ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAnalysis
TriggerMatchingTool
Root
MinimalSumAssociation.cxx
Go to the documentation of this file.
1
// Dear emacs, this is -*- c++ -*-
2
3
/*
4
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
#include "
MinimalSumAssociation.h
"
8
#include "
munkres.h
"
9
10
11
MinimalSumAssociation::MinimalSumAssociation
() :
asg
::
AsgMessaging
(
"MinimalSumAssociation"
){
12
msg
().setLevel(MSG::DEBUG);
13
}
14
15
IAssociationStrategy::index_assignment_t
MinimalSumAssociation::associate
(
const
std::vector<std::vector<double> >& matrix){
16
IAssociationStrategy::index_assignment_t
resultmap;
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(std::move(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
}
debug
const bool debug
Definition
MakeUncertaintyPlots.cxx:53
MinimalSumAssociation.h
IAssociationStrategy::index_assignment_t
std::map< unsigned int, unsigned int > index_assignment_t
Definition
IAssociationStrategy.h:16
MinimalSumAssociation::associate
index_assignment_t associate(const std::vector< std::vector< double > > &matrix)
Definition
MinimalSumAssociation.cxx:15
MinimalSumAssociation::MinimalSumAssociation
MinimalSumAssociation()
Definition
MinimalSumAssociation.cxx:11
asg::AsgMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition
AsgMessaging.cxx:49
asg::AsgMessaging::AsgMessaging
AsgMessaging(const std::string &name)
Constructor with a name.
Definition
AsgMessaging.cxx:17
munkres
Definition
munkres.h:17
munkres::run
result_type run(vec_type &costvector, bool debug=false)
Definition
munkres.cxx:20
munkres::vec_type
std::vector< double > vec_type
Definition
munkres.h:19
munkres.h
asg
Definition
DataHandleTestTool.h:28
Generated on
for ATLAS Offline Software by
1.17.0