86 : m_input(iConfig.getParameter<
edm::
InputTag>(
"input")),
87 m_minPt(iConfig.getParameter<double>(
"minPt")),
88 m_maxTrackerForwardRedChi2(iConfig.getParameter<double>(
"maxTrackerForwardRedChi2")),
89 m_minTrackerDOF(iConfig.getParameter<
int>(
"minTrackerDOF")),
90 m_maxMuonResidual(iConfig.getParameter<double>(
"maxMuonResidual")),
91 m_hists(iConfig.getParameter<
bool>(
"hists")),
93 m_tracker_forwardredchi2(nullptr),
94 m_tracker_dof(nullptr) {
95 produces<TrajTrackAssociationCollection>();
99 m_pt = fs->
make<TH1F>(
"pt",
"Transverse momentum (GeV)", 100, 0., 100.);
101 fs->
make<TH1F>(
"trackerForwardRedChi2",
"forward-biased reduced chi2 in tracker", 100, 0., 5.);
103 m_resid_before = fs->
make<TH1F>(
"residBefore",
"muon residuals before cut (cm)", 100, -20, 20);
104 m_resid_after = fs->
make<TH1F>(
"residAfter",
"muon residuals after cut (cm)", 100, -20, 20);
121 auto newTrajTrackMap = std::make_unique<TrajTrackAssociationCollection>();
126 iPair != originalTrajTrackMap->
end();
129 m_pt->Fill((*(*iPair).val).pt());
132 if ((*(*iPair).val).pt() >
m_minPt) {
133 std::vector<TrajectoryMeasurement> measurements = (*(*iPair).key).measurements();
135 bool has_bad_residual =
false;
137 double tracker_forwardchi2 = 0.;
138 double tracker_dof = 0.;
139 for (std::vector<TrajectoryMeasurement>::const_iterator im = measurements.begin(); im != measurements.end();
143 const DetId id =
hit->geographicalId();
146 if (
hit->dimension() == 1) {
151 tracker_forwardchi2 += residual * residual / error2;
153 }
else if (
hit->dimension() == 2) {
163 tracker_forwardchi2 +=
164 (residualx * residualx + residualy * residualy) / (errorxx2 + 2. * errorxy2 + erroryy2);
176 has_bad_residual =
true;
181 double tracker_forwardredchi2 = tracker_forwardchi2 / tracker_dof;
187 for (std::vector<TrajectoryMeasurement>::const_iterator im = measurements.begin(); im != measurements.end();
191 const DetId id =
hit->geographicalId();
193 if (!has_bad_residual) {
205 if (tracker_forwardredchi2 < m_maxTrackerForwardRedChi2 && tracker_dof >=
m_minTrackerDOF && !has_bad_residual) {
206 newTrajTrackMap->insert((*iPair).key, (*iPair).val);