ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ORUtils::MuJetGhostDRMatcher Class Reference

Matches a muon to a jet via ghost association or a delta-R. More...

#include <MuJetGhostDRMatcher.h>

Inheritance diagram for ORUtils::MuJetGhostDRMatcher:
Collaboration diagram for ORUtils::MuJetGhostDRMatcher:

Public Member Functions

 MuJetGhostDRMatcher (double dR, bool useRapidity=true)
 Constructor takes same arguments as the DeltaRMatcher. More...
 
virtual bool objectsMatch (const xAOD::IParticle &mu, const xAOD::IParticle &jet) const override
 Check for a match via ghost association or delta-R. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

std::unique_ptr< IParticleAssociatorm_drMatcher
 The delta-R matcher. More...
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Detailed Description

Matches a muon to a jet via ghost association or a delta-R.

Ghost association is done by looking for the muon's ID track in the jet's list of ghost tracks. The Delta-R matching is implemented via the DeltaRMatcher. The final result is a match if either the ghost association or the delta-R succeeds.

Author
Steve Farrell Steve.nosp@m.n.Fa.nosp@m.rrell.nosp@m.@cer.nosp@m.n.ch

Definition at line 30 of file MuJetGhostDRMatcher.h.

Constructor & Destructor Documentation

◆ MuJetGhostDRMatcher()

ORUtils::MuJetGhostDRMatcher::MuJetGhostDRMatcher ( double  dR,
bool  useRapidity = true 
)

Constructor takes same arguments as the DeltaRMatcher.

Definition at line 23 of file MuJetGhostDRMatcher.cxx.

24  : asg::AsgMessaging("MuJetGhostDRMatcher"),
25  m_drMatcher (std::make_unique<DeltaRMatcher>(dR, useRapidity))
26  {
27  }

Member Function Documentation

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ msg() [1/2]

MsgStream & asg::AsgMessaging::msg ( ) const
inherited

The standard message stream.

Returns
A reference to the default message stream of this object.

Definition at line 49 of file AsgMessaging.cxx.

49  {
50 #ifndef XAOD_STANDALONE
52 #else // not XAOD_STANDALONE
53  return m_msg;
54 #endif // not XAOD_STANDALONE
55  }

◆ msg() [2/2]

MsgStream & asg::AsgMessaging::msg ( const MSG::Level  lvl) const
inherited

The standard message stream.

Parameters
lvlThe message level to set the stream to
Returns
A reference to the default message stream, set to level "lvl"

Definition at line 57 of file AsgMessaging.cxx.

57  {
58 #ifndef XAOD_STANDALONE
60 #else // not XAOD_STANDALONE
61  m_msg << lvl;
62  return m_msg;
63 #endif // not XAOD_STANDALONE
64  }

◆ msgLvl()

bool asg::AsgMessaging::msgLvl ( const MSG::Level  lvl) const
inherited

Test the output level of the object.

Parameters
lvlThe message level to test against
Returns
boolean Indicting if messages at given level will be printed
true If messages at level "lvl" will be printed

Definition at line 41 of file AsgMessaging.cxx.

41  {
42 #ifndef XAOD_STANDALONE
43  return ::AthMessaging::msgLvl( lvl );
44 #else // not XAOD_STANDALONE
45  return m_msg.msgLevel( lvl );
46 #endif // not XAOD_STANDALONE
47  }

◆ objectsMatch()

bool ORUtils::MuJetGhostDRMatcher::objectsMatch ( const xAOD::IParticle mu,
const xAOD::IParticle jet 
) const
overridevirtual

Check for a match via ghost association or delta-R.

Implements ORUtils::IParticleAssociator.

Definition at line 32 of file MuJetGhostDRMatcher.cxx.

34  {
35  // Ghost track list accessor
36  using GhostList_t = std::vector< ElementLink<xAOD::IParticleContainer> >;
37  const static SG::AuxElement::ConstAccessor<GhostList_t> ghostAcc("GhostTrack");
38 
39  // Check the particle types. First particle should be the muon,
40  // and the second particle should be the jet.
41  if(mu.type() != xAOD::Type::Muon) {
42  ATH_MSG_WARNING("First particle arg to objectsMatch is not a muon!");
43  return false;
44  }
45  if(jet.type() != xAOD::Type::Jet) {
46  ATH_MSG_WARNING("Second particle arg to objectsMatch is not a jet!");
47  return false;
48  }
49 
50  // Try the delta-R match first.
51  if(m_drMatcher->objectsMatch(mu, jet)) {
52  ATH_MSG_DEBUG(" Found a dR association");
53  return true;
54  }
55 
56  // Retrieve the muon's ID track, or bail if none available.
57  const auto idTrkFlag = xAOD::Muon::InnerDetectorTrackParticle;
58  auto muTrk = static_cast<const xAOD::Muon&>(mu).trackParticle(idTrkFlag);
59  if(!muTrk) return false;
60 
61  // Search for the muon ID track in the list of ghosts.
62  for(const auto& ghostLink : ghostAcc(jet)) {
63  if(ghostLink.isValid() && (muTrk == *ghostLink)) {
64  ATH_MSG_DEBUG(" Found a ghost association!");
65  return true;
66  }
67  }
68 
69  return false;
70  }

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_drMatcher

std::unique_ptr<IParticleAssociator> ORUtils::MuJetGhostDRMatcher::m_drMatcher
private

The delta-R matcher.

Definition at line 46 of file MuJetGhostDRMatcher.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.


The documentation for this class was generated from the following files:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ORUtils::MuJetGhostDRMatcher::m_drMatcher
std::unique_ptr< IParticleAssociator > m_drMatcher
The delta-R matcher.
Definition: MuJetGhostDRMatcher.h:46
asg::AsgMessaging
Class mimicking the AthMessaging class from the offline software.
Definition: AsgMessaging.h:40
Muon
struct TBPatternUnitContext Muon
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
xAOD::Jet
Jet_v1 Jet
Definition of the current "jet version".
Definition: Event/xAOD/xAODJet/xAODJet/Jet.h:17