If the TRD geometry is not stored in the file, get it from gAlice
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 Feb 2005 04:33:22 +0000 (04:33 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 Feb 2005 04:33:22 +0000 (04:33 +0000)
TRD/AliTRDgeometry.cxx

index 4641b32..9dda6b0 100644 (file)
@@ -28,6 +28,9 @@
 #include "AliTRDgeometry.h"
 #include "AliTRDparameter.h"
 
+#include "AliRun.h"
+#include "AliTRD.h"
+
 ClassImp(AliTRDgeometry)
 
 //_____________________________________________________________________________
@@ -507,7 +510,15 @@ AliTRDgeometry* AliTRDgeometry::GetGeometry(AliRunLoader* runLoader)
   TDirectory* saveDir = gDirectory;
   runLoader->CdGAFile();
 
+  // Try from the galice.root file
   AliTRDgeometry* geom = (AliTRDgeometry*) gDirectory->Get("TRDgeometry");
+
+  if (!geom) {
+    // It is not in the file, try to get it from gAlice, 
+    // which corresponds to the run loader 
+    AliTRD * trd = (AliTRD*)runLoader->GetAliRun()->GetDetector("TRD");
+    geom = trd->GetGeometry();
+  }
   if (!geom) ::Error("AliTRDgeometry::GetGeometry", "Geometry not found");
 
   saveDir->cd();