1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 ///////////////////////////////////////////////////////////////////////////////
19 // Class providing the calibration parameters by accessing the CDB //
21 // Request an instance with AliTPCcalibDB::Instance() //
22 // If a new event is processed set the event number with SetRun //
23 // Then request the calibration data //
25 ///////////////////////////////////////////////////////////////////////////////
28 #include <AliCDBManager.h>
29 #include <AliCDBStorage.h>
30 #include <AliCDBEntry.h>
33 #include "AliTPCcalibDB.h"
35 #include "AliTPCCalROC.h"
36 #include "AliTPCCalPad.h"
37 #include "AliTPCCalDet.h"
38 #include "AliTPCSensorTempArray.h"
40 ClassImp(AliTPCcalibDB)
42 AliTPCcalibDB* AliTPCcalibDB::fgInstance = 0;
43 Bool_t AliTPCcalibDB::fgTerminated = kFALSE;
46 //_ singleton implementation __________________________________________________
47 AliTPCcalibDB* AliTPCcalibDB::Instance()
50 // Singleton implementation
51 // Returns an instance of this class, it is created if neccessary
54 if (fgTerminated != kFALSE)
58 fgInstance = new AliTPCcalibDB();
63 void AliTPCcalibDB::Terminate()
66 // Singleton implementation
67 // Deletes the instance of this class and sets the terminated flag, instances cannot be requested anymore
68 // This function can be called several times.
80 //_____________________________________________________________________________
81 AliTPCcalibDB::AliTPCcalibDB():
97 Update(); // temporary
100 //_____________________________________________________________________________
101 AliTPCcalibDB::~AliTPCcalibDB()
107 // don't delete anything, CDB cache is active!
108 //if (fPadGainFactor) delete fPadGainFactor;
109 //if (fPadTime0) delete fPadTime0;
110 //if (fPadPRFWidth) delete fPadPRFWidth;
111 //if (fPadNoise) delete fPadNoise;
115 //_____________________________________________________________________________
116 AliCDBEntry* AliTPCcalibDB::GetCDBEntry(const char* cdbPath)
119 // Retrieves an entry with path <cdbPath> from the CDB.
123 AliCDBEntry* entry = AliCDBManager::Instance()->Get(cdbPath, fRun);
126 sprintf(chinfo,"AliTPCcalibDB: Failed to get entry:\t%s ", cdbPath);
134 //_____________________________________________________________________________
135 void AliTPCcalibDB::SetRun(Long64_t run)
138 // Sets current run number. Calibration data is read from the corresponding file.
148 void AliTPCcalibDB::Update(){
150 AliCDBEntry * entry=0;
152 Bool_t cdbCache = AliCDBManager::Instance()->GetCacheFlag(); // save cache status
153 AliCDBManager::Instance()->SetCacheFlag(kTRUE); // activate CDB cache
156 entry = GetCDBEntry("TPC/Calib/PadGainFactor");
158 //if (fPadGainFactor) delete fPadGainFactor;
159 entry->SetOwner(kTRUE);
160 fPadGainFactor = (AliTPCCalPad*)entry->GetObject();
163 entry = GetCDBEntry("TPC/Calib/PadTime0");
165 //if (fPadTime0) delete fPadTime0;
166 entry->SetOwner(kTRUE);
167 fPadTime0 = (AliTPCCalPad*)entry->GetObject();
170 entry = GetCDBEntry("TPC/Calib/PadPRF");
172 //if (fPadPRFWidth) delete fPadPRFWidth;
173 entry->SetOwner(kTRUE);
174 fPadPRFWidth = (AliTPCCalPad*)entry->GetObject();
177 entry = GetCDBEntry("TPC/Calib/PadNoise");
179 //if (fPadNoise) delete fPadNoise;
180 entry->SetOwner(kTRUE);
181 fPadNoise = (AliTPCCalPad*)entry->GetObject();
184 entry = GetCDBEntry("TPC/Calib/Pedestals");
186 //if (fPedestals) delete fPedestals;
187 entry->SetOwner(kTRUE);
188 fPedestals = (AliTPCCalPad*)entry->GetObject();
191 entry = GetCDBEntry("TPC/Calib/Temperature");
193 //if (fTemperature) delete fTemperature;
194 entry->SetOwner(kTRUE);
195 fTemperature = (AliTPCSensorTempArray*)entry->GetObject();
198 entry = GetCDBEntry("TPC/Calib/Pressure");
200 //if (fPressure) delete fPressure;
201 entry->SetOwner(kTRUE);
202 fPressure = (AliTPCSensorPressureArray*)entry->GetObject();
206 entry = GetCDBEntry("TPC/Calib/Parameters");
208 //if (fPadNoise) delete fPadNoise;
209 entry->SetOwner(kTRUE);
210 fParam = (AliTPCParam*)(entry->GetObject()->Clone());
215 AliCDBManager::Instance()->SetCacheFlag(cdbCache); // reset original CDB cache
218 AliTPCcalibDB::AliTPCcalibDB(const AliTPCcalibDB& org)
221 // Copy constructor invalid -- singleton implementation
223 Error("copy constructor","invalid -- singleton implementation");
226 AliTPCcalibDB& AliTPCcalibDB::operator= (const AliTPCcalibDB& rhs)
229 // Singleton implementation - no assignment operator
231 Error("operator =", "assignment operator not implemented");