List of all members | Classes | Public Types | Public Member Functions | Public Attributes | Private Types | Private Attributes | Friends
utl::TimeDistribution< T > Class Template Reference

Histogram class for time distributions with suppressed empty bins. More...

#include "sevt/TimeDistribution.h"

Classes

struct  InternalMapFunctor
 

Public Types

typedef
boost::transform_iterator
< InternalMapFunctor,
InternalConstIterator, Tuple
SparseIterator
 
typedef boost::tuple< const
int, const T > 
Tuple
 
typedef T ValueType
 

Public Member Functions

void AddTime (const double time, const T weight=T(1))
 Add an entry (optionally weighted) for the given time. Slot will be computed. More...
 
At (const double time) const
 
void Clear ()
 Remove contents of the TimeDistribution. More...
 
fData erase (it)
 
double GetBinning () const
 Size of one slot. More...
 
int GetNumSlots () const
 Number of slots from first slot with data up to last slot with data, including empty slots. More...
 
int GetStart () const
 First slot with data. More...
 
int GetStop () const
 Last slot with data (1 less than First slot if no data) More...
 
 if (!ins.second)
 
bool operator!= (const TimeDistribution &td) const
 
TimeDistribution< T > operator+ (const TimeDistribution< T > &td) const
 Add two traces. Adds only bins that have data in them. More...
 
TimeDistribution< T > & operator+= (const TimeDistribution< T > &td)
 
bool operator== (const TimeDistribution &td) const
 
T & operator[] (const int index)
 Return slot content. More...
 
const T & operator[] (const int index) const
 Return slot content. More...
 
T & operator[] (const double time)
 Return contents for slot containing the specified time. More...
 
const T & operator[] (const double time) const
 
int Purge ()
 Remove empty slots and return their number. More...
 
void SetTime (const double time, const T weight=T(1))
 
SparseIterator SparseBegin () const
 Iterator over time slots with data in them (skips empty slots). More...
 
SparseIterator SparseEnd () const
 
 TimeDistribution (const double slotSize)
 Constructor takes the bin size as an argument. More...
 

Public Attributes

const
 Query value without slot creation. More...
 
 else
 
const std::pair
< InternalIterator, bool > 
ins = fData.insert(InternalMapValue(slot, weight))
 
return it == fData.end() ? 0 : it->second
 
 void
 Add an entry (optionally weighted) in the given slot. The slot may be negative. More...
 

Private Types

typedef InternalMap::const_iterator InternalConstIterator
 
typedef InternalMap::iterator InternalIterator
 
typedef std::map< int, T > InternalMap
 
typedef InternalMap::value_type InternalMapValue
 

Private Attributes

InternalMap fData
 
double fSlotSize = 0
 

Friends

class TimeDistributionAlgorithm
 

Detailed Description

template<typename T>
class utl::TimeDistribution< T >

Histogram class for time distributions with suppressed empty bins.

Histogram class for time distributions with suppressed empty bins. Includes two iterator types:

1) SparseIterator steps through time slots skipping those for which values were never assigned.

Author
Tom Paul and Darko Veberic
Date
28 April 2004
23 July 2006 DV update to boost::transform_iterator

Definition at line 15 of file TimeDistribution-fwd.h.

Member Typedef Documentation

template<typename T>
typedef InternalMap::const_iterator utl::TimeDistribution< T >::InternalConstIterator
private

Definition at line 44 of file TimeDistribution.h.

template<typename T>
typedef InternalMap::iterator utl::TimeDistribution< T >::InternalIterator
private

Definition at line 43 of file TimeDistribution.h.

template<typename T>
typedef std::map<int, T> utl::TimeDistribution< T >::InternalMap
private

Definition at line 41 of file TimeDistribution.h.

template<typename T>
typedef InternalMap::value_type utl::TimeDistribution< T >::InternalMapValue
private

Definition at line 42 of file TimeDistribution.h.

template<typename T>
typedef boost::transform_iterator<InternalMapFunctor, InternalConstIterator, Tuple> utl::TimeDistribution< T >::SparseIterator

Sparse iteration skips bins with no content. Here is a code snippet illustrating iteration through sparse bins

// Fill the timeDist with data
for (TimeDistributionI::SparseIterator it = timeDist.SparseBegin(),
end = timeDist.SparseEnd(); it != end; ++it) {
cout << "slot = " << it->get<0>() << ", "
"value = " << it->get<1>() << endl;
}

Definition at line 72 of file TimeDistribution.h.

template<typename T>
typedef boost::tuple<const int, const T> utl::TimeDistribution< T >::Tuple

Definition at line 48 of file TimeDistribution.h.

template<typename T>
typedef T utl::TimeDistribution< T >::ValueType

Definition at line 47 of file TimeDistribution.h.

Constructor & Destructor Documentation

template<typename T>
utl::TimeDistribution< T >::TimeDistribution ( const double  slotSize)
inline

Constructor takes the bin size as an argument.

Definition at line 75 of file TimeDistribution.h.

Member Function Documentation

template<typename T>
void utl::TimeDistribution< T >::AddTime ( const double  time,
const weight = T(1) 
)
inline
template<typename T>
T utl::TimeDistribution< T >::At ( const double  time) const
inline
template<typename T>
void utl::TimeDistribution< T >::Clear ( )
inline
template<typename T>
fData utl::TimeDistribution< T >::erase ( it  )
template<typename T>
double utl::TimeDistribution< T >::GetBinning ( ) const
inline
template<typename T>
int utl::TimeDistribution< T >::GetNumSlots ( ) const
inline

Number of slots from first slot with data up to last slot with data, including empty slots.

Definition at line 213 of file TimeDistribution.h.

References utl::TimeDistribution< T >::fData.

Referenced by testTimeDistribution::testOperatorBracket(), and sdet::UUBDownsampleFilter().

template<typename T>
int utl::TimeDistribution< T >::GetStart ( ) const
inline
template<typename T>
int utl::TimeDistribution< T >::GetStop ( ) const
inline
template<typename T>
utl::TimeDistribution< T >::if ( !ins.  second)
inline
template<typename T>
bool utl::TimeDistribution< T >::operator!= ( const TimeDistribution< T > &  td) const
inline

Definition at line 200 of file TimeDistribution.h.

References utl::TimeDistribution< T >::operator==().

template<typename T>
TimeDistribution<T> utl::TimeDistribution< T >::operator+ ( const TimeDistribution< T > &  td) const
inline

Add two traces. Adds only bins that have data in them.

Definition at line 168 of file TimeDistribution.h.

References ERROR, and utl::TimeDistribution< T >::GetBinning().

template<typename T>
TimeDistribution<T>& utl::TimeDistribution< T >::operator+= ( const TimeDistribution< T > &  td)
inline

Definition at line 184 of file TimeDistribution.h.

References ERROR, and utl::TimeDistribution< T >::GetBinning().

template<typename T>
bool utl::TimeDistribution< T >::operator== ( const TimeDistribution< T > &  td) const
inline
template<typename T>
T& utl::TimeDistribution< T >::operator[] ( const int  index)
inline

Return slot content.

If no slot exists for requested index, create new slot and initialize to 0.

Definition at line 132 of file TimeDistribution.h.

References utl::TimeDistribution< T >::fData.

Referenced by utl::TimeDistribution< T >::operator[]().

template<typename T>
const T& utl::TimeDistribution< T >::operator[] ( const int  index) const
inline

Return slot content.

Slight optimization for const case. Does not create new slots, returns reference to zero in case of a miss.

Definition at line 138 of file TimeDistribution.h.

References utl::TimeDistribution< T >::fData, and utl::TimeDistribution< T >::it.

template<typename T>
T& utl::TimeDistribution< T >::operator[] ( const double  time)
inline

Return contents for slot containing the specified time.

If no slot exists for requested index, create a new slot and initialize to 0.

Definition at line 148 of file TimeDistribution.h.

References utl::TimeDistribution< T >::fSlotSize, and utl::TimeDistribution< T >::operator[]().

template<typename T>
const T& utl::TimeDistribution< T >::operator[] ( const double  time) const
inline
template<typename T>
int utl::TimeDistribution< T >::Purge ( )
inline

Remove empty slots and return their number.

Definition at line 82 of file TimeDistribution.h.

References utl::TimeDistribution< T >::fData, and utl::TimeDistribution< T >::it.

template<typename T>
void utl::TimeDistribution< T >::SetTime ( const double  time,
const weight = T(1) 
)
inline
template<typename T>
SparseIterator utl::TimeDistribution< T >::SparseBegin ( ) const
inline
template<typename T>
SparseIterator utl::TimeDistribution< T >::SparseEnd ( ) const
inline

Friends And Related Function Documentation

template<typename T>
friend class TimeDistributionAlgorithm
friend

Definition at line 227 of file TimeDistribution.h.

Member Data Documentation

template<typename T>
T utl::TimeDistribution< T >::const
Initial value:
{
const InternalConstIterator it = fData.find(index)

Query value without slot creation.

Definition at line 158 of file TimeDistribution.h.

template<typename T>
utl::TimeDistribution< T >::else
Initial value:
{
const InternalIterator it = fData.find(slot)

Definition at line 120 of file TimeDistribution.h.

template<typename T>
InternalMap utl::TimeDistribution< T >::fData
private
template<typename T>
double utl::TimeDistribution< T >::fSlotSize = 0
private
template<typename T>
const std::pair<InternalIterator, bool> utl::TimeDistribution< T >::ins = fData.insert(InternalMapValue(slot, weight))

Definition at line 101 of file TimeDistribution.h.

template<typename T>
return utl::TimeDistribution< T >::it == fData.end() ? 0 : it->second
template<typename T>
utl::TimeDistribution< T >::void
Initial value:
{
return

Add an entry (optionally weighted) in the given slot. The slot may be negative.

Definition at line 98 of file TimeDistribution.h.


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

, generated on Tue Sep 26 2023.