]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliCDBManager.cxx
- Three classes by MinJung Kweon AliHFEpriVtx, AliHFEsecVtx and AliHFEmcQA for primar...
[u/mrichter/AliRoot.git] / STEER / AliCDBManager.cxx
CommitLineData
9e1ceb13 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 **************************************************************************/
fdf65bb5 15//-------------------------------------------------------------------------
16// Implementation of AliCDBManager and AliCDBParam classe
17// Author: Alberto Colla
18// e-mail: Alberto.Colla@cern.ch
19//-------------------------------------------------------------------------
9e1ceb13 20
21#include "AliCDBManager.h"
22#include "AliCDBStorage.h"
23#include "AliLog.h"
24#include "AliCDBDump.h"
25#include "AliCDBLocal.h"
26#include "AliCDBGrid.h"
02c4845e 27#include "AliCDBEntry.h"
28#include "AliCDBMetaData.h"
7de84b33 29#include "AliCDBHandler.h"
9e1ceb13 30
02c4845e 31#include <TObjString.h>
9e1ceb13 32#include <TSystem.h>
7de84b33 33#include <TSAXParser.h>
34#include <TFile.h>
35#include <TUUID.h>
9e1ceb13 36
37ClassImp(AliCDBParam)
38
39ClassImp(AliCDBManager)
40
b8ec52f6 41//TODO OCDB and Reference folder should not be fully hardcoded but built from run number (or year/LHC period)
42TString AliCDBManager::fgkCondUri("alien://folder=/alice/cern.ch/user/a/aliprod/testCDB/CDB?user=aliprod");
43TString AliCDBManager::fgkRefUri("alien://folder=/alice/cern.ch/user/a/aliprod/testCDB/Reference?user=aliprod");
7de84b33 44TString AliCDBManager::fgkMCIdealStorage("alien://folder=/alice/simulation/2008/v4-15-Release/Ideal");
45TString AliCDBManager::fgkMCFullStorage("alien://folder=/alice/simulation/2008/v4-15-Release/Full");
46TString AliCDBManager::fgkMCResidualStorage("alien://folder=/alice/simulation/2008/v4-15-Release/Residual");
47TString AliCDBManager::fgkOCDBFolderXMLfile("alien:///alice/data/OCDBFoldervsRunRange.xml");
9e1ceb13 48AliCDBManager* AliCDBManager::fgInstance = 0x0;
49
50//_____________________________________________________________________________
d1982b43 51AliCDBManager* AliCDBManager::Instance(TMap *entryCache, Int_t run)
b8ec52f6 52{
9e1ceb13 53// returns AliCDBManager instance (singleton)
54
55 if (!fgInstance) {
56 fgInstance = new AliCDBManager();
d1982b43 57 if (!entryCache)
58 fgInstance->Init();
59 else
60 fgInstance->InitFromCache(entryCache,run);
9e1ceb13 61 }
62
63 return fgInstance;
64}
65
66//_____________________________________________________________________________
67void AliCDBManager::Init() {
68// factory registering
69
70 RegisterFactory(new AliCDBDumpFactory());
71 RegisterFactory(new AliCDBLocalFactory());
72 // AliCDBGridFactory is registered only if AliEn libraries are enabled in Root
73 if(!gSystem->Exec("root-config --has-alien |grep yes 2>&1 > /dev/null")){ // returns 0 if yes
74 AliInfo("AliEn classes enabled in Root. AliCDBGrid factory registered.");
75 RegisterFactory(new AliCDBGridFactory());
b8ec52f6 76 fCondParam = CreateParameter(fgkCondUri);
77 fRefParam = CreateParameter(fgkRefUri);
9e1ceb13 78 }
4667c116 79
80 InitShortLived();
9e1ceb13 81}
d1982b43 82
83//_____________________________________________________________________________
84void AliCDBManager::InitFromCache(TMap *entryCache, Int_t run) {
85// initialize manager from existing cache
86// used on the slaves in case of parallel reconstruction
87 SetRun(run);
88
89 TIter iter(entryCache->GetTable());
90 TPair* pair = 0;
91
92 while((pair = dynamic_cast<TPair*> (iter.Next()))){
93 fEntryCache.Add(pair->Key(),pair->Value());
94 }
95 // fEntry is the new owner of the cache
96 fEntryCache.SetOwnerKeyValue(kTRUE,kTRUE);
97 AliInfo(Form("%d cache entries have been loaded",fEntryCache.GetEntries()));
98}
99
9e1ceb13 100//_____________________________________________________________________________
101void AliCDBManager::Destroy() {
102// delete ALCDBManager instance and active storages
103
104 if (fgInstance) {
4b5e0dce 105 //fgInstance->Delete();
9e1ceb13 106 delete fgInstance;
107 fgInstance = 0x0;
108 }
109}
110
111//_____________________________________________________________________________
112AliCDBManager::AliCDBManager():
fe12e09c 113 TObject(),
114 fFactories(),
115 fActiveStorages(),
116 fSpecificStorages(),
b21e3194 117 fEntryCache(),
118 fIds(0),
119 fStorageMap(0),
120 fShortLived(0),
fe12e09c 121 fDefaultStorage(NULL),
122 fDrainStorage(NULL),
b21e3194 123 fCondParam(0),
124 fRefParam(0),
4667c116 125 fRun(-1),
1f341624 126 fCache(kTRUE),
7de84b33 127 fLock(kFALSE),
128 fRaw(kFALSE),
129 fStartRunLHCPeriod(-1),
130 fEndRunLHCPeriod(-1),
131 fLHCPeriod("")
9e1ceb13 132{
133// default constuctor
4b5e0dce 134 fFactories.SetOwner(1);
62032124 135 fActiveStorages.SetOwner(1);
136 fSpecificStorages.SetOwner(1);
d1982b43 137 fEntryCache.SetName("CDBEntryCache");
62032124 138 fEntryCache.SetOwner(1);
b21e3194 139
140 fStorageMap = new TMap();
141 fStorageMap->SetOwner(1);
142 fIds = new TList();
143 fIds->SetOwner(1);
9e1ceb13 144}
145
146//_____________________________________________________________________________
147AliCDBManager::~AliCDBManager() {
148// destructor
4b5e0dce 149 ClearCache();
9e1ceb13 150 DestroyActiveStorages();
62032124 151 fFactories.Delete();
b05400be 152 fDrainStorage = 0x0;
153 fDefaultStorage = 0x0;
b21e3194 154 delete fStorageMap; fStorageMap = 0;
155 delete fIds; fIds = 0;
b8ec52f6 156 delete fCondParam;
157 delete fRefParam;
4667c116 158 delete fShortLived; fShortLived = 0x0;
9e1ceb13 159}
160
9e1ceb13 161//_____________________________________________________________________________
162void AliCDBManager::PutActiveStorage(AliCDBParam* param, AliCDBStorage* storage){
163// put a storage object into the list of active storages
164
165 fActiveStorages.Add(param, storage);
166 AliDebug(1, Form("Active storages: %d", fActiveStorages.GetEntries()));
167}
168
169//_____________________________________________________________________________
170void AliCDBManager::RegisterFactory(AliCDBStorageFactory* factory) {
171// add a storage factory to the list of registerd factories
172
173 if (!fFactories.Contains(factory)) {
174 fFactories.Add(factory);
175 }
176}
177
178//_____________________________________________________________________________
fdf65bb5 179Bool_t AliCDBManager::HasStorage(const char* dbString) const {
b21e3194 180// check if dbString is a URI valid for one of the registered factories
9e1ceb13 181
182 TIter iter(&fFactories);
183
62032124 184 AliCDBStorageFactory* factory=0;
9e1ceb13 185 while ((factory = (AliCDBStorageFactory*) iter.Next())) {
186
187 if (factory->Validate(dbString)) {
188 return kTRUE;
4005d0b5 189 }
9e1ceb13 190 }
191
192 return kFALSE;
193}
194
195//_____________________________________________________________________________
fdf65bb5 196AliCDBParam* AliCDBManager::CreateParameter(const char* dbString) const {
9e1ceb13 197// create AliCDBParam object from URI string
198
199 TIter iter(&fFactories);
7de84b33 200
62032124 201 AliCDBStorageFactory* factory=0;
9e1ceb13 202 while ((factory = (AliCDBStorageFactory*) iter.Next())) {
9e1ceb13 203 AliCDBParam* param = factory->CreateParameter(dbString);
62032124 204 if(param) return param;
9e1ceb13 205 }
206
207 return NULL;
208}
209
210//_____________________________________________________________________________
211AliCDBStorage* AliCDBManager::GetStorage(const char* dbString) {
212// get storage object from URI string
1f341624 213
9e1ceb13 214 AliCDBParam* param = CreateParameter(dbString);
215 if (!param) {
c3a7b59a 216 AliError(Form("Failed to activate requested storage! Check URI: %s", dbString));
9e1ceb13 217 return NULL;
82096dfc 218 }
9e1ceb13 219
220 AliCDBStorage* aStorage = GetStorage(param);
221
222 delete param;
9e1ceb13 223 return aStorage;
224}
225
226//_____________________________________________________________________________
227AliCDBStorage* AliCDBManager::GetStorage(const AliCDBParam* param) {
228// get storage object from AliCDBParam object
1f341624 229
82096dfc 230 // if the list of active storages already contains
9e1ceb13 231 // the requested storage, return it
232 AliCDBStorage* aStorage = GetActiveStorage(param);
233 if (aStorage) {
234 return aStorage;
235 }
236
1f341624 237 // if lock is ON, cannot activate more storages!
238 if(fLock) {
239 if (fDefaultStorage) {
240 AliFatal("Lock is ON, and default storage is already set: "
241 "cannot reset it or activate more storages!");
242 }
243 }
244
9e1ceb13 245 TIter iter(&fFactories);
246
62032124 247 AliCDBStorageFactory* factory=0;
917a098b 248
9e1ceb13 249 // loop on the list of registered factories
250 while ((factory = (AliCDBStorageFactory*) iter.Next())) {
251
252 // each factory tries to create its storage from the parameter
253 aStorage = factory->Create(param);
254 if (aStorage) {
255 PutActiveStorage(param->CloneParam(), aStorage);
917a098b 256 aStorage->SetURI(param->GetURI());
6dc56e97 257 if(fRun >= 0) {
96b7636d 258 if(aStorage->GetType() == "alien"){
259 aStorage->QueryCDB(fRun);
260 } else {
261 AliDebug(2,
262 "Skipping query for valid files, it is used only in grid...");
263 }
c3a7b59a 264 }
9e1ceb13 265 return aStorage;
266 }
267 }
268
c3a7b59a 269 AliError(Form("Failed to activate requested storage! Check URI: %s", param->GetURI().Data()));
270
9e1ceb13 271 return NULL;
272}
273
62032124 274//_____________________________________________________________________________
275AliCDBStorage* AliCDBManager::GetActiveStorage(const AliCDBParam* param) {
276// get a storage object from the list of active storages
277
278 return dynamic_cast<AliCDBStorage*> (fActiveStorages.GetValue(param));
279}
280
9e1ceb13 281//_____________________________________________________________________________
282TList* AliCDBManager::GetActiveStorages() {
283// return list of active storages
62032124 284// user has responsibility to delete returned object
9e1ceb13 285
286 TList* result = new TList();
287
917a098b 288 TIter iter(fActiveStorages.GetTable());
62032124 289 TPair* aPair=0;
9e1ceb13 290 while ((aPair = (TPair*) iter.Next())) {
291 result->Add(aPair->Value());
292 }
293
294 return result;
295}
296
297//_____________________________________________________________________________
298void AliCDBManager::SetDrain(const char* dbString) {
299// set drain storage from URI string
300
301 fDrainStorage = GetStorage(dbString);
302}
303
304//_____________________________________________________________________________
305void AliCDBManager::SetDrain(const AliCDBParam* param) {
306// set drain storage from AliCDBParam
b8ec52f6 307
9e1ceb13 308 fDrainStorage = GetStorage(param);
309}
310
311//_____________________________________________________________________________
312void AliCDBManager::SetDrain(AliCDBStorage* storage) {
313// set drain storage from another active storage
314
315 fDrainStorage = storage;
316}
317
318//_____________________________________________________________________________
319Bool_t AliCDBManager::Drain(AliCDBEntry *entry) {
320// drain retrieved object to drain storage
321
b8ec52f6 322 AliDebug(2, "Draining into drain storage...");
9e1ceb13 323 return fDrainStorage->Put(entry);
324}
325
7de84b33 326//____________________________________________________________________________
9e1ceb13 327void AliCDBManager::SetDefaultStorage(const char* dbString) {
328// sets default storage from URI string
1f341624 329
82096dfc 330 AliInfo(Form("Setting Default storage to: %s",dbString));
4954c5cd 331
7de84b33 332 // checking whether we are in the raw case
333 TString dbStringTemp(dbString);
334 if (dbStringTemp == "raw://") fRaw = kTRUE;
335
336 AliCDBStorage* bckStorage = fDefaultStorage;
337
82096dfc 338 fDefaultStorage = GetStorage(dbString);
95c0e132 339
340 if(!fDefaultStorage) return;
7de84b33 341
4954c5cd 342 if(bckStorage && (fDefaultStorage != bckStorage)){
343 AliWarning("Existing default storage replaced: clearing cache!");
344 ClearCache();
345 }
7de84b33 346
b21e3194 347 if (fStorageMap->Contains("default")) {
348 delete fStorageMap->Remove(fStorageMap->GetValue("default"));
349 }
350 fStorageMap->Add(new TObjString("default"), new TObjString(fDefaultStorage->GetURI()));
9e1ceb13 351}
9e1ceb13 352//_____________________________________________________________________________
353void AliCDBManager::SetDefaultStorage(const AliCDBParam* param) {
354// set default storage from AliCDBParam object
1f341624 355
4954c5cd 356 AliCDBStorage* bckStorage = fDefaultStorage;
357
b8ec52f6 358 fDefaultStorage = GetStorage(param);
4954c5cd 359
95c0e132 360 if(!fDefaultStorage) return;
361
4954c5cd 362 if(bckStorage && (fDefaultStorage != bckStorage)){
363 AliWarning("Existing default storage replaced: clearing cache!");
364 ClearCache();
365 }
b21e3194 366
367 if (fStorageMap->Contains("default")) {
368 delete fStorageMap->Remove(fStorageMap->GetValue("default"));
369 }
370 fStorageMap->Add(new TObjString("default"), new TObjString(fDefaultStorage->GetURI()));
9e1ceb13 371}
372
373//_____________________________________________________________________________
374void AliCDBManager::SetDefaultStorage(AliCDBStorage* storage) {
375// set default storage from another active storage
1f341624 376
377 // if lock is ON, cannot activate more storages!
378 if(fLock) {
379 if (fDefaultStorage) {
380 AliFatal("Lock is ON, and default storage is already set: "
381 "cannot reset it or activate more storages!");
382 }
383 }
384
385 if (!storage) {
386 UnsetDefaultStorage();
387 return;
388 }
389
4954c5cd 390 AliCDBStorage* bckStorage = fDefaultStorage;
391
9e1ceb13 392 fDefaultStorage = storage;
4954c5cd 393
394 if(bckStorage && (fDefaultStorage != bckStorage)){
395 AliWarning("Existing default storage replaced: clearing cache!");
396 ClearCache();
397 }
b21e3194 398
399 if (fStorageMap->Contains("default")) {
400 delete fStorageMap->Remove(fStorageMap->GetValue("default"));
401 }
402 fStorageMap->Add(new TObjString("default"), new TObjString(fDefaultStorage->GetURI()));
9e1ceb13 403}
4667c116 404
7de84b33 405//_____________________________________________________________________________
406void AliCDBManager::SetDefaultStorage(const char* mcString, const char* simType) {
407// sets default storage for MC data
408// mcString MUST be "MC",
409// simType can be "Ideal","Residual","Full"
410
411 TString strmcString(mcString);
412 TString strsimType(simType);
413 TString dbString;
414 if (strmcString != "MC"){
415 AliFatal("Method requires first string to be MC!");
416 }
417 else {
418 if (strsimType == "Ideal"){
419 dbString = fgkMCIdealStorage;
420 }
421 else if (strsimType == "Full"){
422 dbString = fgkMCFullStorage;
423 }
424 else if (strsimType == "Residual"){
425 dbString = fgkMCResidualStorage;
426 }
427 else {
428 AliFatal("Error in setting the storage for MC data, second argument MUST be either \"Ideal\" or \"Full\" or \"Residual\".");
429 }
430
431 SetDefaultStorage(dbString.Data());
432 if(!fDefaultStorage) AliFatal(Form("%s storage not there! Please check!",fLHCPeriod.Data()));
433 }
434}
435//_____________________________________________________________________________
436void AliCDBManager::SetDefaultStorageFromRun(Int_t run) {
437// set default storage from the run number - to be used only with raw data
438
439 // if lock is ON, cannot activate more storages!
440 if(fLock) {
441 if (fDefaultStorage) {
442 AliFatal("Lock is ON, and default storage is already set: "
443 "cannot activate default storage from run number");
444 }
445 }
446
447 // retrieve XML file from alien
448 TUUID uuid;
449 TString rndname = "/tmp/";
450 rndname += "OCDBFolderXML.";
451 rndname += uuid.AsString();
452 rndname += ".xml";
453 AliDebug(2, Form("file to be copied = %s", fgkOCDBFolderXMLfile.Data()));
454 if (!TFile::Cp(fgkOCDBFolderXMLfile.Data(), rndname.Data())) {
455 AliFatal(Form("Cannot make a local copy of OCDBFolder xml file in %s",rndname.Data()));
456 }
457 AliCDBHandler* saxcdb = new AliCDBHandler();
458 saxcdb->SetRun(run);
459 TSAXParser *saxParser = new TSAXParser();
460 saxParser->ConnectToHandler("AliCDBHandler", saxcdb);
461 saxParser->ParseFile(rndname.Data());
462 AliInfo(Form(" LHC folder = %s", saxcdb->GetOCDBFolder().Data()));
463 AliInfo(Form(" LHC period start run = %d", saxcdb->GetStartRunRange()));
464 AliInfo(Form(" LHC period end run = %d", saxcdb->GetEndRunRange()));
465 fLHCPeriod = saxcdb->GetOCDBFolder();
466 fStartRunLHCPeriod = saxcdb->GetStartRunRange();
467 fEndRunLHCPeriod = saxcdb->GetEndRunRange();
468
469 SetDefaultStorage(fLHCPeriod.Data());
470 if(!fDefaultStorage) AliFatal(Form("%s storage not there! Please check!",fLHCPeriod.Data()));
471
472}
473
4667c116 474//_____________________________________________________________________________
1f341624 475void AliCDBManager::UnsetDefaultStorage() {
476// Unset default storage
477
478 // if lock is ON, action is forbidden!
479 if(fLock) {
480 if (fDefaultStorage) {
481 AliFatal("Lock is ON: cannot unset default storage!");
482 }
483 }
484
485 if (fDefaultStorage) {
486 AliWarning("Clearing cache!");
487 ClearCache();
488 }
489
490 fDefaultStorage = 0x0;
4667c116 491}
9e1ceb13 492
02c4845e 493//_____________________________________________________________________________
024cf675 494void AliCDBManager::SetSpecificStorage(const char* calibType, const char* dbString) {
495// sets storage specific for detector or calibration type (works with AliCDBManager::Get(...))
02c4845e 496
497 AliCDBParam *aPar = CreateParameter(dbString);
498 if(!aPar) return;
024cf675 499 SetSpecificStorage(calibType, aPar);
02c4845e 500 delete aPar;
501}
502
503//_____________________________________________________________________________
024cf675 504void AliCDBManager::SetSpecificStorage(const char* calibType, AliCDBParam* param) {
505// sets storage specific for detector or calibration type (works with AliCDBManager::Get(...))
506// Default storage should be defined prior to any specific storages, e.g.:
507// AliCDBManager::instance()->SetDefaultStorage("alien://");
c3a7b59a 508// AliCDBManager::instance()->SetSpecificStorage("TPC/*","local://DB_TPC");
509// AliCDBManager::instance()->SetSpecificStorage("*/Align/*","local://DB_TPCAlign");
510// calibType must be a valid CDB path! (3 level folder structure)
02c4845e 511
7de84b33 512
02c4845e 513 if(!fDefaultStorage) {
c3a7b59a 514 AliError("Please activate a default storage first!");
02c4845e 515 return;
516 }
4005d0b5 517
7de84b33 518
62032124 519 AliCDBPath aPath(calibType);
520 if(!aPath.IsValid()){
521 AliError(Form("Not a valid path: %s", calibType));
522 return;
523 }
524
525 TObjString *objCalibType = new TObjString(aPath.GetPath());
024cf675 526 if(fSpecificStorages.Contains(objCalibType)){
62032124 527 AliWarning(Form("Storage \"%s\" already activated! It will be replaced by the new one",
024cf675 528 calibType));
4005d0b5 529 AliCDBParam *checkPar = dynamic_cast<AliCDBParam*> (fSpecificStorages.GetValue(calibType));
530 if(checkPar) delete checkPar;
8e245d15 531 delete fSpecificStorages.Remove(objCalibType);
02c4845e 532 }
95c0e132 533 AliCDBStorage *aStorage = GetStorage(param);
534 if(!aStorage) return;
96b7636d 535
536 fSpecificStorages.Add(objCalibType, param->CloneParam());
b21e3194 537
538 if(fStorageMap->Contains(objCalibType)){
539 delete fStorageMap->Remove(objCalibType);
540 }
541 fStorageMap->Add(objCalibType->Clone(), new TObjString(param->GetURI()));
542
02c4845e 543}
544
545//_____________________________________________________________________________
024cf675 546AliCDBStorage* AliCDBManager::GetSpecificStorage(const char* calibType) {
547// get storage specific for detector or calibration type
4b5e0dce 548
9c7fb557 549 AliCDBPath calibPath(calibType);
550 if(!calibPath.IsValid()) return NULL;
96b7636d 551
9c7fb557 552 AliCDBParam *checkPar = (AliCDBParam*) fSpecificStorages.GetValue(calibPath.GetPath());
02c4845e 553 if(!checkPar){
b8ec52f6 554 AliError(Form("%s storage not found!", calibType));
02c4845e 555 return NULL;
556 } else {
557 return GetStorage(checkPar);
558 }
96b7636d 559
02c4845e 560}
561
024cf675 562//_____________________________________________________________________________
563AliCDBParam* AliCDBManager::SelectSpecificStorage(const TString& path) {
82096dfc 564// select storage valid for path from the list of specific storages
024cf675 565
62032124 566 AliCDBPath aPath(path);
4005d0b5 567 if(!aPath.IsValid()) return NULL;
62032124 568
024cf675 569 TIter iter(&fSpecificStorages);
62032124 570 TObjString *aCalibType=0;
96b7636d 571 AliCDBPath tmpPath("null/null/null");
024cf675 572 AliCDBParam* aPar=0;
573 while((aCalibType = (TObjString*) iter.Next())){
62032124 574 AliCDBPath calibTypePath(aCalibType->GetName());
575 if(calibTypePath.Comprises(aPath)) {
96b7636d 576 if(calibTypePath.Comprises(tmpPath)) continue;
024cf675 577 aPar = (AliCDBParam*) fSpecificStorages.GetValue(aCalibType);
96b7636d 578 tmpPath.SetPath(calibTypePath.GetPath());
024cf675 579 }
580 }
581 return aPar;
582}
583
02c4845e 584//_____________________________________________________________________________
4667c116 585AliCDBEntry* AliCDBManager::Get(const AliCDBPath& path, Int_t runNumber,
02c4845e 586 Int_t version, Int_t subVersion) {
587// get an AliCDBEntry object from the database
588
024cf675 589 if(runNumber < 0){
590 // RunNumber is not specified. Try with fRun
591 if (fRun < 0){
592 AliError("Run number neither specified in query nor set in AliCDBManager! Use AliCDBManager::SetRun.");
593 return NULL;
594 }
595 runNumber = fRun;
596 }
597
02c4845e 598 return Get(AliCDBId(path, runNumber, runNumber, version, subVersion));
599}
600
601//_____________________________________________________________________________
4667c116 602AliCDBEntry* AliCDBManager::Get(const AliCDBPath& path,
02c4845e 603 const AliCDBRunRange& runRange, Int_t version,
604 Int_t subVersion) {
605// get an AliCDBEntry object from the database!
606
607 return Get(AliCDBId(path, runRange, version, subVersion));
608}
609
610//_____________________________________________________________________________
4667c116 611AliCDBEntry* AliCDBManager::Get(const AliCDBId& query) {
02c4845e 612// get an AliCDBEntry object from the database
613
02c4845e 614 // check if query's path and runRange are valid
615 // query is invalid also if version is not specified and subversion is!
616 if (!query.IsValid()) {
617 AliError(Form("Invalid query: %s", query.ToString().Data()));
618 return NULL;
619 }
024cf675 620
621 // query is not specified if path contains wildcard or run range= [-1,-1]
622 if (!query.IsSpecified()) {
4667c116 623 AliError(Form("Unspecified query: %s",
02c4845e 624 query.ToString().Data()));
625 return NULL;
626 }
627
1f341624 628 if(fLock && query.GetFirstRun() != fRun)
629 AliFatal("Lock is ON: cannot use different run number than the internal one!");
630
631 if(fCache && query.GetFirstRun() != fRun)
024cf675 632 AliWarning("Run number explicitly set in query: CDB cache temporarily disabled!");
633
024cf675 634 AliCDBEntry *entry=0;
8e245d15 635
024cf675 636 // first look into map of cached objects
62032124 637 if(fCache && query.GetFirstRun() == fRun)
024cf675 638 entry = (AliCDBEntry*) fEntryCache.GetValue(query.GetPath());
639
640 if(entry) {
b8ec52f6 641 AliDebug(2, Form("Object %s retrieved from cache !!",query.GetPath().Data()));
024cf675 642 return entry;
643 }
96b7636d 644
d1982b43 645 if(!fDefaultStorage) {
646 AliError("No storage set!");
647 return NULL;
648 }
96b7636d 649 // Entry is not in cache -> retrieve it from CDB and cache it!!
024cf675 650 AliCDBStorage *aStorage=0;
651 AliCDBParam *aPar=SelectSpecificStorage(query.GetPath());
1f341624 652// Bool_t usedDefStorage=kTRUE;
62032124 653
02c4845e 654 if(aPar) {
655 aStorage=GetStorage(aPar);
656 TString str = aPar->GetURI();
657 AliDebug(2,Form("Looking into storage: %s",str.Data()));
1f341624 658// usedDefStorage=kFALSE;
4667c116 659
02c4845e 660 } else {
661 aStorage=GetDefaultStorage();
96b7636d 662 AliDebug(2,"Looking into default storage");
02c4845e 663 }
4667c116 664
024cf675 665 entry = aStorage->Get(query);
024cf675 666
4667c116 667 if(entry && fCache && (query.GetFirstRun() == fRun)){
024cf675 668 CacheEntry(query.GetPath(), entry);
669 }
8e245d15 670
b21e3194 671 if(entry && !fIds->Contains(&entry->GetId())){
672 fIds->Add(entry->GetId().Clone());
673 }
674
675
024cf675 676 return entry;
4667c116 677
678}
679
0f40a831 680//_____________________________________________________________________________
681const char* AliCDBManager::GetURI(const char* path) {
682// return the URI of the storage where to look for path
683
684 if(!IsDefaultStorageSet()) return 0;
685
686 AliCDBParam *aPar=SelectSpecificStorage(path);
687
688 if(aPar) {
689 return aPar->GetURI().Data();
690
691 } else {
692 return GetDefaultStorage()->GetURI().Data();
693 }
694
695 return 0;
696}
697
4667c116 698//_____________________________________________________________________________
699AliCDBId* AliCDBManager::GetId(const AliCDBPath& path, Int_t runNumber,
700 Int_t version, Int_t subVersion) {
701// get the AliCDBId of the valid object from the database (does not retrieve the object)
702// User must delete returned object!
703
704 if(runNumber < 0){
705 // RunNumber is not specified. Try with fRun
706 if (fRun < 0){
707 AliError("Run number neither specified in query nor set in AliCDBManager! Use AliCDBManager::SetRun.");
708 return NULL;
709 }
710 runNumber = fRun;
711 }
712
713 return GetId(AliCDBId(path, runNumber, runNumber, version, subVersion));
714}
715
716//_____________________________________________________________________________
717AliCDBId* AliCDBManager::GetId(const AliCDBPath& path,
718 const AliCDBRunRange& runRange, Int_t version,
719 Int_t subVersion) {
720// get the AliCDBId of the valid object from the database (does not retrieve the object)
721// User must delete returned object!
722
723 return GetId(AliCDBId(path, runRange, version, subVersion));
724}
725
726//_____________________________________________________________________________
727AliCDBId* AliCDBManager::GetId(const AliCDBId& query) {
728// get the AliCDBId of the valid object from the database (does not retrieve the object)
729// User must delete returned object!
730
731 if(!fDefaultStorage) {
732 AliError("No storage set!");
733 return NULL;
734 }
735
736 // check if query's path and runRange are valid
737 // query is invalid also if version is not specified and subversion is!
738 if (!query.IsValid()) {
739 AliError(Form("Invalid query: %s", query.ToString().Data()));
740 return NULL;
741 }
742
743 // query is not specified if path contains wildcard or run range= [-1,-1]
744 if (!query.IsSpecified()) {
745 AliError(Form("Unspecified query: %s",
746 query.ToString().Data()));
747 return NULL;
748 }
749
750 if(fCache && query.GetFirstRun() != fRun)
751 AliWarning("Run number explicitly set in query: CDB cache temporarily disabled!");
752
753 AliCDBEntry* entry = 0;
754
755 // first look into map of cached objects
756 if(fCache && query.GetFirstRun() == fRun)
757 entry = (AliCDBEntry*) fEntryCache.GetValue(query.GetPath());
758
759 if(entry) {
760 AliDebug(2, Form("Object %s retrieved from cache !!",query.GetPath().Data()));
761 return dynamic_cast<AliCDBId*> (entry->GetId().Clone());
762 }
763
764 // Entry is not in cache -> retrieve it from CDB and cache it!!
765 AliCDBStorage *aStorage=0;
766 AliCDBParam *aPar=SelectSpecificStorage(query.GetPath());
767
768 if(aPar) {
769 aStorage=GetStorage(aPar);
770 TString str = aPar->GetURI();
771 AliDebug(2,Form("Looking into storage: %s",str.Data()));
024cf675 772
4667c116 773 } else {
774 aStorage=GetDefaultStorage();
775 AliDebug(2,"Looking into default storage");
776 }
777
778 return aStorage->GetId(query);
779
02c4845e 780}
781
782//_____________________________________________________________________________
62032124 783TList* AliCDBManager::GetAll(const AliCDBPath& path, Int_t runNumber,
02c4845e 784 Int_t version, Int_t subVersion) {
785// get multiple AliCDBEntry objects from the database
786
afd8dbf4 787 if(runNumber < 0){
788 // RunNumber is not specified. Try with fRun
789 if (fRun < 0){
790 AliError("Run number neither specified in query nor set in AliCDBManager! Use AliCDBManager::SetRun.");
791 return NULL;
792 }
793 runNumber = fRun;
794 }
795
02c4845e 796 return GetAll(AliCDBId(path, runNumber, runNumber, version,
797 subVersion));
798}
799
800//_____________________________________________________________________________
8e245d15 801TList* AliCDBManager::GetAll(const AliCDBPath& path,
02c4845e 802 const AliCDBRunRange& runRange, Int_t version, Int_t subVersion) {
803// get multiple AliCDBEntry objects from the database
804
805 return GetAll(AliCDBId(path, runRange, version, subVersion));
806}
807
808//_____________________________________________________________________________
809TList* AliCDBManager::GetAll(const AliCDBId& query) {
810// get multiple AliCDBEntry objects from the database
024cf675 811// Warning: this method works correctly only for queries of the type "Detector/*"
812// and not for more specific queries e.g. "Detector/Calib/*" !
8e245d15 813// Warning #2: Entries are cached, but GetAll will keep on retrieving objects from OCDB!
814// To get an object from cache use Get() function
02c4845e 815
816 if(!fDefaultStorage) {
817 AliError("No storage set!");
818 return NULL;
819 }
820
821 if (!query.IsValid()) {
822 AliError(Form("Invalid query: %s", query.ToString().Data()));
823 return NULL;
824 }
825
afd8dbf4 826 if((fSpecificStorages.GetEntries()>0) && query.GetPath().BeginsWith('*')){
827 // if specific storages are active a query with "*" is ambiguous
828 AliError("Query too generic in this context!");
8e245d15 829 return NULL;
02c4845e 830 }
831
832 if (query.IsAnyRange()) {
833 AliError(Form("Unspecified run or runrange: %s",
8e245d15 834 query.ToString().Data()));
02c4845e 835 return NULL;
8e245d15 836 }
837
1f341624 838 if(fLock && query.GetFirstRun() != fRun)
839 AliFatal("Lock is ON: cannot use different run number than the internal one!");
840
6dc56e97 841 AliCDBParam *aPar=SelectSpecificStorage(query.GetPath());
024cf675 842
8e245d15 843 AliCDBStorage *aStorage;
02c4845e 844 if(aPar) {
845 aStorage=GetStorage(aPar);
96b7636d 846 AliDebug(2,Form("Looking into storage: %s", aPar->GetURI().Data()));
8e245d15 847
02c4845e 848 } else {
849 aStorage=GetDefaultStorage();
8e245d15 850 AliDebug(2,"Looking into default storage");
02c4845e 851 }
852
96b7636d 853 TList *result = 0;
854 if(aStorage) result = aStorage->GetAll(query);
8e245d15 855 if(!result) return 0;
856
96b7636d 857 // loop on result to check whether entries should be re-queried with specific storages
858 if(fSpecificStorages.GetEntries()>0 && ! (fSpecificStorages.GetEntries() == 1 && aPar)) {
859 AliInfo("Now look into all other specific storages...");
860
861 TIter iter(result);
862 AliCDBEntry* chkEntry=0;
863
864 while((chkEntry = dynamic_cast<AliCDBEntry*> (iter.Next()))){
865 AliCDBId& chkId = chkEntry->GetId();
866 AliDebug(2, Form("Checking id %s ", chkId.GetPath().Data()));
867 AliCDBParam *chkPar=SelectSpecificStorage(chkId.GetPath());
868 if (!chkPar || aPar == chkPar) continue;
869 AliCDBStorage *chkStorage = GetStorage(chkPar);
870 AliDebug(2, Form("Found specific storage! %s", chkPar->GetURI().Data()));
871
872 AliCDBEntry *newEntry=0;
873 chkId.SetRunRange(query.GetFirstRun(), query.GetLastRun());
874 chkId.SetVersion(query.GetVersion());
875 chkId.SetSubVersion(query.GetSubVersion());
876
877 if(chkStorage) newEntry = chkStorage->Get(chkId);
878 if(!newEntry) continue;
879
880 // object is found in specific storage: replace entry in the result list!
881 chkEntry->SetOwner(1);
882 delete result->Remove(chkEntry);
883 result->AddFirst(newEntry);
884 }
885
886 Int_t nEntries = result->GetEntries();
887 AliInfo("After look into other specific storages, result list is:");
888 for(int i=0; i<nEntries;i++){
889 AliCDBEntry *entry = (AliCDBEntry*) result->At(i);
890 AliInfo(Form("%s",entry->GetId().ToString().Data()));
891 }
892 }
893
8e245d15 894 // caching entries
b21e3194 895 TIter iter(result);
896 AliCDBEntry* entry=0;
897 while((entry = dynamic_cast<AliCDBEntry*> (iter.Next()))){
02c4845e 898
b21e3194 899 if(!fIds->Contains(&entry->GetId())){
900 fIds->Add(entry->GetId().Clone());
901 }
902 if(fCache && (query.GetFirstRun() == fRun)){
96b7636d 903 CacheEntry(entry->GetId().GetPath(), entry);
8e245d15 904 }
905 }
906
b21e3194 907
8e245d15 908 return result;
02c4845e 909}
910
911//_____________________________________________________________________________
b8ec52f6 912Bool_t AliCDBManager::Put(TObject* object, AliCDBId& id, AliCDBMetaData* metaData, DataType type){
02c4845e 913// store an AliCDBEntry object into the database
914
968cfa08 915 if (object==0x0) {
916 AliError("Null Entry! No storage will be done!");
917 return kFALSE;
918 }
919
02c4845e 920 AliCDBEntry anEntry(object, id, metaData);
b8ec52f6 921 return Put(&anEntry, type);
02c4845e 922
923}
924
925
926//_____________________________________________________________________________
b8ec52f6 927Bool_t AliCDBManager::Put(AliCDBEntry* entry, DataType type){
02c4845e 928// store an AliCDBEntry object into the database
929
b8ec52f6 930 if(type == kPrivate && !fDefaultStorage) {
02c4845e 931 AliError("No storage set!");
932 return kFALSE;
933 }
934
968cfa08 935 if (entry->GetObject()==0x0){
936 AliError("No valid object in CDB entry!");
937 return kFALSE;
938 }
939
02c4845e 940 if (!entry){
941 AliError("No entry!");
942 return kFALSE;
943 }
944
945 if (!entry->GetId().IsValid()) {
946 AliError(Form("Invalid entry ID: %s",
947 entry->GetId().ToString().Data()));
948 return kFALSE;
949 }
950
951 if (!entry->GetId().IsSpecified()) {
952 AliError(Form("Unspecified entry ID: %s",
953 entry->GetId().ToString().Data()));
954 return kFALSE;
955 }
956
957 AliCDBId id = entry->GetId();
024cf675 958 AliCDBParam *aPar = SelectSpecificStorage(id.GetPath());
959
4005d0b5 960 AliCDBStorage *aStorage=0;
02c4845e 961
962 if(aPar) {
963 aStorage=GetStorage(aPar);
02c4845e 964 } else {
b8ec52f6 965 switch(type){
966 case kCondition:
967 aStorage = GetStorage(fCondParam);
968 break;
969 case kReference:
970 aStorage = GetStorage(fRefParam);
971 break;
972 case kPrivate:
973 aStorage = GetDefaultStorage();
974 break;
975 }
02c4845e 976 }
977
b8ec52f6 978 AliDebug(2,Form("Storing object into storage: %s", aStorage->GetURI().Data()));
979
4005d0b5 980 Bool_t result = aStorage->Put(entry, type);
981
982 if(fRun >= 0) QueryCDB();
983
984 return result;
02c4845e 985
986
987}
9e1ceb13 988
4b5e0dce 989//_____________________________________________________________________________
990void AliCDBManager::CacheEntry(const char* path, AliCDBEntry* entry)
991{
992// cache AliCDBEntry. Cache is valid until run number is changed.
993
96b7636d 994 AliCDBEntry *chkEntry = dynamic_cast<AliCDBEntry*> (fEntryCache.GetValue(path));
995
996 if(chkEntry) {
997 AliDebug(2, Form("Object %s already in cache !!", path));
998 return;
999 } else {
1000 AliDebug(2,Form("Caching entry %s", path));
1001 }
1002
4b5e0dce 1003 fEntryCache.Add(new TObjString(path), entry);
96b7636d 1004 AliDebug(2,Form("Cache entries: %d", fEntryCache.GetEntries()));
4b5e0dce 1005
1006}
1007
917a098b 1008//_____________________________________________________________________________
1009void AliCDBManager::Print(Option_t* /*option*/) const
1010{
1011// Print list of active storages and their URIs
917a098b 1012
b8ec52f6 1013 TString output=Form("Run number = %d; ",fRun);
1014 output += "Cache is ";
917a098b 1015 if(!fCache) output += "NOT ";
b8ec52f6 1016 output += Form("ACTIVE; Number of active storages: %d\n",fActiveStorages.GetEntries());
917a098b 1017
1018 if(fDefaultStorage) {
b8ec52f6 1019 output += Form("\t*** Default Storage URI: \"%s\"\n",fDefaultStorage->GetURI().Data());
1020// AliInfo(output.Data());
917a098b 1021 }
1022 if(fSpecificStorages.GetEntries()>0) {
917a098b 1023 TIter iter(fSpecificStorages.GetTable());
62032124 1024 TPair *aPair=0;
b8ec52f6 1025 Int_t i=1;
917a098b 1026 while((aPair = (TPair*) iter.Next())){
b8ec52f6 1027 output += Form("\t*** Specific storage %d: Path \"%s\" -> URI \"%s\"\n",
1028 i++, ((TObjString*) aPair->Key())->GetName(),
917a098b 1029 ((AliCDBParam*) aPair->Value())->GetURI().Data());
917a098b 1030 }
917a098b 1031 }
1032 if(fDrainStorage) {
b8ec52f6 1033 output += Form("*** Drain Storage URI: %s\n",fDrainStorage->GetURI().Data());
917a098b 1034 }
b8ec52f6 1035 AliInfo(output.Data());
917a098b 1036}
1037
4b5e0dce 1038//_____________________________________________________________________________
c3a7b59a 1039void AliCDBManager::SetRun(Int_t run)
4b5e0dce 1040{
917a098b 1041// Sets current run number.
4b5e0dce 1042// When the run number changes the caching is cleared.
1f341624 1043
4b5e0dce 1044 if (fRun == run)
1045 return;
1046
1f341624 1047 if(fLock && fRun >= 0) {
1048 AliFatal("Lock is ON, cannot reset run number!");
1049 }
1050
4b5e0dce 1051 fRun = run;
7de84b33 1052 if (fRaw){
1053 // here the LHCPeriod xml file is parsed; the string containing the correct period is returned; the default storage is set
1054 if (fStartRunLHCPeriod <= run && fEndRunLHCPeriod >= run){
1055 AliInfo("LHCPeriod alien folder for current run already in memory");
1056 }
1057 else {
1058 SetDefaultStorageFromRun(run);
1059 }
1060 }
4b5e0dce 1061 ClearCache();
62032124 1062 QueryCDB();
4b5e0dce 1063}
1064
1065//_____________________________________________________________________________
1066void AliCDBManager::ClearCache(){
1067// clear AliCDBEntry cache
1068
1f341624 1069 AliDebug(2, Form("Cache entries to be deleted: %d",fEntryCache.GetEntries()));
1070
1071 /*
1072 // To clean entries one by one
1073 TIter iter(fEntryCache.GetTable());
1074 TPair* pair=0;
1075 while((pair= dynamic_cast<TPair*> (iter.Next()))){
1076
1077 TObjString* key = dynamic_cast<TObjString*> (pair->Key());
1078 AliCDBEntry* entry = dynamic_cast<AliCDBEntry*> (pair->Value());
1079 AliDebug(2, Form("Deleting entry: %s", key->GetName()));
1080 if (entry) delete entry;
1081 delete fEntryCache.Remove(key);
1082 }
1083 */
4b5e0dce 1084 fEntryCache.DeleteAll();
1f341624 1085 AliDebug(2, Form("After deleting - Cache entries: %d",fEntryCache.GetEntries()));
4b5e0dce 1086}
1087
4005d0b5 1088//_____________________________________________________________________________
1089void AliCDBManager::UnloadFromCache(const char* path){
1090// unload cached object
1091
1092 AliCDBPath queryPath(path);
1093 if(!queryPath.IsValid()) return;
1094
1095 if(!queryPath.IsWildcard()) { // path is not wildcard, get it directly from the cache and unload it!
1096 if(fEntryCache.Contains(path)){
5379c4a3 1097 AliDebug(2, Form("Unloading object \"%s\" from cache", path));
4005d0b5 1098 TObjString pathStr(path);
1099 AliCDBEntry *entry = dynamic_cast<AliCDBEntry*> (fEntryCache.GetValue(&pathStr));
1100 if(entry) delete entry;
1101 delete fEntryCache.Remove(&pathStr);
1102 } else {
1103 AliError(Form("Cache does not contain object \"%s\"!", path))
1104 }
5379c4a3 1105 AliDebug(2, Form("Cache entries: %d",fEntryCache.GetEntries()));
4005d0b5 1106 return;
1107 }
1108
1109 // path is wildcard: loop on the cache and unload all comprised objects!
1110 TIter iter(fEntryCache.GetTable());
1111 TPair* pair = 0;
1112
1113 while((pair = dynamic_cast<TPair*> (iter.Next()))){
1114 AliCDBPath entryPath = pair->Key()->GetName();
1115 if(queryPath.Comprises(entryPath)) {
5379c4a3 1116 AliDebug(2, Form("Unloading object \"%s\" from cache", entryPath.GetPath().Data()));
4005d0b5 1117 TObjString pathStr(entryPath.GetPath().Data());
1118 AliCDBEntry *entry = dynamic_cast<AliCDBEntry*> (fEntryCache.GetValue(&pathStr));
1119 if(entry) delete entry;
1120 delete fEntryCache.Remove(&pathStr);
1121 }
1122 }
1123 AliDebug(2,Form("Cache entries: %d",fEntryCache.GetEntries()));
1124}
1125
9e1ceb13 1126//_____________________________________________________________________________
1127void AliCDBManager::DestroyActiveStorages() {
1128// delete list of active storages
1129
1130 fActiveStorages.DeleteAll();
02c4845e 1131 fSpecificStorages.DeleteAll();
9e1ceb13 1132}
1133
1134//_____________________________________________________________________________
1135void AliCDBManager::DestroyActiveStorage(AliCDBStorage* /*storage*/) {
b05400be 1136// destroys active storage
1137
1138/*
917a098b 1139 TIter iter(fActiveStorages.GetTable());
b05400be 1140 TPair* aPair;
1141 while ((aPair = (TPair*) iter.Next())) {
1142 if(storage == (AliCDBStorage*) aPair->Value())
1143 delete fActiveStorages.Remove(aPair->Key());
1144 storage->Delete(); storage=0x0;
1145 }
6dc56e97 1146*/
9e1ceb13 1147
1148}
1149
62032124 1150//_____________________________________________________________________________
1151void AliCDBManager::QueryCDB() {
1152// query default and specific storages for files valid for fRun. Every storage loads the Ids into its list.
1153
1154 if (fRun < 0){
1155 AliError("Run number not yet set! Use AliCDBManager::SetRun.");
1156 return;
1157 }
6dc56e97 1158 if (!fDefaultStorage){
1159 AliError("Default storage is not set! Use AliCDBManager::SetDefaultStorage");
1160 return;
1161 }
1162 if(fDefaultStorage->GetType() == "alien"){
1163 fDefaultStorage->QueryCDB(fRun);
1164 } else {
1165 AliDebug(2,"Skipping query for valid files, it used only in grid...");
1166 }
62032124 1167
1168 TIter iter(&fSpecificStorages);
1169 TObjString *aCalibType=0;
1170 AliCDBParam* aPar=0;
1171 while((aCalibType = dynamic_cast<TObjString*> (iter.Next()))){
1172 aPar = (AliCDBParam*) fSpecificStorages.GetValue(aCalibType);
1173 if(aPar) {
c3a7b59a 1174 AliDebug(2,Form("Querying specific storage %s",aCalibType->GetName()));
6dc56e97 1175 AliCDBStorage *aStorage = GetStorage(aPar);
1176 if(aStorage->GetType() == "alien"){
1177 aStorage->QueryCDB(fRun,aCalibType->GetName());
1178 } else {
1179 AliDebug(2,
1180 "Skipping query for valid files, it is used only in grid...");
1181 }
62032124 1182 }
1183 }
62032124 1184}
1185
b8ec52f6 1186//______________________________________________________________________________________________
1187const char* AliCDBManager::GetDataTypeName(DataType type)
1188{
1189 // returns the name (string) of the data type
1190
1191 switch (type){
1192 case kCondition: return "Conditions";
1193 case kReference: return "Reference";
1194 case kPrivate: return "Private";
1195 }
1196 return 0;
1197
1198}
62032124 1199
4667c116 1200//______________________________________________________________________________________________
1201void AliCDBManager::InitShortLived()
1202{
1203 // Init the list of short-lived objects
1204 // currently disabled
1205
1206 fShortLived=0x0;
1207
1208// fShortLived = new TList();
1209// fShortLived->SetOwner(1);
1210//
1211// fShortLived->Add(new TObjString("EMCAL/Calib/Data"));
1212//
1213// fShortLived->Add(new TObjString("HMPID/Calib/Nmean"));
1214// fShortLived->Add(new TObjString("HMPID/Calib/Qthre"));
1215//
1216// fShortLived->Add(new TObjString("ITS/Calib/CalibSPD"));
1217//
1218// fShortLived->Add(new TObjString("MUON/Calib/Gains"));
1219// fShortLived->Add(new TObjString("MUON/Calib/HV"));
1220// fShortLived->Add(new TObjString("MUON/Calib/Pedestals"));
1221//
1222// fShortLived->Add(new TObjString("PHOS/Calib/CpvGainPedestals"));
1223// fShortLived->Add(new TObjString("PHOS/Calib/EmcGainPedestals"));
1224//
1225// fShortLived->Add(new TObjString("PMD/Calib/Data"));
1226//
1227// fShortLived->Add(new TObjString("TRD/Calib/ChamberGainFactor"));
1228// fShortLived->Add(new TObjString("TRD/Calib/LocalGainFactor"));
1229// fShortLived->Add(new TObjString("TRD/Calib/ChamberT0"));
1230// fShortLived->Add(new TObjString("TRD/Calib/LocalT0"));
1231// fShortLived->Add(new TObjString("TRD/Calib/ChamberVdrift"));
1232// fShortLived->Add(new TObjString("TRD/Calib/LocalVdrift"));
1233//
1234// fShortLived->Add(new TObjString("ZDC/Calib/Data"));
1235
1236}
1237
1238//______________________________________________________________________________________________
1239Bool_t AliCDBManager::IsShortLived(const char* path)
1240{
1241 // returns the name (string) of the data type
1242
1243 if(!fShortLived) return kFALSE;
1244
1245 AliCDBPath aPath(path);
1246 if(!aPath.IsValid()){
1247 AliError(Form("Not a valid path: %s", path));
1248 return kFALSE;
1249 }
1250
1251 return fShortLived->Contains(path);
1252
1253}
1254
1f341624 1255//______________________________________________________________________________________________
1256void AliCDBManager::SetLock(Bool_t lock){
1257
1258 if(fLock == kTRUE && lock == kFALSE) {
1259 AliFatal("Lock is ON: cannot reset it!");
1260 }
1261
1262 fLock=lock;
1263}
1264
9e1ceb13 1265///////////////////////////////////////////////////////////
1266// AliCDBManager Parameter class //
1267// interface to specific AliCDBParameter class //
1268// (AliCDBGridParam, AliCDBLocalParam, AliCDBDumpParam) //
1269///////////////////////////////////////////////////////////
1270
62032124 1271AliCDBParam::AliCDBParam():
fe12e09c 1272 fType(),
1273 fURI()
62032124 1274{
9e1ceb13 1275// constructor
1276
1277}
1278
1279//_____________________________________________________________________________
1280AliCDBParam::~AliCDBParam() {
1281// destructor
1282
1283}
1284