]>
Commit | Line | Data |
---|---|---|
6dc9348d | 1 | #ifndef ALITOFCALIB_H |
2 | #define ALITOFCALIB_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 | // class for TOF calibration:: simulation of uncalibrated data // | |
9 | ////////////////////////////////////////////////////////////////// | |
10 | ||
0a749fa5 | 11 | #define CHENTRIESSMALL 300 // number of entries per TOF channel per run |
12 | // (to be divided by 3 to get the | |
13 | // real number of entries), smallarray | |
14 | #define MAXCHENTRIESSMALL 10000 // max number of entries per TOF channel | |
15 | // (to be divided by 3 to get the | |
16 | // real number of entries), smallarray | |
17 | ||
18 | #define NIDXSMALL 3 // number of values stored | |
19 | // after Comb PID per ESD track | |
20 | #define DELTAIDXTOT 0 // index for ToT in bigarray | |
21 | #define DELTAIDXTIME 1 // index for TOF time in big/smallarray | |
22 | #define DELTAIDXPID 2 // index for Exp Time after Comb PID | |
23 | // in smallarray | |
24 | #define MEANENTRIES 15 // Mean number of entries per channel | |
25 | // to perform calibration | |
26 | ||
6dc9348d | 27 | #include "TTask.h" |
0e46b9ae | 28 | |
29 | class TArrayF; | |
30 | class TF1; | |
31 | class TH1F; | |
8da43270 | 32 | class TH1C; |
0e46b9ae | 33 | class TObjArray; |
0a749fa5 | 34 | class TTree; |
296591ad | 35 | class TChain; |
17149e6b | 36 | class TMap; |
0e46b9ae | 37 | |
5c7c93fa | 38 | //class AliESD; |
0e46b9ae | 39 | |
40 | class AliTOFCal; | |
7037bd93 | 41 | class AliTOFRecoParam; |
17149e6b | 42 | class AliTOFChannelOnlineStatusArray; |
43 | class AliTOFChannelOnlineArray; | |
2bf4d9d6 | 44 | class AliTOFDeltaBCOffset; |
45 | class AliTOFCTPLatency; | |
46 | class AliTOFT0Fill; | |
f04b3a69 | 47 | class AliTOFRunParams; |
5b4ed716 | 48 | class AliTOFResponseParams; |
49 | class AliESDEvent; | |
3fd7a5cd | 50 | class AliLHCClockPhase; |
6dc9348d | 51 | |
52 | class AliTOFcalib:public TTask{ | |
53 | public: | |
54 | AliTOFcalib(); // ctor | |
7aeeaf38 | 55 | AliTOFcalib(const AliTOFcalib & calib); // copy constructor |
56 | AliTOFcalib& operator=(const AliTOFcalib & calib); // assignment operator | |
6dc9348d | 57 | virtual ~AliTOFcalib() ; // dtor |
0a749fa5 | 58 | void CreateCalArrays(); |
24d1e16e | 59 | void CreateCalObjects(); |
0a749fa5 | 60 | TObjArray * GetTOFCalArrayOnline() const {return fTOFCalOnline;} |
17149e6b | 61 | AliTOFChannelOnlineArray * GetTOFOnlineDelay() const {return fCal;} |
62 | AliTOFChannelOnlineStatusArray * GetTOFOnlineStatus() const {return fStatus;} | |
7fffa85b | 63 | TObjArray * GetTOFCalArrayOnlinePulser() const {return fTOFCalOnlinePulser;} |
64 | TObjArray * GetTOFCalArrayOnlineNoise() const {return fTOFCalOnlineNoise;} | |
65 | TObjArray * GetTOFCalArrayOnlineHW() const {return fTOFCalOnlineHW;} | |
0a749fa5 | 66 | TObjArray * GetTOFCalArrayOffline() const {return fTOFCalOffline;} |
17149e6b | 67 | TMap * GetConfigMap() const {return fConfigMap;} |
d4ad0d6b | 68 | TH1F * GetTOFSimToT() const {return fTOFSimToT;} |
0a749fa5 | 69 | TTree * GetTOFCalibTree() const {return fTree;} |
296591ad | 70 | TChain * GetTOFCalibChain() const {return fChain;} |
0a749fa5 | 71 | const char * GetOfflineValidity() const {return fkValidity;} |
72 | void SetOfflineValidity(const char* validity) {fkValidity = validity;} | |
d4ad0d6b | 73 | Int_t NChannels()const{return fNChannels;} |
17149e6b | 74 | |
2bf4d9d6 | 75 | void CreateDeltaBCOffset(); |
76 | void CreateCTPLatency(); | |
77 | void CreateT0Fill(); | |
f04b3a69 | 78 | void CreateRunParams(); |
2bf4d9d6 | 79 | AliTOFDeltaBCOffset *GetDeltaBCOffset() const {return fDeltaBCOffset;}; |
80 | AliTOFCTPLatency *GetCTPLatency() const {return fCTPLatency;}; | |
81 | AliTOFT0Fill *GetT0Fill() const {return fT0Fill;}; | |
f04b3a69 | 82 | AliTOFRunParams *GetRunParams() const {return fRunParams;}; |
5b4ed716 | 83 | AliTOFResponseParams *GetResponseParams() const {return fResponseParams;}; |
2bf4d9d6 | 84 | |
d4ad0d6b | 85 | // Methods to retrieve/write parameters from/on CDB |
17149e6b | 86 | // writing |
87 | ||
a6e0ebfe | 88 | void WriteSimHistoOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun, TH1F *histo); |
89 | void WriteConfigMapOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun); | |
90 | void WriteConfigMapOnCDB(const Char_t *sel); | |
17149e6b | 91 | // new calib objs |
a6e0ebfe | 92 | void WriteParOnlineDelayOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun); |
93 | void WriteParOnlineStatusOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun); | |
94 | void WriteParOnlineDelayOnCDB(const Char_t *sel); | |
95 | void WriteParOnlineStatusOnCDB(const Char_t *sel); | |
17149e6b | 96 | // old calib objs |
a6e0ebfe | 97 | void WriteParOnlineOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun); |
98 | void WriteParOnlinePulserOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun); | |
99 | void WriteParOnlineNoiseOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun); | |
100 | void WriteParOnlineHWOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun); | |
101 | void WriteParOfflineOnCDB(const Char_t *sel, const Char_t *validity, Int_t minrun, Int_t maxrun); | |
102 | void WriteParOnlineOnCDB(const Char_t *sel); | |
103 | void WriteParOnlinePulserOnCDB(const Char_t *sel); // old, before unification of status info | |
104 | void WriteParOnlineNoiseOnCDB(const Char_t *sel); // old, before unification of status info | |
105 | void WriteParOnlineHWOnCDB(const Char_t *sel); // old, before unification of status info | |
106 | void WriteParOfflineOnCDB(const Char_t *sel, const Char_t *validity); | |
17149e6b | 107 | |
2bf4d9d6 | 108 | void WriteDeltaBCOffsetOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun); |
109 | void WriteCTPLatencyOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun); | |
110 | void WriteT0FillOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun); | |
f04b3a69 | 111 | void WriteRunParamsOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun); |
dad2868f | 112 | void WriteReadoutEfficiencyOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun); |
8da43270 | 113 | void WriteProblematicOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun); |
2bf4d9d6 | 114 | |
17149e6b | 115 | // reading |
a6e0ebfe | 116 | Bool_t ReadSimHistoFromCDB(const Char_t *sel, Int_t nrun); |
117 | Bool_t ReadConfigMapFromCDB(const Char_t *sel, Int_t nrun); | |
17149e6b | 118 | // new objs |
a6e0ebfe | 119 | Bool_t ReadParOnlineDelayFromCDB(const Char_t *sel, Int_t nrun); |
120 | Bool_t ReadParOnlineStatusFromCDB(const Char_t *sel, Int_t nrun); | |
17149e6b | 121 | // old objs |
a6e0ebfe | 122 | Bool_t ReadParOnlineFromCDB(const Char_t *sel, Int_t nrun); |
123 | Bool_t ReadParOnlinePulserFromCDB(const Char_t *sel, Int_t nrun); // old, before unification of status info | |
124 | Bool_t ReadParOnlineNoiseFromCDB(const Char_t *sel, Int_t nrun); // old, before unification of status info | |
125 | Bool_t ReadParOnlineHWFromCDB(const Char_t *sel, Int_t nrun); // old, before unification of status info | |
126 | Bool_t ReadParOfflineFromCDB(const Char_t *sel, Int_t nrun); | |
127 | void WriteRecParOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun, AliTOFRecoParam *param); | |
f858b00e | 128 | void WriteRecParOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun, TObjArray *arr); |
d6888ae2 | 129 | AliTOFRecoParam * ReadRecParFromCDB(const Char_t *sel, Int_t nrun, Int_t eventType=0); |
0a749fa5 | 130 | void CreateTreeFromCDB(Int_t minrun, Int_t maxrun); |
131 | void CreateTreeFromFile(Int_t minrun, Int_t maxrun); | |
132 | void CreateTreeFromGrid(Int_t minrun, Int_t maxrun); | |
296591ad | 133 | void CreateChainFromGrid(Int_t minrun, Int_t maxrun); |
0a749fa5 | 134 | Int_t Calibrate(Option_t *optionSave="", Option_t *optionFit="RQ"); |
135 | Int_t Calibrate(Int_t nch,Int_t *ich, Option_t *optionSave="", Option_t *optionFit="RQ"); | |
136 | Int_t Calibrate(Int_t ichmin, Int_t ichmax, Option_t *optionSave="", Option_t *optionFit="RQ"); | |
137 | Int_t Calibrate(Int_t ich, Option_t *optionSave="", Option_t *optionFit="RQ"); | |
138 | Int_t CalibrateFromProfile(Int_t ich, Option_t *optionSave="", Option_t *optionFit="RQ"); | |
139 | TH1F* Profile(Int_t i); | |
140 | Int_t FindBins (TH1F* h, Double_t *bins) const; | |
141 | void SetNruns(Int_t nruns) {fNruns=nruns;} | |
142 | Int_t GetNruns() const {return fNruns;} | |
0cb9d099 | 143 | void SetFirstRun(Int_t firstRun) {fFirstRun=firstRun;} |
144 | Int_t GetFirstRun() const {return fFirstRun;} | |
145 | void SetLastRun(Int_t lastRun) {fLastRun=lastRun;} | |
146 | Int_t GetLastRun() const {return fLastRun;} | |
6dc9348d | 147 | |
2bf4d9d6 | 148 | Bool_t ReadDeltaBCOffsetFromCDB(const Char_t *sel, Int_t nrun); |
149 | Bool_t ReadCTPLatencyFromCDB(const Char_t *sel, Int_t nrun); | |
150 | Bool_t ReadT0FillFromCDB(const Char_t *sel, Int_t nrun); | |
f04b3a69 | 151 | Bool_t ReadRunParamsFromCDB(const Char_t *sel, Int_t nrun); |
3fd7a5cd | 152 | Bool_t ReadLHCClockPhaseFromCDB(const Char_t *sel, Int_t nrun); |
dad2868f | 153 | Bool_t ReadReadoutEfficiencyFromCDB(const Char_t *sel, Int_t nrun); |
8da43270 | 154 | Bool_t ReadProblematicFromCDB(const Char_t *sel, Int_t nrun); |
2bf4d9d6 | 155 | |
5b4ed716 | 156 | Bool_t Init(Int_t run = -1); // init |
157 | Double_t GetTimeCorrection(Int_t index, Double_t tot, Int_t deltaBC, Int_t l0l1, UInt_t timestamp); // get time correction | |
158 | void CalibrateESD(AliESDEvent *event); // calibrate ESD | |
c2fb5b09 | 159 | void CalibrateTExp(AliESDEvent *event) const; // calibrate TExp |
5b4ed716 | 160 | void SetRemoveMeanT0(Bool_t value) {fRemoveMeanT0 = value;}; // setter |
3fd7a5cd | 161 | void SetUseLHCClockPhase(Bool_t value) {fUseLHCClockPhase = value;}; // setter |
162 | Bool_t GetUseLHCClockPhase() const {return fUseLHCClockPhase;}; // getter | |
8bb89c94 | 163 | void SetCalibrateTOFsignal(Bool_t value) {fCalibrateTOFsignal = value;}; // setter |
5b4ed716 | 164 | void SetCorrectTExp(Bool_t value) {fCorrectTExp = value;}; // setter |
8da43270 | 165 | Bool_t IsChannelEnabled(Int_t index, Bool_t checkEfficiency = kTRUE, Bool_t checkProblematic = kTRUE); // is channel enabled |
dad2868f | 166 | Bool_t IsChannelEfficient(Int_t index); // is channel efficient |
8da43270 | 167 | Bool_t IsChannelProblematic(Int_t index); // is channel problematic |
899d8839 | 168 | Double_t TuneForMC(AliESDEvent *event, Double_t resolution); // tune for MC |
5b4ed716 | 169 | |
1c4d15b9 | 170 | void SetRunParamsSpecificVersion(Int_t value) {fRunParamsSpecificVersion = value;}; // setter |
171 | ||
6dc9348d | 172 | private: |
d4ad0d6b | 173 | Int_t fNChannels; // number of TOF channels |
17149e6b | 174 | |
175 | // old calibration objects | |
0a749fa5 | 176 | TObjArray *fTOFCalOnline; // array of AliTOFChannels storing calib parameters |
17149e6b | 177 | TObjArray *fTOFCalOnlinePulser; // array of AliTOFChannels storing calib status from pulser // old, before unification of status info |
178 | TObjArray *fTOFCalOnlineNoise; // array of AliTOFChannels storing calib status from noise // old, before unification of status info | |
179 | TObjArray *fTOFCalOnlineHW; // array of AliTOFChannels storing calib status from hardware // old, before unification of status info | |
0a749fa5 | 180 | TObjArray *fTOFCalOffline; // array of AliTOFChannels storing calib parameters |
17149e6b | 181 | |
182 | // new calibration objects | |
183 | AliTOFChannelOnlineArray *fCal; // object with delay array for TOF channels | |
184 | AliTOFChannelOnlineStatusArray *fStatus; // object with status array for TOF channels | |
185 | ||
d4ad0d6b | 186 | TH1F *fTOFSimToT; // histo with realistic ToT signal from TB Data |
0a749fa5 | 187 | const char *fkValidity; // validity for offline calibration object |
188 | TTree *fTree; // tree for TOF calibration | |
296591ad | 189 | TChain *fChain; // chain for TOF calibration |
0a749fa5 | 190 | Int_t fNruns; // number of runs to be processed |
0cb9d099 | 191 | Int_t fFirstRun; // first run for calibration obj validity |
192 | Int_t fLastRun; // last run for calib obj validity | |
17149e6b | 193 | TMap* fConfigMap; // map holding configuration obj |
0cb9d099 | 194 | |
2bf4d9d6 | 195 | AliTOFDeltaBCOffset *fDeltaBCOffset; // deltaBC offset |
196 | AliTOFCTPLatency *fCTPLatency; // CTP latency | |
197 | AliTOFT0Fill *fT0Fill; // T0 fill | |
f04b3a69 | 198 | AliTOFRunParams *fRunParams; // run params |
3fd7a5cd | 199 | AliLHCClockPhase *fLHCClockPhase; // LHC clock-phase |
5b4ed716 | 200 | AliTOFResponseParams *fResponseParams; // run params |
dad2868f | 201 | TH1F *fReadoutEfficiency; // readout efficiency |
8da43270 | 202 | TH1C *fProblematic; // problematic |
5b4ed716 | 203 | |
204 | Bool_t fInitFlag; // init flag | |
205 | Bool_t fRemoveMeanT0; // remove mean T0 | |
3fd7a5cd | 206 | Bool_t fUseLHCClockPhase; // use LHC clock-phase |
8bb89c94 | 207 | Bool_t fCalibrateTOFsignal; // calibrate TOF signal |
5b4ed716 | 208 | Bool_t fCorrectTExp; // correct expected time |
2bf4d9d6 | 209 | |
1c4d15b9 | 210 | Int_t fRunParamsSpecificVersion; // RunParams specific version |
8da43270 | 211 | ClassDef(AliTOFcalib,11); |
6dc9348d | 212 | }; |
213 | ||
214 | #endif // AliTOFcalib_H | |
215 |