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;
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;
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";
188 (*ss) <<
"In " << innerLayerObj.
name() <<
" Out " << outerLayerObj.
name() <<
"\tP2 " << totCountP2
189 <<
"\tM2 " << totCountM2 <<
"\tP1 " << totCountP1 <<
"\tM1 " << totCountM1 <<
"\tsel " << selCount
209 (*ss) <<
"In " << innerLayerObj.
name() <<
" Out " << outerLayerObj.
name() <<
"\tP2 " << totCountP2 <<
"\tM2 " 210 << totCountM2 <<
"\tP1 " << totCountP1 <<
"\tM1 " << totCountM1 <<
"\tsel " << selCount << std::endl;
221 (*ss) <<
"*******\nNo valid checkRZ\n*******" << std::endl;
228 sqr(hit->globalPosition().y() - region.
origin().
y()));
232 allowed = checkRZ->
range(r_reduced);
233 float zErr = nSigmaRZ * hit->errorGlobalZ();
234 hitRZ =
Range(hit->globalPosition().z() - zErr, hit->globalPosition().z() + zErr);
236 allowed = checkRZ->
range(hit->globalPosition().z());
237 float rErr = nSigmaRZ * hit->errorGlobalR();
238 hitRZ =
Range(r_reduced - rErr, r_reduced + rErr);
243 (*ss) <<
"\n\t\t allowed Range " << allowed.
min() <<
" \t, " << allowed.max() <<
"\n\t\t hitRz Range " 244 << hitRZ.min() <<
" \t, " << hitRZ.max() <<
"\n\t\t Cross Range " << crossRange.min() <<
" \t, " 245 << crossRange.max() << std::endl;
246 if (!crossRange.empty())
247 (*
ss) <<
"\n\t\t !!!!ACCEPTED!!! \n\n";
250 return crossRange.empty();
258 double r[5],
z[5], ez[5];
263 r[0] = ohit->globalPosition().perp();
264 z[0] = ohit->globalPosition().z();
267 r[1] = nohit->globalPosition().perp();
268 z[1] = nohit->globalPosition().z();
271 r[2] = nihit->globalPosition().perp();
272 z[2] = nihit->globalPosition().z();
275 r[3] = ihit->globalPosition().perp();
276 z[3] = ihit->globalPosition().z();
295 double zInnMin = z[4] - ez[4];
296 double zInnMax = z[4] + ez[4];
300 double zOutMin = z[3] - ez[3];
301 double zOutMax = z[3] + ez[3];
303 double zIntMin = z[2] - ez[2];
304 double zIntMax = z[2] + ez[2];
313 zIntMin = z[1] - ez[1];
314 zIntMax = z[1] + ez[1];
323 zIntMin = z[0] - ez[0];
324 zIntMax = z[0] + ez[0];
334 int size,
double *ax,
double *ay,
double *e2y,
double &p0,
double &e2p0,
double &
p1) {
345 double sqrProjFactor =
346 sqr((hit->globalPosition().z() - region.
origin().
z()) / (hit->globalPosition().perp() - region.
origin().
perp()));
347 return (hit->globalPositionError().czz() + sqrProjFactor * hit->globalPositionError().rerr(hit->globalPosition()));
355 double sqrProjFactor =
356 sqr((hit->globalPosition().z() - region.
origin().
z()) / (hit->globalPosition().perp() - region.
origin().
perp()));
358 sqrt(hit->globalPositionError().czz() + sqrProjFactor * hit->globalPositionError().rerr(hit->globalPosition()));
374 double tmpr, tmpz, tmpez;
378 for (
int i = 0;
i < n -
j;
i++) {
379 if (ar[
i] > ar[
i + 1]) {
409 double zLeft =
getZAtR(rInn, zInnMin, rInt, rOut, zOutMin);
413 double zRight =
getZAtR(rInn, zInnMax, rInt, rOut, zOutMax);
414 if (zIntMin > zRight)
416 if (zIntMin < zLeft && zIntMax < zRight) {
420 if (zIntMin > zLeft && zIntMax > zRight) {
430 double &rInn,
double &zInn,
double &
r,
double &rOut,
double &zOut) {
435 return zInn + (zOut - zInn) * (r - rInn) / (rOut - rInn);
constexpr double deltaPhi(double phi1, double phi2)
std::vector< Hit > hits(float phiMin, float phiMax) const
PixelRecoRange< float > Range
GlobalPoint const & origin() const
LayerCacheType & theLayerCache
virtual Location location() const =0
Which part of the detector (barrel, endcap)
Geom::Phi< T > phi() const
SeedingHitSet::ConstRecHitPointer InnerRecHit
void hitPairs(const TrackingRegion ®, OrderedHitPairs &prs, const Layers &layers, const edm::Event &ev, const edm::EventSetup &es)
const unsigned int theOuterLayer
virtual Range range(const float &rORz) const =0
std::vector< HitWithPhi >::const_iterator HitIter
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)
unsigned int size() const override
virtual HitRZCompatibility * checkRZ(const DetLayer *layer, const Hit &outerHit, const edm::EventSetup &iSetup, const DetLayer *outerlayer=0, float lr=0, float gz=0, float dr=0, float dz=0) const =0
const std::string & name() const
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)
float originZBound() const
bounds the particle vertex in the longitudinal plane
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)
const DetLayer * detLayer() const
const unsigned int theInnerLayer
PixelRecoRange< T > intersection(const PixelRecoRange< T > &r) const
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)