Instructions

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 6

Installation_and_Usage

GODDeSS-Package-Wiki: Installation and Usage


Get the GODDeSS package:
Version 4.3
two small bug fixes (not affecting the simulation itself)
Version 4.2
implemented roughness between fibre core and claddings or cladding and mother
volume, respectively
implemented possibility to specify a WLS attenuation length AND a non-WLS
attenuation length for WLS materials
changed the specification of energy/wave length dependent properties from wave
length to energy (because Geant only knows energy dependence)
implemented possibility to specify the Birk’s Constant for scintillating materials
implemented possibility to specify matching coefficients to adjust the fibres’
signal attenuation length to the manufacturer’s data
hit files are now created separately for each photon detector
added message that is inserted into the output files after all events have been
processed (this makes it easier to check if the simulation run worked correctly)
implemented possibility of automatic creation of (absorbing) coatings for fibres
Version 4.1
fixed the values of the fibre radii in the property files
added option to generate glue volumes around the fibres
Version 4.0
changed to Geant4.10.00.p02
Version 3.0
improvement of the handling of reference volumes that are located in a different
mother volume
better distinction between the physics lists and the object’s constructors
fibres are now automatically distributed to the mother volume, the grandmother
volume, and empty aunt volumes
(therefore, due to visualisation problems (!), the way of fibre building had to be
changed ->the claddings are now hollow cylinders)
(When using bent quadratic fibres, there is a visualisation problem, which is well
known in the Geant4 community (cf. e.g. here and here) and which does only affect
the visualisation but NOT the simulation itself.
The following pictures illustrate the visualisation problem: The fibre seems to
have holes in the visualisation, but the photons behave correctly in the
simulation/tracking.)

Version 2.1
bug-fixed version of Version 2.0
Version 2.0
create replications of objects
more flexibility for Sensitive Detectors
independent data storage class for the GODDeSS objects
easier construction of wrapping
Update 2013-02-13: Due to some bugs/errors, this version is not working! Use
Version 2.1 instead
Version 1.1
Version 1.0 + documentation
Version 1.0
How to install the example simulation:
install Geant4, GODDeSS is based on it (Geant4.9.6.p02 for GODDeSS versions before
4.0 or Geant4.10.00.p02 since GODDeSS version 4.0, Geant4.10.2.p02 is also tested
and approved for GODDeSS version 4.0)
if your working environment does not have it, install boost (http://www.boost.org/,
recommended version 1.59, higher versions will fail) and zlib
(http://www.zlib.net/), GODDeSS uses them
download the package and untar it in your desired directory
create a “build” directory:
_>mkdir -p path/to/BUILD/directory_
change to this directory:
_>cd path/to/BUILD/directory_
set the environment variables of your Geant4 version:
_>source path/to/Geant4/directory/bin/geant4.sh_
set the environment variable “GODDESS” (the path to the directory in which you
untared the package):
_>export GODDESS=“/absolute/path/to/GODDESS/directory”_
use “cmake” to compile the source code:
_>cmake path/to/SOURCE/directory_
_>make -j install_
How to run the example simulation with default settings:
change to the “source” directory:
_>cd path/to/SOURCE/directory_
set the environment variables “SIMDIR” (the path to the “Simulation” directory of
the example simulation) and “BUILDDIR” (the path to the “build” directory of the
example simulation):
_>export SIMDIR=“/absolute/path/to/SIMULATION/directory”_
_>export BUILDDIR=“/absolute/path/to/BUILD/directory”_
start the simulation using the “RunSimulation” script:
_>./RunSimulation.sh_
to shoot a minimum ionising muon into the scintillator tiles, do:
_>/run/beamOn_
How to run the example simulation with individual settings:
change to the “source” directory:
_>cd path/to/SOURCE/directory_
set the environment variables “SIMDIR” (the path to the “Simulation” directory of
the example simulation) and “BUILDDIR” (the path to the “build” directory of the
example simulation):
_>export SIMDIR=/absolute/path/to/SIMULATION/directory_
_>export BUILDDIR=/absolute/path/to/BUILD/directory_
edit the “RunSimulation” script between “#—- program options to be specified: —-#”
and “#—- process the program options —-#” and save the changes
(the setup and primary particles can easily be changed by editing the files
$SIMDIR/src/Preparation/DetectorConstruction.cc and
$SIMDIR/macros/GeneralParticleSource.mac, respectively :-))
start the simulation using the “RunSimulation” script:
_>./RunSimulation.sh_
to shoot a minimum ionising muon into the scintillator tiles, do:
_>/run/beamOn_
How to implement the GODDeSS object classes in to your own simulation:
install GODDeSS like described above (including the environment variables)
link GODDeSS to your simulation:
- in your CMakeLists.txt (which is creating the simulation executable) add:
#——— Boost ———#
# Find Boost package
find_package(Boost REQUIRED regex)

# Add include directories to the list of directories searched by the compiler for
include files:
include_directories(${Boost_INCLUDE_DIRS})

# Set Boost library list


set(LIBS_BOOST boost_regex)

#——— zlib ———#


# Find zlib package
find_package(ZLIB REQUIRED)
# Add include directories to the list of directories searched by the compiler for
include files:
include_directories(${ZLIB_INCLUDE_DIRS})

# Set zlib library list


set(LIBS_ZLIB ${ZLIB_LIBRARIES})

#——— GODDeSS ———#


# Locate GODDeSS
set(GODDESS_LIB_DIR $ENV{GODDESS}/build/G4BasicObjects/*/)
find_library(G4PropertyFileReadInTools NAMES G4PropertyFileReadInTools HINTS “$
{GODDESS_LIB_DIR}”)
find_library(G4Scintillator NAMES G4Scintillator HINTS “${GODDESS_LIB_DIR}”)
find_library(G4Fibre NAMES G4Fibre HINTS “${GODDESS_LIB_DIR}”)
find_library(G4GeneralParticleSource NAMES G4GeneralParticleSource HINTS “$
{GODDESS_LIB_DIR}”)
find_library(G4PhotonDetector NAMES G4PhotonDetector HINTS “${GODDESS_LIB_DIR}”)
find_library(DataProcessing NAMES DataProcessing HINTS “${GODDESS_LIB_DIR}”)
set(LIBS_GODDESS ${G4PropertyFileReadInTools} ${G4Scintillator} ${G4Fibre} $
{G4GeneralParticleSource} ${G4PhotonDetector} ${DataProcessing})

# Add include directories to the list of directories searched by the compiler for
include files:
set(GODDESS_INCLUDE_DIR $ENV{GODDESS}/source/G4BasicObjects/)
include_directories(${GODDESS_INCLUDE_DIR}/G4PropertyFileReadInTools/include)
include_directories(${GODDESS_INCLUDE_DIR}/G4Scintillator/include)
include_directories(${GODDESS_INCLUDE_DIR}/G4Fibre/include)
include_directories(${GODDESS_INCLUDE_DIR}/G4GeneralParticleSource/include)
include_directories(${GODDESS_INCLUDE_DIR}/G4PhotonDetector/include)
include_directories(${GODDESS_INCLUDE_DIR}/DataProcessing/include)

- and link the libraries and dependencies:


target_link_libraries(${PROJECT_NAME} ${LIBS_BOOST} ${LIBS_ZLIB} ${LIBS_GODDESS})
add_dependencies(${PROJECT_NAME} ${LIBS_GODDESS})

implement GODDeSS in your simulation’s main file (which sets up the Geant4
framework):
- in beginning, add:
#include <GODDeSS_Messenger.hh>
#include <ScintillatorTileConstructor.hh>
#include <FibreConstructor.hh>
#include <PhotonDetectorConstructor.hh>
- in your main() function, add the following lines (you can adjust the numerical
values):
// GODDeSS: energy range for the property distributions
vector energyRangeVector;
G4double energyRangeVectorSize = 10;
G4double energiesMin = 0.5*eV;
G4double energiesMax = 25*eV;
for(int i = 0; i < energyRangeVectorSize; i)
energyRangeVector.push_back( energiesMin + i * (energiesMax - energiesMin) /
(energyRangeVectorSize - 1) );

// GODDeSS Messenger:
GODDeSS_Messenger * goddessMessenger = new GODDeSS_Messenger(energyRangeVector);

- pass the goddessMessenger to all parts of your simulation, where it is needed,


e.g. like:
DetectorConstruction * detectorConstruction = new
DetectorConstruction(goddessMessenger);

- and after your physics list (G4VModularPhysicsList physicsList) has been created
(but before it is initialised by SetUserInitialization(physicsList)), add:*
// GODDeSS Constructors:
G4bool SearchOverlaps = false; // set to true to check your geometry
ScintillatorTileConstructor * scintillatorTileConstructor = new
ScintillatorTileConstructor(physicsList, goddessMessengerGetPropertyToolsManager(),
goddessMessenger>GetDataStorage(), SearchOverlaps);
goddessMessenger->SetScintillatorTileConstructor(scintillatorTileConstructor);

FibreConstructor * fibreConstructor = new FibreConstructor(physicsList,


goddessMessengerGetPropertyToolsManager(), goddessMessenger>GetDataStorage(),
SearchOverlaps);
goddessMessenger->SetFibreConstructor(fibreConstructor);

G4String hitFile = path/to/file/which/the/hitting/photons/should/be/saved/in;


goddessMessengerGetDataStorage()>SetPhotonDetectorHitFile(hitFile);
PhotonDetectorConstructor * photonDetectorConstructor = new
PhotonDetectorConstructor(physicsList, goddessMessengerGetPropertyToolsManager(),
goddessMessenger>GetDataStorage(), SearchOverlaps);
goddessMessenger->SetPhotonDetectorConstructor(photonDetectorConstructor);

- and at the end, add:


// GODDeSS
delete goddessMessenger;
delete scintillatorTileConstructor;
delete fibreConstructor;
delete photonDetectorConstructor;

implement GODDeSS in your run action:


- in the BeginOfRunAction(const G4Run aRun) function, add:*
goddessMessengerGetPhotonDetectorConstructor()>WriteRunIDToHitFile(aRun-
>GetRunID());

implement GODDeSS in your event action:


- in the BeginOfEventAction(const G4Event theEvent) function, add:*
GoddessDataStorageGetPhotonDetectorConstructor()>WriteEventIDToHitFile(theEvent-
>GetEventID());
GoddessDataStorage->clean();
- in the EndOfEventAction(const G4Event theEvent) function, handle the recorded
data, e.g.:*
G4double scintillatorHitTime = GoddessDataStorage->GetScintillatorHitTime(iter);

implement GODDeSS in your stepping action:


- in the UserSteppingAction(const G4Step theStep) function, add:*
goddessMessengerGetDataStorage()>SavePreviousStepOpticalPhotonData(theStep);

implement GODDeSS in your detector construction:


- in beginning, add:
#include <ScintillatorTileConstructor.hh>
#include <FibreConstructor.hh>
#include <PhotonDetectorConstructor.hh>
- introduce a new private variable:
GODDeSS_Messenger * goddessMessenger;

- define your constructor to be dependent on the GODDeSS messenger and initialize


it:
DetectorConstruction(GODDeSS_Messenger* gMessenger);
goddessMessenger = gMessenger;

- in your function which defines the setup, add:


ScintillatorTileConstructor * STConstructor = goddessMessenger-
>GetScintillatorTileConstructor();
FibreConstructor * FConstructor = goddessMessenger->GetFibreConstructor();
PhotonDetectorConstructor * PDConstructor = goddessMessenger-
>GetPhotonDetectorConstructor();

- and create objects, e.g. like:


//————— scintillator tile —————//
G4ThreeVector ScintiDimensions = G4ThreeVector(100. * mm, 10. * mm, 100. * mm);

STConstructor->SetScintillatorTransformation(G4Transform3D(G4RotationMatrix(),
G4ThreeVector(0., 50. * mm, 0.));
STConstructor->SetScintillatorName(“scintillator”);
STConstructor->ConstructASensitiveDetector();
G4ScintillatorTile * scintillator = STConstructor-
>ConstructScintillator(ScintiDimensions, path/to/scintillator/property/file,
pointer-to-physical-world-volume);

///————— fibre —————///


G4ThreeVector FibreEndPoint = G4ThreeVector(0. * mm, 0. * mm, ScintiDimensions
[2] / 2. + 5. * mm);
G4ThreeVector FibreStartPoint = G4ThreeVector(0. * mm, 0. * mm, -ScintiDimensions
[2] / 2.);

FConstructor->SetFibreStartPointReflective(0.98);
G4Fibre * fibre = FConstructorConstructFibre(path/to/fibre/property/file,
scintillator>GetScintillator_physicalVolume(), FibreStartPoint, FibreEndPoint);

///————— SiPM —————///


PDConstructor->SetPhotonDetectorName(“SiPM”);
PDConstructorSetPhotonDetectorReferenceVolume(fibre>GetOutermostVolumeOutsideMother
_physicalVolume());
PDConstructorSetSensitiveSurfaceNormalRelativeToReferenceVolume(G4ThreeVector(0.,
0., 1.));
PDConstructorSetSensitiveSurfacePositionRelativeToReferenceVolume(G4ThreeVector(0.
* mm, 0. * mm, fibre>GetFibreLength() / 2.));
PDConstructor->ConstructPhotonDetector(edgeLength, pointer-to-physical-world-
volume);

//————— external reflector / wrapping —————//


STConstructor->SetWrappingName(“wrapping”);
STConstructor->ConstructWrapping(scintillator, path/to/wrapping/property/file);

- you can also use the property tools from GODDeSS to define the properties of your
own volumes, e.g. like:
#include <PropertyToolsManager.hh>
#include <Properties.hh>

// create energy dependent distribution from a constant value:


G4MaterialPropertyVector * refractiveIndex_Vacuum =
goddessMessengerGetPropertyToolsManager()>GetPropertyDistribution(1.);

// get properties from a file:


Properties XYProperties.load(path/to/XY/property/file);
G4double density_XY = XYProperties.getNumber(“density”);

Properties::tabular chemicalComponents_XY =
XYProperties.getTabular(“chemical_components”);

G4Material Material_XY = new G4Material(“Mat_XY”, density_XY, (int)


chemicalComponents_XY[“element”].size());
PropertyTools->AddElementsFromTable(Material_XY, chemicalComponents_XY);

G4MaterialPropertyVector * attenuationLength_XY = PropertyTools-


>GetPropertyDistribution(XYProperties, “mu_att”);

You might also like