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