79 produces<reco::PFClusterCollection>();
80 produces<reco::PFCluster::EEtoPSAssociation>();
81 produces<edm::ValueMap<reco::GenParticleRef> >();
89 desc.add<
double>(
"maxDR2", 0.1 * 0.1);
90 desc.add<
double>(
"maxDEDR2", 0.5 * 0.5);
91 desc.add<
double>(
"volumeZ_EB", 304.5);
92 desc.add<
double>(
"volumeRadius_EB", 123.8);
93 desc.add<
double>(
"volumeZ_EE", 317.0);
94 descriptions.
add(
"pfClusterMatchedToPhotonsSelector",
desc);
107 std::unique_ptr<reco::PFClusterCollection>
out = std::make_unique<reco::PFClusterCollection>();
108 std::unique_ptr<reco::PFCluster::EEtoPSAssociation> association_out =
109 std::make_unique<reco::PFCluster::EEtoPSAssociation>();
110 std::unique_ptr<edm::ValueMap<reco::GenParticleRef> > genmatching_out =
111 std::make_unique<edm::ValueMap<reco::GenParticleRef> >();
113 std::vector<reco::GenParticleRef> genmatching;
116 for (
size_t iP = 0; iP < particleFlowClusterECALHandle_->size(); iP++) {
117 auto&& pfCluster = particleFlowClusterECALHandle_->at(iP);
122 if (pfCluster.energy() <= 0) {
126 for (
auto&& trackingParticle : *trackingParticleHandle_) {
127 if (trackingParticle.pdgId() != 22)
129 if (trackingParticle.status() != 1)
131 matchedKey = trackingParticle.genParticles().at(0).key();
132 float dR2 =
reco::deltaR2(trackingParticle, pfCluster.position());
135 float dE = 1. - trackingParticle.genParticles().at(0)->energy() / pfCluster.energy();
139 bool isConversion =
false;
140 for (
auto&& vertRef : trackingParticle.decayVertices()) {
146 for (
auto&& tpRef : vertRef->daughterTracks()) {
162 out->push_back(pfCluster);
163 for (
size_t i = 0;
i < associationHandle_.
product()->size();
i++) {
164 if (associationHandle_.
product()->at(
i).first == iP) {
165 association_out->push_back(std::make_pair(iN, associationHandle_.
product()->at(
i).second));
172 std::sort(association_out->begin(), association_out->end(),
sortByKey);
177 mapFiller.
insert(pfClusterHandle, genmatching.begin(), genmatching.end());