File indexing completed on 2026-09-02 08:25:30
0001 #ifndef DataAnalysis_H
0002 #define DataAnalysis_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 DataAnalysis{
0020
0021 public:
0022 DataAnalysis(){
0023 eventptr=&event;
0024 rswptr=&rsw;
0025 calibptr=&calib;
0026 }
0027 ~DataAnalysis(){}
0028
0029
0030 inline TString GetRootInputName() const {return RootInputName;};
0031 inline TString GetRootOutputName() const {return RootOutputName;};
0032 inline TString GetPlotOutputDir() const {return OutputNameDirPlots;};
0033
0034 inline TFile* GetRootInput() {return RootInput;}
0035 inline TFile* GetRootOutput() {return RootOutput;}
0036
0037 inline bool CanOverWrite(void) const {return Overwrite;};
0038 inline bool IsCalibSaveToFile(void) const {return SaveCalibToFile;};
0039 inline short GetExtPlotting(void) const {return ExtPlot;};
0040 inline bool IsToRunQA(void) const {return RunQA;};
0041 inline bool GetDeltaTimePlotting(void) const {return DeltaTimePlot;};
0042 inline double GetTimeMin(void) const {return timemin;};
0043 inline double GetTimeMax(void) const {return timemax;};
0044 inline double GetPercentMin(void) const {return percentmin;};
0045 inline double GetPercentMax(void) const {return percentmax;};
0046 inline int GetHGCROCNSampleInteg(void) const {return nSampleHGCROCInt;};
0047 inline int GetHGCROCOptInteg(void) const {return optHGCROCInt;};
0048
0049
0050
0051 inline void CanOverWrite(bool b) {Overwrite=b;};
0052 inline void IsCalibSaveToFile(bool b) {SaveCalibToFile=b;};
0053 inline void SetExtPlotting(short b) {ExtPlot = b;};
0054 inline void SetDeltaTimePlotting(bool b) {DeltaTimePlot = b;};
0055 inline void SetTimeMin(double b) {timemin = b;};
0056 inline void SetTimeMax(double b) {timemax = b;};
0057 inline void SetPercentMin(double b) {percentmin = b;};
0058 inline void SetPercentMax(double b) {percentmax = b;};
0059 inline void EnableDebug(int i) {debug=i;};
0060 inline void IsToRunQA(bool b) {RunQA=b;};
0061 inline void IsToSimpleRunQA(bool b) {RunSimpleQA=b;};
0062
0063 inline void SetYear(int year) {yearData=year;};
0064 inline void SetRunListInput(TString name) {RunListInputName=name;};
0065 inline void SetRootInput(TString name) {RootInputName=name;};
0066 inline void SetRootOutput(TString name) {RootOutputName =name;};
0067 inline void SetRootOutputHists(TString name) {RootOutputNameHist =name;};
0068 inline void SetPlotOutputDir(TString name) {OutputNameDirPlots =name;};
0069 inline void SetPlotExtension(TString name) {plotSuffix = name;};
0070 inline void SetMaximumEvents(int numevents) {eventNumber = numevents;};
0071
0072 inline void SetHGCROCNSampleInteg(int n) {optHGCROCInt = 1;
0073 nSampleHGCROCInt = n;
0074 };
0075 inline void SetHGCROCNSampleIntegForced(int n) {optHGCROCInt = 101;
0076 nSampleHGCROCInt = n;
0077 };
0078
0079
0080
0081 bool CreateOutputRootFile(void);
0082 bool CreateOutputRootFileHist(void);
0083 bool CheckAndOpenIO(void);
0084 bool Process(void);
0085
0086
0087 TString RootOutputName;
0088 TString RootOutputNameHist;
0089 TString OutputNameDirPlots;
0090 TString RootInputName;
0091 TString RunListInputName;
0092 TString plotSuffix = "pdf";
0093 TFile* RootOutput = nullptr;
0094 TFile* RootOutputHist = nullptr;
0095 TFile* RootInput = nullptr;
0096 bool RunQA = false;
0097 bool RunSimpleQA = false;
0098 bool SaveCalibToFile = false;
0099 short ExtPlot = 0;
0100 bool DeltaTimePlot = false;
0101 bool Overwrite = false;
0102 int debug = 0;
0103 int yearData = -1;
0104 int eventNumber = -1;
0105 double timemin = 0;
0106 double timemax = 35000;
0107 double percentmax = 100;
0108 double percentmin = 0;
0109 int optHGCROCInt = 0;
0110 int nSampleHGCROCInt = 1;
0111
0112 RootSetupWrapper rsw;
0113 RootSetupWrapper* rswptr;
0114 Setup* setup;
0115 Calib calib;
0116 Calib* calibptr;
0117 Event event;
0118 Event* eventptr;
0119
0120 TTree* TsetupIn = nullptr;
0121 TTree* TsetupOut = nullptr;
0122 TTree* TdataIn = nullptr;
0123 TTree* TdataOut = nullptr;
0124 TTree* TcalibIn = nullptr;
0125 TTree* TcalibOut = nullptr;
0126
0127 protected:
0128
0129
0130 private:
0131 bool QAData(void);
0132 bool SimpleQAData(void);
0133 };
0134
0135
0136 #endif