14 const double bFieldAtOrigin);
21 double maxAbsDist,
double maxAbsDcot)
30 const double bFieldAtOrigin,
31 const double minFracSharedHits) {
33 std::vector<ConversionInfo>
temp =
getConversionInfos(*gsfElectron.
core(),ctftracks_h,gsftracks_h,bFieldAtOrigin,minFracSharedHits) ;
41 const double bFieldAtOrigin,
42 const double minFracSharedHits) {
44 std::vector<ConversionInfo>
temp =
getConversionInfos(gsfElectron,ctftracks_h,gsftracks_h,bFieldAtOrigin,minFracSharedHits) ;
54 const double bFieldAtOrigin,
55 const double minFracSharedHits) {
74 if(el_ctftrack.
isNonnull() && el_ctftrack.
id() != ctftracks_h.
id())
75 throw cms::Exception(
"ConversionFinderError") <<
"ProductID of ctf track collection does not match ProductID of electron's CTF track! \n";
76 if(el_gsftrack.
isNonnull() && el_gsftrack.
id() != gsftracks_h.
id())
77 throw cms::Exception(
"ConversionFinderError") <<
"ProductID of gsf track collection does not match ProductID of electron's GSF track! \n";
80 LorentzVector el_ctftrack_p4;
82 el_ctftrack_p4 =
LorentzVector(el_ctftrack->px(), el_ctftrack->py(), el_ctftrack->pz(), el_ctftrack->p());
83 LorentzVector el_gsftrack_p4(el_gsftrack->px(), el_gsftrack->py(), el_gsftrack->pz(), el_gsftrack->p());
90 ctfidx = static_cast<int>(el_ctftrack.
key());
92 gsfidx =
static_cast<int>(el_gsftrack.
key());
96 vector<ConversionInfo> v_candidatePartners;
103 for(TrackCollection::const_iterator ctftk = ctftracks->begin();
104 ctftk != ctftracks->end(); ctftk++, ctftk_i++) {
106 if(ctftk_i == ctfidx)
110 LorentzVector ctftk_p4 =
LorentzVector(ctftk->px(), ctftk->py(), ctftk->pz(), ctftk->p());
113 if(ctftk->ptError()/ctftk->pt() > 0.05)
115 if(ctftk->numberOfValidHits() < 5)
120 fabs(ctftk_p4.Pt() - el_ctftrack->pt())/el_ctftrack->pt() < 0.2)
126 deltaR(el_ctftrack_p4, ctftk_p4) < 0.5 &&
127 (el_ctftrack->charge() + ctftk->charge() == 0) ) {
137 v_candidatePartners.push_back({convInfo.
dist,
150 if(
deltaR(el_gsftrack_p4, ctftk_p4) < 0.5 &&
151 (el_gsftrack->charge() + ctftk->charge() == 0) &&
152 el_gsftrack->ptError()/el_gsftrack->pt() < 0.25) {
159 v_candidatePartners.push_back({convInfo.
dist,
173 for(GsfTrackCollection::const_iterator gsftk = gsftracks->begin();
174 gsftk != gsftracks->end(); gsftk++, gsftk_i++) {
177 if(gsfidx == gsftk_i)
180 LorentzVector gsftk_p4 =
LorentzVector(gsftk->px(), gsftk->py(), gsftk->pz(), gsftk->p());
183 if(gsftk->ptError()/gsftk->pt() > 0.5)
185 if(gsftk->numberOfValidHits() < 5)
188 if(fabs(gsftk->pt() - el_gsftrack->pt())/el_gsftrack->pt() < 0.25)
195 deltaR(el_ctftrack_p4, gsftk_p4) < 0.5 &&
196 (el_ctftrack->charge() + gsftk->charge() == 0)) {
203 v_candidatePartners.push_back({convInfo.
dist,
214 if(
deltaR(el_gsftrack_p4, gsftk_p4) < 0.5 &&
215 (el_gsftrack->charge() + gsftk->charge() == 0) &&
216 (el_gsftrack->ptError()/el_gsftrack_p4.pt() < 0.5)) {
224 v_candidatePartners.push_back({convInfo.
dist,
236 return v_candidatePartners;
244 const double bFieldAtOrigin) {
246 using namespace reco;
249 LorentzVector el_tk_p4(el_track->
px(), el_track->
py(), el_track->
pz(), el_track->
p());
250 double elCurvature = -0.3*bFieldAtOrigin*(el_track->
charge()/el_tk_p4.pt())/100.;
251 double rEl = fabs(1./elCurvature);
252 double xEl = -1*(1./elCurvature - el_track->
d0())*
sin(el_tk_p4.phi());
253 double yEl = (1./elCurvature - el_track->
d0())*
cos(el_tk_p4.phi());
256 LorentzVector cand_p4 =
LorentzVector(candPartnerTk->
px(), candPartnerTk->
py(),candPartnerTk->
pz(), candPartnerTk->
p());
257 double candCurvature = -0.3*bFieldAtOrigin*(candPartnerTk->
charge()/cand_p4.pt())/100.;
258 double rCand = fabs(1./candCurvature);
259 double xCand = -1*(1./candCurvature - candPartnerTk->
d0())*
sin(cand_p4.phi());
260 double yCand = (1./candCurvature - candPartnerTk->
d0())*
cos(cand_p4.phi());
262 double d =
sqrt(
pow(xEl-xCand, 2) +
pow(yEl-yCand , 2));
263 double dist = d - (rEl + rCand);
264 double dcot = 1./
tan(el_tk_p4.theta()) - 1./
tan(cand_p4.theta());
267 double xa1 = xEl + (xCand-xEl) * rEl/d;
268 double xa2 = xCand + (xEl-xCand) * rCand/d;
269 double ya1 = yEl + (yCand-yEl) * rEl/d;
270 double ya2 = yCand + (yEl-yCand) * rCand/d;
272 double x=.5*(xa1+xa2);
273 double y=.5*(ya1+ya2);
275 double z = el_track->
dz() + rEl*el_track->
pz()*TMath::ACos(1-
pow(rconv,2)/(2.*
pow(rEl,2)))/el_track->
pt();
280 float tempsign = el_track->
px()*x + el_track->
py()*y;
281 tempsign = tempsign/fabs(tempsign);
282 rconv = tempsign*rconv;
306 if(v_convCandidates.size() == 1)
307 return v_convCandidates.at(0);
309 double R =
sqrt(
pow(v_convCandidates.at(0).dist,2) +
pow(v_convCandidates.at(0).dcot,2));
314 for(
auto const&
temp : v_convCandidates) {
323 return v_convCandidates.at(iArbitrated);
332 if(v_convCandidates.empty())
339 if(v_convCandidates.size() == 1)
340 return v_convCandidates.at(0);
342 vector<ConversionInfo> v_0;
343 vector<ConversionInfo> v_1;
344 vector<ConversionInfo> v_2;
345 vector<ConversionInfo> v_3;
347 for(
unsigned int i = 1;
i < v_convCandidates.size();
i++) {
352 if(fabs(temp.
dist) < 0.02 &&
353 fabs(temp.
dcot) < 0.02 &&
424 int trk1_q,
float trk1_d0,
425 LorentzVector trk2_p4,
426 int trk2_q,
float trk2_d0,
427 float bFieldAtOrigin) {
430 double tk1Curvature = -0.3*bFieldAtOrigin*(trk1_q/trk1_p4.pt())/100.;
431 double rTk1 = fabs(1./tk1Curvature);
432 double xTk1 = -1.*(1./tk1Curvature - trk1_d0)*
sin(trk1_p4.phi());
433 double yTk1 = (1./tk1Curvature - trk1_d0)*
cos(trk1_p4.phi());
436 double tk2Curvature = -0.3*bFieldAtOrigin*(trk2_q/trk2_p4.pt())/100.;
437 double rTk2 = fabs(1./tk2Curvature);
438 double xTk2 = -1.*(1./tk2Curvature - trk2_d0)*
sin(trk2_p4.phi());
439 double yTk2 = (1./tk2Curvature - trk2_d0)*
cos(trk2_p4.phi());
442 double dist =
sqrt(
pow(xTk1-xTk2, 2) +
pow(yTk1-yTk2 , 2));
443 dist = dist - (rTk1 + rTk2);
445 double dcot = 1./
tan(trk1_p4.theta()) - 1./
tan(trk2_p4.theta());
447 return std::make_pair(dist, dcot);
455 const double bFieldAtOrigin,
456 const double minFracSharedHits) {
459 using namespace reco;
469 ctfidx =
static_cast<int>(el_ctftrack.
key());
481 LorentzVector el_tk_p4(el_track->
px(), el_track->
py(), el_track->
pz(), el_track->
p());
485 double mindcot = 9999.;
490 for(TrackCollection::const_iterator tk = ctftracks->begin();
491 tk != ctftracks->end(); tk++, tk_i++) {
496 LorentzVector tk_p4 =
LorentzVector(tk->px(), tk->py(),tk->pz(), tk->p());
499 double dR =
deltaR(el_tk_p4, tk_p4);
505 if(tk->charge() + el_track->
charge() != 0)
508 double dcot = fabs(1./
tan(tk_p4.theta()) - 1./
tan(el_tk_p4.theta()));
525 double elCurvature = -0.3*bFieldAtOrigin*(el_track->
charge()/el_tk_p4.pt())/100.;
526 double rEl = fabs(1./elCurvature);
527 double xEl = -1*(1./elCurvature - el_track->
d0())*
sin(el_tk_p4.phi());
528 double yEl = (1./elCurvature - el_track->
d0())*
cos(el_tk_p4.phi());
531 LorentzVector cand_p4 =
LorentzVector(candCtfTrackRef->px(), candCtfTrackRef->py(),candCtfTrackRef->pz(), candCtfTrackRef->p());
532 double candCurvature = -0.3*bFieldAtOrigin*(candCtfTrackRef->charge()/cand_p4.pt())/100.;
533 double rCand = fabs(1./candCurvature);
534 double xCand = -1*(1./candCurvature - candCtfTrackRef->d0())*
sin(cand_p4.phi());
535 double yCand = (1./candCurvature - candCtfTrackRef->d0())*
cos(cand_p4.phi());
537 double d =
sqrt(
pow(xEl-xCand, 2) +
pow(yEl-yCand , 2));
538 double dist = d - (rEl + rCand);
539 double dcot = 1./
tan(el_tk_p4.theta()) - 1./
tan(cand_p4.theta());
542 double xa1 = xEl + (xCand-xEl) * rEl/d;
543 double xa2 = xCand + (xEl-xCand) * rCand/d;
544 double ya1 = yEl + (yCand-yEl) * rEl/d;
545 double ya2 = yCand + (yEl-yCand) * rCand/d;
547 double x=.5*(xa1+xa2);
548 double y=.5*(ya1+ya2);
550 double z = el_track->
dz() + rEl*el_track->
pz()*TMath::ACos(1-
pow(rconv,2)/(2.*
pow(rEl,2)))/el_track->
pt();
555 float tempsign = el_track->
px()*x + el_track->
py()*y;
556 tempsign = tempsign/fabs(tempsign);
557 rconv = tempsign*rconv;
559 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