]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TGeant4/TG4GeometryServices.cxx
Correction in CompareElement (to prevent from crash when vacuum (z<1) is passed.
[u/mrichter/AliRoot.git] / TGeant4 / TG4GeometryServices.cxx
index 8e5434bdaaeb89d2ec7dd9f04b1143c82619e82f..9d6513aaf530e23e2b405be5b7e9180024c4c5a0 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;