Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:15:44

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   
0050   inline void SetYear(int year)                  {yearData=year;};
0051   inline void SetRunListInput(TString name)      {RunListInputName=name;};
0052   inline void SetRootInput(TString name)         {RootInputName=name;};
0053   inline void SetRootOutput(TString name)        {RootOutputName =name;};
0054   inline void SetRootOutputHists(TString name)   {RootOutputNameHist =name;};
0055   inline void SetPlotOutputDir(TString name)     {OutputNameDirPlots =name;};
0056   
0057   //General methods
0058   bool CreateOutputRootFile(void);
0059   bool CreateOutputRootFileHist(void);
0060   bool CheckAndOpenIO(void);
0061   bool Process(void);
0062 
0063   //Variable members
0064   TString RootOutputName;                 // file name of root output with tree
0065   TString RootOutputNameHist;             // file name of root output with additional histograms & fits
0066   TString OutputNameDirPlots;             // directory name of output for plots
0067   TString RootInputName;                  // file name of input root file 
0068   TString RunListInputName;               // file name run list 
0069   TFile* RootOutput         =nullptr;     // root file output tree
0070   TFile* RootOutputHist     =nullptr;     // root file output histos
0071   TFile* RootInput          =nullptr;     // root file input 
0072   bool RunQA                  = false;    // Flag to run QA routine
0073   bool SaveCalibToFile        =false;     // Flag to save calib objects to text file
0074   short ExtPlot               =0;         // Enable extended plotting
0075   bool Overwrite              =false;     // Flag to overwrite outputs
0076   int debug                   =0;         // debug level 
0077   int yearData                =-1;        // data taking year externally set
0078   RootSetupWrapper rsw;                   // Wrapper singleton class for setup
0079   RootSetupWrapper* rswptr;               // Pointer to wrapper for singleton class for setup
0080   Setup* setup;                           // geometry setup
0081   Calib calib;                            // calibration object
0082   Calib* calibptr;                        // pointer to calib object
0083   Event event;
0084   Event* eventptr;
0085   
0086   TTree* TsetupIn=nullptr;
0087   TTree* TsetupOut=nullptr;
0088   TTree* TdataIn=nullptr;
0089   TTree* TdataOut=nullptr;
0090   TTree* TcalibIn=nullptr;
0091   TTree* TcalibOut=nullptr;
0092 
0093  protected:
0094 
0095 
0096  private:
0097   bool QAData(void);
0098  };
0099 
0100 
0101 #endif