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