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

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

#include <PhiFilterRange.h>

Inheritance diagram for PhiFilterRange:
Collaboration diagram for PhiFilterRange:

Public Member Functions

 PhiFilterRange ()
 Default constructor: it sets the minimum value to -infinity and the maximum value to +infinity. More...
 
 PhiFilterRange (const PhiFilterRange &range)
 Copy constructor: More...
 
 PhiFilterRange (const double min, const double max)
 Constructor with parameters: More...
 
virtual ~PhiFilterRange ()
 Destructor: More...
 
PhiFilterRangeoperator= (const PhiFilterRange &obj)
 Assignment operator: 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...
 
bool isInRange (const double point) const
 Const methods: More...
 
bool isActive () const
 return Return true if the range is active (optimize parsing of multiple ranges and returning the final decision) More...
 
double atlasPhi (const double phi) const
 Convert a phi angle in the ATLAS conventional range -PI->PI inspired from FourMom package (could also use CaloPhiRange) More...
 
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...
 
double precision () const
 Return the double precision for the comparaison of doubles. More...
 
double PLUS_INF () const
 Define +infinity according to specific implementation. More...
 
double MINUS_INF () const
 Define -infinity according to specific implementation. More...
 
void setPrecision (const double delta)
 

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

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

It is a specialisation of FilterRange for the phi angles. It enforces the ATLAS policy for phi angles : \( \phi \in [-\pi,\pi[ \)

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

Definition at line 29 of file PhiFilterRange.h.

Member Typedef Documentation

◆ interval_t

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

Definition at line 142 of file FilterRange.h.

Constructor & Destructor Documentation

◆ PhiFilterRange() [1/3]

PhiFilterRange::PhiFilterRange ( )
inline

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

Inline methods:

Constructors

Definition at line 141 of file PhiFilterRange.h.

141  :
142  FilterRange()
143 {}

◆ PhiFilterRange() [2/3]

PhiFilterRange::PhiFilterRange ( const PhiFilterRange range)

Copy constructor:

Public methods:

Copy constructor

Definition at line 26 of file PhiFilterRange.cxx.

26  :
28 {}

◆ PhiFilterRange() [3/3]

PhiFilterRange::PhiFilterRange ( 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 145 of file PhiFilterRange.h.

145  :
146  FilterRange( min, max )
147 {
148  if ( min == -M_PI && max == +M_PI ) {
149  //std::cout << ">>> You are giving a NO-OP interval : ]"
150  // << min << "; "
151  // << max << "["
152  // << std::endl
153  // << ">>> De-activating this range for optimization purpose."
154  // << std::endl;
155  m_range = std::nullopt;
156  if ( isActive() ) {
157  std::string err = "ERROR : PhiFilterRange is ACTIVE (Should NOT BE !!)";
158  throw err;
159  }
160  } else {
161  // Do nothing : everything is allright
162  }
163 }

◆ ~PhiFilterRange()

PhiFilterRange::~PhiFilterRange ( )
inlinevirtual

Destructor:

Destructor.

Definition at line 167 of file PhiFilterRange.h.

167 {}

Member Function Documentation

◆ addRange()

void PhiFilterRange::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

Take care of inversion of bounds because of the moduli

Definition at line 84 of file PhiFilterRange.cxx.

85 {
87  if ( (xMin == -M_PI && xMax == +M_PI ) ||
88  (xMin == -FLT_MAX && xMax == +FLT_MAX ) ) {
89  m_range = std::nullopt;
90  return;
91  }
92 
94  const double phiMin = atlasPhi( xMin );
95  const double phiMax = atlasPhi( xMax );
96 
97  if ( phiMin < phiMax ) {
98  m_range = interval_t( phiMin, phiMax );
99  } else {
100  m_range = interval_t( phiMax, phiMin );
101  }
102 }

◆ atlasPhi()

double PhiFilterRange::atlasPhi ( const double  phi) const

Convert a phi angle in the ATLAS conventional range -PI->PI inspired from FourMom package (could also use CaloPhiRange)

Definition at line 49 of file PhiFilterRange.cxx.

50 {
51  if ( M_PI == std::fabs(phi) ) {
52  return phi;
53  }
54  if ( FLT_MAX != std::fabs(phi) ) {
55  return std::fmod( phi + 3*M_PI, 2*M_PI ) - M_PI;
56  } else {
57  if ( phi > 0. ) {
58  return M_PI;
59  } else {
60  return -M_PI;
61  }
62  }
63 }

◆ getMax()

double PhiFilterRange::getMax ( ) const
inline

Return the maximum value of the range.

Definition at line 195 of file PhiFilterRange.h.

196 {
197  return upper();
198 }

◆ getMin()

double PhiFilterRange::getMin ( ) const
inline

Return the minimum value of the range.

Definition at line 190 of file PhiFilterRange.h.

191 {
192  return lower();
193 }

◆ include()

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

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

Non-const methods:

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 PhiFilterRange.cxx.

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

◆ includeAll()

void PhiFilterRange::includeAll ( )

Set full range (from MINUS_INF to PLUS_INF ).

Definition at line 75 of file PhiFilterRange.cxx.

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

◆ isActive()

bool PhiFilterRange::isActive ( ) const
inline

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

Definition at line 200 of file PhiFilterRange.h.

201 {
202  if ( m_range ) return true;
203  return false;
204 }

◆ isInRange()

bool PhiFilterRange::isInRange ( const double  point) const

Const methods:

Definition at line 43 of file PhiFilterRange.cxx.

44 {
45  // check if point is in range
46  return FilterRange::isInRange( atlasPhi(point) );
47 }

◆ lower()

double PhiFilterRange::lower ( ) const
inline

Return the minimum value of the range.

Const methods:

Definition at line 172 of file PhiFilterRange.h.

173 {
174  if ( m_range ) {
175  return m_range->lower();
176  }
177 
178  return -M_PI;
179 }

◆ MINUS_INF()

double FilterRange::MINUS_INF ( ) const
inlineinherited

Define -infinity according to specific implementation.

Definition at line 242 of file FilterRange.h.

243 {
244  return -FLT_MAX;
245 }

◆ operator=()

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

Assignment operator:

Assignment operator.

Definition at line 31 of file PhiFilterRange.cxx.

32 {
33  if ( this != &range ) {
35  }
36 
37  return *this;
38 }

◆ PLUS_INF()

double FilterRange::PLUS_INF ( ) const
inlineinherited

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
inlineinherited

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 PhiFilterRange::setMax ( const double  maxValue)
inline

Definition at line 219 of file PhiFilterRange.h.

220 {
221  return setRange( getMin(), maxValue );
222 }

◆ setMin()

void PhiFilterRange::setMin ( const double  minValue)
inline

Definition at line 214 of file PhiFilterRange.h.

215 {
216  return setRange( minValue, getMax() );
217 }

◆ setPrecision()

void FilterRange::setPrecision ( const double  delta)
inlineinherited

Definition at line 256 of file FilterRange.h.

257 {
258  m_precision = delta;
259 }

◆ setRange()

void PhiFilterRange::setRange ( const double  lower,
const double  upper 
)
inline

Non-const methods:

Definition at line 209 of file PhiFilterRange.h.

210 {
211  return addRange( lower, upper );
212 }

◆ upper()

double PhiFilterRange::upper ( ) const
inline

Return the maximum value of the range.

Definition at line 181 of file PhiFilterRange.h.

182 {
183  if ( m_range ) {
184  return m_range->upper();
185  }
186 
187  return +M_PI;
188 }

Member Data Documentation

◆ m_precision

double FilterRange::m_precision
protectedinherited

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
protectedinherited

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::FilterRange
FilterRange()
Default constructor: it sets the minimum value to -infinity and the maximum value to +infinity.
Definition: FilterRange.h:170
FilterRange::isInRange
bool isInRange(const double point) const
return Return true if the point is in range : min <= point <= max
Definition: FilterRange.cxx:45
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
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
M_PI
#define M_PI
Definition: ActiveFraction.h:11
FilterRange::m_precision
double m_precision
Setup the wanted double precision.
Definition: FilterRange.h:151
PhiFilterRange::getMax
double getMax() const
Return the maximum value of the range.
Definition: PhiFilterRange.h:195
PhiFilterRange::getMin
double getMin() const
Return the minimum value of the range.
Definition: PhiFilterRange.h:190
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:193
PhiFilterRange::upper
double upper() const
Return the maximum value of the range.
Definition: PhiFilterRange.h:181
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
PhiFilterRange::atlasPhi
double atlasPhi(const double phi) const
Convert a phi angle in the ATLAS conventional range -PI->PI inspired from FourMom package (could also...
Definition: PhiFilterRange.cxx:49
PhiFilterRange::setRange
void setRange(const double lower, const double upper)
Non-const methods:
Definition: PhiFilterRange.h:209
min
#define min(a, b)
Definition: cfImp.cxx:40
PhiFilterRange::lower
double lower() const
Return the minimum value of the range.
Definition: PhiFilterRange.h:172
FilterRange::operator=
FilterRange & operator=(const FilterRange &obj)
Assignment operator:
Definition: FilterRange.cxx:32
PhiFilterRange::addRange
void addRange(double xMin, double xMax)
add a new range [xmin,xmax] deleting previous ranges full contained
Definition: PhiFilterRange.cxx:84
minValue
#define minValue(current, test)
Definition: CompoundLayerMaterialCreator.h:21
PhiFilterRange::isActive
bool isActive() const
return Return true if the range is active (optimize parsing of multiple ranges and returning the fina...
Definition: PhiFilterRange.h:200