]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Adding functions LoadMpSegmentation2(), LoadDDLStore2()
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 10 Dec 2007 14:32:07 +0000 (14:32 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 10 Dec 2007 14:32:07 +0000 (14:32 +0000)
which allow to set the default CDB storage
(for testing purposes)

MUON/mapping/AliMpCDB.cxx
MUON/mapping/AliMpCDB.h

index 185e7a699400fb90adc06877650236e11b2b9bea..cf6ed3d49640ae22e3c4debbb47a504348fb970a 100644 (file)
@@ -127,6 +127,77 @@ Bool_t AliMpCDB::LoadDDLStore(Bool_t warn)
   }
 }    
 
+//______________________________________________________________________________
+Bool_t AliMpCDB::LoadMpSegmentation2(const char* cdbpath, Int_t runNumber, 
+                                     Bool_t warn)
+{
+/// Load the sementation from the CDB if it does not yet exist;
+/// return false only in case loading from CDB failed.
+/// In difference from LoadMpSegmentation(), in this method the CDB path
+/// and run is set directly via arguments.
+
+
+  AliDebugClass(1,"");
+
+  if ( AliMpSegmentation::Instance(false) ) {
+    if ( warn )  
+      AliWarningClass("Segmentation has been already loaded."); 
+    return true;
+  }  
+  
+  AliCDBManager* cdbManager = AliCDBManager::Instance();
+  cdbManager->SetDefaultStorage(cdbpath);
+
+  AliCDBEntry* cdbEntry = cdbManager->Get("MUON/Calib/Mapping", runNumber);
+  
+  if ( cdbEntry ) 
+  {
+    return (AliMpSegmentation*)cdbEntry->GetObject() != 0x0;
+  }
+  else
+  {
+    return kFALSE;
+  }
+}    
+
+//______________________________________________________________________________
+Bool_t AliMpCDB::LoadDDLStore2(const char* cdbpath, Int_t runNumber, 
+                               Bool_t warn)
+{
+/// Load the DDL store from the CDB if it does not yet exist
+/// return false only in case loading from CDB failed
+/// In difference from LoadDDLStore(), in this method the CDB path
+/// and run is set directly via arguments.
+
+  AliDebugClass(1,"");
+
+  if ( AliMpDDLStore::Instance(false) ) {
+    if ( warn )  
+      AliWarningClass("DDL Store has been already loaded."); 
+    return true;
+  }  
+  
+  // Load segmentation
+  //
+  LoadMpSegmentation2(cdbpath, runNumber, warn); 
+  
+  // Load DDL store
+  //
+  AliCDBManager* cdbManager = AliCDBManager::Instance();
+  cdbManager->SetDefaultStorage(cdbpath);
+
+  AliCDBEntry* cdbEntry =  cdbManager->Get("MUON/Calib/DDLStore", runNumber);
+  
+  if ( cdbEntry ) 
+  {
+    return (AliMpDDLStore*)cdbEntry->GetObject() != 0x0;
+  }
+  else
+  {
+    return kFALSE;
+  }
+}    
+
 //______________________________________________________________________________
 Bool_t AliMpCDB::WriteMpSegmentation(Bool_t readData)
 {
index 81ed1762bc2596be568f54a5cf0303aa6ac2b18f..c195126792caa41fea8a54acab82d7cb6f7ab672 100644 (file)
@@ -25,6 +25,16 @@ class AliMpCDB : public  TObject {
     // static methods
     static Bool_t LoadMpSegmentation(Bool_t warn = false);
     static Bool_t LoadDDLStore(Bool_t warn = false);
+    
+    
+    static Bool_t LoadMpSegmentation2(
+                    const char* cdbpath = "local://$ALICE_ROOT",
+                    Int_t runNumber = 0,
+                    Bool_t warn = false);
+    static Bool_t LoadDDLStore2(
+                    const char* cdbpath = "local://$ALICE_ROOT",
+                    Int_t runNumber = 0,
+                    Bool_t warn = false);
 
     static Bool_t WriteMpSegmentation(Bool_t readData = true);
     static Bool_t WriteDDLStore(Bool_t readData= true);