88 :
m_input(iConfig.getParameter<
edm::InputTag>(
"input"))
89 ,
m_minPt(iConfig.getParameter<double>(
"minPt"))
96 produces<TrajTrackAssociationCollection>();
100 m_pt = fs->
make<TH1F>(
"pt",
"Transverse momentum (GeV)", 100, 0., 100.);
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);
125 auto newTrajTrackMap = std::make_unique<TrajTrackAssociationCollection>();
131 m_pt->Fill((*(*iPair).val).pt());
134 if ((*(*iPair).val).pt() >
m_minPt) {
136 std::vector<TrajectoryMeasurement> measurements = (*(*iPair).key).measurements();
138 bool has_bad_residual =
false;
140 double tracker_forwardchi2 = 0.;
141 double tracker_dof = 0.;
142 for (std::vector<TrajectoryMeasurement>::const_iterator im = measurements.begin(); im != measurements.end(); ++im) {
145 const DetId id =
hit->geographicalId();
148 if (
hit->dimension() == 1) {
152 tracker_forwardchi2 += residual * residual / error2;
155 else if (
hit->dimension() == 2) {
162 tracker_forwardchi2 += (residualx * residualx + residualy * residualy) / (errorxx2 + 2.*errorxy2 + erroryy2);
172 has_bad_residual =
true;
178 double tracker_forwardredchi2 = tracker_forwardchi2 / tracker_dof;
184 for (std::vector<TrajectoryMeasurement>::const_iterator im = measurements.begin(); im != measurements.end(); ++im) {
187 const DetId id =
hit->geographicalId();
189 if (!has_bad_residual) {
199 if (tracker_forwardredchi2 < m_maxTrackerForwardRedChi2 && tracker_dof >=
m_minTrackerDOF && !has_bad_residual) {
200 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)
#define DEFINE_FWK_MODULE(type)
LocalPoint localPosition() const
T * make(const Args &...args) const
make new ROOT object
LocalError positionError() const
double m_maxTrackerForwardRedChi2
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)