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()
94 Update(); // temporary
97 //_____________________________________________________________________________
98 AliTPCcalibDB::~AliTPCcalibDB()
104 // don't delete anything, CDB cache is active!
105 //if (fPadGainFactor) delete fPadGainFactor;
106 //if (fPadTime0) delete fPadTime0;
107 //if (fPadPRFWidth) delete fPadPRFWidth;
108 //if (fPadNoise) delete fPadNoise;
112 //_____________________________________________________________________________
113 AliCDBEntry* AliTPCcalibDB::GetCDBEntry(const char* cdbPath)
116 // Retrieves an entry with path <cdbPath> from the CDB.
120 AliCDBEntry* entry = AliCDBManager::Instance()->Get(cdbPath, fRun);
123 sprintf(chinfo,"AliTPCcalibDB: Failed to get entry:\t%s ", cdbPath);
131 //_____________________________________________________________________________
132 void AliTPCcalibDB::SetRun(Long64_t run)
135 // Sets current run number. Calibration data is read from the corresponding file.
145 void AliTPCcalibDB::Update(){
147 AliCDBEntry * entry=0;
149 Bool_t cdbCache = AliCDBManager::Instance()->GetCacheFlag(); // save cache status
150 AliCDBManager::Instance()->SetCacheFlag(kTRUE); // activate CDB cache
153 entry = GetCDBEntry("TPC/Calib/PadGainFactor");
155 //if (fPadGainFactor) delete fPadGainFactor;
156 entry->SetOwner(kTRUE);
157 fPadGainFactor = (AliTPCCalPad*)entry->GetObject();
160 entry = GetCDBEntry("TPC/Calib/PadTime0");
162 //if (fPadTime0) delete fPadTime0;
163 entry->SetOwner(kTRUE);
164 fPadTime0 = (AliTPCCalPad*)entry->GetObject();
167 entry = GetCDBEntry("TPC/Calib/PadPRF");
169 //if (fPadPRFWidth) delete fPadPRFWidth;
170 entry->SetOwner(kTRUE);
171 fPadPRFWidth = (AliTPCCalPad*)entry->GetObject();
174 entry = GetCDBEntry("TPC/Calib/PadNoise");
176 //if (fPadNoise) delete fPadNoise;
177 entry->SetOwner(kTRUE);
178 fPadNoise = (AliTPCCalPad*)entry->GetObject();
181 AliCDBManager::Instance()->SetCacheFlag(cdbCache); // reset original CDB cache