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"
39 ClassImp(AliTPCcalibDB)
41 AliTPCcalibDB* AliTPCcalibDB::fgInstance = 0;
42 Bool_t AliTPCcalibDB::fgTerminated = kFALSE;
45 //_ singleton implementation __________________________________________________
46 AliTPCcalibDB* AliTPCcalibDB::Instance()
49 // Singleton implementation
50 // Returns an instance of this class, it is created if neccessary
53 if (fgTerminated != kFALSE)
57 fgInstance = new AliTPCcalibDB();
62 void AliTPCcalibDB::Terminate()
65 // Singleton implementation
66 // Deletes the instance of this class and sets the terminated flag, instances cannot be requested anymore
67 // This function can be called several times.
79 //_____________________________________________________________________________
80 AliTPCcalibDB::AliTPCcalibDB()
96 Update(); // temporary
99 //_____________________________________________________________________________
100 AliTPCcalibDB::~AliTPCcalibDB()
106 // don't delete anything, CDB cache is active!
107 //if (fPadGainFactor) delete fPadGainFactor;
108 //if (fPadTime0) delete fPadTime0;
109 //if (fPadPRFWidth) delete fPadPRFWidth;
110 //if (fPadNoise) delete fPadNoise;
114 //_____________________________________________________________________________
115 AliCDBEntry* AliTPCcalibDB::GetCDBEntry(const char* cdbPath)
118 // Retrieves an entry with path <cdbPath> from the CDB.
122 AliCDBEntry* entry = AliCDBManager::Instance()->Get(cdbPath, fRun);
125 sprintf(chinfo,"AliTPCcalibDB: Failed to get entry:\t%s ", cdbPath);
133 //_____________________________________________________________________________
134 void AliTPCcalibDB::SetRun(Long64_t run)
137 // Sets current run number. Calibration data is read from the corresponding file.
147 void AliTPCcalibDB::Update(){
149 AliCDBEntry * entry=0;
151 Bool_t cdbCache = AliCDBManager::Instance()->GetCacheFlag(); // save cache status
152 AliCDBManager::Instance()->SetCacheFlag(kTRUE); // activate CDB cache
155 entry = GetCDBEntry("TPC/Calib/PadGainFactor");
157 //if (fPadGainFactor) delete fPadGainFactor;
158 entry->SetOwner(kTRUE);
159 fPadGainFactor = (AliTPCCalPad*)entry->GetObject();
162 entry = GetCDBEntry("TPC/Calib/PadTime0");
164 //if (fPadTime0) delete fPadTime0;
165 entry->SetOwner(kTRUE);
166 fPadTime0 = (AliTPCCalPad*)entry->GetObject();
169 entry = GetCDBEntry("TPC/Calib/PadPRF");
171 //if (fPadPRFWidth) delete fPadPRFWidth;
172 entry->SetOwner(kTRUE);
173 fPadPRFWidth = (AliTPCCalPad*)entry->GetObject();
176 entry = GetCDBEntry("TPC/Calib/PadNoise");
178 //if (fPadNoise) delete fPadNoise;
179 entry->SetOwner(kTRUE);
180 fPadNoise = (AliTPCCalPad*)entry->GetObject();
183 entry = GetCDBEntry("TPC/Calib/Pedestals");
185 //if (fPedestals) delete fPedestals;
186 entry->SetOwner(kTRUE);
187 fPedestals = (AliTPCCalPad*)entry->GetObject();
190 entry = GetCDBEntry("TPC/Calib/Parameters");
192 //if (fPadNoise) delete fPadNoise;
193 entry->SetOwner(kTRUE);
194 fParam = (AliTPCParam*)entry->GetObject();
199 AliCDBManager::Instance()->SetCacheFlag(cdbCache); // reset original CDB cache