Skip to content

Commit

Permalink
Fix for cone safety when point is on the wrong side.
Browse files Browse the repository at this point in the history
  • Loading branch information
agheata committed Apr 12, 2016
1 parent 53b36eb commit 1ad72e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion geom/geom/src/TGeoCone.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,9 @@ Double_t TGeoCone::Safety(const Double_t *point, Bool_t in) const
saf[1] = TGeoShape::SafetySeg(r,point[2], fRmax2, fDz, fRmin2, fDz, !in);
saf[2] = TGeoShape::SafetySeg(r,point[2], fRmin2, fDz, fRmin1, -fDz, !in);
saf[3] = TGeoShape::SafetySeg(r,point[2], fRmax1, -fDz, fRmax2, fDz, !in);
return saf[TMath::LocMin(4,saf)];
Double_t safety = saf[TMath::LocMin(4,saf)];
if (safety>1.E20) safety = 0.;
return safety;
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion geom/geom/src/TGeoShape.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ Double_t TGeoShape::SafetySeg(Double_t r, Double_t z, Double_t r1, Double_t z1,
Double_t crossp = (z2-z1)*(r-r1)-(z-z1)*(r2-r1);
crossp *= (outer) ? 1. : -1.;
// Positive crossp means point on the requested side of the (1,2) segment
if (crossp < 0) {
if (crossp < -TGeoShape::Tolerance()) {
// if (((z-z1)*(z2-z)) > -1.E-10) return 0;
if (outer) return TGeoShape::Big();
else return 0.;
Expand Down

0 comments on commit 1ad72e1

Please sign in to comment.