From d3ce989c3baa3048eebb497adc2d3cc7d6e12f3e Mon Sep 17 00:00:00 2001 From: rgrosso Date: Fri, 7 Jun 2013 15:24:07 +0000 Subject: [PATCH] Adding the possibility to get an oldest version, also via GetAll, by means of AliCDBStorage::AddSelection This functionality is introduced in this way for the specific purposes described in savannah 101609. --- STEER/CDB/AliCDBManager.cxx | 20 ++++++++++++-------- STEER/CDB/AliCDBStorage.h | 5 +++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/STEER/CDB/AliCDBManager.cxx b/STEER/CDB/AliCDBManager.cxx index 4c94031d2ce..d6b3ebc1929 100644 --- a/STEER/CDB/AliCDBManager.cxx +++ b/STEER/CDB/AliCDBManager.cxx @@ -1160,7 +1160,7 @@ TList* AliCDBManager::GetAll(const AliCDBId& query) { if(!result) return 0; // loop on result to check whether entries should be re-queried with specific storages - if(fSpecificStorages.GetEntries()>0 && ! (fSpecificStorages.GetEntries() == 1 && aPar)) { + if(fSpecificStorages.GetEntries()>0 && ! (fSpecificStorages.GetEntries() == 1 && aPar) || aStorage->GetNSelections()>0 ) { AliInfo("Now look into all other specific storages..."); TIter iter(result); @@ -1169,17 +1169,21 @@ TList* AliCDBManager::GetAll(const AliCDBId& query) { while((chkEntry = dynamic_cast (iter.Next()))){ AliCDBId& chkId = chkEntry->GetId(); AliDebug(2, Form("Checking id %s ", chkId.GetPath().Data())); - AliCDBParam *chkPar=SelectSpecificStorage(chkId.GetPath()); - if (!chkPar || aPar == chkPar) continue; - AliCDBStorage *chkStorage = GetStorage(chkPar); - AliDebug(2, Form("Found specific storage! %s", chkPar->GetURI().Data())); - - AliCDBEntry *newEntry=0; chkId.SetRunRange(query.GetFirstRun(), query.GetLastRun()); chkId.SetVersion(query.GetVersion()); chkId.SetSubVersion(query.GetSubVersion()); - if(chkStorage) newEntry = chkStorage->Get(chkId); + AliCDBParam *chkPar=SelectSpecificStorage(chkId.GetPath()); + AliCDBStorage *chkStorage = 0; + AliCDBEntry *newEntry=0; + if (!chkPar || aPar == chkPar){ + aStorage->GetSelection(&chkId); + newEntry = GetDefaultStorage()->Get(chkId); + }else{ + chkStorage = GetStorage(chkPar); + AliDebug(2, Form("Found specific storage! %s", chkPar->GetURI().Data())); + newEntry = chkStorage->Get(chkId); + } if(!newEntry) continue; // object is found in specific storage: replace entry in the result list! diff --git a/STEER/CDB/AliCDBStorage.h b/STEER/CDB/AliCDBStorage.h index d61ebd857a1..78ca46995a6 100644 --- a/STEER/CDB/AliCDBStorage.h +++ b/STEER/CDB/AliCDBStorage.h @@ -101,11 +101,12 @@ public: void PrintQueryCDB(); TObjArray* GetQueryCDBList() {return &fValidFileIds;} virtual void SetRetry(Int_t nretry, Int_t initsec) = 0; + void GetSelection(AliCDBId* id); + Int_t GetNSelections(){return fSelections.GetEntries();} protected: virtual ~AliCDBStorage(); - void GetSelection(/*const*/ AliCDBId* id); virtual AliCDBEntry* GetEntry(const AliCDBId& query) = 0; virtual AliCDBId* GetEntryId(const AliCDBId& query) = 0; virtual TList* GetEntries(const AliCDBId& query) = 0; @@ -130,7 +131,7 @@ protected: private: AliCDBStorage(const AliCDBStorage & source); - AliCDBStorage & operator=(const AliCDBStorage & source); + AliCDBStorage* operator=(const AliCDBStorage & source); ClassDef(AliCDBStorage, 0); }; -- 2.39.3