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()
98 Update(); // temporary
101 //_____________________________________________________________________________
102 AliTPCcalibDB::~AliTPCcalibDB()
108 // don't delete anything, CDB cache is active!
109 //if (fPadGainFactor) delete fPadGainFactor;
110 //if (fPadTime0) delete fPadTime0;
111 //if (fPadPRFWidth) delete fPadPRFWidth;
112 //if (fPadNoise) delete fPadNoise;
116 //_____________________________________________________________________________
117 AliCDBEntry* AliTPCcalibDB::GetCDBEntry(const char* cdbPath)
120 // Retrieves an entry with path <cdbPath> from the CDB.
124 AliCDBEntry* entry = AliCDBManager::Instance()->Get(cdbPath, fRun);
127 sprintf(chinfo,"AliTPCcalibDB: Failed to get entry:\t%s ", cdbPath);
135 //_____________________________________________________________________________
136 void AliTPCcalibDB::SetRun(Long64_t run)
139 // Sets current run number. Calibration data is read from the corresponding file.
149 void AliTPCcalibDB::Update(){
151 AliCDBEntry * entry=0;
153 Bool_t cdbCache = AliCDBManager::Instance()->GetCacheFlag(); // save cache status
154 AliCDBManager::Instance()->SetCacheFlag(kTRUE); // activate CDB cache
157 entry = GetCDBEntry("TPC/Calib/PadGainFactor");
159 //if (fPadGainFactor) delete fPadGainFactor;
160 entry->SetOwner(kTRUE);
161 fPadGainFactor = (AliTPCCalPad*)entry->GetObject();
164 entry = GetCDBEntry("TPC/Calib/PadTime0");
166 //if (fPadTime0) delete fPadTime0;
167 entry->SetOwner(kTRUE);
168 fPadTime0 = (AliTPCCalPad*)entry->GetObject();
171 entry = GetCDBEntry("TPC/Calib/PadPRF");
173 //if (fPadPRFWidth) delete fPadPRFWidth;
174 entry->SetOwner(kTRUE);
175 fPadPRFWidth = (AliTPCCalPad*)entry->GetObject();
178 entry = GetCDBEntry("TPC/Calib/PadNoise");
180 //if (fPadNoise) delete fPadNoise;
181 entry->SetOwner(kTRUE);
182 fPadNoise = (AliTPCCalPad*)entry->GetObject();
185 entry = GetCDBEntry("TPC/Calib/Pedestals");
187 //if (fPedestals) delete fPedestals;
188 entry->SetOwner(kTRUE);
189 fPedestals = (AliTPCCalPad*)entry->GetObject();
192 entry = GetCDBEntry("TPC/Calib/Temperature");
194 //if (fTemperature) delete fTemperature;
195 entry->SetOwner(kTRUE);
196 fTemperature = (AliTPCSensorTempArray*)entry->GetObject();
199 entry = GetCDBEntry("TPC/Calib/Parameters");
201 //if (fPadNoise) delete fPadNoise;
202 entry->SetOwner(kTRUE);
203 fParam = (AliTPCParam*)(entry->GetObject()->Clone());
208 AliCDBManager::Instance()->SetCacheFlag(cdbCache); // reset original CDB cache