12 #include "Rivet/Analysis.hh" 17 using namespace Rivet;
22 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");
40 std::unique_ptr<reco::GenJetCollection>&
jets,
41 std::unique_ptr<reco::GenParticleCollection>& consts,
44 std::unique_ptr<reco::GenParticleCollection>&
tags,
47 const auto pjet = jet.pseudojet();
54 else if (jet.cTagged())
56 genJet.
setJetArea(pjet.has_area() ? pjet.area() : 0);
58 for (
auto const&
p : jet.particles()) {
62 for (
auto const&
q : *consts) {
76 for (
auto const&
p : jet.tags()) {
79 auto pp4 =
p4(
p) * 1
e-20;
82 for (
auto const&
q : *tags) {
97 jets->push_back(genJet);
101 using namespace Rivet;
135 int iConstituent = -1;
144 for (
auto const&
p : lepton.constituents()) {
146 if (
p.abspid() == 15) {
157 leptons->push_back(lepJet);
163 addGenJet(
jet, jets, consts, constsRefHandle, iConstituent, tags, tagsRefHandle, iTag);
166 addGenJet(
jet, fatjets, consts, constsRefHandle, iConstituent, tags, tagsRefHandle, iTag);
176 event.put(
std::move(neutrinos),
"neutrinos");
177 event.put(
std::move(photons),
"photons");
178 event.put(
std::move(leptons),
"leptons");
180 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)
std::vector< GenJet > GenJetCollection
collection of GenJet objects
Particles leptons() const
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
#define DEFINE_FWK_MODULE(type)
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_
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
Rivet::AnalysisHandler analysisHandler_
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_