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 genJet.
setJetArea(pjet.has_area() ? pjet.area() : 0);
51 for (
auto const &
p : jet.particles()) {
53 bool match =
false;
int iMatch = -1;
54 for (
auto const &
q : *consts ) {
56 if (
q.p4() == pp4) { match =
true;
break; }
66 for (
auto const &
p : jet.tags()) {
69 auto pp4 =
p4(
p)*1
e-20;
70 bool match =
false;
int iMatch = -1;
71 for (
auto const &
q : *tags ) {
73 if (
q.p4() == pp4) { match =
true;
break; }
84 jets->push_back(genJet);
89 using namespace Rivet;
106 const HepMC::GenEvent*
genEvent = srcHandle->GetEvent();
123 int iConstituent = -1;
131 const auto cl = lepton.constituentLepton();
135 for (
auto const &
p : lepton.constituentPhotons()) {
140 leptons->push_back(lepJet);
147 addGenJet(
jet, jets, consts, constsRefHandle, iConstituent, tags, tagsRefHandle, iTag);
150 addGenJet(
jet, fatjets, consts, constsRefHandle, iConstituent, tags, tagsRefHandle, iTag);
157 event.put(
std::move(neutrinos),
"neutrinos");
158 event.put(
std::move(photons),
"photons");
159 event.put(
std::move(leptons),
"leptons");
161 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)
virtual void setPdgId(int pdgId) final
std::vector< GenJet > GenJetCollection
collection of GenJet objects
std::vector< reco::MET > METCollection
collection of MET objects
ParticleVector neutrinos() const
virtual void setJetArea(float fArea)
set jet area
ParticleVector photons() const
reco::Candidate::LorentzVector p4(const T &p) const
virtual void setCharge(Charge q) final
set electric charge
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)
virtual void setVertex(const Point &vertex)
set vertex
Rivet::RivetAnalysis * rivetAnalysis_
ParticleLevelProducer(const edm::ParameterSet &pset)
virtual void setP4(const LorentzVector &p4) final
set 4-momentum
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.
Power< A, B >::type pow(const A &a, const B &b)
math::PtEtaPhiELorentzVectorF LorentzVector
reco::Particle::Point genVertex_