ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAnalysis
TrigInDetAnalysis
TrigInDetAnalysis
TIDAAssociator.h
Go to the documentation of this file.
1
/* emacs: this is -*- c++ -*- */
10
11
12
#ifndef TIDA_ASSOCIATOR_H
13
#define TIDA_ASSOCIATOR_H
14
15
#include <iostream>
16
#include <vector>
17
#include <string>
18
#include <cmath>
19
#include <map>
20
#include <memory>
21
#include <stdexcept>
22
23
namespace
TIDA
{
24
25
template
<
typename
T,
typename
S=T>
26
class
Associator
{
27
28
public
:
29
30
typedef
std::map<const T*, const S*>
map_type
;
31
typedef
std::map<const S*, const T*>
rmap_type
;
32
33
public
:
34
35
Associator
(
const
std::string& name)
36
:
mname
(name)
37
{ }
38
39
virtual
~Associator
() { }
40
41
virtual
std::unique_ptr<Associator>
uclone
()
const
= 0;
42
43
virtual
void
match
(
const
std::vector<T*>& s1,
44
const
std::vector<S*>& s2 ) = 0;
45
46
// get matched track from map
47
virtual
const
S*
matched
( T* t)
const
{
48
typename
map_type::const_iterator titr =
mmatched
.find(t);
49
if
( titr !=
mmatched
.end() )
return
titr->second;
50
else
return
0;
51
}
52
53
// get matched track from reverse map
54
virtual
const
T*
revmatched
( S* t)
const
{
55
typename
rmap_type::const_iterator titr =
mrevmatched
.find(t);
56
if
( titr !=
mrevmatched
.end() )
return
titr->second;
57
else
return
0;
58
}
59
60
// get the lookup tables
61
const
map_type
&
matched
()
const
{
return
mmatched
; }
62
const
rmap_type
&
revmatched
()
const
{
return
mrevmatched
; }
63
64
// clear the match lookup tables
65
void
clear
() {
mmatched
.clear();
mrevmatched
.clear(); }
66
67
// how many items were matched
68
unsigned
size
()
const
{
return
mmatched
.size(); }
69
70
71
protected
:
72
73
std::string
mname
;
74
75
map_type
mmatched
;
76
rmap_type
mrevmatched
;
77
78
};
79
80
}
81
82
83
84
85
template
<
typename
T,
typename
S>
86
inline
std::ostream&
operator<<
(std::ostream& s,
const
TIDA::Associator<T,S>
&
a
) {
87
typename
TIDA::Associator<T,S>::map_type::const_iterator mitr =
a
.matched().begin();
88
typename
TIDA::Associator<T,S>::map_type::const_iterator mend =
a
.matched().end();
89
90
std::cout <<
"TIDA::Associator size() "
<<
a
.size() << std::endl;
91
92
while
( mitr!=mend ) {
93
s <<
"\t[ "
;
94
if
( mitr->first ) s << *(mitr->first) <<
"\t"
;
95
else
s <<
"-------\t\t"
;
96
97
if
( mitr->second ) s << *(mitr->second);
98
else
s <<
"-------"
;
99
100
s <<
" ]"
<< std::endl;
101
102
++mitr;
103
}
104
105
return
s;
106
}
107
108
109
#endif
// TIDA_ASSOCIATOR_H
110
111
112
113
114
115
116
117
118
119
a
static Double_t a
Definition
LArPhysWaveHECTool.cxx:38
operator<<
std::ostream & operator<<(std::ostream &s, const TIDA::Associator< T, S > &a)
Definition
TIDAAssociator.h:86
TIDA::Associator
Definition
TIDAAssociator.h:26
TIDA::Associator::revmatched
virtual const T * revmatched(S *t) const
Definition
TIDAAssociator.h:54
TIDA::Associator< TIDA::Track >::mmatched
map_type mmatched
Definition
TIDAAssociator.h:75
TIDA::Associator::clear
void clear()
Definition
TIDAAssociator.h:65
TIDA::Associator::map_type
std::map< const T *, const S * > map_type
Definition
TIDAAssociator.h:30
TIDA::Associator::matched
const map_type & matched() const
Definition
TIDAAssociator.h:61
TIDA::Associator< TIDA::Track >::mname
std::string mname
Definition
TIDAAssociator.h:73
TIDA::Associator::uclone
virtual std::unique_ptr< Associator > uclone() const =0
TIDA::Associator::matched
virtual const S * matched(T *t) const
Definition
TIDAAssociator.h:47
TIDA::Associator::size
unsigned size() const
Definition
TIDAAssociator.h:68
TIDA::Associator::revmatched
const rmap_type & revmatched() const
Definition
TIDAAssociator.h:62
TIDA::Associator::match
virtual void match(const std::vector< T * > &s1, const std::vector< S * > &s2)=0
TIDA::Associator< TIDA::Track >::mrevmatched
rmap_type mrevmatched
Definition
TIDAAssociator.h:76
TIDA::Associator::rmap_type
std::map< const S *, const T * > rmap_type
Definition
TIDAAssociator.h:31
TIDA::Associator::~Associator
virtual ~Associator()
Definition
TIDAAssociator.h:39
TIDA::Associator::Associator
Associator(const std::string &name)
Definition
TIDAAssociator.h:35
TIDA
Test for xAOD.
Definition
Filter_AcceptAll.h:22
Generated on
for ATLAS Offline Software by
1.17.0