|
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 HandsOn3 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.
$ cd HandsOn5
$ make
$ ./bin/$G4SYSTEM/beamTest
run.mac
This will produce files named G4Data0.heprep and G4Data1.heprep, which can be viewed by invoking the HepRApp visualisation tool.
$ java –jar HepRApp.jar
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 # HandsOn5: 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 of the hadronic physics lists supplied with
the distribution to include hadronic physics. These lists are built by default
starting from release 8.2. 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 register it with the run
manager in place of BeamTestPhysicsList, as shown below.
|
beamTest.cc |
|
----- snipped ----- #include
"G4UIterminal.hh" // HandsOn5: Hadronic
physics list #include
"QGSP_BERT.hh" #include
"Randomize.hh" ----- snipped -----
runManager->SetUserInitialization(detector); //
runManager->SetUserInitialization(new BeamTestPhysicsList); // HandsOn5: Hadronic physics list
runManager->SetUserInitialization(new QGSP_BERT); |
After implementing the above modifications 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
implement 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" // HandsOn5:
Bremsstrahlung splitting #include
"BeamTestPhysicsListLowEnergy.hh" #include "BeamTestPrimaryGeneratorAction.hh" ----- snipped ----- // HandsOn5: Hadronic physics list //
runManager->SetUserInitialization(new QGSP_BERT); // HandsOn5: 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.

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); // HandsOn5:
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 visualise 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 ----- # HandsOn5: One picture
per event /vis/scene/endOfEventAction refresh ----- snipped ----- # Trajectory
colouring scheme # HandsOn5:
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 ----- # HandsOn5: 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 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|