180 likes | 197 Views
Detailed overview of Geant4 kernel features including stacking mechanism, track stacks, primary particle generation, and pre-assigned decay products. Learn how to efficiently manage tracks and events for simulation optimization.
E N D
May 2005, Geant4 v7.0p01 More on Geant4 kernel Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005
Contents • Stacking mechanism • Primary particle generation • Pre-assigned decay products • Bookkeeping issues • Importing “exotic” primary particles More on Geant4 Kernel - M.Asai (SLAC)
Track stacks in Geant4 • By default, Geant4 has three track stacks. • "Urgent", "Waiting" and "PostponeToNextEvent" • Each stack is a simple "last-in-first-out" stack. • User can arbitrary increase the number of stacks. • ClassifyNewTrack() method of UserStackingAction decides which stack each newly storing track to be stacked (or to be killed). • By default, all tracks go to Urgent stack. • A Track is popped up only from Urgent stack. • Once Urgent stack becomes empty, all tracks in Waiting stack are transferred to Urgent stack. • And NewStage() method of UsetStackingAction is invoked. • Utilizing more than one stacks, user can control the priorities of processing tracks without paying the overhead of "scanning the highest priority track" which was the only available way in Geant3. • Proper selection/abortion of tracks/events with well designed stack management provides significant efficiency increase of the entire simulation. More on Geant4 Kernel - M.Asai (SLAC)
primary tracks End OfEvent Pop Classify NewStage Prepare New Event Reclassify Push Push Process One Track Pop Transfer Pop secondary and suspended tracks Push Deleted Transfer Push RIP Stacking mechanism User Stacking Action Temporary Stack Event Manager Urgent Stack Urgent Stack Stacking Manager Waiting Stack Waiting Stack Tracking Manager Postpone To Next Event Stack Postpone To Next Event Stack More on Geant4 Kernel - M.Asai (SLAC)
G4UserStackingAction • User has to implement three methods. • G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track*) • Invoked every time a new track is pushed to G4StackManager. • Classification • fUrgent - pushed into Urgent stack • fWaiting - pushed into Waiting stack • fPostpone - pushed into PostponeToNextEvent stack • fKill - killed • void NewStage() • Invoked when Urgent stack becomes empty and all tracks in Waiting stack have been transferred to Urgent stack. • All tracks which have been transferred from Waiting stack to Urgent stack can be reclassified by invoking stackManager->ReClassify() • void PrepareNewEvent() • Invoked at the beginning of each event for resetting the classification scheme. More on Geant4 Kernel - M.Asai (SLAC)
ExN04StackingAction • ExampleN04 has simplified collider detector geometry and event samples of Higgs decays into four muons. • Stage 0 • Only primary muons are pushed into Urgent stack and all other primaries and secondaries are pushed into Waiting stack. • All of four muons are tracked without being bothered by EM showers caused by delta-rays. • Once Urgent stack becomes empty (i.e. end of stage 0), number of hits in muon counters are examined. • Proceed to next stage only if sufficient number of muons passed through muon counters. Otherwise the event is aborted. More on Geant4 Kernel - M.Asai (SLAC)
ExN04StackingAction • Stage 1 • Only primary charged particles are pushed into Urgent stack and all other primaries and secondaries are pushed into Waiting stack. • All of primary charged particles are tracked until they reach to the surface of calorimeter. Tracks reached to the calorimeter surface are suspended and pushed back to Waiting stack. • All charged primaries are tracked in the tracking region without being bothered by the showers in calorimeter. • At the end of stage 1, isolation of muon tracks is examined. More on Geant4 Kernel - M.Asai (SLAC)
ExN04StackingAction • Stage 2 • Only tracks in "region of interest" are pushed into Urgent stack and all other tracks are killed. • Showers are calculated only inside of "region of interest". • Finding uninteresting events at the earliest possibilities and aborting them without consuming unnecessary CPU time is quite essential for the efficient simulation. • Stacking mechanism is the place to do this trick. • Also quite efficient with event biasing or memory-intensive simulation. More on Geant4 Kernel - M.Asai (SLAC)
G4PrimaryParticle G4Track m- B- B- B- D0 m- m+ D0 m- D0 nm nm nm D0 K- K- m+ nm K- m+ nm K- m+ nm pre-assigned decay products nm Pre-assigned decay products • Physics generator can assign a decay channel for each individual particle separately, while in Geant4 you cannot specify a decay channel for each particle. • Decay chain can be imported into Geant4. • A parent particle in the form of G4Track object travels in the detector, bringing “pre-assigned” decay daughters as objects of G4DynamicParticle. • When the parent track comes to the decay point, pre-assigned daughters become to secondary tracks, instead of randomly selecting a decay channel defined to the particle type. More on Geant4 Kernel - M.Asai (SLAC)
Bookkeeping issues • Connection from G4PrimaryParticle to G4Track G4int G4PrimaryParticle::GetTrackID() • Returns the track ID if this primary particle had been converted into G4Track, otherwise -1. • Both for primaries and pre-assigned decay products • Connection from G4Track to G4PrimaryParticle G4PrimaryParticle* G4DynamicParticle::GetPrimaryParticle() • Returns the pointer of G4PrimaryParticle object if this track was defined as a primary or a pre-assigned decay product, otherwise null. • G4VUserPrimaryVertexInformation, G4VUserPrimaryParticleInformation and G4VUserTrackInformation can be utilized for storing additional information. • Information in UserTrackInformation should be then copied to user-defined trajectory class, so that such information is kept until the end of the event. More on Geant4 Kernel - M.Asai (SLAC)
RE01TrackInformation PrimaryTrackID = 1SourceTrackID = 1 Examples/extended/runAndEvent/RE01 PrimaryTrackID = 1SourceTrackID = 1 PrimaryTrackID = 1SourceTrackID = 1 • An example for connecting G4PrimaryParticle, G4Track, hits and trajectories, by utilizing G4VUserTrackInformation and G4VUserRegionInformation. • SourceTrackID means the ID of a track which gets into calorimeter. • PrimaryTrackID is copied to UserTrackInformation of daughter tracks. • SourceTrackID is updated for secondaries born in tracker, while just copied in calorimeter. PrimaryTrackID = 1SourceTrackID = 1 PrimaryTrackID = 1SourceTrackID = 4 PrimaryTrackID = 1SourceTrackID = 4 PrimaryTrackID = 1SourceTrackID = 3 PrimaryTrackID = 1SourceTrackID = 4 PrimaryTrackID = 1SourceTrackID = 4 PrimaryTrackID = 2SourceTrackID = 2 More on Geant4 Kernel - M.Asai (SLAC)
Trajectory of track6782 Tracker hits of track6782 Calorimeter hits of track6782 Examples/extended/runAndEvent/RE01 Energy deposition includes not only muon itself but also all secondary EM showers started inside the calorimeter. More on Geant4 Kernel - M.Asai (SLAC)
RE01RegionInformation • This example RE01 has three regions, i.e. default world region, tracker region and calorimeter region. • Each region has its unique object of RE01RegionInformation class. class RE01RegionInformation : public G4VUserRegionInformation { … public: G4bool IsWorld() const; G4bool IsTracker() const; G4bool IsCalorimeter() const; … }; • Through step->preStepPoint->physicalVolume->logicalVolume->region-> regionInformation, you can easily identify in which region the current step belongs. • Don’t use volume name to identify. More on Geant4 Kernel - M.Asai (SLAC)
Importing “exotic” particles • “Exotic” particle means a type of particle that Geant4 physics processes do notknow how to deal with and would never generate as a secondary. • It is thus not provided as a class in particle category of Geant4 distribution. • E.g. Higgs, W/Z boson, SUSY particle, r-hadron, monopole, black hole, etc. • “Exotic” particle also includes a type of particle that should not be seen outside of a hadron. • It is used inside Geant4 processes, but it should not be treated as a track. • E.g. quark, gluon. • Such exotic particle can be imported as a G4PrimaryParticle object. • It should have pre-assigned decay products (if it decays), since Geant4 does not know how it decays. • There are two kinds of exotic particles from the view point of Geant4. We have to deal them separately. • Particles that immediately decay without traveling finite distance. • Particles that travel a distance meaningful to Geant4 tracking. More on Geant4 Kernel - M.Asai (SLAC)
Exotic particle that decays immediately • As a default, Geant4 ignores such exotic particle and takes its pre-assigned decay products as primaries. • Anyway, such a particle should not travel through your geometry. • In case you want to see it as a primary track (so that it has a unique track ID and it is recorded as a trajectory), use G4UnknownParticle. • G4UnknownParticle must be defined in your physics list with G4UnknownDecay process attached. • G4UnknownDecay process immediately enforces such particle to decay in its first step naively using pre-assigned decay products. • Once G4UnknownParticle is defined in your physics list, G4PrimaryTransformer converts whatever the exotic particle to a G4Track object of Unknown. • If you want to limit this conversion to be applied only to some kinds of exotic particle types, create your own PrimaryTransformer to override a method. G4ParticleDefinition* GetDefinition(G4PrimaryParticle*) • If non-null pointer is returned, this primary particle is converted into G4Track (or G4DynamicParticle for pre-assigned decay product). • If null is returned, its pre-assigned decay daughters will be treated as primaries. • Your PrimaryTransformer class must be assigned to G4RunManagerKernel. More on Geant4 Kernel - M.Asai (SLAC)
Exotic particle that travels • As a default, Geant4 cannot deal with such a particle. Geant4 does not know what to do. You have to do the followings to import such exotic particle. • Implement ParticleDefinition concrete class to represent (a family of) exotic particle(s). • Typically one concrete class for each category and each charge state. • MyRHadronZero, MyRHadronPlus, etc. • BMesonStarPlus, BMesonStarMinus, etc. • PDG code in ParticleDefinition object for such exotic particle must be 0, and the mass could be arbitrary value. G4DynamicParticle::GetPDGcode() and G4DynamicParticle::GetMass() will return correct values for each individual track. • Assign reasonable processes to it. • G4Transportation, G4Decay (don’t use G4UnknownDecay), EM processes, hadronic processes(?) • create your own PrimaryTransformer to override a method. G4ParticleDefinition* GetDefinition(G4PrimaryParticle*) • By this method, return proper ParticleDefinition object. More on Geant4 Kernel - M.Asai (SLAC)