Decoder

The DecodeAndSortAll program is used to convert data recored by different modules one run into a ROOT file. The user’s physical analysis is based on the ROOT file generated by this program. The data generated by this program has been arranged in ascending order of timestamp.

The user first needs to modify the definition in the UesrDefine.hh file

// #define ONLYPHA
// #define ONLYPSD
// #define ONLYZLE
// #define ONLYSCOPE

If all modules in the DAQ only use one type of firmware, enable the corresponding definition. If there is no definition of a single firmware, the output data file will default to supporting all types of firmware.

#define ROOTFILEPATH "./"       //the path of ROOT file
#define ROOTFILENAME "data"     //the name of ROOT file
// The path and file name for ROOT files
#define RAWFILEPATH "/home/wuhongyi/"      //Path of raw data
#define RAWFILENAME "data"                 //The file name of the raw data
#define MODNUMBER 2                        //Number of modules used in the chassis
const unsigned short SamplingRate[MODNUMBER] = {500, 125};//Specify the sampling rate of each modules separately; 125/500/1000 sampling rates; 0 to skip the module
const unsigned short Firmware[MODNUMBER] = {2, 0};//DPP_PHA=0 DPP_ZLE=1 DPP_PSD=2 DPP_DAW=3 OPEN=4 Scope=5
// Specify the firmware type for each module. If the type is specified incorrectly, there will be issues decoding the data

After modification, execute the following command to compile the program:

make clean
make

After successful compilation, an executable file decodeandsort will be generated, and the program will run as follows:

./decodeandsort [RunNnumber]

Among them, [RunNnumber] is the running number of the file you want to convert.