88 : m_input(iConfig.getParameter<edm::InputTag>(
"input"))
89 , m_minPt(iConfig.getParameter<double>(
"minPt"))
90 , m_maxTrackerForwardRedChi2(iConfig.getParameter<double>(
"maxTrackerForwardRedChi2"))
91 , m_minTrackerDOF(iConfig.getParameter<int>(
"minTrackerDOF"))
92 , m_maxMuonResidual(iConfig.getParameter<double>(
"maxMuonResidual"))
93 , m_hists(iConfig.getParameter<bool>(
"hists"))
94 , m_pt(
NULL), m_tracker_forwardredchi2(
NULL), m_tracker_dof(
NULL)
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);
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);
206 iEvent.
put(newTrajTrackMap);
ConstRecHitPointer const & recHit() const
friend struct const_iterator
TSOS combine(const TSOS &pTsos1, const TSOS &pTsos2) const
#define DEFINE_FWK_MODULE(type)
LocalPoint localPosition() const
T * make(const Args &...args) const
make new ROOT object
LocalError positionError() const
double m_maxTrackerForwardRedChi2
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
~AlignmentMuonHIPTrajectorySelector()
const LocalTrajectoryError & localError() const
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > > TrajTrackAssociationCollection
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
virtual void produce(edm::Event &, const edm::EventSetup &) override
AlignmentMuonHIPTrajectorySelector(const edm::ParameterSet &)
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)