StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMtdCalibMaker.h
1 #ifndef STMTDCALIMAKER_H
2 #define STMTDCALIMAKER_H
3 
4 /***************************************************************************
5  *
6  * $Id: StMtdCalibMaker.h,v 1.3 2016/07/27 15:17:19 marr Exp $
7  * StMtdCalibMaker - class to in inplement Mtd related Calibration paraments
8  * Author: Xinjie Huang
9  *--------------------------------------------------------------------------
10  *
11  ***************************************************************************/
12 #include "TMath.h"
13 #include "StMaker.h"
14 
15 #include <string>
16 #include <vector>
17 #ifndef ST_NO_NAMESPACES
18 using std::string;
19 using std::vector;
20 #endif
21 class TH1F;
22 class TH1D;
23 class TH2F;
24 class TFile;
25 class StEvent;
26 class StMuDst;
27 
28 class StMtdCalibMaker : public StMaker{
29  public:
30  StMtdCalibMaker(const char* name="mtdCalib");
31  virtual ~StMtdCalibMaker();
32 
33  virtual Int_t Init();
34  virtual Int_t InitRun(Int_t);
35  virtual Int_t Make();
36 
37  void setSlewingCorr(Bool_t val=kTRUE);
38  void setDebug(Bool_t val=kFALSE);
39  void setUseTriggercut(Bool_t val=kTRUE);
40  void setCreateHistoFlag(Bool_t histos=kTRUE);
41  void setInitFromFile(Bool_t val=kTRUE);
42 
44  void setCalibFileTot(const Char_t*);
45  void setCalibFileT0(const Char_t*);
46  void setCalibFileDy(const Char_t*);
47  void setCalibFileDz(const Char_t*);
48  void setCalibFileTrigger(const Char_t*);
49 
50  protected:
51  void processStEvent();
52  void processMuDst();
54  Double_t mtdAllCorr(const Double_t tot, const Int_t iBackleg, const Int_t iModule, const Int_t iCell);
55  void bookHistograms();
56 
57  private:
58  enum{
59  mNBackleg = 30, // 30 Backlegs
60  mNModule = 5, // 5 Modules for each Backlegs
61  mNCell = 12, // 12 cells per module
62  mNBinMax = 20 // 20 bins for T-Tot correction and Triggercut
63  };
64 
65  Double_t mMtdT0Corr[mNBackleg][mNModule][mNCell]; // T0 offset
66  Double_t mMtdTotCorr[mNBackleg][mNModule][mNBinMax]; // Slewing correction
67  Double_t mMtdTotEdge[mNBackleg][mNModule][mNBinMax]; // Slewing correction bin edges
68  Double_t mMtdDyCorr[mNBackleg][mNModule]; // dy correction for each module
69  Double_t mMtdDzCorr[mNBackleg][mNModule][mNCell]; // dz correction for each cell
70  Double_t mTriggerHighEdge[mNBackleg][mNModule]; // Lower edge of trigger time cut
71  Double_t mTriggerLowEdge[mNBackleg][mNModule]; // Upper edge of trigger time cut
72 
73  StEvent* mStEvent;
74  StMuDst* mMuDst;
75  Bool_t mDebug; // switch to debug mod
76  Bool_t mHisto; // switch to fill QA histograms
77  Bool_t mUseTriggercut; // switch for use trigger cut
78  Bool_t mInitFromFile; // switch for reading from files
79  string mCalibFileTot; // filename for ToT calibration parameters
80  string mCalibFileT0; // filename for T0 calibration parameters
81  string mCalibFileDy; // filename for dy position correction parameters
82  string mCalibFileDz; // filename for dz position correction parameters
83  string mCalibFileTrigger; // filename for Triggercut calibration parameters
84 
85  TH1D *hTimeOfFlightCorr; // histo of TimeOfFlight before correction
86  TH1D *hAllCorr; // All correction distribution
87  TH2F *hTimeOfFlightModule; // TimeOfFlight vs Module
88  TH2F *hTimeOfFlightCorrModule; // TimeOfFlight correction vs Module
89  TH2F *hTriggerTimeBL; // TriggerTime vs backleg plot
90  TH2F *hVertexzVsTpcz; // Vertexz Vs Tpcz
91  TH2F *hTOFTimeOfFlightTray; // TOF TimeOfFlight vs Tray
92  TH2F *hDyModule; // Dy vs Module
93  TH2F *hDzModule; // Dz vs Module
94 
95  virtual const Char_t *GetCVS() const
96  {
97  static const char cvs[]="Tag $Name: $Id: built " __DATE__ " " __TIME__ ; return cvs;
98  }
99 
100  ClassDef(StMtdCalibMaker,0);
101 };
102 inline void StMtdCalibMaker::setUseTriggercut(const Bool_t val) { mUseTriggercut = val; }
103 inline void StMtdCalibMaker::setDebug(const Bool_t val) { mDebug = val; }
104 inline void StMtdCalibMaker::setCreateHistoFlag(Bool_t histos) { mHisto = histos; }
105 inline void StMtdCalibMaker::setInitFromFile(const Bool_t val) { mInitFromFile = val; }
106 inline void StMtdCalibMaker::setCalibFileTot(const Char_t* filename) { mCalibFileTot = filename; }
107 inline void StMtdCalibMaker::setCalibFileT0(const Char_t* filename) { mCalibFileT0 = filename; }
108 inline void StMtdCalibMaker::setCalibFileDy(const Char_t* filename) { mCalibFileDy = filename; }
109 inline void StMtdCalibMaker::setCalibFileDz(const Char_t* filename) { mCalibFileDz = filename; }
110 inline void StMtdCalibMaker::setCalibFileTrigger(const Char_t* filename) { mCalibFileTrigger = filename; }
111 #endif
virtual Int_t Make()
void setCalibFileTot(const Char_t *)
set input source
void setUseTriggercut(Bool_t val=kTRUE)
switch to run in debug mod
Double_t mtdAllCorr(const Double_t tot, const Int_t iBackleg, const Int_t iModule, const Int_t iCell)
Caculate all the correction value for time of flight.
virtual Int_t Init()
Destructor.
void setInitFromFile(Bool_t val=kTRUE)
enable QA histogram filling
virtual ~StMtdCalibMaker()
Default constructor.
void setDebug(Bool_t val=kFALSE)
switch to turn on slewing correction or not - maybe only T0 in the first step.
StMtdCalibMaker(const char *name="mtdCalib")
void setCreateHistoFlag(Bool_t histos=kTRUE)
switch to use trigger cut