]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TOF/AliTOFcalibHisto.h
Extra library EMCALUtils needed for particle correlations task.
[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
21class TH1F;
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,
41 kTimeSlewingCorr,
42 kNcorrections
43 };
44
45 enum ECalibConst_t {
46 kLHCperiod,
47 kAmphenolCableDelay,
48 kFlatCableDelay,
49 kInterfaceCardDelay,
50 kNcalibConsts
51 };
52
53 enum ECalibMap_t {
0e095c11 54 /* main index */
55 kIndex,
2cdf778a 56 /* EO indices */
57 kDDL,
58 kTRM,
59 kChain,
60 kTDC,
61 kChannel,
62 /* DO indices */
63 kSector,
64 kPlate,
65 kStrip,
66 kSectorStrip,
67 kPadZ,
68 kPadX,
69 kPad,
70 kInterfaceCardIndex,
71 /* calib constants */
72 kDDLBCshift,
73 kFlatCableLength,
74 kInterfaceCardLength,
75 kAmphenolCableLength,
76 /* number of histos */
77 kNcalibMaps
78 };
79
80 enum ECalibPar_t {
81 kDDLdelayPar,
82 kHPTDCdelayPar,
83 kLeftFEAchDelayPar,
84 kRightFEAchDelayPar,
85 kFEAdelayPar,
86 kTRMdelayPar,
87 kTimeSlewingPar,
88 kNcalibPars
89 };
90
91 private:
92
93 static TFile *fgCalibHistoFile; /* calib histo file */
94 static TFile *fgCalibParFile; /* calib par file */
95
96 static TString fgCalibHistoFileName; /* calib histo file name */
97 static TString fgCalibParFileName; /* calib par file name */
98 static const TString fgkCalibConstName[kNcalibConsts]; // calib const name array */
99 static const TString fgkCalibMapName[kNcalibMaps]; // calib map name array */
100 static const TString fgkCalibParName[kNcalibPars]; // calib par name array */
101
102 static const Float_t fgkLHCperiod; /* LHC clock period */
103 static const Float_t fgkAmphenolCableDelay; /* Amphenol cable delay */
104 static const Float_t fgkFlatCableDelay; /* flat cable delay */
105 static const Float_t fgkInterfaceCardDelay; /* interface card delay */
106
0e095c11 107 static const Int_t fgkNchannels; /* number of readout channels (DO) */
108 static const Int_t fgkNchannelsEO; /* number of readout channels (EO) */
2cdf778a 109 static const Int_t fgkDDLBCshift[72]; /* DDL BC shifts due to TTC fibers */
110 static const Float_t fgkFlatCableLength[91]; /* strip flat-cable length */
111 static const Float_t fgkInterfaceCardLength[48]; /* interface card length */
112
9155334b 113 static Bool_t fgCableCorrectionFlag[kNcorrections]; // cable correction flag
114 static Bool_t fgFullCorrectionFlag[kNcorrections]; // full correction flag
115
2cdf778a 116 TH1F *fCalibConst[kNcalibConsts]; // calib const array
117 TH1F *fCalibMap[kNcalibMaps]; // calib map array
118 TH1F *fCalibPar[kNcalibPars]; // calib par array
119
120 /* methods */
121 void LoadHisto(TFile *file, TH1F **histo, const Char_t *name); /* create histo */
122 void CreateHisto(TH1F **histo, const Char_t *name, Int_t size); /* create histo */
123 void WriteHisto(TFile *file, TH1F *histo); /* write histo */
124 void SetHisto(TH1F *histo, Int_t index, Float_t value); /* set histo */
125 Float_t GetHisto(TH1F *histo, Int_t index); /* get histo */
126
127 AliTOFcalibHisto(const AliTOFcalibHisto &source) : TObject(source) {}; /* copy constructor */
128 AliTOFcalibHisto &operator=(const AliTOFcalibHisto &) {return *this;}; /* operator= */
129
130 public:
131
132 AliTOFcalibHisto(); /* default constructor */
133 virtual ~AliTOFcalibHisto(); /* default destructor */
134
135 /* getters */
136 static const Char_t *GetCalibHistoFileName() {return fgCalibHistoFileName.Data();}; /* get calib histo file name */
137 static const Char_t *GetCalibParFileName() {return fgCalibParFileName.Data();}; /* get calib par file name */
138
139 /* setters */
140 static void SetCalibHistoFileName(const Char_t *value) {fgCalibHistoFileName = value;}; /* set calib histo file name */
141 static void SetCalibParFileName(const Char_t *value) {fgCalibParFileName = value;}; /* set calib par file name */
9155334b 142 static void SetCableCorrectionFlag(Int_t i, Bool_t flag) {if (i < kNcorrections) fgCableCorrectionFlag[i] = flag;}; // set cable correction flag
143 static void SetFullCorrectionFlag(Int_t i, Bool_t flag) {if (i < kNcorrections) fgFullCorrectionFlag[i] = flag;}; // set full correction flag
2cdf778a 144
145 /* methods */
a12e97fe 146 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 147 void LoadCalibHisto(); /* load calib histo */
148 void LoadCalibPar(); /* load calib par */
149 void WriteCalibHisto(); /* write calib histo */
150 Float_t GetCalibConst(Int_t histo) {return GetHisto(fCalibConst[histo], 0);}; /* get calib const */
151 Float_t GetCalibMap(Int_t histo, Int_t index) {return GetHisto(fCalibMap[histo], index);}; /* get calib map */
152 Float_t GetCalibPar(Int_t histo, Int_t index) {return GetHisto(fCalibPar[histo], index);}; /* get calib par */
153 Float_t GetCorrection(Int_t corr, Int_t index, Float_t tot = 0.); /* get correction */
154 Float_t GetNominalCorrection(Int_t index); /* get nominal correction */
155 void ApplyNominalCorrection(AliESDtrack *track); /* apply nominal corrections */
9155334b 156
157 Float_t GetCableCorrection(Int_t index); /* get cable correction */
158 Float_t GetFullCorrection(Int_t index); /* get full correction */
2cdf778a 159
160 ClassDef(AliTOFcalibHisto, 1);
161
162};
163
164#endif /* ALITOFCALIBHISTO_H */