]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
corrected way geometry is retrieved so that versions match with what is in geometry...
authorjklay <jklay@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 27 Feb 2008 20:38:37 +0000 (20:38 +0000)
committerjklay <jklay@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 27 Feb 2008 20:38:37 +0000 (20:38 +0000)
EMCAL/AliEMCALGeometry.cxx
EMCAL/AliEMCALRawUtils.cxx
EMCAL/AliEMCALReconstructor.cxx

index 6fdb604839458c6d5769f334c0de0eb2929f24ff..f505f5933c6d8a89973f28982ccc10ade7ec0806 100644 (file)
@@ -65,7 +65,7 @@ ClassImp(AliEMCALGeometry)
 // these initialisations are needed for a singleton
 AliEMCALGeometry  *AliEMCALGeometry::fgGeom      = 0;
 Bool_t             AliEMCALGeometry::fgInit      = kFALSE;
-Char_t*            AliEMCALGeometry::fgDefaultGeometryName = "SHISH_77_TRD1_2X2_FINAL_110DEG";
+Char_t*            AliEMCALGeometry::fgDefaultGeometryName = "SHISH_77_TRD1_2X2_FINAL_110DEG scTh=0.176 pbTh=0.144";
 //
 // Usage: 
 //        You can create the AliEMCALGeometry object independently from anything.
@@ -641,8 +641,8 @@ AliEMCALGeometry* AliEMCALGeometry::GetInstance(const Text_t* name,
       } // end if fgInit
     }else{
        if ( strcmp(fgGeom->GetName(), name) != 0) {
-         printf("\ncurrent geometry is %s : ", fgGeom->GetName());
-         printf(" you cannot call %s ", name);  
+         AliWarning(Form("\ncurrent geometry is %s : ", fgGeom->GetName())));
+         AliFatal(Form(" you cannot call %s ", name));  
        }else{
          rv = (AliEMCALGeometry *) fgGeom; 
        } // end 
index ebeb4c357c8eb7316523ac1118c9c36ad32da030..e30a960f247ed6907ddd05cff4124d76f71d8279 100644 (file)
@@ -56,6 +56,7 @@
 #include "TSystem.h"
 
 #include "AliLog.h"
+#include "AliRun.h"
 #include "AliRunLoader.h"
 #include "AliCaloAltroMapping.h"
 #include "AliAltroBuffer.h"
@@ -101,12 +102,18 @@ AliEMCALRawUtils::AliEMCALRawUtils()
     fMapping[i] = (AliAltroMapping*)maps->At(i);
   }
 
-  fGeom = AliEMCALGeometry::GetInstance();
-  if(!fGeom) {
-    fGeom = AliEMCALGeometry::GetInstance("","");
-    if(!fGeom) AliFatal(Form("Could not get geometry!!"));
+  //To make sure we match with the geometry in a simulation file,
+  //let's try to get it first.  If not, take the default geometry
+  AliRunLoader *rl = AliRunLoader::GetRunLoader();
+  if (rl->GetAliRun() && rl->GetAliRun()->GetDetector("EMCAL")) {
+    fGeom = dynamic_cast<AliEMCAL*>(rl->GetAliRun()->GetDetector("EMCAL"))->GetGeometry();
+  } else {
+    AliInfo(Form("Using default geometry in raw reco"));
+    fGeom =  AliEMCALGeometry::GetInstance(AliEMCALGeometry::GetDefaulGeometryName());
   }
 
+  if(!fGeom) AliFatal(Form("Could not get geometry!"));
+
 }
 
 //____________________________________________________________________________
index 5ac1668309c92966b750da6198da4efee8cd5ebc..71773f78661e7458acd4610f5683864b49d57b22 100644 (file)
@@ -46,6 +46,8 @@
 #include "AliEMCALRecParam.h"
 #include "AliEMCALGeometry.h"
 
+#include "AliRunLoader.h"
+#include "AliRun.h"
 
 ClassImp(AliEMCALReconstructor)
 
@@ -59,12 +61,19 @@ AliEMCALReconstructor::AliEMCALReconstructor()
   InitRecParam();
 
   fgRawUtils = new AliEMCALRawUtils;
-  fGeom = AliEMCALGeometry::GetInstance();
-  if(!fGeom) {
-    fGeom = AliEMCALGeometry::GetInstance("","");
-    if(!fGeom) AliFatal(Form("Could not get geometry!"));
+
+  //To make sure we match with the geometry in a simulation file,
+  //let's try to get it first.  If not, take the default geometry
+  AliRunLoader *rl = AliRunLoader::GetRunLoader();
+  if (rl->GetAliRun() && rl->GetAliRun()->GetDetector("EMCAL")) {
+    fGeom = dynamic_cast<AliEMCAL*>(rl->GetAliRun()->GetDetector("EMCAL"))->GetGeometry();
+  } else {
+    AliInfo(Form("Using default geometry in reconstruction"));
+    fGeom =  AliEMCALGeometry::GetInstance(AliEMCALGeometry::GetDefaulGeometryName());
   }
 
+  if(!fGeom) AliFatal(Form("Could not get geometry!"));
+
 } 
 
 //____________________________________________________________________________