28 using EnergyMap = std::vector<std::pair<unsigned, float> >;
77 add(*clusters, *particles, *energy);
92 add(*clusters, *particles, *energy);
105 for(
const auto&
p: particles) {
110 particle.clearSimClusters();
111 for(
const auto& ref:
p.simClusters()) {
117 for(
const auto elem: energy) {
126 for (
auto& hAndE : hitsAndEnergies) {
130 fraction = hAndE.second / totalenergy;
132 edm::LogWarning(
"PreMixingParticleWorker") <<
"TotalSimEnergy for hit " << hAndE.first
133 <<
" is 0! The fraction for this hit cannot be computed.";
139 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
std::vector< std::pair< uint32_t, float > > hits_and_fractions() const
Returns list of rechit IDs and fractions for this SimCluster.
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_
std::vector< std::pair< unsigned, float > > EnergyMap
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< SimCluster > SimClusterCollection
#define DEFINE_PREMIXING_WORKER(TYPE)
std::unique_ptr< CaloParticleCollection > newParticles_