43 return a.first < b.first;
79 produces<reco::PFClusterCollection>();
80 produces<reco::PFCluster::EEtoPSAssociation>();
81 produces<edm::ValueMap<reco::GenParticleRef> >();
90 desc.
add<
double>(
"maxDR2", 0.1*0.1);
91 desc.
add<
double>(
"maxDEDR2", 0.5*0.5);
92 desc.
add<
double>(
"volumeZ_EB", 304.5);
93 desc.
add<
double>(
"volumeRadius_EB", 123.8);
94 desc.
add<
double>(
"volumeZ_EE", 317.0);
95 descriptions.
add(
"pfClusterMatchedToPhotonsSelector", desc);
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));
165 std::sort(association_out->begin(),association_out->end(),
sortByKey);
170 mapFiller.
insert(pfClusterHandle, genmatching.begin(), genmatching.end());
T getParameter(std::string const &) const
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
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< reco::GenParticleCollection > genParticleToken_
void insert(const H &h, I begin, I end)
Container::value_type value_type
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleToken_
bool isMatched(TrackingRecHit const &hit)
edm::EDGetTokenT< reco::PFClusterCollection > particleFlowClusterECALToken_
static void fillDescriptions(edm::ConfigurationDescriptions &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
T const * product() const
reco::PFCluster::EEtoPSAssociation::value_type EEPSPair
bool sortByKey(const EEPSPair &a, const EEPSPair &b)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
void produce(edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< reco::PFCluster::EEtoPSAssociation > associationToken_
PFClusterMatchedToPhotonsSelector(const edm::ParameterSet &)