27 std::vector<PileupSummaryInfo>
const &ps,
28 int bunchSpacing)
override;
31 using EnergyMap = std::vector<std::pair<unsigned, float>>;
54 sigEnergyToken_(iC.consumes<
EnergyMap>(ps.getParameter<edm::
InputTag>(
"labelSig"))),
55 particlePileInputTag_(ps.getParameter<edm::
InputTag>(
"pileInputTag")),
56 particleCollectionDM_(ps.getParameter<std::
string>(
"collectionDM")) {
82 add(*clusters, *particles, *energy);
97 add(*clusters, *particles, *energy);
112 for (
const auto &
p : particles) {
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)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void addSignals(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
bool getByToken(EDGetToken token, Handle< PROD > &result) const
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_
void add(const SimClusterCollection &clusters, const CaloParticleCollection &particles, const EnergyMap &energyMap)
std::vector< CaloParticle > CaloParticleCollection
bool getByLabel(edm::InputTag const &tag, edm::Handle< T > &result) const
std::vector< std::pair< unsigned, float >> EnergyMap
Log< level::Warning, false > LogWarning
std::vector< SimCluster > SimClusterCollection
#define DEFINE_PREMIXING_WORKER(TYPE)
std::unique_ptr< CaloParticleCollection > newParticles_