190 likes | 202 Views
Learn how to analyze in Geant4, covering user classes, events, tracks, energy tracking, histograms, and more. Get practical examples and tips for effective analysis. Relevant for physics simulations and data interpretation in Geant4 applications.
E N D
Where to put analysis in Geant4 Applications S. Guatelli ( CERN, INFN Genova ) CERN, 13 November 2002 Users Workshop With the help of Geant 4 examples! Useful links: http://geant4.web.cern.ch/geant4/G4UsersDocuments/ UsersGuides/ForApplicationDeveloper/html/index.html http://www.ge.infn.it/geant4/
Book histograms and ntuples I will show: 1. Which Geant4 User classes are suited for : Fill histograms and ntuples Store histograms and ntuple in a file 2. Examples and results of analysis in Geant 4 Applications
Management of Physical Processes • Management of Primary Particles • Management of the Geometry Mandatory user classes The user must override their methods to build up a smulation!
Optional User Action Run Action Event Action Stepping Action Track
A run is a collection of events that share a common beam and a detector Run Action G4UserRunAction user action: class from which you can derive your own concrete class RunAction • the detector geometry • the set up of sensitive detectors • the physics processes Within a run, you should keep unchanged • set a run identification number • book histograms • set run specific conditions of the sensitive detectors Method What you can do beginOfRunAction() invoked at the beginning of the beamOn() Method What you can do • store/print histograms • manipulate run summaries endOfRunAction() invoked at the very end of the beamOn()
Management of the events in terms of tracks of the particles Event action Method • hits collections • particle tracking • energy deposit Eg. information about EndOfEvent Action Visualisation of the tracks
Stepping Action transient information of the step • G4Step Delta of position / time between Pre and PostStepPoint • Step length • Total energy deposited during the step for example: Tracking Action information of the final status of a particle after the completion of a step • Position • kinetic energy • trackID number for example: PERFORMANCE TIP ! Avoid stepping action if possible and use hits and tracking action.
Management of ntuple and histograms Create the file to store the data How to build the analysis in aGeant4 Application Book histos and ntples From brachytherapy example
How to build the analysis in aGeant4 Application 4. Fill histograms and ntuples • 5. Method Finish() • Close histo and ntuple • Close the file From brachytherapy example
1.open the file 2.create the ntuple and the histograms Run Action: Management of the Analysis • Book 1.close the ntuples and histos 2.close the file • Finish From brachytherapy example At the beginning of the BeamOn() At the end of the BeamOn()
Information about energy deposit Example 1 From brachytherapy example • Gets the information about the energy deposit from the Hits Collection In the Event Action
Example 1 From brachytherapy example 3. Gets information of: • Energy deposit • Spatial coordinates 4. A histogram and a ntuple are filled with energy deposit Now everything is ok !
Storage of the energy deposit in a ntuple you can select the energy deposit in planes and represent them in histograms Brachytherapy example Geometric set-up
Example of a result Simulation of a radioactive source Geometric set-up From brachytherapy example The energy deposit fills a 2Dhistogram … … Elaboration of the data stored 0.16 mGy =100% Isodose curves
Example 2 From brachytherapy example Histogram of the initial energy of primary particles Primary particle energy The information is stored in 1D histo In the Primary Action Result
Example 3 range e- range test S. Guatelli, V. Ivantchenko 1. Particle position when the kinetic energy is zero 2. range In the Stepping Action 3. The information is stored in 1D histo
Range Example 3 e- range test S. Guatelli, V. Ivantchenko Result