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()) {
193 ePS1 += psclus->energy();
196 ePS2 += psclus->energy();
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
edm::EDGetTokenT< EcalRecHitCollection > recHitsEB_
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
ALPAKA_FN_ACC static ALPAKA_FN_INLINE float dR2(Position4 pos1, Position4 pos2)
edm::EDGetTokenT< EcalRecHitCollection > recHitsEE_
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())
bool sortByKey(const EEPSPair &a, const EEPSPair &b)
edm::EDGetTokenT< reco::PFCluster::EEtoPSAssociation > associationToken_