510 likes | 707 Views
Computational Physics An Introduction to the Geant4 toolkit. Dr. Guy Tel- Zur. An Introduction to the Geant4 toolkit. Many of the slides are from a presentation by: J . Apostolakis , CERN for the Geant4 collaboration. Geant 4. Home page : http://geant4.cern.ch/
E N D
Computational Physics An Introduction to the Geant4 toolkit • Dr. Guy Tel-Zur
An Introduction to the Geant4 toolkit Many of the slides are from a presentation by: J. Apostolakis, CERN for the Geant4 collaboration
Geant4 • Home page: http://geant4.cern.ch/ • Important paper: Geant4 – a simulation toolkit • Tutorial:http://indico.cern.ch/conferenceOtherViews.py?view=standard&confId=58317 • Live CD: https://twiki.cern.ch/twiki/bin/view/Geant4/Geant4CernVM
Overview • Simulation packages/toolkits • Key capabilities and concepts • What it can do - highlights • Application areas • What is inside – lightning tour • Brief highlights of capabilities • Transparency of results • Open source • GEANT4: the collaboration
What can a simulation package or toolkit do ? • A Package provides ‘general’ tools to undertake (some or all) of the key tasks: • tracking, and geometrical propagation • modelling of physics interactions, • visualization, persistency and enable you to describe your setup’s • detector geometry, • radiation source, • details of sensitive regions
GEANT 4 • Detector simulation tool-kit from HEP • full functionality: geometry, tracking, physics, I/O • offers alternatives, allows for tailoring • Software Engineering and OO technology • provide the architecture & methods for maintaining it • Requirements from: • current and future HEP experiments • medical and space science applications • World-wide collaboration
Key Capabilities • ‘Kernel’: create, manage, move tracks • tracking, stacks, geometry, hits, … • Extensible, flexible • Physics Processes X-section, final-state • models for electromagnetic, hadronic, … • Can be ‘assembled’ for use in an application area • Tools for faster simulation • ‘Cuts’, framework shower parameterisation • Event biasing, variance reduction. • Open interfaces for input/output • User commands, visualization, persistency
Brief History • Geant4 started as RD44 project (1994-98) • Amongst first OO in HEP, 1st for simulation • Dec 1998: 1st supported release Geant4.0.0 • First uses in production in several fields • Space: 1999 XMM (X-ray telescope) • HEP: 2001 BaBar, 2004 ATLAS/CMS/LHCb • Regular public releases (1-2 per year) • Geant4 release 9.0 (Jun 07), 9.3 (Dec 09) • Guy: Dec. 17, 2010: new release: 9.4
Now simulating PEP beam line as well (-9m < zIP < 9m) BaBar • BaBar at SLAC was the pioneer experiment in HEP in use of Geant4 • Started in 2000 • Simulated several x 1010 events Courtesy of D.Wright (SLAC)
Pion longitudinal shower profile in stand-alone ATLAS TileCal test-beam at 90o Thanks to Atlas Tilecal Data MC within ~ ±10% up to 10 λ. For Protons : -(20%-40%) at 10 λ.
Courtesy: CMS Talk of S. Banerjee, Geant4 Workshop 2009
Boulby Mine dark matter search Prototype Simulation One High Energy event mirror LXe GXe PMT source Courtesy of H. Araujo, A. Howard, IC London
Geant4 for beam transportation Courtesy of V.D.Elvira (FNAL)
AGILE GLAST GLAST g astrophysics g-ray bursts GLAST Typical telescope: Tracker Calorimeter Anticoincidence • g conversion • electron interactions • multiple scattering • d-ray production • charged particle tracking
Alfonso Mantero, Thesis, Univ. Genova, 2002 Space Environments and Effects Section Bepi Colombo: X-Ray Mineralogical Survey of Mercury BepiColombo ESA cornerstone mission to Mercury Courtesy of ESA Astrophysics
PlanetoCosmicsGeant4 simulation of Cosmic Rays in planetary Atmo-/Magneto- spheres
Describes a Setup Hierarchy of volumes Many volumes repeat Volume & sub-tree Up to hundreds of thousands of volumes Importing solids from CAD systems Navigates in Detector Locates a point Computes a step Linear intersection Geometry: what it does
Electromagnetic physics • Gammas: • Gamma-conversion, Compton scattering, Photo-electric effect • Leptons(e, m), charged hadrons, ions • Energy loss (Ionisation, Bremstrahlung), Multiple scattering, Transition radiation, Synchrotron radiation, e+ annihilation. • Photons: • Cerenkov, Rayleigh, Reflection, Refraction, Absorption, Scintillation • High energy muons • A choice of implementations for most processes • “Standard”: performant when relevant physics above 1 KeV • “Low Energy”: Extra accuracy for application delving below 1 KeV
Hadronic processes • Hadronic physics is included in Geant4 • a powerful and flexible framework and • implementations of physics X-sections & models. • A variety of models and cross-sections • for each energy regime, particle type, material • alternatives with different strengths and computing resource requirements • Components can be assembled in an optimised way for each use case.
Openness and Extensibility • As a toolkit with open-source code, Geant4 can be extended in many ways • Expected/simple • Creating a new shape (G4VSolid) • Unusual, but predicted • New processes, for physics or user action • Radical extensions • Reversing time (two ways) • Creating ‘on-the-fly’ density for a material (future)
Practical considerations • Starting off: what you need • Compatible platform • Need CLHEP foundation class library • One or more visualisation libraries (possibly from system, e.g. OpenGL) • CLHEP is used for key common classes • ThreeVector (G4ThreeVector is a name for CLHEP::HepThreeVector) • FourVector • Random Number Generators, .. • Coding is needed – except if someone did it for you. • Modify existing C++ ‘code’ to describe your setup • Create you own class to describe eg a magnetic field.
Platforms • What works ‘best’ (used by developers, main testing) • Scientific Linux 4 or 5 and gcc 4.3 (HEP production) • MacOS 10.5 Leopard • What we also support (tested + numerous users) • Windows (XP) & Visual C++ • numerous users • What we expect to work • Other Linux flavours with gcc 4.1 and 4.3 • Possibly with fewer options, eg missing some visualisation • What others ‘ported’ and check • Sun Solaris
Geant4 Collaboration TRIUMF Lebedev Collaborators also from non-member institutions, including IHEP MEPHI Moscow Jefferson Laboratory LIP UK STFC
The Toolkit Examples Three levels:
Hands on! • Time to get your hands on Geant4 • Copy exercises • Your first run of a simple example • To start, please look at http://www.ifh.de/geant4/g4course2010 Else, if you have difficulty to reach that use http://www-zeuthen.desy.de/geant4/g4course2010
User: geant, pw: geant2010 IP = 192.168.11.128
Example N02 This example simulates a simplified fixed target experiment. 1- GEOMETRY DEFINITION The setup consists of a target followed by six chambers of increasing transverse size. These chambers are located in a region called Tracker region. Their shape are boxes, constructed as parametrised volumes (ChamberParametrisation class). The default geometry is constructed in DetectorConstruction class. One can change the material of the target and of the chambers interactively via the commands defined in the DetectorMessenger class. In addition a transverse uniform magnetic field can be applied (see N02MagneticField and DetectorMessenger classes).
2- PHYSICS LIST The particle's type and the physic processes which will be available in this example are set in PhysicsList class. In this example, all the so called 'electromagnetic processes' are introduced for gamma, charged leptons, and charged hadrons (see the method PhysicsList::ConstructEM()). An important data member of this class is the defaultCutValue which defines the production threshold of secondary particles (only Ionisation and Bremsstrahlung processes are concerned by this CutValue). Notice that the CutValue must be given in unit of length, corresponding to the stopping range of the particle. It is automatically converted in energy for each material, and a table is printed in the method PhysicsList::SetCuts() In addition the build-in interactive command: /process/(in)activate processName allows to activate/inactivate the processes one by one.
3- RUNS and EVENTS The primary kinematic consists of a single particle which hits the target perpendicular to the input face. The type of the particle and its energy are set in the PrimaryGeneratorAction class, and can be changed via the G4 build-in commands of ParticleGun class. A RUN is a set of events. The user has control: -at Begin and End of each run (class RunAction) -at Begin and End of each event (class EventAction) -at Begin and End of each track (class TrackingAction, not used here) -at End of each step (class SteppingAction) The class SteppingVerbose prints some informations step per step, under the control of the command: /tracking/verbose 1 It inherits from G4SteppingVerbose, and has been setup here in order to illustrate how to extract informations from the G4 kernel during the tracking of a particle.
4- USER' LIMITS We illustrate how to introduce tracking constraints like maximum step length, minimum kinetic energy ..etc.., via G4UserLimits class. See DetectorConstruction and PhysicsList. 5- DETECTOR RESPONSE A HIT is a record, track per track (even step per step), of all the informations needed to simulate and analyse the detector response. In this example the Tracker chambers are considered as the detector. Therefore the chambers are declared 'sensitive detectors' (SD) in the DetectorConstruction class. Then, a Hit is defined as a set of 4 informations per step, inside the chambers, namely: - the track identifier (an integer), - the chamber number, - the total energy deposit in this step, - the position of the deposit. A given hit is an instance of the class TrackerHit which is created during the tracking of a particle, step by step, in the method TrackerSD::ProcessHits(). This hit is inserted in a HitsCollection. The HitsCollection is printed at the end of event (via the method TrackerSD::EndOfEvent()), under the control of the command: /hits/verbose 1
6- VISUALIZATION The Visualization Manager is set in the main(). The initialisation of the drawing is done via a set of /vis/ commands in the macro vis.mac. This macro is automatically read from the main when running in interactive mode. The tracks are automatically drawn at the end of event and erased at the beginning of the next run. The visualization (with OpenGL driver) assumes two things: 1- the visualisation & interfaces categories have been compiled with the environment variable G4VIS_BUILD_OPENGLX_DRIVER. 2- exampleN02.cc has been compiled with G4VIS_USE_OPENGLX. (The same with DAWNFILE instead of OPENGLX)
7- USER INTERFACES The default command interface, called G4UIterminal, is done via standartcin/G4cout. On Linux and Sun-cc on can use a smarter command interface G4UItcsh. It is enough to set the environment variable G4UI_USE_TCSH before compiling exampleN02.cc 8- HOW TO START ? - compile and link to generate an executable % cd N02 % gmake - execute N02 in 'batch' mode from macro files (without visualization) % exampleN02 run1.mac
- execute N02 in 'interactive mode' with visualization % exampleN02 .... Idle> type your commands. For instance: Idle> /run/beamOn 10 .... Idle> /control/execute run2.mac .... Idle> exit Show in editor printout of exampleN02, see file: ./geant/exampleN02_printout.txt
Geant4 web site http://cern.ch/geant4/ Geant4 Training Page http://cern.ch/geant4/support/ and follow “Training” link, Geant4 training INFN / EM ‘Low-energy’ http://www.ge.infn.it/geant4/training/ Geant4 Workshops and Users Workshops presentations Latest at the home page, previous at http://geant4.web.cern.ch/geant4/collaboration/meetings_minutes.html#G4workshops Geant4 Physics WG web sites Which can all be found at http://cern.ch/geant4/organisation/working_groups.html Geant4 Low-Energy Electromagnetic WG web site http://www.ge.infn.it/geant4/lowE/ Geant4 EM (standard) see below Geant4 Hadronic WG home Papers on G4 and its validation “Geant4: a simulation toolkit”, Nucl Instr and Methods A 506 (2003), 250-303 “Validation of GEANT4, an object-oriented MC toolkit for simulations in medical physics” J.F. Carrier et al, Med Phys 32 (2004), p 484. Resources for more information • Note: “Training” page is also directly accessed at http://cern.ch/geant4/milestones/training/training-milestone.html ElectroMagnetic (standard) WG home page is at http://cern.ch/geant4/working_groups/electromagnetic/ electromagneticWG.html
Geant4 Capabilities & Use • Kernel: create geometry, hits, … • Physics Processes • models for EM, hadronics, … • ‘assembled’ into physics lists for application area • Tools for faster simulation • Shower parameterisation & Event biasing. • Open interfaces for input/output • User commands, visualization • Verification and validation for use cases • Using it • via ready applications (eg GATE) • by starting with examples & customising