Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-21 07:51:39

0001 #ifndef HGCROC_WAVEFORM_ANALYSIS_H
0002 #define HGCROC_WAVEFORM_ANALYSIS_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 HGCROC_Waveform_Analysis{
0020 
0021  public:
0022   HGCROC_Waveform_Analysis(){
0023     eventptr=&event;
0024     rswptr=&rsw;
0025     calibptr=&calib;
0026   }
0027   ~HGCROC_Waveform_Analysis(){}
0028 
0029   //Getter methods
0030   inline TString GetRootCalibInputName()    const {return RootCalibInputName;};
0031   inline TString GetRootCalibOutputName()   const {return RootCalibOutputName;};
0032   inline TString GetRootInputName()         const {return RootInputName;};
0033   inline TString GetRootOutputName()        const {return RootOutputName;};
0034   inline TString GetPlotOutputDir()         const {return OutputNameDirPlots;};
0035   inline TString GetExternalBadChannelMap() const {return ExternalBadChannelMap;};
0036   inline TString GetExternalCalibFile()     const {return ExternalCalibFile;};
0037   inline TString GetExternalToACalibOffSetFile()     const {return ExternalToACalibOffSetFile;};
0038   
0039   inline TFile* GetRootCalibInput()    {return RootCalibInput;}
0040   inline TFile* GetRootInput()         {return RootInput;}
0041   inline TFile* GetRootOutput()        {return RootOutput;}
0042 
0043   inline bool CanOverWrite(void)                const {return Overwrite;};
0044   inline bool IsToAnalysisWaveForm(void)        const {return IsAnalyseWaveForm;};
0045   inline bool IsToExtractTimeWalk(void)         const {return IsExtractTimeWalk;};
0046   inline bool IsToInvCrossTalk(void)            const {return IsInvCrossTalk;};
0047   inline bool IsHGCROC(void)                    const {return HGCROC;};
0048   
0049   inline short GetExtPlotting(void)             const {return ExtPlot;};
0050   inline bool GetOverWriteCalib(void)           const {return OverWriteCalib;};
0051   inline int GetMaxEvents(void)                 const {return maxEvents;};
0052   inline int GetFixedTOASample(void)            const {return fixedTOASample;};
0053   inline int GetFixedROChannel(void)            const {return fixedROCh;};
0054   
0055   //setter methods
0056   //Overload method for boolean...or is it too dangerous?
0057   inline void CanOverWrite(bool b)               {Overwrite=b;};
0058   inline void IsToAnalysisWaveForm(bool b)       {IsAnalyseWaveForm=b;};
0059   inline void IsToExtractTimeWalk(bool b)        {IsExtractTimeWalk=b;};
0060   inline void IsToInvCrossTalk(bool b)           {IsInvCrossTalk=b;};
0061   inline void SetOverWriteCalib(bool b)          {OverWriteCalib = b;};
0062   inline void SetExtPlotting(short b)            {ExtPlot = b;};
0063   inline void EnableDebug(int i)                 {debug=i;};  
0064   
0065   inline void SetYear(int year)                  {yearData=year;};
0066   inline void SetRunListInput(TString name)      {RunListInputName=name;};
0067   inline void SetRootCalibInput(TString name)    {RootCalibInputName=name;};
0068   inline void SetRootCalibOutput(TString name)   {RootCalibOutputName=name;};
0069   inline void SetRootInput(TString name)         {RootInputName=name;};
0070   inline void SetRootOutput(TString name)        {RootOutputName =name;};
0071   inline void SetRootOutputHists(TString name)   {RootOutputNameHist =name;};
0072   inline void SetPlotOutputDir(TString name)     {OutputNameDirPlots =name;};
0073   inline void SetPlotExtension(TString name)     {plotSuffix = name;};
0074   inline void SetExternalBadChannelMap(TString name)     {ExternalBadChannelMap =name;};
0075   inline void SetExternalCalibFile(TString name)     {ExternalCalibFile =name;};
0076   inline void SetExternalToACalibOffSetFile(TString name)     {ExternalToACalibOffSetFile =name;};
0077   inline void SetMaxEvents(int n)                 {maxEvents = n;};
0078   inline void SetFixedTOASample(int s)            {fixedTOASample = s;};
0079   inline void SetFixedROChannel(int r)            {fixedROCh = r;};
0080   
0081   //General methods
0082   bool CreateOutputRootFile(void);
0083   bool CreateOutputRootHistFile(void);
0084   bool CheckAndOpenIO(void);
0085   bool Process(void);
0086 
0087   //Variable members
0088   TString RootOutputName;                 // file name of root output with tree
0089   TString RootOutputNameHist;             // file name of root output with additional histograms & fits
0090   TString OutputNameDirPlots;             // directory name of output for plots
0091   TString RootInputName;                  // file name of input root file 
0092   TString RootCalibInputName;             // file name of calibration root file (mip calib)
0093   TString RootCalibOutputName;            // file name of calibration root file (mip calib) output
0094   TString RunListInputName;               // file name run list 
0095   TString ExternalBadChannelMap;          // file name external bad channel map
0096   TString ExternalCalibFile;              // file name external calib file
0097   TString ExternalToACalibOffSetFile =""; // file name external ToA calib offsets file
0098   TString plotSuffix        = "pdf";      // plot extension
0099   TFile* RootOutput         =nullptr;     // root file output tree
0100   TFile* RootOutputHist     =nullptr;     // root file output histos
0101   TFile* RootInput          =nullptr;     // root file input 
0102   TFile* RootCalibInput     =nullptr;     // root file calib values (mip)
0103   TFile* RootCalibOutput    =nullptr;     // root file calib values (mip) output
0104   bool HGCROC                 =false;     // Flag for HGCROC data conversion
0105   bool IsAnalyseWaveForm      =false;     // Flag for routine with waveform analysis
0106   bool IsExtractTimeWalk      =false;     // Flag for routine with time walk extraction
0107   bool IsInvCrossTalk         =false;     // Flag for routine with investigate cross talk
0108   bool OverWriteCalib         =false;     // Flag to overwrite calib from text file
0109   short ExtPlot               =0;         // Enable extended plotting
0110   bool Overwrite              =false;     // Flag to overwrite outputs
0111   int debug                   =0;         // debug level 
0112   int yearData                =-1;        // data taking year externally set
0113   RootSetupWrapper rsw;                   // Wrapper singleton class for setup
0114   RootSetupWrapper* rswptr;               // Pointer to wrapper for singleton class for setup
0115   Setup* setup;                           // geometry setup
0116   Calib calib;                            // calibration object
0117   Calib* calibptr;                        // pointer to calib object
0118   Event event;
0119   Event* eventptr;
0120   int maxEvents               = -1;
0121   int fixedTOASample          = -1;
0122   int fixedROCh               = -1;
0123   
0124   TTree* TsetupIn=nullptr;
0125   TTree* TsetupOut=nullptr;
0126   TTree* TdataIn=nullptr;
0127   TTree* TdataOut=nullptr;
0128   TTree* TcalibIn=nullptr;
0129   TTree* TcalibOut=nullptr;
0130 
0131  protected:
0132 
0133 
0134  private:
0135   bool AnalyseWaveForm(void);
0136   bool ExtractTimeWalk(void);
0137   bool InvestigateCrossTalk(void);
0138  };
0139 
0140 
0141 #endif