2018 Session 6 : Exercise

Code for download: session6_start.tar.gz

Exercise 6a:

  • With use of G4AnalysisManager
    (see example B4/B4d ):

    1. Create & fill histogram
      • Define a 1D histogram for the energy deposited per event for each calorimeter layer
      • Implement filling of histograms in the EDEmCalorimeterSD::EndOfEvent() function.
        Hint:
        To access the i-th calorimeter hit from fHitsCollection:
        EDEmCalorimeterHit* hit = (EDEmCalorimeterHit*)(*fHitsCollection)[i];
      • Activate plotting of histograms using the UI command(s)
    2. Create & fill ntuple
      • Define two ntuples representing the tracker chamber hit in each tracker chamber:
        • the chamber layer number
        • hit local position (x, y, z)
      • Implement filling of ntuple in  EDChamberSD::ProcessHits();
        • Note that in there is added a new data member, fNtupleId, in the EDChamberSD class which allow to associate each tracker chamber with one of created ntuples
    3. Inspect generated file in Root with Root browser
      • The command to call Root in our environment:
        /usr/local/bin/root

Exercise 6b:

  • Add menu in GUI using command line interface
    • Add a menu « View » in the toolbar (on apple computers, the menu bar is always at the top of the screen)
    • In this View menu, add two buttons for setting the viewPoint at Theta/Phi (0,0) and (90,0)
    • In this View menu, add a button for setting a viewPoint and ask for it (define a command without parameters)
  • Explore visualization commands

Exercise 6c:

  • Inspect the implementation of a command using G4GenericMessenger in the EDEventAction class, execute the command to inactivate verbose mode and run a new event
  • Make randomizing of the particle direction optional, and then implement a command to select the randomize option using G4GenericMessenger in an analogous way as the command in EDEventAction
    • Add a new data member fRandomize of a G4bool type
    • Add a G4GenericMessenger object in EDPrimaryGeneratorAction and call its DeclareProperty method to create setRandomize command

Solution: session6_solution.tar.gz