|
Important: Every time you open a new shell you need to set your
environment up correctly. |
By the end of this Hands-on you should be able to:
l Use
the QGSP_BERT physics list
l Run
a simple job employing uniform bremsstrahlung splitting
This exercise builds on the HandsOn4 exercise.
The following files are provided with the exercise:
l beamTest.cc - main program
l BeamTestDetectorConstruction – material, geometry, sensitive detector, scoring sphere and scorer definitions
l BeamTestPhysicsList - user defined standard physics list
l BeamTestPhysicsListLowEnergy - user defined low energy physics list
l BeamTestLowEnergyMessenger – messenger for BeamTestPhysicsListLowEnergy
l BeamTestPrimaryGeneratorAction - primary particle generator
l BeamTestRun - user defined run class
l BeamTestRunAction - G4UserRunAction class
l BeamTestScoreParameterisation – scoring volume parameterisation
l BremSplittingProcess – G4WrapperProcess implementing bremsstrahlung splitting
All the geometries are implemented by default.
HandsOn6/source/processes/management/include/G4WrapperProcess.hh
If youÕve chosen to copy all Geant4 headers into one
directory, copy the above G4WrapperProcess.hh file to that directory.
Otherwise, replace the version in source/processes/management/include/, for
example,
cp
HandsOn6/source/processes/management/include/G4WrapperProcess.hh
$G4INSTALL/source/processes/management/include/G4WrapperProcess.hh
You do not need to recompile any of
the Geant4 source code.
This new version of
G4WrapperProcess.hh should be provided by default in releases newer than
v8.0.p1.
$ cd HandsOn6
$ make
$ ./bin/$G4SYSTEM/beamTest
run.mac
This will produce files named G4Data0.heprep and G4Data1.heprep, which can be viewed by invoking the Wired visualisation tool.
$ wired G4Data1.heprep
You should be able to view the following:

You can see that all the detector components along with the scoring volume have been implemented.
The exercise uses the user defined physics list, BeamTestPhysicsList,
by default. BeamTestPhysicsList inherits from G4VUserPhysicsList and is one of
the mandatory user classes. BeamTestPhysicsList defines only electromagnetic
and decay processes, which has been sufficient for our needs so far. If we
would like hadronic interactions however, we would need to add in hadronic physics.
To demonstrate this, use the interactive commands to change
the primary particle to a 500 MeV proton and modify the trajectory colouring
scheme in run.mac, as shown below.
|
run.mac |
|
----- snipped ----- # Trajectory colouring
scheme # HandsOn6: Change
primary particle to 500 MeV proton # and use new trajectory
colouring scheme # -actually equivalent to
default colouring scheme /vis/modeling/trajectories/select
drawByCharge-1 /gun/particle
proton /gun/energy 500
MeV |
Run the program
and view the G4Data1.heprep file. You should be able to view something like the
picture shown below. Since there are no hadronic processes registered, the
proton looses energy only by ionisation.

We can use one the hadronic physics lists supplied with the
distribution to include hadronic physics. These lists arenÕt built by default.
To build them, make sure G4LISTS_BASE is not set and do the following.
$ cd
$G4INSTALL/physics_lists/hadronic
$ make
In this example weÕre going to use the QGSP_BERT physics
list. Along with hadronic processes, QGSP_BERT defines electromagnetic, decay
and ion processes. Therefore, we can just use it in place of BeamTestPhysicsList.
First we need to link in QGSP_BERT. To do this, modify GNUmakefile as shown below.
|
GNUmakefile |
|
.PHONY: all all: lib bin # HandsOn6: Hadronic
physics list ifndef
G4LISTS_BASE EXTRALIBS +=
-L$(G4LIB)/plists/$(G4SYSTEM) G4LISTS_BASE =
$(G4INSTALL)/physics_lists else EXTRALIBS +=
-L$(G4LISTS_BASE)/hadronic/plists/lib/$(G4SYSTEM) endif EXTRALIBS +=
-lQGSP_BERT EXTRALIBS +=
-lPackaging CPPFLAGS +=
-I$(G4LISTS_BASE)/hadronic/Packaging/include CPPFLAGS +=
-I$(G4LISTS_BASE)/hadronic/QGSP_BERT/include include
$(G4INSTALL)/config/binmake.gmk |
We also need to
register QGSP_BERT with the run manager in place of BeamTestPhysicsList, as shown below.
|
beamTest.cc |
|
----- snipped ----- #include
"G4UIterminal.hh" // HandsOn6: Hadronic
physics list #include
"QGSP_BERT.hh" #include
"Randomize.hh" ----- snipped ----- runManager->SetUserInitialization(detector); //
runManager->SetUserInitialization(new BeamTestPhysicsList); // HandsOn6: Hadronic physics list
runManager->SetUserInitialization(new QGSP_BERT); |
After implementing the above modifications to GNUmakefile
and beamTest.cc, compile, link and run the program. You should see something
like the picture below.

Physics list
We will
use the BeamTestPhysicsListLowEnergy physics list provided with the example to
control bremsstrahlung splitting. This physics list contains a messenger,
BeamTestLowEnergyMessenger, which allows us to interactively configure
bremsstrahlung splitting. First off, register BeamTestPhysicsListLowEnergy with
the run manager as shown below.
|
beamTest.cc |
|
----- snipped ----- #include
"BeamTestPhysicsList.hh" // HandsOn6:
Bremsstrahlung splitting #include
"BeamTestPhysicsListLowEnergy.hh" #include
"BeamTestPrimaryGeneratorAction.hh" ----- snipped ----- // HandsOn6: Hadronic physics list // runManager->SetUserInitialization(new
QGSP_BERT); // HandsOn6: Bremsstrahlung splitting
runManager->SetUserInitialization(new
BeamTestPhysicsListLowEnergy); |
After implementing the above, compile and link the program. Check that
you are able to see the bremsstrahlung splitting commands using the interactive
help. To do this, run the beamTest executable and type ÒhelpÓ at the prompt:
$ ./bin/$G4SYSTEM/beamTest
Idle> help
You should see the printout shown below.
|
Interactive printout |
|
----- snipped ----- Idle> help Command directory path :
/ Sub-directories : 1) /control/ UI control commands. 2) /units/ Available units. 3) /geometry/ Geometry control commands. 4) /tracking/ TrackingManager and
SteppingManager control commands. 5) /event/ EventManager
control commands. 6) /run/ Run control commands. 7) /random/ Random number status control commands. 8) /particle/ Particle control commands. 9) /process/ Process Table control commands. 10) /BremSplitting/ ...Title not available... 11) /vis/ Visualization commands. 12) /gun/ Particle Gun control commands. 13) /hits/ Sensitive detectors and Hits Commands : Type the number ( 0:end,
-n:n level back ) : 10 Command directory path :
/BremSplitting/ Guidance : Sub-directories : Commands : 1) nSplit * Splitting parameter - how
many photons produced 2) active * Activate or deactivate
brem splitting Type the number ( 0:end,
-n:n level back ) : |
Installing Bremsstrahlung Splitting Process
Next we need to modify BeamTestPhysicsListLowEnergy so that the
BremSplittingProcess is registered with the process manager in place of the
G4LowEnergyBremsstrahlung process. The implementation is shown below.
|
BeamTestPhysicsListLowEnergy.cc |
|
----- snipped ----- } else if (particleName
== "e-") { // Electron
pmanager->AddProcess(new G4MultipleScattering, -1, 1, 1);
pmanager->AddProcess(new G4LowEnergyIonisation, -1, 2, 2); // HandsOn6:
Bremsstrahlung splitting //
pmanager->AddProcess(new G4LowEnergyBremsstrahlung,-1,-1, 3);
G4LowEnergyBremsstrahlung* bremProcess = new
G4LowEnergyBremsstrahlung(); bremSplitting
= new BremSplittingProcess();
bremSplitting->RegisterProcess(bremProcess);
pmanager->AddProcess(bremSplitting,-1,-1, 3); } else if (particleName
== "e+") { |
Implement the above and compile and link the program. WeÕre going to do
a couple of test runs to visualize the experiment with and without
bremsstrahlung splitting applied. Make the following modifications to run.mac
to dump one .heprep file per event with an electron as the primary particle,
and trajectories drawn using the original colouring scheme.
|
run.mac |
|
----- snipped ----- # HandsOn6: One picture
per event /vis/scene/endOfEventAction
refresh ----- snipped ----- # Trajectory
colouring scheme # HandsOn6:
Change primary particle to 500 MeV proton # and use new
trajectory colouring scheme # -actually
equivalent to default colouring scheme /vis/modeling/trajectories/select
drawByCharge-0 #/gun/particle
proton #/gun/energy
500 MeV |
Before running the job, set the following environment variable so that
the heprep file is named nosplittingX.heprep, where X is the event number.
$ setenv G4HEPREPFILE_NAME nosplitting
Run the job and check that you actually get files named
nosplittingX.heprep. Next, make the following changes to run.mac to enable
bremsstrahlung splitting, with the splitting parameter set to 100.
|
run.mac |
|
----- snipped ----- # HandsOn6: Enable
bremsstrahlung splitting /BremSplitting/active
true /BremSplitting/nSplit
100 |
Set the G4HEPREPFILE_NAME environment variable so that the resulting heprep
file is called splittingX.heprep.
$ setenv G4HEPREPFILE_NAME splitting
Run the job and compare the equivalent nosplittingX.heprep and
splittingX.heprep files. You should be able to see many more trajectories in
the bremsstrahlung splitting picture, as shown below.

As another simple example weÕre going to run two jobs and compare the
output. We wonÕt include visualisation since weÕre going to run over a large
number of events. Dedicated macros to control the splitting configuration are
provided with the example.
Job A
This job will generate 1000 events with bremsstrahlung splitting turned
off. We will be using the run_nosplitting_1000.mac macro supplied with the
example:
|
run_nosplitting_1000.mac |
|
# ---------------- # Verbose settings # ---------------- /control/verbose 2 /run/verbose 2 /BremSplitting/active
false /run/beamOn 1000 |
Run the job:
$
./bin/$G4SYSTEM/beamTest run_nosplitting_1000.mac
Check that you get an output file named
output_nosplitting_1000.dat
Job B
This job will generate 1000 events with bremsstrahlung splitting turned
on. The splitting parameter is set to 100 through the /BremSplitting/nSplit
command. We will be using the run_splitting_1000_100.mac macro supplied with
the example:
|
run_splitting_1000_100.mac |
|
# ---------------- # Verbose settings # ---------------- /control/verbose 2 /run/verbose 2 /BremSplitting/active
true /BremSplitting/nSplit 100 /run/beamOn 1000 |
Run the job:
$
./bin/$G4SYSTEM/beamTest run_splitting_1000_100.mac
It may take a minute or so for the job to finish. Check that you get an
output file called output_splitting_1000_100.dat
The data files produced from the two jobs should look something like
those shown below.
|
output_nosplitting_1000.dat |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|