Hanoi, Vietnam The Geant4 Monte Carlo toolkit · 2009. 3. 2. · MCNP, MCNPX, A3MCNP, MCNP-DSP,...

348
1 The The Geant4 Geant4 Monte Carlo Monte Carlo toolkit toolkit Sébastien Incerti IN2P3/CNRS Centre d’Etudes Nucléaires de Bordeaux Gradignan France [email protected] On behalf of the Geant4 collaboration http://cern.ch/geant4 Do-Son school on Advanced Computing and GRID Technologies for Research Institute of Information Technology, VAST, Hanoi, Vietnam 5-16 November 2007

Transcript of Hanoi, Vietnam The Geant4 Monte Carlo toolkit · 2009. 3. 2. · MCNP, MCNPX, A3MCNP, MCNP-DSP,...

  • 1

    The The Geant4Geant4Monte Carlo Monte Carlo toolkittoolkit

    Sébastien IncertiIN2P3/CNRS

    Centre d’Etudes Nucléaires de Bordeaux GradignanFrance

    [email protected]

    On behalf of the Geant4 collaboration

    http://cern.ch/geant4

    Do-Son school on Advanced Computing and GRID Technologies for Research

    Institute of Information Technology, VAST, Hanoi, Vietnam

    5-16 November 2007

  • 2

    ThankThankyouyou !!

    � Do-Son school organizers

    � IN2P3– Vincent Breton ( IN2P3)– François Le Diberder ( IN2P3)

    � Geant4– Makoto Asai ( SLAC)– Michel Maire ( IN2P3)– The whole Geant4 collaboration

  • 3

    1. Introduction 15 minutes2. Basic structure 25 minutes3. Definition of materials 10 minutes4. Geometry construction 30+40 minutes

    5. Electromagnetic Physics : standard version 20 minutes6. Electromagnetic Physics : low energy version 35 minutes

    7. Hadronic Physics 25 minutes8. Physics lists 15 minutes9. Primary particles generation 10 minutes10. Particles and processes 40 minutes

    11. User interface 15 minutes12. Documentation, examples, forum 10 minutes13. Linux 10 minutes14. Write your own application 5 minutes15. Hands on rest of day

    OutlineOutlineof the courseof the course

  • 4

    The The Geant4Geant4 toolkittoolkit ::1/15 1/15 -- IntroductionIntroduction

    15 minutes

  • 5

    Color codeColor code

    � In red : what is very important� In violet : new definitions� In yellow : important� In yellow and courier : code

    � : attention !

  • 6

    Simulation plays a fundamental role in various domains and phases of an experimental physics project

    � design of the experimental set-up� evaluation and definition of the potential physics

    output of the project� evaluation of potential risks to the project� assessment of the performance of the experiment� development, test and optimization of reconstruction

    and physics analysis software� contribution to the calculation and validation of

    physics results

    The The rolerole of simulationof simulation

  • 7

    Detector simulation Detector simulation -- general general

    � General characteristics of a detector simulation system– You specify the geometry of a particle detector– Then the software system automatically transports

    the particle you shoot into the detector by simulating the particle interactions in matter based on the Monte Carlo method

    � The heart of the simulation: the Monte Carlo method– a method to search for solutions to a mathematical

    problem using a statistical sampling with random numbers

  • 8

    Basic requirements for a simulation system Basic requirements for a simulation system

    � Modeling the experimental set-up� Tracking particles through matter� Interaction of particles with matter� Modeling the detector response� Run and event control� Accessory utilities

    (random number generators, PDG particle information etc.)� Interface to event generators� Visualization of the set-up, tracks and hits� User interface� Persistency

  • 9

    OO Toolkit for the simulation of next generation HEP detectors

    … of the current generation too... not only of HEP detectors

    Distributed software production and management

    Application of rigorous software engineering methodologies and Object Oriented technology to the HEP environment

    … also…

    Born from the requirements of large scale HEP

    experiments

    Geant3

    • Fortran• CERN product

    Inadequate for LHC experiments

    R&D phase : RD44, 1994 - 1998

    1st release: December 1998

    2 new releases/year

    WhatWhat isis Geant4Geant4??

    GEometry ANd Tracking

  • 10

    ATLAS

    LHC b

    9 or

    ders

    of m

    agni

    tude

    !

    HiggsHiggs

    All interactions

    Born from the requirements of large scale

    HEPexperiments

  • 11

    Geant4 collaborationGeant4 collaboration

    CERN, ESA, KEK, SLAC, TRIUMF, TJNL, INFN, IN2P3, PPARC

    Barcelona Univ., Budker Inst., Frankfurt Univ., Karolinska Inst., Helsinki Univ.,

    Lebedev Inst., LIP, Northeastern Univ. etc.

  • 12

    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++

    Many codes are not publicly distributed

    Much activity around MC !

    The zooThe zoo

  • 13

    Transports a particle step-by-step by taking into ac count the interactions with materials and external electromagneti c fields until the particle

    - loses its kinetic energy to zero,- disappears by an interaction,- comes to the end of the simulation volume

    Provides a way for the user to access the transportati on process and grab the simulation results

    - at the beginning and end of transportation,- at the end of each stepping in transportation,- at the time when the particle is going into the sensitive volume of

    the detector- etc.

    These are called User Actions

    WhatWhatcancanGeant4Geant4do for do for youyou ??

  • 14

    Three essential information you have to provide :- Geometrical information of the detector- Choice of physics processes - Kinematical information of particles going into the detector

    Auxiliary you have to prepare :- Magnetic and electric field- Actions you want to take when you access the particle

    transportation- Actions you want to take when a particle goes into a sensitive

    volume of the detector- etc.

    WhatWhatyouyou have to do for have to do for Geant4Geant4

  • 15

    Minimum software knowledge to use Minimum software knowledge to use Geant4Geant4

    � C++– Geant4 is implemented in C++, therefore a basic kno wledge of C++ is

    mandatory– C++ is a complex language, but you are not required to be a C++ expert to use

    Geant4

    � Object Oriented Technology– basic concepts– in-depth knowledge needed only for the development of complex applications

    � Unix/Linux Unix/Linux is a standard working environment for Ge ant4, therefore a minimum

    knowledge/experience is required– How to use basic Unix command– How to compile a C++ code

    � Windows• You can use Visual C++• Though still you need some knowledge of Unix (cygwi n) for installation

  • 16

    Geant4 provides standard tools to help you to prepare input information

    ● Multiple choices to describe the detector geometry− Combining basic geometry elements (box, cylinder, trapezoid, etc)− Representation by surface planes− Representation by Boolean operation, etc.

    ● Standard way to define materials in the detector− A large collection of examples to define various materials

    ● A set of wide variety of particles− Standard elementary particles (electron, muon, proton,….)− Unstable particles (resonances, quarks, …)− Ions− Exotic particles (geantino, charged geantino,… yours !)

    Tools for input Tools for input preparationpreparation

  • 17

    Geant4 provides a wide variety of physics models of part icle interactions with matter you can select

    ● Category of physics processes− Standard electromagnetic processes

    − Low energy electromagnetic processes

    − Hadronic processes

    ● How to use physics processes− A rich samples of Physics List provided with example applications

    − Recommended Physics List (educated guess) for hadronic physics

    ChoicesChoicesof of PhysicsPhysicsprocessesprocesses

  • 18

    � This course is part of the training programme offered by the Geant4 Collaboration

    – an international collaboration of scientists, devel oping and maintaining the Geant4 Simulation Toolkit

    � This course is a brief introduction to the architecture, modeling capabilities, physics, functionality and applicatio ns of the Geant4 Toolkit

    – it does not replace the study of Geant4 User Docume ntation

    � More extensive courses, with hands-on exercises, ar e organized by the Geant4 Collaboration

    – information available from Geant4 web site http://cern.ch/geant4

    Geant4Geant4training and user supporttraining and user support

  • 19

    Documentation and tutorials available at :

    http://cern.ch/geant4

    Other tutorial materialOther tutorial material

  • 2025 minutes

    The The Geant4Geant4 toolkittoolkit ::2/15 2/15 -- Basic structureBasic structure

  • 21

    The The Geant4Geant4kernelkernel

    � Handles runs , events , tracks , steps , hits , trajectories

    � Implements Geant4 as a state machine

    � provides a framework for

    − physics processes

    − visualization drivers

    − GUIs

    − persistency

    − histogramming/analysis

    − user code

  • 22

    RunRun

    � A run is a collection of events which are produced under ident ical conditions

    � Within a run, user cannot change :– Detector or apparatus geometry – Physics process settings

    � By analogy to high energy physics, a Geant4 run beg ins with the command “ beamOn ”. Detector is inaccessible once beam is on

    � At beginning of run:– Geometry is optimized for navigation– Cross sections are calculated according to material s in setup– Low-energy cutoff values are defined

    � The class G4Rundefines a run object

  • 23

    � At beginning of processing, an event contains primary particles (from generator , particle gun , ...), which are pushed onto a stack

    � During processing, each particle is popped from the stack and tracked

    � When the stack is empty, processing of the event is over

    � The class G4Event defines an event object

    � At the end of processing it has the following objec ts:– List of primary vertices and particles (the input)– Hits collections– Trajectory collections (optional)– Digitizations collections (optional)

    EventEvent

  • 24

    � A track is a snapshot of a particle within its environment– as the particle moves, the quantities in the snapsh ot change– at any particular instance, a track has position, p hysical quantities – it is not a collection of steps

    � Track object lifetime– created by a generator or physics process (e.g. dec ay)– deleted when it:

    • leaves world volume• disappears (particle decays or is absorbed)• goes to zero energy and no “at rest” process is def ined• user kills it

    � No track object survives the end of an event (not p ersistent). User must take action to store track record in traj ectory

    � The G4Track class defines a track object

    TrackTrack

  • 25

    � The step is the basic unit of simulation– Associated class is G4Step

    – Has two points ( pre-step , post-step )– Contains the incremental particle information

    (energy loss, elapsed time, etc.)– Each point contains volume and material information– If step is limited by a boundary, the end point sta nds exactly on the

    boundary, but is logically part of next volume– Hence boundary processes such as refraction and tra nsition radiation

    can be simulated

    StepStep

  • 26

    A A Geant4Geant4simulation as a HEP simulation as a HEP experimentexperiment

    Incident particles :e.g. beam of protons

    RUN= all the beam

    protons

    EVENT= a proton

    Target Detectors

    TRACK= a snapshot of a particle

    STEP= the elementaryinteration step

    Secondary particles

  • 27

    Geant4 Geant4 categoriescategories

    � Geant4 consists of 17 categories– Each is independently

    developed and maintained by a working group

    � Categories designed to minimize dependence– Geant4 kernel consists of

    categories in red

    D

  • 28

    � Geant4 tracking is general

    – It is independent of• the particle type• the physics processes assigned to the particle

    – It enables all processes to• contribute to the determination of the step length• contribute to any possible changes in physical quantities of

    the track• generate secondary particles• suggest changes in the state of the track

    (e.g. to suspend, postpone or kill)

    TrackingTracking

  • 29

    ProcessesProcesses

    � All the work of particle decays and interactions is do ne by processes– Particle transportation is also a process; the particle can interact with

    geometrical boundaries and any kind of field– There is also a shower parameterization process which can take over

    from transportation

    � Each particle has its own list of applicable process es. At the beginning of each step, all of these processes are queried for a proposed physical interaction length

    � The process with the shortest proposed length (in space-time) is the one that occurs– The chosen process also limits the step size

  • 30

    CutsCuts

    � A “ cut ” in Geant4 is really a production threshold– Only applies to physics processes which have infrar ed divergence– It is not a tracking cut

    � An energy threshold must be determined at which discrete energy loss is replaced by continuous energy loss

    • Specify range (which is converted to energy for each material) at which continuous energy loss begins, track primary down to zero range

    • above specified range create secondaries, • below range add to continuous energy loss of primary

  • 31

    � Use these classes to build your application on top of the Geant4 toolkit(class names in purple are mandatory)

    � Initialization classes– G4VUserDetectorConstruction– G4VUserPhysicsList

    � Action classes– G4VUserPrimaryGeneratorAction– G4UserRunAction– G4UserEventAction– G4UserStackingAction– G4UserTrackingAction– G4UserSteppingAction

    � Main() - not provided by Geant4

    User User classesclasses

  • 32

    � Managers classes broker transactions between objects within a catego ry and communicate with other managers

    � They are singletons

    � The user will have the most contact with G4RunManager– Must register detector geometry, physics list, part icle generator to it

    � Other manager classes:– G4EventManager – handles event processing, user actions– G4TrackingManager – handles tracks, trajectory storage, user actions – G4SteppingManager – handles steps, physics processes, hit scoring, use r

    actions– G4VisManager – handles visualization drivers

    Manager Manager classesclasses

  • 33

    BuildBuild youryour simulation in simulation in 7 7 stepssteps

  • 34

    � Derive your own concrete class from the abstract base cl ass G4VUserDetectorConstruction

    � In the virtual method Construct()– assemble all necessary materials– build the volumes of your detector geometry

    � Optionally you may define:– sensitive detector classes and assign them to the d etector

    volumes– regions for any part of your detector (for producti on ranges)– visualization attributes of detector elements– magnetic (or other) fields

    11 -- DescribeDescribeyouryour detectordetector

  • 35

    � Geant4 does not have any default particles or proce sses– even particle transporation must be explicitly defi ned by user

    � Derive your own concrete class from G4VUserPhysicsListabstract base class

    – define all necessary particles– define all necessary processes and assign them to t he proper particles– define production threshold (cutoff) ranges and ass ign them to world

    volume and each region

    � Geant4 provides many utility classes/methods to ass ist in the above tasks

    � Example (educated guess) physics lists exist for el ectromagneticand hadronic physics

    22 –– Select Select physicsphysicsprocessesprocesses

  • 36

    33 –– GenerateGenerateprimaryprimaryeventevent

    � For each event, user must define all details of initi al particle

    � Derive concrete class from G4VUserPrimaryGeneratorAction abstract base class

    � Geant4 provides several ways to do this:– derive your own generator from G4VPrimaryGenerator

    – use provided generators:• G4ParticleGun (user provides number, energy, direction, type)• G4HEPEvtInterface , G4HepMCInterface (interfaces to high

    energy generator programs)• G4GeneralParticleSource (mostly for radioactivity)

  • 37

    � G4UserRunAction– BeginOfRunAction (define

    histograms)– EndOfRunAction (fill

    histograms)� G4UserEventAction

    – BeginOfEventAction (event selection)

    – EndOfEventAction(analyze event)

    � G4UserTrackingAction– PreUserTrackingAction

    (create user defined trajectory)

    – PostUserTrackingAction

    � G4UserSteppingAction– UserSteppingAction (kill,

    suspend, postpone track)� G4UserStackingAction

    – PrepareNewEvent (reset priority control)

    – ClassifyNewTrack• invoked when new track is

    pushed• can set track as urgent,

    waiting, postpone or kill– NewStage

    • invoked when urgent stack is empty

    • event filtering

    44 –– User action classesUser action classes

  • 38

    � Geant4 does not provide a main()– However, many examples are provided in the Application Developers

    Guide

    � In main() , you must :– Construct G4RunManager (or a class derived from it)– Provide to G4RunManager pointers to mandatory user classes:

    • G4VUserDetectorConstruction

    • G4VUserPhysicsList

    • G4VUserPrimaryGeneratorAction

    � Other classes which can be defined in main()– G4VisManager

    – (G)UI session– Optional user classes

    55 -- The main()The main()programprogram

  • 39

    � Geant4 provides several G4UISession concrete classes

    – Select the one that is appropriate for your computi ng envirnoment

    – In main() , construct one of them– Invoke its sessionStart() method

    � UI sessions provided:– G4UIterminal – C- and TC-shell like character terminal– G4GAG– Tcl/Tk of Java PVM based GUI– G4JAG– interface to JAS (Java Analysis Studio)– G4UIBatch – batch job with macro file

    66 –– Setting up a user interface sessionSetting up a user interface session

  • 40

    � Geant4 provides interfaces to several graphics drive rs:– DAWN – Fukui renderer– WIRED – event display– RayTracer – ray tracing by Geant4 tracking– OpenGL– OpenInventor– VRML

    77 -- VisualizationVisualization

  • 41

    Application files : Application files : exampleexample� In the directory simulation

    – Simulation.cc– GNUMakefile

    � In simulation /src– DetectorConstruction.cc– PhysicsList.cc– PrimaryGeneratorAction.cc– UserRunAction.cc– UserEventAction.cc– UserTrackingAction.cc– UserSteppingAction.cc

    � In simulation /include– DetectorConstruction.hh– PhysicsList.hh– PrimaryGeneratorAction.hh– UserRunAction.hh– UserEventAction.hh– UserTrackingAction.hh– UserSteppingAction.hh

    – main()– Instructions for gmake

    – Materials and geometries– Particles and Physics processes– Primary particles– User action class (run)– User action class(event)– User action class(track)– User action class(step)

    In purple : mandatory filesIn white : optional files

  • 42

    � For portability “ G4” is prepended to raw C++ type names – G4int, G4double , ...

    – This way Geant4 implements correct type for a given architecture

    � G4cout and G4cerr are ostream objects defined by Geant4– G4endl is also provided

    � Some GUIs are buffer output streams so that they displa y print-outs on another window or provide storing/editing functional ity– The user should not use std::cout , etc.

    � Users should not use std::cin for input. Instead use the user-defined commands provided by the intercoms category– e.g. G4UIcmdWithADouble

    The G4 The G4 prefixprefix

  • 43

    System of System of unitsunits

    � Geant4 has no default unit . To give a number, unit must be “ multiplied ” to the number.– for example :

    G4double width = 12.5*m;

    G4double density = 2.7*g/cm3;

    – If no unit is specified, the internal G4 unit will be used, but this is discouraged !

    – Almost all commonly used units are available.– The user can define new units.– Refer to CLHEP: SystemOfUnits.h

    � Divide a variable by a unit you want to get.G4cout

  • 44

    � System of units are defined in CLHEP, based on:

    – millimetre ( mm), nanosecond ( ns), Mega eV (MeV), positron charge ( eplus) degree Kelvin ( kelvin), the amount of substance ( mole), luminous intensity ( candela), radian ( radian), steradian(steradian)

    � All other units are computed from the basic ones.

    � In output, Geant4 can choose the most appropriate u nit to use. Just specify the category for the data (Length, Time, Energy, etc…):

    G4cout

  • 45

    � The Geant4 toolkit consists of 17 categories, each designed for minimal dependence on the others

    � The largest unit of a simulation application is the run, which consists in turn of events, tracks, and steps

    – a track is a snapshot of a dynamic particle, not a trajectory

    � Tracking and physics are carried out by processes

    � Production thresholds and stacking allow for effici ent simulation– Geant4 tracks particles down to zero energy

    � User classes allow the simulation to be customized– user must build the apparatus, select the physics– commands allow user to communicate with simulation

    SummarySummary

  • 46

    MoreMore

  • 47

    Geant4 as a Geant4 as a state machinestate machine

    Geant4 has six application states

    � G4State_PreInit : initialization, definition of geometry, material, particles and physics

    � G4State_Idle : may start run or modify geometry/physics for next run

    � G4State_GeomClosed : geometry is optimized, cross section tables updated, ready to process event

    � G4State_EventProc : an event is being processed

    � G4State_Quit : normal termination� G4State_Abort : fatal exception and

    program is aborting

    D

  • 48

    � New units can be defined directly as constants, or (s uggested way) via G4UnitDefinition .

    G4UnitDefinition ( name, symbol, category, value )

    � Example (mass thickness):G4UnitDefinition (“grammpercm2”, “g/cm2”, “MassThic kness”, g/cm2);

    – The new category “ MassThickness ” will be registered in the kernel in G4UnitsTable

    � To print the list of units:– From the code

    G4UnitDefinition::PrintUnitsTable();

    – At run-time, as UI command:Idle> /units/list

    DefinitionDefinition of new of new unitsunits

  • 49

    EnvironmentEnvironmentvariablesvariables

    � To compile, link and run a Geant4-based simulation, the following environment variables must be set:

    – $G4SYSTEM– operating system (e.g. Linux-g++)– $G4INSTALL – base directory of Geant4 (where the compiled libra ries are)– $G4WORKDIR– where you run your application– $CLHEP_BASE_DIR– location of the compiled CLHEP libraries

    � Variables for physics processes (if those processes are used):– $G4LEVELGAMMADATA– location of photon evaporation data– $G4LEDATA-- location of cross sections for low energy EM modu le– $G4RADIOACTIVEDATA– for radioactive decay processes– $NeutronHPCrossSections – location of high precision neutron db

    � Additional variables for GUI, Visualization, Analys is

  • 50

    CommandsCommands& & intercomsintercoms

    � In Geant4, user can define commands and macros to run applications

    � The Intercoms category handles the framework mechan ism of defining and delivering commands

    – It is exportable to any other application– It is independent of other Geant4 categories– Uses strong type and range checking

    • C++ syntax : aCmd -> SetRange(“x>0. && y>0.”);

    – Dynamic command definition / activation– Commands can be hard coded or issued by (G)UI

    � Macro files are enabled – Loop, foreach, alias, ...

  • 51

    TrackTrackstackingstacking

    � G4Track is a class object -> easy to suspend or postpone tracks

    � Example: – Suspend tracks at entrance to

    calorimeter, i.e. simulate all tracks in tracking region before generating showers

    – Suspend “looper” tracks or abort or postpone them to next event

    � Stacking allows prioritized tracking without a perfomance penalty

    � Well thought-out prioritization or abortion of tracks/events make simulation more efficient

  • 52

    m ain Run m anage r user d e t ect o r co nst r uc t ion

    use r p hy sics l is t

    1 : in i t ial iz e2 : co nst r uc t

    3 : m at e rial co nst r uct ion

    4 : ge om et r y c on st r uc t io n5 : w or ld v o lum e

    6 : c on st ruc t

    7 : p hy sics p r oc ess co nst r uc

    8 : se t cu t s

    InitializationInitialization

    Describe your experimental set-up

    Activate physics processes appropriate to

    your experiment

  • 53

    main Run Manager Geomet ry manager

    Event generat or

    EventManager

    1: Beam On2: close

    3: generat e one event

    4: process one event

    5: open

    BeamBeamOnOn

    Generate primary events according to

    distributions relevant to your experiment

  • 54

    Event computationEvent computation

    Event manager

    Stacking manager

    Tracking manager

    Stepping manager

    User sensit ivedetector

    1: pop

    2: process one t rack3: Stepping

    4: generate hit s

    5: secondaries

    6: push

    Record the physics quantities generated by the simulation, that are

    relevant to your experiment

  • 55

    Step computationStep computation

  • 5610 minutes

    DetectorConstruction.hh (.cc)

    The The Geant4Geant4 toolkittoolkit ::3/15 3/15 -- DefinitionDefinition of of materialsmaterials

  • 57

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

    � Attributes associated:– temperature, pressure, state, density

    DefinitionDefinition of of materialsmaterials

  • 58

    � G4Isotope and G4Element describe the properties of the atoms :– Atomic number, number of nucleons, mass of a

    mole, shell energies– Cross-sections per atoms, etc…

    � G4Material describes the macroscopicproperties of the matter:– temperature, pressure, state, density– Radiation length, absorption length, etc…

    Isotopes, elements and materialsIsotopes, elements and materials

  • 59

    Isotopes can be assembled into elementsG4Isotope (const G4String& name,

    G4int z, // atomic numberG4int n, // number of nucleonsG4double a ); // mass of mole

    … building elements as follows:

    G4Element (const G4String& name,const G4String& symbol, // element symbol

    G4int nIso ); // # of isotopes

    G4Element::AddIsotope (G4Isotope* iso, // isotopeG4double relAbund); // fraction of atoms

    // per volume

    ElementsElements& isotopes& isotopes

  • 60

    G4double density = 1.390*g/cm3;

    G4double a = 39.95*g/mole;

    G4Material* lAr =

    new G4Material("liquidArgon",z=18.,a,density);

    MaterialMaterialof one of one elementelement((lArlAr ))

  • 61

    A molecule is made of several elements (composition by number of atoms ):

    a = 1.01*g/mole;G4Element* elH =

    new G4Element("Hydrogen",symbol="H",z=1.,a);

    a = 16.00*g/mole;G4Element* elO =

    new G4Element("Oxygen",symbol="O",z=8.,a);

    density = 1.000*g/cm3;G4Material* H2O =

    new G4Material("Water",density,ncomp=2);H2O->AddElement (elH, natoms=2);H2O->AddElement (elO, natoms=1);

    MaterialMaterial : : moleculemolecule(water)(water)

  • 62

    � Compound: composition by fraction of mass

    a = 14.01*g/mole;G4Element* elN =

    new G4Element(name="Nitrogen",symbol="N",z= 7.,a);

    a = 16.00*g/mole;G4Element* elO =

    new G4Element(name="Oxygen",symbol="O",z= 8.,a);

    density = 1.290*mg/cm3;

    G4Material* Air = new G4Material(name="Air",density,ncomponents=2);

    Air-> AddElement (elN, 70.0*perCent);Air-> AddElement (elO, 30.0*perCent);

    MaterialMaterial : compound (air): compound (air)

  • 63

    � Composition of compound materials

    G4Element* elC = …; // define “carbon” element

    G4Material* SiO2 = …; // define “quartz” material

    G4Material* H2O = …; // define “water” material

    density = 0.200*g/cm3;

    G4Material* Aerog =

    new G4Material("Aerogel",density,ncomponents=3);

    Aerog-> AddMaterial (SiO2,fractionmass=62.5*perCent);

    Aerog-> AddMaterial (H2O ,fractionmass=37.4*perCent);

    Aerog-> AddElement (elC ,fractionmass= 0.1*perCent);

    MaterialMaterial : mixture (: mixture (aerogelaerogel))

  • 64

    � It may be necessary to specify temperature and pressure– (dE/dx computation affected)

    G4double density = 27.*mg/cm3;G4double temperature = 325.*kelvin;G4double pressure = 50.*atmosphere;

    G4Material* CO2 =new G4Material(“CarbonicGas", density, ncomponents= 2

    kStateGas , temperature, pressure);CO2->AddElement (C,natoms = 1);CO2->AddElement (O,natoms = 2);

    Exemple : Exemple : gasgas(CO(CO22))

  • 65

    � Absolute vacuum does not exist . It is a gas at very low density !

    – Cannot define materials composed of multiple elemen ts through Z or A, or with ρρρρ = 0

    G4double atomicNumber = 1.;G4double massOfMole = 1.008*g/mole;G4double density = 1.e-25*g/cm3;G4double temperature = 2.73*kelvin;G4double pressure = 3.e-18*pascal;G4Material* Vacuum =

    new G4Material(“interGalactic", atomicNumber,massOfMole, density, kStateGas ,temperature, pressure);

    Exemple : vacuumExemple : vacuum

  • 66

    Material Material NISTNIST databasedatabase

    ====================================### Elementary Materials from the NIST Data Base

    ==================================Z Name ChFormula density(g/cm^3) I(eV)

    ====================================1 G4_H H_2 8.3748e-05 19.22 G4_He 0.000166322 41.83 G4_Li 0.534 404 G4_Be 1.848 63.75 G4_B 2.37 766 G4_C 2 817 G4_N N_2 0.0011652 828 G4_O O_2 0.00133151 959 G4_F 0.00158029 11510 G4_Ne 0.000838505 13711 G4_Na 0.971 14912 G4_Mg 1.74 15613 G4_Al 2.6989 16614 G4_Si 2.33 173

    � Elements� Compounds� Nuclear applications� Space applications

    ===================================### Compound Materials from the NIST Data Base ===================================N Name ChFormula density(g/cm^3) I(eV) ===================================13 G4_Adipose_Tissue 0.92 63.2

    1 0.1194776 0.637247 0.007978 0.23233311 0.000512 2e-0515 0.0001616 0.0007317 0.0011919 0.0003220 2e-0526 2e-0530 2e-05

    4 G4_Air 0.00120479 85.76 0.0001247 0.7552688 0.23178118 0.012827

    2 G4_CsI 4.51 553.153 0.4769255 0.52308

  • 67

    � No need to predefine elements and materials

    � Dedicated user interfaces

    G4NistManager* manager = G4NistManager::GetPointer( );

    G4Element* elm = manager-> FindOrBuildElement (“ symb”, G4bool iso);

    G4Element* elm = manager-> FindOrBuildElement (G4int Z, G4bool iso);

    G4Material* mat = manager-> FindOrBuildMaterial (“ name”, G4bool iso);

    G4Material* mat = manager-> ConstructNewMaterial (“name”, const std::vector& Z,const std::vector& weight,G4double density, G4bool iso);

    G4double isotopeMass = manager-> GetMass (G4int Z, G4int N);

    How to use How to use itit ??

  • 6870 minutes

    DetectorConstruction.hh (.cc)

    The The Geant4Geant4 toolkittoolkit ::4/15 4/15 -- GeometryGeometry constructionconstruction

  • 69

    OutlineOutline

    1. The basics2. Logical and physical volumes3. Solids4. Touchables5. Sensitive detector, digitizer 6. Magnetic field7. Visualization8. Advanced features9. Geometry examples

  • 70

    GeometryGeometry::1 1 –– the basicsthe basics

  • 71

    DescribeDescribeyouryour detectordetector

    � Derive your own concrete class from G4VUserDetectorConstruction abstract base class

    � Implementing the method Construct()

    Modularize it according to each detector component or s ub-detector :

    • Construct all necessary materials• Define shapes/solids required to describe the geometry• Construct and place volumes of your detector geometry�Options

    − Define sensitive detectors and identify detector vo lumes which to associate them

    − Associate magnetic field to detector regions− Define visualization attributes for the detector el ements

  • 72

    CreatingCreatinga detector volumea detector volume

    � Start with its Shape & Size– Box 3x5x7 cm, sphere R=8m

    � Add properties:– material, B/E field – (make it sensitive)

    � Place it within another volume– in one place– repeatedly using a function

    • Solid

    • Logical

    • Physical

  • 73

    DefineDefinedetector detector geometrygeometry

    � Three conceptual layers– G4VSolid : shape, size– G4LogicalVolume : daughter physical volumes, material,

    sensitivity, user limits, etc.– G4VPhysicalVolume : position, rotation

    G4Box

    G4Tubs

    G4VSolid G4VPhysicalVolume

    G4Material

    G4VSensitiveDetector

    G4PVPlacement

    G4PVParameterised

    G4VisAttributes

    G4LogicalVolume

  • 74

    � Basic strategy G4VSolid* pBoxSolid =

    new G4Box(“aBoxSolid”,

    1.*m, 2.*m, 3.*m);

    G4LogicalVolume* pBoxLog =

    new G4LogicalVolume ( pBoxSolid,

    pBoxMaterial, “aBoxLog”, 0, 0, 0);

    G4VPhysicalVolume* aBoxPhys =

    new G4PVPlacement ( pRotation,

    G4ThreeVector(posX, posY, posZ),

    pBoxLog, “aBoxPhys”, pMotherLog,

    0, copyNo);

    Solid : shape and sizeLogical volume : + material, sensitivity, etc.

    Physical volume :+ rotation and position

    GeometryGeometry

    A volume is placed in its mother volume . Position and rotation of the daughter volume is des cribed with respect to the

    local coordinate system of the mother volume . The origin of mother volume’s local coordinate syst em is at the center of the mother volume . Daughter volume cannot protrude from mother volume

  • 75

    � One logical volume can be placed more than once. One or more volumes can be placed to a mother volume.

    � Note that the mother-daughter relationship is an information of G4LogicalVolume .– If the mother volume is placed more than once, all

    daughters are by definition appear in all of mother physical volumes.

    � The world volume must be a unique physical volume which fully contains all the other volumes.– The world volume defines the global coordinate

    system . The origin of the global coordinate system is at the center of the world volume.

    – Position of a track is given with respect to the global coordinate system.

    GeometricalGeometricalhierarchyhierarchy

  • 76

    GeometryGeometry::2 2 –– logicallogical and and physicalphysicalvolumesvolumes

  • 77

    G4LogicalVolume ( G4VSolid * pSolid, G4Material * pMaterial,const G4String & name, G4FieldManager * pFieldMgr=0,G4VSensitiveDetector * pSDetector=0,G4UserLimits * pULimits=0,G4bool optimise=true);

    – Contains all information of volume except position:• Shape and dimension ( G4VSolid )• Material, sensitivity, visualization attributes• Position of daughter volumes• Magnetic field, User limits• Shower parameterisation

    – Physical volumes of same type can share a logical v olume.– The pointers to solid and material must be NOT null– Once created it is automatically entered in the LV store– It is not meant to act as a base class

    1)1) G4LogicalVolumeG4LogicalVolume

  • 78

    2)2) G4VPhysicalVolumeG4VPhysicalVolume

    – G4PVPlacement 1 Placement = ONE volume• A volume instance positioned once in a mother volum e

    – G4PVParameterised 1 Parameterised = MANY Volumes• Parameterised by the copy number

    – Shape, size, material, position and rotation can be parameterised, by implementing a concrete class of G4VPVParameterisation .

    • Reduction of memory consumption – Currently: parameterisation can be used only for vol umes that either

    • have no further daughters• are identical in size & shape

    – G4PVReplica 1 Replica = MANY Volumes• Slicing a volume into smaller pieces (if it has a s ymmetry)

  • 79

    2)2) G4VPhysicalVolumeG4VPhysicalVolume-- nextnext

    repeated

    placement

    � Placement : it is one positioned volume

    � Repeated : a volume placed many times– can represent any number of volumes– reduces use of memory– Replica

    • simple repetition, similar to G3 divisions– Parameterised

    � A mother volume can contain either– many placement volumes OR– one repeated volume

  • 80

    G4VPhysicalVolumeG4VPhysicalVolume

    G4PVPlacementG4PVParameterisedG4PVReplicaG4PVDivision

  • 81

    G4PVPlacement ( G4RotationMatrix * pRot,const G4ThreeVector & tlate,G4LogicalVolume * pCurrentLogical,const G4String & pName,G4LogicalVolume * pMotherLogical,G4bool pMany,G4int pCopyNo);

    � Single volume positioned relatively to the mother v olume– In a frame rotated and translated relative to the c oordinate system of the

    mother volume

    � Three additional constructors– A simple variation: specifying the mother volume as a pointer to its physical

    volume instead of its logical volume.– Using G4Transform3D to represent the direct rotation and translation of the

    solid instead of the frame– The combination of the two variants above

    G4PVPlacementG4PVPlacement

  • 82

    G4PVPlacementG4PVPlacementG4PVPlacement ( G4RotationMatrix* pRot, // rotation of mother frame

    const G4ThreeVector &tlate, // position in rotated frame

    G4LogicalVolume *pDaughterLogical,

    const G4String &pName,

    G4LogicalVolume *pMotherLogical,

    G4bool pMany, // ‘true’ not implemented yet…

    G4int pCopyNo, // unique arbitrary integer

    G4bool pSurfChk=false); // optional : boundary chec k

    rotation

    translation in

    the frame

    after rotation

    Mother volume

  • 83

    G4PVPlacement (

    G4Transform3D ( G4RotationMatrix &pRot, // rotation of mother frame

    const G4ThreeVector &tlate), // position in mother frame

    G4LogicalVolume *pDaughterLogical,

    const G4String &pName,

    G4LogicalVolume *pMotherLogical,

    G4bool pMany,

    G4int pCopyNo,

    G4bool pSurfChk=false);

    rotation

    Mother volume

    Translation in

    mother frame

    Alternative Alternative G4PVPlacementG4PVPlacement

  • 84

    G4VPhysicalVolumeG4VPhysicalVolume

    G4PVPlacementG4PVParameterisedG4PVReplicaG4PVDivision

  • 85

    � User written functions define:– the size of the solid (dimensions)

    • function ComputeDimensions(…)

    – where it is positioned (transformation)• function ComputeTransformations(…)

    � Optional:– the type of the solid

    • function ComputeSolid(…)

    – the material• function ComputeMaterial(…)

    � Limitations:– Applies to simple CSG solids only– Daughter volumes allowed only for special cases

    � Very powerful:– Consider parameterised volumes as “leaf” volumes

    ParameterisedParameterisedphysicalphysicalvolumesvolumes

  • 86

    �Complex detectors– with large repetition of

    volumes• regular or irregular

    �Medical applications– the material in animal

    tissue is measured• cubes with varying material

    Use of Use of parameterisedparameterisedvolumesvolumes

  • 87

    G4PVParameterised (const G4String & pName,

    G4LogicalVolume * pCurrentLogical,

    G4LogicalVolume * pMotherLogical,

    const EAxis pAxis,

    const G4int nReplicas,

    G4VPVParameterisation * pParam);

    � Replicates the volume nReplicas times using the parameterisation pParam , within the mother volume

    � The positioning of the replicas is dominant along t he specified Cartesian axis– If kUndefined is specified as axis, 3D voxelisation for optimisati on of the

    geometry is adopted

    � Represents many touchable detector elements differi ng in their positioning and dimensions. Both are calculated by means of a G4VPVParameterisation object

    � Alternative constructor using pointer to physical v olume for the mother

    G4PVParameterisedG4PVParameterised

  • 88

    G4VPhysicalVolumeG4VPhysicalVolume

    G4PVPlacementG4PVParameterisedG4PVReplicaG4PVDivision

  • 89repeated

    � The mother volume is sliced into replicas, all of the same size and dimensions.

    � Represents many touchable detector elements differi ng only in their positioning.

    � Replication may occur along:– Cartesian axes (X, Y, Z) – slices are considered

    perpendicular to the axis of replication• Coordinate system at the center of each replica

    – Radial axis (Rho) – cons/tubs sections centered on the origin and un-rotated

    • Coordinate system same as the mother– Phi axis (Phi) – phi sections or wedges, of cons/tubs form

    • Coordinate system rotated such as that the X axis bisects the angle made by each wedge

    ReplicatedReplicatedphysicalphysicalvolumesvolumes

  • 90

    G4PVReplica (const G4String & pName,G4LogicalVolume * pCurrentLogical,G4LogicalVolume * pMotherLogical,const EAxis pAxis,const G4int nReplicas,const G4double width,const G4double offset=0);

    � Alternative constructor: using pointer to physical volume for the mother

    � An offset can only be associated to a mother offset along the axis of replication

    � Features and restrictions:– Replicas can be placed inside other replicas– Normal placement volumes can be placed inside repli cas, assuming no

    intersection/overlaps with the mother volume or wit h other replicas– No volume can be placed inside a radial replication– Parameterised volumes cannot be placed inside a repl ica

    A daughter volume to be replicated

    mother volume

    G4PVReplicaG4PVReplica

  • 91

    � Cartesian axes - kXaxis,kYaxis,kZaxis

    – offset shall not be used

    – Center of n-th daughter is given as

    -width*(nReplicas-1)*0.5+n*width

    � Radial axis - kRaxis

    – Center of n-th daughter is given as

    width*(n+0.5)+offset

    � Phi axis - kPhi

    – Center of n-th daughter is given as

    width*(n+0.5)+offsetoffset

    width

    offset

    width

    width

    Replica Replica –– axis, width, offsetaxis, width, offset

  • 92

    G4VPhysicalVolumeG4VPhysicalVolume

    G4PVPlacementG4PVParameterisedG4PVReplicaG4PVDivision

  • 93

    � Implemented as “special” kind of parameterised volumes– Applies to CSG-like solids only (box, tubs, cons, p ara, trd, polycone, polyhedra)– Divides a volume in identical copies along one of i ts axis (copies are not strictly

    identical)• e.g. - a tube divided along its radial axis• Offsets can be specified

    � The possible axes of division vary according to the supported solid type

    � Represents many touchable detector elements differi ng only in their positioning

    � G4PVDivision is the class defining the division– The parameterisation is calculated automatically usi ng the values provided in

    input

    G4PVDivisionG4PVDivision

  • 94

    GeometryGeometry::3 3 -- solidssolids

  • 95

    � Abstract class

    � All solids in Geant4 derive from it– Defines but does not implement

    all functions required to:• compute distances to/from the shape• check whether a point is inside the

    shape• compute the extent of the shape• compute the surface normal to the

    shape at a given point

    � Once constructed, each solid is automatically registered in a specific solid store

    G4VSolidG4VSolid

  • 96

    Solids defined in Geant4

    – CSG (Constructed Solid Geometry) solids• G4Box, G4Tubs, G4Cons, G4Trd , …• Analogous to simple Geant3 CSG solids

    – Specific solids (CSG like)• G4Polycone, G4Polyhedra, G4Hype, …

    • G4TwistedTubs, G4TwistedTrap , …

    – BREP (Boundary REPresented) solids• G4BREPSolidPolycone, G4BSplineSurface , …• Any order surface

    – Boolean solids• G4UnionSolid, G4SubtractionSolid , …

    SolidsSolids

  • 97

    G4Tubs(const G4String& pname, // name

    G4double pRmin, // inner radius

    G4double pRmax, // outer radius

    G4double pDz, // Z half length

    G4double pSphi, // starting Phi

    G4double pDphi); // segment angle

    G4Cons(const G4String& pname, // name

    G4double pRmin1, // inner radius -pDz

    G4double pRmax1, // outer radius -pDz

    G4double pRmin2, // inner radius +pDz

    G4double pRmax2, // outer radius +pDz

    G4double pDz, // Z half length

    G4double pSphi, // starting Phi

    G4double pDphi); // segment angle

    CSGCSG: : G4TubsG4Tubs, , G4ConsG4Cons

  • 98

    CSG: G4Box, G4TubsCSG: G4Box, G4Tubs

    G4Box(const G4String &pname, // name

    G4double half_x, // X half size

    G4double half_y, // Y half size

    G4double half_z); // Z half size

    G4Tubs(const G4String &pname, // name

    G4double pRmin, // inner radius

    G4double pRmax, // outer radius

    G4double pDz, // Z half length

    G4double pSphi, // starting Phi

    G4double pDphi); // segment angle

  • 99

    Other Other CSGCSGsolidssolids

    G4Cons

    G4Para(parallelepiped)

    G4Trd

    G4Trap

    G4Sphere G4Orb(full sphere)

    G4Torus

    Consult Geant4 Application Developers Guide for all available shapes.

  • 100

    G4Polycone (const G4String & pName,

    G4double phiStart,

    G4double phiTotal,

    G4int numRZ,

    const G4double r[],

    const G4double z[]);

    ● numRZ: numbers of corners in the r,z space● r, z : coordinates of corners

    ● Additional constructor

    Specific Specific CSGCSGSolids: Solids: G4PolyconeG4Polycone

  • 101

    Other Specific Other Specific CSGCSGsolidssolids

    G4Polyhedra

    G4EllipticalTube G4Ellipsoid

    G4EllipticalCone

    G4HypeG4Tet(tetrahedra)

    G4TwistedBox G4TwistedTrdG4TwistedTrap

    G4TwistedTubs

    Consult Geant4 Application Developers Guide for all available shapes.

  • 102

    � BREP = Boundary REPresented Solid

    � Listing all its surfaces specifies a solid– e.g. 6 squares for a cube

    � Surfaces can be– planar, 2 nd or higher order

    • elementary BREPS

    – Splines, B-Splines, NURBS (Non-Uniform B-Splines)

    • advanced BREPS

    � Few elementary BREPS pre-defined– box, cons, tubs, sphere, torus, polycone, polyhedra

    � Advanced BREPS built through CAD systems

    BREPBREPsolidssolids

  • 103

    G4BREPSolidPolyhedra (const G4String & pName,G4double phiStart,G4double phiTotal,G4int sides,G4int nZplanes,G4double zStart,

    const G4double zval[],const G4double rmin[],const G4double rmax[]);

    � sides - numbers of sides of each polygon in the x-y plane� nZplanes - numbers of planes perpendicular to the z axis� zval[] - z coordinates of each plane� rmin[], rmax[] - radii of inner and outer polygon at each plane

    BREPSBREPS::G4BREPSolidPolyhedraG4BREPSolidPolyhedra

  • 104

    Boolean solidsBoolean solids� Solids can be combined using boolean operations:

    – G4UnionSolid, G4SubtractionSolid, G4IntersectionSol id

    – Requires: 2 solids, 1 boolean operation, and an (opt ional) transformation for the 2 nd solid

    – 2nd solid is positioned relative to the coordinate syst em of the 1 st solid

    – Result of boolean operation becomes a solid. Thus th e third solid can be combined to the resulting solid of first operation.

    � Solids to be combined can be either CSG or other Boo lean solids.

    � Note: tracking cost for the navigation in a complex Boole an solid is proportional to the number of constituent CSG solids

    G4UnionSolid G4IntersectionSolidG4SubtractionSolid

  • 105

    Boolean solidsBoolean solids

  • 106

    Boolean Solids Boolean Solids -- exampleexample

    G4VSolid* box = new G4Box(“Box",50*cm,60*cm,40*cm);

    G4VSolid* cylinder

    = new G4Tubs(“Cylinder”,0.,50.*cm,50.*cm,0.,2*M_PI* rad);

    G4VSolid* union

    = new G4UnionSolid ("Box+Cylinder", box, cylinder);

    G4VSolid* subtract

    = new G4SubtractionSolid ("Box-Cylinder", box, cylinder,

    0, G4ThreeVector(30.*cm,0.,0.));

    G4RotationMatrix* rm = new G4RotationMatrix();

    rm->RotateX(30.*deg);

    G4VSolid* intersect

    = new G4IntersectionSolid ("Box&&Cylinder",

    box, cylinder, rm, G4ThreeVector(0.,0.,0.));

    � The origin and the coordinates of the combined soli d are the same as those of the first solid .

  • 107

    GeometryGeometry::4 4 -- touchablestouchables

  • 108

    TouchablesTouchables

    � Suppose a geometry is made of 4x5 voxels and it is implemented by two levels of replica .

    � In reality, there is only one physical volume object for each level. Its position is parameterized by its copy number. To get the copy number of each level , use touchable to get the copy number of each level

    CopyNo = 0

    CopyNo = 1

    CopyNo = 2

    CopyNo = 3

    0

    0

    0

    0

    1

    1

    1

    1

    2

    2

    2

    2

    3

    3

    3

    3

    4

    4

    4

    4

    � G4VTouchable has a method GetCopyNumber(G4int nLevel=0)

    – nLevel = 0 : returns the copy number of the bottom l evel

    – nLevel = 1 : returns the copy number of the mother v olume

    – nLevel = 2 : returns the copy number of the grandmot her volume, etc.

  • 109

    GeometryGeometry::5 5 –– sensitive detector and digitizersensitive detector and digitizer

  • 110

    � A logical volume becomes sensitive if it has a pointer to a concrete class derived from G4VSensitiveDetector

    � A sensitive detector either– constructs one or more hit objects or – accumulates values to existing hits

    using information given in a G4Step object

    NOTE: you must get the volume information from the “PreStepPoint ”

    Detector sensitivityDetector sensitivity

  • 111

    Sensitive detector and hitSensitive detector and hit

    � Each “Logical Volume ” can have a pointer to a sensitive detector

    � Hit is a snapshot of the physical interaction of a track or an accumulation of interactions of tracks in the sensit ive region of your detector

    � A sensitive detector creates hit(s) using the information given in G4Step object. The user has to provide his/her own implementation of the detector response

    � Hit objects, which still are the user ’s class objects, are collected in a G4Event object at the end of an event.

    – The UserSteppingAction class should NOT do this

  • 112

    � Hit is a user-defined class derived from G4VHit

    � You can store various types information by implementing your own concrete Hit class

    � For example:– Position and time of the step – Momentum and energy of the track – Energy deposition of the step – Geometrical information – or any combination of above

    Hit class Hit class –– 11

  • 113

    � Hit objects of a concrete hit class must be stored in a dedicated collection which is instantiated from G4THitsCollection template class

    � The collection will be associated to a G4Event object via G4HCofThisEvent

    � Hits collections are accessible – through G4Event at the end of event,– through G4SDManager during processing an event•Used for Event filtering

    Hit class Hit class -- 22

  • 114

    � Readout geometry is a virtual and artificial geometry which can be defined in parallel to the real detector geometry

    � A readout geometry is optional

    � Each one is associated to a sensitive detector

    ReadoutReadoutgeometrygeometry

  • 115

    � Digit represents a detector output (e.g. ADC/TDC count, trigger signal)

    � Digit is created with one or more hits and/or other digits by a concrete implementation derived from G4VDigitizerModule

    � In contradiction to the Hit which is generated at tracking time automatically, the digitize() method of each G4VDigitizerModule must be explicitly invoked by the user ’s code (e.g. EventAction)

    DigitizationDigitization

  • 116

    � Basic strategy

    G4LogicalVolume* myLogCalor = ……;

    G4VSensitiveDetector * pSensitivePart =new MyCalorimeterSD (“/mydet/calorimeter”);

    G4SDManager* SDMan = G4SDManager::GetSDMpointer();

    SDMan->AddNewDetector( pSensitivePart );

    myLogCalor-> SetSensitiveDetector ( pSensitivePart ) ;

    Defining a sensitive detectorDefining a sensitive detector

  • 117

    Geometry :Geometry :6 6 –– magnetic fieldmagnetic field

  • 118

    Magnetic fieldMagnetic field� Create your magnetic field class

    – Uniform field : use a G4UniformMagField class object

    G4MagneticField* magField =

    new G4UniformMagField(G4ThreeVector(1.*Tesla,0.,0.) ;

    – Non uniform field : create a concrete class derived from G4MagneticField

    and implement the GetFieldValue method

    void MyField::GetFieldValue(

    const double Point[4], double *field) const

    • Point[0..2] are the positions in the GLOBAL reference frame

    • Point[3] is time

    • field[0..2] returns magnetic field coordinates

    � Also, possibility to define any kind of field !

  • 119

    Field integrationField integration

    � In order to propagate a particle inside a field (e .g. magnetic, electric or both), we solve the equation of motion of the particle in the field.

    � We use a Runge-Kutta method for the integration of t he ordinary differential equations of motion.

    – Several Runge-Kutta ‘steppers ’ are available.

    � In specific cases other solvers can also be used:

    – In a uniform field, using the analytical solution.

    – In a smooth but varying field, with RK+helix.

    � Using the method to calculate the track's motion in a field, Geant4 breaks up this curved path into linear chord segments.

    – We determine the chord segments so that they closel y approximate the curved path.

    Tracking StepChords

    Real trajectory

  • 120

    Tracking in fieldTracking in field

    � We use the chords to interrogate the G4Navigator , to see whether the track has

    crossed a volume boundary.

    � One physics/tracking step can create several chords .

    – In some cases, one step consists of several helix t urns.

    � User can set the accuracy of the volume intersectio n,

    – By setting a parameter called the “miss distance ”

    • It is a measure of the error in whether the approxi mate track intersects a volume.

    • It is quite expensive in CPU performance to set too small “miss distance ”.

    "miss distance"

    Tracking stepChords

    Real trajectory

  • 121

    ExampleExample

    � Tell Geant4 to use your field

    1. Find the global Field Manager

    G4FieldManager* globalFieldMgr =

    G4TransportationManager::GetTransportationManager()

    -> GetFieldManager();

    2. Set the field for this FieldManager,

    globalFieldMgr-> SetDetectorField(magField);

    3. and create a Chord Finder.

    globalFieldMgr-> CreateChordFinder(magField);

    � $G4INSTALL/example/novice/N04/ExN04 is a good starting point

  • 122

    GeometryGeometry::7 7 -- vvisualizationisualization

  • 123

    Visualization of detectorVisualization of detector

    � Each logical volume can have associated a G4VisAttributes object– Visibility, visibility of daughter volumes– Color, line style, line width– Force flag to wire-frame or solid-style mode

    � For parameterised volumes, attributes can be dynamically assigned to the logical volume

    � Lifetime of visualization attributes must be at lea st as long as the objects they ’re assigned to

  • 124

    Visualization of hits and trajectoriesVisualization of hits and trajectories

    � Each G4VHit concrete class must have an implementation of Draw() method.– Colored marker– Colored solid– Change the color of detector element

    � G4Trajectory class has a Draw() method.– Blue : positive– Green : neutral – Red : negative– You can implement alternatives by yourself

  • 125

    GeometryGeometry::8 8 –– advancedadvancedfonctionsfonctions

  • 126

    Cuts by regionCuts by region

    � Geant4 has had a unique production threshold (‘cut ’) expressed in length (i.e. minimum range of secondary)– For all volumes– Possibly different for each particle.

    � Yet appropriate length scales can vary greatly between differentareas of a large detector– E.g. a vertex detector (5 µµµµm) and a muon detector (2.5 cm)– Having a unique (low) cut can create a performance penalty

    � Geant4 allows for several cuts– Globally or per particle– Enabling the tuning of production thresholds at the level of a sub-

    detector, i.e. region– Cuts are applied only for gamma, electron and positron and only for

    processes which have infrared divergence

  • 127

    Detector regionDetector region

    � Concept of region– Set of geometry volumes ,

    typically of a sub-system• barrel + end-caps of the

    calorimeter;• “Deep” areas of support

    structures can be a region.– Or any group of volumes

    � A set of cuts in range is associated to a region– a different range cut for each

    particle among gamma, e-, e+ is allowed in a region

    Region

    B

    Region

    B

    DefaultRegion Region B

    Region B

    Region A

    CC

  • 128

    Region and cutRegion and cut

    � Each region has its unique set of cuts.

    � World volume is recognized as the default region. The default cuts defined in Physics list are used for it.

    – User is not allowed to define a region to the world volume or a cut to the default region

    � A logical volume becomes a root logical volume once it is assigned to a region.

    – All daughter volumes belonging to the root logical volume share the same region (and cut), unless a daughter volume itself becomes to another root

    � Important restriction :No logical volume can be shared by more than

    one regions, regardless of root volume or not

    World Volume - Default Region

    Root logical - Region A

    Root logical

    - Region B

  • 129

    GGEGGE(Graphical Geometry Editor)(Graphical Geometry Editor)

    � Implemented in JAVA, GGE is a graphical geometry editor compliant to Geant4 . It allows to :– Describe a detector geometry including:

    • materials, solids, logical volumes, placements – Graphically visualize the detector geometry using a

    Geant4 supported visualization system, e.g. DAWN – Store persistently the detector description – Generate the C++ code according to the Geant4

    specifications

    � GGE can be downloaded from Web as a separate tool :

    http://erpc1.naruto-u.ac.jp/~geant4/

  • 130

    Computing volumes and massesComputing volumes and masses

    � Geometrical volume of a generic solid or boolean composition can be computed from the solidG4double GetCubicVolume();

    � Overall mass of a geometry setup (subdetector) can be computed from the logical volumeG4double GetMass(G4Bool forced=false,

    G4Material* parameterisedMaterial=0);

  • 131

    Debugging geometriesDebugging geometries

    � An overlapping volume is a contained volume which actually protrud es from its mother volume

    – Volumes are also often positioned in a same volume with the intent of not provoking intersections between themselves. When volumes in a common mother actually intersect themselves are defined as overlapping

    � Geant4 does not allow for malformed geometries

    � The problem of detecting overlaps between volumes i s bounded by the complexity of the solid models description

    � Utilities are provided for detecting wrong position ing– Graphical tools (DAVID, OLAP)– Kernel run-time commands

  • 132

    Moving objectsMoving objects

    � In some applications, it is essential to simulate t he movement of

    some volumes.

    – E.g. particle therapy simulation

    � Geant4 can deal with moving volume

    – In case speed of the moving volume is slow enough c ompared to

    speed of elementary particles, so that you can assu me the position of

    moving volume is still within one event.

    � Two tips to simulate moving objects :

    1. Use parameterized volume to represent the moving volume.

    2. Do not optimize (voxelize) the mother volume of the moving

    volume(s).

  • 133

    GeometryGeometry9 9 -- examplesexamples

  • 134Vertex localizer

    LHCb detector at CERNCourtesy of the LHCb Collaboration

  • SUSY events

    Courtesy of the CMS Collaboration

    CMS detector at CERN

  • Courtesy of the ATLAS Collaboration

    ATLAS detector at CERN

  • 137Courtesy of H.Ikeda (Tohoku)

    Anti-neutrino detector – Kamioka liquid scintillator

  • 138

    Cou

    rtes

    y T

    . Ers

    mar

    k, K

    TH

    Sto

    ckho

    lm

    International Space Station

  • 139

    MoreMore

  • 140

    G4VSolid* solidChamber = new G4Box("chamber", 100*cm, 100*cm, 10*cm);

    G4LogicalVolume* logicChamber =

    new G4LogicalVolume (solidChamber, ChamberMater, "Chamber", 0, 0, 0);

    G4double firstPosition = -trackerSize + 0.5*ChamberWi dth;

    G4double firstLength = fTrackerLength/10;

    G4double lastLength = fTrackerLength;

    G4VPVParameterisation * chamberParam =

    new ChamberParameterisation ( NbOfChambers, firstPosition,

    ChamberSpacing, ChamberWidth,

    firstLength, lastLength);

    G4VPhysicalVolume * physChamber =

    new G4PVParameterised ( "Chamber", logicChamber, logicTracker,

    kZAxis, NbOfChambers, chamberParam );

    Use kUndefined to activate voxelization 3D for optimization

    ParameterizationParameterization: : exampleexample

  • 141

    class ChamberParameterisation : public G4VPVParameterisation

    {

    public:

    ChamberParameterisation ( G4int NoChambers, G4double startZ,

    G4double spacing, G4double widthChamber,

    G4double lenInitial, G4double lenFinal );

    ~ChamberParameterisation ();

    void ComputeTransformation (const G4int copyNo,

    G4VPhysicalVolume* physVol) const;

    void ComputeDimensions (G4Box& trackerLayer, const G4int copyNo,

    const G4VPhysicalVolume* physVol) const;

    }

    ParameterizationParameterization: : exampleexample-- nextnext

  • 142

    void ChamberParameterisation:: ComputeTransformation

    (const G4int copyNo , G4VPhysicalVolume* physVol ) const

    {

    G4double Zposition= fStartZ + (copyNo+1) * fSpacing;

    G4ThreeVector origin(0, 0, Zposition);

    physVol->SetTranslation(origin);

    physVol->SetRotation(0);

    }

    void ChamberParameterisation:: ComputeDimensions

    (G4Box& trackerChamber , const G4int copyNo ,

    const G4VPhysicalVolume* physVol ) const

    {

    G4double halfLength= fHalfLengthFirst + copyNo * fHa lfLengthIncr;

    trackerChamber.SetXHalfLength(halfLength);

    trackerChamber.SetYHalfLength(halfLength);

    trackerChamber.SetZHalfLength(fHalfWidth);

    }

    ParameterizationParameterization: : exampleexample-- end end

  • 143

    G4double tube_dPhi = 2.* M_PI;

    G4VSolid * tube =new G4Tubs("tube", 20*cm, 50*cm, 30*cm, 0., tube_dP hi*rad);

    G4LogicalVolume * tube_log =new G4LogicalVolume(tube, Ar, "tubeL", 0, 0, 0);

    G4VPhysicalVolume * tube_phys =new G4PVPlacement(0,G4ThreeVector(-200.*cm, 0., 0.* cm),

    "tubeP", tube_log, world_phys, false, 0);

    G4double divided_tube_dPhi = tube_dPhi/6.;

    G4VSolid * divided_tube =new G4Tubs("divided_tube", 20*cm, 50*cm, 30*cm,

    -divided_tube_dPhi/2.*rad, divided_tube_dPhi*rad);

    G4LogicalVolume * divided_tube_log =new G4LogicalVolume(divided_tube, Ar, "div_tubeL", 0, 0, 0);

    G4VPhysicalVolume * divided_tube_phys =new G4PVReplica ("divided_tube_phys", divided_tube_log, tube_log,

    kPhi, 6, divided_tube_dPhi);

    ReplicaReplica: : examplesexamples

  • 14420 minutes

    PhysicsList.hh (.cc)

    The The Geant4Geant4 toolkittoolkit ::5/15 5/15 -- ElectromagneticElectromagneticPhysicsPhysics((QEDQED))STANDARD versionSTANDARD version

  • 145

    ContentContent

    � Available EM Physics processes� How to use them ?� Important processes

    – Compton scattering– Ionization– Multiple scattering

  • 146

    AvailableAvailablepackagespackages� Standard

    – from 1 keV– gammas, e+- up to 100 TeV– Hadrons up to 100 TeV– ions up to 100 TeV

    � Muons– Up to 1 PeV

    � Rayons X– Processes for X ray and optical photons production

    � Optical– Interactions of optical photons

    � High energy– High energy processes (E>10GeV)– Exotic particles physics

    � Polarization– Polarized beams

  • 147

    Photons and Photons and electronselectrons

    � Photons– Conversion into e+e-– Compton scattering– Photoelectric effect– Rayleigh scattering

    in low energy package– Photo-nuclear interactions in the– Hadronic sub-package CHIPS

    � Electrons and positrons– Ionization– Coulomb scattering– Bremsstrahlung– Nuclear interactions in the hadronic

    sub-package CHIPS– Positron annihilation

    Calorimeter

    Medical linac

  • 148

    MuonsMuons

    � Ionization� Bremsstrahlung� e+e- pair production� Muon-nucleus interactions in hadronic packages

  • 149

    Hadrons and ionsHadrons and ions

    � Coulomb scattering� Ionization

    – Corrected Bethe-Bloch formula for E>2 MeV

    – Parametrizations of Bragg peak for E< 2 MeV

    (from ICRU’49 & NIST databases)

  • 150

    X rays and X rays and opticalopticalphotonsphotons

    � Standard package– Cherenkov radiation– Synchrotron radiation– Transition radiation– Scintillation

    � Low energy package– Atomic relaxation (fluorescence & Auger transitions)

    � Optical– Reflexion– Refraction– Absorption– Rayleigh scattering

  • 151

    How to use How to use EMEM processesprocesses??

  • 152

    PhysicsPhysicslistlist

    � For each particle type, the ProcessManager maintains a list of applicable processes

    � Three types of processes– Action at rest : AtRest– Action along step : AlongStep– Action after step : PostStep

    � Declared in the UserPhysicsList class

  • 153

    ExampleExampleof of PhysicsPhysicslistlist (1)(1)

    The -1 parameter indicates inactive DoIt

    AtRestDoIt

    AlongStepDoIt

    PostStepDoIt

  • 154

    ExampleExamplede de PhysicsPhysicslistlist (2)(2)

  • 155

    ExampleExampleof of PhysicsPhysicslistlist (3)(3)

    Order has no importance for processes with PostStepAction only

    … is a shortcut of …

  • 156

    ExamplesExamplesof of processesprocesses

  • 157

    Compton Compton scatteringscattering

    � Describes photon scattering by quasi-free atomic electron sγγγγ + e ➠➠➠➠ γγγγ′′′′ + e′′′′

    � Each electron behaves as an independent target : it is an incoherent scattering

    Cross section per atom = Z x Cross section per electron

    � The differential cross section in scattered energy isdescribed by the Klein-Nishina formula , corrected by a factor taking into account the binding energy of the atomi celectron

    � Linked to annihilitation (e+,e-) by crossing symmetry

  • 158

    ExampleExampleof Compton of Compton scatteringscattering

    10 MeV10 MeV γγγγγγγγ in 10 cm Alin 10 cm Al

  • 159

    IonizationIonization

    � The base mechanism is an inelastic collision of the moving charged particle with the material atomic electrons , ejecting an atomic electron

    µµµµ + atom ➠➠➠➠ µµµµ + atom + + e-

    � During each individual collision, the energy transferred to the electron is small . But the total number of collisions is large and one can define a mean energy loss per macroscopic unit of range

  • 160

    GenerationGenerationof of secondarysecondaryelectronselectrons((delta raysdelta rays))

    � In Geant4, one may choose to simulate or not ejected electrons ( delta electrons ) and their interactions with energies above a threshold Tcut

    – Below this threshold , electrons are taken into account in the continuous energy loss of the ionizing particle a nd they are not explicitly simulated

    – above , they are explicitly generated. They are excluded from the continuous energy loss of the ionizing parti cle.

    � The continuous energy loss is computed from the troncated Bethe Bloch formula (dE/dx for T

  • 161

    ExampleExampleof delta ray productionof delta ray production

    ee--, p, , p, αααααααα of 200 MeV in 1 cm Alof 200 MeV in 1 cm Al

  • 162

    EnergyEnergylosslossfluctuations fluctuations ((stragglingstraggling))

    � The Bethe Bloch formula only gives the mean energy loss per ionization. There are fluctuations(straggling ). The distribution of the energy loss ∆Ε∆Ε∆Ε∆Ε within a thickness ∆∆∆∆x can be very dissymmetric ( Landau distribution )

    � Large fluctuations are caused by rare collisions having large energy transfers

  • 163

    16 MeV e16 MeV e-- in 10 cm waterin 10 cm water 105 MeV p in 10 cm water105 MeV p in 10 cm water

    StragglingStragglingexampleexample

    Fluctuations on ∆∆∆∆E ➠➠➠➠ fluctuations on range

  • 164

    Multiple Coulomb Multiple Coulomb scatteringscattering

    � Charged particles travelling through a finitethickness of matter undergo multiple elasticCoulomb scattering.

    � The cumulated effect of these small angle scatterings lead to a global deviation of the particle’s direction of propagation.

    � Theory by Lewis

  • 165

    Multiple Multiple scatteringscatteringexampleexample

  • 16635 minutes

    PhysicsList.hh (.cc)

    The The Geant4Geant4 toolkittoolkit ::6/15 6/15 -- ElectromagneticElectromagneticPhysicsPhysics((QEDQED))LOW LOW ENERGYENERGY versionversion

  • 167

    ContentContent

    � Introduction

    � Processes based on the Livermore database

    � Processes based on the Monte Carlo code Penelope

    � How to use this package ?

  • 168

    The low energy packageThe low energy package

    � A package in the Geant4 electromagnetic package→→→→ in $G4INSTALL/source/processes/electromagnetic/lowener gy/

    � A set of processes extending the coverage of electr omagnetic interactions in Geant4down to “low” energy

    – 250 eV (in principle even below this limit) / 100 eV for electrons and photons– down to approximately the ionization potential of the interacting material for hadrons and ions– up to 100 GeV (unless specified)– based on theoretical models and evaluated data sets ; they involve two distinct phases :

    • calculation and use of total cross sections• generation of the final state

    � Models are detailed– shell structure of the atom– precise angular distributions

    � Complementary to the “standard” electromagnetic package

    � Driven by requirements which come from medicine and space research and from users in HEP instrumentation

  • 169

    Come in two “flavours” of models: • based on the Livermore Library• à la Penelope (+ positron annihil.)

    Photons• Compton Scattering • Compton Scattering by Linearly Polarized Gamma Rays • Rayleigh Scattering • Gamma Conversion • Photoelectric effect

    Electrons• Bremsstrahlung• Ionisation

    Hadrons and ion ionisation• Energy loss of slow & fast hadrons• Energy loss in compounds• Delta-ray production • Effective charge of ions• Barkas and Bloch effects (hadron sign + relativistic)• Nuclear stopping power • PIXE

    Atomic relaxation• Fluorescence• Auger process

    Overview of PhysicsOverview of Physics

  • 170

    A set of LowE processes are based on the

    Livermore Library

  • 171

    � Based on evaluated data librairies from LLNL :– EADL (Evaluated Atomic Data Library) – EEDL (Evaluated Electrons Data Library)– EPDL97 (Evaluated Photons Data Library)

    � Validity range : 250 eV - 100 GeV– The processes can be used down to 100 eV , with degraded accuracy

    – In principle the validity range of the data librari es extends down to ~10 eV

    � Elements Z=1 to Z=100– Atomic relaxation : Z > 5 (transition data available in EADL)

    Photons and electronsPhotons and electrons

  • 172

    ( )( ) ( ) ( ) ( ) ( )( )121221

    /log

    /loglog/logloglog

    EE

    EEEEE

    σσσ +=

    ( )∑ ⋅=

    iii nEσ

    λ 1

    E1 and E2 are the lower and higher energy for which data (σ1 and σ2) are available

    ni = atomic density of the ith element contributing to the material composition

    →→→→ Interpolation from the data libraries

    CalculationCalculationof cross sectionsof cross sections

    → Mean free path for a process, at energy E :

  • 173

    PhotonsPhotons

  • 174

  • 175

    � Energy distribution of the scattered photon according to the Klein-Nishina formula, multiplied by scattering function F(q) (Hubbel ’satomic factor) from EPDL97 data library

    � The effect of scattering function becomes significan t at low energies in suppressing forward scattering

    � Angular distribution of the scattered photon and

    the recoil electron also based on EPDL97

    Klein-Nishina cross section (E’/E) × Scattering Function (q)

    q = E sin2 (θ/2) momentum transfer

    Compton Compton scatteringscattering((incoherentincoherent))

  • 176

    � Depends on charge distribution of atom

    � Angular distribution

    F(E,θθθθ)=[1+cos 2(θθθθ)]sin θ⋅θ⋅θ⋅θ⋅F2(q)

    Rayleigh formula times F(q), the energy dependent Hubbel’sform factor obtained from EPDL97 (forward peak at high energies)

    � Only available in the lowenergy package

    Rayleigh Rayleigh scatteringscattering((coherentcoherent))

  • 177

    � Cross section– Integrated cross section (over the shells)

    from EPDL + interpolation– Shell from which the electron is emitted selected a ccording to

    the detailed cross sections of the EPDL library

    � Final state generation– Various angular distribution generators

    (“naïve”, Sauter-Gavrila, Gavrila)

    � De-excitation via the atomic relaxation sub-process– Initial vacancy + following chain of vacancies crea ted

    PhotoelectricPhotoelectriceffecteffect

  • 178

    � The secondary e - and e+ energies are sampled using Bethe-Heitler cross sections with Coulomb correction (screening)

    � e- and e+ assumed to have symmetric angular distribution

    � Energy and polar angle sampled w.r.t. the incoming ph oton using Tsai differential cross section

    � Azimuthal angle generated isotropically

    � Choice of which particle in the pair is e - or e+ is made randomly

    Gamma conversionGamma conversion

  • 179

    Comparison with NIST dataphotons in Fe

    All simulation results lie with ±±±± 3σσσσ w.r.t. the corresponding NISTdata (National Institute of Standards and Technologies)

    LE EPDL

    LE Penelope

    STD

    data

    Illustration : Illustration : mass mass attenuationattenuationcoefficientcoefficient

    N/N0 = exp [-(µµµµ /ρ) ρ) ρ) ρ) ρρρρx ]

  • 180

    ElectronsElectrons

  • 181

    Parameterisation of EEDL data

    – 16 parameters for each atom

    – At high energy the parameterization reproduces the Bethe-Heitlerformula

    – Precision is ~ 1.5 %

    – Three LowE generators available : G4ModifiedTsai(HE), G4Generator2BS and G4Generator2BN (

  • 182

    � Parameterisation based on 5 parameters for each shell

    � Precision of parameterization isbetter than 5% for 50 % of shells , less accurate for the remaining shells

    IonisationIonisation

  • 183

    ● Compared to NIST database

    ● All simulation results lie within ±±±± 3σσσσ w.r.t. the corresponding NIST data

    The stopping power can be used to calculate the distance it takes to slow an electron down to a given energy. This distance is called the continuous slowing down approximation range , or CSDA range , because the calculationassumes that the electron slows down continuously from the initial energy E to the final energy.

    Comparaison avec données NISTélectrons in Uranium

    LE EEDL

    LE Penelope

    STD

    data

    Illustration :Illustration :rangerange

  • 184

    HadronsHadrons

  • 185

  • 186

    � Variety of models , depending on – energy range– particle type– charge

    � Composition of models across the energy range , with different approaches– analytical– based on data reviews + parameterizations

    � Specialized models for fluctuations (stochastic straggling )

    Hadrons and ionsHadrons and ions

  • 187

    ProtonsProtons

    Stopping power Z dependence for various energies

    Ziegler and ICRU models

    Ziegler and ICRU, Si

    Nuclear stopping power

    Ziegler and ICRU, Fe

    Straggling

    � Bethe-Bloch model of energy loss, E > 2 MeV� 5 parameterization models, E < 2 MeV based

    on Ziegler and ICRU reviews� Free electron gas model below 1 keV

    � 3 models of energy loss fluctuations� Density correction for high energy� Shell correction term for intermediate energy� Chemical effect for compounds� Nuclear stopping power (elastic Coulomb scattering)� PIXE included� Spin dependent term� Barkas (+ vs -) and Bloch terms

  • 188

    � Scaling of Bethe-Bloch :

    � 0.01 < ββββ < 0.05 : parameterizations, Bragg p. , based on Ziegler and ICRU reviews � ββββ < 0.01 : free electron gas model� Effective charge model (picks up e- in the medium)� Nuclear stopping power (elastic Coulomb scattering with nuclei)

    pp

    ion

    mT T

    m=2( ) ( ),ionion p pS T S TZ=

    Positively charged hadrons (Z>1)Positively charged hadrons (Z>1)

  • 189

    ModelsModelsfor antiprotonsfor antiprotons

    � ββββ > 0.5 Bethe-Bloch formula� 0.01 < ββββ < 0.5 Quantum harmonic oscillator model� ββββ < 0.01 Free electron gas model

    Proton

    G4 Antiproton

    Antiproton from Arista et. al

    Antiproton exp. data

    Proton

    G4 Antiproton

    Antiproton from Arista et. al

    Antiproton exp. data

  • 190

    AtomicAtomic relaxationrelaxation

  • 191

    ● The atomic relaxation can be triggered by other electrom agnetic interactions such as the photoelectric effect or ionisation , which leave the atom in anexcited state .

    ● The Livermore Evaluation Atomic Data Library EADL contains data to describethe relaxation of atoms back to neutrality after they a re ionised.

    ● The data in EADL includes the radiative and non-radiative transition probabilities for each sub-shell of each element, for Z =1 to 100. The atom has been ionised by a process that has caused an electron to be ejected from an atom, leaving a vacancy or ``hole" in a given subshell . The EADL data are thenused to calculate the complete radiative and non-radiative spectrum of X-ra ys and electrons emitted as the atom relaxes back to neutrality.

    ● Non-radiative de-excitation can occur via the Auger effect (the initial and secondary vacancies are in different shells) or Coster-Kronig effect (transitions within the same shell).

    Atomic relaxationAtomic relaxation

  • 192

  • 193

    FluorescenceFluorescence

    Scattered

    photons

    Fe lines

    GaAs lines

    Microscopic validation: against reference data

    Experimental validation: test beam data , in collaboration with ESA

    Advanced Concepts & Science Payload Division

    ESA Bepi Colombo mission to Mercury Analysis of the

    elemental composition of Mercury crust through X-ray

    spectroscopy

    10 keV photon beam, BESSYCourtesy of A. Owens et al., ESA

    Fluorescent spectrum of Icelandic Basalt (“Mars-like”)

  • 194

    Auger Auger effecteffect

    Auger electron emissionfrom various materials

    Sn, 3 keV photon beamelectron lines w.r.t.

    published experimental results

  • 195

    PIXE PIXE (Particle Induced X(Particle Induced X--ray Emission)ray Emission)

    � New model based on experimental data– Parameterisation of Paul & Sacher data library for ionization cross sections

    – Uses the EADL-based package of atomic de-excitation for the generation offluorescence and Auger secondary products

    � Current implementation: protons, K-shell

    � Coming in future: protons, L-shell and αααα, K-shell

    Ionization cross section for p, K shell

    Parameterization G4 (ligne)Experimental data

  • 196

    LowE processes based on the

    Monte Carlo codePenelope

  • 197

    ● Compton scattering ● Rayleigh scattering ● Gamma conversion ● Photoelectric effect

    ● Bremsstrahlung● Ionisation

    ● Positron Annihilation

    G4PenelopeAnnihilation G4PenelopeBremsstrahlung G4PenelopeCompton G4PenelopeGammaConversion G4PenelopeIonisation G4PenelopePhotoElectric G4PenelopeRayleigh

    In your Physics list

    Processes Processes àà la Penelopela Penelope

  • 198

    � The whole physics content of the Penelope Monte Carlo code has been re-engineered into Geant4 (except for multiple scattering)

    – processes for photons: release 5.2, for electrons: release 6.0

    � Analytical Physics models by F. Salvat et al.

    � Power of the OO technology:– extending the software system is easy– all processes obey to the same abstract interfaces– using new implementations in application code is simple

    � Profit of Geant4 advanced geometry modeling, interac tive facilities etc.

    – same physics as original Penelope

    ProcessesProcessesà la Penelopeà la Penelope

  • 199

    How to use the How to use the lowlow energyenergypackage ?package ?

  • 200

    Photon processes• Compton scattering (class G4LowEnergyCompton ) • Polarized Compton scattering (class G4LowEnergyPolarizedCompton ) • Rayleigh scattering (class G4LowEnergyRayleigh ) • Gamma conversion (also called pair production, class G4LowEnergyGammaConversion ) • Photo-electric effect (class G4LowEnergyPhotoElectric )

    Electron processes• Bremsstrahlung (class G4LowEnergyBremsstrahlung ) • Ionisation and delta ray production (class G4LowEnergyIonisation )

    Hadron and ion processes• Ionisation and delta ray production (class G4hLowEnergyIonisation )

    ►The user should set the environment variable G4LEDATA to the directory where he/she has copied the files.

    ► Options are available for low energy electromagnetic processes for hadrons and ions in terms of public member functions of the G4hLowEnergyIonisation class: - SetHighEnergyForProtonParametrisation(G4double) - SetLowEnergyForProtonParametrisation(G4double) - SetHighEnergyForAntiProtonParametrisation(G4double) - SetLowEnergyForAntiProtonParametrisation(G4double) - SetElectronicStoppingPowerModel(const G4ParticleDefinition*,const G4String& ) - SetNuclearStoppingPowerModel(const G4String&) - SetNuclearStoppingOn() - SetNuclearStoppingOff() - SetBarkasOn() - SetBarkasOff() - SetFluorescence(const G4bool) - ActivateAugerElectronProduction(G4bool) - SetCutForSecondaryPhotons(G4double) - SetCutForSecondaryElectrons(G4double)

    The available models for ElectronicStoppingPower and NuclearStoppingPower are documented in the class diagrams.

    ► Options are available for low energy electromagnetic processes for