From: ivana Date: Wed, 3 Oct 2007 13:28:45 +0000 (+0000) Subject: - Added new static function ReadData() for loading from ASCII files X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=ac17c5831d2410ded6432176295670bc05641a28;ds=sidebyside - 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 --- diff --git a/MUON/mapping/AliMpDEStore.cxx b/MUON/mapping/AliMpDEStore.cxx index 94713b1107d..13f1c91580a 100644 --- a/MUON/mapping/AliMpDEStore.cxx +++ b/MUON/mapping/AliMpDEStore.cxx @@ -55,14 +55,33 @@ const char AliMpDEStore::fgkCommentPrefix = '#'; // //______________________________________________________________________________ -AliMpDEStore* AliMpDEStore::Instance() +AliMpDEStore* AliMpDEStore::Instance(Bool_t warn) { /// Create the DE store if it does not yet exist /// and return its instance - if ( ! fgInstance ) - fgInstance = new AliMpDEStore(); - + if ( ! fgInstance && warn ) { + AliWarningClass("DE Store has not been loaded"); + } + + return fgInstance; +} + +//______________________________________________________________________________ +AliMpDEStore* AliMpDEStore::ReadData(Bool_t warn) +{ +/// Load the DE store data from ASCII data files +/// and return its instance + + if ( fgInstance ) { + if ( warn ) + AliWarningClass("DE Store has been already loaded"); + return fgInstance; + } + + AliInfoClass("Reading DE Store from ASCII files."); + + fgInstance = new AliMpDEStore(); return fgInstance; } diff --git a/MUON/mapping/AliMpDEStore.h b/MUON/mapping/AliMpDEStore.h index 493a79e6db3..4e802ee09c6 100644 --- a/MUON/mapping/AliMpDEStore.h +++ b/MUON/mapping/AliMpDEStore.h @@ -34,7 +34,8 @@ class AliMpDEStore : public TObject { virtual ~AliMpDEStore(); // static access method - static AliMpDEStore* Instance(); + static AliMpDEStore* Instance(Bool_t warn = true); + static AliMpDEStore* ReadData(Bool_t warn = true); // methods AliMpDetElement* GetDetElement(Int_t detElemId, Bool_t warn = true) const;