11 double maxAbsDist,
double maxAbsDcot)
26 const double bFieldAtOrigin,
27 const double minFracSharedHits) {
29 std::vector<ConversionInfo>
temp =
getConversionInfos(*gsfElectron.
core(),ctftracks_h,gsftracks_h,bFieldAtOrigin,minFracSharedHits) ;
37 const double bFieldAtOrigin,
38 const double minFracSharedHits) {
40 std::vector<ConversionInfo>
temp =
getConversionInfos(gsfElectron,ctftracks_h,gsftracks_h,bFieldAtOrigin,minFracSharedHits) ;
50 const double bFieldAtOrigin,
51 const double minFracSharedHits) {
70 if(el_ctftrack.
isNonnull() && el_ctftrack.
id() != ctftracks_h.
id())
71 throw cms::Exception(
"ConversionFinderError") <<
"ProductID of ctf track collection does not match ProductID of electron's CTF track! \n";
72 if(el_gsftrack.
isNonnull() && el_gsftrack.
id() != gsftracks_h.
id())
73 throw cms::Exception(
"ConversionFinderError") <<
"ProductID of gsf track collection does not match ProductID of electron's GSF track! \n";
78 el_ctftrack_p4 =
LorentzVector(el_ctftrack->px(), el_ctftrack->py(), el_ctftrack->pz(), el_ctftrack->p());
79 LorentzVector el_gsftrack_p4(el_gsftrack->px(), el_gsftrack->py(), el_gsftrack->pz(), el_gsftrack->p());
86 ctfidx = static_cast<int>(el_ctftrack.
key());
88 gsfidx =
static_cast<int>(el_gsftrack.
key());
92 vector<ConversionInfo> v_candidatePartners;
99 for(TrackCollection::const_iterator ctftk = ctftracks->begin();
100 ctftk != ctftracks->end(); ctftk++, ctftk_i++) {
102 if((ctftk_i == ctfidx))
109 if(ctftk->ptError()/ctftk->pt() > 0.05)
111 if(ctftk->numberOfValidHits() < 5)
116 fabs(ctftk_p4.Pt() - el_ctftrack->pt())/el_ctftrack->pt() < 0.2)
122 deltaR(el_ctftrack_p4, ctftk_p4) < 0.5 &&
123 (el_ctftrack->charge() + ctftk->charge() == 0) ) {
141 v_candidatePartners.push_back(convInfo);
147 if(
deltaR(el_gsftrack_p4, ctftk_p4) < 0.5 &&
148 (el_gsftrack->charge() + ctftk->charge() == 0) &&
149 el_gsftrack->ptError()/el_gsftrack->pt() < 0.25) {
157 convInfo.radiusOfConversion(),
158 convInfo.pointOfConversion(),
164 v_candidatePartners.push_back(convInfo);
171 for(GsfTrackCollection::const_iterator gsftk = gsftracks->begin();
172 gsftk != gsftracks->end(); gsftk++, gsftk_i++) {
175 if(gsfidx == gsftk_i)
181 if(gsftk->ptError()/gsftk->pt() > 0.5)
183 if(gsftk->numberOfValidHits() < 5)
186 if(fabs(gsftk->pt() - el_gsftrack->pt())/el_gsftrack->pt() < 0.25)
193 deltaR(el_ctftrack_p4, gsftk_p4) < 0.5 &&
194 (el_ctftrack->charge() + gsftk->charge() == 0)) {
209 v_candidatePartners.push_back(convInfo);
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)) {
232 v_candidatePartners.push_back(convInfo);
237 return v_candidatePartners;
245 const double bFieldAtOrigin) {
247 using namespace reco;
251 double elCurvature = -0.3*bFieldAtOrigin*(el_track->
charge()/el_tk_p4.pt())/100.;
252 double rEl = fabs(1./elCurvature);
253 double xEl = -1*(1./elCurvature - el_track->
d0())*
sin(el_tk_p4.phi());
254 double yEl = (1./elCurvature - el_track->
d0())*
cos(el_tk_p4.phi());
258 double candCurvature = -0.3*bFieldAtOrigin*(candPartnerTk->
charge()/cand_p4.pt())/100.;
259 double rCand = fabs(1./candCurvature);
260 double xCand = -1*(1./candCurvature - candPartnerTk->
d0())*
sin(cand_p4.phi());
261 double yCand = (1./candCurvature - candPartnerTk->
d0())*
cos(cand_p4.phi());
263 double d =
sqrt(
pow(xEl-xCand, 2) +
pow(yEl-yCand , 2));
264 double dist = d - (rEl + rCand);
265 double dcot = 1./
tan(el_tk_p4.theta()) - 1./
tan(cand_p4.theta());
268 double xa1 = xEl + (xCand-xEl) * rEl/d;
269 double xa2 = xCand + (xEl-xCand) * rCand/d;
270 double ya1 = yEl + (yCand-yEl) * rEl/d;
271 double ya2 = yCand + (yEl-yCand) * rCand/d;
273 double x=.5*(xa1+xa2);
274 double y=.5*(ya1+ya2);
276 double z = el_track->
dz() + rEl*el_track->
pz()*TMath::ACos(1-
pow(rconv,2)/(2.*
pow(rEl,2)))/el_track->
pt();
281 float tempsign = el_track->
px()*x + el_track->
py()*
y;
282 tempsign = tempsign/fabs(tempsign);
283 rconv = tempsign*rconv;
307 if(v_convCandidates.size() == 1)
308 return v_convCandidates.at(0);
313 for(
unsigned int i = 1;
i < v_convCandidates.size();
i++) {
318 arbitratedConvInfo =
temp;
323 return arbitratedConvInfo;
332 if(v_convCandidates.size() == 0)
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++) {
350 if(temp.
flag() == 0) {
352 if(fabs(temp.
dist()) < 0.02 &&
353 fabs(temp.
dcot()) < 0.02 &&
366 if(temp.
flag() == 1) {
373 if(temp.
flag() == 2) {
381 if(temp.
flag() == 3) {
424 int trk1_q,
float trk1_d0,
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());
485 double mindcot = 9999.;
490 for(TrackCollection::const_iterator tk = ctftracks->begin();
491 tk != ctftracks->end(); tk++, tk_i++) {
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
bool isNonnull() const
Checks for non-null.
ConversionInfo findBestConversionMatch(const std::vector< ConversionInfo > &v_convCandidates)
double radiusOfConversion() const
double d0() const
dxy parameter in perigee convention (d0 = -dxy)
float ctfGsfOverlap() const
const reco::Track * getElectronTrack(const reco::GsfElectron &, const float minFracSharedHits=0.45)
ConversionInfo getConversionInfo(const reco::GsfElectronCore &, const edm::Handle< reco::TrackCollection > &ctftracks_h, const edm::Handle< reco::GsfTrackCollection > &gsftracks_h, const double bFieldAtOrigin, const double minFracSharedHits=0.45)
bool isFromConversion(const ConversionInfo &, double maxAbsDist=0.02, double maxAbsDcot=0.02)
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.
TrackRef closestCtfTrackRef() const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
double pt() const
track transverse momentum
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)
math::XYZTLorentzVector LorentzVector
T const * get() const
Returns C++ pointer to the item.
math::XYZPoint pointOfConversion() const
ConversionInfo arbitrateConversionPartnersbyR(const std::vector< ConversionInfo > &v_convCandidates)
int deltaMissingHits() const
double pz() const
z coordinate of momentum vector
std::vector< ConversionInfo > getConversionInfos(const reco::GsfElectronCore &, const edm::Handle< reco::TrackCollection > &ctftracks_h, const edm::Handle< reco::GsfTrackCollection > &gsftracks_h, const double bFieldAtOrigin, const double minFracSharedHits=0.45)
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...
double deltaR(double eta1, double eta2, double phi1, double phi2)
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
virtual GsfElectronCoreRef core() const
TrackRef ctfTrack() const
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
math::XYZTLorentzVector LorentzVector
int numberOfHits(HitCategory category) const
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack