]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Take into account different MC/raw Uri structure
authorrgrosso <Raffaele.Grosso@cern.ch>
Wed, 19 Feb 2014 16:11:52 +0000 (17:11 +0100)
committerrgrosso <Raffaele.Grosso@cern.ch>
Thu, 20 Feb 2014 08:19:09 +0000 (09:19 +0100)
STEER/CDB/AliCDBLocal.cxx
STEER/CDB/AliCDBManager.cxx

index 107c17232d159344dcfe8e89c09abdd9fa7fdff9..683ac1f072c6b513e14552d60839e6c453f278cb 100644 (file)
@@ -938,9 +938,16 @@ void AliCDBLocal::QueryValidCVMFSFiles(TString& cvmfsOcdbTag) {
   TString uri(GetURI());
   uri.Remove(TString::kTrailing, '/');
   TObjArray * osArr = uri.Tokenize('/');
-  TObjString* mcdata_os = dynamic_cast<TObjString*>(osArr->At(osArr->GetEntries()-2));
+  TObjString* mcdata_os = dynamic_cast<TObjString*>(osArr->At(osArr->GetEntries()-3));
+  TObjString* yeartype_os = 0;
   TString mcdata = mcdata_os->GetString();
-  TObjString* yeartype_os = dynamic_cast<TObjString*>(osArr->At(osArr->GetEntries()-1));
+  if( mcdata == TString("data")) {
+    yeartype_os = dynamic_cast<TObjString*>(osArr->At(osArr->GetEntries()-2));
+  } else {
+    mcdata_os = dynamic_cast<TObjString*>(osArr->At(osArr->GetEntries()-2));
+    yeartype_os = dynamic_cast<TObjString*>(osArr->At(osArr->GetEntries()-1));
+  }
+  mcdata = mcdata_os->GetString();
   TString yeartype = yeartype_os->GetString();
   command += mcdata;
   command += '/';
@@ -975,8 +982,16 @@ void AliCDBLocal::QueryValidCVMFSFiles(TString& cvmfsOcdbTag) {
   }
   TString filepath;
   while (filepath.ReadLine(*file)) {
+    // skip line in case it is not a root file path
+    if(! filepath.EndsWith(".root")) {
+      continue;
+    }
     //extract three-level path and basename
     TObjArray *tokens = filepath.Tokenize('/');
+    if (tokens->GetEntries() < 5) {
+      AliError(Form("\"%s\" is not a valid cvmfs path for an OCDB object", filepath.Data()));
+      continue;
+    }
     TObjString *baseNameOstr = (TObjString*) tokens->At(tokens->GetEntries()-1);
     TString baseName(baseNameOstr->String());
     TObjString *l0oStr = (TObjString*) tokens->At(tokens->GetEntries()-4);
index 1573fee288d8558f00c3398c92b2678b1f012ae8..f1377456c1c68ee43c98ae11e79b2c3ee493f719 100644 (file)
@@ -429,7 +429,7 @@ void AliCDBManager::AlienToCvmfsUri(TString& uriString) const {
       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(entryValue.Length()-4, entryValue.Length(), "");
       } else if ( !mcFolder.IsNull() ){
         entryValue.Replace(0,36,"/cvmfs/alice.cern.ch/calibration/MC");
       } else {
@@ -502,18 +502,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;
+    }
   }
-}
 
-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;
 }
 
 //_____________________________________________________________________________
@@ -1658,7 +1654,7 @@ void AliCDBManager::QueryCDB() {
     if(aPar) {
       AliDebug(2,Form("Querying specific storage %s",aCalibType->GetName()));
       AliCDBStorage *aStorage = GetStorage(aPar);
-      if(aStorage->GetType() == "alien"){
+      if(aStorage->GetType() == "alien" || aStorage->GetType() == "local"){
         aStorage->QueryCDB(fRun,aCalibType->GetName());
       } else {
         AliDebug(2,