30 if ((rDiff >= rMax) | (rDiff <= rMin))
35 return (phiDiff < thePhiMax) & (phiDiff > thePhiMin);
45 float zDiff = myZ - ts.
z();
46 float myZmax = theZMax;
47 float myZmin = theZMin;
53 if ((zDiff >= myZmax) | (zDiff <= myZmin))
58 return (phiDiff < thePhiMax) & (phiDiff > thePhiMin);
75 meas1stBLayer{phi1min, phi1max, 0., 0.},
76 meas2ndBLayer{phi2minB, phi2maxB, z2minB, z2maxB},
77 meas1stFLayer{phi1min, phi1max, 0., 0., rMinI, rMaxI},
78 meas2ndFLayer{phi2minF, phi2maxF, r2minF, r2maxF, rMinI, rMaxI},
79 prop1stLayer(
nullptr),
80 prop2ndLayer(
nullptr),
107 float mass = .000511;
117 auto xmeas_r = xmeas.
perp();
125 std::vector<SeedWithInfo>
result;
126 unsigned int allSeedsSize = 0;
127 for (
auto const sc : seedsV)
128 allSeedsSize +=
sc->size();
135 for (
auto &
i : iTsos)
137 std::vector<TrajectoryStateOnSurface> vTsos;
138 vTsos.reserve(allSeedsSize);
140 for (
const auto seeds : seedsV) {
141 for (
const auto &
seed : *seeds) {
142 std::vector<GlobalPoint> hitGpMap;
143 if (
seed.nHits() > 9) {
144 edm::LogWarning(
"GsfElectronAlgo|UnexpectedSeed") <<
"We cannot deal with seeds having more than 9 hits.";
151 for (
auto it = hits.first; it != hits.second; ++it) {
152 hitGpMap.emplace_back(it->globalPosition());
156 auto he = hits.second - 1;
157 for (
auto it1 = hits.first; it1 <
he; ++it1) {
161 const DetId id1 = it1->geographicalId();
162 const GeomDet *geomdet1 = it1->det();
172 auto dt = hit1Pos.
x() * xmeas.
x() + hit1Pos.
y() * xmeas.
y();
175 if (
dt < phicut * (xmeas_r * hit1Pos.
perp()))
178 if (iTsos[ix1] < 0) {
179 iTsos[ix1] = vTsos.size();
182 auto tsos1 = &vTsos[iTsos[ix1]];
184 if (!tsos1->isValid())
189 EleRelPointPair pp1(hit1Pos, tsos1->globalParameters().position(), vprim);
190 const math::XYZPoint relHit1Pos(hit1Pos - vprim), relTSOSPos(tsos1->globalParameters().position() - vprim);
192 const float dRz1 = (id1.
subdetId() % 2 ? pp1.dZ() : pp1.dPerp());
193 const float dPhi1 = pp1.dPhi();
199 const double pxHit1z = hit1Pos.
z();
200 const double pxHit1x = hit1Pos.
x();
201 const double pxHit1y = hit1Pos.
y();
202 const double r1diff =
203 std::sqrt((pxHit1x - vprim.
x()) * (pxHit1x - vprim.
x()) + (pxHit1y - vprim.
y()) * (pxHit1y - vprim.
y()));
204 const double r2diff =
205 std::sqrt((xmeas.
x() - pxHit1x) * (xmeas.
x() - pxHit1x) + (xmeas.
y() - pxHit1y) * (xmeas.
y() - pxHit1y));
206 zVertex = pxHit1z - r1diff * (xmeas.
z() - pxHit1z) / r2diff;
214 for (
auto it2 = it1 + 1; it2 != hits.second; ++it2) {
218 const DetId id2 = it2->geographicalId();
219 const GeomDet *geomdet2 = it2->det();
220 const auto det_key = std::make_pair(geomdet2->
gdetIndex(), hit1Pos);
222 auto tsos2_itr = mapTsos2Fast.find(det_key);
223 if (tsos2_itr != mapTsos2Fast.end()) {
224 tsos2 = &(tsos2_itr->second);
226 auto empl_result = mapTsos2Fast.emplace(det_key,
prop2ndLayer->propagate(fts2, geomdet2->
surface()));
227 tsos2 = &(empl_result.first->second);
229 if (!tsos2->isValid())
237 const float dRz2 = (subDet2 % 2 == 1) ? pp2.dZ() : pp2.dPerp();
238 const float dPhi2 = pp2.dPhi();
239 const unsigned char hitsMask = (1 << idx1) | (1 << idx2);
240 result.push_back({
seed, hitsMask, subDet2, dRz2, dPhi2, subDet1, dRz1, dPhi1});
BarrelMeasurementEstimator meas2ndBLayer
std::pair< const_iterator, const_iterator > range
static FreeTrajectoryState get(MagneticField const &magField, GlobalPoint const &xmeas, GlobalPoint const &xvert, float momentum, TrackCharge charge)
BarrelMeasurementEstimator meas1stBLayer
PixelHitMatcher(float phi1min, float phi1max, float phi2minB, float phi2maxB, float phi2minF, float phi2maxF, float z2minB, float z2maxB, float r2minF, float r2maxF, float rMinI, float rMaxI, bool useRecoVertex)
constexpr T normalizedPhi(T phi)
const Plane & surface() const
The nominal surface of the GeomDet.
std::unique_ptr< PropagatorWithMaterial > prop2ndLayer
std::vector< SeedWithInfo > operator()(const std::vector< const TrajectorySeedCollection * > &seedsV, const GlobalPoint &xmeas, const GlobalPoint &vprim, float energy, int charge) const
void set2ndLayer(float dummyphi2minB, float dummyphi2maxB, float dummyphi2minF, float dummyphi2maxF)
std::unique_ptr< PropagatorWithMaterial > prop1stLayer
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
void set1stLayerZRange(float zmin1, float zmax1)
bool operator()(const GlobalPoint &vprim, const TrajectoryStateOnSurface &ts, const GlobalPoint &gp) const
Cos< T >::type cos(const T &t)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
const MagneticField * theMagField
Abs< T >::type abs(const T &t)
GlobalVector momentum() const
bool operator()(const GlobalPoint &vprim, const TrajectoryStateOnSurface &ts, const GlobalPoint &gp) const
GlobalPoint position() const
GlobalPoint position() const
std::unordered_map< std::pair< int, GlobalPoint >, T, HashIntGlobalPointPair > IntGlobalPointPairUnorderedMap
const GlobalTrajectoryParameters & globalParameters() const
void set1stLayer(float dummyphi1min, float dummyphi1max)
XYZPointD XYZPoint
point in space with cartesian internal representation
ForwardMeasurementEstimator meas2ndFLayer
ForwardMeasurementEstimator meas1stFLayer
const bool useRecoVertex_
void setES(const MagneticField *, const TrackerGeometry *trackerGeometry)
const TrackerGeometry * theTrackerGeometry