66 : theVertexFinder_(nullptr)
120 "dEtacutForSCmatching");
122 "dPhicutForSCmatching");
169 auto outputConvPhotonCollection_p = std::make_unique<reco::ConversionCollection>();
175 iEvent.getByToken(
src_, trackCollectionHandle);
178 std::multimap<float, edm::Ptr<reco::ConversionTrack> > convTrackMap;
179 for (
auto const&
t : trackCollectionHandle->ptrs())
180 convTrackMap.emplace(
t->track()->eta(),
t);
187 edm::LogError(
"ConversionProducer") <<
"Error! Can't get the product primary Vertex Collection "
209 std::multimap<double, reco::CaloClusterPtr> basicClusterPtrs;
210 std::multimap<double, reco::CaloClusterPtr> superClusterPtrs;
220 outputConvPhotonCollection);
222 outputConvPhotonCollection_p->assign(outputConvPhotonCollection.begin(), outputConvPhotonCollection.end());
227 std::multimap<double, reco::CaloClusterPtr>& basicClusterPtrs,
228 std::multimap<double, reco::CaloClusterPtr>& superClusterPtrs) {
232 if (!scBarrelHandle.
isValid()) {
233 edm::LogError(
"ConvertedPhotonProducer") <<
"Error! Can't get the barrel superclusters!";
239 if (!scEndcapHandle.
isValid()) {
240 edm::LogError(
"ConvertedPhotonProducer") <<
"Error! Can't get the endcap superclusters!";
247 if (!bcBarrelHandle.
isValid()) {
248 edm::LogError(
"ConvertedPhotonProducer") <<
"Error! Can't get the barrel basic clusters!";
252 if (!bcEndcapHandle.
isValid()) {
253 edm::LogError(
"ConvertedPhotonProducer") <<
"Error! Can't get the endcap basic clusters!";
256 if (bcBarrelHandle.
isValid()) {
257 for (
auto const&
handle : {bcBarrelHandle, bcEndcapHandle}) {
258 for (
auto const& bc :
handle->ptrs()) {
260 basicClusterPtrs.emplace(bc->position().eta(), bc);
265 if (scBarrelHandle.
isValid()) {
266 for (
auto const&
handle : {scBarrelHandle, scEndcapHandle}) {
267 for (
auto const& sc :
handle->ptrs()) {
269 superClusterPtrs.emplace(sc->position().eta(), sc);
278 const std::multimap<double, reco::CaloClusterPtr>& superClusterPtrs,
279 const std::multimap<double, reco::CaloClusterPtr>& basicClusterPtrs,
302 std::map<edm::Ptr<reco::ConversionTrack>,
math::XYZPointF> trackImpactPosition;
312 const reco::Track* tk = tk_ref->second->trackRef().get();
317 trackImpactPosition[tk_ref->second] = ew;
322 trackMatchedBC[tk_ref->second] = closest_bc;
333 bool track1HighPurity =
true;
341 if (dynamic_cast<const reco::GsfTrack*>(left.
get())) {
353 track1HighPurity =
false;
356 track1HighPurity =
false;
359 std::vector<int> right_candidates;
360 std::vector<double> right_candidate_theta, right_candidate_approach;
361 std::vector<std::pair<bool, reco::Vertex> > vertex_candidates;
365 std::multimap<float, edm::Ptr<reco::ConversionTrack> >::const_iterator
rr = ll;
368 bool track2HighPurity =
true;
369 bool highPurityPair =
true;
375 if (dynamic_cast<const reco::GsfTrack*>(right.
get())) {
392 double approachDist = -999.;
413 bool goodVertex =
checkVertex(ttk_l, ttk_r, magField, theConversionVertex);
423 highPurityPair =
false;
428 track2HighPurity =
false;
431 track2HighPurity =
false;
435 std::vector<edm::RefToBase<reco::Track> > trackPairRef;
436 trackPairRef.push_back(left);
437 trackPairRef.push_back(right);
439 std::vector<math::XYZVectorF> trackPin;
440 std::vector<math::XYZVectorF> trackPout;
441 std::vector<math::XYZPointF> trackInnPos;
442 std::vector<uint8_t> nHitsBeforeVtx;
443 std::vector<Measurement1DFloat> dlClosestHitToVtx;
454 nHitsBeforeVtx.push_back(leftWrongHits.first);
455 nHitsBeforeVtx.push_back(rightWrongHits.first);
456 dlClosestHitToVtx.push_back(leftWrongHits.second);
457 dlClosestHitToVtx.push_back(rightWrongHits.second);
463 if (theConversionVertex.
isValid()) {
466 highPurityPair =
false;
470 std::vector<math::XYZPointF> trkPositionAtEcal;
471 std::vector<reco::CaloClusterPtr> matchingBC;
477 std::map<edm::Ptr<reco::ConversionTrack>,
math::XYZPointF>::const_iterator trackImpactPositionLeft =
478 trackImpactPosition.find(ll->second);
479 std::map<edm::Ptr<reco::ConversionTrack>,
math::XYZPointF>::const_iterator trackImpactPositionRight =
480 trackImpactPosition.find(
rr->second);
481 std::map<edm::Ptr<reco::ConversionTrack>,
reco::CaloClusterPtr>::const_iterator trackMatchedBCLeft =
482 trackMatchedBC.find(ll->second);
483 std::map<edm::Ptr<reco::ConversionTrack>,
reco::CaloClusterPtr>::const_iterator trackMatchedBCRight =
484 trackMatchedBC.find(
rr->second);
486 if (trackImpactPositionLeft != trackImpactPosition.end()) {
487 trkPositionAtEcal.push_back(trackImpactPositionLeft->second);
491 if (trackImpactPositionRight != trackImpactPosition.end()) {
492 trkPositionAtEcal.push_back(trackImpactPositionRight->second);
495 double total_e_bc = 0.;
496 if (trackMatchedBCLeft != trackMatchedBC.end()) {
497 matchingBC.push_back(trackMatchedBCLeft->second);
498 total_e_bc += trackMatchedBCLeft->second->energy();
502 if (trackMatchedBCRight != trackMatchedBC.end()) {
503 matchingBC.push_back(trackMatchedBCRight->second);
504 total_e_bc += trackMatchedBCRight->second->energy();
508 highPurityPair =
false;
512 highPurityPair = highPurityPair && track1HighPurity && track2HighPurity && goodVertex &&
513 checkPhi(left, right, trackerGeom, magField, theConversionVertex);
526 const float minAppDist = approachDist;
545 if (
matchingSC(superClusterPtrs, newCandidate, scPtrVec))
550 !dynamic_cast<const reco::GsfTrack*>(ll->second->trackRef().get()) &&
551 !dynamic_cast<const reco::GsfTrack*>(
rr->second->trackRef().get());
552 bool gsfTracksOpenOnly = ll->second->isGsfTrackOpen() &&
rr->second->isGsfTrackOpen();
554 bool arbitratedMerged = ll->second->isArbitratedMerged() &&
rr->second->isArbitratedMerged();
555 bool arbitratedMergedEcalGeneral =
556 ll->second->isArbitratedMergedEcalGeneral() &&
rr->second->isArbitratedMergedEcalGeneral();
564 outputConvPhotonCollection.push_back(newCandidate);
622 stateAtECAL = propag.
propagate(myTSOS, *theBarrel_);
626 stateAtECAL = propag.
propagate(myTSOS, *thePositiveEtaEndcap_);
628 stateAtECAL = propag.
propagate(myTSOS, *theNegativeEtaEndcap_);
643 double detaMin = 999.;
646 for (std::multimap<double, reco::CaloClusterPtr>::const_iterator scItr = scMap.begin(); scItr != scMap.end();
650 double sceta = sc->eta();
652 const double delta_eta = fabs(conveta - sceta);
670 const double track_eta = trackImpactPosition.eta();
671 const double track_phi = trackImpactPosition.phi();
673 double min_eta = 999., min_phi = 999.;
675 for (std::multimap<double, reco::CaloClusterPtr>::const_iterator bc = bcMap.lower_bound(track_eta -
halfWayEta_);
679 const double delta_eta = track_eta - (ebc->position().eta());
685 closest_bc = bc->second;
692 closestBC = closest_bc;
714 double recoPhoR =
vtx.position().Rho();
721 recoPhoR - 0.001, recoPhoR + 0.001, -fabs(
vtx.position().z()), fabs(
vtx.position().z()))));
730 stateAtVtx1 = propag.
propagate(myTSOS1, *theBarrel_);
732 stateAtVtx1 = propag.
propagate(myTSOS1, *theDisk_);
737 stateAtVtx2 = propag.
propagate(myTSOS2, *theBarrel_);
739 stateAtVtx2 = propag.
propagate(myTSOS2, *theDisk_);
779 double rho = tangentPoint.
perp();
790 std::pair<GlobalTrajectoryParameters, GlobalTrajectoryParameters> trajs = tangent.
trajectoryParameters();
793 if (
std::abs(trajs.first.position().z() - trajs.second.position().z()) >
dzCut_) {
797 float minApproach = tangent.
perpdist();
798 appDist = minApproach;
815 double total_e_bc = 0;
817 total_e_bc += bc_l->energy();
820 total_e_bc += bc_r->energy();
836 std::vector<reco::TransientTrack> pair;
837 pair.push_back(ttk_l);
838 pair.push_back(ttk_r);
847 const float PI = 3.1415927;
850 const float R_ECAL = 136.5;
857 float ZEcal =
R_ECAL * sinh(EtaParticle) + Zvertex;
867 if (EtaParticle < 0.0)
869 float Zlen = Zend - Zvertex;
870 float RR = Zlen / sinh(EtaParticle);
871 Theta = atan(RR / Zend);