Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Acts::Range1D< Type > Class Template Reference

A one-dimensional range between two points. More...

#include <acts/blob/sPHENIX/Core/include/Acts/Utilities/Range1D.hpp>

Public Member Functions

 Range1D ()
 Construct a new degenerate range object.
 
 Range1D (Type min, Type max)
 Construct a new range object from a lower and upper bound.
 
 Range1D (const std::pair< Type, Type > &p)
 Construct a new range object from a pair of bounds.
 
 Range1D (const Range1D< Type > &o)
 Construct a new range object from an existing range.
 
void setMin (const Type &v)
 Set the minimum value.
 
void setMax (const Type &v)
 Set the maximum value.
 
void set (const Type &min, const Type &max)
 Set the minimum and maximum value.
 
void shrinkMin (const Type &v)
 Shrink a range by increasing the minimum value.
 
void shrinkMax (const Type &v)
 Shrink a range by decreasing the maximum value.
 
void shrink (const Type &min, const Type &max)
 Shrink a range on both ends.
 
void expandMin (const Type &v)
 Expand a range by decreasing the minimum value.
 
void expandMax (const Type &v)
 Expand a range by increasing the maximum value.
 
void expand (const Type &min, const Type &max)
 Expand a range on both ends.
 
Type min (void) const
 Return the minimum value of the range (inclusive)
 
Type max (void) const
 Return the maximum value of the range (inclusive)
 
Type size (void) const
 Compute the size of the range.
 
bool degenerate (void) const
 Determine if this range is degenerate or not.
 
bool contains (const Type &v) const
 Determine if the range contains a given value.
 
bool operator&& (const Range1D< Type > &o) const
 Determine whether the range intersects another range.
 
bool operator== (const Range1D< Type > &o) const
 Determine whether the range is equal to another range.
 
bool operator<= (const Range1D< Type > &o) const
 Determine whether the left-hand range is a subset of the right-hand range.
 
bool operator>= (const Range1D< Type > &o) const
 Determine whether the left-hand range is a superset of the right-hand range.
 
Range1D< Type > & operator= (const Range1D< Type > &o)
 Assignment operator.
 
Range1D< Type > operator& (const Range1D< Type > &o) const
 Compute the intersection of two ranges.
 
Range1D< Type > & operator&= (const Range1D< Type > &o)
 Set the range to the intersection of itself and another range.
 

Private Attributes

Type m_min
 
Type m_max
 

Detailed Description

template<typename Type>
class Acts::Range1D< Type >

A one-dimensional range between two points.

This type describes a one-demensional range of values, designed to be used in the construction of more complex multi-dimensional types. The class provides functionality for growing and shrinking the range, as well as some other utilities. These ranges are half-open, including the minimum but excluding the maximum.

Template Parameters
TypeThe scalar type of the values contained in this range.

Definition at line 25 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 25 of file Range1D.hpp

Constructor & Destructor Documentation

template<typename Type>
Acts::Range1D< Type >::Range1D ( )
inline

Construct a new degenerate range object.

This constructor coonstructs a degenerate range object with a maximum lower than the minimum. In other words, this range is empty.

Definition at line 31 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 31 of file Range1D.hpp

template<typename Type>
Acts::Range1D< Type >::Range1D ( Type  min,
Type  max 
)
inline

Construct a new range object from a lower and upper bound.

Construct a new range object given the values for the minimum and maximum. Note that it is perfectly possible to construct a degenerate range in this way.

Parameters
minThe minimum value in the range (inclusive)
maxThe maximum value in the range (exclusive)

Definition at line 43 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 43 of file Range1D.hpp

template<typename Type>
Acts::Range1D< Type >::Range1D ( const std::pair< Type, Type > &  p)
inline

Construct a new range object from a pair of bounds.

Construct a new range object from a pair of values, the first of which is taken to be the minimum, and the second of which is taken to be the maximum.

Parameters
pThe pair of values to use as the minimum and maximum

Definition at line 52 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 52 of file Range1D.hpp

template<typename Type>
Acts::Range1D< Type >::Range1D ( const Range1D< Type > &  o)
inline

Construct a new range object from an existing range.

This simply copies the values from the existing range to the new one. It's the copy constructor.

Parameters
oThe range to copy

Definition at line 60 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 60 of file Range1D.hpp

Member Function Documentation

template<typename Type>
bool Acts::Range1D< Type >::contains ( const Type &  v) const
inline

Determine if the range contains a given value.

A value is inside a range if and only if it is greater than the minimum and smaller than the maximum.

Parameters
vThe value to check
Returns
true The value is inside the range
false The value is not inside the range

Definition at line 212 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 212 of file Range1D.hpp

Referenced by Acts::Test::BOOST_AUTO_TEST_CASE().

+ Here is the caller graph for this function:

template<typename Type>
bool Acts::Range1D< Type >::degenerate ( void  ) const
inline

Determine if this range is degenerate or not.

A degenerate range has a minimum higher than the maximum, and thus cannot contain any values.

Returns
true The range is degenerate and has size zero
false The range is not degenerate

Definition at line 201 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 201 of file Range1D.hpp

Referenced by Acts::Test::BOOST_AUTO_TEST_CASE().

+ Here is the caller graph for this function:

template<typename Type>
void Acts::Range1D< Type >::expand ( const Type &  min,
const Type &  max 
)
inline

Expand a range on both ends.

Expand a range by decreasing the minimum value as well as increasing the maximum value. If either of the values are already larger or smaller (respectively) than the proposed values, then that particular boundary of the interval is not expanded.

Note
After this operation, the range is always equal to or larger than [min, max].
Parameters
minThe proposed new minimum for the range
maxThe proposed new maximum for the range

Definition at line 167 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 167 of file Range1D.hpp

Referenced by Acts::Test::BOOST_AUTO_TEST_CASE().

+ Here is the caller graph for this function:

template<typename Type>
void Acts::Range1D< Type >::expandMax ( const Type &  v)
inline

Expand a range by increasing the maximum value.

Expand the range by increasing the maximum value. If the given value is smaller than the current maximum (in other words, if the proposed new range would be smaller than the current range), this is a no-op.

Parameters
vThe proposed new maximum for the range

Definition at line 153 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 153 of file Range1D.hpp

Referenced by Acts::Test::BOOST_AUTO_TEST_CASE(), and Acts::Range1D< ActsScalar >::expand().

+ Here is the caller graph for this function:

template<typename Type>
void Acts::Range1D< Type >::expandMin ( const Type &  v)
inline

Expand a range by decreasing the minimum value.

Expand the range by decreasing the minimum value. If the given value is larger than the current minimum (in other words, if the proposed new range would be smaller than the current range), this is a no-op.

Parameters
vThe proposed new minimum for the range

Definition at line 144 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 144 of file Range1D.hpp

Referenced by Acts::Test::BOOST_AUTO_TEST_CASE(), Acts::Range1D< ActsScalar >::expand(), and Acts::Polyhedron::extent().

+ Here is the caller graph for this function:

template<typename Type>
Range1D<Type> Acts::Range1D< Type >::operator& ( const Range1D< Type > &  o) const
inline

Compute the intersection of two ranges.

The intersection of two ranges is the range containing all values contained in both ranges. If the two ranges do not intersect, the intersection is a degenerate range. This operation is commutative.

Parameters
oThe range to compute the intersection with
Returns
The intersection range between the two ranges

Definition at line 300 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 300 of file Range1D.hpp

template<typename Type>
bool Acts::Range1D< Type >::operator&& ( const Range1D< Type > &  o) const
inline

Determine whether the range intersects another range.

The intersection of a range is the space where both ranges overlap. If the ranges overlap at all, they are said to intersect. This operation is commutative.

Parameters
oThe other range to check
Returns
true The ranges intersect
false The ranges do not intersect

Definition at line 224 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 224 of file Range1D.hpp

template<typename Type>
Range1D<Type>& Acts::Range1D< Type >::operator&= ( const Range1D< Type > &  o)
inline

Set the range to the intersection of itself and another range.

This is an assignment version of operator&, which updates the range on which it is called to ensure that the new range is the intersection of the old range and the new range.

Parameters
oThe range to compute the intersection with
Returns
This object

Definition at line 313 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 313 of file Range1D.hpp

template<typename Type>
bool Acts::Range1D< Type >::operator<= ( const Range1D< Type > &  o) const
inline

Determine whether the left-hand range is a subset of the right-hand range.

A range is a subset of another range if and only if all values contained in the first range are also contained in the second range.

Parameters
oThe other range to check
Returns
true The left-hand range is a subset of the right-hand range
false The left-hand range is not a subset of the right-hand range

Definition at line 256 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 256 of file Range1D.hpp

template<typename Type>
Range1D<Type>& Acts::Range1D< Type >::operator= ( const Range1D< Type > &  o)
inline

Assignment operator.

Copy the right-hand range into the left-hand range, which means setting the minimum and maximum to equal the minimum and maximum of the right-hand side.

Parameters
oThe range of values to copy
Returns
This range

Definition at line 284 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 284 of file Range1D.hpp

template<typename Type>
bool Acts::Range1D< Type >::operator== ( const Range1D< Type > &  o) const
inline

Determine whether the range is equal to another range.

Two ranges are equal if and only if their minima and maxima are the same.

Warning
This method relies on the existence of a well-defined notion of equality for the underlying types. Using this method on floating ranges may have unintended effecrs.
Parameters
oThe other range to check
Returns
true The ranges are equal
false The ranges are not equal

Definition at line 241 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 241 of file Range1D.hpp

template<typename Type>
bool Acts::Range1D< Type >::operator>= ( const Range1D< Type > &  o) const
inline

Determine whether the left-hand range is a superset of the right-hand range.

A range is a superset of another range if and only if all values contained in the second range are also contained in the first range.

Parameters
oThe other range to check
Returns
true The left-hand range is a superset of thr right-hand range
false The left-hand range is not a superset of the right-hand range

Definition at line 271 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 271 of file Range1D.hpp

template<typename Type>
void Acts::Range1D< Type >::set ( const Type &  min,
const Type &  max 
)
inline

Set the minimum and maximum value.

Override both the minimum and maximum value of the range, regardless of what they were set to.

Note
If you want to shrink or expand the range, use the shrink and expand methods.
After this operation, the range should be exactly equal to [min, max]
Parameters
minThe new minimum value of the range
maxThe new maximum value of the range

Definition at line 97 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 97 of file Range1D.hpp

Referenced by Acts::Test::BOOST_FIXTURE_TEST_CASE(), Acts::DD4hepLayerBuilder::centralLayers(), Acts::DD4hepLayerBuilder::endcapLayers(), Acts::Polyhedron::extent(), and Acts::Extent::set().

+ Here is the caller graph for this function:

template<typename Type>
void Acts::Range1D< Type >::setMax ( const Type &  v)
inline

Set the maximum value.

Override the maximum value of the range, regardless of what was already set.

Note
If you want to shrink or expand the range, use the shrink and expand methods.
Parameters
vThe value to use as the new maximum

Definition at line 82 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 82 of file Range1D.hpp

Referenced by Acts::Test::BOOST_AUTO_TEST_CASE(), and Acts::from_json().

+ Here is the caller graph for this function:

template<typename Type>
void Acts::Range1D< Type >::setMin ( const Type &  v)
inline

Set the minimum value.

Override the minimum value of the range, regardless of what was already set.

Note
If you want to shrink or expand the range, use the shrink and expand methods.
Parameters
vThe value to use as the new minimum

Definition at line 71 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 71 of file Range1D.hpp

Referenced by Acts::Extent::addConstrain(), Acts::Test::BOOST_AUTO_TEST_CASE(), Acts::Polyhedron::extent(), and Acts::from_json().

+ Here is the caller graph for this function:

template<typename Type>
void Acts::Range1D< Type >::shrink ( const Type &  min,
const Type &  max 
)
inline

Shrink a range on both ends.

Shrink a range by increasing the minimum value as well as decreasing the maximum value. If either of the values are already smaller or larger (respectively) than the proposed values, then that particular boundary of the interval is not shrunk.

Note
After this operation, the range is always equal to or smaller than [min, max].
Parameters
minThe proposed new minimum for the range
maxThe proposed new maximum for the range

Definition at line 132 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 132 of file Range1D.hpp

Referenced by Acts::Test::BOOST_AUTO_TEST_CASE().

+ Here is the caller graph for this function:

template<typename Type>
void Acts::Range1D< Type >::shrinkMax ( const Type &  v)
inline

Shrink a range by decreasing the maximum value.

Shrink the range by decreasing the maximum value. If the given value is larger than the current maximum (in other words, if the proposed new range would be larger than the current range), this is a no-op.

Parameters
vThe proposed new maximum for the range

Definition at line 118 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 118 of file Range1D.hpp

Referenced by Acts::Test::BOOST_AUTO_TEST_CASE(), and Acts::Range1D< ActsScalar >::shrink().

+ Here is the caller graph for this function:

template<typename Type>
void Acts::Range1D< Type >::shrinkMin ( const Type &  v)
inline

Shrink a range by increasing the minimum value.

Shrink the range by increasing the minimum value. If the given value is smaller than the current minimum (in other words, if the proposed new range would be larger than the current range), this is a no-op.

Parameters
vThe proposed new minimum for the range

Definition at line 109 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 109 of file Range1D.hpp

Referenced by Acts::Test::BOOST_AUTO_TEST_CASE(), and Acts::Range1D< ActsScalar >::shrink().

+ Here is the caller graph for this function:

template<typename Type>
Type Acts::Range1D< Type >::size ( void  ) const
inline

Compute the size of the range.

The size of a range is defined as the difference between the minimum and the maximum. For degenerate ranges, this is zero.

Warning
Due to the nature of numbers, the result of this function can be somewhat ambiguous. For natural numbers, you could argue that the range [n, n] has size 0 or size 1. In this case we say it has size 0. The uncountable nature of the reals means this doesn't matter for them, but this can be awkward when working with integers.
Returns
The size of the range

Definition at line 190 of file Range1D.hpp.

View newest version in sPHENIX GitHub at line 190 of file Range1D.hpp

Referenced by Acts::Test::BOOST_AUTO_TEST_CASE().

+ Here is the caller graph for this function:

Member Data Documentation


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