Information about creating a ROOT file with histos/data and reading this back¶
WARNING: THIS IS OUT OF DATE AND NEEDS AN UPDATE
Creating a ROOT file¶
An example main program is in src/TestBeamReadout.cc
This and all the code it requires is compiled from the Makefile in the "src" directory i.e. via "cd src; make"
This creates the header dependencies behind the scenes (via scripts/make_dependencies.sh which are placed in dep/*.mk).
The dependency creation can be subsequently skipped if you have not added new header files to the code or included new header files i.e. "make bin" skips the dependency step.
The code is run via the command:
bin/TestBeamReadout.exe < cfg/TestBeamReadout.cards
The options for the job e.g. the name of the o/p ROOT file are in the cfg/TestBeamReadout.cards file.
These cards are defined and read in TestBeamReadout.cc.
TestBeamReadout invokes a analysis framework embodied in root/gm2.hh. In this example the specific analysis module
invoked is src/root/Write_RootTest.cc
One can easily create their own analysis module and run this from TestBeamReadout.cc
Write_RootTest creates a ROOT file that has one folder/directory called "Write_RootTest". This directory contains one example histogram "nhits_per_TDC" and one TTree called "FILL_DATA". This TTree is filled each fill and has two branches: "FILL" and "TDCData".
"FILL" just has general fill parameters: the fill number and the fill time.
"TDC_DATA" has values:
ntdc : # of TDCs being readout in this fill
tdc_header[ntdc] : a header (int) for each TDC. This may have serial number etc
tdc_data[ntdc] : the TDC data for this TDC for this fill as 2048 ints.
What is stored can be changed quickly by editing
In the .cc file make you'll need to amend setAddresses() and defs() to add the new variable.
The routines print() and copy() and testFill() will also need amending.
TestBeamReadout.cc uses some man classes: general/Logger.hh general/ControlCards.hh which control the printing of messages and steering of the code via control cards.
Reading the ROOT file¶
This is very similar to the above. There is main file: src/TestBeamAnalysis.cc which invokes the analysis module
src/root/Root_ReadTest.cc which in turn defines some analysis histograms in src/root/TestBeamAnalysisHistos.
It is run via: bin/TestBeamAnalysis.exe < cfg/TestBeamAnalysis.cards
The above code reads the ROOT file created by TestBeamReadout.exe and outputs some histos into a new ROOT file.