#include <Alignment/CommonAlignmentProducer/plugins/AlignmentMuonHIPTrajectorySelector.cc>
Public Member Functions | |
AlignmentMuonHIPTrajectorySelector (const edm::ParameterSet &) | |
~AlignmentMuonHIPTrajectorySelector () | |
Private Member Functions | |
virtual void | beginJob (const edm::EventSetup &) |
virtual void | endJob () |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
bool | m_hists |
edm::InputTag | m_input |
double | m_maxMuonResidual |
double | m_maxTrackerForwardRedChi2 |
double | m_minPt |
int | m_minTrackerDOF |
TH1F * | m_pt |
TH1F * | m_resid_after |
TH1F * | m_resid_before |
TH1F * | m_tracker_dof |
TH1F * | m_tracker_forwardredchi2 |
Implementation: <Notes on="" implementation>="">
Definition at line 55 of file AlignmentMuonHIPTrajectorySelector.cc.
AlignmentMuonHIPTrajectorySelector::AlignmentMuonHIPTrajectorySelector | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 89 of file AlignmentMuonHIPTrajectorySelector.cc.
References m_hists, m_pt, m_resid_after, m_resid_before, m_tracker_dof, and m_tracker_forwardredchi2.
00090 : m_input(iConfig.getParameter<edm::InputTag>("input")) 00091 , m_minPt(iConfig.getParameter<double>("minPt")) 00092 , m_maxTrackerForwardRedChi2(iConfig.getParameter<double>("maxTrackerForwardRedChi2")) 00093 , m_minTrackerDOF(iConfig.getParameter<int>("minTrackerDOF")) 00094 , m_maxMuonResidual(iConfig.getParameter<double>("maxMuonResidual")) 00095 , m_hists(iConfig.getParameter<bool>("hists")) 00096 , m_pt(NULL), m_tracker_forwardredchi2(NULL), m_tracker_dof(NULL) 00097 { 00098 produces<TrajTrackAssociationCollection>(); 00099 00100 if (m_hists) { 00101 edm::Service<TFileService> fs; 00102 m_pt = fs->make<TH1F>("pt", "Transverse momentum (GeV)", 100, 0., 100.); 00103 m_tracker_forwardredchi2 = fs->make<TH1F>("trackerForwardRedChi2", "forward-biased reduced chi2 in tracker", 100, 0., 5.); 00104 m_tracker_dof = fs->make<TH1F>("trackerDOF", "DOF in tracker", 61, -0.5, 60.5); 00105 m_resid_before = fs->make<TH1F>("residBefore", "muon residuals before cut (cm)", 100, -20, 20); 00106 m_resid_after = fs->make<TH1F>("residAfter", "muon residuals after cut (cm)", 100, -20, 20); 00107 } 00108 }
AlignmentMuonHIPTrajectorySelector::~AlignmentMuonHIPTrajectorySelector | ( | ) |
void AlignmentMuonHIPTrajectorySelector::beginJob | ( | const edm::EventSetup & | ) | [private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 213 of file AlignmentMuonHIPTrajectorySelector.cc.
Reimplemented from edm::EDProducer.
Definition at line 217 of file AlignmentMuonHIPTrajectorySelector.cc.
void AlignmentMuonHIPTrajectorySelector::produce | ( | edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 120 of file AlignmentMuonHIPTrajectorySelector.cc.
References TrajectoryMeasurement::backwardPredictedState(), TrajectoryStateCombiner::combine(), MuonSubdetId::CSC, TrackingRecHit::dimension(), MuonSubdetId::DT, TrajectoryMeasurement::forwardPredictedState(), TrackingRecHit::geographicalId(), edm::Event::getByLabel(), TrackingRecHit::isValid(), TrajectoryStateOnSurface::localError(), TrackingRecHit::localPosition(), TrajectoryStateOnSurface::localPosition(), TrackingRecHit::localPositionError(), m_hists, m_input, m_maxMuonResidual, m_minPt, m_minTrackerDOF, m_pt, m_resid_after, m_resid_before, m_tracker_dof, m_tracker_forwardredchi2, DetId::Muon, LocalTrajectoryError::positionError(), edm::Event::put(), TrajectoryMeasurement::recHit(), DetId::Tracker, PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), LocalError::xy(), PV3DBase< T, PVType, FrameType >::y(), and LocalError::yy().
00121 { 00122 // input 00123 edm::Handle<TrajTrackAssociationCollection> originalTrajTrackMap; 00124 iEvent.getByLabel(m_input, originalTrajTrackMap); 00125 00126 // output 00127 std::auto_ptr<TrajTrackAssociationCollection> newTrajTrackMap(new TrajTrackAssociationCollection()); 00128 00129 TrajectoryStateCombiner tsoscomb; 00130 00131 for (TrajTrackAssociationCollection::const_iterator iPair = originalTrajTrackMap->begin(); iPair != originalTrajTrackMap->end(); ++iPair) { 00132 if (m_hists) { 00133 m_pt->Fill((*(*iPair).val).pt()); 00134 } 00135 00136 if ((*(*iPair).val).pt() > m_minPt) { 00137 00138 std::vector<TrajectoryMeasurement> measurements = (*(*iPair).key).measurements(); 00139 00140 bool has_bad_residual = false; 00141 00142 double tracker_forwardchi2 = 0.; 00143 double tracker_dof = 0.; 00144 for (std::vector<TrajectoryMeasurement>::const_iterator im = measurements.begin(); im != measurements.end(); ++im) { 00145 const TrajectoryMeasurement meas = *im; 00146 const TransientTrackingRecHit* hit = &(*meas.recHit()); 00147 const DetId id = hit->geographicalId(); 00148 00149 if (hit->isValid() && id.det() == DetId::Tracker) { 00150 if (hit->dimension() == 1) { 00151 double residual = meas.forwardPredictedState().localPosition().x() - hit->localPosition().x(); 00152 double error2 = meas.forwardPredictedState().localError().positionError().xx() + hit->localPositionError().xx(); 00153 00154 tracker_forwardchi2 += residual * residual / error2; 00155 tracker_dof += 1.; 00156 } 00157 else if (hit->dimension() == 2) { 00158 double residualx = meas.forwardPredictedState().localPosition().x() - hit->localPosition().x(); 00159 double residualy = meas.forwardPredictedState().localPosition().y() - hit->localPosition().y(); 00160 double errorxx2 = meas.forwardPredictedState().localError().positionError().xx() + hit->localPositionError().xx(); 00161 double errorxy2 = meas.forwardPredictedState().localError().positionError().xy() + hit->localPositionError().xy(); 00162 double erroryy2 = meas.forwardPredictedState().localError().positionError().yy() + hit->localPositionError().yy(); 00163 00164 tracker_forwardchi2 += (residualx * residualx + residualy * residualy) / (errorxx2 + 2.*errorxy2 + erroryy2); 00165 tracker_dof += 2.; 00166 } 00167 } // end if a tracker hit 00168 00169 if (hit->isValid() && id.det() == DetId::Muon && (id.subdetId() == MuonSubdetId::DT || id.subdetId() == MuonSubdetId::CSC)) { 00170 TrajectoryStateOnSurface tsosc = tsoscomb.combine(meas.forwardPredictedState(), meas.backwardPredictedState()); 00171 double residual = tsosc.localPosition().x() - hit->localPosition().x(); 00172 m_resid_before->Fill(residual); 00173 if (fabs(residual) > m_maxMuonResidual) { 00174 has_bad_residual = true; 00175 } 00176 } // end if a muon hit 00177 00178 } 00179 tracker_dof -= 5.; 00180 double tracker_forwardredchi2 = tracker_forwardchi2 / tracker_dof; 00181 00182 if (m_hists) { 00183 m_tracker_forwardredchi2->Fill(tracker_forwardredchi2); 00184 m_tracker_dof->Fill(tracker_dof); 00185 00186 for (std::vector<TrajectoryMeasurement>::const_iterator im = measurements.begin(); im != measurements.end(); ++im) { 00187 const TrajectoryMeasurement meas = *im; 00188 const TransientTrackingRecHit* hit = &(*meas.recHit()); 00189 const DetId id = hit->geographicalId(); 00190 00191 if (!has_bad_residual) { 00192 if (hit->isValid() && id.det() == DetId::Muon && (id.subdetId() == MuonSubdetId::DT || id.subdetId() == MuonSubdetId::CSC)) { 00193 TrajectoryStateOnSurface tsosc = tsoscomb.combine(meas.forwardPredictedState(), meas.backwardPredictedState()); 00194 double residual = tsosc.localPosition().x() - hit->localPosition().x(); 00195 m_resid_after->Fill(residual); 00196 } 00197 } // end if residuals pass cut 00198 } // end second loop over hits 00199 } // end if filling histograms 00200 00201 if (tracker_forwardredchi2 < m_maxTrackerForwardRedChi2 && tracker_dof >= m_minTrackerDOF && !has_bad_residual) { 00202 newTrajTrackMap->insert((*iPair).key, (*iPair).val); 00203 } // end if passes tracker cuts 00204 } // end if passes pT cut 00205 } // end loop over original trajTrackMap 00206 00207 // put it in the Event 00208 iEvent.put(newTrajTrackMap); 00209 }
Definition at line 72 of file AlignmentMuonHIPTrajectorySelector.cc.
Referenced by AlignmentMuonHIPTrajectorySelector(), and produce().
double AlignmentMuonHIPTrajectorySelector::m_maxMuonResidual [private] |
double AlignmentMuonHIPTrajectorySelector::m_maxTrackerForwardRedChi2 [private] |
Definition at line 68 of file AlignmentMuonHIPTrajectorySelector.cc.
double AlignmentMuonHIPTrajectorySelector::m_minPt [private] |
TH1F* AlignmentMuonHIPTrajectorySelector::m_pt [private] |
Definition at line 73 of file AlignmentMuonHIPTrajectorySelector.cc.
Referenced by AlignmentMuonHIPTrajectorySelector(), and produce().
TH1F * AlignmentMuonHIPTrajectorySelector::m_resid_after [private] |
Definition at line 74 of file AlignmentMuonHIPTrajectorySelector.cc.
Referenced by AlignmentMuonHIPTrajectorySelector(), and produce().
TH1F* AlignmentMuonHIPTrajectorySelector::m_resid_before [private] |
Definition at line 74 of file AlignmentMuonHIPTrajectorySelector.cc.
Referenced by AlignmentMuonHIPTrajectorySelector(), and produce().
TH1F * AlignmentMuonHIPTrajectorySelector::m_tracker_dof [private] |
Definition at line 73 of file AlignmentMuonHIPTrajectorySelector.cc.
Referenced by AlignmentMuonHIPTrajectorySelector(), and produce().
TH1F * AlignmentMuonHIPTrajectorySelector::m_tracker_forwardredchi2 [private] |
Definition at line 73 of file AlignmentMuonHIPTrajectorySelector.cc.
Referenced by AlignmentMuonHIPTrajectorySelector(), and produce().