# Session 8 : Enoncé

** These exercices are of course just a little sample of physics problems. **

Energy deposit depending on particle species:

• Add a calorimeter collection to collect deposit from neutral particles only.
• Add an Edep histogram for these neutral particles. In the run action, you will have to add the creation of these histograms as, for example:
```  for ( G4int i=0; i<10; ++i) {
std::ostringstream os;
os << i;
G4String hname = "NeutralLayer";
hname += os.str();
G4String htitle = "Neutral Edep in layer ";
htitle += os.str();
htitle += " in EmCalorimeter";
analysisManager->CreateH1(hname, htitle, 100, 0., 10*MeV;
}```

You will see that energy deposit from neutral particle is quite marginal. Explain why neutral particles deposit so few compared to charged ones.

Stability of energy deposit with cuts:

• A `runProton.mac` file has been created to allowyou to run 1000 protons in batch mode:`./exampleED -m runProton.mac`This runProton.mac is simple:
```  # Set particle production thresholds (cuts)
#
/run/setCut 1 mm
/run/setCutForRegion EmCalorimeterRegion 1 mm
#
# Run processing
#
/gun/particle proton
/run/beamOn 1000```
• Run 1000 protons with `1 mm` cut, save your `ED.root` as, eg, `ED-1mm.root`
• Run 1000 protons with `1 km` cut, save your `ED.root` as, eg, `ED-1km.root`
• Compare the energy deposit distribution in calorimeter.
• Explain the observed result.

Production of secondaries with cuts:

• We will add a new volume, a thin screen, for counting particles that exit from the calorimeter.This screen will be made sensitive, but we will not create hits and hits collections, but just store in the ntuple the quantities we are interested in.This screen will be placed far from the calorimeter. For this reason, the world volume has been made larger than in the previous exercises, as can be seen in the detector construction:
```// Make world larger for this example:
hx += 5*m;
hy += 5*m;
hz += 5*m;```
• Make a thin screen, and place it 2.5 meters from « Chamber2 » using the following code sample:
```// Make a thin screen for counting:
hx = 5.0*m;
hy = 3.0*m;
hz = 1.*mm;
G4VSolid* screenS = new G4Box("screenS", hx, hy, hz);
G4LogicalVolume* screenLV
= new G4LogicalVolume(screenS, galactic, "Screen");

// Rotation
G4RotationMatrix* screenRotation = new G4RotationMatrix();
*screenRotation = *secondArmRotation;

// Position
zpos = 5.*m + 3.*m + 2.5*m + 1.*mm;
G4ThreeVector screenPosition(0, 0, zpos);
screenPosition.rotateY(-armAngle);
new G4PVPlacement(screenRotation,
screenPosition,
screenLV,        //its logical volume
"Screen",        //its name
worldLV,         //its mother  volume
false,           //no boolean operation
0,               //copy number
checkOverlaps);  //overlaps checking```
• To this screen logical volume, attach a sensitive detector that you will have to create (Note, that when adding a new class, you have to re-run cmake in the build area to get this new class included in compilation):
``` include/EDScreenSD.hh
src/EDScreenSD.cc```

and in the `ProcessHits()` of this sensitive detector, you will fill a Root ntuple:

```  // Store hit in the ntuple
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->FillNtupleIColumn(0, ID);
analysisManager->FillNtupleIColumn(1, pdgCode);
analysisManager->FillNtupleDColumn(2, Ekin/MeV);
analysisManager->FillNtupleDColumn(3, localPosition.x()/cm);
analysisManager->FillNtupleDColumn(4, localPosition.y()/cm);
analysisManager->FillNtupleDColumn(5, time/ns);

where `ID` is the track ID, `pdgCode` its PDG code, `Ekin` the kinetic energy, `localPosition` is the G4ThreeVector of local coordinate in the frame of the screen (see `EDChamberSD` to see how to get these coordinates, for example).

This ntuple has been declared and shaped in the `RunAction`.

• Run 1000 protons with `1 mm` cut, save your `ED.root` as, eg, `ED-1mm.root`
• Run 1000 protons with `1 km` cut, save your `ED.root` as, eg, `ED-1km.root`
• Compare the counting of particles at the screen level. Comment.

Change of secondary production with physics list:

• You will use several physics lists to compare neutron production and transport. With a `1 mm` cut, run the application with the following physics lists:
• LHEP [known to be badly describing neutrons]
• FTFP_BERT [the one you use by default in this tutorial]
• FTFP_BERT_HP [the most precise one for what concerns neutron transport]

The physics list can be passed in batch on the command line, eg:

`./exampleED -p LHEP -m runProton.mac`

• Check the energy spectrum of neutrons reaching the screen for the 3 cases, and specially a low energy (eg: below 50 MeV).

Solution: session8_solution.tar.gz

Exercise ++:

The exercises marked as ++ are optional; they are recommended for participants who have already some experience with Geant4 and get some time left for practicing more than the basic exercise proposed above.

• There is no exercise++ for this session.