17 inline float sqr(
float x) {
return x*
x; }
37 return a.
x() * b.
y() - a.
y() * b.
x();
42 (
const vector<GlobalPoint> &
g)
45 vector<Global2DVector>
p;
46 for(vector<GlobalPoint>::const_iterator ig = g.begin();
51 vector<GlobalVector> globalDirs;
60 float rad2 = (p[0] -
c).
mag2();
61 float area = fabsf(areaParallelogram(p[1] - p[0], p[1] -
c));
64 if(area >= rad2) a12 =
M_PI/2;
65 else a12 = asin(area / rad2);
67 float slope = (g[1].z() - g[0].z()) / a12;
69 float cotTheta = slope * circle.
curvature();
70 float coshEta =
sqrt(1 +
sqr(cotTheta));
73 float sinTheta = 1. / coshEta;
74 float cosTheta = cotTheta * sinTheta;
77 if(areaParallelogram(p[0] -
c, p[1] -
c) > 0) dir = 1;
else dir = -1;
81 for(vector<Global2DVector>::const_iterator ip = p.begin();
91 LogDebug(
"LowPtClusterShapeSeedComparitor")<<
"the curvature is null:"
94 <<
"\n point3: "<<g[2];
103 vector<GlobalPoint> globalPoss;
105 for(TransientTrackingRecHit::ConstRecHitContainer::const_iterator recHit = thits.begin();
106 recHit!= thits.end();
109 DetId detId = (*recHit)->hit()->geographicalId();
113 globalPoss.push_back(gpos);
133 vector<GlobalPoint> globalPoss = getGlobalPoss(thits);
136 vector<GlobalVector> globalDirs = getGlobalDirs(globalPoss);
143 if (globalDirs.size()!=globalPoss.size() || globalDirs.size()!=thits.size())
145 LogDebug(
"LowPtClusterShapeSeedComparitor")<<
"not enough global dir calculated:"
146 <<
"\nnHits: "<<thits.size()
147 <<
"\nnPos: "<<globalPoss.size()
148 <<
"\nnDir: "<<globalDirs.size()
149 <<
" will say the seed is good anyway.";
153 for(
int i = 0;
i < 3;
i++)
159 edm::LogError(
"LowPtClusterShapeSeedComparitor")<<
"this is not a pixel cluster";
168 LogDebug(
"LowPtClusterShapeSeedComparitor")<<
"about to compute compatibility."
169 <<
"hit ptr: "<<pixelRecHit
170 <<
"global direction:"<< globalDirs[
i];
173 if(! theFilter->isCompatible(*pixelRecHit, globalDirs[
i]) )
175 LogTrace(
"LowPtClusterShapeSeedComparitor")
176 <<
" clusShape is not compatible"
static std::string getInfo(const DetId &id)
virtual ~LowPtClusterShapeSeedComparitor()
const RecHits & container() const
static const double slope[3]
float areaParallelogram(const Global2DVector &a, const Global2DVector &b)
virtual bool compatible(const SeedingHitSet &hits, const edm::EventSetup &es)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
T curvature(T InversePt, const edm::EventSetup &iSetup)
LowPtClusterShapeSeedComparitor(const edm::ParameterSet &ps)
T y() const
Cartesian y coordinate.
std::vector< GlobalVector > getGlobalDirs(const std::vector< GlobalPoint > &globalPoss)
std::vector< ConstRecHitPointer > ConstRecHitContainer
T const * product() const
Square< F >::type sqr(const F &f)
std::vector< GlobalPoint > getGlobalPoss(const TransientTrackingRecHit::ConstRecHitContainer &recHits)
T x() const
Cartesian x coordinate.
Global3DVector GlobalVector