34 : theLayerCache(*layerCache), theOuterLayer(
outer), theInnerLayer(
inner), theMaxElement(
max) {
35 ss =
new std::stringstream;
51 size_t totCountP2 = 0, totCountP1 = 0, totCountM2 = 0, totCountM1 = 0, selCount = 0;
52 (*ss) <<
"In " << innerLayerObj.
name() <<
" Out " <<
theOuterLayer.name() << std::endl;
57 if (innerHitsMap.
empty())
61 if (outerHitsMap.
empty())
68 vector<RecHitsSortedInPhi::Hit> innerHits;
70 float innerPhimin, innerPhimax;
84 std::unique_ptr<const HitRZCompatibility> checkRZ =
region.checkRZ(outerLayerObj.
detLayer(), ohit);
85 for (nextoh = oh + 1; nextoh != outerHits.second; ++nextoh) {
90 (*ss) <<
"\toPos " << oPos <<
" r " << oPos.
perp() <<
" phi " << oPos.
phi() <<
" cotTheta " 91 << oPos.
z() / oPos.
perp() << std::endl;
92 (*ss) <<
"\tnoPos " << noPos <<
" r " << noPos.
perp() <<
" phi " << noPos.
phi() <<
" cotTheta " 93 << noPos.
z() / noPos.
perp() << std::endl;
117 innerPhimin = ohit->globalPosition().phi();
118 innerPhimax = nohit->globalPosition().phi();
122 innerHitsMap.
hits(innerPhimin, innerPhimax, innerHits);
125 (*ss) <<
"\tiphimin, iphimax " << innerPhimin <<
" " << innerPhimax << std::endl;
128 std::unique_ptr<const HitRZCompatibility> checkRZb =
region.checkRZ(innerLayerObj.
detLayer(), ohit);
129 std::unique_ptr<const HitRZCompatibility> checkRZc =
region.checkRZ(innerLayerObj.
detLayer(), nohit);
132 vector<RecHitsSortedInPhi::Hit>::const_iterator ieh = innerHits.end();
133 for (vector<RecHitsSortedInPhi::Hit>::const_iterator ih = innerHits.begin(); ih < ieh; ++ih) {
138 (*ss) <<
"\toPos " << oPos <<
" r " << oPos.
perp() <<
" phi " << oPos.
phi() <<
" cotTheta " 139 << oPos.
z() / oPos.
perp() << std::endl;
140 (*ss) <<
"\tnoPos " << noPos <<
" r " << noPos.
perp() <<
" phi " << noPos.
phi() <<
" cotTheta " 141 << noPos.
z() / noPos.
perp() << std::endl;
142 (*ss) <<
"\tinnPos " << innPos <<
" r " << innPos.
perp() <<
" phi " << innPos.
phi() <<
" cotTheta " 143 << innPos.
z() / innPos.
perp() << std::endl;
152 for (vector<RecHitsSortedInPhi::Hit>::const_iterator nextih = ih + 1; nextih != ieh; ++nextih) {
157 (*ss) <<
"\toPos " << oPos <<
" r " << oPos.
perp() <<
" phi " << oPos.
phi() <<
" cotTheta " 158 << oPos.
z() / oPos.
perp() << std::endl;
159 (*ss) <<
"\tnoPos " << noPos <<
" r " << noPos.
perp() <<
" phi " << noPos.
phi() <<
" cotTheta " 160 << noPos.
z() / noPos.
perp() << std::endl;
161 (*ss) <<
"\tinnPos " << innPos <<
" r " << innPos.
perp() <<
" phi " << innPos.
phi() <<
" cotTheta " 162 << innPos.
z() / innPos.
perp() << std::endl;
163 (*ss) <<
"\tninnPos " << ninnPos <<
" r " << ninnPos.
perp() <<
" phi " << ninnPos.
phi() <<
" cotTheta " 164 << ninnPos.
z() / ninnPos.
perp() << std::endl;
180 edm::LogError(
"TooManyQuads") <<
"number of Quad combinations exceed maximum, no quads produced";
182 (*ss) <<
"In " << innerLayerObj.
name() <<
" Out " << outerLayerObj.
name() <<
"\tP2 " << totCountP2
183 <<
"\tM2 " << totCountM2 <<
"\tP1 " << totCountP1 <<
"\tM1 " << totCountM1 <<
"\tsel " << selCount
202 (*ss) <<
"In " << innerLayerObj.
name() <<
" Out " << outerLayerObj.
name() <<
"\tP2 " << totCountP2 <<
"\tM2 " 203 << totCountM2 <<
"\tP1 " << totCountP1 <<
"\tM1 " << totCountM1 <<
"\tsel " << selCount << std::endl;
214 (*ss) <<
"*******\nNo valid checkRZ\n*******" << std::endl;
225 allowed = checkRZ->
range(r_reduced);
227 hitRZ =
Range(
hit->globalPosition().
z() - zErr,
hit->globalPosition().
z() + zErr);
229 allowed = checkRZ->
range(
hit->globalPosition().
z());
231 hitRZ =
Range(r_reduced - rErr, r_reduced + rErr);
236 (*ss) <<
"\n\t\t allowed Range " << allowed.
min() <<
" \t, " << allowed.max() <<
"\n\t\t hitRz Range " 237 << hitRZ.min() <<
" \t, " << hitRZ.max() <<
"\n\t\t Cross Range " << crossRange.min() <<
" \t, " 238 << crossRange.max() << std::endl;
239 if (!crossRange.empty())
240 (*
ss) <<
"\n\t\t !!!!ACCEPTED!!! \n\n";
243 return crossRange.empty();
251 double r[5],
z[5], ez[5];
256 r[0] = ohit->globalPosition().perp();
257 z[0] = ohit->globalPosition().z();
260 r[1] = nohit->globalPosition().perp();
261 z[1] = nohit->globalPosition().z();
264 r[2] = nihit->globalPosition().perp();
265 z[2] = nihit->globalPosition().z();
268 r[3] = ihit->globalPosition().perp();
269 z[3] = ihit->globalPosition().z();
278 double vError =
region.originZBound();
288 double zInnMin =
z[4] - ez[4];
289 double zInnMax =
z[4] + ez[4];
293 double zOutMin =
z[3] - ez[3];
294 double zOutMax =
z[3] + ez[3];
296 double zIntMin =
z[2] - ez[2];
297 double zIntMax =
z[2] + ez[2];
306 zIntMin =
z[1] - ez[1];
307 zIntMax =
z[1] + ez[1];
316 zIntMin =
z[0] - ez[0];
317 zIntMax =
z[0] + ez[0];
327 int size,
double *ax,
double *ay,
double *e2y,
double &p0,
double &e2p0,
double &
p1) {
338 double sqrProjFactor =
339 sqr((
hit->globalPosition().
z() -
region.origin().z()) / (
hit->globalPosition().perp() -
region.origin().perp()));
340 return (
hit->globalPositionError().czz() + sqrProjFactor *
hit->globalPositionError().rerr(
hit->globalPosition()));
348 double sqrProjFactor =
349 sqr((
hit->globalPosition().
z() -
region.origin().z()) / (
hit->globalPosition().perp() -
region.origin().perp()));
351 sqrt(
hit->globalPositionError().czz() + sqrProjFactor *
hit->globalPositionError().rerr(
hit->globalPosition()));
367 double tmpr, tmpz, tmpez;
371 for (
int i = 0;
i <
n -
j;
i++) {
372 if (ar[
i] > ar[
i + 1]) {
402 double zLeft =
getZAtR(rInn, zInnMin, rInt, rOut, zOutMin);
406 double zRight =
getZAtR(rInn, zInnMax, rInt, rOut, zOutMax);
407 if (zIntMin > zRight)
409 if (zIntMin < zLeft && zIntMax < zRight) {
413 if (zIntMin > zLeft && zIntMax > zRight) {
423 double &rInn,
double &zInn,
double &
r,
double &rOut,
double &zOut) {
428 return zInn + (zOut - zInn) * (
r - rInn) / (rOut - rInn);
constexpr double deltaPhi(double phi1, double phi2)
PixelRecoRange< float > Range
const std::string & name() const
virtual Range range(const float &rORz) const =0
Geom::Phi< T > phi() const
LayerCacheType & theLayerCache
SeedingHitSet::ConstRecHitPointer InnerRecHit
const unsigned int theOuterLayer
Log< level::Error, false > LogError
void hitPairs(const TrackingRegion ®, OrderedHitPairs &prs, const Layers &layers)
const DetLayer * detLayer() const
std::vector< HitWithPhi >::const_iterator HitIter
constexpr double nSigmaRZ
std::pair< HitIter, HitIter > Range
bool failCheckSegmentZCompatibility(double &rInn, double &zInnMin, double &zInnMax, double &rInt, double &zIntMin, double &zIntMax, double &rOut, double &zOutMin, double &zOutMax)
HitQuadrupletGeneratorFromLayerPairForPhotonConversion(unsigned int inner, unsigned int outer, LayerCacheType *layerCache, unsigned int max=0)
bool failCheckSlopeTest(const RecHitsSortedInPhi::Hit &ohit, const RecHitsSortedInPhi::Hit &nohit, const RecHitsSortedInPhi::Hit &ihit, const RecHitsSortedInPhi::Hit &nihit, const TrackingRegion ®ion)
std::vector< Hit > hits(float phiMin, float phiMax) const
SeedingHitSet::ConstRecHitPointer Hit
BaseTrackerRecHit const * Hit
const unsigned int theMaxElement
double getEffectiveErrorOnZ(const RecHitsSortedInPhi::Hit &hit, const TrackingRegion ®ion)
double verySimpleFit(int size, double *ax, double *ay, double *e2y, double &p0, double &e2p0, double &p1)
PixelRecoRange< T > intersection(const PixelRecoRange< T > &r) const
const unsigned int theInnerLayer
double getZAtR(double &rInn, double &zInn, double &r, double &rOut, double &zOut)
bool failCheckRZCompatibility(const RecHitsSortedInPhi::Hit &hit, const DetLayer &layer, const HitRZCompatibility *checkRZ, const TrackingRegion ®ion)
SeedingHitSet::ConstRecHitPointer OuterRecHit
void bubbleSortVsR(int n, double *ax, double *ay, double *aey)
double getSqrEffectiveErrorOnZ(const RecHitsSortedInPhi::Hit &hit, const TrackingRegion ®ion)