Skip to content

Commit

Permalink
Added one control for the input value of asin to avoid NAN.
Browse files Browse the repository at this point in the history
  • Loading branch information
shaojunlu authored and gaede committed Sep 12, 2017
1 parent f301806 commit 70cda99
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions source/Digitisers/src/DDTPCDigiProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1597,12 +1597,16 @@ double DDTPCDigiProcessor::getPadTheta(CLHEP::Hep3Vector* firstPoint, CLHEP::Hep
) / 2.0 ) / theCircle.GetRadius() ) * theCircle.GetRadius() ;


double pathlength2 = 2.0 * asin( ( sqrt (
(lastPointRPhi.x()-middlePointRPhi.x()) * (lastPointRPhi.x()-middlePointRPhi.x())
+
(lastPointRPhi.y()-middlePointRPhi.y()) * (lastPointRPhi.y()-middlePointRPhi.y())
) / 2.0 ) / theCircle.GetRadius() ) * theCircle.GetRadius() ;

double pathlength2 = ( ( sqrt ( (lastPointRPhi.x()-middlePointRPhi.x()) * (lastPointRPhi.x()-middlePointRPhi.x())
+ (lastPointRPhi.y()-middlePointRPhi.y()) * (lastPointRPhi.y()-middlePointRPhi.y())
) / 2.0 ) / theCircle.GetRadius() >= 1.0 ) ?
( 2.0 * asin( 1.0 ) * theCircle.GetRadius() )
:
( 2.0 * asin( ( sqrt (
(lastPointRPhi.x()-middlePointRPhi.x()) * (lastPointRPhi.x()-middlePointRPhi.x())
+
(lastPointRPhi.y()-middlePointRPhi.y()) * (lastPointRPhi.y()-middlePointRPhi.y())
) / 2.0 ) / theCircle.GetRadius() ) * theCircle.GetRadius() ) ;

padTheta = atan ((fabs(pathlength1 + pathlength2)) / (fabs(lastPoint->z() - firstPoint->z())) ) ;

Expand Down

0 comments on commit 70cda99

Please sign in to comment.