ATLAS Offline Software
Functions
FilterRange.cxx File Reference
#include <cmath>
#include <boost/numeric/interval/compare/explicit.hpp>
#include "AnalysisUtils/FilterRange.h"
Include dependency graph for FilterRange.cxx:

Go to the source code of this file.

Functions

bool operator== (const FilterRange &r1, const FilterRange &r2)
 
bool operator!= (const FilterRange &r1, const FilterRange &r2)
 
bool operator< (const FilterRange &r1, const FilterRange &r2)
 
bool operator>= (const FilterRange &r1, const FilterRange &r2)
 
bool operator> (const FilterRange &r1, const FilterRange &r2)
 
bool operator<= (const FilterRange &r1, const FilterRange &r2)
 

Function Documentation

◆ operator!=()

bool operator!= ( const FilterRange r1,
const FilterRange r2 
)

Definition at line 114 of file FilterRange.cxx.

115 {
116  return !( operator==(r1,r2));
117 }

◆ operator<()

bool operator< ( const FilterRange r1,
const FilterRange r2 
)

!isActive <==> range= [-inf, +inf]

Definition at line 119 of file FilterRange.cxx.

120 {
121  if ( r1.isActive() != r2.isActive() ) {
123  if ( r2.isActive() ) {
124  // case r1 = [-inf, +inf] and r2 = [a,b]
125  return false;
126  } else {
127  // case r1 = [a, b] and r2 = [-inf, +inf]
128  return true;
129  }
130  }
131 
132  if ( false == r1.isActive() &&
133  false == r2.isActive() ) {
134  return false;
135  }
136 
137  return ( r1.upper() < r2.lower() );
138 }

◆ operator<=()

bool operator<= ( const FilterRange r1,
const FilterRange r2 
)

Definition at line 166 of file FilterRange.cxx.

167 {
168  return !( operator>(r1,r2) );
169 }

◆ operator==()

bool operator== ( const FilterRange r1,
const FilterRange r2 
)

Definition at line 98 of file FilterRange.cxx.

99 {
100  if ( r1.isActive() != r2.isActive() ) {
101  return false;
102  }
103 
104  if ( false == r1.isActive() &&
105  false == r2.isActive() ) {
106  return true;
107  }
108  const double precision = std::min( r1.precision(), r2.precision() );
109 
110  return ( ( std::fabs(r1.lower() - r2.lower()) <= precision ) &&
111  ( std::fabs(r1.upper() - r2.upper()) <= precision ) );
112 }

◆ operator>()

bool operator> ( const FilterRange r1,
const FilterRange r2 
)

!isActive <==> range= [-inf, +inf]

Definition at line 145 of file FilterRange.cxx.

146 {
147  if ( r1.isActive() != r2.isActive() ) {
149  if ( r2.isActive() ) {
150  // case r1 = [-inf, +inf] and r2 = [a,b]
151  return true;
152  } else {
153  // case r1 = [a, b] and r2 = [-inf, +inf]
154  return false;
155  }
156  }
157 
158  if ( false == r1.isActive() &&
159  false == r2.isActive() ) {
160  return false;
161  }
162 
163  return ( r1.lower() > r2.upper() );
164 }

◆ operator>=()

bool operator>= ( const FilterRange r1,
const FilterRange r2 
)

Definition at line 140 of file FilterRange.cxx.

141 {
142  return !( operator<(r1,r2) );
143 }
operator==
bool operator==(const FilterRange &r1, const FilterRange &r2)
Definition: FilterRange.cxx:98
MCP::ScaleSmearParam::r2
@ r2
operator<
bool operator<(const FilterRange &r1, const FilterRange &r2)
Definition: FilterRange.cxx:119
operator>
bool operator>(const FilterRange &r1, const FilterRange &r2)
Definition: FilterRange.cxx:145
min
#define min(a, b)
Definition: cfImp.cxx:40
MCP::ScaleSmearParam::r1
@ r1