20 template<
class T>
T sqr(
T t) {
return t *
t;}
25 : thePairGenerator(0),
27 extraHitRZtolerance(cfg.getParameter<double>(
"extraHitRZtolerance")),
28 extraHitRPhitolerance(cfg.getParameter<double>(
"extraHitRPhitolerance")),
29 extraHitPhiToleranceForPreFiltering(cfg.getParameter<double>(
"extraHitPhiToleranceForPreFiltering")),
30 theNSigma(cfg.getParameter<double>(
"nSigma")),
31 theChi2Cut(cfg.getParameter<double>(
"chi2Cut"))
42 std::vector<SeedingLayerSetsHits::SeedingLayer> thirdLayers) {
67 OrderedHitPairs::const_iterator ip;
70 if (pairs.
size() ==0)
return;
75 for (
int il=0; il <=size-1; il++) {
76 thirdHitMap[il] = &(*theLayerCache)(
theLayers[il], region, ev, es);
82 if (!firstLayer || !secondLayer)
return;
88 for (ip = pairs.begin(); ip != pairs.end(); ip++) {
90 GlobalPoint
p1((*ip).inner()->globalPosition()-
shift);
91 GlobalPoint
p2((*ip).outer()->globalPosition()-
shift);
100 double msRPhi1 = sigma1RPhi(pt_p1p2, line.cotLine(), 0.f);
101 double msRPhi2 = sigma2RPhi(pt_p1p2, line.cotLine(),point1);
102 double sinTheta = 1/
sqrt(1+
sqr(line.cotLine()));
103 double cosTheta = fabs(line.cotLine())/
sqrt(1+
sqr(line.cotLine()));
105 double p1_errorRPhi =
sqrt(
sqr((*ip).inner()->errorGlobalRPhi())+
sqr(msRPhi1) +
sqr(errorXY));
106 double p2_errorRPhi =
sqrt(
sqr((*ip).outer()->errorGlobalRPhi())+
sqr(msRPhi2) +
sqr(errorXY));
110 for (
int il=0; il <=size-1; il++) {
115 double msRPhi3 = sigma3RPhi(pt_p1p2, line.cotLine(),point2);
122 rRange =
Range(radius-halfThickness, radius+halfThickness);
127 float zMin = zLayer-halfThickness;
128 float zMax = zLayer+halfThickness;
130 GlobalPoint p3_a =
p2+dr*(zMin-
p2.z())/dr.
z();
131 GlobalPoint p3_b =
p2+dr*(zMax-
p2.z())/dr.
z();
132 if (zLayer * p3_a.
z() < 0)
continue;
136 double displacment = shift.
perp();
137 GlobalPoint crossing1 = predictionRPhi.crossing(rRange.min()-displacment)+shift;
138 GlobalPoint crossing2 = predictionRPhi.crossing(rRange.max()+displacment)+shift;
139 float c1_phi= crossing1.
phi();
140 float c2_phi= crossing2.
phi();
141 if (c2_phi < c1_phi)
swap(c1_phi,c2_phi);
142 if (c2_phi-c1_phi >
M_PI) { c2_phi -= 2*
M_PI;
swap(c1_phi,c2_phi); }
144 c1_phi -= extraAngle;
145 c2_phi += extraAngle;
146 vector<Hit> thirdHits = thirdHitMap[il]->
hits(c1_phi, c2_phi) ;
148 typedef vector<Hit>::const_iterator IH;
149 for (IH th=thirdHits.begin(), eh=thirdHits.end(); th < eh; ++th) {
150 GlobalPoint
p3((*th)->globalPosition()-
shift);
151 double p3_errorRPhi =
sqrt(
sqr((*th)->errorGlobalRPhi()) +
sqr(msRPhi3) +
sqr(errorXY));
153 predictionRPhi.add(
p3,p3_errorRPhi);
155 double curvature = predictionRPhi.curvature();
157 ThirdHitZPrediction zPrediction( (*ip).inner()->globalPosition(),
sqrt(
sqr((*ip).inner()->errorGlobalR())+
sqr(msRPhi1/cosTheta)),
sqrt(
sqr((*ip).inner()->errorGlobalZ())+
sqr(msRPhi1/sinTheta)),
158 (*ip).outer()->globalPosition(),
sqrt(
sqr((*ip).outer()->errorGlobalR())+
sqr(msRPhi2/cosTheta)),
sqrt(
sqr((*ip).outer()->errorGlobalZ())+
sqr(msRPhi2/sinTheta)),
162 double z3Hit = (*th)->globalPosition().z();
164 Range hitZRange(z3Hit-z3HitError, z3Hit+z3HitError);
165 bool inside = hitZRange.hasIntersection(zRange);
168 bool ptCut = (predictionRPhi.curvature()-
theNSigma*predictionRPhi.errorCurvature() < curvatureMS);
169 bool chi2Cut = (predictionRPhi.chi2() <
theChi2Cut);
170 if (inside && ptCut && chi2Cut) {
173 edm::LogError(
"TooManyTriplets")<<
" number of triples exceed maximum. no triplets produced.";
174 delete [] thirdHitMap;
179 predictionRPhi.remove(
p3,p3_errorRPhi);
183 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
GlobalPoint const & origin() const
virtual Location location() const =0
Which part of the detector (barrel, endcap)
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
virtual const BoundSurface & surface() const GCC11_FINAL
GeometricSearchDet interface.
const Bounds & bounds() const
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.
void init(const HitPairGenerator &pairs, LayerCacheType *layerCache) override
std::vector< SeedingLayerSetsHits::SeedingLayer > theLayers
unsigned int theMaxElement
SeedingHitSet::ConstRecHitPointer Hit
BaseTrackerRecHit const * Hit
float extraHitPhiToleranceForPreFiltering
LayerCacheType * theLayerCache
PixelRecoRange< float > Range
virtual const Surface::PositionType & position() const
Returns position of the surface.
void setSeedingLayers(SeedingLayerSetsHits::SeedingLayerSet pairLayers, std::vector< SeedingLayerSetsHits::SeedingLayer > thirdLayers) override
float ptMin() const
minimal pt of interest
const DetLayer * detLayer() const
HitPairGenerator * thePairGenerator
Square< F >::type sqr(const F &f)
static unsigned int const shift
list pairs
sort tag files by run number
virtual unsigned int size() const
virtual const BoundCylinder & specificSurface() const GCC11_FINAL
Extension of the interface.
PixelTripletNoTipGenerator(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
tuple size
Write out results.
virtual void setSeedingLayers(SeedingLayerSetsHits::SeedingLayerSet layers)=0