1 #ifndef ALITOFCALIBHISTO_H
2 #define ALITOFCALIBHISTO_H
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
7 /*************************************************************************
9 * AliTOFcalibHisto - class to handle TOF calibration histograms,
10 * map histograms and more
13 * autors: Roberto Preghenella (R+)
14 * concacts: preghenella@bo.infn.it
16 *************************************************************************/
25 class AliTOFcalibHisto :
79 /* number of histos */
104 static TFile *fgCalibHistoFile; /* calib histo file */
105 static TFile *fgCalibParFile; /* calib par file */
106 static TFile *fgCalibStatFile; /* calib stat file */
108 static TString fgCalibHistoFileName; /* calib histo file name */
109 static TString fgCalibParFileName; /* calib par file name */
110 static TString fgCalibStatFileName; /* calib par file name */
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 */
114 static const TString fgkCalibStatName[kNcalibStats]; // calib stat name array */
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 */
121 static const Int_t fgkNchannels; /* number of readout channels (DO) */
122 static const Int_t fgkNchannelsEO; /* number of readout channels (EO) */
123 static const Int_t fgkDDLBCshift[72]; /* DDL BC shifts due to TTC fibers */
124 static const Double_t fgkFlatCableLength[91]; /* strip flat-cable length */
125 static const Double_t fgkInterfaceCardLength[48]; /* interface card length */
127 static Bool_t fgCableCorrectionFlag[kNcorrections]; // cable correction flag
128 static Bool_t fgFullCorrectionFlag[kNcorrections]; // full correction flag
130 static const Int_t fgkStripStat[18][91]; // strip status
132 TH1D *fCalibConst[kNcalibConsts]; // calib const array
133 TH1D *fCalibMap[kNcalibMaps]; // calib map array
134 TH1D *fCalibPar[kNcalibPars]; // calib par array
135 TH1D *fCalibStat[kNcalibStats]; // calib stat array
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 */
144 AliTOFcalibHisto(const AliTOFcalibHisto &source) : TObject(source) {}; /* copy constructor */
145 AliTOFcalibHisto &operator=(const AliTOFcalibHisto &) {return *this;}; /* operator= */
149 AliTOFcalibHisto(); /* default constructor */
150 virtual ~AliTOFcalibHisto(); /* default destructor */
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 */
155 static const Char_t *GetCalibStatFileName() {return fgCalibStatFileName.Data();}; /* get calib stat file name */
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 */
160 static void SetCalibStatFileName(const Char_t *value) {fgCalibStatFileName = value;}; /* set calib stat file name */
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
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 */
166 void LoadCalibHisto(); /* load calib histo */
167 void LoadCalibPar(); /* load calib par */
168 void LoadCalibStat(); /* load calib stat */
169 void WriteCalibHisto(); /* write calib histo */
170 void WriteCalibStat(); /* write calib stat */
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 */
174 Bool_t GetCalibStat(Int_t histo, Int_t index) {return GetHisto(fCalibStat[histo], index) != 0. ? kTRUE : kFALSE;}; /* get calib stat */
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 */
177 void ApplyNominalCorrection(AliESDtrack *track); /* apply nominal corrections */
179 Double_t GetCableCorrection(Int_t index); /* get cable correction */
180 Double_t GetFullCorrection(Int_t index, Double_t tot = 0.); /* get full correction */
182 Bool_t GetStatus(Int_t index); /* get status */
184 ClassDef(AliTOFcalibHisto, 1);
188 #endif /* ALITOFCALIBHISTO_H */