Title: Usage and results
1Usage and results
http//cern.ch/geant4/geant4.html http//www.ge.in
fn.it/geant4/
- Maria Grazia Pia
- INFN Genova
- Maria.Grazia.Pia_at_cern.ch
http//www.ge.infn.it/geant4/training/
2Todays exercise
Tomorrows lecture
- A real-life example
- simulation analysis in a simple experimental
set-up - By-products
- an overview of Geant4
- an overview of OO Analysis Tools
- a practical example how to use Geant4 and
AIDA/Anaphe - an introduction to software process
- an introduction to basics concepts of OO
technology
- Applications and results of Geant4
- large-scale HEP experiments
- small-scale HEP experiments
- astroparticle experiments
- space science
- radiotherapy
- Discussion
3through a real-life simulation analysis
and AIDAAnaphe
http//cern.ch/geant4/ http//www.ge.infn.it/geant
4/ http//cern.ch/anaphe/
- Maria Grazia Pia
- INFN Genova
- Maria.Grazia.Pia_at_cern.ch
4The experimental set-up of our exercise
- A simple configuration, consisting of
- a tracking detector
- an electromagnetic calorimeter
- a system of anti-coincidences
- What happens in our detectors
- incident particles interact in the experimental
set-up - secondary particles may be generated and interact
too - detectors and their read-out electronics record
the effects produced by primary and secondary
particles
5What shall we do now?
Sit in front of a PC and start writing code
Wonder what we want to do
Ask our boss what he wants us to do
Chat with collaborators in the experiment
Ask and think and plan and analyse and design and
develop and test and get feedback and ask and
think and plan and analyse and design and develop
and test and get feedback and ask and think and
Software process
6The software life-cycle
- A software process
- provides guidance to a teams activities
- specifies which work products should be produced
and when - offers criteria for monitoring and measuring the
projects products and activities
- Complexity is never overwhelming
- only tackle small bits at a time
- Early feedback from using the software
- provides input to the analysis of subsequent
iterations - Developers skills can grow with the project
- dont need to apply latest techniques/technology
at the start - Requirements can be modified
- each iteration is a mini-project (analysis,
design)
Advantages of iterative and incremental
development
7Software Process
SEIs definition A set of activities, methods,
practices and transformations that people use to
develop and maintain software and associated
products
- Three key components
- the people involved
- the organization of the development process
- the technology used
- Reference for guidance and assessment
- Capability Maturity Model (CMM)
- SPICE/ISO 15504
- Various software process models
- USDP / RUP
- OPEN
- OOSP
- XP, Agile etc.
- waterfall
USDP
8Best practices
- The goal
- to ensure the production of high-quality software
- that meets the needs of its end users
- within a predictable schedule and budget
- The way to progress is to study and improve the
way software is produced - better technology only helps once the
organizational framework is set - there is evidence that going for new technology
instead of improving the process can make things
worst - A set of best practices for software
development teams - considered conventional wisdom by methodology
pratictioners
9The inception phase
- Formulating the scope of the project
- capturing the context and the most important
requirements and constraints - Planning
- project plan, risk management, staffing etc.
- Synthesizing a candidate architecture
- to demonstrate feasibility through some kind of
proof of concept - Preparing the environment for the project
10Define the scope of the software system to be
built (what it should do)
11User Requirements
12(No Transcript)
13Lifetime of LHC software 25 yrs
WWW
Thanks to Dino Ferrero Merlino(IT)
14The zoo
DPM EA-MC FLUKA GEM HERMES LAHET MCBEND MCU
MF3D NMTC MONK MORSE RTST-2000 SCALE TRAX VMC
EGS4, EGS5, EGSnrc Geant3, Geant4 MARS MCNP,
MCNPX, A3MCNP, MCNP-DSP, MCNP4B MVP,
MVP-BURN Penelope Peregrine Tripoli-3, Tripoli-3
A, Tripoli-4
...and I probably forgot some more
Many codes not publicly distributed A lot of
business around MC
Monte Carlo codes presented at the MC200
Conference, Lisbon, October 2000
15What is ?
- OO Toolkit for the simulation of next generation
HEP detectors
- ...of the current generation too
- ...not only of HEP detectors
- already used also in nuclear physics, medical
physics, space applications, radiation background
studies etc.
- Geant4 provides a general infrastructure for
- modeling geometry and materials
- particle transport and interactions with matter
- describing detector response
- visualisation of geometries, tracks and hits
- The user develops specific code for
- the primary event generator
- the geometrical description of the set-up
- the digitisation of the detector response
16The Toolkit approach
- A toolkit is a set of compatible components
- each component is specialised for a specific
functionality - each component can be refined independently to a
great detail - components can be integrated at any degree of
complexity - it is easy to provide (and use) alternative
components - the simulation application can be customised by
the user according to his/her needs - maintenance and evolution - both of the
components and of the user application - is
greatly facilitated - ...but what is the price to pay?
- the user is invested of a greater responsibility
- he/she must critically evaluate what he/she needs
and wants to use
17Software Engineering
plays a fundamental role in Geant4
- formally collected
- systematically updated
- PSS-05 standard
Interface to external products w/o dependencies
User Requirements
Software Process
- spiral iterative approach
- regular assessments and improvements (SPI
process) - monitored following the ISO 15504 model
Object Oriented methods
- openness to extension and evolution
- contribute to the transparency of physics
- interface to external software without
dependencies
Quality Assurance
- commercial tools
- code inspections
- automatic checks of coding guidelines
- testing procedures at unit and integration level
- dedicated testing team
Use of Standards
18(No Transcript)
19(No Transcript)
20The elaboration
- Refining the vision
- a solid understanding of the most critical use
cases - Defining, validating and refining the
architecture - Iteration plans for the construction phase
- Putting in place the development environment
21Architecture
22Initialisation
Describe a geometrical set-up a Si-W tracker, a
CsI calorimeter and an anti-coincidence system
made out of plastic scintillators.
Activate electromagnetic/hadronic processes
appropriate to the energy range of the experiment
23Beam On
Generate primary events according to various
distributions relevant to gamma astrophysics
24Event processing
Record the coordinates of impact of tracks in the
tracker layers
Record the energy deposited in each element of
the calorimeter at every event
25The kernel
- Run and event
- multiple events
- possibility to handle the pile-up
- multiple runs in the same job
- with different geometries, materials etc.
- powerful stacking mechanism
- three levels by default handle trigger studies,
loopers etc.
- Tracking
- decoupled from physics all processes handled
through the same abstract interface - tracking is independent from particle type
- it is possible to add new physics processes
without affecting the tracking
- Geant4 has only production thresholds, no
tracking cuts - all particles are tracked down to zero range
- energy, TOF ... cuts can be defined by the user
26The construction
- Completing the
- analysis
- design
- development
- testing
- of all required functionality
27Detailing the design
28Materials
Describe a geometrical set-up a Si-W tracker, a
CsI calorimeter and an anti-coincidence system
made out of plastic scintillators.
- Different kinds of materials can be defined
- isotopes G4Isotope
- elements G4Element
- molecules G4Material
- compounds and mixtures G4Material
- Attributes associated
- temperature
- pressure
- state
- density
29Geometry
Role detailed detector description and efficient
navigation
Multiple representations (same abstract interface)
- CSG (Constructed Solid Geometries)
- - simple solids
- STEP extensions
- - polyhedra,, spheres, cylinders, cones, toroids,
etc. - BREPS (Boundary REPresented Solids)
- - volumes defined by boundary surfaces
- - include solids defined by NURBS (Non-Uniform
Rational B-Splines)
CAD exchange ISO STEP interface
Fields of variable non-uniformity and
differentiability
External tool for g3tog4 geometry conversion
30How to define detector geometry
- Three conceptual layers
- G4VSolid shape, size
- G4LogicalVolume daughter volumes, material,
sensitivity etc. - G4VPhysicalVolume position, rotation
- Placement one positioned volume
- Repeated a volume placed many times
- reduces use of memory
- Replica simple repetition (e.g. divisions)
- Parameterised
31Read-out Geometry
- Readout geometry is a virtual and artificial
geometry - it is associated to a sensitive detector
- can be defined in parallel to the real detector
geometry - helps optimising the performance
32(No Transcript)
33DetectorConstruction
- // Calorimeter Structure (CALLayerX CALLayerY)
- // Solid
- solidCALLayerX new G4Box("CALLayerX",
CALSizeXY/2, CALSizeXY/2, CALBarThickness/2) - // Logical volume
- logicCALLayerX new G4LogicalVolume(solidCALLayer
X, CALMaterial, "CALLayerX") - // Physical volume
- for (G4int i 0 i lt NbOfCALLayers i)
physiCALLayerY new G4PVPlacement()
physiCALLayerX new G4PVPlacement() -
-
34Hits and Digis
Record the coordinates of impact of tracks in the
layers of the tracker. Record the energy
deposited in each element of the calorimeter at
every event.
- A sensitive detector creates hits using the
information provided by G4Step - One can store various types of information in a
hit - position and time of the step
- momentum and energy of the track
- energy deposition of the step
- geometrical information
- etc.
- A Digi represents a detector output
- e.g. ADC/TDC count, trigger signal
- A Digi is created with one or more hits and/or
other digits - Hits collections are accessible
- through G4Event at the end of an event
- through G4SDManager during processing an event
- The digitise() method of each G4VDigitizerModule
must be explicitly invoked by the users code - e.g. in the UserEventAction
35Hits and Digis
36Hits in our example
- Each tracker hit contains the following
information - ID of the event (this is important for multiple
events run) - Energy deposition of the particle in the strip
- Number of the strip
- Number of the plane
- Type of the plane
- Position of the hit (x,y,z) in the reference
frame of the payload
37Generating primary particles
Generate primary events according to various
distributions relevant to ? astrophysics
- Interface to Event Generators
- through ASCII file for generators supporting
/HEPEVT/ - abstract interface to Lund
- Various utilities provided within the Geant4
Toolkit - ParticleGun
- beam of selectable particle type, energy etc.
- GeneralParticleSource
- provides sophisticated facilities to model a
particle source - used to model space radiation environments,
sources of radioactivity in underground
experiments etc. - you can write your own, inheriting from
G4VUserPrimaryGeneratorAction - Particles
- all PDG data
- and more, for specific Geant4 use, like ions
38Primary generator in our example
- GammaRayTelParticleGenerationAction and its
Messenger are responsible for the generation of
primary particles and the related configuration
through the UI - Define the incident flux of particles
- from a specific direction
- or from an isotropic background
- Choose also between two spectral options
- monochromatic
- or with a power-law dependence
- The particle generator parameters are accessible
through the UI - /gun/ tree
39Physics
Activate electromagnetic and hadronic processes
appropriate to the energy range of the experiment
- From the Minutes of LCB (LHCC Computing Board)
meeting on 21 October, 1997
It was noted that experiments have requirements
for independent, alternative physics models. In
Geant4 these models, differently from the concept
of packages, allow the user to understand how the
results are produced, and hence improve the
physics validation. Geant4 is developed with a
modular architecture and is the ideal framework
where existing components are integrated and new
models continue to be developed.
40Physics general features
- Ample variety of physics functionalities
- Modular design, at a fine granularity, to expose
the physics - Uniform treatment of electromagnetic and hadronic
processes - Abstract interface to physics processes
- tracking independent from physics
- Distinction between processes and models
- often multiple models for the same physics
process (complementary/alternative) - Transparency (supported by encapsulation and
polymorfism) - calculation of cross-sections independent from
the way they are accessed (data files, analytical
formulae etc.) - distinction between the calculation of cross
sections and their use - calculation of the final state independent from
tracking - Open system
- users can easily create and use their own models
41Data libraries
- Systematic collection and evaluation of
experimental data from many sources worldwide - Databases
- ENDF/B, JENDL, FENDL, CENDL, ENSDF,JEF, BROND,
EFF, MENDL, IRDF, SAID, EPDL, EEDL, EADL, SANDIA,
ICRU etc. - Collaborating distribution centres
- NEA, LLNL, BNL, KEK, IAEA, IHEP, TRIUMF, FNAL,
Helsinki, Durham, Japan etc. - The use of evaluated data is important for the
validation of physics results of the experiments
41
42Processes
- Processes describe how particles interact with
material or with a volume - Three basic types
- At rest process
- (eg. decay at rest)
- Continuous process
- (eg. ionization)
- Discrete process
- (eg. decay in flight)
- Transportation is a process
- interacting with volume boundary
- A process which requires the shortest interaction
length limits the step
43Electromagnetic physics
- electrons and positrons
- g, X-ray and optical photons
- muons
- charged hadrons
- ions
- Multiple scattering
- Bremsstrahlung
- Ionisation
- Annihilation
- Photoelectric effect
- Compton scattering
- Rayleigh effect
- g conversion
- ee- pair production
- Synchrotron radiation
- Transition radiation
- Cherenkov
- Refraction
- Reflection
- Absorption
- Scintillation
- Fluorescence
- Auger (in progress)
energy loss
Comparable to Geant3 already in the a release
(1997) Further extensions (facilitated by the OO
technology)
- High energy extensions
- needed for LHC experiments, cosmic ray
experiments - Low energy extensions
- fundamental for space and medical applications,
dark matter and n experiments, antimatter
spectroscopy etc. - Alternative models for the same process
All obeying to the same abstract Process
interface ? transparent to tracking
44Standard electromagnetic processes
Multiple scattering 6.56 MeV proton , 92.6 mm Si
1 keV up to O(100 TeV)
- Multiple scattering
- new model (by L. Urbán)
- computes mean free path length and lateral
displacement - New energy loss algorithm
- optimises the generation of d rays near
boundaries - Variety of models for ionisation and energy loss
- including PhotoAbsorption Interaction model (for
thin layers) - Many optimised features
- Secondaries produced only when needed
- Sub-threshold production
Old plot, further improvements with a new model
J.Vincour and P.Bem Nucl.Instr.Meth. 148. (1978)
399
45 Low Energy electromagnetic
Processes e, g
46Low energy e.m. extensions
shell effects
Fundamental for neutrino/dark matter experiments,
space and medical applications, antimatter
spectroscopy etc.
Bragg peak
e,? down to 250 eV (EGS4, ITS to 1 keV, Geant3
to 10 keV)
Hadron and ion models based on Ziegler and ICRU
data and parameterisations
Based on EPDL97, EEDL and EADL evaluated data
libraries
Barkas effect (charge dependence) models for
negative hadrons
Photon attenuation
ions
protons
antiprotons
47GammaRayTelPhysicsList
if (particleName "gamma") //
gamma pManager-gtAddDiscreteProcess(new
G4PhotoElectricEffect())
pManager-gtAddDiscreteProcess(new
G4ComptonScattering()) pManager-gtAddDiscret
eProcess(new G4GammaConversion())
else if (particleName "e-") //
electron pManager-gtAddProcess(new
G4MultipleScattering(),-1, 1,1)
pManager-gtAddProcess(new G4eIonisation(),
-1, 2,2) pManager-gtAddProcess(new
G4eBremsstrahlung(), -1,-1,3)
else if (particleName "e") //
positron pManager-gtAddProcess(new
G4MultipleScattering(),-1, 1,1)
pManager-gtAddProcess(new G4eIonisation(),
-1, 2,2) pManager-gtAddProcess(new
G4eBremsstrahlung(), -1,-1,3)
pManager-gtAddProcess(new G4eplusAnnihilation(),
0,-1,4) SetCutValue(cutForGamma,
"gamma") SetCutValue(cutForElectron, "e-")
SetCutValue(cutForElectron, "e")
select physics processes to be activated for each
particle type
set production thresholds
48- Highlights of Geant4
- Hadronic Physics
- and more about
- Electromagnetic Physics
- in tomorrows lecture
49Now we can run our simulation, track particles,
produce showers and record the effects in the
detectors
but our job is not limited to simulation only
50Collaborating Frameworks
In our application
- Simulation
- to model the experimental setup and generate
effects from particle interactions - User Interface
- to control configuration and flow of execution
- Visualisation
- detector geometry, particle tracks, hits etc.
- Analysis
- histogramming of physics quantities
51Components and Frameworks
- Frameworks are composed of components
- Abstract Interfaces de-couple components and
frameworks - Frameworks
- correlated groups of classes (components)
together with their interactions - re-usable (generic) designs of a software system
on a very high abstraction level - flow of control is bi-directional between
application and the framework library - Component
- a correlated group of classes together with their
interactions - reusable design of (part of) a software system on
a low or medium abstraction level
- Weakly coupled components and frameworks have
large advantages - ease of re-use of component or framework
- flexibility through independence of
implementation - maintainability through independent evolution of
components
52Interface to external tools in Geant4
Through abstract interfaces
no dependence minimize coupling of components
- Visualisation
- (G)UI
- Persistency
- Analysis
Similar approach
The user is free to choose the concrete system
he/she prefers for each component
53Visualisation in Geant4
Visualise the experimental set-up Visualise
tracks in the experimental set-up Visualise hits
- Control of several kinds of visualisation
- detector geometry
- particle trajectories
- hits in the detectors
- Using abstract G4VisManager class
- takes 3-D data from geometry/track/hits
- passes on to abstract visualization driver
- G4VGraphicsSystem (initialization)
- G4VSceneHandler (processing 3-D data for
visualisation) - G4VViewer (rendering the processed 3-D data)
- Various drivers
- OpenGL, OpenInventor, X11, Postscript, DAWN,
OPACS, VRML
54User Interface in Geant4
Configure the tracker, by modifying the number of
active planes, the pitch of the strips, the area
of silicon tiles, the material of the
converter Configure the calorimeter, by modifying
the number of active elements, the number of
layers Configure the source Configure
digitisation by modifying the threshold
Configure the histograms
- Two phases of user user actions
- setup of simulation
- control of event generation and processing
- User Interface category separated from actual
command interpreter (intercoms) - using abstract G4UIsession class
- several implementations exist
- command-line (batch and terminal)
- GUIs (X11/Motif, GAG, MOMO, OPACS, Java)
- Automatic code generation for geometry and
materials (GGE, GPE)
55Persistency in Geant4
Produce an intermediate output of the simulation
at the level of hits in the tracker
- Geant4 Persistency makes run, event, hits, digits
and geometry information be persistent, to be
read back later by user programs - no dependence on any specific persistency model
- use industrial standard ODMG C binding and
HepODBMS as persistency interface - Possibility to run in transient or persistent
mode
G4 kernel objects have corresponding P objects
in G4Persistency G4Run ? G4PRun G4Event ?
G4PEvent G4Hit ? G4PHit
Parallel World approach
Data members of transient and persistent objects
are copied by Store( ) and Retrieve( )
56The analysis framework
Plot the x-y distribution of impact of the
track Plot the energy distribution in the
calorimeter. Store significant quantities in a
ntuple (energy release in the strips, hit strips)
for further analysis Plot histograms during the
simulation execution.
COLT JAS OpenScientist
Lizard
57AIDA
- Abstract Interfaces for Data Analysis (in HEP)
- The goals of the AIDA project are to define
abstract interfaces for common physics analysis
tools, such as histograms. The adoption of these
interfaces should make it easier for developers
and users to select to use different tools
without having to learn new interfaces or change
their code. In addition it should be possible to
exchange data (objects) between AIDA compliant
applications. (http//aida.freehep.org) - Unify/standardize look and feel for various
tools - there is no longer only one tool
- Provide flexibility to interchange
implementations of these interfaces - can use specific features of specific tools w/o
change! - Allows and try to re-use existing packages
- even across language boundaries
- e.g., C analysis using Java Histograms
- Minimize coupling between components
58Abstract Interfaces
- Only pure virtual methods, inheritance only from
other Abstract Interfaces - Components use other components only through
their Abstract Interfaces - Defines a kind of a protocol for a component
- Maximize flexibility and re-use of packages
- Allow each component to develop independently
- De-couple the implementation of a component from
its use
59Use of Components with Abstract Interfaces
- User Code uses only Interface classes
- IHistogram1D hist histoFactory-gt
create1D(track quality, 100, 0., 10.) - Actual implementations are selected at run-time
- loading of shared libraries
- No change at all to user code but keep freedom
to choose implementation - flexible
- customizable
60Architectural issue Components
- Identify components by functionality
- Define protocol using Abstract Interfaces
- Emphasize separation of different aspects for
each component - example Histogram
- statistical entity (density distribution of a
physics quantity) - view of a collection of data points
- (which can be a density distribution but also a
detector efficiency curve) - command to manipulate/store/plot/fit/...
- Users view is different from developers
view - separate Abstract Interfaces for both aspects
- UserInterface as a separate component
- by definition couples to most of the other
components - promotes weak coupling between the other
components - interfaces to scripting and/or GUI
61Initial categories and dependencies
62Anaphe what it is
- Modular (OO/C) replacement of CERNLIB
functionality for use in HEP experiments - memory management
- I/O
- foundation classes
- histogramming
- minimizing/fitting
- visualization
- interactive data analysis
- Trying to use standards wherever possible
- Trying to re-use existing class libraries
63(No Transcript)
64Anaphe Abstract Interfaces
65Anaphe components
66Lizard
- Un tool di analisi interattiva AIDA compatibile
- Python scripting
- Visualizzazione con Qt
- Istogrammi HTL (via AIDA)
- Persistenza con Objectivity (o licence-free)
- Fitting con NAG Libraries (o Minuit)
- Componenti disponibili come shared libraries
- indipendenti dal linguaggio di scripting
67Design and implementation in our example
- Based on AIDA
- independent from any concrete Analysis Tool
- Online histogramming
- provides fast feedback
68Are we done?
- Not yet
- Did we satisfy all the original requests?
- Which element of the design does a requirement
correspond to? - Which requirement does a design element
correspond to? - Same for the implementation
- Did we test that each requirement has been
correctly satisfied? - Did we provide documentation for usage?
- Where are we now in the process of producing our
software product?
69Traceability
Traceability is the ability to trace a project
element to other related project elements
From RUP
70A simple example of traceability through User
Requirements, Design, Implementation, Test
Iterative and incremental process Every release
cycle increments the functionality, until all
requirements are satisfied
71The transition phase
- In most cases our software is used in the wider
context of an experiment
- documentation
- training collaborators to use our software
- feedback from users
- maintenance
- start an evolutionary cycle for a new version of
our software
Geant4 GammaRayTelescope advanced
example Developed by Riccardo Giannitrapani,
Francesco Longo, Giovanni Santin (INFN
TS/UD) http//www.ge.infn.it/geant4/examples/gamma
ray_telescope/index.html geant4/examples/advanced/
gammaray_telescope/
72GLAST g-ray telescope
Credit Hytec
Preliminary
Courtesy of F. Longo and R. Giannitrapani, GLAST
73Geant4 advanced examples
- g-ray telescope
- X-ray telescope
- Underground physics and radiation background
- X-ray fluorescence
- Brachytherapy
Full scale applications showing physics
guidelines, advanced interactive facilities and
usage of OO Analysis Tools in real-life set-ups