22 float rDiff =
gp.perp() - ts.
perp();
31 if ((rDiff >=
rMax) | (rDiff <=
rMin))
36 return (phiDiff < thePhiMax) & (phiDiff > thePhiMin);
47 float zDiff = myZ - ts.
z();
48 float myZmax = theZMax;
49 float myZmin = theZMin;
55 if ((zDiff >= myZmax) | (zDiff <= myZmin))
60 return (phiDiff < thePhiMax) & (phiDiff > thePhiMin);
74 meas1stBLayer{phi1min, phi1max, 0., 0.},
75 meas2ndBLayer{phi2minB, phi2maxB, -z2maxB, z2maxB},
76 meas1stFLayer{phi1min, phi1max, 0., 0., -rMaxI, rMaxI},
77 meas2ndFLayer{phi2minF, phi2maxF, -r2maxF, r2maxF, -rMaxI, rMaxI},
104 constexpr
float mass = .000511;
114 auto xmeas_r = xmeas.
perp();
122 std::vector<SeedWithInfo>
result;
123 unsigned int allSeedsSize = 0;
124 for (
auto const sc : seedsV)
125 allSeedsSize += sc->size();
132 for (
auto &
i : iTsos)
134 std::vector<TrajectoryStateOnSurface> vTsos;
135 vTsos.reserve(allSeedsSize);
137 std::vector<GlobalPoint> hitGpMap;
138 for (
const auto seeds : seedsV) {
141 if (
seed.nHits() > 9) {
142 edm::LogWarning(
"GsfElectronAlgo|UnexpectedSeed") <<
"We cannot deal with seeds having more than 9 hits.";
150 hitGpMap.emplace_back(
hit.globalPosition());
155 for (
auto it1 =
hits.begin(); it1 <
he; ++it1) {
159 const DetId id1 = it1->geographicalId();
160 const GeomDet *geomdet1 = it1->det();
170 auto dt = hit1Pos.
x() * xmeas.
x() + hit1Pos.
y() * xmeas.
y();
173 if (
dt < phicut * (xmeas_r * hit1Pos.
perp()))
176 if (iTsos[ix1] < 0) {
177 iTsos[ix1] = vTsos.size();
180 auto tsos1 = &vTsos[iTsos[ix1]];
182 if (!tsos1->isValid())
188 EleRelPointPair pp1(hit1Pos, tsos1->globalParameters().position(), vprim);
189 const math::XYZPoint relHit1Pos(hit1Pos - vprim), relTSOSPos(tsos1->globalParameters().position() - vprim);
190 const int subDet1 =
id1.subdetId();
191 const float dRz1 = (
id1.subdetId() % 2 ? pp1.dZ() : pp1.dPerp());
192 const float dPhi1 = pp1.dPhi();
198 const double pxHit1z = hit1Pos.
z();
199 const double pxHit1x = hit1Pos.
x();
200 const double pxHit1y = hit1Pos.
y();
201 const double r1diff =
202 std::sqrt((pxHit1x - vprim.
x()) * (pxHit1x - vprim.
x()) + (pxHit1y - vprim.
y()) * (pxHit1y - vprim.
y()));
203 const double r2diff =
204 std::sqrt((xmeas.
x() - pxHit1x) * (xmeas.
x() - pxHit1x) + (xmeas.
y() - pxHit1y) * (xmeas.
y() - pxHit1y));
205 zVertex = pxHit1z - r1diff * (xmeas.
z() - pxHit1z) / r2diff;
213 for (
auto it2 = it1 + 1; it2 !=
hits.end(); ++it2) {
217 const DetId id2 = it2->geographicalId();
218 const GeomDet *geomdet2 = it2->det();
219 const auto det_key = std::make_pair(geomdet2->
gdetIndex(), hit1Pos);
221 auto tsos2_itr = mapTsos2Fast.find(det_key);
222 if (tsos2_itr != mapTsos2Fast.end()) {
223 tsos2 = &(tsos2_itr->second);
225 auto empl_result = mapTsos2Fast.emplace(det_key,
prop2ndLayer->propagate(fts2, geomdet2->
surface()));
226 tsos2 = &(empl_result.first->second);
228 if (!tsos2->isValid())
235 const int subDet2 =
id2.subdetId();
236 const float dRz2 = (subDet2 % 2 == 1) ? pp2.dZ() : pp2.dPerp();
237 const float dPhi2 = pp2.dPhi();
238 const unsigned char hitsMask = (1 << idx1) | (1 << idx2);
239 result.push_back({
seed, hitsMask, subDet2, dRz2, dPhi2, subDet1, dRz1, dPhi1});
BarrelMeasurementEstimator meas2ndBLayer
BarrelMeasurementEstimator meas1stBLayer
GlobalPoint position() const
constexpr T normalizedPhi(T phi)
const GlobalTrajectoryParameters & globalParameters() const
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
std::unique_ptr< PropagatorWithMaterial > prop2ndLayer
void set2ndLayer(float dummyphi2minB, float dummyphi2maxB, float dummyphi2minF, float dummyphi2maxF)
std::unique_ptr< PropagatorWithMaterial > prop1stLayer
void set1stLayerZRange(float zmin1, float zmax1)
Cos< T >::type cos(const T &t)
const MagneticField * theMagField
Abs< T >::type abs(const T &t)
bool operator()(const GlobalPoint &vprim, const TrajectoryStateOnSurface &, const GlobalPoint &, int charge) const
const Plane & surface() const
The nominal surface of the GeomDet.
std::unordered_map< std::pair< int, GlobalPoint >, T, HashIntGlobalPointPair > IntGlobalPointPairUnorderedMap
void set1stLayer(float dummyphi1min, float dummyphi1max)
XYZPointD XYZPoint
point in space with cartesian internal representation
ForwardMeasurementEstimator meas2ndFLayer
bool operator()(const GlobalPoint &vprim, const TrajectoryStateOnSurface &, const GlobalPoint &, int charge) const
ForwardMeasurementEstimator meas1stFLayer
const bool useRecoVertex_
Log< level::Warning, false > LogWarning
std::vector< SeedWithInfo > operator()(const std::vector< const TrajectorySeedCollection *> &seedsV, const GlobalPoint &xmeas, const GlobalPoint &vprim, float energy, int charge) const
const TrackerGeometry * theTrackerGeometry
PixelHitMatcher(float phi1min, float phi1max, float phi2minB, float phi2maxB, float phi2minF, float phi2maxF, float z2maxB, float r2maxF, float rMaxI, bool useRecoVertex)
void setES(MagneticField const &, TrackerGeometry const &trackerGeometry)