12#ifndef ZDCTreeAnalysis_h
13#define ZDCTreeAnalysis_h
223 ZDCTreeAnalysis(std::string filename,
int nSample = 7,
double deltaT = 12.5,
int preSamplIdx = 1, std::string fitFunction =
"FermiExp");
229 _dataAnalyzer_p->SetADCOverUnderflowValues(HGOverFlowADC, HGUnderFlowADC, LGOverFlowADC);
241 DeltaT0CutLowHG, DeltaT0CutHighHG,
242 DeltaT0CutLowLG, DeltaT0CutHighLG);
252 _dataAnalyzer_p->SetTauT0Values(fixTau1, fixTau2, tau1, tau2, t0HG, t0LG);
267 std::array<std::array<TSpline*, 4>, 2>&& calibSplinesLG)
269 _dataAnalyzer_p->LoadtT0Calibrations(std::move(calibSplinesHG), std::move(calibSplinesLG));
272 void SetLBDepT0(
int iside,
int imod, TSpline* t0SplineLG, TSpline* t0SplineHG);
274 void SetSlewingCoeff(
const std::array<std::array<std::vector<float>, 4>, 2>& HGParamArr,
275 const std::array<std::array<std::vector<float>, 4>, 2>& LGParamArr)
283 void PlotFits(
const std::string & canvasSavePath =
"");
286 virtual Int_t
Cut(Long64_t entry);
290 virtual void Loop(
int numEntries = -1,
int startEntry = 0);
292 virtual void Show(Long64_t entry = -1);
314#ifdef ZDCTreeAnalysis_cxx
317 fChain(0), _outTFile(0), _outTree(0),
318 _nSample(nSample), _deltaTSample(deltaT), _preSampleIdx(preSamplIdx),
319 _doOutput(false), _currentEntry(-1), _inLoop(false),
320 _haveCalibrations(false)
326 TFile* f =
new TFile(filename.c_str());
327 f->GetObject(
"zdcTree",
tree);
344 9.51415, 9.5049, 9.51659, 9.51415};
380 delete fChain->GetCurrentFile();
395 Long64_t centry =
fChain->LoadTree(entry);
396 if (centry < 0)
return centry;
469 fChain->SetBranchStatus(
"*", 0);
470 fChain->SetBranchStatus(
"runNumber", 1);
471 fChain->SetBranchStatus(
"eventNumber", 1);
472 fChain->SetBranchStatus(
"lumiBlock", 1);
473 fChain->SetBranchStatus(
"bcid", 1);
474 fChain->SetBranchStatus(
"zdc_raw", 1);
475 fChain->SetBranchStatus(
"tbp", 1);
477 fChain->SetBranchStatus(
"passBits", 1);
479 fChain->SetBranchStatus(
"L1_ZDC_A", 1);
480 fChain->SetBranchStatus(
"L1_ZDC_C", 1);
481 fChain->SetBranchStatus(
"L1_ZDC_AND", 1);
482 fChain->SetBranchStatus(
"L1_ZDC_A_C", 1);
std::array< std::array< bool, 4 >, 2 > ZDCModuleBoolArray
std::array< std::array< float, 4 >, 2 > ZDCModuleFloatArray
float zdc_Presample[2][4]
ZDCTreeAnalysis(std::string filename, int nSample=7, double deltaT=12.5, int preSamplIdx=1, std::string fitFunction="FermiExp")
float _DeltaT0CutLow[2][4]
virtual Long64_t LoadTree(Long64_t entry)
void SetTauT0Values(const ZDCDataAnalyzer::ZDCModuleBoolArray &fixTau1, const ZDCDataAnalyzer::ZDCModuleBoolArray &fixTau2, const ZDCDataAnalyzer::ZDCModuleFloatArray &tau1, const ZDCDataAnalyzer::ZDCModuleFloatArray &tau2, const ZDCDataAnalyzer::ZDCModuleFloatArray &t0HG, const ZDCDataAnalyzer::ZDCModuleFloatArray &t0LG)
void SetDebugLevel(int debugLevel=0)
TSpline * _moduleT0LGLB[2][4]
float _HGOverFlowADC[2][4]
float _DeltaT0CutHigh[2][4]
float _T0SlewCoeffLG[2][4][3]
virtual Int_t GetEntry(Long64_t entry)
TSpline * _modECalibLB[2][4]
Int_t fCurrent
pointer to the analyzed TTree or TChain
int zdc_Min2ndDerivSample[2][4]
std::vector< float > * zdc_samplesDeriv2nd
void SetCutValues(const ZDCDataAnalyzer::ZDCModuleFloatArray &chisqDivAmpCutHG, const ZDCDataAnalyzer::ZDCModuleFloatArray &chisqDivAmpCutLG, const ZDCDataAnalyzer::ZDCModuleFloatArray &DeltaT0CutLowHG, const ZDCDataAnalyzer::ZDCModuleFloatArray &DeltaT0CutHighHG, const ZDCDataAnalyzer::ZDCModuleFloatArray &DeltaT0CutLowLG, const ZDCDataAnalyzer::ZDCModuleFloatArray &DeltaT0CutHighLG)
TSpline * _moduleT0HGLB[2][4]
float _chisqDivAmpCutHG[2][4]
void PlotFits(const std::string &canvasSavePath="")
ZDCDataAnalyzer::ZDCModuleFloatArray _peak2ndDerivMinSamples
virtual void Show(Long64_t entry=-1)
void SetADCOverUnderflowValues(const ZDCDataAnalyzer::ZDCModuleFloatArray &HGOverFlowADC, const ZDCDataAnalyzer::ZDCModuleFloatArray &HGUnderFlowADC, const ZDCDataAnalyzer::ZDCModuleFloatArray &LGOverFlowADC)
void SetLBDepT0(int iside, int imod, TSpline *t0SplineLG, TSpline *t0SplineHG)
TBranch * b_ps_L1_ZDC_AND
std::array< std::array< float, 4 >, 2 > _moduleHGGains
float _HGUnderFlowADC[2][4]
TBranch * b_ps_L1_ZDC_A_C
float _chisqDivAmpCutLG[2][4]
std::vector< std::set< int > > _trains
std::vector< float > * zdc_samplesSub
void SetSlewingCoeff(const std::array< std::array< std::vector< float >, 4 >, 2 > &HGParamArr, const std::array< std::array< std::vector< float >, 4 >, 2 > &LGParamArr)
virtual ~ZDCTreeAnalysis()
void LoadEnergyCalibrations(std::array< std::array< TSpline *, 4 >, 2 > &&calibSplines)
TFile * _outTFile
current Tree number in a TChain
virtual Int_t Cut(Long64_t entry)
std::vector< int > _BCIDGap
UShort_t zdc_raw[2][4][2][2][7]
float _T0SlewCoeffHG[2][4][3]
float zdc_CalibTime[2][4]
int zdc_MaxADCSample[2][4]
bool _haveLBDepECalib[2][4]
void OpenOutputTree(const std::string &file)
void LoadT0Calibrations(std::array< std::array< TSpline *, 4 >, 2 > &&calibSplinesHG, std::array< std::array< TSpline *, 4 >, 2 > &&calibSplinesLG)
int zdc_MinADCSample[2][4]
float zdc_Min2ndDeriv[2][4]
ZDCDataAnalyzer::ZDCModuleFloatArray _peak2ndDerivMinThresholds
unsigned int GetRunNumber() const
void LoadEntry(int entry)
bool _haveModuleSettings[2][4]
std::vector< float > * zdc_samplesDeriv
virtual void Loop(int numEntries=-1, int startEntry=0)
std::vector< int > _BCIDPosInTrain
virtual void Init(TTree *tree)
ZDCDataAnalyzer * _dataAnalyzer_p