The full set of lecture notes of this Geant4 Course is available at

Slides:



Advertisements
Similar presentations
Geant4 v9.2p02 Primary Particle Makoto Asai (SLAC) Geant4 Tutorial Course.
Advertisements

Makoto Asai (SLAC) Geant4 Users SLAC Feb. 18 th, 2002 Getting Started.
Introduction and Getting Started ESA/ESTEC Makoto Asai (SLAC)
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 Users SLAC Feb. 20th, 2002 Stack management, Digitization and Pile-up.
S. Guatelli, M.G Pia, INFN Genova S. Guatelli ( CERN, INFN Genova ) CERN, 13 November 2002 Users Workshop Where to put analysis in Geant4 Applications.
Makoto Asai (SLAC) Geant4 Users CERN Nov. 13th, 2002 Stack management, Digitization and Pile-up.
Логашенко И.Б. Современные методы обработки экспериментальных данных GEANT4 – программный пакет для моделирования взаимодействия элементарных частиц с.
IEEE Nuclear Science Symposium and Medical Imaging Conference Short Course The Geant4 Simulation Toolkit Sunanda Banerjee (Saha Inst. Nucl. Phys., Kolkata,
A introduction Luciano Pandola INFN-LNGS Partially based on a presentation by G.A.P. Cirrone (INFN-LNS) and M.G. Pia (INFN-Ge) Queen’s University, Belfast.
Tabular Editors for Geant4 Geant4 Geometry Editor and Geant4 Physics Editor CHEP 2000 at Padova Hajime Yoshida Naruto University of Education.
Introduction to Geant4 Makoto Asai (SLAC Computing Services) Geant4 Tutorial Course February 2004, Geant4 v6.0p01.
Tuesday, Nov 9th 9:30-12:30 –Visualization attributes –Physics processes 14:00-17:00 –Kinematics and event generation (from yesterday) Particle gun –Boolean.
Materials In nature, general materials (compounds, mixtures) are made by elements and elements are made by isotopes. These are the three main classes.
17-19 Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan 2007 Geant4 Collaboration.
Physics I: Physics Lists Geant4 Tutorial at Jefferson Lab 10 July 2012 Dennis Wright (SLAC) Geant4 9.6 beta.
1 Primary particles Geant4 User's Tutorial CERN, February 2010 Talk from previous tutorial by Giovanni Santin Ecole Geant4, Annecy 2008.
Geant4 Training 2003 Basic structure of the Geant4 Simulation Toolkit The full set of lecture notes of this Geant4 Course is available.
Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial CERN May 25-27, 2005 May 2005, Geant4 v7.0p01.
Work_Geant4 Bo-Wen Shiou. #include "G4RunManager.hh“ #include "G4RunManager.hh“ #include "G4UImanager.hh" #include "G4UImanager.hh" #include "ExN01DetectorConstruction.hh“
Special Topics in Nuclear Physics, JU, Second Semester, (Saed Dababneh). 1 Course web or
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.
7th December 2007Geant4 Manchester Seminar1 Geant4 A simulation toolkit Geometry and tracking 4th incarnation.
Geant4 internal Classes and Objects Gunter Folger / CERN Geant4 course, Annecy 2008 User Action & Information Classes.
1 Physics I: Physics Lists Paris Geant4 Tutorial 4 June 2007 Marc Verderi Laboratoire Leprince-Ringuet (Heavily copied from D. Wright) Geant4 V8.3.
Monte Carlo /12/07. What is Geant ? Monte Carlo simulation tool for nuclear and particle physics Set up detectors –Sensitive detector which returns.
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)
Monte carlo and analysis tool study Shi-hong yao.
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.
Maria Grazia Pia INFN Genova Salamanca, July 2002
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.
WORK Bo-Wen Shiou. GNUmakefile GNUmakefile XXX.cc (ex:try03.cc) XXX.cc (ex:try03.cc) include folder (xxx.hh) include folder (xxx.hh) src folder (xxx.cc)
V.Ivanchenko Salamanca1 Geant4: Electromagnetic Processes 1  Introduction  Interfaces  PhysicsList  Optical process.
Makoto Asai (SLAC) Getting Started MGP: added class diagram of basic user application.
Physics I: Physics Lists Puebla Geant4 Tutorial 15 June 2010 Dennis Wright Geant4 V9.3.p01.
Geant4 internal Classes and Objects Gunter Folger / CERN MC-PAD, DESY/Hamburg January 2010 User Action & Information Classes.
1 Exercises 0 Go inside the “hadrontherapy” directory: cd hadrontherapy Copy the Hadrontherapy example to your home folder: cp –r $G4INSTALL/examples/advanced/hadrontherapy.
Maria Grazia Pia Retrieving information from kernel Acknowledgements: A. Lechner, J. Apostolakis, M. Asai, G. Cosmo, A. Howard.
Interaction with the Geant4 kernel
Pablo Cirrone INFN-LNS
Pablo Cirrone INFN-LNS
Makoto Asai (SLAC) Geant4 Tutorial Course
Interaction with the Geant4 kernel
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
Physics I: Physics Lists
Primary Particle Generation
Makoto Asai (SLAC) Geant4 Tutorial Course
Read-out and detector response
User Application
The n-3He Simulation Using Geant4
Detector Description - Materials
User Application
User Application
The full set of lecture notes of this Geant4 Course is available at
Customizing Run Management
Primary particle Makoto Asai (SLAC Computing Services)
The full set of lecture notes of this Geant4 Course is available at
Monte Carlo /12/25.
Simulation in Experiments searching for rare events
Presentation transcript:

The full set of lecture notes of this Geant4 Course is available at User Application http://cern.ch/geant4 The full set of lecture notes of this Geant4 Course is available at http://www.ge.infn.it/geant4/events/nss2003/geant4course.html

Useful links: http://cern.ch/geant4/ http://www.ge.infn.it/geant4/ How to use Geant4 User Requirements Design of a Geant4 application Implementation Focus on : User initialisation classes User action classes Useful links: http://cern.ch/geant4/ http://www.ge.infn.it/geant4/

Capture User Requirements Define the scope of the software system to be built (“what it should do”) Experimental set-up Functionality needed Physics involved The application developer must study:

User Requirements

Identify a candidate architecture How the components (geometry, physics, detector, etc.) collaborate in order to satisfy the User Requirements Documentation: G. Booch, OO analysis and design with applications, Addison-Wesley, 1994  R. Martin, Designing OO C++ applications using the Booch method, Prentice Hall, 1994 E. Gamma et al., Design Patterns, Addison-Wesley, 1995

Particles Geometry Analysis Physics Stacks Tracks Steps

User classes Initialisation classes Action classes Mandatory classes: Invoked at the initialization G4VUserDetectorConstruction G4VUserPhysicsList Action classes Invoked during the execution loop G4VUserPrimaryGeneratorAction G4UserRunAction G4UserEventAction G4UserTrackingAction G4UserStackingAction G4UserSteppingAction G4VUserDetectorConstruction describe the experimental set-up G4VUserPhysicsList select the physics you want to activate G4VUserPrimaryGeneratorAction generate primary events Mandatory classes:

The main program Geant4 does not provide the main() In his/her main(), the user must construct G4RunManager (or his/her own derived class) notify the mandatory user classes to G4RunManager G4VUserDetectorConstruction G4VUserPhysicsList G4VUserPrimaryGeneratorAction The user can define VisManager, (G)UI session, optional user action classes in his/her main()

The main program The main // Construct the default run manager {… // Construct the default run manager G4RunManager* runManager = new G4RunManager; // Set mandatory user initialization classes MyDetectorConstruction* detector= new MyDetectorConstruction; runManager->SetUserInitialization(detector); runManager->SetUserInitialization(new MyPhysicsList); // Set mandatory user action classes runManager->SetUserAction(new MyPrimaryGeneratorAction ); // Set optional user action classes MyEventAction* eventAction = new MyEventAction(); runManager->SetUserAction(eventAction); MyRunAction* runAction = new MyRunAction(); runManager->SetUserAction(runAction); …}

Describe the experimental set-up Derive your own concrete class from the G4VUserDetectorConstruction abstract base class Implement the Construct() method construct all necessary materials define shapes/solids required to describe the geometry construct and place volumes of your detector geometry define sensitive detectors and identify detector volumes to associate them to associate magnetic field to detector regions define visualisation attributes for the detector elements

How to define materials 1 Isotopes Elements Molecule compounds and mixtures isotopes Different kinds of materials can be defined PVPhysicalVolume* MyDetectorConstruction::Construct() {… a = 207.19*g/mole; density = 11.35*g/cm3; G4Material* Pb = new G4Material(name="Pb", z=82., a, density); density = 5.458*mg/cm3; pressure = 1*atmosphere; temperature = 293.15*kelvin; G4Material* Xenon = new G4Material(name="XenonGas", z=54., a=131.29*g/mole, density, kStateGas , temperature ,pressure); ....... } Lead Xenon gas

How to define materials 2 G4double a = 1.01*g/mole; G4Element* H = new G4Element(name="Hydrogen",symbol="H" , z= 1., a); a = 12.01*g/mole; G4Element* C = new G4Element(name="Carbon" ,symbol="C" , z= 6., a); G4double density = 1.032*g/cm3; G4Material* Sci = new G4Material(name = "Scintillator", density, ncomponents = 2); Sci -> AddElement(C, natoms = 9); Sci -> AddElement(H, natoms = 10);

Define detector geometry Three conceptual layers G4VSolid -- shape, size G4LogicalVolume -- material, sensitivity, magnetic field, etc. G4VPhysicalVolume -- position, rotation A unique physical volume (the world volume), which represents the experimental area, must exist and fully contain all other components Possible attributes associated to a G4LogicalVolume: Magnetic field Material If sensitive, associated sensitive detector Quality of geometry optimization (smartless) Visualization attributes User limits (maximum allowed step, track length, minimum kinetic energy, …) … Mother volume: containing volume Ex: Volume1 is mother of Volume 2 The mother must contain entirely the daughter volume Volume2 Volume1 World

How to build a volume inside the World … How to build the World … solidWorld=newG4Box("world",HalfWorldLength,HalfWorldLength,HalfWorldLength); logicWorld=new G4LogicalVolume( solidWorld, Air, "World", 0, 0, 0); physiWorld= new G4PVPlacement (0, //no rotation G4ThreeVector(), // at (0,0,0) logicWorld, // its logical volume "World", // its name 0, // its mother volume false, // no boolean operations 0); // no magnetic field How to build a volume inside the World … solidTarget = new G4Box("target",targetSize,targetSize,targetSize); logicTarget = newG4LogicalVolume(solidTarget,TargetMater,"Target",0,0,0); physiTarget = new G4PVPlacement(0, // no rotation positionTarget, // at (x,y,z) logicTarget, // its logical volume "Target", // its name logicWorld, // its mother volume false, // no boolean operations 0); // no particular field

Select physics processes Geant4 does not have any default particles or processes Derive your own concrete class from the G4VUserPhysicsList abstract base class define all necessary particles define all necessary processes and assign them to proper particles define production thresholds (in terms of range) Pure virtual methods ConstructParticles() ConstructProcesses() SetCuts() to be implemented by the user in his/her concrete derived class

Physics List 1 MyPhysicsList :: MyPhysicsList(): G4VUserPhysicsList() { defaultCutValue = 1.0*cm; define production thresholds (the same for all particles) } MyPhysicsList:: ~MyPhysicsList(){} void MyPhysicsList :: ConstructParticles() { G4Electron::ElectronDefinition(); G4Positron::PositronDefinition(); G4Gamma::GammaDefinition(); } define particles involved void MyPhysicsList :: SetCuts() { SetCutsWithDefault(); } Set the cut

Physics List 2 MyPhysicsList :: MyPhysicsList(): G4VUserPhysicsList() { cutForGamma = 1.0*cm; define production thresholds cutForElectron = 1. *mm; cutForPositron = 0.1*mm; } ; void MyPhysicsList :: SetCuts() SetCutValue(cutForGamma, "gamma"); SetCutValue(cutForElectron, "e-"); SetCutValue(cutForPositron, "e+"); } the user can define different cuts!

Physics List 3 void MyPhysicsList :: ConstructParticles() { if (particleName == "gamma") { pManager->AddDiscreteProcess(new G4PhotoElectricEffect()); pManager->AddDiscreteProcess(new G4ComptonScattering()); pManager->AddDiscreteProcess(new G4GammaConversion()); } else if (particleName == "e-") { pManager->AddProcess(new G4MultipleScattering(), -1, 1,1); pManager->AddProcess(new G4eIonisation(), -1, 2,2); pManager->AddProcess(new G4eBremsstrahlung(), -1,-1,3); } else if (particleName == "e+") { pManager->AddProcess(new G4MultipleScattering(), -1, 1,1); pManager->AddProcess(new G4eIonisation(), -1, 2,2); pManager->AddProcess(new G4eBremsstrahlung(), -1,-1,3); pManager->AddProcess(new G4eplusAnnihilation(), 0,-1,4); } select physics processes to be activated for each particle type

Primary events Derive your own concrete class from the G4VUserPrimaryGenerator Action abstract base Pparticle type Iinitial position ninitial direction Iinitial energy Define primary particles in terms of: Pure virtual methods: GeneratePrimaries()

Generate primary events MyPrimaryGeneratorAction :: My PrimaryGeneratorAction() { G4int n_particle = 1; particleGun = new G4ParticleGun (n_particle); G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable(); G4ParticleDefinition* particle = particleTable->FindParticle(“e-“); particleGun->SetParticleDefinition(particle); particleGun->SetParticlePosition(G4ThreeVector(x,y,z)); particleGun->SetParticleMomentumDirection(G4ThreeVector(x,y,z)); particleGun->SetParticleEnergy(energy); } MyPrimaryGeneratorAction :: ~MyPrimaryGeneratorAction() {} void MyPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) { particleGun->GeneratePrimaryVertex(anEvent); }

Optional user action classes Five virtual classes whose methods the user may override in order to gain control of the simulation at various stages. Each method of each action class has an empty default implementation, allowing the user to inherit and implement desired classes and methods. Objects of user action classes must be registered with G4RunManager.

Optional user action classes G4UserRunAction BeginOfRunAction(const G4Run*) example: book histograms EndOfRunAction(const G4Run*) example: store histograms G4UserEventAction BeginOfEventAction(const G4Event*) example: event selection EndOfEventAction(const G4Event*) example: analyse the event G4UserTrackingAction PreUserTrackingAction(const G4Track*) example: decide whether a trajectory should be stored or not PostUserTrackingAction(const G4Track*) G4UserSteppingAction UserSteppingAction(const G4Step*) example: kill, suspend, postpone the track G4UserStackingAction PrepareNewEvent() reset priority control ClassifyNewTrack(const G4Track*) Invoked every time a new track is pushed Classify a new track (priority control) Urgent, Waiting, PostponeToNextEvent, Kill NewStage() invoked when the Urgent stack becomes empty change the classification criteria event filtering (event abortion)

Summary Initialisation classes Action classes User classes Mandatory classes Primary events Physics Geometry Definition of experimental setup in terms of Optional action classes Allow the user to gain the control of the simulation at different stages (tracks, events, runs) How to initialise the classes (mandatory and optional) in the main