79 : m_vecPileupSummaryInfoToken( consumes< std::vector<
PileupSummaryInfo> >( iConfig.getParameter< edm::
InputTag >(
"pileupSummaryCollection" ) ) )
80 , m_hepMCProductToken( consumes< edm::
HepMCProduct >( iConfig.getParameter< edm::
InputTag >(
"mcTruthCollection" ) ) )
81 , m_weighter( iConfig.getParameter<edm::
ParameterSet>(
"weighterConfig" ) )
106 bool selected =
true;
108 double computed_weight(1);
116 std::vector<PileupSummaryInfo>::const_iterator pileupinfo;
117 for(pileupinfo = pileupinfos->begin(); pileupinfo != pileupinfos->end() ; ++pileupinfo) {
118 if(pileupinfo->getBunchCrossing()==0)
break;
122 if(pileupinfo->getBunchCrossing()!=0) {
123 edm::LogError(
"NoInTimePileUpInfo") <<
"Cannot find the in-time pileup info " << pileupinfo->getBunchCrossing();
129 const std::vector<float>& zpositions = pileupinfo->getPU_zpositions();
140 const HepMC::GenEvent* Evt = EvtHandle->GetEvent();
145 if(Evt->vertices_begin() != Evt->vertices_end()) {
146 zmain = (*Evt->vertices_begin())->point3d().z()/10.;
156 std::auto_ptr<double>
weight(
new double(computed_weight));
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
MCVerticesWeight(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual bool filter(edm::Event &, const edm::EventSetup &)
const VertexWeighter m_weighter
edm::EDGetTokenT< edm::HepMCProduct > m_hepMCProductToken
const double weight(const std::vector< float > &zpositions, const float &zmain) const
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > m_vecPileupSummaryInfoToken