38 : theLayerCache(*layerCache), theOuterLayer(
outer), theInnerLayer(
inner), theMaxElement(
max) {
39 ss =
new std::stringstream;
56 size_t totCountP2 = 0, totCountP1 = 0, totCountM2 = 0, totCountM1 = 0, selCount = 0;
58 (*ss) <<
"In " << innerLayerObj.
name() <<
" Out " <<
theOuterLayer.name() << std::endl;
63 if (innerHitsMap.
empty())
67 if (outerHitsMap.
empty())
74 vector<RecHitsSortedInPhi::Hit> innerHits;
76 float innerPhimin, innerPhimax;
88 std::unique_ptr<const HitRZCompatibility> checkRZ =
region.checkRZ(outerLayerObj.
detLayer(), ohit, es);
89 for (nextoh = oh + 1; nextoh != outerHits.second; ++nextoh) {
94 (*ss) <<
"\toPos " << oPos <<
" r " << oPos.
perp() <<
" phi " << oPos.
phi() <<
" cotTheta "
95 << oPos.
z() / oPos.
perp() << std::endl;
96 (*ss) <<
"\tnoPos " << noPos <<
" r " << noPos.
perp() <<
" phi " << noPos.
phi() <<
" cotTheta "
97 << noPos.
z() / noPos.
perp() << std::endl;
119 innerPhimin = ohit->globalPosition().phi();
120 innerPhimax = nohit->globalPosition().phi();
124 innerHitsMap.
hits(innerPhimin, innerPhimax, innerHits);
127 (*ss) <<
"\tiphimin, iphimax " << innerPhimin <<
" " << innerPhimax << std::endl;
130 std::unique_ptr<const HitRZCompatibility> checkRZb =
region.checkRZ(innerLayerObj.
detLayer(), ohit, es);
131 std::unique_ptr<const HitRZCompatibility> checkRZc =
region.checkRZ(innerLayerObj.
detLayer(), nohit, es);
134 vector<RecHitsSortedInPhi::Hit>::const_iterator ieh = innerHits.end();
135 for (vector<RecHitsSortedInPhi::Hit>::const_iterator ih = innerHits.begin(); ih < ieh; ++ih) {
140 (*ss) <<
"\toPos " << oPos <<
" r " << oPos.
perp() <<
" phi " << oPos.
phi() <<
" cotTheta "
141 << oPos.
z() / oPos.
perp() << std::endl;
142 (*ss) <<
"\tnoPos " << noPos <<
" r " << noPos.
perp() <<
" phi " << noPos.
phi() <<
" cotTheta "
143 << noPos.
z() / noPos.
perp() << std::endl;
144 (*ss) <<
"\tinnPos " << innPos <<
" r " << innPos.
perp() <<
" phi " << innPos.
phi() <<
" cotTheta "
145 << innPos.
z() / innPos.
perp() << std::endl;
155 for (vector<RecHitsSortedInPhi::Hit>::const_iterator nextih = ih + 1; nextih != ieh; ++nextih) {
160 (*ss) <<
"\toPos " << oPos <<
" r " << oPos.
perp() <<
" phi " << oPos.
phi() <<
" cotTheta "
161 << oPos.
z() / oPos.
perp() << std::endl;
162 (*ss) <<
"\tnoPos " << noPos <<
" r " << noPos.
perp() <<
" phi " << noPos.
phi() <<
" cotTheta "
163 << noPos.
z() / noPos.
perp() << std::endl;
164 (*ss) <<
"\tinnPos " << innPos <<
" r " << innPos.
perp() <<
" phi " << innPos.
phi() <<
" cotTheta "
165 << innPos.
z() / innPos.
perp() << std::endl;
166 (*ss) <<
"\tninnPos " << ninnPos <<
" r " << ninnPos.
perp() <<
" phi " << ninnPos.
phi() <<
" cotTheta "
167 << ninnPos.
z() / ninnPos.
perp() << std::endl;
183 edm::LogError(
"TooManyQuads") <<
"number of Quad combinations exceed maximum, no quads produced";
185 (*ss) <<
"In " << innerLayerObj.
name() <<
" Out " << outerLayerObj.
name() <<
"\tP2 " << totCountP2
186 <<
"\tM2 " << totCountM2 <<
"\tP1 " << totCountP1 <<
"\tM1 " << totCountM1 <<
"\tsel " << selCount
203 (*ss) <<
"In " << innerLayerObj.
name() <<
" Out " << outerLayerObj.
name() <<
"\tP2 " << totCountP2 <<
"\tM2 "
204 << totCountM2 <<
"\tP1 " << totCountP1 <<
"\tM1 " << totCountM1 <<
"\tsel " << selCount << std::endl;
215 (*ss) <<
"*******\nNo valid checkRZ\n*******" << std::endl;
226 allowed = checkRZ->
range(r_reduced);
228 hitRZ =
Range(
hit->globalPosition().
z() - zErr,
hit->globalPosition().
z() + zErr);
230 allowed = checkRZ->
range(
hit->globalPosition().
z());
232 hitRZ =
Range(r_reduced - rErr, r_reduced + rErr);
237 (*ss) <<
"\n\t\t allowed Range " << allowed.
min() <<
" \t, " << allowed.max() <<
"\n\t\t hitRz Range "
238 << hitRZ.min() <<
" \t, " << hitRZ.max() <<
"\n\t\t Cross Range " << crossRange.min() <<
" \t, "
239 << crossRange.max() << std::endl;
240 if (!crossRange.empty())
241 (*
ss) <<
"\n\t\t !!!!ACCEPTED!!! \n\n";
244 return crossRange.empty();
252 double r[5],
z[5], ez[5];
257 r[0] = ohit->globalPosition().perp();
258 z[0] = ohit->globalPosition().z();
261 r[1] = nohit->globalPosition().perp();
262 z[1] = nohit->globalPosition().z();
265 r[2] = nihit->globalPosition().perp();
266 z[2] = nihit->globalPosition().z();
269 r[3] = ihit->globalPosition().perp();
270 z[3] = ihit->globalPosition().z();
279 double vError =
region.originZBound();
289 double zInnMin =
z[4] - ez[4];
290 double zInnMax =
z[4] + ez[4];
294 double zOutMin =
z[3] - ez[3];
295 double zOutMax =
z[3] + ez[3];
297 double zIntMin =
z[2] - ez[2];
298 double zIntMax =
z[2] + ez[2];
307 zIntMin =
z[1] - ez[1];
308 zIntMax =
z[1] + ez[1];
317 zIntMin =
z[0] - ez[0];
318 zIntMax =
z[0] + ez[0];
328 int size,
double *ax,
double *ay,
double *e2y,
double &p0,
double &e2p0,
double &
p1) {
339 double sqrProjFactor =
340 sqr((
hit->globalPosition().
z() -
region.origin().z()) / (
hit->globalPosition().perp() -
region.origin().perp()));
341 return (
hit->globalPositionError().czz() + sqrProjFactor *
hit->globalPositionError().rerr(
hit->globalPosition()));
349 double sqrProjFactor =
350 sqr((
hit->globalPosition().
z() -
region.origin().z()) / (
hit->globalPosition().perp() -
region.origin().perp()));
352 sqrt(
hit->globalPositionError().czz() + sqrProjFactor *
hit->globalPositionError().rerr(
hit->globalPosition()));
368 double tmpr, tmpz, tmpez;
372 for (
int i = 0;
i <
n -
j;
i++) {
373 if (ar[
i] > ar[
i + 1]) {
403 double zLeft =
getZAtR(rInn, zInnMin, rInt, rOut, zOutMin);
407 double zRight =
getZAtR(rInn, zInnMax, rInt, rOut, zOutMax);
408 if (zIntMin > zRight)
410 if (zIntMin < zLeft && zIntMax < zRight) {
414 if (zIntMin > zLeft && zIntMax > zRight) {
424 double &rInn,
double &zInn,
double &
r,
double &rOut,
double &zOut) {
429 return zInn + (zOut - zInn) * (
r - rInn) / (rOut - rInn);