ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
MinimalSumAssociation Class Reference

#include <MinimalSumAssociation.h>

Inheritance diagram for MinimalSumAssociation:
Collaboration diagram for MinimalSumAssociation:

Public Types

typedef std::map< unsigned int, unsigned int > index_assignment_t
 

Public Member Functions

 MinimalSumAssociation ()
 
index_assignment_t associate (const std::vector< std::vector< double > > &matrix)
 
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::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

Definition at line 14 of file MinimalSumAssociation.h.

Member Typedef Documentation

◆ index_assignment_t

typedef std::map<unsigned int,unsigned int> IAssociationStrategy::index_assignment_t
inherited

Definition at line 16 of file IAssociationStrategy.h.

Constructor & Destructor Documentation

◆ MinimalSumAssociation()

MinimalSumAssociation::MinimalSumAssociation ( )

Definition at line 11 of file MinimalSumAssociation.cxx.

11  : asg::AsgMessaging("MinimalSumAssociation"){
12  msg().setLevel(MSG::DEBUG);
13 }

Member Function Documentation

◆ associate()

IAssociationStrategy::index_assignment_t MinimalSumAssociation::associate ( const std::vector< std::vector< double > > &  matrix)
virtual

Implements IAssociationStrategy.

Definition at line 15 of file MinimalSumAssociation.cxx.

15  {
17  int nrows = matrix.size();
18  int ncols = matrix.at(0).size();
19 
20  auto workmatrix = matrix;
21  //if we have more columns than rows we pad the matrix to make it square
22  if(nrows < ncols){
23  for(int i = (ncols - nrows); i > 0;i--){
24  workmatrix.push_back(std::vector<double>(ncols,0));
25  }
26  }
27 
28  munkres::vec_type costs;
29  costs.reserve(ncols);
30  munkres munk(workmatrix);
31 
32  bool debug = false;
33  auto result = munk.run(costs,debug);
34 
35  //result is indexed by row
36  //i.e. when matrix is matrxi[reco][trig]
37  //it maps reco particle at index i to trig particle at index
38  //result[i]
39  for(int i = 0;i < nrows;++i){
40  resultmap[i] = result[i];
41  }
42 
43  return resultmap;
44 }

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

◆ 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_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
get_generator_info.result
result
Definition: get_generator_info.py:21
munkres
Definition: munkres.h:17
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
IAssociationStrategy::index_assignment_t
std::map< unsigned int, unsigned int > index_assignment_t
Definition: IAssociationStrategy.h:16
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
lumiFormat.i
int i
Definition: lumiFormat.py:92
asg::AsgMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AsgMessaging.cxx:49
munkres::vec_type
std::vector< double > vec_type
Definition: munkres.h:19
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
asg::AsgMessaging
Class mimicking the AthMessaging class from the offline software.
Definition: AsgMessaging.h:40
python.testIfMatch.matrix
matrix
Definition: testIfMatch.py:66
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
DEBUG
#define DEBUG
Definition: page_access.h:11
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7