ATLAS Offline Software
Loading...
Searching...
No Matches
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.
 PhiFilterRange (const PhiFilterRange &range)
 Copy constructor:
 PhiFilterRange (const double min, const double max)
 Constructor with parameters:
virtual ~PhiFilterRange ()
 Destructor:
PhiFilterRangeoperator= (const PhiFilterRange &obj)
 Assignment operator:
double lower () const
 Return the minimum value of the range.
double upper () const
 Return the maximum value of the range.
double getMin () const
 Return the minimum value of the range.
double getMax () const
 Return the maximum value of the range.
bool isInRange (const double point) const
 Const methods:
bool isActive () const
 return Return true if the range is active (optimize parsing of multiple ranges and returning the final decision)
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)
void setRange (const double lower, const double upper)
 Non-const methods:
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.
void includeAll ()
 Set full range (from MINUS_INF to PLUS_INF ).
double precision () const
 Return the double precision for the comparaison of doubles.
double PLUS_INF () const
 Define +infinity according to specific implementation.
double MINUS_INF () const
 Define -infinity according to specific implementation.
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

Protected Attributes

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

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 :
143{}
FilterRange()
Default constructor: it sets the minimum value to -infinity and the maximum value to +infinity.

◆ PhiFilterRange() [2/3]

PhiFilterRange::PhiFilterRange ( const PhiFilterRange & range)

Copy constructor:

Public methods:

Copy constructor

Definition at line 26 of file PhiFilterRange.cxx.

26 :
27 FilterRange( range )
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 :
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}
#define M_PI
#define min(a, b)
Definition cfImp.cxx:40
#define max(a, b)
Definition cfImp.cxx:41
std::optional< interval_t > m_range
The boost interval wrapped by a boost optional.
bool isActive() const
return Return true if the range is active (optimize parsing of multiple ranges and returning the fina...

◆ ~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}
boost::numeric::interval< double > interval_t
double atlasPhi(const double phi) const
Convert a phi angle in the ATLAS conventional range -PI->PI inspired from FourMom package (could also...

◆ 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}
Scalar phi() const
phi method

◆ 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}
double upper() const
Return the maximum value of the range.

◆ 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}
double lower() const
Return the minimum value of the range.

◆ 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}
void addRange(double xMin, double xMax)
add a new range [xmin,xmax] deleting previous ranges full contained

◆ 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}
bool isInRange(const double point) const
return Return true if the point is in range : min <= point <= max

◆ 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}
FilterRange & operator=(const FilterRange &obj)
Assignment operator:

◆ 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}
double m_precision
Setup the wanted double precision.

◆ setMax()

void PhiFilterRange::setMax ( const double maxValue)
inline

Definition at line 219 of file PhiFilterRange.h.

220{
221 return setRange( getMin(), maxValue );
222}
#define maxValue(current, test)
double getMin() const
Return the minimum value of the range.
void setRange(const double lower, const double upper)
Non-const methods:

◆ setMin()

void PhiFilterRange::setMin ( const double minValue)
inline

Definition at line 214 of file PhiFilterRange.h.

215{
216 return setRange( minValue, getMax() );
217}
#define minValue(current, test)
double getMax() const
Return the maximum value of the range.

◆ 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: