Primary particle Geant4 tutorial Paris, 4-8 June 2007 Giovanni Santin ESA / ESTEC Rhea System SA With material from previous tutorials by Makoto Asai.

Slides:



Advertisements
Similar presentations
Primary Particle KOI, Tatsumi Geant4 V9.4 Geant4 Tutorial at Texas A&M 11-Jan
Advertisements

山下智弘 JST CREST/ 神戸大学 Borrowing especially from presentations of M. Asai(SLAC) Geant4 Japan Oct, RCNS, based on Geant4 9.0.p01.
Geant4 v9.2p02 Particle Gun Makoto Asai (SLAC) Geant4 Tutorial Course.
Geant4 v9.2p02 Primary Particle Makoto Asai (SLAC) Geant4 Tutorial Course.
Primary particle generation Makoto Asai (SLAC) Geant4 Users CERN Nov. 12 th, 2002.
Makoto Asai (SLAC) Geant4 Users SLAC Feb. 18 th, 2002 Getting Started.
Primary particle generation Makoto Asai (SLAC) Geant4 Users SLAC Feb. 18 th, 2002.
1 4 th Geant4 Space Users’ Workshop and 3 rd Spenvis Users’ Workshop11/06/06-11/10/06 Total Ionizing Dose Environment for a Jovian Mission Using Geant4.
Makoto Asai (SLAC) Geant4 Users CERN Nov. 15 th, 2002 Customizing Run Management.
Geant4 v9.4 Primary Particle Makoto Asai (SLAC) Geant4 Tutorial Course.
Makoto Asai (SLAC) Geant4 Users CERN Nov. 11 th, 2002 Getting Started.
Makoto Asai (SLAC) Geant4 Users SLAC Feb. 18 th, 2002 Getting Started.
Geant4 v9.3p01 Primary Particle Makoto Asai (SLAC) Geant4 Tutorial Course.
Makoto Asai (SLAC) Geant4 Tutorial Course
Primary particle generation Makoto Asai (SLAC) Geant4 Users SLAC Feb. 18 th, 2002.
Makoto Asai (SLAC) Geant4 Users CERN Nov. 13th, 2002 Stack management, Digitization and Pile-up.
14 User Documents and Examples II SLAC Geant4 Tutorial 17 May 2007 Dennis Wright Geant4 V8.3.
Primary Particle Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01.
Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course the 2nd Finnish Geant4 Workshop June , Helsinki Institute of Physics June 2005,
A stable interface to read and write IAEA phase-space files in Geant4 M. A. Cortés-Giraldo 1, R. Capote 2, J. M. Quesada 1 1 Dep. Física Atómica, Molecular.
14 Overview of Geant4 Examples Geant4 Tutorial 8-10 March 2004 Dennis Wright (SLAC)
Gamma calorimeter for R3B: first simulation results INDEX ● The calGamma Geant4 simulation ( a short introduction ) ● Crystal and geometry selection: –
R 3 B Gamma Calorimeter Agenda. ● Introduction ● Short presentation on the first ● Task definition for R&D period ( )
Geant4 Electromagnetic Physics Introduction V.Ivanchenko, M.Maire, M.Verderi  Process interface  Physics categories  Electromagnetic physics  PhysicsList.
1 Primary particles Geant4 User's Tutorial CERN, February 2010 Talk from previous tutorial by Giovanni Santin Ecole Geant4, Annecy 2008.
GAMOS tutorial X-ray Exercises
Geant4 Training 2003 Basic structure of the Geant4 Simulation Toolkit The full set of lecture notes of this Geant4 Course is available.
Normalisation modelling sources Geant4 tutorial Paris, 4-8 June 2007 Giovanni Santin ESA / ESTEC Rhea System SA.
Source Specifications in MCNP
Basic Structure of the Geant4 Simulation Toolkit
Primary particle Giovanni Santin ESA / ESTEC and RheaTech Ltd On behalf of the Geant4 collaboration Ecole Geant4 Annecy, and Nov 2008 With.
Geant4 Event Biasing Marc Verderi, LLR (Heavily copied from Jane Tinslay, SLAC) June 2007.
Computing Performance Recommendations #13, #14. Recommendation #13 (1/3) We recommend providing a simple mechanism for users to turn off “irrelevant”
User Application Toolkit + User application toolkit Geant4 is a toolkit –i.e. you cannot “run” it out of the box –You must write.
User Application Luciano Pandola INFN-LNGS Partially based on a presentation by Maria Grazia Pia (INFN-Ge)
Geant4 internal Classes and Objects Geant4 Users’ Tutorial February 2010 Gunter Folger / CERN User Action & Information Classes.
Generating Primary Particles Each Geant4 Event starts with generation of one or multiple primary particles It is up to the user to define primary particle.
G4GeneralParticleSource Class: Developed by ESA as the space radiation environment is often quite complex in energy and angular distribution, and requires.
Maria Grazia Pia INFN Genova Salamanca, July 2002
Cosmic rays at sea level. There is in nearby interstellar space a flux of particles—mostly protons and atomic nuclei— travelling at almost the speed of.
CBM Software Meeting 1 CBM Simulation & Analysis Framework Geant3 / Gean4 configuration M. Al-Turany, D. Bertini.
Basics of Primary Particle Generation and Tracking Makoto Asai (SLAC) Geant4 Tutorial CERN May 25-27, 2005 May 2005, Geant4 v7.0p01.
Run and Event G4Run and G4RunManager In Geant4, the Run is the largest unit of simulation and it consist of a series of events Within a Run, the detector.
Makoto Asai (SLAC) Getting Started MGP: added class diagram of basic user application.
Geant4 Training 2003 Primary Particle Generation The full set of lecture notes of this Geant4 Course is available at
Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course the 2nd Finnish Geant4 Workshop June , Helsinki Institute of Physics June 2005,
1 Exercises 0 Go inside the “hadrontherapy” directory: cd hadrontherapy Copy the Hadrontherapy example to your home folder: cp –r $G4INSTALL/examples/advanced/hadrontherapy.
GPS General Particle Source
Maria Grazia Pia Retrieving information from kernel Acknowledgements: A. Lechner, J. Apostolakis, M. Asai, G. Cosmo, A. Howard.
Interaction with the Geant4 kernel
Interaction with the Geant4 kernel
GAMOS tutorial Shielding Exercises
Introduction Goal: Can we reconstruct the energy depositions of the proton in the brain if we are able to reconstruct the photons produced during this.
Results of ion simulations
Basics of a user application
Geant4:User Actions and Analysis
Primary Particle Generation
Makoto Asai (SLAC) Geant4 Users CERN Nov. 11th, 2002
G.A.P.Cirrone, S.E.Mazzaglia - INFN/LNS, Italy
Primary Particle Generation
The n-3He Simulation Using Geant4
G4GeneralParticleSource Class:
The n-3He Simulation Using Geant4
User Application
The full set of lecture notes of this Geant4 Course is available at
Customizing Run Management
The full set of lecture notes of this Geant4 Course is available at
Kernel Author: Makoto Asai.
Primary particle Makoto Asai (SLAC Computing Services)
The full set of lecture notes of this Geant4 Course is available at
Presentation transcript:

Primary particle Geant4 tutorial Paris, 4-8 June 2007 Giovanni Santin ESA / ESTEC Rhea System SA With material from previous tutorials by Makoto Asai

Giovanni Santin - Primary particle - Geant4 tutorial, Paris Contents G4VUserPrimaryGeneratorAction Primary vertex and primary particle Built-in primary particle generators –Particle gun –Interfaces to HEPEVT and HEPMC –General particle source (Exotic primary particle, pre-assigned decay)

Giovanni Santin - Primary particle - Geant4 tutorial, Paris Primary particle generation

Giovanni Santin - Primary particle - Geant4 tutorial, Paris User classes Initialization classes –Use G4RunManager::SetUserInitialization() to define. –Invoked at the initialization G4VUserDetectorConstruction G4VUserPhysicsList Action classes –Use G4RunManager::SetUserAction() to define. –Invoked during an event loop G4VUserPrimaryGeneratorAction G4UserRunAction G4UserEventAction G4UserStackingAction G4UserTrackingAction G4UserSteppingAction main() –Geant4 does not provide main(). Note : classes written in orange are mandatory.

Giovanni Santin - Primary particle - Geant4 tutorial, Paris G4VUserPrimaryGeneratorAction This class is one of the mandatory user classes and controls the generation of primaries –What kind of particle (how many) what energy, position, direction, polarisation, etc This class itself should NOT generate primaries but invoke GeneratePrimaryVertex() method of primary generator(s) to make primaries (G4VPrimaryGenerator) Constructor –Instantiate primary generator(s) –Set default values to it (them) GeneratePrimaries() method –Randomize particle-by-particle value(s) –Set these values to primary generator(s) Never use hard-coded UI commands –Invoke GeneratePrimaryVertex() method of primary generator(s)

Giovanni Santin - Primary particle - Geant4 tutorial, Paris Primary vertices and primary particles Primary vertices and primary particles are stored in G4Event in advance to processing an event. –G4PrimaryVertex and G4PrimaryParticle classes –These classes don ’ t have any dependency to G4ParticleDefinition nor G4Track. –They will become “ primary tracks ” only at Begin of Event phase and put into a “ stack ” MyPrimaryGenerator (G4VUserPrimaryGeneratorAction) Computes desired primary properties MyParticleGun (G4VPrimaryGenerator) Vertices and Primary particles are created G4Event Primaries are stored for later tracking

Giovanni Santin - Primary particle - Geant4 tutorial, Paris Pre-assigned decay for primaries Capability of bookkeeping decay chains Primary particles may not necessarily be particles which can be tracked by Geant4 –Pre-assigned decay channels attached to particles –Also, “ exotic ” particles can be imported from Particle Generators, followed by either decay or user defined physics processes (e.g. Higgs, W/Z boson, SUSY particle, … ) See talk by Makoto Asai

Giovanni Santin - Primary particle - Geant4 tutorial, Paris Built-in primary particle generators Geant4 provides some concrete implementations of G4VPrimaryGenerator. –G4ParticleGun –G4HEPEvtInterface, G4HEPMCInterface –G4GeneralParticleSource

Giovanni Santin - Primary particle - Geant4 tutorial, Paris G4ParticleGun Concrete implementations of G4VPrimaryGenerator –A good example for experiment-specific primary generator implementation It shoots one primary particle of a certain energy from a certain point at a certain time to a certain direction. –Various set methods are available –Intercoms commands are also available for setting initial values G4ParticleGun is basic, but it can be used from inside UserPrimaryGeneratorAction to model complex source types / distributions: –Generate the desired distributions (by shooting random numbers) –Use set methods of G4ParticleGun –Use G4ParticleGun as many times as you want –Use any other primary generators as many times as you want to make overlapping events

Giovanni Santin - Primary particle - Geant4 tutorial, Paris G4VUserPrimaryGeneratorAction Example of usage of G4ParticleGun void T01PrimaryGeneratorAction:: GeneratePrimaries(G4Event* anEvent) { G4ParticleDefinition* particle; G4int i = (int)(5.*G4UniformRand()); switch(i) { case 0: particle = positron; break;... } particleGun->SetParticleDefinition(particle); G4double pp = momentum+(G4UniformRand()-0.5)*sigmaMomentum; G4double mass = particle->GetPDGMass(); G4double Ekin = sqrt(pp*pp+mass*mass)-mass; particleGun->SetParticleEnergy(Ekin); G4double angle = (G4UniformRand()-0.5)*sigmaAngle; particleGun->SetParticleMomentumDirection (G4ThreeVector(sin(angle),0.,cos(angle))); particleGun->GeneratePrimaryVertex(anEvent); } You can repeat this for generating more than one primary particles.

Giovanni Santin - Primary particle - Geant4 tutorial, Paris Interfaces to HEPEvt and HepMC Concrete implementations of G4VPrimaryGenerator –Good examples for experiment-specific primary generator implementation –Interface to external physics generators G4HEPEvtInterface –Event record structure based on /HEPEVT/ common block –Used by (FORTRAN) HEP physics generators –Developed and agreed on within the framework of the 1989 LEP physics study –ASCII file input G4HepMCInterface –HepMC Event record for MC generators. Object Oriented, C++ –Used by new (C++) HEP physics generators. –ASCII file input or direct linking to a generator through HepMC.

Giovanni Santin - Primary particle - Geant4 tutorial, Paris G4GeneralParticleSource (GPS) An advanced concrete implementation of G4VPrimaryGenerator Offers as pre-defined many common (and not so common) options for particle generation: Primary vertex can be randomly positioned with options –Point, Beam, Plane (Circle, Annulus, Ellipsoid, Square or Rectangle ), Surface or Volume (Sphere, Ellipsoid, Cylinder or Para ) Angular emission can be –isotropic (iso), cosine-law (cos), planar wave (planar), 1-d accelerator beam (beam1d), 2-d accelerator beam (beam2d), focusing to a point (focused) or user-defined (user) Kinetic energy of the primary particle can also be randomized. –mono-energetic (Mono), linear (Lin), power-law (Pow), exponential (Exp), Gaussian (Gauss), bremsstrahlung (Brem), black-body (Bbody), cosmic diffuse gamma ray (Cdg), user-defined histogram (User), arbitrary point- wise spectrum (Arb) and user-defined energy per nucleon histogram (Epn) Multiple sources –With user defined relative intensity Capability of event biasing (variance reduction). –By enhancing particle type, distribution of vertex point, energy and/or direction All features can be used via C++ or command line (or macro) UI

Giovanni Santin - Primary particle - Geant4 tutorial, Paris GPS Typical UserPrimaryGeneratorAction class Can be extremely simple: GRASPrimaryGeneratorAction::GRASPrimaryGeneratorAction() { m_particleGun = new G4GeneralParticleSource(); } GRASPrimaryGeneratorAction::~GRASPrimaryGeneratorAction() { delete m_particleGun; } void GRASPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) { m_particleGun->GeneratePrimaryVertex(anEvent); } All user instructions given via macro UI commands Extensive documentation at

Giovanni Santin - Primary particle - Geant4 tutorial, Paris GPS Example 6 Vertex on sphere surface Isotropic emission Pre-defined spectrum (black-body) Macro /gps/particle geantino /gps/pos/type Surface /gps/pos/shape Sphere /gps/pos/centre cm /gps/pos/radius 2.5 cm /gps/ang/type iso /gps/ene/type Bbody /gps/ene/min 2. MeV /gps/ene/max 10. MeV /gps/ene/temp 2e10 /gps/ene/calculate

Giovanni Santin - Primary particle - Geant4 tutorial, Paris GPS Example 7 Vertex on cylinder surface Cosine-law emission (to mimic isotropic source in space) Pre-defined spectrum (Cosmic Diffuse Gamma) Macro /gps/particle gamma /gps/pos/type Surface /gps/pos/shape Cylinder /gps/pos/centre cm /gps/pos/radius 2.5 cm /gps/pos/halfz 5. cm /gps/ang/type cos /gps/ene/type Cdg /gps/ene/min 20. keV /gps/ene/max 1. MeV /gps/ene/calculate

Giovanni Santin - Primary particle - Geant4 tutorial, Paris GPS Example 24 Vertex in sphere volume with z biasing Isotropic radiation with theta and phi biasing Integral arbitrary point-wise energy distribution with linear interpolation. Macro /gps/particle geantino /gps/pos/type Volume /gps/pos/shape Sphere /gps/pos/centre cm /gps/pos/radius 2. Cm /gps/ang/type iso /gps/ene/type Arb /gps/ene/diffspec 0 /gps/hist/type arb /gps/hist/point /gps/hist/point /gps/hist/point /gps/hist/point /gps/hist/point /gps/hist/point /gps/hist/point /gps/hist/point /gps/hist/point /gps/hist/point /gps/hist/inter Lin /gps/hist/type biasz /gps/hist/point /gps/hist/point /gps/hist/point /gps/hist/point /gps/hist/type biast /gps/hist/point /gps/hist/point /gps/hist/point /gps/hist/point /gps/hist/type biasp /gps/hist/point /gps/hist/point /gps/hist/point /gps/hist/point /gps/hist/point /gps/hist/point 1. 1.

Giovanni Santin - Primary particle - Geant4 tutorial, Paris GPS Example 31 Two-beam source definition (multiple sources) Gaussian profile Can be focused / defocused Macro # beam #1 # default intensity is 1 now change to 5. /gps/source/intensity 5. /gps/particle proton /gps/pos/type Beam # the incident surface is in the y-z plane /gps/pos/rot /gps/pos/rot # the beam spot is centered at the origin and is # of 1d gaussian shape with a 1 mm central plateau /gps/pos/shape Circle /gps/pos/centre mm /gps/pos/radius 1. mm /gps/pos/sigma_r.2 mm # # the beam is travelling along the X_axis with 5 degrees dispersion /gps/ang/rot /gps/ang/rot /gps/ang/type beam1d /gps/ang/sigma_r 5. deg # # the beam energy is in gaussian profile centered at 400 MeV /gps/ene/type Gauss /gps/ene/mono 400 MeV /gps/ene/sigma 50. MeV # beam #2 # 2x the instensity of beam #1 /gps/source/add 10. # # this is a electron beam...