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"
23#include <optional>
24
26 public asg::AsgTool,
27 virtual public IJetDecorator
28{
30
31public:
32
34 JetTruthLabelingTool(const std::string& name = "JetTruthLabelingTool");
35 virtual StatusCode initialize() override;
36
38 StatusCode decorate(const xAOD::JetContainer& jets) const override;
39
41 void print() const override;
42
44 const std::string& getLargeRJetTruthLabelName() const {
45 return m_truthLabelName;
46 };
47
48protected:
49
50 Gaudi::Property<std::string> m_jetContainerName{this, "RecoJetContainer", "", "Input reco jet container name"};
51 Gaudi::Property<std::string> m_truthLabelName{this, "TruthLabelName", "R10TruthLabel_R22v1", "Truth label name"};
52
53 Gaudi::Property<bool> m_isTruthJetCol{this, "IsTruthJetCollection", false, "Flag indicating whether input collection is a truth jet container"};
54 Gaudi::Property<bool> m_forceDeltaRMatch{this, "ForceDeltaRMatch", false, "Whether to force dR matching e.g. if GhostTruth is not available"};
55
56 SG::ReadHandleKey<xAOD::EventInfo> m_evtInfoKey{this, "EventInfoKey", "EventInfo", "Name of EventInfo object"};
57
59 SG::ReadHandleKey<xAOD::JetContainer> m_OOTJetName{ this, "OOTJetContainer", "OutOfTimeAntiKt4TruthJets", "Do not configure manually!" };
60 SG::ReadHandleKey<xAOD::JetContainer> m_ITJetName{ this, "ITJetContainer", "InTimeAntiKt4TruthJets", "Do not configure manually!" };
61 SG::ReadHandleKey<xAOD::JetContainer> m_truthJetCollectionKey{this, "TruthJetContainer", "", "Do not configure manually!"};
62 SG::ReadHandleKey<xAOD::JetContainer> m_truthGroomedJetCollectionKey{this, "TruthGroomedJetContainer", "", "Do not configure manually!"};
64 bool m_isSmallR{};
67 double m_dRTruthJet{};
68 double m_recoGhostFrac{};
69 double m_mLowTop{};
70 double m_mLowW{};
71 double m_mLowZ{};
72 bool m_doLargeRLabels{true};
73
105 friend struct DecorHandles;
106
108 StatusCode labelTruthJets( DecorHandles& dh,
109 const EventContext& ctx ) const;
110 StatusCode labelTruthJets( DecorHandles& dh,
111 const xAOD::JetContainer &jets,
112 const EventContext& ctx ) const;
113
115 StatusCode labelRecoJets(DecorHandles& dh,
116 const xAOD::JetContainer &jets,
117 const EventContext& ctx) const;
118
121 const xAOD::Jet &jet,
122 const EventContext& ctx ) const;
123
125 int getLabel( DecorHandles& dh,
126 const xAOD::Jet &jet, bool matchH, bool matchW, bool matchZ, bool matchTop,
127 const EventContext& ctx ) const;
128
130 float getWZSplit12Cut( float pt ) const;
131
133 float getTopSplit23Cut( float pt ) const;
134
136 int getNGhostParticles( const xAOD::Jet &jet, const std::string & collection ) const;
137
148
149 TruthLabelConfiguration parseLabel(const std::string& label);
151
152 SG::WriteDecorHandleKey<xAOD::JetContainer> m_label_truthKey{this, "label_TruthKey", "", "Do not configure manually!"};
153 SG::WriteDecorHandleKey<xAOD::JetContainer> m_NB_truthKey{this, "NB_TruthKey", "", "Do not configure manually!"};
154 SG::ReadDecorHandleKey<xAOD::JetContainer> m_split12_truthKey{this, "Split12_TruthKey", "", "Do not configure manually!"};
155 SG::ReadDecorHandleKey<xAOD::JetContainer> m_split23_truthKey{this, "Split23_TruthKey", "", "Do not configure manually!"};
156
157 SG::WriteDecorHandleKey<xAOD::JetContainer> m_label_recoKey{this, "label_RecoKey", "", "Do not configure manually!"};
158 SG::WriteDecorHandleKey<xAOD::JetContainer> m_NB_recoKey{this, "NB_RecoKey", "", "Do not configure manually!"};
159 SG::WriteDecorHandleKey<xAOD::JetContainer> m_truthSplit12_recoKey{this, "TruthSplit12_RecoKey", "", "Do not configure manually!"};
160 SG::WriteDecorHandleKey<xAOD::JetContainer> m_truthSplit23_recoKey{this, "TruthSplit23_RecoKey", "", "Do not configure manually!"};
161
162 SG::WriteDecorHandleKey<xAOD::JetContainer> m_matchedTruthJet_recoKey{this, "TruthMatch_Jet_RecoKey", "", "Do not configure manually!"};
163 SG::WriteDecorHandleKey<xAOD::JetContainer> m_matchedTruthJetMass_recoKey{this, "TruthMatch_m_RecoKey", "", "Do not configure manually!"};
164 SG::WriteDecorHandleKey<xAOD::JetContainer> m_matchedTruthJetPt_recoKey{this, "TruthMatch_pt_RecoKey", "", "Do not configure manually!"};
165 SG::WriteDecorHandleKey<xAOD::JetContainer> m_matchedTruthJetRapidity_recoKey{ this, "TruthMatch_rapidity_RecoKey", "", "Do not configure manually!" };
166 SG::WriteDecorHandleKey<xAOD::JetContainer> m_matchedTruthJetPhi_recoKey{ this, "TruthMatch_phi_RecoKey", "", "Do not configure manually!" };
167 SG::WriteDecorHandleKey<xAOD::JetContainer> m_matchedTruthJetDR_recoKey{ this, "TruthMatch_dR_RecoKey", "", "Do not configure manually!" };
168 SG::WriteDecorHandleKey<xAOD::JetContainer> m_matchedPileupTag_recoKey{ this, "TruthMatch_PileupLabel_RecoKey", "", "Do not configure manually!" };
169 SG::WriteDecorHandleKey<xAOD::JetContainer> m_sumPtMatchedHSJets_recoKey{ this, "TruthMatch_HSSumPt_RecoKey", "", "Do not configure manually!" };
170 SG::WriteDecorHandleKey<xAOD::JetContainer> m_sumPtMatchedOOTJets_recoKey{ this, "TruthMatch_OOTSumPt_RecoKey", "", "Do not configure manually!" };
171 SG::WriteDecorHandleKey<xAOD::JetContainer> m_sumPtMatchedITJets_recoKey{ this, "TruthMatch_ITSumPt_RecoKey", "", "Do not configure manually!" };
172
173 SG::WriteDecorHandleKey<xAOD::JetContainer> m_matchedTruthGroomedJetMass_recoKey{this, "TruthMatch_GroomedJetMass_RecoKey", "", "Do not configure manually!"};
174 SG::WriteDecorHandleKey<xAOD::JetContainer> m_matchedTruthGroomedJetPt_recoKey{this, "TruthMatch_GroomedJetPt_RecoKey", "", "Do not configure manually!"};
175};
176
177#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_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.
bool m_isSmallR
Use ghost association to match reco to truth jets, dR otherwise.
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
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedPileupTag_recoKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_sumPtMatchedOOTJets_recoKey
SG::ReadHandleKey< xAOD::JetContainer > m_ITJetName
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::ReadDecorHandleKey< xAOD::JetContainer > m_split12_truthKey
int getNGhostParticles(const xAOD::Jet &jet, const std::string &collection) const
Get number of ghost associated particles.
SG::ReadHandleKey< xAOD::JetContainer > m_OOTJetName
parameters for truth labeling
SG::WriteDecorHandleKey< xAOD::JetContainer > m_truthSplit12_recoKey
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthGroomedJetMass_recoKey
bool m_matchUngroomedParent
Is the reco jet collection small or large R, default large.
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
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.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthJetRapidity_recoKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_sumPtMatchedHSJets_recoKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_sumPtMatchedITJets_recoKey
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