Line data Source code
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 : // *
13 : // * autors: Roberto Preghenella (R+)
14 : // * concacts: preghenella@bo.infn.it
15 : // *
16 : // *
17 :
18 : #include "TObject.h"
19 : #include "TString.h"
20 :
21 : class TH1D;
22 : class TFile;
23 : class AliESDtrack;
24 :
25 : class AliTOFcalibHisto :
26 : public TObject
27 : {
28 :
29 : public:
30 :
31 : enum ECorrection_t {
32 : kDDLBCcorr,
33 : kAmphenolCableCorr,
34 : kFlatCableCorr,
35 : kInterfaceCardCorr,
36 : kDDLdelayCorr,
37 : kHPTDCdelayCorr,
38 : kFEAchDelayCorr,
39 : kFEAdelayCorr,
40 : kTRMdelayCorr,
41 : kICdelayCorr,
42 : kStripDelayCorr,
43 : kIndexDelayCorr,
44 : kTimeSlewingCorr,
45 : kNcorrections
46 : };
47 :
48 : enum ECalibConst_t {
49 : kLHCperiod,
50 : kAmphenolCableDelay,
51 : kFlatCableDelay,
52 : kInterfaceCardDelay,
53 : kNcalibConsts
54 : };
55 :
56 : enum ECalibMap_t {
57 : /* main index */
58 : kIndex,
59 : /* EO indices */
60 : kDDL,
61 : kTRM,
62 : kChain,
63 : kTDC,
64 : kChannel,
65 : /* DO indices */
66 : kSector,
67 : kPlate,
68 : kStrip,
69 : kSectorStrip,
70 : kPadZ,
71 : kPadX,
72 : kPad,
73 : kInterfaceCardIndex,
74 : /* calib constants */
75 : kDDLBCshift,
76 : kFlatCableLength,
77 : kInterfaceCardLength,
78 : kAmphenolCableLength,
79 : /* number of histos */
80 : kNcalibMaps
81 : };
82 :
83 : enum ECalibPar_t {
84 : kDDLdelayPar,
85 : kHPTDCdelayPar,
86 : kLeftFEAchDelayPar,
87 : kRightFEAchDelayPar,
88 : kFEAdelayPar,
89 : kICdelayPar,
90 : kTRMdelayPar,
91 : kStripDelayPar,
92 : kIndexDelayPar,
93 : kTimeSlewingPar,
94 : kNcalibPars
95 : };
96 :
97 : enum ECalibStat_t {
98 : kStripStat,
99 : kNcalibStats
100 : };
101 :
102 : AliTOFcalibHisto(); /* default constructor */
103 : virtual ~AliTOFcalibHisto(); /* default destructor */
104 :
105 : /* getters */
106 0 : static const Char_t *GetCalibHistoFileName() {return fgCalibHistoFileName.Data();}; /* get calib histo file name */
107 0 : static const Char_t *GetCalibParFileName() {return fgCalibParFileName.Data();}; /* get calib par file name */
108 0 : static const Char_t *GetCalibStatFileName() {return fgCalibStatFileName.Data();}; /* get calib stat file name */
109 :
110 : /* setters */
111 0 : static void SetCalibHistoFileName(const Char_t *value) {fgCalibHistoFileName = value;}; /* set calib histo file name */
112 0 : static void SetCalibParFileName(const Char_t *value) {fgCalibParFileName = value;}; /* set calib par file name */
113 0 : static void SetCalibStatFileName(const Char_t *value) {fgCalibStatFileName = value;}; /* set calib stat file name */
114 0 : static void SetCableCorrectionFlag(Int_t i, Bool_t flag) {if (i < kNcorrections) fgCableCorrectionFlag[i] = flag;}; // set cable correction flag
115 0 : static void SetFullCorrectionFlag(Int_t i, Bool_t flag) {if (i < kNcorrections) fgFullCorrectionFlag[i] = flag;}; // set full correction flag
116 :
117 : /* methods */
118 0 : 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 */
119 : void LoadCalibHisto(); /* load calib histo */
120 : void LoadCalibPar(); /* load calib par */
121 : void LoadCalibStat(); /* load calib stat */
122 : void WriteCalibHisto(); /* write calib histo */
123 : void WriteCalibStat(); /* write calib stat */
124 0 : Double_t GetCalibConst(Int_t histo) {return GetHisto(fCalibConst[histo], 0);}; /* get calib const */
125 0 : Double_t GetCalibMap(Int_t histo, Int_t index) {return GetHisto(fCalibMap[histo], index);}; /* get calib map */
126 0 : Double_t GetCalibPar(Int_t histo, Int_t index) {return GetHisto(fCalibPar[histo], index);}; /* get calib par */
127 0 : Bool_t GetCalibStat(Int_t histo, Int_t index) {return GetHisto(fCalibStat[histo], index) != 0. ? kTRUE : kFALSE;}; /* get calib stat */
128 : Double_t GetCorrection(Int_t corr, Int_t index, Double_t tot = 0.); /* get correction */
129 : Double_t GetNominalCorrection(Int_t index); /* get nominal correction */
130 : void ApplyNominalCorrection(AliESDtrack *track); /* apply nominal corrections */
131 :
132 : Double_t GetCableCorrection(Int_t index); /* get cable correction */
133 : Double_t GetFullCorrection(Int_t index, Double_t tot = 0.); /* get full correction */
134 :
135 : Bool_t GetStatus(Int_t index); /* get status */
136 :
137 : private:
138 :
139 : static TFile *fgCalibHistoFile; /* calib histo file */
140 : static TFile *fgCalibParFile; /* calib par file */
141 : static TFile *fgCalibStatFile; /* calib stat file */
142 :
143 : static TString fgCalibHistoFileName; /* calib histo file name */
144 : static TString fgCalibParFileName; /* calib par file name */
145 : static TString fgCalibStatFileName; /* calib par file name */
146 : static const TString fgkCalibConstName[kNcalibConsts]; // calib const name array */
147 : static const TString fgkCalibMapName[kNcalibMaps]; // calib map name array */
148 : static const TString fgkCalibParName[kNcalibPars]; // calib par name array */
149 : static const TString fgkCalibStatName[kNcalibStats]; // calib stat name array */
150 :
151 : static const Double_t fgkLHCperiod; /* LHC clock period */
152 : static const Double_t fgkAmphenolCableDelay; /* Amphenol cable delay */
153 : static const Double_t fgkFlatCableDelay; /* flat cable delay */
154 : static const Double_t fgkInterfaceCardDelay; /* interface card delay */
155 :
156 : static const Int_t fgkNchannels; /* number of readout channels (DO) */
157 : static const Int_t fgkNchannelsEO; /* number of readout channels (EO) */
158 : static const Int_t fgkDDLBCshift[72]; /* DDL BC shifts due to TTC fibers */
159 : static const Double_t fgkFlatCableLength[91]; /* strip flat-cable length */
160 : static const Double_t fgkInterfaceCardLength[48]; /* interface card length */
161 :
162 : static Bool_t fgCableCorrectionFlag[kNcorrections]; // cable correction flag
163 : static Bool_t fgFullCorrectionFlag[kNcorrections]; // full correction flag
164 :
165 : static const Int_t fgkStripStat[18][91]; // strip status
166 :
167 : TH1D *fCalibConst[kNcalibConsts]; // calib const array
168 : TH1D *fCalibMap[kNcalibMaps]; // calib map array
169 : TH1D *fCalibPar[kNcalibPars]; // calib par array
170 : TH1D *fCalibStat[kNcalibStats]; // calib stat array
171 :
172 : /* methods */
173 : void LoadHisto(TFile * const file, TH1D **histo, const Char_t *name); /* create histo */
174 : void CreateHisto(TH1D **histo, const Char_t *name, Int_t size); /* create histo */
175 : void WriteHisto(TFile *file, TH1D *histo); /* write histo */
176 : void SetHisto(TH1D *histo, Int_t index, Double_t value); /* set histo */
177 : Double_t GetHisto(TH1D *histo, Int_t index); /* get histo */
178 :
179 : AliTOFcalibHisto(const AliTOFcalibHisto &source) : TObject(source) {}; /* copy constructor */
180 : AliTOFcalibHisto &operator=(const AliTOFcalibHisto &) {return *this;}; /* operator= */
181 :
182 26 : ClassDef(AliTOFcalibHisto, 1);
183 :
184 : };
185 :
186 : #endif /* ALITOFCALIBHISTO_H */
|