#include <WeightManager.h>
Public Member Functions | |
double | weight (const edm::Event &) |
WeightManager (const edm::ParameterSet &) | |
~WeightManager () | |
Private Attributes | |
std::vector< edm::InputTag > | _genEventInfos |
edm::InputTag | _hepmcCollection |
bool | _useHepMC |
Definition at line 17 of file WeightManager.h.
WeightManager::WeightManager | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 12 of file WeightManager.cc.
References _genEventInfos, _hepmcCollection, _useHepMC, and edm::ParameterSet::getParameter().
: _useHepMC(iConfig.getParameter<bool>("UseWeightFromHepMC")) { if (_useHepMC) _hepmcCollection = iConfig.getParameter<InputTag>("hepmcCollection"); else _genEventInfos = iConfig.getParameter<std::vector<InputTag> >("genEventInfos"); }
WeightManager::~WeightManager | ( | ) | [inline] |
Definition at line 22 of file WeightManager.h.
{};
double WeightManager::weight | ( | const edm::Event & | iEvent | ) |
Definition at line 21 of file WeightManager.cc.
References _genEventInfos, _hepmcCollection, _useHepMC, edm::Event::getByLabel(), i, and info.
Referenced by WValidation::analyze(), MBUEandQCDValidation::analyze(), TauValidation::analyze(), DuplicationChecker::analyze(), BasicGenParticleValidation::analyze(), DrellYanValidation::analyze(), BasicHepMCValidation::analyze(), and HiggsValidation::analyze().
{ if (_useHepMC){ edm::Handle<HepMCProduct> evt; iEvent.getByLabel(_hepmcCollection, evt); const HepMC::GenEvent *myGenEvent = evt->GetEvent(); double weight = 1.; if (myGenEvent->weights().size() > 0) weight = myGenEvent->weights()[0]; return weight; } else { double weight = 1.; for (unsigned int i = 0; i < _genEventInfos.size(); ++i){ edm::Handle<GenEventInfoProduct> info; iEvent.getByLabel(_genEventInfos[i], info); weight *= info->weight(); } return weight; } }
std::vector<edm::InputTag> WeightManager::_genEventInfos [private] |
Definition at line 28 of file WeightManager.h.
Referenced by weight(), and WeightManager().
edm::InputTag WeightManager::_hepmcCollection [private] |
Definition at line 29 of file WeightManager.h.
Referenced by weight(), and WeightManager().
bool WeightManager::_useHepMC [private] |
Definition at line 27 of file WeightManager.h.
Referenced by weight(), and WeightManager().