]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/CDB/AliCDBManager.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / STEER / CDB / AliCDBManager.cxx
index 1573fee288d8558f00c3398c92b2678b1f012ae8..26e754dba3a6be2239aee79767283aeed44915cd 100644 (file)
@@ -385,7 +385,7 @@ AliCDBParam* AliCDBManager::CreateParameter(const char* dbString) const {
 
   TString uriString(dbString);
 
-  if (! fCvmfsOcdb.IsNull()) {
+  if ( !fCvmfsOcdb.IsNull() && uriString.BeginsWith("alien://")) {
     AlienToCvmfsUri(uriString);
   }
 
@@ -405,9 +405,6 @@ AliCDBParam* AliCDBManager::CreateParameter(const char* dbString) const {
 void AliCDBManager::AlienToCvmfsUri(TString& uriString) const {
 // convert alien storage uri to local:///cvmfs storage uri (called when OCDB_PATH is set)
 
-  if (! uriString.BeginsWith("alien://") && !fCvmfsOcdb.IsNull())
-    AliFatal("Cannot set local://cvmfs storage for a non alien uri");
-
   TObjArray *arr = uriString.Tokenize('?');
   TIter iter(arr);
   TObjString *str = 0;
@@ -428,10 +425,10 @@ void AliCDBManager::AlienToCvmfsUri(TString& uriString) const {
       TString rawFolder = entryValue(re_RawFolder);
       TString mcFolder = entryValue(re_MCFolder);
       if ( !rawFolder.IsNull() ){
-        entryValue.Replace(0, 6, "/cvmfs/alice.cern.ch/calibration");
-        entryValue.Replace(entryValue.Length()-4, entryValue.Length(), "");
+        entryValue.Replace(0, 6, "/cvmfs/alice-ocdb.cern.ch/calibration");
+        //entryValue.Replace(entryValue.Length()-4, entryValue.Length(), "");
       } else if ( !mcFolder.IsNull() ){
-        entryValue.Replace(0,36,"/cvmfs/alice.cern.ch/calibration/MC");
+        entryValue.Replace(0,36,"/cvmfs/alice-ocdb.cern.ch/calibration/MC");
       } else {
         AliFatal(Form("Environment variable for cvmfs OCDB folder set for an invalid OCDB storage:\n   %s", entryValue.Data()));
       }
@@ -502,18 +499,14 @@ AliCDBStorage* AliCDBManager::GetStorage(const AliCDBParam* param) {
       if(fRun >= 0) {
         if( aStorage->GetType() == "alien" || aStorage->GetType() == "local" )
           aStorage->QueryCDB(fRun);
-        //} else {
-        //     AliDebug(2,
-        //             "Skipping query for valid files, it is used only in grid...");
-        //}
+      }
+      return aStorage;
     }
-    return aStorage;
   }
-}
 
-AliError(Form("Failed to activate requested storage! Check URI: %s", param->GetURI().Data()));
+  AliError(Form("Failed to activate requested storage! Check URI: %s", param->GetURI().Data()));
 
-return NULL;
+  return NULL;
 }
 
 //_____________________________________________________________________________
@@ -746,15 +739,13 @@ void AliCDBManager::SetDefaultStorageFromRun(Int_t run) {
     }
 
     // now read the file with the uri and first and last run
-    ifstream *file = new ifstream(inoutFile.Data());
-    if (!*file) {
+    std::ifstream file(inoutFile.Data());
+    if (!file.is_open()) {
       AliFatal(Form("Error opening file \"%s\"!", inoutFile.Data()));
-      file->close();
-      delete file;
     }
     TString lhcPeriod;
     TObjArray* oStringsArray = 0;
-    while (lhcPeriod.ReadLine(*file)){
+    while (lhcPeriod.ReadLine(file)){
       oStringsArray = lhcPeriod.Tokenize(' ');
     }
     TObjString *oStrUri = dynamic_cast<TObjString*> (oStringsArray->At(0));
@@ -767,8 +758,7 @@ void AliCDBManager::SetDefaultStorageFromRun(Int_t run) {
     fStartRunLHCPeriod = firstRun.Atoi();
     fEndRunLHCPeriod = lastRun.Atoi();
 
-    file->close();
-    delete file;
+    file.close();
 
   } else { // if not cvmfs case, "plain" AliEn case
     // retrieve XML file from alien
@@ -853,7 +843,6 @@ void AliCDBManager::SetSpecificStorage(const char* calibType, const AliCDBParam*
     return;
   }
 
-
   AliCDBPath aPath(calibType);
   if(!aPath.IsValid()){
     AliError(Form("Not a valid path: %s", calibType));
@@ -1658,8 +1647,8 @@ void AliCDBManager::QueryCDB() {
     if(aPar) {
       AliDebug(2,Form("Querying specific storage %s",aCalibType->GetName()));
       AliCDBStorage *aStorage = GetStorage(aPar);
-      if(aStorage->GetType() == "alien"){
-        aStorage->QueryCDB(fRun,aCalibType->GetName());
+      if(aStorage->GetType() == "alien" || aStorage->GetType() == "local"){
+        aStorage->QueryCDB(fRun, aCalibType->GetName());
       } else {
         AliDebug(2,
             "Skipping query for valid files, it is used only in grid...");