]>
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> | |
3ac615eb | 86 | #include <AliMagF.h> |
87 | #include <AliMagWrapCheb.h> | |
c5bbaa2c | 88 | |
89 | #include "AliTPCcalibDB.h" | |
d6834f5f | 90 | #include "AliTPCAltroMapping.h" |
418bbcaf | 91 | #include "AliTPCExB.h" |
c5bbaa2c | 92 | |
93 | #include "AliTPCCalROC.h" | |
94 | #include "AliTPCCalPad.h" | |
54472e4f | 95 | #include "AliTPCSensorTempArray.h" |
bf85fe4d | 96 | #include "AliGRPObject.h" |
418bbcaf | 97 | #include "AliTPCTransform.h" |
d6834f5f | 98 | |
418bbcaf | 99 | class AliCDBStorage; |
100 | class AliTPCCalDet; | |
86df2b3a | 101 | // |
102 | // | |
103 | ||
86df2b3a | 104 | #include "TFile.h" |
105 | #include "TKey.h" | |
106 | ||
107 | #include "TObjArray.h" | |
108 | #include "TObjString.h" | |
109 | #include "TString.h" | |
110 | #include "AliTPCCalPad.h" | |
0fe7645c | 111 | #include "AliTPCCalibPulser.h" |
86df2b3a | 112 | #include "AliTPCCalibPedestal.h" |
113 | #include "AliTPCCalibCE.h" | |
3ac615eb | 114 | #include "AliTPCExBFirst.h" |
bf85fe4d | 115 | #include "AliTPCTempMap.h" |
da6c0bc9 | 116 | #include "AliTPCCalibVdrift.h" |
86df2b3a | 117 | |
118 | ||
119 | ||
c5bbaa2c | 120 | |
121 | ClassImp(AliTPCcalibDB) | |
122 | ||
123 | AliTPCcalibDB* AliTPCcalibDB::fgInstance = 0; | |
124 | Bool_t AliTPCcalibDB::fgTerminated = kFALSE; | |
3ac615eb | 125 | TObjArray AliTPCcalibDB::fgExBArray; // array of ExB corrections |
c5bbaa2c | 126 | |
127 | ||
128 | //_ singleton implementation __________________________________________________ | |
129 | AliTPCcalibDB* AliTPCcalibDB::Instance() | |
130 | { | |
131 | // | |
132 | // Singleton implementation | |
133 | // Returns an instance of this class, it is created if neccessary | |
134 | // | |
135 | ||
136 | if (fgTerminated != kFALSE) | |
137 | return 0; | |
138 | ||
139 | if (fgInstance == 0) | |
140 | fgInstance = new AliTPCcalibDB(); | |
141 | ||
142 | return fgInstance; | |
143 | } | |
144 | ||
145 | void AliTPCcalibDB::Terminate() | |
146 | { | |
147 | // | |
148 | // Singleton implementation | |
149 | // Deletes the instance of this class and sets the terminated flag, instances cannot be requested anymore | |
150 | // This function can be called several times. | |
151 | // | |
152 | ||
153 | fgTerminated = kTRUE; | |
154 | ||
155 | if (fgInstance != 0) | |
156 | { | |
157 | delete fgInstance; | |
158 | fgInstance = 0; | |
159 | } | |
160 | } | |
161 | ||
162 | //_____________________________________________________________________________ | |
e4dce695 | 163 | AliTPCcalibDB::AliTPCcalibDB(): |
9389f9a4 | 164 | TObject(), |
e4dce695 | 165 | fRun(-1), |
f5344549 | 166 | fTransform(0), |
481f877b | 167 | fExB(0), |
e4dce695 | 168 | fPadGainFactor(0), |
9f6e9f81 | 169 | fDedxGainFactor(0), |
e4dce695 | 170 | fPadTime0(0), |
e4dce695 | 171 | fPadNoise(0), |
172 | fPedestals(0), | |
173 | fTemperature(0), | |
d6834f5f | 174 | fMapping(0), |
96305e49 | 175 | fParam(0), |
bf85fe4d | 176 | fClusterParam(0), |
da6c0bc9 | 177 | fGRPArray(100000), //! array of GRPs - per run - JUST for calibration studies |
178 | fGoofieArray(100000), //! array of GOOFIE values -per run - Just for calibration studies | |
179 | fTemperatureArray(100000), //! array of temperature sensors - per run - Just for calibration studies | |
180 | fVdriftArray(100000), //! array of v drift interfaces | |
bf85fe4d | 181 | fRunList(100000) //! run list - indicates try to get the run param |
182 | ||
c5bbaa2c | 183 | { |
184 | // | |
185 | // constructor | |
186 | // | |
54472e4f | 187 | // |
c5bbaa2c | 188 | Update(); // temporary |
189 | } | |
190 | ||
9389f9a4 | 191 | AliTPCcalibDB::AliTPCcalibDB(const AliTPCcalibDB& ): |
192 | TObject(), | |
193 | fRun(-1), | |
194 | fTransform(0), | |
195 | fExB(0), | |
196 | fPadGainFactor(0), | |
9f6e9f81 | 197 | fDedxGainFactor(0), |
9389f9a4 | 198 | fPadTime0(0), |
199 | fPadNoise(0), | |
200 | fPedestals(0), | |
201 | fTemperature(0), | |
202 | fMapping(0), | |
9389f9a4 | 203 | fParam(0), |
bf85fe4d | 204 | fClusterParam(0), |
205 | fGRPArray(0), //! array of GRPs - per run - JUST for calibration studies | |
206 | fGoofieArray(0), //! array of GOOFIE values -per run - Just for calibration studies | |
207 | fTemperatureArray(0), //! array of temperature sensors - per run - Just for calibration studies | |
da6c0bc9 | 208 | fVdriftArray(0), //! array of v drift interfaces |
bf85fe4d | 209 | fRunList(0) //! run list - indicates try to get the run param |
9389f9a4 | 210 | { |
211 | // | |
212 | // Copy constructor invalid -- singleton implementation | |
213 | // | |
214 | Error("copy constructor","invalid -- singleton implementation"); | |
215 | } | |
216 | ||
217 | AliTPCcalibDB& AliTPCcalibDB::operator= (const AliTPCcalibDB& ) | |
218 | { | |
219 | // | |
220 | // Singleton implementation - no assignment operator | |
221 | // | |
222 | Error("operator =", "assignment operator not implemented"); | |
223 | return *this; | |
224 | } | |
225 | ||
226 | ||
227 | ||
c5bbaa2c | 228 | //_____________________________________________________________________________ |
229 | AliTPCcalibDB::~AliTPCcalibDB() | |
230 | { | |
231 | // | |
232 | // destructor | |
233 | // | |
68751c2c | 234 | |
235 | // don't delete anything, CDB cache is active! | |
236 | //if (fPadGainFactor) delete fPadGainFactor; | |
237 | //if (fPadTime0) delete fPadTime0; | |
68751c2c | 238 | //if (fPadNoise) delete fPadNoise; |
c5bbaa2c | 239 | } |
240 | ||
241 | ||
242 | //_____________________________________________________________________________ | |
243 | AliCDBEntry* AliTPCcalibDB::GetCDBEntry(const char* cdbPath) | |
244 | { | |
245 | // | |
246 | // Retrieves an entry with path <cdbPath> from the CDB. | |
247 | // | |
248 | char chinfo[1000]; | |
249 | ||
68751c2c | 250 | AliCDBEntry* entry = AliCDBManager::Instance()->Get(cdbPath, fRun); |
c5bbaa2c | 251 | if (!entry) |
252 | { | |
253 | sprintf(chinfo,"AliTPCcalibDB: Failed to get entry:\t%s ", cdbPath); | |
254 | AliError(chinfo); | |
255 | return 0; | |
256 | } | |
257 | return entry; | |
258 | } | |
259 | ||
260 | ||
261 | //_____________________________________________________________________________ | |
262 | void AliTPCcalibDB::SetRun(Long64_t run) | |
263 | { | |
264 | // | |
265 | // Sets current run number. Calibration data is read from the corresponding file. | |
266 | // | |
267 | if (fRun == run) | |
268 | return; | |
269 | fRun = run; | |
270 | Update(); | |
271 | } | |
272 | ||
273 | ||
274 | ||
275 | void AliTPCcalibDB::Update(){ | |
276 | // | |
277 | AliCDBEntry * entry=0; | |
68751c2c | 278 | |
279 | Bool_t cdbCache = AliCDBManager::Instance()->GetCacheFlag(); // save cache status | |
280 | AliCDBManager::Instance()->SetCacheFlag(kTRUE); // activate CDB cache | |
281 | ||
c5bbaa2c | 282 | // |
283 | entry = GetCDBEntry("TPC/Calib/PadGainFactor"); | |
284 | if (entry){ | |
68751c2c | 285 | //if (fPadGainFactor) delete fPadGainFactor; |
c5bbaa2c | 286 | entry->SetOwner(kTRUE); |
287 | fPadGainFactor = (AliTPCCalPad*)entry->GetObject(); | |
288 | } | |
289 | // | |
9f6e9f81 | 290 | entry = GetCDBEntry("TPC/Calib/GainFactorDedx"); |
291 | if (entry){ | |
292 | entry->SetOwner(kTRUE); | |
293 | fDedxGainFactor = (AliTPCCalPad*)entry->GetObject(); | |
294 | } | |
295 | // | |
c5bbaa2c | 296 | entry = GetCDBEntry("TPC/Calib/PadTime0"); |
297 | if (entry){ | |
68751c2c | 298 | //if (fPadTime0) delete fPadTime0; |
c5bbaa2c | 299 | entry->SetOwner(kTRUE); |
300 | fPadTime0 = (AliTPCCalPad*)entry->GetObject(); | |
301 | } | |
302 | // | |
c5bbaa2c | 303 | // |
304 | entry = GetCDBEntry("TPC/Calib/PadNoise"); | |
305 | if (entry){ | |
68751c2c | 306 | //if (fPadNoise) delete fPadNoise; |
c5bbaa2c | 307 | entry->SetOwner(kTRUE); |
308 | fPadNoise = (AliTPCCalPad*)entry->GetObject(); | |
309 | } | |
8477f500 | 310 | |
311 | entry = GetCDBEntry("TPC/Calib/Pedestals"); | |
312 | if (entry){ | |
313 | //if (fPedestals) delete fPedestals; | |
314 | entry->SetOwner(kTRUE); | |
315 | fPedestals = (AliTPCCalPad*)entry->GetObject(); | |
316 | } | |
317 | ||
54472e4f | 318 | entry = GetCDBEntry("TPC/Calib/Temperature"); |
319 | if (entry){ | |
320 | //if (fTemperature) delete fTemperature; | |
321 | entry->SetOwner(kTRUE); | |
322 | fTemperature = (AliTPCSensorTempArray*)entry->GetObject(); | |
323 | } | |
324 | ||
8477f500 | 325 | entry = GetCDBEntry("TPC/Calib/Parameters"); |
326 | if (entry){ | |
54472e4f | 327 | //if (fPadNoise) delete fPadNoise; |
8477f500 | 328 | entry->SetOwner(kTRUE); |
a778f7e3 | 329 | fParam = (AliTPCParam*)(entry->GetObject()->Clone()); |
8477f500 | 330 | } |
331 | ||
96305e49 | 332 | entry = GetCDBEntry("TPC/Calib/ClusterParam"); |
333 | if (entry){ | |
334 | //if (fPadNoise) delete fPadNoise; | |
335 | entry->SetOwner(kTRUE); | |
336 | fClusterParam = (AliTPCClusterParam*)(entry->GetObject()->Clone()); | |
337 | } | |
338 | ||
d6834f5f | 339 | entry = GetCDBEntry("TPC/Calib/Mapping"); |
340 | if (entry){ | |
341 | //if (fPadNoise) delete fPadNoise; | |
342 | entry->SetOwner(kTRUE); | |
343 | TObjArray * array = dynamic_cast<TObjArray*>(entry->GetObject()); | |
344 | if (array && array->GetEntriesFast()==6){ | |
345 | fMapping = new AliTPCAltroMapping*[6]; | |
346 | for (Int_t i=0; i<6; i++){ | |
347 | fMapping[i] = dynamic_cast<AliTPCAltroMapping*>(array->At(i)); | |
348 | } | |
349 | } | |
350 | } | |
351 | ||
352 | ||
353 | ||
3ac615eb | 354 | //entry = GetCDBEntry("TPC/Calib/ExB"); |
355 | //if (entry) { | |
356 | // entry->SetOwner(kTRUE); | |
357 | // fExB=dynamic_cast<AliTPCExB*>(entry->GetObject()->Clone()); | |
358 | //} | |
359 | // | |
360 | // ExB - calculate during initialization | |
361 | // - | |
f4d5fd21 | 362 | fExB = GetExB(-5,kTRUE); |
363 | // | |
f5344549 | 364 | if (!fTransform) { |
365 | fTransform=new AliTPCTransform(); | |
366 | } | |
8477f500 | 367 | |
c5bbaa2c | 368 | // |
68751c2c | 369 | AliCDBManager::Instance()->SetCacheFlag(cdbCache); // reset original CDB cache |
370 | ||
c5bbaa2c | 371 | } |
e4dce695 | 372 | |
86df2b3a | 373 | |
374 | ||
375 | void AliTPCcalibDB::CreateObjectList(const Char_t *filename, TObjArray *calibObjects) | |
376 | { | |
418bbcaf | 377 | // |
378 | // Create calibration objects and read contents from OCDB | |
379 | // | |
86df2b3a | 380 | if ( calibObjects == 0x0 ) return; |
381 | ifstream in; | |
382 | in.open(filename); | |
383 | if ( !in.is_open() ){ | |
384 | fprintf(stderr,"Error: cannot open list file '%s'", filename); | |
385 | return; | |
386 | } | |
387 | ||
388 | AliTPCCalPad *calPad=0x0; | |
389 | ||
390 | TString sFile; | |
391 | sFile.ReadFile(in); | |
392 | in.close(); | |
393 | ||
394 | TObjArray *arrFileLine = sFile.Tokenize("\n"); | |
395 | ||
396 | TIter nextLine(arrFileLine); | |
397 | ||
398 | TObjString *sObjLine=0x0; | |
2c632057 | 399 | while ( (sObjLine = (TObjString*)nextLine()) ){ |
86df2b3a | 400 | TString sLine(sObjLine->GetString()); |
401 | ||
402 | TObjArray *arrNextCol = sLine.Tokenize("\t"); | |
403 | ||
404 | TObjString *sObjType = (TObjString*)(arrNextCol->At(0)); | |
405 | TObjString *sObjFileName = (TObjString*)(arrNextCol->At(1)); | |
406 | ||
407 | if ( !sObjType || ! sObjFileName ) continue; | |
408 | TString sType(sObjType->GetString()); | |
409 | TString sFileName(sObjFileName->GetString()); | |
410 | printf("%s\t%s\n",sType.Data(),sFileName.Data()); | |
411 | ||
412 | TFile *fIn = TFile::Open(sFileName); | |
413 | if ( !fIn ){ | |
414 | fprintf(stderr,"File not found: '%s'", sFileName.Data()); | |
415 | continue; | |
416 | } | |
417 | ||
418 | if ( sType == "CE" ){ | |
419 | AliTPCCalibCE *ce = (AliTPCCalibCE*)fIn->Get("AliTPCCalibCE"); | |
420 | ||
421 | calPad = new AliTPCCalPad((TObjArray*)ce->GetCalPadT0()); | |
422 | calPad->SetNameTitle("CETmean","CETmean"); | |
423 | calibObjects->Add(calPad); | |
424 | ||
425 | calPad = new AliTPCCalPad((TObjArray*)ce->GetCalPadQ()); | |
426 | calPad->SetNameTitle("CEQmean","CEQmean"); | |
427 | calibObjects->Add(calPad); | |
428 | ||
429 | calPad = new AliTPCCalPad((TObjArray*)ce->GetCalPadRMS()); | |
430 | calPad->SetNameTitle("CETrms","CETrms"); | |
431 | calibObjects->Add(calPad); | |
432 | ||
433 | } else if ( sType == "Pulser") { | |
0fe7645c | 434 | AliTPCCalibPulser *sig = (AliTPCCalibPulser*)fIn->Get("AliTPCCalibPulser"); |
86df2b3a | 435 | |
436 | calPad = new AliTPCCalPad((TObjArray*)sig->GetCalPadT0()); | |
437 | calPad->SetNameTitle("PulserTmean","PulserTmean"); | |
438 | calibObjects->Add(calPad); | |
439 | ||
440 | calPad = new AliTPCCalPad((TObjArray*)sig->GetCalPadQ()); | |
441 | calPad->SetNameTitle("PulserQmean","PulserQmean"); | |
442 | calibObjects->Add(calPad); | |
443 | ||
444 | calPad = new AliTPCCalPad((TObjArray*)sig->GetCalPadRMS()); | |
445 | calPad->SetNameTitle("PulserTrms","PulserTrms"); | |
446 | calibObjects->Add(calPad); | |
447 | ||
448 | } else if ( sType == "Pedestals") { | |
449 | AliTPCCalibPedestal *ped = (AliTPCCalibPedestal*)fIn->Get("AliTPCCalibPedestal"); | |
450 | ||
451 | calPad = new AliTPCCalPad((TObjArray*)ped->GetCalPadPedestal()); | |
452 | calPad->SetNameTitle("Pedestals","Pedestals"); | |
453 | calibObjects->Add(calPad); | |
454 | ||
455 | calPad = new AliTPCCalPad((TObjArray*)ped->GetCalPadRMS()); | |
456 | calPad->SetNameTitle("Noise","Noise"); | |
457 | calibObjects->Add(calPad); | |
458 | ||
459 | } else { | |
460 | fprintf(stderr,"Undefined Type: '%s'",sType.Data()); | |
461 | ||
462 | } | |
463 | delete fIn; | |
464 | } | |
465 | } | |
466 | ||
467 | ||
468 | ||
469 | void AliTPCcalibDB::MakeTree(const char * fileName, TObjArray * array, const char * mapFileName, AliTPCCalPad* outlierPad, Float_t ltmFraction) { | |
470 | // | |
471 | // Write a tree with all available information | |
418bbcaf | 472 | // if mapFileName is specified, the Map information are also written to the tree |
86df2b3a | 473 | // pads specified in outlierPad are not used for calculating statistics |
474 | // - the same function as AliTPCCalPad::MakeTree - | |
475 | // | |
476 | AliTPCROC* tpcROCinstance = AliTPCROC::Instance(); | |
477 | ||
478 | TObjArray* mapIROCs = 0; | |
479 | TObjArray* mapOROCs = 0; | |
480 | TVectorF *mapIROCArray = 0; | |
481 | TVectorF *mapOROCArray = 0; | |
482 | Int_t mapEntries = 0; | |
483 | TString* mapNames = 0; | |
484 | ||
485 | if (mapFileName) { | |
486 | TFile mapFile(mapFileName, "read"); | |
487 | ||
488 | TList* listOfROCs = mapFile.GetListOfKeys(); | |
489 | mapEntries = listOfROCs->GetEntries()/2; | |
490 | mapIROCs = new TObjArray(mapEntries*2); | |
491 | mapOROCs = new TObjArray(mapEntries*2); | |
492 | mapIROCArray = new TVectorF[mapEntries]; | |
493 | mapOROCArray = new TVectorF[mapEntries]; | |
494 | ||
495 | mapNames = new TString[mapEntries]; | |
496 | for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) { | |
418bbcaf | 497 | TString nameROC(((TKey*)(listOfROCs->At(ivalue*2)))->GetName()); |
498 | nameROC.Remove(nameROC.Length()-4, 4); | |
499 | mapIROCs->AddAt((AliTPCCalROC*)mapFile.Get((nameROC + "IROC").Data()), ivalue); | |
500 | mapOROCs->AddAt((AliTPCCalROC*)mapFile.Get((nameROC + "OROC").Data()), ivalue); | |
501 | mapNames[ivalue].Append(nameROC); | |
86df2b3a | 502 | } |
503 | ||
504 | for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) { | |
505 | mapIROCArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(0)); | |
506 | mapOROCArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(36)); | |
507 | ||
508 | for (UInt_t ichannel = 0; ichannel < tpcROCinstance->GetNChannels(0); ichannel++) | |
509 | (mapIROCArray[ivalue])[ichannel] = ((AliTPCCalROC*)(mapIROCs->At(ivalue)))->GetValue(ichannel); | |
510 | for (UInt_t ichannel = 0; ichannel < tpcROCinstance->GetNChannels(36); ichannel++) | |
511 | (mapOROCArray[ivalue])[ichannel] = ((AliTPCCalROC*)(mapOROCs->At(ivalue)))->GetValue(ichannel); | |
512 | } | |
513 | ||
514 | } // if (mapFileName) | |
515 | ||
516 | TTreeSRedirector cstream(fileName); | |
517 | Int_t arrayEntries = array->GetEntries(); | |
518 | ||
519 | TString* names = new TString[arrayEntries]; | |
520 | for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) | |
521 | names[ivalue].Append(((AliTPCCalPad*)array->At(ivalue))->GetName()); | |
522 | ||
523 | for (UInt_t isector = 0; isector < tpcROCinstance->GetNSectors(); isector++) { | |
524 | // | |
525 | // get statistic for given sector | |
526 | // | |
527 | TVectorF median(arrayEntries); | |
528 | TVectorF mean(arrayEntries); | |
529 | TVectorF rms(arrayEntries); | |
530 | TVectorF ltm(arrayEntries); | |
531 | TVectorF ltmrms(arrayEntries); | |
532 | TVectorF medianWithOut(arrayEntries); | |
533 | TVectorF meanWithOut(arrayEntries); | |
534 | TVectorF rmsWithOut(arrayEntries); | |
535 | TVectorF ltmWithOut(arrayEntries); | |
536 | TVectorF ltmrmsWithOut(arrayEntries); | |
537 | ||
538 | TVectorF *vectorArray = new TVectorF[arrayEntries]; | |
539 | for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) | |
540 | vectorArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(isector)); | |
541 | ||
542 | for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) { | |
543 | AliTPCCalPad* calPad = (AliTPCCalPad*) array->At(ivalue); | |
544 | AliTPCCalROC* calROC = calPad->GetCalROC(isector); | |
545 | AliTPCCalROC* outlierROC = 0; | |
546 | if (outlierPad) outlierROC = outlierPad->GetCalROC(isector); | |
547 | if (calROC) { | |
548 | median[ivalue] = calROC->GetMedian(); | |
549 | mean[ivalue] = calROC->GetMean(); | |
550 | rms[ivalue] = calROC->GetRMS(); | |
551 | Double_t ltmrmsValue = 0; | |
552 | ltm[ivalue] = calROC->GetLTM(<mrmsValue, ltmFraction); | |
553 | ltmrms[ivalue] = ltmrmsValue; | |
554 | if (outlierROC) { | |
555 | medianWithOut[ivalue] = calROC->GetMedian(outlierROC); | |
556 | meanWithOut[ivalue] = calROC->GetMean(outlierROC); | |
557 | rmsWithOut[ivalue] = calROC->GetRMS(outlierROC); | |
558 | ltmrmsValue = 0; | |
559 | ltmWithOut[ivalue] = calROC->GetLTM(<mrmsValue, ltmFraction, outlierROC); | |
560 | ltmrmsWithOut[ivalue] = ltmrmsValue; | |
561 | } | |
562 | } | |
563 | else { | |
564 | median[ivalue] = 0.; | |
565 | mean[ivalue] = 0.; | |
566 | rms[ivalue] = 0.; | |
567 | ltm[ivalue] = 0.; | |
568 | ltmrms[ivalue] = 0.; | |
569 | medianWithOut[ivalue] = 0.; | |
570 | meanWithOut[ivalue] = 0.; | |
571 | rmsWithOut[ivalue] = 0.; | |
572 | ltmWithOut[ivalue] = 0.; | |
573 | ltmrmsWithOut[ivalue] = 0.; | |
574 | } | |
575 | } | |
576 | ||
577 | // | |
578 | // fill vectors of variable per pad | |
579 | // | |
580 | TVectorF *posArray = new TVectorF[8]; | |
581 | for (Int_t ivalue = 0; ivalue < 8; ivalue++) | |
582 | posArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(isector)); | |
583 | ||
584 | Float_t posG[3] = {0}; | |
585 | Float_t posL[3] = {0}; | |
586 | Int_t ichannel = 0; | |
587 | for (UInt_t irow = 0; irow < tpcROCinstance->GetNRows(isector); irow++) { | |
588 | for (UInt_t ipad = 0; ipad < tpcROCinstance->GetNPads(isector, irow); ipad++) { | |
589 | tpcROCinstance->GetPositionLocal(isector, irow, ipad, posL); | |
590 | tpcROCinstance->GetPositionGlobal(isector, irow, ipad, posG); | |
591 | posArray[0][ichannel] = irow; | |
592 | posArray[1][ichannel] = ipad; | |
593 | posArray[2][ichannel] = posL[0]; | |
594 | posArray[3][ichannel] = posL[1]; | |
595 | posArray[4][ichannel] = posG[0]; | |
596 | posArray[5][ichannel] = posG[1]; | |
597 | posArray[6][ichannel] = (Int_t)(ipad - (Double_t)(tpcROCinstance->GetNPads(isector, irow))/2); | |
598 | posArray[7][ichannel] = ichannel; | |
599 | ||
600 | // loop over array containing AliTPCCalPads | |
601 | for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) { | |
602 | AliTPCCalPad* calPad = (AliTPCCalPad*) array->At(ivalue); | |
603 | AliTPCCalROC* calROC = calPad->GetCalROC(isector); | |
604 | if (calROC) | |
605 | (vectorArray[ivalue])[ichannel] = calROC->GetValue(irow, ipad); | |
606 | else | |
607 | (vectorArray[ivalue])[ichannel] = 0; | |
608 | } | |
609 | ichannel++; | |
610 | } | |
611 | } | |
612 | ||
613 | cstream << "calPads" << | |
614 | "sector=" << isector; | |
615 | ||
616 | for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) { | |
617 | cstream << "calPads" << | |
618 | (Char_t*)((names[ivalue] + "_Median=").Data()) << median[ivalue] << | |
619 | (Char_t*)((names[ivalue] + "_Mean=").Data()) << mean[ivalue] << | |
620 | (Char_t*)((names[ivalue] + "_RMS=").Data()) << rms[ivalue] << | |
621 | (Char_t*)((names[ivalue] + "_LTM=").Data()) << ltm[ivalue] << | |
622 | (Char_t*)((names[ivalue] + "_RMS_LTM=").Data()) << ltmrms[ivalue]; | |
623 | if (outlierPad) { | |
624 | cstream << "calPads" << | |
625 | (Char_t*)((names[ivalue] + "_Median_OutlierCutted=").Data()) << medianWithOut[ivalue] << | |
626 | (Char_t*)((names[ivalue] + "_Mean_OutlierCutted=").Data()) << meanWithOut[ivalue] << | |
627 | (Char_t*)((names[ivalue] + "_RMS_OutlierCutted=").Data()) << rmsWithOut[ivalue] << | |
628 | (Char_t*)((names[ivalue] + "_LTM_OutlierCutted=").Data()) << ltmWithOut[ivalue] << | |
629 | (Char_t*)((names[ivalue] + "_RMS_LTM_OutlierCutted=").Data()) << ltmrmsWithOut[ivalue]; | |
630 | } | |
631 | } | |
632 | ||
633 | for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) { | |
634 | cstream << "calPads" << | |
635 | (Char_t*)((names[ivalue] + ".=").Data()) << &vectorArray[ivalue]; | |
636 | } | |
637 | ||
638 | if (mapFileName) { | |
639 | for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) { | |
640 | if (isector < 36) | |
641 | cstream << "calPads" << | |
642 | (Char_t*)((mapNames[ivalue] + ".=").Data()) << &mapIROCArray[ivalue]; | |
643 | else | |
644 | cstream << "calPads" << | |
645 | (Char_t*)((mapNames[ivalue] + ".=").Data()) << &mapOROCArray[ivalue]; | |
646 | } | |
647 | } | |
648 | ||
649 | cstream << "calPads" << | |
650 | "row.=" << &posArray[0] << | |
651 | "pad.=" << &posArray[1] << | |
652 | "lx.=" << &posArray[2] << | |
653 | "ly.=" << &posArray[3] << | |
654 | "gx.=" << &posArray[4] << | |
655 | "gy.=" << &posArray[5] << | |
656 | "rpad.=" << &posArray[6] << | |
657 | "channel.=" << &posArray[7]; | |
658 | ||
659 | cstream << "calPads" << | |
660 | "\n"; | |
661 | ||
662 | delete[] posArray; | |
663 | delete[] vectorArray; | |
664 | } | |
665 | ||
666 | ||
667 | delete[] names; | |
668 | if (mapFileName) { | |
669 | delete mapIROCs; | |
670 | delete mapOROCs; | |
671 | delete[] mapIROCArray; | |
672 | delete[] mapOROCArray; | |
673 | delete[] mapNames; | |
674 | } | |
675 | } | |
3ac615eb | 676 | |
677 | ||
678 | ||
679 | void AliTPCcalibDB::RegisterExB(Int_t index, Float_t bz, Bool_t bdelete){ | |
680 | // | |
681 | // Register static ExB correction map | |
682 | // index - registration index - used for visualization | |
683 | // bz - bz field in kGaus | |
684 | ||
685 | Float_t factor = bz/(-5.); // default b filed in Cheb with minus sign | |
686 | ||
687 | AliMagF* bmap = new AliMagWrapCheb("Maps","Maps", 2, factor, 10., AliMagWrapCheb::k5kG,kTRUE,"$(ALICE_ROOT)/data/maps/mfchebKGI_sym.root"); | |
688 | ||
689 | AliTPCExBFirst *exb = new AliTPCExBFirst(bmap,0.88*2.6400e+04,50,50,50); | |
690 | AliTPCExB::SetInstance(exb); | |
691 | ||
692 | if (bdelete){ | |
693 | delete bmap; | |
694 | }else{ | |
695 | AliTPCExB::RegisterField(index,bmap); | |
696 | } | |
697 | if (index>=fgExBArray.GetEntries()) fgExBArray.Expand((index+1)*2+11); | |
698 | fgExBArray.AddAt(exb,index); | |
699 | } | |
700 | ||
701 | ||
702 | AliTPCExB* AliTPCcalibDB::GetExB(Float_t bz, Bool_t deleteB) { | |
703 | // | |
704 | // bz filed in KGaus not in tesla | |
705 | // Get ExB correction map | |
706 | // if doesn't exist - create it | |
707 | // | |
708 | Int_t index = TMath::Nint(5+bz); | |
709 | if (index>fgExBArray.GetEntries()) fgExBArray.Expand((index+1)*2+11); | |
710 | if (!fgExBArray.At(index)) AliTPCcalibDB::RegisterExB(index,bz,deleteB); | |
711 | return (AliTPCExB*)fgExBArray.At(index); | |
712 | } | |
713 | ||
714 | ||
715 | void AliTPCcalibDB::SetExBField(Float_t bz){ | |
716 | // | |
717 | // Set magnetic filed for ExB correction | |
718 | // | |
719 | fExB = GetExB(bz,kFALSE); | |
720 | } | |
bf85fe4d | 721 | |
722 | ||
723 | ||
724 | void AliTPCcalibDB::GetRunInformations( Int_t run){ | |
725 | // | |
726 | // - > Don't use it for reconstruction - Only for Calibration studies | |
727 | // | |
728 | AliCDBEntry * entry = 0; | |
729 | if (run>= fRunList.GetSize()){ | |
730 | fRunList.Set(run*2+1); | |
da6c0bc9 | 731 | fGRPArray.Expand(run*2+1); |
732 | fGoofieArray.Expand(run*2+1); | |
733 | fTemperatureArray.Expand(run*2+1); | |
734 | fVdriftArray.Expand(run*2+1); | |
bf85fe4d | 735 | } |
736 | if (fRunList[run]>0) return; | |
737 | entry = AliCDBManager::Instance()->Get("GRP/GRP/Data",run); | |
738 | if (entry) fGRPArray.AddAt(entry->GetObject(),run); | |
739 | entry = AliCDBManager::Instance()->Get("TPC/Calib/Goofie",run); | |
740 | if (entry) fGoofieArray.AddAt(entry->GetObject(),run); | |
741 | entry = AliCDBManager::Instance()->Get("TPC/Calib/Temperature",run); | |
742 | if (entry) fTemperatureArray.AddAt(entry->GetObject(),run); | |
743 | fRunList[run]=1; // sign as used | |
da6c0bc9 | 744 | |
745 | AliDCSSensor * press = GetPressureSensor(run); | |
746 | AliTPCSensorTempArray * temp = GetTemperatureSensor(run); | |
747 | if (press && temp){ | |
748 | AliTPCCalibVdrift * vdrift = new AliTPCCalibVdrift(temp, press,0); | |
749 | fVdriftArray.AddAt(vdrift,run); | |
750 | } | |
bf85fe4d | 751 | } |
752 | ||
753 | ||
754 | Float_t AliTPCcalibDB::GetGain(Int_t sector, Int_t row, Int_t pad){ | |
755 | // | |
756 | // | |
757 | AliTPCCalPad *calPad = Instance()->fDedxGainFactor;; | |
758 | if (!calPad) return 0; | |
759 | return calPad->GetCalROC(sector)->GetValue(row,pad); | |
760 | } | |
761 | ||
8de77f00 | 762 | |
763 | AliGRPObject *AliTPCcalibDB::GetGRP(Int_t run){ | |
764 | // | |
765 | // Get GRP object for given run | |
766 | // | |
767 | AliGRPObject * grpRun = dynamic_cast<AliGRPObject *>((Instance()->fGRPArray).At(run)); | |
768 | if (!grpRun) { | |
769 | Instance()->GetRunInformations(run); | |
770 | grpRun = dynamic_cast<AliGRPObject *>(Instance()->fGRPArray.At(run)); | |
771 | if (!grpRun) return 0; | |
772 | } | |
773 | return grpRun; | |
774 | } | |
775 | ||
776 | ||
777 | ||
da6c0bc9 | 778 | AliDCSSensor * AliTPCcalibDB::GetPressureSensor(Int_t run, Int_t type){ |
bf85fe4d | 779 | // |
780 | // | |
efdbb95a | 781 | AliGRPObject * grpRun = dynamic_cast<AliGRPObject *>(fGRPArray.At(run)); |
bf85fe4d | 782 | if (!grpRun) { |
783 | GetRunInformations(run); | |
efdbb95a | 784 | grpRun = dynamic_cast<AliGRPObject *>(fGRPArray.At(run)); |
bf85fe4d | 785 | if (!grpRun) return 0; |
786 | } | |
787 | AliDCSSensor * sensor = grpRun->GetCavernAtmosPressure(); | |
da6c0bc9 | 788 | if (type==1) sensor = grpRun->GetSurfaceAtmosPressure(); |
789 | return sensor; | |
bf85fe4d | 790 | } |
791 | ||
792 | AliTPCSensorTempArray * AliTPCcalibDB::GetTemperatureSensor(Int_t run){ | |
793 | // | |
794 | // Get temperature sensor array | |
795 | // | |
796 | AliTPCSensorTempArray * tempArray = (AliTPCSensorTempArray *)fTemperatureArray.At(run); | |
797 | if (!tempArray) { | |
798 | GetRunInformations(run); | |
799 | tempArray = (AliTPCSensorTempArray *)fTemperatureArray.At(run); | |
800 | } | |
801 | return tempArray; | |
802 | } | |
803 | ||
804 | AliDCSSensorArray * AliTPCcalibDB::GetGoofieSensors(Int_t run){ | |
805 | // | |
806 | // Get temperature sensor array | |
807 | // | |
808 | AliDCSSensorArray * goofieArray = (AliDCSSensorArray *)fGoofieArray.At(run); | |
809 | if (!goofieArray) { | |
810 | GetRunInformations(run); | |
811 | goofieArray = (AliDCSSensorArray *)fGoofieArray.At(run); | |
812 | } | |
813 | return goofieArray; | |
814 | } | |
815 | ||
da6c0bc9 | 816 | AliTPCCalibVdrift * AliTPCcalibDB::GetVdrift(Int_t run){ |
817 | // | |
818 | // Get the interface to the the vdrift | |
819 | // | |
820 | AliTPCCalibVdrift * vdrift = (AliTPCCalibVdrift*)fVdriftArray.At(run); | |
821 | if (!vdrift) { | |
822 | GetRunInformations(run); | |
823 | vdrift= (AliTPCCalibVdrift*)fVdriftArray.At(run); | |
824 | } | |
825 | return vdrift; | |
826 | } | |
827 | ||
bf85fe4d | 828 | |
829 | ||
830 | ||
da6c0bc9 | 831 | Float_t AliTPCcalibDB::GetPressure(Int_t timeStamp, Int_t run, Int_t type){ |
bf85fe4d | 832 | // |
833 | // GetPressure for given time stamp and runt | |
834 | // | |
835 | TTimeStamp stamp(timeStamp); | |
da6c0bc9 | 836 | AliDCSSensor * sensor = Instance()->GetPressureSensor(run,type); |
bf85fe4d | 837 | if (!sensor) return 0; |
838 | if (!sensor->GetFit()) return 0; | |
839 | return sensor->GetValue(stamp); | |
840 | } | |
841 | ||
7f7847fe | 842 | Float_t AliTPCcalibDB::GetValueGoofie(Int_t timeStamp, Int_t run, Int_t type){ |
843 | // | |
844 | // GetPressure for given time stamp and runt | |
845 | // | |
846 | TTimeStamp stamp(timeStamp); | |
847 | AliDCSSensorArray* goofieArray = AliTPCcalibDB::Instance()->GetGoofieSensors(run); | |
848 | if (!goofieArray) return 0; | |
849 | AliDCSSensor *sensor = goofieArray->GetSensor(type); | |
850 | return sensor->GetValue(stamp); | |
851 | } | |
852 | ||
853 | ||
854 | ||
855 | ||
856 | ||
857 | ||
f0269955 | 858 | Bool_t AliTPCcalibDB::GetTemperatureFit(Int_t timeStamp, Int_t run, Int_t side,TVectorD& fit){ |
859 | // | |
860 | // | |
861 | // | |
862 | TTimeStamp tstamp(timeStamp); | |
64b48395 | 863 | AliTPCSensorTempArray* tempArray = Instance()->GetTemperatureSensor(run); |
f0269955 | 864 | if (! tempArray) return kFALSE; |
865 | AliTPCTempMap * tempMap = new AliTPCTempMap(tempArray); | |
866 | TLinearFitter * fitter = tempMap->GetLinearFitter(3,side,tstamp); | |
867 | if (fitter){ | |
868 | fitter->Eval(); | |
869 | fitter->GetParameters(fit); | |
870 | } | |
871 | delete fitter; | |
872 | delete tempMap; | |
873 | if (!fitter) return kFALSE; | |
874 | return kTRUE; | |
875 | } | |
876 | ||
64b48395 | 877 | Float_t AliTPCcalibDB::GetTemperature(Int_t timeStamp, Int_t run, Int_t side){ |
878 | // | |
879 | // | |
880 | // | |
881 | TVectorD vec; | |
882 | if (side==0) { | |
883 | GetTemperatureFit(timeStamp,run,0,vec); | |
884 | return vec[0]; | |
885 | } | |
886 | if (side==1){ | |
887 | GetTemperatureFit(timeStamp,run,0,vec); | |
888 | return vec[0]; | |
889 | } | |
57dc06f2 | 890 | return 0; |
64b48395 | 891 | } |
bf85fe4d | 892 | |
893 | ||
da6c0bc9 | 894 | Double_t AliTPCcalibDB::GetPTRelative(UInt_t timeSec, Int_t run, Int_t side){ |
895 | // | |
896 | // Get relative P/T | |
897 | // time - absolute time | |
898 | // run - run number | |
899 | // side - 0 - A side 1-C side | |
900 | AliTPCCalibVdrift * vdrift = Instance()->GetVdrift(run); | |
901 | if (!vdrift) return 0; | |
902 | return vdrift->GetPTRelative(timeSec,side); | |
903 | } | |
904 | ||
bf85fe4d | 905 | |
906 | void AliTPCcalibDB::ProcessEnv(const char * runList){ | |
907 | // | |
908 | // Example test function - how to use the environment variables | |
909 | // runList - ascii file with run numbers | |
910 | // output - dcsTime.root file with tree | |
911 | ||
912 | ifstream in; | |
913 | in.open(runList); | |
914 | Int_t irun=0; | |
915 | TTreeSRedirector *pcstream = new TTreeSRedirector("dcsTime.root"); | |
916 | while(in.good()) { | |
917 | in >> irun; | |
918 | if (irun==0) continue; | |
919 | printf("Processing run %d\n",irun); | |
920 | AliDCSSensor * sensorPressure = AliTPCcalibDB::Instance()->GetPressureSensor(irun); | |
921 | if (!sensorPressure) continue; | |
922 | AliTPCSensorTempArray * tempArray = AliTPCcalibDB::Instance()->GetTemperatureSensor(irun); | |
923 | AliTPCTempMap * tempMap = new AliTPCTempMap(tempArray); | |
924 | AliDCSSensorArray* goofieArray = AliTPCcalibDB::Instance()->GetGoofieSensors(irun); | |
925 | // | |
926 | Int_t startTime = sensorPressure->GetStartTime(); | |
927 | Int_t endTime = sensorPressure->GetEndTime(); | |
928 | Int_t dtime = TMath::Max((endTime-startTime)/20,10*60); | |
929 | for (Int_t itime=startTime; itime<endTime; itime+=dtime){ | |
930 | // | |
931 | TTimeStamp tstamp(itime); | |
932 | Float_t valuePressure = sensorPressure->GetValue(tstamp); | |
933 | ||
934 | TLinearFitter * fitter = 0; | |
935 | TVectorD vecTemp[10]; | |
936 | if (itime<tempArray->GetStartTime().GetSec() || itime>tempArray->GetEndTime().GetSec()){ | |
937 | }else{ | |
938 | for (Int_t itype=0; itype<5; itype++) | |
939 | for (Int_t iside=0; iside<2; iside++){ | |
940 | fitter= tempMap->GetLinearFitter(itype,iside,tstamp); | |
941 | if (!fitter) continue; | |
942 | fitter->Eval(); fitter->GetParameters(vecTemp[itype+iside*5]); | |
943 | delete fitter; | |
944 | } | |
945 | } | |
946 | ||
947 | TVectorD vecGoofie, vecEntries, vecMean, vecMedian,vecRMS; | |
948 | if (goofieArray){ | |
949 | vecGoofie.ResizeTo(goofieArray->NumSensors()); | |
950 | ProcessGoofie(goofieArray, vecEntries ,vecMedian, vecMean, vecRMS); | |
951 | // | |
952 | for (Int_t isensor=0; isensor<goofieArray->NumSensors();isensor++){ | |
953 | AliDCSSensor *gsensor = goofieArray->GetSensor(isensor); | |
954 | if (gsensor){ | |
955 | vecGoofie[isensor] = gsensor->GetValue(tstamp); | |
956 | } | |
957 | } | |
958 | } | |
959 | ||
960 | ||
961 | //tempMap->GetLinearFitter(0,0,itime); | |
962 | (*pcstream)<<"dcs"<< | |
963 | "run="<<irun<< | |
964 | "time="<<itime<< | |
965 | "goofie.="<<&vecGoofie<< | |
966 | "goofieE.="<<&vecEntries<< | |
967 | "goofieMean.="<<&vecMean<< | |
968 | "goofieMedian.="<<&vecMedian<< | |
969 | "goofieRMS.="<<&vecRMS<< | |
970 | "press="<<valuePressure<< | |
971 | "temp00.="<<&vecTemp[0]<< | |
972 | "temp10.="<<&vecTemp[1]<< | |
973 | "temp20.="<<&vecTemp[2]<< | |
974 | "temp30.="<<&vecTemp[3]<< | |
975 | "temp40.="<<&vecTemp[4]<< | |
976 | "temp01.="<<&vecTemp[5]<< | |
977 | "temp11.="<<&vecTemp[6]<< | |
978 | "temp21.="<<&vecTemp[7]<< | |
979 | "temp31.="<<&vecTemp[8]<< | |
980 | "temp41.="<<&vecTemp[9]<< | |
981 | "\n"; | |
982 | } | |
983 | } | |
984 | delete pcstream; | |
985 | } | |
986 | ||
987 | ||
988 | void AliTPCcalibDB::ProcessGoofie( AliDCSSensorArray* goofieArray, TVectorD & vecEntries, TVectorD & vecMedian, TVectorD &vecMean, TVectorD &vecRMS){ | |
989 | /* | |
990 | ||
991 | 1 TPC_ANODE_I_A00_STAT | |
992 | 2 TPC_DVM_CO2 | |
993 | 3 TPC_DVM_DriftVelocity | |
994 | 4 TPC_DVM_FCageHV | |
995 | 5 TPC_DVM_GainFar | |
996 | 6 TPC_DVM_GainNear | |
997 | 7 TPC_DVM_N2 | |
998 | 8 TPC_DVM_NumberOfSparks | |
999 | 9 TPC_DVM_PeakAreaFar | |
1000 | 10 TPC_DVM_PeakAreaNear | |
1001 | 11 TPC_DVM_PeakPosFar | |
1002 | 12 TPC_DVM_PeakPosNear | |
1003 | 13 TPC_DVM_PickupHV | |
1004 | 14 TPC_DVM_Pressure | |
1005 | 15 TPC_DVM_T1_Over_P | |
1006 | 16 TPC_DVM_T2_Over_P | |
1007 | 17 TPC_DVM_T_Over_P | |
1008 | 18 TPC_DVM_TemperatureS1 | |
1009 | */ | |
1010 | // | |
1011 | // | |
1012 | // TVectorD vecMedian; TVectorD vecEntries; TVectorD vecMean; TVectorD vecRMS; | |
1013 | Double_t kEpsilon=0.0000000001; | |
1014 | Double_t kBig=100000000000.; | |
1015 | Int_t nsensors = goofieArray->NumSensors(); | |
1016 | vecEntries.ResizeTo(nsensors); | |
1017 | vecMedian.ResizeTo(nsensors); | |
1018 | vecMean.ResizeTo(nsensors); | |
1019 | vecRMS.ResizeTo(nsensors); | |
1020 | TVectorF values; | |
1021 | for (Int_t isensor=0; isensor<goofieArray->NumSensors();isensor++){ | |
1022 | AliDCSSensor *gsensor = goofieArray->GetSensor(isensor); | |
1023 | if (gsensor && gsensor->GetGraph()){ | |
1024 | Int_t npoints = gsensor->GetGraph()->GetN(); | |
1025 | // filter zeroes | |
1026 | values.ResizeTo(npoints); | |
1027 | Int_t nused =0; | |
1028 | for (Int_t ipoint=0; ipoint<npoints; ipoint++){ | |
1029 | if (TMath::Abs(gsensor->GetGraph()->GetY()[ipoint])>kEpsilon && | |
1030 | TMath::Abs(gsensor->GetGraph()->GetY()[ipoint])<kBig ){ | |
1031 | values[nused]=gsensor->GetGraph()->GetY()[ipoint]; | |
1032 | nused++; | |
1033 | } | |
1034 | } | |
1035 | // | |
1036 | vecEntries[isensor]= nused; | |
1037 | if (nused>1){ | |
1038 | vecMedian[isensor] = TMath::Median(nused,values.GetMatrixArray()); | |
1039 | vecMean[isensor] = TMath::Mean(nused,values.GetMatrixArray()); | |
1040 | vecRMS[isensor] = TMath::RMS(nused,values.GetMatrixArray()); | |
1041 | } | |
1042 | } | |
1043 | } | |
1044 | } | |
1045 |