90 : m_input(iConfig.getParameter<
edm::
InputTag>(
"input")),
91 m_minPt(iConfig.getParameter<double>(
"minPt")),
92 m_maxTrackerForwardRedChi2(iConfig.getParameter<double>(
"maxTrackerForwardRedChi2")),
93 m_minTrackerDOF(iConfig.getParameter<
int>(
"minTrackerDOF")),
94 m_maxMuonResidual(iConfig.getParameter<double>(
"maxMuonResidual")),
95 m_hists(iConfig.getParameter<
bool>(
"hists")),
98 m_tracker_forwardredchi2(nullptr),
99 m_tracker_dof(nullptr) {
100 produces<TrajTrackAssociationCollection>();
104 m_pt =
fs->make<TH1F>(
"pt",
"Transverse momentum (GeV)", 100, 0., 100.);
106 fs->make<TH1F>(
"trackerForwardRedChi2",
"forward-biased reduced chi2 in tracker", 100, 0., 5.);
107 m_tracker_dof =
fs->make<TH1F>(
"trackerDOF",
"DOF in tracker", 61, -0.5, 60.5);
108 m_resid_before =
fs->make<TH1F>(
"residBefore",
"muon residuals before cut (cm)", 100, -20, 20);
109 m_resid_after =
fs->make<TH1F>(
"residAfter",
"muon residuals after cut (cm)", 100, -20, 20);
128 auto newTrajTrackMap = std::make_unique<TrajTrackAssociationCollection>();
133 iPair != originalTrajTrackMap->
end();
136 m_pt->Fill((*(*iPair).val).pt());
139 if ((*(*iPair).val).pt() >
m_minPt) {
140 std::vector<TrajectoryMeasurement> measurements = (*(*iPair).key).measurements();
142 bool has_bad_residual =
false;
144 double tracker_forwardchi2 = 0.;
145 double tracker_dof = 0.;
146 for (std::vector<TrajectoryMeasurement>::const_iterator im = measurements.begin(); im != measurements.end();
150 const DetId id =
hit->geographicalId();
153 if (
hit->dimension() == 1) {
158 tracker_forwardchi2 += residual * residual / error2;
160 }
else if (
hit->dimension() == 2) {
170 tracker_forwardchi2 +=
171 (residualx * residualx + residualy * residualy) / (errorxx2 + 2. * errorxy2 + erroryy2);
183 has_bad_residual =
true;
188 double tracker_forwardredchi2 = tracker_forwardchi2 / tracker_dof;
194 for (std::vector<TrajectoryMeasurement>::const_iterator im = measurements.begin(); im != measurements.end();
198 const DetId id =
hit->geographicalId();
200 if (!has_bad_residual) {
212 if (tracker_forwardredchi2 < m_maxTrackerForwardRedChi2 && tracker_dof >=
m_minTrackerDOF && !has_bad_residual) {
213 newTrajTrackMap->insert((*iPair).key, (*iPair).val);
const double m_maxTrackerForwardRedChi2
const int m_minTrackerDOF
const LocalTrajectoryError & localError() const
LocalPoint localPosition() const
friend struct const_iterator
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
const edm::EDGetTokenT< TrajTrackAssociationCollection > mapToken_
LocalError positionError() const
const_iterator end() const
last iterator over the map (read only)
const double m_maxMuonResidual
void addDefault(ParameterSetDescription const &psetDescription)
const edm::InputTag m_input
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
#define DEFINE_FWK_MODULE(type)
TH1F * m_tracker_forwardredchi2
const_iterator begin() const
first iterator over the map (read only)
void produce(edm::Event &, const edm::EventSetup &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
~AlignmentMuonHIPTrajectorySelector() override=default
AlignmentMuonHIPTrajectorySelector(const edm::ParameterSet &)
ConstRecHitPointer const & recHit() const