From 5f377a9a784413aa47621ae8973c6394d184a596 Mon Sep 17 00:00:00 2001 From: ivana Date: Fri, 6 Jul 2007 13:12:42 +0000 Subject: [PATCH] - Added new static function ReadData() for loading from ASCII files - Instance() does not load data automatically anymore, but client has to take care of it --- MUON/mapping/AliMpDDLStore.cxx | 28 +++++++++++++++++++++---- MUON/mapping/AliMpDDLStore.h | 3 ++- MUON/mapping/AliMpSegmentation.cxx | 33 ++++++++++++++++++++++++------ MUON/mapping/AliMpSegmentation.h | 3 ++- 4 files changed, 55 insertions(+), 12 deletions(-) diff --git a/MUON/mapping/AliMpDDLStore.cxx b/MUON/mapping/AliMpDDLStore.cxx index c63540c93d2..43ebb67208b 100644 --- a/MUON/mapping/AliMpDDLStore.cxx +++ b/MUON/mapping/AliMpDDLStore.cxx @@ -46,6 +46,7 @@ #include #include #include +#include /// \cond CLASSIMP ClassImp(AliMpDDLStore) @@ -60,14 +61,33 @@ const Int_t AliMpDDLStore::fgkNofTriggerDDLs = 2; // //______________________________________________________________________________ -AliMpDDLStore* AliMpDDLStore::Instance() +AliMpDDLStore* AliMpDDLStore::Instance(Bool_t warn) { /// Create the DDL store if it does not yet exist /// and return its instance - if ( ! fgInstance ) - fgInstance = new AliMpDDLStore(); - + if ( ! fgInstance && warn ) { + AliWarningClass("DDL Store has not beenloaded"); + } + + return fgInstance; +} + +//______________________________________________________________________________ +AliMpDDLStore* AliMpDDLStore::ReadData(Bool_t warn) +{ +/// Load the DDL store rom ASCII data files +/// and return its instance + + if ( fgInstance ) { + if ( warn ) + AliWarningClass("DDL Store has been already loaded"); + return fgInstance; + } + + AliInfoClass("Reading DDL Store from ASCII files."); + + fgInstance = new AliMpDDLStore(); return fgInstance; } diff --git a/MUON/mapping/AliMpDDLStore.h b/MUON/mapping/AliMpDDLStore.h index 507698f69f0..32268e3de40 100644 --- a/MUON/mapping/AliMpDDLStore.h +++ b/MUON/mapping/AliMpDDLStore.h @@ -40,7 +40,8 @@ class AliMpDDLStore : public TObject { virtual ~AliMpDDLStore(); // static access method - static AliMpDDLStore* Instance(); + static AliMpDDLStore* Instance(Bool_t warn = true); + static AliMpDDLStore* ReadData(Bool_t warn = true); // methods AliMpDDL* GetDDL(Int_t ddlId, Bool_t warn = true) const; diff --git a/MUON/mapping/AliMpSegmentation.cxx b/MUON/mapping/AliMpSegmentation.cxx index 12911cfe8aa..e6c2dec0000 100644 --- a/MUON/mapping/AliMpSegmentation.cxx +++ b/MUON/mapping/AliMpSegmentation.cxx @@ -42,11 +42,14 @@ #include "AliMpCathodType.h" #include "AliLog.h" +#include "AliCDBManager.h" +#include "AliCDBEntry.h" #include #include #include #include +#include /// \cond CLASSIMP ClassImp(AliMpSegmentation) @@ -59,17 +62,35 @@ AliMpSegmentation* AliMpSegmentation::fgInstance = 0; // //______________________________________________________________________________ -AliMpSegmentation* AliMpSegmentation::Instance() +AliMpSegmentation* AliMpSegmentation::Instance(Bool_t warn) { -/// Create the sementation if it does not yet exist -/// and return its instance +/// Return its instance - if ( ! fgInstance ) - fgInstance = new AliMpSegmentation(); + if ( ! fgInstance && warn ) { + AliWarningClass("Segmentation has not been loaded"); + } return fgInstance; } +//______________________________________________________________________________ +AliMpSegmentation* AliMpSegmentation::ReadData(Bool_t warn) +{ +/// Load the sementation from ASCII data files +/// and return its instance + + if ( fgInstance ) { + if ( warn ) + AliWarningClass("Segmentation has been already loaded"); + return fgInstance; + } + + AliInfoClass("Reading segmentation from ASCII files."); + + fgInstance = new AliMpSegmentation(); + return fgInstance; +} + // // ctors, dtor // @@ -81,7 +102,7 @@ AliMpSegmentation::AliMpSegmentation() fElCardsMap(true), fSlatMotifMap() { -/// Standard constructor +/// Standard constructor - segmentation is loaded from ASCII data files AliDebug(1,""); fElCardsMap.SetOwner(true); diff --git a/MUON/mapping/AliMpSegmentation.h b/MUON/mapping/AliMpSegmentation.h index 8cef7285848..df758b41222 100644 --- a/MUON/mapping/AliMpSegmentation.h +++ b/MUON/mapping/AliMpSegmentation.h @@ -51,7 +51,8 @@ class AliMpSegmentation : public TObject { virtual ~AliMpSegmentation(); // static methods - static AliMpSegmentation* Instance(); + static AliMpSegmentation* Instance(Bool_t warn = true); + static AliMpSegmentation* ReadData(Bool_t warn = true); // methods const AliMpVSegmentation* GetMpSegmentation( -- 2.43.0