14 const double bFieldAtOrigin);
28 const double bFieldAtOrigin,
29 const double minFracSharedHits) {
30 std::vector<ConversionInfo>
temp =
38 const double bFieldAtOrigin,
39 const double minFracSharedHits) {
40 std::vector<ConversionInfo>
temp =
41 getConversionInfos(gsfElectron, ctftracks_h, gsftracks_h, bFieldAtOrigin, minFracSharedHits);
49 const double bFieldAtOrigin,
50 const double minFracSharedHits) {
65 if (el_ctftrack.
isNonnull() && el_ctftrack.
id() != ctftracks_h.
id())
67 <<
"ProductID of ctf track collection does not match ProductID of electron's CTF track! \n";
68 if (el_gsftrack.
isNonnull() && el_gsftrack.
id() != gsftracks_h.
id())
70 <<
"ProductID of gsf track collection does not match ProductID of electron's GSF track! \n";
73 LorentzVector el_ctftrack_p4;
75 el_ctftrack_p4 =
LorentzVector(el_ctftrack->px(), el_ctftrack->py(), el_ctftrack->pz(), el_ctftrack->p());
76 LorentzVector el_gsftrack_p4(el_gsftrack->px(), el_gsftrack->py(), el_gsftrack->pz(), el_gsftrack->p());
83 ctfidx = static_cast<int>(el_ctftrack.
key());
85 gsfidx =
static_cast<int>(el_gsftrack.
key());
88 vector<ConversionInfo> v_candidatePartners;
94 for (TrackCollection::const_iterator ctftk = ctftracks->begin(); ctftk != ctftracks->end(); ctftk++, ctftk_i++) {
95 if (ctftk_i == ctfidx)
99 LorentzVector ctftk_p4 =
LorentzVector(ctftk->px(), ctftk->py(), ctftk->pz(), ctftk->p());
102 if (ctftk->ptError() / ctftk->pt() > 0.05)
104 if (ctftk->numberOfValidHits() < 5)
108 fabs(ctftk_p4.Pt() - el_ctftrack->pt()) / el_ctftrack->pt() < 0.2)
114 deltaR(el_ctftrack_p4, ctftk_p4) < 0.5 && (el_ctftrack->charge() + ctftk->charge() == 0)) {
122 v_candidatePartners.push_back({convInfo.
dist,
134 if (
deltaR(el_gsftrack_p4, ctftk_p4) < 0.5 && (el_gsftrack->charge() + ctftk->charge() == 0) &&
135 el_gsftrack->ptError() / el_gsftrack->pt() < 0.25) {
141 v_candidatePartners.push_back({convInfo.
dist,
154 for (GsfTrackCollection::const_iterator gsftk = gsftracks->begin(); gsftk != gsftracks->end(); gsftk++, gsftk_i++) {
156 if (gsfidx == gsftk_i)
159 LorentzVector gsftk_p4 =
LorentzVector(gsftk->px(), gsftk->py(), gsftk->pz(), gsftk->p());
162 if (gsftk->ptError() / gsftk->pt() > 0.5)
164 if (gsftk->numberOfValidHits() < 5)
167 if (fabs(gsftk->pt() - el_gsftrack->pt()) / el_gsftrack->pt() < 0.25)
174 deltaR(el_ctftrack_p4, gsftk_p4) < 0.5 && (el_ctftrack->charge() + gsftk->charge() == 0)) {
181 v_candidatePartners.push_back({convInfo.
dist,
192 if (
deltaR(el_gsftrack_p4, gsftk_p4) < 0.5 && (el_gsftrack->charge() + gsftk->charge() == 0) &&
193 (el_gsftrack->ptError() / el_gsftrack_p4.pt() < 0.5)) {
201 v_candidatePartners.push_back({convInfo.
dist,
212 return v_candidatePartners;
218 const double bFieldAtOrigin) {
219 using namespace reco;
222 LorentzVector el_tk_p4(el_track->
px(), el_track->
py(), el_track->
pz(), el_track->
p());
223 double elCurvature = -0.3 * bFieldAtOrigin * (el_track->
charge() / el_tk_p4.pt()) / 100.;
224 double rEl = fabs(1. / elCurvature);
225 double xEl = -1 * (1. / elCurvature - el_track->
d0()) *
sin(el_tk_p4.phi());
226 double yEl = (1. / elCurvature - el_track->
d0()) *
cos(el_tk_p4.phi());
228 LorentzVector cand_p4 =
229 LorentzVector(candPartnerTk->
px(), candPartnerTk->
py(), candPartnerTk->
pz(), candPartnerTk->
p());
230 double candCurvature = -0.3 * bFieldAtOrigin * (candPartnerTk->
charge() / cand_p4.pt()) / 100.;
231 double rCand = fabs(1. / candCurvature);
232 double xCand = -1 * (1. / candCurvature - candPartnerTk->
d0()) *
sin(cand_p4.phi());
233 double yCand = (1. / candCurvature - candPartnerTk->
d0()) *
cos(cand_p4.phi());
235 double d =
sqrt(
pow(xEl - xCand, 2) +
pow(yEl - yCand, 2));
236 double dist = d - (rEl + rCand);
237 double dcot = 1. /
tan(el_tk_p4.theta()) - 1. /
tan(cand_p4.theta());
240 double xa1 = xEl + (xCand - xEl) * rEl / d;
241 double xa2 = xCand + (xEl - xCand) * rCand / d;
242 double ya1 = yEl + (yCand - yEl) * rEl / d;
243 double ya2 = yCand + (yEl - yCand) * rCand / d;
245 double x = .5 * (xa1 + xa2);
246 double y = .5 * (ya1 + ya2);
249 el_track->
dz() + rEl * el_track->
pz() * TMath::ACos(1 -
pow(rconv, 2) / (2. *
pow(rEl, 2))) / el_track->
pt();
254 float tempsign = el_track->
px() * x + el_track->
py() * y;
255 tempsign = tempsign / fabs(tempsign);
256 rconv = tempsign * rconv;
276 if (v_convCandidates.size() == 1)
277 return v_convCandidates.at(0);
279 double R =
sqrt(
pow(v_convCandidates.at(0).dist, 2) +
pow(v_convCandidates.at(0).dcot, 2));
284 for (
auto const&
temp : v_convCandidates) {
293 return v_convCandidates.at(iArbitrated);
300 if (v_convCandidates.empty())
310 if (v_convCandidates.size() == 1)
311 return v_convCandidates.at(0);
313 vector<ConversionInfo> v_0;
314 vector<ConversionInfo> v_1;
315 vector<ConversionInfo> v_2;
316 vector<ConversionInfo> v_3;
318 for (
unsigned int i = 1;
i < v_convCandidates.size();
i++) {
321 if (temp.
flag == 0) {
334 if (temp.
flag == 1) {
339 if (temp.
flag == 2) {
344 if (temp.
flag == 3) {
381 LorentzVector trk2_p4,
384 float bFieldAtOrigin) {
385 double tk1Curvature = -0.3 * bFieldAtOrigin * (trk1_q / trk1_p4.pt()) / 100.;
386 double rTk1 = fabs(1. / tk1Curvature);
387 double xTk1 = -1. * (1. / tk1Curvature - trk1_d0) *
sin(trk1_p4.phi());
388 double yTk1 = (1. / tk1Curvature - trk1_d0) *
cos(trk1_p4.phi());
390 double tk2Curvature = -0.3 * bFieldAtOrigin * (trk2_q / trk2_p4.pt()) / 100.;
391 double rTk2 = fabs(1. / tk2Curvature);
392 double xTk2 = -1. * (1. / tk2Curvature - trk2_d0) *
sin(trk2_p4.phi());
393 double yTk2 = (1. / tk2Curvature - trk2_d0) *
cos(trk2_p4.phi());
395 double dist =
sqrt(
pow(xTk1 - xTk2, 2) +
pow(yTk1 - yTk2, 2));
396 dist = dist - (rTk1 + rTk2);
398 double dcot = 1. /
tan(trk1_p4.theta()) - 1. /
tan(trk2_p4.theta());
400 return std::make_pair(dist, dcot);
406 const double bFieldAtOrigin,
407 const double minFracSharedHits) {
408 using namespace reco;
417 ctfidx =
static_cast<int>(el_ctftrack.
key());
428 LorentzVector el_tk_p4(el_track->
px(), el_track->
py(), el_track->
pz(), el_track->
p());
431 double mindcot = 9999.;
435 for (TrackCollection::const_iterator tk = ctftracks->begin(); tk != ctftracks->end(); tk++, tk_i++) {
440 LorentzVector tk_p4 =
LorentzVector(tk->px(), tk->py(), tk->pz(), tk->p());
443 double dR =
deltaR(el_tk_p4, tk_p4);
448 if (tk->charge() + el_track->
charge() != 0)
451 double dcot = fabs(1. /
tan(tk_p4.theta()) - 1. /
tan(el_tk_p4.theta()));
452 if (dcot < mindcot) {
469 double elCurvature = -0.3 * bFieldAtOrigin * (el_track->
charge() / el_tk_p4.pt()) / 100.;
470 double rEl = fabs(1. / elCurvature);
471 double xEl = -1 * (1. / elCurvature - el_track->
d0()) *
sin(el_tk_p4.phi());
472 double yEl = (1. / elCurvature - el_track->
d0()) *
cos(el_tk_p4.phi());
474 LorentzVector cand_p4 =
475 LorentzVector(candCtfTrackRef->px(), candCtfTrackRef->py(), candCtfTrackRef->pz(), candCtfTrackRef->p());
476 double candCurvature = -0.3 * bFieldAtOrigin * (candCtfTrackRef->charge() / cand_p4.pt()) / 100.;
477 double rCand = fabs(1. / candCurvature);
478 double xCand = -1 * (1. / candCurvature - candCtfTrackRef->d0()) *
sin(cand_p4.phi());
479 double yCand = (1. / candCurvature - candCtfTrackRef->d0()) *
cos(cand_p4.phi());
481 double d =
sqrt(
pow(xEl - xCand, 2) +
pow(yEl - yCand, 2));
482 double dist = d - (rEl + rCand);
483 double dcot = 1. /
tan(el_tk_p4.theta()) - 1. /
tan(cand_p4.theta());
486 double xa1 = xEl + (xCand - xEl) * rEl / d;
487 double xa2 = xCand + (xEl - xCand) * rCand / d;
488 double ya1 = yEl + (yCand - yEl) * rEl / d;
489 double ya2 = yCand + (yEl - yCand) * rCand / d;
491 double x = .5 * (xa1 + xa2);
492 double y = .5 * (ya1 + ya2);
495 el_track->
dz() + rEl * el_track->
pz() * TMath::ACos(1 -
pow(rconv, 2) / (2. *
pow(rEl, 2))) / el_track->
pt();
500 float tempsign = el_track->
px() * x + el_track->
py() * y;
501 tempsign = tempsign / fabs(tempsign);
502 rconv = tempsign * rconv;
504 int deltaMissingHits = -9999;
edm::Ref< GsfTrackCollection > GsfTrackRef
persistent reference to a GsfTrack
double p() const
momentum vector magnitude
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
virtual TrackRef closestCtfTrackRef() const
bool isNonnull() const
Checks for non-null.
double d0() const
dxy parameter in perigee convention (d0 = -dxy)
float ctfGsfOverlap() const
Sin< T >::type sin(const T &t)
const GsfTrackRef & gsfTrack() const
std::vector< Track > TrackCollection
collection of Tracks
key_type key() const
Accessor for product key.
double px() const
x coordinate of momentum vector
ProductID id() const
Accessor for product ID.
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
double pt() const
track transverse momentum
const double radiusOfConversion
std::vector< GsfTrack > GsfTrackCollection
collection of GsfTracks
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
T const * get() const
Returns C++ pointer to the item.
double pz() const
z coordinate of momentum vector
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
float shFracInnerHits() const
T const * product() const
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
XYZPointD XYZPoint
point in space with cartesian internal representation
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
int numberOfLostHits(HitCategory category) const
virtual GsfElectronCoreRef core() const
const int deltaMissingHits
TrackRef ctfTrack() const
const math::XYZPoint pointOfConversion
int charge() const
track electric charge
Power< A, B >::type pow(const A &a, const B &b)
double py() const
y coordinate of momentum vector