Upload
lucius-ramirez
View
95
Download
0
Embed Size (px)
DESCRIPTION
Логашенко И.Б. Современные методы обработки экспериментальных данных. GEANT4 – программный пакет для моделирования взаимодействия элементарных частиц с веществом. Документация. Веб-страница http://geant4.cern.ch Руководство пользователя - PowerPoint PPT Presentation
Citation preview
Логашенко И.Б.Современные методы обработки экспериментальных данных
GEANT4 – программный пакет для моделирования взаимодействия элементарных частиц с веществом
Логашенко И.Б. Современные методы обработки экспериментальных данных
2
Документация
• Веб-страницаhttp://geant4.cern.ch
• Руководство пользователяhttp://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/index.html
• Подробное описание классовhttp://geant4.cern.ch/bin/SRM/G4GenDoc.csh?flag=1http://www-geant4.kek.jp/lxr/source/
Логашенко И.Б. Современные методы обработки экспериментальных данных
3
Запуск примера1. Зайдите на class-lin
2. Скопируйте директориюmkdir geant4cd geant4cp /home/Logashenko/geant4/setenv.sh .cp –r /home/Logashenko/geant4/simple .
3. Отредактируйте setenv.sh
4. Откомпилируйте примерsource setenv.shcd simplegmake
5. Запустите пример../bin/Linux-g++/exampleN03 run1.mac
Maria Grazia Pia, INFN Genova
http://cern.ch/geant4/geant4http://www.ge.infn.it/geant4
Overview of applicationsOverview of applications
Maria Grazia Pia, INFN Genova
ATLAS
Courtesy of ATLAS Collaboration
-100 1000 200 300 400 5000
600
100
200
300
400
500
700
800
Calorimeter Signal [nA]
Events
/10 n
A
180 GeV μ
HEC Testbeam: Muon Response Comparisons
Extensive comparisons with test beam data(activity in progress)
Maria Grazia Pia, INFN Genova
Maria Grazia Pia, INFN Genova
astrophysics--ray burstsray bursts
AGILE GLAST
Typical telescope: Tracker Calorimeter Anticoincidence
conversion electron interactions multiple scattering-ray production charged particle tracking
GLAST
GLAST
Maria Grazia Pia, INFN Genova
CT-simulation with a Rando phantomExperimental data with TLD LiF dosimeter
CT images used to define the geometry:
a thorax slice from a Rando
anthropomorphic phantom
Comparison with commercial treatment planning systems
M. C. LopesIPOFG-CROC Coimbra Oncological Regional Center
L. Peralta, P. Rodrigues, A. TrindadeLIP - Lisbon
Central-Axis depth dose
Profile curves at 9.8 cm depth
PLATO overestimates the dose at ~ 5% level
Maria Grazia Pia, INFN Genova
Dosimetry in interplanetary missions
Aurora Programme
Dose in astronaut resulting from Galactic Cosmic Rays
vehicle concept
Maria Grazia Pia, INFN Genova
GATEa Geant4 based simulation
platform, designed for PET and
SPECT
GATEa Geant4 based simulation
platform, designed for PET and
SPECT
Recently released as an open source software system
under GPL
>400 registered users worldwide
GATE Collaboration
Maria Grazia Pia, INFN Genova
Current implementation
ORNL and MIRD5 phantomsMale and Female
Geant4 analytical phantomORNL model, female
1 skull2 thyroid3 spine4 lungs5 breast6 heart7 liver8 stomach9 spleen10 kidneys11 pancreas12 intestine13 uterus and ovaries14 bladder15 womb16 leg bones17 arm bones
Geant4 analytical phantoms
Maria Grazia Pia, INFN Genova
Heavy ion beams
Geant4 simulation
Beam Track Reconstruction135 MeV/u 12C beam
NIRS N. Kanematsu, M. Komori - Nagoya K. Niwa, T.Toshito, T.Nakamura, T.Ban, N.Naganawa, S.Takahashi - Uchu-ken
M.Ozaki - Kobe S. Aoki - Aichi Y.Kodama - Naruto H.Yoshida - Ritsumei S.Tanaka - SLAC M. Asai, T. Koi - Tokyo N.Kokubu -
Gunma K. Yusa - Toho H.Shibuya, R.Ogawa, A. Shibazaki, T.Fukushima - KEK K. Amako,
K.Murakami, T. Sasaki
high spatial resolution emulsion chamber
Medical ion
beam
Events with > 50000
particles/event in detector
acceptance
CMS
~ 180 minutes to simulate 1 event with 55K generator tracks
Maria Grazia Pia, INFN Genova
- DNA
Relevance for space: astronaut and airline pilot radiation hazards, biological experiments
Applications in radiotherapy, radiobiology…
http://www.ge.infn.it/geant4/dna/
Prototyping
Multi-disciplinary Collaboration of
astrophysicists/space scientists
particle physicists medical physicists computer scientists biologists physicians
5.3 MeV particle in a cylindrical volume. The inner cylinder has a radius of 50 nm.
What if the geometry to describe with Geant4 were DNA and the process were mutagenesis?
Study of radiation damage at the cellular and DNA level in the space radiation environment (and other applications, not only in the space domain)
User Application
http://cern.ch/geant4
EGS4, EGS5, EGSnrcGeant3, Geant4 MARSMCNP, MCNPX, A3MCNP, MCNP-DSP, MCNP4BMVP, MVP-BURNPenelopePeregrineTripoli-3, Tripoli-3 A, Tripoli-4
DPMEA-MCFLUKA GEMHERMESLAHETMCBEND MCU MF3DNMTCMONK MORSERTS&T-2000 SCALETRAXVMC++
...and I probably forgot some moreMany codes not publicly distributed
A lot of business around MC
The zoo
Monte Carlo codes presented at the MC200 Conference, Lisbon, October 2000Monte Carlo codes presented at the MC200 Conference, Lisbon, October 2000
Geant4 CollaborationGeant4 Collaboration
CERN, ESA, KEK, SLAC, TRIUMF, TJNL
INFN, IN2P3, PPARCBarcelona Univ., Budker Inst., Frankfurt Univ., Karolinska
Inst., Helsinki Univ., Lebedev Inst., LIP, Northeastern Univ. etc.
MoU basedDistribution, Development and User Support of Geant4
Toolkit + User application
Geant4 is a toolkittoolkit– i.e. you cannot “run” it out of the box
– You must write an application, which uses Geant4 tools
Consequences– There are no such concepts as “Geant4 defaults”
– You must provide the necessary information to configure your simulation
– You must deliberately choose which Geant4 tools to use
Guidance: we provide many examplesexamples– Novice ExamplesNovice Examples: overview of Geant4 tools
– Advanced ExamplesAdvanced Examples: Geant4 tools
Basic concepts
What you MUSTMUST do:– Describe your experimental set-upexperimental set-up
– Provide the primary particlesprimary particles input to your simulation– Decide which particlesparticles and physics modelsphysics models you want to
use out of those available in Geant4 and the precision of your simulation (cuts to produce and track secondary particles)
You may also want – To interact with Geant4 kernel to control control your simulation
– To visualise visualise your simulation configuration or results
– To produce histograms, tupleshistograms, tuples etc. to be further analysed
Geant4 Kernel
Provides central functionality of the toolkit
– 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
1
RunA run is a collection of events which are produced under identical conditions
Within a run, a user cannot change:– Detector or apparatus geometry – Physics process settings
By analogy to high energy physics a Geant4 run begins 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 materials in the setup
– Low-energy cutoff values are defined
1
EventAt beginning of processing, an event contains primary particles (from generator, particle gun, ...), which are pushed into 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 represents an event
At the end of processing it has the following objects:
– List of primary vertices and particles (the input)
– Hits collections
– Trajectory collections (optional)
– Digitizations collections (optional)
1
TrackA track is a snapshot of a particle within its environment
– as the particle moves, the quantities in the snapshot change– at any particular instance, a track has position, physical quantities – it is not a collection of steps
Track object lifetime– created by a generator or physics process (e.g. decay)– deleted when it:
leaves world volume disappears (particle decays or is absorbed) goes to zero energy and no “at rest” process is defined user kills it
No track object survives the end of an event (not persistent)– User must take action to store track record in trajectory
1
StepThe step is the basic unit of simulation– 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 stands exactly on the boundary, but is logically part of next volume
– Hence boundary processes such as refraction and transition radiation can be simulated
1
Interaction with Geant4 kernel
Geant4 design provides toolstools for a user application– To tell the kernel about your simulation configuration – To interact with Geant4 kernel itself
Geant4 tools for user interaction are base classesbase classes– You create your own concrete classyour own concrete class derived from the base classes– Geant4 kernel handles your own derived classes transparently through
their base class interface (polymorphism)(polymorphism)
Abstract base classesAbstract base classes for user interaction– User derived concrete classes are mandatory
Concrete base classesConcrete base classes (with virtual dummy methods) for user interaction– User derived classes are optionaloptional
Initialisation classesInitialisation classesInvoked at the initialization
G4VUserDetectorConstruction
G4VUserPhysicsList
Action classesAction classesInvoked during the execution loop
G4VUserPrimaryGeneratorAction
G4UserRunAction
G4UserEventAction
G4UserTrackingAction
G4UserStackingAction
G4UserSteppingAction
Mandatory classes:
G4VUserDetectorConstruction describe the experimental set-up
G4VUserPhysicsList select the physics you want to activate
G4VUserPrimaryGeneratorAction generate primary events
User classes
The main programGeant4 does not provide the main()main()– Geant4 is a toolkit!– The main() is part of the user application
In his/her main(), the user mustmust– construct G4RunManager G4RunManager (or his/her own derived class)– notify the G4RunManager mandatory user classes derived from
G4VUserDetectorConstruction G4VUserPhysicsList G4VUserPrimaryGeneratorAction
The user may define in his/her main()– optional user action classes– VisManager, (G)UI session
{ … // Construct the default run manager G4RunManager* runManager = new G4RunManagerG4RunManager;;
// Set mandatory user initialization classes MyDetectorConstruction* detector = new MyDetectorConstructionMyDetectorConstruction;; runManager->SetUserInitialization(detector); runManager->SetUserInitialization(new MyPhysicsListMyPhysicsList);
// Set mandatory user action classes runManager->SetUserAction(new MyPrimaryGeneratorActionMyPrimaryGeneratorAction);
// Set optional user action classes MyEventAction* eventAction = new MyEventAction()MyEventAction();; runManager->SetUserAction(eventAction); MyRunAction* runAction = new MyRunAction()MyRunAction();; runManager->SetUserAction(runAction); …}
main()
Describe the experimental set-up
Derive your own concrete class from the G4VUserDetectorConstructionG4VUserDetectorConstruction abstract base class
Implement the Construct()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
PVPhysicalVolume* MyDetectorConstruction::Construct() {
… a = 207.19*g/mole; density = 11.35*g/cm3; G4Material* lead = new new G4MaterialG4Material(name="Pb", z=82., a, density);
density = 5.458*mg/cm3; pressure = 1*atmosphere; temperature = 293.15*kelvin; G4Material* xenon = new new G4MaterialG4Material(name="XenonGas", z=54.,
a=131.29*g/mole, density,
kStateGas, temperature, pressure); ... }
Different kinds of materials can be defined
IsotopesElementsMoleculesCompounds and mixtures
Lead
Xenongas
For example, a scintillator consisting of Hydrogen and Carbon:
G4double a = 1.01*g/mole; G4Element* H = new G4ElementG4Element(name="Hydrogen", symbol="H", z=1., a); a = 12.01*g/mole; G4Element* C = new G4ElementG4Element(name="Carbon", symbol="C", z=6., a);
G4double density = 1.032*g/cm3; G4Material* scintillatorG4Material* scintillator = new G4MaterialG4Material(name = "Scintillator", density, numberOfComponents = 2);
scintillator -> AddElement(C, numberOfAtoms = 9); scintillator -> AddElement(H, numberOfAtoms = 10);
How to define a compound material
Define detector geometryThree 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
World
Volume B (daughter)
Volume A (mother)
e.g.: Volume A is mother of Volume B
The mother must contain the daughter volume entirely
solidWorld = new G4Box(“World", halfWorldLength, halfWorldLength, halfWorldLength); logicWorld = new G4LogicalVolume(solidWorld, air, "World", 0, 0, 0); physicalWorld = 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
solidTarget = new G4Box(“Target", targetSize, targetSize, targetSize);logicTarget = new G4LogicalVolume(solidTarget, targetMaterial, "Target",0,0,0);physicalTarget = 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
How to build the World
How to build a volume inside the World
Select physics processesGeant4 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 of G4VUserPhysicsList
to be implemented by the user in his/her concrete derived class
ConstructParticles()ConstructProcesses()SetCuts()
PhysicsList: particles and cuts
void MyPhysicsList :: ConstructParticles(){ G4Electron::ElectronDefinition(); G4Positron::PositronDefinition(); G4Gamma::GammaDefinition();}
Define the the particlesparticles involved in the simulation
void MyPhysicsList :: SetCuts(){ SetCutsWithDefault(); }
Set the production threshold
MyPhysicsList :: MyPhysicsList(): G4VUserPhysicsList(){ defaultCutValue = 1.0*cm;}
Define production thresholdsproduction thresholds (the same for all particles)
PhysicsList: more about cutsMyPhysicsList :: MyPhysicsList(): G4VUserPhysicsList(){ // Define production thresholds cutForGamma = 1.0*cm; cutForElectron = 1.*mm; cutForPositron = 0.1*mm; } ;
void MyPhysicsList :: SetCuts(){ // Assign production thresholds
SetCutValue(cutForGamma, "gamma"); SetCutValue(cutForElectron, "e-"); SetCutValue(cutForPositron, "e+");}
The user can define different cuts for different particles ordifferent regions
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
Physics List: processes
The Geant4 Standard electromagnetic processes are selected in this example
Primary events
Derive your own concrete class from the G4VUserPrimaryGeneratorAction abstract base class
Implement the virtual member function GeneratePrimaries()
Define primary particles providing:
Particle typeInitial positionInitial directionInitial energy
MyPrimaryGeneratorAction:: My PrimaryGeneratorAction(){
G4int numberOfParticles = 1; particleGun = new G4ParticleGunG4ParticleGun (numberOfParticles); 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);}}
void MyPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent){ particleGun->GeneratePrimaryVertex(anEvent); }
Generate primary particles
Optional User Action classes
Five concrete base classes whose virtual member functionsvirtual member functions the user may override to gain control of the simulation at various stages– G4UserRunAction
– G4UserEventAction
– G4UserTrackingAction
– G4UserStackingAction
– G4UserSteppingAction
Each member function of the base classes has a dummy implementation– Empty implementation: does nothing
The user may implement the member functions he desires in his/her derived classes
Objects of user action classes must be registered with G4RunManager
Optional User Action classes
G4UserRunActionG4UserRunActionBeginOfRunAction(const G4Run*)– For example: book histograms
EndOfRunAction(const G4Run*)– For example: store histograms
G4UserEventActionG4UserEventActionBeginOfEventAction(const G4Event*)– For example: perform and event selection
EndOfEventAction(const G4Event*)– For example: analyse the event
G4UserTrackingActionG4UserTrackingActionPreUserTrackingAction(const G4Track*)– For example: decide whether a trajectory should be stored or not
PostUserTrackingAction(const G4Track*)
Optional User Action classesG4UserSteppingActionG4UserSteppingAction
UserSteppingAction(const G4Step*)– For example: kill, suspend, postpone the track– For example: draw the step
G4UserStackingActionG4UserStackingActionPrepareNewEvent()– For example: reset priority control
ClassifyNewTrack(const G4Track*)– Invoked every time a new track is pushed – For example: classify a new track (priority control)
Urgent, Waiting, PostponeToNextEvent, Kill
NewStage()– Invoked when the Urgent stack becomes empty– For example: change the classification criteria – For example: event filtering (event abortion)
Initialisationmain Run manager user detector
const ructionuser physics
list
1: initialize2 : const ruct
3: material const ruct ion
4: geometry construct ion5: world volume
6 : const ruct
7 : physics process const ruction
8: set cuts
Describe your experimental set-up
Activate physics processes appropriate to your experiment
Beam Onmain Run Manager Geometry
managerEvent
generatorEvent
Manager
1: Beam On2: close
3: generate one event
4: process one event
5: open
Generate primary events according to distributions relevant to your experiment
Event processingEvent
managerStacking manager
Tracking manager
Stepping manager
User sensitive detector
1: pop
2: process one track3: Stepping
4: generate hits
5: secondaries
6: push
Record the physics quantities generated by the simulation, that are relevant to your experiment
Define three kinds of actions:
– AtRestAtRest actions: decay, annihilation …
– AlongStepAlongStep actions: continuous interactions occuring along the path, like ionisation
– PostStepPostStep actions: point-like interactions, like decay in flight, hard radiation…
A process can implement any combination of the three AtRest, AlongStep and PostStep actions: eg: decay = AtRest + PostStep
Each action defines two methods:
– GetPhysicalInteractionLength()GetPhysicalInteractionLength() used to limit the step size
either because the process triggers an interaction or a decayor in other cases, like fraction of energy loss, geometry boundary, user’s limit…
– DoIt()DoIt()• implements the actual action to be applied to the track• implements the related production of secondaries
G4VProcesG4VProcesss
AlongStep
PostStep
Abstract class defining the common interface of all processes in Geant4
Multiple scattering BremsstrahlungIonisationAnnihilationPhotoelectric effect Compton scattering Rayleigh effect conversione+e- pair productionSynchrotron radiationTransition radiationCherenkovRefractionReflectionAbsorptionScintillationFluorescenceAuger
Electromagnetic physics
High energy extensionsHigh energy extensions– needed for LHC experiments, cosmic ray
experiments…
Low energy extensionsLow energy extensions– fundamental for space and medical applications, dark
matter and experiments, antimatter spectroscopy etc.
Alternative models for the same processAlternative models for the same process
energy loss
electrons and positrons , X-ray and optical photons muons charged hadrons ions
Comparable to Geant3 already in the release (1997)
Further extensions (facilitated by the OO technology)
All obeying to the same abstract Process interface transparent to tracking
Detector Description
Alexander Howard, CERN
Acknowledgements: Slides produced by J.Apostolakis, G.Cosmo, M. Asai
http://cern.ch/geant4
48
Unit systemUnit system 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 << dE / MeV << “ (MeV)” << G4endl;
49
System of UnitsSystem of Units 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 unit to
use. Just specify the category for the data (Length, Time, Energy, etc…):
G4cout << G4BestUnit(StepSize, “Length”);
StepSize will be printed in km, m, mm or … fermi, depending on its value
50
Isotopes, Elements and MaterialsIsotopes, Elements and Materials
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 macroscopic properties of the matter: temperature, pressure, state, density Radiation length, absorption length, etc…
51
Material: moleculeMaterial: molecule 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);
52
Material: compound Material: compound 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);
53
Material: mixtureMaterial: mixture 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);
54
Example: gasExample: gas 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);
55
Define detector geometryDefine detector geometry
G4Box
G4Tubs
G4VSolid G4VPhysicalVolume
G4Material
G4VSensitiveDetector
G4PVPlacement
G4PVParameterised
G4VisAttributes
G4LogicalVolume
Three conceptual layers G4VSolid -- shape, size G4LogicalVolume -- daughter physical volumes, material, sensitivity, user limits, etc. G4VPhysicalVolume -- position, rotation
56
Define detector geometry 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);
A volume is placed in its mother volume. Position and rotation of the daughter
volume is described with respect to the local coordinate system of the mother
volume. The origin of mother volume’s local coordinate system is at the center
of the mother volume.
Daughter volume cannot protrude from mother volume.
Solid : shape and sizeLogical volume : + material, sensitivity, etc.
Physical volume : + rotation and position
57
G4LogicalVolumeG4LogicalVolumeG4LogicalVolume(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 volume. 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
58
G4PVPlacementG4PVPlacementG4PVPlacement(G4RotationMatrix* pRot,
const G4ThreeVector& tlate, G4LogicalVolume* pCurrentLogical,
const G4String& pName, G4LogicalVolume* pMotherLogical, G4bool pMany, G4int pCopyNo);
Single volume positioned relatively to the mother volume In a frame rotated and translated relative to the coordinate
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
59
G4PVPlacementG4PVPlacement(G4RotationMatrix* pRot, // rotation of mother frame
const G4ThreeVector &tlate, // position in rotated frame
G4LogicalVolume *pDaughterLogical,
const G4String &pName,
G4LogicalVolume *pMotherLogical,
G4bool pMany, // ‘true’ is not supported yet…
G4int pCopyNo, // unique arbitrary integer
G4bool pSurfChk=false); // optional boundary check Single volume positioned relatively to the mother volume.
rotation
translation in
rotated frame
Mother volume
60
Alternative G4PVPlacementG4PVPlacement(
G4Transform3D(G4RotationMatrix &pRot, // rotation of daughter frame
const G4ThreeVector &tlate), // position in mother frame
G4LogicalVolume *pDaughterLogical,
const G4String &pName,
G4LogicalVolume *pMotherLogical,
G4bool pMany, // ‘true’ is not supported yet…
G4int pCopyNo, // unique arbitrary integer
G4bool pSurfChk=false); // optional boundary check Single volume positioned relatively to the mother volume.
rotation
Mother volume
translation in
mother frame
61
G4VSolidG4VSolid 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
62
CSG: 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
63
Other CSG solids
G4Cons
G4Para(parallelepipe
d)G4Trd
G4Trap
G4SphereG4Orb
(full solid sphere)
G4Torus
Consult to Consult to Section 4.1.2 of Section 4.1.2 of Geant4 Application Developers Geant4 Application Developers GuideGuide for all available shapes. for all available shapes.
64
Other Specific CSG solids
G4Polyhedra
G4EllipticalTube
G4Ellipsoid
G4EllipticalCone
G4HypeG4Tet(tetrahedra)
G4TwistedBox G4TwistedTrdG4TwistedTrap
G4TwistedTubs
Consult to Consult to Section 4.1.2 of Geant4 Section 4.1.2 of Geant4 Application Developers GuideApplication Developers Guide for all for all available shapes.available shapes.
65
Boolean Solids Solids can be combined using boolean operations:
G4UnionSolid, G4SubtractionSolid, G4IntersectionSolid Requires: 2 solids, 1 boolean operation, and an (optional)
transformation for the 2nd solid 2nd solid is positioned relative to the coordinate system of the 1st solid Result of boolean operation becomes a solid. Thus the third solid can
be combined to the resulting solid of first operation. Solids to be combined can be either CSG or other Boolean solids. Note: tracking cost for the navigation in a complex Boolean solid is
proportional to the number of constituent CSG solids
G4UnionSolid G4IntersectionSolidG4SubtractionSolid