From c3a7b59ad78b88072feaab8b40e071ae84bad21d Mon Sep 17 00:00:00 2001 From: hristov Date: Mon, 18 Sep 2006 16:36:53 +0000 Subject: [PATCH] Updated version of the CDB classes. Bug fix in AliCDBGrid. New AliCDBStorage function needed by SHUTTLE (Alberto) --- STEER/AliCDBDump.cxx | 51 ++++++++- STEER/AliCDBDump.h | 3 + STEER/AliCDBGrid.cxx | 146 +++++++++++++++--------- STEER/AliCDBGrid.h | 16 +-- STEER/AliCDBId.cxx | 20 +--- STEER/AliCDBLocal.cxx | 218 +++++++++++++++++++++++++----------- STEER/AliCDBLocal.h | 11 +- STEER/AliCDBManager.cxx | 19 +++- STEER/AliCDBManager.h | 6 +- STEER/AliCDBMetaData.cxx | 23 +++- STEER/AliCDBMetaData.h | 1 + STEER/AliCDBRunRange.h | 4 +- STEER/AliCDBStorage.cxx | 31 +++-- STEER/AliCDBStorage.h | 10 +- STEER/AliReconstruction.cxx | 53 +++++++-- STEER/AliReconstruction.h | 2 +- STEER/AliSimulation.cxx | 14 ++- STEER/AliSimulation.h | 2 +- 18 files changed, 432 insertions(+), 198 deletions(-) diff --git a/STEER/AliCDBDump.cxx b/STEER/AliCDBDump.cxx index 6e221d5d47e..d40bb51f981 100644 --- a/STEER/AliCDBDump.cxx +++ b/STEER/AliCDBDump.cxx @@ -545,7 +545,7 @@ Bool_t AliCDBDump::PutEntry(AliCDBEntry* entry) { // write object (key name: Run#firstRun_#lastRun_v#version_s#subVersion) Bool_t result = gDirectory->WriteTObject(entry, keyname); if (!result) { - AliError(Form("Can't write entry to file: %s", + AliError(Form("Can't write entry to file: %s", fFile->GetName())); } @@ -606,7 +606,54 @@ Bool_t AliCDBDump::Contains(const char* path) const{ //_____________________________________________________________________________ void AliCDBDump::QueryValidFiles() { -// blabla +// Query the CDB for files valid for AliCDBStorage::fRun +// fills list fValidFileIds with AliCDBId objects created from file name + + AliError("Not yet (and maybe never) implemented"); +} + +//_____________________________________________________________________________ +Bool_t AliCDBDump::IdToFilename(const AliCDBId& /*id*/, TString& /*filename*/) const { +// build file name from AliCDBId (path, run range, version) and fDBFolder + + AliError("Not implemented"); + return kFALSE; +} + +//_____________________________________________________________________________ +Int_t AliCDBDump::GetLatestVersion(const char* path, Int_t run){ +// get last version found in the database valid for run and path + + AliCDBPath aCDBPath(path); + if(!aCDBPath.IsValid() || aCDBPath.IsWildcard()) { + AliError(Form("Invalid path in request: %s", path)); + return -1; + } + + AliCDBId query(path, run, run, -1, -1); + AliCDBId dataId; + + GetId(query,dataId); + + return dataId.GetVersion(); +} + +//_____________________________________________________________________________ +Int_t AliCDBDump::GetLatestSubVersion(const char* path, Int_t run, Int_t version){ +// get last version found in the database valid for run and path + + AliCDBPath aCDBPath(path); + if(!aCDBPath.IsValid() || aCDBPath.IsWildcard()) { + AliError(Form("Invalid path in request: %s", path)); + return -1; + } + + AliCDBId query(path, run, run, version, -1); + AliCDBId dataId; + + GetId(query,dataId); + + return dataId.GetSubVersion(); } diff --git a/STEER/AliCDBDump.h b/STEER/AliCDBDump.h index ca5a7cc96b6..c8b33694f9f 100644 --- a/STEER/AliCDBDump.h +++ b/STEER/AliCDBDump.h @@ -25,6 +25,9 @@ public: virtual Bool_t IsReadOnly() const {return fReadOnly;}; virtual Bool_t HasSubVersion() const {return kFALSE;}; virtual Bool_t Contains(const char* path) const; + virtual Int_t GetLatestVersion(const char* path, Int_t run); + virtual Int_t GetLatestSubVersion(const char* path, Int_t run, Int_t version=-1); + virtual Bool_t IdToFilename(const AliCDBId& id, TString& filename) const; protected: diff --git a/STEER/AliCDBGrid.cxx b/STEER/AliCDBGrid.cxx index fc8fd411111..8aea7878243 100644 --- a/STEER/AliCDBGrid.cxx +++ b/STEER/AliCDBGrid.cxx @@ -139,7 +139,7 @@ Bool_t AliCDBGrid::FilenameToId(TString& filename, AliCDBId& id) { } //_____________________________________________________________________________ -Bool_t AliCDBGrid::IdToFilename(const AliCDBId& id, TString& filename) { +Bool_t AliCDBGrid::IdToFilename(const AliCDBId& id, TString& filename) const { // build file name from AliCDBId (path, run range, version) and fDBFolder if (!id.GetAliCDBRunRange().IsValid()) { @@ -244,7 +244,6 @@ AliCDBId* AliCDBGrid::GetId(const TList& validFileIds, const AliCDBId& query) { AliCDBId* result=0; while((anIdPtr = dynamic_cast (iter.Next()))){ - if(anIdPtr->GetPath() != query.GetPath()) continue; //if(!CheckVersion(query, anIdPtr, result)) return NULL; @@ -273,41 +272,6 @@ AliCDBId* AliCDBGrid::GetId(const TList& validFileIds, const AliCDBId& query) { return result; } -/* TODO remove -//_____________________________________________________________________________ -Bool_t AliCDBGrid::CheckVersion(const AliCDBId& query, AliCDBId* idToCheck, AliCDBId* result){ -// Check if idToCheck has the "right" requested version and return it in result - - if (!result) { - result = idToCheck; - AliInfo(Form("all'inizio: result = %s", result->ToString().Data())); - return kTRUE; - } - - AliInfo(Form("result = %s", result->ToString().Data())); - - if (!query.HasVersion()){ // look for highest version - if(result->GetVersion() > idToCheck->GetVersion()) return kTRUE; - if(result->GetVersion() == idToCheck->GetVersion()) { - AliDebug(2,Form("More than one object valid for run %d, version %d!", - query.GetFirstRun(), idToCheck->GetVersion())); - return kFALSE; - } - - } else { // look for specified version - if(query.GetVersion() != idToCheck->GetVersion()) return kTRUE; - if(result->GetVersion() == idToCheck->GetVersion()){ - AliDebug(2,Form("More than one object valid for run %d, version %d!", - query.GetFirstRun(), idToCheck->GetVersion())); - return kFALSE; - } - } - result = idToCheck; - AliInfo(Form("alla fine: result = %s", result->ToString().Data())); - return kTRUE; -} -*/ - //_____________________________________________________________________________ AliCDBEntry* AliCDBGrid::GetEntry(const AliCDBId& queryId) { // get AliCDBEntry from the database @@ -325,7 +289,7 @@ AliCDBEntry* AliCDBGrid::GetEntry(const AliCDBId& queryId) { // look for file matching query requests (path, runRange, version) if(selectedId.GetFirstRun() == fRun && - fPathFilter.Comprises(selectedId.GetAliCDBPath()) && fVersion < 0){ + fPathFilter.Comprises(selectedId.GetAliCDBPath()) && fVersion < 0 && !fMetaDataFilter){ // look into list of valid files previously loaded with AliCDBStorage::FillValidFileIds() AliDebug(2, Form("List of files valid for run %d and for path %s was loaded. Looking there!", selectedId.GetFirstRun(), selectedId.GetPath().Data())); @@ -344,6 +308,7 @@ AliCDBEntry* AliCDBGrid::GetEntry(const AliCDBId& queryId) { AliCDBId validFileId; for(int i=0; iGetEntries(); i++){ TString filename = res->GetKey(i, "lfn"); + if(filename == "") continue; if(FilenameToId(filename, validFileId)) validFileIds.AddLast(validFileId.Clone()); } @@ -424,7 +389,7 @@ TList* AliCDBGrid::GetEntries(const AliCDBId& queryId) { // look for file matching query requests (path, runRange) if(queryId.GetFirstRun() == fRun && - fPathFilter.Comprises(queryId.GetAliCDBPath()) && fVersion < 0){ + fPathFilter.Comprises(queryId.GetAliCDBPath()) && fVersion < 0 && !fMetaDataFilter){ // look into list of valid files previously loaded with AliCDBStorage::FillValidFileIds() AliDebug(2,Form("List of files valid for run %d and for path %s was loaded. Looking there!", queryId.GetFirstRun(), queryId.GetPath().Data())); @@ -444,6 +409,7 @@ TList* AliCDBGrid::GetEntries(const AliCDBId& queryId) { AliCDBId validFileId; for(int i=0; iGetEntries(); i++){ TString filename = res->GetKey(i, "lfn"); + if(filename == "") continue; if(FilenameToId(filename, validFileId)) validFileIds.AddLast(validFileId.Clone()); } @@ -528,8 +494,8 @@ Bool_t AliCDBGrid::PutEntry(AliCDBEntry* entry) { // add CDB and CDB_MD tag to folder // TODO how to check that folder has already tags? - Bool_t tagCDB = AddTag(folderToTag,"CDB"); - Bool_t tagCDBmd = AddTag(folderToTag,"CDB_MD"); + AddTag(folderToTag,"CDB"); + AddTag(folderToTag,"CDB_MD"); TDirectory* saveDir = gDirectory; @@ -555,12 +521,19 @@ Bool_t AliCDBGrid::PutEntry(AliCDBEntry* entry) { if (saveDir) saveDir->cd(); else gROOT->cd(); file->Close(); delete file; file=0; + if(result) { AliInfo(Form("CDB object stored into file %s", filename.Data())); AliInfo(Form("using S.E. %s", fSE.Data())); - if(tagCDB) TagFileId(filename, &id); - if(tagCDBmd) TagFileMetaData(filename, entry->GetMetaData()); + if(!TagFileId(filename, &id)){ + AliInfo(Form("CDB tagging failed. Deleting file %s!",filename.Data())); + if(!gGrid->Rm(filename.Data())) + AliError("Can't delete file!"); + return kFALSE; + } + + TagFileMetaData(filename, entry->GetMetaData()); } return result; @@ -584,7 +557,7 @@ Bool_t AliCDBGrid::AddTag(TString& folderToTag, const char* tagname){ } //_____________________________________________________________________________ -void AliCDBGrid::TagFileId(TString& filename, const AliCDBId* id){ +Bool_t AliCDBGrid::TagFileId(TString& filename, const AliCDBId* id){ // tag stored object in CDB table using object Id's parameters TString addTagValue_1 = Form("addTagValue %s CDB ", filename.Data()); @@ -601,22 +574,25 @@ void AliCDBGrid::TagFileId(TString& filename, const AliCDBId* id){ addTagValue_2.Data(), addTagValue_3.Data()); + Bool_t result = kFALSE; AliDebug(2, Form("Tagging file. Tag command: %s", addTagValue.Data())); TGridResult* res = gGrid->Command(addTagValue.Data()); const char* resCode = res->GetKey(0,"__result__"); // '1' if success if(resCode[0] != '1') { - AliWarning(Form("Couldn't add CDB tag value to file %s !", + AliError(Form("Couldn't add CDB tag value to file %s !", filename.Data())); + result = kFALSE; } else { AliInfo("Object successfully tagged."); + result = kTRUE; } delete res; - + return result; } //_____________________________________________________________________________ -void AliCDBGrid::TagFileMetaData(TString& filename, const AliCDBMetaData* md){ +Bool_t AliCDBGrid::TagFileMetaData(TString& filename, const AliCDBMetaData* md){ // tag stored object in CDB table using object Id's parameters TString addTagValue_1 = Form("addTagValue %s CDB_MD ", filename.Data()); @@ -632,16 +608,19 @@ void AliCDBGrid::TagFileMetaData(TString& filename, const AliCDBMetaData* md){ addTagValue_2.Data(), addTagValue_3.Data()); + Bool_t result = kFALSE; AliDebug(2, Form("Tagging file. Tag command: %s", addTagValue.Data())); TGridResult* res = gGrid->Command(addTagValue.Data()); const char* resCode = res->GetKey(0,"__result__"); // '1' if success if(resCode[0] != '1') { AliWarning(Form("Couldn't add CDB_MD tag value to file %s !", filename.Data())); + result = kFALSE; } else { AliInfo("Object successfully tagged."); + result = kTRUE; } - + return result; } //_____________________________________________________________________________ @@ -704,6 +683,7 @@ void AliCDBGrid::QueryValidFiles() AliCDBId validFileId; for(int i=0; iGetEntries(); i++){ TString filename = res->GetKey(i, "lfn"); + if(filename == "") continue; AliDebug(2,Form("Found valid file: %s", filename.Data())); Bool_t result = FilenameToId(filename, validFileId); if(result) { @@ -715,13 +695,13 @@ void AliCDBGrid::QueryValidFiles() } //_____________________________________________________________________________ -void AliCDBGrid::MakeQueryFilter(Long64_t firstRun, Long64_t lastRun, +void AliCDBGrid::MakeQueryFilter(Int_t firstRun, Int_t lastRun, const AliCDBPath& pathFilter, Int_t version, const AliCDBMetaData* md, TString& result) const { // create filter for file query - result = Form("CDB:first_run<=%ld and CDB:last_run>=%ld", (long) firstRun, (long) lastRun); + result = Form("CDB:first_run<=%d and CDB:last_run>=%d", firstRun, lastRun); if(version >= 0) { result += Form(" and CDB:version=%d", version); @@ -757,6 +737,64 @@ void AliCDBGrid::MakeQueryFilter(Long64_t firstRun, Long64_t lastRun, } +//_____________________________________________________________________________ +Int_t AliCDBGrid::GetLatestVersion(const char* path, Int_t run){ +// get last version found in the database valid for run and path + + TList validFileIds; + validFileIds.SetOwner(1); + + AliCDBPath aCDBPath(path); + if(!aCDBPath.IsValid() || aCDBPath.IsWildcard()) { + AliError(Form("Invalid path in request: %s", path)); + return -1; + } + AliCDBId query(path, run, run, -1, -1); + AliCDBId* dataId = 0; + + // look for file matching query requests (path, runRange, version) + if(run == fRun && + fPathFilter.Comprises(aCDBPath) && fVersion < 0){ + // look into list of valid files previously loaded with AliCDBStorage::FillValidFileIds() + AliDebug(2, Form("List of files valid for run %d and for path %s was loaded. Looking there!", + run, path)); + dataId = GetId(fValidFileIds, query); + if (!dataId) return -1; + return dataId->GetVersion(); + + } + // List of files valid for reqested run was not loaded. Looking directly into CDB + AliDebug(2, Form("List of files valid for run %d and for path %s was not loaded. Looking directly into CDB!", + run, path)); + + TString filter; + MakeQueryFilter(run, run, aCDBPath, -1, 0, filter); + + TGridResult *res = gGrid->Query(fDBFolder, "Run*.root", filter, ""); + AliCDBId validFileId; + for(int i=0; iGetEntries(); i++){ + TString filename = res->GetKey(i, "lfn"); + if(filename == "") continue; + if(FilenameToId(filename, validFileId)) + validFileIds.AddLast(validFileId.Clone()); + } + delete res; + + dataId = GetId(validFileIds, query); + if (!dataId) return -1; + + return dataId->GetVersion(); + +} + +//_____________________________________________________________________________ +Int_t AliCDBGrid::GetLatestSubVersion(const char* /*path*/, Int_t /*run*/, Int_t /*version*/){ +// get last subversion found in the database valid for run and path + AliError("Objects in GRID storage have no sub version!"); + return -1; +} + + ///////////////////////////////////////////////////////////////////////////////////////////////// // // // AliCDBGrid factory // @@ -787,8 +825,8 @@ AliCDBParam* AliCDBGridFactory::CreateParameter(const char* gridString) { } //TString buffer(gridString + sizeof("alien://") - 1); TString buffer(gridString); - - TString gridUrl = "alien://"; + + TString gridUrl = "alien://"; TString user = ""; TString dbFolder = "DBGrid"; TString se = "ALICE::CERN::se01"; @@ -854,6 +892,10 @@ AliCDBStorage* AliCDBGridFactory::Create(const AliCDBParam* param) { } + if(!gGrid && grid) { + delete grid; grid=0; + } + return grid; } diff --git a/STEER/AliCDBGrid.h b/STEER/AliCDBGrid.h index e41124bcd88..764fe08b1a3 100644 --- a/STEER/AliCDBGrid.h +++ b/STEER/AliCDBGrid.h @@ -20,10 +20,13 @@ class AliCDBGrid: public AliCDBStorage { public: - virtual Bool_t IsReadOnly() const {return kFALSE;}; - virtual Bool_t HasSubVersion() const {return kFALSE;}; + virtual Bool_t IsReadOnly() const {return kFALSE;} + virtual Bool_t HasSubVersion() const {return kFALSE;} virtual Bool_t Contains(const char* path) const; - + virtual Int_t GetLatestVersion(const char* path, Int_t run); + virtual Int_t GetLatestSubVersion(const char* path, Int_t run, Int_t version); + virtual Bool_t IdToFilename(const AliCDBId& id, TString& filename) const; + protected: virtual AliCDBEntry* GetEntry(const AliCDBId& queryId); @@ -41,19 +44,18 @@ private: AliCDBGrid& operator = (const AliCDBGrid& db); Bool_t FilenameToId(TString& filename, AliCDBId& id); - Bool_t IdToFilename(const AliCDBId& id, TString& filename); Bool_t PrepareId(AliCDBId& id); AliCDBId* GetId(const TList& validFileIds, const AliCDBId& query); AliCDBEntry* GetEntryFromFile(TString& filename, const AliCDBId* dataId); Bool_t AddTag(TString& foldername, const char* tagname); - void TagFileId(TString& filename, const AliCDBId* id); - void TagFileMetaData(TString& filename, const AliCDBMetaData* md); + Bool_t TagFileId(TString& filename, const AliCDBId* id); + Bool_t TagFileMetaData(TString& filename, const AliCDBMetaData* md); // Bool_t CheckVersion(const AliCDBId& query, AliCDBId* idToCheck, AliCDBId* result); - void MakeQueryFilter(Long64_t firstRun, Long64_t lastRun, const AliCDBPath& pathFilter, Int_t version, + void MakeQueryFilter(Int_t firstRun, Int_t lastRun, const AliCDBPath& pathFilter, Int_t version, const AliCDBMetaData* md, TString& result) const; virtual void QueryValidFiles(); diff --git a/STEER/AliCDBId.cxx b/STEER/AliCDBId.cxx index 0f00a334f03..35fa599a095 100644 --- a/STEER/AliCDBId.cxx +++ b/STEER/AliCDBId.cxx @@ -98,18 +98,10 @@ Bool_t AliCDBId::IsValid() const { TString AliCDBId::ToString() const { // returns a string of Id data - TString result; - result += "path \""; - result += GetPath(); - result += "\"; run range ["; - result += GetFirstRun(); - result += ","; - result += GetLastRun(); - result += "]; version v"; - result += GetVersion(); - if(GetSubVersion()>0){ - result += "_s"; - result += GetSubVersion(); - } - return result; + TString result = Form("path: \"%s\"; run range: [%d,%d]", + GetPath().Data(), GetFirstRun(), GetLastRun()); + + if(GetVersion() >= 0) result += Form("; version: v%d", GetVersion()); + if(GetSubVersion() >= 0) result += Form("_s%d", GetSubVersion()); + return result; } diff --git a/STEER/AliCDBLocal.cxx b/STEER/AliCDBLocal.cxx index a11dd2b4572..a40c51bef35 100644 --- a/STEER/AliCDBLocal.cxx +++ b/STEER/AliCDBLocal.cxx @@ -98,35 +98,29 @@ Bool_t AliCDBLocal::FilenameToId(const char* filename, AliCDBRunRange& runRange, //_____________________________________________________________________________ -Bool_t AliCDBLocal::IdToFilename(const AliCDBRunRange& runRange, Int_t version, - Int_t subVersion, TString& filename) { +Bool_t AliCDBLocal::IdToFilename(const AliCDBId& id, TString& filename) const { // build file name from AliCDBId data (run range, version, subVersion) - if (!runRange.IsValid()) { + if (!id.GetAliCDBRunRange().IsValid()) { AliDebug(2,Form("Invalid run range <%d, %d>.", - runRange.GetFirstRun(), runRange.GetLastRun())); + id.GetFirstRun(), id.GetLastRun())); return kFALSE; } - if (version < 0) { - AliDebug(2,Form("Invalid version <%d>.", version)); + if (id.GetVersion() < 0) { + AliDebug(2,Form("Invalid version <%d>.", id.GetVersion())); return kFALSE; } - if (subVersion < 0) { - AliDebug(2,Form("Invalid subversion <%s>.", subVersion)); + if (id.GetSubVersion() < 0) { + AliDebug(2,Form("Invalid subversion <%s>.", id.GetSubVersion())); return kFALSE; } - filename += "Run"; - filename += runRange.GetFirstRun(); - filename += "_"; - filename += runRange.GetLastRun(); - filename += "_v"; - filename += version; - filename += "_s"; - filename += subVersion; - filename += ".root"; + filename = Form("Run%d_%d_v%d_s%d.root", id.GetFirstRun(), id.GetLastRun(), + id.GetVersion(), id.GetSubVersion()); + + filename.Prepend(fBaseDirectory +'/' + id.GetPath() + '/'); return kTRUE; } @@ -135,10 +129,7 @@ Bool_t AliCDBLocal::IdToFilename(const AliCDBRunRange& runRange, Int_t version, Bool_t AliCDBLocal::PrepareId(AliCDBId& id) { // prepare id (version, subVersion) of the object that will be stored (called by PutEntry) - TString dirName; - dirName += fBaseDirectory; - dirName += '/'; - dirName += id.GetPath(); + TString dirName = Form("%s/%s", fBaseDirectory.Data(), id.GetPath().Data()); // go to the path; if directory does not exist, create it void* dirPtr = gSystem->OpenDirectory(dirName); @@ -245,27 +236,24 @@ Bool_t AliCDBLocal::PrepareId(AliCDBId& id) { Bool_t AliCDBLocal::GetId(const AliCDBId& query, AliCDBId& result) { // look for filename matching query (called by GetEntry) - TString dirName; - dirName += fBaseDirectory; - dirName += '/'; - dirName += query.GetPath(); // dirName = fDBPath/idPath + TString dirName = Form("%s/%s", fBaseDirectory.Data(), query.GetPath().Data()); - void* dirPtr = gSystem->OpenDirectory(dirName); + void* dirPtr = gSystem->OpenDirectory(dirName); if (!dirPtr) { AliDebug(2,Form("Directory <%s> not found", (query.GetPath()).Data())); AliDebug(2,Form("in DB folder %s", fBaseDirectory.Data())); return kFALSE; } - const char* filename; - + const char* filename; + AliCDBRunRange aRunRange; // the runRange got from filename Int_t aVersion, aSubVersion; // the version and subVersion got from filename if (!query.HasVersion()) { // neither version and subversion specified -> look for highest version and subVersion - + while ((filename = gSystem->GetDirEntry(dirPtr))) { // loop on files - + TString aString(filename); if (aString == "." || aString == "..") continue; @@ -274,7 +262,7 @@ Bool_t AliCDBLocal::GetId(const AliCDBId& query, AliCDBId& result) { if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue; // aRunRange contains requested run! - + if (result.GetVersion() < aVersion) { result.SetVersion(aVersion); result.SetSubVersion(aSubVersion); @@ -379,7 +367,7 @@ AliCDBEntry* AliCDBLocal::GetEntry(const AliCDBId& queryId) { AliCDBId dataId(queryId.GetAliCDBPath(), -1, -1, -1, -1); Bool_t result; - + // look for a filename matching query requests (path, runRange, version, subVersion) if (!queryId.HasVersion()) { // if version is not specified, first check the selection criteria list @@ -393,14 +381,11 @@ AliCDBEntry* AliCDBLocal::GetEntry(const AliCDBId& queryId) { if (!result || !dataId.IsSpecified()) return NULL; TString filename; - if (!IdToFilename(dataId.GetAliCDBRunRange(), dataId.GetVersion(), - dataId.GetSubVersion(), filename)) { + if (!IdToFilename(dataId, filename)) { AliDebug(2,Form("Bad data ID encountered! Subnormal error!")); return NULL; } - - filename.Prepend((fBaseDirectory +'/' + queryId.GetPath() + '/')); TFile file(filename, "READ"); // open file if (!file.IsOpen()) { @@ -442,17 +427,14 @@ void AliCDBLocal::GetEntriesForLevel0(const char* level0, const AliCDBId& queryId, TList* result) { // multiple request (AliCDBStorage::GetAll) - TString level0Dir; - level0Dir += fBaseDirectory; - level0Dir += '/'; - level0Dir += level0; - + TString level0Dir = Form("%s/%s", fBaseDirectory.Data(), level0); + void* level0DirPtr = gSystem->OpenDirectory(level0Dir); if (!level0DirPtr) { - AliDebug(2,Form("Can't open level0 directory <%s>!", + AliDebug(2,Form("Can't open level0 directory <%s>!", level0Dir.Data())); return; - } + } const char* level1; while ((level1 = gSystem->GetDirEntry(level0DirPtr))) { @@ -475,16 +457,11 @@ void AliCDBLocal::GetEntriesForLevel1(const char* level0, const char* level1, const AliCDBId& queryId, TList* result) { // multiple request (AliCDBStorage::GetAll) - TString level1Dir; - level1Dir += fBaseDirectory; - level1Dir += '/'; - level1Dir += level0; - level1Dir += '/'; - level1Dir += level1; + TString level1Dir = Form("%s/%s/%s", fBaseDirectory.Data(), level0,level1); void* level1DirPtr = gSystem->OpenDirectory(level1Dir); if (!level1DirPtr) { - AliDebug(2,Form("Can't open level1 directory <%s>!", + AliDebug(2,Form("Can't open level1 directory <%s>!", level1Dir.Data())); return; } @@ -522,24 +499,24 @@ TList* AliCDBLocal::GetEntries(const AliCDBId& queryId) { AliDebug(2,Form("Can't open storage directory <%s>", fBaseDirectory.Data())); return NULL; - } + } TList* result = new TList(); result->SetOwner(); const char* level0; while ((level0 = gSystem->GetDirEntry(storageDirPtr))) { - + TString level0Str(level0); if (level0Str == "." || level0Str == "..") { continue; } if (queryId.GetAliCDBPath().Level0Comprises(level0)) { - GetEntriesForLevel0(level0, queryId, result); + GetEntriesForLevel0(level0, queryId, result); } - } - + } + gSystem->FreeDirectory(storageDirPtr); return result; @@ -552,20 +529,17 @@ Bool_t AliCDBLocal::PutEntry(AliCDBEntry* entry) { AliCDBId& id = entry->GetId(); // set version and subVersion for the entry to be stored - if (!PrepareId(id)) return kFALSE; + if (!PrepareId(id)) return kFALSE; // build filename from entry's id TString filename=""; - if (!IdToFilename(id.GetAliCDBRunRange(), id.GetVersion(), - id.GetSubVersion(), filename)) { + if (!IdToFilename(id, filename)) { AliDebug(2,Form("Bad ID encountered! Subnormal error!")); return kFALSE; } - - filename.Prepend(fBaseDirectory +'/' + id.GetPath() + '/'); - + // open file TFile file(filename, "CREATE"); if (!file.IsOpen()) { @@ -582,7 +556,6 @@ Bool_t AliCDBLocal::PutEntry(AliCDBEntry* entry) { file.Close(); if(result) { - // TODO this is to make the SHUTTLE output lighter if(!(id.GetPath().Contains("SHUTTLE/STATUS"))) AliInfo(Form("CDB object stored into file %s",filename.Data())); } @@ -625,10 +598,7 @@ TList* AliCDBLocal::GetIdListFromFile(const char* fileName){ Bool_t AliCDBLocal::Contains(const char* path) const{ // check for path in storage's fBaseDirectory - TString dirName; - dirName += fBaseDirectory; - dirName += '/'; - dirName += path; // dirName = fDBPath/path + TString dirName = Form("%s/%s", fBaseDirectory.Data(), path); Bool_t result=kFALSE; void* dirPtr = gSystem->OpenDirectory(dirName); @@ -641,7 +611,121 @@ Bool_t AliCDBLocal::Contains(const char* path) const{ //_____________________________________________________________________________ void AliCDBLocal::QueryValidFiles() { -// blabla +// Query the CDB for files valid for AliCDBStorage::fRun +// fills list fValidFileIds with AliCDBId objects created from file name + + if(fVersion != -1) AliWarning ("Version parameter is not used by local storage query!"); + if(fMetaDataFilter) { + AliWarning ("CDB meta data parameters are not used by local storage query!"); + delete fMetaDataFilter; fMetaDataFilter=0; + } + + void* storageDirPtr = gSystem->OpenDirectory(fBaseDirectory); + + const char* level0; + while ((level0 = gSystem->GetDirEntry(storageDirPtr))) { + + TString level0Str(level0); + if (level0Str == "." || level0Str == "..") { + continue; + } + + if (fPathFilter.Level0Comprises(level0)) { + TString level0Dir = Form("%s/%s",fBaseDirectory.Data(),level0); + void* level0DirPtr = gSystem->OpenDirectory(level0Dir); + const char* level1; + while ((level1 = gSystem->GetDirEntry(level0DirPtr))) { + + TString level1Str(level1); + if (level1Str == "." || level1Str == "..") { + continue; + } + + if (fPathFilter.Level1Comprises(level1)) { + TString level1Dir = Form("%s/%s/%s", + fBaseDirectory.Data(),level0,level1); + + void* level1DirPtr = gSystem->OpenDirectory(level1Dir); + const char* level2; + while ((level2 = gSystem->GetDirEntry(level1DirPtr))) { + + TString level2Str(level2); + if (level2Str == "." || level2Str == "..") { + continue; + } + + if (fPathFilter.Level2Comprises(level2)) { + TString dirName = Form("%s/%s/%s/%s", + fBaseDirectory.Data(),level0,level1,level2); + + void* dirPtr = gSystem->OpenDirectory(dirName); + + const char* filename; + + AliCDBRunRange aRunRange; // the runRange got from filename + Int_t aVersion, aSubVersion; // the version and subVersion got from filename + + while ((filename = gSystem->GetDirEntry(dirPtr))) { // loop on files + + TString aString(filename); + if (aString == "." || aString == "..") continue; + + if (!FilenameToId(filename, aRunRange, aVersion, aSubVersion)) continue; + AliCDBRunRange runrg(fRun,fRun); + if (!aRunRange.Comprises(runrg)) continue; + // aRunRange contains requested run! + AliCDBPath validPath(level0,level1,level2); + AliCDBId validId(validPath,aRunRange,aVersion,aSubVersion); + fValidFileIds.AddLast(validId.Clone()); + } + gSystem->FreeDirectory(dirPtr); + } + } + gSystem->FreeDirectory(level1DirPtr); + } + } + gSystem->FreeDirectory(level0DirPtr); + } + } + gSystem->FreeDirectory(storageDirPtr); + +} + +//_____________________________________________________________________________ +Int_t AliCDBLocal::GetLatestVersion(const char* path, Int_t run){ +// get last version found in the database valid for run and path + + AliCDBPath aCDBPath(path); + if(!aCDBPath.IsValid() || aCDBPath.IsWildcard()) { + AliError(Form("Invalid path in request: %s", path)); + return -1; + } + + AliCDBId query(path, run, run, -1, -1); + AliCDBId dataId; + + GetId(query,dataId); + + return dataId.GetVersion(); + +} + +//_____________________________________________________________________________ +Int_t AliCDBLocal::GetLatestSubVersion(const char* path, Int_t run, Int_t version){ +// get last version found in the database valid for run and path + + AliCDBPath aCDBPath(path); + if(!aCDBPath.IsValid() || aCDBPath.IsWildcard()) { + AliError(Form("Invalid path in request: %s", path)); + return -1; + } + + AliCDBId query(path, run, run, version, -1); + AliCDBId dataId; + + GetId(query,dataId); + + return dataId.GetSubVersion(); } diff --git a/STEER/AliCDBLocal.h b/STEER/AliCDBLocal.h index 5f031e11616..8997905bc84 100644 --- a/STEER/AliCDBLocal.h +++ b/STEER/AliCDBLocal.h @@ -22,12 +22,15 @@ public: virtual Bool_t IsReadOnly() const {return kFALSE;}; virtual Bool_t HasSubVersion() const {return kTRUE;}; virtual Bool_t Contains(const char* path) const; + virtual Int_t GetLatestVersion(const char* path, Int_t run); + virtual Int_t GetLatestSubVersion(const char* path, Int_t run, Int_t version=-1); + virtual Bool_t IdToFilename(const AliCDBId& id, TString& filename) const; protected: - virtual AliCDBEntry* GetEntry(const AliCDBId& queryId); - virtual TList* GetEntries(const AliCDBId& queryId); - virtual Bool_t PutEntry(AliCDBEntry* entry); + virtual AliCDBEntry* GetEntry(const AliCDBId& queryId); + virtual TList* GetEntries(const AliCDBId& queryId); + virtual Bool_t PutEntry(AliCDBEntry* entry); virtual TList* GetIdListFromFile(const char* fileName); private: @@ -39,8 +42,6 @@ private: Bool_t FilenameToId(const char* filename, AliCDBRunRange& runRange, Int_t& version, Int_t& subVersion); - Bool_t IdToFilename(const AliCDBRunRange& runRange, Int_t version, - Int_t subVersion, TString& filename); Bool_t PrepareId(AliCDBId& id); Bool_t GetId(const AliCDBId& query, AliCDBId& result); diff --git a/STEER/AliCDBManager.cxx b/STEER/AliCDBManager.cxx index 661067e2158..2a7cfb58326 100644 --- a/STEER/AliCDBManager.cxx +++ b/STEER/AliCDBManager.cxx @@ -155,6 +155,7 @@ AliCDBStorage* AliCDBManager::GetStorage(const char* dbString) { AliCDBParam* param = CreateParameter(dbString); if (!param) { + AliError(Form("Failed to activate requested storage! Check URI: %s", dbString)); return NULL; } @@ -187,10 +188,15 @@ AliCDBStorage* AliCDBManager::GetStorage(const AliCDBParam* param) { if (aStorage) { PutActiveStorage(param->CloneParam(), aStorage); aStorage->SetURI(param->GetURI()); + if(fRun > 0) { + aStorage->QueryCDB(fRun); + } return aStorage; } } + AliError(Form("Failed to activate requested storage! Check URI: %s", param->GetURI().Data())); + return NULL; } @@ -283,11 +289,12 @@ void AliCDBManager::SetSpecificStorage(const char* calibType, AliCDBParam* param // sets storage specific for detector or calibration type (works with AliCDBManager::Get(...)) // Default storage should be defined prior to any specific storages, e.g.: // AliCDBManager::instance()->SetDefaultStorage("alien://"); -// AliCDBManager::instance()->SetSpecificStorage("TPC","local://DB_TPC"); -// AliCDBManager::instance()->SetSpecificStorage("RICH/Align","local://DB_TPCAlign"); +// AliCDBManager::instance()->SetSpecificStorage("TPC/*","local://DB_TPC"); +// AliCDBManager::instance()->SetSpecificStorage("*/Align/*","local://DB_TPCAlign"); +// calibType must be a valid CDB path! (3 level folder structure) if(!fDefaultStorage) { - AliError("Please activate a default storage first!"); + AliError("Please activate a default storage first!"); return; } @@ -613,7 +620,7 @@ void AliCDBManager::Print(Option_t* /*option*/) const } //_____________________________________________________________________________ -void AliCDBManager::SetRun(Long64_t run) +void AliCDBManager::SetRun(Int_t run) { // Sets current run number. // When the run number changes the caching is cleared. @@ -669,7 +676,7 @@ void AliCDBManager::QueryCDB() { return; } - AliInfo(Form("Querying default and specific storages for files valid for run %ld", (long) fRun)); + AliInfo(Form("Querying default and specific storages for files valid for run %d", fRun)); fDefaultStorage->QueryCDB(fRun); TIter iter(&fSpecificStorages); @@ -678,7 +685,7 @@ void AliCDBManager::QueryCDB() { while((aCalibType = dynamic_cast (iter.Next()))){ aPar = (AliCDBParam*) fSpecificStorages.GetValue(aCalibType); if(aPar) { - AliDebug(2,Form("Qerying specific storage %s",aCalibType->GetName())); + AliDebug(2,Form("Querying specific storage %s",aCalibType->GetName())); GetStorage(aPar)->QueryCDB(fRun,aCalibType->GetName()); } diff --git a/STEER/AliCDBManager.h b/STEER/AliCDBManager.h index 90841f6c72d..c9482685a91 100644 --- a/STEER/AliCDBManager.h +++ b/STEER/AliCDBManager.h @@ -79,8 +79,8 @@ class AliCDBManager: public TObject { void SetCacheFlag(Bool_t cacheFlag) {fCache=cacheFlag;} Bool_t GetCacheFlag() const {return fCache;} - void SetRun(Long64_t run); - Long64_t GetRun() const {return fRun;} + void SetRun(Int_t run); + Int_t GetRun() const {return fRun;} // AliCDBEntry* Get(const char* path); @@ -125,7 +125,7 @@ class AliCDBManager: public TObject { TMap fEntryCache; //! cache of the retrieved objects Bool_t fCache; //! The cache flag - Long64_t fRun; //! The run number + Int_t fRun; //! The run number ClassDef(AliCDBManager, 0); }; diff --git a/STEER/AliCDBMetaData.cxx b/STEER/AliCDBMetaData.cxx index d0bc667f834..4a55caa34d0 100644 --- a/STEER/AliCDBMetaData.cxx +++ b/STEER/AliCDBMetaData.cxx @@ -32,8 +32,8 @@ ClassImp(AliCDBMetaData) AliCDBMetaData::AliCDBMetaData() : TObject(), fObjectClassName(""), -fResponsible(""), -fBeamPeriod(0), +fResponsible(""), +fBeamPeriod(0), fAliRootVersion(""), fComment(""), fProperties() @@ -43,6 +43,22 @@ fProperties() fProperties.SetOwner(1); } +//_____________________________________________________________________________ +AliCDBMetaData::AliCDBMetaData(const char *responsible, UInt_t beamPeriod, + const char* alirootVersion, const char* comment) : +TObject(), +fObjectClassName(""), +fResponsible(responsible), +fBeamPeriod(beamPeriod), +fAliRootVersion(alirootVersion), +fComment(comment), +fProperties() +{ +// constructor + + fProperties.SetOwner(1); +} + //_____________________________________________________________________________ AliCDBMetaData::~AliCDBMetaData() { // destructor @@ -102,5 +118,6 @@ void AliCDBMetaData::PrintMetaData() { message += Form("\t\t%s\n", ((TObjString* ) aPair->Key())->String().Data()); } } - AliInfo(Form("**** Object's MetaData set **** \n%s", message.Data())); + message += '\n'; + AliInfo(Form("**** Object's MetaData parameters **** \n%s", message.Data())); } diff --git a/STEER/AliCDBMetaData.h b/STEER/AliCDBMetaData.h index 36b9f999343..d7a4247aa12 100644 --- a/STEER/AliCDBMetaData.h +++ b/STEER/AliCDBMetaData.h @@ -19,6 +19,7 @@ class AliCDBMetaData: public TObject { public: AliCDBMetaData(); + AliCDBMetaData(const char *responsible, UInt_t beamPeriod=0, const char* alirootVersion="", const char* comment=""); virtual ~AliCDBMetaData(); void SetObjectClassName(const char* name) diff --git a/STEER/AliCDBRunRange.h b/STEER/AliCDBRunRange.h index 4545048c865..e0c2ed29d13 100644 --- a/STEER/AliCDBRunRange.h +++ b/STEER/AliCDBRunRange.h @@ -43,14 +43,14 @@ public: virtual Bool_t IsEqual(const TObject *obj) const; - static UInt_t Infinity() {return fgkInfinity;} + static Int_t Infinity() {return fgkInfinity;} private: Int_t fFirstRun; // first valid run Int_t fLastRun; // last valid run - static const UInt_t fgkInfinity = 999999999; //! Flag for "infinity" + static const Int_t fgkInfinity = 999999999; //! Flag for "infinity" ClassDef(AliCDBRunRange, 1); }; diff --git a/STEER/AliCDBStorage.cxx b/STEER/AliCDBStorage.cxx index a82c176d25c..7b2316ffe03 100644 --- a/STEER/AliCDBStorage.cxx +++ b/STEER/AliCDBStorage.cxx @@ -231,8 +231,7 @@ AliCDBEntry* AliCDBStorage::Get(const AliCDBId& query) { } else { // this is to make the SHUTTLE output lighter if(!(query.GetPath().Contains("SHUTTLE/STATUS"))) - AliInfo(Form("No valid CDB object found! request was: name = <%s>, run = %d", - (query.GetPath()).Data(), query.GetFirstRun())); + AliInfo(Form("No valid CDB object found! request was: %s", query.ToString().Data())); } // if drain storage is set, drain entry into drain storage @@ -293,8 +292,7 @@ TList* AliCDBStorage::GetAll(const AliCDBId& query) { } } else { - AliInfo(Form("No valid CDB object found! request was: name = <%s>, run = %d, version = %d", - (query.GetPath()).Data(), query.GetFirstRun(), query.GetVersion())); + AliInfo(Form("No valid CDB object found! request was: %s", query.ToString().Data())); } // if drain storage is set, drain entries into drain storage @@ -364,7 +362,7 @@ Bool_t AliCDBStorage::Put(AliCDBEntry* entry) { } //_____________________________________________________________________________ -void AliCDBStorage::QueryCDB(Long64_t run, const char* pathFilter, +void AliCDBStorage::QueryCDB(Int_t run, const char* pathFilter, Int_t version, AliCDBMetaData* md){ // query CDB for files valid for given run, and fill list fValidFileIds // Actual query is done in virtual function QueryValidFiles() @@ -388,9 +386,10 @@ void AliCDBStorage::QueryCDB(Long64_t run, const char* pathFilter, if(md) fMetaDataFilter = dynamic_cast (md->Clone()); QueryValidFiles(); + AliCDBId queryId(pathFilter,run,run,version); - AliInfo(Form("%d files valid for run %ld, path %s and version %d found in CDB storage: \n %s://%s", - fValidFileIds.GetEntries(), (long) fRun, pathFilter, version, + AliInfo(Form("%d files valid for request <%s> found in CDB storage \"%s://%s\"", + fValidFileIds.GetEntries(), queryId.ToString().Data(), fType.Data(), fBaseFolder.Data())); } @@ -399,22 +398,22 @@ void AliCDBStorage::QueryCDB(Long64_t run, const char* pathFilter, void AliCDBStorage::PrintQueryCDB(){ // print parameters used to load list of CDB Id's (fRun, fPathFilter, fVersion) - AliInfo(Form("QueryCDB Parameters: \n\tRun = %ld \n\tPath filter = %s \n\tVersion = %d", - (long) fRun, fPathFilter.GetPath().Data(), fVersion)); + AliCDBId paramId(fPathFilter, fRun, fRun, fVersion); + AliInfo(Form("**** QueryCDB Parameters **** \n\t<%s>\n", + paramId.ToString().Data())); + + if(fMetaDataFilter) fMetaDataFilter->PrintMetaData(); - if(fMetaDataFilter) { - AliInfo("CDBMetaData Parameters: "); - } - fMetaDataFilter->PrintMetaData(); - AliInfo("Id's of valid objects found:"); + TString message = "**** Id's of valid objects found *****\n"; TIter iter(&fValidFileIds); AliCDBId* anId=0; // loop on the list of selection criteria while ((anId = dynamic_cast(iter.Next()))) { - AliInfo(Form("%s", anId->ToString().Data())); + message += Form("\t%s\n", anId->ToString().Data()); } - + message += Form("\n\tTotal: %d objects found\n", fValidFileIds.GetEntries()); + AliInfo(Form("%s", message.Data())); } diff --git a/STEER/AliCDBStorage.h b/STEER/AliCDBStorage.h index 3ae3075aac2..cba746be5e9 100644 --- a/STEER/AliCDBStorage.h +++ b/STEER/AliCDBStorage.h @@ -79,12 +79,16 @@ public: virtual Bool_t IsReadOnly() const = 0; virtual Bool_t HasSubVersion() const = 0; virtual Bool_t Contains(const char* path) const = 0; + virtual Bool_t IdToFilename(const AliCDBId& id, TString& filename) const = 0; - void QueryCDB(Long64_t run, const char* pathFilter="*", + void QueryCDB(Int_t run, const char* pathFilter="*", Int_t version=-1, AliCDBMetaData *mdFilter=0); void PrintQueryCDB(); TList* GetQueryCDBList() {return &fValidFileIds;} + virtual Int_t GetLatestVersion(const char* path, Int_t run)=0; + virtual Int_t GetLatestSubVersion(const char* path, Int_t run, Int_t version=-1)=0; + protected: virtual ~AliCDBStorage(); @@ -96,7 +100,7 @@ protected: virtual void QueryValidFiles() = 0; TList fValidFileIds; // list of Id's of the files valid for a given run (cached as fRun) - Long64_t fRun; // run number, used to manage list of valid files + Int_t fRun; // run number, used to manage list of valid files AliCDBPath fPathFilter; // path filter, used to manage list of valid files Int_t fVersion; // version, used to manage list of valid files AliCDBMetaData* fMetaDataFilter; // metadata, used to manage list of valid files @@ -106,7 +110,7 @@ protected: TString fType; //! Local, Grid: base folder name - Dump: file name TString fBaseFolder; //! Local, Grid: base folder name - Dump: file name - private: +private: AliCDBStorage(const AliCDBStorage & source); AliCDBStorage & operator=(const AliCDBStorage & source); diff --git a/STEER/AliReconstruction.cxx b/STEER/AliReconstruction.cxx index aad6f236fcf..3d2fac036a4 100644 --- a/STEER/AliReconstruction.cxx +++ b/STEER/AliReconstruction.cxx @@ -291,15 +291,13 @@ void AliReconstruction::InitCDBStorage() } // Now activate the detector specific CDB storage locations - for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { - TString detName = fgkDetectorName[iDet]; - TObject* obj = fSpecCDBUri.FindObject(detName.Data()); - if (obj) { - AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); - AliWarning(Form("Specific CDB storage for %s is set to: %s",detName.Data(),obj->GetTitle())); - AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); - man->SetSpecificStorage(detName.Data(),obj->GetTitle()); - } + for (Int_t i = 0; i < fSpecCDBUri.GetEntriesFast(); i++) { + TObject* obj = fSpecCDBUri[i]; + if (!obj) continue; + AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + AliWarning(Form("Specific CDB storage for %s is set to: %s",obj->GetName(),obj->GetTitle())); + AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + man->SetSpecificStorage(obj->GetName(), obj->GetTitle()); } man->Print(); } @@ -314,13 +312,44 @@ void AliReconstruction::SetDefaultStorage(const char* uri) { } //_____________________________________________________________________________ -void AliReconstruction::SetSpecificStorage(const char* detName, const char* uri) { +void AliReconstruction::SetSpecificStorage(const char* calibType, const char* uri) { // Store a detector-specific CDB storage location // Activate it later within the Run() method - TObject* obj = fSpecCDBUri.FindObject(detName); + AliCDBPath aPath(calibType); + if(!aPath.IsValid()){ + // if calibType is not wildcard but it is a valid detector, add "/*" to make it a valid path + for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { + if(!strcmp(calibType, fgkDetectorName[iDet])) { + aPath.SetPath(Form("%s/*", calibType)); + AliInfo(Form("Path for specific storage set to %s", aPath.GetPath().Data())); + break; + } + } + if(!aPath.IsValid()){ + AliError(Form("Not a valid path or detector: %s", calibType)); + return; + } + } + + // check that calibType refers to a "valid" detector name + Bool_t isDetector = kFALSE; + for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { + TString detName = fgkDetectorName[iDet]; + if(aPath.GetLevel0() == detName) { + isDetector = kTRUE; + break; + } + } + + if(!isDetector) { + AliError(Form("Not a valid detector: %s", aPath.GetLevel0().Data())); + return; + } + + TObject* obj = fSpecCDBUri.FindObject(aPath.GetPath().Data()); if (obj) fSpecCDBUri.Remove(obj); - fSpecCDBUri.Add(new TNamed(detName, uri)); + fSpecCDBUri.Add(new TNamed(aPath.GetPath().Data(), uri)); } diff --git a/STEER/AliReconstruction.h b/STEER/AliReconstruction.h index 2e0454cc44b..de2f61b7946 100644 --- a/STEER/AliReconstruction.h +++ b/STEER/AliReconstruction.h @@ -82,7 +82,7 @@ public: // CDB storage activation void InitCDBStorage(); void SetDefaultStorage(const char* uri); - void SetSpecificStorage(const char* detName, const char* uri); + void SetSpecificStorage(const char* calibType, const char* uri); Bool_t SetRunNumber(); diff --git a/STEER/AliSimulation.cxx b/STEER/AliSimulation.cxx index 31ddb74bf06..0230d59f46e 100644 --- a/STEER/AliSimulation.cxx +++ b/STEER/AliSimulation.cxx @@ -285,7 +285,7 @@ void AliSimulation::InitCDBStorage() AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); AliWarning(Form("Specific CDB storage for %s is set to: %s",obj->GetName(),obj->GetTitle())); AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); - man->SetSpecificStorage(obj->GetName(),obj->GetTitle()); + man->SetSpecificStorage(obj->GetName(), obj->GetTitle()); } man->Print(); } @@ -300,13 +300,19 @@ void AliSimulation::SetDefaultStorage(const char* uri) { } //_____________________________________________________________________________ -void AliSimulation::SetSpecificStorage(const char* detName, const char* uri) { +void AliSimulation::SetSpecificStorage(const char* calibType, const char* uri) { // Store a detector-specific CDB storage location // Activate it later within the Run() method - TObject* obj = fSpecCDBUri.FindObject(detName); + AliCDBPath aPath(calibType); + if(!aPath.IsValid()){ + AliError(Form("Not a valid path: %s", calibType)); + return; + } + + TObject* obj = fSpecCDBUri.FindObject(calibType); if (obj) fSpecCDBUri.Remove(obj); - fSpecCDBUri.Add(new TNamed(detName, uri)); + fSpecCDBUri.Add(new TNamed(calibType, uri)); } diff --git a/STEER/AliSimulation.h b/STEER/AliSimulation.h index fc64c355830..569edae371e 100644 --- a/STEER/AliSimulation.h +++ b/STEER/AliSimulation.h @@ -85,7 +85,7 @@ public: // CDB storage activation void InitCDBStorage(); void SetDefaultStorage(const char* uri); - void SetSpecificStorage(const char* detName, const char* uri); + void SetSpecificStorage(const char* calibType, const char* uri); virtual Bool_t Run(Int_t nEvents = 0); -- 2.43.0