12 #include "Rivet/Analysis.hh" 17 using namespace Rivet;
27 produces<reco::GenParticleCollection>(
"neutrinos");
28 produces<reco::GenParticleCollection>(
"photons");
29 produces<reco::GenJetCollection>(
"leptons");
30 produces<reco::GenJetCollection>(
"jets");
31 produces<reco::GenJetCollection>(
"fatjets");
32 produces<reco::GenParticleCollection>(
"consts");
33 produces<reco::GenParticleCollection>(
"tags");
34 produces<reco::METCollection>(
"mets");
43 const auto pjet = jet.pseudojet();
48 if ( jet.bTagged() ) genJet.
setPdgId(5);
49 else if ( jet.cTagged() ) genJet.
setPdgId(4);
50 genJet.
setJetArea(pjet.has_area() ? pjet.area() : 0);
52 for (
auto const &
p : jet.particles()) {
54 bool match =
false;
int iMatch = -1;
55 for (
auto const &
q : *consts ) {
57 if (
q.p4() == pp4) { match =
true;
break; }
67 for (
auto const &
p : jet.tags()) {
70 auto pp4 =
p4(
p)*1
e-20;
71 bool match =
false;
int iMatch = -1;
72 for (
auto const &
q : *tags ) {
74 if (
q.p4() == pp4) { match =
true;
break; }
85 jets->push_back(genJet);
90 using namespace Rivet;
107 const HepMC::GenEvent*
genEvent = srcHandle->GetEvent();
124 int iConstituent = -1;
132 const auto cl = lepton.constituentLepton();
136 for (
auto const &
p : lepton.constituentPhotons()) {
141 leptons->push_back(lepJet);
148 addGenJet(
jet, jets, consts, constsRefHandle, iConstituent, tags, tagsRefHandle, iTag);
151 addGenJet(
jet, fatjets, consts, constsRefHandle, iConstituent, tags, tagsRefHandle, iTag);
158 event.put(
std::move(neutrinos),
"neutrinos");
159 event.put(
std::move(photons),
"photons");
160 event.put(
std::move(leptons),
"leptons");
162 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
std::vector< reco::MET > METCollection
collection of MET objects
void setVertex(const Point &vertex) override
set vertex
ParticleVector neutrinos() const
void setCharge(Charge q) final
set electric charge
virtual void setJetArea(float fArea)
set jet area
ParticleVector photons() const
reco::Candidate::LorentzVector p4(const T &p) const
math::XYZPoint Point
point in the space
std::vector< DressedLepton > leptons() const
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.
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_