Skip to content

Commit

Permalink
nan protection
Browse files Browse the repository at this point in the history
  • Loading branch information
jhgoh committed May 26, 2017
1 parent 4ecd0de commit f9fecde
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions RecoLocalMuon/RPCRecHit/src/RPCCluster.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ int RPCCluster::bx() const { return bunchx; }

bool RPCCluster::hasTime() const { return nTime > 0; }
float RPCCluster::time() const { return hasTime() ? sumTime/nTime : 0; }
float RPCCluster::timeRMS() const { return hasTime() ? sqrt((sumTime2*nTime - sumTime*sumTime)/nTime) : -1; }
float RPCCluster::timeRMS() const { return hasTime() ? sqrt(std::max(0.F, sumTime2*nTime - sumTime*sumTime)/nTime) : -1; }

bool RPCCluster::hasY() const { return nY > 0; }
float RPCCluster::y() const { return hasY() ? sumY/nY : 0; }
float RPCCluster::yRMS() const { return hasY() ? sqrt((sumY2*nY - sumY*sumY)/nY) : -1; }
float RPCCluster::yRMS() const { return hasY() ? sqrt(std::max(0.F, sumY2*nY - sumY*sumY)/nY) : -1; }

bool RPCCluster::isAdjacent(const RPCCluster& cl) const
{
Expand Down

0 comments on commit f9fecde

Please sign in to comment.