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.);
102 m_tracker_dof =
fs->make<TH1F>(
"trackerDOF",
"DOF in tracker", 61, -0.5, 60.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);
const LocalTrajectoryError & localError() const
LocalPoint localPosition() const
friend struct const_iterator
#define DEFINE_FWK_MODULE(type)
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
LocalError positionError() const
double m_maxTrackerForwardRedChi2
const_iterator end() const
last iterator over the map (read only)
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
TH1F * m_tracker_forwardredchi2
~AlignmentMuonHIPTrajectorySelector() override
const_iterator begin() const
first iterator over the map (read only)
void produce(edm::Event &, const edm::EventSetup &) override
AlignmentMuonHIPTrajectorySelector(const edm::ParameterSet &)
ConstRecHitPointer const & recHit() const