20 template<
class T>
T sqr(
T t) {
return t *
t;}
23 using namespace ctfseeding;
26 : thePairGenerator(0),
28 extraHitRZtolerance(cfg.getParameter<double>(
"extraHitRZtolerance")),
29 extraHitRPhitolerance(cfg.getParameter<double>(
"extraHitRPhitolerance")),
30 extraHitPhiToleranceForPreFiltering(cfg.getParameter<double>(
"extraHitPhiToleranceForPreFiltering")),
31 theNSigma(cfg.getParameter<double>(
"nSigma")),
32 theChi2Cut(cfg.getParameter<double>(
"chi2Cut"))
36 const std::vector<SeedingLayer> & layers,
64 OrderedHitPairs::const_iterator ip;
67 if (pairs.
size() ==0)
return;
72 for (
int il=0; il <=size-1; il++) {
73 thirdHitMap[il] = &(*theLayerCache)(&
theLayers[il], region, ev, es);
79 if (!firstLayer || !secondLayer)
return;
85 for (ip = pairs.begin(); ip != pairs.end(); ip++) {
87 GlobalPoint
p1((*ip).inner()->globalPosition()-
shift);
88 GlobalPoint
p2((*ip).outer()->globalPosition()-
shift);
97 double msRPhi1 = sigma1RPhi(pt_p1p2, line.cotLine(), 0.f);
98 double msRPhi2 = sigma2RPhi(pt_p1p2, line.cotLine(),point1);
99 double sinTheta = 1/
sqrt(1+
sqr(line.cotLine()));
100 double cosTheta = fabs(line.cotLine())/
sqrt(1+
sqr(line.cotLine()));
102 double p1_errorRPhi =
sqrt(
sqr((*ip).inner()->errorGlobalRPhi())+
sqr(msRPhi1) +
sqr(errorXY));
103 double p2_errorRPhi =
sqrt(
sqr((*ip).outer()->errorGlobalRPhi())+
sqr(msRPhi2) +
sqr(errorXY));
107 for (
int il=0; il <=size-1; il++) {
112 double msRPhi3 = sigma3RPhi(pt_p1p2, line.cotLine(),point2);
119 rRange =
Range(radius-halfThickness, radius+halfThickness);
124 float zMin = zLayer-halfThickness;
125 float zMax = zLayer+halfThickness;
127 GlobalPoint p3_a =
p2+dr*(zMin-
p2.z())/dr.
z();
128 GlobalPoint p3_b =
p2+dr*(zMax-
p2.z())/dr.
z();
129 if (zLayer * p3_a.
z() < 0)
continue;
133 double displacment = shift.
perp();
134 GlobalPoint crossing1 = predictionRPhi.crossing(rRange.min()-displacment)+shift;
135 GlobalPoint crossing2 = predictionRPhi.crossing(rRange.max()+displacment)+shift;
136 float c1_phi= crossing1.
phi();
137 float c2_phi= crossing2.
phi();
138 if (c2_phi < c1_phi)
swap(c1_phi,c2_phi);
139 if (c2_phi-c1_phi >
M_PI) { c2_phi -= 2*
M_PI;
swap(c1_phi,c2_phi); }
141 c1_phi -= extraAngle;
142 c2_phi += extraAngle;
143 vector<Hit> thirdHits = thirdHitMap[il]->
hits(c1_phi, c2_phi) ;
145 typedef vector<Hit>::const_iterator IH;
146 for (IH th=thirdHits.begin(), eh=thirdHits.end(); th < eh; ++th) {
147 GlobalPoint
p3((*th)->globalPosition()-
shift);
148 double p3_errorRPhi =
sqrt(
sqr((*th)->errorGlobalRPhi()) +
sqr(msRPhi3) +
sqr(errorXY));
150 predictionRPhi.add(
p3,p3_errorRPhi);
152 double curvature = predictionRPhi.curvature();
154 ThirdHitZPrediction zPrediction( (*ip).inner()->globalPosition(),
sqrt(
sqr((*ip).inner()->errorGlobalR())+
sqr(msRPhi1/cosTheta)),
sqrt(
sqr((*ip).inner()->errorGlobalZ())+
sqr(msRPhi1/sinTheta)),
155 (*ip).outer()->globalPosition(),
sqrt(
sqr((*ip).outer()->errorGlobalR())+
sqr(msRPhi2/cosTheta)),
sqrt(
sqr((*ip).outer()->errorGlobalZ())+
sqr(msRPhi2/sinTheta)),
159 double z3Hit = (*th)->globalPosition().z();
161 Range hitZRange(z3Hit-z3HitError, z3Hit+z3HitError);
162 bool inside = hitZRange.hasIntersection(zRange);
165 bool ptCut = (predictionRPhi.curvature()-
theNSigma*predictionRPhi.errorCurvature() < curvatureMS);
166 bool chi2Cut = (predictionRPhi.chi2() <
theChi2Cut);
167 if (inside && ptCut && chi2Cut) {
170 edm::LogError(
"TooManyTriplets")<<
" number of triples exceed maximum. no triplets produced.";
171 delete [] thirdHitMap;
176 predictionRPhi.remove(
p3,p3_errorRPhi);
180 delete [] thirdHitMap;
float originRBound() const
bounds the particle vertex in the transverse plane
void swap(ora::Record &rh, ora::Record &lh)
std::vector< Hit > hits(float phiMin, float phiMax) const
virtual void hitTriplets(const TrackingRegion ®ion, OrderedHitTriplets &trs, const edm::Event &ev, const edm::EventSetup &es)
virtual HitPairGenerator * clone() const =0
PixelTripletNoTipGenerator(const edm::ParameterSet &cfg)
GlobalPoint const & origin() const
virtual Location location() const =0
Which part of the detector (barrel, endcap)
const DetLayer * detLayer() const
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
const Layer & innerLayer() const
virtual const BoundSurface & surface() const GCC11_FINAL
GeometricSearchDet interface.
const Bounds & bounds() const
std::vector< ctfseeding::SeedingLayer > theLayers
virtual unsigned int size() const
virtual float thickness() const =0
T inversePt(T curvature, const edm::EventSetup &iSetup)
T curvature(T InversePt, const edm::EventSetup &iSetup)
virtual void hitPairs(const TrackingRegion ®, OrderedHitPairs &prs, const edm::EventSetup &es)
float extraHitRZtolerance
virtual const BoundSurface & surface() const GCC11_FINAL
The surface of the GeometricSearchDet.
virtual void init(const HitPairGenerator &pairs, const std::vector< ctfseeding::SeedingLayer > &layers, LayerCacheType *layerCache)
unsigned int theMaxElement
float extraHitPhiToleranceForPreFiltering
const Layer & outerLayer() const
LayerCacheType * theLayerCache
PixelRecoRange< float > Range
virtual const Surface::PositionType & position() const
Returns position of the surface.
float ptMin() const
minimal pt of interest
HitPairGenerator * thePairGenerator
Square< F >::type sqr(const F &f)
TransientTrackingRecHit::ConstRecHitPointer Hit
static unsigned int const shift
virtual unsigned int size() const
virtual const BoundCylinder & specificSurface() const GCC11_FINAL
Extension of the interface.
tuple size
Write out results.