From d3af4674c8d33b59bd2a074b3c71bfb84a9e7eb4 Mon Sep 17 00:00:00 2001 From: ivana Date: Mon, 10 Dec 2007 14:32:07 +0000 Subject: [PATCH] Adding functions LoadMpSegmentation2(), LoadDDLStore2() which allow to set the default CDB storage (for testing purposes) --- MUON/mapping/AliMpCDB.cxx | 71 +++++++++++++++++++++++++++++++++++++++ MUON/mapping/AliMpCDB.h | 10 ++++++ 2 files changed, 81 insertions(+) diff --git a/MUON/mapping/AliMpCDB.cxx b/MUON/mapping/AliMpCDB.cxx index 185e7a69940..cf6ed3d4964 100644 --- a/MUON/mapping/AliMpCDB.cxx +++ b/MUON/mapping/AliMpCDB.cxx @@ -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) { diff --git a/MUON/mapping/AliMpCDB.h b/MUON/mapping/AliMpCDB.h index 81ed1762bc2..c195126792c 100644 --- a/MUON/mapping/AliMpCDB.h +++ b/MUON/mapping/AliMpCDB.h @@ -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); -- 2.43.5