27 std::vector<PileupSummaryInfo>
const &ps,
28 int bunchSpacing)
override;
31 using EnergyMap = std::vector<std::pair<unsigned, float>>;
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,
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.";
149 std::unordered_map<unsigned, float>{}.swap(
totalEnergy_);
edm::InputTag particlePileInputTag_
BranchAliasSetterT< ProductType > produces()
declare what type of product will make and with which optional label
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void addSignals(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
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
void addRecHitAndFraction(uint32_t hit, float fraction)
add rechit with fraction
std::string particleCollectionDM_
~PreMixingCaloParticleWorker() override=default
std::unordered_map< unsigned, float > totalEnergy_
void clearHitsAndFractions()
clear the hits and fractions list
std::unique_ptr< SimClusterCollection > newClusters_
edm::EDGetTokenT< SimClusterCollection > sigClusterToken_
PreMixingCaloParticleWorker(const edm::ParameterSet &ps, edm::ProducerBase &producer, edm::ConsumesCollector &&iC)
def elem(elemtype, innerHTML='', html_class='', kwargs)
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
std::vector< SimCluster > SimClusterCollection
#define DEFINE_PREMIXING_WORKER(TYPE)
std::unique_ptr< CaloParticleCollection > newParticles_
std::vector< std::pair< uint32_t, float > > hits_and_fractions() const
Returns list of rechit IDs and fractions for this SimCluster.