]>
Commit | Line | Data |
---|---|---|
b3fcfd96 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | ||
17 | ||
18 | /* | |
4c865c34 | 19 | Responsible: Raphaelle Bailhache (rbailhache@ikf.uni-frankfurt.de) |
20 | Code to analyze the TRD calibration and to produce OCDB entries | |
b3fcfd96 | 21 | |
22 | ||
23 | .x ~/rootlogon.C | |
24 | gSystem->Load("libANALYSIS"); | |
4c865c34 | 25 | gSystem->Load("libTRDcalib"); |
b3fcfd96 | 26 | |
27 | AliTRDPreprocessorOffline proces; | |
28 | TString ocdbPath="local:////" | |
29 | ocdbPath+=gSystem->GetFromPipe("pwd"); | |
30 | ||
31 | proces.CalibTimeGain("CalibObjects.root",run0,run1,ocdbPath); | |
32 | proces.CalibTimeVdrift("CalibObjects.root",run0,run1,ocdbPath); | |
33 | // take the raw calibration data from the file CalibObjects.root | |
34 | // and make a OCDB entry with run validity run0-run1 | |
35 | // results are stored at the ocdbPath - local or alien ... | |
36 | // default storage ""- data stored at current working directory | |
37 | ||
38 | */ | |
00d203b6 | 39 | #include "AliLog.h" |
b3fcfd96 | 40 | #include "Riostream.h" |
41 | #include <fstream> | |
42 | #include "TFile.h" | |
43 | #include "TCanvas.h" | |
44 | #include "TLegend.h" | |
45 | #include "TH2I.h" | |
46 | #include "TH1I.h" | |
47 | #include "TH2F.h" | |
48 | #include "TH1F.h" | |
82b413fd | 49 | #include "TMath.h" |
83d0cc79 | 50 | #include "THnSparse.h" |
b3fcfd96 | 51 | #include "TProfile2D.h" |
52 | #include "AliTRDCalDet.h" | |
53 | #include "AliTRDCalPad.h" | |
54 | #include "AliCDBMetaData.h" | |
55 | #include "AliCDBId.h" | |
56 | #include "AliCDBManager.h" | |
57 | #include "AliCDBStorage.h" | |
58 | #include "AliTRDCalibraMode.h" | |
59 | #include "AliTRDCalibraFit.h" | |
60 | #include "AliTRDCalibraVdriftLinearFit.h" | |
a0bb5615 | 61 | #include "AliTRDCalibraExbAltFit.h" |
b3fcfd96 | 62 | #include "AliTRDPreprocessorOffline.h" |
81a5aeca | 63 | #include "AliTRDCalChamberStatus.h" |
83d0cc79 | 64 | #include "AliTRDCalibChamberStatus.h" |
840ec79d | 65 | #include "AliTRDCommonParam.h" |
83d0cc79 | 66 | #include "AliCDBManager.h" |
67 | #include "AliCDBEntry.h" | |
e2a1c98b | 68 | #include "AliTRDdEdxUtils.h" |
b3fcfd96 | 69 | |
70 | ||
71 | ClassImp(AliTRDPreprocessorOffline) | |
72 | ||
54f2ff1c | 73 | AliTRDPreprocessorOffline::AliTRDPreprocessorOffline(): |
01239968 | 74 | TNamed("TPCPreprocessorOffline","TPCPreprocessorOffline"), |
b3fcfd96 | 75 | fMethodSecond(kTRUE), |
01239968 | 76 | fNameList("TRDCalib"), |
77 | fCalDetGainUsed(0x0), | |
4c865c34 | 78 | fCalDetVdriftUsed(0x0), |
840ec79d | 79 | fCalDetExBUsed(0x0), |
b3fcfd96 | 80 | fCH2d(0x0), |
81 | fPH2d(0x0), | |
82 | fPRF2d(0x0), | |
83d0cc79 | 83 | fSparse(0x0), |
b3fcfd96 | 84 | fAliTRDCalibraVdriftLinearFit(0x0), |
a0bb5615 | 85 | fAliTRDCalibraExbAltFit(0x0), |
b3fcfd96 | 86 | fNEvents(0x0), |
87 | fAbsoluteGain(0x0), | |
a0bb5615 | 88 | fPlots(new TObjArray(kNumCalibObjs)), |
89 | fCalibObjects(new TObjArray(kNumCalibObjs)), | |
83d0cc79 | 90 | fFirstRunGainUsed(0), |
4c865c34 | 91 | fVersionGainUsed(0), |
92 | fSubVersionGainUsed(0), | |
ca7e6e64 | 93 | fFirstRunVdriftUsed(0), |
4c865c34 | 94 | fVersionVdriftUsed(0), |
00d203b6 | 95 | fSubVersionVdriftUsed(0), |
83d0cc79 | 96 | fFirstRunExBUsed(0), |
97 | fVersionExBUsed(0), | |
98 | fSubVersionExBUsed(0), | |
99 | fNoExBUsedInReco(kFALSE), | |
00d203b6 | 100 | fSwitchOnValidation(kTRUE), |
101 | fVdriftValidated(kFALSE), | |
840ec79d | 102 | fExBValidated(kFALSE), |
a2a4ec8e | 103 | fT0Validated(kFALSE), |
104 | fMinStatsVdriftT0PH(800*20), | |
105 | fMinStatsVdriftLinear(800), | |
106 | fMinStatsGain(800), | |
54f2ff1c | 107 | fMinStatsPRF(600), |
83d0cc79 | 108 | fMinStatsChamberStatus(20), |
17aa2935 | 109 | fMinSingleStatsChamberStatus(0.05), |
54f2ff1c | 110 | fBackCorrectGain(kFALSE), |
111 | fBackCorrectVdrift(kTRUE), | |
112 | fNotEnoughStatisticsForTheGain(kFALSE), | |
113 | fNotEnoughStatisticsForTheVdriftLinear(kFALSE), | |
82b413fd | 114 | fStatusNeg(0), |
83d0cc79 | 115 | fStatusPos(0), |
661c7be6 | 116 | fBadCalibValidate(40), |
117 | fNoDataValidate(40), | |
83d0cc79 | 118 | fRMSBadCalibratedGain(20.0), |
119 | fRMSBadCalibratedVdrift(20.0), | |
661c7be6 | 120 | fRMSBadCalibratedExB(20.0), |
2a1a7b36 | 121 | fRobustFitDriftVelocity(kTRUE), |
661c7be6 | 122 | fRobustFitExbAlt(kFALSE), |
123 | fAlternativeVdrfitFit(kFALSE), | |
595cfc12 | 124 | fAlternativeExbAltFit(kFALSE), |
125 | fMethodeGain(0), | |
126 | fOutliersFitChargeLow(0.03), | |
127 | fOutliersFitChargeHigh(0.7), | |
128 | fBeginFitCharge(3.5) | |
b3fcfd96 | 129 | { |
130 | // | |
131 | // default constructor | |
132 | // | |
83d0cc79 | 133 | |
134 | memset(fBadCalib, 0, sizeof(Int_t) * 18); | |
135 | memset(fNoData, 0, sizeof(Int_t) * 18); | |
b3fcfd96 | 136 | } |
00d203b6 | 137 | //_________________________________________________________________________________________________________________ |
b3fcfd96 | 138 | AliTRDPreprocessorOffline::~AliTRDPreprocessorOffline() { |
139 | // | |
140 | // Destructor | |
141 | // | |
142 | ||
01239968 | 143 | if(fCalDetGainUsed) delete fCalDetGainUsed; |
4c865c34 | 144 | if(fCalDetVdriftUsed) delete fCalDetVdriftUsed; |
840ec79d | 145 | if(fCalDetExBUsed) delete fCalDetExBUsed; |
b3fcfd96 | 146 | if(fCH2d) delete fCH2d; |
147 | if(fPH2d) delete fPH2d; | |
148 | if(fPRF2d) delete fPRF2d; | |
83d0cc79 | 149 | if(fSparse) delete fSparse; |
e2a1c98b | 150 | AliTRDdEdxUtils::DeleteCalibHist(); |
151 | AliTRDdEdxUtils::DeleteCalibObj(); | |
b3fcfd96 | 152 | if(fAliTRDCalibraVdriftLinearFit) delete fAliTRDCalibraVdriftLinearFit; |
a0bb5615 | 153 | if(fAliTRDCalibraExbAltFit) delete fAliTRDCalibraExbAltFit; |
b3fcfd96 | 154 | if(fNEvents) delete fNEvents; |
155 | if(fAbsoluteGain) delete fAbsoluteGain; | |
156 | if(fPlots) delete fPlots; | |
157 | if(fCalibObjects) delete fCalibObjects; | |
158 | ||
83d0cc79 | 159 | } |
160 | //___________________________________________________________________________________ | |
161 | void AliTRDPreprocessorOffline::Process(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage) | |
162 | { | |
163 | // | |
164 | // Process to the gain, vdrift, timeoffset, exb and chamber status calibration | |
165 | // | |
166 | ||
167 | if(SetCalDetGain(startRunNumber,fVersionGainUsed,fSubVersionGainUsed) && SetCalDetVdriftExB(startRunNumber,fVersionVdriftUsed,fSubVersionVdriftUsed,fVersionExBUsed,fSubVersionExBUsed)) { | |
168 | ||
169 | CalibVdriftT0(file,startRunNumber,endRunNumber,ocdbStorage); | |
170 | CalibGain(file,startRunNumber,endRunNumber,ocdbStorage); | |
171 | CalibChamberStatus(file,startRunNumber,endRunNumber,ocdbStorage); | |
f29cf84c | 172 | CalibExbAlt(file,startRunNumber,endRunNumber,ocdbStorage); |
e2a1c98b | 173 | |
83d0cc79 | 174 | } |
e2a1c98b | 175 | |
176 | CalibPHQ(file, startRunNumber, endRunNumber, ocdbStorage); | |
83d0cc79 | 177 | |
178 | PrintStatus(); | |
179 | ||
b3fcfd96 | 180 | } |
00d203b6 | 181 | //___________________________________________________________________________________________________________________ |
b3fcfd96 | 182 | |
183 | void AliTRDPreprocessorOffline::CalibVdriftT0(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage){ | |
184 | // | |
185 | // make calibration of the drift velocity | |
186 | // Input parameters: | |
187 | // file - the location of input file | |
188 | // startRunNumber, endRunNumber - run validity period | |
189 | // ocdbStorage - path to the OCDB storage | |
190 | // - if empty - local storage 'pwd' uesed | |
191 | if (ocdbStorage.Length()<=0) ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB"; | |
192 | // | |
193 | // 1. Initialization | |
194 | // | |
008817a3 | 195 | fVdriftValidated = kTRUE; |
196 | fT0Validated = kTRUE; | |
840ec79d | 197 | fExBValidated = kTRUE; |
54f2ff1c | 198 | fNotEnoughStatisticsForTheVdriftLinear = kFALSE; |
b3fcfd96 | 199 | // |
200 | // 2. extraction of the information | |
201 | // | |
840ec79d | 202 | if(ReadVdriftLinearFitGlobal(file) && fCalDetVdriftUsed && fCalDetExBUsed) AnalyzeVdriftLinearFit(); |
54f2ff1c | 203 | if(ReadVdriftT0Global(file)) AnalyzeVdriftT0(); |
b3fcfd96 | 204 | // |
205 | // 3. Append QA plots | |
206 | // | |
207 | //MakeDefaultPlots(fVdriftArray,fVdriftArray); | |
208 | // | |
209 | // | |
00d203b6 | 210 | // 4. validate OCDB entries |
b3fcfd96 | 211 | // |
00d203b6 | 212 | if(fSwitchOnValidation==kTRUE && ValidateVdrift()==kFALSE) { |
82b413fd | 213 | //AliError("TRD vdrift OCDB parameters out of range!"); |
00d203b6 | 214 | fVdriftValidated = kFALSE; |
215 | } | |
216 | if(fSwitchOnValidation==kTRUE && ValidateT0()==kFALSE) { | |
82b413fd | 217 | //AliError("TRD t0 OCDB parameters out of range!"); |
00d203b6 | 218 | fT0Validated = kFALSE; |
219 | } | |
840ec79d | 220 | if(fSwitchOnValidation==kTRUE && ValidateExB()==kFALSE) { |
221 | //AliError("TRD t0 OCDB parameters out of range!"); | |
222 | fExBValidated = kFALSE; | |
223 | } | |
b3fcfd96 | 224 | // |
00d203b6 | 225 | // 5. update of OCDB |
226 | // | |
227 | // | |
228 | if(fVdriftValidated) UpdateOCDBVdrift(startRunNumber,endRunNumber,ocdbStorage); | |
229 | if(fT0Validated) UpdateOCDBT0(startRunNumber,endRunNumber,ocdbStorage); | |
840ec79d | 230 | if(fExBValidated) UpdateOCDBExB(startRunNumber,endRunNumber,ocdbStorage); |
00d203b6 | 231 | |
b3fcfd96 | 232 | } |
a0bb5615 | 233 | //___________________________________________________________________________________________________________________ |
234 | ||
235 | void AliTRDPreprocessorOffline::CalibExbAlt(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage){ | |
236 | // | |
237 | // make calibration of the drift velocity | |
238 | // Input parameters: | |
239 | // file - the location of input file | |
240 | // startRunNumber, endRunNumber - run validity period | |
241 | // ocdbStorage - path to the OCDB storage | |
242 | // - if empty - local storage 'pwd' uesed | |
243 | if (ocdbStorage.Length()<=0) ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB"; | |
244 | // | |
245 | // 1. Initialization | |
246 | // | |
247 | ||
248 | // | |
249 | // 2. extraction of the information | |
250 | // | |
251 | if(ReadExbAltFitGlobal(file)) AnalyzeExbAltFit(); | |
252 | // | |
253 | // 3. Append QA plots | |
254 | // | |
255 | //MakeDefaultPlots(fVdriftArray,fVdriftArray); | |
256 | // | |
257 | // | |
258 | // 4. validate OCDB entries | |
259 | // | |
260 | // | |
261 | // 5. update of OCDB | |
262 | // | |
263 | // | |
264 | UpdateOCDBExBAlt(startRunNumber,endRunNumber,ocdbStorage); | |
265 | ||
266 | } | |
267 | ||
00d203b6 | 268 | //_________________________________________________________________________________________________________________ |
b3fcfd96 | 269 | |
270 | void AliTRDPreprocessorOffline::CalibGain(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage){ | |
271 | // | |
272 | // make calibration of the drift velocity | |
273 | // Input parameters: | |
274 | // file - the location of input file | |
275 | // startRunNumber, endRunNumber - run validity period | |
276 | // ocdbStorage - path to the OCDB storage | |
277 | // - if empty - local storage 'pwd' uesed | |
278 | if (ocdbStorage.Length()<=0) ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB"; | |
279 | // | |
54f2ff1c | 280 | fNotEnoughStatisticsForTheGain = kFALSE; |
281 | // | |
b3fcfd96 | 282 | // 1. Initialization |
283 | if(!ReadGainGlobal(file)) return; | |
284 | // | |
285 | // | |
286 | // 2. extraction of the information | |
287 | // | |
288 | AnalyzeGain(); | |
54f2ff1c | 289 | if(fBackCorrectGain) CorrectFromDetGainUsed(); |
a0bb5615 | 290 | //if(fBackCorrectVdrift) CorrectFromDetVdriftUsed(); |
b3fcfd96 | 291 | // |
292 | // 3. Append QA plots | |
293 | // | |
294 | //MakeDefaultPlots(fVdriftArray,fVdriftArray); | |
295 | // | |
296 | // | |
00d203b6 | 297 | // 4. validate OCDB entries |
298 | // | |
299 | if(fSwitchOnValidation==kTRUE && ValidateGain()==kFALSE) { | |
82b413fd | 300 | //AliError("TRD gain OCDB parameters out of range!"); |
00d203b6 | 301 | return; |
302 | } | |
b3fcfd96 | 303 | // |
00d203b6 | 304 | // 5. update of OCDB |
b3fcfd96 | 305 | // |
00d203b6 | 306 | // |
307 | if((!fCalDetVdriftUsed) || (fCalDetVdriftUsed && fVdriftValidated)) UpdateOCDBGain(startRunNumber,endRunNumber,ocdbStorage); | |
308 | ||
b3fcfd96 | 309 | |
310 | } | |
00d203b6 | 311 | //________________________________________________________________________________________________________________ |
b3fcfd96 | 312 | |
313 | void AliTRDPreprocessorOffline::CalibPRF(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage){ | |
314 | // | |
315 | // make calibration of the drift velocity | |
316 | // Input parameters: | |
317 | // file - the location of input file | |
318 | // startRunNumber, endRunNumber - run validity period | |
319 | // ocdbStorage - path to the OCDB storage | |
320 | // - if empty - local storage 'pwd' uesed | |
321 | if (ocdbStorage.Length()<=0) ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB"; | |
322 | // | |
323 | // 1. Initialization | |
324 | if(!ReadPRFGlobal(file)) return; | |
325 | // | |
326 | // | |
327 | // 2. extraction of the information | |
328 | // | |
329 | AnalyzePRF(); | |
330 | // | |
331 | // 3. Append QA plots | |
332 | // | |
333 | //MakeDefaultPlots(fVdriftArray,fVdriftArray); | |
334 | // | |
335 | // | |
00d203b6 | 336 | // |
337 | // 4. validate OCDB entries | |
338 | // | |
339 | if(fSwitchOnValidation==kTRUE && ValidatePRF()==kFALSE) { | |
82b413fd | 340 | //AliError("TRD prf OCDB parameters out of range!"); |
00d203b6 | 341 | return; |
342 | } | |
343 | // | |
344 | // 5. update of OCDB | |
b3fcfd96 | 345 | // |
346 | // | |
347 | UpdateOCDBPRF(startRunNumber,endRunNumber,ocdbStorage); | |
348 | ||
a5dcf618 | 349 | } |
e2a1c98b | 350 | //________________________________________________________________________________________________________________ |
351 | void AliTRDPreprocessorOffline::CalibPHQ(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage) | |
352 | { | |
353 | // | |
354 | // make calibration of puls height Q | |
355 | // Input parameters: | |
356 | // startRunNumber, endRunNumber - run validity period | |
357 | // ocdbStorage - path to the OCDB storage | |
358 | // - if empty - local storage 'pwd' uesed | |
359 | // | |
360 | ||
361 | if (ocdbStorage.Length()<=0) ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB"; | |
362 | //printf("test %s\n", ocdbStorage.Data()); | |
363 | ||
364 | if(!ReadPHQGlobal(file)) return; | |
365 | ||
366 | if(!AnalyzePHQ(startRunNumber)) return; | |
367 | ||
368 | UpdateOCDBPHQ(startRunNumber,endRunNumber,ocdbStorage); | |
369 | } | |
370 | ||
a5dcf618 | 371 | //________________________________________________________________________________________________________________ |
372 | ||
83d0cc79 | 373 | void AliTRDPreprocessorOffline::CalibChamberStatus(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage){ |
a5dcf618 | 374 | // |
375 | // make calibration of the chamber status | |
376 | // Input parameters: | |
377 | // startRunNumber, endRunNumber - run validity period | |
378 | // ocdbStorage - path to the OCDB storage | |
379 | // - if empty - local storage 'pwd' uesed | |
380 | if (ocdbStorage.Length()<=0) ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB"; | |
381 | // | |
382 | // | |
83d0cc79 | 383 | // 1. Initialization |
384 | if(!ReadStatusGlobal(file)) return; | |
385 | // | |
386 | // | |
387 | // | |
a5dcf618 | 388 | // 2. extraction of the information |
389 | // | |
390 | if(!AnalyzeChamberStatus()) return; | |
391 | // | |
392 | // 3. Append QA plots | |
393 | // | |
394 | //MakeDefaultPlots(fVdriftArray,fVdriftArray); | |
395 | // | |
396 | // | |
397 | // | |
398 | // 4. validate OCDB entries | |
399 | // | |
400 | if(fSwitchOnValidation==kTRUE && ValidateChamberStatus()==kFALSE) { | |
82b413fd | 401 | //AliError("TRD Chamber status OCDB parameters not ok!"); |
a5dcf618 | 402 | return; |
403 | } | |
404 | // | |
405 | // 5. update of OCDB | |
406 | // | |
407 | // | |
83d0cc79 | 408 | if((!fNotEnoughStatisticsForTheVdriftLinear) && (!fNotEnoughStatisticsForTheGain)) UpdateOCDBChamberStatus(startRunNumber,endRunNumber,ocdbStorage); |
409 | //UpdateOCDBChamberStatus(startRunNumber,endRunNumber,ocdbStorage); | |
a5dcf618 | 410 | |
b3fcfd96 | 411 | } |
00d203b6 | 412 | //______________________________________________________________________________________________________ |
4c865c34 | 413 | Bool_t AliTRDPreprocessorOffline::Init(const Char_t* fileName){ |
414 | // | |
415 | // read the calibration used during the reconstruction | |
416 | // | |
417 | ||
418 | if(ReadVdriftT0Global(fileName)) { | |
419 | ||
420 | TString nameph = fPH2d->GetTitle(); | |
ca7e6e64 | 421 | fFirstRunVdriftUsed = GetFirstRun(nameph); |
4c865c34 | 422 | fVersionVdriftUsed = GetVersion(nameph); |
423 | fSubVersionVdriftUsed = GetSubVersion(nameph); | |
424 | ||
425 | //printf("Found Version %d, Subversion %d for vdrift\n",fVersionVdriftUsed,fSubVersionVdriftUsed); | |
426 | ||
427 | } | |
428 | ||
429 | if(ReadGainGlobal(fileName)) { | |
430 | ||
431 | TString namech = fCH2d->GetTitle(); | |
83d0cc79 | 432 | fFirstRunGainUsed = GetFirstRun(namech); |
4c865c34 | 433 | fVersionGainUsed = GetVersion(namech); |
434 | fSubVersionGainUsed = GetSubVersion(namech); | |
435 | ||
436 | //printf("Found Version %d, Subversion %d for gain\n",fVersionGainUsed,fSubVersionGainUsed); | |
437 | ||
438 | } | |
83d0cc79 | 439 | |
440 | if(ReadVdriftLinearFitGlobal(fileName)) { | |
441 | ||
442 | TString namelinear = fAliTRDCalibraVdriftLinearFit->GetNameCalibUsed(); | |
443 | fFirstRunExBUsed = GetFirstRun(namelinear); | |
444 | fVersionExBUsed = GetVersion(namelinear); | |
445 | fSubVersionExBUsed = GetSubVersion(namelinear); | |
446 | ||
447 | //printf("Found Version %d, Subversion %d, run %d for ExB\n",fVersionExBUsed,fSubVersionExBUsed,fFirstRunExBUsed); | |
448 | ||
449 | } | |
4c865c34 | 450 | |
82b413fd | 451 | if(fVersionVdriftUsed == 0) fStatusPos = fStatusPos |kVdriftErrorOld; |
452 | if(fVersionGainUsed == 0) fStatusPos = fStatusPos | kGainErrorOld; | |
e2a1c98b | 453 | |
4c865c34 | 454 | return kTRUE; |
455 | ||
456 | } | |
00d203b6 | 457 | //___________________________________________________________________________________________________________________ |
b3fcfd96 | 458 | |
83d0cc79 | 459 | Bool_t AliTRDPreprocessorOffline::ReadStatusGlobal(const Char_t* fileName){ |
460 | // | |
461 | // read calibration entries from file | |
462 | // | |
463 | if(fSparse) return kTRUE; | |
464 | TFile fcalib(fileName); | |
465 | TObjArray * array = (TObjArray*)fcalib.Get(fNameList); | |
466 | if (array){ | |
467 | fSparse = (THnSparseI *) array->FindObject("NumberOfEntries"); | |
468 | if(!fSparse) return kFALSE; | |
469 | } | |
470 | else | |
471 | return kFALSE; | |
472 | ||
473 | return kTRUE; | |
474 | ||
475 | } | |
476 | //___________________________________________________________________________________________________________________ | |
477 | ||
e2a1c98b | 478 | Bool_t AliTRDPreprocessorOffline::ReadPHQGlobal(const Char_t* fileName) |
479 | { | |
480 | // | |
481 | // read calibration entries from file | |
482 | // | |
483 | ||
484 | return AliTRDdEdxUtils::ReadCalibHist(fileName, fNameList); | |
485 | } | |
486 | ||
487 | //___________________________________________________________________________________________________________________ | |
488 | ||
b3fcfd96 | 489 | Bool_t AliTRDPreprocessorOffline::ReadGainGlobal(const Char_t* fileName){ |
490 | // | |
491 | // read calibration entries from file | |
492 | // | |
4c865c34 | 493 | if(fCH2d) return kTRUE; |
b3fcfd96 | 494 | TFile fcalib(fileName); |
01239968 | 495 | TObjArray * array = (TObjArray*)fcalib.Get(fNameList); |
b3fcfd96 | 496 | if (array){ |
497 | TH2I *ch2d = (TH2I *) array->FindObject("CH2d"); | |
498 | if(!ch2d) return kFALSE; | |
499 | fCH2d = (TH2I*)ch2d->Clone(); | |
500 | //fNEvents = (TH1I *) array->FindObject("NEvents"); | |
501 | //fAbsoluteGain = (TH2F *) array->FindObject("AbsoluteGain"); | |
502 | }else{ | |
503 | TH2I *ch2d = (TH2I *) fcalib.Get("CH2d"); | |
504 | if(!ch2d) return kFALSE; | |
505 | fCH2d = (TH2I*)ch2d->Clone(); | |
506 | //fNEvents = (TH1I *) fcalib.Get("NEvents"); | |
507 | //fAbsoluteGain = (TH2F *) fcalib.Get("AbsoluteGain"); | |
508 | } | |
509 | fCH2d->SetDirectory(0); | |
510 | //printf("title of CH2d %s\n",fCH2d->GetTitle()); | |
511 | ||
512 | return kTRUE; | |
513 | ||
514 | } | |
00d203b6 | 515 | //_________________________________________________________________________________________________________________ |
b3fcfd96 | 516 | |
517 | Bool_t AliTRDPreprocessorOffline::ReadVdriftT0Global(const Char_t* fileName){ | |
518 | // | |
519 | // read calibration entries from file | |
520 | // | |
4c865c34 | 521 | if(fPH2d) return kTRUE; |
b3fcfd96 | 522 | TFile fcalib(fileName); |
01239968 | 523 | TObjArray * array = (TObjArray*)fcalib.Get(fNameList); |
b3fcfd96 | 524 | if (array){ |
525 | TProfile2D *ph2d = (TProfile2D *) array->FindObject("PH2d"); | |
526 | if(!ph2d) return kFALSE; | |
527 | fPH2d = (TProfile2D*)ph2d->Clone(); | |
528 | //fNEvents = (TH1I *) array->FindObject("NEvents"); | |
529 | }else{ | |
530 | TProfile2D *ph2d = (TProfile2D *) fcalib.Get("PH2d"); | |
531 | if(!ph2d) return kFALSE; | |
532 | fPH2d = (TProfile2D*)ph2d->Clone(); | |
533 | //fNEvents = (TH1I *) fcalib.Get("NEvents"); | |
534 | } | |
535 | fPH2d->SetDirectory(0); | |
536 | //printf("title of PH2d %s\n",fPH2d->GetTitle()); | |
537 | ||
538 | return kTRUE; | |
539 | ||
540 | } | |
00d203b6 | 541 | //___________________________________________________________________________________________________________________ |
b3fcfd96 | 542 | |
543 | Bool_t AliTRDPreprocessorOffline::ReadVdriftLinearFitGlobal(const Char_t* fileName){ | |
544 | // | |
545 | // read calibration entries from file | |
546 | // | |
4c865c34 | 547 | if(fAliTRDCalibraVdriftLinearFit) return kTRUE; |
b3fcfd96 | 548 | TFile fcalib(fileName); |
01239968 | 549 | TObjArray * array = (TObjArray*)fcalib.Get(fNameList); |
b3fcfd96 | 550 | if (array){ |
551 | fAliTRDCalibraVdriftLinearFit = (AliTRDCalibraVdriftLinearFit *) array->FindObject("AliTRDCalibraVdriftLinearFit"); | |
552 | //fNEvents = (TH1I *) array->FindObject("NEvents"); | |
553 | }else{ | |
554 | fAliTRDCalibraVdriftLinearFit = (AliTRDCalibraVdriftLinearFit *) fcalib.Get("AliTRDCalibraVdriftLinearFit"); | |
555 | //fNEvents = (TH1I *) fcalib.Get("NEvents"); | |
556 | } | |
557 | if(!fAliTRDCalibraVdriftLinearFit) { | |
558 | //printf("No AliTRDCalibraVdriftLinearFit\n"); | |
559 | return kFALSE; | |
560 | } | |
561 | return kTRUE; | |
562 | ||
a0bb5615 | 563 | } |
564 | //_____________________________________________________________________________________________________________ | |
565 | Bool_t AliTRDPreprocessorOffline::ReadExbAltFitGlobal(const Char_t* fileName){ | |
566 | // | |
567 | // read calibration entries from file | |
568 | // | |
569 | if(fAliTRDCalibraExbAltFit) return kTRUE; | |
570 | TFile fcalib(fileName); | |
571 | TObjArray * array = (TObjArray*)fcalib.Get(fNameList); | |
572 | if (array){ | |
573 | fAliTRDCalibraExbAltFit = (AliTRDCalibraExbAltFit *) array->FindObject("AliTRDCalibraExbAltFit"); | |
574 | //fNEvents = (TH1I *) array->FindObject("NEvents"); | |
575 | }else{ | |
576 | fAliTRDCalibraExbAltFit = (AliTRDCalibraExbAltFit *) fcalib.Get("AliTRDCalibraExbAltFit"); | |
577 | //fNEvents = (TH1I *) fcalib.Get("NEvents"); | |
578 | } | |
579 | if(!fAliTRDCalibraExbAltFit) { | |
580 | //printf("No AliTRDCalibraExbAltFit\n"); | |
581 | return kFALSE; | |
582 | } | |
583 | return kTRUE; | |
584 | ||
b3fcfd96 | 585 | } |
00d203b6 | 586 | //_____________________________________________________________________________________________________________ |
b3fcfd96 | 587 | |
588 | Bool_t AliTRDPreprocessorOffline::ReadPRFGlobal(const Char_t* fileName){ | |
589 | // | |
590 | // read calibration entries from file | |
591 | // | |
4c865c34 | 592 | if(fPRF2d) return kTRUE; |
b3fcfd96 | 593 | TFile fcalib(fileName); |
01239968 | 594 | TObjArray * array = (TObjArray*)fcalib.Get(fNameList); |
b3fcfd96 | 595 | if (array){ |
596 | TProfile2D *prf2d = (TProfile2D *) array->FindObject("PRF2d"); | |
597 | if(!prf2d) return kFALSE; | |
598 | fPRF2d = (TProfile2D*)prf2d->Clone(); | |
599 | //fNEvents = (TH1I *) array->FindObject("NEvents"); | |
600 | }else{ | |
601 | TProfile2D *prf2d = (TProfile2D *) fcalib.Get("PRF2d"); | |
602 | if(!prf2d) return kFALSE; | |
603 | fPRF2d = (TProfile2D*)prf2d->Clone(); | |
604 | //fNEvents = (TH1I *) fcalib.Get("NEvents"); | |
605 | } | |
606 | fPRF2d->SetDirectory(0); | |
607 | //printf("title of PRF2d %s\n",fPRF2d->GetTitle()); | |
608 | ||
609 | return kTRUE; | |
610 | ||
611 | } | |
00d203b6 | 612 | //__________________________________________________________________________________________________________ |
b3fcfd96 | 613 | |
614 | Bool_t AliTRDPreprocessorOffline::AnalyzeGain(){ | |
615 | // | |
616 | // Analyze gain - produce the calibration objects | |
617 | // | |
618 | ||
619 | AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance(); | |
595cfc12 | 620 | calibra->ChooseMethod(fMethodeGain); |
621 | calibra->SetBeginFitCharge(fBeginFitCharge); | |
622 | calibra->SetFitOutliersChargeLow(fOutliersFitChargeLow); | |
623 | calibra->SetFitOutliersChargeHigh(fOutliersFitChargeHigh); | |
a2a4ec8e | 624 | calibra->SetMinEntries(fMinStatsGain); // If there is less than 1000 entries in the histo: no fit |
b3fcfd96 | 625 | calibra->AnalyseCH(fCH2d); |
626 | ||
627 | Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(0)) | |
628 | + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(0)); | |
629 | Int_t nbfit = calibra->GetNumberFit(); | |
630 | Int_t nbE = calibra->GetNumberEnt(); | |
631 | ||
632 | ||
633 | Bool_t ok = kFALSE; | |
4c865c34 | 634 | Bool_t meanother = kFALSE; |
b3fcfd96 | 635 | // enough statistics |
636 | if ((nbtg > 0) && | |
637 | (nbfit >= 0.5*nbE) && (nbE > 30)) { | |
638 | // create the cal objects | |
54f2ff1c | 639 | if(!fBackCorrectGain) { |
4c865c34 | 640 | calibra->PutMeanValueOtherVectorFit(1,kTRUE); |
641 | meanother = kTRUE; | |
642 | } | |
b3fcfd96 | 643 | TObjArray object = calibra->GetVectorFit(); |
4c865c34 | 644 | AliTRDCalDet *calDetGain = calibra->CreateDetObjectGain(&object,meanother); |
b3fcfd96 | 645 | TH1F *coefGain = calDetGain->MakeHisto1DAsFunctionOfDet(); |
646 | // Put them in the array | |
647 | fCalibObjects->AddAt(calDetGain,kGain); | |
648 | fPlots->AddAt(coefGain,kGain); | |
649 | // | |
650 | ok = kTRUE; | |
651 | } | |
54f2ff1c | 652 | else { |
653 | fNotEnoughStatisticsForTheGain = kTRUE; | |
dee5f636 | 654 | Int_t minStatsGain = fMinStatsGain*30; |
655 | calibra->SetMinEntries(minStatsGain); // Because we do it for all, we increase this | |
54f2ff1c | 656 | Double_t gainoverallnotnormalized = calibra->AnalyseCHAllTogether(fCH2d); |
657 | if(fCalDetGainUsed && (gainoverallnotnormalized > 0.0)) { | |
658 | AliTRDCalDet *calDetGain = new AliTRDCalDet(*fCalDetGainUsed); | |
659 | Double_t oldmean = fCalDetGainUsed->CalcMean(kFALSE); | |
660 | //printf("oldmean %f\n",oldmean); | |
661 | if(oldmean > 0.0) { | |
662 | Double_t scalefactor = calibra->GetScaleFactorGain(); | |
663 | //printf("Correction factor %f\n",gainoverallnotnormalized*scalefactor); | |
664 | calDetGain->Multiply(gainoverallnotnormalized*scalefactor/oldmean); | |
665 | //printf("newmean %f\n",calDetGain->CalcMean(kFALSE)); | |
666 | TH1F *coefGain = calDetGain->MakeHisto1DAsFunctionOfDet(); | |
667 | fCalibObjects->AddAt(calDetGain,kGain); | |
668 | fPlots->AddAt(coefGain,kGain); | |
669 | // | |
670 | ok = kTRUE; | |
82b413fd | 671 | fStatusNeg = fStatusNeg | kGainNotEnoughStatsButFill; |
54f2ff1c | 672 | } |
673 | else { | |
82b413fd | 674 | fStatusPos = fStatusPos | kGainErrorOld; |
54f2ff1c | 675 | } |
676 | } | |
677 | else { | |
82b413fd | 678 | if(gainoverallnotnormalized <= 0.0) fStatusNeg = fStatusNeg | kGainNotEnoughStatsNotFill; |
679 | if(!fCalDetGainUsed) fStatusPos = fStatusPos | kGainErrorOld; | |
54f2ff1c | 680 | } |
681 | } | |
b3fcfd96 | 682 | |
683 | calibra->ResetVectorFit(); | |
684 | ||
685 | return ok; | |
686 | ||
687 | } | |
00d203b6 | 688 | //_____________________________________________________________________________________________________ |
b3fcfd96 | 689 | Bool_t AliTRDPreprocessorOffline::AnalyzeVdriftT0(){ |
690 | // | |
691 | // Analyze VdriftT0 - produce the calibration objects | |
692 | // | |
693 | ||
694 | AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance(); | |
a2a4ec8e | 695 | calibra->SetMinEntries(fMinStatsVdriftT0PH); // If there is less than 1000 entries in the histo: no fit |
b3fcfd96 | 696 | calibra->AnalysePH(fPH2d); |
697 | ||
698 | Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(1)) | |
699 | + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(1)); | |
700 | Int_t nbfit = calibra->GetNumberFit(); | |
701 | Int_t nbfitSuccess = calibra->GetNumberFitSuccess(); | |
702 | Int_t nbE = calibra->GetNumberEnt(); | |
703 | ||
704 | //printf("nbtg %d, nbfit %d, nbE %d, nbfitSuccess %d\n",nbtg,nbfit,nbE,nbfitSuccess); | |
705 | ||
706 | Bool_t ok = kFALSE; | |
707 | if ((nbtg > 0) && | |
708 | (nbfit >= 0.5*nbE) && (nbE > 30) && (nbfitSuccess > 30)) { | |
709 | //printf("Pass the cut for VdriftT0\n"); | |
710 | // create the cal objects | |
01239968 | 711 | calibra->RemoveOutliers(1,kFALSE); |
712 | calibra->PutMeanValueOtherVectorFit(1,kFALSE); | |
713 | calibra->RemoveOutliers2(kFALSE); | |
714 | calibra->PutMeanValueOtherVectorFit2(1,kFALSE); | |
715 | // | |
b3fcfd96 | 716 | TObjArray object = calibra->GetVectorFit(); |
717 | AliTRDCalDet *calDetVdrift = calibra->CreateDetObjectVdrift(&object); | |
718 | TH1F *coefVdriftPH = calDetVdrift->MakeHisto1DAsFunctionOfDet(); | |
719 | AliTRDCalPad *calPadVdrift = (AliTRDCalPad *)calibra->CreatePadObjectVdrift(&object,calDetVdrift); | |
720 | TH1F *coefPadVdrift = calPadVdrift->MakeHisto1D(); | |
721 | object = calibra->GetVectorFit2(); | |
722 | AliTRDCalDet *calDetT0 = calibra->CreateDetObjectT0(&object); | |
723 | TH1F *coefT0 = calDetT0->MakeHisto1DAsFunctionOfDet(); | |
724 | AliTRDCalPad *calPadT0 = (AliTRDCalPad *)calibra->CreatePadObjectT0(&object,calDetT0); | |
725 | TH1F *coefPadT0 = calPadT0->MakeHisto1D(); | |
726 | // Put them in the array | |
727 | fCalibObjects->AddAt(calDetT0,kT0PHDet); | |
728 | fCalibObjects->AddAt(calDetVdrift,kVdriftPHDet); | |
729 | fCalibObjects->AddAt(calPadT0,kT0PHPad); | |
730 | fCalibObjects->AddAt(calPadVdrift,kVdriftPHPad); | |
731 | fPlots->AddAt(coefVdriftPH,kVdriftPHDet); | |
732 | fPlots->AddAt(coefT0,kT0PHDet); | |
733 | fPlots->AddAt(coefPadVdrift,kVdriftPHPad); | |
734 | fPlots->AddAt(coefPadT0,kT0PHPad); | |
735 | // | |
736 | ok = kTRUE; | |
737 | } | |
54f2ff1c | 738 | else { |
840ec79d | 739 | //printf("Not enough stats timeoffset\n"); |
82b413fd | 740 | fStatusNeg = fStatusNeg | kTimeOffsetNotEnoughStatsNotFill; |
54f2ff1c | 741 | } |
b3fcfd96 | 742 | calibra->ResetVectorFit(); |
743 | ||
744 | return ok; | |
745 | ||
746 | } | |
00d203b6 | 747 | //____________________________________________________________________________________________________________________ |
b3fcfd96 | 748 | Bool_t AliTRDPreprocessorOffline::AnalyzeVdriftLinearFit(){ |
749 | // | |
750 | // Analyze vdrift linear fit - produce the calibration objects | |
751 | // | |
752 | ||
a5dcf618 | 753 | //printf("Analyse linear fit\n"); |
754 | ||
f558cb62 | 755 | |
b3fcfd96 | 756 | AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance(); |
840ec79d | 757 | calibra->SetCalDetVdriftExB(fCalDetVdriftUsed,fCalDetExBUsed); |
a2a4ec8e | 758 | calibra->SetMinEntries(fMinStatsVdriftLinear); // If there is less than 1000 entries in the histo: no fit |
a5dcf618 | 759 | //printf("Fill PE Array\n"); |
2a1a7b36 | 760 | fAliTRDCalibraVdriftLinearFit->SetRobustFit(fRobustFitDriftVelocity); |
661c7be6 | 761 | if(!fAlternativeVdrfitFit) |
762 | fAliTRDCalibraVdriftLinearFit->FillPEArray(); | |
763 | else | |
764 | fAliTRDCalibraVdriftLinearFit->FillPEArray2(); | |
a5dcf618 | 765 | //printf("AliTRDCalibraFit\n"); |
b3fcfd96 | 766 | calibra->AnalyseLinearFitters(fAliTRDCalibraVdriftLinearFit); |
a5dcf618 | 767 | //printf("After\n"); |
b3fcfd96 | 768 | |
769 | //Int_t nbtg = 540; | |
770 | Int_t nbfit = calibra->GetNumberFit(); | |
771 | Int_t nbE = calibra->GetNumberEnt(); | |
772 | ||
773 | ||
774 | Bool_t ok = kFALSE; | |
775 | // enough statistics | |
776 | if ((nbfit >= 0.5*nbE) && (nbE > 30)) { | |
777 | // create the cal objects | |
01239968 | 778 | //calibra->RemoveOutliers(1,kTRUE); |
779 | calibra->PutMeanValueOtherVectorFit(1,kTRUE); | |
780 | //calibra->RemoveOutliers2(kTRUE); | |
781 | calibra->PutMeanValueOtherVectorFit2(1,kTRUE); | |
782 | // | |
b3fcfd96 | 783 | TObjArray object = calibra->GetVectorFit(); |
784 | AliTRDCalDet *calDetVdrift = calibra->CreateDetObjectVdrift(&object,kTRUE); | |
785 | TH1F *coefDriftLinear = calDetVdrift->MakeHisto1DAsFunctionOfDet(); | |
786 | object = calibra->GetVectorFit2(); | |
787 | AliTRDCalDet *calDetLorentz = calibra->CreateDetObjectLorentzAngle(&object); | |
788 | TH1F *coefLorentzAngle = calDetLorentz->MakeHisto1DAsFunctionOfDet(); | |
eec29d56 | 789 | //if(!calDetLorentz) printf("No lorentz created\n"); |
b3fcfd96 | 790 | // Put them in the array |
791 | fCalibObjects->AddAt(calDetVdrift,kVdriftLinear); | |
792 | fCalibObjects->AddAt(calDetLorentz,kLorentzLinear); | |
793 | fPlots->AddAt(coefDriftLinear,kVdriftLinear); | |
794 | fPlots->AddAt(coefLorentzAngle,kLorentzLinear); | |
795 | // | |
796 | ok = kTRUE; | |
797 | } | |
54f2ff1c | 798 | else { |
799 | fNotEnoughStatisticsForTheVdriftLinear = kTRUE; | |
dee5f636 | 800 | Int_t minNumberOfEntriesForAll = fMinStatsVdriftLinear*30; |
801 | calibra->SetMinEntries(minNumberOfEntriesForAll); // Because we do it for all, we increase this | |
840ec79d | 802 | Double_t vdriftoverall = -100.0; |
803 | Double_t exboverall = 100.0; | |
804 | calibra->AnalyseLinearFittersAllTogether(fAliTRDCalibraVdriftLinearFit,vdriftoverall,exboverall); | |
805 | //printf("Found mean vdrift %f and exb %f\n",vdriftoverall,exboverall); | |
806 | if(fCalDetVdriftUsed && (vdriftoverall > 0.0) && (exboverall < 70.0)) { | |
54f2ff1c | 807 | AliTRDCalDet *calDetVdrift = new AliTRDCalDet(*fCalDetVdriftUsed); |
840ec79d | 808 | AliTRDCalDet *calDetLorentz = new AliTRDCalDet(*fCalDetExBUsed); |
809 | Double_t oldmeanvdrift = fCalDetVdriftUsed->CalcMean(kFALSE); | |
810 | Double_t oldmeanexb = fCalDetExBUsed->CalcMean(kFALSE); | |
54f2ff1c | 811 | //printf("oldmean %f\n",oldmean); |
840ec79d | 812 | if((oldmeanvdrift > 0.0) && (oldmeanexb < 70.0)) { |
54f2ff1c | 813 | //printf("Correction factor %f\n",vdriftoverall); |
840ec79d | 814 | calDetVdrift->Multiply(vdriftoverall/oldmeanvdrift); |
a50946d4 | 815 | if(TMath::Abs(oldmeanexb) > 0.0001) calDetLorentz->Multiply(exboverall/oldmeanexb); |
54f2ff1c | 816 | //printf("newmean %f\n",calDetVdrift->CalcMean(kFALSE)); |
817 | TH1F *coefDriftLinear = calDetVdrift->MakeHisto1DAsFunctionOfDet(); | |
840ec79d | 818 | TH1F *coefLorentzAngle = calDetLorentz->MakeHisto1DAsFunctionOfDet(); |
54f2ff1c | 819 | // Put them in the array |
820 | fCalibObjects->AddAt(calDetVdrift,kVdriftLinear); | |
840ec79d | 821 | fCalibObjects->AddAt(calDetLorentz,kLorentzLinear); |
54f2ff1c | 822 | fPlots->AddAt(coefDriftLinear,kVdriftLinear); |
840ec79d | 823 | fPlots->AddAt(coefLorentzAngle,kLorentzLinear); |
54f2ff1c | 824 | // |
825 | ok = kTRUE; | |
82b413fd | 826 | fStatusNeg = fStatusNeg | kVdriftNotEnoughStatsButFill; |
54f2ff1c | 827 | } |
82b413fd | 828 | else { |
840ec79d | 829 | if(oldmeanvdrift) fStatusPos = fStatusPos | kVdriftErrorOld; |
830 | if(oldmeanexb) fStatusPos = fStatusPos | kExBErrorOld; | |
82b413fd | 831 | } |
832 | } | |
833 | else { | |
840ec79d | 834 | if((vdriftoverall <= 0.0) && (exboverall > 70.0)) fStatusNeg = fStatusNeg | kVdriftNotEnoughStatsNotFill; |
82b413fd | 835 | if(!fCalDetVdriftUsed) fStatusPos = fStatusPos | kVdriftErrorOld; |
840ec79d | 836 | if(!fCalDetExBUsed) fStatusPos = fStatusPos | kExBErrorOld; |
54f2ff1c | 837 | } |
54f2ff1c | 838 | } |
b3fcfd96 | 839 | |
840 | calibra->ResetVectorFit(); | |
841 | ||
842 | return ok; | |
843 | ||
844 | } | |
00d203b6 | 845 | //________________________________________________________________________________________________________________ |
b3fcfd96 | 846 | |
a0bb5615 | 847 | Bool_t AliTRDPreprocessorOffline::AnalyzeExbAltFit(){ |
848 | // | |
849 | // Analyze vdrift linear fit - produce the calibration objects | |
850 | // | |
851 | ||
852 | //printf("Analyse linear fit\n"); | |
853 | ||
854 | ||
855 | AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance(); | |
856 | calibra->SetMinEntries(fMinStatsVdriftLinear); // If there is less than 1000 entries in the histo: no fit | |
857 | //printf("Fill PE Array\n"); | |
2a1a7b36 | 858 | fAliTRDCalibraExbAltFit->SetRobustFit(fRobustFitExbAlt); |
661c7be6 | 859 | if(!fAlternativeExbAltFit) |
860 | fAliTRDCalibraExbAltFit->FillPEArray(); | |
861 | else | |
862 | fAliTRDCalibraExbAltFit->FillPEArray2(); | |
a0bb5615 | 863 | //printf("AliTRDCalibraFit\n"); |
864 | calibra->AnalyseExbAltFit(fAliTRDCalibraExbAltFit); | |
865 | //printf("After\n"); | |
866 | ||
867 | //Int_t nbtg = 540; | |
868 | Int_t nbfit = calibra->GetNumberFit(); | |
869 | Int_t nbE = calibra->GetNumberEnt(); | |
870 | ||
871 | ||
872 | Bool_t ok = kFALSE; | |
873 | // enough statistics | |
874 | if ((nbfit >= 0.5*nbE) && (nbE > 30)) { | |
875 | // create the cal objects | |
876 | //calibra->RemoveOutliers(1,kTRUE); | |
877 | calibra->PutMeanValueOtherVectorFit2(1,kTRUE); | |
878 | // | |
879 | TObjArray object = calibra->GetVectorFit2(); | |
880 | AliTRDCalDet *calDetLorentz = calibra->CreateDetObjectExbAlt(&object); | |
881 | TH1F *coefLorentzAngle = calDetLorentz->MakeHisto1DAsFunctionOfDet(); | |
882 | //if(!calDetLorentz) printf("No lorentz created\n"); | |
883 | // Put them in the array | |
884 | fCalibObjects->AddAt(calDetLorentz,kExbAlt); | |
885 | fPlots->AddAt(coefLorentzAngle,kExbAlt); | |
886 | // | |
887 | ok = kTRUE; | |
888 | } | |
889 | ||
890 | calibra->ResetVectorFit(); | |
891 | ||
892 | return ok; | |
893 | ||
894 | } | |
895 | //________________________________________________________________________________________________________________ | |
896 | ||
b3fcfd96 | 897 | Bool_t AliTRDPreprocessorOffline::AnalyzePRF(){ |
898 | // | |
899 | // Analyze PRF - produce the calibration objects | |
900 | // | |
901 | ||
902 | AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance(); | |
a2a4ec8e | 903 | calibra->SetMinEntries(fMinStatsPRF); // If there is less than 1000 entries in the histo: no fit |
b3fcfd96 | 904 | calibra->AnalysePRFMarianFit(fPRF2d); |
905 | ||
906 | Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(2)) | |
907 | + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(2)); | |
908 | Int_t nbfit = calibra->GetNumberFit(); | |
909 | Int_t nbE = calibra->GetNumberEnt(); | |
910 | ||
911 | ||
912 | Bool_t ok = kFALSE; | |
913 | // enough statistics | |
914 | if ((nbtg > 0) && | |
915 | (nbfit >= 0.95*nbE) && (nbE > 30)) { | |
916 | // create the cal objects | |
917 | TObjArray object = calibra->GetVectorFit(); | |
918 | AliTRDCalPad *calPadPRF = (AliTRDCalPad*) calibra->CreatePadObjectPRF(&object); | |
919 | TH1F *coefPRF = calPadPRF->MakeHisto1D(); | |
920 | // Put them in the array | |
921 | fCalibObjects->AddAt(calPadPRF,kPRF); | |
922 | fPlots->AddAt(coefPRF,kPRF); | |
923 | // | |
924 | ok = kTRUE; | |
925 | } | |
926 | ||
927 | calibra->ResetVectorFit(); | |
928 | ||
929 | return ok; | |
930 | ||
931 | } | |
a5dcf618 | 932 | |
e2a1c98b | 933 | //_____________________________________________________________________________ |
934 | Bool_t AliTRDPreprocessorOffline::AnalyzePHQ(Int_t startRunNumber) | |
935 | { | |
936 | // | |
937 | //Produce PHQ calibration results | |
938 | // | |
939 | AliTRDdEdxUtils::PrintControl(); | |
940 | ||
941 | for(Int_t iter=0; iter<8; iter++){ | |
942 | THnSparseD *hi = (THnSparseD*) AliTRDdEdxUtils::GetHistPHQ()->At(iter); | |
943 | TObjArray *obji = AliTRDdEdxUtils::GetCalibObj(hi, startRunNumber); | |
944 | //printf("test analyze %s\n", obji->GetName()); | |
945 | AliTRDdEdxUtils::GetObjPHQ()->AddAt(obji, iter); | |
946 | } | |
947 | ||
948 | fCalibObjects->AddAt(AliTRDdEdxUtils::GetObjPHQ(), kPHQ); | |
949 | return kTRUE; | |
950 | } | |
951 | ||
a5dcf618 | 952 | //_____________________________________________________________________________ |
953 | Bool_t AliTRDPreprocessorOffline::AnalyzeChamberStatus() | |
954 | { | |
4c865c34 | 955 | // |
a5dcf618 | 956 | // Produce AliTRDCalChamberStatus out of calibration results |
4c865c34 | 957 | // |
b61b92a0 | 958 | |
83d0cc79 | 959 | // set up AliTRDCalibChamberStatus |
92df0132 | 960 | AliTRDCalibChamberStatus *chamberStatus = new AliTRDCalibChamberStatus(); |
961 | chamberStatus->SetSparseI(fSparse); | |
962 | chamberStatus->AnalyseHisto(fMinStatsChamberStatus, fMinSingleStatsChamberStatus); | |
83d0cc79 | 963 | // get AliTRDCalChamberStatus |
92df0132 | 964 | AliTRDCalChamberStatus *calChamberStatus = chamberStatus->GetCalChamberStatus(); |
01239968 | 965 | |
a5dcf618 | 966 | // get calibration objects |
967 | AliTRDCalDet *calDetGain = (AliTRDCalDet *) fCalibObjects->At(kGain); | |
968 | AliTRDCalDet *calDetVDrift = (AliTRDCalDet *) fCalibObjects->At(kVdriftLinear); | |
840ec79d | 969 | AliTRDCalDet *calDetExB = (AliTRDCalDet *) fCalibObjects->At(kLorentzLinear); |
a5dcf618 | 970 | |
971 | // Check | |
92df0132 | 972 | if((!calDetGain) || (!calDetVDrift) || (!fCH2d) || (!calDetExB) || (!calChamberStatus)) return kFALSE; |
a5dcf618 | 973 | |
974 | // Gain | |
83d0cc79 | 975 | Double_t gainmean = calDetGain->GetMean(); |
a5dcf618 | 976 | Double_t vdriftmean = calDetVDrift->GetMean(); |
83d0cc79 | 977 | Double_t exbmean = calDetExB->GetMean(); |
a5dcf618 | 978 | |
83d0cc79 | 979 | Double_t gainrms = calDetGain->GetRMSRobust(); |
980 | Double_t vdriftrms = calDetVDrift->GetRMSRobust(); | |
981 | Double_t exbrms = calDetExB->GetRMSRobust(); | |
a5dcf618 | 982 | |
983 | //printf("Gain mean: %f, rms: %f\n",gainmean,gainrms); | |
984 | //printf("Vdrift mean: %f, rms: %f\n",vdriftmean,vdriftrms); | |
840ec79d | 985 | //printf("ExB mean: %f, rms: %f\n",exbmean,exbrms); |
986 | ||
a5dcf618 | 987 | // Check |
840ec79d | 988 | if((TMath::Abs(gainrms) < 0.001) || (TMath::Abs(vdriftrms) < 0.001) || (TMath::Abs(exbrms) < 0.0000001)) return kFALSE; |
01239968 | 989 | |
a5dcf618 | 990 | // mask chambers with empty gain entries |
991 | //Int_t counter = 0; | |
992 | for (Int_t idet = 0; idet < 540; idet++) { | |
01239968 | 993 | |
a5dcf618 | 994 | // ch2d |
995 | TH1I *projch = (TH1I *) fCH2d->ProjectionX("projch",idet+1,idet+1,(Option_t *)"e"); | |
996 | Double_t entries = projch->GetEntries(); | |
83d0cc79 | 997 | //printf("Number of entries %f for det %d\n",entries,idet); |
4c865c34 | 998 | |
a5dcf618 | 999 | // gain |
1000 | Double_t gain = calDetGain->GetValue(idet); | |
4c865c34 | 1001 | |
a5dcf618 | 1002 | // vdrift |
1003 | Double_t vdrift = calDetVDrift->GetValue(idet); | |
4c865c34 | 1004 | |
840ec79d | 1005 | // exb |
1006 | Double_t exb = calDetExB->GetValue(idet); | |
1007 | ||
4c865c34 | 1008 | |
92df0132 | 1009 | if( (entries<50 && !calChamberStatus->IsNoData(idet)) || |
83d0cc79 | 1010 | TMath::Abs(gainmean-gain) > (fRMSBadCalibratedGain*gainrms) || |
1011 | TMath::Abs(vdriftmean-vdrift) > (fRMSBadCalibratedVdrift*vdriftrms) || | |
1012 | TMath::Abs(exbmean-exb) > (fRMSBadCalibratedExB*exbrms) ) { | |
a5dcf618 | 1013 | |
1014 | //printf(" chamber det %03d masked \n",idet); | |
1015 | //printf(" gainmean %f and gain %f, gainrms %f \n",gainmean,gain,gainrms); | |
1016 | //printf(" vdriftmean %f and vdrift %f, vdriftrms %f \n",vdriftmean,vdrift,vdriftrms); | |
840ec79d | 1017 | //printf(" exbmean %f and exb %f, exbrms %f \n",exbmean,exb,exbrms); |
1018 | ||
92df0132 | 1019 | calChamberStatus->SetStatus(idet,AliTRDCalChamberStatus::kBadCalibrated); |
a5dcf618 | 1020 | //counter++; |
1021 | } | |
4c865c34 | 1022 | |
b61b92a0 | 1023 | delete projch; |
1024 | ||
a5dcf618 | 1025 | } |
b3fcfd96 | 1026 | |
83d0cc79 | 1027 | // Security |
1028 | for(Int_t sm=0; sm < 18; sm++) { | |
1029 | Int_t smnodata = 0; | |
1030 | Int_t smbadcalib = 0; | |
1031 | for(Int_t det = 0; det < 30; det++){ | |
1032 | Int_t detector = sm*30+det; | |
92df0132 | 1033 | if(calChamberStatus->IsNoData(detector)) smnodata++; |
83d0cc79 | 1034 | else { |
92df0132 | 1035 | if(calChamberStatus->IsBadCalibrated(detector)) smbadcalib++; |
83d0cc79 | 1036 | } |
1037 | } | |
1038 | fNoData[sm] = smnodata; | |
1039 | fBadCalib[sm]= smbadcalib; | |
1040 | //printf("No Data %d, bad calibrated %d for %d\n",fNoData[sm],fBadCalib[sm],sm); | |
1041 | } | |
1042 | ||
1043 | // Security | |
1044 | // for(Int_t sm=0; sm < 18; sm++) { | |
1045 | // Int_t counter = 0; | |
1046 | // for(Int_t det = 0; det < 30; det++){ | |
1047 | // Int_t detector = sm*30+det; | |
92df0132 | 1048 | // if(calChamberStatus->IsBadCalibrated(detector)) counter++; |
83d0cc79 | 1049 | // } |
1050 | // if(counter >= 20) { | |
1051 | // for(Int_t det = 0; det < 30; det++){ | |
1052 | // Int_t detector = sm*30+det; | |
92df0132 | 1053 | // calChamberStatus->SetStatus(detector,AliTRDCalChamberStatus::kGood); |
83d0cc79 | 1054 | // } |
1055 | // } | |
1056 | // } | |
b3fcfd96 | 1057 | |
92df0132 | 1058 | fCalibObjects->AddAt(calChamberStatus,kChamberStatus); |
a5dcf618 | 1059 | return kTRUE; |
b3fcfd96 | 1060 | |
a5dcf618 | 1061 | } |
b3fcfd96 | 1062 | |
b3fcfd96 | 1063 | |
a5dcf618 | 1064 | //________________________________________________________________________________________________ |
1065 | void AliTRDPreprocessorOffline::CorrectFromDetGainUsed() { | |
1066 | // | |
1067 | // Correct from the gas gain used afterwards | |
1068 | // | |
1069 | AliTRDCalDet *calDetGain = (AliTRDCalDet *) fCalibObjects->At(kGain); | |
1070 | if(!calDetGain) return; | |
b3fcfd96 | 1071 | |
a5dcf618 | 1072 | // Calculate mean |
1073 | Double_t mean = 0.0; | |
1074 | Int_t nbdet = 0; | |
b3fcfd96 | 1075 | |
a5dcf618 | 1076 | for(Int_t det = 0; det < 540; det++) { |
00d203b6 | 1077 | |
a5dcf618 | 1078 | Float_t gaininit = fCalDetGainUsed->GetValue(det); |
1079 | Float_t gainout = calDetGain->GetValue(det); | |
00d203b6 | 1080 | |
00d203b6 | 1081 | |
a5dcf618 | 1082 | if(TMath::Abs(gainout-1.0) > 0.000001) { |
1083 | mean += (gaininit*gainout); | |
1084 | nbdet++; | |
1085 | } | |
1086 | } | |
1087 | if(nbdet > 0) mean = mean/nbdet; | |
00d203b6 | 1088 | |
a5dcf618 | 1089 | for(Int_t det = 0; det < 540; det++) { |
00d203b6 | 1090 | |
a5dcf618 | 1091 | Float_t gaininit = fCalDetGainUsed->GetValue(det); |
1092 | Float_t gainout = calDetGain->GetValue(det); | |
1093 | ||
ba1aa7a7 | 1094 | if(TMath::Abs(gainout-1.0) > 0.000001) { |
1095 | Double_t newgain = gaininit*gainout; | |
1096 | if(newgain < 0.1) newgain = 0.1; | |
58e2b572 | 1097 | if(newgain > 1.9) newgain = 1.9; |
ba1aa7a7 | 1098 | calDetGain->SetValue(det,newgain); |
1099 | } | |
1100 | else { | |
1101 | Double_t newgain = mean; | |
1102 | if(newgain < 0.1) newgain = 0.1; | |
58e2b572 | 1103 | if(newgain > 1.9) newgain = 1.9; |
ba1aa7a7 | 1104 | calDetGain->SetValue(det,newgain); |
1105 | } | |
a5dcf618 | 1106 | } |
1107 | ||
1108 | ||
1109 | } | |
1110 | //________________________________________________________________________________________________ | |
1111 | void AliTRDPreprocessorOffline::CorrectFromDetVdriftUsed() { | |
1112 | // | |
1113 | // Correct from the drift velocity | |
1114 | // | |
1115 | ||
1116 | //printf("Correct for vdrift\n"); | |
1117 | ||
1118 | AliTRDCalDet *calDetGain = (AliTRDCalDet *) fCalibObjects->At(kGain); | |
1119 | if(!calDetGain) return; | |
1120 | ||
1121 | Int_t detVdrift = kVdriftPHDet; | |
1122 | if(fMethodSecond) detVdrift = kVdriftLinear; | |
1123 | AliTRDCalDet *calDetVdrift = (AliTRDCalDet *) fCalibObjects->At(detVdrift); | |
1124 | if(!calDetVdrift) return; | |
1125 | ||
1126 | // Calculate mean | |
8dac2af1 | 1127 | if(!fNotEnoughStatisticsForTheVdriftLinear) { |
54f2ff1c | 1128 | for(Int_t det = 0; det < 540; det++) { |
1129 | ||
1130 | Float_t vdriftinit = fCalDetVdriftUsed->GetValue(det); | |
1131 | Float_t vdriftout = calDetVdrift->GetValue(det); | |
1132 | ||
1133 | Float_t gain = calDetGain->GetValue(det); | |
1134 | if(vdriftout > 0.0) gain = gain*vdriftinit/vdriftout; | |
1135 | if(gain < 0.1) gain = 0.1; | |
1136 | if(gain > 1.9) gain = 1.9; | |
1137 | calDetGain->SetValue(det,gain); | |
1138 | } | |
a5dcf618 | 1139 | } |
54f2ff1c | 1140 | else { |
1141 | ||
1142 | Float_t vdriftinit = fCalDetVdriftUsed->CalcMean(kFALSE); | |
1143 | Float_t vdriftout = calDetVdrift->CalcMean(kFALSE); | |
1144 | Float_t factorcorrectif = 1.0; | |
1145 | if(vdriftout > 0.0) factorcorrectif = vdriftinit/vdriftout; | |
1146 | for(Int_t det = 0; det < 540; det++) { | |
1147 | Float_t gain = calDetGain->GetValue(det); | |
1148 | gain = gain*factorcorrectif; | |
1149 | if(gain < 0.1) gain = 0.1; | |
1150 | if(gain > 1.9) gain = 1.9; | |
1151 | calDetGain->SetValue(det,gain); | |
1152 | } | |
1153 | ||
1154 | } | |
1155 | ||
a5dcf618 | 1156 | } |
54f2ff1c | 1157 | //_________________________________________________________________________________________________________________ |
a5dcf618 | 1158 | void AliTRDPreprocessorOffline::UpdateOCDBGain(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath){ |
1159 | // | |
1160 | // Update OCDB entry | |
1161 | // | |
1162 | ||
1163 | AliCDBMetaData *metaData= new AliCDBMetaData(); | |
1164 | metaData->SetObjectClassName("AliTRDCalDet"); | |
1165 | metaData->SetResponsible("Raphaelle Bailhache"); | |
58006729 | 1166 | metaData->AddDateToComment(); |
a5dcf618 | 1167 | metaData->SetBeamPeriod(1); |
1168 | ||
1169 | AliCDBId id1("TRD/Calib/ChamberGainFactor", startRunNumber, endRunNumber); | |
1170 | AliCDBStorage * gStorage = AliCDBManager::Instance()->GetStorage(storagePath); | |
1171 | AliTRDCalDet *calDet = (AliTRDCalDet *) fCalibObjects->At(kGain); | |
1172 | if(calDet) gStorage->Put(calDet, id1, metaData); | |
1173 | ||
1174 | ||
eec29d56 | 1175 | } |
1176 | //___________________________________________________________________________________________________________________ | |
1177 | void AliTRDPreprocessorOffline::UpdateOCDBExB(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath){ | |
1178 | // | |
1179 | // Update OCDB entry | |
1180 | // | |
1181 | ||
1182 | Int_t detExB = kLorentzLinear; | |
1183 | if(!fMethodSecond) return; | |
1184 | ||
1185 | //printf("Pass\n"); | |
1186 | ||
1187 | AliCDBMetaData *metaData= new AliCDBMetaData(); | |
1188 | metaData->SetObjectClassName("AliTRDCalDet"); | |
1189 | metaData->SetResponsible("Raphaelle Bailhache"); | |
58006729 | 1190 | metaData->AddDateToComment(); |
eec29d56 | 1191 | metaData->SetBeamPeriod(1); |
1192 | ||
1193 | AliCDBId id1("TRD/Calib/ChamberExB", startRunNumber, endRunNumber); | |
1194 | AliCDBStorage * gStorage = AliCDBManager::Instance()->GetStorage(storagePath); | |
1195 | AliTRDCalDet *calDet = (AliTRDCalDet *) fCalibObjects->At(detExB); | |
1196 | if(calDet) gStorage->Put(calDet, id1, metaData); | |
1197 | //if(!calDet) printf("No caldet\n"); | |
1198 | ||
a5dcf618 | 1199 | } |
a0bb5615 | 1200 | //___________________________________________________________________________________________________________________ |
1201 | void AliTRDPreprocessorOffline::UpdateOCDBExBAlt(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath){ | |
1202 | // | |
1203 | // Update OCDB entry | |
1204 | // | |
1205 | ||
1206 | Int_t detExB = kExbAlt; | |
1207 | if(!fMethodSecond) return; | |
1208 | ||
1209 | //printf("Pass\n"); | |
1210 | ||
1211 | AliCDBMetaData *metaData= new AliCDBMetaData(); | |
1212 | metaData->SetObjectClassName("AliTRDCalDet"); | |
58006729 | 1213 | metaData->SetResponsible("Theo Rascanu"); |
1214 | metaData->AddDateToComment(); | |
a0bb5615 | 1215 | metaData->SetBeamPeriod(1); |
1216 | ||
1217 | AliCDBId id1("TRD/Calib/ChamberExBAlt", startRunNumber, endRunNumber); | |
1218 | AliCDBStorage * gStorage = AliCDBManager::Instance()->GetStorage(storagePath); | |
1219 | AliTRDCalDet *calDet = (AliTRDCalDet *) fCalibObjects->At(detExB); | |
1220 | if(calDet) gStorage->Put(calDet, id1, metaData); | |
1221 | //if(!calDet) printf("No caldet\n"); | |
1222 | ||
1223 | } | |
a5dcf618 | 1224 | //___________________________________________________________________________________________________________________ |
1225 | void AliTRDPreprocessorOffline::UpdateOCDBVdrift(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath){ | |
1226 | // | |
1227 | // Update OCDB entry | |
1228 | // | |
1229 | ||
1230 | Int_t detVdrift = kVdriftPHDet; | |
1231 | ||
1232 | if(fMethodSecond) detVdrift = kVdriftLinear; | |
1233 | ||
1234 | AliCDBMetaData *metaData= new AliCDBMetaData(); | |
1235 | metaData->SetObjectClassName("AliTRDCalDet"); | |
1236 | metaData->SetResponsible("Raphaelle Bailhache"); | |
58006729 | 1237 | metaData->AddDateToComment(); |
a5dcf618 | 1238 | metaData->SetBeamPeriod(1); |
1239 | ||
1240 | AliCDBId id1("TRD/Calib/ChamberVdrift", startRunNumber, endRunNumber); | |
1241 | AliCDBStorage * gStorage = AliCDBManager::Instance()->GetStorage(storagePath); | |
1242 | AliTRDCalDet *calDet = (AliTRDCalDet *) fCalibObjects->At(detVdrift); | |
1243 | if(calDet) gStorage->Put(calDet, id1, metaData); | |
1244 | ||
1245 | // | |
1246 | ||
1247 | if(!fMethodSecond) { | |
1248 | ||
1249 | AliCDBMetaData *metaDataPad= new AliCDBMetaData(); | |
1250 | metaDataPad->SetObjectClassName("AliTRDCalPad"); | |
1251 | metaDataPad->SetResponsible("Raphaelle Bailhache"); | |
58006729 | 1252 | metaDataPad->AddDateToComment(); |
a5dcf618 | 1253 | metaDataPad->SetBeamPeriod(1); |
1254 | ||
1255 | AliCDBId id1Pad("TRD/Calib/LocalVdrift", startRunNumber, endRunNumber); | |
1256 | AliTRDCalPad *calPad = (AliTRDCalPad *) fCalibObjects->At(kVdriftPHPad); | |
1257 | if(calPad) gStorage->Put(calPad, id1Pad, metaDataPad); | |
1258 | ||
1259 | } | |
1260 | ||
1261 | } | |
1262 | //________________________________________________________________________________________________________________________ | |
1263 | void AliTRDPreprocessorOffline::UpdateOCDBT0(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath){ | |
1264 | // | |
1265 | // Update OCDB entry | |
1266 | // | |
1267 | ||
1268 | AliCDBMetaData *metaData= new AliCDBMetaData(); | |
1269 | metaData->SetObjectClassName("AliTRDCalDet"); | |
1270 | metaData->SetResponsible("Raphaelle Bailhache"); | |
58006729 | 1271 | metaData->AddDateToComment(); |
a5dcf618 | 1272 | metaData->SetBeamPeriod(1); |
1273 | ||
1274 | AliCDBId id1("TRD/Calib/ChamberT0", startRunNumber, endRunNumber); | |
1275 | AliCDBStorage * gStorage = AliCDBManager::Instance()->GetStorage(storagePath); | |
1276 | AliTRDCalDet *calDet = (AliTRDCalDet *) fCalibObjects->At(kT0PHDet); | |
1277 | if(calDet) gStorage->Put(calDet, id1, metaData); | |
1278 | ||
1279 | // | |
1280 | ||
1281 | AliCDBMetaData *metaDataPad= new AliCDBMetaData(); | |
1282 | metaDataPad->SetObjectClassName("AliTRDCalPad"); | |
1283 | metaDataPad->SetResponsible("Raphaelle Bailhache"); | |
58006729 | 1284 | metaDataPad->AddDateToComment(); |
a5dcf618 | 1285 | metaDataPad->SetBeamPeriod(1); |
1286 | ||
1287 | AliCDBId id1Pad("TRD/Calib/LocalT0", startRunNumber, endRunNumber); | |
1288 | AliTRDCalPad *calPad = (AliTRDCalPad *) fCalibObjects->At(kT0PHPad); | |
1289 | if(calPad) gStorage->Put(calPad, id1Pad, metaDataPad); | |
1290 | ||
1291 | ||
1292 | ||
1293 | } | |
1294 | //_________________________________________________________________________________________________________________ | |
1295 | void AliTRDPreprocessorOffline::UpdateOCDBPRF(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath){ | |
1296 | // | |
1297 | // Update OCDB entry | |
1298 | // | |
1299 | ||
1300 | AliCDBMetaData *metaData= new AliCDBMetaData(); | |
1301 | metaData->SetObjectClassName("AliTRDCalPad"); | |
1302 | metaData->SetResponsible("Raphaelle Bailhache"); | |
58006729 | 1303 | metaData->AddDateToComment(); |
a5dcf618 | 1304 | metaData->SetBeamPeriod(1); |
1305 | ||
58006729 | 1306 | |
a5dcf618 | 1307 | AliCDBId id1("TRD/Calib/PRFWidth", startRunNumber, endRunNumber); |
1308 | AliCDBStorage * gStorage = AliCDBManager::Instance()->GetStorage(storagePath); | |
1309 | AliTRDCalPad *calPad = (AliTRDCalPad *) fCalibObjects->At(kPRF); | |
1310 | if(calPad) gStorage->Put(calPad, id1, metaData); | |
1311 | ||
1312 | ||
1313 | } | |
e2a1c98b | 1314 | //_________________________________________________________________________________________________________________ |
1315 | void AliTRDPreprocessorOffline::UpdateOCDBPHQ(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath) | |
1316 | { | |
1317 | // | |
1318 | // Update OCDB entry | |
1319 | // | |
1320 | AliCDBMetaData *metaData= new AliCDBMetaData(); | |
1321 | metaData->SetObjectClassName("TObjArray"); | |
1322 | metaData->SetResponsible("Raphaelle Bailhache and Xianguo Lu"); | |
1323 | metaData->AddDateToComment(); | |
1324 | metaData->SetBeamPeriod(1); | |
1325 | ||
1326 | AliCDBId id1("TRD/Calib/PHQ", startRunNumber, endRunNumber); | |
1327 | AliCDBStorage * gStorage = AliCDBManager::Instance()->GetStorage(storagePath); | |
1328 | TObjArray *cobj = (TObjArray *) fCalibObjects->At(kPHQ); | |
1329 | if(cobj){ | |
1330 | //cobj->Print(); | |
1331 | gStorage->Put(cobj, id1, metaData); | |
1332 | } | |
1333 | } | |
1334 | ||
a5dcf618 | 1335 | //_________________________________________________________________________________________________________________ |
1336 | void AliTRDPreprocessorOffline::UpdateOCDBChamberStatus(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath){ | |
1337 | // | |
1338 | // Update OCDB entry | |
1339 | // | |
1340 | ||
1341 | AliCDBMetaData *metaData= new AliCDBMetaData(); | |
1342 | metaData->SetObjectClassName("AliTRDCalChamberStatus"); | |
58006729 | 1343 | metaData->SetResponsible("Raphaelle Bailhache and Julian Book"); |
1344 | metaData->AddDateToComment(); | |
a5dcf618 | 1345 | metaData->SetBeamPeriod(1); |
1346 | ||
1347 | AliCDBId id1("TRD/Calib/ChamberStatus", startRunNumber, endRunNumber); | |
1348 | AliCDBStorage * gStorage = AliCDBManager::Instance()->GetStorage(storagePath); | |
1349 | AliTRDCalChamberStatus *calChamberStatus = (AliTRDCalChamberStatus *) fCalibObjects->At(kChamberStatus); | |
1350 | if(calChamberStatus) gStorage->Put(calChamberStatus, id1, metaData); | |
1351 | ||
1352 | ||
1353 | } | |
1354 | //__________________________________________________________________________________________________________________________ | |
54f2ff1c | 1355 | Bool_t AliTRDPreprocessorOffline::ValidateGain() { |
a5dcf618 | 1356 | // |
1357 | // Validate OCDB entry | |
1358 | // | |
1359 | ||
1360 | AliTRDCalDet *calDet = (AliTRDCalDet *) fCalibObjects->At(kGain); | |
1361 | if(calDet) { | |
1362 | Double_t mean = calDet->GetMean(); | |
1363 | Double_t rms = calDet->GetRMSRobust(); | |
1364 | if((mean > 0.2) && (mean < 1.4) && (rms < 0.5)) return kTRUE; | |
1365 | //if((mean > 0.2) && (mean < 1.4)) return kTRUE; | |
54f2ff1c | 1366 | else { |
82b413fd | 1367 | fStatusPos = fStatusPos | kGainErrorRange; |
54f2ff1c | 1368 | return kFALSE; |
1369 | } | |
a5dcf618 | 1370 | } |
1371 | else return kFALSE; | |
54f2ff1c | 1372 | |
a5dcf618 | 1373 | |
1374 | ||
1375 | } | |
1376 | //__________________________________________________________________________________________________________________________ | |
1377 | Bool_t AliTRDPreprocessorOffline::ValidateVdrift(){ | |
1378 | // | |
1379 | // Update OCDB entry | |
1380 | // | |
1381 | ||
1382 | Int_t detVdrift = kVdriftPHDet; | |
1383 | Bool_t ok = kTRUE; | |
1384 | ||
1385 | if(fMethodSecond) detVdrift = kVdriftLinear; | |
1386 | ||
1387 | AliTRDCalDet *calDet = (AliTRDCalDet *) fCalibObjects->At(detVdrift); | |
1388 | if(calDet) { | |
1389 | Double_t mean = calDet->GetMean(); | |
1390 | Double_t rms = calDet->GetRMSRobust(); | |
1391 | //printf("Vdrift::mean %f, rms %f\n",mean,rms); | |
54f2ff1c | 1392 | if(!((mean > 1.0) && (mean < 2.0) && (rms < 0.5))) { |
82b413fd | 1393 | fStatusPos = fStatusPos | kVdriftErrorRange; |
54f2ff1c | 1394 | ok = kFALSE; |
1395 | } | |
a5dcf618 | 1396 | } |
1397 | else return kFALSE; | |
1398 | ||
1399 | if(!fMethodSecond) { | |
1400 | AliTRDCalPad *calPad = (AliTRDCalPad *) fCalibObjects->At(kVdriftPHPad); | |
1401 | if(calPad) { | |
1402 | Double_t mean = calPad->GetMean(); | |
1403 | Double_t rms = calPad->GetRMS(); | |
1404 | //printf("Vdrift::meanpad %f, rmspad %f\n",mean,rms); | |
54f2ff1c | 1405 | if(!((mean > 0.9) && (mean < 1.1) && (rms < 0.6))) { |
82b413fd | 1406 | fStatusPos = fStatusPos | kVdriftErrorRange; |
54f2ff1c | 1407 | ok = kFALSE; |
1408 | } | |
a5dcf618 | 1409 | } |
1410 | else return kFALSE; | |
1411 | } | |
1412 | ||
1413 | return ok; | |
1414 | ||
840ec79d | 1415 | } |
1416 | //__________________________________________________________________________________________________________________________ | |
1417 | Bool_t AliTRDPreprocessorOffline::ValidateExB(){ | |
1418 | // | |
1419 | // Update OCDB entry | |
1420 | // | |
1421 | ||
1422 | AliTRDCalDet *calDet = (AliTRDCalDet *) fCalibObjects->At(kLorentzLinear); | |
1423 | if(calDet) { | |
1424 | Double_t mean = calDet->GetMean(); | |
1425 | Double_t rms = calDet->GetRMSRobust(); | |
1426 | //printf("Vdrift::mean %f, rms %f\n",mean,rms); | |
1427 | if(!((mean > -1.0) && (mean < 1.0) && (rms < 0.5))) { | |
1428 | fStatusNeg = fStatusNeg | kExBErrorRange; | |
1429 | return kFALSE; | |
1430 | } | |
1431 | else return kTRUE; | |
1432 | } | |
1433 | else return kFALSE; | |
1434 | ||
a5dcf618 | 1435 | } |
1436 | //__________________________________________________________________________________________________________________________ | |
1437 | Bool_t AliTRDPreprocessorOffline::ValidateT0(){ | |
1438 | // | |
1439 | // Update OCDB entry | |
1440 | // | |
1441 | ||
1442 | AliTRDCalDet *calDet = (AliTRDCalDet *) fCalibObjects->At(kT0PHDet); | |
1443 | AliTRDCalPad *calPad = (AliTRDCalPad *) fCalibObjects->At(kT0PHPad); | |
1444 | if(calDet && calPad) { | |
1445 | Double_t meandet = calDet->GetMean(); | |
1446 | Double_t rmsdet = calDet->GetRMSRobust(); | |
1447 | Double_t meanpad = calPad->GetMean(); | |
1448 | //Double_t rmspad = calPad->GetRMS(); | |
1449 | //printf("T0::minimum %f, rmsdet %f,meanpad %f, rmspad %f\n",meandet,rmsdet,meanpad,rmspad); | |
1450 | if((meandet > -1.5) && (meandet < 5.0) && (rmsdet < 4.0) && (meanpad < 5.0) && (meanpad > -0.5)) return kTRUE; | |
54f2ff1c | 1451 | else { |
82b413fd | 1452 | fStatusPos = fStatusPos | kTimeOffsetErrorRange; |
54f2ff1c | 1453 | return kFALSE; |
1454 | } | |
a5dcf618 | 1455 | } |
1456 | else return kFALSE; | |
1457 | ||
1458 | } | |
1459 | //__________________________________________________________________________________________________________________________ | |
1460 | Bool_t AliTRDPreprocessorOffline::ValidatePRF() const{ | |
1461 | // | |
1462 | // Update OCDB entry | |
1463 | // | |
1464 | ||
1465 | AliTRDCalPad *calPad = (AliTRDCalPad *) fCalibObjects->At(kPRF); | |
1466 | if(calPad) { | |
1467 | Double_t meanpad = calPad->GetMean(); | |
1468 | Double_t rmspad = calPad->GetRMS(); | |
1469 | //printf("PRF::meanpad %f, rmspad %f\n",meanpad,rmspad); | |
1470 | if((meanpad < 1.0) && (rmspad < 0.8)) return kTRUE; | |
1471 | else return kFALSE; | |
1472 | } | |
1473 | else return kFALSE; | |
1474 | ||
1475 | ||
1476 | } | |
1477 | //__________________________________________________________________________________________________________________________ | |
82b413fd | 1478 | Bool_t AliTRDPreprocessorOffline::ValidateChamberStatus(){ |
00d203b6 | 1479 | // |
1480 | // Update OCDB entry | |
1481 | // | |
1482 | ||
a5dcf618 | 1483 | AliTRDCalChamberStatus *calChamberStatus = (AliTRDCalChamberStatus *) fCalibObjects->At(kChamberStatus); |
1484 | if(calChamberStatus) { | |
83d0cc79 | 1485 | |
1486 | Int_t detectornodata = 0; | |
1487 | Int_t detectorbadcalib = 0; | |
1488 | ||
1489 | for(Int_t sm=0; sm < 18; sm++) { | |
1490 | //printf("%d chambers w/o data in sm %d\n",fNoData[sm],sm); | |
1491 | //printf("%d bad calibrated chambers in sm %d\n",fBadCalib[sm],sm); | |
1492 | if(fNoData[sm] != 30) detectornodata += fNoData[sm]; | |
1493 | detectorbadcalib+=fBadCalib[sm]; | |
a5dcf618 | 1494 | } |
83d0cc79 | 1495 | //printf("Number of chambers w/o data %d\n",detectornodata); |
1496 | //printf("Number of chambers bad calibrated %d\n",detectorbadcalib); | |
1497 | ||
1498 | if((detectornodata > fNoDataValidate) || | |
1499 | (detectorbadcalib > fBadCalibValidate)){ | |
82b413fd | 1500 | fStatusPos = fStatusPos | kChamberStatusErrorRange; |
1501 | return kFALSE; | |
1502 | } | |
83d0cc79 | 1503 | return kTRUE; |
00d203b6 | 1504 | } |
1505 | else return kFALSE; | |
83d0cc79 | 1506 | |
b3fcfd96 | 1507 | } |
4c865c34 | 1508 | //_____________________________________________________________________________ |
1509 | Int_t AliTRDPreprocessorOffline::GetVersion(TString name) const | |
1510 | { | |
1511 | // | |
1512 | // Get version from the title | |
1513 | // | |
1514 | ||
1515 | // Some patterns | |
1516 | const Char_t *version = "Ver"; | |
1517 | if(!strstr(name.Data(),version)) return -1; | |
f558cb62 | 1518 | const Char_t *after = "Subver"; |
1519 | if(!strstr(name.Data(),after)) return -1; | |
1520 | ||
4c865c34 | 1521 | for(Int_t ver = 0; ver < 999999999; ver++) { |
1522 | ||
1523 | TString vertry(version); | |
1524 | vertry += ver; | |
f558cb62 | 1525 | vertry += after; |
4c865c34 | 1526 | |
1527 | //printf("vertry %s and name %s\n",vertry.Data(),name.Data()); | |
1528 | ||
1529 | if(strstr(name.Data(),vertry.Data())) return ver; | |
1530 | ||
1531 | } | |
1532 | ||
1533 | return -1; | |
1534 | ||
1535 | } | |
1536 | ||
1537 | //_____________________________________________________________________________ | |
1538 | Int_t AliTRDPreprocessorOffline::GetSubVersion(TString name) const | |
1539 | { | |
1540 | // | |
1541 | // Get subversion from the title | |
1542 | // | |
1543 | ||
1544 | // Some patterns | |
1545 | const Char_t *subversion = "Subver"; | |
1546 | if(!strstr(name.Data(),subversion)) return -1; | |
f558cb62 | 1547 | const Char_t *after = "FirstRun"; |
1548 | if(!strstr(name.Data(),after)) { | |
1549 | after = "Nz"; | |
1550 | } | |
1551 | if(!strstr(name.Data(),after)) return -1; | |
1552 | ||
4c865c34 | 1553 | |
1554 | for(Int_t ver = 0; ver < 999999999; ver++) { | |
1555 | ||
1556 | TString vertry(subversion); | |
1557 | vertry += ver; | |
f558cb62 | 1558 | vertry += after; |
ca7e6e64 | 1559 | |
1560 | //printf("vertry %s and name %s\n",vertry.Data(),name.Data()); | |
1561 | ||
1562 | if(strstr(name.Data(),vertry.Data())) return ver; | |
1563 | ||
1564 | } | |
1565 | ||
1566 | return -1; | |
1567 | ||
1568 | } | |
1569 | ||
1570 | //_____________________________________________________________________________ | |
1571 | Int_t AliTRDPreprocessorOffline::GetFirstRun(TString name) const | |
1572 | { | |
1573 | // | |
1574 | // Get first run from the title | |
1575 | // | |
1576 | ||
1577 | // Some patterns | |
1578 | const Char_t *firstrun = "FirstRun"; | |
1579 | if(!strstr(name.Data(),firstrun)) return -1; | |
f558cb62 | 1580 | const Char_t *after = "Nz"; |
1581 | if(!strstr(name.Data(),after)) return -1; | |
1582 | ||
ca7e6e64 | 1583 | |
1584 | for(Int_t ver = 0; ver < 999999999; ver++) { | |
1585 | ||
1586 | TString vertry(firstrun); | |
1587 | vertry += ver; | |
f558cb62 | 1588 | vertry += after; |
4c865c34 | 1589 | |
1590 | //printf("vertry %s and name %s\n",vertry.Data(),name.Data()); | |
1591 | ||
1592 | if(strstr(name.Data(),vertry.Data())) return ver; | |
1593 | ||
1594 | } | |
1595 | ||
1596 | return -1; | |
1597 | ||
1598 | } | |
82b413fd | 1599 | //_____________________________________________________________________________ |
1600 | Bool_t AliTRDPreprocessorOffline::CheckStatus(Int_t status, Int_t bitMask) const | |
1601 | { | |
1602 | // | |
1603 | // Checks the status | |
1604 | // | |
1605 | ||
1606 | return (status & bitMask) ? kTRUE : kFALSE; | |
1607 | ||
1608 | } | |
1609 | //_____________________________________________________________________________ | |
1610 | Int_t AliTRDPreprocessorOffline::GetStatus() const | |
1611 | { | |
1612 | // | |
1613 | // Checks the status | |
1614 | // fStatusPos: errors | |
1615 | // fStatusNeg: only info | |
1616 | // | |
1617 | ||
1618 | if(fStatusPos > 0) return fStatusPos; | |
1619 | else return (-TMath::Abs(fStatusNeg)); | |
1620 | ||
1621 | } | |
1622 | //_____________________________________________________________________________ | |
1623 | void AliTRDPreprocessorOffline::PrintStatus() const | |
1624 | { | |
1625 | // | |
1626 | // Do Summary | |
1627 | // | |
1628 | ||
1629 | AliInfo(Form("The error status is %d",fStatusPos)); | |
1630 | AliInfo(Form("IsGainErrorOld? %d",(Int_t)IsGainErrorOld())); | |
1631 | AliInfo(Form("IsVdriftErrorOld? %d",(Int_t)IsVdriftErrorOld())); | |
1632 | AliInfo(Form("IsGainErrorRange? %d",(Int_t)IsGainErrorRange())); | |
1633 | AliInfo(Form("IsVdriftErrorRange? %d",(Int_t)IsVdriftErrorRange())); | |
1634 | AliInfo(Form("IsTimeOffsetErrorRange? %d",(Int_t)IsTimeOffsetErrorRange())); | |
1635 | AliInfo(Form("IsChamberStatusErrorRange? %d",(Int_t)IsChamberStatusErrorRange())); | |
1636 | ||
1637 | ||
1638 | AliInfo(Form("The info status is %d",fStatusNeg)); | |
1639 | AliInfo(Form("IsGainNotEnoughStatsButFill? %d",(Int_t)IsGainNotEnoughStatsButFill())); | |
1640 | AliInfo(Form("IsVdriftNotEnoughStatsButFill? %d",(Int_t)IsVdriftNotEnoughStatsButFill())); | |
1641 | AliInfo(Form("IsGainNotEnoughStatsNotFill? %d",(Int_t)IsGainNotEnoughStatsNotFill())); | |
1642 | AliInfo(Form("IsVdriftNotEnoughStatsNotFill? %d",(Int_t)IsVdriftNotEnoughStatsNotFill())); | |
1643 | AliInfo(Form("IsTimeOffsetNotEnoughStatsNotFill? %d",(Int_t)IsTimeOffsetNotEnoughStatsNotFill())); | |
840ec79d | 1644 | |
1645 | AliInfo(Form("IsExBErrorRange? %d",(Int_t)IsExBErrorRange())); | |
1646 | AliInfo(Form("IsExBErrorOld? %d",(Int_t)IsExBErrorOld())); | |
82b413fd | 1647 | |
1648 | } | |
840ec79d | 1649 | //___________________________________________________________________________________ |
1650 | void AliTRDPreprocessorOffline::SetCalDetVdrift(AliTRDCalDet *calDetVdriftUsed) | |
1651 | { | |
1652 | ||
1653 | fCalDetVdriftUsed = calDetVdriftUsed; | |
1654 | ||
1655 | fCalDetExBUsed = new AliTRDCalDet("lorentz angle tan","lorentz angle tan (detector value)"); | |
1656 | for(Int_t k = 0; k < 540; k++){ | |
1657 | fCalDetExBUsed->SetValue(k,AliTRDCommonParam::Instance()->GetOmegaTau(fCalDetVdriftUsed->GetValue(k))); | |
1658 | //printf("Set the exb object for detector %d, vdrift %f and exb %f\n",k,fCalDetVdriftUsed->GetValue(k),fCalDetExBUsed->GetValue(k)); | |
1659 | } | |
1660 | ||
1661 | }; | |
83d0cc79 | 1662 | //___________________________________________________________________________________ |
1663 | Bool_t AliTRDPreprocessorOffline::SetCalDetGain(Int_t runNumber, Int_t version, Int_t subversion) | |
1664 | { | |
1665 | // | |
1666 | // Set the fCalDetGainUsed | |
1667 | // | |
1668 | ||
1669 | if((version == 0) && (subversion == 0)) return kFALSE; | |
82b413fd | 1670 | |
83d0cc79 | 1671 | AliCDBEntry *entry = AliCDBManager::Instance()->Get("TRD/Calib/ChamberGainFactor",runNumber, version, subversion); |
1672 | if(!entry) { | |
1673 | AliError("Found no entry\n"); | |
1674 | fStatusPos = fStatusPos | kGainErrorOld; | |
1675 | return kFALSE; | |
1676 | } | |
1677 | //const AliCDBId id = entry->GetId(); | |
1678 | //version = id.GetVersion(); | |
1679 | //subversion = id.GetSubVersion(); | |
1680 | //printf("Found version %d and subversion %d for vdrift\n",version,subversion); | |
1681 | AliTRDCalDet* calDet = (AliTRDCalDet *)entry->GetObject(); | |
1682 | if(calDet) fCalDetGainUsed = calDet; | |
1683 | else { | |
1684 | fStatusPos = fStatusPos | kGainErrorOld; | |
1685 | return kFALSE; | |
1686 | } | |
1687 | ||
1688 | return kTRUE; | |
1689 | ||
1690 | } | |
1691 | //___________________________________________________________________________________ | |
1692 | Bool_t AliTRDPreprocessorOffline::SetCalDetVdriftExB(Int_t runNumber, Int_t versionv, Int_t subversionv, Int_t versionexb, Int_t subversionexb) | |
1693 | { | |
1694 | // | |
1695 | // Set the fCalDetVdriftUsed and fCalDetExBUsed | |
1696 | // | |
1697 | ||
1698 | if((versionv == 0) && (subversionv == 0)) return kFALSE; | |
1699 | ||
1700 | AliCDBEntry *entry = AliCDBManager::Instance()->Get("TRD/Calib/ChamberVdrift",runNumber, versionv, subversionv); | |
1701 | if(!entry) { | |
1702 | AliError("Found no entry\n"); | |
1703 | fStatusPos = fStatusPos | kVdriftErrorOld; | |
1704 | return kFALSE; | |
1705 | } | |
1706 | AliTRDCalDet* calDet = (AliTRDCalDet *)entry->GetObject(); | |
1707 | if(calDet) fCalDetVdriftUsed = calDet; | |
1708 | else { | |
1709 | fStatusPos = fStatusPos | kVdriftErrorOld; | |
1710 | return kFALSE; | |
1711 | } | |
1712 | ||
1713 | // ExB object | |
1714 | ||
1715 | if((versionexb == 0) && (subversionexb == 0)) { | |
1716 | ||
1717 | fCalDetExBUsed = new AliTRDCalDet("lorentz angle tan","lorentz angle tan (detector value)"); | |
1718 | for(Int_t k = 0; k < 540; k++){ | |
1719 | fCalDetExBUsed->SetValue(k,AliTRDCommonParam::Instance()->GetOmegaTau(fCalDetVdriftUsed->GetValue(k))); | |
1720 | //printf("Nothing found: set the exb object for detector %d, vdrift %f and exb %f\n",k,fCalDetVdriftUsed->GetValue(k),fCalDetExBUsed->GetValue(k)); | |
1721 | } | |
1722 | } | |
1723 | else { | |
1724 | ||
1725 | entry = 0x0; | |
1726 | entry = AliCDBManager::Instance()->Get("TRD/Calib/ChamberExB",runNumber, versionexb, subversionexb); | |
1727 | if(!entry) { | |
1728 | //printf("Found no entry\n"); | |
1729 | fStatusPos = fStatusPos | kExBErrorOld; | |
1730 | return kFALSE; | |
1731 | } | |
1732 | AliTRDCalDet* calDetexb = (AliTRDCalDet *)entry->GetObject(); | |
1733 | if(!calDetexb) { | |
1734 | fStatusPos = fStatusPos | kExBErrorOld; | |
1735 | return kFALSE; | |
1736 | } | |
1737 | ||
1738 | Double_t meanexb = calDetexb->GetMean(); | |
1739 | //printf("Mean value %f\n",meanexb); | |
1740 | if((meanexb > 70) || (fNoExBUsedInReco)) { | |
1741 | fCalDetExBUsed = new AliTRDCalDet("lorentz angle tan","lorentz angle tan (detector value)"); | |
1742 | for(Int_t k = 0; k < 540; k++){ | |
1743 | fCalDetExBUsed->SetValue(k,AliTRDCommonParam::Instance()->GetOmegaTau(fCalDetVdriftUsed->GetValue(k))); | |
1744 | //printf("Found but: set the exb object for detector %d, vdrift %f and exb %f\n",k,fCalDetVdriftUsed->GetValue(k),fCalDetExBUsed->GetValue(k)); | |
1745 | } | |
1746 | } | |
1747 | else { | |
1748 | fCalDetExBUsed = calDetexb; | |
1749 | } | |
1750 | ||
1751 | } | |
1752 | ||
1753 | ||
1754 | return kTRUE; | |
1755 | ||
1756 | } | |
01239968 | 1757 |