ATLAS Offline Software
Loading...
Searching...
No Matches
JetTruthLabelingTool Class Reference

#include <JetTruthLabelingTool.h>

Inheritance diagram for JetTruthLabelingTool:
Collaboration diagram for JetTruthLabelingTool:

Classes

struct  DecorHandles

Public Member Functions

 JetTruthLabelingTool (const std::string &name="JetTruthLabelingTool")
 default constructor - to be used in all derived classes
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function.
StatusCode decorate (const xAOD::JetContainer &jets) const override
 decorate truth label to a jet collection
void print () const override
 Print configured parameters.
const std::string & getLargeRJetTruthLabelName () const
 returns the name of large-R jet truth label
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
virtual StatusCode modify (xAOD::JetContainer &jets) const override final
 Concrete implementation of the function inherited from IJetModifier.
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Types

enum class  TruthLabelConfiguration {
  R21Precision_2022v1 , R10TruthLabel_R22v1 , R10WZTruthLabel_R22v1 , R4TruthLabel ,
  R4TruthDressedWZLabel , R4InTimeTruthLabel , R4OutOfTimeTruthLabel , Unknown
}

Protected Member Functions

StatusCode labelTruthJets (DecorHandles &dh, const EventContext &ctx) const
 Label truth jet collection.
StatusCode labelTruthJets (DecorHandles &dh, const xAOD::JetContainer &jets, const EventContext &ctx) const
StatusCode labelRecoJets (DecorHandles &dh, const xAOD::JetContainer &jets, const EventContext &ctx) const
 Apply labels to all jets in a container.
int getTruthJetLabelGA (DecorHandles &dh, const xAOD::Jet &jet, const EventContext &ctx) const
 Get truth label using ghost-associated particles.
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.
float getWZSplit12Cut (float pt) const
 Get W/Z label Split12 cut.
float getTopSplit23Cut (float pt) const
 Get top label Split23 cut.
int getNGhostParticles (const xAOD::Jet &jet, const std::string &collection) const
 Get number of ghost associated particles.
TruthLabelConfiguration parseLabel (const std::string &label)
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Protected Attributes

Gaudi::Property< std::string > m_jetContainerName {this, "RecoJetContainer", "", "Input reco jet container name"}
Gaudi::Property< std::string > m_truthLabelName {this, "TruthLabelName", "R10TruthLabel_R22v1", "Truth label name"}
Gaudi::Property< bool > m_isTruthJetCol {this, "IsTruthJetCollection", false, "Flag indicating whether input collection is a truth jet container"}
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey {this, "EventInfoKey", "EventInfo", "Name of EventInfo object"}
SG::ReadHandleKey< xAOD::JetContainer > m_OOTJetName { this, "OOTJetContainer", "OutOfTimeAntiKt4TruthJets", "Do not configure manually!" }
 parameters for truth labeling
SG::ReadHandleKey< xAOD::JetContainer > m_ITJetName { this, "ITJetContainer", "InTimeAntiKt4TruthJets", "Do not configure manually!" }
SG::ReadHandleKey< xAOD::JetContainer > m_truthJetCollectionKey {this, "TruthJetContainer", "", "Do not configure manually!"}
SG::ReadHandleKey< xAOD::JetContainer > m_truthGroomedJetCollectionKey {this, "TruthGroomedJetContainer", "", "Do not configure manually!"}
Gaudi::Property< bool > m_useGhostJetMatch {this, "UseGhostJetMatch", false, "Use ghost association to match reco to truth jets, dR otherwise"}
Gaudi::Property< double > m_recoGhostFrac {this, "RecoGhostFraction", 0.75, "Ghost pT fraction window for GA matching"}
Gaudi::Property< bool > m_matchUngroomedParent {this, "MatchUngroomedParent", false, "Use the ungroomed reco jet parent to match to truth jet"}
Gaudi::Property< bool > m_getTruthGroomedJetValues {this, "GetTruthGroomedJetValues", false, "Save properties of the groomed truth jet"}
Gaudi::Property< double > m_dRTruthJet {this, "dRTruthJet", 0.0, "dR to match truth jet to reco jet (<0: closest jet)"}
Gaudi::Property< bool > m_doLargeRLabels {this, "DoLargeRLabels", true, "Compute the W/Z/top labels (large R jets)"}
Gaudi::Property< double > m_mLowTop {this, "MassLowTop", 140.0, "Lower mass cut for top label [GeV]"}
 Large R containment cuts [GeV].
Gaudi::Property< double > m_mLowW {this, "MassLowW", 50.0, "Lower mass cut for W label [GeV]"}
Gaudi::Property< double > m_mLowZ {this, "MassLowZ", 50.0, "Lower mass cut for Z label [GeV]"}
TruthLabelConfiguration m_truthLabelConfig = TruthLabelConfiguration::Unknown
SG::WriteDecorHandleKey< xAOD::JetContainer > m_label_truthKey {this, "label_TruthKey", "", "Do not configure manually!"}
SG::WriteDecorHandleKey< xAOD::JetContainer > m_NB_truthKey {this, "NB_TruthKey", "", "Do not configure manually!"}
SG::ReadDecorHandleKey< xAOD::JetContainer > m_split12_truthKey {this, "Split12_TruthKey", "", "Do not configure manually!"}
SG::ReadDecorHandleKey< xAOD::JetContainer > m_split23_truthKey {this, "Split23_TruthKey", "", "Do not configure manually!"}
SG::WriteDecorHandleKey< xAOD::JetContainer > m_label_recoKey {this, "label_RecoKey", "", "Do not configure manually!"}
SG::WriteDecorHandleKey< xAOD::JetContainer > m_NB_recoKey {this, "NB_RecoKey", "", "Do not configure manually!"}
SG::WriteDecorHandleKey< xAOD::JetContainer > m_truthSplit12_recoKey {this, "TruthSplit12_RecoKey", "", "Do not configure manually!"}
SG::WriteDecorHandleKey< xAOD::JetContainer > m_truthSplit23_recoKey {this, "TruthSplit23_RecoKey", "", "Do not configure manually!"}
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthJet_recoKey {this, "TruthMatch_Jet_RecoKey", "", "Do not configure manually!"}
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthJetMass_recoKey {this, "TruthMatch_m_RecoKey", "", "Do not configure manually!"}
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthJetPt_recoKey {this, "TruthMatch_pt_RecoKey", "", "Do not configure manually!"}
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthJetRapidity_recoKey { this, "TruthMatch_rapidity_RecoKey", "", "Do not configure manually!" }
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthJetPhi_recoKey { this, "TruthMatch_phi_RecoKey", "", "Do not configure manually!" }
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthJetDR_recoKey { this, "TruthMatch_dR_RecoKey", "", "Do not configure manually!" }
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedPileupTag_recoKey { this, "TruthMatch_PileupLabel_RecoKey", "", "Do not configure manually!" }
SG::WriteDecorHandleKey< xAOD::JetContainer > m_sumPtMatchedHSJets_recoKey { this, "TruthMatch_HSSumPt_RecoKey", "", "Do not configure manually!" }
SG::WriteDecorHandleKey< xAOD::JetContainer > m_sumPtMatchedOOTJets_recoKey { this, "TruthMatch_OOTSumPt_RecoKey", "", "Do not configure manually!" }
SG::WriteDecorHandleKey< xAOD::JetContainer > m_sumPtMatchedITJets_recoKey { this, "TruthMatch_ITSumPt_RecoKey", "", "Do not configure manually!" }
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthGroomedJetMass_recoKey {this, "TruthMatch_GroomedJetMass_RecoKey", "", "Do not configure manually!"}
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthGroomedJetPt_recoKey {this, "TruthMatch_GroomedJetPt_RecoKey", "", "Do not configure manually!"}

Private Types

typedef ServiceHandle< StoreGateSvc > StoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Friends

struct DecorHandles

Detailed Description

Definition at line 27 of file JetTruthLabelingTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 376 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ TruthLabelConfiguration

Enumerator
R21Precision_2022v1 
R10TruthLabel_R22v1 
R10WZTruthLabel_R22v1 
R4TruthLabel 
R4TruthDressedWZLabel 
R4InTimeTruthLabel 
R4OutOfTimeTruthLabel 
Unknown 

Definition at line 141 of file JetTruthLabelingTool.h.

141 {
142 R21Precision_2022v1,
143 R10TruthLabel_R22v1,
144 R10WZTruthLabel_R22v1,
145 R4TruthLabel,
146 R4TruthDressedWZLabel,
147 R4InTimeTruthLabel,
148 R4OutOfTimeTruthLabel,
149 Unknown
150 };
struct TBPatternUnitContext Unknown

Constructor & Destructor Documentation

◆ JetTruthLabelingTool()

JetTruthLabelingTool::JetTruthLabelingTool ( const std::string & name = "JetTruthLabelingTool")

default constructor - to be used in all derived classes

Definition at line 14 of file JetTruthLabelingTool.cxx.

14 :
15 asg::AsgTool(name)
16{}

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ decorate()

StatusCode JetTruthLabelingTool::decorate ( const xAOD::JetContainer & jets) const
overridevirtual

decorate truth label to a jet collection

Apply label to truth jet collections

Copy label to matched reco jets

Implements IJetDecorator.

Definition at line 205 of file JetTruthLabelingTool.cxx.

205 {
206 const EventContext& ctx = Gaudi::Hive::currentContext();
207 DecorHandles dh (*this, ctx);
208
210 if(m_isTruthJetCol) {
211 return labelTruthJets(dh, jets, ctx);
212 }
213
214 else if (!m_isTruthJetCol && !m_doLargeRLabels) {
215 return labelRecoJets(dh, jets, ctx);
216 }
217
219 else {
220 ATH_CHECK( labelTruthJets(dh, ctx) );
221 return labelRecoJets(dh, jets, ctx);
222 }
223
224 return StatusCode::SUCCESS;
225}
#define ATH_CHECK
Evaluate an expression and check for errors.
StatusCode labelRecoJets(DecorHandles &dh, const xAOD::JetContainer &jets, const EventContext &ctx) const
Apply labels to all jets in a container.
StatusCode labelTruthJets(DecorHandles &dh, const EventContext &ctx) const
Label truth jet collection.
Gaudi::Property< bool > m_doLargeRLabels
Gaudi::Property< bool > m_isTruthJetCol

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::Event both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::Event, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getLabel()

int JetTruthLabelingTool::getLabel ( DecorHandles & dh,
const xAOD::Jet & jet,
bool matchH,
bool matchW,
bool matchZ,
bool matchTop,
const EventContext & ctx ) const
protected

Get label based on matching and containment criteria.

Booleans for containment selections

This method can be expanded to include custom label priorities

If it isn't matched to any heavy particles, is it QCD

Contained H->bb

Contained H->cc

Contained H->tautau

Other from H

Contained top

Contained W from a top

Contained W not from a top

Contained Z->bb

Contained Z->cc

Contained Z->tautau

Contained Z->qq

Uncontained top

Uncontained V

Definition at line 675 of file JetTruthLabelingTool.cxx.

681 {
682
683 // store GhostBHadronsFinal count
684 int nMatchB = getNGhostParticles( jet, "GhostBHadronsFinal" );
685 (*dh.nbHandle)(jet) = nMatchB;
686
688 bool is_bb = false;
689 bool is_cc = false;
690 bool is_tautauEl = false;
691 bool is_tautauMu = false;
692 bool is_tautauHad = false;
693 bool isTop = false;
694 bool isW = false;
695 bool isZ = false;
696
697 // Use R21Precision_2022v1 definition
699 SG::ReadDecorHandle<xAOD::JetContainer, float> split23Handle(m_split23_truthKey, ctx);
700 SG::ReadDecorHandle<xAOD::JetContainer, float> split12Handle(m_split12_truthKey, ctx);
701 is_bb = ( nMatchB > 1 );
702 isTop = ( matchTop && matchW && nMatchB > 0 && jet.m() / 1000. > m_mLowTop && split23Handle(jet) / 1000. > getTopSplit23Cut( jet.pt() / 1000. ) );
703 isW = matchW && nMatchB == 0 && jet.m() / 1000. > m_mLowW && split12Handle(jet) / 1000. > getWZSplit12Cut( jet.pt() / 1000. );
704 isZ = matchZ && jet.m() / 1000. > m_mLowZ && split12Handle(jet) / 1000. > getWZSplit12Cut( jet.pt() / 1000. );
705 }
706
707 // Use R10TruthLabel_R22v1 definition
709 // get extended ghost associated truth label
710 int extended_GA_label = -1;
711 if (not jet.getAttribute("HadronGhostExtendedTruthLabelID", extended_GA_label)) {
712 ATH_MSG_ERROR( "HadronGhostExtendedTruthLabelID not available for " + m_truthJetCollectionKey.key() );
713 }
714
715 SG::ReadDecorHandle<xAOD::JetContainer, float> split23Handle(m_split23_truthKey, ctx);
716 SG::ReadDecorHandle<xAOD::JetContainer, float> split12Handle(m_split12_truthKey, ctx);
717 is_bb = ( extended_GA_label == 55 );
718 is_cc = ( extended_GA_label == 44 );
719 is_tautauEl = ( extended_GA_label == 151511 );
720 is_tautauMu = ( extended_GA_label == 151513 );
721 is_tautauHad = ( extended_GA_label == 1515 );
722 isTop = ( matchTop && matchW && nMatchB > 0 && jet.m() / 1000. > m_mLowTop && split23Handle(jet) / 1000. > getTopSplit23Cut( jet.pt() / 1000. ) );
723 isW = matchW && nMatchB == 0 && jet.m() / 1000. > m_mLowW && split12Handle(jet) / 1000. > getWZSplit12Cut( jet.pt() / 1000. );
724 isZ = matchZ && jet.m() / 1000. > m_mLowZ && split12Handle(jet) / 1000. > getWZSplit12Cut( jet.pt() / 1000. );
725 }
726
727
729
730 /* The default priority of labels is:
731 * 1) Hbb/cc/tautau
732 * 2) Contained top
733 * 3) Contained W
734 * 4) Contained Zbb/cc/qq/tautau
735 * 5) Uncontained top
736 * 6) Uncontained V
737 */
738
740 if( !(matchTop || matchW || matchZ || matchH) ) {
742 }
743
744 // Higgs
745 if ( matchH ) {
747 if ( is_bb ) return LargeRJetTruthLabel::Hbb;
749 if ( is_cc ) return LargeRJetTruthLabel::Hcc;
751 if ( is_tautauEl ) return LargeRJetTruthLabel::HtautauEl;
752 if ( is_tautauMu ) return LargeRJetTruthLabel::HtautauMu;
753 if ( is_tautauHad ) return LargeRJetTruthLabel::HtautauHad;
756 }
757
759 if ( isTop ) return LargeRJetTruthLabel::tqqb;
760
761 if ( isW ) {
763 if ( matchTop ) return LargeRJetTruthLabel::Wqq_From_t;
766 }
767
768 if ( matchZ ) {
770 if ( is_bb ) return LargeRJetTruthLabel::Zbb;
772 if ( is_cc ) return LargeRJetTruthLabel::Zcc;
774 if ( is_tautauEl ) return LargeRJetTruthLabel::ZtautauEl;
775 if ( is_tautauMu ) return LargeRJetTruthLabel::ZtautauMu;
776 if ( is_tautauHad ) return LargeRJetTruthLabel::ZtautauHad;
777 }
778 if ( isZ ) {
781 }
782
784 if ( matchTop ) return LargeRJetTruthLabel::other_From_t;
785
788
789}
#define ATH_MSG_ERROR(x,...)
bool isW(const T &p)
Definition AtlasPID.h:388
bool isZ(const T &p)
Definition AtlasPID.h:385
bool isTop(const T &p)
Definition AtlasPID.h:191
float getTopSplit23Cut(float pt) const
Get top label Split23 cut.
TruthLabelConfiguration m_truthLabelConfig
float getWZSplit12Cut(float pt) const
Get W/Z label Split12 cut.
Gaudi::Property< double > m_mLowW
Gaudi::Property< double > m_mLowZ
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.
Gaudi::Property< double > m_mLowTop
Large R containment cuts [GeV].
SG::ReadHandleKey< xAOD::JetContainer > m_truthJetCollectionKey

◆ getLargeRJetTruthLabelName()

const std::string & JetTruthLabelingTool::getLargeRJetTruthLabelName ( ) const
inline

returns the name of large-R jet truth label

Definition at line 46 of file JetTruthLabelingTool.h.

46 {
47 return m_truthLabelName;
48 };
Gaudi::Property< std::string > m_truthLabelName

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::Event both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::Event, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getNGhostParticles()

int JetTruthLabelingTool::getNGhostParticles ( const xAOD::Jet & jet,
const std::string & collection ) const
protected

Get number of ghost associated particles.

Definition at line 659 of file JetTruthLabelingTool.cxx.

659 {
660
661 int nMatchPart = 0;
662
663 if( !jet.getAttribute<int>( collection+"Count", nMatchPart ) ){
664
665 std::vector<const xAOD::TruthParticle*> ghostParts;
666 if( !jet.getAssociatedObjects<xAOD::TruthParticle>( collection, ghostParts ) ){
667 ATH_MSG_ERROR( collection + " cannot be retrieved! Truth label definition might be wrong" );
668 }
669 nMatchPart = ghostParts.size();
670 }
671
672 return nMatchPart;
673}
TruthParticle_v1 TruthParticle
Typedef to implementation.

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ getTopSplit23Cut()

float JetTruthLabelingTool::getTopSplit23Cut ( float pt) const
protected

Get top label Split23 cut.

The functional form and parameters come from optimization studies: https://indico.cern.ch/event/931498/contributions/3921872/attachments/2064188/3463746/JSS_25June.pdf

Definition at line 638 of file JetTruthLabelingTool.cxx.

638 {
639
642
643 float split23 = -999.0;
644
648
649 const float c0 = 3.3;
650 const float c1 = -6.98e-4;
651
652 split23 = std::exp( c0 + c1 * pt );
653
654 }
655
656 return split23;
657}

◆ getTruthJetLabelGA()

int JetTruthLabelingTool::getTruthJetLabelGA ( DecorHandles & dh,
const xAOD::Jet & jet,
const EventContext & ctx ) const
protected

Get truth label using ghost-associated particles.

Booleans to check ghost-associated heavy particles

Find ghost associated W bosons

Find ghost associated Z bosons

Find ghost associated H bosons

Find ghost associated top quarks

Definition at line 163 of file JetTruthLabelingTool.cxx.

166{
168 bool matchW = false;
169 bool matchZ = false;
170 bool matchH = false;
171 bool matchTop = false;
172
174 int nMatchW = getNGhostParticles( jet, "GhostWBosons" );
175
176 if ( nMatchW ) {
177 matchW = true;
178 }
179
181 int nMatchZ = getNGhostParticles( jet, "GhostZBosons" );
182
183 if ( nMatchZ ) {
184 matchZ = true;
185 }
186
188 int nMatchH = getNGhostParticles( jet, "GhostHBosons" );
189
190 if ( nMatchH ) {
191 matchH = true;
192 }
193
195 int nMatchTop = getNGhostParticles( jet, "GhostTQuarksFinal" );
196
197 if ( nMatchTop ) {
198 matchTop = true;
199 }
200
201 return getLabel( dh, jet, matchH, matchW, matchZ, matchTop, ctx );
202
203}
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.

◆ getWZSplit12Cut()

float JetTruthLabelingTool::getWZSplit12Cut ( float pt) const
protected

Get W/Z label Split12 cut.

The functional form and parameters come from optimization studies: https://cds.cern.ch/record/2777009/files/ATL-PHYS-PUB-2021-029.pdf

Definition at line 620 of file JetTruthLabelingTool.cxx.

620 {
621
624
625 float split12 = -999.0;
626
628 const float c0 = 55.25;
629 const float c1 = -2.34e-3;
630
631 split12 = c0 * std::exp( c1 * pt );
632 }
633
634 return split12;
635
636}

◆ initialize()

StatusCode JetTruthLabelingTool::initialize ( void )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Check if TruthLabelName is supported. If not, give an error and return FAILURE

Reimplemented from asg::AsgTool.

Definition at line 33 of file JetTruthLabelingTool.cxx.

33 {
34
35 ATH_MSG_INFO("Initializing " << name());
36
38
41 ATH_MSG_ERROR("TruthLabelName " << m_truthLabelName << " is not supported. Exiting...");
42 return StatusCode::FAILURE;
43 }
44
45 print();
46
51
52 if(!m_isTruthJetCol){
55 m_truthSplit12_recoKey = m_jetContainerName + "." + m_truthLabelName + "_TruthJetSplit12";
56 m_truthSplit23_recoKey = m_jetContainerName + "." + m_truthLabelName + "_TruthJetSplit23";
57
64
65 if (!m_doLargeRLabels) { //Simple naming for small R
66 m_matchedTruthJet_recoKey = m_jetContainerName + "." + "TruthMatch_Jet";
68 m_matchedTruthJetPt_recoKey = m_jetContainerName + "." + "TruthMatch_pt";
69 m_matchedTruthJetRapidity_recoKey = m_jetContainerName + "." + "TruthMatch_rapidity";
70 m_matchedTruthJetPhi_recoKey = m_jetContainerName + "." + "TruthMatch_phi";
71 m_matchedTruthJetDR_recoKey = m_jetContainerName + "." + "TruthMatch_dR";
72 m_matchedPileupTag_recoKey = m_jetContainerName + "." + "TruthMatch_PileupLabel";
73 m_sumPtMatchedHSJets_recoKey = m_jetContainerName + "." + "TruthMatch_HSSumPt";
74 m_sumPtMatchedOOTJets_recoKey = m_jetContainerName + "." + "TruthMatch_OOTSumPt";
75 m_sumPtMatchedITJets_recoKey = m_jetContainerName + "." + "TruthMatch_ITSumPt";
76 }
77
78 m_matchedTruthGroomedJetMass_recoKey = m_jetContainerName + "." + m_truthLabelName + "_TruthMatch_GroomedJetMass";
79 m_matchedTruthGroomedJetPt_recoKey = m_jetContainerName + "." + m_truthLabelName + "_TruthMatch_GroomedJetPt";
80 }
81
82 ATH_CHECK(m_evtInfoKey.initialize());
85
88
89 ATH_CHECK(m_label_truthKey.initialize());
90 ATH_CHECK(m_NB_truthKey.initialize());
91
94
99
106
111
114
115 return StatusCode::SUCCESS;
116}
#define ATH_MSG_INFO(x,...)
Gaudi::Property< std::string > m_jetContainerName
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthJetDR_recoKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_NB_truthKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthJetPt_recoKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_label_recoKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthJetPhi_recoKey
SG::ReadHandleKey< xAOD::JetContainer > m_truthGroomedJetCollectionKey
void print() const override
Print configured parameters.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthJetMass_recoKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthJet_recoKey
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
Gaudi::Property< bool > m_getTruthGroomedJetValues
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
TruthLabelConfiguration parseLabel(const std::string &label)
SG::WriteDecorHandleKey< xAOD::JetContainer > m_label_truthKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_NB_recoKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthGroomedJetPt_recoKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_matchedTruthJetRapidity_recoKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_sumPtMatchedHSJets_recoKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_sumPtMatchedITJets_recoKey

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ labelRecoJets()

StatusCode JetTruthLabelingTool::labelRecoJets ( DecorHandles & dh,
const xAOD::JetContainer & jets,
const EventContext & ctx ) const
protected

Apply labels to all jets in a container.

Get parent ungroomed reco jet for matching

Find matched truth jet

Groomed Jet matching variables (Large R only)

Pileup tagging variables

If m_dRTruthJet < 0, the closest truth jet is used as matched jet. Otherwise, only match if dR < m_dRTruthJet

Decorate truth label

Decorate additional information used for truth labeling

Definition at line 227 of file JetTruthLabelingTool.cxx.

229 {
230
231 SG::ReadHandle<xAOD::JetContainer> truthJets(m_truthJetCollectionKey, ctx);
232
233 bool usePileupJets = true;
234
235 SG::ReadHandle<xAOD::JetContainer> inTimeTruthJets;
236 SG::ReadHandle<xAOD::JetContainer> outOfTimeTruthJets;
237 if (!m_doLargeRLabels) {
238 inTimeTruthJets = SG::makeHandle(m_ITJetName, ctx);
239 outOfTimeTruthJets = SG::makeHandle(m_OOTJetName, ctx);
240
241 if (!inTimeTruthJets.isValid() || !outOfTimeTruthJets.isValid()) {
242 ATH_MSG_WARNING("Pileup jet collections unavailabel for " << m_truthJetCollectionKey << ". Running without pileup tagger.");
243 usePileupJets = false;
244 }
245 }
246
247 SG::ReadHandle<xAOD::JetContainer> truthGroomedJets;
249 truthGroomedJets = SG::makeHandle(m_truthGroomedJetCollectionKey, ctx);
250 }
251
252 const SG::Accessor<int> nbAcc (m_truthLabelName + "_NB");
253 static const SG::ConstAccessor< ElementLink< xAOD::JetContainer > > ParentAcc ("Parent");
254
255 for(const xAOD::Jet *jet : jets) {
256
258 const xAOD::Jet* parent = nullptr;
260 ElementLink<xAOD::JetContainer> element_link = ParentAcc (*jet);
261 if ( element_link.isValid() ) {
262 parent = *element_link;
263 }
264 else {
265 ATH_MSG_ERROR("Unable to get a link to the parent jet! Returning a NULL pointer.");
266 return StatusCode::FAILURE;
267 }
268 }
270 float dRmin = 9999;
271 float oot_dRmin = 9999;
272 float it_dRmin = 9999;
273 float ghostFracNominal = 9;
274 const xAOD::Jet* matchTruthJet = nullptr;
275 const xAOD::Jet* oot_matchTruthJet = nullptr;
276 const xAOD::Jet* it_matchTruthJet = nullptr;
278 float dRminGroomed = 9999;
279 const xAOD::Jet* matchTruthGroomedJet = nullptr;
281 float sumPtMatchedHSJets = 0;
282 float sumPtMatchedOOTJets = 0;
283 float sumPtMatchedITJets = 0;
284 float bestHSpT = -9999;
285 float bestOOTpT = -9999;
286 float bestITpT = -9999;
287 float bestHSpTRatio = -9;
288 float bestOOTpTRatio = -9;
289 float bestITpTRatio = -9;
290 int nMatchedHSJets = 0;
291 int nMatchedOOTJets = 0;
292 int nMatchedITJets = 0;
294 //coverity[UNNECESSARY_STRING_COPY:FALSE]
295 static const SG::ConstAccessor<float> accGhostTruthPt("GhostTruthPt");
296
297 // Ensure that the reco jet has at least one constituent
298 // (and thus a well-defined four-vector)
299 if (jet->numConstituents() > 0) {
300 for (const xAOD::Jet* truthJet : *truthJets) { // Truth jet loop
301 // Calculate DR
302 float dR = jet->p4().DeltaR(truthJet->p4(),true);
303 // If parent jet has been retrieved, calculate dR w.r.t. it instead
304 if (parent) dR = parent->p4().DeltaR(truthJet->p4(),true);
305 // Calculate GF
306 if (m_useGhostJetMatch) { // GA matching. Upper bound applied for completeness, but realistically not needed.
307 // Access ghostTruthPt now so it is available for pileup jets
308 float ghostTruthPt = accGhostTruthPt(*jet);
309 float ghostPtFraction = (ghostTruthPt / (truthJet->pt()));
310 if ((ghostPtFraction >= m_recoGhostFrac) && (ghostPtFraction <= (2 - m_recoGhostFrac))) { // All matches
311 nMatchedHSJets += 1;
312 sumPtMatchedHSJets += truthJet->pt();
313 if (std::abs(1 - ghostPtFraction) < std::abs(1 - ghostFracNominal)) { // Best match
314 matchTruthJet = truthJet;
315 ghostFracNominal = ghostPtFraction;
316 }
317 }
318 }
319 else { // If m_dRTruthJet < 0, the closest truth jet is used as matched jet. Otherwise, only match if dR < m_dRTruthJet
320 if (m_dRTruthJet < 0 || dR < m_dRTruthJet) { // All matches
321 nMatchedHSJets += 1;
322 sumPtMatchedHSJets += truthJet->pt();
323 if (dR < dRmin) { // Best match
324 dRmin = dR;
325 matchTruthJet = truthJet;
326 }
327 }
328 }
329 }
330 if (!m_doLargeRLabels && usePileupJets) {
331 for (const xAOD::Jet* ootJet : *outOfTimeTruthJets) { // Out of time pileup truth jet loop
332 float dR = jet->p4().DeltaR(ootJet->p4(), true);
333 if (m_useGhostJetMatch) {
334 float ghostTruthPt = accGhostTruthPt(*jet);
335 float ghostPtFraction = (ghostTruthPt / (ootJet->pt()));
336 if ((ghostPtFraction >= m_recoGhostFrac) && (ghostPtFraction <= (2 - m_recoGhostFrac))) { // All matches
337 nMatchedOOTJets += 1;
338 sumPtMatchedOOTJets += ootJet->pt();
339 if (std::abs(1 - ghostPtFraction) < std::abs(1 - ghostFracNominal)) { // Best match
340 oot_matchTruthJet = ootJet;
341 }
342 }
343 }
344 else {
345 if (dR < m_dRTruthJet) { // All matches
346 nMatchedOOTJets += 1;
347 sumPtMatchedOOTJets += ootJet->pt();
348 if (dR < oot_dRmin) { // Best match
349 oot_dRmin = dR;
350 oot_matchTruthJet = ootJet;
351 }
352 }
353 }
354 }
355 for (const xAOD::Jet* itJet : *inTimeTruthJets) { // In time pileup truth jet loop
356 float dR = jet->p4().DeltaR(itJet->p4(), true);
357 if (m_useGhostJetMatch) {
358 float ghostTruthPt = accGhostTruthPt(*jet);
359 float ghostPtFraction = (ghostTruthPt / (itJet->pt()));
360 if ((ghostPtFraction >= m_recoGhostFrac) && (ghostPtFraction <= (2 - m_recoGhostFrac))) { // All matches
361 nMatchedITJets += 1;
362 sumPtMatchedITJets += itJet->pt();
363 if (std::abs(1 - ghostPtFraction) < std::abs(1 - ghostFracNominal)) { // Best match
364 it_matchTruthJet = itJet;
365 }
366 }
367 }
368 else {
369 if (dR < m_dRTruthJet) { // All matches
370 nMatchedITJets += 1;
371 sumPtMatchedITJets += itJet->pt();
372 if (dR < it_dRmin) { // Best match
373 it_dRmin = dR;
374 it_matchTruthJet = itJet;
375 }
376 }
377 }
378 }
379
380 //#######################################################################################
381 //# PILEUP TAGGER KEY #
382 //# 0: Hard scatter ------------- Best truth jet match has >90% of the total matched pT #
383 //# 1: Mixed hard scatter-------- Match with multiple truth jets, none >90% (no PU) #
384 //# 2: Hard scatter with pileup - Best truth jet <90%, also has pileup matches #
385 //# 3: In time pileup---------- - Best it jet match has > 90 % of the total matched pT #
386 //# 4: Mixed pileup ------------- Match with multiple pileup jets, none >90% (no HS) #
387 //# 5: Out of time pileup------ - Best oot jet match has > 90 % of the total matched pT #
388 //# 6: Other/unknown ------------ Fails all above cases #
389 //#######################################################################################
390
391 //NOTE: HS has 5 GeV pT threshold, 10 GeV and 15 GeV for IT and OOT pileup.
392
393 int nMatchedPUJets = nMatchedOOTJets + nMatchedITJets;
394
395 float totalMatchedpT = sumPtMatchedHSJets + sumPtMatchedOOTJets + sumPtMatchedITJets;
396
397 if (matchTruthJet) {
398 bestHSpT = matchTruthJet->pt();
399 bestHSpTRatio = bestHSpT / totalMatchedpT;
400 }
401 if (oot_matchTruthJet) {
402 bestOOTpT = oot_matchTruthJet->pt();
403 bestOOTpTRatio = bestOOTpT / totalMatchedpT;
404 }
405 if (it_matchTruthJet) {
406 bestITpT = it_matchTruthJet->pt();
407 bestITpTRatio = bestITpT / totalMatchedpT;
408 }
409
410 if (bestHSpTRatio >= 0.9) { //HS
411 pileupTag = SmallRJetPileupLabel::HS;
412 }
413 else if (bestITpTRatio >= 0.9) { //IT
414 pileupTag = SmallRJetPileupLabel::ITPU;
415 }
416 else if (bestOOTpTRatio >= 0.9) { //OOT
417 pileupTag = SmallRJetPileupLabel::OOTPU;
418 }
419 else if (nMatchedPUJets == 0 && nMatchedHSJets > 1) { //Mixed HS
420 pileupTag = SmallRJetPileupLabel::MixHS;
421 }
422 else if (nMatchedPUJets > 0 && nMatchedHSJets > 0) { //HS with pileup
423 pileupTag = SmallRJetPileupLabel::HSPU;
424 }
425 else if (nMatchedPUJets > 1) {//Mixed PU
426 pileupTag = SmallRJetPileupLabel::MixPU;
427 }
428 else { //No match
430 }
431
432 }
433
434 }
435
437 int truthJetNB = -1;
438 float truthJetSplit12 = -9999;
439 float truthJetSplit23 = -9999;
440
441 // Defaults to null EL
442 ElementLink<xAOD::JetContainer> truthJetEL{};
443 float truthJetMass = -9999;
444 float truthJetPt = -9999;
445 float truthJetRapidity = -9;
446 float truthJetPhi = -9999;
447 float deltaR = -2;
448
449 const xAOD::JetContainer* truthJetCont = truthJets.cptr();
450
451 //If the best match is PU, reassign the truth jet to take variables from
452 switch(pileupTag) {
454 matchTruthJet = it_matchTruthJet;
455 truthJetCont = inTimeTruthJets.cptr();
456 break;
457 }
459 matchTruthJet = oot_matchTruthJet;
460 truthJetCont = outOfTimeTruthJets.cptr();
461 break;
462 }
464 if (bestITpTRatio >= bestOOTpTRatio) {
465 matchTruthJet = it_matchTruthJet;
466 truthJetCont = inTimeTruthJets.cptr();
467 }
468 else {
469 matchTruthJet = oot_matchTruthJet;
470 truthJetCont = outOfTimeTruthJets.cptr();
471 }
472 }
473 default:
474 break;
475 }
476
477 if ( matchTruthJet ) {
478
479 // Can't use the WriteDecorHandle to read --- the decoration may have
480 // been added and locked by a previous algorithm.
481 // Not saving Truth jet decorations for small R
482 if (m_doLargeRLabels) {
483 SG::ConstAccessor<int> labelAcc(dh.labelHandle->auxid());
484 label = labelAcc(*matchTruthJet);
486 SG::ReadDecorHandle<xAOD::JetContainer, float> split23Handle(m_split23_truthKey, ctx);
487 if (split23Handle.isAvailable()) truthJetSplit23 = split23Handle(*matchTruthJet);
488 SG::ReadDecorHandle<xAOD::JetContainer, float> split12Handle(m_split12_truthKey, ctx);
489 if (split12Handle.isAvailable()) truthJetSplit12 = split12Handle(*matchTruthJet);
490 }
491 if (nbAcc.isAvailable(*matchTruthJet)) truthJetNB = nbAcc(*matchTruthJet);
492 }
493 ATH_MSG_VERBOSE("For reco jet " << jet->index() << ", matched truth jet index " << matchTruthJet->index());
494 truthJetEL = ElementLink<xAOD::JetContainer>(*truthJetCont, matchTruthJet->index(), ctx);
495 truthJetMass = matchTruthJet->m();
496 truthJetPt = matchTruthJet->pt();
497 truthJetRapidity = matchTruthJet->rapidity();
498 truthJetPhi = matchTruthJet->phi();
499 deltaR = dRmin;
500 }
501
502 // Save Groomed Truth Jet variables
503 float truthGroomedJetMass = -9999;
504 float truthGroomedJetPt = -9999;
506 if ( matchTruthJet ) {
507 for ( const xAOD::Jet* truthGroomedJet : *truthGroomedJets ) {
508 ElementLink<xAOD::JetContainer> element_link = ParentAcc (*truthGroomedJet);
509 if ( !element_link.isValid() ) { continue; }
510 if ( matchTruthJet == *element_link ) {
511 matchTruthGroomedJet = truthGroomedJet;
512 break;
513 }
514 }
515 }
516 // If no matched jet found or matched jet has no corresponding groomed jet, use dR matching
517 if ( !matchTruthGroomedJet && parent != nullptr) {
518 for ( const xAOD::Jet* truthGroomedJet : *truthGroomedJets ) {
519 float dR = parent->p4().DeltaR(truthGroomedJet->p4(),true);
521 if ( m_dRTruthJet < 0 || dR < m_dRTruthJet ) {
522 if ( dR < dRminGroomed ) {
523 dRminGroomed = dR;
524 matchTruthGroomedJet = truthGroomedJet;
525 }
526 }
527 }
528 }
529 if ( matchTruthGroomedJet ) {
530 truthGroomedJetMass = matchTruthGroomedJet->m();
531 truthGroomedJetPt = matchTruthGroomedJet->pt();
532 }
533 }
534
536 if (m_doLargeRLabels) {
537 (*dh.labelRecoHandle)(*jet) = label;
540 (*dh.split23Handle)(*jet) = truthJetSplit23;
541 (*dh.split12Handle)(*jet) = truthJetSplit12;
542 }
543
544 (*dh.nbRecoHandle)(*jet) = truthJetNB;
545 }
546
547 (*dh.matchedTruthJetHandle)(*jet) = truthJetEL;
548 (*dh.matchedTruthJetMassHandle)(*jet) = truthJetMass;
549 (*dh.matchedTruthJetPtHandle)(*jet) = truthJetPt;
550 (*dh.matchedTruthJetRapidityHandle)(*jet) = truthJetRapidity;
551 (*dh.matchedTruthJetPhiHandle)(*jet) = truthJetPhi;
552 (*dh.matchedTruthJetDRHandle)(*jet) = deltaR;
553
554 if (!m_doLargeRLabels && usePileupJets) {
555 (*dh.matchedPileupTagHandle)(*jet) = pileupTag;
556 (*dh.sumPtMatchedHSJetsHandle)(*jet) = sumPtMatchedHSJets;
557 (*dh.sumPtMatchedOOTJetsHandle)(*jet) = sumPtMatchedOOTJets;
558 (*dh.sumPtMatchedITJetsHandle)(*jet) = sumPtMatchedITJets;
559 }
560
562 (*dh.matchedTruthGroomedMassHandle)(*jet) = truthGroomedJetMass;
563 (*dh.matchedTruthGroomedPtHandle)(*jet) = truthGroomedJetPt;
564 }
565 }
566
567 return StatusCode::SUCCESS;
568}
Scalar deltaR(const MatrixBase< Derived > &vec) const
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
Gaudi::Property< bool > m_matchUngroomedParent
Gaudi::Property< double > m_recoGhostFrac
Gaudi::Property< double > m_dRTruthJet
Gaudi::Property< bool > m_useGhostJetMatch
virtual bool isValid() override final
Can the handle be successfully dereferenced?
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition Jet_v1.cxx:54
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition Jet_v1.cxx:44
virtual double rapidity() const
The true rapidity (y) of the particle.
Definition Jet_v1.cxx:67
virtual double m() const
The invariant mass of the particle.
Definition Jet_v1.cxx:59
std::string label(const std::string &format, int i)
Definition label.h:19
int enumToInt(const TypeEnum type)
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:570
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
int enumToInt(const TypeEnum type)
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".

◆ labelTruthJets() [1/2]

StatusCode JetTruthLabelingTool::labelTruthJets ( DecorHandles & dh,
const EventContext & ctx ) const
protected

Label truth jet collection.

Retrieve appropriate truth jet container

Make sure the truth jet collection has been retrieved

Definition at line 570 of file JetTruthLabelingTool.cxx.

571 {
572
574 SG::ReadHandle<xAOD::JetContainer> truthJets(m_truthJetCollectionKey, ctx);
575
577 if ( !truthJets.isValid() ) {
578 ATH_MSG_ERROR("No truth jet container retrieved. Please make sure you are using a supported TruthLabelName.");
579 return StatusCode::FAILURE;
580 }
581
582 return labelTruthJets(dh, *truthJets, ctx);
583
584}

◆ labelTruthJets() [2/2]

StatusCode JetTruthLabelingTool::labelTruthJets ( DecorHandles & dh,
const xAOD::JetContainer & jets,
const EventContext & ctx ) const
protected

Make sure there is at least 1 jet in truth collection

Check if the truth jet collection already has labels applied

Get the EventInfo to identify Sherpa samples

Apply label to truth jet

Definition at line 586 of file JetTruthLabelingTool.cxx.

589{
591 if ( !(truthJets.size()) ) return StatusCode::SUCCESS;
592
594 if(dh.labelHandle->isAvailable()){
595 // Beware: if we get here, the configuration is probably not MT-compatible.
596 ATH_MSG_DEBUG("labelTruthJets: Truth jet collection already labelled with " << m_truthLabelName);
597 return StatusCode::SUCCESS;
598 }
599
601 SG::ReadHandle<xAOD::EventInfo> eventInfo(m_evtInfoKey, ctx);
602 if(!eventInfo.isValid()){
603 ATH_MSG_ERROR("Failed to retrieve event information.");
604 return StatusCode::FAILURE;
605 }
606
607 if(m_doLargeRLabels) {
610 for ( const xAOD::Jet *jet : truthJets ) {
611 ATH_MSG_DEBUG("Getting truth label using ghost-association");
612 label = getTruthJetLabelGA(dh, *jet, ctx);
613 (*dh.labelHandle)(*jet) = label;
614 }
615 }
616
617 return StatusCode::SUCCESS;
618}
#define ATH_MSG_DEBUG(x,...)
int getTruthJetLabelGA(DecorHandles &dh, const xAOD::Jet &jet, const EventContext &ctx) const
Get truth label using ghost-associated particles.

◆ modify()

virtual StatusCode IJetDecorator::modify ( xAOD::JetContainer & jets) const
inlinefinaloverridevirtualinherited

Concrete implementation of the function inherited from IJetModifier.

Implements IJetModifier.

Definition at line 32 of file IJetDecorator.h.

32{return decorate(jets);};
virtual StatusCode decorate(const xAOD::JetContainer &jets) const =0
Decorate a jet collection without otherwise modifying it.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ parseLabel()

JetTruthLabelingTool::TruthLabelConfiguration JetTruthLabelingTool::parseLabel ( const std::string & label)
protected

Definition at line 19 of file JetTruthLabelingTool.cxx.

◆ print()

void JetTruthLabelingTool::print ( ) const
overridevirtual

Print configured parameters.

Reimplemented from asg::AsgTool.

Definition at line 118 of file JetTruthLabelingTool.cxx.

118 {
119 ATH_MSG_INFO("Parameters for " << name());
120
121 ATH_MSG_INFO("xAOD information:");
122 ATH_MSG_INFO("TruthLabelName: " << m_truthLabelName);
123 ATH_MSG_INFO("TruthJetCollectionName: " << m_truthJetCollectionKey.key());
124 ATH_MSG_INFO("dRTruthJet: " << std::to_string(m_dRTruthJet));
125
127 ATH_MSG_INFO("truthGroomedJetCollectionName: " << m_truthGroomedJetCollectionKey.key());
128 }
129}

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 352 of file AthCommonDataStore.h.

352 {
354 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, and AthCheckedComponent<::AthAlgTool >.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }
std::vector< SG::VarHandleKeyArray * > m_vhka

◆ DecorHandles

friend struct DecorHandles
friend

Definition at line 108 of file JetTruthLabelingTool.h.

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 381 of file AthCommonDataStore.h.

◆ m_doLargeRLabels

Gaudi::Property<bool> JetTruthLabelingTool::m_doLargeRLabels {this, "DoLargeRLabels", true, "Compute the W/Z/top labels (large R jets)"}
protected

Definition at line 70 of file JetTruthLabelingTool.h.

70{this, "DoLargeRLabels", true, "Compute the W/Z/top labels (large R jets)"};

◆ m_dRTruthJet

Gaudi::Property<double> JetTruthLabelingTool::m_dRTruthJet {this, "dRTruthJet", 0.0, "dR to match truth jet to reco jet (<0: closest jet)"}
protected

Definition at line 69 of file JetTruthLabelingTool.h.

69{this, "dRTruthJet", 0.0, "dR to match truth jet to reco jet (<0: closest jet)"};

◆ m_evtInfoKey

SG::ReadHandleKey<xAOD::EventInfo> JetTruthLabelingTool::m_evtInfoKey {this, "EventInfoKey", "EventInfo", "Name of EventInfo object"}
protected

Definition at line 57 of file JetTruthLabelingTool.h.

57{this, "EventInfoKey", "EventInfo", "Name of EventInfo object"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 378 of file AthCommonDataStore.h.

◆ m_getTruthGroomedJetValues

Gaudi::Property<bool> JetTruthLabelingTool::m_getTruthGroomedJetValues {this, "GetTruthGroomedJetValues", false, "Save properties of the groomed truth jet"}
protected

Definition at line 68 of file JetTruthLabelingTool.h.

68{this, "GetTruthGroomedJetValues", false, "Save properties of the groomed truth jet"};

◆ m_isTruthJetCol

Gaudi::Property<bool> JetTruthLabelingTool::m_isTruthJetCol {this, "IsTruthJetCollection", false, "Flag indicating whether input collection is a truth jet container"}
protected

Definition at line 55 of file JetTruthLabelingTool.h.

55{this, "IsTruthJetCollection", false, "Flag indicating whether input collection is a truth jet container"};

◆ m_ITJetName

SG::ReadHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_ITJetName { this, "ITJetContainer", "InTimeAntiKt4TruthJets", "Do not configure manually!" }
protected

Definition at line 61 of file JetTruthLabelingTool.h.

61{ this, "ITJetContainer", "InTimeAntiKt4TruthJets", "Do not configure manually!" };

◆ m_jetContainerName

Gaudi::Property<std::string> JetTruthLabelingTool::m_jetContainerName {this, "RecoJetContainer", "", "Input reco jet container name"}
protected

Definition at line 52 of file JetTruthLabelingTool.h.

52{this, "RecoJetContainer", "", "Input reco jet container name"};

◆ m_label_recoKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_label_recoKey {this, "label_RecoKey", "", "Do not configure manually!"}
protected

Definition at line 160 of file JetTruthLabelingTool.h.

160{this, "label_RecoKey", "", "Do not configure manually!"};

◆ m_label_truthKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_label_truthKey {this, "label_TruthKey", "", "Do not configure manually!"}
protected

Definition at line 155 of file JetTruthLabelingTool.h.

155{this, "label_TruthKey", "", "Do not configure manually!"};

◆ m_matchedPileupTag_recoKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_matchedPileupTag_recoKey { this, "TruthMatch_PileupLabel_RecoKey", "", "Do not configure manually!" }
protected

Definition at line 171 of file JetTruthLabelingTool.h.

171{ this, "TruthMatch_PileupLabel_RecoKey", "", "Do not configure manually!" };

◆ m_matchedTruthGroomedJetMass_recoKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_matchedTruthGroomedJetMass_recoKey {this, "TruthMatch_GroomedJetMass_RecoKey", "", "Do not configure manually!"}
protected

Definition at line 176 of file JetTruthLabelingTool.h.

176{this, "TruthMatch_GroomedJetMass_RecoKey", "", "Do not configure manually!"};

◆ m_matchedTruthGroomedJetPt_recoKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_matchedTruthGroomedJetPt_recoKey {this, "TruthMatch_GroomedJetPt_RecoKey", "", "Do not configure manually!"}
protected

Definition at line 177 of file JetTruthLabelingTool.h.

177{this, "TruthMatch_GroomedJetPt_RecoKey", "", "Do not configure manually!"};

◆ m_matchedTruthJet_recoKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_matchedTruthJet_recoKey {this, "TruthMatch_Jet_RecoKey", "", "Do not configure manually!"}
protected

Definition at line 165 of file JetTruthLabelingTool.h.

165{this, "TruthMatch_Jet_RecoKey", "", "Do not configure manually!"};

◆ m_matchedTruthJetDR_recoKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_matchedTruthJetDR_recoKey { this, "TruthMatch_dR_RecoKey", "", "Do not configure manually!" }
protected

Definition at line 170 of file JetTruthLabelingTool.h.

170{ this, "TruthMatch_dR_RecoKey", "", "Do not configure manually!" };

◆ m_matchedTruthJetMass_recoKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_matchedTruthJetMass_recoKey {this, "TruthMatch_m_RecoKey", "", "Do not configure manually!"}
protected

Definition at line 166 of file JetTruthLabelingTool.h.

166{this, "TruthMatch_m_RecoKey", "", "Do not configure manually!"};

◆ m_matchedTruthJetPhi_recoKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_matchedTruthJetPhi_recoKey { this, "TruthMatch_phi_RecoKey", "", "Do not configure manually!" }
protected

Definition at line 169 of file JetTruthLabelingTool.h.

169{ this, "TruthMatch_phi_RecoKey", "", "Do not configure manually!" };

◆ m_matchedTruthJetPt_recoKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_matchedTruthJetPt_recoKey {this, "TruthMatch_pt_RecoKey", "", "Do not configure manually!"}
protected

Definition at line 167 of file JetTruthLabelingTool.h.

167{this, "TruthMatch_pt_RecoKey", "", "Do not configure manually!"};

◆ m_matchedTruthJetRapidity_recoKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_matchedTruthJetRapidity_recoKey { this, "TruthMatch_rapidity_RecoKey", "", "Do not configure manually!" }
protected

Definition at line 168 of file JetTruthLabelingTool.h.

168{ this, "TruthMatch_rapidity_RecoKey", "", "Do not configure manually!" };

◆ m_matchUngroomedParent

Gaudi::Property<bool> JetTruthLabelingTool::m_matchUngroomedParent {this, "MatchUngroomedParent", false, "Use the ungroomed reco jet parent to match to truth jet"}
protected

Definition at line 67 of file JetTruthLabelingTool.h.

67{this, "MatchUngroomedParent", false, "Use the ungroomed reco jet parent to match to truth jet"};

◆ m_mLowTop

Gaudi::Property<double> JetTruthLabelingTool::m_mLowTop {this, "MassLowTop", 140.0, "Lower mass cut for top label [GeV]"}
protected

Large R containment cuts [GeV].

Definition at line 73 of file JetTruthLabelingTool.h.

73{this, "MassLowTop", 140.0, "Lower mass cut for top label [GeV]"};

◆ m_mLowW

Gaudi::Property<double> JetTruthLabelingTool::m_mLowW {this, "MassLowW", 50.0, "Lower mass cut for W label [GeV]"}
protected

Definition at line 74 of file JetTruthLabelingTool.h.

74{this, "MassLowW", 50.0, "Lower mass cut for W label [GeV]"};

◆ m_mLowZ

Gaudi::Property<double> JetTruthLabelingTool::m_mLowZ {this, "MassLowZ", 50.0, "Lower mass cut for Z label [GeV]"}
protected

Definition at line 75 of file JetTruthLabelingTool.h.

75{this, "MassLowZ", 50.0, "Lower mass cut for Z label [GeV]"};

◆ m_NB_recoKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_NB_recoKey {this, "NB_RecoKey", "", "Do not configure manually!"}
protected

Definition at line 161 of file JetTruthLabelingTool.h.

161{this, "NB_RecoKey", "", "Do not configure manually!"};

◆ m_NB_truthKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_NB_truthKey {this, "NB_TruthKey", "", "Do not configure manually!"}
protected

Definition at line 156 of file JetTruthLabelingTool.h.

156{this, "NB_TruthKey", "", "Do not configure manually!"};

◆ m_OOTJetName

SG::ReadHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_OOTJetName { this, "OOTJetContainer", "OutOfTimeAntiKt4TruthJets", "Do not configure manually!" }
protected

parameters for truth labeling

Definition at line 60 of file JetTruthLabelingTool.h.

60{ this, "OOTJetContainer", "OutOfTimeAntiKt4TruthJets", "Do not configure manually!" };

◆ m_recoGhostFrac

Gaudi::Property<double> JetTruthLabelingTool::m_recoGhostFrac {this, "RecoGhostFraction", 0.75, "Ghost pT fraction window for GA matching"}
protected

Definition at line 66 of file JetTruthLabelingTool.h.

66{this, "RecoGhostFraction", 0.75, "Ghost pT fraction window for GA matching"};

◆ m_split12_truthKey

SG::ReadDecorHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_split12_truthKey {this, "Split12_TruthKey", "", "Do not configure manually!"}
protected

Definition at line 157 of file JetTruthLabelingTool.h.

157{this, "Split12_TruthKey", "", "Do not configure manually!"};

◆ m_split23_truthKey

SG::ReadDecorHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_split23_truthKey {this, "Split23_TruthKey", "", "Do not configure manually!"}
protected

Definition at line 158 of file JetTruthLabelingTool.h.

158{this, "Split23_TruthKey", "", "Do not configure manually!"};

◆ m_sumPtMatchedHSJets_recoKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_sumPtMatchedHSJets_recoKey { this, "TruthMatch_HSSumPt_RecoKey", "", "Do not configure manually!" }
protected

Definition at line 172 of file JetTruthLabelingTool.h.

172{ this, "TruthMatch_HSSumPt_RecoKey", "", "Do not configure manually!" };

◆ m_sumPtMatchedITJets_recoKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_sumPtMatchedITJets_recoKey { this, "TruthMatch_ITSumPt_RecoKey", "", "Do not configure manually!" }
protected

Definition at line 174 of file JetTruthLabelingTool.h.

174{ this, "TruthMatch_ITSumPt_RecoKey", "", "Do not configure manually!" };

◆ m_sumPtMatchedOOTJets_recoKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_sumPtMatchedOOTJets_recoKey { this, "TruthMatch_OOTSumPt_RecoKey", "", "Do not configure manually!" }
protected

Definition at line 173 of file JetTruthLabelingTool.h.

173{ this, "TruthMatch_OOTSumPt_RecoKey", "", "Do not configure manually!" };

◆ m_truthGroomedJetCollectionKey

SG::ReadHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_truthGroomedJetCollectionKey {this, "TruthGroomedJetContainer", "", "Do not configure manually!"}
protected

Definition at line 63 of file JetTruthLabelingTool.h.

63{this, "TruthGroomedJetContainer", "", "Do not configure manually!"};

◆ m_truthJetCollectionKey

SG::ReadHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_truthJetCollectionKey {this, "TruthJetContainer", "", "Do not configure manually!"}
protected

Definition at line 62 of file JetTruthLabelingTool.h.

62{this, "TruthJetContainer", "", "Do not configure manually!"};

◆ m_truthLabelConfig

TruthLabelConfiguration JetTruthLabelingTool::m_truthLabelConfig = TruthLabelConfiguration::Unknown
protected

Definition at line 153 of file JetTruthLabelingTool.h.

◆ m_truthLabelName

Gaudi::Property<std::string> JetTruthLabelingTool::m_truthLabelName {this, "TruthLabelName", "R10TruthLabel_R22v1", "Truth label name"}
protected

Definition at line 53 of file JetTruthLabelingTool.h.

53{this, "TruthLabelName", "R10TruthLabel_R22v1", "Truth label name"};

◆ m_truthSplit12_recoKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_truthSplit12_recoKey {this, "TruthSplit12_RecoKey", "", "Do not configure manually!"}
protected

Definition at line 162 of file JetTruthLabelingTool.h.

162{this, "TruthSplit12_RecoKey", "", "Do not configure manually!"};

◆ m_truthSplit23_recoKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetTruthLabelingTool::m_truthSplit23_recoKey {this, "TruthSplit23_RecoKey", "", "Do not configure manually!"}
protected

Definition at line 163 of file JetTruthLabelingTool.h.

163{this, "TruthSplit23_RecoKey", "", "Do not configure manually!"};

◆ m_useGhostJetMatch

Gaudi::Property<bool> JetTruthLabelingTool::m_useGhostJetMatch {this, "UseGhostJetMatch", false, "Use ghost association to match reco to truth jets, dR otherwise"}
protected

Definition at line 65 of file JetTruthLabelingTool.h.

65{this, "UseGhostJetMatch", false, "Use ghost association to match reco to truth jets, dR otherwise"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 387 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 386 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: