]>
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> |
7fff7612 | 87 | #include <AliSplineFit.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" | |
7390f655 | 110 | #include "TDirectory.h" |
86df2b3a | 111 | #include "AliTPCCalPad.h" |
0fe7645c | 112 | #include "AliTPCCalibPulser.h" |
86df2b3a | 113 | #include "AliTPCCalibPedestal.h" |
114 | #include "AliTPCCalibCE.h" | |
3ac615eb | 115 | #include "AliTPCExBFirst.h" |
bf85fe4d | 116 | #include "AliTPCTempMap.h" |
da6c0bc9 | 117 | #include "AliTPCCalibVdrift.h" |
6e7d7dc4 | 118 | #include "AliTPCCalibRaw.h" |
86df2b3a | 119 | |
5312f439 | 120 | #include "AliTPCPreprocessorOnline.h" |
86df2b3a | 121 | |
c5bbaa2c | 122 | |
123 | ClassImp(AliTPCcalibDB) | |
124 | ||
125 | AliTPCcalibDB* AliTPCcalibDB::fgInstance = 0; | |
126 | Bool_t AliTPCcalibDB::fgTerminated = kFALSE; | |
3ac615eb | 127 | TObjArray AliTPCcalibDB::fgExBArray; // array of ExB corrections |
c5bbaa2c | 128 | |
129 | ||
130 | //_ singleton implementation __________________________________________________ | |
131 | AliTPCcalibDB* AliTPCcalibDB::Instance() | |
132 | { | |
133 | // | |
134 | // Singleton implementation | |
135 | // Returns an instance of this class, it is created if neccessary | |
136 | // | |
137 | ||
138 | if (fgTerminated != kFALSE) | |
139 | return 0; | |
140 | ||
141 | if (fgInstance == 0) | |
142 | fgInstance = new AliTPCcalibDB(); | |
143 | ||
144 | return fgInstance; | |
145 | } | |
146 | ||
147 | void AliTPCcalibDB::Terminate() | |
148 | { | |
149 | // | |
150 | // Singleton implementation | |
151 | // Deletes the instance of this class and sets the terminated flag, instances cannot be requested anymore | |
152 | // This function can be called several times. | |
153 | // | |
154 | ||
155 | fgTerminated = kTRUE; | |
156 | ||
157 | if (fgInstance != 0) | |
158 | { | |
159 | delete fgInstance; | |
160 | fgInstance = 0; | |
161 | } | |
162 | } | |
163 | ||
164 | //_____________________________________________________________________________ | |
e4dce695 | 165 | AliTPCcalibDB::AliTPCcalibDB(): |
9389f9a4 | 166 | TObject(), |
e4dce695 | 167 | fRun(-1), |
f5344549 | 168 | fTransform(0), |
481f877b | 169 | fExB(0), |
e4dce695 | 170 | fPadGainFactor(0), |
9f6e9f81 | 171 | fDedxGainFactor(0), |
e4dce695 | 172 | fPadTime0(0), |
e4dce695 | 173 | fPadNoise(0), |
174 | fPedestals(0), | |
6e7d7dc4 | 175 | fCalibRaw(0), |
5312f439 | 176 | fALTROConfigData(0), |
177 | fPulserData(0), | |
178 | fCEData(0), | |
e4dce695 | 179 | fTemperature(0), |
d6834f5f | 180 | fMapping(0), |
96305e49 | 181 | fParam(0), |
a2c3785e | 182 | fClusterParam(0), |
183 | fTimeGainSplines(0), | |
184 | fTimeGainSplinesArray(100000), | |
da6c0bc9 | 185 | fGRPArray(100000), //! array of GRPs - per run - JUST for calibration studies |
0231c65f | 186 | fGRPMaps(100000), //! array of GRPs - per run - JUST for calibration studies |
da6c0bc9 | 187 | fGoofieArray(100000), //! array of GOOFIE values -per run - Just for calibration studies |
e2914767 | 188 | fVoltageArray(100000), |
da6c0bc9 | 189 | fTemperatureArray(100000), //! array of temperature sensors - per run - Just for calibration studies |
190 | fVdriftArray(100000), //! array of v drift interfaces | |
5e1215d4 | 191 | fDriftCorrectionArray(100000), //! array of drift correction |
bf85fe4d | 192 | fRunList(100000) //! run list - indicates try to get the run param |
193 | ||
c5bbaa2c | 194 | { |
195 | // | |
196 | // constructor | |
197 | // | |
54472e4f | 198 | // |
c5bbaa2c | 199 | Update(); // temporary |
200 | } | |
201 | ||
9389f9a4 | 202 | AliTPCcalibDB::AliTPCcalibDB(const AliTPCcalibDB& ): |
203 | TObject(), | |
204 | fRun(-1), | |
205 | fTransform(0), | |
206 | fExB(0), | |
207 | fPadGainFactor(0), | |
9f6e9f81 | 208 | fDedxGainFactor(0), |
9389f9a4 | 209 | fPadTime0(0), |
210 | fPadNoise(0), | |
211 | fPedestals(0), | |
6e7d7dc4 | 212 | fCalibRaw(0), |
5312f439 | 213 | fALTROConfigData(0), |
214 | fPulserData(0), | |
215 | fCEData(0), | |
9389f9a4 | 216 | fTemperature(0), |
217 | fMapping(0), | |
9389f9a4 | 218 | fParam(0), |
bf85fe4d | 219 | fClusterParam(0), |
a2c3785e | 220 | fTimeGainSplines(0), |
221 | fTimeGainSplinesArray(100000), | |
bf85fe4d | 222 | fGRPArray(0), //! array of GRPs - per run - JUST for calibration studies |
0231c65f | 223 | fGRPMaps(0), //! array of GRPs - per run - JUST for calibration studies |
bf85fe4d | 224 | fGoofieArray(0), //! array of GOOFIE values -per run - Just for calibration studies |
e2914767 | 225 | fVoltageArray(0), |
bf85fe4d | 226 | fTemperatureArray(0), //! array of temperature sensors - per run - Just for calibration studies |
da6c0bc9 | 227 | fVdriftArray(0), //! array of v drift interfaces |
5e1215d4 | 228 | fDriftCorrectionArray(0), //! array of v drift interfaces |
bf85fe4d | 229 | fRunList(0) //! run list - indicates try to get the run param |
9389f9a4 | 230 | { |
231 | // | |
232 | // Copy constructor invalid -- singleton implementation | |
233 | // | |
234 | Error("copy constructor","invalid -- singleton implementation"); | |
235 | } | |
236 | ||
237 | AliTPCcalibDB& AliTPCcalibDB::operator= (const AliTPCcalibDB& ) | |
238 | { | |
239 | // | |
240 | // Singleton implementation - no assignment operator | |
241 | // | |
242 | Error("operator =", "assignment operator not implemented"); | |
243 | return *this; | |
244 | } | |
245 | ||
246 | ||
247 | ||
c5bbaa2c | 248 | //_____________________________________________________________________________ |
249 | AliTPCcalibDB::~AliTPCcalibDB() | |
250 | { | |
251 | // | |
252 | // destructor | |
253 | // | |
68751c2c | 254 | |
255 | // don't delete anything, CDB cache is active! | |
256 | //if (fPadGainFactor) delete fPadGainFactor; | |
257 | //if (fPadTime0) delete fPadTime0; | |
68751c2c | 258 | //if (fPadNoise) delete fPadNoise; |
c5bbaa2c | 259 | } |
260 | ||
261 | ||
262 | //_____________________________________________________________________________ | |
263 | AliCDBEntry* AliTPCcalibDB::GetCDBEntry(const char* cdbPath) | |
264 | { | |
265 | // | |
266 | // Retrieves an entry with path <cdbPath> from the CDB. | |
267 | // | |
268 | char chinfo[1000]; | |
269 | ||
68751c2c | 270 | AliCDBEntry* entry = AliCDBManager::Instance()->Get(cdbPath, fRun); |
c5bbaa2c | 271 | if (!entry) |
272 | { | |
273 | sprintf(chinfo,"AliTPCcalibDB: Failed to get entry:\t%s ", cdbPath); | |
274 | AliError(chinfo); | |
275 | return 0; | |
276 | } | |
277 | return entry; | |
278 | } | |
279 | ||
280 | ||
281 | //_____________________________________________________________________________ | |
282 | void AliTPCcalibDB::SetRun(Long64_t run) | |
283 | { | |
284 | // | |
285 | // Sets current run number. Calibration data is read from the corresponding file. | |
286 | // | |
287 | if (fRun == run) | |
288 | return; | |
a2c3785e | 289 | fRun = run; |
c5bbaa2c | 290 | Update(); |
291 | } | |
292 | ||
293 | ||
294 | ||
295 | void AliTPCcalibDB::Update(){ | |
a2c3785e | 296 | // |
297 | AliCDBEntry * entry=0; | |
68751c2c | 298 | |
299 | Bool_t cdbCache = AliCDBManager::Instance()->GetCacheFlag(); // save cache status | |
300 | AliCDBManager::Instance()->SetCacheFlag(kTRUE); // activate CDB cache | |
301 | ||
c5bbaa2c | 302 | // |
303 | entry = GetCDBEntry("TPC/Calib/PadGainFactor"); | |
304 | if (entry){ | |
68751c2c | 305 | //if (fPadGainFactor) delete fPadGainFactor; |
c5bbaa2c | 306 | entry->SetOwner(kTRUE); |
307 | fPadGainFactor = (AliTPCCalPad*)entry->GetObject(); | |
308 | } | |
309 | // | |
3af3fbc4 | 310 | entry = GetCDBEntry("TPC/Calib/TimeGain"); |
311 | if (entry){ | |
312 | //if (fTimeGainSplines) delete fTimeGainSplines; | |
313 | entry->SetOwner(kTRUE); | |
314 | fTimeGainSplines = (TObjArray*)entry->GetObject(); | |
315 | } | |
316 | // | |
9f6e9f81 | 317 | entry = GetCDBEntry("TPC/Calib/GainFactorDedx"); |
318 | if (entry){ | |
319 | entry->SetOwner(kTRUE); | |
320 | fDedxGainFactor = (AliTPCCalPad*)entry->GetObject(); | |
321 | } | |
322 | // | |
c5bbaa2c | 323 | entry = GetCDBEntry("TPC/Calib/PadTime0"); |
324 | if (entry){ | |
68751c2c | 325 | //if (fPadTime0) delete fPadTime0; |
c5bbaa2c | 326 | entry->SetOwner(kTRUE); |
327 | fPadTime0 = (AliTPCCalPad*)entry->GetObject(); | |
328 | } | |
329 | // | |
c5bbaa2c | 330 | // |
331 | entry = GetCDBEntry("TPC/Calib/PadNoise"); | |
332 | if (entry){ | |
68751c2c | 333 | //if (fPadNoise) delete fPadNoise; |
c5bbaa2c | 334 | entry->SetOwner(kTRUE); |
335 | fPadNoise = (AliTPCCalPad*)entry->GetObject(); | |
336 | } | |
8477f500 | 337 | |
338 | entry = GetCDBEntry("TPC/Calib/Pedestals"); | |
339 | if (entry){ | |
340 | //if (fPedestals) delete fPedestals; | |
341 | entry->SetOwner(kTRUE); | |
342 | fPedestals = (AliTPCCalPad*)entry->GetObject(); | |
343 | } | |
344 | ||
54472e4f | 345 | entry = GetCDBEntry("TPC/Calib/Temperature"); |
346 | if (entry){ | |
347 | //if (fTemperature) delete fTemperature; | |
348 | entry->SetOwner(kTRUE); | |
349 | fTemperature = (AliTPCSensorTempArray*)entry->GetObject(); | |
350 | } | |
351 | ||
8477f500 | 352 | entry = GetCDBEntry("TPC/Calib/Parameters"); |
353 | if (entry){ | |
54472e4f | 354 | //if (fPadNoise) delete fPadNoise; |
8477f500 | 355 | entry->SetOwner(kTRUE); |
a778f7e3 | 356 | fParam = (AliTPCParam*)(entry->GetObject()->Clone()); |
8477f500 | 357 | } |
358 | ||
96305e49 | 359 | entry = GetCDBEntry("TPC/Calib/ClusterParam"); |
360 | if (entry){ | |
96305e49 | 361 | entry->SetOwner(kTRUE); |
362 | fClusterParam = (AliTPCClusterParam*)(entry->GetObject()->Clone()); | |
363 | } | |
364 | ||
5312f439 | 365 | //ALTRO configuration data |
366 | entry = GetCDBEntry("TPC/Calib/AltroConfig"); | |
367 | if (entry){ | |
368 | entry->SetOwner(kTRUE); | |
369 | fALTROConfigData=(TObjArray*)(entry->GetObject()); | |
370 | } | |
371 | ||
372 | //Calibration Pulser data | |
373 | entry = GetCDBEntry("TPC/Calib/Pulser"); | |
374 | if (entry){ | |
375 | entry->SetOwner(kTRUE); | |
376 | fPulserData=(TObjArray*)(entry->GetObject()); | |
377 | } | |
378 | ||
379 | //CE data | |
380 | entry = GetCDBEntry("TPC/Calib/CE"); | |
381 | if (entry){ | |
382 | entry->SetOwner(kTRUE); | |
383 | fCEData=(TObjArray*)(entry->GetObject()); | |
384 | } | |
6e7d7dc4 | 385 | //RAW calibration data |
386 | entry = GetCDBEntry("TPC/Calib/Raw"); | |
387 | if (entry){ | |
388 | entry->SetOwner(kTRUE); | |
389 | TObjArray *arr=(TObjArray*)(entry->GetObject()); | |
390 | if (arr) fCalibRaw=(AliTPCCalibRaw*)arr->At(0); | |
391 | } | |
5312f439 | 392 | |
d6834f5f | 393 | entry = GetCDBEntry("TPC/Calib/Mapping"); |
394 | if (entry){ | |
395 | //if (fPadNoise) delete fPadNoise; | |
396 | entry->SetOwner(kTRUE); | |
397 | TObjArray * array = dynamic_cast<TObjArray*>(entry->GetObject()); | |
398 | if (array && array->GetEntriesFast()==6){ | |
399 | fMapping = new AliTPCAltroMapping*[6]; | |
400 | for (Int_t i=0; i<6; i++){ | |
5312f439 | 401 | fMapping[i] = dynamic_cast<AliTPCAltroMapping*>(array->At(i)); |
d6834f5f | 402 | } |
403 | } | |
404 | } | |
405 | ||
406 | ||
407 | ||
3ac615eb | 408 | //entry = GetCDBEntry("TPC/Calib/ExB"); |
409 | //if (entry) { | |
410 | // entry->SetOwner(kTRUE); | |
411 | // fExB=dynamic_cast<AliTPCExB*>(entry->GetObject()->Clone()); | |
412 | //} | |
413 | // | |
414 | // ExB - calculate during initialization | |
415 | // - | |
f4d5fd21 | 416 | fExB = GetExB(-5,kTRUE); |
417 | // | |
f5344549 | 418 | if (!fTransform) { |
419 | fTransform=new AliTPCTransform(); | |
bfec3eeb | 420 | fTransform->SetCurrentRun(AliCDBManager::Instance()->GetRun()); |
f5344549 | 421 | } |
8477f500 | 422 | |
c5bbaa2c | 423 | // |
68751c2c | 424 | AliCDBManager::Instance()->SetCacheFlag(cdbCache); // reset original CDB cache |
425 | ||
c5bbaa2c | 426 | } |
e4dce695 | 427 | |
86df2b3a | 428 | |
429 | ||
430 | void AliTPCcalibDB::CreateObjectList(const Char_t *filename, TObjArray *calibObjects) | |
431 | { | |
418bbcaf | 432 | // |
433 | // Create calibration objects and read contents from OCDB | |
434 | // | |
86df2b3a | 435 | if ( calibObjects == 0x0 ) return; |
436 | ifstream in; | |
437 | in.open(filename); | |
438 | if ( !in.is_open() ){ | |
439 | fprintf(stderr,"Error: cannot open list file '%s'", filename); | |
440 | return; | |
441 | } | |
442 | ||
443 | AliTPCCalPad *calPad=0x0; | |
444 | ||
445 | TString sFile; | |
446 | sFile.ReadFile(in); | |
447 | in.close(); | |
448 | ||
449 | TObjArray *arrFileLine = sFile.Tokenize("\n"); | |
450 | ||
451 | TIter nextLine(arrFileLine); | |
452 | ||
453 | TObjString *sObjLine=0x0; | |
2c632057 | 454 | while ( (sObjLine = (TObjString*)nextLine()) ){ |
86df2b3a | 455 | TString sLine(sObjLine->GetString()); |
456 | ||
457 | TObjArray *arrNextCol = sLine.Tokenize("\t"); | |
458 | ||
459 | TObjString *sObjType = (TObjString*)(arrNextCol->At(0)); | |
460 | TObjString *sObjFileName = (TObjString*)(arrNextCol->At(1)); | |
461 | ||
462 | if ( !sObjType || ! sObjFileName ) continue; | |
463 | TString sType(sObjType->GetString()); | |
464 | TString sFileName(sObjFileName->GetString()); | |
465 | printf("%s\t%s\n",sType.Data(),sFileName.Data()); | |
466 | ||
467 | TFile *fIn = TFile::Open(sFileName); | |
468 | if ( !fIn ){ | |
469 | fprintf(stderr,"File not found: '%s'", sFileName.Data()); | |
470 | continue; | |
471 | } | |
472 | ||
473 | if ( sType == "CE" ){ | |
474 | AliTPCCalibCE *ce = (AliTPCCalibCE*)fIn->Get("AliTPCCalibCE"); | |
475 | ||
476 | calPad = new AliTPCCalPad((TObjArray*)ce->GetCalPadT0()); | |
477 | calPad->SetNameTitle("CETmean","CETmean"); | |
478 | calibObjects->Add(calPad); | |
479 | ||
480 | calPad = new AliTPCCalPad((TObjArray*)ce->GetCalPadQ()); | |
481 | calPad->SetNameTitle("CEQmean","CEQmean"); | |
482 | calibObjects->Add(calPad); | |
483 | ||
484 | calPad = new AliTPCCalPad((TObjArray*)ce->GetCalPadRMS()); | |
485 | calPad->SetNameTitle("CETrms","CETrms"); | |
486 | calibObjects->Add(calPad); | |
487 | ||
488 | } else if ( sType == "Pulser") { | |
0fe7645c | 489 | AliTPCCalibPulser *sig = (AliTPCCalibPulser*)fIn->Get("AliTPCCalibPulser"); |
86df2b3a | 490 | |
491 | calPad = new AliTPCCalPad((TObjArray*)sig->GetCalPadT0()); | |
492 | calPad->SetNameTitle("PulserTmean","PulserTmean"); | |
493 | calibObjects->Add(calPad); | |
494 | ||
495 | calPad = new AliTPCCalPad((TObjArray*)sig->GetCalPadQ()); | |
496 | calPad->SetNameTitle("PulserQmean","PulserQmean"); | |
497 | calibObjects->Add(calPad); | |
498 | ||
499 | calPad = new AliTPCCalPad((TObjArray*)sig->GetCalPadRMS()); | |
500 | calPad->SetNameTitle("PulserTrms","PulserTrms"); | |
501 | calibObjects->Add(calPad); | |
502 | ||
503 | } else if ( sType == "Pedestals") { | |
504 | AliTPCCalibPedestal *ped = (AliTPCCalibPedestal*)fIn->Get("AliTPCCalibPedestal"); | |
505 | ||
506 | calPad = new AliTPCCalPad((TObjArray*)ped->GetCalPadPedestal()); | |
507 | calPad->SetNameTitle("Pedestals","Pedestals"); | |
508 | calibObjects->Add(calPad); | |
509 | ||
510 | calPad = new AliTPCCalPad((TObjArray*)ped->GetCalPadRMS()); | |
511 | calPad->SetNameTitle("Noise","Noise"); | |
512 | calibObjects->Add(calPad); | |
513 | ||
514 | } else { | |
515 | fprintf(stderr,"Undefined Type: '%s'",sType.Data()); | |
516 | ||
517 | } | |
518 | delete fIn; | |
519 | } | |
520 | } | |
521 | ||
522 | ||
523 | ||
524 | void AliTPCcalibDB::MakeTree(const char * fileName, TObjArray * array, const char * mapFileName, AliTPCCalPad* outlierPad, Float_t ltmFraction) { | |
525 | // | |
526 | // Write a tree with all available information | |
418bbcaf | 527 | // if mapFileName is specified, the Map information are also written to the tree |
86df2b3a | 528 | // pads specified in outlierPad are not used for calculating statistics |
529 | // - the same function as AliTPCCalPad::MakeTree - | |
530 | // | |
531 | AliTPCROC* tpcROCinstance = AliTPCROC::Instance(); | |
532 | ||
533 | TObjArray* mapIROCs = 0; | |
534 | TObjArray* mapOROCs = 0; | |
535 | TVectorF *mapIROCArray = 0; | |
536 | TVectorF *mapOROCArray = 0; | |
537 | Int_t mapEntries = 0; | |
538 | TString* mapNames = 0; | |
539 | ||
540 | if (mapFileName) { | |
541 | TFile mapFile(mapFileName, "read"); | |
542 | ||
543 | TList* listOfROCs = mapFile.GetListOfKeys(); | |
544 | mapEntries = listOfROCs->GetEntries()/2; | |
545 | mapIROCs = new TObjArray(mapEntries*2); | |
546 | mapOROCs = new TObjArray(mapEntries*2); | |
547 | mapIROCArray = new TVectorF[mapEntries]; | |
548 | mapOROCArray = new TVectorF[mapEntries]; | |
549 | ||
550 | mapNames = new TString[mapEntries]; | |
551 | for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) { | |
418bbcaf | 552 | TString nameROC(((TKey*)(listOfROCs->At(ivalue*2)))->GetName()); |
553 | nameROC.Remove(nameROC.Length()-4, 4); | |
554 | mapIROCs->AddAt((AliTPCCalROC*)mapFile.Get((nameROC + "IROC").Data()), ivalue); | |
555 | mapOROCs->AddAt((AliTPCCalROC*)mapFile.Get((nameROC + "OROC").Data()), ivalue); | |
556 | mapNames[ivalue].Append(nameROC); | |
86df2b3a | 557 | } |
558 | ||
559 | for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) { | |
560 | mapIROCArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(0)); | |
561 | mapOROCArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(36)); | |
562 | ||
563 | for (UInt_t ichannel = 0; ichannel < tpcROCinstance->GetNChannels(0); ichannel++) | |
564 | (mapIROCArray[ivalue])[ichannel] = ((AliTPCCalROC*)(mapIROCs->At(ivalue)))->GetValue(ichannel); | |
565 | for (UInt_t ichannel = 0; ichannel < tpcROCinstance->GetNChannels(36); ichannel++) | |
566 | (mapOROCArray[ivalue])[ichannel] = ((AliTPCCalROC*)(mapOROCs->At(ivalue)))->GetValue(ichannel); | |
567 | } | |
568 | ||
569 | } // if (mapFileName) | |
570 | ||
571 | TTreeSRedirector cstream(fileName); | |
572 | Int_t arrayEntries = array->GetEntries(); | |
573 | ||
574 | TString* names = new TString[arrayEntries]; | |
575 | for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) | |
576 | names[ivalue].Append(((AliTPCCalPad*)array->At(ivalue))->GetName()); | |
577 | ||
578 | for (UInt_t isector = 0; isector < tpcROCinstance->GetNSectors(); isector++) { | |
579 | // | |
580 | // get statistic for given sector | |
581 | // | |
582 | TVectorF median(arrayEntries); | |
583 | TVectorF mean(arrayEntries); | |
584 | TVectorF rms(arrayEntries); | |
585 | TVectorF ltm(arrayEntries); | |
586 | TVectorF ltmrms(arrayEntries); | |
587 | TVectorF medianWithOut(arrayEntries); | |
588 | TVectorF meanWithOut(arrayEntries); | |
589 | TVectorF rmsWithOut(arrayEntries); | |
590 | TVectorF ltmWithOut(arrayEntries); | |
591 | TVectorF ltmrmsWithOut(arrayEntries); | |
592 | ||
593 | TVectorF *vectorArray = new TVectorF[arrayEntries]; | |
594 | for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) | |
595 | vectorArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(isector)); | |
596 | ||
597 | for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) { | |
598 | AliTPCCalPad* calPad = (AliTPCCalPad*) array->At(ivalue); | |
599 | AliTPCCalROC* calROC = calPad->GetCalROC(isector); | |
600 | AliTPCCalROC* outlierROC = 0; | |
601 | if (outlierPad) outlierROC = outlierPad->GetCalROC(isector); | |
602 | if (calROC) { | |
603 | median[ivalue] = calROC->GetMedian(); | |
604 | mean[ivalue] = calROC->GetMean(); | |
605 | rms[ivalue] = calROC->GetRMS(); | |
606 | Double_t ltmrmsValue = 0; | |
607 | ltm[ivalue] = calROC->GetLTM(<mrmsValue, ltmFraction); | |
608 | ltmrms[ivalue] = ltmrmsValue; | |
609 | if (outlierROC) { | |
610 | medianWithOut[ivalue] = calROC->GetMedian(outlierROC); | |
611 | meanWithOut[ivalue] = calROC->GetMean(outlierROC); | |
612 | rmsWithOut[ivalue] = calROC->GetRMS(outlierROC); | |
613 | ltmrmsValue = 0; | |
614 | ltmWithOut[ivalue] = calROC->GetLTM(<mrmsValue, ltmFraction, outlierROC); | |
615 | ltmrmsWithOut[ivalue] = ltmrmsValue; | |
616 | } | |
617 | } | |
618 | else { | |
619 | median[ivalue] = 0.; | |
620 | mean[ivalue] = 0.; | |
621 | rms[ivalue] = 0.; | |
622 | ltm[ivalue] = 0.; | |
623 | ltmrms[ivalue] = 0.; | |
624 | medianWithOut[ivalue] = 0.; | |
625 | meanWithOut[ivalue] = 0.; | |
626 | rmsWithOut[ivalue] = 0.; | |
627 | ltmWithOut[ivalue] = 0.; | |
628 | ltmrmsWithOut[ivalue] = 0.; | |
629 | } | |
630 | } | |
631 | ||
632 | // | |
633 | // fill vectors of variable per pad | |
634 | // | |
635 | TVectorF *posArray = new TVectorF[8]; | |
636 | for (Int_t ivalue = 0; ivalue < 8; ivalue++) | |
637 | posArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(isector)); | |
638 | ||
639 | Float_t posG[3] = {0}; | |
640 | Float_t posL[3] = {0}; | |
641 | Int_t ichannel = 0; | |
642 | for (UInt_t irow = 0; irow < tpcROCinstance->GetNRows(isector); irow++) { | |
643 | for (UInt_t ipad = 0; ipad < tpcROCinstance->GetNPads(isector, irow); ipad++) { | |
644 | tpcROCinstance->GetPositionLocal(isector, irow, ipad, posL); | |
645 | tpcROCinstance->GetPositionGlobal(isector, irow, ipad, posG); | |
646 | posArray[0][ichannel] = irow; | |
647 | posArray[1][ichannel] = ipad; | |
648 | posArray[2][ichannel] = posL[0]; | |
649 | posArray[3][ichannel] = posL[1]; | |
650 | posArray[4][ichannel] = posG[0]; | |
651 | posArray[5][ichannel] = posG[1]; | |
652 | posArray[6][ichannel] = (Int_t)(ipad - (Double_t)(tpcROCinstance->GetNPads(isector, irow))/2); | |
653 | posArray[7][ichannel] = ichannel; | |
654 | ||
655 | // loop over array containing AliTPCCalPads | |
656 | for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) { | |
657 | AliTPCCalPad* calPad = (AliTPCCalPad*) array->At(ivalue); | |
658 | AliTPCCalROC* calROC = calPad->GetCalROC(isector); | |
659 | if (calROC) | |
660 | (vectorArray[ivalue])[ichannel] = calROC->GetValue(irow, ipad); | |
661 | else | |
662 | (vectorArray[ivalue])[ichannel] = 0; | |
663 | } | |
664 | ichannel++; | |
665 | } | |
666 | } | |
667 | ||
668 | cstream << "calPads" << | |
669 | "sector=" << isector; | |
670 | ||
671 | for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) { | |
672 | cstream << "calPads" << | |
673 | (Char_t*)((names[ivalue] + "_Median=").Data()) << median[ivalue] << | |
674 | (Char_t*)((names[ivalue] + "_Mean=").Data()) << mean[ivalue] << | |
675 | (Char_t*)((names[ivalue] + "_RMS=").Data()) << rms[ivalue] << | |
676 | (Char_t*)((names[ivalue] + "_LTM=").Data()) << ltm[ivalue] << | |
677 | (Char_t*)((names[ivalue] + "_RMS_LTM=").Data()) << ltmrms[ivalue]; | |
678 | if (outlierPad) { | |
679 | cstream << "calPads" << | |
680 | (Char_t*)((names[ivalue] + "_Median_OutlierCutted=").Data()) << medianWithOut[ivalue] << | |
681 | (Char_t*)((names[ivalue] + "_Mean_OutlierCutted=").Data()) << meanWithOut[ivalue] << | |
682 | (Char_t*)((names[ivalue] + "_RMS_OutlierCutted=").Data()) << rmsWithOut[ivalue] << | |
683 | (Char_t*)((names[ivalue] + "_LTM_OutlierCutted=").Data()) << ltmWithOut[ivalue] << | |
684 | (Char_t*)((names[ivalue] + "_RMS_LTM_OutlierCutted=").Data()) << ltmrmsWithOut[ivalue]; | |
685 | } | |
686 | } | |
687 | ||
688 | for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) { | |
689 | cstream << "calPads" << | |
690 | (Char_t*)((names[ivalue] + ".=").Data()) << &vectorArray[ivalue]; | |
691 | } | |
692 | ||
693 | if (mapFileName) { | |
694 | for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) { | |
695 | if (isector < 36) | |
696 | cstream << "calPads" << | |
697 | (Char_t*)((mapNames[ivalue] + ".=").Data()) << &mapIROCArray[ivalue]; | |
698 | else | |
699 | cstream << "calPads" << | |
700 | (Char_t*)((mapNames[ivalue] + ".=").Data()) << &mapOROCArray[ivalue]; | |
701 | } | |
702 | } | |
703 | ||
704 | cstream << "calPads" << | |
705 | "row.=" << &posArray[0] << | |
706 | "pad.=" << &posArray[1] << | |
707 | "lx.=" << &posArray[2] << | |
708 | "ly.=" << &posArray[3] << | |
709 | "gx.=" << &posArray[4] << | |
710 | "gy.=" << &posArray[5] << | |
711 | "rpad.=" << &posArray[6] << | |
712 | "channel.=" << &posArray[7]; | |
713 | ||
714 | cstream << "calPads" << | |
715 | "\n"; | |
716 | ||
717 | delete[] posArray; | |
718 | delete[] vectorArray; | |
719 | } | |
720 | ||
721 | ||
722 | delete[] names; | |
723 | if (mapFileName) { | |
724 | delete mapIROCs; | |
725 | delete mapOROCs; | |
726 | delete[] mapIROCArray; | |
727 | delete[] mapOROCArray; | |
728 | delete[] mapNames; | |
729 | } | |
730 | } | |
3ac615eb | 731 | |
732 | ||
733 | ||
734 | void AliTPCcalibDB::RegisterExB(Int_t index, Float_t bz, Bool_t bdelete){ | |
735 | // | |
736 | // Register static ExB correction map | |
737 | // index - registration index - used for visualization | |
738 | // bz - bz field in kGaus | |
739 | ||
0a997b33 | 740 | // Float_t factor = bz/(-5.); // default b filed in Cheb with minus sign |
741 | Float_t factor = bz/(5.); // default b filed in Cheb with minus sign | |
742 | // was chenged in the Revision ???? (Ruben can you add here number) | |
3ac615eb | 743 | |
f7a1cc68 | 744 | AliMagF* bmap = new AliMagF("MapsExB","MapsExB", 2,factor,1., 10.,AliMagF::k5kG,"$(ALICE_ROOT)/data/maps/mfchebKGI_sym.root"); |
3ac615eb | 745 | |
746 | AliTPCExBFirst *exb = new AliTPCExBFirst(bmap,0.88*2.6400e+04,50,50,50); | |
747 | AliTPCExB::SetInstance(exb); | |
748 | ||
749 | if (bdelete){ | |
750 | delete bmap; | |
751 | }else{ | |
752 | AliTPCExB::RegisterField(index,bmap); | |
753 | } | |
754 | if (index>=fgExBArray.GetEntries()) fgExBArray.Expand((index+1)*2+11); | |
755 | fgExBArray.AddAt(exb,index); | |
756 | } | |
757 | ||
758 | ||
759 | AliTPCExB* AliTPCcalibDB::GetExB(Float_t bz, Bool_t deleteB) { | |
760 | // | |
761 | // bz filed in KGaus not in tesla | |
762 | // Get ExB correction map | |
763 | // if doesn't exist - create it | |
764 | // | |
765 | Int_t index = TMath::Nint(5+bz); | |
766 | if (index>fgExBArray.GetEntries()) fgExBArray.Expand((index+1)*2+11); | |
767 | if (!fgExBArray.At(index)) AliTPCcalibDB::RegisterExB(index,bz,deleteB); | |
768 | return (AliTPCExB*)fgExBArray.At(index); | |
769 | } | |
770 | ||
771 | ||
772 | void AliTPCcalibDB::SetExBField(Float_t bz){ | |
773 | // | |
774 | // Set magnetic filed for ExB correction | |
775 | // | |
776 | fExB = GetExB(bz,kFALSE); | |
777 | } | |
bf85fe4d | 778 | |
0a997b33 | 779 | void AliTPCcalibDB::SetExBField(const AliMagF* bmap){ |
780 | // | |
781 | // Set magnetic field for ExB correction | |
782 | // | |
783 | AliTPCExBFirst *exb = new AliTPCExBFirst(bmap,0.88*2.6400e+04,50,50,50); | |
784 | AliTPCExB::SetInstance(exb); | |
785 | fExB=exb; | |
786 | } | |
787 | ||
bf85fe4d | 788 | |
789 | ||
5e1215d4 | 790 | |
791 | ||
792 | void AliTPCcalibDB::UpdateRunInformations( Int_t run, Bool_t force){ | |
bf85fe4d | 793 | // |
794 | // - > Don't use it for reconstruction - Only for Calibration studies | |
795 | // | |
796 | AliCDBEntry * entry = 0; | |
797 | if (run>= fRunList.GetSize()){ | |
798 | fRunList.Set(run*2+1); | |
da6c0bc9 | 799 | fGRPArray.Expand(run*2+1); |
0231c65f | 800 | fGRPMaps.Expand(run*2+1); |
e2914767 | 801 | fGoofieArray.Expand(run*2+1); |
802 | fVoltageArray.Expand(run*2+1); | |
da6c0bc9 | 803 | fTemperatureArray.Expand(run*2+1); |
804 | fVdriftArray.Expand(run*2+1); | |
5e1215d4 | 805 | fDriftCorrectionArray.Expand(run*2+1); |
a2c3785e | 806 | fTimeGainSplinesArray.Expand(run*2+1); |
bf85fe4d | 807 | } |
5e1215d4 | 808 | if (fRunList[run]>0 &&force==kFALSE) return; |
809 | // | |
bf85fe4d | 810 | entry = AliCDBManager::Instance()->Get("GRP/GRP/Data",run); |
0231c65f | 811 | if (entry) { |
812 | AliGRPObject * grpRun = dynamic_cast<AliGRPObject*>(entry->GetObject()); | |
813 | if (!grpRun){ | |
814 | TMap* map = dynamic_cast<TMap*>(entry->GetObject()); | |
815 | if (map){ | |
e2914767 | 816 | //grpRun = new AliGRPObject; |
817 | //grpRun->ReadValuesFromMap(map); | |
818 | grpRun = MakeGRPObjectFromMap(map); | |
819 | ||
0231c65f | 820 | fGRPMaps.AddAt(map,run); |
821 | } | |
822 | } | |
823 | fGRPArray.AddAt(grpRun,run); | |
824 | } | |
bf85fe4d | 825 | entry = AliCDBManager::Instance()->Get("TPC/Calib/Goofie",run); |
5e1215d4 | 826 | if (entry){ |
827 | fGoofieArray.AddAt(entry->GetObject(),run); | |
828 | } | |
e2914767 | 829 | // |
830 | entry = AliCDBManager::Instance()->Get("TPC/Calib/HighVoltage",run); | |
5e1215d4 | 831 | if (entry) { |
832 | fVoltageArray.AddAt(entry->GetObject(),run); | |
833 | } | |
e2914767 | 834 | // |
a2c3785e | 835 | entry = AliCDBManager::Instance()->Get("TPC/Calib/TimeGain",run); |
5e1215d4 | 836 | if (entry) { |
837 | fTimeGainSplinesArray.AddAt(entry->GetObject(),run); | |
838 | } | |
839 | // | |
840 | entry = AliCDBManager::Instance()->Get("TPC/Calib/TimeDrift",run); | |
841 | if (entry) { | |
842 | fDriftCorrectionArray.AddAt(entry->GetObject(),run); | |
843 | } | |
a2c3785e | 844 | // |
bf85fe4d | 845 | entry = AliCDBManager::Instance()->Get("TPC/Calib/Temperature",run); |
5e1215d4 | 846 | if (entry) { |
847 | fTemperatureArray.AddAt(entry->GetObject(),run); | |
848 | } | |
bf85fe4d | 849 | fRunList[run]=1; // sign as used |
da6c0bc9 | 850 | |
bfec3eeb | 851 | AliDCSSensor * press = GetPressureSensor(run,0); |
da6c0bc9 | 852 | AliTPCSensorTempArray * temp = GetTemperatureSensor(run); |
853 | if (press && temp){ | |
854 | AliTPCCalibVdrift * vdrift = new AliTPCCalibVdrift(temp, press,0); | |
855 | fVdriftArray.AddAt(vdrift,run); | |
856 | } | |
bf85fe4d | 857 | } |
858 | ||
859 | ||
860 | Float_t AliTPCcalibDB::GetGain(Int_t sector, Int_t row, Int_t pad){ | |
861 | // | |
862 | // | |
863 | AliTPCCalPad *calPad = Instance()->fDedxGainFactor;; | |
864 | if (!calPad) return 0; | |
865 | return calPad->GetCalROC(sector)->GetValue(row,pad); | |
866 | } | |
867 | ||
7390f655 | 868 | AliSplineFit* AliTPCcalibDB::GetVdriftSplineFit(const char* name, Int_t run){ |
869 | // | |
870 | // | |
871 | // | |
872 | TObjArray *arr=GetTimeVdriftSplineRun(run); | |
873 | if (!arr) return 0; | |
874 | return dynamic_cast<AliSplineFit*>(arr->FindObject(name)); | |
875 | } | |
876 | ||
8de77f00 | 877 | |
878 | AliGRPObject *AliTPCcalibDB::GetGRP(Int_t run){ | |
879 | // | |
880 | // Get GRP object for given run | |
881 | // | |
882 | AliGRPObject * grpRun = dynamic_cast<AliGRPObject *>((Instance()->fGRPArray).At(run)); | |
883 | if (!grpRun) { | |
5e1215d4 | 884 | Instance()->UpdateRunInformations(run); |
8de77f00 | 885 | grpRun = dynamic_cast<AliGRPObject *>(Instance()->fGRPArray.At(run)); |
886 | if (!grpRun) return 0; | |
887 | } | |
888 | return grpRun; | |
889 | } | |
890 | ||
0231c65f | 891 | TMap * AliTPCcalibDB::GetGRPMap(Int_t run){ |
892 | // | |
893 | // | |
894 | // | |
895 | TMap * grpRun = dynamic_cast<TMap *>((Instance()->fGRPMaps).At(run)); | |
896 | if (!grpRun) { | |
5e1215d4 | 897 | Instance()->UpdateRunInformations(run); |
0231c65f | 898 | grpRun = dynamic_cast<TMap *>(Instance()->fGRPMaps.At(run)); |
899 | if (!grpRun) return 0; | |
900 | } | |
901 | return grpRun; | |
902 | } | |
8de77f00 | 903 | |
904 | ||
da6c0bc9 | 905 | AliDCSSensor * AliTPCcalibDB::GetPressureSensor(Int_t run, Int_t type){ |
bf85fe4d | 906 | // |
0231c65f | 907 | // Get Pressure sensor |
bfec3eeb | 908 | // run = run number |
909 | // type = 0 - Cavern pressure | |
910 | // 1 - Suface pressure | |
0231c65f | 911 | // First try to get if trom map - if existing (Old format of data storing) |
bf85fe4d | 912 | // |
bfec3eeb | 913 | |
914 | ||
0231c65f | 915 | TMap *map = GetGRPMap(run); |
916 | if (map){ | |
917 | AliDCSSensor * sensor = 0; | |
918 | TObject *osensor=0; | |
919 | if (type==0) osensor = ((*map)("fCavernPressure")); | |
920 | if (type==1) osensor = ((*map)("fP2Pressure")); | |
921 | sensor =dynamic_cast<AliDCSSensor *>(osensor); | |
922 | if (sensor) return sensor; | |
923 | } | |
924 | // | |
925 | // If not map try to get it from the GRPObject | |
926 | // | |
927 | AliGRPObject * grpRun = dynamic_cast<AliGRPObject *>(fGRPArray.At(run)); | |
bf85fe4d | 928 | if (!grpRun) { |
5e1215d4 | 929 | UpdateRunInformations(run); |
efdbb95a | 930 | grpRun = dynamic_cast<AliGRPObject *>(fGRPArray.At(run)); |
bf85fe4d | 931 | if (!grpRun) return 0; |
932 | } | |
933 | AliDCSSensor * sensor = grpRun->GetCavernAtmosPressure(); | |
da6c0bc9 | 934 | if (type==1) sensor = grpRun->GetSurfaceAtmosPressure(); |
935 | return sensor; | |
bf85fe4d | 936 | } |
937 | ||
938 | AliTPCSensorTempArray * AliTPCcalibDB::GetTemperatureSensor(Int_t run){ | |
939 | // | |
940 | // Get temperature sensor array | |
941 | // | |
942 | AliTPCSensorTempArray * tempArray = (AliTPCSensorTempArray *)fTemperatureArray.At(run); | |
943 | if (!tempArray) { | |
5e1215d4 | 944 | UpdateRunInformations(run); |
bf85fe4d | 945 | tempArray = (AliTPCSensorTempArray *)fTemperatureArray.At(run); |
946 | } | |
947 | return tempArray; | |
948 | } | |
949 | ||
a2c3785e | 950 | |
951 | TObjArray * AliTPCcalibDB::GetTimeGainSplinesRun(Int_t run){ | |
bf85fe4d | 952 | // |
953 | // Get temperature sensor array | |
954 | // | |
a2c3785e | 955 | TObjArray * gainSplines = (TObjArray *)fTimeGainSplinesArray.At(run); |
956 | if (!gainSplines) { | |
5e1215d4 | 957 | UpdateRunInformations(run); |
a2c3785e | 958 | gainSplines = (TObjArray *)fTimeGainSplinesArray.At(run); |
bf85fe4d | 959 | } |
a2c3785e | 960 | return gainSplines; |
bf85fe4d | 961 | } |
962 | ||
7390f655 | 963 | TObjArray * AliTPCcalibDB::GetTimeVdriftSplineRun(Int_t run){ |
964 | // | |
965 | // Get drift spline array | |
966 | // | |
967 | TObjArray * driftSplines = (TObjArray *)fDriftCorrectionArray.At(run); | |
968 | if (!driftSplines) { | |
969 | UpdateRunInformations(run); | |
970 | driftSplines = (TObjArray *)fDriftCorrectionArray.At(run); | |
971 | } | |
972 | return driftSplines; | |
973 | } | |
974 | ||
e2914767 | 975 | AliDCSSensorArray * AliTPCcalibDB::GetVoltageSensors(Int_t run){ |
976 | // | |
977 | // Get temperature sensor array | |
978 | // | |
979 | AliDCSSensorArray * voltageArray = (AliDCSSensorArray *)fVoltageArray.At(run); | |
980 | if (!voltageArray) { | |
5e1215d4 | 981 | UpdateRunInformations(run); |
e2914767 | 982 | voltageArray = (AliDCSSensorArray *)fVoltageArray.At(run); |
983 | } | |
984 | return voltageArray; | |
985 | } | |
986 | ||
99895a4f | 987 | AliDCSSensorArray * AliTPCcalibDB::GetGoofieSensors(Int_t run){ |
988 | // | |
989 | // Get temperature sensor array | |
990 | // | |
991 | AliDCSSensorArray * goofieArray = (AliDCSSensorArray *)fGoofieArray.At(run); | |
992 | if (!goofieArray) { | |
5e1215d4 | 993 | UpdateRunInformations(run); |
99895a4f | 994 | goofieArray = (AliDCSSensorArray *)fGoofieArray.At(run); |
995 | } | |
996 | return goofieArray; | |
997 | } | |
998 | ||
999 | ||
1000 | ||
da6c0bc9 | 1001 | AliTPCCalibVdrift * AliTPCcalibDB::GetVdrift(Int_t run){ |
1002 | // | |
1003 | // Get the interface to the the vdrift | |
1004 | // | |
1005 | AliTPCCalibVdrift * vdrift = (AliTPCCalibVdrift*)fVdriftArray.At(run); | |
1006 | if (!vdrift) { | |
5e1215d4 | 1007 | UpdateRunInformations(run); |
da6c0bc9 | 1008 | vdrift= (AliTPCCalibVdrift*)fVdriftArray.At(run); |
1009 | } | |
1010 | return vdrift; | |
1011 | } | |
1012 | ||
892226be | 1013 | Float_t AliTPCcalibDB::GetCEdriftTime(Int_t run, Int_t sector, Double_t timeStamp, Int_t *entries) |
1014 | { | |
1015 | // | |
1016 | // GetCE drift time information for 'sector' | |
1017 | // sector 72 is the mean drift time of the A-Side | |
1018 | // sector 73 is the mean drift time of the C-Side | |
1019 | // it timestamp==-1 return mean value | |
1020 | // | |
1021 | AliTPCcalibDB::Instance()->SetRun(run); | |
1022 | TGraph *gr=AliTPCcalibDB::Instance()->GetCErocTgraph(sector); | |
1023 | if (!gr||sector<0||sector>73) { | |
1024 | if (entries) *entries=0; | |
1025 | return 0.; | |
1026 | } | |
1027 | Float_t val=0.; | |
1028 | if (timeStamp==-1.){ | |
1029 | val=gr->GetMean(2); | |
1030 | }else{ | |
1031 | for (Int_t ipoint=0;ipoint<gr->GetN();++ipoint){ | |
1032 | Double_t x,y; | |
1033 | gr->GetPoint(ipoint,x,y); | |
1034 | if (x<timeStamp) continue; | |
1035 | val=y; | |
1036 | break; | |
1037 | } | |
1038 | } | |
1039 | return val; | |
1040 | } | |
1041 | ||
1042 | Float_t AliTPCcalibDB::GetCEchargeTime(Int_t run, Int_t sector, Double_t timeStamp, Int_t *entries) | |
1043 | { | |
1044 | // | |
1045 | // GetCE mean charge for 'sector' | |
1046 | // it timestamp==-1 return mean value | |
1047 | // | |
1048 | AliTPCcalibDB::Instance()->SetRun(run); | |
1049 | TGraph *gr=AliTPCcalibDB::Instance()->GetCErocQgraph(sector); | |
1050 | if (!gr||sector<0||sector>71) { | |
1051 | if (entries) *entries=0; | |
1052 | return 0.; | |
1053 | } | |
1054 | Float_t val=0.; | |
1055 | if (timeStamp==-1.){ | |
1056 | val=gr->GetMean(2); | |
1057 | }else{ | |
1058 | for (Int_t ipoint=0;ipoint<gr->GetN();++ipoint){ | |
1059 | Double_t x,y; | |
1060 | gr->GetPoint(ipoint,x,y); | |
1061 | if (x<timeStamp) continue; | |
1062 | val=y; | |
1063 | break; | |
1064 | } | |
1065 | } | |
1066 | return val; | |
1067 | } | |
1068 | ||
7fff7612 | 1069 | Float_t AliTPCcalibDB::GetDCSSensorValue(AliDCSSensorArray *arr, Int_t timeStamp, const char * sensorName, Int_t sigDigits) |
1070 | { | |
1071 | // | |
1072 | // Get Value for a DCS sensor 'sensorName', run 'run' at time 'timeStamp' | |
1073 | // | |
1074 | Float_t val=0; | |
1075 | const TString sensorNameString(sensorName); | |
1076 | AliDCSSensor *sensor = arr->GetSensor(sensorNameString); | |
1077 | if (!sensor) return val; | |
892226be | 1078 | //use the dcs graph if possible |
1079 | TGraph *gr=sensor->GetGraph(); | |
1080 | if (gr){ | |
1081 | for (Int_t ipoint=0;ipoint<gr->GetN();++ipoint){ | |
1082 | Double_t x,y; | |
1083 | gr->GetPoint(ipoint,x,y); | |
7390f655 | 1084 | Int_t time=TMath::Nint(sensor->GetStartTime()+x*3600); //time in graph is hours |
892226be | 1085 | if (time<timeStamp) continue; |
1086 | val=y; | |
1087 | break; | |
1088 | } | |
1089 | //if val is still 0, test if if the requested time if within 5min of the first/last | |
1090 | //data point. If this is the case return the firs/last entry | |
1091 | //the timestamps might not be syncronised for all calibration types, sometimes a 'pre' | |
1092 | //and 'pos' period is requested. Especially to the HV this is not the case! | |
1093 | //first point | |
1094 | if (val==0 ){ | |
1095 | Double_t x,y; | |
1096 | gr->GetPoint(0,x,y); | |
7390f655 | 1097 | Int_t time=TMath::Nint(sensor->GetStartTime()+x*3600); //time in graph is hours |
892226be | 1098 | if ((time-timeStamp)<5*60) val=y; |
1099 | } | |
1100 | //last point | |
1101 | if (val==0 ){ | |
1102 | Double_t x,y; | |
1103 | gr->GetPoint(gr->GetN()-1,x,y); | |
7390f655 | 1104 | Int_t time=TMath::Nint(sensor->GetStartTime()+x*3600); //time in graph is hours |
892226be | 1105 | if ((timeStamp-time)<5*60) val=y; |
1106 | } | |
1107 | } else { | |
1108 | val=sensor->GetValue(timeStamp); | |
1109 | } | |
7fff7612 | 1110 | if (sigDigits>=0){ |
1111 | val=(Float_t)TMath::Floor(val * TMath::Power(10., sigDigits) + .5) / TMath::Power(10., sigDigits); | |
1112 | } | |
1113 | return val; | |
1114 | } | |
1115 | ||
1116 | Float_t AliTPCcalibDB::GetDCSSensorMeanValue(AliDCSSensorArray *arr, const char * sensorName, Int_t sigDigits) | |
1117 | { | |
1118 | // | |
1119 | // Get mean Value for a DCS sensor 'sensorName' during run 'run' | |
1120 | // | |
1121 | Float_t val=0; | |
1122 | const TString sensorNameString(sensorName); | |
1123 | AliDCSSensor *sensor = arr->GetSensor(sensorNameString); | |
1124 | if (!sensor) return val; | |
892226be | 1125 | |
1126 | //use dcs graph if it exists | |
1127 | TGraph *gr=sensor->GetGraph(); | |
1128 | if (gr){ | |
1129 | val=gr->GetMean(2); | |
1130 | } else { | |
1131 | //if we don't have the dcs graph, try to get some meaningful information | |
1132 | if (!sensor->GetFit()) return val; | |
1133 | Int_t nKnots=sensor->GetFit()->GetKnots(); | |
1134 | Double_t tMid=(sensor->GetEndTime()-sensor->GetStartTime())/2.; | |
1135 | for (Int_t iKnot=0;iKnot<nKnots;++iKnot){ | |
1136 | if (sensor->GetFit()->GetX()[iKnot]>tMid/3600.) break; | |
1137 | val=(Float_t)sensor->GetFit()->GetY0()[iKnot]; | |
1138 | } | |
7fff7612 | 1139 | } |
7fff7612 | 1140 | if (sigDigits>=0){ |
1141 | val/=10; | |
1142 | val=(Float_t)TMath::Floor(val * TMath::Power(10., sigDigits) + .5) / TMath::Power(10., sigDigits); | |
1143 | val*=10; | |
1144 | } | |
1145 | return val; | |
1146 | } | |
bf85fe4d | 1147 | |
7fff7612 | 1148 | Float_t AliTPCcalibDB::GetChamberHighVoltage(Int_t run, Int_t sector, Int_t timeStamp, Int_t sigDigits) { |
e2914767 | 1149 | // |
1150 | // return the chamber HV for given run and time: 0-35 IROC, 36-72 OROC | |
7fff7612 | 1151 | // if timeStamp==-1 return mean value |
1152 | // | |
1153 | Float_t val=0; | |
1154 | TString sensorName=""; | |
1155 | TTimeStamp stamp(timeStamp); | |
1156 | AliDCSSensorArray* voltageArray = AliTPCcalibDB::Instance()->GetVoltageSensors(run); | |
1157 | if (!voltageArray || (sector<0) || (sector>71)) return val; | |
1158 | Char_t sideName='A'; | |
1159 | if ((sector/18)%2==1) sideName='C'; | |
1160 | if (sector<36){ | |
1161 | //IROC | |
1162 | sensorName=Form("TPC_ANODE_I_%c%02d_VMEAS",sideName,sector%18); | |
1163 | }else{ | |
1164 | //OROC | |
1165 | sensorName=Form("TPC_ANODE_O_%c%02d_0_VMEAS",sideName,sector%18); | |
1166 | } | |
1167 | if (timeStamp==-1){ | |
1168 | val=AliTPCcalibDB::GetDCSSensorMeanValue(voltageArray, sensorName.Data(),sigDigits); | |
1169 | } else { | |
1170 | val=AliTPCcalibDB::GetDCSSensorValue(voltageArray, timeStamp, sensorName.Data(),sigDigits); | |
1171 | } | |
1172 | return val; | |
1173 | } | |
1174 | Float_t AliTPCcalibDB::GetSkirtVoltage(Int_t run, Int_t sector, Int_t timeStamp, Int_t sigDigits) | |
1175 | { | |
1176 | // | |
1177 | // Get the skirt voltage for 'run' at 'timeStamp' and 'sector': 0-35 IROC, 36-72 OROC | |
1178 | // type corresponds to the following: 0 - IROC A-Side; 1 - IROC C-Side; 2 - OROC A-Side; 3 - OROC C-Side | |
1179 | // if timeStamp==-1 return the mean value for the run | |
1180 | // | |
1181 | Float_t val=0; | |
1182 | TString sensorName=""; | |
1183 | TTimeStamp stamp(timeStamp); | |
1184 | AliDCSSensorArray* voltageArray = AliTPCcalibDB::Instance()->GetVoltageSensors(run); | |
1185 | if (!voltageArray || (sector<0) || (sector>71)) return val; | |
1186 | Char_t sideName='A'; | |
1187 | if ((sector/18)%2==1) sideName='C'; | |
1188 | sensorName=Form("TPC_SKIRT_%c_VMEAS",sideName); | |
1189 | if (timeStamp==-1){ | |
1190 | val=AliTPCcalibDB::GetDCSSensorMeanValue(voltageArray, sensorName.Data(),sigDigits); | |
1191 | } else { | |
1192 | val=AliTPCcalibDB::GetDCSSensorValue(voltageArray, timeStamp, sensorName.Data(),sigDigits); | |
1193 | } | |
1194 | return val; | |
1195 | } | |
1196 | ||
1197 | Float_t AliTPCcalibDB::GetCoverVoltage(Int_t run, Int_t sector, Int_t timeStamp, Int_t sigDigits) | |
1198 | { | |
1199 | // | |
1200 | // Get the cover voltage for run 'run' at time 'timeStamp' | |
1201 | // type corresponds to the following: 0 - IROC A-Side; 1 - IROC C-Side; 2 - OROC A-Side; 3 - OROC C-Side | |
1202 | // if timeStamp==-1 return the mean value for the run | |
e2914767 | 1203 | // |
7fff7612 | 1204 | Float_t val=0; |
1205 | TString sensorName=""; | |
e2914767 | 1206 | TTimeStamp stamp(timeStamp); |
1207 | AliDCSSensorArray* voltageArray = AliTPCcalibDB::Instance()->GetVoltageSensors(run); | |
7fff7612 | 1208 | if (!voltageArray || (sector<0) || (sector>71)) return val; |
1209 | Char_t sideName='A'; | |
1210 | if ((sector/18)%2==1) sideName='C'; | |
1211 | if (sector<36){ | |
1212 | //IROC | |
1213 | sensorName=Form("TPC_COVER_I_%c_VMEAS",sideName); | |
1214 | }else{ | |
1215 | //OROC | |
1216 | sensorName=Form("TPC_COVER_O_%c_VMEAS",sideName); | |
1217 | } | |
1218 | if (timeStamp==-1){ | |
1219 | val=AliTPCcalibDB::GetDCSSensorMeanValue(voltageArray, sensorName.Data(),sigDigits); | |
1220 | } else { | |
1221 | val=AliTPCcalibDB::GetDCSSensorValue(voltageArray, timeStamp, sensorName.Data(),sigDigits); | |
1222 | } | |
1223 | return val; | |
1224 | } | |
1225 | ||
1226 | Float_t AliTPCcalibDB::GetGGoffsetVoltage(Int_t run, Int_t sector, Int_t timeStamp, Int_t sigDigits) | |
1227 | { | |
1228 | // | |
1229 | // Get the GG offset voltage for run 'run' at time 'timeStamp' | |
1230 | // type corresponds to the following: 0 - IROC A-Side; 1 - IROC C-Side; 2 - OROC A-Side; 3 - OROC C-Side | |
1231 | // if timeStamp==-1 return the mean value for the run | |
1232 | // | |
1233 | Float_t val=0; | |
1234 | TString sensorName=""; | |
1235 | TTimeStamp stamp(timeStamp); | |
1236 | AliDCSSensorArray* voltageArray = AliTPCcalibDB::Instance()->GetVoltageSensors(run); | |
1237 | if (!voltageArray || (sector<0) || (sector>71)) return val; | |
1238 | Char_t sideName='A'; | |
1239 | if ((sector/18)%2==1) sideName='C'; | |
1240 | if (sector<36){ | |
1241 | //IROC | |
1242 | sensorName=Form("TPC_GATE_I_%c_OFF_VMEAS",sideName); | |
1243 | }else{ | |
1244 | //OROC | |
1245 | sensorName=Form("TPC_GATE_O_%c_OFF_VMEAS",sideName); | |
1246 | } | |
1247 | if (timeStamp==-1){ | |
1248 | val=AliTPCcalibDB::GetDCSSensorMeanValue(voltageArray, sensorName.Data(),sigDigits); | |
1249 | } else { | |
1250 | val=AliTPCcalibDB::GetDCSSensorValue(voltageArray, timeStamp, sensorName.Data(),sigDigits); | |
1251 | } | |
1252 | return val; | |
1253 | } | |
1254 | ||
1255 | Float_t AliTPCcalibDB::GetGGnegVoltage(Int_t run, Int_t sector, Int_t timeStamp, Int_t sigDigits) | |
1256 | { | |
1257 | // | |
1258 | // Get the GG offset voltage for run 'run' at time 'timeStamp' | |
1259 | // type corresponds to the following: 0 - IROC A-Side; 1 - IROC C-Side; 2 - OROC A-Side; 3 - OROC C-Side | |
1260 | // if timeStamp==-1 return the mean value for the run | |
1261 | // | |
1262 | Float_t val=0; | |
1263 | TString sensorName=""; | |
1264 | TTimeStamp stamp(timeStamp); | |
1265 | AliDCSSensorArray* voltageArray = AliTPCcalibDB::Instance()->GetVoltageSensors(run); | |
1266 | if (!voltageArray || (sector<0) || (sector>71)) return val; | |
1267 | Char_t sideName='A'; | |
1268 | if ((sector/18)%2==1) sideName='C'; | |
1269 | if (sector<36){ | |
1270 | //IROC | |
1271 | sensorName=Form("TPC_GATE_I_%c_NEG_VMEAS",sideName); | |
1272 | }else{ | |
1273 | //OROC | |
1274 | sensorName=Form("TPC_GATE_O_%c_NEG_VMEAS",sideName); | |
1275 | } | |
1276 | if (timeStamp==-1){ | |
1277 | val=AliTPCcalibDB::GetDCSSensorMeanValue(voltageArray, sensorName.Data(),sigDigits); | |
1278 | } else { | |
1279 | val=AliTPCcalibDB::GetDCSSensorValue(voltageArray, timeStamp, sensorName.Data(),sigDigits); | |
1280 | } | |
1281 | return val; | |
1282 | } | |
1283 | ||
1284 | Float_t AliTPCcalibDB::GetGGposVoltage(Int_t run, Int_t sector, Int_t timeStamp, Int_t sigDigits) | |
1285 | { | |
1286 | // | |
1287 | // Get the GG offset voltage for run 'run' at time 'timeStamp' | |
1288 | // type corresponds to the following: 0 - IROC A-Side; 1 - IROC C-Side; 2 - OROC A-Side; 3 - OROC C-Side | |
1289 | // if timeStamp==-1 return the mean value for the run | |
1290 | // | |
1291 | Float_t val=0; | |
1292 | TString sensorName=""; | |
1293 | TTimeStamp stamp(timeStamp); | |
1294 | AliDCSSensorArray* voltageArray = AliTPCcalibDB::Instance()->GetVoltageSensors(run); | |
1295 | if (!voltageArray || (sector<0) || (sector>71)) return val; | |
1296 | Char_t sideName='A'; | |
1297 | if ((sector/18)%2==1) sideName='C'; | |
1298 | if (sector<36){ | |
1299 | //IROC | |
1300 | sensorName=Form("TPC_GATE_I_%c_POS_VMEAS",sideName); | |
1301 | }else{ | |
1302 | //OROC | |
1303 | sensorName=Form("TPC_GATE_O_%c_POS_VMEAS",sideName); | |
1304 | } | |
1305 | if (timeStamp==-1){ | |
1306 | val=AliTPCcalibDB::GetDCSSensorMeanValue(voltageArray, sensorName.Data(),sigDigits); | |
1307 | } else { | |
1308 | val=AliTPCcalibDB::GetDCSSensorValue(voltageArray, timeStamp, sensorName.Data(),sigDigits); | |
1309 | } | |
1310 | return val; | |
e2914767 | 1311 | } |
bf85fe4d | 1312 | |
da6c0bc9 | 1313 | Float_t AliTPCcalibDB::GetPressure(Int_t timeStamp, Int_t run, Int_t type){ |
bf85fe4d | 1314 | // |
1315 | // GetPressure for given time stamp and runt | |
1316 | // | |
1317 | TTimeStamp stamp(timeStamp); | |
da6c0bc9 | 1318 | AliDCSSensor * sensor = Instance()->GetPressureSensor(run,type); |
bf85fe4d | 1319 | if (!sensor) return 0; |
bf85fe4d | 1320 | return sensor->GetValue(stamp); |
1321 | } | |
1322 | ||
5312f439 | 1323 | Float_t AliTPCcalibDB::GetL3Current(Int_t run, Int_t statType){ |
1324 | // | |
1325 | // return L3 current | |
1326 | // stat type is: AliGRPObject::Stats: kMean = 0, kTruncMean = 1, kMedian = 2, kSDMean = 3, kSDMedian = 4 | |
1327 | // | |
1328 | Float_t current=-1; | |
1329 | AliGRPObject *grp=AliTPCcalibDB::GetGRP(run); | |
1330 | if (grp) current=grp->GetL3Current((AliGRPObject::Stats)statType); | |
1331 | return current; | |
1332 | } | |
1333 | ||
1334 | Float_t AliTPCcalibDB::GetBz(Int_t run){ | |
1335 | // | |
e6970ab5 | 1336 | // calculate BZ in T from L3 current |
5312f439 | 1337 | // |
1338 | Float_t bz=-1; | |
1339 | Float_t current=AliTPCcalibDB::GetL3Current(run); | |
e6970ab5 | 1340 | if (current>-1) bz=5*current/30000.*.1; |
5312f439 | 1341 | return bz; |
1342 | } | |
1343 | ||
1344 | Char_t AliTPCcalibDB::GetL3Polarity(Int_t run) { | |
1345 | // | |
1346 | // get l3 polarity from GRP | |
1347 | // | |
7390f655 | 1348 | Char_t pol=-100; |
1349 | AliGRPObject *grp=AliTPCcalibDB::GetGRP(run); | |
1350 | if (grp) pol=grp->GetL3Polarity(); | |
1351 | return pol; | |
5312f439 | 1352 | } |
1353 | ||
1354 | TString AliTPCcalibDB::GetRunType(Int_t run){ | |
1355 | // | |
1356 | // return run type from grp | |
1357 | // | |
7390f655 | 1358 | |
1359 | // TString type("UNKNOWN"); | |
1360 | AliGRPObject *grp=AliTPCcalibDB::GetGRP(run); | |
1361 | if (grp) return grp->GetRunType(); | |
1362 | return "UNKNOWN"; | |
5312f439 | 1363 | } |
1364 | ||
7f7847fe | 1365 | Float_t AliTPCcalibDB::GetValueGoofie(Int_t timeStamp, Int_t run, Int_t type){ |
1366 | // | |
1367 | // GetPressure for given time stamp and runt | |
1368 | // | |
1369 | TTimeStamp stamp(timeStamp); | |
1370 | AliDCSSensorArray* goofieArray = AliTPCcalibDB::Instance()->GetGoofieSensors(run); | |
1371 | if (!goofieArray) return 0; | |
1372 | AliDCSSensor *sensor = goofieArray->GetSensor(type); | |
1373 | return sensor->GetValue(stamp); | |
1374 | } | |
1375 | ||
1376 | ||
1377 | ||
1378 | ||
1379 | ||
1380 | ||
f0269955 | 1381 | Bool_t AliTPCcalibDB::GetTemperatureFit(Int_t timeStamp, Int_t run, Int_t side,TVectorD& fit){ |
1382 | // | |
1383 | // | |
1384 | // | |
1385 | TTimeStamp tstamp(timeStamp); | |
64b48395 | 1386 | AliTPCSensorTempArray* tempArray = Instance()->GetTemperatureSensor(run); |
f0269955 | 1387 | if (! tempArray) return kFALSE; |
1388 | AliTPCTempMap * tempMap = new AliTPCTempMap(tempArray); | |
1389 | TLinearFitter * fitter = tempMap->GetLinearFitter(3,side,tstamp); | |
1390 | if (fitter){ | |
1391 | fitter->Eval(); | |
1392 | fitter->GetParameters(fit); | |
1393 | } | |
1394 | delete fitter; | |
1395 | delete tempMap; | |
1396 | if (!fitter) return kFALSE; | |
1397 | return kTRUE; | |
1398 | } | |
1399 | ||
64b48395 | 1400 | Float_t AliTPCcalibDB::GetTemperature(Int_t timeStamp, Int_t run, Int_t side){ |
1401 | // | |
1402 | // | |
1403 | // | |
12e42756 | 1404 | TVectorD vec(5); |
64b48395 | 1405 | if (side==0) { |
1406 | GetTemperatureFit(timeStamp,run,0,vec); | |
1407 | return vec[0]; | |
1408 | } | |
1409 | if (side==1){ | |
1410 | GetTemperatureFit(timeStamp,run,0,vec); | |
1411 | return vec[0]; | |
1412 | } | |
57dc06f2 | 1413 | return 0; |
64b48395 | 1414 | } |
bf85fe4d | 1415 | |
1416 | ||
da6c0bc9 | 1417 | Double_t AliTPCcalibDB::GetPTRelative(UInt_t timeSec, Int_t run, Int_t side){ |
1418 | // | |
1419 | // Get relative P/T | |
1420 | // time - absolute time | |
1421 | // run - run number | |
1422 | // side - 0 - A side 1-C side | |
1423 | AliTPCCalibVdrift * vdrift = Instance()->GetVdrift(run); | |
1424 | if (!vdrift) return 0; | |
1425 | return vdrift->GetPTRelative(timeSec,side); | |
1426 | } | |
1427 | ||
e2914767 | 1428 | AliGRPObject * AliTPCcalibDB::MakeGRPObjectFromMap(TMap *map){ |
1429 | // | |
1430 | // Function to covert old GRP run information from TMap to GRPObject | |
1431 | // | |
1432 | // TMap * map = AliTPCcalibDB::GetGRPMap(52406); | |
1433 | if (!map) return 0; | |
1434 | AliDCSSensor * sensor = 0; | |
1435 | TObject *osensor=0; | |
1436 | osensor = ((*map)("fP2Pressure")); | |
1437 | sensor =dynamic_cast<AliDCSSensor *>(osensor); | |
1438 | // | |
1439 | if (!sensor) return 0; | |
1440 | // | |
1441 | AliDCSSensor * sensor2 = new AliDCSSensor(*sensor); | |
1442 | osensor = ((*map)("fCavernPressure")); | |
1443 | TGraph * gr = new TGraph(2); | |
1444 | gr->GetX()[0]= -100000.; | |
1445 | gr->GetX()[1]= 1000000.; | |
1446 | gr->GetY()[0]= atof(osensor->GetName()); | |
1447 | gr->GetY()[1]= atof(osensor->GetName()); | |
1448 | sensor2->SetGraph(gr); | |
1449 | sensor2->SetFit(0); | |
1450 | ||
1451 | ||
1452 | AliGRPObject *grpRun = new AliGRPObject; | |
1453 | grpRun->ReadValuesFromMap(map); | |
1454 | grpRun->SetCavernAtmosPressure(sensor2); | |
1455 | grpRun->SetSurfaceAtmosPressure(sensor); | |
1456 | return grpRun; | |
1457 | } | |
1458 | ||
5312f439 | 1459 | Bool_t AliTPCcalibDB::CreateGUITree(Int_t run, const char* filename) |
1460 | { | |
1461 | // | |
1462 | // Create a gui tree for run number 'run' | |
1463 | // | |
e2914767 | 1464 | |
5312f439 | 1465 | if (!AliCDBManager::Instance()->GetDefaultStorage()){ |
1466 | AliLog::Message(AliLog::kError, "Default Storage not set. Cannot create Calibration Tree!", | |
1467 | MODULENAME(), "AliTPCcalibDB", FUNCTIONNAME(), __FILE__, __LINE__); | |
1468 | return kFALSE; | |
1469 | } | |
1470 | //db instance | |
1471 | AliTPCcalibDB *db=AliTPCcalibDB::Instance(); | |
1472 | // retrieve cal pad objects | |
1473 | db->SetRun(run); | |
1474 | AliTPCPreprocessorOnline prep; | |
1475 | //noise and pedestals | |
1476 | prep.AddComponent(db->GetPedestals()); | |
1477 | prep.AddComponent(db->GetPadNoise()); | |
1478 | //pulser data | |
1479 | prep.AddComponent(db->GetPulserTmean()); | |
1480 | prep.AddComponent(db->GetPulserTrms()); | |
1481 | prep.AddComponent(db->GetPulserQmean()); | |
1482 | //CE data | |
1483 | prep.AddComponent(db->GetCETmean()); | |
1484 | prep.AddComponent(db->GetCETrms()); | |
1485 | prep.AddComponent(db->GetCEQmean()); | |
1486 | //Altro data | |
1487 | prep.AddComponent(db->GetALTROAcqStart() ); | |
1488 | prep.AddComponent(db->GetALTROZsThr() ); | |
1489 | prep.AddComponent(db->GetALTROFPED() ); | |
1490 | prep.AddComponent(db->GetALTROAcqStop() ); | |
1491 | prep.AddComponent(db->GetALTROMasked() ); | |
1492 | // | |
1493 | TString file(filename); | |
1494 | if (file.IsNull()) file=Form("guiTreeRun_%d.root",run); | |
1495 | prep.DumpToFile(file.Data()); | |
1496 | return kTRUE; | |
1497 | } | |
e2914767 | 1498 | |
7390f655 | 1499 | Bool_t AliTPCcalibDB::CreateRefFile(Int_t run, const char* filename) |
1500 | { | |
1501 | // | |
1502 | // Create a gui tree for run number 'run' | |
1503 | // | |
1504 | ||
1505 | if (!AliCDBManager::Instance()->GetDefaultStorage()){ | |
1506 | AliLog::Message(AliLog::kError, "Default Storage not set. Cannot create Calibration Tree!", | |
1507 | MODULENAME(), "AliTPCcalibDB", FUNCTIONNAME(), __FILE__, __LINE__); | |
1508 | return kFALSE; | |
1509 | } | |
1510 | TString file(filename); | |
1511 | if (file.IsNull()) file=Form("RefCalPads_%d.root",run); | |
1512 | TDirectory *currDir=gDirectory; | |
1513 | //db instance | |
1514 | AliTPCcalibDB *db=AliTPCcalibDB::Instance(); | |
1515 | // retrieve cal pad objects | |
1516 | db->SetRun(run); | |
1517 | //open file | |
1518 | TFile f(file.Data(),"recreate"); | |
1519 | //noise and pedestals | |
1520 | db->GetPedestals()->Write("Pedestals"); | |
1521 | db->GetPadNoise()->Write("PadNoise"); | |
1522 | //pulser data | |
1523 | db->GetPulserTmean()->Write("PulserTmean"); | |
1524 | db->GetPulserTrms()->Write("PulserTrms"); | |
1525 | db->GetPulserQmean()->Write("PulserQmean"); | |
1526 | //CE data | |
1527 | db->GetCETmean()->Write("CETmean"); | |
1528 | db->GetCETrms()->Write("CETrms"); | |
1529 | db->GetCEQmean()->Write("CEQmean"); | |
1530 | //Altro data | |
1531 | db->GetALTROAcqStart() ->Write("ALTROAcqStart"); | |
1532 | db->GetALTROZsThr() ->Write("ALTROZsThr"); | |
1533 | db->GetALTROFPED() ->Write("ALTROFPED"); | |
1534 | db->GetALTROAcqStop() ->Write("ALTROAcqStop"); | |
1535 | db->GetALTROMasked() ->Write("ALTROMasked"); | |
1536 | // | |
1537 | f.Close(); | |
1538 | currDir->cd(); | |
1539 | return kTRUE; | |
1540 | } |