]>
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" | |
49 | #include "TProfile2D.h" | |
50 | #include "AliTRDCalDet.h" | |
51 | #include "AliTRDCalPad.h" | |
52 | #include "AliCDBMetaData.h" | |
53 | #include "AliCDBId.h" | |
54 | #include "AliCDBManager.h" | |
55 | #include "AliCDBStorage.h" | |
56 | #include "AliTRDCalibraMode.h" | |
57 | #include "AliTRDCalibraFit.h" | |
58 | #include "AliTRDCalibraVdriftLinearFit.h" | |
59 | #include "AliTRDPreprocessorOffline.h" | |
81a5aeca | 60 | #include "AliTRDCalChamberStatus.h" |
b3fcfd96 | 61 | |
62 | ||
63 | ClassImp(AliTRDPreprocessorOffline) | |
64 | ||
65 | AliTRDPreprocessorOffline::AliTRDPreprocessorOffline(): | |
01239968 | 66 | TNamed("TPCPreprocessorOffline","TPCPreprocessorOffline"), |
b3fcfd96 | 67 | fMethodSecond(kTRUE), |
01239968 | 68 | fNameList("TRDCalib"), |
69 | fCalDetGainUsed(0x0), | |
4c865c34 | 70 | fCalDetVdriftUsed(0x0), |
b3fcfd96 | 71 | fCH2d(0x0), |
72 | fPH2d(0x0), | |
73 | fPRF2d(0x0), | |
74 | fAliTRDCalibraVdriftLinearFit(0x0), | |
75 | fNEvents(0x0), | |
76 | fAbsoluteGain(0x0), | |
adab6236 | 77 | fPlots(new TObjArray(9)), |
78 | fCalibObjects(new TObjArray(9)), | |
4c865c34 | 79 | fVersionGainUsed(0), |
80 | fSubVersionGainUsed(0), | |
ca7e6e64 | 81 | fFirstRunVdriftUsed(0), |
4c865c34 | 82 | fVersionVdriftUsed(0), |
00d203b6 | 83 | fSubVersionVdriftUsed(0), |
84 | fSwitchOnValidation(kTRUE), | |
85 | fVdriftValidated(kFALSE), | |
a2a4ec8e | 86 | fT0Validated(kFALSE), |
87 | fMinStatsVdriftT0PH(800*20), | |
88 | fMinStatsVdriftLinear(800), | |
89 | fMinStatsGain(800), | |
90 | fMinStatsPRF(600) | |
b3fcfd96 | 91 | { |
92 | // | |
93 | // default constructor | |
94 | // | |
95 | } | |
00d203b6 | 96 | //_________________________________________________________________________________________________________________ |
b3fcfd96 | 97 | AliTRDPreprocessorOffline::~AliTRDPreprocessorOffline() { |
98 | // | |
99 | // Destructor | |
100 | // | |
101 | ||
01239968 | 102 | if(fCalDetGainUsed) delete fCalDetGainUsed; |
4c865c34 | 103 | if(fCalDetVdriftUsed) delete fCalDetVdriftUsed; |
b3fcfd96 | 104 | if(fCH2d) delete fCH2d; |
105 | if(fPH2d) delete fPH2d; | |
106 | if(fPRF2d) delete fPRF2d; | |
107 | if(fAliTRDCalibraVdriftLinearFit) delete fAliTRDCalibraVdriftLinearFit; | |
108 | if(fNEvents) delete fNEvents; | |
109 | if(fAbsoluteGain) delete fAbsoluteGain; | |
110 | if(fPlots) delete fPlots; | |
111 | if(fCalibObjects) delete fCalibObjects; | |
112 | ||
113 | } | |
00d203b6 | 114 | //___________________________________________________________________________________________________________________ |
b3fcfd96 | 115 | |
116 | void AliTRDPreprocessorOffline::CalibVdriftT0(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage){ | |
117 | // | |
118 | // make calibration of the drift velocity | |
119 | // Input parameters: | |
120 | // file - the location of input file | |
121 | // startRunNumber, endRunNumber - run validity period | |
122 | // ocdbStorage - path to the OCDB storage | |
123 | // - if empty - local storage 'pwd' uesed | |
124 | if (ocdbStorage.Length()<=0) ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB"; | |
125 | // | |
126 | // 1. Initialization | |
127 | // | |
008817a3 | 128 | fVdriftValidated = kTRUE; |
129 | fT0Validated = kTRUE; | |
b3fcfd96 | 130 | // |
131 | // 2. extraction of the information | |
132 | // | |
133 | if(ReadVdriftT0Global(file)) AnalyzeVdriftT0(); | |
a5dcf618 | 134 | //printf("Finish PH\n"); |
b3fcfd96 | 135 | if(ReadVdriftLinearFitGlobal(file)) AnalyzeVdriftLinearFit(); |
136 | // | |
137 | // 3. Append QA plots | |
138 | // | |
139 | //MakeDefaultPlots(fVdriftArray,fVdriftArray); | |
140 | // | |
141 | // | |
00d203b6 | 142 | // 4. validate OCDB entries |
b3fcfd96 | 143 | // |
00d203b6 | 144 | if(fSwitchOnValidation==kTRUE && ValidateVdrift()==kFALSE) { |
145 | AliError("TRD vdrift OCDB parameters out of range!"); | |
146 | fVdriftValidated = kFALSE; | |
147 | } | |
148 | if(fSwitchOnValidation==kTRUE && ValidateT0()==kFALSE) { | |
149 | AliError("TRD t0 OCDB parameters out of range!"); | |
150 | fT0Validated = kFALSE; | |
151 | } | |
b3fcfd96 | 152 | // |
00d203b6 | 153 | // 5. update of OCDB |
154 | // | |
155 | // | |
156 | if(fVdriftValidated) UpdateOCDBVdrift(startRunNumber,endRunNumber,ocdbStorage); | |
157 | if(fT0Validated) UpdateOCDBT0(startRunNumber,endRunNumber,ocdbStorage); | |
158 | ||
b3fcfd96 | 159 | } |
00d203b6 | 160 | //_________________________________________________________________________________________________________________ |
b3fcfd96 | 161 | |
162 | void AliTRDPreprocessorOffline::CalibGain(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage){ | |
163 | // | |
164 | // make calibration of the drift velocity | |
165 | // Input parameters: | |
166 | // file - the location of input file | |
167 | // startRunNumber, endRunNumber - run validity period | |
168 | // ocdbStorage - path to the OCDB storage | |
169 | // - if empty - local storage 'pwd' uesed | |
170 | if (ocdbStorage.Length()<=0) ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB"; | |
171 | // | |
172 | // 1. Initialization | |
173 | if(!ReadGainGlobal(file)) return; | |
174 | // | |
175 | // | |
176 | // 2. extraction of the information | |
177 | // | |
178 | AnalyzeGain(); | |
01239968 | 179 | if(fCalDetGainUsed) CorrectFromDetGainUsed(); |
4c865c34 | 180 | if(fCalDetVdriftUsed) CorrectFromDetVdriftUsed(); |
b3fcfd96 | 181 | // |
182 | // 3. Append QA plots | |
183 | // | |
184 | //MakeDefaultPlots(fVdriftArray,fVdriftArray); | |
185 | // | |
186 | // | |
00d203b6 | 187 | // 4. validate OCDB entries |
188 | // | |
189 | if(fSwitchOnValidation==kTRUE && ValidateGain()==kFALSE) { | |
190 | AliError("TRD gain OCDB parameters out of range!"); | |
191 | return; | |
192 | } | |
b3fcfd96 | 193 | // |
00d203b6 | 194 | // 5. update of OCDB |
b3fcfd96 | 195 | // |
00d203b6 | 196 | // |
197 | if((!fCalDetVdriftUsed) || (fCalDetVdriftUsed && fVdriftValidated)) UpdateOCDBGain(startRunNumber,endRunNumber,ocdbStorage); | |
198 | ||
b3fcfd96 | 199 | |
200 | } | |
00d203b6 | 201 | //________________________________________________________________________________________________________________ |
b3fcfd96 | 202 | |
203 | void AliTRDPreprocessorOffline::CalibPRF(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage){ | |
204 | // | |
205 | // make calibration of the drift velocity | |
206 | // Input parameters: | |
207 | // file - the location of input file | |
208 | // startRunNumber, endRunNumber - run validity period | |
209 | // ocdbStorage - path to the OCDB storage | |
210 | // - if empty - local storage 'pwd' uesed | |
211 | if (ocdbStorage.Length()<=0) ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB"; | |
212 | // | |
213 | // 1. Initialization | |
214 | if(!ReadPRFGlobal(file)) return; | |
215 | // | |
216 | // | |
217 | // 2. extraction of the information | |
218 | // | |
219 | AnalyzePRF(); | |
220 | // | |
221 | // 3. Append QA plots | |
222 | // | |
223 | //MakeDefaultPlots(fVdriftArray,fVdriftArray); | |
224 | // | |
225 | // | |
00d203b6 | 226 | // |
227 | // 4. validate OCDB entries | |
228 | // | |
229 | if(fSwitchOnValidation==kTRUE && ValidatePRF()==kFALSE) { | |
230 | AliError("TRD prf OCDB parameters out of range!"); | |
231 | return; | |
232 | } | |
233 | // | |
234 | // 5. update of OCDB | |
b3fcfd96 | 235 | // |
236 | // | |
237 | UpdateOCDBPRF(startRunNumber,endRunNumber,ocdbStorage); | |
238 | ||
a5dcf618 | 239 | } |
240 | //________________________________________________________________________________________________________________ | |
241 | ||
242 | void AliTRDPreprocessorOffline::CalibChamberStatus(Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage){ | |
243 | // | |
244 | // make calibration of the chamber status | |
245 | // Input parameters: | |
246 | // startRunNumber, endRunNumber - run validity period | |
247 | // ocdbStorage - path to the OCDB storage | |
248 | // - if empty - local storage 'pwd' uesed | |
249 | if (ocdbStorage.Length()<=0) ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB"; | |
250 | // | |
251 | // | |
252 | // 2. extraction of the information | |
253 | // | |
254 | if(!AnalyzeChamberStatus()) return; | |
255 | // | |
256 | // 3. Append QA plots | |
257 | // | |
258 | //MakeDefaultPlots(fVdriftArray,fVdriftArray); | |
259 | // | |
260 | // | |
261 | // | |
262 | // 4. validate OCDB entries | |
263 | // | |
264 | if(fSwitchOnValidation==kTRUE && ValidateChamberStatus()==kFALSE) { | |
265 | AliError("TRD Chamber status OCDB parameters not ok!"); | |
266 | return; | |
267 | } | |
268 | // | |
269 | // 5. update of OCDB | |
270 | // | |
271 | // | |
272 | UpdateOCDBChamberStatus(startRunNumber,endRunNumber,ocdbStorage); | |
273 | ||
b3fcfd96 | 274 | } |
00d203b6 | 275 | //______________________________________________________________________________________________________ |
4c865c34 | 276 | Bool_t AliTRDPreprocessorOffline::Init(const Char_t* fileName){ |
277 | // | |
278 | // read the calibration used during the reconstruction | |
279 | // | |
280 | ||
281 | if(ReadVdriftT0Global(fileName)) { | |
282 | ||
283 | TString nameph = fPH2d->GetTitle(); | |
ca7e6e64 | 284 | fFirstRunVdriftUsed = GetFirstRun(nameph); |
4c865c34 | 285 | fVersionVdriftUsed = GetVersion(nameph); |
286 | fSubVersionVdriftUsed = GetSubVersion(nameph); | |
287 | ||
288 | //printf("Found Version %d, Subversion %d for vdrift\n",fVersionVdriftUsed,fSubVersionVdriftUsed); | |
289 | ||
290 | } | |
291 | ||
292 | if(ReadGainGlobal(fileName)) { | |
293 | ||
294 | TString namech = fCH2d->GetTitle(); | |
295 | fVersionGainUsed = GetVersion(namech); | |
296 | fSubVersionGainUsed = GetSubVersion(namech); | |
297 | ||
298 | //printf("Found Version %d, Subversion %d for gain\n",fVersionGainUsed,fSubVersionGainUsed); | |
299 | ||
300 | } | |
301 | ||
302 | return kTRUE; | |
303 | ||
304 | } | |
00d203b6 | 305 | //___________________________________________________________________________________________________________________ |
b3fcfd96 | 306 | |
307 | Bool_t AliTRDPreprocessorOffline::ReadGainGlobal(const Char_t* fileName){ | |
308 | // | |
309 | // read calibration entries from file | |
310 | // | |
4c865c34 | 311 | if(fCH2d) return kTRUE; |
b3fcfd96 | 312 | TFile fcalib(fileName); |
01239968 | 313 | TObjArray * array = (TObjArray*)fcalib.Get(fNameList); |
b3fcfd96 | 314 | if (array){ |
315 | TH2I *ch2d = (TH2I *) array->FindObject("CH2d"); | |
316 | if(!ch2d) return kFALSE; | |
317 | fCH2d = (TH2I*)ch2d->Clone(); | |
318 | //fNEvents = (TH1I *) array->FindObject("NEvents"); | |
319 | //fAbsoluteGain = (TH2F *) array->FindObject("AbsoluteGain"); | |
320 | }else{ | |
321 | TH2I *ch2d = (TH2I *) fcalib.Get("CH2d"); | |
322 | if(!ch2d) return kFALSE; | |
323 | fCH2d = (TH2I*)ch2d->Clone(); | |
324 | //fNEvents = (TH1I *) fcalib.Get("NEvents"); | |
325 | //fAbsoluteGain = (TH2F *) fcalib.Get("AbsoluteGain"); | |
326 | } | |
327 | fCH2d->SetDirectory(0); | |
328 | //printf("title of CH2d %s\n",fCH2d->GetTitle()); | |
329 | ||
330 | return kTRUE; | |
331 | ||
332 | } | |
00d203b6 | 333 | //_________________________________________________________________________________________________________________ |
b3fcfd96 | 334 | |
335 | Bool_t AliTRDPreprocessorOffline::ReadVdriftT0Global(const Char_t* fileName){ | |
336 | // | |
337 | // read calibration entries from file | |
338 | // | |
4c865c34 | 339 | if(fPH2d) return kTRUE; |
b3fcfd96 | 340 | TFile fcalib(fileName); |
01239968 | 341 | TObjArray * array = (TObjArray*)fcalib.Get(fNameList); |
b3fcfd96 | 342 | if (array){ |
343 | TProfile2D *ph2d = (TProfile2D *) array->FindObject("PH2d"); | |
344 | if(!ph2d) return kFALSE; | |
345 | fPH2d = (TProfile2D*)ph2d->Clone(); | |
346 | //fNEvents = (TH1I *) array->FindObject("NEvents"); | |
347 | }else{ | |
348 | TProfile2D *ph2d = (TProfile2D *) fcalib.Get("PH2d"); | |
349 | if(!ph2d) return kFALSE; | |
350 | fPH2d = (TProfile2D*)ph2d->Clone(); | |
351 | //fNEvents = (TH1I *) fcalib.Get("NEvents"); | |
352 | } | |
353 | fPH2d->SetDirectory(0); | |
354 | //printf("title of PH2d %s\n",fPH2d->GetTitle()); | |
355 | ||
356 | return kTRUE; | |
357 | ||
358 | } | |
00d203b6 | 359 | //___________________________________________________________________________________________________________________ |
b3fcfd96 | 360 | |
361 | Bool_t AliTRDPreprocessorOffline::ReadVdriftLinearFitGlobal(const Char_t* fileName){ | |
362 | // | |
363 | // read calibration entries from file | |
364 | // | |
4c865c34 | 365 | if(fAliTRDCalibraVdriftLinearFit) return kTRUE; |
b3fcfd96 | 366 | TFile fcalib(fileName); |
01239968 | 367 | TObjArray * array = (TObjArray*)fcalib.Get(fNameList); |
b3fcfd96 | 368 | if (array){ |
369 | fAliTRDCalibraVdriftLinearFit = (AliTRDCalibraVdriftLinearFit *) array->FindObject("AliTRDCalibraVdriftLinearFit"); | |
370 | //fNEvents = (TH1I *) array->FindObject("NEvents"); | |
371 | }else{ | |
372 | fAliTRDCalibraVdriftLinearFit = (AliTRDCalibraVdriftLinearFit *) fcalib.Get("AliTRDCalibraVdriftLinearFit"); | |
373 | //fNEvents = (TH1I *) fcalib.Get("NEvents"); | |
374 | } | |
375 | if(!fAliTRDCalibraVdriftLinearFit) { | |
376 | //printf("No AliTRDCalibraVdriftLinearFit\n"); | |
377 | return kFALSE; | |
378 | } | |
379 | return kTRUE; | |
380 | ||
381 | } | |
00d203b6 | 382 | //_____________________________________________________________________________________________________________ |
b3fcfd96 | 383 | |
384 | Bool_t AliTRDPreprocessorOffline::ReadPRFGlobal(const Char_t* fileName){ | |
385 | // | |
386 | // read calibration entries from file | |
387 | // | |
4c865c34 | 388 | if(fPRF2d) return kTRUE; |
b3fcfd96 | 389 | TFile fcalib(fileName); |
01239968 | 390 | TObjArray * array = (TObjArray*)fcalib.Get(fNameList); |
b3fcfd96 | 391 | if (array){ |
392 | TProfile2D *prf2d = (TProfile2D *) array->FindObject("PRF2d"); | |
393 | if(!prf2d) return kFALSE; | |
394 | fPRF2d = (TProfile2D*)prf2d->Clone(); | |
395 | //fNEvents = (TH1I *) array->FindObject("NEvents"); | |
396 | }else{ | |
397 | TProfile2D *prf2d = (TProfile2D *) fcalib.Get("PRF2d"); | |
398 | if(!prf2d) return kFALSE; | |
399 | fPRF2d = (TProfile2D*)prf2d->Clone(); | |
400 | //fNEvents = (TH1I *) fcalib.Get("NEvents"); | |
401 | } | |
402 | fPRF2d->SetDirectory(0); | |
403 | //printf("title of PRF2d %s\n",fPRF2d->GetTitle()); | |
404 | ||
405 | return kTRUE; | |
406 | ||
407 | } | |
00d203b6 | 408 | //__________________________________________________________________________________________________________ |
b3fcfd96 | 409 | |
410 | Bool_t AliTRDPreprocessorOffline::AnalyzeGain(){ | |
411 | // | |
412 | // Analyze gain - produce the calibration objects | |
413 | // | |
414 | ||
415 | AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance(); | |
a2a4ec8e | 416 | calibra->SetMinEntries(fMinStatsGain); // If there is less than 1000 entries in the histo: no fit |
b3fcfd96 | 417 | calibra->AnalyseCH(fCH2d); |
418 | ||
419 | Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(0)) | |
420 | + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(0)); | |
421 | Int_t nbfit = calibra->GetNumberFit(); | |
422 | Int_t nbE = calibra->GetNumberEnt(); | |
423 | ||
424 | ||
425 | Bool_t ok = kFALSE; | |
4c865c34 | 426 | Bool_t meanother = kFALSE; |
b3fcfd96 | 427 | // enough statistics |
428 | if ((nbtg > 0) && | |
429 | (nbfit >= 0.5*nbE) && (nbE > 30)) { | |
430 | // create the cal objects | |
4c865c34 | 431 | if(!fCalDetGainUsed) { |
432 | calibra->PutMeanValueOtherVectorFit(1,kTRUE); | |
433 | meanother = kTRUE; | |
434 | } | |
b3fcfd96 | 435 | TObjArray object = calibra->GetVectorFit(); |
4c865c34 | 436 | AliTRDCalDet *calDetGain = calibra->CreateDetObjectGain(&object,meanother); |
b3fcfd96 | 437 | TH1F *coefGain = calDetGain->MakeHisto1DAsFunctionOfDet(); |
438 | // Put them in the array | |
439 | fCalibObjects->AddAt(calDetGain,kGain); | |
440 | fPlots->AddAt(coefGain,kGain); | |
441 | // | |
442 | ok = kTRUE; | |
443 | } | |
444 | ||
445 | calibra->ResetVectorFit(); | |
446 | ||
447 | return ok; | |
448 | ||
449 | } | |
00d203b6 | 450 | //_____________________________________________________________________________________________________ |
b3fcfd96 | 451 | Bool_t AliTRDPreprocessorOffline::AnalyzeVdriftT0(){ |
452 | // | |
453 | // Analyze VdriftT0 - produce the calibration objects | |
454 | // | |
455 | ||
456 | AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance(); | |
a2a4ec8e | 457 | calibra->SetMinEntries(fMinStatsVdriftT0PH); // If there is less than 1000 entries in the histo: no fit |
b3fcfd96 | 458 | calibra->AnalysePH(fPH2d); |
459 | ||
460 | Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(1)) | |
461 | + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(1)); | |
462 | Int_t nbfit = calibra->GetNumberFit(); | |
463 | Int_t nbfitSuccess = calibra->GetNumberFitSuccess(); | |
464 | Int_t nbE = calibra->GetNumberEnt(); | |
465 | ||
466 | //printf("nbtg %d, nbfit %d, nbE %d, nbfitSuccess %d\n",nbtg,nbfit,nbE,nbfitSuccess); | |
467 | ||
468 | Bool_t ok = kFALSE; | |
469 | if ((nbtg > 0) && | |
470 | (nbfit >= 0.5*nbE) && (nbE > 30) && (nbfitSuccess > 30)) { | |
471 | //printf("Pass the cut for VdriftT0\n"); | |
472 | // create the cal objects | |
01239968 | 473 | calibra->RemoveOutliers(1,kFALSE); |
474 | calibra->PutMeanValueOtherVectorFit(1,kFALSE); | |
475 | calibra->RemoveOutliers2(kFALSE); | |
476 | calibra->PutMeanValueOtherVectorFit2(1,kFALSE); | |
477 | // | |
b3fcfd96 | 478 | TObjArray object = calibra->GetVectorFit(); |
479 | AliTRDCalDet *calDetVdrift = calibra->CreateDetObjectVdrift(&object); | |
480 | TH1F *coefVdriftPH = calDetVdrift->MakeHisto1DAsFunctionOfDet(); | |
481 | AliTRDCalPad *calPadVdrift = (AliTRDCalPad *)calibra->CreatePadObjectVdrift(&object,calDetVdrift); | |
482 | TH1F *coefPadVdrift = calPadVdrift->MakeHisto1D(); | |
483 | object = calibra->GetVectorFit2(); | |
484 | AliTRDCalDet *calDetT0 = calibra->CreateDetObjectT0(&object); | |
485 | TH1F *coefT0 = calDetT0->MakeHisto1DAsFunctionOfDet(); | |
486 | AliTRDCalPad *calPadT0 = (AliTRDCalPad *)calibra->CreatePadObjectT0(&object,calDetT0); | |
487 | TH1F *coefPadT0 = calPadT0->MakeHisto1D(); | |
488 | // Put them in the array | |
489 | fCalibObjects->AddAt(calDetT0,kT0PHDet); | |
490 | fCalibObjects->AddAt(calDetVdrift,kVdriftPHDet); | |
491 | fCalibObjects->AddAt(calPadT0,kT0PHPad); | |
492 | fCalibObjects->AddAt(calPadVdrift,kVdriftPHPad); | |
493 | fPlots->AddAt(coefVdriftPH,kVdriftPHDet); | |
494 | fPlots->AddAt(coefT0,kT0PHDet); | |
495 | fPlots->AddAt(coefPadVdrift,kVdriftPHPad); | |
496 | fPlots->AddAt(coefPadT0,kT0PHPad); | |
497 | // | |
498 | ok = kTRUE; | |
499 | } | |
500 | calibra->ResetVectorFit(); | |
501 | ||
502 | return ok; | |
503 | ||
504 | } | |
00d203b6 | 505 | //____________________________________________________________________________________________________________________ |
b3fcfd96 | 506 | Bool_t AliTRDPreprocessorOffline::AnalyzeVdriftLinearFit(){ |
507 | // | |
508 | // Analyze vdrift linear fit - produce the calibration objects | |
509 | // | |
510 | ||
a5dcf618 | 511 | //printf("Analyse linear fit\n"); |
512 | ||
f558cb62 | 513 | |
b3fcfd96 | 514 | AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance(); |
a2a4ec8e | 515 | calibra->SetMinEntries(fMinStatsVdriftLinear); // If there is less than 1000 entries in the histo: no fit |
a5dcf618 | 516 | //printf("Fill PE Array\n"); |
01239968 | 517 | fAliTRDCalibraVdriftLinearFit->FillPEArray(); |
a5dcf618 | 518 | //printf("AliTRDCalibraFit\n"); |
b3fcfd96 | 519 | calibra->AnalyseLinearFitters(fAliTRDCalibraVdriftLinearFit); |
a5dcf618 | 520 | //printf("After\n"); |
b3fcfd96 | 521 | |
522 | //Int_t nbtg = 540; | |
523 | Int_t nbfit = calibra->GetNumberFit(); | |
524 | Int_t nbE = calibra->GetNumberEnt(); | |
525 | ||
526 | ||
527 | Bool_t ok = kFALSE; | |
528 | // enough statistics | |
529 | if ((nbfit >= 0.5*nbE) && (nbE > 30)) { | |
530 | // create the cal objects | |
01239968 | 531 | //calibra->RemoveOutliers(1,kTRUE); |
532 | calibra->PutMeanValueOtherVectorFit(1,kTRUE); | |
533 | //calibra->RemoveOutliers2(kTRUE); | |
534 | calibra->PutMeanValueOtherVectorFit2(1,kTRUE); | |
535 | // | |
b3fcfd96 | 536 | TObjArray object = calibra->GetVectorFit(); |
537 | AliTRDCalDet *calDetVdrift = calibra->CreateDetObjectVdrift(&object,kTRUE); | |
538 | TH1F *coefDriftLinear = calDetVdrift->MakeHisto1DAsFunctionOfDet(); | |
539 | object = calibra->GetVectorFit2(); | |
540 | AliTRDCalDet *calDetLorentz = calibra->CreateDetObjectLorentzAngle(&object); | |
541 | TH1F *coefLorentzAngle = calDetLorentz->MakeHisto1DAsFunctionOfDet(); | |
542 | // Put them in the array | |
543 | fCalibObjects->AddAt(calDetVdrift,kVdriftLinear); | |
544 | fCalibObjects->AddAt(calDetLorentz,kLorentzLinear); | |
545 | fPlots->AddAt(coefDriftLinear,kVdriftLinear); | |
546 | fPlots->AddAt(coefLorentzAngle,kLorentzLinear); | |
547 | // | |
548 | ok = kTRUE; | |
549 | } | |
550 | ||
551 | calibra->ResetVectorFit(); | |
552 | ||
553 | return ok; | |
554 | ||
555 | } | |
00d203b6 | 556 | //________________________________________________________________________________________________________________ |
b3fcfd96 | 557 | |
558 | Bool_t AliTRDPreprocessorOffline::AnalyzePRF(){ | |
559 | // | |
560 | // Analyze PRF - produce the calibration objects | |
561 | // | |
562 | ||
563 | AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance(); | |
a2a4ec8e | 564 | calibra->SetMinEntries(fMinStatsPRF); // If there is less than 1000 entries in the histo: no fit |
b3fcfd96 | 565 | calibra->AnalysePRFMarianFit(fPRF2d); |
566 | ||
567 | Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(2)) | |
568 | + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(2)); | |
569 | Int_t nbfit = calibra->GetNumberFit(); | |
570 | Int_t nbE = calibra->GetNumberEnt(); | |
571 | ||
572 | ||
573 | Bool_t ok = kFALSE; | |
574 | // enough statistics | |
575 | if ((nbtg > 0) && | |
576 | (nbfit >= 0.95*nbE) && (nbE > 30)) { | |
577 | // create the cal objects | |
578 | TObjArray object = calibra->GetVectorFit(); | |
579 | AliTRDCalPad *calPadPRF = (AliTRDCalPad*) calibra->CreatePadObjectPRF(&object); | |
580 | TH1F *coefPRF = calPadPRF->MakeHisto1D(); | |
581 | // Put them in the array | |
582 | fCalibObjects->AddAt(calPadPRF,kPRF); | |
583 | fPlots->AddAt(coefPRF,kPRF); | |
584 | // | |
585 | ok = kTRUE; | |
586 | } | |
587 | ||
588 | calibra->ResetVectorFit(); | |
589 | ||
590 | return ok; | |
591 | ||
592 | } | |
a5dcf618 | 593 | |
594 | //_____________________________________________________________________________ | |
595 | Bool_t AliTRDPreprocessorOffline::AnalyzeChamberStatus() | |
596 | { | |
4c865c34 | 597 | // |
a5dcf618 | 598 | // Produce AliTRDCalChamberStatus out of calibration results |
4c865c34 | 599 | // |
b61b92a0 | 600 | |
a5dcf618 | 601 | // set up AliTRDCalChamberStatus |
602 | AliTRDCalChamberStatus *CalChamberStatus = new AliTRDCalChamberStatus(); | |
603 | for(Int_t det = 0; det < 540; det++) CalChamberStatus->SetStatus(det,1); | |
01239968 | 604 | |
a5dcf618 | 605 | // get calibration objects |
606 | AliTRDCalDet *calDetGain = (AliTRDCalDet *) fCalibObjects->At(kGain); | |
607 | AliTRDCalDet *calDetVDrift = (AliTRDCalDet *) fCalibObjects->At(kVdriftLinear); | |
608 | ||
609 | // Check | |
b61b92a0 | 610 | if((!calDetGain) || (!calDetVDrift) || (!fCH2d)) return kFALSE; |
a5dcf618 | 611 | |
612 | // Gain | |
613 | Double_t gainmean = calDetGain->GetMean(); | |
614 | Double_t vdriftmean = calDetVDrift->GetMean(); | |
615 | ||
616 | Double_t gainrms = calDetGain->GetRMSRobust(); | |
617 | Double_t vdriftrms = calDetVDrift->GetRMSRobust(); | |
618 | ||
619 | //printf("Gain mean: %f, rms: %f\n",gainmean,gainrms); | |
620 | //printf("Vdrift mean: %f, rms: %f\n",vdriftmean,vdriftrms); | |
4c865c34 | 621 | |
a5dcf618 | 622 | // Check |
623 | if((TMath::Abs(gainrms) < 0.001) || (TMath::Abs(vdriftrms) < 0.001)) return kFALSE; | |
01239968 | 624 | |
a5dcf618 | 625 | // mask chambers with empty gain entries |
626 | //Int_t counter = 0; | |
627 | for (Int_t idet = 0; idet < 540; idet++) { | |
01239968 | 628 | |
a5dcf618 | 629 | // ch2d |
630 | TH1I *projch = (TH1I *) fCH2d->ProjectionX("projch",idet+1,idet+1,(Option_t *)"e"); | |
631 | Double_t entries = projch->GetEntries(); | |
4c865c34 | 632 | |
a5dcf618 | 633 | // gain |
634 | Double_t gain = calDetGain->GetValue(idet); | |
4c865c34 | 635 | |
a5dcf618 | 636 | // vdrift |
637 | Double_t vdrift = calDetVDrift->GetValue(idet); | |
4c865c34 | 638 | |
4c865c34 | 639 | |
a5dcf618 | 640 | if(entries<=0.5 || |
641 | TMath::Abs(gainmean-gain) > (15.0*gainrms) || | |
642 | TMath::Abs(vdriftmean-vdrift) > (15.0*vdriftrms)) { | |
643 | ||
644 | //printf(" chamber det %03d masked \n",idet); | |
645 | //printf(" gainmean %f and gain %f, gainrms %f \n",gainmean,gain,gainrms); | |
646 | //printf(" vdriftmean %f and vdrift %f, vdriftrms %f \n",vdriftmean,vdrift,vdriftrms); | |
647 | CalChamberStatus->SetStatus(idet,AliTRDCalChamberStatus::kMasked); | |
648 | //counter++; | |
649 | } | |
4c865c34 | 650 | |
a5dcf618 | 651 | /* |
652 | // installed supermodules+1 -> abort | |
653 | if(counter > (7+1)*30) { | |
654 | printf("ERROR: more than one SM to be masked!! \n Abort...\n"); | |
655 | if(projch) delete projch; | |
656 | return 0x0; | |
657 | } | |
658 | */ | |
4c865c34 | 659 | |
b61b92a0 | 660 | delete projch; |
661 | ||
a5dcf618 | 662 | } |
b3fcfd96 | 663 | |
a5dcf618 | 664 | // Security |
665 | for(Int_t sm=0; sm < 18; sm++) { | |
666 | Int_t counter = 0; | |
667 | for(Int_t det = 0; det < 30; det++){ | |
668 | Int_t detector = sm*30+det; | |
669 | if(CalChamberStatus->IsMasked(detector)) counter++; | |
670 | } | |
671 | if(counter >= 10) { | |
672 | for(Int_t det = 0; det < 30; det++){ | |
673 | Int_t detector = sm*30+det; | |
674 | CalChamberStatus->SetStatus(detector,AliTRDCalChamberStatus::kInstalled); | |
675 | } | |
676 | } | |
677 | } | |
b3fcfd96 | 678 | |
a5dcf618 | 679 | fCalibObjects->AddAt(CalChamberStatus,kChamberStatus); |
680 | return kTRUE; | |
b3fcfd96 | 681 | |
a5dcf618 | 682 | } |
b3fcfd96 | 683 | |
b3fcfd96 | 684 | |
a5dcf618 | 685 | //________________________________________________________________________________________________ |
686 | void AliTRDPreprocessorOffline::CorrectFromDetGainUsed() { | |
687 | // | |
688 | // Correct from the gas gain used afterwards | |
689 | // | |
690 | AliTRDCalDet *calDetGain = (AliTRDCalDet *) fCalibObjects->At(kGain); | |
691 | if(!calDetGain) return; | |
b3fcfd96 | 692 | |
a5dcf618 | 693 | // Calculate mean |
694 | Double_t mean = 0.0; | |
695 | Int_t nbdet = 0; | |
b3fcfd96 | 696 | |
a5dcf618 | 697 | for(Int_t det = 0; det < 540; det++) { |
00d203b6 | 698 | |
a5dcf618 | 699 | Float_t gaininit = fCalDetGainUsed->GetValue(det); |
700 | Float_t gainout = calDetGain->GetValue(det); | |
00d203b6 | 701 | |
00d203b6 | 702 | |
a5dcf618 | 703 | if(TMath::Abs(gainout-1.0) > 0.000001) { |
704 | mean += (gaininit*gainout); | |
705 | nbdet++; | |
706 | } | |
707 | } | |
708 | if(nbdet > 0) mean = mean/nbdet; | |
00d203b6 | 709 | |
a5dcf618 | 710 | for(Int_t det = 0; det < 540; det++) { |
00d203b6 | 711 | |
a5dcf618 | 712 | Float_t gaininit = fCalDetGainUsed->GetValue(det); |
713 | Float_t gainout = calDetGain->GetValue(det); | |
714 | ||
ba1aa7a7 | 715 | if(TMath::Abs(gainout-1.0) > 0.000001) { |
716 | Double_t newgain = gaininit*gainout; | |
717 | if(newgain < 0.1) newgain = 0.1; | |
58e2b572 | 718 | if(newgain > 1.9) newgain = 1.9; |
ba1aa7a7 | 719 | calDetGain->SetValue(det,newgain); |
720 | } | |
721 | else { | |
722 | Double_t newgain = mean; | |
723 | if(newgain < 0.1) newgain = 0.1; | |
58e2b572 | 724 | if(newgain > 1.9) newgain = 1.9; |
ba1aa7a7 | 725 | calDetGain->SetValue(det,newgain); |
726 | } | |
a5dcf618 | 727 | } |
728 | ||
729 | ||
730 | } | |
731 | //________________________________________________________________________________________________ | |
732 | void AliTRDPreprocessorOffline::CorrectFromDetVdriftUsed() { | |
733 | // | |
734 | // Correct from the drift velocity | |
735 | // | |
736 | ||
737 | //printf("Correct for vdrift\n"); | |
738 | ||
739 | AliTRDCalDet *calDetGain = (AliTRDCalDet *) fCalibObjects->At(kGain); | |
740 | if(!calDetGain) return; | |
741 | ||
742 | Int_t detVdrift = kVdriftPHDet; | |
743 | if(fMethodSecond) detVdrift = kVdriftLinear; | |
744 | AliTRDCalDet *calDetVdrift = (AliTRDCalDet *) fCalibObjects->At(detVdrift); | |
745 | if(!calDetVdrift) return; | |
746 | ||
747 | // Calculate mean | |
748 | ||
749 | for(Int_t det = 0; det < 540; det++) { | |
750 | ||
751 | Float_t vdriftinit = fCalDetVdriftUsed->GetValue(det); | |
752 | Float_t vdriftout = calDetVdrift->GetValue(det); | |
753 | ||
754 | Float_t gain = calDetGain->GetValue(det); | |
755 | if(vdriftout > 0.0) gain = gain*vdriftinit/vdriftout; | |
ba1aa7a7 | 756 | if(gain < 0.1) gain = 0.1; |
58e2b572 | 757 | if(gain > 1.9) gain = 1.9; |
a5dcf618 | 758 | calDetGain->SetValue(det,gain); |
759 | ||
760 | ||
761 | } | |
762 | ||
763 | } | |
764 | //_________________________________________________________________________________________________________________ | |
765 | void AliTRDPreprocessorOffline::UpdateOCDBGain(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath){ | |
766 | // | |
767 | // Update OCDB entry | |
768 | // | |
769 | ||
770 | AliCDBMetaData *metaData= new AliCDBMetaData(); | |
771 | metaData->SetObjectClassName("AliTRDCalDet"); | |
772 | metaData->SetResponsible("Raphaelle Bailhache"); | |
773 | metaData->SetBeamPeriod(1); | |
774 | ||
775 | AliCDBId id1("TRD/Calib/ChamberGainFactor", startRunNumber, endRunNumber); | |
776 | AliCDBStorage * gStorage = AliCDBManager::Instance()->GetStorage(storagePath); | |
777 | AliTRDCalDet *calDet = (AliTRDCalDet *) fCalibObjects->At(kGain); | |
778 | if(calDet) gStorage->Put(calDet, id1, metaData); | |
779 | ||
780 | ||
781 | } | |
782 | //___________________________________________________________________________________________________________________ | |
783 | void AliTRDPreprocessorOffline::UpdateOCDBVdrift(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath){ | |
784 | // | |
785 | // Update OCDB entry | |
786 | // | |
787 | ||
788 | Int_t detVdrift = kVdriftPHDet; | |
789 | ||
790 | if(fMethodSecond) detVdrift = kVdriftLinear; | |
791 | ||
792 | AliCDBMetaData *metaData= new AliCDBMetaData(); | |
793 | metaData->SetObjectClassName("AliTRDCalDet"); | |
794 | metaData->SetResponsible("Raphaelle Bailhache"); | |
795 | metaData->SetBeamPeriod(1); | |
796 | ||
797 | AliCDBId id1("TRD/Calib/ChamberVdrift", startRunNumber, endRunNumber); | |
798 | AliCDBStorage * gStorage = AliCDBManager::Instance()->GetStorage(storagePath); | |
799 | AliTRDCalDet *calDet = (AliTRDCalDet *) fCalibObjects->At(detVdrift); | |
800 | if(calDet) gStorage->Put(calDet, id1, metaData); | |
801 | ||
802 | // | |
803 | ||
804 | if(!fMethodSecond) { | |
805 | ||
806 | AliCDBMetaData *metaDataPad= new AliCDBMetaData(); | |
807 | metaDataPad->SetObjectClassName("AliTRDCalPad"); | |
808 | metaDataPad->SetResponsible("Raphaelle Bailhache"); | |
809 | metaDataPad->SetBeamPeriod(1); | |
810 | ||
811 | AliCDBId id1Pad("TRD/Calib/LocalVdrift", startRunNumber, endRunNumber); | |
812 | AliTRDCalPad *calPad = (AliTRDCalPad *) fCalibObjects->At(kVdriftPHPad); | |
813 | if(calPad) gStorage->Put(calPad, id1Pad, metaDataPad); | |
814 | ||
815 | } | |
816 | ||
817 | } | |
818 | //________________________________________________________________________________________________________________________ | |
819 | void AliTRDPreprocessorOffline::UpdateOCDBT0(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath){ | |
820 | // | |
821 | // Update OCDB entry | |
822 | // | |
823 | ||
824 | AliCDBMetaData *metaData= new AliCDBMetaData(); | |
825 | metaData->SetObjectClassName("AliTRDCalDet"); | |
826 | metaData->SetResponsible("Raphaelle Bailhache"); | |
827 | metaData->SetBeamPeriod(1); | |
828 | ||
829 | AliCDBId id1("TRD/Calib/ChamberT0", startRunNumber, endRunNumber); | |
830 | AliCDBStorage * gStorage = AliCDBManager::Instance()->GetStorage(storagePath); | |
831 | AliTRDCalDet *calDet = (AliTRDCalDet *) fCalibObjects->At(kT0PHDet); | |
832 | if(calDet) gStorage->Put(calDet, id1, metaData); | |
833 | ||
834 | // | |
835 | ||
836 | AliCDBMetaData *metaDataPad= new AliCDBMetaData(); | |
837 | metaDataPad->SetObjectClassName("AliTRDCalPad"); | |
838 | metaDataPad->SetResponsible("Raphaelle Bailhache"); | |
839 | metaDataPad->SetBeamPeriod(1); | |
840 | ||
841 | AliCDBId id1Pad("TRD/Calib/LocalT0", startRunNumber, endRunNumber); | |
842 | AliTRDCalPad *calPad = (AliTRDCalPad *) fCalibObjects->At(kT0PHPad); | |
843 | if(calPad) gStorage->Put(calPad, id1Pad, metaDataPad); | |
844 | ||
845 | ||
846 | ||
847 | } | |
848 | //_________________________________________________________________________________________________________________ | |
849 | void AliTRDPreprocessorOffline::UpdateOCDBPRF(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath){ | |
850 | // | |
851 | // Update OCDB entry | |
852 | // | |
853 | ||
854 | AliCDBMetaData *metaData= new AliCDBMetaData(); | |
855 | metaData->SetObjectClassName("AliTRDCalPad"); | |
856 | metaData->SetResponsible("Raphaelle Bailhache"); | |
857 | metaData->SetBeamPeriod(1); | |
858 | ||
859 | AliCDBId id1("TRD/Calib/PRFWidth", startRunNumber, endRunNumber); | |
860 | AliCDBStorage * gStorage = AliCDBManager::Instance()->GetStorage(storagePath); | |
861 | AliTRDCalPad *calPad = (AliTRDCalPad *) fCalibObjects->At(kPRF); | |
862 | if(calPad) gStorage->Put(calPad, id1, metaData); | |
863 | ||
864 | ||
865 | } | |
866 | //_________________________________________________________________________________________________________________ | |
867 | void AliTRDPreprocessorOffline::UpdateOCDBChamberStatus(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath){ | |
868 | // | |
869 | // Update OCDB entry | |
870 | // | |
871 | ||
872 | AliCDBMetaData *metaData= new AliCDBMetaData(); | |
873 | metaData->SetObjectClassName("AliTRDCalChamberStatus"); | |
874 | metaData->SetResponsible("Raphaelle Bailhache"); | |
875 | metaData->SetBeamPeriod(1); | |
876 | ||
877 | AliCDBId id1("TRD/Calib/ChamberStatus", startRunNumber, endRunNumber); | |
878 | AliCDBStorage * gStorage = AliCDBManager::Instance()->GetStorage(storagePath); | |
879 | AliTRDCalChamberStatus *calChamberStatus = (AliTRDCalChamberStatus *) fCalibObjects->At(kChamberStatus); | |
880 | if(calChamberStatus) gStorage->Put(calChamberStatus, id1, metaData); | |
881 | ||
882 | ||
883 | } | |
884 | //__________________________________________________________________________________________________________________________ | |
885 | Bool_t AliTRDPreprocessorOffline::ValidateGain() const { | |
886 | // | |
887 | // Validate OCDB entry | |
888 | // | |
889 | ||
890 | AliTRDCalDet *calDet = (AliTRDCalDet *) fCalibObjects->At(kGain); | |
891 | if(calDet) { | |
892 | Double_t mean = calDet->GetMean(); | |
893 | Double_t rms = calDet->GetRMSRobust(); | |
894 | if((mean > 0.2) && (mean < 1.4) && (rms < 0.5)) return kTRUE; | |
895 | //if((mean > 0.2) && (mean < 1.4)) return kTRUE; | |
896 | else return kFALSE; | |
897 | } | |
898 | else return kFALSE; | |
899 | ||
900 | ||
901 | } | |
902 | //__________________________________________________________________________________________________________________________ | |
903 | Bool_t AliTRDPreprocessorOffline::ValidateVdrift(){ | |
904 | // | |
905 | // Update OCDB entry | |
906 | // | |
907 | ||
908 | Int_t detVdrift = kVdriftPHDet; | |
909 | Bool_t ok = kTRUE; | |
910 | ||
911 | if(fMethodSecond) detVdrift = kVdriftLinear; | |
912 | ||
913 | AliTRDCalDet *calDet = (AliTRDCalDet *) fCalibObjects->At(detVdrift); | |
914 | if(calDet) { | |
915 | Double_t mean = calDet->GetMean(); | |
916 | Double_t rms = calDet->GetRMSRobust(); | |
917 | //printf("Vdrift::mean %f, rms %f\n",mean,rms); | |
918 | if(!((mean > 1.0) && (mean < 2.0) && (rms < 0.5))) ok = kFALSE; | |
919 | } | |
920 | else return kFALSE; | |
921 | ||
922 | if(!fMethodSecond) { | |
923 | AliTRDCalPad *calPad = (AliTRDCalPad *) fCalibObjects->At(kVdriftPHPad); | |
924 | if(calPad) { | |
925 | Double_t mean = calPad->GetMean(); | |
926 | Double_t rms = calPad->GetRMS(); | |
927 | //printf("Vdrift::meanpad %f, rmspad %f\n",mean,rms); | |
928 | if(!((mean > 0.9) && (mean < 1.1) && (rms < 0.6))) ok = kFALSE; | |
929 | } | |
930 | else return kFALSE; | |
931 | } | |
932 | ||
933 | return ok; | |
934 | ||
935 | } | |
936 | //__________________________________________________________________________________________________________________________ | |
937 | Bool_t AliTRDPreprocessorOffline::ValidateT0(){ | |
938 | // | |
939 | // Update OCDB entry | |
940 | // | |
941 | ||
942 | AliTRDCalDet *calDet = (AliTRDCalDet *) fCalibObjects->At(kT0PHDet); | |
943 | AliTRDCalPad *calPad = (AliTRDCalPad *) fCalibObjects->At(kT0PHPad); | |
944 | if(calDet && calPad) { | |
945 | Double_t meandet = calDet->GetMean(); | |
946 | Double_t rmsdet = calDet->GetRMSRobust(); | |
947 | Double_t meanpad = calPad->GetMean(); | |
948 | //Double_t rmspad = calPad->GetRMS(); | |
949 | //printf("T0::minimum %f, rmsdet %f,meanpad %f, rmspad %f\n",meandet,rmsdet,meanpad,rmspad); | |
950 | if((meandet > -1.5) && (meandet < 5.0) && (rmsdet < 4.0) && (meanpad < 5.0) && (meanpad > -0.5)) return kTRUE; | |
951 | else return kFALSE; | |
952 | } | |
953 | else return kFALSE; | |
954 | ||
955 | } | |
956 | //__________________________________________________________________________________________________________________________ | |
957 | Bool_t AliTRDPreprocessorOffline::ValidatePRF() const{ | |
958 | // | |
959 | // Update OCDB entry | |
960 | // | |
961 | ||
962 | AliTRDCalPad *calPad = (AliTRDCalPad *) fCalibObjects->At(kPRF); | |
963 | if(calPad) { | |
964 | Double_t meanpad = calPad->GetMean(); | |
965 | Double_t rmspad = calPad->GetRMS(); | |
966 | //printf("PRF::meanpad %f, rmspad %f\n",meanpad,rmspad); | |
967 | if((meanpad < 1.0) && (rmspad < 0.8)) return kTRUE; | |
968 | else return kFALSE; | |
969 | } | |
970 | else return kFALSE; | |
971 | ||
972 | ||
973 | } | |
974 | //__________________________________________________________________________________________________________________________ | |
975 | Bool_t AliTRDPreprocessorOffline::ValidateChamberStatus() const{ | |
00d203b6 | 976 | // |
977 | // Update OCDB entry | |
978 | // | |
979 | ||
a5dcf618 | 980 | AliTRDCalChamberStatus *calChamberStatus = (AliTRDCalChamberStatus *) fCalibObjects->At(kChamberStatus); |
981 | if(calChamberStatus) { | |
982 | Int_t detectormasked = 0; | |
983 | for(Int_t det = 0; det < 540; det++) { | |
984 | if(calChamberStatus->IsMasked(det)) detectormasked++; | |
985 | } | |
986 | //printf("Number of chambers masked %d\n",detectormasked); | |
987 | if(detectormasked > 29) return kFALSE; | |
988 | else return kTRUE; | |
00d203b6 | 989 | } |
990 | else return kFALSE; | |
991 | ||
b3fcfd96 | 992 | } |
4c865c34 | 993 | //_____________________________________________________________________________ |
994 | Int_t AliTRDPreprocessorOffline::GetVersion(TString name) const | |
995 | { | |
996 | // | |
997 | // Get version from the title | |
998 | // | |
999 | ||
1000 | // Some patterns | |
1001 | const Char_t *version = "Ver"; | |
1002 | if(!strstr(name.Data(),version)) return -1; | |
f558cb62 | 1003 | const Char_t *after = "Subver"; |
1004 | if(!strstr(name.Data(),after)) return -1; | |
1005 | ||
4c865c34 | 1006 | for(Int_t ver = 0; ver < 999999999; ver++) { |
1007 | ||
1008 | TString vertry(version); | |
1009 | vertry += ver; | |
f558cb62 | 1010 | vertry += after; |
4c865c34 | 1011 | |
1012 | //printf("vertry %s and name %s\n",vertry.Data(),name.Data()); | |
1013 | ||
1014 | if(strstr(name.Data(),vertry.Data())) return ver; | |
1015 | ||
1016 | } | |
1017 | ||
1018 | return -1; | |
1019 | ||
1020 | } | |
1021 | ||
1022 | //_____________________________________________________________________________ | |
1023 | Int_t AliTRDPreprocessorOffline::GetSubVersion(TString name) const | |
1024 | { | |
1025 | // | |
1026 | // Get subversion from the title | |
1027 | // | |
1028 | ||
1029 | // Some patterns | |
1030 | const Char_t *subversion = "Subver"; | |
1031 | if(!strstr(name.Data(),subversion)) return -1; | |
f558cb62 | 1032 | const Char_t *after = "FirstRun"; |
1033 | if(!strstr(name.Data(),after)) { | |
1034 | after = "Nz"; | |
1035 | } | |
1036 | if(!strstr(name.Data(),after)) return -1; | |
1037 | ||
4c865c34 | 1038 | |
1039 | for(Int_t ver = 0; ver < 999999999; ver++) { | |
1040 | ||
1041 | TString vertry(subversion); | |
1042 | vertry += ver; | |
f558cb62 | 1043 | vertry += after; |
ca7e6e64 | 1044 | |
1045 | //printf("vertry %s and name %s\n",vertry.Data(),name.Data()); | |
1046 | ||
1047 | if(strstr(name.Data(),vertry.Data())) return ver; | |
1048 | ||
1049 | } | |
1050 | ||
1051 | return -1; | |
1052 | ||
1053 | } | |
1054 | ||
1055 | //_____________________________________________________________________________ | |
1056 | Int_t AliTRDPreprocessorOffline::GetFirstRun(TString name) const | |
1057 | { | |
1058 | // | |
1059 | // Get first run from the title | |
1060 | // | |
1061 | ||
1062 | // Some patterns | |
1063 | const Char_t *firstrun = "FirstRun"; | |
1064 | if(!strstr(name.Data(),firstrun)) return -1; | |
f558cb62 | 1065 | const Char_t *after = "Nz"; |
1066 | if(!strstr(name.Data(),after)) return -1; | |
1067 | ||
ca7e6e64 | 1068 | |
1069 | for(Int_t ver = 0; ver < 999999999; ver++) { | |
1070 | ||
1071 | TString vertry(firstrun); | |
1072 | vertry += ver; | |
f558cb62 | 1073 | vertry += after; |
4c865c34 | 1074 | |
1075 | //printf("vertry %s and name %s\n",vertry.Data(),name.Data()); | |
1076 | ||
1077 | if(strstr(name.Data(),vertry.Data())) return ver; | |
1078 | ||
1079 | } | |
1080 | ||
1081 | return -1; | |
1082 | ||
1083 | } | |
01239968 | 1084 |