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