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)
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.
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
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_