]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TOF/AliTOFcalibHisto.h
Adding time delays (channel-by-channel) as an OCDB entry. Measured only once since...
[u/mrichter/AliRoot.git] / TOF / AliTOFcalibHisto.h
CommitLineData
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 *
3aaf7a5f 12 *
2cdf778a 13 * autors: Roberto Preghenella (R+)
14 * concacts: preghenella@bo.infn.it
15 *
16 *************************************************************************/
17
18#include "TObject.h"
19#include "TString.h"
20
97a29b32 21class TH1D;
2cdf778a 22class TFile;
23class AliESDtrack;
24
25class AliTOFcalibHisto :
26public 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,
97a29b32 41 kICdelayCorr,
42 kStripDelayCorr,
43 kIndexDelayCorr,
2cdf778a 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 {
0e095c11 57 /* main index */
58 kIndex,
2cdf778a 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,
97a29b32 89 kICdelayPar,
2cdf778a 90 kTRMdelayPar,
97a29b32 91 kStripDelayPar,
92 kIndexDelayPar,
2cdf778a 93 kTimeSlewingPar,
94 kNcalibPars
95 };
96
27e86428 97 enum ECalibStat_t {
98 kStripStat,
99 kNcalibStats
100 };
101
2cdf778a 102 private:
103
104 static TFile *fgCalibHistoFile; /* calib histo file */
105 static TFile *fgCalibParFile; /* calib par file */
27e86428 106 static TFile *fgCalibStatFile; /* calib stat file */
2cdf778a 107
108 static TString fgCalibHistoFileName; /* calib histo file name */
109 static TString fgCalibParFileName; /* calib par file name */
27e86428 110 static TString fgCalibStatFileName; /* calib par file name */
2cdf778a 111 static const TString fgkCalibConstName[kNcalibConsts]; // calib const name array */
112 static const TString fgkCalibMapName[kNcalibMaps]; // calib map name array */
113 static const TString fgkCalibParName[kNcalibPars]; // calib par name array */
27e86428 114 static const TString fgkCalibStatName[kNcalibStats]; // calib stat name array */
2cdf778a 115
97a29b32 116 static const Double_t fgkLHCperiod; /* LHC clock period */
117 static const Double_t fgkAmphenolCableDelay; /* Amphenol cable delay */
118 static const Double_t fgkFlatCableDelay; /* flat cable delay */
119 static const Double_t fgkInterfaceCardDelay; /* interface card delay */
2cdf778a 120
0e095c11 121 static const Int_t fgkNchannels; /* number of readout channels (DO) */
122 static const Int_t fgkNchannelsEO; /* number of readout channels (EO) */
2cdf778a 123 static const Int_t fgkDDLBCshift[72]; /* DDL BC shifts due to TTC fibers */
97a29b32 124 static const Double_t fgkFlatCableLength[91]; /* strip flat-cable length */
125 static const Double_t fgkInterfaceCardLength[48]; /* interface card length */
2cdf778a 126
9155334b 127 static Bool_t fgCableCorrectionFlag[kNcorrections]; // cable correction flag
128 static Bool_t fgFullCorrectionFlag[kNcorrections]; // full correction flag
129
27e86428 130 static const Int_t fgkStripStat[18][91]; // strip status
131
97a29b32 132 TH1D *fCalibConst[kNcalibConsts]; // calib const array
133 TH1D *fCalibMap[kNcalibMaps]; // calib map array
134 TH1D *fCalibPar[kNcalibPars]; // calib par array
27e86428 135 TH1D *fCalibStat[kNcalibStats]; // calib stat array
2cdf778a 136
137 /* methods */
97a29b32 138 void LoadHisto(TFile *file, TH1D **histo, const Char_t *name); /* create histo */
139 void CreateHisto(TH1D **histo, const Char_t *name, Int_t size); /* create histo */
140 void WriteHisto(TFile *file, TH1D *histo); /* write histo */
141 void SetHisto(TH1D *histo, Int_t index, Double_t value); /* set histo */
142 Double_t GetHisto(TH1D *histo, Int_t index); /* get histo */
2cdf778a 143
144 AliTOFcalibHisto(const AliTOFcalibHisto &source) : TObject(source) {}; /* copy constructor */
145 AliTOFcalibHisto &operator=(const AliTOFcalibHisto &) {return *this;}; /* operator= */
146
147 public:
148
149 AliTOFcalibHisto(); /* default constructor */
150 virtual ~AliTOFcalibHisto(); /* default destructor */
151
152 /* getters */
153 static const Char_t *GetCalibHistoFileName() {return fgCalibHistoFileName.Data();}; /* get calib histo file name */
154 static const Char_t *GetCalibParFileName() {return fgCalibParFileName.Data();}; /* get calib par file name */
27e86428 155 static const Char_t *GetCalibStatFileName() {return fgCalibStatFileName.Data();}; /* get calib stat file name */
2cdf778a 156
157 /* setters */
158 static void SetCalibHistoFileName(const Char_t *value) {fgCalibHistoFileName = value;}; /* set calib histo file name */
159 static void SetCalibParFileName(const Char_t *value) {fgCalibParFileName = value;}; /* set calib par file name */
27e86428 160 static void SetCalibStatFileName(const Char_t *value) {fgCalibStatFileName = value;}; /* set calib stat file name */
9155334b 161 static void SetCableCorrectionFlag(Int_t i, Bool_t flag) {if (i < kNcorrections) fgCableCorrectionFlag[i] = flag;}; // set cable correction flag
162 static void SetFullCorrectionFlag(Int_t i, Bool_t flag) {if (i < kNcorrections) fgFullCorrectionFlag[i] = flag;}; // set full correction flag
2cdf778a 163
164 /* methods */
a12e97fe 165 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 166 void LoadCalibHisto(); /* load calib histo */
167 void LoadCalibPar(); /* load calib par */
27e86428 168 void LoadCalibStat(); /* load calib stat */
2cdf778a 169 void WriteCalibHisto(); /* write calib histo */
27e86428 170 void WriteCalibStat(); /* write calib stat */
97a29b32 171 Double_t GetCalibConst(Int_t histo) {return GetHisto(fCalibConst[histo], 0);}; /* get calib const */
172 Double_t GetCalibMap(Int_t histo, Int_t index) {return GetHisto(fCalibMap[histo], index);}; /* get calib map */
173 Double_t GetCalibPar(Int_t histo, Int_t index) {return GetHisto(fCalibPar[histo], index);}; /* get calib par */
27e86428 174 Bool_t GetCalibStat(Int_t histo, Int_t index) {return GetHisto(fCalibStat[histo], index) != 0. ? kTRUE : kFALSE;}; /* get calib stat */
97a29b32 175 Double_t GetCorrection(Int_t corr, Int_t index, Double_t tot = 0.); /* get correction */
176 Double_t GetNominalCorrection(Int_t index); /* get nominal correction */
2cdf778a 177 void ApplyNominalCorrection(AliESDtrack *track); /* apply nominal corrections */
9155334b 178
97a29b32 179 Double_t GetCableCorrection(Int_t index); /* get cable correction */
180 Double_t GetFullCorrection(Int_t index, Double_t tot = 0.); /* get full correction */
27e86428 181
182 Bool_t GetStatus(Int_t index); /* get status */
2cdf778a 183
184 ClassDef(AliTOFcalibHisto, 1);
185
186};
187
188#endif /* ALITOFCALIBHISTO_H */