34 : theLayerCache(*layerCache), theOuterLayer(
outer), theInnerLayer(
inner), theMaxElement(
max) {
35 ss =
new std::stringstream;
50 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;
82 std::unique_ptr<const HitRZCompatibility> checkRZ =
region.checkRZ(outerLayerObj.
detLayer(), ohit);
83 for (nextoh = oh + 1; nextoh != outerHits.second; ++nextoh) {
88 (*ss) <<
"\toPos " << oPos <<
" r " << oPos.
perp() <<
" phi " << oPos.
phi() <<
" cotTheta " 89 << oPos.
z() / oPos.
perp() << std::endl;
90 (*ss) <<
"\tnoPos " << noPos <<
" r " << noPos.
perp() <<
" phi " << noPos.
phi() <<
" cotTheta " 91 << noPos.
z() / noPos.
perp() << std::endl;
113 innerPhimin = ohit->globalPosition().phi();
114 innerPhimax = nohit->globalPosition().phi();
118 innerHitsMap.
hits(innerPhimin, innerPhimax, innerHits);
121 (*ss) <<
"\tiphimin, iphimax " << innerPhimin <<
" " << innerPhimax << std::endl;
124 std::unique_ptr<const HitRZCompatibility> checkRZb =
region.checkRZ(innerLayerObj.
detLayer(), ohit);
125 std::unique_ptr<const HitRZCompatibility> checkRZc =
region.checkRZ(innerLayerObj.
detLayer(), nohit);
128 vector<RecHitsSortedInPhi::Hit>::const_iterator ieh = innerHits.end();
129 for (vector<RecHitsSortedInPhi::Hit>::const_iterator ih = innerHits.begin(); ih < ieh; ++ih) {
134 (*ss) <<
"\toPos " << oPos <<
" r " << oPos.
perp() <<
" phi " << oPos.
phi() <<
" cotTheta " 135 << oPos.
z() / oPos.
perp() << std::endl;
136 (*ss) <<
"\tnoPos " << noPos <<
" r " << noPos.
perp() <<
" phi " << noPos.
phi() <<
" cotTheta " 137 << noPos.
z() / noPos.
perp() << std::endl;
138 (*ss) <<
"\tinnPos " << innPos <<
" r " << innPos.
perp() <<
" phi " << innPos.
phi() <<
" cotTheta " 139 << innPos.
z() / innPos.
perp() << std::endl;
149 for (vector<RecHitsSortedInPhi::Hit>::const_iterator nextih = ih + 1; nextih != ieh; ++nextih) {
154 (*ss) <<
"\toPos " << oPos <<
" r " << oPos.
perp() <<
" phi " << oPos.
phi() <<
" cotTheta " 155 << oPos.
z() / oPos.
perp() << std::endl;
156 (*ss) <<
"\tnoPos " << noPos <<
" r " << noPos.
perp() <<
" phi " << noPos.
phi() <<
" cotTheta " 157 << noPos.
z() / noPos.
perp() << std::endl;
158 (*ss) <<
"\tinnPos " << innPos <<
" r " << innPos.
perp() <<
" phi " << innPos.
phi() <<
" cotTheta " 159 << innPos.
z() / innPos.
perp() << std::endl;
160 (*ss) <<
"\tninnPos " << ninnPos <<
" r " << ninnPos.
perp() <<
" phi " << ninnPos.
phi() <<
" cotTheta " 161 << ninnPos.
z() / ninnPos.
perp() << std::endl;
177 edm::LogError(
"TooManyQuads") <<
"number of Quad combinations exceed maximum, no quads produced";
179 (*ss) <<
"In " << innerLayerObj.
name() <<
" Out " << outerLayerObj.
name() <<
"\tP2 " << totCountP2
180 <<
"\tM2 " << totCountM2 <<
"\tP1 " << totCountP1 <<
"\tM1 " << totCountM1 <<
"\tsel " << selCount
197 (*ss) <<
"In " << innerLayerObj.
name() <<
" Out " << outerLayerObj.
name() <<
"\tP2 " << totCountP2 <<
"\tM2 " 198 << totCountM2 <<
"\tP1 " << totCountP1 <<
"\tM1 " << totCountM1 <<
"\tsel " << selCount << std::endl;
209 (*ss) <<
"*******\nNo valid checkRZ\n*******" << std::endl;
220 allowed = checkRZ->
range(r_reduced);
222 hitRZ =
Range(
hit->globalPosition().
z() - zErr,
hit->globalPosition().
z() + zErr);
224 allowed = checkRZ->
range(
hit->globalPosition().
z());
226 hitRZ =
Range(r_reduced - rErr, r_reduced + rErr);
231 (*ss) <<
"\n\t\t allowed Range " << allowed.
min() <<
" \t, " << allowed.max() <<
"\n\t\t hitRz Range " 232 << hitRZ.min() <<
" \t, " << hitRZ.max() <<
"\n\t\t Cross Range " << crossRange.min() <<
" \t, " 233 << crossRange.max() << std::endl;
234 if (!crossRange.empty())
235 (*
ss) <<
"\n\t\t !!!!ACCEPTED!!! \n\n";
238 return crossRange.empty();
246 double r[5],
z[5], ez[5];
251 r[0] = ohit->globalPosition().perp();
252 z[0] = ohit->globalPosition().z();
255 r[1] = nohit->globalPosition().perp();
256 z[1] = nohit->globalPosition().z();
259 r[2] = nihit->globalPosition().perp();
260 z[2] = nihit->globalPosition().z();
263 r[3] = ihit->globalPosition().perp();
264 z[3] = ihit->globalPosition().z();
273 double vError =
region.originZBound();
283 double zInnMin =
z[4] - ez[4];
284 double zInnMax =
z[4] + ez[4];
288 double zOutMin =
z[3] - ez[3];
289 double zOutMax =
z[3] + ez[3];
291 double zIntMin =
z[2] - ez[2];
292 double zIntMax =
z[2] + ez[2];
301 zIntMin =
z[1] - ez[1];
302 zIntMax =
z[1] + ez[1];
311 zIntMin =
z[0] - ez[0];
312 zIntMax =
z[0] + ez[0];
322 int size,
double *ax,
double *ay,
double *e2y,
double &p0,
double &e2p0,
double &
p1) {
333 double sqrProjFactor =
334 sqr((
hit->globalPosition().
z() -
region.origin().z()) / (
hit->globalPosition().perp() -
region.origin().perp()));
335 return (
hit->globalPositionError().czz() + sqrProjFactor *
hit->globalPositionError().rerr(
hit->globalPosition()));
343 double sqrProjFactor =
344 sqr((
hit->globalPosition().
z() -
region.origin().z()) / (
hit->globalPosition().perp() -
region.origin().perp()));
346 sqrt(
hit->globalPositionError().czz() + sqrProjFactor *
hit->globalPositionError().rerr(
hit->globalPosition()));
362 double tmpr, tmpz, tmpez;
366 for (
int i = 0;
i <
n -
j;
i++) {
367 if (ar[
i] > ar[
i + 1]) {
397 double zLeft =
getZAtR(rInn, zInnMin, rInt, rOut, zOutMin);
401 double zRight =
getZAtR(rInn, zInnMax, rInt, rOut, zOutMax);
402 if (zIntMin > zRight)
404 if (zIntMin < zLeft && zIntMax < zRight) {
408 if (zIntMin > zLeft && zIntMax > zRight) {
418 double &rInn,
double &zInn,
double &
r,
double &rOut,
double &zOut) {
423 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
constexpr std::array< uint8_t, layerIndexSize > layer
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)