Makoto Asai (SLAC) Geant4 Users SLAC Feb. 20th, 2002 Stack management, Digitization and Pile-up.

Slides:



Advertisements
Similar presentations
The Geant4 Kernel: Status and Recent Developments John Apostolakis, Gabriele Cosmo – CERN / PH Makoto Asai – SLAC On behalf the Geant4 collaboration April.
Advertisements

Geant4 v9.2p02 Speed up Makoto Asai (SLAC) Geant4 Tutorial Course.
Geant4 v9.2p02 Kernel II Makoto Asai (SLAC) Geant4 Tutorial Course.
IEEE Nuclear Science Symposium and Medical Imaging Conference Short Course The Geant4 Simulation Toolkit Sunanda Banerjee (Saha Inst. Nucl. Phys., Kolkata,
Geant4 v9.2p02 Scoring II Makoto Asai (SLAC) Geant4 Tutorial Course.
Welcome to Geant4 Users ’ Workshop Makoto Asai (SLAC) Feb. 18 th – 22 th, 2002.
Primary particle generation Makoto Asai (SLAC) Geant4 Users CERN Nov. 12 th, 2002.
Makoto Asai (SLAC) Geant4 Users SLAC Feb. 18 th, 2002 Getting Started.
Primary particle generation Makoto Asai (SLAC) Geant4 Users SLAC Feb. 18 th, 2002.
Makoto Asai (SLAC) Geant4 Users CERN Nov. 15 th, 2002 Customizing Run Management.
Makoto Asai (SLAC) Geant4 Users CERN Nov. 12 th, 2002 Detector Sensitivity.
Geant4 v9.4 Primary Particle Makoto Asai (SLAC) Geant4 Tutorial Course.
Makoto Asai (SLAC) Geant4 Users SLAC Feb. 18 th, 2002 Detector Sensitivity.
Makoto Asai (SLAC) Geant4 Users CERN Nov. 11 th, 2002 Getting Started.
Makoto Asai (SLAC) Geant4 Users SLAC Feb. 18 th, 2002 Getting Started.
Scoring II Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01.
Makoto Asai (SLAC) Geant4 Users SLAC Feb. 20th, 2002 Stack management, Digitization and Pile-up.
Geant4 v9.3 Scoring II Makoto Asai (SLAC) Geant4 Tutorial Course.
Primary particle generation Makoto Asai (SLAC) Geant4 Users SLAC Feb. 18 th, 2002.
Makoto Asai (SLAC) Geant4 Users CERN Nov. 13th, 2002 Stack management, Digitization and Pile-up.
Some tips for geometries of medical applications Makoto Asai (SLAC)
INPUT/OUTPUT ORGANIZATION INTERRUPTS CS147 Summer 2001 Professor: Sin-Min Lee Presented by: Jing Chen.
17-19 Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan 2007 Geant4 Japan.
parameterisation The aim of the exercise is again to build a lead-scintillator calorimeter, this time though the calorimeter will be a trapezoid.
Marc Verderi - IN2P3 SLAC User's Workshop.1 Introduction G EANT4 has been designed to allow users to implement new processes the kernel will treat as any.
Geant4 Training 2003 Basic structure of the Geant4 Simulation Toolkit The full set of lecture notes of this Geant4 Course is available.
Maria Grazia Pia Detector Response Acknowledgements: A. Lechner, J. Apostolakis, M. Asai, G. Cosmo, A. Howard.
Basic Structure of the Geant4 Simulation Toolkit
Primary particle Giovanni Santin ESA / ESTEC and RheaTech Ltd On behalf of the Geant4 collaboration Ecole Geant4 Annecy, and Nov 2008 With.
Geant4 internal Classes and Objects Gunter Folger / CERN Geant4 course, Annecy 2008 User Action & Information Classes.
山下智弘 JST CREST/ 神戸大学 Borrowing especially from presentations of M. Asai(SLAC) Geant4 Japan Oct, RCNS, based on Geant4 9.0.p01.
User Application Luciano Pandola INFN-LNGS Partially based on a presentation by Maria Grazia Pia (INFN-Ge)
17-19 Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan 2007 Geant4 Collaboration.
Geant4 internal Classes and Objects Geant4 Users’ Tutorial February 2010 Gunter Folger / CERN User Action & Information Classes.
Maria Grazia Pia INFN Genova Salamanca, July 2002
CBM Software Meeting 1 CBM Simulation & Analysis Framework Geant3 / Gean4 configuration M. Al-Turany, D. Bertini.
Basics of Primary Particle Generation and Tracking Makoto Asai (SLAC) Geant4 Tutorial CERN May 25-27, 2005 May 2005, Geant4 v7.0p01.
Run and Event G4Run and G4RunManager In Geant4, the Run is the largest unit of simulation and it consist of a series of events Within a Run, the detector.
Makoto Asai (SLAC) Getting Started MGP: added class diagram of basic user application.
Geant4 internal Classes and Objects Gunter Folger / CERN MC-PAD, DESY/Hamburg January 2010 User Action & Information Classes.
Geant4 release 5.1 summary Gabriele Cosmo EP/SFT.
Read-out and detector response
Physics II : processes Paris Geant4 Tutorial 5 June 2007 Marc Verderi Ecole Polytechnique - LLR.
Makoto Asai.  Parallel layered mass geometry  Other minor improvement  G4Exception.
Maria Grazia Pia Retrieving information from kernel Acknowledgements: A. Lechner, J. Apostolakis, M. Asai, G. Cosmo, A. Howard.
Makoto Asai.  In the past, material is considered only if it appears in the mass (tracking) world. The user might define parallel world(s) for artificial.
Interaction with the Geant4 kernel
J. Apostolakis, M. Asai, G. Cosmo, A. Howard
Makoto Asai (SLAC) Geant4 Tutorial Course
Interaction with the Geant4 kernel
Basics of a user application
Geant4:User Actions and Analysis
Makoto Asai (SLAC) Geant4 Tutorial Course
Geant4 introduction 2008/03/18 Nobu Katayama KEK
Makoto Asai (SLAC) Geant4 Users CERN Nov. 11th, 2002
Read-out and detector response
Makoto Asai (SLAC) Geant4 Tutorial Course
Detector sensitivity Makoto Asai (SLAC Computing Services)
A shortcut to the tracking
Makoto Asai (SLAC) Geant4 Tutorial Course
Read-out and detector response
Makoto Asai (SLAC) Geant4 Tutorial Course
Makoto Asai (SLAC) Geant4 Tutorial Course
User Application
The full set of lecture notes of this Geant4 Course is available at
Customizing Run Management
The full set of lecture notes of this Geant4 Course is available at
Kernel Author: Makoto Asai.
Geant4: Detector description module
Simulation in Experiments searching for rare events
Presentation transcript:

Makoto Asai (SLAC) Geant4 Users SLAC Feb. 20th, 2002 Stack management, Digitization and Pile-up

2Introduction  This tutorial covers the features of –Stack management –Digitization –Multiple events handling and pile-up  These features are not necessary for naïve simulation. But using them, you can made your simulation program more flexible and efficient.

3 Stack management  By default, Geant4 has three track stacks. –“Urgent”, “Waiting”, “PostponeToNextEvent” –Tracks are popped out only from Urgent stack. –Once Urgent stack becomes empty, tracks in Waiting stack are moved to Urgent stack. –UserStackingAction class classifies each track which stack to be pushed in (or killed). –By utilizing stacks, you can manage priorities of the tracks without “highest priority scan”. –You can add stacks for more intelligent stack management.  Proper stack management and selection/abortion of event gives you better performance of your simulation.

Stack management Event Manager Tracking Manager Stacking Manager User Stacking Action Urgent Stack Waiting Stack Postpone To Next Event Stack Push Pop Push Pop Classify secondary or suspended tracks Process One Track primary tracks

5G4UserStackingAction  G4UserStackingAction class has three methods.  void NewStage() –Invoked when Urgent stack becomes empty –Move tracks in Waiting stack to Urgent stack –Or issue stackManager->ReClassify() thus all tracks in Waiting stack will be re-examined by ClassifyNewTrack method  G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track*) –Invoked every time a track is pushed in –Classification fUrgent // pushed into Urgent stack fWaiting // pushed into Waiting stack fPostpone // pushed into PostponeToNextEevnt fKill // killed  void PrepareNewEvent() –Invoked at the beginning of new event

6G4UserStackingAction ExampleN04 gives you a good example of stack management.  This example code has a simplified collider detector geometry and event sample of Higgs particle decays into muons.  It has three stages 0) Primary muons 1) Primary charged particles within the tracking region 2) Primary neutral particles and secondaries in “Region of Interest”

7 At the beginning of an event (Stage 0), only primary muons are pushed into Urgent stack and others to Waiting stack. G4ClassificationOfNewTrack ExN04StackingAction::ClassifyNewTrack(const G4Track * aTrack) { G4ClassificationOfNewTrack classification = fWaiting; switch(stage) { case 0: if(aTrack->GetParentID()==0) { G4ParticleDefinition * particleType = aTrack->GetDefinition(); if((particleType==G4MuonPlus::MuonPlusDefinition()) ||(particleType==G4MuonMinus::MuonMinusDefinition())) { classification = fUrgent; } } break; } return classification;

8 When Urgent stack becomes empty (end of stage 0), number of hits in muon counters are examined –Event is aborted if reasonable numbers of hits are NOT found, otherwise proceed to next stage. void ExN04StackingAction::NewStage() { stage++; G4int nhits; if(stage==1) { muonHits = (ExN04MuonHitsCollection*) GetCollection("muonCollection"); nhits = muonHits->entries(); if(nhits<reqMuon) { stackManager->clear(); // Event abortion return; } stackManager->ReClassify(); // New classification return; }

9 At stage 1 only primary charged tracks are pushed into Urgent stack G4ClassificationOfNewTrack ExN04StackingAction::ClassifyNewTrack(const G4Track * aTrack) { G4ClassificationOfNewTrack classification = fWaiting; switch(stage) { case 1: if(aTrack->GetParentID()!=0) { break; } if(aTrack->GetTrackStatus()==fSuspend) { break; } if(aTrack->GetDefinition()->GetPDGCharge()==0.) { break; } classification = fUrgent; break; } return classification; }

10 Each charged primary track except muon is traced in the tracking region and suspended and pushed back to Waiting Stack once it reaches to calorimeter. void ExN04SteppingAction::UserSteppingAction(const G4Step * theStep) { // select charged primary track except muon G4Track * theTrack = theStep->GetTrack(); if(theTrack->GetTrackStatus()!=fAlive) { return; } if(theTrack->GetParentID()!=0) { return; } G4ParticleDefinition * particleType = theTrack->GetDefinition(); if((particleType==G4MuonPlus::MuonPlusDefinition()) ||(particleType==G4MuonMinus::MuonMinusDefinition())) { return; } // check if it is entering to the calorimeter volume G4StepPoint * thePrePoint = theStep->GetPreStepPoint(); G4VPhysicalVolume * thePrePV = thePrePoint->GetPhysicalVolume(); G4String thePrePVname = thePrePV->GetName(); if(thePrePVname(0,4)=="calo") { return; } G4StepPoint * thePostPoint = theStep->GetPostStepPoint(); G4VPhysicalVolume * thePostPV = thePostPoint->GetPhysicalVolume(); G4String thePostPVname = thePostPV->GetName(); if(thePostPVname(0,4)!="calo") { return; } // then suspend the track theTrack->SetTrackStatus(fSuspend); }

11 Remaining senario  At the end of stage 1, hits in tracking chambers are examined –Event is aborted if reasonable numbers of isolated muons are NOT found  In stage 2, neutral primary tracks and secondary tracks only inside of “Region of Interest” are pushed into Urgent stack and traced. –I.e. Shower is simulated only inside of RoI.

12Digitization  Digit represents a detector output (e.g. ADC/TDC count, trigger signal).  Digit is created with one or more hits and/or other digits by a concrete implementation derived from G4VDigitizerModule.  In contradiction to the Hit which is generated at tracking time automatically, the digitize() method of each G4VDigitizerModule must be explicitly invoked by the user’s code (typically at EndOfEventAction).

13Digitization  The usages of methods in G4VDigitizerModule is similar to those of G4VSensitiveDetector. –Constructor Registration of digits collection name(s) –Digitize() method Get hits from proper hits collections and/or digits from proper digits collections Generate digit(s) and store to dedicated digits collection(s) Set created digits collections to G4DCofThisEvent via StoreDigiCollection() method. –G4VDigitizerModule does NOT have initialize() or EndOfEvent() methods.

14 Usuful methods in G4DigiManager –static G4DigiManager* GetDMpointer(); Static method which returns the pointer to G4DigiManager singleton object –void AddNewModule(G4VDigitizerModule*); Register a digitizer module to G4DigiManager –G4VDigitizerModule* FindDigitizerModule(G4String); Return the pointer to the digitizer module of given name –G4int GetHitsCollectionID(G4string); –G4int GetDigiCollectionID(G4string); Return the hits / digits collection ID of given name –const G4VHitsCollection* GetHitsCollection(G4int); –const G4VDigiCollection* GetDigiCollection(G4int); Return the pointer to hits / digits collection of given ID Cast to the concrete collection class

15 Sample implementation of Digitizer G4DigiManager* DM = G4DigiManager::GetDMpointer(); G4int HCID = DM->GetHitsCollectionID(”/mydet/col1”); MyDigiCollection* myDigiCol = new MyDigiCollection(theDigitizer, collectionName[0]); MyHitsCollection* myHitsCol = (MyHitsCollection*)(DM->GetHitsCollection(HCID)); G4int nHits = myHitsCol->entries(); for(G4int I=0;I<nHits;I++) { MyDigit* aDigit = new MyDigit((*myHitsCol)[i]); myDigiCol->insert(aDigit); } StoreDigiCollection(myDigiCol);

16 Multi-event treatment and pile-up  By design, G4EventManager cannot process more than one events. –Previous events kept by G4RunManager are read-only.  Invoke your Digitizer to generate digits / digits collection using collections of previous events. Generated collections are set to the current event.  G4DigiManager provides methods to access to hits / digits collection of previous events. const G4VHitsCollection* GetHitsCollection(G4int colID,G4int nPrevEv); const G4VDigiCollection* GetDigiCollection(G4int colID,G4int nPrevEv); Don’t forget to invoke G4RunManager::SetNumberOfEventsToBeStored() method beforehand.