CMS 3D CMS Logo

Public Member Functions

TRange< T > Class Template Reference

#include <TRange.h>

Inheritance diagram for TRange< T >:
pair

List of all members.

Public Member Functions

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

Detailed Description

template<class T>
class TRange< T >

Define a range [aMin,aMax]

Definition at line 11 of file TRange.h.


Constructor & Destructor Documentation

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

Definition at line 14 of file TRange.h.

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

{ }
template<class T>
TRange< T >::TRange ( const T aMin,
const T aMax 
) [inline]

Definition at line 16 of file TRange.h.

      : std::pair<T,T> (aMin,aMax) { }
template<class T>
TRange< T >::TRange ( const std::pair< T, T > &  apair) [inline]

Definition at line 19 of file TRange.h.

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

Member Function Documentation

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

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

Definition at line 31 of file TRange.h.

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

{ return (this->second < this->first); }
template<class T>
bool TRange< T >::inside ( const T value) const [inline]

check if object is inside region

Definition at line 34 of file TRange.h.

Referenced by SiPixelFedCablingMapBuilder::produce().

                                     {
    if (value < this->first || this->second < value)  return false; 
    else  return true;
  }
template<class T>
const T& TRange< T >::max ( ) const [inline]

upper edge of range

Definition at line 26 of file TRange.h.

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

{ return this->second; }
template<class T>
T TRange< T >::mean ( ) const [inline]

Definition at line 28 of file TRange.h.

{ return (this->first+this->second)/2.; }
template<class T>
const T& TRange< T >::min ( ) const [inline]

lower edge of range

Definition at line 23 of file TRange.h.

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

{ return this->first; }
template<class T>
void TRange< T >::sort ( ) [inline]

Definition at line 60 of file TRange.h.

{ if (empty() ) std::swap(this->first,this->second); }
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 53 of file TRange.h.

                                           {
   if( this->empty()) return r;
   else if( r.empty()) return *this;
   else return TRange( (min() < r.min()) ? min() : r.min(), 
      (max() < r.max()) ? r.max() : max()); 
  }