79 m_pileupcollection(iConfig.getParameter<edm::InputTag>(
"pileupSummaryCollection")),
80 m_mctruthcollection(iConfig.getParameter<edm::InputTag>(
"mcTruthCollection")),
81 m_weighter(iConfig.getParameter<edm::
ParameterSet>(
"weighterConfig"))
107 bool selected =
true;
109 double computed_weight(1);
117 std::vector<PileupSummaryInfo>::const_iterator pileupinfo;
118 for(pileupinfo = pileupinfos->begin(); pileupinfo != pileupinfos->end() ; ++pileupinfo) {
119 if(pileupinfo->getBunchCrossing()==0)
break;
123 if(pileupinfo->getBunchCrossing()!=0) {
124 edm::LogError(
"NoInTimePileUpInfo") <<
"Cannot find the in-time pileup info " << pileupinfo->getBunchCrossing();
130 const std::vector<float>& zpositions = pileupinfo->getPU_zpositions();
141 const HepMC::GenEvent* Evt = EvtHandle->GetEvent();
146 if(Evt->vertices_begin() != Evt->vertices_end()) {
147 zmain = (*Evt->vertices_begin())->point3d().z()/10.;
157 std::auto_ptr<double>
weight(
new double(computed_weight));
#define DEFINE_FWK_MODULE(type)
edm::InputTag m_mctruthcollection
MCVerticesWeight(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual bool filter(edm::Event &, const edm::EventSetup &)
edm::InputTag m_pileupcollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
const VertexWeighter m_weighter
const double weight(const std::vector< float > &zpositions, const float &zmain) const