ATLAS Offline Software
Loading...
Searching...
No Matches
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
9using namespace std;
10using namespace Analysis;
11
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}
#define ATH_MSG_VERBOSE(x)
ATLAS-specific HepMC functions.
int modifyJet(xAOD::Jet &jet) const
Modify a single jet. This is obsolete and set to be removed.
std::string label(const std::string &format, int i)
Definition label.h:19
The namespace of all packages in PhysicsAnalysis/JetTagging.
bool isTop(const T &p)
STL namespace.
Jet_v1 Jet
Definition of the current "jet version".