Top Banner
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 With the help of Geant 4 examples! Useful links: http://geant4.web.cern.ch/geant4/G4UsersD ocuments/ UsersGuides / ForApplicationDeveloper/ html/index.html
19

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.

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 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.

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

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/

Page 2: 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.

S. Guatelli, M.G Pia, INFN Genova

I will show:

1. Which Geant4 User classes are suited for :

Book histograms and ntuplesBook histograms and ntuples

Fill histograms and ntuplesFill histograms and ntuples

Store histograms and ntuple in a file Store histograms and ntuple in a file

2. Examples and results of analysis

in Geant 4 Applications

Page 3: 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.

S. Guatelli, M.G Pia, INFN Genova

Mandatory user classes

Management of Physical Processes

Management of Primary Particles

Management of the Geometry

The user must override their methods to build up a smulation!

The user must override their methods to build up a smulation!

Page 4: 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.

S. Guatelli, M.G Pia, INFN Genova

Optional User Action

Run Action Run Action

TrackTrack

Stepping ActionStepping Action

Event ActionEvent Action

Page 5: 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.

S. Guatelli, M.G Pia, INFN Genova

Page 6: 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.

S. Guatelli, M.G Pia, INFN Genova

Run ActionA run is a collection of events that share

a common beam and a detector

the detector geometry

the set up of sensitive detectors

the physics processes

Within a run, you should keep unchanged

G4UserRunAction user action : class from which you can derive your own concrete class RunAction

MethodbeginOfRunAction()

invoked at the very end of the beamOn()

endOfRunAction() endOfRunAction()

invoked at the beginning of the beamOn()

What you can do

• set a run identification number

•book histograms

•set run specific conditions of the sensitive detectors

•store/print histograms

•manipulate run summaries

Method What you can do

Page 7: 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.

S. Guatelli, M.G Pia, INFN Genova

Event actionManagement of the events in terms of

tracks of the particles

hits collections

particle tracking

energy deposit

EndOfEvent Action

Method

Visualisation of

the tracks

Eg. information about

Page 8: 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.

S. Guatelli, M.G Pia, INFN Genova

Stepping Action

PERFORMANCE TIP !

Avoid stepping action if possible and use hits and tracking action.

G4Step Delta of position / time between Pre and PostStepPoint

Step length

Total energy deposited during the step

information of the final status of a particle after the completion of a step

for example:

transient information of the step

Tracking Action

for example:

Position

kinetic energy

trackID number

Page 9: 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.

S. Guatelli, M.G Pia, INFN Genova

Brachytherapy example: analysis with AIDA

Page 10: 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.

S. Guatelli, M.G Pia, INFN Genova

How to build the analysis in a

Geant4 Application

1. Management of ntuple and histograms

2. Create the file to store the data

3. Book histos and ntples

From brachytherapy example

Page 11: 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.

S. Guatelli, M.G Pia, INFN Genova

4. Fill histograms

and ntuples 5. Method Finish()

Close histo and ntuple

Close the file

How to build the analysis in a

Geant4 Application

From brachytherapy example

Page 12: 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.

S. Guatelli, M.G Pia, INFN Genova

At the beginning At the beginning of the BeamOn()of the BeamOn()

Run Action: Management of the Analysis

At the end of the At the end of the BeamOn()BeamOn()

1.open the file

2.create the ntuple and the histograms Book

Finish 1.close the ntuples and histos

2.close the fileFrom brachytherapy example

Page 13: 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.

S. Guatelli, M.G Pia, INFN Genova

Information aboutenergy deposit

1. Gets the information about the energy deposit from the Hits Collection

Example 1

In the Event Action

From brachytherapy example

Page 14: 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.

S. Guatelli, M.G Pia, INFN Genova

Example 1

3. Gets information of:

Energy deposit

Spatial coordinates

4. A histogram and a ntuple are filled with energy deposit

Now everything is ok !

From brachytherapy example

Page 15: 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.

S. Guatelli, M.G Pia, INFN Genova

Storage of

the energy deposit in a ntuple

you can select the energy deposit in planes and represent them in histograms

Geometric set-up

Brachytherapy example

Page 16: 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.

S. Guatelli, M.G Pia, INFN Genova

Example of a result

Simulation of a radioactive

source

The energy deposit fills a 2Dhistogram … … Elaboration of the data stored

0.16 mGy =100%

Isodose curves

Geometric set-up

From brachytherapy example

Page 17: 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.

S. Guatelli, M.G Pia, INFN Genova

Example 2

Histogram of the initial energy of primary particles

The informationThe information is stored in 1D histois stored in 1D histo

ResultResult

From brachytherapy example

In the Primary Action

Primary particle energyPrimary particle energy

Page 18: 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.

S. Guatelli, M.G Pia, INFN Genova

Example 3

range

1. Particle position when the kinetic energy is zero

3. The information3. The information is stored in 1D histois stored in 1D histo

2. range

e- range test S. Guatelli, V. Ivantchenko

In the Stepping

Action

Page 19: 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.

S. Guatelli, M.G Pia, INFN Genova

ResultResult

Example 3 e- range test

S. Guatelli, V. Ivantchenko

Range