12 #include "Rivet/Analysis.hh" 17 using namespace Rivet;
23 usesResource(
"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");
44 const auto pjet = jet.pseudojet();
49 if ( jet.bTagged() ) genJet.
setPdgId(5);
50 else if ( jet.cTagged() ) genJet.
setPdgId(4);
51 genJet.
setJetArea(pjet.has_area() ? pjet.area() : 0);
53 for (
auto const &
p : jet.particles()) {
55 bool match =
false;
int iMatch = -1;
56 for (
auto const &
q : *consts ) {
58 if (
q.p4() == pp4) { match =
true;
break; }
68 for (
auto const &
p : jet.tags()) {
71 auto pp4 =
p4(
p)*1
e-20;
72 bool match =
false;
int iMatch = -1;
73 for (
auto const &
q : *tags ) {
75 if (
q.p4() == pp4) { match =
true;
break; }
86 jets->push_back(genJet);
91 using namespace Rivet;
125 int iConstituent = -1;
134 const auto&
cl = lepton.constituentLepton();
138 for (
auto const &
p : lepton.constituentPhotons()) {
140 if (
p.abspid() == 15) {
151 leptons->push_back(lepJet);
157 addGenJet(
jet, jets, consts, constsRefHandle, iConstituent, tags, tagsRefHandle, iTag);
160 addGenJet(
jet, fatjets, consts, constsRefHandle, iConstituent, tags, tagsRefHandle, iTag);
167 event.put(
std::move(neutrinos),
"neutrinos");
168 event.put(
std::move(photons),
"photons");
169 event.put(
std::move(leptons),
"leptons");
171 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_