DAS  3.0
Das Analysis System
Helper

#include <helper.h>

+ Collaboration diagram for Helper:

Public Member Functions

 Helper (DAS::Parameters &parameters)
 
DAS::GenJet GetGenJet (const reco::JetFlavourInfoMatching &ijet)
 
DAS::GenJet GetGenJet (const reco::Jet &ijet)
 
DAS::RecJet GetRecJet (const pat::Jet &ijet)
 
bool LooseID (const pat::Jet &jet)
 
bool TightID (const pat::Jet &jet)
 
bool TightLepVetoID (const pat::Jet &jet)
 
DAS::GenMuon GetGenMu (const reco::Candidate &mu)
 
DAS::RecMuon GetRecMu (const pat::Muon &mu)
 
DAS::GenPhoton GetGenPhoton (const reco::GenParticle &photon, bool zAncestor)
 
DAS::RecPhoton GetRecPhoton (const pat::Photon &photon)
 

Public Attributes

DAS::Parametersp
 

Constructor & Destructor Documentation

◆ Helper()

Helper ( DAS::Parameters parameters)

Constructor

Only giving parameters in reference

14 : p(parameters) {}

Member Function Documentation

◆ GetGenJet() [1/2]

DAS::GenJet GetGenJet ( const reco::Jet &  ijet)

Helper to get DAS::GenJet from MiniAOD without flavour.

19 {
20  DAS::GenJet jjet;
21 
22  // kinematics
23  jjet.p4 = DAS::FourVector(ijet.p4());
24 
25  return jjet;
26 }

◆ GetGenJet() [2/2]

DAS::GenJet GetGenJet ( const reco::JetFlavourInfoMatching &  ijet)

Helper to get DAS::GenJet from MiniAOD with flavour.

31 {
32  const reco::Jet& Jet = *(ijet.first.get());
33  const reco::JetFlavourInfo& Info = ijet.second;
34 
35  DAS::GenJet jjet = GetGenJet(Jet);
36 
37  // parton flavour
38  jjet.partonFlavour = Info.getPartonFlavour();
39 
40  // heavy-flavour hadrons
41  jjet.nBHadrons = Info.getbHadrons().size();
42  jjet.nCHadrons = Info.getcHadrons().size();
43 
44  return jjet;
45 }

◆ GetGenMu()

DAS::GenMuon GetGenMu ( const reco::Candidate &  mu)

Helper to get DAS::GenMuon from MiniAOD.

244 {
245  DAS::GenMuon Mu;
246 
247  // kinematics
248  Mu.p4 = mu.p4();
249 
250  Mu.Q = mu.charge();
251 
252  return Mu;
253 }

◆ GetGenPhoton()

DAS::GenPhoton GetGenPhoton ( const reco::GenParticle &  photon,
bool  zAncestor 
)

Helper to get DAS::GenPhoton from MiniAOD.

279 {
280  DAS::GenPhoton dasPhoton;
281 
282  // kinematics
283  dasPhoton.p4 = photon.p4();
284  dasPhoton.zAncestor = zAncestor;
285  dasPhoton.prompt = photon.isPromptFinalState();
286 
287  return dasPhoton;
288 }

◆ GetRecJet()

DAS::RecJet GetRecJet ( const pat::Jet &  ijet)

Helper to get DAS::RecJet from MiniAOD

General instructions DeepJet

53 {
54  DAS::RecJet jjet;
55 
56  // kinematics
57  jjet.p4 = ijet.correctedP4("Uncorrected");
58 
59  // JetMET business
60  jjet.area = ijet.jetArea();
61  jjet.puID = p.PUjetID ? ijet.userFloat("pileupJetId:fullDiscriminant") : 1.;
62 
63  if (p.flavour) {
64  // parton flavour
65  jjet.partonFlavour = ijet.partonFlavour();
66 
67  // heavy-flavour hadrons
68  jjet.nBHadrons = ijet.jetFlavourInfo().getbHadrons().size();
69  jjet.nCHadrons = ijet.jetFlavourInfo().getcHadrons().size();
70 
71  // heavy-flavour tagging
72  jjet.DeepJet.probb = ijet.bDiscriminator("pfDeepFlavourJetTags:probb");
73  jjet.DeepJet.probbb = ijet.bDiscriminator("pfDeepFlavourJetTags:probbb");
74  jjet.DeepJet.problepb = ijet.bDiscriminator("pfDeepFlavourJetTags:problepb");
75  jjet.DeepJet.probc = ijet.bDiscriminator("pfDeepFlavourJetTags:probc");
76  //jjet.DeepJet.probcc = ijet.bDiscriminator("pfDeepFlavourJetTags:probcc");
77  jjet.DeepJet.probuds = ijet.bDiscriminator("pfDeepFlavourJetTags:probuds");
78  jjet.DeepJet.probg = ijet.bDiscriminator("pfDeepFlavourJetTags:probg");
79 
80  static const auto eps = 10*numeric_limits<float>::epsilon();
81  if (abs(jjet.DeepJet.probb + jjet.DeepJet.probbb + jjet.DeepJet.problepb + jjet.DeepJet.probc + /*jjet.DeepJet.probcc +*/ jjet.DeepJet.probuds + jjet.DeepJet.probg - 1) > eps)
82  cerr << abs(jjet.DeepJet.probb + jjet.DeepJet.probbb + jjet.DeepJet.problepb + jjet.DeepJet.probc + /*jjet.DeepJet.probcc +*/ jjet.DeepJet.probuds + jjet.DeepJet.probg - 1) << ' ' << eps << endl;
83  }
84 
85  jjet.scales.resize(1, 1.0);
86 
87  return jjet;
88 }

◆ GetRecMu()

DAS::RecMuon GetRecMu ( const pat::Muon &  mu)

Helper to get DAS::RecMuon from MiniAOD.

258 {
259  DAS::RecMuon Mu;
260 
261  // kinematics
262  Mu.p4 = mu.p4();
263 
264  Mu.selectors = mu.selectors();
265  Mu.Q = mu.charge();
266 
267  // tracking properties
268  Mu.Dxy = mu.dB(pat::Muon::PV2D);
269  Mu.Dz = mu.dB(pat::Muon::PVDZ);
270  if (mu.innerTrack().isNonnull())
271  Mu.nTkHits = mu.innerTrack()->hitPattern().trackerLayersWithMeasurement();
272 
273  return Mu;
274 }

◆ GetRecPhoton()

DAS::RecPhoton GetRecPhoton ( const pat::Photon &  photon)

Helper to get DAS::RecLep from MiniAOD.

293 {
294  DAS::RecPhoton dasPhoton;
295 
296  // kinematics
297  dasPhoton.p4 = photon.p4();
298  const auto raw_energy = dasPhoton.p4.E();
299  dasPhoton.scales = decltype(dasPhoton.scales){{
300  photon.userFloat("ecalEnergyPostCorr") / raw_energy,
301  photon.userFloat("energyScaleUp") / raw_energy,
302  photon.userFloat("energyScaleDown") / raw_energy,
303  photon.userFloat("energySigmaPhiUp") / raw_energy,
304  photon.userFloat("energySigmaPhiDown") / raw_energy,
305  photon.userFloat("energySigmaRhoUp") / raw_energy,
306  photon.userFloat("energySigmaRhoDown") / raw_energy,
307  }};
308  dasPhoton.ecalEnergyErrPostCorr = photon.userFloat("ecalEnergyErrPostCorr");
309 
310  // supercluster
311  dasPhoton.scEta = photon.superCluster()->eta();
312  dasPhoton.sigmaIEtaIEta = photon.full5x5_sigmaIetaIeta();
313 
314  // ID
315  dasPhoton.hOverE = photon.hadronicOverEm();
316 
317  if (photon.photonID("cutBasedPhotonID-Fall17-94X-V2-loose"))
319  if (photon.photonID("cutBasedPhotonID-Fall17-94X-V2-medium"))
321  if (photon.photonID("cutBasedPhotonID-Fall17-94X-V2-tight"))
323  if (photon.photonID("mvaPhoID-RunIIFall17-v2-wp80"))
325  if (photon.photonID("mvaPhoID-RunIIFall17-v2-wp90"))
327  if (photon.passElectronVeto())
329  if (!photon.hasPixelSeed())
331 
332  // Isolation
333  dasPhoton.chargedIsolation = photon.chargedHadronIso();
334  dasPhoton.neutralHadronIsolation = photon.neutralHadronIso();
335  dasPhoton.photonIsolation = photon.photonIso();
336  dasPhoton.worstChargedIsolation = photon.chargedHadronWorstVtxIso();
337 
338  return dasPhoton;
339 }

◆ LooseID()

bool LooseID ( const pat::Jet &  jet)

Testing loose ID definition for jets (official from JetMET)

see https://twiki.cern.ch/twiki/bin/viewauth/CMS/JetID

/!\ these values are intended for 2016 only!!

97 {
98  assert(p.year == 2016); // LooseID is only defined for 2016
99 
100  const auto abseta = abs(jet.eta());
101 
102  auto NHF = jet.neutralHadronEnergyFraction();
103  auto NEMF = jet.photonEnergyFraction();
104  auto NumConst = jet.neutralMultiplicity() + jet.chargedMultiplicity();
105 
106  auto CHF = jet.chargedHadronEnergyFraction();
107  auto CHM = jet.chargedHadronMultiplicity();
108  auto CEMF = jet.chargedEmEnergyFraction();
109 
110  if (abseta <= 2.7)
111  return (NHF<0.99 && NEMF<0.99 && NumConst>1)
112  && ((abseta<=2.4 && CHF>0 && CHM>0 && CEMF<0.99) || abseta>2.4);
113 
114  auto NumNeutralParticle = jet.neutralMultiplicity();
115 
116  if (abseta <= 3.0)
117  return NHF<0.98 && NEMF>0.01 && NumNeutralParticle>2;
118 
119  return NEMF<0.90 && NumNeutralParticle>10;
120 }

◆ TightID()

bool TightID ( const pat::Jet &  jet)

Testing tight ID definition for jets (official from JetMET)

see https://twiki.cern.ch/twiki/bin/viewauth/CMS/JetID

127 {
128  const auto abseta = abs(jet.eta());
129 
130  auto NHF = jet.neutralHadronEnergyFraction();
131  auto NEMF = jet.photonEnergyFraction();
132  auto NumConst = jet.neutralMultiplicity() + jet.chargedMultiplicity();
133 
134  auto CHF = jet.chargedHadronEnergyFraction();
135  auto CHM = jet.chargedHadronMultiplicity();
136  auto CEMF = jet.chargedEmEnergyFraction();
137 
138  if (abseta <= 2.7)
139  switch (p.year) {
140  case 2016:
141  return (NHF<0.90 && NEMF<0.90 && NumConst>1)
142  && ((abseta<=2.4 && CHF>0 && CHM>0 && CEMF<0.99) || abseta>2.4);
143  case 2017:
144  return (NHF<0.90 && NEMF<0.90 && NumConst>1)
145  && ((abseta<=2.4 && CHF>0 && CHM>0 ) || abseta>2.4);
146  case 2018:
147  return (abseta<=2.6 && CHM>0 && CHF>0 && NumConst>1 && NEMF<0.9 && NHF < 0.9 )
148  || (CHM>0 && NEMF<0.99 && NHF < 0.9);
149  default:
150  cerr << "Only 2016, 2017 or 2018 is possible\n";
151  exit(EXIT_FAILURE);
152  }
153 
154  auto NumNeutralParticle = jet.neutralMultiplicity();
155 
156  if (abseta <= 3.0)
157  switch (p.year) {
158  case 2016:
159  return NHF<0.98 && NEMF>0.01 && NumNeutralParticle>2;
160  case 2017:
161  case 2018:
162  return NEMF>0.02 && NEMF<0.99 && NumNeutralParticle>2;
163  default:
164  cerr << "Only 2016, 2017 or 2018 is possible\n";
165  exit(EXIT_FAILURE);
166  }
167 
168  switch (p.year) {
169  case 2016:
170  return NEMF<0.90 && NumNeutralParticle>10;
171  case 2017:
172  return NEMF<0.90 && NHF>0.02 && NumNeutralParticle>10;
173  case 2018:
174  return NEMF<0.90 && NHF>0.2 && NumNeutralParticle>10;
175  default:
176  cerr << "Only 2016, 2017 or 2018 is possible\n";
177  exit(EXIT_FAILURE);
178  }
179 }

◆ TightLepVetoID()

bool TightLepVetoID ( const pat::Jet &  jet)

Testing tight ID definition for jets (official from JetMET)

see https://twiki.cern.ch/twiki/bin/viewauth/CMS/JetID

186 {
187  const auto abseta = abs(jet.eta());
188 
189  auto NHF = jet.neutralHadronEnergyFraction();
190  auto NEMF = jet.photonEnergyFraction();
191  auto NumConst = jet.neutralMultiplicity() + jet.chargedMultiplicity();
192 
193  auto CHF = jet.chargedHadronEnergyFraction();
194  auto CHM = jet.chargedHadronMultiplicity();
195  auto CEMF = jet.chargedEmEnergyFraction();
196  auto MUF = jet.muonEnergyFraction();
197 
198  if (abseta <= 2.7)
199  switch (p.year) {
200  case 2016:
201  return (NHF<0.90 && NEMF<0.90 && NumConst>1 && MUF<0.80)
202  && ((abseta<=2.4 && CHF>0 && CHM>0 && CEMF<0.90) || abseta>2.4);
203  case 2017:
204  return (NHF<0.90 && NEMF<0.90 && NumConst>1 && MUF<0.80)
205  && ((abseta<=2.4 && CHF>0 && CHM>0 && CEMF<0.80) || abseta>2.4);
206  case 2018:
207  return (abseta<=2.6 && MUF<0.80 && CEMF<0.80 && CHM>0 && NHF<0.9 && NEMF<0.90 && CHF>0 && NumConst>1)
208  || (MUF<0.80 && CEMF<0.80 && CHM>0 && NHF<0.9 && NEMF<0.99);
209  default:
210  cerr << "Only 2016, 2017 or 2018 is possible\n";
211  exit(EXIT_FAILURE);
212  }
213 
214  auto NumNeutralParticle = jet.neutralMultiplicity();
215 
216  if (abseta <= 3.0)
217  switch (p.year) {
218  case 2016:
219  return NHF<0.98 && NEMF>0.01 && NumNeutralParticle>2;
220  case 2017:
221  case 2018:
222  return NEMF>0.02 && NEMF<0.99 && NumNeutralParticle>2;
223  default:
224  cerr << "Only 2016, 2017 or 2018 is possible\n";
225  exit(EXIT_FAILURE);
226  }
227 
228  switch (p.year) {
229  case 2016:
230  return NEMF<0.90 && NumNeutralParticle>10;
231  case 2017:
232  return NEMF<0.90 && NHF>0.02 && NumNeutralParticle>10;
233  case 2018:
234  return NEMF<0.90 && NHF>0.2 && NumNeutralParticle>10;
235  default:
236  cerr << "Only 2016, 2017 or 2018 is possible\n";
237  exit(EXIT_FAILURE);
238  }
239 }

Member Data Documentation

◆ p


The documentation for this struct was generated from the following files:
DAS::GenJet::partonFlavour
int partonFlavour
Parton flavour (PDG ID)
Definition: Jet.h:15
Ntupliser_cfg.cerr
cerr
Definition: Ntupliser_cfg.py:93
Step::eps
static const auto eps
Definition: Step.h:38
DAS::RecPhoton::PixelSeedVeto
@ PixelSeedVeto
Pixel seed veto.
Definition: Photon.h:55
DAS::Helper::GetGenJet
DAS::GenJet GetGenJet(const reco::JetFlavourInfoMatching &ijet)
Helper to get DAS::GenJet from MiniAOD with flavour.
Definition: helper.cc:30
DAS::RecPhoton::CutBasedMedium
@ CutBasedMedium
Medium cut-based ID.
Definition: Photon.h:50
DAS::RecPhoton::scEta
float scEta
Super cluster eta, used to veto the barrel/endcap transition region.
Definition: Photon.h:58
DAS::PhysicsObject::p4
FourVector p4
raw four-momentum directly after reconstruction
Definition: PhysicsObject.h:50
DAS::RecMuon::Dxy
float Dxy
transverse distance to PV
Definition: Lepton.h:31
DAS::RecPhoton::sigmaIEtaIEta
float sigmaIEtaIEta
Width of the ECAL deposit along the eta axis.
Definition: Photon.h:59
DAS::Helper::p
DAS::Parameters & p
Definition: helper.h:28
DAS::GenJet::nBHadrons
int nBHadrons
Number of B hadrons (0, 1 or 2+)
Definition: Jet.h:13
DAS::RecPhoton::photonIsolation
float photonIsolation
Recomputed isolation from other photons.
Definition: Photon.h:63
DAS::RecPhoton::CutBasedLoose
@ CutBasedLoose
Loose cut-based ID.
Definition: Photon.h:49
DAS::RecJet::Tagger::probc
float probc
Probability for the jet to contain at least one D hadron.
Definition: Jet.h:49
DAS::RecPhoton::MVAWorkingPoint80
@ MVAWorkingPoint80
80% efficiency working point of the MVA ID
Definition: Photon.h:52
DAS::RecJet::Tagger::probb
float probb
Probability for the jet to contain exactly one B hadron decaying hadronically.
Definition: Jet.h:50
DAS::RecMuon::nTkHits
int nTkHits
number of hits in tracker
Definition: Lepton.h:34
DAS::RecMuon::Dz
float Dz
longitudinal distance to PV
Definition: Lepton.h:32
DAS::RecJet
Definition: Jet.h:37
DAS::PhysicsObject::scales
std::vector< float > scales
energy scale corrections and variations
Definition: PhysicsObject.h:51
DAS::Parameters::year
const int year
20xx
Definition: Parameters.h:57
DAS::RecPhoton::selectors
std::uint32_t selectors
Identification cuts satisfied by the photon.
Definition: Photon.h:70
DAS::RecMuon
class RecMuon
Definition: Lepton.h:25
DAS::RecJet::Tagger::probbb
float probbb
Probability for the jet to contain at least two B hadrons.
Definition: Jet.h:51
DAS::GenPhoton
class GenPhoton
Definition: Photon.h:13
DAS::RecJet::DeepJet
struct DAS::RecJet::Tagger DeepJet
Reference
DAS::RecJet::Tagger::problepb
float problepb
Probability for the jet to contain exactly one B hadron decaying leptonically.
Definition: Jet.h:52
DAS::GenMuon
class GenMuon
Definition: Lepton.h:9
DAS::GenJet
class GenJet
Definition: Jet.h:9
DAS::GenPhoton::prompt
bool prompt
Originates directly from the matrix element.
Definition: Photon.h:18
DAS::GenJet::nCHadrons
int nCHadrons
Number of D hadrons (0, 1+ in 2017; 0, 1, 2+ in 2016)
Definition: Jet.h:14
DAS::RecPhoton::worstChargedIsolation
float worstChargedIsolation
Recomputed charged isolation with the vertex chosen to maximize this value used for the ID.
Definition: Photon.h:64
DAS::RecPhoton::hOverE
float hOverE
Ratio of HCAL to ECAL energy.
Definition: Photon.h:60
DAS::RecMuon::selectors
unsigned int selectors
muon ID & PF isolation
Definition: Lepton.h:29
DAS::RecJet::area
float area
Jet area (should be peaked at pi*R^2), used for the JES corrections.
Definition: Jet.h:42
DAS::RecPhoton::ecalEnergyErrPostCorr
float ecalEnergyErrPostCorr
Energy scale and smearing variations, indexed with the EnergyVariation enum.
Definition: Photon.h:68
DAS::RecJet::Tagger::probuds
float probuds
Probability for the jet to be a quark jet with no HF hadron.
Definition: Jet.h:53
DAS::RecPhoton::CutBasedTight
@ CutBasedTight
Tight cut-based ID.
Definition: Photon.h:51
DAS::Parameters::flavour
const bool flavour
Definition: Parameters.h:68
DAS::GenPhoton::zAncestor
bool zAncestor
Z boson among the particle mothers.
Definition: Photon.h:17
DAS::Parameters::PUjetID
const bool PUjetID
Definition: Parameters.h:68
DAS::FourVector
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< float > > FourVector
Definition: PhysicsObject.h:15
DAS::RecPhoton::neutralHadronIsolation
float neutralHadronIsolation
Recomputed isolation from neutral hadrons.
Definition: Photon.h:62
DAS::GenMuon::Q
int Q
+/- 1
Definition: Lepton.h:13
DAS::RecJet::Tagger::probg
float probg
Probability for the jet to be a gluon jet with no HF hadron.
Definition: Jet.h:54
DAS::RecPhoton::MVAWorkingPoint90
@ MVAWorkingPoint90
90% efficiency working point of the MVA ID
Definition: Photon.h:53
DAS::RecPhoton::chargedIsolation
float chargedIsolation
Recomputed isolation from charged particles.
Definition: Photon.h:61
DAS::RecPhoton
class RecPhoton
Definition: Photon.h:27
DAS::RecPhoton::ConversionSafeElectronVeto
@ ConversionSafeElectronVeto
Electron veto.
Definition: Photon.h:54
DAS::RecJet::puID
float puID
pile-up jet ID
Definition: Jet.h:43