9 constexpr
float square(
float x) {
return x *
x; };
33 float minFracSharedHits) {
44 float eleGsfPt = eleGsfTk->pt();
45 float eleGsfEta = eleGsfTk->eta();
46 float eleGsfPhi = eleGsfTk->phi();
50 std::optional<float> eleCtfPt = std::nullopt;
51 std::optional<float> eleCtfEta = std::nullopt;
52 std::optional<float> eleCtfPhi = std::nullopt;
56 std::optional<int> ctfidx = std::nullopt;
57 int gsfidx =
static_cast<int>(eleGsfTk.
key());
60 eleCtfPt = eleCtfTk->pt();
61 eleCtfEta = eleCtfTk->eta();
62 eleCtfPhi = eleCtfTk->phi();
63 ctfidx =
static_cast<int>(eleCtfTk.
key());
67 std::vector<ConversionInfo> v_candidatePartners;
73 for (
auto ctftkItr = ctfTable.begin(); ctftkItr != ctfTable.end(); ++ctftkItr, ctftk_i++) {
74 if (useEleCtfTrack && ctftk_i == ctfidx.value())
77 auto ctftk = *ctftkItr;
89 if (useEleCtfTrack && eleCtfTk->charge() + ctftk.
get<
Charge>() == 0 &&
90 deltaR2(eleCtfEta.value(), eleCtfPhi.value(), ctftk.get<
Eta>(), ctftk.get<
Phi>()) <
dR2Max) {
95 int deltaMissingHits = ctftk.get<
MissingInnerHits>() - eleCtfTk->missingInnerHits();
97 v_candidatePartners.push_back(
103 if (eleGsfTk->charge() + ctftk.
get<
Charge>() == 0 &&
110 v_candidatePartners.push_back(
117 for (
auto gsftkItr = gsfTable.begin(); gsftkItr != gsfTable.end(); ++gsftkItr, gsftk_i++) {
119 if (gsfidx == gsftk_i)
122 auto gsftk = *gsftkItr;
135 if (useEleCtfTrack && eleCtfTk->charge() + gsftk.
get<
Charge>() == 0 &&
136 deltaR2(eleCtfEta.value(), eleCtfPhi.value(), gsftk.get<
Eta>(), gsftk.get<
Phi>()) <
dR2Max) {
137 int deltaMissingHits = gsftk.get<
MissingInnerHits>() - eleCtfTk->missingInnerHits();
141 v_candidatePartners.push_back(
146 if (eleGsfTk->charge() + gsftk.
get<
Charge>() == 0 &&
152 int deltaMissingHits = gsftk.get<
MissingInnerHits>() - eleGsfTk->missingInnerHits();
154 v_candidatePartners.push_back(
159 return v_candidatePartners;
167 float rEl = 100.f * ele.
pt() / (-0.3f * bFieldAtOrigin * ele.
charge());
168 float xEl = -1.f * (rEl - ele.
d0()) *
sin(ele.
phi());
169 float yEl = (rEl - ele.
d0()) *
cos(ele.
phi());
177 float d =
sqrt(
pow(xEl - xCand, 2) +
pow(yEl - yCand, 2));
178 float dist =
d - (rEl + rCand);
184 float xa1 = xEl + (xCand - xEl) * rEl /
d;
185 float xa2 = xCand + (xEl - xCand) * rCand /
d;
186 float ya1 = yEl + (yCand - yEl) * rEl /
d;
187 float ya2 = yCand + (yEl - yCand) * rCand /
d;
189 float x = .5f * (xa1 + xa2);
190 float y = .5f * (ya1 + ya2);
196 float tempsign = ele.
px() *
x + ele.
py() * y;
197 tempsign = tempsign /
std::abs(tempsign);
198 rconv = tempsign * rconv;
201 return {dist, dcot, rconv};
210 ConversionInfo const* closestConversion = &convCandidates.front();
212 if (convCandidates.size() == 1)
213 return *closestConversion;
215 float R =
pow(closestConversion->
dist, 2) +
pow(closestConversion->
dcot, 2);
217 for (
auto const&
temp : convCandidates) {
221 closestConversion = &
temp;
225 return *closestConversion;
232 if (v_convCandidates.empty())
235 if (v_convCandidates.size() == 1)
236 return v_convCandidates.at(0);
238 vector<ConversionInfo> v_0;
239 vector<ConversionInfo> v_1;
240 vector<ConversionInfo> v_2;
241 vector<ConversionInfo> v_3;
244 for (
auto const&
temp : v_convCandidates) {
245 if (
temp.radiusOfConversion <= -2)
248 if (
temp.flag == 0) {
255 if (
temp.flag == 1) {
259 if (
temp.flag == 2) {
263 if (
temp.flag == 3) {
TrackRef ctfTrack() const
constexpr float maxRelGsfPtError
float ctfGsfOverlap() const
double px() const
x coordinate of momentum vector
TrackTable::const_iterator::value_type TrackRowView
ConversionInfo findBestConversionMatch(const std::vector< ConversionInfo > &v_convCandidates)
Sin< T >::type sin(const T &t)
double py() const
y coordinate of momentum vector
bool isNonnull() const
Checks for non-null.
ConversionInfo getConversionInfo(reco::Track const &el_track, TrackRowView const &track, float bFieldAtOrigin)
constexpr float maxRelGsfPtErrorForKfConv
key_type key() const
Accessor for product key.
constexpr float maxRefPtErrorForKfConv
double pt() const
track transverse momentum
constexpr float maxRelPtDiffForGsfConv
int charge() const
track electric charge
constexpr int maxDeltaMissingHitsForKFtoKF
constexpr float maxDistOrCotForKFtoKF
edm::soa::ViewFromTable_t< TrackTable > TrackTableView
constexpr float maxRelPtDiffForKfConv
std::vector< ConversionInfo > findConversions(const reco::GsfElectronCore &gsfElectron, TrackTableView ctfTable, TrackTableView gsfTable, float bFieldAtOrigin, float minFracSharedHits)
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
ConversionInfo const & arbitrateConversionPartnersbyR(const std::vector< ConversionInfo > &convCandidates)
double phi() const
azimuthal angle of momentum vector
double d0() const
dxy parameter in perigee convention (d0 = -dxy)
double pz() const
z coordinate of momentum vector
static double square(double x)
const GsfTrackRef & gsfTrack() const
constexpr int minNumberOfValidHits
T const * get() const
Returns C++ pointer to the item.
constexpr float maxDist2Dcot2
constexpr int maxDeltaMissingHits
Power< A, B >::type pow(const A &a, const B &b)
const float radiusOfConversion