ATLAS Offline Software
Loading...
Searching...
No Matches
JetTruthLabelingTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef PARTICLEJETTOOLS_JETTRUTHLABELINGTOOL_H
6#define PARTICLEJETTOOLS_JETTRUTHLABELINGTOOL_H
7
8#include "AsgTools/AsgTool.h"
15
19#include "AthLinks/ElementLink.h"
22#include <optional>
23
25 public asg::AsgTool,
26 virtual public IJetDecorator
27{
29
30public:
31
33 JetTruthLabelingTool(const std::string& name = "JetTruthLabelingTool");
34 virtual StatusCode initialize() override;
35
37 StatusCode decorate(const xAOD::JetContainer& jets) const override;
38
40 void print() const override;
41
43 const std::string& getLargeRJetTruthLabelName() const {
44 return m_truthLabelName;
45 };
46
47protected:
48
49 Gaudi::Property<std::string> m_jetContainerName{this, "RecoJetContainer", "", "Input reco jet container name"};
50 Gaudi::Property<std::string> m_truthLabelName{this, "TruthLabelName", "R10TruthLabel_R22v1", "Truth label name"};
51
52 Gaudi::Property<bool> m_isTruthJetCol{this, "IsTruthJetCollection", false, "Flag indicating whether input collection is a truth jet container"};
53 Gaudi::Property<bool> m_forceDeltaRMatch{this, "ForceDeltaRMatch", false, "Whether to force dR matching e.g. if GhostTruth is not available"};
54
55 SG::ReadHandleKey<xAOD::EventInfo> m_evtInfoKey{this, "EventInfoKey", "EventInfo", "Name of EventInfo object"};
56
58 SG::ReadHandleKey<xAOD::JetContainer> m_truthJetCollectionKey{this, "TruthJetContainer", "", "Do not configure manually!"};
59 SG::ReadHandleKey<xAOD::JetContainer> m_truthGroomedJetCollectionKey{this, "TruthGroomedJetContainer", "", "Do not configure manually!"};
63 double m_dRTruthJet{};
64 double m_recoGhostFrac{};
65 double m_mLowTop{};
66 double m_mLowW{};
67 double m_mLowZ{};
68 bool m_doLargeRLabels{true};
69
95 friend struct DecorHandles;
96
98 StatusCode labelTruthJets( DecorHandles& dh,
99 const EventContext& ctx ) const;
100 StatusCode labelTruthJets( DecorHandles& dh,
101 const xAOD::JetContainer &jets,
102 const EventContext& ctx ) const;
103
105 StatusCode labelRecoJets(DecorHandles& dh,
106 const xAOD::JetContainer &jets,
107 const EventContext& ctx) const;
108
111 const xAOD::Jet &jet,
112 const EventContext& ctx ) const;
113
115 int getLabel( DecorHandles& dh,
116 const xAOD::Jet &jet, bool matchH, bool matchW, bool matchZ, bool matchTop,
117 const EventContext& ctx ) const;
118
120 float getWZSplit12Cut( float pt ) const;
121
123 float getTopSplit23Cut( float pt ) const;
124
126 int getNGhostParticles( const xAOD::Jet &jet, const std::string & collection ) const;
127
137
138 TruthLabelConfiguration parseLabel(const std::string& label);
140
141 SG::WriteDecorHandleKey<xAOD::JetContainer> m_label_truthKey{this, "label_TruthKey", "", "Do not configure manually!"};
142 SG::WriteDecorHandleKey<xAOD::JetContainer> m_NB_truthKey{this, "NB_TruthKey", "", "Do not configure manually!"};
143 SG::ReadDecorHandleKey<xAOD::JetContainer> m_split12_truthKey{this, "Split12_TruthKey", "", "Do not configure manually!"};
144 SG::ReadDecorHandleKey<xAOD::JetContainer> m_split23_truthKey{this, "Split23_TruthKey", "", "Do not configure manually!"};
145
146 SG::WriteDecorHandleKey<xAOD::JetContainer> m_label_recoKey{this, "label_RecoKey", "", "Do not configure manually!"};
147 SG::WriteDecorHandleKey<xAOD::JetContainer> m_NB_recoKey{this, "NB_RecoKey", "", "Do not configure manually!"};
148 SG::WriteDecorHandleKey<xAOD::JetContainer> m_truthSplit12_recoKey{this, "TruthSplit12_RecoKey", "", "Do not configure manually!"};
149 SG::WriteDecorHandleKey<xAOD::JetContainer> m_truthSplit23_recoKey{this, "TruthSplit23_RecoKey", "", "Do not configure manually!"};
150
151 SG::WriteDecorHandleKey<xAOD::JetContainer> m_matchedTruthJet_recoKey{this, "MatchedTruthJet_RecoKey", "", "Do not configure manually!"};
152 SG::WriteDecorHandleKey<xAOD::JetContainer> m_matchedTruthJetMass_recoKey{this, "MatchedTruthJetMass_RecoKey", "", "Do not configure manually!"};
153 SG::WriteDecorHandleKey<xAOD::JetContainer> m_matchedTruthJetPt_recoKey{this, "MatchedTruthJetPt_RecoKey", "", "Do not configure manually!"};
154 SG::WriteDecorHandleKey<xAOD::JetContainer> m_matchedTruthJetEta_recoKey{ this, "MatchedTruthJetEta_RecoKey", "", "Do not configure manually!" };
155 SG::WriteDecorHandleKey<xAOD::JetContainer> m_matchedTruthJetPhi_recoKey{ this, "MatchedTruthJetPhi_RecoKey", "", "Do not configure manually!" };
156 SG::WriteDecorHandleKey<xAOD::JetContainer> m_matchedTruthJetDR_recoKey{ this, "MatchedTruthJetDR_RecoKey", "", "Do not configure manually!" };
157 SG::WriteDecorHandleKey<xAOD::JetContainer> m_matchedTruthJetGF_recoKey{ this, "MatchedTruthJetGF_RecoKey", "", "Do not configure manually!" };
158
159 SG::WriteDecorHandleKey<xAOD::JetContainer> m_matchedTruthGroomedJetMass_recoKey{this, "MatchedTruthGroomedJetMass_RecoKey", "", "Do not configure manually!"};
160 SG::WriteDecorHandleKey<xAOD::JetContainer> m_matchedTruthGroomedJetPt_recoKey{this, "MatchedTruthGroomedJetPt_RecoKey", "", "Do not configure manually!"};
161};
162
163#endif
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Handle class for reading a decoration on an object.
Property holding a SG store/key/clid from which a ReadHandle is made.
Handle class for adding a decoration to an object.
@ Unknown
Definition TruthClasses.h:9
Interface for adding a decoration to a jet container.
Gaudi::Property< std::string > m_jetContainerName
Gaudi::Property< std::string > m_truthLabelName
Gaudi::Property< bool > m_forceDeltaRMatch
bool m_getTruthGroomedJetValues
Use the ungroomed reco jet parent to match to truth jet.
double m_mLowZ
Lower mass cut for W label.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthJetDR_recoKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_NB_truthKey
StatusCode labelRecoJets(DecorHandles &dh, const xAOD::JetContainer &jets, const EventContext &ctx) const
Apply labels to all jets in a container.
float getTopSplit23Cut(float pt) const
Get top label Split23 cut.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthJetPt_recoKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_label_recoKey
StatusCode labelTruthJets(DecorHandles &dh, const EventContext &ctx) const
Label truth jet collection.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthJetEta_recoKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthJetPhi_recoKey
double m_mLowTop
Ghost pT fraction to match truth jet to reco jet.
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
SG::ReadHandleKey< xAOD::JetContainer > m_truthGroomedJetCollectionKey
void print() const override
Print configured parameters.
int getTruthJetLabelGA(DecorHandles &dh, const xAOD::Jet &jet, const EventContext &ctx) const
Get truth label using ghost-associated particles.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthJetMass_recoKey
double m_recoGhostFrac
dR to match truth jet to reco jet
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthJet_recoKey
Gaudi::Property< bool > m_isTruthJetCol
TruthLabelConfiguration m_truthLabelConfig
bool m_doLargeRLabels
Lower mass cut for Z label.
int getLabel(DecorHandles &dh, const xAOD::Jet &jet, bool matchH, bool matchW, bool matchZ, bool matchTop, const EventContext &ctx) const
Get label based on matching and containment criteria.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_truthSplit23_recoKey
const std::string & getLargeRJetTruthLabelName() const
returns the name of large-R jet truth label
float getWZSplit12Cut(float pt) const
Get W/Z label Split12 cut.
SG::ReadDecorHandleKey< xAOD::JetContainer > m_split23_truthKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthJetGF_recoKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_split12_truthKey
int getNGhostParticles(const xAOD::Jet &jet, const std::string &collection) const
Get number of ghost associated particles.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_truthSplit12_recoKey
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthGroomedJetMass_recoKey
bool m_matchUngroomedParent
Use ghost association to match reco to truth jets, dR otherwise.
TruthLabelConfiguration parseLabel(const std::string &label)
JetTruthLabelingTool(const std::string &name="JetTruthLabelingTool")
default constructor - to be used in all derived classes
SG::WriteDecorHandleKey< xAOD::JetContainer > m_label_truthKey
StatusCode decorate(const xAOD::JetContainer &jets) const override
decorate truth label to a jet collection
SG::ReadHandleKey< xAOD::JetContainer > m_truthJetCollectionKey
parameters for truth labeling
double m_mLowW
Lower mass cut for top label.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_NB_recoKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthGroomedJetPt_recoKey
double m_dRTruthJet
When truth jet matching to ungroomed truth, allow saving properties of groomed truth jets.
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Handle class for adding a decoration to an object.
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
std::string label(const std::string &format, int i)
Definition label.h:19
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Track internally if the W,Z,Top labels should be done (for large-R).
std::optional< FloatHandle_t > FloatHandleOp_t
SG::WriteDecorHandle< xAOD::JetContainer, ElementLink< xAOD::JetContainer > > ELHandle_t
DecorHandles(const JetTruthLabelingTool &tool, const EventContext &ctx)
std::optional< IntHandle_t > IntHandleOp_t
SG::WriteDecorHandle< xAOD::JetContainer, int > IntHandle_t
SG::WriteDecorHandle< xAOD::JetContainer, float > FloatHandle_t
std::optional< ELHandle_t > ELHandleOp_t