]>
Commit | Line | Data |
---|---|---|
c5bbaa2c | 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 | // Class providing the calibration parameters by accessing the CDB // | |
20 | // // | |
21 | // Request an instance with AliTPCcalibDB::Instance() // | |
22 | // If a new event is processed set the event number with SetRun // | |
1ac191a6 | 23 | // Then request the calibration data //// |
f5344549 | 24 | // |
25 | // | |
1ac191a6 | 26 | // Calibration data: |
8cd9634d | 27 | // 0.) Altro mapping |
28 | // Simulation - not yet | |
29 | // Reconstruction - AliTPCclustererMI::Digits2Clusters(AliRawReader* rawReader) | |
30 | // | |
1ac191a6 | 31 | // 1.) pad by pad calibration - AliTPCCalPad |
f5344549 | 32 | // |
1ac191a6 | 33 | // a.) fPadGainFactor |
34 | // Simulation: AliTPCDigitizer::ExecFast - Multiply by gain | |
35 | // Reconstruction : AliTPCclustererMI::Digits2Clusters - Divide by gain | |
f5344549 | 36 | // |
1ac191a6 | 37 | // b.) fPadNoise - |
38 | // Simulation: AliTPCDigitizer::ExecFast | |
39 | // Reconstruction: AliTPCclustererMI::FindClusters(AliTPCCalROC * noiseROC) | |
8cd9634d | 40 | // Noise depending cut on clusters charge (n sigma) |
f5344549 | 41 | // c.) fPedestal: |
42 | // Simulation: Not used yet - To be impleneted - Rounding to the nearest integer | |
43 | // Reconstruction: Used in AliTPCclustererMI::Digits2Clusters(AliRawReader* rawReader) | |
44 | // if data taken without zero suppression | |
45 | // Currently switch in fRecoParam->GetCalcPedestal(); | |
46 | // | |
47 | // d.) fPadTime0 | |
48 | // Simulation: applied in the AliTPC::MakeSector - adding offset | |
49 | // Reconstruction: AliTPCTransform::Transform() - remove offset | |
50 | // AliTPCTransform::Transform() - to be called | |
51 | // in AliTPCtracker::Transform() | |
8cd9634d | 52 | // |
53 | // | |
54 | // 2.) Space points transformation: | |
55 | // | |
56 | // a.) General coordinate tranformation - AliTPCtransform (see $ALICE_ROOT/TPC/AliTPCtransform.cxx) | |
57 | // Created on fly - use the other calibration components | |
58 | // Unisochronity - (substract time0 - pad by pad) | |
59 | // Drift velocity - Currently common drift velocity - functionality of AliTPCParam | |
60 | // ExB effect | |
61 | // Simulation - Not used directly (the effects are applied one by one (see AliTPC::MakeSector) | |
62 | // Reconstruction - | |
63 | // AliTPCclustererMI::AddCluster | |
64 | // AliTPCtrackerMI::Transform | |
65 | // b.) ExB effect calibration - | |
66 | // classes (base class AliTPCExB, implementation- AliTPCExBExact.h AliTPCExBFirst.h) | |
67 | // a.a) Simulation: applied in the AliTPC::MakeSector - | |
68 | // calib->GetExB()->CorrectInverse(dxyz0,dxyz1); | |
69 | // a.b) Reconstruction - | |
70 | // | |
71 | // in AliTPCtransform::Correct() - called calib->GetExB()->Correct(dxyz0,dxyz1) | |
72 | // | |
96305e49 | 73 | // 3.) cluster error, shape and Q parameterization |
74 | // | |
75 | // | |
8cd9634d | 76 | // |
c5bbaa2c | 77 | /////////////////////////////////////////////////////////////////////////////// |
78 | ||
418bbcaf | 79 | #include <iostream> |
80 | #include <fstream> | |
81 | ||
c5bbaa2c | 82 | |
83 | #include <AliCDBManager.h> | |
c5bbaa2c | 84 | #include <AliCDBEntry.h> |
85 | #include <AliLog.h> | |
86 | ||
87 | #include "AliTPCcalibDB.h" | |
d6834f5f | 88 | #include "AliTPCAltroMapping.h" |
418bbcaf | 89 | #include "AliTPCExB.h" |
c5bbaa2c | 90 | |
91 | #include "AliTPCCalROC.h" | |
92 | #include "AliTPCCalPad.h" | |
54472e4f | 93 | #include "AliTPCSensorTempArray.h" |
418bbcaf | 94 | #include "AliTPCTransform.h" |
d6834f5f | 95 | |
418bbcaf | 96 | class AliCDBStorage; |
97 | class AliTPCCalDet; | |
86df2b3a | 98 | // |
99 | // | |
100 | ||
86df2b3a | 101 | #include "TFile.h" |
102 | #include "TKey.h" | |
103 | ||
104 | #include "TObjArray.h" | |
105 | #include "TObjString.h" | |
106 | #include "TString.h" | |
107 | #include "AliTPCCalPad.h" | |
0fe7645c | 108 | #include "AliTPCCalibPulser.h" |
86df2b3a | 109 | #include "AliTPCCalibPedestal.h" |
110 | #include "AliTPCCalibCE.h" | |
111 | ||
112 | ||
113 | ||
114 | ||
c5bbaa2c | 115 | |
116 | ClassImp(AliTPCcalibDB) | |
117 | ||
118 | AliTPCcalibDB* AliTPCcalibDB::fgInstance = 0; | |
119 | Bool_t AliTPCcalibDB::fgTerminated = kFALSE; | |
120 | ||
121 | ||
122 | //_ singleton implementation __________________________________________________ | |
123 | AliTPCcalibDB* AliTPCcalibDB::Instance() | |
124 | { | |
125 | // | |
126 | // Singleton implementation | |
127 | // Returns an instance of this class, it is created if neccessary | |
128 | // | |
129 | ||
130 | if (fgTerminated != kFALSE) | |
131 | return 0; | |
132 | ||
133 | if (fgInstance == 0) | |
134 | fgInstance = new AliTPCcalibDB(); | |
135 | ||
136 | return fgInstance; | |
137 | } | |
138 | ||
139 | void AliTPCcalibDB::Terminate() | |
140 | { | |
141 | // | |
142 | // Singleton implementation | |
143 | // Deletes the instance of this class and sets the terminated flag, instances cannot be requested anymore | |
144 | // This function can be called several times. | |
145 | // | |
146 | ||
147 | fgTerminated = kTRUE; | |
148 | ||
149 | if (fgInstance != 0) | |
150 | { | |
151 | delete fgInstance; | |
152 | fgInstance = 0; | |
153 | } | |
154 | } | |
155 | ||
156 | //_____________________________________________________________________________ | |
e4dce695 | 157 | AliTPCcalibDB::AliTPCcalibDB(): |
158 | fRun(-1), | |
f5344549 | 159 | fTransform(0), |
481f877b | 160 | fExB(0), |
e4dce695 | 161 | fPadGainFactor(0), |
162 | fPadTime0(0), | |
e4dce695 | 163 | fPadNoise(0), |
164 | fPedestals(0), | |
165 | fTemperature(0), | |
d6834f5f | 166 | fMapping(0), |
7a9e557b | 167 | fRecoParamArray(0), |
96305e49 | 168 | fParam(0), |
169 | fClusterParam(0) | |
c5bbaa2c | 170 | { |
171 | // | |
172 | // constructor | |
173 | // | |
54472e4f | 174 | // |
c5bbaa2c | 175 | Update(); // temporary |
176 | } | |
177 | ||
178 | //_____________________________________________________________________________ | |
179 | AliTPCcalibDB::~AliTPCcalibDB() | |
180 | { | |
181 | // | |
182 | // destructor | |
183 | // | |
68751c2c | 184 | |
185 | // don't delete anything, CDB cache is active! | |
186 | //if (fPadGainFactor) delete fPadGainFactor; | |
187 | //if (fPadTime0) delete fPadTime0; | |
68751c2c | 188 | //if (fPadNoise) delete fPadNoise; |
c5bbaa2c | 189 | } |
190 | ||
191 | ||
192 | //_____________________________________________________________________________ | |
193 | AliCDBEntry* AliTPCcalibDB::GetCDBEntry(const char* cdbPath) | |
194 | { | |
195 | // | |
196 | // Retrieves an entry with path <cdbPath> from the CDB. | |
197 | // | |
198 | char chinfo[1000]; | |
199 | ||
68751c2c | 200 | AliCDBEntry* entry = AliCDBManager::Instance()->Get(cdbPath, fRun); |
c5bbaa2c | 201 | if (!entry) |
202 | { | |
203 | sprintf(chinfo,"AliTPCcalibDB: Failed to get entry:\t%s ", cdbPath); | |
204 | AliError(chinfo); | |
205 | return 0; | |
206 | } | |
207 | return entry; | |
208 | } | |
209 | ||
210 | ||
211 | //_____________________________________________________________________________ | |
212 | void AliTPCcalibDB::SetRun(Long64_t run) | |
213 | { | |
214 | // | |
215 | // Sets current run number. Calibration data is read from the corresponding file. | |
216 | // | |
217 | if (fRun == run) | |
218 | return; | |
219 | fRun = run; | |
220 | Update(); | |
221 | } | |
222 | ||
223 | ||
224 | ||
225 | void AliTPCcalibDB::Update(){ | |
226 | // | |
227 | AliCDBEntry * entry=0; | |
68751c2c | 228 | |
229 | Bool_t cdbCache = AliCDBManager::Instance()->GetCacheFlag(); // save cache status | |
230 | AliCDBManager::Instance()->SetCacheFlag(kTRUE); // activate CDB cache | |
231 | ||
c5bbaa2c | 232 | // |
233 | entry = GetCDBEntry("TPC/Calib/PadGainFactor"); | |
234 | if (entry){ | |
68751c2c | 235 | //if (fPadGainFactor) delete fPadGainFactor; |
c5bbaa2c | 236 | entry->SetOwner(kTRUE); |
237 | fPadGainFactor = (AliTPCCalPad*)entry->GetObject(); | |
238 | } | |
239 | // | |
240 | entry = GetCDBEntry("TPC/Calib/PadTime0"); | |
241 | if (entry){ | |
68751c2c | 242 | //if (fPadTime0) delete fPadTime0; |
c5bbaa2c | 243 | entry->SetOwner(kTRUE); |
244 | fPadTime0 = (AliTPCCalPad*)entry->GetObject(); | |
245 | } | |
246 | // | |
c5bbaa2c | 247 | // |
248 | entry = GetCDBEntry("TPC/Calib/PadNoise"); | |
249 | if (entry){ | |
68751c2c | 250 | //if (fPadNoise) delete fPadNoise; |
c5bbaa2c | 251 | entry->SetOwner(kTRUE); |
252 | fPadNoise = (AliTPCCalPad*)entry->GetObject(); | |
253 | } | |
8477f500 | 254 | |
255 | entry = GetCDBEntry("TPC/Calib/Pedestals"); | |
256 | if (entry){ | |
257 | //if (fPedestals) delete fPedestals; | |
258 | entry->SetOwner(kTRUE); | |
259 | fPedestals = (AliTPCCalPad*)entry->GetObject(); | |
260 | } | |
261 | ||
54472e4f | 262 | entry = GetCDBEntry("TPC/Calib/Temperature"); |
263 | if (entry){ | |
264 | //if (fTemperature) delete fTemperature; | |
265 | entry->SetOwner(kTRUE); | |
266 | fTemperature = (AliTPCSensorTempArray*)entry->GetObject(); | |
267 | } | |
268 | ||
7a9e557b | 269 | |
270 | entry = GetCDBEntry("TPC/Calib/RecoParam"); | |
271 | if (entry){ | |
272 | entry->SetOwner(kTRUE); | |
273 | fRecoParamArray = (TObjArray*)(entry->GetObject()); | |
274 | } | |
275 | ||
276 | ||
8477f500 | 277 | entry = GetCDBEntry("TPC/Calib/Parameters"); |
278 | if (entry){ | |
54472e4f | 279 | //if (fPadNoise) delete fPadNoise; |
8477f500 | 280 | entry->SetOwner(kTRUE); |
a778f7e3 | 281 | fParam = (AliTPCParam*)(entry->GetObject()->Clone()); |
8477f500 | 282 | } |
283 | ||
96305e49 | 284 | entry = GetCDBEntry("TPC/Calib/ClusterParam"); |
285 | if (entry){ | |
286 | //if (fPadNoise) delete fPadNoise; | |
287 | entry->SetOwner(kTRUE); | |
288 | fClusterParam = (AliTPCClusterParam*)(entry->GetObject()->Clone()); | |
289 | } | |
290 | ||
d6834f5f | 291 | entry = GetCDBEntry("TPC/Calib/Mapping"); |
292 | if (entry){ | |
293 | //if (fPadNoise) delete fPadNoise; | |
294 | entry->SetOwner(kTRUE); | |
295 | TObjArray * array = dynamic_cast<TObjArray*>(entry->GetObject()); | |
296 | if (array && array->GetEntriesFast()==6){ | |
297 | fMapping = new AliTPCAltroMapping*[6]; | |
298 | for (Int_t i=0; i<6; i++){ | |
299 | fMapping[i] = dynamic_cast<AliTPCAltroMapping*>(array->At(i)); | |
300 | } | |
301 | } | |
302 | } | |
303 | ||
304 | ||
305 | ||
481f877b | 306 | entry = GetCDBEntry("TPC/Calib/ExB"); |
307 | if (entry) { | |
308 | entry->SetOwner(kTRUE); | |
309 | fExB=dynamic_cast<AliTPCExB*>(entry->GetObject()->Clone()); | |
310 | } | |
311 | ||
f5344549 | 312 | if (!fTransform) { |
313 | fTransform=new AliTPCTransform(); | |
314 | } | |
8477f500 | 315 | |
c5bbaa2c | 316 | // |
68751c2c | 317 | AliCDBManager::Instance()->SetCacheFlag(cdbCache); // reset original CDB cache |
318 | ||
c5bbaa2c | 319 | } |
f4a89669 | 320 | AliTPCcalibDB::AliTPCcalibDB(const AliTPCcalibDB& ): |
321 | fRun(-1), | |
322 | fTransform(0), | |
323 | fExB(0), | |
324 | fPadGainFactor(0), | |
325 | fPadTime0(0), | |
326 | fPadNoise(0), | |
327 | fPedestals(0), | |
328 | fTemperature(0), | |
329 | fMapping(0), | |
330 | fRecoParamArray(0), | |
331 | fParam(0), | |
332 | fClusterParam(0) | |
333 | ||
e4dce695 | 334 | { |
335 | // | |
336 | // Copy constructor invalid -- singleton implementation | |
337 | // | |
338 | Error("copy constructor","invalid -- singleton implementation"); | |
339 | } | |
340 | ||
f4a89669 | 341 | AliTPCcalibDB& AliTPCcalibDB::operator= (const AliTPCcalibDB& ) |
e4dce695 | 342 | { |
343 | // | |
344 | // Singleton implementation - no assignment operator | |
345 | // | |
346 | Error("operator =", "assignment operator not implemented"); | |
347 | return *this; | |
348 | } | |
349 | ||
86df2b3a | 350 | |
351 | ||
352 | void AliTPCcalibDB::CreateObjectList(const Char_t *filename, TObjArray *calibObjects) | |
353 | { | |
418bbcaf | 354 | // |
355 | // Create calibration objects and read contents from OCDB | |
356 | // | |
86df2b3a | 357 | if ( calibObjects == 0x0 ) return; |
358 | ifstream in; | |
359 | in.open(filename); | |
360 | if ( !in.is_open() ){ | |
361 | fprintf(stderr,"Error: cannot open list file '%s'", filename); | |
362 | return; | |
363 | } | |
364 | ||
365 | AliTPCCalPad *calPad=0x0; | |
366 | ||
367 | TString sFile; | |
368 | sFile.ReadFile(in); | |
369 | in.close(); | |
370 | ||
371 | TObjArray *arrFileLine = sFile.Tokenize("\n"); | |
372 | ||
373 | TIter nextLine(arrFileLine); | |
374 | ||
375 | TObjString *sObjLine=0x0; | |
376 | while ( sObjLine = (TObjString*)nextLine() ){ | |
377 | TString sLine(sObjLine->GetString()); | |
378 | ||
379 | TObjArray *arrNextCol = sLine.Tokenize("\t"); | |
380 | ||
381 | TObjString *sObjType = (TObjString*)(arrNextCol->At(0)); | |
382 | TObjString *sObjFileName = (TObjString*)(arrNextCol->At(1)); | |
383 | ||
384 | if ( !sObjType || ! sObjFileName ) continue; | |
385 | TString sType(sObjType->GetString()); | |
386 | TString sFileName(sObjFileName->GetString()); | |
387 | printf("%s\t%s\n",sType.Data(),sFileName.Data()); | |
388 | ||
389 | TFile *fIn = TFile::Open(sFileName); | |
390 | if ( !fIn ){ | |
391 | fprintf(stderr,"File not found: '%s'", sFileName.Data()); | |
392 | continue; | |
393 | } | |
394 | ||
395 | if ( sType == "CE" ){ | |
396 | AliTPCCalibCE *ce = (AliTPCCalibCE*)fIn->Get("AliTPCCalibCE"); | |
397 | ||
398 | calPad = new AliTPCCalPad((TObjArray*)ce->GetCalPadT0()); | |
399 | calPad->SetNameTitle("CETmean","CETmean"); | |
400 | calibObjects->Add(calPad); | |
401 | ||
402 | calPad = new AliTPCCalPad((TObjArray*)ce->GetCalPadQ()); | |
403 | calPad->SetNameTitle("CEQmean","CEQmean"); | |
404 | calibObjects->Add(calPad); | |
405 | ||
406 | calPad = new AliTPCCalPad((TObjArray*)ce->GetCalPadRMS()); | |
407 | calPad->SetNameTitle("CETrms","CETrms"); | |
408 | calibObjects->Add(calPad); | |
409 | ||
410 | } else if ( sType == "Pulser") { | |
0fe7645c | 411 | AliTPCCalibPulser *sig = (AliTPCCalibPulser*)fIn->Get("AliTPCCalibPulser"); |
86df2b3a | 412 | |
413 | calPad = new AliTPCCalPad((TObjArray*)sig->GetCalPadT0()); | |
414 | calPad->SetNameTitle("PulserTmean","PulserTmean"); | |
415 | calibObjects->Add(calPad); | |
416 | ||
417 | calPad = new AliTPCCalPad((TObjArray*)sig->GetCalPadQ()); | |
418 | calPad->SetNameTitle("PulserQmean","PulserQmean"); | |
419 | calibObjects->Add(calPad); | |
420 | ||
421 | calPad = new AliTPCCalPad((TObjArray*)sig->GetCalPadRMS()); | |
422 | calPad->SetNameTitle("PulserTrms","PulserTrms"); | |
423 | calibObjects->Add(calPad); | |
424 | ||
425 | } else if ( sType == "Pedestals") { | |
426 | AliTPCCalibPedestal *ped = (AliTPCCalibPedestal*)fIn->Get("AliTPCCalibPedestal"); | |
427 | ||
428 | calPad = new AliTPCCalPad((TObjArray*)ped->GetCalPadPedestal()); | |
429 | calPad->SetNameTitle("Pedestals","Pedestals"); | |
430 | calibObjects->Add(calPad); | |
431 | ||
432 | calPad = new AliTPCCalPad((TObjArray*)ped->GetCalPadRMS()); | |
433 | calPad->SetNameTitle("Noise","Noise"); | |
434 | calibObjects->Add(calPad); | |
435 | ||
436 | } else { | |
437 | fprintf(stderr,"Undefined Type: '%s'",sType.Data()); | |
438 | ||
439 | } | |
440 | delete fIn; | |
441 | } | |
442 | } | |
443 | ||
444 | ||
445 | ||
446 | void AliTPCcalibDB::MakeTree(const char * fileName, TObjArray * array, const char * mapFileName, AliTPCCalPad* outlierPad, Float_t ltmFraction) { | |
447 | // | |
448 | // Write a tree with all available information | |
418bbcaf | 449 | // if mapFileName is specified, the Map information are also written to the tree |
86df2b3a | 450 | // pads specified in outlierPad are not used for calculating statistics |
451 | // - the same function as AliTPCCalPad::MakeTree - | |
452 | // | |
453 | AliTPCROC* tpcROCinstance = AliTPCROC::Instance(); | |
454 | ||
455 | TObjArray* mapIROCs = 0; | |
456 | TObjArray* mapOROCs = 0; | |
457 | TVectorF *mapIROCArray = 0; | |
458 | TVectorF *mapOROCArray = 0; | |
459 | Int_t mapEntries = 0; | |
460 | TString* mapNames = 0; | |
461 | ||
462 | if (mapFileName) { | |
463 | TFile mapFile(mapFileName, "read"); | |
464 | ||
465 | TList* listOfROCs = mapFile.GetListOfKeys(); | |
466 | mapEntries = listOfROCs->GetEntries()/2; | |
467 | mapIROCs = new TObjArray(mapEntries*2); | |
468 | mapOROCs = new TObjArray(mapEntries*2); | |
469 | mapIROCArray = new TVectorF[mapEntries]; | |
470 | mapOROCArray = new TVectorF[mapEntries]; | |
471 | ||
472 | mapNames = new TString[mapEntries]; | |
473 | for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) { | |
418bbcaf | 474 | TString nameROC(((TKey*)(listOfROCs->At(ivalue*2)))->GetName()); |
475 | nameROC.Remove(nameROC.Length()-4, 4); | |
476 | mapIROCs->AddAt((AliTPCCalROC*)mapFile.Get((nameROC + "IROC").Data()), ivalue); | |
477 | mapOROCs->AddAt((AliTPCCalROC*)mapFile.Get((nameROC + "OROC").Data()), ivalue); | |
478 | mapNames[ivalue].Append(nameROC); | |
86df2b3a | 479 | } |
480 | ||
481 | for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) { | |
482 | mapIROCArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(0)); | |
483 | mapOROCArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(36)); | |
484 | ||
485 | for (UInt_t ichannel = 0; ichannel < tpcROCinstance->GetNChannels(0); ichannel++) | |
486 | (mapIROCArray[ivalue])[ichannel] = ((AliTPCCalROC*)(mapIROCs->At(ivalue)))->GetValue(ichannel); | |
487 | for (UInt_t ichannel = 0; ichannel < tpcROCinstance->GetNChannels(36); ichannel++) | |
488 | (mapOROCArray[ivalue])[ichannel] = ((AliTPCCalROC*)(mapOROCs->At(ivalue)))->GetValue(ichannel); | |
489 | } | |
490 | ||
491 | } // if (mapFileName) | |
492 | ||
493 | TTreeSRedirector cstream(fileName); | |
494 | Int_t arrayEntries = array->GetEntries(); | |
495 | ||
496 | TString* names = new TString[arrayEntries]; | |
497 | for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) | |
498 | names[ivalue].Append(((AliTPCCalPad*)array->At(ivalue))->GetName()); | |
499 | ||
500 | for (UInt_t isector = 0; isector < tpcROCinstance->GetNSectors(); isector++) { | |
501 | // | |
502 | // get statistic for given sector | |
503 | // | |
504 | TVectorF median(arrayEntries); | |
505 | TVectorF mean(arrayEntries); | |
506 | TVectorF rms(arrayEntries); | |
507 | TVectorF ltm(arrayEntries); | |
508 | TVectorF ltmrms(arrayEntries); | |
509 | TVectorF medianWithOut(arrayEntries); | |
510 | TVectorF meanWithOut(arrayEntries); | |
511 | TVectorF rmsWithOut(arrayEntries); | |
512 | TVectorF ltmWithOut(arrayEntries); | |
513 | TVectorF ltmrmsWithOut(arrayEntries); | |
514 | ||
515 | TVectorF *vectorArray = new TVectorF[arrayEntries]; | |
516 | for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) | |
517 | vectorArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(isector)); | |
518 | ||
519 | for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) { | |
520 | AliTPCCalPad* calPad = (AliTPCCalPad*) array->At(ivalue); | |
521 | AliTPCCalROC* calROC = calPad->GetCalROC(isector); | |
522 | AliTPCCalROC* outlierROC = 0; | |
523 | if (outlierPad) outlierROC = outlierPad->GetCalROC(isector); | |
524 | if (calROC) { | |
525 | median[ivalue] = calROC->GetMedian(); | |
526 | mean[ivalue] = calROC->GetMean(); | |
527 | rms[ivalue] = calROC->GetRMS(); | |
528 | Double_t ltmrmsValue = 0; | |
529 | ltm[ivalue] = calROC->GetLTM(<mrmsValue, ltmFraction); | |
530 | ltmrms[ivalue] = ltmrmsValue; | |
531 | if (outlierROC) { | |
532 | medianWithOut[ivalue] = calROC->GetMedian(outlierROC); | |
533 | meanWithOut[ivalue] = calROC->GetMean(outlierROC); | |
534 | rmsWithOut[ivalue] = calROC->GetRMS(outlierROC); | |
535 | ltmrmsValue = 0; | |
536 | ltmWithOut[ivalue] = calROC->GetLTM(<mrmsValue, ltmFraction, outlierROC); | |
537 | ltmrmsWithOut[ivalue] = ltmrmsValue; | |
538 | } | |
539 | } | |
540 | else { | |
541 | median[ivalue] = 0.; | |
542 | mean[ivalue] = 0.; | |
543 | rms[ivalue] = 0.; | |
544 | ltm[ivalue] = 0.; | |
545 | ltmrms[ivalue] = 0.; | |
546 | medianWithOut[ivalue] = 0.; | |
547 | meanWithOut[ivalue] = 0.; | |
548 | rmsWithOut[ivalue] = 0.; | |
549 | ltmWithOut[ivalue] = 0.; | |
550 | ltmrmsWithOut[ivalue] = 0.; | |
551 | } | |
552 | } | |
553 | ||
554 | // | |
555 | // fill vectors of variable per pad | |
556 | // | |
557 | TVectorF *posArray = new TVectorF[8]; | |
558 | for (Int_t ivalue = 0; ivalue < 8; ivalue++) | |
559 | posArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(isector)); | |
560 | ||
561 | Float_t posG[3] = {0}; | |
562 | Float_t posL[3] = {0}; | |
563 | Int_t ichannel = 0; | |
564 | for (UInt_t irow = 0; irow < tpcROCinstance->GetNRows(isector); irow++) { | |
565 | for (UInt_t ipad = 0; ipad < tpcROCinstance->GetNPads(isector, irow); ipad++) { | |
566 | tpcROCinstance->GetPositionLocal(isector, irow, ipad, posL); | |
567 | tpcROCinstance->GetPositionGlobal(isector, irow, ipad, posG); | |
568 | posArray[0][ichannel] = irow; | |
569 | posArray[1][ichannel] = ipad; | |
570 | posArray[2][ichannel] = posL[0]; | |
571 | posArray[3][ichannel] = posL[1]; | |
572 | posArray[4][ichannel] = posG[0]; | |
573 | posArray[5][ichannel] = posG[1]; | |
574 | posArray[6][ichannel] = (Int_t)(ipad - (Double_t)(tpcROCinstance->GetNPads(isector, irow))/2); | |
575 | posArray[7][ichannel] = ichannel; | |
576 | ||
577 | // loop over array containing AliTPCCalPads | |
578 | for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) { | |
579 | AliTPCCalPad* calPad = (AliTPCCalPad*) array->At(ivalue); | |
580 | AliTPCCalROC* calROC = calPad->GetCalROC(isector); | |
581 | if (calROC) | |
582 | (vectorArray[ivalue])[ichannel] = calROC->GetValue(irow, ipad); | |
583 | else | |
584 | (vectorArray[ivalue])[ichannel] = 0; | |
585 | } | |
586 | ichannel++; | |
587 | } | |
588 | } | |
589 | ||
590 | cstream << "calPads" << | |
591 | "sector=" << isector; | |
592 | ||
593 | for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) { | |
594 | cstream << "calPads" << | |
595 | (Char_t*)((names[ivalue] + "_Median=").Data()) << median[ivalue] << | |
596 | (Char_t*)((names[ivalue] + "_Mean=").Data()) << mean[ivalue] << | |
597 | (Char_t*)((names[ivalue] + "_RMS=").Data()) << rms[ivalue] << | |
598 | (Char_t*)((names[ivalue] + "_LTM=").Data()) << ltm[ivalue] << | |
599 | (Char_t*)((names[ivalue] + "_RMS_LTM=").Data()) << ltmrms[ivalue]; | |
600 | if (outlierPad) { | |
601 | cstream << "calPads" << | |
602 | (Char_t*)((names[ivalue] + "_Median_OutlierCutted=").Data()) << medianWithOut[ivalue] << | |
603 | (Char_t*)((names[ivalue] + "_Mean_OutlierCutted=").Data()) << meanWithOut[ivalue] << | |
604 | (Char_t*)((names[ivalue] + "_RMS_OutlierCutted=").Data()) << rmsWithOut[ivalue] << | |
605 | (Char_t*)((names[ivalue] + "_LTM_OutlierCutted=").Data()) << ltmWithOut[ivalue] << | |
606 | (Char_t*)((names[ivalue] + "_RMS_LTM_OutlierCutted=").Data()) << ltmrmsWithOut[ivalue]; | |
607 | } | |
608 | } | |
609 | ||
610 | for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) { | |
611 | cstream << "calPads" << | |
612 | (Char_t*)((names[ivalue] + ".=").Data()) << &vectorArray[ivalue]; | |
613 | } | |
614 | ||
615 | if (mapFileName) { | |
616 | for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) { | |
617 | if (isector < 36) | |
618 | cstream << "calPads" << | |
619 | (Char_t*)((mapNames[ivalue] + ".=").Data()) << &mapIROCArray[ivalue]; | |
620 | else | |
621 | cstream << "calPads" << | |
622 | (Char_t*)((mapNames[ivalue] + ".=").Data()) << &mapOROCArray[ivalue]; | |
623 | } | |
624 | } | |
625 | ||
626 | cstream << "calPads" << | |
627 | "row.=" << &posArray[0] << | |
628 | "pad.=" << &posArray[1] << | |
629 | "lx.=" << &posArray[2] << | |
630 | "ly.=" << &posArray[3] << | |
631 | "gx.=" << &posArray[4] << | |
632 | "gy.=" << &posArray[5] << | |
633 | "rpad.=" << &posArray[6] << | |
634 | "channel.=" << &posArray[7]; | |
635 | ||
636 | cstream << "calPads" << | |
637 | "\n"; | |
638 | ||
639 | delete[] posArray; | |
640 | delete[] vectorArray; | |
641 | } | |
642 | ||
643 | ||
644 | delete[] names; | |
645 | if (mapFileName) { | |
646 | delete mapIROCs; | |
647 | delete mapOROCs; | |
648 | delete[] mapIROCArray; | |
649 | delete[] mapOROCArray; | |
650 | delete[] mapNames; | |
651 | } | |
652 | } | |
653 | ||
7a9e557b | 654 | |
655 | AliTPCRecoParam * AliTPCcalibDB::GetRecoParam(Int_t */*eventtype*/){ | |
656 | // | |
657 | // | |
658 | // | |
659 | if (!fRecoParamArray){ | |
660 | return 0; // back compatible sollution | |
661 | }; | |
662 | ||
663 | AliTPCRecoParam * param = (AliTPCRecoParam*)fRecoParamArray->At(0); | |
664 | return param; | |
665 | ||
666 | } |