67 : m_vecPileupSummaryInfoToken(
69 m_hepMCProductToken(consumes<edm::
HepMCProduct>(iConfig.getParameter<edm::
InputTag>(
"mcTruthCollection"))),
70 m_weighter(iConfig.getParameter<edm::
ParameterSet>(
"weighterConfig")) {
84 double computed_weight(1);
91 std::vector<PileupSummaryInfo>::const_iterator pileupinfo;
92 for (pileupinfo = pileupinfos->begin(); pileupinfo != pileupinfos->end(); ++pileupinfo) {
93 if (pileupinfo->getBunchCrossing() == 0)
98 if (pileupinfo->getBunchCrossing() != 0) {
99 edm::LogError(
"NoInTimePileUpInfo") <<
"Cannot find the in-time pileup info " << pileupinfo->getBunchCrossing();
103 const std::vector<float>& zpositions = pileupinfo->getPU_zpositions();
119 if (Evt->vertices_begin() != Evt->vertices_end()) {
120 zmain = (*Evt->vertices_begin())->point3d().z() / 10.;
128 std::unique_ptr<double>
weight(
new double(computed_weight));
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
Log< level::Error, false > LogError
MCVerticesWeight(const edm::ParameterSet &)
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > m_vecPileupSummaryInfoToken
bool filter(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
const VertexWeighter m_weighter
edm::EDGetTokenT< edm::HepMCProduct > m_hepMCProductToken
~MCVerticesWeight() override
const double weight(const std::vector< float > &zpositions, const float &zmain) const