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