]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Search for new detector object only in case its loader changed
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 27 Aug 2004 09:00:06 +0000 (09:00 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 27 Aug 2004 09:00:06 +0000 (09:00 +0000)
EMCAL/AliEMCALGetter.cxx
PHOS/AliPHOSGetter.cxx

index fb48153b7c758f1a17f8e7fe20fab9a02af71389..9ef6fb7e83689d1b9131afc84044c178515708f6 100644 (file)
@@ -390,7 +390,16 @@ Int_t AliEMCALGetter::NPrimaries() const
 AliEMCAL * AliEMCALGetter:: EMCAL() const  
 {
   // returns the EMCAL object 
-  AliEMCAL * emcal = dynamic_cast<AliEMCAL*>(EmcalLoader()->GetModulesFolder()->FindObject("EMCAL")) ;  
+  AliEMCALLoader *    loader = 0;
+  static AliEMCALLoader * oldloader = 0;
+  static AliEMCAL * emcal = 0;
+
+  loader = EmcalLoader();
+
+  if (loader != oldloader ) {
+    emcal = dynamic_cast<AliEMCAL*>(loader->GetModulesFolder()->FindObject("EMCAL")) ;  
+    oldloader = loader;
+  }
   if (!emcal) 
     if (fgDebug)
       Warning("EMCAL", "EMCAL module not found in module folders: %s", EmcalLoader()->GetModulesFolder()->GetName() ) ; 
index 9f94b708c39f7a1e9c16b588a51ef53919d0a711..7fe9f3b3ed96b38e086ad4ad97a7ab9bf1875291 100644 (file)
@@ -421,7 +421,16 @@ TParticle * AliPHOSGetter::Primary(Int_t index) const
 AliPHOS * AliPHOSGetter:: PHOS() const  
 {
   // returns the PHOS object 
-  AliPHOS * phos = dynamic_cast<AliPHOS*>(PhosLoader()->GetModulesFolder()->FindObject("PHOS")) ;  
+  AliPHOSLoader *    loader = 0;
+  static AliPHOSLoader * oldloader = 0;
+  static AliPHOS * phos = 0;
+
+  loader = PhosLoader();
+
+  if ( loader != oldloader) {
+    phos = dynamic_cast<AliPHOS*>(loader->GetModulesFolder()->FindObject("PHOS")) ;
+    oldloader = loader;
+  }
   if (!phos) 
     if (fgDebug)
       Warning("PHOS", "PHOS module not found in module folders: %s", PhosLoader()->GetModulesFolder()->GetName() ) ;