Correction in CompareElement (to prevent from crash when vacuum (z<1) is passed.
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 8 Oct 2001 13:20:34 +0000 (13:20 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 8 Oct 2001 13:20:34 +0000 (13:20 +0000)
TGeant4/TG4GeometryServices.cxx

index 8e5434b..9d6513a 100644 (file)
@@ -117,7 +117,13 @@ G4bool TG4GeometryServices::CompareElement(G4double a, G4double z,
   G4double ze = element->GetZ();
 
   // g3tog4 can redefine A
-  G4double ax = G3Ele.GetEle(z)->GetA()/TG4G3Units::AtomicWeight();
+  G4double ax;
+  if (z<1) {
+    // vacuum 
+    ax = 1.01*g/mole; 
+  }
+  else  
+    ax = G3Ele.GetEle(z)->GetA()/TG4G3Units::AtomicWeight();
 
   if (abs(ax - ae) < fgkAZTolerance && abs(z  - ze) < fgkAZTolerance) 
     return true;