/*================== Thie event builder both sort and build event. skip the *.to file. ===================*/ #include #include #include #include #include #include "TFile.h" #include "TTree.h" #include "TMath.h" #include "TBenchmark.h" #include "TStopwatch.h" #include "TTreeIndex.h" #include "../mapping.h" #include "evtReader.h" #define MAXMULTI 100 #define MAXBUFFER 100 // number of hit in memory buffer int main(int argn, char **argv){ printf("=====================================\n"); printf("=== Event Builder from *.evt ===\n"); printf("=====================================\n"); if (argn < 5 ) { printf("Usage :\n"); printf("%s [timeWindows] [Reject Flag] [SaveFileName] [*.evt File1 [*.evt File2] ...\n", argv[0]); printf(" timeWindows [int]: 1 unit = 10 ns \n"); printf(" Reject Flag [int]: 0 = no rejection, 1 = reject no gamma, 2 = reject no GAGG. see mapping.h\n"); printf(" SaveFileName [str]: custom save file name \n"); return 1; } unsigned short timeWindow = atoi(argv[1]); unsigned short rejectFlag = atoi(argv[2]); TString outFileName = argv[3]; std::vector inFileList; for( int i = 4; i < argn; i++) inFileList.push_back(argv[i]); //========== put data into RAM buffer. std::vector hitListA, hitListB; evtReader * reader = nullptr; for( size_t i = 0 ; i < inFileList.size(); i++){ reader = new evtReader(inFileList[i]); reader->ScanNumberOfBlock(); reader->ReadBatchDataAndSort(MAXBUFFER); hitListA = reader->GetDataList(); reader->ReadBatchDataAndSort(MAXBUFFER); hitListB = reader->GetDataList(); delete reader; } return 0; }