Geant4:User Actions and Analysis

Slides:



Advertisements
Similar presentations
IEEE Nuclear Science Symposium and Medical Imaging Conference Short Course The Geant4 Simulation Toolkit Sunanda Banerjee (Saha Inst. Nucl. Phys., Kolkata,
Advertisements

Geant4 v9.2p02 Primary Particle Makoto Asai (SLAC) Geant4 Tutorial Course.
Makoto Asai (SLAC) Geant4 Users SLAC Feb. 18 th, 2002 Getting Started.
Makoto Asai (SLAC) Geant4 Users SLAC Feb. 20th, 2002 Stack management, Digitization and Pile-up.
25/03/2003Simulation Application for the LHCb Experiment CHEP March 2003 Presented by: W. Pokorski / CERN Authors: I. Belyaev, Ph. Charpentier,
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.
Geant4 v9.3p01 Primary Particle Makoto Asai (SLAC) Geant4 Tutorial Course.
Makoto Asai (SLAC) Geant4 Users SLAC Feb. 20th, 2002 Stack management, Digitization and Pile-up.
14 Overview of Geant4 Examples 2 nd Finnish Geant4 Workshop 6-7 June 2005 Dennis Wright (SLAC)
S. Guatelli, M.G Pia, INFN Genova S. Guatelli ( CERN, INFN Genova ) CERN, 13 November 2002 Users Workshop Where to put analysis in Geant4 Applications.
Makoto Asai (SLAC) Geant4 Users CERN Nov. 13th, 2002 Stack management, Digitization and Pile-up.
1 Primary particles Geant4 User's Tutorial CERN, February 2010 Talk from previous tutorial by Giovanni Santin Ecole Geant4, Annecy 2008.
Maria Grazia Pia Detector Response Acknowledgements: A. Lechner, J. Apostolakis, M. Asai, G. Cosmo, A. Howard.
Primary particle Giovanni Santin ESA / ESTEC and RheaTech Ltd On behalf of the Geant4 collaboration Ecole Geant4 Annecy, and Nov 2008 With.
W. Pokorski - CERN Simulation Project1 Python binding for Geant4 toolkit using Reflex/PyROOT tool Witek Pokorski EuroPython 2006, CERN, Geneva
Geant4 internal Classes and Objects Gunter Folger / CERN Geant4 course, Annecy 2008 User Action & Information Classes.
User Application Toolkit + User application toolkit Geant4 is a toolkit –i.e. you cannot “run” it out of the box –You must write.
User Application Luciano Pandola INFN-LNGS Partially based on a presentation by Maria Grazia Pia (INFN-Ge)
Gaudi Framework Tutorial, April Algorithm Tools: what they are, how to write them, how to use them.
Geant4 internal Classes and Objects Geant4 Users’ Tutorial February 2010 Gunter Folger / CERN User Action & Information Classes.
Geant4 in production: status and developments John Apostolakis (CERN) Makoto Asai (SLAC) for the Geant4 collaboration.
Maria Grazia Pia INFN Genova Salamanca, July 2002
The CMS Simulation Software Julia Yarba, Fermilab on behalf of CMS Collaboration 22 m long, 15 m in diameter Over a million geometrical volumes Many complex.
CBM Software Meeting 1 CBM Simulation & Analysis Framework Geant3 / Gean4 configuration M. Al-Turany, D. Bertini.
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.
Read-out and detector response
N ATIONAL E NERGY R ESEARCH S CIENTIFIC C OMPUTING C ENTER Charles Leggett Prototype GEANT4 Service for ATHENA framework ATLAS Software Workshop Dec 3.
MONTE CARLO TRANSPORT SIMULATION Panda Computing Week 2012, Torino.
Maria Grazia Pia Retrieving information from kernel Acknowledgements: A. Lechner, J. Apostolakis, M. Asai, G. Cosmo, A. Howard.
LHCb Simulation LHCC Computing Manpower Review 3 September 2003 F.Ranjard / CERN.
Interaction with the Geant4 kernel
The Generator Phase in Gauss
The LHCb Software and Computing NSS/IEEE workshop Ph. Charpentier, CERN B00le.
Makoto Asai (SLAC) Geant4 Tutorial Course
GUI Parallel Session Hajime Yoshida
Interaction with the Geant4 kernel
Physical Units Event Data Model Access to MonteCarlo truth
GAUSS - GEANT4 based simulation for LHCb
LHCb Software Tutorial
User Documents and Examples I
LHCb-Italian Software Tutorial
Basics of a user application
Geant4 introduction 2008/03/18 Nobu Katayama KEK
Primary Particle Generation
Makoto Asai (SLAC) Geant4 Users CERN Nov. 11th, 2002
G.A.P.Cirrone, S.E.Mazzaglia - INFN/LNS, Italy
Primary Particle Generation
Read-out and detector response
Detector sensitivity Makoto Asai (SLAC Computing Services)
Makoto Asai (SLAC) Geant4 Tutorial Course
Read-out and detector response
User Application
Simulation Framework Subproject cern
The n-3He Simulation Using Geant4
GAUSS - GEANT4 based simulation for LHCb
Simulation and Physics
User Application
User Application
The full set of lecture notes of this Geant4 Course is available at
The full set of lecture notes of this Geant4 Course is available at
Kernel Author: Makoto Asai.
Primary particle Makoto Asai (SLAC Computing Services)
Geant4: Detector description module
Simulation in Experiments searching for rare events
Presentation transcript:

Geant4:User Actions and Analysis Geant4 user interface User actions Analysis tools External frameworks

Geant4 User Interface Simulation of particle transport and interaction in Geant4 is under control of Geant4 kernel There are a variety of possibilities for user to get intermediate information and to score results of simulation User actions Sensitive detector Physics processes Geant4 26.05.2005 User Actions

Geant4 User Actions G4UserRunAction CMS simulation of SUSY event Begin and end of the run G4UserEventAction Begin and end of an event G4UserTrackingAction Begin and end of tracking of a G4Track G4UserSteppingAction At each step G4UserStackingAction Classification of new G4Track CMS simulation of SUSY event Geant4 26.05.2005 User Actions

Geant4 User Actions Interfaces of user action use const references and pointers to preserve Geant4 kernel from user interventions: void G4UserRunAction::BeginOfRunAction(const G4Run* run) void G4UserRunAction::EndOfRunAction(const G4Run* run) void G4UserEventAction::BeginOfEventAction(const G4Event* evt) void G4UserEventAction::EndOfEventAction(const G4Event* evt) G4ClassificationOfNewTrack G4UserStackingAction::ClassifyNewTrack(const G4Track* track) G4ClassificationOfNewTrack = fUrgent - put into urgent stack fWaiting - put into waiting stack fPostpone - postpone to the next event fKill - kill without stacking Geant4 26.05.2005 User Actions

Geant4 User Actions When G4Track is taken from a stack for tracking the user action is invoked: void G4UserTrackingAction::PreUserTrackingAction (const G4Track* track) Information is available about mother particle, vertex, position, 4-momentum, creation process, etc After the end of tracking the user action is invoked: void G4UserTrackingAction::PostUserTrackingAction (const G4Track* track) Tracking action allows to control event history Geant4 26.05.2005 User Actions

Geant4 User Actions At each step user have access to complete information about each step of simulation void G4UserSteppingAction::UserSteppingAction (const G4Step* step) The pointer to G4Step allows to access other instances: const G4Track* track = step->GetTrack(); const G4StepPoint* prePoint = step->GetPreStepPoint(); const G4StepPoint* postPoint = step->GetPostStepPoint(); WARNING: user code may be source of CPU penalty All what can be done using sensitive detector approach, can be also done inside UserSteppingAction for complete responsibility of the user Inside G4UserSteppingAction the complete navigation in the geometry tree needs to be done Sensitive Detector is called only if step is performed inside corresponding volume Geant4 26.05.2005 User Actions

G4UserSteppingAction example // example/extended/electromagnetic/MuonProcesses void SteppingAction::UserSteppingAction( const G4Step* aStep ) { G4StepPoint* prePoint = aStep->GetPreStepPoint(); G4StepPoint* postPoint = aStep->GetPostStepPoint(); //plot energy transfered G4double kinEnergyPreStep = prePoint->GetKineticEnergy(); G4double kinEnergyPostStep = prePoint->GetKineticEnergy(); G4double lgepsE = 1.0 – kinEnergyPostStep/ kinEnergyPreStep; if (etrans > 0.) lgepsE = std::log10(lgepsE); //count processes G4String procName = postPoint->GetProcessDefinedStep()->GetProcessName(); G4int id = 0; if (procName == "muIoni") id = 1; if (procName == "muPairProd") id = 2; if (procName == "muBrems") id = 3; if (procName == "muNucl") id = 4; histoManager->FillHisto(id,lgepsE); } Geant4 26.05.2005 User Actions

Verbosity Standard Geant4 verbosity can be activated via UI commands: /run/verbose 1 /event/verbose 1 /tracking/verbose 1 User have a possibility to have additional verbosity in user action classes It is possible to have user implementation of G4VSteppingVerbose class, for example, $G4INSTALL/example/extended/electromagnetic/TestEm1 Geant4 26.05.2005 User Actions

Analysis Tools Analysis tools allow to store histograms, nTuples, and other objects with results of Geant4 simulation Geant4 has no any native analysis tool – it is external software There are several Geant4 examples using analysis tools: examples/extended/analysis/ examples/extended/electromagnetic examples/advanced Available tools: PI (CERN) ROOT (CERN) JAS (SLAC) Open Scientist (LAL) AIDA interfaces Output formats: hbook, root, xml Analysis software are under intensive development Geant4 26.05.2005 User Actions

Example of Analysis - TestEm7 class RunAction : public G4UserRunAction { public: RunAction(DetectorConstruction*, PhysicsList*, PrimaryGeneratorAction*); ~RunAction(); void BeginOfRunAction (const G4Run*); void EndOfRunAction (const G4Run*); // Specific methods for the example void FillTallyEdep (G4int n, G4double e) {tallyEdep[n] += e;}; G4double GetBinLength() {return binLength;}; G4double GetOffsetX() {return offsetX;} void FillHisto(G4int id, G4double x, G4double weight = 1.0); void AddProjRange (G4double x) {projRange += x; projRange2 += x*x;}; private: void bookHisto(); // Access to external software void cleanHisto(); // Specific members of the example DetectorConstruction* detector; PhysicsList* physics; PrimaryGeneratorAction* kinematic; G4double* tallyEdep; G4double binLength; G4double offsetX; G4double projRange, projRange2; // AIDA interfaces AIDA::IAnalysisFactory* af; AIDA::ITree* tree; AIDA::IHistogram1D* histo[1]; }; Geant4 26.05.2005 User Actions

External Frameworks Each large HEP project has a software framework and Geant4 as a toolkit can be driven by the framework User actions are used to exchange data between Geant4 kernel and the framework Factory approach: many specialized user actions There are also useful tools built on top of Geant4, which can be used in small projects Geant4 26.05.2005 User Actions

BaBar (SLAC, Stanford) - Leader Experiment Using Geant4 D.Wright, 2003 Geant4 26.05.2005 User Actions

LHCb: Gauss Application (2004) Pythia, EvtGen etc JobOpts Int.face Geant4 GiGa Cnv JobOpts LHCb Event model Exchange model MCParticle MCVertex MCHits HepMC POOL POOL Event generation Detector Simulation Two phases primary event generator specialized decay package pile-up generation geometry (LHCb  G4) tracking through materials (G4) hit creation ( G4  LHCb ) MC truth generation (G4  LHCb) Geant4 26.05.2005 User Actions

GATE Software for Tomography Geant4 26.05.2005 User Actions

General Radiation Analysis for Space - GRAS New project of ESA Service for radiation studies for space applications Generic dosimetry and analysis Can be applied for studying of different problems Available for testers, public release soon Geant4 26.05.2005 User Actions

Conclusion remarks The Geant4 toolkit provides a wide choice of user actions allowing detailed monitoring of the simulation It is user’s responsibility to choose and design of user actions and/or analysis engine In Geant4 examples (novice, extended, advanced) there are proposed solutions for different use-cases User actions may require extra CPU and/or memory Geant4 26.05.2005 User Actions