]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliCDBManager.cxx
Supressed warning when a data slot is not connected to a container
[u/mrichter/AliRoot.git] / STEER / AliCDBManager.cxx
index c63140c6ac19345e300469fe0b15bd5e0c8d7696..06b412fea9391e8260f4cf9348fcb1092f8c488b 100644 (file)
 #include "AliCDBLocal.h"
 #include "AliCDBGrid.h"
 #include "AliCDBEntry.h"
-#include "AliCDBMetaData.h"
 #include "AliCDBHandler.h"
 
 #include <TObjString.h>
-#include <TSystem.h>
 #include <TSAXParser.h>
 #include <TFile.h>
 #include <TUUID.h>
+#include <TGrid.h>
 
 ClassImp(AliCDBParam)
 
@@ -329,11 +328,22 @@ Bool_t AliCDBManager::Drain(AliCDBEntry *entry) {
 void AliCDBManager::SetDefaultStorage(const char* dbString) {
 // sets default storage from URI string
        
-       AliInfo(Form("Setting Default storage to: %s",dbString));
-
        // checking whether we are in the raw case
        TString dbStringTemp(dbString);
-       if (dbStringTemp == "raw://") fRaw = kTRUE;
+       if (dbStringTemp == "raw://")
+       {
+               fRaw = kTRUE;
+               AliInfo("Setting the run-number will set the corresponding OCDB for raw data reconstruction.");
+               AliInfo("Connecting to the grid...");
+               if(!gGrid) {
+                       TGrid::Connect("alien://","");
+                       if(!gGrid) {
+                               AliError("Connection to alien failed!");
+                               return;
+                       }
+               }
+               return;
+       }
 
        AliCDBStorage* bckStorage = fDefaultStorage;
        
@@ -447,6 +457,13 @@ void AliCDBManager::SetDefaultStorageFromRun(Int_t run) {
        }       
 
        // retrieve XML file from alien
+       if(!gGrid) {
+           TGrid::Connect("alien://","");
+           if(!gGrid) {
+               AliError("Connection to alien failed!");
+               return;
+           }
+       }
        TUUID uuid;
        TString rndname = "/tmp/";
        rndname += "OCDBFolderXML.";
@@ -488,6 +505,9 @@ void AliCDBManager::UnsetDefaultStorage() {
                AliWarning("Clearing cache!");
                ClearCache();
        }
+
+       fRun = fStartRunLHCPeriod = fEndRunLHCPeriod = -1;
+       fRaw = kFALSE;
        
        fDefaultStorage = 0x0;
 }
@@ -512,7 +532,7 @@ void AliCDBManager::SetSpecificStorage(const char* calibType, AliCDBParam* param
 // calibType must be a valid CDB path! (3 level folder structure)
 
 
-       if(!fDefaultStorage) {
+       if(!fDefaultStorage && !fRaw) {
                AliError("Please activate a default storage first!");
                return;
        }
@@ -627,10 +647,10 @@ AliCDBEntry* AliCDBManager::Get(const AliCDBId& query) {
                 return NULL;
        }
 
-       if(fLock && query.GetFirstRun() != fRun)
+       if(fLock && !(fRun >= query.GetFirstRun() && fRun <= query.GetLastRun())) 
                AliFatal("Lock is ON: cannot use different run number than the internal one!");
        
-       if(fCache && query.GetFirstRun() != fRun)
+       if(fCache && !(fRun >= query.GetFirstRun() && fRun <= query.GetLastRun())) 
                AliWarning("Run number explicitly set in query: CDB cache temporarily disabled!");
 
        AliCDBEntry *entry=0;
@@ -911,7 +931,7 @@ TList* AliCDBManager::GetAll(const AliCDBId& query) {
 }
 
 //_____________________________________________________________________________
-Bool_t AliCDBManager::Put(TObject* object, AliCDBId& id,  AliCDBMetaData* metaData, DataType type){
+Bool_t AliCDBManager::Put(TObject* object, AliCDBId& id, AliCDBMetaData* metaData, const DataType type){
 // store an AliCDBEntry object into the database
 
        if (object==0x0) {
@@ -934,13 +954,13 @@ Bool_t AliCDBManager::Put(AliCDBEntry* entry, DataType type){
                return kFALSE;
        }
 
-       if (entry->GetObject()==0x0){
-               AliError("No valid object in CDB entry!");
+       if (!entry){
+               AliError("No entry!");
                return kFALSE;
        }
 
-       if (!entry){
-               AliError("No entry!");
+       if (entry->GetObject()==0x0){
+               AliError("No valid object in CDB entry!");
                return kFALSE;
        }
 
@@ -1043,7 +1063,7 @@ void AliCDBManager::SetRun(Int_t run)
 // Sets current run number.
 // When the run number changes the caching is cleared.
        
-       if (fRun == run)
+       if(fRun == run)
                return;
   
        if(fLock && fRun >= 0) {
@@ -1051,13 +1071,14 @@ void AliCDBManager::SetRun(Int_t run)
        }       
                
        fRun = run;
-       if (fRaw){
+       if(fRaw){
                // here the LHCPeriod xml file is parsed; the string containing the correct period is returned; the default storage is set
                if (fStartRunLHCPeriod <= run && fEndRunLHCPeriod >= run){
                        AliInfo("LHCPeriod alien folder for current run already in memory");
-               }
-               else {
+               }else{
                        SetDefaultStorageFromRun(run);
+                       if(fEntryCache.GetEntries()!=0) ClearCache();
+                       return;
                }
        }
        ClearCache();
@@ -1091,6 +1112,11 @@ void AliCDBManager::ClearCache(){
 void AliCDBManager::UnloadFromCache(const char* path){
 // unload cached object
 
+       if(!fActiveStorages.GetEntries()) {
+               AliDebug(2, Form("No active storages. Object \"%s\" is not unloaded from cache", path));
+               return;
+       }
+
        AliCDBPath queryPath(path);
        if(!queryPath.IsValid()) return;