CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CommutativePairs< T > Class Template Reference

#include <CommutativePairs.h>

Public Member Functions

void concatenate (CommutativePairs< T > const &other)
 Add the pairs from another CommutativePairs to this. More...
 
bool contains (T const &a) const
 
bool contains (T const &a, T const &b) const
 
void insert (T const &a, T const &b)
 

Private Attributes

std::vector< std::pair< T, T > > pairs_
 

Detailed Description

template<class T>
class CommutativePairs< T >

Wrapper around std::vector<std::pair<T, T>> when the order of the pair elements is not relevant.

Template Parameters
Tthe type of data stored in the pairs

Definition at line 14 of file CommutativePairs.h.

Member Function Documentation

◆ concatenate()

template<class T>
void CommutativePairs< T >::concatenate ( CommutativePairs< T > const &  other)
inline

Add the pairs from another CommutativePairs to this.

Definition at line 40 of file CommutativePairs.h.

40  {
41  pairs_.insert(pairs_.end(), other.pairs_.begin(), other.pairs_.end());
42  }

Referenced by PFEGammaAlgo::mergeROsByAnyLink().

◆ contains() [1/2]

template<class T>
bool CommutativePairs< T >::contains ( T const &  a) const
inline

Definition at line 30 of file CommutativePairs.h.

30  {
31  for (auto const& p : pairs_) {
32  if (a == p.first || a == p.second) {
33  return true;
34  }
35  }
36  return false;
37  }

◆ contains() [2/2]

template<class T>
bool CommutativePairs< T >::contains ( T const &  a,
T const &  b 
) const
inline

Definition at line 20 of file CommutativePairs.h.

20  {
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  }

Referenced by PFEGammaAlgo::calculateEleMVA(), PFEGammaAlgo::unlinkRefinableObjectKFandECALMatchedToHCAL(), and PFEGammaAlgo::unlinkRefinableObjectKFandECALWithBadEoverP().

◆ insert()

template<class T>
void CommutativePairs< T >::insert ( T const &  a,
T const &  b 
)
inline

Member Data Documentation

◆ pairs_

template<class T>
std::vector<std::pair<T, T> > CommutativePairs< T >::pairs_
private
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::pairs_
std::vector< std::pair< T, T > > pairs_
Definition: CommutativePairs.h:45