1 #ifndef GeneratorInterface_RivetInterface_RivetAnalysis_H
2 #define GeneratorInterface_RivetInterface_RivetAnalysis_H
6 #include "Rivet/Analysis.hh"
7 #include "Rivet/Projections/FinalState.hh"
8 #include "Rivet/Particle.hh"
9 #include "Rivet/Particle.fhh"
10 #include "Rivet/Event.hh"
11 #include "Rivet/Projections/FastJets.hh"
12 #include "Rivet/Projections/JetAlg.hh"
13 #include "Rivet/Projections/ChargedLeptons.hh"
14 #include "Rivet/Projections/PromptFinalState.hh"
15 #include "Rivet/Projections/DressedLeptons.hh"
16 #include "Rivet/Projections/VetoedFinalState.hh"
17 #include "Rivet/Projections/IdentifiedFinalState.hh"
18 #include "Rivet/Projections/MissingMomentum.hh"
19 #include "Rivet/Tools/RivetHepMC.hh"
51 : Analysis(
"RivetAnalysis"),
61 _lepMinPt(pset.getParameter<double>(
"lepMinPt")),
62 _lepMaxEta(pset.getParameter<double>(
"lepMaxEta")),
65 _jetMinPt(pset.getParameter<double>(
"jetMinPt")),
66 _jetMaxEta(pset.getParameter<double>(
"jetMaxEta")),
72 _phoMinPt(pset.getParameter<double>(
"phoMinPt")),
73 _phoMaxEta(pset.getParameter<double>(
"phoMaxEta")),
80 Cut particle_cut = (Cuts::abseta < _particleMaxEta) and (Cuts::pT >
_particleMinPt * GeV);
81 Cut lepton_cut = (Cuts::abseta < _lepMaxEta) and (Cuts::pT >
_lepMinPt * GeV);
84 FinalState
fs(particle_cut);
89 ChargedLeptons charged_leptons(fs);
90 IdentifiedFinalState
photons(fs);
93 PromptFinalState prompt_leptons(charged_leptons);
94 prompt_leptons.acceptMuonDecays(
true);
95 prompt_leptons.acceptTauDecays(
true);
96 declare(prompt_leptons,
"PromptLeptons");
98 PromptFinalState prompt_photons(photons);
99 prompt_photons.acceptMuonDecays(
true);
100 prompt_photons.acceptTauDecays(
true);
105 DressedLeptons dressed_leptons(
106 prompt_photons, prompt_leptons,
_lepConeSize, lepton_cut,
true);
108 dressed_leptons = DressedLeptons(photons, charged_leptons,
_lepConeSize, lepton_cut,
true);
109 declare(dressed_leptons,
"DressedLeptons");
111 declare(photons,
"Photons");
114 VetoedFinalState fsForJets(fs);
116 fsForJets.addVetoOnThisFinalState(dressed_leptons);
117 JetAlg::Invisibles invisiblesStrategy = JetAlg::Invisibles::DECAY;
123 declare(FastJets(fsForJets, FastJets::ANTIKT,
_fatJetConeSize),
"FatJets");
127 neutrinos.acceptNeutrinos();
128 if (_usePromptFinalStates) {
129 PromptFinalState prompt_neutrinos(neutrinos);
130 prompt_neutrinos.acceptMuonDecays(
true);
131 prompt_neutrinos.acceptTauDecays(
true);
132 declare(prompt_neutrinos,
"Neutrinos");
134 declare(neutrinos,
"Neutrinos");
137 declare(MissingMomentum(fs),
"MET");
149 Cut jet_cut = (Cuts::abseta < _jetMaxEta) and (Cuts::pT >
_jetMinPt * GeV);
150 Cut fatjet_cut = (Cuts::abseta < _fatJetMaxEta) and (Cuts::pT >
_fatJetMinPt * GeV);
152 _leptons = apply<DressedLeptons>(
event,
"DressedLeptons").particlesByPt();
155 Particles promptleptons = apply<PromptFinalState>(
event,
"PromptLeptons").
particles();
157 const auto&
cl = lepton.constituents().front();
158 for (
auto const& pl : promptleptons) {
159 if (
cl.momentum() == pl.momentum()) {
160 for (
auto&
p : pl.ancestors()) {
161 if (
p.abspid() == 15) {
162 p.setMomentum(
p.momentum() * 10
e-20);
163 lepton.addConstituent(
p,
false);
172 Particles fsparticles = apply<FinalState>(
event,
"FS").
particles();
174 for (
auto& photon : apply<FinalState>(event,
"Photons").particlesByPt()) {
181 double photonptsum = 0;
183 for (
auto& fsparticle : fsparticles) {
184 if (
deltaR(fsparticle, photon) == 0)
190 photonptsum += fsparticle.pt();
200 _jets = apply<FastJets>(
event,
"Jets").jetsByPt(jet_cut);
201 _fatjets = apply<FastJets>(
event,
"FatJets").jetsByPt(fatjet_cut);
204 _met = apply<MissingMomentum>(
event,
"MET").missingMomentum().p3();
208 for (
auto&
pt :
jet.tags()) {
210 pt.addConstituent(
p,
false);
215 for (
auto&
pt :
jet.tags()) {
217 pt.addConstituent(
p,
false);
Particles leptons() const
bool isLepton(const Candidate &part)
RivetAnalysis(const edm::ParameterSet &pset)
bool _excludeNeutrinosFromJetClustering
Abs< T >::type abs(const T &t)
void analyze(const Event &event) override
bool _excludePromptLeptonsFromJetClustering
bool _usePromptFinalStates
std::string status() const override
Particles photons() const
Particles neutrinos() const