File indexing completed on 2026-01-07 09:25:15
0001 #ifndef CalibSampleParser_H
0002 #define CalibSampleParser_H
0003
0004 #include <iostream>
0005 #include <fstream>
0006 #include "TString.h"
0007 #include "TFile.h"
0008 #include "TTree.h"
0009 #include "TObjString.h"
0010
0011 #include "Setup.h"
0012 #include "RootSetupWrapper.h"
0013 #include "Calib.h"
0014 #include "Event.h"
0015 #include "Tile.h"
0016 #include "HGCROC.h"
0017 #include "Caen.h"
0018
0019 class CalibSampleParser{
0020 public:
0021 CalibSampleParser(){
0022 rswptr=&rsw;
0023 calibptr=&calib;
0024 }
0025 ~CalibSampleParser(){}
0026
0027
0028
0029
0030
0031 inline void EnableDebug(int i) {debug=i;};
0032 inline void SetInputFile(TString name) {inputFilePath=name;};
0033 inline void SetMappingFile(TString name) {MapInputName=name;};
0034 inline void SetOutputFilename(TString name) {OutputFilename=name;};
0035 inline void SetPlotDirectory(TString name) {outputDirPlots=name;};
0036 inline void SetRunListInput(TString name) {RunListInputName=name;};
0037 inline void SetRunNumber(int i) {RunNr=i;};
0038 inline void EnablePlotting() {doPlotting=true;};
0039 inline void SwitchPedestalCalib() {optParse=1;};
0040 inline void SetInputCalibFile(TString name) {calibInputFile=name;};
0041
0042
0043
0044 bool CheckAndOpenIO(void);
0045 bool Process(void);
0046
0047
0048 TString inputFilePath;
0049 TString MapInputName;
0050 TString calibInputFile;
0051 TString RunListInputName;
0052 int RunNr = -1;
0053 std::fstream MapInput;
0054 TString OutputFilename;
0055 TString OutputHistFilename;
0056 TString outputDirPlots;
0057 TFile* RootCalibInput = nullptr;
0058 TFile* RootOutput = nullptr;
0059 TFile* RootOutputHist = nullptr;
0060 int debug = 0;
0061 int optParse = 0;
0062
0063 Event event;
0064 RootSetupWrapper rsw;
0065 RootSetupWrapper* rswptr;
0066 Setup* setup;
0067 Calib calib;
0068 Calib* calibptr;
0069
0070 TTree* tOutTree = nullptr;
0071 TTree* TsetupOut = nullptr;
0072 TTree* TcalibIn = nullptr;
0073 TTree* TcalibOut = nullptr;
0074
0075 bool doPlotting = false;
0076
0077 std::vector<int> calibChannelsSet;
0078 int kcu = 0;
0079
0080 protected:
0081
0082 private:
0083 bool Parse();
0084 bool ProcessAndPlotWaveforms();
0085 bool ParsePedestalCalib();
0086
0087 bool IsCalibChannel(int channel){
0088 for(int i=0; i < calibChannelsSet.size(); i++){
0089 if( calibChannelsSet.at(i) == channel ) return true;
0090 }
0091 return false;
0092 }
0093
0094 };
0095
0096 #endif