#include <LowPtClusterShapeSeedComparitor.h>
Public Member Functions | |
virtual bool | compatible (const SeedingHitSet &hits, const edm::EventSetup &es) |
LowPtClusterShapeSeedComparitor (const edm::ParameterSet &ps) | |
virtual | ~LowPtClusterShapeSeedComparitor () |
Private Member Functions | |
float | areaParallelogram (const Global2DVector &a, const Global2DVector &b) |
std::vector< GlobalVector > | getGlobalDirs (const std::vector< GlobalPoint > &globalPoss) |
std::vector< GlobalPoint > | getGlobalPoss (const TransientTrackingRecHit::ConstRecHitContainer &recHits) |
Private Attributes | |
const ClusterShapeHitFilter * | theFilter |
Definition at line 23 of file LowPtClusterShapeSeedComparitor.h.
LowPtClusterShapeSeedComparitor::LowPtClusterShapeSeedComparitor | ( | const edm::ParameterSet & | ps | ) |
Definition at line 23 of file LowPtClusterShapeSeedComparitor.cc.
{ }
LowPtClusterShapeSeedComparitor::~LowPtClusterShapeSeedComparitor | ( | ) | [virtual] |
Definition at line 29 of file LowPtClusterShapeSeedComparitor.cc.
{ }
float LowPtClusterShapeSeedComparitor::areaParallelogram | ( | const Global2DVector & | a, |
const Global2DVector & | b | ||
) | [private] |
Definition at line 35 of file LowPtClusterShapeSeedComparitor.cc.
References PV2DBase< T, PVType, FrameType >::x(), and PV2DBase< T, PVType, FrameType >::y().
bool LowPtClusterShapeSeedComparitor::compatible | ( | const SeedingHitSet & | hits, |
const edm::EventSetup & | es | ||
) | [virtual] |
Implements SeedComparitor.
Definition at line 120 of file LowPtClusterShapeSeedComparitor.cc.
References SeedingHitSet::container(), edm::EventSetup::get(), HitInfo::getInfo(), i, TrackingRecHit::isValid(), LogDebug, LogTrace, convertSQLiteXML::ok, and edm::ESHandle< T >::product().
{ // Get cluster shape hit filter edm::ESHandle<ClusterShapeHitFilter> shape; es.get<CkfComponentsRecord>().get("ClusterShapeHitFilter",shape); theFilter = shape.product(); const TransientTrackingRecHit::ConstRecHitContainer & thits = hits.container(); // Get global positions vector<GlobalPoint> globalPoss = getGlobalPoss(thits); // Get global directions vector<GlobalVector> globalDirs = getGlobalDirs(globalPoss); bool ok = true; // Check whether shape of pixel cluster is compatible // with local track direction if (globalDirs.size()!=globalPoss.size() || globalDirs.size()!=thits.size()) { LogDebug("LowPtClusterShapeSeedComparitor")<<"not enough global dir calculated:" <<"\nnHits: "<<thits.size() <<"\nnPos: "<<globalPoss.size() <<"\nnDir: "<<globalDirs.size() <<" will say the seed is good anyway."; return true; } for(int i = 0; i < 3; i++) { const SiPixelRecHit* pixelRecHit = dynamic_cast<const SiPixelRecHit *>(thits[i]->hit()); if (!pixelRecHit){ edm::LogError("LowPtClusterShapeSeedComparitor")<<"this is not a pixel cluster"; ok = false; break; } if(!pixelRecHit->isValid()) { ok = false; break; } LogDebug("LowPtClusterShapeSeedComparitor")<<"about to compute compatibility." <<"hit ptr: "<<pixelRecHit <<"global direction:"<< globalDirs[i]; if(! theFilter->isCompatible(*pixelRecHit, globalDirs[i]) ) { LogTrace("LowPtClusterShapeSeedComparitor") << " clusShape is not compatible" << HitInfo::getInfo(*thits[i]->hit()); ok = false; break; } } return ok; }
vector< GlobalVector > LowPtClusterShapeSeedComparitor::getGlobalDirs | ( | const std::vector< GlobalPoint > & | globalPoss | ) | [private] |
Definition at line 59 of file ClusterShapeTrackFilter.cc.
References trackerHits::c, CircleFromThreePoints::center(), PixelRecoUtilities::curvature(), CircleFromThreePoints::curvature(), dir, mag2(), L1TEmulatorMonitor_cff::p, slope, funct::sqr(), mathSSE::sqrt(), v, PV2DBase< T, PVType, FrameType >::x(), and PV2DBase< T, PVType, FrameType >::y().
{ // Get 2d points vector<Global2DVector> p; for(vector<GlobalPoint>::const_iterator ig = g.begin(); ig!= g.end(); ig++) p.push_back( Global2DVector(ig->x(), ig->y()) ); // vector<GlobalVector> globalDirs; // Determine circle CircleFromThreePoints circle(g[0],g[1],g[2]); if(circle.curvature() != 0.) { Global2DVector c (circle.center().x(), circle.center().y()); float rad2 = (p[0] - c).mag2(); float a12 = asin(fabsf(areaParallelogram(p[0] - c, p[1] - c)) / rad2); float slope = (g[1].z() - g[0].z()) / a12; float cotTheta = slope * circle.curvature(); // == sinhEta float coshEta = sqrt(1 + sqr(cotTheta)); // == 1/sinTheta // Calculate globalDirs float sinTheta = 1. / coshEta; float cosTheta = cotTheta * sinTheta; int dir; if(areaParallelogram(p[0] - c, p[1] - c) > 0) dir = 1; else dir = -1; float curvature = circle.curvature(); for(vector<Global2DVector>::const_iterator ip = p.begin(); ip!= p.end(); ip++) { Global2DVector v = (*ip - c)*curvature*dir; globalDirs.push_back(GlobalVector(-v.y()*sinTheta, v.x()*sinTheta, cosTheta)); } } return globalDirs; }
vector< GlobalPoint > LowPtClusterShapeSeedComparitor::getGlobalPoss | ( | const TransientTrackingRecHit::ConstRecHitContainer & | recHits | ) | [private] |
Definition at line 109 of file ClusterShapeTrackFilter.cc.
{ vector<GlobalPoint> globalPoss; for(vector<const TrackingRecHit *>::const_iterator recHit = recHits.begin(); recHit!= recHits.end(); recHit++) { DetId detId = (*recHit)->geographicalId(); GlobalPoint gpos = theTracker->idToDet(detId)->toGlobal((*recHit)->localPosition()); globalPoss.push_back(gpos); } return globalPoss; }
const ClusterShapeHitFilter* LowPtClusterShapeSeedComparitor::theFilter [private] |
Definition at line 38 of file LowPtClusterShapeSeedComparitor.h.