From a2fea429c3615a22e010ec8b0f68fc6ba864c315 Mon Sep 17 00:00:00 2001 From: swmukher Date: Fri, 1 Oct 2021 09:14:48 +0200 Subject: [PATCH] moving sinh conversion to constructor for speed-up --- .../interface/MinHitsTrajectoryFilter.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/TrackingTools/TrajectoryFiltering/interface/MinHitsTrajectoryFilter.h b/TrackingTools/TrajectoryFiltering/interface/MinHitsTrajectoryFilter.h index 0dbda945ff292..cb992b064e1b3 100644 --- a/TrackingTools/TrajectoryFiltering/interface/MinHitsTrajectoryFilter.h +++ b/TrackingTools/TrajectoryFiltering/interface/MinHitsTrajectoryFilter.h @@ -13,7 +13,7 @@ class MinHitsTrajectoryFilter final : public TrajectoryFilter { public: explicit MinHitsTrajectoryFilter(int minHits = 5, - double highEtaSwitch = 5.0, + double highEtaSwitch = sinh(5.0), int minHitsAtHighEta = 5, int seedPairPenalty = 0) : theMinHits(minHits), @@ -23,7 +23,7 @@ class MinHitsTrajectoryFilter final : public TrajectoryFilter { MinHitsTrajectoryFilter(const edm::ParameterSet& pset, edm::ConsumesCollector& iC) : theMinHits(pset.getParameter("minimumNumberOfHits")), - theHighEtaSwitch(pset.getParameter("highEtaSwitch")), + theHighEtaSwitch(sinh(pset.getParameter("highEtaSwitch"))), theMinHitsAtHighEta(pset.getParameter("minHitsAtHighEta")), theSeedPairPenalty(pset.getParameter("seedPairPenalty")) {} @@ -51,11 +51,10 @@ class MinHitsTrajectoryFilter final : public TrajectoryFilter { bool passed = false; if (!traj.empty()) { - auto pt = traj.lastMeasurement().updatedState().freeTrajectoryState()->momentum().perp(); + auto pt2 = traj.lastMeasurement().updatedState().freeTrajectoryState()->momentum().perp2(); auto pz = traj.lastMeasurement().updatedState().freeTrajectoryState()->momentum().z(); - auto sinhTrajEta2 = (pz * pz) / (pt * pt); - auto myEtaSwitch = sinh(theHighEtaSwitch); - if (sinhTrajEta2 < (myEtaSwitch * myEtaSwitch)) { + auto sinhTrajEta2 = (pz * pz) / pt2; + if (sinhTrajEta2 < (theHighEtaSwitch * theHighEtaSwitch)) { if (traj.foundHits() >= theMinHits + seedPenalty) passed = true; } else { //absTrajEta>theHighEtaSwitch, so apply relaxed cuts