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