Message: Setting TrackID Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Setting TrackID 

Forum: Event and Track Management
Date: 09 Mar, 2009
From: Tom Roberts <Tom Roberts>

What is the proper way to set the TrackID of a track inside my GeneratePrimaries(G4Event *event) ?

Note that this does not work (specifically the last line of this snippet), and the track's TrackID gets reset to 1 at the start of tracking:

        particleGun->SetParticleTime(time);
        particleGun->SetParticlePosition(pos);
        particleGun->SetParticleEnergy(ke);
        particleGun->SetParticleMomentumDirection(direction);
        particleGun->GeneratePrimaryVertex(event);
        event->SetEventID(eventID);
        event->GetPrimaryVertex()->SetWeight(weight);
        event->GetPrimaryVertex()->GetPrimary()->SetTrackID(trackId);

I am reading a file of existing tracks, and I want to: a) preserve the TrackID's of all tracks, and b) ensure that generated secondaries do not duplicate any TrackIDs that came from the file. Here there is just a single track in the event, but soon I'll have multiple tracks (and possibly multiple vertexes).

Note that my code does not use the primary vertex at all, except to pass a weight into the track. Is there some way I can just create some G4Track-s myself and stack them, rather than jumping through hoops to use G4ParticleGun?

A quick glance at G4EventManager.cc indicates to me that this appears to be impossible, unless I re-write TrackIDs in UserStackingAction or PreUserTrackingAction, which would be complex and fragile. Or do I need to write my own RunManager and EventManager?

Has nobody ever done this before? (I have been living with re-numbered TrackIDs for years, but now it has become a problem.)

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Setting TrackID   (Makoto Asai - 11 Mar, 2009)
 Add Message Add Message
to: "Setting TrackID"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]