]>
Commit | Line | Data |
---|---|---|
2cdf778a | 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 { | |
0e095c11 | 53 | /* main index */ |
54 | kIndex, | |
2cdf778a | 55 | /* EO indices */ |
56 | kDDL, | |
57 | kTRM, | |
58 | kChain, | |
59 | kTDC, | |
60 | kChannel, | |
61 | /* DO indices */ | |
62 | kSector, | |
63 | kPlate, | |
64 | kStrip, | |
65 | kSectorStrip, | |
66 | kPadZ, | |
67 | kPadX, | |
68 | kPad, | |
69 | kInterfaceCardIndex, | |
70 | /* calib constants */ | |
71 | kDDLBCshift, | |
72 | kFlatCableLength, | |
73 | kInterfaceCardLength, | |
74 | kAmphenolCableLength, | |
75 | /* number of histos */ | |
76 | kNcalibMaps | |
77 | }; | |
78 | ||
79 | enum ECalibPar_t { | |
80 | kDDLdelayPar, | |
81 | kHPTDCdelayPar, | |
82 | kLeftFEAchDelayPar, | |
83 | kRightFEAchDelayPar, | |
84 | kFEAdelayPar, | |
85 | kTRMdelayPar, | |
86 | kTimeSlewingPar, | |
87 | kNcalibPars | |
88 | }; | |
89 | ||
90 | private: | |
91 | ||
92 | static TFile *fgCalibHistoFile; /* calib histo file */ | |
93 | static TFile *fgCalibParFile; /* calib par file */ | |
94 | ||
95 | static TString fgCalibHistoFileName; /* calib histo file name */ | |
96 | static TString fgCalibParFileName; /* calib par file name */ | |
97 | static const TString fgkCalibConstName[kNcalibConsts]; // calib const name array */ | |
98 | static const TString fgkCalibMapName[kNcalibMaps]; // calib map name array */ | |
99 | static const TString fgkCalibParName[kNcalibPars]; // calib par name array */ | |
100 | ||
101 | static const Float_t fgkLHCperiod; /* LHC clock period */ | |
102 | static const Float_t fgkAmphenolCableDelay; /* Amphenol cable delay */ | |
103 | static const Float_t fgkFlatCableDelay; /* flat cable delay */ | |
104 | static const Float_t fgkInterfaceCardDelay; /* interface card delay */ | |
105 | ||
0e095c11 | 106 | static const Int_t fgkNchannels; /* number of readout channels (DO) */ |
107 | static const Int_t fgkNchannelsEO; /* number of readout channels (EO) */ | |
2cdf778a | 108 | static const Int_t fgkDDLBCshift[72]; /* DDL BC shifts due to TTC fibers */ |
109 | static const Float_t fgkFlatCableLength[91]; /* strip flat-cable length */ | |
110 | static const Float_t fgkInterfaceCardLength[48]; /* interface card length */ | |
111 | ||
112 | TH1F *fCalibConst[kNcalibConsts]; // calib const array | |
113 | TH1F *fCalibMap[kNcalibMaps]; // calib map array | |
114 | TH1F *fCalibPar[kNcalibPars]; // calib par array | |
115 | ||
116 | /* methods */ | |
117 | void LoadHisto(TFile *file, TH1F **histo, const Char_t *name); /* create histo */ | |
118 | void CreateHisto(TH1F **histo, const Char_t *name, Int_t size); /* create histo */ | |
119 | void WriteHisto(TFile *file, TH1F *histo); /* write histo */ | |
120 | void SetHisto(TH1F *histo, Int_t index, Float_t value); /* set histo */ | |
121 | Float_t GetHisto(TH1F *histo, Int_t index); /* get histo */ | |
122 | ||
123 | AliTOFcalibHisto(const AliTOFcalibHisto &source) : TObject(source) {}; /* copy constructor */ | |
124 | AliTOFcalibHisto &operator=(const AliTOFcalibHisto &) {return *this;}; /* operator= */ | |
125 | ||
126 | public: | |
127 | ||
128 | AliTOFcalibHisto(); /* default constructor */ | |
129 | virtual ~AliTOFcalibHisto(); /* default destructor */ | |
130 | ||
131 | /* getters */ | |
132 | static const Char_t *GetCalibHistoFileName() {return fgCalibHistoFileName.Data();}; /* get calib histo file name */ | |
133 | static const Char_t *GetCalibParFileName() {return fgCalibParFileName.Data();}; /* get calib par file name */ | |
134 | ||
135 | /* setters */ | |
136 | static void SetCalibHistoFileName(const Char_t *value) {fgCalibHistoFileName = value;}; /* set calib histo file name */ | |
137 | static void SetCalibParFileName(const Char_t *value) {fgCalibParFileName = value;}; /* set calib par file name */ | |
138 | ||
139 | /* methods */ | |
a12e97fe | 140 | static Int_t GetIndexEO(Int_t ddl, Int_t trm, Int_t chain, Int_t tdc, Int_t channel) {return (channel + 8 * tdc + 120 * chain + 240 * trm + 2400 * ddl);}; /* get index EO */ |
2cdf778a | 141 | void LoadCalibHisto(); /* load calib histo */ |
142 | void LoadCalibPar(); /* load calib par */ | |
143 | void WriteCalibHisto(); /* write calib histo */ | |
144 | Float_t GetCalibConst(Int_t histo) {return GetHisto(fCalibConst[histo], 0);}; /* get calib const */ | |
145 | Float_t GetCalibMap(Int_t histo, Int_t index) {return GetHisto(fCalibMap[histo], index);}; /* get calib map */ | |
146 | Float_t GetCalibPar(Int_t histo, Int_t index) {return GetHisto(fCalibPar[histo], index);}; /* get calib par */ | |
147 | Float_t GetCorrection(Int_t corr, Int_t index, Float_t tot = 0.); /* get correction */ | |
148 | Float_t GetNominalCorrection(Int_t index); /* get nominal correction */ | |
149 | void ApplyNominalCorrection(AliESDtrack *track); /* apply nominal corrections */ | |
150 | ||
151 | ClassDef(AliTOFcalibHisto, 1); | |
152 | ||
153 | }; | |
154 | ||
155 | #endif /* ALITOFCALIBHISTO_H */ |