ATLAS Offline Software
JetPartonTruthLabel.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
9 using namespace std;
10 using namespace Analysis;
11 
12 int JetPartonTruthLabel::modifyJet(xAOD::Jet &jet) const {
13  ATH_MSG_VERBOSE("In " << name() << "::modifyJet()");
14 
15  int label = -1;
16  int extended_label = -1;
17  double e_max = 0;
18  double pt_max = 0;
19  double dr_max = 0;
20 
21  vector<const xAOD::TruthParticle*> partons;
22  bool success = jet.getAssociatedObjects("GhostPartons", partons);
23  if(success) {
24  for(auto it = partons.begin(); it != partons.end(); it++) {
25  if(MC::isTop(*it)) continue; // Skip top
26 
27  if((*it)->e() > e_max) {
28  label = (*it)->absPdgId();
29  extended_label = (*it)->pdgId();
30  e_max = (*it)->e();
31  pt_max = (*it)->pt();
32  dr_max = (*it)->p4().DeltaR(jet.p4());
33  }
34  }
35  }
36 
37  jet.setAttribute("PartonTruthLabelID", label);
38  jet.setAttribute("PartonExtendedTruthLabelID", extended_label);
39  jet.setAttribute("PartonTruthLabelPt", pt_max);
40  jet.setAttribute("PartonTruthLabelEnergy", e_max);
41  jet.setAttribute("PartonTruthLabelDR", dr_max);
42 
43  return 0;
44 }
skel.it
it
Definition: skel.GENtoEVGEN.py:407
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
add-xsec-uncert-quadrature-N.label
label
Definition: add-xsec-uncert-quadrature-N.py:104
Analysis
The namespace of all packages in PhysicsAnalysis/JetTagging.
Definition: BTaggingCnvAlg.h:20
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
isTop
bool isTop(const T &p)
Definition: AtlasPID.h:182
JetPartonTruthLabel.h
TruthParticle.h
HepMCHelpers.h