ATLAS Offline Software
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
FilterRange Class Reference

FilterRange implements the range (ie: [min, max]) the filters will use to take their filtering decisions. More...

#include <FilterRange.h>

Inheritance diagram for FilterRange:
Collaboration diagram for FilterRange:

Public Member Functions

 FilterRange ()
 Default constructor: it sets the minimum value to -infinity and the maximum value to +infinity. More...
 
 FilterRange (const FilterRange &range)
 Copy constructor: More...
 
 FilterRange (const double min, const double max)
 Constructor with parameters: More...
 
virtual ~FilterRange ()
 Destructor: More...
 
FilterRangeoperator= (const FilterRange &obj)
 Assignment operator: More...
 
double precision () const
 Return the double precision for the comparaison of doubles. More...
 
double lower () const
 Return the minimum value of the range. More...
 
double upper () const
 Return the maximum value of the range. More...
 
double getMin () const
 Return the minimum value of the range. More...
 
double getMax () const
 Return the maximum value of the range. More...
 
double PLUS_INF () const
 Define +infinity according to specific implementation. More...
 
double MINUS_INF () const
 Define -infinity according to specific implementation. More...
 
bool isInRange (const double point) const
 return Return true if the point is in range : min <= point <= max More...
 
bool isActive () const
 return Return true if the range is active (optimize parsing of multiple ranges and returning the final decision) More...
 
void setPrecision (const double delta)
 
void setRange (const double lower, const double upper)
 Non-const methods:
More...
 
void setMin (const double minValue)
 
void setMax (const double maxValue)
 
void include (const double xMin, const double xMax)
 Add [xMin, xMax] interval to existing set of valid ranges. More...
 
void includeAll ()
 Set full range (from MINUS_INF to PLUS_INF ). More...
 

Protected Types

typedef boost::numeric::interval< double > interval_t
 

Protected Member Functions

void addRange (double xMin, double xMax)
 add a new range [xmin,xmax] deleting previous ranges full contained More...
 

Protected Attributes

std::optional< interval_tm_range
 The boost interval wrapped by a boost optional. More...
 
double m_precision
 Setup the wanted double precision. More...
 

Detailed Description

FilterRange implements the range (ie: [min, max]) the filters will use to take their filtering decisions.

Internally it uses the Boost class interval but maybe one could use a SEAL class (FML/RangeSet or FML/Bound)

Definition at line 34 of file FilterRange.h.

Member Typedef Documentation

◆ interval_t

typedef boost::numeric::interval<double> FilterRange::interval_t
protected

Definition at line 142 of file FilterRange.h.

Constructor & Destructor Documentation

◆ FilterRange() [1/3]

FilterRange::FilterRange ( )
inline

Default constructor: it sets the minimum value to -infinity and the maximum value to +infinity.

Inline methods:

Constructors

Definition at line 170 of file FilterRange.h.

170  :
171  m_range(std::nullopt),
172  m_precision(1e-6)
173 {}

◆ FilterRange() [2/3]

FilterRange::FilterRange ( const FilterRange range)

Copy constructor:

Public methods:

Copy constructor

Definition at line 26 of file FilterRange.cxx.

26  :
27  m_range( range.m_range ),
28  m_precision( range.m_precision )
29 {}

◆ FilterRange() [3/3]

FilterRange::FilterRange ( const double  min,
const double  max 
)
inline

Constructor with parameters:

Parameters
min: the minimum value of the range
max: the maximum value of the range

Definition at line 175 of file FilterRange.h.

175  :
176  m_range( interval_t(min, max) ),
177  m_precision(1e-6)
178 {
179  if ( min == MINUS_INF() && max == PLUS_INF() ) {
180  //std::cout << ">>> You are giving a NO-OP interval : ]"
181  // << min << "; "
182  // << max << "["
183  // << std::endl
184  // << ">>> De-activating this range for optimization purpose."
185  // << std::endl;
186  m_range = std::nullopt;
187  if ( isActive() ) {
188  std::string error = "ERROR : FilterRange is ACTIVE (Should NOT BE !!)";
189  std::cerr << error << std::endl;
190  throw error;
191  }
192  } else {
193  // Do nothing : everything is allright
194  }
195 }

◆ ~FilterRange()

FilterRange::~FilterRange ( )
inlinevirtual

Destructor:

Definition at line 199 of file FilterRange.h.

199 {}

Member Function Documentation

◆ addRange()

void FilterRange::addRange ( double  xMin,
double  xMax 
)
protected

add a new range [xmin,xmax] deleting previous ranges full contained

Special case where one adds a no-op interval

Definition at line 84 of file FilterRange.cxx.

85 {
87  if ( xMin == MINUS_INF() && xMax == PLUS_INF() ) {
88  m_range = std::nullopt;
89  return;
90  }
91 
92  m_range = interval_t( xMin, xMax );
93 }

◆ getMax()

double FilterRange::getMax ( ) const
inline

Return the maximum value of the range.

Definition at line 232 of file FilterRange.h.

233 {
234  return upper();
235 }

◆ getMin()

double FilterRange::getMin ( ) const
inline

Return the minimum value of the range.

Definition at line 227 of file FilterRange.h.

228 {
229  return lower();
230 }

◆ include()

void FilterRange::include ( const double  xMin,
const double  xMax 
)

Add [xMin, xMax] interval to existing set of valid ranges.

Parameters
xMin- lower bound of a new valid range
xMax- upper bound of a new valid range

Reset the whole range : this is temporary, just to mimic FML::RangeSet API

Definition at line 68 of file FilterRange.cxx.

69 {
72  addRange(xMin,xMax);
73 }

◆ includeAll()

void FilterRange::includeAll ( )

Set full range (from MINUS_INF to PLUS_INF ).

Definition at line 75 of file FilterRange.cxx.

76 {
77  m_range = std::nullopt;
78  return;
79 }

◆ isActive()

bool FilterRange::isActive ( ) const
inline

return Return true if the range is active (optimize parsing of multiple ranges and returning the final decision)

Definition at line 247 of file FilterRange.h.

248 {
249  if ( m_range ) return true;
250  return false;
251 }

◆ isInRange()

bool FilterRange::isInRange ( const double  point) const

return Return true if the point is in range : min <= point <= max

Const methods:

Definition at line 45 of file FilterRange.cxx.

46 {
47  // check if point is in range
48  if ( ( ( lower() - point ) <= +m_precision ) &&
49  ( ( upper() - point ) >= -m_precision ) ) return true;
50  return false;
51 }

◆ lower()

double FilterRange::lower ( ) const
inline

Return the minimum value of the range.

Definition at line 209 of file FilterRange.h.

210 {
211  if ( m_range ) {
212  return m_range->lower();
213  }
214 
215  return MINUS_INF();
216 }

◆ MINUS_INF()

double FilterRange::MINUS_INF ( ) const
inline

Define -infinity according to specific implementation.

Definition at line 242 of file FilterRange.h.

243 {
244  return -FLT_MAX;
245 }

◆ operator=()

FilterRange & FilterRange::operator= ( const FilterRange obj)

Assignment operator:

Assignment operator.

Definition at line 32 of file FilterRange.cxx.

33 {
34  if ( this != &range ) {
35  m_range = interval_t( range.lower(), range.upper() );
36  m_precision = range.m_precision;
37  }
38 
39  return *this;
40 }

◆ PLUS_INF()

double FilterRange::PLUS_INF ( ) const
inline

Define +infinity according to specific implementation.

Definition at line 237 of file FilterRange.h.

238 {
239  return FLT_MAX;
240 }

◆ precision()

double FilterRange::precision ( ) const
inline

Return the double precision for the comparaison of doubles.

Definition at line 204 of file FilterRange.h.

205 {
206  return m_precision;
207 }

◆ setMax()

void FilterRange::setMax ( const double  maxValue)
inline

Definition at line 266 of file FilterRange.h.

267 {
268  return setRange( getMin(), maxValue );
269 }

◆ setMin()

void FilterRange::setMin ( const double  minValue)
inline

Definition at line 261 of file FilterRange.h.

262 {
263  return setRange( minValue, getMax() );
264 }

◆ setPrecision()

void FilterRange::setPrecision ( const double  delta)
inline

Definition at line 256 of file FilterRange.h.

257 {
258  m_precision = delta;
259 }

◆ setRange()

void FilterRange::setRange ( const double  lower,
const double  upper 
)

Non-const methods:

Special case where one adds a no-op interval

Now handle the normal cases

Definition at line 56 of file FilterRange.cxx.

57 {
59  if ( lower == MINUS_INF() && upper == PLUS_INF() ) {
60  m_range = std::nullopt;
61  return;
62  }
63 
66 }

◆ upper()

double FilterRange::upper ( ) const
inline

Return the maximum value of the range.

Definition at line 218 of file FilterRange.h.

219 {
220  if ( m_range ) {
221  return m_range->upper();
222  }
223 
224  return PLUS_INF();
225 }

Member Data Documentation

◆ m_precision

double FilterRange::m_precision
protected

Setup the wanted double precision.

Default = 1e-6

Definition at line 151 of file FilterRange.h.

◆ m_range

std::optional<interval_t> FilterRange::m_range
protected

The boost interval wrapped by a boost optional.

This is to allow the instantiation of uninitialised ranges

Definition at line 147 of file FilterRange.h.


The documentation for this class was generated from the following files:
FilterRange::MINUS_INF
double MINUS_INF() const
Define -infinity according to specific implementation.
Definition: FilterRange.h:242
FilterRange::isActive
bool isActive() const
return Return true if the range is active (optimize parsing of multiple ranges and returning the fina...
Definition: FilterRange.h:247
FilterRange::interval_t
boost::numeric::interval< double > interval_t
Definition: FilterRange.h:142
FilterRange::m_range
std::optional< interval_t > m_range
The boost interval wrapped by a boost optional.
Definition: FilterRange.h:147
maxValue
#define maxValue(current, test)
Definition: CompoundLayerMaterialCreator.h:22
max
#define max(a, b)
Definition: cfImp.cxx:41
FilterRange::getMax
double getMax() const
Return the maximum value of the range.
Definition: FilterRange.h:232
FilterRange::m_precision
double m_precision
Setup the wanted double precision.
Definition: FilterRange.h:151
FilterRange::PLUS_INF
double PLUS_INF() const
Define +infinity according to specific implementation.
Definition: FilterRange.h:237
FilterRange::getMin
double getMin() const
Return the minimum value of the range.
Definition: FilterRange.h:227
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
FilterRange::setRange
void setRange(const double lower, const double upper)
Non-const methods:
Definition: FilterRange.cxx:56
min
#define min(a, b)
Definition: cfImp.cxx:40
FilterRange::addRange
void addRange(double xMin, double xMax)
add a new range [xmin,xmax] deleting previous ranges full contained
Definition: FilterRange.cxx:84
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
get_generator_info.error
error
Definition: get_generator_info.py:40
error
Definition: IImpactPoint3dEstimator.h:70
minValue
#define minValue(current, test)
Definition: CompoundLayerMaterialCreator.h:21
FilterRange::lower
double lower() const
Return the minimum value of the range.
Definition: FilterRange.h:209
FilterRange::upper
double upper() const
Return the maximum value of the range.
Definition: FilterRange.h:218