110 std::unique_ptr<reco::PFClusterCollection>
out = std::make_unique<reco::PFClusterCollection>();
111 std::unique_ptr<reco::PFCluster::EEtoPSAssociation> association_out = std::make_unique<reco::PFCluster::EEtoPSAssociation>();
112 std::unique_ptr<edm::ValueMap<reco::GenParticleRef> > genmatching_out = std::make_unique<edm::ValueMap<reco::GenParticleRef> >();
114 std::vector<reco::GenParticleRef> genmatching;
117 for (
size_t iP = 0; iP < particleFlowClusterECALHandle_->size(); iP++) {
119 auto&& pfCluster = particleFlowClusterECALHandle_->at(iP);
124 if (pfCluster.energy() <= 0) {
128 for (
auto&& trackingParticle : *trackingParticleHandle_) {
129 if (trackingParticle.pdgId() != 22)
continue;
130 if (trackingParticle.status() != 1)
continue;
131 matchedKey = trackingParticle.genParticles().at(0).key();
132 float dR2 =
reco::deltaR2(trackingParticle, pfCluster.position());
134 float dE = 1. - trackingParticle.genParticles().at(0)->energy()/pfCluster.energy();
137 bool isConversion =
false;
138 for (
auto&& vertRef : trackingParticle.decayVertices()) {
142 for(
auto&& tpRef: vertRef->daughterTracks()) {
143 if(
std::abs(tpRef->pdgId()) == 11) isConversion =
true;
146 if (isConversion)
break;
148 if (isConversion)
continue;
155 out->push_back(pfCluster);
156 for (
size_t i=0;
i<associationHandle_.
product()->size();
i++) {
157 if (associationHandle_.
product()->at(
i).first == iP) {
158 association_out->push_back(std::make_pair(iN, associationHandle_.
product()->at(
i).second));
170 mapFiller.insert(pfClusterHandle, genmatching.begin(), genmatching.end());
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< reco::GenParticleCollection > genParticleToken_
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleToken_
bool isMatched(TrackingRecHit const &hit)
edm::EDGetTokenT< reco::PFClusterCollection > particleFlowClusterECALToken_
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
T const * product() const
bool sortByKey(const EEPSPair &a, const EEPSPair &b)
edm::EDGetTokenT< reco::PFCluster::EEtoPSAssociation > associationToken_