AliRoot Core  a565103 (a565103)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliTPCcalibDB.cxx
Go to the documentation of this file.
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 
70 
71 #include <iostream>
72 #include <fstream>
73 
74 
75 #include <AliCDBManager.h>
76 #include <AliCDBEntry.h>
77 #include <AliCDBId.h>
78 #include <AliLog.h>
79 #include <AliMagF.h>
80 #include <AliSplineFit.h>
81 #include <AliCTPTimeParams.h>
82 
83 #include "TGraphErrors.h"
84 #include "AliTPCcalibDB.h"
85 #include "AliTPCdataQA.h"
86 #include "AliTPCcalibDButil.h"
87 #include "AliTPCAltroMapping.h"
88 #include "AliTPCExB.h"
89 
90 #include "AliTPCCalROC.h"
91 #include "AliTPCCalPad.h"
92 #include "AliTPCSensorTempArray.h"
93 #include "AliGRPObject.h"
94 #include "AliTPCTransform.h"
95 #include "AliTPCmapper.h"
96 
97 class AliCDBStorage;
98 class AliTPCCalDet;
99 //
100 //
101 
102 #include "TFile.h"
103 #include "TKey.h"
104 #include "TGraphErrors.h"
105 
106 #include "TObjArray.h"
107 #include "TObjString.h"
108 #include "TString.h"
109 #include "TDirectory.h"
110 #include "TArrayI.h"
111 #include "AliTPCCalPad.h"
112 #include "AliTPCCalibPulser.h"
113 #include "AliTPCCalibPedestal.h"
114 #include "AliTPCCalibCE.h"
115 #include "AliTPCExBFirst.h"
116 #include "AliTPCTempMap.h"
117 #include "AliTPCCalibVdrift.h"
118 #include "AliTPCCalibRaw.h"
119 #include "AliTPCParam.h"
120 #include "AliTPCCorrection.h"
123 #include "AliTimeStamp.h"
124 #include "AliTriggerRunScalers.h"
125 #include "AliTriggerScalers.h"
126 #include "AliTriggerScalersRecord.h"
127 #include "AliDAQ.h"
131 
132 AliTPCcalibDB* AliTPCcalibDB::fgInstance = 0;
133 Bool_t AliTPCcalibDB::fgTerminated = kFALSE;
134 TObjArray AliTPCcalibDB::fgExBArray;
135 
136 
137 //_ singleton implementation __________________________________________________
139 {
142 
143  if (fgTerminated != kFALSE)
144  return 0;
145 
146  if (fgInstance == 0)
147  fgInstance = new AliTPCcalibDB();
148 
149  return fgInstance;
150 }
151 
153 {
157 
158  fgTerminated = kTRUE;
159 
160  if (fgInstance != 0)
161  {
162  delete fgInstance;
163  fgInstance = 0;
164  }
165 }
166 
167 //_____________________________________________________________________________
169  TObject(),
170  fRun(-1),
171  fTransform(0),
172  fExB(0),
173  fPadGainFactor(0),
174  fActiveChannelMap(0),
175  fDedxGainFactor(0),
176  fPadTime0(0),
177  fDistortionMap(0),
178  fComposedCorrection(0),
179  fComposedCorrectionArray(0),
180  fCorrectionMaps(0),
181  fPadNoise(0),
182  fPedestals(0),
183  fCalibRaw(0),
184  fDataQA(0),
185  fALTROConfigData(0),
186  fIonTailArray(0),
187  fPulserData(0),
188  fCEData(0),
189  fMaxTimeBinAllPads(-1),
190  fHVsensors(),
191  fGrRunState(0x0),
192  fTemperature(0),
193  fMapping(0),
194  fParam(0),
195  fClusterParam(0),
196  fRecoParamList(0),
197  fTimeGainSplines(0),
198  fTimeGainSplinesArray(1),
199  fGRPArray(1),
200  fGRPMaps(1),
201  fGoofieArray(1),
202  fVoltageArray(1),
203  fTemperatureArray(1),
204  fVdriftArray(1),
205  fDriftCorrectionArray(1),
206  fRunList(1),
207  fBHasAlignmentOCDB(kFALSE), // Flag - has the alignment on the composed correction ?
208  fDButil(0),
209  fCTPTimeParams(0),
210  fMode(-1)
211 {
213 
214  fgInstance=this;
215  for (Int_t i=0;i<72;++i){
216  fChamberHVStatus[i]=kTRUE;
217  fChamberHVmedian[i]=-1;
220  }
221  Update(); // temporary
222  fTimeGainSplinesArray.SetOwner(); //own the keys
223  fGRPArray.SetOwner(); //own the keys
224  fGRPMaps.SetOwner(); //own the keys
225  fGoofieArray.SetOwner(); //own the keys
226  fVoltageArray.SetOwner(); //own the keys
227  fTemperatureArray.SetOwner(); //own the keys
228  fVdriftArray.SetOwner(); //own the keys
229  fDriftCorrectionArray.SetOwner(); //own the keys
230 }
231 
233  TObject(),
234  fRun(-1),
235  fTransform(0),
236  fExB(0),
237  fPadGainFactor(0),
238  fActiveChannelMap(0),
239  fDedxGainFactor(0),
240  fPadTime0(0),
241  fDistortionMap(0),
242  fComposedCorrection(0),
243  fComposedCorrectionArray(0),
244  fCorrectionMaps(0),
245  fPadNoise(0),
246  fPedestals(0),
247  fCalibRaw(0),
248  fDataQA(0),
249  fALTROConfigData(0),
250  fIonTailArray(0),
251  fPulserData(0),
252  fCEData(0),
253  fMaxTimeBinAllPads(-1),
254  fHVsensors(),
255  fGrRunState(0x0),
256  fTemperature(0),
257  fMapping(0),
258  fParam(0),
259  fClusterParam(0),
260  fRecoParamList(0),
261  fTimeGainSplines(0),
262  fTimeGainSplinesArray(1),
263  fGRPArray(0),
264  fGRPMaps(0),
265  fGoofieArray(0),
266  fVoltageArray(0),
267  fTemperatureArray(0),
268  fVdriftArray(0),
269  fDriftCorrectionArray(0),
270  fRunList(0),
271  fBHasAlignmentOCDB(kFALSE), // Flag - has the alignment on the composed correction ?
272  fDButil(0),
273  fCTPTimeParams(0),
274  fMode(-1)
275 {
277 
278  Error("copy constructor","invalid -- singleton implementation");
279  for (Int_t i=0;i<72;++i){
280  fChamberHVStatus[i]=kTRUE;
281  fChamberHVmedian[i]=-1;
284  }
285  fTimeGainSplinesArray.SetOwner(); //own the keys
286  fGRPArray.SetOwner(); //own the keys
287  fGRPMaps.SetOwner(); //own the keys
288  fGoofieArray.SetOwner(); //own the keys
289  fVoltageArray.SetOwner(); //own the keys
290  fTemperatureArray.SetOwner(); //own the keys
291  fVdriftArray.SetOwner(); //own the keys
292  fDriftCorrectionArray.SetOwner(); //own the keys
293 }
294 
296 {
298 
299  Error("operator =", "assignment operator not implemented");
300  return *this;
301 }
302 
303 
304 
305 //_____________________________________________________________________________
307 {
311 
312  delete fActiveChannelMap;
313  delete fGrRunState;
314  fgInstance = 0;
315 }
316 
319 
320  return (fDistortionMap) ? (AliTPCCalPad*)fDistortionMap->At(i):0;
321 }
322 
324  return (fRecoParamList) ? (AliTPCRecoParam*)fRecoParamList->At(i):0;
325 }
326 
327 //_____________________________________________________________________________
328 AliCDBEntry* AliTPCcalibDB::GetCDBEntry(const char* cdbPath)
329 {
331 
332  char chinfo[1000];
333 
334  AliCDBEntry* entry = AliCDBManager::Instance()->Get(cdbPath, fRun);
335  if (!entry)
336  {
337  snprintf(chinfo,1000,"AliTPCcalibDB: Failed to get entry:\t%s ", cdbPath);
338  AliError(chinfo);
339  return 0;
340  }
341  return entry;
342 }
343 
344 
345 //_____________________________________________________________________________
346 void AliTPCcalibDB::SetRun(Long64_t run)
347 {
349 
350  if (fRun == run)
351  return;
352  fRun = run;
353  Update();
354 }
355 
356 
357 
360 
361 
362  AliCDBEntry * entry=0x0;
363  Bool_t cdbCache = AliCDBManager::Instance()->GetCacheFlag(); // save cache status
364  AliCDBManager::Instance()->SetCacheFlag(kTRUE); // activate CDB cache
366  //
367  fRun = AliCDBManager::Instance()->GetRun();
368 
369  //RS: new TPC correction map (array of AliTPCChebCorr) will be loaded on demand
370  fCorrectionMaps = 0; // assuming that the object is managed by the OCDB
371  //
372 
373  entry = GetCDBEntry("TPC/Calib/Parameters");
374  if (entry){
375  //if (fPadNoise) delete fPadNoise;
376  entry->SetOwner(kTRUE);
377  fParam = (AliTPCParam*)(entry->GetObject());
378  }else{
379  AliFatal("TPC - Missing calibration entry TPC/Calib/Parameters");
380  }
381 
382  //
383  // check the presence of the detectors
384  try {
385  entry = AliCDBManager::Instance()->Get("GRP/GRP/Data");
386  } catch(...) {
387  AliInfo("No GRP entry found");
388  entry = 0x0;
389  }
390  if (entry) {
391  AliGRPObject* grpData = dynamic_cast<AliGRPObject*>(entry->GetObject());
392  if (!grpData) {printf("Failed to get GRP data for run %d\n",fRun); return;}
393  Int_t activeDetectors = grpData->GetDetectorMask();
394  TString detStr = AliDAQ::ListOfTriggeredDetectors(activeDetectors);
395  //printf("Detectors in the data:\n%s\n",detStr.Data());
396  if ( detStr.Contains("TPC")==0){
397  AliInfo("TPC not present in the run");
398  return;
399  }
400  }
401 
402 
403 
404 
405  entry = GetCDBEntry("TPC/Calib/PadGainFactor");
406  if (entry){
407  //if (fPadGainFactor) delete fPadGainFactor;
408  entry->SetOwner(kTRUE);
409  fPadGainFactor = (AliTPCCalPad*)entry->GetObject();
410  }else{
411  AliFatal("TPC - Missing calibration entry TPC/Calib/PadGainFactor");
412  }
413  //
414  entry = GetCDBEntry("TPC/Calib/TimeGain");
415  if (entry){
416  //if (fTimeGainSplines) delete fTimeGainSplines;
417  entry->SetOwner(kTRUE);
418  fTimeGainSplines = (TObjArray*)entry->GetObject();
419  }else{
420  AliFatal("TPC - Missing calibration entry TPC/Calib/Timegain");
421  }
422  //
423  entry = GetCDBEntry("TPC/Calib/GainFactorDedx");
424  if (entry){
425  entry->SetOwner(kTRUE);
426  fDedxGainFactor = (AliTPCCalPad*)entry->GetObject();
427  }else{
428  AliFatal("TPC - Missing calibration entry TPC/Calib/gainFactordEdx");
429  }
430  //
431  entry = GetCDBEntry("TPC/Calib/PadTime0");
432  if (entry){
433  //if (fPadTime0) delete fPadTime0;
434  entry->SetOwner(kTRUE);
435  fPadTime0 = (AliTPCCalPad*)entry->GetObject();
436  }else{
437  AliFatal("TPC - Missing calibration entry");
438  }
439 
440  entry = GetCDBEntry("TPC/Calib/Distortion");
441  if (entry){
442  //if (fPadTime0) delete fPadTime0;
443  entry->SetOwner(kTRUE);
444  fDistortionMap =dynamic_cast<TObjArray*>(entry->GetObject());
445  }else{
446  //AliFatal("TPC - Missing calibration entry")
447  }
448 
449 
450  //
451  //
452  entry = GetCDBEntry("TPC/Calib/PadNoise");
453  if (entry){
454  //if (fPadNoise) delete fPadNoise;
455  entry->SetOwner(kTRUE);
456  fPadNoise = (AliTPCCalPad*)entry->GetObject();
457  }else{
458  AliFatal("TPC - Missing calibration entry");
459  }
460 
461  entry = GetCDBEntry("TPC/Calib/Pedestals");
462  if (entry){
463  //if (fPedestals) delete fPedestals;
464  entry->SetOwner(kTRUE);
465  fPedestals = (AliTPCCalPad*)entry->GetObject();
466  }
467 
468  entry = GetCDBEntry("TPC/Calib/Temperature");
469  if (entry){
470  //if (fTemperature) delete fTemperature;
471  entry->SetOwner(kTRUE);
472  fTemperature = (AliTPCSensorTempArray*)entry->GetObject();
473  }
474 
475 
476  entry = GetCDBEntry("TPC/Calib/ClusterParam");
477  if (entry){
478  entry->SetOwner(kTRUE);
479  fClusterParam = (AliTPCClusterParam*)(entry->GetObject());
480  }else{
481  AliFatal("TPC - Missing calibration entry");
482  }
483 
484  entry = GetCDBEntry("TPC/Calib/RecoParam");
485  if (entry){
486  //PH entry->SetOwner(kTRUE);
487  fRecoParamList = dynamic_cast<TObjArray*>(entry->GetObject());
488 
489  }else{
490  AliFatal("TPC - Missing calibration entry TPC/Calib/RecoParam");
491  }
492 
493 
494  //ALTRO configuration data
495  entry = GetCDBEntry("TPC/Calib/AltroConfig");
496  if (entry){
497  entry->SetOwner(kTRUE);
498  fALTROConfigData=(TObjArray*)(entry->GetObject());
499  }else{
500  AliFatal("TPC - Missing calibration entry");
501  }
502 
503  //Calibration Pulser data
504  entry = GetCDBEntry("TPC/Calib/Pulser");
505  if (entry){
506  entry->SetOwner(kTRUE);
507  fPulserData=(TObjArray*)(entry->GetObject());
508  }
509 
510  //Calibration ION tail data
511  entry = GetCDBEntry("TPC/Calib/IonTail");
512  if (entry){
513  //delete fIonTailArray; fIonTailArray=NULL;
514  entry->SetOwner(kTRUE);
515  fIonTailArray=(TObjArray*)(entry->GetObject());
516  fIonTailArray->SetOwner(); //own the keys
517  }
518 
519  //CE data
520  entry = GetCDBEntry("TPC/Calib/CE");
521  if (entry){
522  entry->SetOwner(kTRUE);
523  fCEData=(TObjArray*)(entry->GetObject());
524  }
525  //RAW calibration data
526  // entry = GetCDBEntry("TPC/Calib/Raw");
527 
528  entry = GetCDBEntry("TPC/Calib/Mapping");
529  if (entry){
530  //if (fPadNoise) delete fPadNoise;
531  entry->SetOwner(kTRUE);
532  TObjArray * array = dynamic_cast<TObjArray*>(entry->GetObject());
533  if (array && array->GetEntriesFast()==6){
534  fMapping = new AliTPCAltroMapping*[6];
535  for (Int_t i=0; i<6; i++){
536  fMapping[i] = dynamic_cast<AliTPCAltroMapping*>(array->At(i));
537  }
538  }
539  }
540 
541  //CTP calibration data
542  entry = GetCDBEntry("GRP/CTP/CTPtiming");
543  if (entry){
544  //entry->SetOwner(kTRUE);
545  fCTPTimeParams=dynamic_cast<AliCTPTimeParams*>(entry->GetObject());
546  }else{
547  AliError("TPC - Missing calibration entry");
548  }
549  //TPC space point correction data
550  entry = GetCDBEntry("TPC/Calib/Correction");
551  if (entry){
552  //entry->SetOwner(kTRUE);
553  fComposedCorrection=dynamic_cast<AliTPCCorrection*>(entry->GetObject());
555  fComposedCorrectionArray=dynamic_cast<TObjArray*>(entry->GetObject());
557  for (Int_t i=0; i<fComposedCorrectionArray->GetEntries(); i++){
558  AliTPCComposedCorrection* composedCorrection= dynamic_cast<AliTPCComposedCorrection*>(fComposedCorrectionArray->At(i));
559  if (composedCorrection) {
560  composedCorrection->Init();
561  if (composedCorrection->GetCorrections()){
562  if (composedCorrection->GetCorrections()->FindObject("FitAlignTPC")){
563  fBHasAlignmentOCDB=kTRUE;
564  }
565  }
566  }
567  }
568  }
569  }else{
570  AliError("TPC - Missing calibration entry- TPC/Calib/Correction");
571  }
572 
573  //RCU trigger config mode
575  //
576  if (!fTransform) {
578  fTransform->SetCurrentRun(AliCDBManager::Instance()->GetRun());
579  }
580 
581  // Chamber HV data
582  // needs to be called before InitDeadMap
584 
585  // Create Dead Channel Map
586  InitDeadMap();
587 
588  // Calculate derived ALTRO information
589  InitAltroData();
590 
591  //
592  AliCDBManager::Instance()->SetCacheFlag(cdbCache); // reset original CDB cache
593 }
594 
595 
597 {
598  // TPC fast Chebyshev correction map, loaded on 1st demand
599  AliCDBEntry* entry = GetCDBEntry("TPC/Calib/CorrectionMaps");
600  if (entry) {
601  fCorrectionMaps = dynamic_cast<TObjArray*>(entry->GetObject());
602  }
603  else{
604  AliError("TPC - Missing calibration entry- TPC/Calib/CorrectionMaps");
605  }
606 }
607 
613 
614  AliCDBEntry * entry=0;
615  entry = GetCDBEntry("TPC/Calib/Raw");
616  if (entry){
617  entry->SetOwner(kTRUE);
618  TObjArray *arr=dynamic_cast<TObjArray*>(entry->GetObject());
619  if (arr) fCalibRaw=(AliTPCCalibRaw*)arr->At(0);
620  else fCalibRaw = (AliTPCCalibRaw*)(entry->GetObject());
621  }
622  //QA calibration data
623  entry = GetCDBEntry("TPC/Calib/QA");
624  if (entry){
625  entry->SetOwner(kTRUE);
626  fDataQA=dynamic_cast<AliTPCdataQA*>(entry->GetObject());
627  }
628  // High voltage
629  if (fRun>=0 && !fVoltageArray.GetValue(Form("%i",fRun))){
630  entry = AliCDBManager::Instance()->Get("TPC/Calib/HighVoltage",fRun);
631  if (entry) {
632  fVoltageArray.Add(new TObjString(Form("%i",fRun)),entry->GetObject());
633  }
634  }
635 
636 }
637 
638 Bool_t AliTPCcalibDB::GetTailcancelationGraphs(Int_t sector, TGraphErrors ** graphRes, Float_t * indexAmpGraphs){
639 
642 
643  //Int_t run = fTransform->GetCurrentRunNumber();
644  //SetRun(run);
645  //Float_t rocVoltage = GetChamberHighVoltage(run,sector, -1); // Get the voltage from OCDB with a getter (old function)
646 // Float_t rocVoltage=GetChamberHighVoltageMedian(sector); // Get the voltage from OCDB, new function from Jens
647 
648  Int_t nominalVoltage = (sector<36) ? 1240 : 1470 ; // nominal voltage of 2012 when the TRF functions were produced
649 
650  Float_t rocVoltage = nominalVoltage;
651 
652  if ( rocVoltage < nominalVoltage/2. || rocVoltage > nominalVoltage*2. )
653  {
654  AliInfo(Form("rocVoltage out of range: roc: %.2f, nominal: %i", rocVoltage, nominalVoltage));
655  return kFALSE;
656  }
657 
658  Int_t tempVoltage = 0;
659  Int_t trackAngle = 4; // (1=first, 2=second, 3=third, 4=first+second, 5=all tracks) note: 3rd is distorted by low freq
660  TString rocType = (sector<36) ? "iroc" : "oroc";
661  const Int_t ngraph=fIonTailArray->GetLast();
662 
663  // create array of voltages in order to select the proper TRF with closest voltage
664  Int_t voltages[ngraph]; // array of voltages
665  for (Int_t i=0; i<ngraph; i++){
666  voltages[i]=0;
667  }
668 
669  // loop over response functions in the TObjarray
670  Int_t nvoltages=0;
671  for (Int_t i=0;i<=ngraph;i++){
672 
673  // read the TRF object name in order to select proper TRF for the given sector
674  TString objname(fIonTailArray->At(i)->GetName());
675  if (!objname.Contains(rocType)) continue;
676 
677  TObjArray *objArr = objname.Tokenize("_");
678 
679  // select the roc type (IROC or OROC) and the trackAngle
680  if ( atoi(static_cast<TObjString*>(objArr->At(3))->GetName())==trackAngle )
681  {
682  // Create the voltage array for proper voltage value selection
683  voltages[nvoltages]=atoi(static_cast<TObjString*>(objArr->At(2))->GetName());
684  nvoltages++;
685  }
686  delete objArr;
687  }
688 
689  // find closest voltage value to ROC voltage (among the TRF' voltage array --> to select proper t.r.f.)
690  Int_t ampIndex = 0;
691  Int_t diffVoltage = TMath::Abs(rocVoltage - voltages[0]);
692  for (Int_t k=0;k<ngraph;k++) {
693  if (diffVoltage >= TMath::Abs(rocVoltage-voltages[k]) && voltages[k]!=0)
694  {
695  diffVoltage = TMath::Abs(rocVoltage-voltages[k]);
696  ampIndex = k;
697  }
698  }
699  tempVoltage = voltages[ampIndex]; // use closest voltage to current voltage
700  //if (run<140000) tempVoltage = nominalVoltage; // for 2010 data
701 
702  // assign TGraphErrors
703  Int_t igraph=0;
704  for (Int_t i=0; i<=ngraph; i++){
705 
706  // read TRFs for TObjArray and select the roc type (IROC or OROC) and the trackAngle
707  TGraphErrors * trfObj = static_cast<TGraphErrors*>(fIonTailArray->At(i));
708  TString objname(trfObj->GetName());
709  if (!objname.Contains(rocType)) continue; //choose ROC type
710 
711  TObjArray *objArr1 = objname.Tokenize("_");
712 
713  // TRF eleminations
714  TObjString* angleString = static_cast<TObjString*>(objArr1->At(3));
715  TObjString* voltageString = static_cast<TObjString*>(objArr1->At(2));
716  //choose angle and voltage
717  if ((atoi(angleString->GetName())==trackAngle) && (atoi(voltageString->GetName())==tempVoltage) )
718  {
719  // Apply Voltage scaling
720  Int_t voltage = atoi(voltageString->GetName());
721  Double_t voltageScaled = 1;
722  if (rocVoltage>0) voltageScaled = Double_t(voltage)/Double_t(rocVoltage); // for jens how it can happen that we have clusters at 0 HV ?
723  const Int_t nScaled = TMath::Nint(voltageScaled*trfObj->GetN())-1;
724  Double_t x;
725  Double_t y;
726 
727  delete graphRes[igraph];
728  graphRes[igraph] = new TGraphErrors(nScaled);
729 
730  for (Int_t j=0; j<nScaled; j++){
731  x = TMath::Nint(j*(voltageScaled));
732  y = (j<trfObj->GetN()) ? (1./voltageScaled)*trfObj->GetY()[j] : 0.;
733  graphRes[igraph]->SetPoint(j,x,y);
734  }
735 
736  // fill arrays for proper position and amplitude selections
737  TObjString* distanceToCenterOfGravity = static_cast<TObjString*>(objArr1->At(4));
738  indexAmpGraphs[igraph] = (distanceToCenterOfGravity->GetString().Atof())/10.;
739  // smooth voltage scaled graph
740  for (Int_t m=1; m<nScaled;m++){
741  if (graphRes[igraph]->GetY()[m]==0) graphRes[igraph]->GetY()[m] = graphRes[igraph]->GetY()[m-1];
742  }
743  igraph++;
744  }
745  delete objArr1;
746  }
747  return kTRUE;
748 }
749 
750 void AliTPCcalibDB::CreateObjectList(const Char_t *filename, TObjArray *calibObjects)
751 {
753 
754  if ( calibObjects == 0x0 ) return;
755  ifstream in;
756  in.open(filename);
757  if ( !in.is_open() ){
758  fprintf(stderr,"Error: cannot open list file '%s'", filename);
759  return;
760  }
761 
762  AliTPCCalPad *calPad=0x0;
763 
764  TString sFile;
765  sFile.ReadFile(in);
766  in.close();
767 
768  TObjArray *arrFileLine = sFile.Tokenize("\n");
769 
770  TIter nextLine(arrFileLine);
771 
772  TObjString *sObjLine=0x0;
773  while ( (sObjLine = (TObjString*)nextLine()) ){
774  TString sLine(sObjLine->GetString());
775 
776  TObjArray *arrNextCol = sLine.Tokenize("\t");
777 
778  TObjString *sObjType = (TObjString*)(arrNextCol->At(0));
779  TObjString *sObjFileName = (TObjString*)(arrNextCol->At(1));
780  delete arrNextCol;
781 
782  if ( !sObjType || ! sObjFileName ) continue;
783  TString sType(sObjType->GetString());
784  TString sFileName(sObjFileName->GetString());
785 // printf("%s\t%s\n",sType.Data(),sFileName.Data());
786 
787  TFile *fIn = TFile::Open(sFileName);
788  if ( !fIn ){
789  fprintf(stderr,"File not found: '%s'", sFileName.Data());
790  continue;
791  }
792 
793  if ( sType == "CE" ){
794  AliTPCCalibCE *ce = (AliTPCCalibCE*)fIn->Get("AliTPCCalibCE");
795 
796  calPad = new AliTPCCalPad((TObjArray*)ce->GetCalPadT0());
797  calPad->SetNameTitle("CETmean","CETmean");
798  calibObjects->Add(calPad);
799 
800  calPad = new AliTPCCalPad((TObjArray*)ce->GetCalPadQ());
801  calPad->SetNameTitle("CEQmean","CEQmean");
802  calibObjects->Add(calPad);
803 
804  calPad = new AliTPCCalPad((TObjArray*)ce->GetCalPadRMS());
805  calPad->SetNameTitle("CETrms","CETrms");
806  calibObjects->Add(calPad);
807 
808  } else if ( sType == "Pulser") {
809  AliTPCCalibPulser *sig = (AliTPCCalibPulser*)fIn->Get("AliTPCCalibPulser");
810 
811  calPad = new AliTPCCalPad((TObjArray*)sig->GetCalPadT0());
812  calPad->SetNameTitle("PulserTmean","PulserTmean");
813  calibObjects->Add(calPad);
814 
815  calPad = new AliTPCCalPad((TObjArray*)sig->GetCalPadQ());
816  calPad->SetNameTitle("PulserQmean","PulserQmean");
817  calibObjects->Add(calPad);
818 
819  calPad = new AliTPCCalPad((TObjArray*)sig->GetCalPadRMS());
820  calPad->SetNameTitle("PulserTrms","PulserTrms");
821  calibObjects->Add(calPad);
822 
823  } else if ( sType == "Pedestals") {
824  AliTPCCalibPedestal *ped = (AliTPCCalibPedestal*)fIn->Get("AliTPCCalibPedestal");
825 
826  calPad = new AliTPCCalPad((TObjArray*)ped->GetCalPadPedestal());
827  calPad->SetNameTitle("Pedestals","Pedestals");
828  calibObjects->Add(calPad);
829 
830  calPad = new AliTPCCalPad((TObjArray*)ped->GetCalPadRMS());
831  calPad->SetNameTitle("Noise","Noise");
832  calibObjects->Add(calPad);
833 
834  } else {
835  fprintf(stderr,"Undefined Type: '%s'",sType.Data());
836 
837  }
838  delete fIn;
839  }
840  delete arrFileLine;
841 }
842 
844 {
854 
855  // check necessary information
856  const Int_t run=GetRun();
857  if (run<0){
858  AliError("run not set in CDB manager. Cannot create active channel map");
859  return 0;
860  }
861  AliDCSSensorArray* voltageArray = GetVoltageSensors(run);
862  AliTPCCalPad* altroMap = GetALTROMasked();
863  TMap* mapddl = GetDDLMap();
864 
865  if (!voltageArray && !altroMap && !mapddl) {
866  AliError("All necessary information to create the activate channel are map missing.");
867  AliError(" -> Check existance of the OCDB entries: 'TPC/Calib/AltroConfig', 'TPC/Calib/HighVoltage'");
868  return 0;
869  }
870 
871  // mapping handler
872  AliTPCmapper map(gSystem->ExpandPathName("$ALICE_ROOT/TPC/mapping/"));
873 
874  //=============================================================
875  // Setup DDL map
876 
877  Bool_t ddlMap[216]={0};
878  for (Int_t iddl=0; iddl<216; ++iddl) ddlMap[iddl]=1;
879  if (mapddl){
880  TObjString *s = (TObjString*)mapddl->GetValue("DDLArray");
881  if (s){
882  for (Int_t iddl=0; iddl<216; ++iddl) {
883  ddlMap[iddl]=TString(s->GetString()(iddl))!="0";
884  if (!ddlMap[iddl]) {
885  Int_t roc = map.GetRocFromEquipmentID(iddl+768);
886  AliWarning(Form("Inactive DDL (#%d, ROC %2d) detected based on the 'DDLArray' in 'TPC/Calib/AltroConfig'. This will deactivate many channels.", iddl, roc));
887  }
888  }
889  }
890  } else {
891  AliError("DDL map missing. ActiveChannelMap can only be created with parts of the information.");
892  AliError(" -> Check existance of 'DDLArray' in the OCDB entry: 'TPC/Calib/AltroConfig'");
893  }
894  // Setup DDL map done
895  // ============================================================
896 
897  //=============================================================
898  // Setup active chnnel map
899  //
900 
901  if (!fActiveChannelMap) fActiveChannelMap=new AliTPCCalPad("ActiveChannelMap","ActiveChannelMap");
902 
903  if (!altroMap) {
904  AliError("ALTRO dead channel map missing. ActiveChannelMap can only be created with parts of the information.");
905  AliError(" -> Check existance of 'Masked' in the OCDB entry: 'TPC/Calib/AltroConfig'");
906  }
907 
908  for (Int_t iROC=0;iROC<AliTPCCalPad::kNsec;++iROC){
910  if (!roc){
911  AliError(Form("No ROC %d in active channel map",iROC));
912  continue;
913  }
914 
915  // check for bad voltage
916  // see UpdateChamberHighVoltageData()
917  if (!fChamberHVStatus[iROC]){
918  roc->Multiply(0.);
919  AliWarning(Form("Turning off all channels of ROC %2d due to a bad HV status", iROC));
920  AliWarning(" -> Check messages in UpdateChamberHighVoltageData()");
921  continue;
922  }
923 
924  AliTPCCalROC *masked=0x0;
925  if (altroMap) masked=altroMap->GetCalROC(iROC);
926 
927  Int_t numberOfDeactivatedChannels=0;
928  for (UInt_t irow=0; irow<roc->GetNrows(); ++irow){
929  for (UInt_t ipad=0; ipad<roc->GetNPads(irow); ++ipad){
930  //per default the channel is on
931  roc->SetValue(irow,ipad,1);
932  // apply altro dead channel mask (inverse logik, it is not active, but inactive channles)
933  if (masked && masked->GetValue(irow, ipad)) roc->SetValue(irow, ipad ,0);
934  // mask channels if a DDL is inactive
935  Int_t ddlId=map.GetEquipmentID(iROC, irow, ipad)-768;
936  if (ddlId>=0 && !ddlMap[ddlId]) roc->SetValue(irow, ipad ,0);
937 
938  if (roc->GetValue(irow, ipad)<0.0001) {
939  ++numberOfDeactivatedChannels;
940  }
941  }
942  }
943 
944  if (numberOfDeactivatedChannels>0) {
945  AliInfo(Form("Deactivated %4d channels in ROC %2d due to altro and DDL map states",
946  numberOfDeactivatedChannels, iROC));
947  }
948  }
949 
950  return 1;
951 }
952 
954 {
960 
961  // ===| Maximum time bin |====================================================
962  //
963  // Calculate the maximum time using the 'AcqStart' cal pad object from
964  // TPC/Calib/AltroConfig
965  // if this object is not available, the value will return the max time bin
966  // stored in the AliTPCParam object from TPC/Calib/Parameters
967 
969 
970  const AliTPCCalPad *calPadAcqStop = GetALTROAcqStop();
971 
972  if (calPadAcqStop) {
973  //find max elememt
974  // TODO: change this once the GetMaxElement function is implemented in AliTPCCalPad
975  Float_t maxBin=-1;
976  for (Int_t iroc=0; iroc<AliTPCCalPad::kNsec; ++iroc) {
977  const AliTPCCalROC *roc = calPadAcqStop->GetCalROC(iroc);
978  if (!roc) continue;
979  for (Int_t ichannel=0; ichannel<roc->GetNchannels(); ++ichannel) {
980  const Float_t val=roc->GetValue(ichannel);
981  if (val>maxBin) maxBin=val;
982  }
983  }
984  fMaxTimeBinAllPads = TMath::Nint(maxBin);
985  }
986 
987  if (fMaxTimeBinAllPads<0) {
988  if (fParam) {
989  AliWarning("Could not access 'AcqStop' map from AltroConfig or invalid max time bine. fMaxTimeBinAllPads will be set from AliTPCParam.");
991  } else {
992  // last fallback
993  AliWarning("Could neither access 'Parameters' nor 'AcqStop' map from AltroConfig. fMaxTimeBinAllPads will be set to 1000.");
994  fMaxTimeBinAllPads=1000;
995  }
996  }
997 
998  AliInfo(TString::Format("fMaxTimeBinAllPads set to %d", fMaxTimeBinAllPads).Data());
999 }
1000 
1001 void AliTPCcalibDB::MakeTree(const char * fileName, TObjArray * array, const char * mapFileName, AliTPCCalPad* outlierPad, Float_t ltmFraction) {
1006 
1007  AliTPCROC* tpcROCinstance = AliTPCROC::Instance();
1008 
1009  TObjArray* mapIROCs = 0;
1010  TObjArray* mapOROCs = 0;
1011  TVectorF *mapIROCArray = 0;
1012  TVectorF *mapOROCArray = 0;
1013  Int_t mapEntries = 0;
1014  TString* mapNames = 0;
1015 
1016  if (mapFileName) {
1017  TFile mapFile(mapFileName, "read");
1018 
1019  TList* listOfROCs = mapFile.GetListOfKeys();
1020  mapEntries = listOfROCs->GetEntries()/2;
1021  mapIROCs = new TObjArray(mapEntries*2);
1022  mapOROCs = new TObjArray(mapEntries*2);
1023  mapIROCArray = new TVectorF[mapEntries];
1024  mapOROCArray = new TVectorF[mapEntries];
1025 
1026  mapNames = new TString[mapEntries];
1027  for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) {
1028  TString nameROC(((TKey*)(listOfROCs->At(ivalue*2)))->GetName());
1029  nameROC.Remove(nameROC.Length()-4, 4);
1030  mapIROCs->AddAt((AliTPCCalROC*)mapFile.Get((nameROC + "IROC").Data()), ivalue);
1031  mapOROCs->AddAt((AliTPCCalROC*)mapFile.Get((nameROC + "OROC").Data()), ivalue);
1032  mapNames[ivalue].Append(nameROC);
1033  }
1034 
1035  for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) {
1036  mapIROCArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(0));
1037  mapOROCArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(36));
1038 
1039  for (UInt_t ichannel = 0; ichannel < tpcROCinstance->GetNChannels(0); ichannel++)
1040  (mapIROCArray[ivalue])[ichannel] = ((AliTPCCalROC*)(mapIROCs->At(ivalue)))->GetValue(ichannel);
1041  for (UInt_t ichannel = 0; ichannel < tpcROCinstance->GetNChannels(36); ichannel++)
1042  (mapOROCArray[ivalue])[ichannel] = ((AliTPCCalROC*)(mapOROCs->At(ivalue)))->GetValue(ichannel);
1043  }
1044 
1045  } // if (mapFileName)
1046 
1047  TTreeSRedirector cstream(fileName);
1048  Int_t arrayEntries = array->GetEntries();
1049 
1050  TString* names = new TString[arrayEntries];
1051  for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++)
1052  names[ivalue].Append(((AliTPCCalPad*)array->At(ivalue))->GetName());
1053 
1054  for (UInt_t isector = 0; isector < tpcROCinstance->GetNSectors(); isector++) {
1055  //
1056  // get statistic for given sector
1057  //
1058  TVectorF median(arrayEntries);
1059  TVectorF mean(arrayEntries);
1060  TVectorF rms(arrayEntries);
1061  TVectorF ltm(arrayEntries);
1062  TVectorF ltmrms(arrayEntries);
1063  TVectorF medianWithOut(arrayEntries);
1064  TVectorF meanWithOut(arrayEntries);
1065  TVectorF rmsWithOut(arrayEntries);
1066  TVectorF ltmWithOut(arrayEntries);
1067  TVectorF ltmrmsWithOut(arrayEntries);
1068 
1069  TVectorF *vectorArray = new TVectorF[arrayEntries];
1070  for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++)
1071  vectorArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(isector));
1072 
1073  for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) {
1074  AliTPCCalPad* calPad = (AliTPCCalPad*) array->At(ivalue);
1075  AliTPCCalROC* calROC = calPad->GetCalROC(isector);
1076  AliTPCCalROC* outlierROC = 0;
1077  if (outlierPad) outlierROC = outlierPad->GetCalROC(isector);
1078  if (calROC) {
1079  median[ivalue] = calROC->GetMedian();
1080  mean[ivalue] = calROC->GetMean();
1081  rms[ivalue] = calROC->GetRMS();
1082  Double_t ltmrmsValue = 0;
1083  ltm[ivalue] = calROC->GetLTM(&ltmrmsValue, ltmFraction);
1084  ltmrms[ivalue] = ltmrmsValue;
1085  if (outlierROC) {
1086  medianWithOut[ivalue] = calROC->GetMedian(outlierROC);
1087  meanWithOut[ivalue] = calROC->GetMean(outlierROC);
1088  rmsWithOut[ivalue] = calROC->GetRMS(outlierROC);
1089  ltmrmsValue = 0;
1090  ltmWithOut[ivalue] = calROC->GetLTM(&ltmrmsValue, ltmFraction, outlierROC);
1091  ltmrmsWithOut[ivalue] = ltmrmsValue;
1092  }
1093  }
1094  else {
1095  median[ivalue] = 0.;
1096  mean[ivalue] = 0.;
1097  rms[ivalue] = 0.;
1098  ltm[ivalue] = 0.;
1099  ltmrms[ivalue] = 0.;
1100  medianWithOut[ivalue] = 0.;
1101  meanWithOut[ivalue] = 0.;
1102  rmsWithOut[ivalue] = 0.;
1103  ltmWithOut[ivalue] = 0.;
1104  ltmrmsWithOut[ivalue] = 0.;
1105  }
1106  }
1107 
1108  //
1109  // fill vectors of variable per pad
1110  //
1111  TVectorF *posArray = new TVectorF[8];
1112  for (Int_t ivalue = 0; ivalue < 8; ivalue++)
1113  posArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(isector));
1114 
1115  Float_t posG[3] = {0};
1116  Float_t posL[3] = {0};
1117  Int_t ichannel = 0;
1118  for (UInt_t irow = 0; irow < tpcROCinstance->GetNRows(isector); irow++) {
1119  for (UInt_t ipad = 0; ipad < tpcROCinstance->GetNPads(isector, irow); ipad++) {
1120  tpcROCinstance->GetPositionLocal(isector, irow, ipad, posL);
1121  tpcROCinstance->GetPositionGlobal(isector, irow, ipad, posG);
1122  posArray[0][ichannel] = irow;
1123  posArray[1][ichannel] = ipad;
1124  posArray[2][ichannel] = posL[0];
1125  posArray[3][ichannel] = posL[1];
1126  posArray[4][ichannel] = posG[0];
1127  posArray[5][ichannel] = posG[1];
1128  posArray[6][ichannel] = (Int_t)(ipad - (Double_t)(tpcROCinstance->GetNPads(isector, irow))/2);
1129  posArray[7][ichannel] = ichannel;
1130 
1131  // loop over array containing AliTPCCalPads
1132  for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) {
1133  AliTPCCalPad* calPad = (AliTPCCalPad*) array->At(ivalue);
1134  AliTPCCalROC* calROC = calPad->GetCalROC(isector);
1135  if (calROC)
1136  (vectorArray[ivalue])[ichannel] = calROC->GetValue(irow, ipad);
1137  else
1138  (vectorArray[ivalue])[ichannel] = 0;
1139  }
1140  ichannel++;
1141  }
1142  }
1143 
1144  cstream << "calPads" <<
1145  "sector=" << isector;
1146 
1147  for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) {
1148  cstream << "calPads" <<
1149  (Char_t*)((names[ivalue] + "_Median=").Data()) << median[ivalue] <<
1150  (Char_t*)((names[ivalue] + "_Mean=").Data()) << mean[ivalue] <<
1151  (Char_t*)((names[ivalue] + "_RMS=").Data()) << rms[ivalue] <<
1152  (Char_t*)((names[ivalue] + "_LTM=").Data()) << ltm[ivalue] <<
1153  (Char_t*)((names[ivalue] + "_RMS_LTM=").Data()) << ltmrms[ivalue];
1154  if (outlierPad) {
1155  cstream << "calPads" <<
1156  (Char_t*)((names[ivalue] + "_Median_OutlierCutted=").Data()) << medianWithOut[ivalue] <<
1157  (Char_t*)((names[ivalue] + "_Mean_OutlierCutted=").Data()) << meanWithOut[ivalue] <<
1158  (Char_t*)((names[ivalue] + "_RMS_OutlierCutted=").Data()) << rmsWithOut[ivalue] <<
1159  (Char_t*)((names[ivalue] + "_LTM_OutlierCutted=").Data()) << ltmWithOut[ivalue] <<
1160  (Char_t*)((names[ivalue] + "_RMS_LTM_OutlierCutted=").Data()) << ltmrmsWithOut[ivalue];
1161  }
1162  }
1163 
1164  for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) {
1165  cstream << "calPads" <<
1166  (Char_t*)((names[ivalue] + ".=").Data()) << &vectorArray[ivalue];
1167  }
1168 
1169  if (mapFileName) {
1170  for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) {
1171  if (isector < 36)
1172  cstream << "calPads" <<
1173  (Char_t*)((mapNames[ivalue] + ".=").Data()) << &mapIROCArray[ivalue];
1174  else
1175  cstream << "calPads" <<
1176  (Char_t*)((mapNames[ivalue] + ".=").Data()) << &mapOROCArray[ivalue];
1177  }
1178  }
1179 
1180  cstream << "calPads" <<
1181  "row.=" << &posArray[0] <<
1182  "pad.=" << &posArray[1] <<
1183  "lx.=" << &posArray[2] <<
1184  "ly.=" << &posArray[3] <<
1185  "gx.=" << &posArray[4] <<
1186  "gy.=" << &posArray[5] <<
1187  "rpad.=" << &posArray[6] <<
1188  "channel.=" << &posArray[7];
1189 
1190  cstream << "calPads" <<
1191  "\n";
1192 
1193  delete[] posArray;
1194  delete[] vectorArray;
1195  }
1196 
1197 
1198  delete[] names;
1199  if (mapFileName) {
1200  delete mapIROCs;
1201  delete mapOROCs;
1202  delete[] mapIROCArray;
1203  delete[] mapOROCArray;
1204  delete[] mapNames;
1205  }
1206 }
1207 
1209 {
1211 
1212  TMap *map=GetRCUconfig();
1213  if (!map) return -1;
1214  TVectorF *v=(TVectorF*)map->GetValue("TRGCONF_TRG_MODE");
1215  Float_t mode=-1;
1216  for (Int_t i=0; i<v->GetNrows(); ++i){
1217  Float_t newmode=v->GetMatrixArray()[i];
1218  if (newmode>-1){
1219  if (mode>-1&&newmode!=mode) AliWarning("Found different RCU trigger configurations!!!");
1220  mode=newmode;
1221  }
1222  }
1223  return (Int_t)mode;
1224 }
1225 
1227 {
1229 
1230  if (fMode<0) return kFALSE;
1231  return (fMode==1);
1232 }
1233 
1235 {
1237 
1238  if (fMode<0) return kFALSE;
1239  return (fMode==0);
1240 }
1241 
1242 void AliTPCcalibDB::RegisterExB(Int_t index, Float_t bz, Bool_t bdelete){
1246 
1247  // Float_t factor = bz/(-5.); // default b filed in Cheb with minus sign
1248  Float_t factor = bz/(5.); // default b filed in Cheb with minus sign
1249  // was chenged in the Revision ???? (Ruben can you add here number)
1250 
1251  AliMagF* bmap = new AliMagF("MapsExB","MapsExB", factor,TMath::Sign(1.f,factor),AliMagF::k5kG);
1252 
1253  AliTPCExBFirst *exb = new AliTPCExBFirst(bmap,0.88*2.6400e+04,50,50,50);
1255 
1256  if (bdelete){
1257  delete bmap;
1258  }else{
1259  AliTPCExB::RegisterField(index,bmap);
1260  }
1261  if (index>=fgExBArray.GetEntries()) fgExBArray.Expand((index+1)*2+11);
1262  fgExBArray.AddAt(exb,index);
1263 }
1264 
1265 
1266 AliTPCExB* AliTPCcalibDB::GetExB(Float_t bz, Bool_t deleteB) {
1270 
1271  Int_t index = TMath::Nint(5+bz);
1272  if (index>fgExBArray.GetEntries()) fgExBArray.Expand((index+1)*2+11);
1273  if (!fgExBArray.At(index)) AliTPCcalibDB::RegisterExB(index,bz,deleteB);
1274  return (AliTPCExB*)fgExBArray.At(index);
1275 }
1276 
1277 
1280 
1281  fExB = GetExB(bz,kFALSE);
1282 }
1283 
1284 void AliTPCcalibDB::SetExBField(const AliMagF* bmap){
1286 
1287  AliTPCExBFirst *exb = new AliTPCExBFirst(bmap,0.88*2.6400e+04,50,50,50);
1289  fExB=exb;
1290 }
1291 
1292 
1293 
1294 void AliTPCcalibDB::UpdateRunInformations( Int_t run, Bool_t force){
1296 
1297  if (run<=0) return;
1298  TObjString runstr(Form("%i",run));
1299  fRun=run;
1300  AliCDBEntry * entry = 0;
1301  if (run>= fRunList.fN){
1302  fRunList.Set(run*2+1);
1303  //
1304  //
1305  fALTROConfigData->Expand(run*2+1); // ALTRO configuration data
1306  fPulserData->Expand(run*2+1); // Calibration Pulser data
1307  fCEData->Expand(run*2+1); // CE data
1308  if (!fTimeGainSplines) fTimeGainSplines = new TObjArray(run*2+1);
1309  fTimeGainSplines->Expand(run*2+1); // Array of AliSplineFits: at 0 MIP position in
1310  }
1311  if (fRunList[run]>0 &&force==kFALSE) return;
1312 
1313  fRunList[run]=1; // sign as used
1314 
1315  //
1316  entry = AliCDBManager::Instance()->Get("GRP/GRP/Data",run);
1317  if (entry) {
1318  AliGRPObject * grpRun = dynamic_cast<AliGRPObject*>(entry->GetObject());
1319  if (!grpRun){
1320  TMap* map = dynamic_cast<TMap*>(entry->GetObject());
1321  if (map){
1322  //grpRun = new AliGRPObject;
1323  //grpRun->ReadValuesFromMap(map);
1324  grpRun = MakeGRPObjectFromMap(map);
1325 
1326  fGRPMaps.Add(new TObjString(runstr),map);
1327  }
1328  }
1329  fGRPArray.Add(new TObjString(runstr),(AliGRPObject*)grpRun->Clone());
1330  }
1331  entry = AliCDBManager::Instance()->Get("TPC/Calib/Goofie",run);
1332  if (entry){
1333  fGoofieArray.Add(new TObjString(runstr),entry->GetObject());
1334  }
1335  //
1336 
1337  //
1338  entry = AliCDBManager::Instance()->Get("TPC/Calib/TimeGain",run);
1339  if (entry) {
1340  fTimeGainSplinesArray.Add(new TObjString(runstr),entry->GetObject());
1341  }else{
1342  AliFatal("TPC - Missing calibration entry TimeGain");
1343  }
1344  //
1345  entry = AliCDBManager::Instance()->Get("TPC/Calib/TimeDrift",run);
1346  if (entry) {
1347  TObjArray * timeArray = (TObjArray*)entry->GetObject();
1348  fDriftCorrectionArray.Add(new TObjString(runstr),entry->GetObject());
1349  AliTPCCorrection * correctionTime = (AliTPCCorrection *)timeArray->FindObject("FitCorrectionTime");
1350  if (correctionTime && fComposedCorrectionArray){
1351  correctionTime->Init();
1352  if (fComposedCorrectionArray->GetEntriesFast()<4) fComposedCorrectionArray->Expand(40);
1353  fComposedCorrectionArray->AddAt(correctionTime,4); //add time dependent correction to the list of available corrections
1354  }
1355  }else{
1356  AliFatal("TPC - Missing calibration entry TimeDrift");
1357  }
1358  //
1359  entry = AliCDBManager::Instance()->Get("TPC/Calib/Temperature",run);
1360  if (entry) {
1361  fTemperatureArray.Add(new TObjString(runstr),entry->GetObject());
1362  }
1363 
1364  // High voltage
1365  entry = AliCDBManager::Instance()->Get("TPC/Calib/HighVoltage",run);
1366  if (!fVoltageArray.GetValue(runstr.GetName()) && entry) {
1367  fVoltageArray.Add(new TObjString(runstr),entry->GetObject());
1368  }
1369 
1370  //apply fDButil filters
1371 
1374 
1375  AliDCSSensor * press = GetPressureSensor(run,0);
1377  Bool_t accept=kTRUE;
1378  if (temp) {
1379  accept = fDButil->FilterTemperature(temp)>0.1;
1380  }
1381  if (press) {
1382  const Double_t kMinP=900.;
1383  const Double_t kMaxP=1050.;
1384  const Double_t kMaxdP=10.;
1385  const Double_t kSigmaCut=4.;
1386  fDButil->FilterSensor(press,kMinP,kMaxP,kMaxdP,kSigmaCut);
1387  if (press->GetFit()==0) accept=kFALSE;
1388  }
1389 
1390  if (press && temp &&accept){
1391  AliTPCCalibVdrift * vdrift = new AliTPCCalibVdrift(temp, press,0);
1392  fVdriftArray.Add(new TObjString(runstr),vdrift);
1393  }
1394 
1395  fDButil->FilterCE(120., 3., 4.,0);
1396  fDButil->FilterTracks(run, 10.,0);
1397 
1398 }
1399 
1400 
1401 Float_t AliTPCcalibDB::GetGain(Int_t sector, Int_t row, Int_t pad){
1403 
1404  AliTPCCalPad *calPad = Instance()->fDedxGainFactor;;
1405  if (!calPad) return 0;
1406  return calPad->GetCalROC(sector)->GetValue(row,pad);
1407 }
1408 
1409 AliSplineFit* AliTPCcalibDB::GetVdriftSplineFit(const char* name, Int_t run){
1411 
1413  if (!arr) return 0;
1414  return dynamic_cast<AliSplineFit*>(arr->FindObject(name));
1415 }
1416 
1417 AliSplineFit* AliTPCcalibDB::CreateVdriftSplineFit(const char* graphName, Int_t run){
1419 
1421  if (!arr) return 0;
1422  TGraph *graph=dynamic_cast<TGraph*>(arr->FindObject(graphName));
1423  if (!graph) return 0;
1424  AliSplineFit *fit = new AliSplineFit();
1425  fit->SetGraph(graph);
1426  fit->SetMinPoints(graph->GetN()+1);
1427  fit->InitKnots(graph,2,0,0.001);
1428  fit->SplineFit(0);
1429  return fit;
1430 }
1431 
1432 AliGRPObject *AliTPCcalibDB::GetGRP(Int_t run){
1434 
1435  AliGRPObject * grpRun = dynamic_cast<AliGRPObject *>((Instance()->fGRPArray).GetValue(Form("%i",run)));
1436  if (!grpRun) {
1438  grpRun = dynamic_cast<AliGRPObject *>(Instance()->fGRPArray.GetValue(Form("%i",run)));
1439  if (!grpRun) return 0;
1440  }
1441  return grpRun;
1442 }
1443 
1444 TMap * AliTPCcalibDB::GetGRPMap(Int_t run){
1446 
1447  TMap * grpRun = dynamic_cast<TMap *>((Instance()->fGRPMaps).GetValue(Form("%i",run)));
1448  if (!grpRun) {
1450  grpRun = dynamic_cast<TMap *>(Instance()->fGRPMaps.GetValue(Form("%i",run)));
1451  if (!grpRun) return 0;
1452  }
1453  return grpRun;
1454 }
1455 
1456 
1457 AliDCSSensor * AliTPCcalibDB::GetPressureSensor(Int_t run, Int_t type){
1463 
1464 
1465  TMap *map = GetGRPMap(run);
1466  if (map){
1467  AliDCSSensor * sensor = 0;
1468  TObject *osensor=0;
1469  if (type==0) osensor = ((*map)("fCavernPressure"));
1470  if (type==1) osensor = ((*map)("fP2Pressure"));
1471  sensor =dynamic_cast<AliDCSSensor *>(osensor);
1472  if (sensor) return sensor;
1473  }
1474  //
1475  // If not map try to get it from the GRPObject
1476  //
1477  AliGRPObject * grpRun = dynamic_cast<AliGRPObject *>(fGRPArray.GetValue(Form("%i",run)));
1478  if (!grpRun) {
1479  UpdateRunInformations(run);
1480  grpRun = dynamic_cast<AliGRPObject *>(fGRPArray.GetValue(Form("%i",run)));
1481  if (!grpRun) return 0;
1482  }
1483  AliDCSSensor * sensor = grpRun->GetCavernAtmosPressure();
1484  if (type==1) sensor = grpRun->GetSurfaceAtmosPressure();
1485  return sensor;
1486 }
1487 
1490 
1491  AliTPCSensorTempArray * tempArray = (AliTPCSensorTempArray *)fTemperatureArray.GetValue(Form("%i",run));
1492  if (!tempArray) {
1493  UpdateRunInformations(run);
1494  tempArray = (AliTPCSensorTempArray *)fTemperatureArray.GetValue(Form("%i",run));
1495  }
1496  return tempArray;
1497 }
1498 
1499 
1502 
1503  TObjArray * gainSplines = (TObjArray *)fTimeGainSplinesArray.GetValue(Form("%i",run));
1504  if (!gainSplines) {
1505  UpdateRunInformations(run);
1506  gainSplines = (TObjArray *)fTimeGainSplinesArray.GetValue(Form("%i",run));
1507  }
1508  return gainSplines;
1509 }
1510 
1513 
1514  TObjArray * driftSplines = (TObjArray *)fDriftCorrectionArray.GetValue(Form("%i",run));
1515  if (!driftSplines) {
1516  UpdateRunInformations(run);
1517  driftSplines = (TObjArray *)fDriftCorrectionArray.GetValue(Form("%i",run));
1518  }
1519  return driftSplines;
1520 }
1521 
1522 AliDCSSensorArray * AliTPCcalibDB::GetVoltageSensors(Int_t run){
1524 
1525  AliDCSSensorArray * voltageArray = (AliDCSSensorArray *)fVoltageArray.GetValue(Form("%i",run));
1526  if (!voltageArray) {
1527  UpdateRunInformations(run);
1528  voltageArray = (AliDCSSensorArray *)fVoltageArray.GetValue(Form("%i",run));
1529  }
1530  return voltageArray;
1531 }
1532 
1533 AliDCSSensorArray * AliTPCcalibDB::GetGoofieSensors(Int_t run){
1535 
1536  AliDCSSensorArray * goofieArray = (AliDCSSensorArray *)fGoofieArray.GetValue(Form("%i",run));
1537  if (!goofieArray) {
1538  UpdateRunInformations(run);
1539  goofieArray = (AliDCSSensorArray *)fGoofieArray.GetValue(Form("%i",run));
1540  }
1541  return goofieArray;
1542 }
1543 
1544 
1545 
1548 
1549  AliTPCCalibVdrift * vdrift = (AliTPCCalibVdrift*)fVdriftArray.GetValue(Form("%i",run));
1550  if (!vdrift) {
1551  UpdateRunInformations(run);
1552  vdrift= (AliTPCCalibVdrift*)fVdriftArray.GetValue(Form("%i",run));
1553  }
1554  return vdrift;
1555 }
1556 
1557 Float_t AliTPCcalibDB::GetCEdriftTime(Int_t run, Int_t sector, Double_t timeStamp, Int_t *entries)
1558 {
1563 
1565  TGraph *gr=AliTPCcalibDB::Instance()->GetCErocTgraph(sector);
1566  if (!gr||sector<0||sector>73) {
1567  if (entries) *entries=0;
1568  return 0.;
1569  }
1570  Float_t val=0.;
1571  if (timeStamp==-1.){
1572  val=gr->GetMean(2);
1573  }else{
1574  for (Int_t ipoint=0;ipoint<gr->GetN();++ipoint){
1575  Double_t x,y;
1576  gr->GetPoint(ipoint,x,y);
1577  if (x<timeStamp) continue;
1578  val=y;
1579  break;
1580  }
1581  }
1582  return val;
1583 }
1584 
1585 Float_t AliTPCcalibDB::GetCEchargeTime(Int_t run, Int_t sector, Double_t timeStamp, Int_t *entries)
1586 {
1589 
1591  TGraph *gr=AliTPCcalibDB::Instance()->GetCErocQgraph(sector);
1592  if (!gr||sector<0||sector>71) {
1593  if (entries) *entries=0;
1594  return 0.;
1595  }
1596  Float_t val=0.;
1597  if (timeStamp==-1.){
1598  val=gr->GetMean(2);
1599  }else{
1600  for (Int_t ipoint=0;ipoint<gr->GetN();++ipoint){
1601  Double_t x,y;
1602  gr->GetPoint(ipoint,x,y);
1603  if (x<timeStamp) continue;
1604  val=y;
1605  break;
1606  }
1607  }
1608  return val;
1609 }
1610 
1611 Float_t AliTPCcalibDB::GetDCSSensorValue(AliDCSSensorArray *arr, Int_t timeStamp, const char * sensorName, Int_t sigDigits)
1612 {
1614 
1615  Float_t val=0;
1616  const TString sensorNameString(sensorName);
1617  AliDCSSensor *sensor = arr->GetSensor(sensorNameString);
1618  if (!sensor) return val;
1619  //use the dcs graph if possible
1620  TGraph *gr=sensor->GetGraph();
1621  if (gr){
1622  for (Int_t ipoint=0;ipoint<gr->GetN();++ipoint){
1623  Double_t x,y;
1624  gr->GetPoint(ipoint,x,y);
1625  Int_t time=TMath::Nint(sensor->GetStartTime()+x*3600); //time in graph is hours
1626  if (time<timeStamp) continue;
1627  val=y;
1628  break;
1629  }
1630  //if val is still 0, test if if the requested time if within 5min of the first/last
1631  //data point. If this is the case return the firs/last entry
1632  //the timestamps might not be syncronised for all calibration types, sometimes a 'pre'
1633  //and 'pos' period is requested. Especially to the HV this is not the case!
1634  //first point
1635  if (val==0 ){
1636  Double_t x,y;
1637  gr->GetPoint(0,x,y);
1638  const Int_t time=TMath::Nint(sensor->GetStartTime()+x*3600); //time in graph is hours
1639  const Int_t dtime=time-timeStamp;
1640  if ( (dtime>0) && (dtime<5*60) ) val=y;
1641  }
1642  //last point
1643  if (val==0 ){
1644  Double_t x,y;
1645  gr->GetPoint(gr->GetN()-1,x,y);
1646  const Int_t time=TMath::Nint(sensor->GetStartTime()+x*3600); //time in graph is hours
1647  const Int_t dtime=timeStamp-time;
1648  if ( (dtime>0) && (dtime<5*60) ) val=y;
1649  }
1650  } else {
1651  val=sensor->GetValue(timeStamp);
1652  }
1653  if (sigDigits>=0){
1654  val=(Float_t)TMath::Floor(val * TMath::Power(10., sigDigits) + .5) / TMath::Power(10., sigDigits);
1655  }
1656  return val;
1657 }
1658 
1659 Float_t AliTPCcalibDB::GetDCSSensorMeanValue(AliDCSSensorArray *arr, const char * sensorName, Int_t sigDigits)
1660 {
1662 
1663  Float_t val=0;
1664  const TString sensorNameString(sensorName);
1665  AliDCSSensor *sensor = arr->GetSensor(sensorNameString);
1666  if (!sensor) return val;
1667 
1668  //use dcs graph if it exists
1669  TGraph *gr=sensor->GetGraph();
1670  if (gr){
1671  val=gr->GetMean(2);
1672  } else {
1673  //if we don't have the dcs graph, try to get some meaningful information
1674  if (!sensor->GetFit()) return val;
1675  Int_t nKnots=sensor->GetFit()->GetKnots();
1676  Double_t tMid=(sensor->GetEndTime()-sensor->GetStartTime())/2.;
1677  for (Int_t iKnot=0;iKnot<nKnots;++iKnot){
1678  if (sensor->GetFit()->GetX()[iKnot]>tMid/3600.) break;
1679  val=(Float_t)sensor->GetFit()->GetY0()[iKnot];
1680  }
1681  }
1682  if (sigDigits>=0){
1683  // val/=10;
1684  val=(Float_t)TMath::Floor(val * TMath::Power(10., sigDigits) + .5) / TMath::Power(10., sigDigits);
1685  // val*=10;
1686  }
1687  return val;
1688 }
1689 
1690 Bool_t AliTPCcalibDB::IsDataTakingActive(time_t timeStamp)
1691 {
1692  //
1693  // Check if the data taking is active.
1694  // This information ist based on the trigger scalers and calculated in UpdateChamberHighVoltageData() below.
1695  // in case there is no GRP object or no trigger scalers fGrRunState should be a NULL pointer
1696  // if this is the case we assume by default that the data taking is active
1697  // NOTE: The logik changed. Before v5-06-03-79-gc804e5a we assumed by default the data taking is inactive
1698  //
1699  if (!fGrRunState) return kTRUE;
1700  Double_t time=Double_t(timeStamp);
1701  Int_t currentPoint=0;
1702  Bool_t currentVal=fGrRunState->GetY()[currentPoint]>0.5;
1703  Bool_t retVal=currentVal;
1704  Double_t currentTime=fGrRunState->GetX()[currentPoint];
1705 
1706  while (time>currentTime){
1707  retVal=currentVal;
1708  if (currentPoint==fGrRunState->GetN()) break;
1709  currentVal=fGrRunState->GetY()[currentPoint]>0.5;
1710  currentTime=fGrRunState->GetX()[currentPoint];
1711  ++currentPoint;
1712  }
1713 
1714  return retVal;
1715 }
1716 
1718 {
1730 
1731  // reset active run state graph
1732  delete fGrRunState;
1733  fGrRunState=0x0;
1734 
1735  // start and end time of the run
1736  const Int_t run=GetRun();
1737  if (run<0) return;
1738 
1739  // if no valid run information - return
1740  AliGRPObject* grp = GetGRP(run);
1741  if (!grp) return;
1742 
1743  const Int_t startTimeGRP = grp->GetTimeStart();
1744  const Int_t stopTimeGRP = grp->GetTimeEnd();
1745 
1746  //
1747  // In case we use a generated GRP we cannot make use of the start time and end time information
1748  // therefore we cannot calculate proper HV information and will skip this
1749  //
1750  if (startTimeGRP==0 && stopTimeGRP==0) {
1751  AliWarning("Using a generated GRP with 'GetTimeStart()' and 'GetTimeEnd()' == 0. Cannot calculate HV information.");
1752  return;
1753  }
1754 
1755  //
1756  // check active state by analysing the scalers
1757  //
1758  // initialise graph with active running
1759  const char* hltMode = NULL;
1760  hltMode = gSystem->Getenv("HLT_ONLINE_MODE");
1761 
1762  AliCDBEntry *entry = NULL;
1763  if (!hltMode) entry = GetCDBEntry("GRP/CTP/Scalers");
1764  if (entry) {
1765  // entry->SetOwner(kTRUE);
1766  AliTriggerRunScalers *sca = (AliTriggerRunScalers*)entry->GetObject();
1767  Int_t nchannels = sca->GetNumClasses(); // number of scaler channels (i.e. trigger classes)
1768  Int_t npoints = sca->GetScalersRecords()->GetEntries(); // number of samples
1769 
1770  // require at least two points from the scalers.
1771  if (npoints>1) {
1772  fGrRunState=new TGraph;
1773  fGrRunState->SetPoint(fGrRunState->GetN(),Double_t(startTimeGRP)-.001,0);
1774  fGrRunState->SetPoint(fGrRunState->GetN(),Double_t(startTimeGRP),1);
1775  ULong64_t lastSum=0;
1776  Double_t timeLast=Double_t(startTimeGRP);
1777  Bool_t active=kTRUE;
1778  for (int i=0; i<npoints; i++) {
1779  AliTriggerScalersRecord *rec = (AliTriggerScalersRecord *) sca->GetScalersRecord(i);
1780  Double_t time = ((AliTimeStamp*) rec->GetTimeStamp())->GetSeconds();
1781  // check if time is inside the grp times. For dummy scaler entries the time might be compatible with 0
1782  if ( time<startTimeGRP || time>stopTimeGRP ){
1783  AliWarning(Form("Time of scaler record %d: %.0f is outside the GRP times (%d, %d). Skipping this record.", i, time, startTimeGRP, stopTimeGRP));
1784  continue;
1785  }
1786  ULong64_t sum=0;
1787  for (int j=0; j<nchannels; j++) sum += ((AliTriggerScalers*) rec->GetTriggerScalers()->At(j))->GetL2CA();
1788  if (TMath::Abs(time-timeLast)<.001 && sum==lastSum ) continue;
1789  if (active && sum==lastSum){
1790  fGrRunState->SetPoint(fGrRunState->GetN(),timeLast-.01,1);
1791  fGrRunState->SetPoint(fGrRunState->GetN(),timeLast,0);
1792  active=kFALSE;
1793  } else if (!active && sum>lastSum ){
1794  fGrRunState->SetPoint(fGrRunState->GetN(),timeLast-.01,0);
1795  fGrRunState->SetPoint(fGrRunState->GetN(),timeLast,1);
1796  active=kTRUE;
1797  }
1798  lastSum=sum;
1799  timeLast=time;
1800  }
1801  fGrRunState->SetPoint(fGrRunState->GetN(),Double_t(stopTimeGRP),active);
1802  fGrRunState->SetPoint(fGrRunState->GetN(),Double_t(stopTimeGRP)+.001,0);
1803  } else {
1804  AliWarning("Only one entry found in the trigger scalers. Most probably this is a dummy entry. Scaler information will not be used!");
1805  }
1806  }
1807 
1808 
1809  // reset all values
1810  for (Int_t iROC=0;iROC<72;++iROC) {
1811  fChamberHVmedian[iROC] = -1;
1812  fChamberHVgoodFraction[iROC] = 0.;
1813  fCurrentNominalVoltage[iROC] = -999.;
1814  fChamberHVStatus[iROC] = kFALSE;
1815  }
1816 
1817  AliDCSSensorArray* voltageArray = GetVoltageSensors(run);
1818  if (!voltageArray) {
1819  AliError("Voltage Array missing. Cannot calculate HV information!");
1820  AliError(" -> Check OCDB entry: 'TPC/Calib/HighVoltage'");
1821  return;
1822  }
1823 
1824  // max HV diffs before a chamber is masked
1825  const Float_t maxVdiff = fParam->GetMaxVoltageDeviation();
1826  const Float_t maxDipVoltage = fParam->GetMaxDipVoltage();
1827  const Float_t maxFracHVbad = fParam->GetMaxFractionHVbad();
1828 
1829  const Int_t samplingPeriod=1;
1830 
1831  // array with sampled voltages
1832  const Int_t maxSamples=(stopTimeGRP-startTimeGRP)/samplingPeriod + 10*samplingPeriod;
1833  Float_t *vSampled = new Float_t[maxSamples];
1834 
1835  // deviation of the median from the nominal voltage
1836  Double_t chamberMedianDeviation[72]={0.};
1837 
1838  for (Int_t iROC=0; iROC<72; ++iROC){
1839  chamberMedianDeviation[iROC]=0.;
1840  TString sensorName="";
1841  Char_t sideName='A';
1842  if ((iROC/18)%2==1) sideName='C';
1843  if (iROC<36) sensorName=Form("TPC_ANODE_I_%c%02d_VMEAS",sideName,iROC%18);
1844  else sensorName=Form("TPC_ANODE_O_%c%02d_0_VMEAS",sideName,iROC%18);
1845 
1846  AliDCSSensor *sensor = voltageArray->GetSensor(sensorName);
1847 
1848  fHVsensors[iROC]=sensor;
1849  if (!sensor) continue;
1850 
1851  Int_t nPointsSampled=0;
1852 
1853  TGraph *gr=sensor->GetGraph();
1854  if ( gr && gr->GetN()>0 ){
1855  //1. sample voltage over time
1856  // get a robust median
1857  // buffer sampled voltages
1858 
1859  // current sampling time
1860  Int_t time=startTimeGRP;
1861 
1862  // input graph sampling point
1863  const Int_t nGraph=gr->GetN();
1864  Int_t pointGraph=0;
1865 
1866  //initialise graph information
1867  Int_t timeGraph=stopTimeGRP;
1868  if (gr->GetN()>1) timeGraph=TMath::Nint(gr->GetX()[pointGraph+1]*3600+sensor->GetStartTime());
1869  Double_t sampledHV=gr->GetY()[pointGraph++];
1870 
1871  while (time<stopTimeGRP){
1872  while (timeGraph<=time && pointGraph+1<nGraph){
1873  timeGraph=TMath::Nint(gr->GetX()[pointGraph+1]*3600+sensor->GetStartTime());
1874  sampledHV=gr->GetY()[pointGraph++];
1875  }
1876  time+=samplingPeriod;
1877  if (!IsDataTakingActive(time-samplingPeriod)) continue;
1878  vSampled[nPointsSampled++]=sampledHV;
1879  }
1880 
1881  if (nPointsSampled<1) continue;
1882 
1883  fChamberHVmedian[iROC]=TMath::Median(nPointsSampled,vSampled);
1884  chamberMedianDeviation[iROC]=fChamberHVmedian[iROC]-fParam->GetNominalVoltage(iROC);
1885 
1886  //2. calculate good HV fraction
1887  Int_t ngood=0;
1888  for (Int_t ipoint=0; ipoint<nPointsSampled; ++ipoint) {
1889  if (TMath::Abs(vSampled[ipoint]-fChamberHVmedian[iROC])<maxDipVoltage) ++ngood;
1890  }
1891 
1892  fChamberHVgoodFraction[iROC]=Float_t(ngood)/Float_t(nPointsSampled);
1893  } else if (!gr && !sensor->GetFit() ){
1894  // This is an exception handling.
1895  // It was observed that for some rund in the 2010 data taking no HV info is available
1896  // for some sectors. However they were active. So take care about this
1897  fChamberHVmedian[iROC] = fParam->GetNominalVoltage(iROC);
1898  fChamberHVgoodFraction[iROC] = 1.;
1899  AliWarning(Form("ROC %d detected without HV Splines and HV graph. Will set median HV to nominal voltage",iROC));
1900  } else {
1901  AliError(Form("No Graph or graph without points found for HV sensor of ROC %d",iROC));
1902  }
1903  }
1904 
1905  delete [] vSampled;
1906  vSampled=0x0;
1907 
1908  // get median deviation from all chambers (detect e.g. -50V)
1909  const Double_t medianIROC=TMath::Median( 36, chamberMedianDeviation );
1910  const Double_t medianOROC=TMath::Median( 36, chamberMedianDeviation+36 );
1911 
1912  // Define current default voltages
1913  for (Int_t iROC=0;iROC<72/*AliTPCCalPad::kNsec*/;++iROC){
1914  const Float_t averageDeviation=(iROC<36)?medianIROC:medianOROC;
1915  fCurrentNominalVoltage[iROC]=fParam->GetNominalVoltage(iROC)+averageDeviation;
1916  }
1917 
1918  //
1919  // Check HV status
1920  //
1921  Int_t nbad=0;
1922  for (Int_t iROC=0;iROC<72/*AliTPCCalPad::kNsec*/;++iROC){
1923  fChamberHVStatus[iROC]=kTRUE;
1924  const Float_t averageDeviation=(iROC<36)?medianIROC:medianOROC;
1925 
1926  //a. Deviation of median from current nominal voltage
1927  // allow larger than nominal voltages
1928  if (fCurrentNominalVoltage[iROC]-fChamberHVmedian[iROC] > maxVdiff) {
1929  AliWarning(Form("Low voltage detected for ROC %2d",iROC));
1930  AliWarning(Form(" -> Based on nominal voltage: %.2f + averge deviation: %.2f = current nominal voltage: %.2f - meadian HV: %.2f > max diff: %.2f",
1931  fParam->GetNominalVoltage(iROC), averageDeviation, fCurrentNominalVoltage[iROC], fChamberHVmedian[iROC], maxVdiff));
1932  AliWarning(" -> Check consistent usage of HV information in the OCDB entry: 'TPC/Calib/HighVoltage'");
1933  AliWarning(" -> and the nominal voltages in the OCDB entry: 'TPC/Calib/Parameters'");
1934  fChamberHVStatus[iROC]=kFALSE;
1935  }
1936 
1937  //b. Fraction of bad hv values
1938  if ( 1.-fChamberHVgoodFraction[iROC] > maxFracHVbad ) {
1939  AliWarning(Form("Large fraction of low HV readings detected in ROC %2d: %.2f > %.2f",
1940  iROC, 1.-fChamberHVgoodFraction[iROC], maxFracHVbad));
1941  AliWarning(Form(" -> Based on HV information from OCDB entry: 'TPC/Calib/HighVoltage' with median voltage: %.2f", fChamberHVmedian[iROC]));
1942  AliWarning( " -> Check with experts if this chamber had HV problems in this run");
1943  fChamberHVStatus[iROC]=kFALSE;
1944  }
1945 
1946  if (!fChamberHVStatus[iROC]) {
1947  ++nbad;
1948  }
1949  }
1950 
1951  // check if all chamber are off
1952  if (nbad==72) {
1953  AliFatal("Something went wrong in the chamber HV status calculation. Check warning messages above. All chambers would be deactivated!");
1954  }
1955 }
1956 
1957 Float_t AliTPCcalibDB::GetChamberHighVoltage(Int_t run, Int_t sector, Int_t timeStamp, Int_t sigDigits, Bool_t current) {
1960 
1961  Float_t val=0;
1962  TString sensorName="";
1963  TTimeStamp stamp(timeStamp);
1964  AliDCSSensorArray* voltageArray = AliTPCcalibDB::Instance()->GetVoltageSensors(run);
1965  if (!voltageArray || (sector<0) || (sector>71)) return val;
1966  Char_t sideName='A';
1967  if ((sector/18)%2==1) sideName='C';
1968  if (sector<36){
1969  //IROC
1970  sensorName=Form("TPC_ANODE_I_%c%02d_VMEAS",sideName,sector%18);
1971  }else{
1972  //OROC
1973  sensorName=Form("TPC_ANODE_O_%c%02d_0_VMEAS",sideName,sector%18);
1974  }
1975  if (current){
1976  if (sector<36){
1977  //IROC
1978  sensorName=Form("TPC_ANODE_I_%c%02d_IMEAS",sideName,sector%18);
1979  }else{
1980  //OROC
1981  sensorName=Form("TPC_ANODE_O_%c%02d_0_IMEAS",sideName,sector%18);
1982  }
1983 
1984  }
1985  if (timeStamp==-1){
1986  val=AliTPCcalibDB::GetDCSSensorMeanValue(voltageArray, sensorName.Data(),sigDigits);
1987  } else {
1988  val=AliTPCcalibDB::GetDCSSensorValue(voltageArray, timeStamp, sensorName.Data(),sigDigits);
1989  }
1990  return val;
1991 }
1992 Float_t AliTPCcalibDB::GetSkirtVoltage(Int_t run, Int_t sector, Int_t timeStamp, Int_t sigDigits)
1993 {
1997 
1998  Float_t val=0;
1999  TString sensorName="";
2000  TTimeStamp stamp(timeStamp);
2001  AliDCSSensorArray* voltageArray = AliTPCcalibDB::Instance()->GetVoltageSensors(run);
2002  if (!voltageArray || (sector<0) || (sector>71)) return val;
2003  Char_t sideName='A';
2004  if ((sector/18)%2==1) sideName='C';
2005  sensorName=Form("TPC_SKIRT_%c_VMEAS",sideName);
2006  if (timeStamp==-1){
2007  val=AliTPCcalibDB::GetDCSSensorMeanValue(voltageArray, sensorName.Data(),sigDigits);
2008  } else {
2009  val=AliTPCcalibDB::GetDCSSensorValue(voltageArray, timeStamp, sensorName.Data(),sigDigits);
2010  }
2011  return val;
2012 }
2013 
2014 Float_t AliTPCcalibDB::GetCoverVoltage(Int_t run, Int_t sector, Int_t timeStamp, Int_t sigDigits)
2015 {
2019 
2020  Float_t val=0;
2021  TString sensorName="";
2022  TTimeStamp stamp(timeStamp);
2023  AliDCSSensorArray* voltageArray = AliTPCcalibDB::Instance()->GetVoltageSensors(run);
2024  if (!voltageArray || (sector<0) || (sector>71)) return val;
2025  Char_t sideName='A';
2026  if ((sector/18)%2==1) sideName='C';
2027  if (sector<36){
2028  //IROC
2029  sensorName=Form("TPC_COVER_I_%c_VMEAS",sideName);
2030  }else{
2031  //OROC
2032  sensorName=Form("TPC_COVER_O_%c_VMEAS",sideName);
2033  }
2034  if (timeStamp==-1){
2035  val=AliTPCcalibDB::GetDCSSensorMeanValue(voltageArray, sensorName.Data(),sigDigits);
2036  } else {
2037  val=AliTPCcalibDB::GetDCSSensorValue(voltageArray, timeStamp, sensorName.Data(),sigDigits);
2038  }
2039  return val;
2040 }
2041 
2042 Float_t AliTPCcalibDB::GetGGoffsetVoltage(Int_t run, Int_t sector, Int_t timeStamp, Int_t sigDigits)
2043 {
2047 
2048  Float_t val=0;
2049  TString sensorName="";
2050  TTimeStamp stamp(timeStamp);
2051  AliDCSSensorArray* voltageArray = AliTPCcalibDB::Instance()->GetVoltageSensors(run);
2052  if (!voltageArray || (sector<0) || (sector>71)) return val;
2053  Char_t sideName='A';
2054  if ((sector/18)%2==1) sideName='C';
2055  if (sector<36){
2056  //IROC
2057  sensorName=Form("TPC_GATE_I_%c_OFF_VMEAS",sideName);
2058  }else{
2059  //OROC
2060  sensorName=Form("TPC_GATE_O_%c_OFF_VMEAS",sideName);
2061  }
2062  if (timeStamp==-1){
2063  val=AliTPCcalibDB::GetDCSSensorMeanValue(voltageArray, sensorName.Data(),sigDigits);
2064  } else {
2065  val=AliTPCcalibDB::GetDCSSensorValue(voltageArray, timeStamp, sensorName.Data(),sigDigits);
2066  }
2067  return val;
2068 }
2069 
2070 Float_t AliTPCcalibDB::GetGGnegVoltage(Int_t run, Int_t sector, Int_t timeStamp, Int_t sigDigits)
2071 {
2075 
2076  Float_t val=0;
2077  TString sensorName="";
2078  TTimeStamp stamp(timeStamp);
2079  AliDCSSensorArray* voltageArray = AliTPCcalibDB::Instance()->GetVoltageSensors(run);
2080  if (!voltageArray || (sector<0) || (sector>71)) return val;
2081  Char_t sideName='A';
2082  if ((sector/18)%2==1) sideName='C';
2083  if (sector<36){
2084  //IROC
2085  sensorName=Form("TPC_GATE_I_%c_NEG_VMEAS",sideName);
2086  }else{
2087  //OROC
2088  sensorName=Form("TPC_GATE_O_%c_NEG_VMEAS",sideName);
2089  }
2090  if (timeStamp==-1){
2091  val=AliTPCcalibDB::GetDCSSensorMeanValue(voltageArray, sensorName.Data(),sigDigits);
2092  } else {
2093  val=AliTPCcalibDB::GetDCSSensorValue(voltageArray, timeStamp, sensorName.Data(),sigDigits);
2094  }
2095  return val;
2096 }
2097 
2098 Float_t AliTPCcalibDB::GetGGposVoltage(Int_t run, Int_t sector, Int_t timeStamp, Int_t sigDigits)
2099 {
2103 
2104  Float_t val=0;
2105  TString sensorName="";
2106  TTimeStamp stamp(timeStamp);
2107  AliDCSSensorArray* voltageArray = AliTPCcalibDB::Instance()->GetVoltageSensors(run);
2108  if (!voltageArray || (sector<0) || (sector>71)) return val;
2109  Char_t sideName='A';
2110  if ((sector/18)%2==1) sideName='C';
2111  if (sector<36){
2112  //IROC
2113  sensorName=Form("TPC_GATE_I_%c_POS_VMEAS",sideName);
2114  }else{
2115  //OROC
2116  sensorName=Form("TPC_GATE_O_%c_POS_VMEAS",sideName);
2117  }
2118  if (timeStamp==-1){
2119  val=AliTPCcalibDB::GetDCSSensorMeanValue(voltageArray, sensorName.Data(),sigDigits);
2120  } else {
2121  val=AliTPCcalibDB::GetDCSSensorValue(voltageArray, timeStamp, sensorName.Data(),sigDigits);
2122  }
2123  return val;
2124 }
2125 
2126 Float_t AliTPCcalibDB::GetPressure(Int_t timeStamp, Int_t run, Int_t type){
2128 
2129  TTimeStamp stamp(timeStamp);
2130  AliDCSSensor * sensor = Instance()->GetPressureSensor(run,type);
2131  if (!sensor) return 0;
2132  return sensor->GetValue(stamp);
2133 }
2134 
2135 Float_t AliTPCcalibDB::GetL3Current(Int_t run, Int_t statType){
2138 
2139  Float_t current=-1;
2140  AliGRPObject *grp=AliTPCcalibDB::GetGRP(run);
2141  if (grp) current=grp->GetL3Current((AliGRPObject::Stats)statType);
2142  return current;
2143 }
2144 
2145 Float_t AliTPCcalibDB::GetBz(Int_t run){
2147 
2148  Float_t bz=-1;
2149  Float_t current=AliTPCcalibDB::GetL3Current(run);
2150  if (current>-1) bz=5*current/30000.*.1;
2151  return bz;
2152 }
2153 
2154 Char_t AliTPCcalibDB::GetL3Polarity(Int_t run) {
2156 
2157  Char_t pol=-100;
2158  AliGRPObject *grp=AliTPCcalibDB::GetGRP(run);
2159  if (grp) pol=grp->GetL3Polarity();
2160  return pol;
2161 }
2162 
2163 TString AliTPCcalibDB::GetRunType(Int_t run){
2165 
2166 // TString type("UNKNOWN");
2167  AliGRPObject *grp=AliTPCcalibDB::GetGRP(run);
2168  if (grp) return grp->GetRunType();
2169  return "UNKNOWN";
2170 }
2171 
2172 Float_t AliTPCcalibDB::GetValueGoofie(Int_t timeStamp, Int_t run, Int_t type){
2174 
2175  TTimeStamp stamp(timeStamp);
2176  AliDCSSensorArray* goofieArray = AliTPCcalibDB::Instance()->GetGoofieSensors(run);
2177  if (!goofieArray) return 0;
2178  AliDCSSensor *sensor = goofieArray->GetSensor(type);
2179  return sensor->GetValue(stamp);
2180 }
2181 
2182 
2183 
2184 
2185 
2186 
2187 Bool_t AliTPCcalibDB::GetTemperatureFit(Int_t timeStamp, Int_t run, Int_t side,TVectorD& fit){
2189 
2190  TTimeStamp tstamp(timeStamp);
2192  if (! tempArray) return kFALSE;
2193  AliTPCTempMap * tempMap = new AliTPCTempMap(tempArray);
2194  TLinearFitter * fitter = tempMap->GetLinearFitter(3,side,tstamp);
2195  if (fitter){
2196  fitter->Eval();
2197  fitter->GetParameters(fit);
2198  }
2199  delete fitter;
2200  delete tempMap;
2201  if (!fitter) return kFALSE;
2202  return kTRUE;
2203 }
2204 
2205 Float_t AliTPCcalibDB::GetTemperature(Int_t timeStamp, Int_t run, Int_t side){
2207 
2208  TVectorD vec(5);
2209  if (side==0) {
2210  GetTemperatureFit(timeStamp,run,0,vec);
2211  return vec[0];
2212  }
2213  if (side==1){
2214  GetTemperatureFit(timeStamp,run,0,vec);
2215  return vec[0];
2216  }
2217  return 0;
2218 }
2219 
2220 
2221 Double_t AliTPCcalibDB::GetPTRelative(UInt_t timeSec, Int_t run, Int_t side){
2226 
2228  if (!vdrift) return 0;
2229  return vdrift->GetPTRelative(timeSec,side);
2230 }
2231 
2232 AliGRPObject * AliTPCcalibDB::MakeGRPObjectFromMap(TMap *map){
2236 
2237  if (!map) return 0;
2238  AliDCSSensor * sensor = 0;
2239  TObject *osensor=0;
2240  osensor = ((*map)("fP2Pressure"));
2241  sensor =dynamic_cast<AliDCSSensor *>(osensor);
2242  //
2243  if (!sensor) return 0;
2244  //
2245  AliDCSSensor * sensor2 = new AliDCSSensor(*sensor);
2246  osensor = ((*map)("fCavernPressure"));
2247  TGraph * gr = new TGraph(2);
2248  gr->GetX()[0]= -100000.;
2249  gr->GetX()[1]= 1000000.;
2250  gr->GetY()[0]= atof(osensor->GetName());
2251  gr->GetY()[1]= atof(osensor->GetName());
2252  sensor2->SetGraph(gr);
2253  sensor2->SetFit(0);
2254 
2255 
2256  AliGRPObject *grpRun = new AliGRPObject;
2257  grpRun->ReadValuesFromMap(map);
2258  grpRun->SetCavernAtmosPressure(sensor2);
2259  grpRun->SetCavernAtmosPressure(sensor2);
2260  grpRun->SetSurfaceAtmosPressure(sensor);
2261  return grpRun;
2262 }
2263 
2264 Bool_t AliTPCcalibDB::CreateGUITree(Int_t run, const char* filename)
2265 {
2267 
2268  if (!AliCDBManager::Instance()->GetDefaultStorage()){
2269  AliLog::Message(AliLog::kError, "Default Storage not set. Cannot create Calibration Tree!",
2270  MODULENAME(), "AliTPCcalibDB", FUNCTIONNAME(), __FILE__, __LINE__);
2271  return kFALSE;
2272  }
2273  //db instance
2275  // retrieve cal pad objects
2276  db->SetRun(run);
2277  db->CreateGUITree(filename);
2278  return kTRUE;
2279 }
2280 
2281 Bool_t AliTPCcalibDB::CreateGUITree(const char* filename){
2283 
2284  if (!AliCDBManager::Instance()->GetDefaultStorage()){
2285  AliError("Default Storage not set. Cannot create calibration Tree!");
2286  return kFALSE;
2287  }
2288  UpdateNonRec(); // load all infromation now
2289 
2292 
2293  // gain map
2295  //noise and pedestals
2296  if (GetPedestals()) prep.AddComponent(new AliTPCCalPad(*(GetPedestals())));
2297  if (GetPadNoise() ) prep.AddComponent(new AliTPCCalPad(*(GetPadNoise())));
2298  //pulser data
2299  if (GetPulserTmean()) prep.AddComponent(new AliTPCCalPad(*(GetPulserTmean())));
2300  if (GetPulserTrms() ) prep.AddComponent(new AliTPCCalPad(*(GetPulserTrms())));
2301  if (GetPulserQmean()) prep.AddComponent(new AliTPCCalPad(*(GetPulserQmean())));
2302  //CE data
2303  if (GetCETmean()) prep.AddComponent(new AliTPCCalPad(*(GetCETmean())));
2304  if (GetCETrms() ) prep.AddComponent(new AliTPCCalPad(*(GetCETrms())));
2305  if (GetCEQmean()) prep.AddComponent(new AliTPCCalPad(*(GetCEQmean())));
2306  //Altro data
2308  if (GetALTROZsThr() ) prep.AddComponent(new AliTPCCalPad(*(GetALTROZsThr() )));
2309  if (GetALTROFPED() ) prep.AddComponent(new AliTPCCalPad(*(GetALTROFPED() )));
2310  if (GetALTROAcqStop() ) prep.AddComponent(new AliTPCCalPad(*(GetALTROAcqStop() )));
2311  if (GetALTROMasked() ) prep.AddComponent(new AliTPCCalPad(*(GetALTROMasked() )));
2312  //QA
2313  AliTPCdataQA *dataQA=GetDataQA();
2314  if (dataQA) {
2315  if (dataQA->GetNLocalMaxima())
2316  prep.AddComponent(new AliTPCCalPad(*(dataQA->GetNLocalMaxima())));
2317  if (dataQA->GetMaxCharge())
2318  prep.AddComponent(new AliTPCCalPad(*(dataQA->GetMaxCharge())));
2319  if (dataQA->GetMeanCharge())
2320  prep.AddComponent(new AliTPCCalPad(*(dataQA->GetMeanCharge())));
2321  if (dataQA->GetNoThreshold())
2322  prep.AddComponent(new AliTPCCalPad(*(dataQA->GetNoThreshold())));
2323  if (dataQA->GetNTimeBins())
2324  prep.AddComponent(new AliTPCCalPad(*(dataQA->GetNTimeBins())));
2325  if (dataQA->GetNPads())
2326  prep.AddComponent(new AliTPCCalPad(*(dataQA->GetNPads())));
2327  if (dataQA->GetTimePosition())
2328  prep.AddComponent(new AliTPCCalPad(*(dataQA->GetTimePosition())));
2329  }
2330 
2331  //
2332  TString file(filename);
2333  if (file.IsNull()) file=Form("guiTreeRun_%i.root",fRun);
2334  prep.DumpToFile(file.Data());
2335  return kTRUE;
2336 }
2337 
2338 Bool_t AliTPCcalibDB::CreateRefFile(Int_t run, const char* filename)
2339 {
2341 
2342  if (!AliCDBManager::Instance()->GetDefaultStorage()){
2343  AliLog::Message(AliLog::kError, "Default Storage not set. Cannot create Calibration Tree!",
2344  MODULENAME(), "AliTPCcalibDB", FUNCTIONNAME(), __FILE__, __LINE__);
2345  return kFALSE;
2346  }
2347  TString file(filename);
2348  if (file.IsNull()) file=Form("RefCalPads_%d.root",run);
2349  TDirectory *currDir=gDirectory;
2350  //db instance
2352  // retrieve cal pad objects
2353  db->SetRun(run);
2354  //open file
2355  TFile f(file.Data(),"recreate");
2356  //noise and pedestals
2357  db->GetPedestals()->Write("Pedestals");
2358  db->GetPadNoise()->Write("PadNoise");
2359  //pulser data
2360  db->GetPulserTmean()->Write("PulserTmean");
2361  db->GetPulserTrms()->Write("PulserTrms");
2362  db->GetPulserQmean()->Write("PulserQmean");
2363  //CE data
2364  db->GetCETmean()->Write("CETmean");
2365  db->GetCETrms()->Write("CETrms");
2366  db->GetCEQmean()->Write("CEQmean");
2367  //Altro data
2368  db->GetALTROAcqStart() ->Write("ALTROAcqStart");
2369  db->GetALTROZsThr() ->Write("ALTROZsThr");
2370  db->GetALTROFPED() ->Write("ALTROFPED");
2371  db->GetALTROAcqStop() ->Write("ALTROAcqStop");
2372  db->GetALTROMasked() ->Write("ALTROMasked");
2373  //
2374  f.Close();
2375  currDir->cd();
2376  return kTRUE;
2377 }
2378 
2379 
2380 
2381 Double_t AliTPCcalibDB::GetVDriftCorrectionTime(Int_t timeStamp, Int_t run, Int_t /*side*/, Int_t mode){
2391 
2392  Double_t result=0;
2393  // mode 1 automatic mode - according to the distance to the valid calibration
2394  // -
2395  Double_t deltaP=0, driftP=0, wP = 0.;
2396  Double_t deltaITS=0,driftITS=0, wITS= 0.;
2397  Double_t deltaLT=0, driftLT=0, wLT = 0.;
2398  Double_t deltaCE=0, driftCE=0, wCE = 0.;
2399  driftP = fDButil->GetVDriftTPC(deltaP,run,timeStamp);
2400  driftITS= fDButil->GetVDriftTPCITS(deltaITS,run,timeStamp);
2401  driftCE = fDButil->GetVDriftTPCCE(deltaCE, run,timeStamp,36000,2);
2402  driftLT = fDButil->GetVDriftTPCLaserTracks(deltaLT,run,timeStamp,36000,2);
2403  deltaITS = TMath::Abs(deltaITS);
2404  deltaP = TMath::Abs(deltaP);
2405  deltaLT = TMath::Abs(deltaLT);
2406  deltaCE = TMath::Abs(deltaCE);
2407  if (mode==1) {
2408  const Double_t kEpsilon=0.00000000001;
2409  const Double_t kdeltaT=360.; // 10 minutes
2410  if(TMath::Abs(deltaITS) < 12*kdeltaT) {
2411  result = driftITS;
2412  } else {
2413  wITS = 64.*kdeltaT/(deltaITS +kdeltaT);
2414  wLT = 16.*kdeltaT/(deltaLT +kdeltaT);
2415  wP = 0. *kdeltaT/(deltaP +kdeltaT);
2416  wCE = 1. *kdeltaT/(deltaCE +kdeltaT);
2417  //
2418  //
2419  if (TMath::Abs(driftP)<kEpsilon) wP=0; // invalid calibration
2420  if (TMath::Abs(driftITS)<kEpsilon)wITS=0; // invalid calibration
2421  if (TMath::Abs(driftLT)<kEpsilon) wLT=0; // invalid calibration
2422  if (TMath::Abs(driftCE)<kEpsilon) wCE=0; // invalid calibration
2423  if (wP+wITS+wLT+wCE<kEpsilon) return 0;
2424  result = (driftP*wP+driftITS*wITS+driftLT*wLT+driftCE*wCE)/(wP+wITS+wLT+wCE);
2425  }
2426 
2427 
2428  }
2429 
2430  return result;
2431 }
2432 
2433 Double_t AliTPCcalibDB::GetTime0CorrectionTime(Int_t timeStamp, Int_t run, Int_t /*side*/, Int_t mode){
2444 
2445  Double_t result=0;
2446  if (mode==2) {
2447  // TPC-TPC mode
2448  result=fDButil->GetTriggerOffsetTPC(run,timeStamp);
2449  result *=fParam->GetZLength();
2450  }
2451  if (mode==1){
2452  // TPC-ITS mode
2453  Double_t dist=0;
2454  result= -fDButil->GetTime0TPCITS(dist, run, timeStamp)*fParam->GetDriftV()/1000000.;
2455  }
2456  return result;
2457 
2458 }
2459 
2460 
2461 
2462 
2463 Double_t AliTPCcalibDB::GetVDriftCorrectionGy(Int_t timeStamp, Int_t run, Int_t side, Int_t /*mode*/){
2474 
2475  if (run<=0 && fTransform) run = fTransform->GetCurrentRunNumber();
2476  UpdateRunInformations(run,kFALSE);
2478  if (!array) return 0;
2479  Double_t result=0;
2480 
2481  // use TPC-ITS if present
2482  TGraphErrors *gr= (TGraphErrors*)array->FindObject("ALIGN_ITSB_TPC_VDGY");
2483  if (!gr) gr = (TGraphErrors*)array->FindObject("ALIGN_TOFB_TPC_VDGY");
2484  if(gr) {
2485  result = AliTPCcalibDButil::EvalGraphConst(gr,timeStamp);
2486 
2487  // transform from [(cm/mus)/ m] to [1/cm]
2488  result /= (fParam->GetDriftV()/1000000.);
2489  result /= 100.;
2490 
2491  //printf("result %e \n", result);
2492  return result;
2493  }
2494 
2495  // use laser if ITS-TPC not present
2496  TGraphErrors *laserA= (TGraphErrors*)array->FindObject("GRAPH_MEAN_GLOBALYGRADIENT_LASER_ALL_A");
2497  TGraphErrors *laserC= (TGraphErrors*)array->FindObject("GRAPH_MEAN_GLOBALYGRADIENT_LASER_ALL_C");
2498 
2499  if (laserA && laserC){
2500  result= (laserA->Eval(timeStamp)+laserC->Eval(timeStamp))*0.5;
2501  }
2502  if (laserA && side==0){
2503  result = (laserA->Eval(timeStamp));
2504  }
2505  if (laserC &&side==1){
2506  result = (laserC->Eval(timeStamp));
2507  }
2508  //printf("laser result %e \n", -result/250.);
2509 
2510  return -result/250.; //normalized before
2511 }
2512 
2513 
2514 Double_t AliTPCcalibDB::GetVDriftCorrectionDeltaZ(Int_t /*timeStamp*/, Int_t run, Int_t /*side*/, Int_t /*mode*/){
2517 
2518  // Arguments:
2519  // mode determines the algorith how to combine the Laser Track, LaserCE or TPC-ITS
2520  // timestamp - not used
2521  // run - run number
2522  // side - common for boith sides
2523  //
2524  if (run<=0 && fTransform) run = fTransform->GetCurrentRunNumber();
2525  UpdateRunInformations(run,kFALSE);
2527  if (!array) return 0;
2528  Double_t result=0;
2529 
2530  // use TPC-ITS if present
2531  TGraphErrors *gr= (TGraphErrors*)array->FindObject("ALIGN_ITSB_TPC_DELTAZ");
2532  if(gr) {
2533  result = TMath::Mean(gr->GetN(), gr->GetY());
2534  }
2535  return result;
2536 }
2537 
2538 
2539 
2540 
2541 AliTPCCalPad* AliTPCcalibDB::MakeDeadMap(Double_t notInMap, const char* nameMappingFile) {
2548 
2549  char chinfo[1000];
2550 
2551  TFile *fileMapping = new TFile(nameMappingFile, "read");
2552  AliTPCmapper *mapping = (AliTPCmapper*) fileMapping->Get("tpcMapping");
2553  if (!mapping) {
2554  snprintf(chinfo,1000,"Failed to get mapping object from %s. ...\n", nameMappingFile);
2555  AliError (chinfo);
2556  return 0;
2557  }
2558 
2559  AliTPCCalPad *deadMap = new AliTPCCalPad("deadMap","deadMap");
2560  if (!deadMap) {
2561  AliError("Failed to allocate dead map AliTPCCalPad");
2562  return 0;
2563  }
2564 
2566  Int_t idDDL=0;
2567  if (!fALTROConfigData ) {
2568  AliError("No ALTRO config OCDB entry available");
2569  return 0;
2570  }
2571  TMap *activeDDL = (TMap*)fALTROConfigData->FindObject("DDLArray");
2572  TObjString *ddlArray=0;
2573  if (activeDDL) {
2574  ddlArray = (TObjString*)activeDDL->GetValue("DDLArray");
2575  if (!ddlArray) {
2576  AliError("Empty list of active DDLs in OCDB entry");
2577  return 0;
2578  }
2579  } else {
2580  AliError("List of active DDLs not available in OCDB entry");
2581  return 0;
2582  }
2583  TString arrDDL=ddlArray->GetString();
2584  Int_t offset = mapping->GetTpcDdlOffset();
2585  Double_t active;
2586  for (Int_t i=0; i<mapping->GetNumDdl(); i++) {
2587  idDDL= i+offset;
2588  if (idDDL<0) continue;
2589  Int_t patch = mapping->GetPatchFromEquipmentID(idDDL);
2590  if (patch<0) continue;
2591  Int_t roc=mapping->GetRocFromEquipmentID(idDDL);
2592  if (roc<0) continue;
2593  AliTPCCalROC *calRoc=deadMap->GetCalROC(roc);
2594  if (calRoc) {
2595  for ( Int_t branch = 0; branch < 2; branch++ ) {
2596  for ( Int_t fec = 0; fec < mapping->GetNfec(patch, branch); fec++ ) {
2597  for ( Int_t altro = 0; altro < 8; altro++ ) {
2598  for ( Int_t channel = 0; channel < 16; channel++ ) {
2599  Int_t hwadd = mapping->CodeHWAddress(branch, fec, altro, channel);
2600  Int_t row = mapping->GetPadRow(patch, hwadd); // row in a ROC (IROC or OROC)
2601 // Int_t globalrow = mapping.GetGlobalPadRow(patch, hwadd); // row in full sector (IROC plus OROC)
2602  Int_t pad = mapping->GetPad(patch, hwadd);
2603  if (!TString(arrDDL[i]).IsDigit()) {
2604  active = notInMap;
2605  } else {
2606  active=TString(arrDDL[i]).Atof();
2607  }
2608  calRoc->SetValue(row,pad,active);
2609  } // end channel for loop
2610  } // end altro for loop
2611  } // end fec for loop
2612  } // end branch for loop
2613  } // valid calROC
2614  } // end loop on active DDLs
2615  return deadMap;
2616 }
2617 
2618 
2619 
2625 
2626  if (!fComposedCorrectionArray) return 0;
2627  if (field>0.1 && fComposedCorrectionArray->At(1)) {
2628  return (AliTPCCorrection *)fComposedCorrectionArray->At(1);
2629  }
2630  if (field<-0.1 &&fComposedCorrectionArray->At(2)) {
2631  return (AliTPCCorrection *)fComposedCorrectionArray->At(2);
2632  }
2633  return (AliTPCCorrection *)fComposedCorrectionArray->At(0);
2634 
2635 }
2636 
2637 
2641 
2642  if (!fComposedCorrectionArray) return 0;
2643  if (fRun<0) return 0;
2644  if (fDriftCorrectionArray.GetValue(Form("%i",fRun))==0) return 0;
2645  if (fComposedCorrectionArray->GetEntriesFast()<=4) {
2646  fComposedCorrectionArray->Expand(5);
2647  TObjArray * timeArray =(TObjArray*)(fDriftCorrectionArray.GetValue(Form("%i",fRun)));
2648  AliTPCCorrection * correctionTime = (AliTPCCorrection *)timeArray->FindObject("FitCorrectionTime");
2649  if (correctionTime){
2650  correctionTime->Init();
2651  fComposedCorrectionArray->AddAt(correctionTime,4); //add time dependent c
2652  }
2653  }
2654  return (AliTPCCorrection *)fComposedCorrectionArray->At(4); //
2655 }
2656 
2657 Double_t AliTPCcalibDB::GetGainCorrectionHVandPT(Int_t timeStamp, Int_t run, Int_t sector, Int_t deltaCache, Int_t mode){
2675 
2676  static Float_t gGainCorrection[72];
2677  static Float_t gGainCorrectionPT[72];
2678  static Float_t gGainCorrectionHV[72];
2679  static Int_t gTimeStamp=-99999999;
2680  static Bool_t hasTimeDependent=kFALSE;
2681  if ( TMath::Abs(timeStamp-gTimeStamp)> deltaCache){
2682  //
2683  TGraphErrors * graphGHV = 0;
2684  TGraphErrors * graphGPT = 0;
2685  TObjArray *timeGainSplines = GetTimeGainSplinesRun(run);
2686  if (timeGainSplines){
2687  graphGHV = (TGraphErrors*) timeGainSplines->FindObject("GainSlopesHV");
2688  graphGPT = (TGraphErrors*) timeGainSplines->FindObject("GainSlopesPT");
2689  if (graphGHV) hasTimeDependent=kTRUE;
2690  }
2691  if (!graphGHV) graphGHV = fParam->GetGainSlopesHV();
2692  if (!graphGPT) graphGPT = fParam->GetGainSlopesPT();
2693  //
2694  for (Int_t isec=0; isec<72; isec++){
2695  Double_t HV= GetChamberHighVoltage(run,isec, timeStamp);
2696  if (HV<=0){ // check if the HV was available
2697  AliDCSSensor* sensor = GetChamberHVSensor(isec);
2698  if (sensor && sensor->GetGraph()==NULL && sensor->GetFit()==NULL){
2699  HV=fParam->GetNominalVoltage(isec);
2700  }
2701  }
2702  Double_t deltaHV= HV - fParam->GetNominalVoltage(isec);
2703  Double_t deltaGHV=0;
2704  Double_t deltaGPT=0;
2705  if (graphGHV) deltaGHV = graphGHV->GetY()[isec]*deltaHV;
2706  if (graphGPT) deltaGPT = graphGPT->GetY()[isec]*GetPTRelative(timeStamp,run,0);
2707  gGainCorrection[isec]=(1.+deltaGHV)*(1.+deltaGPT);
2708  gGainCorrectionPT[isec]=1+deltaGPT;
2709  gGainCorrectionHV[isec]=1+deltaGHV;
2710  }
2711  gTimeStamp=timeStamp;
2712  }
2713  if (mode==0){
2714  if (hasTimeDependent) return gGainCorrection[sector];
2715  if (!hasTimeDependent) return 1;
2716  }
2717  if (mode==1) return gGainCorrection[sector];
2718  if (mode==2) return gGainCorrectionPT[sector];
2719  if (mode==3) return gGainCorrectionHV[sector];
2720  return 1;
2721 }
static AliTPCcalibDB * Instance()
static Float_t GetGain(Int_t sector, Int_t row, Int_t pad)
static Double_t EvalGraphConst(TGraph *const graph, Double_t xref)
TMap fDriftCorrectionArray
! array of drift correction
static void CreateObjectList(const Char_t *filename, TObjArray *calibObjects)
static Float_t GetBz(Int_t run)
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
UInt_t GetNPads(UInt_t sector, UInt_t row) const
Definition: AliTPCROC.h:30
Float_t GetMaxDipVoltage() const
Definition: AliTPCParam.h:381
const Double_t kEpsilon
Double_t GetTime0CorrectionTime(Int_t timeStamp, Int_t run, Int_t side, Int_t mode)
TFile * Open(const char *filename, Long64_t &nevents)
const TObjArray * GetCalPadRMS() const
Bool_t fBHasAlignmentOCDB
Flag - alignment from the Transformation class.
static Char_t GetL3Polarity(Int_t run)
AliTPCCalROC * GetCalROC(Int_t sector) const
Definition: AliTPCCalPad.h:39
const TObjArray * GetCalPadRMS() const
Definition: AliTPCCalibCE.h:57
static Double_t GetPTRelative(UInt_t timeSec, Int_t run, Int_t side)
AliTPCCalPad * fPadTime0
Time0 calibration entry.
AliTPCCalPad * GetMaxCharge() const
Definition: AliTPCdataQA.h:60
TObjArray * fIonTailArray
array of graphs with the ion tail
static Double_t GetVDriftTPC(Double_t &dist, Int_t run, Int_t timeStamp, Double_t deltaT=86400, Double_t deltaTLaser=3600, Int_t valType=0)
TMap * GetRCUconfig() const
Definition: AliTPCcalibDB.h:92
AliDCSSensor * GetChamberHVSensor(UInt_t roc) const
TMap fTimeGainSplinesArray
! array Array of AliSplineFits: at 0 MIP position in time ; at 1 Fermi Plateau from cosmics ...
Double_t GetMedian(AliTPCCalROC *const outlierROC=0, EPadType padType=kAll) const
#define TObjArray
TVectorD vec
Definition: AnalyzeLaser.C:8
Double_t GetRMS(AliTPCCalROC *const outlierROC=0, EPadType padType=kAll) const
AliDCSSensor * fHVsensors[72]
HV sensors.
Int_t fMaxTimeBinAllPads
Maximum Time bin in whole TPC extracted from AltroConfig.
void SetExBField(Float_t bz)
Class providing the calibration parameters by accessing the CDB.
Definition: AliTPCcalibDB.h:43
TGraph * fGrRunState
store information if run is active or paused
void UpdateChamberHighVoltageData()
Manager and of geomety classes for set: TPC.
Definition: AliTPCParam.h:18
static void FilterTracks(Int_t run, Double_t cutSigma=20., TTreeSRedirector *const pcstream=0)
AliTPCCalPad * GetALTROFPED() const
Definition: AliTPCcalibDB.h:88
AliTPCmapper.
Definition: AliTPCmapper.h:15
static Float_t GetGGoffsetVoltage(Int_t run, Int_t sector, Int_t timeStamp=-1, Int_t sigDigits=0)
UInt_t GetNRows(UInt_t sector) const
Definition: AliTPCROC.h:28
Implementation of the TPC transformation class.
TObjArray * fComposedCorrectionArray
space point corrections for different field setting
Float_t GetDriftV() const
Definition: AliTPCParam.h:341
Float_t GetMaxFractionHVbad() const
Definition: AliTPCParam.h:382
static Float_t GetValueGoofie(Int_t timeStamp, Int_t run, Int_t type)
TFile f("CalibObjects.root")
Float_t GetMaxVoltageDeviation() const
Definition: AliTPCParam.h:380
Float_t GetValue(UInt_t row, UInt_t pad) const
Definition: AliTPCCalROC.h:38
Implementation of the TPC pedestal calibration.
void Multiply(Float_t c1)
AliTPCTransform * fTransform
object responsible for spacial corrections
static void Terminate()
TMap fGoofieArray
! array of GOOFIE values -per run
const TObjArray * GetCalPadT0() const
Definition: AliTPCCalibCE.h:54
Int_t GetPad(Int_t patch, Int_t hwAddress) const
AliDCSSensor * GetPressureSensor(Int_t run, Int_t type=0)
AliTPCCalPad * fPadNoise
Noise calibration entry.
static Float_t FilterSensor(AliDCSSensor *sensor, Double_t ymin, Double_t ymax, Double_t maxdy, Double_t sigmaCut)
TPC calibration class for temperature maps and tendencies.
Definition: AliTPCTempMap.h:19
UInt_t GetNChannels(UInt_t sector) const
Definition: AliTPCROC.h:29
static Double_t GetVDriftTPCCE(Double_t &dist, Int_t run, Int_t timeStamp, Double_t deltaT=43200, Int_t side=2)
TMap fVoltageArray
! array of Chamber HV values -per run
AliTPCExB * GetExB() const
Definition: AliTPCcalibDB.h:61
void GetPositionLocal(UInt_t sector, UInt_t row, UInt_t pad, Float_t *pos)
Definition: AliTPCROC.cxx:414
AliTPCCalPad * GetPedestals() const
Definition: AliTPCcalibDB.h:80
AliTPCCalPad * fPadGainFactor
Gain calibration entry.
TObjArray * GetTimeGainSplinesRun(Int_t run)
AliTPCCalPad * fActiveChannelMap
Map of active channels calculated on the fly.
static void FilterCE(Double_t deltaT=100, Double_t cutAbs=10, Double_t cutSigma=4., TTreeSRedirector *const pcstream=0)
AliTPCCalPad * GetNTimeBins() const
Definition: AliTPCdataQA.h:66
TGraph * GetCErocQgraph(const Int_t roc) const
static Float_t GetChamberHighVoltage(Int_t run, Int_t sector, Int_t timeStamp=-1, Int_t sigDigits=0, Bool_t current=kFALSE)
AliTPCCalPad * GetTimePosition() const
Definition: AliTPCdataQA.h:68
static Bool_t fgTerminated
termination control
TMap fTemperatureArray
! array of temperature sensors - per run
Int_t GetNfec(Int_t patch, Int_t branch) const
void SetCurrentRun(Int_t run)
Float_t fChamberHVgoodFraction[72]
fraction of time the chamber has a good HV (wrt. robust median)
npoints
Definition: driftITSTPC.C:85
AliTPCdataQA * GetDataQA() const
AliSplineFit fit
Definition: CalibTime.C:30
Int_t CodeHWAddress(Int_t branch, Int_t fec, Int_t chip, Int_t channel) const
static Double_t GetTime0TPCITS(Double_t &dist, Int_t run, Int_t timeStamp)
const TObjArray * GetCalPadRMS() const
Class providing the calculation of derived quantities (mean,rms,fits,...) of calibration entries...
AliDCSSensorArray * GetVoltageSensors(Int_t run)
static Float_t GetPressure(Int_t timeStamp, Int_t run, Int_t type=0)
AliTPCCorrection * fComposedCorrection
general space point corrections
TObjArray * array
Definition: AnalyzeLaser.C:12
static void SetInstance(AliTPCExB *const param)
Definition: AliTPCExB.h:31
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
Int_t GetRCUTriggerConfig() const
static TString GetRunType(Int_t run)
TMap fGRPMaps
! array of GRPs maps - per run - old data
AliTPCCorrection class.
Implementation of the TPC pulser calibration.
void sum()
static Float_t GetSkirtVoltage(Int_t run, Int_t sector, Int_t timeStamp=-1, Int_t sigDigits=0)
virtual ~AliTPCcalibDB()
Int_t GetNumDdl() const
Definition: AliTPCmapper.h:103
Bool_t GetTailcancelationGraphs(Int_t sector, TGraphErrors **graphRes, Float_t *indexAmpGraphs)
static Float_t FilterTemperature(AliTPCSensorTempArray *tempArray, Double_t ymin=15, Double_t ymax=22, Double_t sigmaCut=5)
UInt_t GetNPads(UInt_t row) const
Definition: AliTPCCalROC.h:37
TPC cluster error, shape and charge parameterization as function of drift length and inclination angl...
TLinearFitter * GetLinearFitter(Int_t type, Int_t side, UInt_t timeSec)
Bool_t CreateGUITree(const char *filename="")
AliGRPObject * MakeGRPObjectFromMap(TMap *map)
AliTPCSensorTempArray * GetTemperature() const
Float_t fChamberHVmedian[72]
median chamber high voltage
AliTPCCalPad * GetCEQmean() const
AliTPCComposedCorrection class.
static Float_t GetL3Current(Int_t run, Int_t statType=0)
AliTPCCalPad * fDedxGainFactor
Gain calibration entry - for dEdx.
Float_t fCurrentNominalVoltage[72]
current nominal voltages
AliTPCSensorTempArray * fTemperature
Temperature calibration entry.
AliTPCcalibDB & operator=(const AliTPCcalibDB &)
Double_t GetMean(AliTPCCalROC *const outlierROC=0, EPadType padType=kAll) const
AliCTPTimeParams * fCTPTimeParams
CTP timing parameters.
void GetPositionGlobal(UInt_t sector, UInt_t row, UInt_t pad, Float_t *pos)
Definition: AliTPCROC.cxx:432
void UpdateRunInformations(Int_t run, Bool_t force=kFALSE)
static void MakeTree(const char *fileName, TObjArray *array, const char *mapFileName=0, AliTPCCalPad *outlierPad=0, Float_t ltmFraction=0.9)
Int_t fMode
RCU trigger config mode.
TGraph * gr
Definition: CalibTime.C:25
TObjArray * fPulserData
Calibration Pulser data.
const TObjArray * GetCalPadT0() const
Geometry class for a single ROC.
Definition: AliTPCROC.h:14
AliTPCCalPad * GetPulserQmean() const
AliTPCCalPad * GetALTROAcqStop() const
Definition: AliTPCcalibDB.h:89
void SetValue(UInt_t row, UInt_t pad, Float_t vd)
Definition: AliTPCCalROC.h:40
void Add(Float_t c1)
TObjArray * fDistortionMap
distortion map
Int_t GetPadRow(Int_t patch, Int_t hwAddress) const
TObjArray * fCEData
CE data.
AliTPCCalPad * GetCETmean() const
void LoadCorrectionMaps()
AliTPCCalPad * GetPadNoise() const
Definition: AliTPCcalibDB.h:79
AliTPCCalPad * GetPulserTmean() const
static Float_t GetGGnegVoltage(Int_t run, Int_t sector, Int_t timeStamp=-1, Int_t sigDigits=0)
AliTPCCalPad * GetPulserTrms() const
static void RegisterField(Int_t index, AliMagF *magf)
Definition: AliTPCExB.cxx:215
Double_t GetVDriftCorrectionGy(Int_t timeStamp, Int_t run, Int_t side, Int_t mode)
static Float_t GetDCSSensorMeanValue(AliDCSSensorArray *arr, const char *sensorName, Int_t sigDigits=-1)
AliTPCdataQA * fDataQA
qa object
void rec(const char *filename="raw.root")
Definition: rec.C:1
Bool_t IsDataTakingActive(time_t timeStamp)
TObjArray * GetTimeVdriftSplineRun(Int_t run)
AliCDBEntry * GetCDBEntry(const char *cdbPath)
AliTPCClusterParam * fClusterParam
TPC cluster error, shape and Q parameterization.
Int_t GetPatchFromEquipmentID(Int_t equipmentID) const
Int_t GetTpcDdlOffset() const
Definition: AliTPCmapper.h:102
Bool_t fChamberHVStatus[72]
Status of the Chamber, HV wise (on/off)
TPC calibration base class for one ROC.
Definition: AliTPCCalROC.h:20
UInt_t GetCurrentRunNumber() const
const Float_t kSigmaCut
AliTPCParam * fParam
TPC parameters.
AliTPCCalPad * GetNPads() const
Definition: AliTPCdataQA.h:67
const TObjArray * GetCalPadPedestal() const
Int_t fRun
current run number
Float_t GetNominalVoltage(UInt_t i) const
Definition: AliTPCParam.h:379
TObjArray * fALTROConfigData
ALTRO configuration data.
static TObjArray fgExBArray
array of ExB corrections
static TMap * GetGRPMap(Int_t run)
TGraphErrors * GetGainSlopesPT() const
Definition: AliTPCParam.h:346
AliTPCCorrection * GetTPCComposedCorrectionDelta() const
static Float_t GetCoverVoltage(Int_t run, Int_t sector, Int_t timeStamp=-1, Int_t sigDigits=0)
AliTPCCalPad * GetMeanCharge() const
Definition: AliTPCdataQA.h:61
AliSplineFit * GetVdriftSplineFit(const char *name, Int_t run)
TCollection * GetCorrections() const
TGraphErrors * GetGainSlopesHV() const
Definition: AliTPCParam.h:345
static Float_t GetGGposVoltage(Int_t run, Int_t sector, Int_t timeStamp=-1, Int_t sigDigits=0)
UInt_t GetNchannels() const
Definition: AliTPCCalROC.h:34
AliTPCCorrection * GetTPCComposedCorrection() const
Definition: AliTPCcalibDB.h:71
void SetRun(Long64_t run)
static void RegisterExB(Int_t index, Float_t bz, Bool_t bdelete)
AliDCSSensorArray * GetGoofieSensors(Int_t run)
void DumpToFile(const char *fileName)
Long64_t GetRun() const
Definition: AliTPCcalibDB.h:56
static AliGRPObject * GetGRP(Int_t run)
AliTPCExB * fExB
ExB correction factor.
AliTPCCalPad * GetActiveChannelMap() const
Definition: AliTPCcalibDB.h:67
Preprocessor class for HLT and DAQ.
Double_t GetGainCorrectionHVandPT(Int_t timeStamp, Int_t run, Int_t sector, Int_t deltaCache, Int_t mode)
AliTPCCalPad * GetALTROAcqStart() const
Definition: AliTPCcalibDB.h:86
TPC calibration class for parameters which saved per pad.
Int_t grp(UInt_t run, TString &gdc)
Definition: onlineReco.C:70
const TObjArray * GetCalPadQ() const
Definition: AliTPCCalibCE.h:56
AliSplineFit * CreateVdriftSplineFit(const char *graphName, Int_t run)
static Double_t GetVDriftTPCITS(Double_t &dist, Int_t run, Int_t timeStamp)
TGraph * GetCErocTgraph(const Int_t roc) const
AliTPCCalPad * GetNLocalMaxima() const
Definition: AliTPCdataQA.h:62
Int_t GetRocFromEquipmentID(Int_t equipmentID) const
AliTPCCalPad * GetDedxGainFactor() const
Definition: AliTPCcalibDB.h:68
static Double_t GetVDriftTPCLaserTracks(Double_t &dist, Int_t run, Int_t timeStamp, Double_t deltaT=43200, Int_t side=2)
Double_t GetVDriftCorrectionDeltaZ(Int_t timeStamp, Int_t run, Int_t side, Int_t mode)
TObjArray * fCorrectionMaps
RS: new fast Chebyshev parameterization maps.
static AliTPCcalibDB * fgInstance
singleton control
static Bool_t CreateRefFile(Int_t run, const char *filename="")
TMap fVdriftArray
! array of v drift interfaces
Double_t vdrift
Definition: DriftKalman.C:98
static Float_t GetDCSSensorValue(AliDCSSensorArray *arr, Int_t timeStamp, const char *sensorName, Int_t sigDigits=-1)
static Float_t GetCEdriftTime(Int_t run, Int_t sector, Double_t timeStamp=-1., Int_t *entries=0)
static AliTPCROC * Instance()
Definition: AliTPCROC.cxx:34
Implementation of the TPC Central Electrode calibration.
Definition: AliTPCCalibCE.h:29
AliTPCCalibVdrift * GetVdrift(Int_t run)
Class with TPC reconstruction parameters.
AliTPCCalibRaw * fCalibRaw
raw data calibration entry
TArrayI fRunList
! run list - indicates try to get the run param
TObjArray * fRecoParamList
List of TPC reco param objects.
AliTPCAltroMapping ** fMapping
Altro mapping.
Float_t GetZLength(Int_t sector=0) const
Definition: AliTPCParam.h:837
static Bool_t GetTemperatureFit(Int_t timeStamp, Int_t run, Int_t side, TVectorD &fit)
AliTPCCalPad * GetNoThreshold() const
Definition: AliTPCdataQA.h:59
UInt_t GetNSectors() const
Definition: AliTPCROC.h:27
TObjArray * fTimeGainSplines
Array of AliSplineFits: at 0 MIP position in time ; at 1 Fermi Plateau from cosmics.
AliTPCCalPad * GetALTROZsThr() const
Definition: AliTPCcalibDB.h:87
static Float_t GetCEchargeTime(Int_t run, Int_t sector, Double_t timeStamp=-1., Int_t *entries=0)
Double_t GetLTM(Double_t *const sigma=0, Double_t fraction=0.9, AliTPCCalROC *const outlierROC=0, EPadType padType=kAll)
AliTPCCalPad * GetDistortionMap(Int_t i) const
Int_t GetMaxTBin() const
Definition: AliTPCParam.h:370
virtual void Init()
AliTPCCalPad * GetALTROMasked() const
Definition: AliTPCcalibDB.h:90
Double_t GetVDriftCorrectionTime(Int_t timeStamp, Int_t run, Int_t side, Int_t mode)
Abstract class for ExB effect parameterization.
Definition: AliTPCExB.h:10
AliTPCcalibDButil * fDButil
utility class
const TObjArray * GetCalPadQ() const
AliTPCCalPad * GetCETrms() const
AliTPCCalPad * MakeDeadMap(Double_t notInMap=1, const char *nameMappingFile="$ALICE_ROOT/TPC/Calib/tpcMapping.root")
This implementation AliTPCExB is using an aproximate calculation of the ExB effect.
AliTPCRecoParam * GetRecoParam(Int_t i) const
TMap * GetDDLMap() const
Definition: AliTPCcalibDB.h:91
Double_t GetPTRelative(UInt_t absTimeSec, Int_t side)
UInt_t GetNrows() const
Definition: AliTPCCalROC.h:33
AliTPCCalPad * fPedestals
Pedestal calibration entry.
AliTPCSensorTempArray * GetTemperatureSensor(Int_t run)
TMap fGRPArray
! array of GRPs - per run
Implementation of the TPC Raw drift velocity and Altro L1 Phase calibration.
static Double_t GetTriggerOffsetTPC(Int_t run, Int_t timeStamp, Double_t deltaT=86400, Double_t deltaTLaser=3600, Int_t valType=0)