71 : ecalClusterToolsESGetTokens_{consumesCollector()} {
73 particleFlowClusterECALToken_ =
74 consumes<reco::PFClusterCollection>(iConfig.getParameter<
edm::InputTag>(
"pfClustersTag"));
76 consumes<reco::PFCluster::EEtoPSAssociation>(iConfig.getParameter<
edm::InputTag>(
"pfClustersTag"));
77 trackingParticleToken_ =
78 consumes<TrackingParticleCollection>(iConfig.getParameter<
edm::InputTag>(
"trackingParticleTag"));
79 genParticleToken_ = consumes<reco::GenParticleCollection>(iConfig.getParameter<
edm::InputTag>(
"genParticleTag"));
80 recHitsEB_ = consumes<EcalRecHitCollection>(iConfig.getParameter<
edm::InputTag>(
"recHitsEBLabel"));
81 recHitsEE_ = consumes<EcalRecHitCollection>(iConfig.getParameter<
edm::InputTag>(
"recHitsEELabel"));
83 matchMaxDR2_ = iConfig.getParameter<
double>(
"maxDR2");
84 matchMaxDEDR2_ = iConfig.getParameter<
double>(
"maxDEDR2");
85 volumeZ_EB_ = iConfig.getParameter<
double>(
"volumeZ_EB");
86 volumeRadius_EB_ = iConfig.getParameter<
double>(
"volumeRadius_EB");
87 volumeZ_EE_ = iConfig.getParameter<
double>(
"volumeZ_EE");
89 produces<reco::PFClusterCollection>();
90 produces<edm::ValueMap<reco::GenParticleRef> >();
91 produces<edm::ValueMap<int> >();
92 produces<edm::ValueMap<float> >(
"PS1");
93 produces<edm::ValueMap<float> >(
"PS2");
103 desc.add<
double>(
"maxDR2", 0.1 * 0.1);
104 desc.add<
double>(
"maxDEDR2", 0.5 * 0.5);
105 desc.add<
double>(
"volumeZ_EB", 304.5);
106 desc.add<
double>(
"volumeRadius_EB", 123.8);
107 desc.add<
double>(
"volumeZ_EE", 317.0);
108 descriptions.
add(
"pfClusterMatchedToPhotonsSelector",
desc);
122 std::unique_ptr<reco::PFClusterCollection>
out = std::make_unique<reco::PFClusterCollection>();
123 std::unique_ptr<edm::ValueMap<reco::GenParticleRef> > genmatching_out =
124 std::make_unique<edm::ValueMap<reco::GenParticleRef> >();
125 std::unique_ptr<edm::ValueMap<int> > clustersize_out = std::make_unique<edm::ValueMap<int> >();
126 std::unique_ptr<edm::ValueMap<float> > energyPS1_out = std::make_unique<edm::ValueMap<float> >();
127 std::unique_ptr<edm::ValueMap<float> > energyPS2_out = std::make_unique<edm::ValueMap<float> >();
129 std::vector<reco::GenParticleRef> genmatching;
130 std::vector<int> clustersize;
131 std::vector<float> energyPS1;
132 std::vector<float> energyPS2;
136 for (
size_t iP = 0; iP < particleFlowClusterECALHandle_->size(); iP++) {
137 auto&& pfCluster = particleFlowClusterECALHandle_->at(iP);
142 if (pfCluster.energy() <= 0) {
146 for (
auto&& trackingParticle : *trackingParticleHandle_) {
147 if (trackingParticle.pdgId() != 22)
149 if (trackingParticle.status() != 1)
151 matchedKey = trackingParticle.genParticles().at(0).key();
156 float dE = 1. - trackingParticle.genParticles().at(0)->energy() / pfCluster.energy();
160 bool isConversion =
false;
161 for (
auto&& vertRef : trackingParticle.decayVertices()) {
167 for (
auto&& tpRef : vertRef->daughterTracks()) {
183 out->push_back(pfCluster);
184 double ePS1 = 0, ePS2 = 0;
187 const auto clustops = std::equal_range(
189 for (
auto i_ps = clustops.first; i_ps != clustops.second; ++i_ps) {
191 switch (psclus->
layer()) {
205 clustersize.push_back(lazyTool.n5x5(pfCluster));
206 energyPS1.push_back(ePS1);
207 energyPS2.push_back(ePS2);
214 mapFiller.
insert(pfClusterHandle, genmatching.begin(), genmatching.end());
219 mapFiller_int.
insert(pfClusterHandle, clustersize.begin(), clustersize.end());
220 mapFiller_int.
fill();
224 mapFiller_energyPS1.
insert(pfClusterHandle, energyPS1.begin(), energyPS1.end());
225 mapFiller_energyPS1.
fill();
229 mapFiller_energyPS2.
insert(pfClusterHandle, energyPS2.begin(), energyPS2.end());
230 mapFiller_energyPS2.
fill();
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
edm::EDGetTokenT< reco::GenParticleCollection > genParticleToken_
T const * product() const
void insert(const H &h, I begin, I end)
PFLayer::Layer layer() const
cluster layer, see PFLayer.h in this directory
edm::EDGetTokenT< EcalRecHitCollection > recHitsEB_
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
Container::value_type value_type
ALPAKA_FN_ACC static ALPAKA_FN_INLINE float dR2(Position4 pos1, Position4 pos2)
edm::EDGetTokenT< EcalRecHitCollection > recHitsEE_
double energy() const
cluster energy
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleToken_
bool isMatched(TrackingRecHit const &hit)
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< reco::PFClusterCollection > particleFlowClusterECALToken_
static void fillDescriptions(edm::ConfigurationDescriptions &)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
reco::PFCluster::EEtoPSAssociation::value_type EEPSPair
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 &)