]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
New functionality added in AliCDBManager: the activated default and specific
authoracolla <acolla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 24 Oct 2007 10:07:06 +0000 (10:07 +0000)
committeracolla <acolla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 24 Oct 2007 10:07:06 +0000 (10:07 +0000)
storages and the retrieved objects' Ids are saved in a TMap and a TList
respectively. The storage map and the list of retrieved Ids can be got with:

const TMap* GetStorageMap() const {return fStorageMap;}
const TList* GetRetrievedIds() const {return fIds;}

in AliCDBId: added Print function

STEER/AliCDBId.cxx
STEER/AliCDBId.h
STEER/AliCDBManager.cxx
STEER/AliCDBManager.h

index a5053da1cd9cf6800b442d91bada4f8854aec3c0..10e0510bacbd438c3194979ff269b8bcc6352750 100644 (file)
@@ -22,6 +22,7 @@
 /////////////////////////////////////////////////////////////////////
 
 #include "AliCDBId.h"
+#include <Riostream.h>
 
 ClassImp(AliCDBId)
 
@@ -121,3 +122,11 @@ TString AliCDBId::ToString() const {
        if(GetSubVersion() >= 0) result += Form("_s%d", GetSubVersion());
        return result;
 }
+
+//_____________________________________________________________________________
+void AliCDBId::Print(Option_t* /*option*/) const {
+// Prints ToString()
+
+       cout << ToString().Data() << endl;
+
+}
index 54ae14aabf9970898e77525b416bbb050ebae145..549bd5209147fcea43f1c1e90fd67b6d0a03da57 100644 (file)
@@ -75,6 +75,7 @@ public:
        virtual Bool_t IsEqual(const TObject *obj) const;
 
        TString ToString() const;
+       void Print(Option_t* option="") const;
 
 private:
 
index e0fd144c669a1c06c293df60f512dbc9d57343d4..51d38d86c7e066438909cda5a66a1e9dd886ca27 100644 (file)
@@ -82,24 +82,31 @@ void AliCDBManager::Destroy() {
 //_____________________________________________________________________________
 AliCDBManager::AliCDBManager():
   TObject(),
-  fCondParam(0),
-  fRefParam(0),
   fFactories(),
   fActiveStorages(),
   fSpecificStorages(),
+  fEntryCache(),
+  fIds(0),
+  fStorageMap(0),
+  fShortLived(0),
   fDefaultStorage(NULL),
   fRemoteStorage(NULL),
   fDrainStorage(NULL),
-  fEntryCache(),
-  fCache(kTRUE),
+  fCondParam(0),
+  fRefParam(0),
   fRun(-1),
-  fShortLived(0)
+  fCache(kTRUE)
 {
 // default constuctor
        fFactories.SetOwner(1);
        fActiveStorages.SetOwner(1);
        fSpecificStorages.SetOwner(1);
        fEntryCache.SetOwner(1);
+
+       fStorageMap = new TMap();
+       fStorageMap->SetOwner(1);
+       fIds = new TList();
+       fIds->SetOwner(1);
 }
 
 //_____________________________________________________________________________
@@ -111,6 +118,8 @@ AliCDBManager::~AliCDBManager() {
        fDrainStorage = 0x0;
        fDefaultStorage = 0x0;
        fRemoteStorage = 0x0;
+       delete fStorageMap; fStorageMap = 0;
+       delete fIds; fIds = 0;
        delete fCondParam;
        delete fRefParam;
        delete fShortLived; fShortLived = 0x0;
@@ -135,7 +144,7 @@ void AliCDBManager::RegisterFactory(AliCDBStorageFactory* factory) {
 
 //_____________________________________________________________________________
 Bool_t AliCDBManager::HasStorage(const char* dbString) const {
-// check if dbString is a URI valid for one of the registered factories 
+// check if dbString is a URI valid for one of the registered factories
 
        TIter iter(&fFactories);
 
@@ -286,6 +295,11 @@ void AliCDBManager::SetDefaultStorage(const char* dbString) {
                AliWarning("Existing default storage replaced: clearing cache!");
                ClearCache();
        }
+
+       if (fStorageMap->Contains("default")) {
+               delete fStorageMap->Remove(fStorageMap->GetValue("default"));
+       }
+       fStorageMap->Add(new TObjString("default"), new TObjString(fDefaultStorage->GetURI()));
 }
 
 //_____________________________________________________________________________
@@ -300,6 +314,11 @@ void AliCDBManager::SetDefaultStorage(const AliCDBParam* param) {
                AliWarning("Existing default storage replaced: clearing cache!");
                ClearCache();
        }
+
+       if (fStorageMap->Contains("default")) {
+               delete fStorageMap->Remove(fStorageMap->GetValue("default"));
+       }
+       fStorageMap->Add(new TObjString("default"), new TObjString(fDefaultStorage->GetURI()));
 }
 
 //_____________________________________________________________________________
@@ -314,6 +333,11 @@ void AliCDBManager::SetDefaultStorage(AliCDBStorage* storage) {
                AliWarning("Existing default storage replaced: clearing cache!");
                ClearCache();
        }
+
+       if (fStorageMap->Contains("default")) {
+               delete fStorageMap->Remove(fStorageMap->GetValue("default"));
+       }
+       fStorageMap->Add(new TObjString("default"), new TObjString(fDefaultStorage->GetURI()));
 }
 //_____________________________________________________________________________
 void AliCDBManager::SetRemoteStorage(const char* dbString) {
@@ -381,6 +405,12 @@ void AliCDBManager::SetSpecificStorage(const char* calibType, AliCDBParam* param
        GetStorage(param);
 
        fSpecificStorages.Add(objCalibType, param->CloneParam());
+
+       if(fStorageMap->Contains(objCalibType)){
+               delete fStorageMap->Remove(objCalibType);
+       }
+       fStorageMap->Add(objCalibType->Clone(), new TObjString(param->GetURI()));
+
 }
 
 //_____________________________________________________________________________
@@ -513,6 +543,11 @@ AliCDBEntry* AliCDBManager::Get(const AliCDBId& query) {
                CacheEntry(query.GetPath(), entry);
        }
 
+       if(entry && !fIds->Contains(&entry->GetId())){
+               fIds->Add(entry->GetId().Clone());
+       }
+
+
        return entry;
 
 }
@@ -711,15 +746,19 @@ TList* AliCDBManager::GetAll(const AliCDBId& query) {
        }
 
        // caching entries
-       if(fCache && (query.GetFirstRun() == fRun)){
+       TIter iter(result);
+       AliCDBEntry* entry=0;
+       while((entry = dynamic_cast<AliCDBEntry*> (iter.Next()))){
 
-               TIter iter(result);
-               AliCDBEntry* entry=0;
-               while((entry = dynamic_cast<AliCDBEntry*> (iter.Next()))){
+               if(!fIds->Contains(&entry->GetId())){
+                       fIds->Add(entry->GetId().Clone());
+               }
+               if(fCache && (query.GetFirstRun() == fRun)){
                        CacheEntry(entry->GetId().GetPath(), entry);
                }
        }
 
+
        return result;
 }
 
index a5f72a0fcf418d457b52235981a53e9359aeb5c8..418b2392da7ac48aeb9065353a13f5bb7fecbee4 100644 (file)
@@ -42,6 +42,9 @@ class AliCDBManager: public TObject {
 
        TList* GetActiveStorages();
 
+       const TMap* GetStorageMap() const {return fStorageMap;}
+       const TList* GetRetrievedIds() const {return fIds;}
+
        void SetDefaultStorage(const char* dbString);
        void SetDefaultStorage(const AliCDBParam* param);
        void SetDefaultStorage(AliCDBStorage *storage);
@@ -122,8 +125,6 @@ class AliCDBManager: public TObject {
 
        static TString fgkCondUri;      // URI of the Conditions data base folder
        static TString fgkRefUri;       // URI of the Reference data base folder
-       AliCDBParam* fCondParam;        // Conditions data storage parameters
-       AliCDBParam* fRefParam;         // Reference data storage parameters
 
        AliCDBManager();
        AliCDBManager(const AliCDBManager & source);
@@ -146,17 +147,22 @@ class AliCDBManager: public TObject {
        TList fFactories;               //! list of registered storage factories
        TMap fActiveStorages;           //! list of active storages
        TMap fSpecificStorages;         //! list of detector-specific storages
+       TMap fEntryCache;               //! cache of the retrieved objects
+
+       TList* fIds;            //! List of the retrieved object Id's (to be streamed to file)
+       TMap* fStorageMap;      //! list of storages (to be streamed to file)
+       TList* fShortLived;     //! List of short lived objects
 
        AliCDBStorage *fDefaultStorage; //! pointer to default storage
        AliCDBStorage *fRemoteStorage;  //! pointer to remote storage
        AliCDBStorage *fDrainStorage;   //! pointer to drain storage
 
-       TMap fEntryCache;       //! cache of the retrieved objects
+       AliCDBParam* fCondParam;        // Conditions data storage parameters
+       AliCDBParam* fRefParam;         // Reference data storage parameters
 
+       Int_t fRun;                     //! The run number
        Bool_t fCache;                  //! The cache flag
-       Int_t fRun;                     //! The run number
 
-       TList* fShortLived;     //! List of short lived objects
 
        ClassDef(AliCDBManager, 0);
 };