27 std::vector<PileupSummaryInfo>
const &ps,
31 using EnergyMap = std::vector<std::pair<unsigned, float>>;
55 particlePileInputTag_(ps.getParameter<
edm::
InputTag>(
"pileInputTag")),
56 particleCollectionDM_(ps.getParameter<
std::
string>(
"collectionDM")) {
117 particle.clearSimClusters();
118 for (
const auto &ref :
p.simClusters()) {
124 for (
const auto &elem :
energy) {
131 std::vector<PileupSummaryInfo>
const &ps,
134 auto hitsAndEnergies = sc.hits_and_fractions();
135 sc.clearHitsAndFractions();
136 for (
auto &hAndE : hitsAndEnergies) {
140 fraction = hAndE.second / totalenergy;
143 <<
"TotalSimEnergy for hit " << hAndE.first <<
" is 0! The fraction for this hit cannot be computed.";
144 sc.addRecHitAndFraction(hAndE.first,
fraction);
149 std::unordered_map<unsigned, float>{}.swap(
totalEnergy_);
edm::InputTag particlePileInputTag_
PreMixingCaloParticleWorker(const edm::ParameterSet &ps, edm::ProducesCollector, edm::ConsumesCollector &&iC)
void addSignals(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
SimClusterRefProd clusterRef_
edm::Ref< SimClusterCollection > SimClusterRef
void addPileups(PileUpEventPrincipal const &pep, edm::EventSetup const &iSetup) override
edm::EDGetTokenT< CaloParticleCollection > sigParticleToken_
edm::EDGetTokenT< EnergyMap > sigEnergyToken_
void put(edm::Event &iEvent, edm::EventSetup const &iSetup, std::vector< PileupSummaryInfo > const &ps, int bunchSpacing) override
void initializeEvent(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
std::string particleCollectionDM_
~PreMixingCaloParticleWorker() override=default
std::unordered_map< unsigned, float > totalEnergy_
std::unique_ptr< SimClusterCollection > newClusters_
edm::EDGetTokenT< SimClusterCollection > sigClusterToken_
std::vector< std::pair< unsigned, float > > EnergyMap
void add(const SimClusterCollection &clusters, const CaloParticleCollection &particles, const EnergyMap &energyMap)
std::vector< CaloParticle > CaloParticleCollection
Log< level::Warning, false > LogWarning
std::vector< SimCluster > SimClusterCollection
#define DEFINE_PREMIXING_WORKER(TYPE)
std::unique_ptr< CaloParticleCollection > newParticles_
bool getByLabel(edm::InputTag const &tag, edm::Handle< T > &result) const