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());
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)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
T const * product() const
reco::PFCluster::EEtoPSAssociation::value_type EEPSPair
T getParameter(std::string const &) const
bool sortByKey(const EEPSPair &a, const EEPSPair &b)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void produce(edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< reco::PFCluster::EEtoPSAssociation > associationToken_
PFClusterMatchedToPhotonsSelector(const edm::ParameterSet &)