20 template<
class T>
T sqr(
T t) {
return t *
t;}
26 extraHitRZtolerance(cfg.getParameter<double>(
"extraHitRZtolerance")),
27 extraHitRPhitolerance(cfg.getParameter<double>(
"extraHitRPhitolerance")),
28 extraHitPhiToleranceForPreFiltering(cfg.getParameter<double>(
"extraHitPhiToleranceForPreFiltering")),
29 theNSigma(cfg.getParameter<double>(
"nSigma")),
30 theChi2Cut(cfg.getParameter<double>(
"chi2Cut"))
41 const std::vector<SeedingLayerSetsHits::SeedingLayer>& thirdLayers)
57 OrderedHitPairs::const_iterator ip;
60 if (pairs.
size() ==0)
return;
62 int size = thirdLayers.size();
65 for (
int il=0; il <=size-1; il++) {
66 thirdHitMap[il] = &(*theLayerCache)(thirdLayers[il],
region,
ev, es);
71 if (!firstLayer || !secondLayer)
return;
77 for (ip = pairs.begin(); ip != pairs.end(); ip++) {
79 GlobalPoint
p1((*ip).inner()->globalPosition()-
shift);
80 GlobalPoint
p2((*ip).outer()->globalPosition()-
shift);
89 double msRPhi1 = sigma1RPhi(pt_p1p2, line.cotLine(), 0.f);
90 double msRPhi2 = sigma2RPhi(pt_p1p2, line.cotLine(),point1);
91 double sinTheta = 1/
sqrt(1+
sqr(line.cotLine()));
92 double cosTheta = fabs(line.cotLine())/
sqrt(1+
sqr(line.cotLine()));
94 double p1_errorRPhi =
sqrt(
sqr((*ip).inner()->errorGlobalRPhi())+
sqr(msRPhi1) +
sqr(errorXY));
95 double p2_errorRPhi =
sqrt(
sqr((*ip).outer()->errorGlobalRPhi())+
sqr(msRPhi2) +
sqr(errorXY));
99 for (
int il=0; il <=size-1; il++) {
101 const DetLayer * layer = thirdLayers[il].detLayer();
104 double msRPhi3 = sigma3RPhi(pt_p1p2, line.cotLine(),point2);
111 rRange =
Range(radius-halfThickness, radius+halfThickness);
116 float zMin = zLayer-halfThickness;
117 float zMax = zLayer+halfThickness;
119 GlobalPoint p3_a =
p2+dr*(zMin-
p2.z())/dr.
z();
120 GlobalPoint p3_b =
p2+dr*(zMax-
p2.z())/dr.
z();
121 if (zLayer * p3_a.
z() < 0)
continue;
125 double displacment = shift.
perp();
126 GlobalPoint crossing1 = predictionRPhi.crossing(rRange.min()-displacment)+shift;
127 GlobalPoint crossing2 = predictionRPhi.crossing(rRange.max()+displacment)+shift;
128 float c1_phi= crossing1.
phi();
129 float c2_phi= crossing2.
phi();
130 if (c2_phi < c1_phi)
swap(c1_phi,c2_phi);
131 if (c2_phi-c1_phi >
M_PI) { c2_phi -= 2*
M_PI;
swap(c1_phi,c2_phi); }
133 c1_phi -= extraAngle;
134 c2_phi += extraAngle;
135 vector<Hit> thirdHits = thirdHitMap[il]->
hits(c1_phi, c2_phi) ;
137 typedef vector<Hit>::const_iterator IH;
138 for (IH th=thirdHits.begin(), eh=thirdHits.end(); th < eh; ++th) {
139 GlobalPoint
p3((*th)->globalPosition()-
shift);
140 double p3_errorRPhi =
sqrt(
sqr((*th)->errorGlobalRPhi()) +
sqr(msRPhi3) +
sqr(errorXY));
142 predictionRPhi.add(
p3,p3_errorRPhi);
144 double curvature = predictionRPhi.curvature();
146 ThirdHitZPrediction zPrediction( (*ip).inner()->globalPosition(),
sqrt(
sqr((*ip).inner()->errorGlobalR())+
sqr(msRPhi1/cosTheta)),
sqrt(
sqr((*ip).inner()->errorGlobalZ())+
sqr(msRPhi1/sinTheta)),
147 (*ip).outer()->globalPosition(),
sqrt(
sqr((*ip).outer()->errorGlobalR())+
sqr(msRPhi2/cosTheta)),
sqrt(
sqr((*ip).outer()->errorGlobalZ())+
sqr(msRPhi2/sinTheta)),
151 double z3Hit = (*th)->globalPosition().z();
153 Range hitZRange(z3Hit-z3HitError, z3Hit+z3HitError);
154 bool inside = hitZRange.hasIntersection(zRange);
157 bool ptCut = (predictionRPhi.curvature()-
theNSigma*predictionRPhi.errorCurvature() < curvatureMS);
158 bool chi2Cut = (predictionRPhi.chi2() <
theChi2Cut);
159 if (inside && ptCut && chi2Cut) {
162 edm::LogError(
"TooManyTriplets")<<
" number of triples exceed maximum. no triplets produced.";
163 delete [] thirdHitMap;
168 predictionRPhi.remove(
p3,p3_errorRPhi);
172 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
GlobalPoint const & origin() const
virtual ~PixelTripletNoTipGenerator()
PixelRecoRange< T > & sort()
virtual Location location() const =0
Which part of the detector (barrel, endcap)
PixelRecoRange< float > Range
virtual const BoundSurface & surface() const final
GeometricSearchDet interface.
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
const Bounds & bounds() const
virtual unsigned int size() const
const unsigned int theMaxElement
virtual float thickness() const =0
T inversePt(T curvature, const edm::EventSetup &iSetup)
T curvature(T InversePt, const edm::EventSetup &iSetup)
float extraHitRZtolerance
virtual void hitTriplets(const TrackingRegion ®ion, OrderedHitTriplets &trs, const edm::Event &ev, const edm::EventSetup &es, SeedingLayerSetsHits::SeedingLayerSet pairLayers, const std::vector< SeedingLayerSetsHits::SeedingLayer > &thirdLayers) override
SeedingHitSet::ConstRecHitPointer Hit
BaseTrackerRecHit const * Hit
float extraHitPhiToleranceForPreFiltering
std::unique_ptr< HitPairGeneratorFromLayerPair > thePairGenerator
virtual const Surface::PositionType & position() const
Returns position of the surface.
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
float ptMin() const
minimal pt of interest
virtual const BoundSurface & surface() const final
The surface of the GeometricSearchDet.
Square< F >::type sqr(const F &f)
static unsigned int const shift
virtual unsigned int size() const
PixelTripletNoTipGenerator(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
tuple size
Write out results.