ATLAS Offline Software
JetFlavourInfo.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <vector>
8 #include <string>
9 
10 using xAOD::IParticle;
12 
13 int
15 
16  const std::string labelB = "GhostBHadronsFinal";
17  const std::string labelC = "GhostCHadronsFinal";
18  const std::string labelTau = "GhostTausFinal";
19 
20  std::vector<const IParticle*> ghostB;
21  if (jet->getAssociatedObjects<IParticle>(labelB, ghostB) && ghostB.size() > 0) return 5;
22  std::vector<const IParticle*> ghostC;
23  if (jet->getAssociatedObjects<IParticle>(labelC, ghostC) && ghostC.size() > 0) return 4;
24  std::vector<const IParticle*> ghostTau;
25  if (jet->getAssociatedObjects<IParticle>(labelTau, ghostTau) && ghostTau.size() > 0) return 15;
26  return 0;
27 }
28 
29 int
31 
32  const std::string labelB = "GhostBHadronsInitial";
33  const std::string labelC = "GhostCHadronsInitial";
34  const std::string labelTau = "GhostTausFinal";
35 
36  std::vector<const IParticle*> ghostB;
37  if (jet->getAssociatedObjects<IParticle>(labelB, ghostB) && ghostB.size() > 0) return 5;
38  std::vector<const IParticle*> ghostC;
39  if (jet->getAssociatedObjects<IParticle>(labelC, ghostC) && ghostC.size() > 0) return 4;
40  std::vector<const IParticle*> ghostTau;
41  if (jet->getAssociatedObjects<IParticle>(labelTau, ghostTau) && ghostTau.size() > 0) return 15;
42  return 0;
43 }
44 
45 int
47 
48  const std::string labelB = "GhostBQuarksFinal";
49  const std::string labelC = "GhostCQuarksFinal";
50  const std::string labelTau = "GhostTausFinal";
51 
52  std::vector<const IParticle*> ghostB;
53  if (jet->getAssociatedObjects<IParticle>(labelB, ghostB) && ghostB.size() > 0) return 5;
54  std::vector<const IParticle*> ghostC;
55  if (jet->getAssociatedObjects<IParticle>(labelC, ghostC) && ghostC.size() > 0) return 4;
56  std::vector<const IParticle*> ghostTau;
57  if (jet->getAssociatedObjects<IParticle>(labelTau, ghostTau) && ghostTau.size() > 0) return 15;
58  return 0;
59 }
60 
61 int
63  // default label means "invalid"
64  int label = -1;
65 
66  // First try the new naming scheme
67  if (jet->getAttribute("ConeTruthLabelID",label)) return label;
68  // If that fails, revert to the old scheme. In this case, further testing is not very useful
69  jet->getAttribute("TruthLabelID", label);
70  return label;
71 }
72 
73 int
75  // default label means "invalid"
76  int label = -1;
77 
78  // We don't check the return value, as we would not be able to handle it gracefully anyway
79  jet->getAttribute("HadronConeExclTruthLabelID",label);
80  return label;
81 }
82 
83 int
85  // default label means "invalid"
86  int label = -1;
87 
88  // We don't check the return value, as we would not be able to handle it gracefully anyway
89  jet->getAttribute("HadronConeExclExtendedTruthLabelID",label);
90  return label;
91 }
92 
94 
95  switch (t) {
96  case GAFinalHadron: return GAFinalHadronFlavourLabel (jet); break;
97  case GAInitialHadron: return GAInitialHadronFlavourLabel (jet); break;
98  case GAFinalParton: return GAFinalPartonFlavourLabel (jet); break;
100  case ConeFinalParton: default: return ConeFinalPartonFlavourLabel (jet);
101  }
102 }
JetFlavourInfo.h
xAOD::GAFinalParton
@ GAFinalParton
Definition: JetFlavourInfo.h:32
xAOD::JetFlavourLabelType
JetFlavourLabelType
Definition: JetFlavourInfo.h:32
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
xAOD::ConeFinalParton
@ ConeFinalParton
Definition: JetFlavourInfo.h:32
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:40
xAOD::GAInitialHadron
@ GAInitialHadron
Definition: JetFlavourInfo.h:32
xAOD::ExclusiveConeHadronFlavourLabel
int ExclusiveConeHadronFlavourLabel(const xAOD::Jet *jet)
Definition: JetFlavourInfo.cxx:74
xAOD::jetFlavourLabel
int jetFlavourLabel(const xAOD::Jet *jet, JetFlavourLabelType=ExclConeHadron)
Definition: JetFlavourInfo.cxx:93
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
xAOD::GAInitialHadronFlavourLabel
int GAInitialHadronFlavourLabel(const xAOD::Jet *jet)
Definition: JetFlavourInfo.cxx:30
xAOD::ExclusiveConeDoubleHadronFlavourLabel
int ExclusiveConeDoubleHadronFlavourLabel(const xAOD::Jet *jet)
Definition: JetFlavourInfo.cxx:84
xAOD::ConeFinalPartonFlavourLabel
int ConeFinalPartonFlavourLabel(const xAOD::Jet *jet)
Definition: JetFlavourInfo.cxx:62
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
xAOD::ExclConeHadron
@ ExclConeHadron
Definition: JetFlavourInfo.h:32
xAOD::GAFinalHadronFlavourLabel
int GAFinalHadronFlavourLabel(const xAOD::Jet *jet)
Definition: JetFlavourInfo.cxx:14
xAOD::GAFinalPartonFlavourLabel
int GAFinalPartonFlavourLabel(const xAOD::Jet *jet)
Definition: JetFlavourInfo.cxx:46
xAOD::GAFinalHadron
@ GAFinalHadron
Definition: JetFlavourInfo.h:32