Hands-on 5 Alternative Physics Lists, Bremsstrahlung Splitting

 

l    Introduction

l    Installation

l    Hadronic Physics Lists

l    Bremsstrahlung Splitting

 

Important:

 

Every time you open a new shell you need to set your environment up correctly.

 


Introduction

 

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.

 


 

Installation                               

 

  1. If using windows, make sure G4UI_USE_TCSH is not set

 

  1. For bremsstrahlung splitting weÕre going to be using the low energy electromagnetic processes which use the G4EMLOW4.2 data files. If youÕve not done so already, download G4EMLOW.4.2.tar.gz from http://geant4.web.cern.ch/geant4/support/source/G4EMLOW.4.2.tar.gz, and unpack it into your $G4INSTALL/data directory.

 

  1. Unpack HandsOn5.tgz to your working directory.

 

  1. Compile and link using following commands:

 

     $ cd HandsOn5

     $ make

 

  1. Once you have successfully compiled and linked the code, try it to see how it runs:

 

     $ ./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.

 


 

Hadronic Physics Lists

 

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.

 

 

 


 

Bremsstrahlung Splitting

 

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.

 

 

 

Example

 

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

Theta

Scorer0

Scorer1

Scorer2

Scorer3

Scorer4

Scorer5

Scorer6

Scorer7

Scorer8

Scorer9

0

0.00113

0.00032

0.000261

8.72E-05

0

0.000116

0

0

2.91E-05

2.91E-05

1

0.000535

0.000126

9.72E-05

7.78E-05

3.89E-05

0

9.72E-06

0

9.72E-06

0

2

0.000329

4.11E-05

2.94E-05

5.87E-06

1.17E-05

5.87E-06

1.17E-05

0

0

0

3

0.000216

4.67E-05

1.27E-05

8.49E-06

0

0

0

0

0

0

4

0.000171

2.34E-05

6.70E-06

1.00E-05

3.35E-06

0

0

0

0

0

5

0.000134

1.12E-05

2.79E-06

0

2.79E-06

0

0

0

0

0

6

0.000106

1.21E-05

0

0

0

0

0

0

0

0

7

6.02E-05

4.30E-06

2.15E-06

2.15E-06

0

0

0

0

0

0

8

7.24E-05

3.91E-06

0

0

0

0

0

0

0

0

9

5.98E-05

3.63E-06

0

0

0

0

0

0