14 #include "Rivet/Analysis.hh"
19 using namespace Rivet;
23 usesResource(
"Rivet");
26 produces<reco::GenParticleCollection>(
"neutrinos");
27 produces<reco::GenParticleCollection>(
"photons");
28 produces<reco::GenJetCollection>(
"leptons");
29 produces<reco::GenJetCollection>(
"jets");
30 produces<reco::GenJetCollection>(
"fatjets");
31 produces<reco::GenParticleCollection>(
"consts");
32 produces<reco::GenParticleCollection>(
"tags");
33 produces<reco::METCollection>(
"mets");
37 std::unique_ptr<reco::GenJetCollection>&
jets,
38 std::unique_ptr<reco::GenParticleCollection>& consts,
41 std::unique_ptr<reco::GenParticleCollection>&
tags,
44 const auto pjet = jet.pseudojet();
51 else if (jet.cTagged())
53 genJet.
setJetArea(pjet.has_area() ? pjet.area() : 0);
55 for (
auto const&
p : jet.particles()) {
59 for (
auto const&
q : *consts) {
73 for (
auto const&
p : jet.tags()) {
76 auto pp4 =
p4(
p) * 1
e-20;
79 for (
auto const&
q : *tags) {
92 int iTagMother = iTag;
93 for (
auto const&
d :
p.constituents()) {
95 int d_status = (
d.isStable()) ? 1 : 2;
104 jets->push_back(genJet);
108 using namespace Rivet;
151 int iConstituent = -1;
160 for (
auto const&
p : lepton.constituents()) {
162 if (
p.abspid() == 15) {
173 leptons->push_back(lepJet);
179 addGenJet(
jet, jets, consts, constsRefHandle, iConstituent, tags, tagsRefHandle, iTag);
182 addGenJet(
jet, fatjets, consts, constsRefHandle, iConstituent, tags, tagsRefHandle, iTag);
192 event.put(
std::move(neutrinos),
"neutrinos");
193 event.put(
std::move(photons),
"photons");
194 event.put(
std::move(leptons),
"leptons");
196 event.put(
std::move(fatjets),
"fatjets");
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
#define DEFINE_FWK_MODULE(type)
std::vector< GenJet > GenJetCollection
collection of GenJet objects
Particles leptons() const
const edm::ParameterSet pset_
std::vector< reco::MET > METCollection
collection of MET objects
void setVertex(const Point &vertex) override
set vertex
void setCharge(Charge q) final
set electric charge
virtual void setJetArea(float fArea)
set jet area
reco::Candidate::LorentzVector p4(const T &p) const
math::XYZPoint Point
point in the space
Jets made from MC generator particles.
void addGenJet(Rivet::Jet jet, std::unique_ptr< reco::GenJetCollection > &jets, std::unique_ptr< reco::GenParticleCollection > &consts, edm::RefProd< reco::GenParticleCollection > &constsRefHandle, int &iConstituent, std::unique_ptr< reco::GenParticleCollection > &tags, edm::RefProd< reco::GenParticleCollection > &tagsRefHandle, int &iTag)
Rivet::RivetAnalysis * rivetAnalysis_
std::unique_ptr< Rivet::AnalysisHandler > analysisHandler_
ParticleLevelProducer(const edm::ParameterSet &pset)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
const edm::EDGetTokenT< edm::HepMCProduct > srcToken_
void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
void addDaughter(const CandidatePtr &)
add a daughter via a reference
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Particles photons() const
Particles neutrinos() const
void setPdgId(int pdgId) final
void setP4(const LorentzVector &p4) final
set 4-momentum
Power< A, B >::type pow(const A &a, const B &b)
math::PtEtaPhiELorentzVectorF LorentzVector
reco::Particle::Point genVertex_