24 template<
class T>
inline T sqr(
T t) {
return t*
t;}
40 : theLayerCache(*layerCache), theOuterLayer(outer), theInnerLayer(inner),
43 ss =
new std::stringstream;
60 size_t totCountP2=0, totCountP1=0, totCountM2=0, totCountM1=0, selCount=0;
62 (*ss) <<
"In " << innerLayerObj.
name() <<
" Out " <<
theOuterLayer.name() << std::endl;
67 if (innerHitsMap.
empty())
return;
70 if (outerHitsMap.
empty())
return;
76 vector<RecHitsSortedInPhi::Hit> innerHits;
78 float innerPhimin, innerPhimax;
91 for(nextoh=oh+1;nextoh!=outerHits.second; ++nextoh){
98 (*ss) <<
"\toPos " << oPos <<
" r " << oPos.
perp() <<
" phi " << oPos.
phi() <<
" cotTheta " << oPos.
z()/oPos.
perp() << std::endl;
99 (*ss) <<
"\tnoPos " << noPos <<
" r " << noPos.
perp() <<
" phi " << noPos.
phi() <<
" cotTheta " << noPos.
z()/noPos.
perp() << std::endl;
120 innerPhimin=ohit->globalPosition().phi();
121 innerPhimax=nohit->globalPosition().phi();
125 innerHitsMap.
hits(innerPhimin, innerPhimax, innerHits);
128 (*ss) <<
"\tiphimin, iphimax " << innerPhimin <<
" " << innerPhimax << std::endl;
135 vector<RecHitsSortedInPhi::Hit>::const_iterator ieh = innerHits.end();
136 for ( vector<RecHitsSortedInPhi::Hit>::const_iterator ih=innerHits.begin(); ih < ieh; ++ih) {
141 (*ss) <<
"\toPos " << oPos <<
" r " << oPos.
perp() <<
" phi " << oPos.
phi() <<
" cotTheta " << oPos.
z()/oPos.
perp() << std::endl;
142 (*ss) <<
"\tnoPos " << noPos <<
" r " << noPos.
perp() <<
" phi " << noPos.
phi() <<
" cotTheta " << noPos.
z()/noPos.
perp() << std::endl;
143 (*ss) <<
"\tinnPos " << innPos <<
" r " << innPos.
perp() <<
" phi " << innPos.
phi() <<
" cotTheta " << innPos.
z()/innPos.
perp() << std::endl;
154 for ( vector<RecHitsSortedInPhi::Hit>::const_iterator nextih=ih+1; nextih != ieh; ++nextih) {
160 (*ss) <<
"\toPos " << oPos <<
" r " << oPos.
perp() <<
" phi " << oPos.
phi() <<
" cotTheta " << oPos.
z()/oPos.
perp() << std::endl;
161 (*ss) <<
"\tnoPos " << noPos <<
" r " << noPos.
perp() <<
" phi " << noPos.
phi() <<
" cotTheta " << noPos.
z()/noPos.
perp() << std::endl;
162 (*ss) <<
"\tinnPos " << innPos <<
" r " << innPos.
perp() <<
" phi " << innPos.
phi() <<
" cotTheta " << innPos.
z()/innPos.
perp() << std::endl;
163 (*ss) <<
"\tninnPos " << ninnPos <<
" r " << ninnPos.
perp() <<
" phi " << ninnPos.
phi() <<
" cotTheta " << ninnPos.
z()/ninnPos.
perp() << std::endl;
178 edm::LogError(
"TooManyQuads")<<
"number of Quad combinations exceed maximum, no quads produced";
183 (*ss) <<
"In " << innerLayerObj.
name() <<
" Out " << outerLayerObj.
name()
184 <<
"\tP2 " << totCountP2
185 <<
"\tM2 " << totCountM2
186 <<
"\tP1 " << totCountP1
187 <<
"\tM1 " << totCountM1
188 <<
"\tsel " << selCount
208 (*ss) <<
"In " << innerLayerObj.
name() <<
" Out " << outerLayerObj.
name()
209 <<
"\tP2 " << totCountP2
210 <<
"\tM2 " << totCountM2
211 <<
"\tP1 " << totCountP1
212 <<
"\tM1 " << totCountM1
213 <<
"\tsel " << selCount
227 (*ss) <<
"*******\nNo valid checkRZ\n*******" << std::endl;
237 allowed = checkRZ->
range(r_reduced);
238 float zErr = nSigmaRZ * hit->errorGlobalZ();
239 hitRZ =
Range(hit->globalPosition().z()-zErr, hit->globalPosition().z()+zErr);
241 allowed = checkRZ->
range(hit->globalPosition().z());
242 float rErr = nSigmaRZ * hit->errorGlobalR();
243 hitRZ =
Range(r_reduced-rErr, r_reduced+rErr);
249 <<
"\n\t\t allowed Range " << allowed.
min() <<
" \t, " << allowed.max()
250 <<
"\n\t\t hitRz Range " << hitRZ.min() <<
" \t, " << hitRZ.max()
251 <<
"\n\t\t Cross Range " << crossRange.min() <<
" \t, " << crossRange.max()
253 if( !crossRange.empty())
254 (*
ss) <<
"\n\t\t !!!!ACCEPTED!!! \n\n";
257 return crossRange.empty();
264 double r[5],
z[5], ez[5];
269 r[0] = ohit->globalPosition().perp();
270 z[0] = ohit->globalPosition().z();
273 r[1] = nohit->globalPosition().perp();
274 z[1] = nohit->globalPosition().z();
277 r[2] = nihit->globalPosition().perp();
278 z[2] = nihit->globalPosition().z();
281 r[3] = ihit->globalPosition().perp();
282 z[3] = ihit->globalPosition().z();
292 if ( vError > 15. ) vError = 1.;
300 double zInnMin = z[4]-ez[4];
301 double zInnMax = z[4]+ez[4];
305 double zOutMin = z[3]-ez[3];
306 double zOutMax = z[3]+ez[3];
308 double zIntMin = z[2]-ez[2];
309 double zIntMax = z[2]+ez[2];
311 rInt, zIntMin, zIntMax,
312 rOut, zOutMin, zOutMax) )
return true;
319 zIntMin = z[1]-ez[1];
320 zIntMax = z[1]+ez[1];
322 rInt, zIntMin, zIntMax,
323 rOut, zOutMin, zOutMax) )
return true;
330 zIntMin = z[0]-ez[0];
331 zIntMax = z[0]+ez[0];
333 rInt, zIntMin, zIntMax,
334 rOut, zOutMin, zOutMax) )
return true;
356 double sqrProjFactor =
sqr((hit->globalPosition().z()-region.
origin().
z())/(hit->globalPosition().perp()-region.
origin().
perp()));
357 return (hit->globalPositionError().czz()+sqrProjFactor*hit->globalPositionError().rerr(hit->globalPosition()));
366 double sqrProjFactor =
sqr((hit->globalPosition().z()-region.
origin().
z())/(hit->globalPosition().perp()-region.
origin().
perp()));
367 double effErr =
sqrt(hit->globalPositionError().czz()+sqrProjFactor*hit->globalPositionError().rerr(hit->globalPosition()));
384 double tmpr, tmpz, tmpez;
388 for (
int i = 0;
i < n - j;
i++) {
389 if ( ar[
i] > ar[
i+1] ) {
407 double &rInt,
double &zIntMin,
double &zIntMax,
408 double &rOut,
double &zOutMin,
double &zOutMax){
414 double zLeft =
getZAtR(rInn, zInnMin, rInt, rOut, zOutMin);
415 if ( zIntMax < zLeft )
return true;
417 double zRight =
getZAtR(rInn, zInnMax, rInt, rOut, zOutMax);
418 if ( zIntMin > zRight )
return true;
419 if ( zIntMin < zLeft && zIntMax < zRight ) {
423 if ( zIntMin > zLeft && zIntMax > zRight ) {
436 double &rOut,
double &zOut){
443 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
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
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
std::pair< HitIter, HitIter > Range
virtual Range range(const float &rORz) const =0
std::vector< HitWithPhi >::const_iterator HitIter
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)