Code for download: session6_start.tar.gz
Exercise:
- With use of
G4AnalysisManager
(see example B4/B4d ):- 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];
- Create & fill ntuple
- Define an ntuple representing the tracker chamber hit:
- the chamber layer number
- hit local position (x, y, z)
- Implement filling of ntuple in
EDChamberSD::ProcessHits();
- Hint: Add a data member for ntuple ID in EDChamberSD, so that each instance of Chamber sensitive detector is associated with a different ntuple.
- Define an ntuple representing the tracker chamber hit:
- Inspect generated file in Root with Root browser
- Create & fill histogram
- 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)
- Manipulate visualization scene
- Add axes at the middle of the EmCalorimeter
- Add date on your scene
- Add text in red near your tube withe the « tube » label
- Set background to « gray »
- Make an 8000*6000 EPS file (with 100 events) and look at it
- Complete vis.mac with these comands
Solution: session6_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.
- Use one 2D histogram for all calorimeter layers.