CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
Rivet::RivetAnalysis Class Reference

#include <RivetAnalysis.h>

Inheritance diagram for Rivet::RivetAnalysis:

Public Member Functions

void analyze (const Event &event) override
 
Jets fatjets () const
 
void finalize () override
 
void init () override
 
Jets jets () const
 
Particles leptons () const
 
Vector3 met () const
 
Particles neutrinos () const
 
Particles photons () const
 
 RivetAnalysis (const edm::ParameterSet &pset)
 
std::string status () const override
 

Private Attributes

bool _doJetClustering
 
bool _excludeNeutrinosFromJetClustering
 
bool _excludePromptLeptonsFromJetClustering
 
double _fatJetConeSize
 
double _fatJetMaxEta
 
double _fatJetMinPt
 
Jets _fatjets
 
double _jetConeSize
 
double _jetMaxEta
 
double _jetMinPt
 
Jets _jets
 
double _lepConeSize
 
double _lepMaxEta
 
double _lepMinPt
 
Particles _leptons
 
Vector3 _met
 
Particles _neutrinos
 
double _particleMaxEta
 
double _particleMinPt
 
double _phoIsoConeSize
 
double _phoMaxEta
 
double _phoMaxRelIso
 
double _phoMinPt
 
Particles _photons
 
bool _usePromptFinalStates
 

Detailed Description

Definition at line 23 of file RivetAnalysis.h.

Constructor & Destructor Documentation

◆ RivetAnalysis()

Rivet::RivetAnalysis::RivetAnalysis ( const edm::ParameterSet pset)
inline

Definition at line 50 of file RivetAnalysis.h.

51  : Analysis("RivetAnalysis"),
52  _usePromptFinalStates(pset.getParameter<bool>("usePromptFinalStates")),
53  _excludePromptLeptonsFromJetClustering(pset.getParameter<bool>("excludePromptLeptonsFromJetClustering")),
54  _excludeNeutrinosFromJetClustering(pset.getParameter<bool>("excludeNeutrinosFromJetClustering")),
55  _doJetClustering(pset.getParameter<bool>("doJetClustering")),
56 
57  _particleMinPt(pset.getParameter<double>("particleMinPt")),
58  _particleMaxEta(pset.getParameter<double>("particleMaxEta")),
59 
60  _lepConeSize(pset.getParameter<double>("lepConeSize")),
61  _lepMinPt(pset.getParameter<double>("lepMinPt")),
62  _lepMaxEta(pset.getParameter<double>("lepMaxEta")),
63 
64  _jetConeSize(pset.getParameter<double>("jetConeSize")),
65  _jetMinPt(pset.getParameter<double>("jetMinPt")),
66  _jetMaxEta(pset.getParameter<double>("jetMaxEta")),
67 
68  _fatJetConeSize(pset.getParameter<double>("fatJetConeSize")),
69  _fatJetMinPt(pset.getParameter<double>("fatJetMinPt")),
70  _fatJetMaxEta(pset.getParameter<double>("fatJetMaxEta")),
71 
72  _phoMinPt(pset.getParameter<double>("phoMinPt")),
73  _phoMaxEta(pset.getParameter<double>("phoMaxEta")),
74  _phoIsoConeSize(pset.getParameter<double>("phoIsoConeSize")),
75  _phoMaxRelIso(pset.getParameter<double>("phoMaxRelIso")) {}
bool _excludeNeutrinosFromJetClustering
Definition: RivetAnalysis.h:35
bool _excludePromptLeptonsFromJetClustering
Definition: RivetAnalysis.h:34

Member Function Documentation

◆ analyze()

void Rivet::RivetAnalysis::analyze ( const Event event)
inlineoverride

Definition at line 140 of file RivetAnalysis.h.

References _doJetClustering, _fatJetMinPt, _fatjets, _jetMinPt, _jets, _leptons, _met, _neutrinos, _phoIsoConeSize, _phoMaxEta, _phoMaxRelIso, _phoMinPt, _photons, funct::abs(), haddnano::cl, PbPb_ZMuSkimMuonDPG_cff::deltaR, MillePedeFileConverter_cfg::e, edmPickEvents::event, reco::isLepton(), metsig::jet, AlCaHLTBitMon_ParallelJobs::p, ecalTrigSettings_cff::particles, displacedMuons_cfi::photon, and DiDispStaMuonMonitor_cfi::pt.

140  {
141  _jets.clear();
142  _fatjets.clear();
143  _leptons.clear();
144  _photons.clear();
145  _neutrinos.clear();
146 
147  // Get analysis objects from projections
148  Cut jet_cut = (Cuts::abseta < _jetMaxEta) and (Cuts::pT > _jetMinPt * GeV);
149  Cut fatjet_cut = (Cuts::abseta < _fatJetMaxEta) and (Cuts::pT > _fatJetMinPt * GeV);
150 
151  _leptons = apply<DressedLeptons>(event, "DressedLeptons").particlesByPt();
152 
153  // search tau ancestors
154  Particles promptleptons = apply<PromptFinalState>(event, "PromptLeptons").particles();
155  for (auto& lepton : _leptons) {
156  const auto& cl = lepton.constituents().front(); // this has no ancestors anymore :(
157  for (auto const& pl : promptleptons) {
158  if (cl.momentum() == pl.momentum()) {
159  for (auto& p : pl.ancestors()) {
160  if (p.abspid() == 15) {
161  p.setMomentum(p.momentum() * 10e-20);
162  lepton.addConstituent(p, false);
163  }
164  }
165  break;
166  }
167  }
168  }
169 
170  // Photons
171  Particles fsparticles = apply<FinalState>(event, "FS").particles();
172 
173  for (auto& photon : apply<FinalState>(event, "Photons").particlesByPt()) {
174  if (photon.pt() < _phoMinPt)
175  continue;
176 
177  if (abs(photon.eta()) > _phoMaxEta)
178  continue;
179 
180  double photonptsum = 0;
181 
182  for (auto& fsparticle : fsparticles) {
183  if (deltaR(fsparticle, photon) == 0)
184  continue;
185 
186  if (deltaR(fsparticle, photon) > _phoIsoConeSize)
187  continue;
188 
189  photonptsum += fsparticle.pt();
190  }
191 
192  if (photonptsum / photon.pt() > _phoMaxRelIso)
193  continue;
194 
195  _photons.push_back(photon);
196  }
197 
198  if (_doJetClustering) {
199  _jets = apply<FastJets>(event, "Jets").jetsByPt(jet_cut);
200  _fatjets = apply<FastJets>(event, "FatJets").jetsByPt(fatjet_cut);
201  }
202  _neutrinos = apply<FinalState>(event, "Neutrinos").particlesByPt();
203  _met = apply<MissingMomentum>(event, "MET").missingMomentum().p3();
204 
205  // check for leptonic decays of tag particles
206  for (auto& jet : _jets) {
207  for (auto& pt : jet.tags()) {
208  for (auto& p : pt.children(isLepton)) {
209  pt.addConstituent(p, false);
210  }
211  }
212  }
213  for (auto& jet : _fatjets) {
214  for (auto& pt : jet.tags()) {
215  for (auto& p : pt.children(isLepton)) {
216  pt.addConstituent(p, false);
217  }
218  }
219  }
220  };
bool isLepton(const Candidate &part)
Definition: pdgIdUtils.h:13
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: event.py:1

◆ fatjets()

Jets Rivet::RivetAnalysis::fatjets ( ) const
inline

Definition at line 29 of file RivetAnalysis.h.

References _fatjets.

Referenced by ParticleLevelProducer::produce().

29 { return _fatjets; }

◆ finalize()

void Rivet::RivetAnalysis::finalize ( void  )
inlineoverride

Definition at line 223 of file RivetAnalysis.h.

223 {};

◆ init()

void Rivet::RivetAnalysis::init ( void  )
inlineoverride

Definition at line 78 of file RivetAnalysis.h.

References _excludeNeutrinosFromJetClustering, _excludePromptLeptonsFromJetClustering, _fatJetConeSize, _jetConeSize, _lepConeSize, _lepMinPt, _particleMinPt, _usePromptFinalStates, diffTwoXMLs::ALL(), compareTotals::fs, neutrinos(), NONE, pat::PHOTON, and photons().

78  {
79  // Cuts
80  Cut particle_cut = (Cuts::abseta < _particleMaxEta) and (Cuts::pT > _particleMinPt * GeV);
81  Cut lepton_cut = (Cuts::abseta < _lepMaxEta) and (Cuts::pT > _lepMinPt * GeV);
82 
83  // Generic final state
84  FinalState fs(particle_cut);
85 
86  declare(fs, "FS");
87 
88  // Dressed leptons
89  ChargedLeptons charged_leptons(fs);
90  IdentifiedFinalState photons(fs);
91  photons.acceptIdPair(PID::PHOTON);
92 
93  PromptFinalState prompt_leptons(charged_leptons);
94  prompt_leptons.acceptMuonDecays(true);
95  prompt_leptons.acceptTauDecays(true);
96  declare(prompt_leptons, "PromptLeptons");
97 
98  PromptFinalState prompt_photons(photons);
99  prompt_photons.acceptMuonDecays(true);
100  prompt_photons.acceptTauDecays(true);
101 
102  // useDecayPhotons=true allows for photons with tau ancestor,
103  // photons from hadrons are vetoed by the PromptFinalState;
104  // will be default DressedLeptons behaviour for Rivet >= 2.5.4
105  DressedLeptons prompt_dressed_leptons(
106  prompt_photons, prompt_leptons, _lepConeSize, lepton_cut, /*useDecayPhotons*/ true);
107  DressedLeptons dressed_leptons(photons, charged_leptons, _lepConeSize, lepton_cut, /*useDecayPhotons*/ true);
108  declare(_usePromptFinalStates ? prompt_dressed_leptons : dressed_leptons, "DressedLeptons");
109 
110  declare(photons, "Photons");
111 
112  // Jets
113  VetoedFinalState fsForJets(fs);
115  fsForJets.addVetoOnThisFinalState(prompt_dressed_leptons);
116  JetAlg::Invisibles invisiblesStrategy = JetAlg::Invisibles::DECAY;
118  invisiblesStrategy = JetAlg::Invisibles::NONE;
119  declare(FastJets(fsForJets, FastJets::ANTIKT, _jetConeSize, JetAlg::Muons::ALL, invisiblesStrategy), "Jets");
120 
121  // FatJets
122  declare(FastJets(fsForJets, FastJets::ANTIKT, _fatJetConeSize), "FatJets");
123 
124  // Neutrinos
125  IdentifiedFinalState neutrinos(fs);
126  neutrinos.acceptNeutrinos();
127  if (_usePromptFinalStates) {
128  PromptFinalState prompt_neutrinos(neutrinos);
129  prompt_neutrinos.acceptMuonDecays(true);
130  prompt_neutrinos.acceptTauDecays(true);
131  declare(prompt_neutrinos, "Neutrinos");
132  } else
133  declare(neutrinos, "Neutrinos");
134 
135  // MET
136  declare(MissingMomentum(fs), "MET");
137  };
def ALL(dt, wheel, station, sector)
Definition: diffTwoXMLs.py:28
Particles photons() const
Definition: RivetAnalysis.h:26
bool _excludeNeutrinosFromJetClustering
Definition: RivetAnalysis.h:35
bool _excludePromptLeptonsFromJetClustering
Definition: RivetAnalysis.h:34
Particles neutrinos() const
Definition: RivetAnalysis.h:27
Definition: TkAlStyle.h:43

◆ jets()

Jets Rivet::RivetAnalysis::jets ( ) const
inline

Definition at line 28 of file RivetAnalysis.h.

References _jets.

Referenced by ParticleLevelProducer::produce().

28 { return _jets; }

◆ leptons()

Particles Rivet::RivetAnalysis::leptons ( void  ) const
inline

Definition at line 25 of file RivetAnalysis.h.

References _leptons.

Referenced by ParticleLevelProducer::produce().

25 { return _leptons; }

◆ met()

Vector3 Rivet::RivetAnalysis::met ( ) const
inline

Definition at line 30 of file RivetAnalysis.h.

References _met.

Referenced by objects.METAnalyzer.METAnalyzer::applyDeltaMet(), and ParticleLevelProducer::produce().

30 { return _met; }

◆ neutrinos()

Particles Rivet::RivetAnalysis::neutrinos ( ) const
inline

Definition at line 27 of file RivetAnalysis.h.

References _neutrinos.

Referenced by init(), and ParticleLevelProducer::produce().

27 { return _neutrinos; }

◆ photons()

Particles Rivet::RivetAnalysis::photons ( ) const
inline

Definition at line 26 of file RivetAnalysis.h.

References _photons.

Referenced by init(), and ParticleLevelProducer::produce().

26 { return _photons; }

◆ status()

std::string Rivet::RivetAnalysis::status ( void  ) const
inlineoverride

Definition at line 225 of file RivetAnalysis.h.

225 { return "VALIDATED"; }

Member Data Documentation

◆ _doJetClustering

bool Rivet::RivetAnalysis::_doJetClustering
private

Definition at line 36 of file RivetAnalysis.h.

Referenced by analyze().

◆ _excludeNeutrinosFromJetClustering

bool Rivet::RivetAnalysis::_excludeNeutrinosFromJetClustering
private

Definition at line 35 of file RivetAnalysis.h.

Referenced by init().

◆ _excludePromptLeptonsFromJetClustering

bool Rivet::RivetAnalysis::_excludePromptLeptonsFromJetClustering
private

Definition at line 34 of file RivetAnalysis.h.

Referenced by init().

◆ _fatJetConeSize

double Rivet::RivetAnalysis::_fatJetConeSize
private

Definition at line 41 of file RivetAnalysis.h.

Referenced by init().

◆ _fatJetMaxEta

double Rivet::RivetAnalysis::_fatJetMaxEta
private

Definition at line 41 of file RivetAnalysis.h.

◆ _fatJetMinPt

double Rivet::RivetAnalysis::_fatJetMinPt
private

Definition at line 41 of file RivetAnalysis.h.

Referenced by analyze().

◆ _fatjets

Jets Rivet::RivetAnalysis::_fatjets
private

Definition at line 46 of file RivetAnalysis.h.

Referenced by analyze(), and fatjets().

◆ _jetConeSize

double Rivet::RivetAnalysis::_jetConeSize
private

Definition at line 40 of file RivetAnalysis.h.

Referenced by init().

◆ _jetMaxEta

double Rivet::RivetAnalysis::_jetMaxEta
private

Definition at line 40 of file RivetAnalysis.h.

◆ _jetMinPt

double Rivet::RivetAnalysis::_jetMinPt
private

Definition at line 40 of file RivetAnalysis.h.

Referenced by analyze().

◆ _jets

Jets Rivet::RivetAnalysis::_jets
private

Definition at line 46 of file RivetAnalysis.h.

Referenced by analyze(), and jets().

◆ _lepConeSize

double Rivet::RivetAnalysis::_lepConeSize
private

Definition at line 39 of file RivetAnalysis.h.

Referenced by init().

◆ _lepMaxEta

double Rivet::RivetAnalysis::_lepMaxEta
private

Definition at line 39 of file RivetAnalysis.h.

◆ _lepMinPt

double Rivet::RivetAnalysis::_lepMinPt
private

Definition at line 39 of file RivetAnalysis.h.

Referenced by init().

◆ _leptons

Particles Rivet::RivetAnalysis::_leptons
private

Definition at line 45 of file RivetAnalysis.h.

Referenced by analyze(), and leptons().

◆ _met

Vector3 Rivet::RivetAnalysis::_met
private

Definition at line 47 of file RivetAnalysis.h.

Referenced by analyze(), and met().

◆ _neutrinos

Particles Rivet::RivetAnalysis::_neutrinos
private

Definition at line 45 of file RivetAnalysis.h.

Referenced by analyze(), and neutrinos().

◆ _particleMaxEta

double Rivet::RivetAnalysis::_particleMaxEta
private

Definition at line 38 of file RivetAnalysis.h.

◆ _particleMinPt

double Rivet::RivetAnalysis::_particleMinPt
private

Definition at line 38 of file RivetAnalysis.h.

Referenced by init().

◆ _phoIsoConeSize

double Rivet::RivetAnalysis::_phoIsoConeSize
private

Definition at line 43 of file RivetAnalysis.h.

Referenced by analyze().

◆ _phoMaxEta

double Rivet::RivetAnalysis::_phoMaxEta
private

Definition at line 43 of file RivetAnalysis.h.

Referenced by analyze().

◆ _phoMaxRelIso

double Rivet::RivetAnalysis::_phoMaxRelIso
private

Definition at line 43 of file RivetAnalysis.h.

Referenced by analyze().

◆ _phoMinPt

double Rivet::RivetAnalysis::_phoMinPt
private

Definition at line 43 of file RivetAnalysis.h.

Referenced by analyze().

◆ _photons

Particles Rivet::RivetAnalysis::_photons
private

Definition at line 45 of file RivetAnalysis.h.

Referenced by analyze(), and photons().

◆ _usePromptFinalStates

bool Rivet::RivetAnalysis::_usePromptFinalStates
private

Definition at line 33 of file RivetAnalysis.h.

Referenced by init().