Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:25:21

0001 #include "RecoHI/HiTracking/interface/HIPixelTrackFilter.h"
0002 
0003 #include "DataFormats/TrackReco/interface/Track.h"
0004 #include "DataFormats/TrackReco/interface/TrackBase.h"
0005 
0006 using namespace std;
0007 using namespace edm;
0008 
0009 /*****************************************************************************/
0010 HIPixelTrackFilter::HIPixelTrackFilter(const SiPixelClusterShapeCache* cache,
0011                                        double ptMin,
0012                                        double ptMax,
0013                                        const TrackerGeometry* tracker,
0014                                        const ClusterShapeHitFilter* shape,
0015                                        const TrackerTopology* ttopo,
0016                                        const reco::VertexCollection* vertices,
0017                                        double tipMax,
0018                                        double tipMaxTolerance,
0019                                        double lipMax,
0020                                        double lipMaxTolerance,
0021                                        double chi2max,
0022                                        bool useClusterShape)
0023     : ClusterShapeTrackFilter(cache, ptMin, ptMax, tracker, shape, ttopo),
0024       theVertices(vertices),
0025       theTIPMax(tipMax),
0026       theNSigmaTipMaxTolerance(tipMaxTolerance),
0027       theLIPMax(lipMax),
0028       theNSigmaLipMaxTolerance(lipMaxTolerance),
0029       theChi2Max(chi2max),
0030       thePtMin(ptMin),
0031       useClusterShape(useClusterShape) {}
0032 
0033 /*****************************************************************************/
0034 HIPixelTrackFilter::~HIPixelTrackFilter() {}
0035 
0036 /*****************************************************************************/
0037 bool HIPixelTrackFilter::operator()(const reco::Track* track, const PixelTrackFilterBase::Hits& recHits) const {
0038   if (!track)
0039     return false;
0040   if (track->chi2() > theChi2Max || track->pt() < thePtMin)
0041     return false;
0042 
0043   math::XYZPoint vtxPoint(0.0, 0.0, 0.0);
0044   double vzErr = 0.0, vxErr = 0.0, vyErr = 0.0;
0045 
0046   if (!theVertices->empty()) {
0047     vtxPoint = theVertices->begin()->position();
0048     vzErr = theVertices->begin()->zError();
0049     vxErr = theVertices->begin()->xError();
0050     vyErr = theVertices->begin()->yError();
0051   } else {
0052     // THINK OF SOMETHING TO DO IF THERE IS NO VERTEX
0053   }
0054 
0055   double d0 = 0.0, dz = 0.0, d0sigma = 0.0, dzsigma = 0.0;
0056   d0 = -1. * track->dxy(vtxPoint);
0057   dz = track->dz(vtxPoint);
0058   d0sigma = sqrt(track->d0Error() * track->d0Error() + vxErr * vyErr);
0059   dzsigma = sqrt(track->dzError() * track->dzError() + vzErr * vzErr);
0060 
0061   if (theTIPMax > 0 && fabs(d0) > theTIPMax)
0062     return false;
0063   if (theNSigmaTipMaxTolerance > 0 && (fabs(d0) / d0sigma) > theNSigmaTipMaxTolerance)
0064     return false;
0065   if (theLIPMax > 0 && fabs(dz) > theLIPMax)
0066     return false;
0067   if (theNSigmaLipMaxTolerance > 0 && (fabs(dz) / dzsigma) > theNSigmaLipMaxTolerance)
0068     return false;
0069 
0070   bool ok = true;
0071   if (useClusterShape)
0072     ok = ClusterShapeTrackFilter::operator()(track, recHits);
0073 
0074   return ok;
0075 }