File indexing completed on 2024-04-06 12:25:21
0001 #include "RecoHI/HiTracking/interface/HIProtoTrackFilter.h"
0002
0003 #include "DataFormats/TrackReco/interface/Track.h"
0004 #include "DataFormats/TrackReco/interface/TrackBase.h"
0005 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
0006
0007 using namespace std;
0008 using namespace edm;
0009
0010
0011 HIProtoTrackFilter::HIProtoTrackFilter(const reco::BeamSpot* beamSpot, double tipMax, double chi2Max, double ptMin)
0012 : theTIPMax(tipMax), theChi2Max(chi2Max), thePtMin(ptMin), theBeamSpot(beamSpot) {}
0013
0014
0015 HIProtoTrackFilter::~HIProtoTrackFilter() {}
0016
0017
0018 bool HIProtoTrackFilter::operator()(const reco::Track* track, const PixelTrackFilterBase::Hits& recHits) const {
0019 if (!track)
0020 return false;
0021
0022 if (track->chi2() > theChi2Max || track->pt() < thePtMin)
0023 return false;
0024
0025 math::XYZPoint vtxPoint(0.0, 0.0, 0.0);
0026
0027 if (theBeamSpot)
0028 vtxPoint = theBeamSpot->position();
0029
0030 double d0 = 0.0;
0031 d0 = -1. * track->dxy(vtxPoint);
0032
0033 if (theTIPMax > 0 && fabs(d0) > theTIPMax)
0034 return false;
0035
0036 return true;
0037 }