Code for download: session10_start.tar.gz
Start code: session9_start with updated geometry with addition of a shield made of concrete.
Introduction:
The exercise shows one usage of the biasing classes.
We have a shield, made of concrete, which is inserted between the calorimeter and the screen of session 9. This shield is divided in 10 slices, using a replica.
We want to estimate the efficiency of the shield to neutrons, and characterize the neutrons which succeed in exiting the shield. As this one is doing its job, only a few neutrons can traverse this shield. The goal of the exercise is to bias the simulation in the shield to get more neutrons traversing.
First stage:
The following items have been introduced:
- two biasing classes:
EDBiasingOperator
,
EDBiasingOperationSplitAndKill
- in the detector construction, the
ConstructSDandField()
method has been modified to attach the biasing operator to the logical volume of the shield slices - in the
main
program, a command line option « -b » has been added to activate or not the biasing, this option controls the use or not of theG4GenericBiasingPhysics
physi constructor.
Compile and run the code in a non-biased way (so-called analog way):
./exampleED -b off
- Look at how the neutron processes appear when printing these processes with a command line.
- Shoot a few protons, to verify that the shield is indeed preventing most of particles to traverse.
Run the code in biased mode:
./exampleED -b on
- Look at how the neutron processes appear now when printing these processes with a command line..
First Exercise :
The EDBiasingOperator
must send the EDBiasingOperationSplitAndKill
biasing operation to be applied. In the code here, it does not. Make it returning the biasing operation using the proper method.
Run the code in biasing mode to verify that now particles go through the shield.
You will notice that the track weight has been added to the ntuple. Plot some quantities (eg: Ekin
) not using and using the weight: this second plot is the correct one.
root [] Screen->Draw("Ekin");
root [] Screen->Draw("Ekin","weight");
Second Exercise :
We will reduce the flux backward, for this apply a « Russian Roulette » technique. Look at the corresponding section of the code on the EDBiasingOperationSplitAndKill
class, which provides further hints to implement the killing.
Solution: session10_solution.tar.gz
#include « G4SDManager.hh »
In EDDetectorConstruction.cc, fix:
//
// Sensitive detectors
//
EDChamberSD* chamber1SD
= new EDChamberSD(« Chamber1SD », « Chamber1HitsCollection », 0);
G4SDManager::GetSDMpointer()->AddNewDetector(chamber1SD);
SetSensitiveDetector(« WirePlane1 », chamber1SD);
EDChamberSD* chamber2SD
= new EDChamberSD(« Chamber2SD », « Chamber2HitsCollection », 1);
G4SDManager::GetSDMpointer()->AddNewDetector(chamber2SD);
SetSensitiveDetector(« WirePlane2 », chamber2SD);
EDEmCalorimeterSD* calorimeterSD
= new EDEmCalorimeterSD(« EmCalorimeterSD », « EmCalorimeterHitsCollection »);
G4SDManager::GetSDMpointer()->AddNewDetector(calorimeterSD);
SetSensitiveDetector(« EmCell », calorimeterSD);
EDScreenSD* screenSD = new EDScreenSD(« ScreenSD », 2);
G4SDManager::GetSDMpointer()->AddNewDetector(screenSD);
SetSensitiveDetector(« Screen », screenSD);