52 double errorXY =
region.originRBound();
57 OrderedHitPairs::const_iterator ip;
65 if (!firstLayer || !secondLayer)
68 int size = thirdLayers.size();
71 for (
int il = 0; il <=
size - 1; il++) {
72 thirdHitMap[il] = &(*theLayerCache)(thirdLayers[il],
region, es);
79 for (ip = pairs.begin(); ip != pairs.end(); ip++) {
90 double msRPhi1 = sigma1RPhi(pt_p1p2,
line.cotLine(), 0.f);
91 double msRPhi2 = sigma2RPhi(pt_p1p2,
line.cotLine(), point1);
92 double sinTheta = 1 /
sqrt(1 +
sqr(
line.cotLine()));
95 double p1_errorRPhi =
sqrt(
sqr((*ip).inner()->errorGlobalRPhi()) +
sqr(msRPhi1) +
sqr(errorXY));
96 double p2_errorRPhi =
sqrt(
sqr((*ip).outer()->errorGlobalRPhi()) +
sqr(msRPhi2) +
sqr(errorXY));
100 for (
int il = 0; il <=
size - 1; il++) {
104 double msRPhi3 = sigma3RPhi(pt_p1p2,
line.cotLine(), point2);
116 float zMin = zLayer - halfThickness;
117 float zMax = zLayer + halfThickness;
121 if (zLayer * p3_a.
z() < 0)
126 double displacment =
shift.perp();
127 GlobalPoint crossing1 = predictionRPhi.crossing(rRange.min() - displacment) +
shift;
128 GlobalPoint crossing2 = predictionRPhi.crossing(rRange.max() + displacment) +
shift;
129 float c1_phi = crossing1.
phi();
130 float c2_phi = crossing2.
phi();
132 swap(c1_phi, c2_phi);
133 if (c2_phi - c1_phi >
M_PI) {
135 swap(c1_phi, c2_phi);
138 c1_phi -= extraAngle;
139 c2_phi += extraAngle;
140 vector<Hit> thirdHits = thirdHitMap[il]->
hits(c1_phi, c2_phi);
142 typedef vector<Hit>::const_iterator IH;
143 for (IH th = thirdHits.begin(), eh = thirdHits.end(); th < eh; ++th) {
145 double p3_errorRPhi =
sqrt(
sqr((*th)->errorGlobalRPhi()) +
sqr(msRPhi3) +
sqr(errorXY));
147 predictionRPhi.add(
p3, p3_errorRPhi);
149 double curvature = predictionRPhi.curvature();
152 sqrt(
sqr((*ip).inner()->errorGlobalR()) +
sqr(msRPhi1 / cosTheta)),
153 sqrt(
sqr((*ip).inner()->errorGlobalZ()) +
sqr(msRPhi1 / sinTheta)),
154 (*ip).outer()->globalPosition(),
155 sqrt(
sqr((*ip).outer()->errorGlobalR()) +
sqr(msRPhi2 / cosTheta)),
156 sqrt(
sqr((*ip).outer()->errorGlobalZ()) +
sqr(msRPhi2 / sinTheta)),
160 zPrediction((*th)->globalPosition(),
sqrt(
sqr((*th)->errorGlobalR())) +
sqr(msRPhi3 / cosTheta));
162 double z3Hit = (*th)->globalPosition().z();
165 Range hitZRange(z3Hit - z3HitError, z3Hit + z3HitError);
166 bool inside = hitZRange.hasIntersection(
zRange);
169 bool ptCut = (predictionRPhi.curvature() -
theNSigma * predictionRPhi.errorCurvature() < curvatureMS);
174 edm::LogError(
"TooManyTriplets") <<
" number of triples exceed maximum. no triplets produced.";
175 delete[] thirdHitMap;
180 predictionRPhi.remove(
p3, p3_errorRPhi);
184 delete[] thirdHitMap;