CMS 3D CMS Logo

List of all members | Public Member Functions
TRange< T > Class Template Reference

#include <TRange.h>

Inheritance diagram for TRange< T >:

Public Member Functions

bool empty () const
 true for empty region. note that region [x,x] is not empty More...
 
bool inside (const T &value) const
 check if object is inside region More...
 
const Tmax () const
 upper edge of range More...
 
T mean () const
 
const Tmin () const
 lower edge of range More...
 
void sort ()
 
TRange< Tsum (const TRange< T > &r) const
 sum of overlaping regions. the overlapping should be checked before. More...
 
 TRange ()
 
 TRange (const std::pair< T, T > &apair)
 
 TRange (const T &aMin, const T &aMax)
 

Detailed Description

template<class T>
class TRange< T >

Define a range [aMin,aMax]

Definition at line 11 of file TRange.h.

Constructor & Destructor Documentation

◆ TRange() [1/3]

template<class T>
TRange< T >::TRange ( )
inline

Definition at line 13 of file TRange.h.

13 {}

Referenced by TRange< int >::sum().

◆ TRange() [2/3]

template<class T>
TRange< T >::TRange ( const T aMin,
const T aMax 
)
inline

Definition at line 15 of file TRange.h.

15 : std::pair<T, T>(aMin, aMax) {}

◆ TRange() [3/3]

template<class T>
TRange< T >::TRange ( const std::pair< T, T > &  apair)
inline

Definition at line 17 of file TRange.h.

17 : std::pair<T, T>(apair) {}

Member Function Documentation

◆ empty()

template<class T>
bool TRange< T >::empty ( ) const
inline

true for empty region. note that region [x,x] is not empty

Definition at line 28 of file TRange.h.

28 { return (this->second < this->first); }

Referenced by TRange< int >::sort(), and TRange< int >::sum().

◆ inside()

template<class T>
bool TRange< T >::inside ( const T value) const
inline

check if object is inside region

Definition at line 31 of file TRange.h.

31  {
32  if (value < this->first || this->second < value)
33  return false;
34  else
35  return true;
36  }

◆ max()

template<class T>
const T& TRange< T >::max ( ) const
inline

upper edge of range

Definition at line 23 of file TRange.h.

23 { return this->second; }

Referenced by PixelToLNKAssociateFromAscii::addConnections(), and TRange< int >::sum().

◆ mean()

template<class T>
T TRange< T >::mean ( ) const
inline

Definition at line 25 of file TRange.h.

25 { return (this->first + this->second) / 2.; }

◆ min()

template<class T>
const T& TRange< T >::min ( ) const
inline

lower edge of range

Definition at line 20 of file TRange.h.

20 { return this->first; }

Referenced by PixelToLNKAssociateFromAscii::addConnections(), and TRange< int >::sum().

◆ sort()

template<class T>
void TRange< T >::sort ( )
inline

Definition at line 61 of file TRange.h.

61  {
62  if (empty())
63  std::swap(this->first, this->second);
64  }

◆ sum()

template<class T>
TRange<T> TRange< T >::sum ( const TRange< T > &  r) const
inline

sum of overlaping regions. the overlapping should be checked before.

Definition at line 52 of file TRange.h.

52  {
53  if (this->empty())
54  return r;
55  else if (r.empty())
56  return *this;
57  else
58  return TRange((min() < r.min()) ? min() : r.min(), (max() < r.max()) ? r.max() : max());
59  }
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
dqmdumpme.first
first
Definition: dqmdumpme.py:55
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
TRange::min
const T & min() const
lower edge of range
Definition: TRange.h:20
value
Definition: value.py:1
alignCSCRings.r
r
Definition: alignCSCRings.py:93
TRange::TRange
TRange()
Definition: TRange.h:13
TRange::empty
bool empty() const
true for empty region. note that region [x,x] is not empty
Definition: TRange.h:28
TRange::max
const T & max() const
upper edge of range
Definition: TRange.h:23