Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-11 07:53:48

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