Hands-on

Code for download: session6_start.tar.gz

Hands-on 6a

  • Set particles production thresholds (cuts) via Geant4 command in run.mac.

    • Use Help in Qt session to find out needed commands.
    • See setCut* commands in /run directory.
  • Define a region in EM calorimeter with production thresholds different from the default ones.

Hands-on 6b

With use of G4AnalysisManager :

  1. Create & fill histogram (see example B4/B4d )

    • Define a 1D histogram for the energy deposited per event for each calorimeter layer.
      Hint: You can use std::to_string() to convert an integer number to a string

    • Implement filling of histograms in the EmCalorimeterSD::EndOfEvent() function.
      Hint: To access the i-th calorimeter hit from fHitsCollection:

      EmCalorimeterHit* hit = (EmCalorimeterHit*)(*fHitsCollection)[i];
      
  2. Inspect generated file in ROOT with the ROOT browser

    • To get root available on the classroom computers you need to define the environment using the provided script:

      source /nfsapp/physics/root.bash -n
      
    • The command to call Root:

      root
      
  3. Execute the plotter.mac macro and run 100 events. The histogram is empty, why ?

    Update the RunAction code to postpone resetting histograms to the start of the next run and run 100 events again. The histogram should not be empty this time.

    Activate the setLayout command in the plotter.mac macro to create 2x2 plotting regions and add the histograms for the layers 2, 3, 4.

Hands-on 6c:

  1. Create & fill ntuples (see example B4/B4d ):

    • Define two ntuples representing the tracker chamber hits in each tracker chamber (one in the first arm and one in the second arm)

      • the chamber layer number
      • hit local position (x, y, z)
    • Implement filling of the ntuples in ChamberSD::ProcessHits();

      • Note that there is added a new data member, fNtupleId, in the ChamberSD class which allows to associate each tracker chamber with one of created ntuples
  2. Inspect generated file in ROOT with the ROOT browser

  3. Activate batch plotting of histograms using the UI command(s)

Solution: session6_solution.tar.gz