ATLAS Offline Software
Loading...
Searching...
No Matches
ORUtils::MuJetGhostDRMatcher Class Referencefinal

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.
virtual StatusCode setObjectTypes (xAODType::ObjectType type1, xAODType::ObjectType type2) override
 Set the object types to be used in the association.
virtual bool objectsMatch (columnar::Particle1Id mu, columnar::Particle2Id jet, bool swapArgs=false) const override
 Check for a match via ghost association or delta-R.
bool objectsMatch (columnar::Particle2Id p2, columnar::Particle1Id p1) const
void setLevel (MSG::Level lvl)
 Change the current logging level.
Functions providing the same interface as AthMessaging
bool msgLvl (const MSG::Level lvl) const
 Test the output level of the object.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.

Private Types

using MyTrackDef = columnar::VariantContainerId<columnar::ContainerId::track0,columnar::ContainerId::track0, columnar::ContainerId::track1>
 IDTrack type.

Private Member Functions

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

Private Attributes

std::unique_ptr< IParticleAssociatorm_drMatcher
 The delta-R matcher.
columnar::Particle1Accessor< columnar::ObjectLink< MyTrackDef > > m_muonTrkAcc {*this, "inDetTrackParticleLink"}
columnar::Particle2Accessor< std::vector< columnar::LinkCastColumn< MyTrackDef, xAOD::IParticleContainer > > > m_ghostAcc {*this, "GhostTrack"}
std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels)
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging)

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 37 of file MuJetGhostDRMatcher.h.

Member Typedef Documentation

◆ MyTrackDef

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 addSubtool (*m_drMatcher.get());
28 }
std::unique_ptr< IParticleAssociator > m_drMatcher
The delta-R matcher.

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 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ 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
51 return ::AthMessaging::msg();
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
59 return ::AthMessaging::msg( lvl );
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() [1/2]

bool ORUtils::IParticleAssociator::objectsMatch ( columnar::Particle2Id p2,
columnar::Particle1Id p1 ) const
inlineinherited

Definition at line 37 of file IObjectAssociator.h.

39 { return objectsMatch(p1, p2, true); }
virtual bool objectsMatch(columnar::Particle1Id p1, columnar::Particle2Id p2, bool swapArgs=false) const =0
Test association between two IParticles.

◆ objectsMatch() [2/2]

bool ORUtils::MuJetGhostDRMatcher::objectsMatch ( columnar::Particle1Id mu,
columnar::Particle2Id jet,
bool swapArgs = false ) const
overridevirtual

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

Implements ORUtils::IParticleAssociator.

Definition at line 51 of file MuJetGhostDRMatcher.cxx.

54 {
55 if (swapArgs) {
56 ATH_MSG_WARNING("MuJetGhostDRMatcher does not support swapped args");
57 return false;
58 }
59
60 // Check the particle types. First particle should be the muon,
61 // and the second particle should be the jet.
63 {
64 if(mu.getXAODObject().type() != xAOD::Type::Muon) {
65 ATH_MSG_WARNING("First particle arg to objectsMatch is not a muon!");
66 return false;
67 }
68 if(jet.getXAODObject().type() != xAOD::Type::Jet) {
69 ATH_MSG_WARNING("Second particle arg to objectsMatch is not a jet!");
70 return false;
71 }
72 }
73
74 // Try the delta-R match first.
75 if(m_drMatcher->objectsMatch(mu, jet)) {
76 ATH_MSG_DEBUG(" Found a dR association");
77 return true;
78 }
79
80 // Retrieve the muon's ID track, or bail if none available.
81 auto muTrk = mu(m_muonTrkAcc).opt_value();
82 if(!muTrk) return false;
83
84 // Search for the muon ID track in the list of ghosts.
85 for(const auto ghostLink : m_ghostAcc(jet)) {
86 if(ghostLink.has_value() && muTrk == ghostLink) {
87 ATH_MSG_DEBUG(" Found a ghost association!");
88 return true;
89 }
90 }
91
92 return false;
93 }
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
columnar::Particle2Accessor< std::vector< columnar::LinkCastColumn< MyTrackDef, xAOD::IParticleContainer > > > m_ghostAcc
columnar::Particle1Accessor< columnar::ObjectLink< MyTrackDef > > m_muonTrkAcc
@ Jet
The object is a jet.
Definition ObjectType.h:40
@ Muon
The object is a muon.
Definition ObjectType.h:48
static constexpr bool isXAOD
Whether this is the xAOD mode.
Definition ColumnarDef.h:20

◆ 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}

◆ setObjectTypes()

StatusCode ORUtils::MuJetGhostDRMatcher::setObjectTypes ( xAODType::ObjectType type1,
xAODType::ObjectType type2 )
overridevirtual

Set the object types to be used in the association.

Implements ORUtils::IParticleAssociator.

Definition at line 32 of file MuJetGhostDRMatcher.cxx.

34 {
35 if (type1 != xAOD::Type::Muon) {
36 ATH_MSG_ERROR("First particle arg to setObjectTypes is not a muon!");
37 return StatusCode::FAILURE;
38 }
39 if (type2 != xAOD::Type::Jet) {
40 ATH_MSG_ERROR("Second particle arg to setObjectTypes is not a jet!");
41 return StatusCode::FAILURE;
42 }
43 ATH_CHECK (m_drMatcher->setObjectTypes(type1, type2));
44 addSubtool (*m_drMatcher.get());
45 return StatusCode::SUCCESS;
46 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)

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 57 of file MuJetGhostDRMatcher.h.

◆ m_ghostAcc

columnar::Particle2Accessor<std::vector<columnar::LinkCastColumn<MyTrackDef,xAOD::IParticleContainer> > > ORUtils::MuJetGhostDRMatcher::m_ghostAcc {*this, "GhostTrack"}
private

Definition at line 65 of file MuJetGhostDRMatcher.h.

65{*this, "GhostTrack"};

◆ m_imsg

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

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_lvl

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

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ 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_muonTrkAcc

columnar::Particle1Accessor<columnar::ObjectLink<MyTrackDef> > ORUtils::MuJetGhostDRMatcher::m_muonTrkAcc {*this, "inDetTrackParticleLink"}
private

Definition at line 62 of file MuJetGhostDRMatcher.h.

62{*this, "inDetTrackParticleLink"};

◆ 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: