Information about creating a ROOT file with histos/data and reading this back


Creating a ROOT file

An example main program is in src/
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/ 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/

The options for the job e.g. the name of the o/p ROOT file are in the cfg/ file.
These cards are defined and read in

TestBeamReadout invokes a analysis framework embodied in root/gm2.hh. In this example the specific analysis module
invoked is src/root/

One can easily create their own analysis module and run this from

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][2048] : the TDC data for this TDC for this fill as 2048 ints.

What is stored can be changed quickly by editing
include/root/FilldataDef.hh src/root/
include/root/TDCdataDef.hh src/root/

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. 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/ which invokes the analysis module
src/root/ which in turn defines some analysis histograms in src/root/TestBeamAnalysisHistos.

It is run via: bin/TestBeamAnalysis.exe < cfg/

The above code reads the ROOT file created by TestBeamReadout.exe and outputs some histos into a new ROOT file.