Import Geant4 11.0.0 source tree
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
|
||||
///\file "optical/.README.txt"
|
||||
///\brief Examples optical README page
|
||||
|
||||
/*! \page Examples_optical Category "optical"
|
||||
|
||||
This directory includes examples demonstrating the use of optical processes
|
||||
in the simulation.
|
||||
|
||||
\link ExampleOpNovice OpNovice \endlink
|
||||
|
||||
Simulation of optical photons generation and transport.
|
||||
Defines optical surfaces and exercises optical physics processes
|
||||
(Cerenkov, Scintillation, Absorption, Rayleigh, ...). Uses stacking
|
||||
mechanism to count the secondary particles generated.
|
||||
|
||||
\link ExampleOpNovice2 OpNovice2 \endlink
|
||||
|
||||
Investigate optical properties and parameters. Details of optical
|
||||
photon boundary interactions on a surface are recorded. Details
|
||||
of optical photon generation and transport are recorded.
|
||||
|
||||
\link ExampleLXe LXe \endlink
|
||||
|
||||
Multi-purpose detector setup implementing:
|
||||
-# scintillation inside a bulk scintillator with PMTs
|
||||
-# large wall of small PMTs opposite a Cerenkov slab to show the cone
|
||||
-# plastic scintillator with wave-length-shifting fiber readout.
|
||||
|
||||
\link Examplewls wls \endlink
|
||||
|
||||
This application simulates the propagation of photons inside a Wave Length
|
||||
Shifting (WLS) fiber.
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,385 @@
|
||||
|
||||
///\file "optical/LXe/.README.txt"
|
||||
///\brief Example LXe README page
|
||||
|
||||
/*! \page ExampleLXe Example LXe
|
||||
|
||||
\section LXe_s1 Introduction
|
||||
|
||||
This example demonstrates usage of optical physics.
|
||||
|
||||
\section LXe_s2 Geometry and primary particle
|
||||
|
||||
The main volume is a box of LXe. PMTs are placed around the outside. There
|
||||
may be a reflective sphere placed inside the box, and a wavelength shifting
|
||||
slab and fibers.
|
||||
|
||||
The geometry implementation is different from many of the other examples.
|
||||
See the discussion below.
|
||||
|
||||
G4ParticleGun creates the primary particle. The type of particle is selectable
|
||||
by the user.
|
||||
|
||||
\section LXe_s3 Physics
|
||||
|
||||
The physics list is FTFP_BERT, with G4EmStandard_option4 electromagnetic
|
||||
physics and G4OpticalPhysics.
|
||||
|
||||
\section LXe_s4 Physics Macro files
|
||||
|
||||
cerenkov.mac disables scintillation, so the optical photons that are produced
|
||||
are Cerenkov photons.
|
||||
|
||||
wls.mac implements a scintillating slab and wavelength shifting fibers.
|
||||
|
||||
\section LXe_s5 List of built-in histograms
|
||||
|
||||
1 "hits per event"
|
||||
2 "hits per event above threshold"
|
||||
3 "scintillation photons per event"
|
||||
4 "Cerenkov photons per event"
|
||||
5 "absorbed photons per event"
|
||||
6 "photons absorbed at boundary per event"
|
||||
7 "energy deposition in scintillator per event"
|
||||
|
||||
\section LXe_s6 How to start?
|
||||
|
||||
- execute LXe in 'batch' mode from macro files, e.g.
|
||||
$ ./LXe cerenkov.mac
|
||||
|
||||
- execute LXe in 'interactive' mode with visualization, e.g.
|
||||
$ ./LXe
|
||||
Then type commands, for instance
|
||||
Session: /run/beamOn 1
|
||||
|
||||
\section LXe_s7 Macros included
|
||||
|
||||
Several macros are include in the distribution:
|
||||
|
||||
cerenkov.mac: Shoot a 200 MeV mu+ and only allow it to take one step. The
|
||||
Cerenkov cone and PMTs hit are visible. (Reduce the number
|
||||
of particles for visualization.)
|
||||
LXe.mac: Shoot a 511 keV gamma with the default geometry.
|
||||
photon.mac: Primary beam is an optical photon, with the default geometry.
|
||||
wls.mac: Geometry includes 15 WLS fibers. A 511 keV electron is the
|
||||
primary.
|
||||
|
||||
-
|
||||
|
||||
\section LXe_s8 Detailed Explanation of Geometry Implementation
|
||||
|
||||
The way the geometry is constructed is an experiment for a new, more object
|
||||
oriented, way to construct geometry. It separates the concept of how a volume
|
||||
is built from where it is placed. Each major volume in the geometry is defined
|
||||
as a class derived from G4PVPlacement. In this example, just the main LXe
|
||||
volume, the WLS scintillator slab, and the WLS fibers were chosen. To place
|
||||
one of these volumes, simply create an instance of it with the appropriate
|
||||
rotation, translation, and mother volumes.
|
||||
|
||||
\verbatim
|
||||
LXeMainVolume(G4RotationMatrix *pRot,
|
||||
const G4ThreeVector &tlate,
|
||||
G4LogicalVolume *pMotherLogical,
|
||||
G4bool pMany,
|
||||
G4int pCopyNo,
|
||||
LXeDetectorConstruction* c);
|
||||
\endverbatim
|
||||
|
||||
Also necessary are the pMany and pCopyNo variables with the same usage as in
|
||||
G4PVPlacement. Additionally, the detector construction must be passed to the
|
||||
main volume as a way to communicate the many parameters to the volume and its
|
||||
sub-volumes. The communication is done from the CopyValues() function which
|
||||
retrieves the information from the detector constructor.
|
||||
|
||||
Notably, the name and logical volume parameters are no longer part of the
|
||||
constructor. This is because they are both to be decided by the volume itself.
|
||||
The volume must specify its own name and a temporary logical volume. The
|
||||
constructor will then procede to define its logical volume in the normal way.
|
||||
Once complete, the logical volume can be assigned to the physical volume using
|
||||
the SetLogicalVolume() function.
|
||||
|
||||
To handle instances of the same type of volume, a new logical volume should not
|
||||
be defined for each one. Instead, the logical volume is kept as a static member
|
||||
and defined only once.
|
||||
|
||||
\verbatim
|
||||
if (!housing_log || updated) {
|
||||
//...
|
||||
//Define logical volume
|
||||
//...
|
||||
}
|
||||
SetLogicalVolume(housing_log);
|
||||
\endverbatim
|
||||
|
||||
The updated variable is to signal that the volume needs to be updated and a new
|
||||
logical volume made.
|
||||
|
||||
\section LXe_s9 Modifying the geometry at runtime
|
||||
|
||||
This example allows the user to modify the geometry definition at runtime. This
|
||||
is accomplished through LXeDetectorMessenger, a derived class of G4UImessenger.
|
||||
The commands it adds change variables stored in LXeDetectorConstructor that
|
||||
are used when constructing the geometry.
|
||||
|
||||
\verbatim
|
||||
void LXeDetectorConstruction::UpdateGeometry(){
|
||||
// clean-up previous geometry
|
||||
G4SolidStore::GetInstance()->Clean();
|
||||
G4LogicalVolumeStore::GetInstance()->Clean();
|
||||
G4PhysicalVolumeStore::GetInstance()->Clean();
|
||||
|
||||
//define new one
|
||||
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructDetector());
|
||||
G4RunManager::GetRunManager()->GeometryHasBeenModified();
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
\section LXe_s10 PMT sensitive detector
|
||||
|
||||
The PMT sensitive detector cannot be triggered like a normal sensitive detector
|
||||
because the sensitive volume does not allow photons to pass through it. Rather,
|
||||
it detects them in the OpBoundary process based on an efficiency set on the
|
||||
skin of the volume.
|
||||
|
||||
\verbatim
|
||||
G4OpticalSurface* photocath_opsurf=
|
||||
new G4OpticalSurface("photocath_opsurf",glisur,polished,
|
||||
dielectric_metal);
|
||||
G4double photocath_EFF[num]={1.,1.};
|
||||
G4double photocath_REFL[num]={0.,0.};
|
||||
G4MaterialPropertiesTable* photocath_mt = new G4MaterialPropertiesTable();
|
||||
photocath_mt->AddProperty("EFFICIENCY",Ephoton,photocath_EFF,num);
|
||||
photocath_mt->AddProperty("REFLECTIVITY",Ephoton,photocath_REFL,num);
|
||||
photocath_opsurf->SetMaterialPropertiesTable(photocath_mt);
|
||||
new G4LogicalSkinSurface("photocath_surf",photocath_log,photocath_opsurf);
|
||||
\endverbatim
|
||||
|
||||
A normal sensitive detector would have its ProcessHits
|
||||
function called for each step by a particle inside the volume. So, to record
|
||||
these hits with a sensitive detector we watched the status of the OpBoundary
|
||||
process from the stepping manager whenever a photon hit the sensitive volume
|
||||
of the pmt. If the status was 'Detection', we retrieve the sensitive detector
|
||||
from G4SDManager and call its ProcessHits function.
|
||||
|
||||
\verbatim
|
||||
boundaryStatus=boundary->GetStatus();
|
||||
//Check to see if the particle was actually at a boundary
|
||||
//Otherwise the boundary status may not be valid
|
||||
//Prior to Geant4.6.0-p1 this would not have been enough to check
|
||||
if(thePostPoint->GetStepStatus()==fGeomBoundary){
|
||||
switch(boundaryStatus){
|
||||
//...
|
||||
case Detection: //Note, this assumes that the volume causing detection
|
||||
//is the photocathode because it is the only one with
|
||||
//non-zero efficiency
|
||||
{
|
||||
//Trigger sensitive detector manually since photon is
|
||||
//absorbed but status was Detection
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
G4String sdName="/LXeDet/pmtSD";
|
||||
LXePMTSD* pmtSD = (LXePMTSD*)SDman
|
||||
->FindSensitiveDetector(sdName);
|
||||
if(pmtSD)
|
||||
pmtSD->ProcessHits_constStep(theStep,NULL);
|
||||
break;
|
||||
}
|
||||
//...
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
\section LXe_s11 Selectively drawing trajectories or highlighting volumes
|
||||
|
||||
In a simulation such as this one, where an average of 6000 trajectories are
|
||||
generated in a small space, there is little use in drawing all of them. There
|
||||
are two ways to select which ones to draw. The first of which is to decide
|
||||
while looping through the trajectory container which ones to draw and only call
|
||||
DrawTrajectory on the important ones. However, trajectories only contain a
|
||||
small portion of the information from the track it represents. This may not
|
||||
be enough to decide if a trajectory is worth drawing.
|
||||
|
||||
The alternative is to define your own trajectory class to store additional
|
||||
information to help decide if it should be drawn. To use your custom trajectory
|
||||
you must create it in the PreUserTrackingAction:
|
||||
|
||||
\verbatim
|
||||
fpTrackingManager->SetTrajectory(new LXeTrajectory(aTrack));
|
||||
\endverbatim
|
||||
|
||||
Then at any point you can get access to the trajectory you can update the extra
|
||||
information within it. When it comes to drawing, you can then use this to
|
||||
decide if you want to call DrawTrajectory. Or you can call DrawTrajectory for
|
||||
all trajectories and have the logic decide how and if a trajectory should
|
||||
be drawn inside the DrawTrajectory function itself.
|
||||
|
||||
Selectively highlighting volumes is useful to show which volumes were hit. To
|
||||
do this, you simply need a pointer to the physical volume. With that, you can
|
||||
modify its vis attributes and instruct the vis manager to redraw the volume
|
||||
with the new vis attributes.
|
||||
|
||||
\verbatim
|
||||
G4VisAttributes attribs(G4Colour(1.,0.,0.));
|
||||
attribs.SetForceSolid(true);
|
||||
G4RotationMatrix rot;
|
||||
if(physVol->GetRotation())//If a rotation is defined use it
|
||||
rot=*(physVol->GetRotation());
|
||||
G4Transform3D trans(rot,physVol->GetTranslation());//Create transform
|
||||
pVVisManager->Draw(*physVol,attribs,trans);//Draw it
|
||||
\endverbatim
|
||||
|
||||
In this case, it is done in Draw function of a PMT hit but it can be placed
|
||||
anywhere. The logic to decide if it should be drawn or not may be similar to
|
||||
the logic used in choosing which trajectories to draw.
|
||||
|
||||
See /LXe/detector/volumes/sphere in "UI commands" below for info on what
|
||||
trajectories are drawn in this simulation.
|
||||
|
||||
\section LXe_s12 Saving random engine seeds
|
||||
|
||||
At times it may be necessary to review a particular event of interest. To do
|
||||
this without redoing an entire run, which may take a long time, you must store
|
||||
the random engine seed from the beginning of the event. The run manager
|
||||
has some functions that help in this task.
|
||||
|
||||
\verbatim
|
||||
G4RunManager::SetRandomNumberStore(G4bool)
|
||||
\endverbatim
|
||||
|
||||
When set to true, this causes the run manager to write the seed for the
|
||||
beginning of the current run to CurrentRun.rndm and the current event to
|
||||
CurrentEvent.rndm. However, at the beginning of each event this file will be
|
||||
overwritten with the new event. To keep a copy for a particular event there is
|
||||
a function to copy this file to "run###evt###.rndm".
|
||||
|
||||
\verbatim
|
||||
G4RunManager::rndmSaveThisEvent()
|
||||
\endverbatim
|
||||
|
||||
This can be done for every event so you can review any event you like but this
|
||||
may be awkward for runs with very large numbers of events. Instead, implement
|
||||
some form of logic in EndOfEventAction to decide if the event is worth saving.
|
||||
If it is, then call rndmSaveThisEvent(). By default, these files are stored in
|
||||
the current working directory. There is a function to change this as well.
|
||||
Typically you would call that at the same time SetRandomNumberStore. The
|
||||
directory to save in must exist first. GEANT4 will not create it for you.
|
||||
|
||||
\verbatim
|
||||
G4RunManager::SetRandomNumberStoreDir(G4String)
|
||||
\endverbatim
|
||||
|
||||
\section LXe_s13 UI commands
|
||||
|
||||
Directories:
|
||||
\verbatim
|
||||
/LXe/ - All custom commands belong below this directory
|
||||
/LXe/detector/ - Geometry related commands
|
||||
/LXe/detector/volumes/ - Commands to enable/disable volumes in the geometry
|
||||
\endverbatim
|
||||
|
||||
Commands:
|
||||
\verbatim
|
||||
/LXe/saveThreshold <int, default = 4500>
|
||||
\endverbatim
|
||||
-Specifies a threshold for saving the random seed for an event. If the number
|
||||
of photons generated in an event is below this number then the random seed is
|
||||
saved to "./random/run###evt###.rndm". See "Saving random engine seeds".
|
||||
|
||||
\verbatim
|
||||
/LXe/eventVerbose <int, default = 1>
|
||||
\endverbatim
|
||||
-Enables end of event verbose data to be printed. This includes information
|
||||
counted and calculated by the user action classes.
|
||||
|
||||
\verbatim
|
||||
/LXe/pmtThreshold <int, default = 1>
|
||||
\endverbatim
|
||||
-Sets the PMT threshold in # of photons being detected by the PMT. PMTs below
|
||||
with fewer hits than the threshold will not count as being hit and will also
|
||||
not be highlighted at the end of the event.
|
||||
|
||||
\verbatim
|
||||
/LXe/oneStepPrimaries <bool>
|
||||
\endverbatim
|
||||
-This causes primary particles to be killed after going only one step inside
|
||||
the scintillator volume. This is useful to view the photons generated during
|
||||
the initial conversion of the primary particle.
|
||||
|
||||
\verbatim
|
||||
/LXe/forceDrawPhotons <bool>
|
||||
\endverbatim
|
||||
-Forces all optical photon trajectories to be drawn at the end of the event
|
||||
regardless of the scheme mentioned in /LXe/detector/volumes/sphere below.
|
||||
|
||||
\verbatim
|
||||
/LXe/forceDrawNoPhotons <bool>
|
||||
\endverbatim
|
||||
-Forces all optical photon trajectories to NOT be drawn at the end of the
|
||||
event regardless of the scheme mentioned in /LXe/detector/volumes/sphere below.
|
||||
-If /LXe/forceDrawPhotons is set to true, this has no effect.
|
||||
|
||||
\verbatim
|
||||
/LXe/detector/dimensions <double x y z> <unit, default = cm>
|
||||
\endverbatim
|
||||
-Sets the dimensions of the main scintillator volume.
|
||||
|
||||
\verbatim
|
||||
/LXe/detector/housingThickness <double>
|
||||
\endverbatim
|
||||
-Sets the thickness of the housing surrounding the main detector volume.
|
||||
|
||||
\verbatim
|
||||
/LXe/detector/pmtRadius <double> <unit, default = cm>
|
||||
\endverbatim
|
||||
-Sets the radius of the PMTs
|
||||
|
||||
\verbatim
|
||||
/LXe/detector/nx
|
||||
/LXe/detector/ny
|
||||
/LXe/detector/nz
|
||||
\endverbatim
|
||||
-Sets the number of PMTs placed in a row along each axis.
|
||||
|
||||
\verbatim
|
||||
/LXe/detector/reflectivity <double>
|
||||
\endverbatim
|
||||
-Sets the reflectivity of the inside of the aluminum housing. The geometry
|
||||
uses a default value of 1.00 for a fully reflective surface.
|
||||
|
||||
\verbatim
|
||||
/LXe/detector/nfibers <int>
|
||||
\endverbatim
|
||||
-Sets the number of WLS fibers placed in the WLS scintillator slab. The
|
||||
geometry uses a default value of 15 fibers.
|
||||
|
||||
\verbatim
|
||||
/LXe/detector/scintYieldFactor <double>
|
||||
\endverbatim
|
||||
-Sets the yield factor for the scintillation process. This is cumulative with
|
||||
the yield factor set on individual materials. Set to 0 to produce no
|
||||
scintillation photons.
|
||||
|
||||
\verbatim
|
||||
/LXe/detector/defaults
|
||||
\endverbatim
|
||||
-Resets all detector values customizable with commands above to their defaults.
|
||||
|
||||
\verbatim
|
||||
/LXe/detector/volumes/sphere <bool>
|
||||
\endverbatim
|
||||
-Enables/disables the sphere placed inside the main scintillator volume. When
|
||||
the sphere is enabled, only photons that hit the sphere and hit a PMT are
|
||||
drawn. If it is disabled, then all photons that hit PMTs are drawn.
|
||||
|
||||
\verbatim
|
||||
/LXe/detector/volumes/wls <bool>
|
||||
\endverbatim
|
||||
-Enables/disables the WLS scintillator slab containing WLS fibers. By default
|
||||
this is not part of the geometry. Enabling it will place it behind the LXe
|
||||
scintillator volume.
|
||||
|
||||
\verbatim
|
||||
/LXe/detector/volumes/lxe <bool>
|
||||
\endverbatim
|
||||
-Enables/disables the main LXe scintillator volume. By default this is part of
|
||||
the geometry.
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,356 @@
|
||||
|
||||
LXe Example
|
||||
-----------
|
||||
|
||||
------------
|
||||
Introduction
|
||||
------------
|
||||
|
||||
This example demonstrates usage of optical physics.
|
||||
|
||||
-----------------------------
|
||||
Geometry and primary particle
|
||||
-----------------------------
|
||||
|
||||
The main volume is a box of LXe. PMTs are placed around the outside. There
|
||||
may be a reflective sphere placed inside the box, and a wavelength shifting
|
||||
slab and fibers.
|
||||
|
||||
The geometry implementation is different from many of the other examples.
|
||||
See the discussion below.
|
||||
|
||||
G4ParticleGun creates the primary particle. The type of particle is selectable
|
||||
by the user.
|
||||
|
||||
-------
|
||||
Physics
|
||||
-------
|
||||
|
||||
The physics list is FTFP_BERT, with G4EmStandard_option4 electromagnetic
|
||||
physics and G4OpticalPhysics.
|
||||
|
||||
-----------
|
||||
Macro files
|
||||
-----------
|
||||
|
||||
cerenkov.mac disables scintillation, so the optical photons that are produced
|
||||
are Cerenkov photons.
|
||||
|
||||
wls.mac implements a scintillating slab and wavelength shifting fibers.
|
||||
|
||||
|
||||
---------------------------
|
||||
List of built-in histograms
|
||||
---------------------------
|
||||
|
||||
1 "hits per event"
|
||||
2 "hits per event above threshold"
|
||||
3 "scintillation photons per event"
|
||||
4 "Cerenkov photons per event"
|
||||
5 "absorbed photons per event"
|
||||
6 "photons absorbed at boundary per event"
|
||||
7 "energy deposition in scintillator per event"
|
||||
|
||||
|
||||
-------------
|
||||
How to start?
|
||||
-------------
|
||||
|
||||
- execute LXe in 'batch' mode from macro files, e.g.
|
||||
$ ./LXe cerenkov.mac
|
||||
|
||||
- execute LXe in 'interactive' mode with visualization, e.g.
|
||||
$ ./LXe
|
||||
Then type commands, for instance
|
||||
Session: /run/beamOn 1
|
||||
|
||||
---------------
|
||||
Macros included
|
||||
---------------
|
||||
|
||||
Several macros are include in the distribution:
|
||||
|
||||
cerenkov.mac: Shoot a 200 MeV mu+ and only allow it to take one step. The
|
||||
Cerenkov cone and PMTs hit are visible. (Reduce the number
|
||||
of particles for visualization.)
|
||||
LXe.mac: Shoot a 511 keV gamma with the default geometry.
|
||||
photon.mac: Primary beam is an optical photon, with the default geometry.
|
||||
wls.mac: Geometry includes 15 WLS fibers. A 511 keV electron is the
|
||||
primary.
|
||||
|
||||
-----------------------------------------------
|
||||
Detailed Explanation of Geometry Implementation
|
||||
-----------------------------------------------
|
||||
|
||||
The way the geometry is constructed is an experiment for a new, more object
|
||||
oriented, way to construct geometry. It separates the concept of how a volume
|
||||
is built from where it is placed. Each major volume in the geometry is defined
|
||||
as a class derived from G4PVPlacement. In this example, just the main LXe
|
||||
volume, the WLS scintillator slab, and the WLS fibers were chosen. To place
|
||||
one of these volumes, simply create an instance of it with the appropriate
|
||||
rotation, translation, and mother volumes.
|
||||
|
||||
LXeMainVolume(G4RotationMatrix *pRot,
|
||||
const G4ThreeVector &tlate,
|
||||
G4LogicalVolume *pMotherLogical,
|
||||
G4bool pMany,
|
||||
G4int pCopyNo,
|
||||
LXeDetectorConstruction* c);
|
||||
|
||||
Also necessary are the pMany and pCopyNo variables with the same usage as in
|
||||
G4PVPlacement. Additionally, the detector construction must be passed to the
|
||||
main volume as a way to communicate the many parameters to the volume and its
|
||||
sub-volumes. The communication is done from the CopyValues() function which
|
||||
retrieves the information from the detector constructor.
|
||||
|
||||
Notably, the name and logical volume parameters are no longer part of the
|
||||
constructor. This is because they are both to be decided by the volume itself.
|
||||
The volume must specify its own name and a temporary logical volume. The
|
||||
constructor will then procede to define its logical volume in the normal way.
|
||||
Once complete, the logical volume can be assigned to the physical volume using
|
||||
the SetLogicalVolume() function.
|
||||
|
||||
To handle instances of the same type of volume, a new logical volume should not
|
||||
be defined for each one. Instead, the logical volume is kept as a static member
|
||||
and defined only once.
|
||||
|
||||
if (!housing_log || updated) {
|
||||
//...
|
||||
//Define logical volume
|
||||
//...
|
||||
}
|
||||
SetLogicalVolume(housing_log);
|
||||
|
||||
The updated variable is to signal that the volume needs to be updated and a new
|
||||
logical volume made.
|
||||
|
||||
---------------------------------
|
||||
Modifying the geometry at runtime
|
||||
---------------------------------
|
||||
|
||||
This example allows the user to modify the geometry definition at runtime. This
|
||||
is accomplished through LXeDetectorMessenger, a derived class of G4UImessenger.
|
||||
The commands it adds change variables stored in LXeDetectorConstructor that
|
||||
are used when constructing the geometry.
|
||||
|
||||
void LXeDetectorConstruction::UpdateGeometry(){
|
||||
// clean-up previous geometry
|
||||
G4SolidStore::GetInstance()->Clean();
|
||||
G4LogicalVolumeStore::GetInstance()->Clean();
|
||||
G4PhysicalVolumeStore::GetInstance()->Clean();
|
||||
|
||||
//define new one
|
||||
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructDetector());
|
||||
G4RunManager::GetRunManager()->GeometryHasBeenModified();
|
||||
}
|
||||
|
||||
----------------------
|
||||
PMT sensitive detector
|
||||
----------------------
|
||||
|
||||
The PMT sensitive detector cannot be triggered like a normal sensitive detector
|
||||
because the sensitive volume does not allow photons to pass through it. Rather,
|
||||
it detects them in the OpBoundary process based on an efficiency set on the
|
||||
skin of the volume.
|
||||
|
||||
|
||||
G4OpticalSurface* photocath_opsurf=
|
||||
new G4OpticalSurface("photocath_opsurf",glisur,polished,
|
||||
dielectric_metal);
|
||||
G4double photocath_EFF[num]={1.,1.};
|
||||
G4double photocath_REFL[num]={0.,0.};
|
||||
G4MaterialPropertiesTable* photocath_mt = new G4MaterialPropertiesTable();
|
||||
photocath_mt->AddProperty("EFFICIENCY",Ephoton,photocath_EFF,num);
|
||||
photocath_mt->AddProperty("REFLECTIVITY",Ephoton,photocath_REFL,num);
|
||||
photocath_opsurf->SetMaterialPropertiesTable(photocath_mt);
|
||||
new G4LogicalSkinSurface("photocath_surf",photocath_log,photocath_opsurf);
|
||||
|
||||
|
||||
A normal sensitive detector would have its ProcessHits
|
||||
function called for each step by a particle inside the volume. So, to record
|
||||
these hits with a sensitive detector we watched the status of the OpBoundary
|
||||
process from the stepping manager whenever a photon hit the sensitive volume
|
||||
of the pmt. If the status was 'Detection', we retrieve the sensitive detector
|
||||
from G4SDManager and call its ProcessHits function.
|
||||
|
||||
|
||||
boundaryStatus=boundary->GetStatus();
|
||||
//Check to see if the particle was actually at a boundary
|
||||
//Otherwise the boundary status may not be valid
|
||||
//Prior to Geant4.6.0-p1 this would not have been enough to check
|
||||
if(thePostPoint->GetStepStatus()==fGeomBoundary){
|
||||
switch(boundaryStatus){
|
||||
//...
|
||||
case Detection: //Note, this assumes that the volume causing detection
|
||||
//is the photocathode because it is the only one with
|
||||
//non-zero efficiency
|
||||
{
|
||||
//Trigger sensitive detector manually since photon is
|
||||
//absorbed but status was Detection
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
G4String sdName="/LXeDet/pmtSD";
|
||||
LXePMTSD* pmtSD = (LXePMTSD*)SDman
|
||||
->FindSensitiveDetector(sdName);
|
||||
if(pmtSD)
|
||||
pmtSD->ProcessHits_constStep(theStep,NULL);
|
||||
break;
|
||||
}
|
||||
//...
|
||||
}
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
Selectively drawing trajectories or highlighting volumes
|
||||
--------------------------------------------------------
|
||||
|
||||
In a simulation such as this one, where an average of 6000 trajectories are
|
||||
generated in a small space, there is little use in drawing all of them. There
|
||||
are two ways to select which ones to draw. The first of which is to decide
|
||||
while looping through the trajectory container which ones to draw and only call
|
||||
DrawTrajectory on the important ones. However, trajectories only contain a
|
||||
small portion of the information from the track it represents. This may not
|
||||
be enough to decide if a trajectory is worth drawing.
|
||||
|
||||
The alternative is to define your own trajectory class to store additional
|
||||
information to help decide if it should be drawn. To use your custom trajectory
|
||||
you must create it in the PreUserTrackingAction:
|
||||
|
||||
fpTrackingManager->SetTrajectory(new LXeTrajectory(aTrack));
|
||||
|
||||
Then at any point you can get access to the trajectory you can update the extra
|
||||
information within it. When it comes to drawing, you can then use this to
|
||||
decide if you want to call DrawTrajectory. Or you can call DrawTrajectory for
|
||||
all trajectories and have the logic decide how and if a trajectory should
|
||||
be drawn inside the DrawTrajectory function itself.
|
||||
|
||||
Selectively highlighting volumes is useful to show which volumes were hit. To
|
||||
do this, you simply need a pointer to the physical volume. With that, you can
|
||||
modify its vis attributes and instruct the vis manager to redraw the volume
|
||||
with the new vis attributes.
|
||||
|
||||
G4VisAttributes attribs(G4Colour(1.,0.,0.));
|
||||
attribs.SetForceSolid(true);
|
||||
G4RotationMatrix rot;
|
||||
if(physVol->GetRotation())//If a rotation is defined use it
|
||||
rot=*(physVol->GetRotation());
|
||||
G4Transform3D trans(rot,physVol->GetTranslation());//Create transform
|
||||
pVVisManager->Draw(*physVol,attribs,trans);//Draw it
|
||||
|
||||
In this case, it is done in Draw function of a PMT hit but it can be placed
|
||||
anywhere. The logic to decide if it should be drawn or not may be similar to
|
||||
the logic used in choosing which trajectories to draw.
|
||||
|
||||
See /LXe/detector/volumes/sphere in "UI commands" below for info on what
|
||||
trajectories are drawn in this simulation.
|
||||
|
||||
--------------------------
|
||||
Saving random engine seeds
|
||||
--------------------------
|
||||
|
||||
At times it may be necessary to review a particular event of interest. To do
|
||||
this without redoing an entire run, which may take a long time, you must store
|
||||
the random engine seed from the beginning of the event. The run manager
|
||||
has some functions that help in this task.
|
||||
|
||||
G4RunManager::SetRandomNumberStore(G4bool)
|
||||
|
||||
When set to true, this causes the run manager to write the seed for the
|
||||
beginning of the current run to CurrentRun.rndm and the current event to
|
||||
CurrentEvent.rndm. However, at the beginning of each event this file will be
|
||||
overwritten with the new event. To keep a copy for a particular event there is
|
||||
a function to copy this file to run###evt###.rndm.
|
||||
|
||||
G4RunManager::rndmSaveThisEvent()
|
||||
|
||||
This can be done for every event so you can review any event you like but this
|
||||
may be awkward for runs with very large numbers of events. Instead, implement
|
||||
some form of logic in EndOfEventAction to decide if the event is worth saving.
|
||||
If it is, then call rndmSaveThisEvent(). By default, these files are stored in
|
||||
the current working directory. There is a function to change this as well.
|
||||
Typically you would call that at the same time SetRandomNumberStore. The
|
||||
directory to save in must exist first. GEANT4 will not create it for you.
|
||||
|
||||
G4RunManager::SetRandomNumberStoreDir(G4String)
|
||||
|
||||
-----------
|
||||
UI commands
|
||||
-----------
|
||||
|
||||
Directories:
|
||||
/LXe/ - All custom commands belong below this directory
|
||||
/LXe/detector/ - Geometry related commands
|
||||
/LXe/detector/volumes/ - Commands to enable/disable volumes in the geometry
|
||||
|
||||
Commands:
|
||||
/LXe/saveThreshold <int, default = 4500>
|
||||
-Specifies a threshold for saving the random seed for an event. If the number
|
||||
of photons generated in an event is below this number then the random seed is
|
||||
saved to ./random/run###evt###.rndm. See "Saving random engine seeds".
|
||||
|
||||
/LXe/eventVerbose <int, default = 1>
|
||||
-Enables end of event verbose data to be printed. This includes information
|
||||
counted and calculated by the user action classes.
|
||||
|
||||
/LXe/pmtThreshold <int, default = 1>
|
||||
-Sets the PMT threshold in # of photons being detected by the PMT. PMTs below
|
||||
with fewer hits than the threshold will not count as being hit and will also
|
||||
not be highlighted at the end of the event.
|
||||
|
||||
/LXe/oneStepPrimaries <bool>
|
||||
-This causes primary particles to be killed after going only one step inside
|
||||
the scintillator volume. This is useful to view the photons generated during
|
||||
the initial conversion of the primary particle.
|
||||
|
||||
/LXe/forceDrawPhotons <bool>
|
||||
-Forces all optical photon trajectories to be drawn at the end of the event
|
||||
regardless of the scheme mentioned in /LXe/detector/volumes/sphere below.
|
||||
|
||||
/LXe/forceDrawNoPhotons <bool>
|
||||
-Forces all optical photon trajectories to NOT be drawn at the end of the
|
||||
event regardless of the scheme mentioned in /LXe/detector/volumes/sphere below.
|
||||
-If /LXe/forceDrawPhotons is set to true, this has no effect.
|
||||
|
||||
/LXe/detector/dimensions <double x y z> <unit, default = cm>
|
||||
-Sets the dimensions of the main scintillator volume.
|
||||
|
||||
/LXe/detector/housingThickness <double>
|
||||
-Sets the thickness of the housing surrounding the main detector volume.
|
||||
|
||||
/LXe/detector/pmtRadius <double> <unit, default = cm>
|
||||
-Sets the radius of the PMTs
|
||||
|
||||
/LXe/detector/nx
|
||||
/LXe/detector/ny
|
||||
/LXe/detector/nz
|
||||
-Sets the number of PMTs placed in a row along each axis.
|
||||
|
||||
/LXe/detector/reflectivity <double>
|
||||
-Sets the reflectivity of the inside of the aluminum housing. The geometry
|
||||
uses a default value of 1.00 for a fully reflective surface.
|
||||
|
||||
/LXe/detector/nfibers <int>
|
||||
-Sets the number of WLS fibers placed in the WLS scintillator slab. The
|
||||
geometry uses a default value of 15 fibers.
|
||||
|
||||
/LXe/detector/scintYieldFactor <double>
|
||||
-Sets the yield factor for the scintillation process. This is cumulative with
|
||||
the yield factor set on individual materials. Set to 0 to produce no
|
||||
scintillation photons.
|
||||
|
||||
/LXe/detector/defaults
|
||||
-Resets all detector values customizable with commands above to their defaults.
|
||||
|
||||
/LXe/detector/volumes/sphere <bool>
|
||||
-Enables/disables the sphere placed inside the main scintillator volume. When
|
||||
the sphere is enabled, only photons that hit the sphere and hit a PMT are
|
||||
drawn. If it is disabled, then all photons that hit PMTs are drawn.
|
||||
|
||||
/LXe/detector/volumes/wls <bool>
|
||||
-Enables/disables the WLS scintillator slab containing WLS fibers. By default
|
||||
this is not part of the geometry. Enabling it will place it behind the LXe
|
||||
scintillator volume.
|
||||
|
||||
/LXe/detector/volumes/lxe <bool>
|
||||
-Enables/disables the main LXe scintillator volume. By default this is part of
|
||||
the geometry.
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
|
||||
///\file "optical/OpNovice/.README.txt"
|
||||
///\brief Example OpNovice README page
|
||||
|
||||
/*! \page ExampleOpNovice Example OpNovice
|
||||
|
||||
This example presently illustrates the following basic concepts, and in
|
||||
particular (indicated with ***), how to use G4 for optical photon
|
||||
generation and transport. Other extended example of what is possible
|
||||
in Geant4 with optical photons can be found at
|
||||
examples/extended/optical/LXe and wls
|
||||
|
||||
\section ExampleOpNovice_s1 main()
|
||||
|
||||
Define Random Number generator initial seed
|
||||
|
||||
\section ExampleOpNovice_s2 G4OpticalPhysics
|
||||
|
||||
The G4OpticalPhysics physics class is used. The messenger is the
|
||||
G4OpticalParametersMessenger class.
|
||||
|
||||
- Define particles; including - *** G4OpticalPhoton ***
|
||||
- Define processes; including
|
||||
- *** G4Cerenkov ***
|
||||
- *** G4Scintillation ***
|
||||
- *** G4OpAbsorption ***
|
||||
- *** G4OpRayleigh ***
|
||||
- *** G4OpBoundaryProcess ***
|
||||
|
||||
A messenger command allows to define interactively the
|
||||
verbose level and the maximum number of Cerenkov photons per step
|
||||
(see for instance OpNovice.in)
|
||||
|
||||
\section ExampleOpNovice_s3 G4VUserDetectorConstruction
|
||||
|
||||
- Define material: Air and Water
|
||||
- Define simple G4box geometry
|
||||
- *** add G4MaterialPropertiesTable to G4Material ***
|
||||
- *** define G4LogicalSurface(s) ***
|
||||
- *** define G4OpticalSurface ***
|
||||
- *** add G4MaterialPropertiesTable to G4OpticalSurface ***
|
||||
|
||||
alternatively the Configuration can be read from a gdml file.
|
||||
The provided gdml file NoviceExample.gdml corresponds to the detector
|
||||
defined in OpNoviceDetectorConstruction.
|
||||
|
||||
|
||||
\section ExampleOpNovice_s4 G4VUserPrimaryGeneratorAction
|
||||
|
||||
Use G4ParticleGun to shoot a charge particle into a Cerenkov radiator
|
||||
|
||||
A messenger command allows to define interactively the polarization of an
|
||||
primary optical photon (see for instance optPhoton.mac)
|
||||
|
||||
\section ExampleOpNovice_s5 G4UserRunAction and G4Run
|
||||
|
||||
- Used to accumulate statistics.
|
||||
|
||||
\section ExampleOpNovice_s6 G4UserStackingAction and G4UserEventAction
|
||||
|
||||
Show how to count the number of secondary particles in an event
|
||||
|
||||
\section ExampleOpNovice_s7 Visualisation
|
||||
|
||||
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 in case of interactive running mode.
|
||||
|
||||
The detector has a default view which is a longitudinal view of the tank.
|
||||
The tracks are drawn at the end of event, and erased at the end of run.
|
||||
|
||||
\section ExampleOpNovice_s8 How to start
|
||||
|
||||
- compile and link to generate an executable
|
||||
|
||||
This example handles the program arguments in a new way.
|
||||
It can be run with the following optional arguments:
|
||||
\verbatim
|
||||
$ OpNovice [-g gdmlfile] [-m macro ] [-u UIsession] [-t nThreads]
|
||||
\endverbatim
|
||||
|
||||
The -t option is available only in multi-threading mode
|
||||
and it allows the user to override the Geant4 default number of
|
||||
threads. The number of threads can be also set via G4FORCENUMBEROFTHREADS
|
||||
environment variable which has the top priority.
|
||||
|
||||
- execute OpNovice in 'batch' mode from macro files
|
||||
\verbatim
|
||||
$ OpNovice -m OpNovice.in
|
||||
\endverbatim
|
||||
|
||||
- execute OpNovice in 'batch' mode from macro files using a gdml file
|
||||
to define the geometry
|
||||
$ OpNovice -g NoviceExample.gdml -m OpNovice.in
|
||||
|
||||
- execute OpNovice in 'interactive mode' with visualization
|
||||
\verbatim
|
||||
$ OpNovice
|
||||
....
|
||||
Idle> type your commands. For instance:
|
||||
Idle> /control/execute optPhoton.mac
|
||||
....
|
||||
Idle> exit
|
||||
\endverbatim
|
||||
|
||||
Macros
|
||||
------
|
||||
|
||||
The following macros are provided:
|
||||
|
||||
optPhoton.mac: Shoot optical photons with energy 3 eV
|
||||
OpNovice.in: Shoot positrons with energy 500 keV.
|
||||
gui.mac: Configure the graphical user interface.
|
||||
vis.mac: Configure visualization.
|
||||
|
||||
|
||||
|
||||
gdml files
|
||||
----------
|
||||
NoviceExample.gdml: example gdml file corresponding to
|
||||
OpNoviceDetectorConstruction
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,124 @@
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
OpNovice
|
||||
--------
|
||||
|
||||
This example presently illustrates the following basic concepts, and in
|
||||
particular (indicated with ***), how to use G4 for optical photon
|
||||
generation and transport. Other extended example of what is possible
|
||||
in Geant4 with optical photons can be found at
|
||||
examples/extended/optical/LXe and wls.
|
||||
|
||||
main()
|
||||
------
|
||||
|
||||
==> define Random Number generator initial seed
|
||||
|
||||
G4Optical Physics
|
||||
-----------------
|
||||
|
||||
The G4OpticalPhysics physics class is used. The messenger is the
|
||||
G4OpticalParametersMessenger class.
|
||||
|
||||
==> define particles; including *** G4OpticalPhoton ***
|
||||
define processes; including *** G4Cerenkov ***
|
||||
*** G4Scintillation ***
|
||||
*** G4OpAbsorption ***
|
||||
*** G4OpRayleigh ***
|
||||
*** G4OpBoundaryProcess ***
|
||||
|
||||
==> A messenger command allows to define interactively the
|
||||
verbose level and the maximum number of Cerenkov photons per step
|
||||
(see for instance OpNovice.in)
|
||||
|
||||
G4VUserDetectorConstruction
|
||||
---------------------------
|
||||
|
||||
==> define material: Air and Water
|
||||
define simple G4box geometry
|
||||
*** add G4MaterialPropertiesTable to G4Material ***
|
||||
*** define G4LogicalSurface(s) ***
|
||||
*** define G4OpticalSurface ***
|
||||
*** add G4MaterialPropertiesTable to G4OpticalSurface ***
|
||||
|
||||
alternatively the Configuration can be read from a gdml file.
|
||||
The provided gdml file NoviceExample.gdml corresponds to the detector
|
||||
defined in OpNoviceDetectorConstruction.
|
||||
|
||||
G4VUserPrimaryGeneratorAction
|
||||
-----------------------------
|
||||
|
||||
==> Use G4ParticleGun to shoot a charge particle into a Cerenkov radiator
|
||||
|
||||
==> A messenger command allows to define interactively the polarization of an
|
||||
primary optical photon (see for instance optPhoton.mac)
|
||||
|
||||
G4UserRunAction and G4Run
|
||||
-------------------------
|
||||
|
||||
Used to accumulate statistics.
|
||||
|
||||
G4UserStackingAction and G4UserEventAction
|
||||
------------------------------------------
|
||||
|
||||
==> show how to count the number of secondary particles in an event
|
||||
|
||||
Visualisation
|
||||
-------------
|
||||
|
||||
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 in case of interactive running mode.
|
||||
|
||||
The detector has a default view which is a longitudinal view of the tank.
|
||||
The tracks are drawn at the end of event, and erased at the end of run.
|
||||
|
||||
HOW TO START
|
||||
------------
|
||||
|
||||
- compile and link to generate an executable
|
||||
|
||||
This example handles the program arguments in a new way.
|
||||
It can be run with the following optional optionaarguments:
|
||||
$ OpNovice [-g gdmlfile] [-m macro ] [-u UIsession] [-t nThreads]
|
||||
|
||||
The -t option is available only in multi-threading mode
|
||||
and it allows the user to override the Geant4 default number of
|
||||
threads. The number of threads can be also set via G4FORCENUMBEROFTHREADS
|
||||
environment variable which has the top priority.
|
||||
|
||||
- execute OpNovice in 'batch' mode from macro files
|
||||
$ OpNovice -m OpNovice.in
|
||||
|
||||
- execute OpNovice in 'batch' mode from macro files using a gdml file
|
||||
to define the geometry
|
||||
$ OpNovice -g NoviceExample.gdml -m OpNovice.in
|
||||
|
||||
- execute OpNovice in 'interactive mode' with visualization
|
||||
$ OpNovice
|
||||
....
|
||||
Idle> type your commands. For instance:
|
||||
Idle> /control/execute optPhoton.mac
|
||||
....
|
||||
Idle> exit
|
||||
|
||||
Macros
|
||||
------
|
||||
|
||||
The following macros are provided:
|
||||
|
||||
optPhoton.mac: Shoot optical photons with energy 3 eV
|
||||
OpNovice.in: Shoot positrons with energy 500 keV.
|
||||
gui.mac: Configure the graphical user interface.
|
||||
vis.mac: Configure visualization.ls
|
||||
|
||||
|
||||
gdml files
|
||||
----------
|
||||
NoviceExample.gdml: example gdml file corresponding to
|
||||
OpNoviceDetectorConstruction
|
||||
@@ -0,0 +1,158 @@
|
||||
|
||||
///\file "optical/OpNovice2/.README.txt"
|
||||
///\brief Example AnaEx01 README page
|
||||
|
||||
/*! \page ExampleOpNovice2 Example OpNovice2
|
||||
|
||||
Investigate optical properties and parameters. Details of optical
|
||||
photon boundary interactions on a surface are recorded. Details
|
||||
of optical photon generation and transport are recorded.
|
||||
|
||||
|
||||
\section OpNovice2_s1 GEOMETRY DEFINITION
|
||||
|
||||
The geometry consists of a cube "box" with a side of 2 m inside
|
||||
the world cube of side 20 m. Optical properties of the box, the world,
|
||||
and the surface may be set interactively via the commands defined
|
||||
in the DetectorMessenger class.
|
||||
|
||||
Material properties may be added using the macro commands:
|
||||
- for the box:
|
||||
\verbatim
|
||||
/opnovice2/boxProperty NAME EN1 V1 EN2 V2 [ .. ENn Vn]
|
||||
/opnovice2/boxConstProperty NAME VALUE
|
||||
\endverbatim
|
||||
- for the world:
|
||||
\verbatim
|
||||
/opnovice2/worldProperty NAME EN1 V1 EN2 V2 [ .. ENn Vn]
|
||||
/opnovice2/worldConstProperty NAME VALUE
|
||||
\endverbatim
|
||||
- for the surface:
|
||||
\verbatim
|
||||
/opnovice2/surfaceProperty NAME EN1 V1 EN2 V2 [ .. ENn Vn]
|
||||
\endverbatim
|
||||
|
||||
Multiple energy and value pairs may be specified for the energy-dependent
|
||||
properties.
|
||||
|
||||
Values are in Geant4 internal units. Energy is in MeV.
|
||||
|
||||
Example:
|
||||
\verbatim
|
||||
/opnovice2/boxProperty RINDEX 0.000002 1.3 0.000005 1.32 0.000008 1.34
|
||||
\endverbatim
|
||||
sets the refractive index of the box to 1.3 at 2 eV, 1.32 at 5 eV, and
|
||||
1.34 at 8 eV.
|
||||
|
||||
\section OpNovice2_s2 PHYSICS LIST
|
||||
|
||||
The FTFP_BERT physics list is used, with electromagnetic option
|
||||
EMZ (option4) and G4OpticalPhysics for the optical physics.
|
||||
|
||||
\section OpNovice2_s3 AN EVENT : THE PRIMARY GENERATOR
|
||||
|
||||
The primary kinematic consists of a single particle. The type of
|
||||
the particle, its energy, position, and direction, are set
|
||||
in the PrimaryGeneratorAction class, and can be changed via the G4
|
||||
build-in commands of G4ParticleGun class (see the macros provided with
|
||||
this example).
|
||||
|
||||
\section OpNovice2_s4 VISUALIZATION
|
||||
|
||||
The Visualization Manager is set in the main().
|
||||
The initialisation of the drawing is done via the commands
|
||||
/vis/... in the macro vis.mac. To get visualisation:
|
||||
\verbatim
|
||||
> /control/execute vis.mac
|
||||
\endverbatim
|
||||
or run the program with no command line arguments:
|
||||
\verbatim
|
||||
$ ./OpNovice2
|
||||
\endverbatim
|
||||
|
||||
\section OpNovice2_s5 HOW TO START ?
|
||||
|
||||
- Execute OpNovice2 in 'batch' mode from macro files
|
||||
\verbatim
|
||||
% OpNovice2 electron.mac
|
||||
\endverbatim
|
||||
|
||||
- Execute OpNovice2 in 'interactive mode' with visualization
|
||||
\verbatim
|
||||
% OpNovice2
|
||||
....
|
||||
Idle> type your commands
|
||||
....
|
||||
Idle> exit
|
||||
\endverbatim
|
||||
|
||||
\section OpNovice2_s6 RESULTS
|
||||
|
||||
A table of optical photon events is printed at the end of the run.
|
||||
|
||||
\section OpNovice2_s7 HISTOGRAMS
|
||||
|
||||
OpNovice2 has several predefined 1D histograms :
|
||||
- 1 : Cerenkov spectrum
|
||||
- 2 : scintillation spectrum
|
||||
- 3 : scintillation time (global time)
|
||||
- 4 : WLS absorption spectrum
|
||||
- 5 : WLS emission spectrum
|
||||
- 6 : WLS emission time
|
||||
- 7 : WLS2 absorption spectrum
|
||||
- 8 : WLS2 emission spectrum
|
||||
- 9 : WLS2 emission time
|
||||
- 10 : boundary process status
|
||||
- 11 : X momentum dir of scattered photons with px < 0
|
||||
- 12 : Y momentum dir of scattered photons with px < 0
|
||||
- 13 : Z momentum dir of scattered photons with px < 0
|
||||
- 14 : X momentum dir of scattered photons with px >= 0
|
||||
- 15 : Y momentum dir of scattered photons with px >= 0
|
||||
- 16 : Z momentum dir of scattered photons with px >= 0
|
||||
- 17 : X momentum dir of Fresnel-refracted photons
|
||||
- 18 : Y momentum dir of Fresnel-refracted photons
|
||||
- 19 : Z momentum dir of Fresnel-refracted photons
|
||||
- 20 : fraction of photons transmitted at surface
|
||||
- 21 : fraction of photons reflected at surface
|
||||
|
||||
Histograms 11-19 are recorded for photons scattered from the +X
|
||||
surface of the cube. Only the first interaction is recorded.
|
||||
|
||||
The histograms are managed by G4Analysis classes.
|
||||
The histos can be individually activated with the command :
|
||||
\verbatim
|
||||
/analysis/h1/set id nbBins valMin valMax
|
||||
\endverbatim
|
||||
The unit is hardcoded to be eV for energy and ns for time.
|
||||
|
||||
One can control the name of the histograms file with the command:
|
||||
\verbatim
|
||||
/analysis/setFileName name (default opnovice2)
|
||||
\endverbatim
|
||||
|
||||
It is possible to choose the format of the histogram file : root (default),
|
||||
hbook, xml, csv, by using namespace in HistoManager.hh
|
||||
|
||||
It is also possible to print selected histograms on an ascii file:
|
||||
\verbatim
|
||||
/analysis/h1/setAscii id
|
||||
\endverbatim
|
||||
All selected histos will be written on a file name.ascii (default opnovice2)
|
||||
|
||||
\section OpNovice2_s8 MACROS
|
||||
|
||||
Several macros are included.
|
||||
boundary.mac: Set the surface to the various types and configurations of
|
||||
model, type, etc., shoot optical photons, and record statistics
|
||||
electron.mac: Shoot electrons and observe Cerenkov and scintillation radiation
|
||||
fresnel.mac: Shoot optical photons of fixed polarization and random direction
|
||||
at a surface, and plot reflectance/transmittance vs incident
|
||||
angle.
|
||||
OpNovice2.mac: Shoot an optical photon inside a box.
|
||||
scint_by_particle.mac: Configure scintillation to have particle-specific
|
||||
yields and yield ratios. Shoot different types of particles.
|
||||
vis.mac: Configure visualization.
|
||||
wls.mac: Configure two wavelength-shifting processes, and shoot optical
|
||||
photons.
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,137 @@
|
||||
-------------------------------------------------------------------
|
||||
|
||||
==================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation
|
||||
==================================================
|
||||
|
||||
OpNovice2
|
||||
---------
|
||||
|
||||
Investigate optical properties and parameters. Details of optical
|
||||
photon boundary interactions on a surface are recorded. Details
|
||||
of optical photon generation and transport are recorded.
|
||||
|
||||
|
||||
1- GEOMETRY DEFINITION
|
||||
|
||||
The geometry consists of a cube "box" with a side of 2 m inside
|
||||
the world cube of side 20 m. Optical properties of the box, the world,
|
||||
and the surface may be set interactively via the commands defined
|
||||
in the DetectorMessenger class.
|
||||
|
||||
Material properties may be added using the macro commands:
|
||||
# for the box:
|
||||
/opnovice2/boxProperty NAME EN1 V1 EN2 V2 [ .. ENn Vn]
|
||||
/opnovice2/boxConstProperty NAME VALUE
|
||||
# for the world:
|
||||
/opnovice2/worldProperty NAME EN1 V1 EN2 V2 [ .. ENn Vn]
|
||||
/opnovice2/worldConstProperty NAME VALUE
|
||||
# for the surface:
|
||||
/opnovice2/surfaceProperty NAME EN1 V1 EN2 V2 [ .. ENn Vn]
|
||||
|
||||
Multiple energy and value pairs may be specified for the energy-dependent
|
||||
properties.
|
||||
|
||||
Values are in Geant4 internal units. Energy is in MeV.
|
||||
|
||||
Example:
|
||||
/opnovice2/boxProperty RINDEX 0.000002 1.3 0.000005 1.32 0.000008 1.34
|
||||
sets the refractive index of the box to 1.3 at 2 eV, 1.32 at 5 eV, and
|
||||
1.34 at 8 eV.
|
||||
|
||||
2- PHYSICS LIST
|
||||
|
||||
The FTFP_BERT physics list is used, with electromagnetic option
|
||||
EMZ (option4) and G4OpticalPhysics for the optical physics.
|
||||
|
||||
3- AN EVENT : THE PRIMARY GENERATOR
|
||||
|
||||
The primary kinematic consists of a single particle. The type of
|
||||
the particle, its energy, position, and direction, are set
|
||||
in the PrimaryGeneratorAction class, and can be changed via the G4
|
||||
build-in commands of G4ParticleGun class (see the macros provided with
|
||||
this example).
|
||||
|
||||
4- VISUALIZATION
|
||||
|
||||
The Visualization Manager is set in the main().
|
||||
The initialisation of the drawing is done via the commands
|
||||
/vis/... in the macro vis.mac. To get visualisation:
|
||||
> /control/execute vis.mac
|
||||
or run the program with no command line arguments:
|
||||
$ ./OpNovice2
|
||||
|
||||
5- HOW TO START ?
|
||||
|
||||
- Execute OpNovice2 in 'batch' mode from macro files
|
||||
% OpNovice2 electron.mac
|
||||
|
||||
- Execute OpNovice2 in 'interactive mode' with visualization
|
||||
% OpNovice2
|
||||
....
|
||||
Idle> type your commands
|
||||
....
|
||||
Idle> exit
|
||||
|
||||
6- RESULTS
|
||||
|
||||
A table of optical photon events is printed at the end of the run.
|
||||
|
||||
7- HISTOGRAMS
|
||||
|
||||
OpNovice2 has several predefined 1D histograms :
|
||||
1 : Cerenkov spectrum
|
||||
2 : scintillation spectrum
|
||||
3 : scintillation time (global time)
|
||||
4 : WLS absorption spectrum
|
||||
5 : WLS emission spectrum
|
||||
6 : WLS emission time
|
||||
7 : WLS2 absorption spectrum
|
||||
8 : WLS2 emission spectrum
|
||||
9 : WLS2 emission time
|
||||
10 : boundary process status
|
||||
11 : X momentum dir of scattered photons with px < 0
|
||||
12 : Y momentum dir of scattered photons with px < 0
|
||||
13 : Z momentum dir of scattered photons with px < 0
|
||||
14 : X momentum dir of scattered photons with px >= 0
|
||||
15 : Y momentum dir of scattered photons with px >= 0
|
||||
16 : Z momentum dir of scattered photons with px >= 0
|
||||
17 : X momentum dir of Fresnel-refracted photons
|
||||
18 : Y momentum dir of Fresnel-refracted photons
|
||||
19 : Z momentum dir of Fresnel-refracted photons
|
||||
20 : fraction of photons transmitted at surface
|
||||
21 : fraction of photons reflected at surface
|
||||
|
||||
Histograms 11-19 are recorded for photons scattered from the +X
|
||||
surface of the cube. Only the first interaction is recorded.
|
||||
|
||||
The histograms are managed by G4Analysis classes.
|
||||
The histos can be individually activated with the command:
|
||||
/analysis/h1/set id nbBins valMin valMax
|
||||
The unit is hardcoded to be eV for energy and ns for time.
|
||||
|
||||
One can control the name of the histograms file with the command:
|
||||
/analysis/setFileName name (default opnovice2)
|
||||
|
||||
It is possible to choose the format of the histogram file : root (default),
|
||||
hbook, xml, csv, by using namespace in HistoManager.hh
|
||||
|
||||
It is also possible to print selected histograms on an ascii file:
|
||||
/analysis/h1/setAscii id
|
||||
All selected histos will be written on a file name.ascii (default opnovice2)
|
||||
|
||||
8- MACROS
|
||||
|
||||
Several macros are included.
|
||||
boundary.mac: Set the surface to the various types and configurations of
|
||||
model, type, etc., shoot optical photons, and record statistics
|
||||
electron.mac: Shoot electrons and observe Cerenkov and scintillation radiation
|
||||
fresnel.mac: Shoot optical photons of fixed polarization and random direction
|
||||
at a surface, and plot reflectance/transmittance vs incident
|
||||
angle.
|
||||
OpNovice2.mac: Shoot an optical photon inside a box.
|
||||
scint_by_particle.mac: Configure scintillation to have particle-specific
|
||||
yields and yield ratios. Shoot different types of particles.
|
||||
vis.mac: Configure visualization.
|
||||
wls.mac: Configure two wavelength-shifting processes, and shoot optical
|
||||
photons.
|
||||
@@ -0,0 +1,34 @@
|
||||
|
||||
Optical processes
|
||||
-----------------
|
||||
|
||||
This directory includes examples demonstrating the use of optical processes
|
||||
in the simulation.
|
||||
|
||||
OpNovice
|
||||
--------
|
||||
Simulation of optical photons generation and transport.
|
||||
Defines optical surfaces and exercises optical physics processes
|
||||
(Cerenkov, Scintillation, Absorption, Rayleigh, ...). Uses stacking
|
||||
mechanism to count the secondary particles generated.
|
||||
Via the command line one can select an option to define the detector via a
|
||||
gdml file. An example gdml file is provided that corresponds
|
||||
to the detector configuration defined in OpNoviceDetectorConstruction.cc.
|
||||
|
||||
OpNovice2
|
||||
--------
|
||||
Investigate optical properties and parameters. Details of optical
|
||||
photon boundary interactions on a surface are recorded. Details
|
||||
of optical photon generation and transport are recorded.
|
||||
|
||||
LXe
|
||||
----
|
||||
Multi-purpose detector setup implementing:
|
||||
(1) scintillation inside a bulk scintillator with PMTs
|
||||
(2) large wall of small PMTs opposite a Cerenkov slab to show the cone
|
||||
(3) plastic scintillator with wave-length-shifting fiber readout.
|
||||
|
||||
WLS
|
||||
----
|
||||
This application simulates the propagation of photons inside a Wave Length
|
||||
Shifting (WLS) fiber.
|
||||
@@ -0,0 +1,100 @@
|
||||
|
||||
///\file "optical/wls/.README.txt"
|
||||
///\brief Example wls README page
|
||||
|
||||
/*! \page Examplewls Example wls
|
||||
|
||||
This application simulates the propagation of optical photons inside a
|
||||
Wave Length Shifting (WLS) fiber.
|
||||
|
||||
|
||||
\section Examplewls_s1 Geometry Definition
|
||||
|
||||
The default geometry is as follow:
|
||||
|
||||
- A perfect, bare (or clad), PMMA fiber: 0.5mm radius, 2m length at
|
||||
center (0,0,0) of the World.
|
||||
- A circular MPPC with 0.5mm radius at the +z end of the fiber
|
||||
- World and coupling materials are G4_AIR
|
||||
- Photons will always refracted out to coupling material before
|
||||
reaching MPPC
|
||||
- There are many flexible parameters that the user could specify.
|
||||
They are under the /WLS directory of help.
|
||||
|
||||
|
||||
\section Examplewls_s2 Material Choices
|
||||
|
||||
There are several materials that the user can use for the fiber core,
|
||||
world and coupling.
|
||||
|
||||
They are:
|
||||
|
||||
- Vacuum (G4_Galactic)
|
||||
- Air (G4_AIR)
|
||||
- PMMA, refractive index n = 1.60
|
||||
- Pethylene, n = 1.49
|
||||
- FPethylene, n = 1.42
|
||||
- Polystyrene, n = 1.60
|
||||
- Silicone, n = 1.46
|
||||
|
||||
|
||||
\section Examplewls_s3 Photon Source
|
||||
|
||||
This program uses the General Particle Source (G4GeneralParticleSource)
|
||||
provided by Geant4 for generating particles. The energy of a primary
|
||||
optical photon must be within the range 2.00 eV to 3.47 eV.
|
||||
|
||||
|
||||
\section Examplewls_s4 Hit
|
||||
|
||||
A hit is registered when an optical photon is absorbed on the MPPC
|
||||
surface. Information stored in a hit includes the local coordinate of the
|
||||
location the optical photon is absorbed on the MPPC, the global coordinate
|
||||
where the optical photon left the fiber, the transit time of the optical
|
||||
photon, and the energy of the optical photon.
|
||||
|
||||
|
||||
\section Examplewls_s5 Stepping Action
|
||||
|
||||
The stepping action keeps track of the number of bounces an optical photon has
|
||||
gone through. In order to prevent infinite loop and extremely skewed
|
||||
rays taking up computing time, there is a limit of the number of
|
||||
bounces that an optical photon can go through before it is artificially killed.
|
||||
The default limit is 100,000. The user can set his/her own limit using
|
||||
the /stepping/setBounceLimit command. A value of 0 will turn off the
|
||||
limit. All optical photons artificially killed will have murderee flag turned
|
||||
on in their UserTrackInformation.
|
||||
|
||||
|
||||
\section Examplewls_s6 Visualization
|
||||
|
||||
To visualize particle trajectories, simply use vis.mac macro in
|
||||
interactive mode or in your own macro.
|
||||
|
||||
|
||||
\section Examplewls_s7 main ()
|
||||
|
||||
- Execute wls in 'batch' mode from macro files; \n
|
||||
you can enter an optional integer seed for batch mode
|
||||
\verbatim
|
||||
% wls electron.mac (optional: enter an integer seed here)
|
||||
\endverbatim
|
||||
|
||||
- wls in 'interactive mode' with visualization
|
||||
\verbatim
|
||||
% wls
|
||||
....
|
||||
Idle> /control/execute vis.mac
|
||||
Idle> /run/beamOn 1
|
||||
....
|
||||
Idle> exit
|
||||
\endverbatim
|
||||
|
||||
\section Examplewls_s8 Macros provided
|
||||
|
||||
- electron.mac: Sets up the default geometry and configures the particle source.
|
||||
Primary particle is a 10 MeV electron.
|
||||
- vis.mac: macro for visualization; called automatically when no macro is
|
||||
given on command line.
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,95 @@
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
WLS
|
||||
----------
|
||||
|
||||
This application simulates the propagation of optical photons inside a
|
||||
Wave Length Shifting (WLS) fiber.
|
||||
|
||||
|
||||
1- Geometry Definition
|
||||
|
||||
The default geometry is as follow:
|
||||
|
||||
- A perfect, bare (or clad), PMMA fiber: 0.5mm radius, 2m length at
|
||||
center (0,0,0) of the World.
|
||||
- A circular MPPC with 0.5mm radius at the +z end of the fiber
|
||||
- World and coupling materials are G4_AIR
|
||||
- Photons will always refracted out to coupling material before
|
||||
reaching MPPC
|
||||
- There are many flexible parameters that the user could specify.
|
||||
They are under the /WLS directory of help.
|
||||
|
||||
|
||||
2- Material Choices
|
||||
|
||||
There are several materials that the user can use for the fiber core,
|
||||
world and coupling.
|
||||
|
||||
They are:
|
||||
|
||||
- Vacuum (G4_Galactic)
|
||||
- Air (G4_AIR)
|
||||
- PMMA, refractive index n = 1.60
|
||||
- Pethylene, n = 1.49
|
||||
- FPethylene, n = 1.42
|
||||
- Polystyrene, n = 1.60
|
||||
- Silicone, n = 1.46
|
||||
|
||||
|
||||
3- Photon Source
|
||||
|
||||
This program uses the General Particle Source (G4GeneralParticleSource)
|
||||
provided by Geant4 for generating particles. The energy of a primary
|
||||
optical photon must be within the range 2.00 eV to 3.47 eV.
|
||||
|
||||
|
||||
4- Hit
|
||||
|
||||
A hit is registered when an optical photon is absorbed on the MPPC
|
||||
surface. Information stored in a hit includes the local coordinate of the
|
||||
location the optical photon is absorbed on the MPPC, the global coordinate
|
||||
where the optical photon left the fiber, the transit time of the optical
|
||||
photon, and the energy of the optical photon.
|
||||
|
||||
|
||||
5- Stepping Action
|
||||
|
||||
The stepping action keeps track of the number of bounces an optical photon has
|
||||
gone through. In order to prevent infinite loop and extremely skewed
|
||||
rays taking up computing time, there is a limit of the number of
|
||||
bounces that an optical photon can go through before it is artificially killed.
|
||||
The default limit is 100,000. The user can set his/her own limit using
|
||||
the /stepping/setBounceLimit command. A value of 0 will turn off the
|
||||
limit. All optical photons artificially killed will have murderee flag turned
|
||||
on in their UserTrackInformation.
|
||||
|
||||
|
||||
6- Visualization
|
||||
|
||||
To visualize particle trajectories, simply use vis.mac macro in
|
||||
interactive mode or in your own macro.
|
||||
|
||||
|
||||
7- main()
|
||||
|
||||
- execute wls in 'batch' mode from macro files
|
||||
- you can enter an optional integer seed for batch mode
|
||||
% wls electron.mac (optional: enter an integer seed here)
|
||||
|
||||
- wls in 'interactive mode' with visualization
|
||||
% wls
|
||||
....
|
||||
Idle> /control/execute
|
||||
Idle> /run/beamOn 1
|
||||
....
|
||||
Idle> exit
|
||||
|
||||
8- Macros provided
|
||||
|
||||
- electron.mac: Sets up the geometry and configures the particle source.
|
||||
Primary particle is a 10 MeV electron.
|
||||
- vis.mac: macro for visualization; called automatically when no macro is
|
||||
given on command line.
|
||||
Reference in New Issue
Block a user