HiRAEVTMapper - nscl-hira/HiRAEVT GitHub Wiki

HiRAEVTMapper takes the output from HiRAEVTUnpacker and "maps" that data into physical detectors.

Using the program

Setting environment variables

To run the program or read the TTree, you must make sure all of the environment variables are properly set. This involves making sure the ROOT libraries are on your LD_LIBRARY_PATH, and the libraries and executables built by this code are on your LD_LIBRARY_PATH, and PATH, respectively. If you are working on the NSCL/FRIB cluster fishtank, there are scripts to assist with this. From the source directory run:

source env.sh

Mapping data

The program requires two inputs: a configuration file that specifies the how the data should be mapped and calibrated, and the run number to map. The file format of the configuration file is detailed here. The program assumes an input file of the form run-[runNum].root and outputs a file of the form mappedRun-[runNum].root. The input/output directories are specified in the configuration file.

HiRAEVTMapper [config.json] [run number]

Reading data

Assuming the required library (HTDetectors) is on your LD_LIBRARY_PATH, you should be able to read the data like any other ROOT TTree, by either manually setting addresses or using a TTreeReader<>. You can also directly create spectra using TTree::Draw()

For example, if you created a detector of type HTSimpleDetector called HPGe you could draw the energy spectrum in the root interpreter with the command TreeName->("HPGe.fEnergy")

Available detectors

A number of detectors have already been implemented. They are:

  • HTSimpleDetector: A detector that supports a single channel with energy and time.

For developers

Adding detectors

To add a detector two classes must be created, and some singleton factories modified:

  • The detector must derive from HTDetector and be added to the CMakeLists.txt in HTDetectors
  • The detector has to be added to the HTDetectorFactory in HTDetectors.
  • The detector mapper must derive from HTDetectorMapper and be added to the CMakeLists.txt in HTMappers
  • The detector mapper has to be added to the HTDetectorMapperFactory in HTMappers.
  • The detector must be documented on the wiki.

See the pages describing the two interfaces HTDetector and HTDetecorMapper for more details.

Standard calibrations

Included in the codebase is a static singleton to help calibrate data using JSON calibration files. At the time of writing is only supports polynomial calibrations, but could be extended. It can be used in the following way

Double_t calibratedData = HTCalibrator::Instance()->Calibrate(rawData, jsonCalibrationParameters)

The json object must have the format

{
  "method":methodName,
  ...
}

Currently the only supported method is "poly" which requires a second key:value pair called "parameters":[par array]. The array specifies the coefficients to apply in the calibration. For example the json object

{
  "method":"poly",
  "parameters":[ 10, 0.132, 0.0003]
}

when used would return 10 + 0.132*rawData + 0.0003*rawData^2 when HTCalibrator::Instance()->Calibrate(rawData, jsonCalibrationParameters) is called.