A copy of Ex04 but remove the printout of the number of hits per event and replace it with a histogram.
# Run the example with: art -c ex06.fcl
# After this, run root to view the histogram and to make the .pdf file: root -l ../art-workbook/artwb/Ex06/ex06.cint ( can we shorten the path to the cint file? ). After you see the block, click on the shell window from which you ran root and type ".q" ( without the quotes, with the the dot ) to exit root.
# view the pdf file: display ex06.pdf ( get acroread or kpdf installed? )
# Print the pdf file ( flpr -q xxxxx output/ex06.pdf ), where xxx is the name of a print queue. There is a poster near each printer with its name.
Browse the output root file interactively:
This uses a helper script distributed with the workbook.
# type the command: browse output/ex06.root
# This will open a root browser window. In the left hand panel there will a root file icon named ex06.root. Double click on this.
# A subdirectory icon named "hello" will appear. Double click on this.
# A histogram icon named nHits will appear; double click on this. The right panel will fill with a view of the histogram.
# To exit root, return to the shell window and, at the root prompt type .q ( a dot character followed by the letter q ).
# If you really want to use raw root,then:
at the shell prompt: root -l
# at the root prompt: TBrowser b;
# This will open a root browser window. Navigate the left hand panel to find the icon for the file ex06.root.
# Double click on this icon and follow the directions above.
# In the .fcl file, change the name of the root output file. Rerun. Browse the new file. Modify the cint script to use the new file and make a new .pdf file.
# In the .fcl file, change the module label "hello" to some other string ( in both places ). Rerun. Browse the file ex06.root interactively. Note that the subdirectory named "hello" has changed to the new module label that you used.
# print the TCanvas using the pull down menu.
Ideas to discuss
# How to browse histograms using interactive root.
# For each module that uses TFileService, art creates a subdirectory in the root output file. If you follow the recommended procedures, any histograms created by your module will appear in this subdirectory. Note the the subdirectories are named after the module label, not the module class name; so, if you have several instances of the same module class, each gets their own subdirectory.
# ROOT convention: low edge is in the bin and high edge is not. So read the high bin as 30, not 31.
# browse command
# Look at the CMakeLists.txt file. Diff against any of Ex03...Ex05. There are four new lines; these are libraries needed for making histograms and for using GenParticles.
# Postpone the discussion of "what is a service until Ex08".