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 */
99 static TFile *fgCalibHistoFile; /* calib histo file */
100 static TFile *fgCalibParFile; /* calib par file */
102 static TString fgCalibHistoFileName; /* calib histo file name */
103 static TString fgCalibParFileName; /* calib par file name */
104 static const TString fgkCalibConstName[kNcalibConsts]; // calib const name array */
105 static const TString fgkCalibMapName[kNcalibMaps]; // calib map name array */
106 static const TString fgkCalibParName[kNcalibPars]; // calib par name array */
108 static const Double_t fgkLHCperiod; /* LHC clock period */
109 static const Double_t fgkAmphenolCableDelay; /* Amphenol cable delay */
110 static const Double_t fgkFlatCableDelay; /* flat cable delay */
111 static const Double_t fgkInterfaceCardDelay; /* interface card delay */
113 static const Int_t fgkNchannels; /* number of readout channels (DO) */
114 static const Int_t fgkNchannelsEO; /* number of readout channels (EO) */
115 static const Int_t fgkDDLBCshift[72]; /* DDL BC shifts due to TTC fibers */
116 static const Double_t fgkFlatCableLength[91]; /* strip flat-cable length */
117 static const Double_t fgkInterfaceCardLength[48]; /* interface card length */
119 static Bool_t fgCableCorrectionFlag[kNcorrections]; // cable correction flag
120 static Bool_t fgFullCorrectionFlag[kNcorrections]; // full correction flag
122 TH1D *fCalibConst[kNcalibConsts]; // calib const array
123 TH1D *fCalibMap[kNcalibMaps]; // calib map array
124 TH1D *fCalibPar[kNcalibPars]; // calib par array
127 void LoadHisto(TFile *file, TH1D **histo, const Char_t *name); /* create histo */
128 void CreateHisto(TH1D **histo, const Char_t *name, Int_t size); /* create histo */
129 void WriteHisto(TFile *file, TH1D *histo); /* write histo */
130 void SetHisto(TH1D *histo, Int_t index, Double_t value); /* set histo */
131 Double_t GetHisto(TH1D *histo, Int_t index); /* get histo */
133 AliTOFcalibHisto(const AliTOFcalibHisto &source) : TObject(source) {}; /* copy constructor */
134 AliTOFcalibHisto &operator=(const AliTOFcalibHisto &) {return *this;}; /* operator= */
138 AliTOFcalibHisto(); /* default constructor */
139 virtual ~AliTOFcalibHisto(); /* default destructor */
142 static const Char_t *GetCalibHistoFileName() {return fgCalibHistoFileName.Data();}; /* get calib histo file name */
143 static const Char_t *GetCalibParFileName() {return fgCalibParFileName.Data();}; /* get calib par file name */
146 static void SetCalibHistoFileName(const Char_t *value) {fgCalibHistoFileName = value;}; /* set calib histo file name */
147 static void SetCalibParFileName(const Char_t *value) {fgCalibParFileName = value;}; /* set calib par file name */
148 static void SetCableCorrectionFlag(Int_t i, Bool_t flag) {if (i < kNcorrections) fgCableCorrectionFlag[i] = flag;}; // set cable correction flag
149 static void SetFullCorrectionFlag(Int_t i, Bool_t flag) {if (i < kNcorrections) fgFullCorrectionFlag[i] = flag;}; // set full correction flag
152 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 */
153 void LoadCalibHisto(); /* load calib histo */
154 void LoadCalibPar(); /* load calib par */
155 void WriteCalibHisto(); /* write calib histo */
156 Double_t GetCalibConst(Int_t histo) {return GetHisto(fCalibConst[histo], 0);}; /* get calib const */
157 Double_t GetCalibMap(Int_t histo, Int_t index) {return GetHisto(fCalibMap[histo], index);}; /* get calib map */
158 Double_t GetCalibPar(Int_t histo, Int_t index) {return GetHisto(fCalibPar[histo], index);}; /* get calib par */
159 Double_t GetCorrection(Int_t corr, Int_t index, Double_t tot = 0.); /* get correction */
160 Double_t GetNominalCorrection(Int_t index); /* get nominal correction */
161 void ApplyNominalCorrection(AliESDtrack *track); /* apply nominal corrections */
163 Double_t GetCableCorrection(Int_t index); /* get cable correction */
164 Double_t GetFullCorrection(Int_t index, Double_t tot = 0.); /* get full correction */
166 ClassDef(AliTOFcalibHisto, 1);
170 #endif /* ALITOFCALIBHISTO_H */