Transcript Document

Логашенко И.Б.
Современные методы обработки
экспериментальных данных
GEANT4 – программный пакет для
моделирования взаимодействия
элементарных частиц с веществом
Документация
• Веб-страница
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=1
http://www-geant4.kek.jp/lxr/source/
Логашенко И.Б.
Современные методы обработки
экспериментальных данных
2
Запуск примера
1.
Зайдите на class-lin
2.
Скопируйте директорию
mkdir geant4
cd geant4
cp /home/Logashenko/geant4/setenv.sh .
cp –r /home/Logashenko/geant4/simple .
3.
Отредактируйте setenv.sh
4.
Откомпилируйте пример
source setenv.sh
cd simple
gmake
5.
Запустите пример
../bin/Linux-g++/exampleN03 run1.mac
Логашенко И.Б.
Современные методы обработки
экспериментальных данных
3
Overview of applications
http://cern.ch/geant4/geant4
http://www.ge.infn.it/geant4
Maria Grazia Pia, INFN Genova
ATLAS
Extensive comparisons
with test beam data
(activity in progress)
800
Events/10 nA
700
600
180 GeV μ
500
400
300
200
100
0
-100
0
100
200
300
Calorimeter Signal [nA]
Maria Grazia Pia, INFN Genova
400
500
HEC Testbeam:
Muon Response
Comparisons
Courtesy of ATLAS
Collaboration
Maria Grazia Pia, INFN Genova
g astrophysics
AGILE
GLAST
g-ray bursts
GLAST
GLAST
Typical telescope:
Tracker
Calorimeter
Anticoincidence
 g conversion
 electron interactions
 multiple scattering
 d-ray production
 charged particle tracking
Maria Grazia Pia, INFN Genova
Comparison with commercial
treatment planning systems
Central-Axis depth dose
M. C. Lopes
IPOFG-CROC Coimbra Oncological Regional Center
L. Peralta, P. Rodrigues, A. Trindade
LIP - Lisbon
CT-simulation with a Rando phantom
Experimental data with TLD LiF dosimeter
CT images used to
define the geometry:
a thorax slice from a
Rando
anthropomorphic
phantom
Maria Grazia Pia, INFN Genova
Profile curves at 9.8 cm depth
PLATO overestimates
the dose at ~ 5% level
Dosimetry in interplanetary missions
Aurora Programme
vehicle concept
Dose in astronaut resulting
from Galactic Cosmic Rays
Maria Grazia Pia, INFN Genova
GATE
a Geant4 based simulation
platform,
designed for PET and
SPECT
GATE Collaboration
Recently released as
an open source
software system
under GPL
>400 registered
users worldwide
Maria Grazia Pia, INFN Genova
Geant4 analytical phantoms
Current implementation
ORNL and MIRD5 phantoms
Male and Female
Geant4 analytical phantom
ORNL model, female
Maria Grazia Pia, INFN Genova
1 skull
2 thyroid
3 spine
4 lungs
5 breast
6 heart
7 liver
8 stomach
9 spleen
10 kidneys
11 pancreas
12 intestine
13 uterus and ovaries
14 bladder
15 womb
16 leg bones
17 arm bones
Heavy ion beams
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
Geant4 simulation
CMS
Events with >
50000
particles/event in
detector
~ 180 minutes
to simulate 1 event
acceptance
with 55K
generator tracks
Maria Grazia Pia, INFN Genova
Medical
ion beam
Beam Track Reconstruction
135 MeV/u 12C beam
high spatial resolution
emulsion chamber
- DNA
http://www.ge.infn.it/geant4/dna/
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)
Multi-disciplinary Collaboration
of
astrophysicists/space
scientists
particle physicists
medical physicists
Prototyping
computer scientists
biologists
5.3 MeV  particle in a cylindrical volume.
physicians
The inner cylinder has a radius of 50 nm.






Relevance for space: astronaut and airline
pilot radiation hazards, biological
experiments
Applications in radiotherapy, radiobiology…
Maria Grazia Pia, INFN Genova
User Application
http://cern.ch/geant4
The zoo
EGS4, EGS5, EGSnrc
Geant3, Geant4
MARS
MCNP, MCNPX, A3MCNP, MCNP-DSP, MCNP4B
MVP, MVP-BURN
Penelope
Peregrine
Tripoli-3, Tripoli-3 A, Tripoli-4
...and I probably forgot some more
Many codes not publicly distributed
A lot of business around MC
DPM
EA-MC
FLUKA
GEM
HERMES
LAHET
MCBEND
MCU
MF3D
NMTC
MONK
MORSE
RTS&T-2000
SCALE
TRAX
VMC++
Monte Carlo codes presented at the MC200 Conference, Lisbon, October 2000
Geant4 Collaboration
MoU based
Distribution, Development and User Support of Geant4
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.
Toolkit + User application
Geant4 is a toolkit
– 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 examples
– Novice Examples: overview of Geant4 tools
– Advanced Examples: Geant4 tools
Basic concepts
What you MUST do:
– Describe your experimental set-up
– Provide the primary particles input to your simulation
– Decide which particles and physics 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 your simulation
– To visualise your simulation configuration or results
– To produce histograms, 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
Run
A 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
Event
At 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
Track
A 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
Step
The 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 tools 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 classes
– You create your own concrete class derived from the base classes
– Geant4 kernel handles your own derived classes transparently through
their base class interface (polymorphism)
Abstract base classes for user interaction
– User derived concrete classes are mandatory
Concrete base classes (with virtual dummy methods) for user
interaction
– User derived classes are optional
User classes
Initialisation classes
Action classes
Invoked at the initialization
G4VUserDetectorConstruction
G4VUserPhysicsList
Invoked 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
The main program
Geant4 does not provide the main()
– Geant4 is a toolkit!
– The main() is part of the user application
In his/her main(), the user must
– construct 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
main()
{
…
// 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
Different kinds of materials can be defined
Isotopes
Elements
Molecules
Compounds and mixtures
PVPhysicalVolume* MyDetectorConstruction::Construct()
{
…
Lead
a = 207.19*g/mole;
density = 11.35*g/cm3;
G4Material* lead = new G4Material(name="Pb", z=82., a, density);
Xenon
gas
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);
...
}
How to define a compound material
For example, a scintillator consisting of Hydrogen and Carbon:
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* scintillator = new G4Material(name = "Scintillator", density,
numberOfComponents = 2);
scintillator -> AddElement(C, numberOfAtoms = 9);
scintillator -> AddElement(H, numberOfAtoms = 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
Volume B (daughter)
Volume A (mother)
World
e.g.: Volume A is mother of Volume B
The mother must contain the
daughter volume entirely
How to build the World
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
How to build a volume inside the World
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
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 of G4VUserPhysicsList
ConstructParticles()
ConstructProcesses()
SetCuts()
to be implemented by the user in
his/her concrete derived class
PhysicsList: particles and cuts
MyPhysicsList :: MyPhysicsList(): G4VUserPhysicsList()
{
defaultCutValue = 1.0*cm;
Define production thresholds
}
(the same for all particles)
void MyPhysicsList :: ConstructParticles()
{
G4Electron::ElectronDefinition();
Define the particles
G4Positron::PositronDefinition();
involved in the simulation
G4Gamma::GammaDefinition();
}
void MyPhysicsList :: SetCuts()
{
SetCutsWithDefault();
}
Set the production threshold
PhysicsList: more about cuts
MyPhysicsList :: 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
or
different regions
Physics List: processes
void MyPhysicsList :: ConstructParticles()
Select physics processes to be
{
activated for each particle type
if (particleName == "gamma")
{
pManager->AddDiscreteProcess(new G4PhotoElectricEffect());
pManager->AddDiscreteProcess(new G4ComptonScattering());
pManager->AddDiscreteProcess(new G4GammaConversion());
}
The Geant4 Standard electromagnetic
else if (particleName == "e-")
processes are selected in this example
{
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);
}
}
Primary events
Derive your own concrete class from the
G4VUserPrimaryGeneratorAction abstract base class
Define primary particles providing:
Particle type
Initial position
Initial direction
Initial energy
Implement the virtual member function GeneratePrimaries()
Generate primary particles
MyPrimaryGeneratorAction:: My PrimaryGeneratorAction()
{
G4int numberOfParticles = 1;
particleGun = new G4ParticleGun (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);
}
Optional User Action classes
Five concrete base classes whose virtual 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
G4UserRunAction
BeginOfRunAction(const G4Run*)
– For example: book histograms
EndOfRunAction(const G4Run*)
– For example: store histograms
G4UserEventAction
BeginOfEventAction(const G4Event*)
– For example: perform and event selection
EndOfEventAction(const G4Event*)
– For example: analyse the event
G4UserTrackingAction
PreUserTrackingAction(const G4Track*)
– For example: decide whether a trajectory should be stored or not
PostUserTrackingAction(const G4Track*)
Optional User Action classes
G4UserSteppingAction
UserSteppingAction(const G4Step*)
– For example: kill, suspend, postpone the track
– For example: draw the step
G4UserStackingAction
PrepareNewEvent()
– 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)
Initialisation
m a in
Ru n m a n a g e r
1 : in i t i al iz e
u se r d e t e ct o r
co n st r u c t i o n
u se r p h y si cs
l ist
2 : co n st r u c t
3 : m at e ri al co n st r u ct i o n
Describe your
experimental set-up
4 : g e o m e t r y c o n st r u c t io n
5 : w o r ld v o l u m e
6 : c o n st r u c t
7 : p h y si cs p r o c e ss co n st r u c t i o
Activate physics processes
appropriate to your experiment 8 : se t cu t s
Beam On
m ain
Run Manager
1 : Beam On
Geom et r y
manager
Event
generat or
Event
Manager
2 : close
3 : generat e one event
Generate primary events
according to distributions
relevant to your experiment
4: process one event
5 : open
Event processing
Event
manager
St acking
manager
Tracking
manager
Stepping
manager
User sensitive
det ect or
1: pop
2: process one t rack
5: secondaries
6: push
3: Stepping
4: generat e hit s
Record the physics quantities
generated by the simulation, that
are relevant to your experiment
G4VProcess
Abstract class defining the common
interface of all processes in Geant4
AlongStep
Define three kinds of actions:
–
–
–
PostStep
AtRest actions: decay, annihilation …
AlongStep actions: continuous interactions occuring along the path, like ionisation
PostStep 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()
used to limit the step size
either because the process triggers an interaction or a decay
or in other cases, like fraction of energy loss, geometry boundary, user’s limit…
– DoIt()
• implements the actual action to be applied to the track
• implements the related production of secondaries
Electromagnetic physics
energy loss
 electrons and positrons
 g, X-ray and optical photons
 muons
 charged hadrons
 ions
Comparable to Geant3 already in the  release (1997)
Further extensions (facilitated by the OO technology)
High energy extensions
Multiple scattering
Bremsstrahlung
Ionisation
Annihilation
Photoelectric effect
Compton scattering
Rayleigh effect
g conversion
e+e- pair production
Synchrotron radiation
Transition radiation
Cherenkov
Refraction
Reflection
Absorption
Scintillation
Fluorescence
Auger
– needed for LHC experiments, cosmic ray
experiments…
Low energy extensions
– fundamental for space and medical applications, dark
matter and n experiments, antimatter spectroscopy etc.
Alternative models for the same process
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
Unit 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;
48
System 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
49
Isotopes, 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…
50
Material: 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);
51
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);
52
Material: mixture

Composition of compound materials
G4Element* elC = …;
G4Material* SiO2 = …;
G4Material* H2O = …;
// define “carbon” element
// define “quartz” material
// 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);
53
Example: 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);
54
Define detector geometry

Three conceptual layers



G4VSolid -- shape, size
G4LogicalVolume -- daughter physical volumes,
material, sensitivity, user limits, etc.
G4VPhysicalVolume -- position, rotation
G4VSolid
G4Box
G4Tubs
G4LogicalVolume
G4Material
G4VisAttributes
G4VSensitiveDetector
G4VPhysicalVolume
G4PVPlacement
G4PVParameterised
55
Define detector geometry

Basic strategy
G4VSolid* pBoxSolid =
Logical volume :
+ material,
sensitivity,
etc.size
Solid
: shape and
new G4Box(“aBoxSolid”,
1.*m, 2.*m, 3.*m);
G4LogicalVolume* pBoxLog =
new G4LogicalVolume( pBoxSolid,
pBoxMaterial, “aBoxLog”, 0, 0, 0);
G4VPhysicalVolume* aBoxPhys =
Physical volume :
+ rotation and position
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.
56
G4LogicalVolume
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 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
57
G4PVPlacement
G4PVPlacement(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
58
G4PVPlacement
G4PVPlacement(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.
Mother volume
rotation
59
Alternative G4PVPlacement
G4PVPlacement(
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.
Mother volume
rotation
60
G4VSolid

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
61
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
62
Other CSG solids
G4Trap
G4Cons
G4Para
(parallelepiped)
G4Trd
G4Torus
G4Sphere
G4Orb
(full solid sphere)
Consult to Section 4.1.2 of Geant4
Application Developers Guide for
all available shapes.
63
Other Specific CSG solids
G4Polyhedra
G4EllipticalTube
G4Tet
(tetrahedra)
G4Hype
G4Ellipsoid
G4TwistedBox
G4EllipticalCone
G4TwistedTubs
G4TwistedTrap
G4TwistedTrd
Consult to Section 4.1.2 of Geant4
Application Developers Guide for all
available shapes.
64
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
G4SubtractionSolid
G4IntersectionSolid
65