Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-05 08:58:06

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   //Getter methods
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   
0047   //setter methods
0048   //Overload method for boolean...or is it too dangerous?
0049   inline void CanOverWrite(bool b)               {Overwrite=b;};
0050   inline void IsCalibSaveToFile(bool b)          {SaveCalibToFile=b;};
0051   inline void SetExtPlotting(short b)            {ExtPlot = b;};
0052   inline void SetDeltaTimePlotting(bool b)      {DeltaTimePlot = b;};
0053   inline void SetTimeMin(double b)               {timemin = b;};
0054   inline void SetTimeMax(double b)               {timemax = b;};
0055   inline void SetPercentMin(double b)            {percentmin = b;};
0056   inline void SetPercentMax(double b)            {percentmax = b;};
0057   inline void EnableDebug(int i)                 {debug=i;};
0058   inline void IsToRunQA(bool b)                  {RunQA=b;};
0059   inline void IsToSimpleRunQA(bool b)            {RunSimpleQA=b;};
0060   
0061   inline void SetYear(int year)                  {yearData=year;};
0062   inline void SetRunListInput(TString name)      {RunListInputName=name;};
0063   inline void SetRootInput(TString name)         {RootInputName=name;};
0064   inline void SetRootOutput(TString name)        {RootOutputName =name;};
0065   inline void SetRootOutputHists(TString name)   {RootOutputNameHist =name;};
0066   inline void SetPlotOutputDir(TString name)     {OutputNameDirPlots =name;};
0067   inline void SetPlotExtension(TString name)     {plotSuffix = name;};
0068   inline void SetMaximumEvents(int numevents)    {eventNumber = numevents;};
0069   
0070   //General methods
0071   bool CreateOutputRootFile(void);
0072   bool CreateOutputRootFileHist(void);
0073   bool CheckAndOpenIO(void);
0074   bool Process(void);
0075 
0076   //Variable members
0077   TString RootOutputName;                 // file name of root output with tree
0078   TString RootOutputNameHist;             // file name of root output with additional histograms & fits
0079   TString OutputNameDirPlots;             // directory name of output for plots
0080   TString RootInputName;                  // file name of input root file 
0081   TString RunListInputName;               // file name run list 
0082   TString plotSuffix        = "pdf";      // plot extension
0083   TFile* RootOutput         =nullptr;     // root file output tree
0084   TFile* RootOutputHist     =nullptr;     // root file output histos
0085   TFile* RootInput          =nullptr;     // root file input 
0086   bool RunQA                  = false;    // Flag to run QA routine
0087   bool RunSimpleQA            = false;    // Flag to run QA routine
0088   bool SaveCalibToFile        =false;     // Flag to save calib objects to text file
0089   short ExtPlot               =0;         // Enable extended plotting
0090   bool DeltaTimePlot         =false;         // Enable deltatime plotting
0091   bool Overwrite              =false;     // Flag to overwrite outputs
0092   int debug                   =0;         // debug level 
0093   int yearData                =-1;        // data taking year externally set
0094   int eventNumber             =-1;        // maximum events externally set
0095   double timemin              =0;         // set min cut for deltatime
0096   double timemax              =35000;     // set max cut for deltatime
0097   double percentmax           =100;       // set min percent cut for deltatime
0098   double percentmin           =0;         // set max percent cut for deltatime
0099   RootSetupWrapper rsw;                   // Wrapper singleton class for setup
0100   RootSetupWrapper* rswptr;               // Pointer to wrapper for singleton class for setup
0101   Setup* setup;                           // geometry setup
0102   Calib calib;                            // calibration object
0103   Calib* calibptr;                        // pointer to calib object
0104   Event event;
0105   Event* eventptr;
0106   
0107   TTree* TsetupIn=nullptr;
0108   TTree* TsetupOut=nullptr;
0109   TTree* TdataIn=nullptr;
0110   TTree* TdataOut=nullptr;
0111   TTree* TcalibIn=nullptr;
0112   TTree* TcalibOut=nullptr;
0113 
0114  protected:
0115 
0116 
0117  private:
0118   bool QAData(void);
0119   bool SimpleQAData(void);
0120  };
0121 
0122 
0123 #endif