]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Protection against not accessible input OCDB (Laurent)
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 17 Oct 2007 13:01:32 +0000 (13:01 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 17 Oct 2007 13:01:32 +0000 (13:01 +0000)
MUON/TestMUONPreprocessor.C
MUON/TestMUONPreprocessor.h
MUON/mapping/AliMpCDB.cxx

index fb5f2b1025c3d228453d6441c61feb728448e042..55c3302316315ec501adb21e064f3e29fc2322a1 100644 (file)
 /// b) select run type, using shuttle->AddInputRunParameter() (the run type
 ///    dictates which task is really performed by the MUONPreprocessor
 ///
+/// You must load relevant libraries (besides normal MUON ones) before
+/// compiling this macro :
+///
+/// gSystem->Load("$ALICE_ROOT/SHUTTLE/TestShuttle/libTestShuttle");
+/// gSystem->Load("libMUONshuttle.so");
+///
+///
 /// For more information on usage, please see READMEshuttle.
 ///
 // By Laurent Aphecetche, SUBATECH Nantes
 #include "TestMUONPreprocessor.h"
 
 #include "AliMUONTrackerPreprocessor.h"
-#include "AliMUONHVNamer.h"
+
+#include "AliLog.h"
 
 #include "AliMpExMap.h"
 #include "AliMpHelper.h"
+#include "AliMpHVNamer.h"
 #include "AliMpCDB.h"
 
 #include "AliCDBManager.h"
@@ -66,29 +75,30 @@ void TestMUONPreprocessor(Int_t runNumber=80, const char* runType="PEDESTAL_RUN"
   // PHYSICS -> HV
   // GMS
   
-  // load library
-  gSystem->Load("../SHUTTLE/TestShuttle/libTestShuttle.so");
-  gSystem->Load("libMUONshuttle.so");
-  
   // create AliTestShuttle instance
   // The parameters are run, startTime, endTime
   AliTestShuttle* shuttle = new AliTestShuttle(runNumber, 0, 1);
-
   
-  AliTestShuttle::SetMainCDB("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
+  const char* inputCDB = "local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB";
+    
+  AliTestShuttle::SetMainCDB(inputCDB);
   AliTestShuttle::SetMainRefStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestReference");
 
+  // Create DCS HV aliases
+  TMap* dcsAliasMap = CreateDCSAliasMap(inputCDB);
+  
+  if ( dcsAliasMap ) 
+  {
+    // now give the alias map to the shuttle
+    shuttle->SetDCSInput(dcsAliasMap);
+  }
+  
+  
   printf("Test Shuttle temp dir: %s\n", AliShuttleInterface::GetShuttleTempDir());
   printf("Test Shuttle log dir: %s\n", AliShuttleInterface::GetShuttleLogDir());
   printf("Test OCDB storage Uri: %s\n", AliShuttleInterface::GetMainCDB().Data());
   printf("Test Reference storage Uri: %s\n", AliShuttleInterface::GetMainRefStorage().Data());
   
-  // Create DCS HV aliases
-  TMap* dcsAliasMap = CreateDCSAliasMap();
-
-  // now give the alias map to the shuttle
-  shuttle->SetDCSInput(dcsAliasMap);
-
   // The shuttle can process files that originate from DCS, DAQ and HLT.
   // To test it, we provide some local files and locations where these would be found when
   // the online machinery would be there.
@@ -127,7 +137,7 @@ void TestMUONPreprocessor(Int_t runNumber=80, const char* runType="PEDESTAL_RUN"
   shuttle->Process();
 }
 
-TMap* CreateDCSAliasMap()
+TMap* CreateDCSAliasMap(const char* inputCDB)
 {
   /// Creates a DCS structure for MUON Tracker HV
   ///
@@ -138,15 +148,35 @@ TMap* CreateDCSAliasMap()
   ///     <valueList> is a TObjArray of AliDCSValue
   ///     An AliDCSValue consists of timestamp and a value in form of a AliSimpleValue
   
+  Bool_t undefStorage(kFALSE);
+  
+  AliCDBManager* man = AliCDBManager::Instance();
+  if (!man->IsDefaultStorageSet())
+  {
+    undefStorage = kTRUE;
+    man->SetDefaultStorage(inputCDB);
+  }
+  
   // Load mapping
-  AliMpCDB::LoadDDLStore();
+  Bool_t ok = AliMpCDB::LoadDDLStore();
+  
+  if (undefStorage)
+  {
+    man->UnsetDefaultStorage();
+  }
+  
+  if (!ok)
+  {
+    AliErrorGeneral("CreateDCSAliasMap","Could not load DDLStore from OCDB");
+    return 0x0;
+  }
 
   TMap* aliasMap = new TMap;
   aliasMap->SetOwner(kTRUE);
   
   TRandom random(0);
   
-  AliMUONHVNamer hvNamer;
+  AliMpHVNamer hvNamer;
   
   TObjArray* aliases = hvNamer.GenerateAliases();
   
index 82335ba7620cc738118e54f9a552b852dc824c79..20eb546ab082f5ff9f2601c729b4607ab4ef6ce1 100644 (file)
@@ -3,6 +3,6 @@
 
 class TMap;
 
-TMap* CreateDCSAliasMap();
+TMap* CreateDCSAliasMap(const char* inputCDB);
 
 #endif
index 47c4557f25324ef6dbcbc9fd610cd68fedee2271..99557082ca8690340c54f1431269de95d5003485 100644 (file)
@@ -68,10 +68,16 @@ Bool_t AliMpCDB::LoadMpSegmentation(Bool_t warn)
     cdbManager->SetRun(run);
   }  
 
-  AliCDBEntry* cdbEntry 
-    =  cdbManager->Get("MUON/Calib/Mapping", run);
+  AliCDBEntry* cdbEntry = cdbManager->Get("MUON/Calib/Mapping", run);
   
-  return (AliMpSegmentation*)cdbEntry->GetObject() != 0x0;
+  if ( cdbEntry ) 
+  {
+    return (AliMpSegmentation*)cdbEntry->GetObject() != 0x0;
+  }
+  else
+  {
+    return kFALSE;
+  }
 }    
 
 //______________________________________________________________________________
@@ -104,10 +110,16 @@ Bool_t AliMpCDB::LoadDDLStore(Bool_t warn)
     cdbManager->SetRun(run);
   }  
 
-  AliCDBEntry* cdbEntry 
-    =  cdbManager->Get("MUON/Calib/DDLStore", run);
+  AliCDBEntry* cdbEntry =  cdbManager->Get("MUON/Calib/DDLStore", run);
   
-  return (AliMpDDLStore*)cdbEntry->GetObject() != 0x0;
+  if ( cdbEntry ) 
+  {
+    return (AliMpDDLStore*)cdbEntry->GetObject() != 0x0;
+  }
+  else
+  {
+    return kFALSE;
+  }
 }    
 
 //______________________________________________________________________________