86 :
m_input(iConfig.getParameter<
edm::InputTag>(
"input")),
87 m_minPt(iConfig.getParameter<double>(
"minPt")),
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);
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ConstRecHitPointer const & recHit() const
friend struct const_iterator
const_iterator end() const
last iterator over the map (read only)
LocalPoint localPosition() const
T * make(const Args &...args) const
make new ROOT object
LocalError positionError() const
double m_maxTrackerForwardRedChi2
#define DEFINE_FWK_MODULE(type)
const LocalTrajectoryError & localError() const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
TH1F * m_tracker_forwardredchi2
~AlignmentMuonHIPTrajectorySelector() override
void produce(edm::Event &, const edm::EventSetup &) override
AlignmentMuonHIPTrajectorySelector(const edm::ParameterSet &)
const_iterator begin() const
first iterator over the map (read only)
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)