File indexing completed on 2025-01-18 09:15:43
0001 #ifndef ANALYSES_H
0002 #define ANALYSES_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 Analyses{
0020
0021 public:
0022 Analyses(){
0023 eventptr=&event;
0024 rswptr=&rsw;
0025 calibptr=&calib;
0026 }
0027 ~Analyses(){}
0028
0029
0030 inline TString GetASCIIinputName() const {return ASCIIinputName;};
0031 inline TString GetMapInputName() const {return MapInputName;};
0032 inline TString GetRootCalibInputName() const {return RootCalibInputName;};
0033 inline TString GetRootInputName() const {return RootInputName;};
0034 inline TString GetRootPedestalInputName() const {return RootPedestalInputName;};
0035 inline TString GetRootOutputName() const {return RootOutputName;};
0036 inline TString GetPlotOutputDir() const {return OutputNameDirPlots;};
0037 inline TString GetExternalBadChannelMap() const {return ExternalBadChannelMap;};
0038
0039 inline std::fstream* GetASCIIinput() {return &ASCIIinput;};
0040 inline std::fstream* GetMapInput() {return &MapInput;};
0041
0042 inline TFile* GetRootCalibInput() {return RootCalibInput;}
0043 inline TFile* GetRootInput() {return RootInput;}
0044 inline TFile* GetRootPedestalInput() {return RootPedestalInput;}
0045 inline TFile* GetRootOutput() {return RootOutput;}
0046
0047 inline bool CanOverWrite(void) const {return Overwrite;};
0048 inline bool IsToApplyPedestalCorrection(void) const {return ApplyPedestalCorrection;};
0049 inline bool IsToApplyCalibration(void) const {return ApplyCalibration;};
0050 inline bool IsToConvert(void) const {return Convert;};
0051 inline bool IsToExtractPedestal(void) const {return ExtractPedestal;};
0052 inline bool IsToExtractScaling(void) const {return ExtractScaling;};
0053 inline bool IsToExtractScalingImproved(void) const {return ExtractScalingImproved;};
0054 inline bool IsToReextractNoise(void) const {return ReextractNoise;};
0055 inline bool IsToSaveNoiseOnly(void) const {return SaveNoiseOnly;};
0056 inline bool IsToSaveMipsOnly(void) const {return SaveMipsOnly;};
0057 inline bool IsCalibSaveToFile(void) const {return SaveCalibToFile;};
0058 inline short GetCalcBadChannel(void) const {return CalcBadChannel;};
0059 inline short GetExtPlotting(void) const {return ExtPlot;};
0060
0061
0062
0063 inline void CanOverWrite(bool b) {Overwrite=b;};
0064 inline void IsCalibSaveToFile(bool b) {SaveCalibToFile=b;};
0065 inline void IsToApplyPedestalCorrection(bool b){ApplyPedestalCorrection=b;};
0066 inline void IsToApplyCalibration(bool b) {ApplyCalibration=b;};
0067 inline void IsToConvert(bool b) {Convert=b;};
0068 inline void IsToExtractPedestal(bool b) {ExtractPedestal=b;};
0069 inline void IsToExtractScaling(bool b) {ExtractScaling=b;};
0070 inline void IsToExtractScalingImproved(bool b) {ExtractScalingImproved=b;};
0071 inline void IsToReextractNoise(bool b) {ReextractNoise=b;};
0072 inline void IsToSaveNoiseOnly(bool b) {SaveNoiseOnly = b;};
0073 inline void IsToSaveMipsOnly(bool b) {SaveMipsOnly = b;};
0074 inline void SetCalcBadChannel(short b) {CalcBadChannel = b;};
0075 inline void SetExtPlotting(short b) {ExtPlot = b;};
0076 inline void EnableDebug(int i) {debug=i;};
0077
0078
0079 inline void SetYear(int year) {yearData=year;};
0080 inline void SetASCIIinput(TString name) {ASCIIinputName=name;};
0081 inline void SetMapInput(TString name) {MapInputName=name;};
0082 inline void SetRunListInput(TString name) {RunListInputName=name;};
0083 inline void SetRootCalibInput(TString name) {RootCalibInputName=name;};
0084 inline void SetRootInput(TString name) {RootInputName=name;};
0085 inline void SetRootPedestalInput(TString name) {RootPedestalInputName=name;};
0086 inline void SetRootOutput(TString name) {RootOutputName =name;};
0087 inline void SetRootOutputHists(TString name) {RootOutputNameHist =name;};
0088 inline void SetPlotOutputDir(TString name) {OutputNameDirPlots =name;};
0089 inline void SetExternalBadChannelMap(TString name) {ExternalBadChannelMap =name;};
0090
0091
0092
0093 bool CreateOutputRootFile(void);
0094 bool CheckAndOpenIO(void);
0095 bool Process(void);
0096
0097
0098 TString ASCIIinputName;
0099 TString RootOutputName;
0100 TString RootOutputNameHist;
0101 TString OutputNameDirPlots;
0102 TString RootInputName;
0103 TString RootCalibInputName;
0104 TString RootPedestalInputName;
0105 TString MapInputName;
0106 TString RunListInputName;
0107 TString ExternalBadChannelMap;
0108 TFile* RootOutput =nullptr;
0109 TFile* RootOutputHist =nullptr;
0110 TFile* RootInput =nullptr;
0111 TFile* RootPedestalInput =nullptr;
0112 TFile* RootCalibInput =nullptr;
0113 std::fstream ASCIIinput;
0114 std::fstream MapInput;
0115 bool Convert =false;
0116 bool ExtractPedestal =false;
0117 bool ExtractScaling =false;
0118 bool ExtractScalingImproved =false;
0119 bool ReextractNoise =false;
0120 bool ApplyPedestalCorrection=false;
0121 bool ApplyCalibration =false;
0122 bool SaveNoiseOnly =false;
0123 bool SaveMipsOnly =false;
0124 bool SaveCalibToFile =false;
0125 short CalcBadChannel =0;
0126 short ExtPlot =0;
0127 bool Overwrite =false;
0128 int debug =0;
0129 int yearData =-1;
0130 RootSetupWrapper rsw;
0131 RootSetupWrapper* rswptr;
0132 Setup* setup;
0133 Calib calib;
0134 Calib* calibptr;
0135 Event event;
0136 Event* eventptr;
0137
0138 TTree* TsetupIn=nullptr;
0139 TTree* TsetupOut=nullptr;
0140 TTree* TdataIn=nullptr;
0141 TTree* TdataOut=nullptr;
0142 TTree* TcalibIn=nullptr;
0143 TTree* TcalibOut=nullptr;
0144
0145 protected:
0146
0147
0148 private:
0149 bool ConvertASCII2Root(void);
0150 bool ConvertOldRootFile2Root(void);
0151 bool GetPedestal(void);
0152 bool CorrectPedestal(void);
0153 bool GetScaling(void);
0154 bool GetImprovedScaling(void);
0155 bool GetNoiseSampleAndRefitPedestal(void);
0156 bool Calibrate(void);
0157 bool SaveNoiseTriggersOnly(void);
0158 bool SaveMuonTriggersOnly(void);
0159 std::map<int,short> ReadExternalBadChannelMap(void);
0160 };
0161
0162
0163 #endif