Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova [email protected] Budker...

73
Maria Grazia Pia results results Maria Grazia Pia INFN Genova [email protected] Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg http://cern.ch/geant4/geant4.html http://cern.ch/geant4/geant4.html http://www.ge.infn.it/geant4/ http://www.ge.infn.it/geant4/ http://www.ge.infn.it/geant4/traini http://www.ge.infn.it/geant4/traini

Transcript of Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova [email protected] Budker...

Page 1: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Usage and resultsUsage and resultsMaria Grazia Pia

INFN [email protected]

Budker Inst. of PhysicsIHEP ProtvinoMEPHI Moscow Pittsburg University

http://cern.ch/geant4/geant4.htmlhttp://cern.ch/geant4/geant4.html

http://www.ge.infn.it/geant4/http://www.ge.infn.it/geant4/

http://www.ge.infn.it/geant4/training/http://www.ge.infn.it/geant4/training/

Page 2: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Today’s exercise

A real-life example– simulation + analysis in a

simple experimental set-up

By-products

– an overview of Geant4 Geant4

– an overview of OO Analysis ToolsAnalysis Tools

– a practical exampleexample how to use Geant4 and AIDA/Anaphe

– an introduction to software processsoftware process

– an introduction to basics concepts of OO technologyOO technology

Applications and results of Geant4 – large-scale HEP experiments– small-scale HEP experiments– astroparticle experiments– space science– radiotherapy

Discussion

Tomorrow’s lecture

Page 3: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

through a real-life through a real-life simulation + analysissimulation + analysis

Maria Grazia Pia

INFN [email protected]

Budker Inst. of PhysicsIHEP ProtvinoMEPHI Moscow Pittsburg University

http://cern.ch/geant4/http://www.ge.infn.it/geant4/

http://cern.ch/anaphe/

and AIDA+Anaphe

Page 4: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

The 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

Page 5: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

What shall we do now?

Wonder what we want to do…

Ask our boss what he wants us to do…

Chat with collaborators in the experiment…

Sit in front of a PC and start writing code…

Software process

AskAsk and thinkthink and planplan and analyse and designdesign and developdevelop and testtest and get feedbackget feedback and ask and think and plan and analyse and design and develop and test and get feedback and ask and think and…

Page 6: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

The software life-cycle

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

– don’t 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 incrementaliterative and incremental

development

A software process- provides guidance to a team’s activities- specifies which work products should be produced and when- offers criteria for monitoring and measuring the project’s products and activities

Page 7: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

SEI’s definition: A set of activities, methods, practices and transformations that A set of activities, methods, practices and transformations that people use to develop and maintain software and associated people use to develop and maintain software and associated productsproducts

USDP

Three key componentskey components:

the people involved the organization of the development process the technology used

Various software process models

USDP / RUPOPENOOSPXP, Agile etc.waterfall

Reference for guidance and assessment

Capability Maturity Model (CMM) SPICE/ISO 15504

Software ProcessSoftware Process

Page 8: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Best 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 producedthe 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 practicesbest practices” for software development teams

– considered conventional wisdom by methodology pratictioners

Page 9: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

The 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

Capture User RequirementsCapture User Requirements

Select a simulation frameworkSelect a simulation framework

Identify a candidate architectureIdentify a candidate architecture

Page 10: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Capture User RequirementsCapture User Requirements

Define the scope of the software system to be built (“what it should do”)

Page 11: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

1. General UR 1.1 Configure the Run UR 1.2 Configure the Event Loop

2. Description of the experimental set-up UR 2.1 Describe a geometrical set-up: a Si-W tracker, a

CsI calorimeter and an anti-coincidence system made out of plastic scintillators.

UR 2.2 Record the coordinates of impact of tracks in the layers of the tracker. Record the energy release in the strips of the tracker.

UR 2.3 Record the energy deposited in each element of the calorimeter at every event.

UR 2.4 Record the energy deposited in each element of the anticoincidence at every event.

UR 2.5 Digitise the hits, setting a threshold for the energy deposit in the tracker.

UR 2.6 Generate a trigger signal combining signals from different detectors.

3. Physics UR 3.1 Generate primary events according to various

distributions relevant to gamma astrophysics UR 3.2 Activate electromagnetic processes appropriate

to the energy range of the experiment. UR 3.3 Activate hadronic processes appropriate to the

energy range of the experiment.

4. Analysis UR 4.1 Plot the x-y distribution of impact of the track. UR 4.2 Plot histograms during the simulation execution. UR 4.3 Store significant quantities in a ntuple (energy

release in the strips, hit strips) for further analysis. UR 4.4 Plot the energy distribution in the calorimeter.

5. Visualisation UR 5.1 Visualise the experimental set-up. UR 5.2 Visualise tracks in the experimental set-up. UR 5.3 Visualise hits in the experimental set-up.

6. User Interface UR 6.1 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

UR 6.2 Configure the calorimeter, by modifying the number of active elements, the number of layers.

UR 6.3 Configure the source. UR 6.4 Configure digitisation by modifying threshold UR 6.5 Configure the histograms

7. Persistency UR 7.1 Produce an intermediate output of the simulation

at the level of hits in the tracker. UR 7.2 Store significant results in FITS format. UR 7.3 Read in an intermediate output for further

elaboration.

User Requirements

Page 12: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Select a simulation Select a simulation frameworkframework

Page 13: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Lifetime of LHC software = 25 yrs

WWW Thanks to Dino Ferrero Merlino(IT)

Page 14: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

EGS4, EGS5, EGSnrcGeant3, Geant4 MARSMCNP, MCNPX, A3MCNP, MCNP-DSP, MCNP4BMVP, MVP-BURNPenelopePeregrineTripoli-3, Tripoli-3 A, Tripoli-4

DPMEA-MCFLUKA GEMHERMESLAHETMCBEND MCU MF3DNMTCMONK MORSERTS&T-2000 SCALETRAXVMC++

...and I probably forgot some moreMany codes not publicly distributed

A lot of business around MC

The zoo

Monte Carlo codes presented at the MC200 Conference, Lisbon, October 2000Monte Carlo codes presented at the MC200 Conference, Lisbon, October 2000

Page 15: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

What is ?OO Toolkit for the simulation of next generation HEP detectorsOO Toolkit for the simulation of next generation HEP detectors

Geant4 provides a general infrastructuregeneral infrastructure for– modeling geometry and materials

– particle transport and interactions with matter

– describing detector response

– visualisation of geometries, tracks and hitsThe user develops specific codespecific code for

– the primary event generator

– the geometrical description of the set-up

– the digitisation of the detector response

– ...of the current generation too

– ...not only of HEP detectors already used also in nuclear physics, medical physics, space applications,

radiation background studies etc.

Page 16: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

The Toolkit approach

A toolkit is a set of compatible componentscomponents– each component is specialisedspecialised for a specific functionality– each component can be refinedrefined independently to a great detail– components can be integratedintegrated at any degree of complexity– it is easy to provide (and use) alternativealternative components– the simulation application can be customisedcustomised by the user according to

his/her needs– maintenance maintenance and evolutionevolution - 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

Page 17: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Domain decomposition

hierarchical structure of

sub-domains

Geant4 architecture

Uni-directional flow of

dependencies

Interface to external products w/o dependencies

Software Engineering

plays a fundamental role in Geant4

User Requirements• formally collected• systematically updated• PSS-05 standard

Software Process• spiral iterative approach• regular assessments and improvements (SPI process)• monitored following the ISO 15504 model

Quality Assurance• commercial tools• code inspections• automatic checks of coding guidelines• testing procedures at unit and integration level• dedicated testing team

Object Oriented methods • OOAD• use of CASE tools

• openness to extension and evolution• contribute to the transparency of physics• interface to external software without dependencies

Use of Standards • de jure and de facto

Page 18: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Identify a candidate architectureIdentify a candidate architecture

Page 19: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Page 20: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

The 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

Use case realizationsUse case realizations

ArchitectureArchitecture (based on the Geant4 framework) (based on the Geant4 framework)

Priorities of requirements: plan iterationsPriorities of requirements: plan iterations

Page 21: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Detector description

Detector response

Primary event generation

Management

Physics

Visualisation

Analysis

ArchitectureArchitecture

Page 22: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Initialisationmain Run manager user detector

const ructionuser physics

list

1: initialize2 : const ruct

3: material const ruct ion

4: geometry construct ion5: world volume

6 : const ruct

7 : physics process const ruction

8: set cuts

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

Page 23: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Beam On

main Run Manager Geometry manager

Event generator

EventManager

1: Beam On2: close

3: generate one event

4: process one event

5: open

Generate primary events according to various distributions relevant to gamma astrophysics

Page 24: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Event processing

Event manager

Stacking manager

Tracking manager

Stepping manager

User sensitive detector

1: pop

2: process one track3: Stepping

4: generate hits

5: secondaries

6: push

Record the coordinates of impact of tracks in the tracker layersRecord the energy deposited in each element of the calorimeter at every event

Page 25: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

The kernel

Run and eventRun 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 Tracking decoupled from physics: all processes handled through the same abstract interface tracking is independent from particle typeit 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

Page 26: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

The construction

Completing the – analysis– design– development – testing

of all required functionality

Page 27: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Detailing the Detailing the designdesign

Page 28: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Materials

Different kinds of materials can be defined– isotopes G4Isotope– elements G4Element– molecules G4Material– compounds and mixtures G4Material

Attributes associated:– temperature– pressure– state– density

Describe a geometrical set-up: a Si-W tracker, a CsI calorimeter and an anti-coincidence system made out of plastic scintillators.

Page 29: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Geometry

Borexino CMS

ATLAS

Chandra

Role: detailed detector description and efficient

navigation

CSGCSG (Constructed Solid Geometries)- simple solids

STEP extensionsSTEP extensions- polyhedra,, spheres, cylinders, cones, toroids, etc.

BREPSBREPS ((BBoundary oundary REPREPresentedresented S Solids)olids)- volumes defined by boundary surfaces- include solids defined by NURBS (Non-Uniform Rational B-Splines)

External tool for g3tog4 geometry conversion

Multiple representationsMultiple representations(same abstract interface)

CAD exchange: ISO STEP interface

Fields: of variable non-uniformity and differentiability

BaBar

ATLAS

Page 30: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

How to define detector geometry

Three conceptual layers– G4VSolid: shape, size– G4LogicalVolume: daughter volumes, material, sensitivity etc.– G4VPhysicalVolume: position, rotation

Placement: one positioned volumeRepeated: a volume placed many times

– reduces use of memory– Replica: simple repetition (e.g. divisions)– Parameterised

G4Box

G4Tubs

G4VSolid G4VPhysicalVolume

G4Material

G4VSensitiveDetector

G4PVPlacement

G4PVParametrized

G4VisAttributes

G4LogicalVolume

repeated

placement

Page 31: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Read-out Geometry

Readout geometry is a virtual and artificial geometry

it is associated to a sensitive detectorsensitive detector

can be defined in parallel to the real detector geometry

helps optimising the performance

Page 32: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Page 33: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

DetectorConstruction

// Calorimeter Structure (CALLayerX + CALLayerY)

// SolidSolid solidCALLayerX = new G4Box("CALLayerX",

CALSizeXY/2, CALSizeXY/2, CALBarThickness/2);

// Logical volumeLogical volume logicCALLayerX = new

G4LogicalVolume(solidCALLayerX, CALMaterial, "CALLayerX");

// Physical volumePhysical volume for (G4int i = 0; i < NbOfCALLayers; i++)

{ physiCALLayerY = new G4PVPlacement(…); physiCALLayerX = new G4PVPlacement(…);

… }

Page 34: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Hits and Digis

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 user’s code

– e.g. in the UserEventAction

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.

Page 35: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Hits and Digis

Page 36: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Hits 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

Page 37: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Generating primary particles

Interface to Event GeneratorsInterface to Event Generators– through ASCII file for generators supporting /HEPEVT/– abstract interface to Lund++

Various utilities provided within the Geant4 ToolkitVarious utilities provided within the Geant4 Toolkit– ParticleGunParticleGun

beam of selectable particle type, energy etc.– GeneralParticleSourceGeneralParticleSource

provides sophisticated facilities to model a particle sourceused to model space radiation environments, sources of radioactivity in underground experiments etc.

– you can write your own, inheriting from G4VUserPrimaryGeneratorAction

ParticlesParticles– all PDG data– and more, for specific Geant4 use, like ions

Generate primary events according to various distributions relevant to astrophysics

Page 38: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Primary 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

Page 39: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Physics

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.”

Activate electromagnetic and hadronic processes appropriate to the energy range of the experiment

Page 40: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Physics: 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

Page 41: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Data libraries

Systematic collection and evaluation of experimental data from many sources worldwide

DatabasesDatabases– ENDF/B, JENDL, FENDL, CENDL, ENSDF,JEF, BROND, EFF,

MENDL, IRDF, SAID, EPDL, EEDL, EADL, SANDIA, ICRU etc.

Collaborating distribution centresCollaborating 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

Page 42: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Processes

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

Page 43: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Multiple scattering BremsstrahlungIonisationAnnihilationPhotoelectric effect Compton scattering Rayleigh effect conversione+e- pair productionSynchrotron radiationTransition radiationCherenkovRefractionReflectionAbsorptionScintillationFluorescenceAuger (in progress)

Electromagnetic physics

High energy extensionsHigh energy extensions– needed for LHC experiments, cosmic ray experiments…

Low energy extensionsLow energy extensions– fundamental for space and medical applications, dark matter

and experiments, antimatter spectroscopy etc.

Alternative models for the same processAlternative models for the same process

energy loss

electrons and positrons , X-ray and optical photons muons charged hadrons ions

Comparable to Geant3 already in the release (1997)

Further extensions (facilitated by the OO technology)

All obeying to the same abstract Process interface transparent to tracking

Page 44: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Standard electromagnetic processes

Multiple scatteringMultiple scattering– new model (by L. Urbán)– computes mean free path length and

lateral displacement

New energy loss algorithmNew energy loss algorithm– optimises the generation of rays near

boundaries

Variety of modelsVariety of models for ionisation and energy loss

– including PhotoAbsorption Interaction model (for thin layers)

Many optimised featuresMany optimised features– Secondaries produced only when needed– Sub-threshold production

Multiple scattering

6.56 MeV proton , 92.6 mm Si

J.Vincour and P.Bem Nucl.Instr.Meth. 148. (1978) 399

1 keV up to O(100 TeV)1 keV up to O(100 TeV)

Geant4Geant3data

Old plot, further

improvements with a new

model

Page 45: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Low Energy electromagnetic Processes: e,

Page 46: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Low energy e.m. Low energy e.m. extensionsextensions

e,down to 250 eV (EGS4, ITS to 1 keV, Geant3 to 10 keV)

Fundamental for neutrino/dark matter

experiments, space and medical applications,

antimatter spectroscopy etc. Hadron and ion models

based on Ziegler and ICRU data and parameterisationsBarkas effect

(charge dependence)models for negative hadrons

0.01 0.1 1 100.01

0.1

1

10

100

1000

Geant4 LowEn NIST

/

(cm

2 /g

) in

iron

Photon Energy (MeV)

Based on EPDL97, EEDL and EADL evaluated data libraries

Bragg peak

shell effects

Photon attenuation

antiprotons

protons ions

Page 47: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

GammaRayTelPhysicsList …if (particleName == "gamma") { // gamma pManager->AddDiscreteProcess(new G4PhotoElectricEffect()); pManager->AddDiscreteProcess(new G4ComptonScattering()); pManager->AddDiscreteProcess(new G4GammaConversion()); } else if (particleName == "e-") { // electron pManager->AddProcess(new G4MultipleScattering(),-1, 1,1); pManager->AddProcess(new G4eIonisation(), -1, 2,2); pManager->AddProcess(new G4eBremsstrahlung(), -1,-1,3);

} else if (particleName == "e+") { // positron pManager->AddProcess(new G4MultipleScattering(),-1, 1,1); pManager->AddProcess(new G4eIonisation(), -1, 2,2); pManager->AddProcess(new G4eBremsstrahlung(), -1,-1,3); pManager->AddProcess(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

Page 48: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Highlights of Geant4

Hadronic Physics Hadronic Physics and more about

Electromagnetic Physics Electromagnetic Physics in tomorrow’s lecture …

Page 49: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Now 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

Page 50: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Collaborating Frameworks

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

In our application:

Page 51: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Components and Frameworks

Frameworks are composed of components

Abstract InterfacesAbstract Interfaces de-couplede-couple components and frameworks

FrameworksFrameworks– 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

ComponentComponent– 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 Weakly coupled components and frameworks have large advantagesadvantages

– ease of re-use of component or framework– flexibility through independence of implementation

– maintainability through independent evolution of components

Page 52: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Similar Similar approachapproach

Interface to external tools in Geant4

no dependenceminimize coupling of components

Through abstract interfaces

Visualisation

(G)UI

Persistency

Analysis

The user is free to choose the concrete system he/she prefers for each

component

Page 53: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Visualisation in Geant4

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…

Visualise the experimental set-upVisualise tracks in the experimental set-upVisualise hits

Page 54: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

User Interface in Geant4

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)

Configure the tracker, by modifying the number of active planes, the pitch of the strips, the area of

silicon tiles, the material of the converterConfigure 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

Page 55: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Persistency in Geant4

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

Produce an intermediate output of the simulation at the level of hits in the tracker

Object Database

Constructor

Destructor

Time

File

G4Application

PersistentObject

G4Application

TransientObject

G4Persistency

G4Kernel

Store( )Retrieve( ) Inherits from HepPersObj

in HepODBMS

G4 kernel objects have corresponding “P” objects in G4PersistencyG4Run G4PRunG4Event G4PEventG4Hit G4PHit : :

G4 kernel objects have corresponding “P” objects in G4PersistencyG4Run G4PRunG4Event G4PEventG4Hit G4PHit : :

“Parallel World” approach

Data members of transient and persistent objects are copied by Store( ) and Retrieve( )

Page 56: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

The analysis framework

LizarLizardd

Plot the x-y distribution of impact of the trackPlot the energy distribution in the calorimeter.Store significant quantities in a ntuple (energy release in the strips, hit strips) for further analysisPlot histograms during the simulation execution.

COLTCOLT

JASJAS

OpenScientistOpenScientist

Page 57: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

AIDAAbstract Interfaces for Data Analysis (in HEP)

“The goals of the AIDA project are to define abstract interfacesabstract interfaces for common physics analysis toolsphysics 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 dataexchange 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 flexibilityflexibility to interchange implementations of these interfaces– can use specific features of specific tools w/o change!

Allows and try to re-usere-use existing packages – even across “language boundaries”

e.g., C++ analysis using Java Histograms

Minimize couplingMinimize coupling between components

Page 58: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Abstract Interfaces

Only pure virtualpure virtual methods, inheritanceinheritance only from other Abstract Interfaces

Components use use other components only through their Abstract Interfaces

Defines a kind of a “protocolprotocol” for a component

Maximize flexibilityflexibility and re-usere-use of packages

Allow each component to develop independently

De-couple the implementationimplementation of a component from its useuse

Page 59: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Use of Components with Abstract Interfaces

User Code uses only Interface classes– IHistogram1D* hist = histoFactory-> 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 Histo-

Impl. 2

Histo-IF Fitter-IF

User Code

Fitter-Impl. Y

Histo-Impl. 1

Fitter-Impl. X

Page 60: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Architectural issue: Components

Identify components by functionalityfunctionality

Define “protocol” using Abstract Interfaces

Emphasize separation of different aspectsdifferent aspects for each component– example: Histogram

statistical entitystatistical entity (density distribution of a physics quantity)

viewview of a “collection of data points” (which can be a density distribution but also a detector efficiency curve)

commandcommand to manipulate/store/plot/fit/...

“User’s view” is different from “developer’s view”– separate Abstract Interfaces for both aspects

UserInterfaceUserInterface as a separate component– by definition couples to most of the other components – promotes weak couplingweak coupling between the other components– interfaces to scripting and/or GUI

Page 61: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Initial categories and dependencies

Page 62: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Anaphe: 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

Page 63: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Page 64: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Anaphe Abstract Interfaces

Page 65: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Anaphe components

Page 66: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Lizard

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

Page 67: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Design and implementation in our example

Based on AIDA– independent from any concrete Analysis Tool

Online histogramming– provides fast feedback

Java Analysis Studio

Page 68: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Are 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?

Page 69: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Traceability

Traceability is the ability to trace a project element to other related project elements

From RUP

Page 70: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

UR Design and Implementation Test 1.1 GammaRayTelRunAction Start Run 1.2 GammaRayTelEventAction Manage Events 2.1 GammaRayTelDetectorConstruction Visualisation 2.2 GammaRayTelTrackerSD Histogramming and Output File 2.3 GammaRayTelCAlorimeterSD Histogramming and Output File 2.4 GammaRayTelAnticoincidenceSD Histogramming andOutput File 2.5 GammaRayTelDigitizer Output File 2.6 (not yet) 3.1 GammaRayTelPrimaryGeneratorAction Visualization 3.2 GammaRayTelPhysicsList Histogramming and Visualization 3.3 (not yet) 4.1 GammaRayTelAnalysis Histogram, Plotting 4.2 GammaRayTelAnalysis Histogram, Plotting 4.3 GammaRayTelAnalysis Histogram files 4.4 (not yet) 5.1 GammaRayTelVisManager Visualization 5.2 GammaRayTelVisManager Visualization 5.3 (not yet) 6.1 GammaRayTelDetectorMessenger UI and Visualization 6.2 GammaRayTelDetectorMessenger UI and Visualization 6.3 GammaRayTelPrimaryGeneratorMessenger UI and Visualization 6.4 GammaRayTelDigitizerMessenger Output File 6.5 GammaRayTelAnalysisMessenger Plotting, Histogramming 7.1 GammaRayTelAnalysis Plotting 7.2 (not yet) 7.3 (not yet)

A 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

Page 71: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

The transition phase In most cases our software is used in

the wider context of an experiment

Geant4 GammaRayTelescope advanced exampleGeant4 GammaRayTelescope advanced exampleDeveloped by Riccardo Giannitrapani, Francesco Longo, Giovanni Santin (INFN TS/UD)

http://www.ge.infn.it/geant4/examples/gammaray_telescope/index.html

geant4/examples/advanced/gammaray_telescope/

– documentation

– training collaborators to use our software

– feedback from users

– maintenance

…start an evolutionary cycle for a new version of our software

Page 72: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia Courtesy of F. Longo and R. Giannitrapani, GLAST

GLAST

Credit: Hytec

GLAST ray telescope

Preliminary

Page 73: Maria Grazia Pia Usage and results Maria Grazia Pia INFN Genova Maria.Grazia.Pia@cern.ch Budker Inst. of Physics IHEP Protvino MEPHI Moscow Pittsburg University.

Maria Grazia Pia

Geant4 advanced examples

-ray telescopeX-ray telescopeUnderground physics and radiation backgroundX-ray fluorescenceBrachytherapy

Full scale applications showing physics guidelines, advanced interactive facilities and usage of OO Analysis Tools in real-life set-ups

GaAs linesFe lines

fluorescence