Skip to content

Commit

Permalink
Merge pull request #35493 from swagata87/trajEmptyCheck
Browse files Browse the repository at this point in the history
[bugfix] Adding protection for empty trajectory
  • Loading branch information
cmsbuild authored Oct 4, 2021
2 parents 3abab3e + a2fea42 commit ec48861
Showing 1 changed file with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -23,7 +23,7 @@ class MinHitsTrajectoryFilter final : public TrajectoryFilter {

MinHitsTrajectoryFilter(const edm::ParameterSet& pset, edm::ConsumesCollector& iC)
: theMinHits(pset.getParameter<int>("minimumNumberOfHits")),
theHighEtaSwitch(pset.getParameter<double>("highEtaSwitch")),
theHighEtaSwitch(sinh(pset.getParameter<double>("highEtaSwitch"))),
theMinHitsAtHighEta(pset.getParameter<int>("minHitsAtHighEta")),
theSeedPairPenalty(pset.getParameter<int>("seedPairPenalty")) {}

Expand All @@ -49,16 +49,18 @@ class MinHitsTrajectoryFilter final : public TrajectoryFilter {
bool QF(const T& traj) const {
int seedPenalty = (2 == traj.seedNHits()) ? theSeedPairPenalty : 0; // increase by one if seed-doublet...
bool passed = false;
double pt = traj.lastMeasurement().updatedState().freeTrajectoryState()->momentum().perp();
double pz = traj.lastMeasurement().updatedState().freeTrajectoryState()->momentum().z();
double sinhTrajEta2 = (pz * pz) / (pt * pt);
double myEtaSwitch = sinh(theHighEtaSwitch);
if (sinhTrajEta2 < (myEtaSwitch * myEtaSwitch)) {
if (traj.foundHits() >= theMinHits + seedPenalty)
passed = true;
} else { //absTrajEta>theHighEtaSwitch, so apply relaxed cuts
if (traj.foundHits() >= theMinHitsAtHighEta + seedPenalty)
passed = true;

if (!traj.empty()) {
auto pt2 = traj.lastMeasurement().updatedState().freeTrajectoryState()->momentum().perp2();
auto pz = traj.lastMeasurement().updatedState().freeTrajectoryState()->momentum().z();
auto sinhTrajEta2 = (pz * pz) / pt2;
if (sinhTrajEta2 < (theHighEtaSwitch * theHighEtaSwitch)) {
if (traj.foundHits() >= theMinHits + seedPenalty)
passed = true;
} else { //absTrajEta>theHighEtaSwitch, so apply relaxed cuts
if (traj.foundHits() >= theMinHitsAtHighEta + seedPenalty)
passed = true;
}
}
return passed;
}
Expand Down

0 comments on commit ec48861

Please sign in to comment.