]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFcalibHisto.h
Added AliTOFcalibHisto class to handle calibration information
[u/mrichter/AliRoot.git] / TOF / AliTOFcalibHisto.h
1 #ifndef ALITOFCALIBHISTO_H
2 #define ALITOFCALIBHISTO_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 /*************************************************************************
8  *
9  * AliTOFcalibHisto - class to handle TOF calibration histograms,
10  *                    map histograms and more
11  *
12  * autors:   Roberto Preghenella (R+)
13  * concacts: preghenella@bo.infn.it
14  *
15  *************************************************************************/
16
17 #include "TObject.h"
18 #include "TString.h"
19
20 class TH1F;
21 class TFile;
22 class AliESDtrack;
23
24 class AliTOFcalibHisto :
25 public TObject
26 {
27
28  public:
29
30   enum ECorrection_t {
31     kDDLBCcorr,
32     kAmphenolCableCorr,
33     kFlatCableCorr,
34     kInterfaceCardCorr,
35     kDDLdelayCorr,
36     kHPTDCdelayCorr,
37     kFEAchDelayCorr,
38     kFEAdelayCorr,
39     kTRMdelayCorr,
40     kTimeSlewingCorr,
41     kNcorrections
42   };
43   
44   enum ECalibConst_t {
45     kLHCperiod,
46     kAmphenolCableDelay,
47     kFlatCableDelay,
48     kInterfaceCardDelay,
49     kNcalibConsts
50   };
51
52   enum ECalibMap_t {
53     /* EO indices */
54     kDDL, 
55     kTRM, 
56     kChain, 
57     kTDC, 
58     kChannel, 
59     /* DO indices */
60     kSector, 
61     kPlate, 
62     kStrip, 
63     kSectorStrip, 
64     kPadZ, 
65     kPadX, 
66     kPad,
67     kInterfaceCardIndex,
68     /* calib constants */
69     kDDLBCshift,
70     kFlatCableLength,
71     kInterfaceCardLength,
72     kAmphenolCableLength,
73     /* number of histos */
74     kNcalibMaps
75   };
76
77   enum ECalibPar_t {
78     kDDLdelayPar,
79     kHPTDCdelayPar,
80     kLeftFEAchDelayPar,
81     kRightFEAchDelayPar,
82     kFEAdelayPar,
83     kTRMdelayPar,
84     kTimeSlewingPar,
85     kNcalibPars
86   };
87
88  private:
89
90   static TFile *fgCalibHistoFile; /* calib histo file */
91   static TFile *fgCalibParFile; /* calib par file */
92
93   static TString fgCalibHistoFileName; /* calib histo file name */
94   static TString fgCalibParFileName; /* calib par file name */
95   static const TString fgkCalibConstName[kNcalibConsts]; // calib const name array */
96   static const TString fgkCalibMapName[kNcalibMaps]; // calib map name array */
97   static const TString fgkCalibParName[kNcalibPars]; // calib par name array */
98
99   static const Float_t fgkLHCperiod; /* LHC clock period */
100   static const Float_t fgkAmphenolCableDelay; /* Amphenol cable delay */
101   static const Float_t fgkFlatCableDelay; /* flat cable delay */
102   static const Float_t fgkInterfaceCardDelay; /* interface card delay */
103
104   static const Int_t fgkNchannels; /* number of readout channels */
105   static const Int_t fgkDDLBCshift[72]; /* DDL BC shifts due to TTC fibers */
106   static const Float_t fgkFlatCableLength[91]; /* strip flat-cable length */
107   static const Float_t fgkInterfaceCardLength[48]; /* interface card length */
108
109   TH1F *fCalibConst[kNcalibConsts]; // calib const array
110   TH1F *fCalibMap[kNcalibMaps]; // calib map array
111   TH1F *fCalibPar[kNcalibPars]; // calib par array
112
113   /* methods */
114   void LoadHisto(TFile *file, TH1F **histo, const Char_t *name); /* create histo */
115   void CreateHisto(TH1F **histo, const Char_t *name, Int_t size); /* create histo */
116   void WriteHisto(TFile *file, TH1F *histo); /* write histo */
117   void SetHisto(TH1F *histo, Int_t index, Float_t value); /* set histo */
118   Float_t GetHisto(TH1F *histo, Int_t index); /* get histo */
119   
120   AliTOFcalibHisto(const AliTOFcalibHisto &source) : TObject(source) {}; /* copy constructor */
121   AliTOFcalibHisto &operator=(const AliTOFcalibHisto &) {return *this;}; /* operator= */
122
123  public:
124
125   AliTOFcalibHisto(); /* default constructor */
126   virtual ~AliTOFcalibHisto(); /* default destructor */
127
128   /* getters */
129   static const Char_t *GetCalibHistoFileName() {return fgCalibHistoFileName.Data();}; /* get calib histo file name */
130   static const Char_t *GetCalibParFileName() {return fgCalibParFileName.Data();}; /* get calib par file name */
131
132   /* setters */
133   static void SetCalibHistoFileName(const Char_t *value) {fgCalibHistoFileName = value;}; /* set calib histo file name */
134   static void SetCalibParFileName(const Char_t *value) {fgCalibParFileName = value;}; /* set calib par file name */
135
136   /* methods */
137   void LoadCalibHisto(); /* load calib histo */
138   void LoadCalibPar(); /* load calib par */
139   void WriteCalibHisto(); /* write calib histo */
140   Float_t GetCalibConst(Int_t histo) {return GetHisto(fCalibConst[histo], 0);}; /* get calib const */
141   Float_t GetCalibMap(Int_t histo, Int_t index) {return GetHisto(fCalibMap[histo], index);}; /* get calib map */
142   Float_t GetCalibPar(Int_t histo, Int_t index) {return GetHisto(fCalibPar[histo], index);}; /* get calib par */
143   Float_t GetCorrection(Int_t corr, Int_t index, Float_t tot = 0.); /* get correction */
144   Float_t GetNominalCorrection(Int_t index); /* get nominal correction */
145   void ApplyNominalCorrection(AliESDtrack *track); /* apply nominal corrections */
146   
147   ClassDef(AliTOFcalibHisto, 1);
148   
149 };
150
151 #endif /* ALITOFCALIBHISTO_H */