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 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 interval wrapped by a std::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[ \)

Definition at line 26 of file PhiFilterRange.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 138 of file PhiFilterRange.h.

138 :
140{}
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 23 of file PhiFilterRange.cxx.

23 :
24 FilterRange( range )
25{}

◆ 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 142 of file PhiFilterRange.h.

142 :
144{
145 if ( min == -M_PI && max == +M_PI ) {
146 //std::cout << ">>> You are giving a NO-OP interval : ]"
147 // << min << "; "
148 // << max << "["
149 // << std::endl
150 // << ">>> De-activating this range for optimization purpose."
151 // << std::endl;
152 m_range = std::nullopt;
153 if ( isActive() ) {
154 std::string err = "ERROR : PhiFilterRange is ACTIVE (Should NOT BE !!)";
155 throw err;
156 }
157 } else {
158 // Do nothing : everything is allright
159 }
160}
#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 interval wrapped by a std::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 164 of file PhiFilterRange.h.

164{}

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 81 of file PhiFilterRange.cxx.

82{
84 if ( (xMin == -M_PI && xMax == +M_PI ) ||
85 (xMin == -FLT_MAX && xMax == +FLT_MAX ) ) {
86 m_range = std::nullopt;
87 return;
88 }
89
91 const double phiMin = atlasPhi( xMin );
92 const double phiMax = atlasPhi( xMax );
93
94 if ( phiMin < phiMax ) {
95 m_range = interval_t( phiMin, phiMax );
96 } else {
97 m_range = interval_t( phiMax, phiMin );
98 }
99}
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 46 of file PhiFilterRange.cxx.

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

◆ getMax()

double PhiFilterRange::getMax ( ) const
inline

Return the maximum value of the range.

Definition at line 192 of file PhiFilterRange.h.

193{
194 return upper();
195}
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 187 of file PhiFilterRange.h.

188{
189 return lower();
190}
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 65 of file PhiFilterRange.cxx.

66{
69 addRange(xMin,xMax);
70}
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 72 of file PhiFilterRange.cxx.

73{
74 m_range = std::nullopt;
75 return;
76}

◆ 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 197 of file PhiFilterRange.h.

198{
199 if ( m_range ) return true;
200 return false;
201}

◆ isInRange()

bool PhiFilterRange::isInRange ( const double point) const

Const methods:

Definition at line 40 of file PhiFilterRange.cxx.

41{
42 // check if point is in range
43 return FilterRange::isInRange( atlasPhi(point) );
44}
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 169 of file PhiFilterRange.h.

170{
171 if ( m_range ) {
172 return m_range->lower();
173 }
174
175 return -M_PI;
176}

◆ MINUS_INF()

double FilterRange::MINUS_INF ( ) const
inlineinherited

Define -infinity according to specific implementation.

Definition at line 238 of file FilterRange.h.

239{
240 return -FLT_MAX;
241}

◆ operator=()

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

Assignment operator:

Assignment operator.

Definition at line 28 of file PhiFilterRange.cxx.

29{
30 if ( this != &range ) {
32 }
33
34 return *this;
35}
FilterRange & operator=(const FilterRange &obj)
Assignment operator:

◆ PLUS_INF()

double FilterRange::PLUS_INF ( ) const
inlineinherited

Define +infinity according to specific implementation.

Definition at line 233 of file FilterRange.h.

234{
235 return FLT_MAX;
236}

◆ precision()

double FilterRange::precision ( ) const
inlineinherited

Return the double precision for the comparaison of doubles.

Definition at line 200 of file FilterRange.h.

201{
202 return m_precision;
203}
double m_precision
Setup the wanted double precision.

◆ setMax()

void PhiFilterRange::setMax ( const double maxValue)
inline

Definition at line 216 of file PhiFilterRange.h.

217{
218 return setRange( getMin(), maxValue );
219}
#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 211 of file PhiFilterRange.h.

212{
213 return setRange( minValue, getMax() );
214}
#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 252 of file FilterRange.h.

253{
254 m_precision = delta;
255}

◆ setRange()

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

Non-const methods:

Definition at line 206 of file PhiFilterRange.h.

207{
208 return addRange( lower, upper );
209}

◆ upper()

double PhiFilterRange::upper ( ) const
inline

Return the maximum value of the range.

Definition at line 178 of file PhiFilterRange.h.

179{
180 if ( m_range ) {
181 return m_range->upper();
182 }
183
184 return +M_PI;
185}

Member Data Documentation

◆ m_precision

double FilterRange::m_precision
protectedinherited

Setup the wanted double precision.

Default = 1e-6

Definition at line 147 of file FilterRange.h.

◆ m_range

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

The interval wrapped by a std::optional.

This is to allow the instantiation of uninitialised ranges

Definition at line 143 of file FilterRange.h.


The documentation for this class was generated from the following files: