RecoParticleFlow
PFProducer
interface
CommutativePairs.h
Go to the documentation of this file.
1
#ifndef RecoParticleFlow_PFProducer_CommutativePairs_h
2
#define RecoParticleFlow_PFProducer_CommutativePairs_h
3
4
#include <utility>
5
#include <vector>
6
13
template
<
class
T>
14
class
CommutativePairs
{
15
public
:
16
// Insert a new pair
17
void
insert
(
T
const
&
a
,
T
const
&
b
) {
pairs_
.emplace_back(
a
,
b
); }
18
19
// Check if this contains (a,b) or (b,a)
20
bool
contains
(
T
const
&
a
,
T
const
&
b
)
const
{
21
for
(
auto
const
&
p
:
pairs_
) {
22
if
((
a
==
p
.first &&
b
==
p
.second) || (
b
==
p
.first &&
a
==
p
.second)) {
23
return
true
;
24
}
25
}
26
return
false
;
27
}
28
29
// Check if this contains (a,b) or (b,a), where b is arbitrary
30
bool
contains
(
T
const
&
a
)
const
{
31
for
(
auto
const
&
p
:
pairs_
) {
32
if
(
a
==
p
.first ||
a
==
p
.second) {
33
return
true
;
34
}
35
}
36
return
false
;
37
}
38
40
void
concatenate
(
CommutativePairs<T>
const
&
other
) {
41
pairs_
.insert(
pairs_
.end(),
other
.pairs_.begin(),
other
.pairs_.end());
42
}
43
44
private
:
45
std::vector<std::pair<T, T>>
pairs_
;
46
};
47
48
#endif
CommutativePairs::contains
bool contains(T const &a, T const &b) const
Definition:
CommutativePairs.h:20
CommutativePairs::contains
bool contains(T const &a) const
Definition:
CommutativePairs.h:30
CommutativePairs
Definition:
CommutativePairs.h:14
CommutativePairs::concatenate
void concatenate(CommutativePairs< T > const &other)
Add the pairs from another CommutativePairs to this.
Definition:
CommutativePairs.h:40
trackingPlots.other
other
Definition:
trackingPlots.py:1464
b
double b
Definition:
hdecay.h:118
a
double a
Definition:
hdecay.h:119
AlCaHLTBitMon_ParallelJobs.p
def p
Definition:
AlCaHLTBitMon_ParallelJobs.py:153
CommutativePairs::insert
void insert(T const &a, T const &b)
Definition:
CommutativePairs.h:17
CommutativePairs::pairs_
std::vector< std::pair< T, T > > pairs_
Definition:
CommutativePairs.h:45
T
long double T
Definition:
Basic3DVectorLD.h:48
Generated for CMSSW Reference Manual by
1.8.16