13 src_(pset.getParameter<edm::InputTag>(
"src")),
14 srcHepMC_(pset.getParameter<edm::InputTag>(
"hepMcSrc")),
15 hepMcMode_(stringToHepMcMode(pset.getParameter<std::string>(
"hepMcMode"))),
18 produces<edm::HepMCProduct>();
19 produces<double>(
"weight");
28 else if(name ==
"replace")
31 throw cms::Exception(
"Configuration") <<
"Unsupported hepMcMode " << name <<
", should be 'new' or 'replace'" << std::endl;
38 std::vector<reco::Muon>
muons;
43 if (combCandidatesHandle->size()==0)
45 for (
size_t idx = 0; idx < combCandidatesHandle->at(0).numberOfDaughters(); ++idx)
47 int charge = combCandidatesHandle->at(0).daughter(idx)->charge();
58 for (
size_t idx = 0; idx < candsHandle->size(); ++idx)
60 int charge = candsHandle->at(idx).charge();
67 if (muons.size() == 0)
69 edm::LogError(
"MCParticleReplacer") <<
"No candidates or muons found!";
73 std::auto_ptr<HepMC::GenEvent> evt;
78 evt =
replacer_->produce(muons, 0, HepMCHandle->GetEvent());
89 bare_product->addHepMCData(evt.release());
91 iEvent.
put(bare_product);
93 std::auto_ptr<double> bare_weight(
new double(
replacer_->eventWeight));
94 iEvent.
put(bare_weight, std::string(
"weight"));
#define DEFINE_FWK_MODULE(type)
virtual void beginRun(edm::Run &iRun, const edm::EventSetup &iSetup)
MCParticleReplacer(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
static HepMcMode stringToHepMcMode(const std::string &name)
math::XYZPoint Point
point in the space
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup)
boost::shared_ptr< ParticleReplacerBase > replacer_
math::XYZTLorentzVector LorentzVector
Lorentz vector.