Atlfast::BinID Class Reference

Stores bin limits for a given bin index. More...

#include <BinID.h>

List of all members.

Public Member Functions

 BinID ()
 BinID (int intID, double low1, double high1)
 BinID (int intID, double low1, double high1, double low2, double high2)
 BinID (int intID, std::vector< double > low, std::vector< double > high)
double low (int n=0) const
double high (int n=0) const
bool isInBin (const double &var) const
bool isInBin (const std::vector< double > &var) const
bool operator< (const BinID &other) const

Private Attributes

int m_int
std::vector< double > m_lowEdge
std::vector< double > m_highEdge


Detailed Description

Stores bin limits for a given bin index.

Works with any number of dimensions.

Definition at line 16 of file BinID.h.


Constructor & Destructor Documentation

Atlfast::BinID::BinID (  )  [inline]

Default constructor

Definition at line 21 of file BinID.h.

00021 : m_int(0),m_lowEdge(1, 0.),m_highEdge(1, 0.){}

Atlfast::BinID::BinID ( int  intID,
double  low1,
double  high1 
)

Constructor for 1D bin

Definition at line 6 of file BinID.cxx.

00006                                                 : m_int(intID) { 
00007   m_lowEdge.push_back(low1);
00008   m_highEdge.push_back(high1);
00009 }

Atlfast::BinID::BinID ( int  intID,
double  low1,
double  high1,
double  low2,
double  high2 
)

Constructor for 2D bin

Definition at line 11 of file BinID.cxx.

00011                                                                           :
00012   m_int(intID) {
00013   m_lowEdge.push_back(low1);
00014   m_lowEdge.push_back(low2);
00015   m_highEdge.push_back(high1);
00016   m_highEdge.push_back(high2);
00017 }

Atlfast::BinID::BinID ( int  intID,
std::vector< double >  low,
std::vector< double >  high 
)

Constructor for any-dimensional bin

Definition at line 19 of file BinID.cxx.

00019                                                                     :
00020   m_int(intID), m_lowEdge(low), m_highEdge(high) {}


Member Function Documentation

double Atlfast::BinID::low ( int  n = 0  )  const

Returns low edge of bin in nth dimension

Definition at line 23 of file BinID.cxx.

00023 {return m_lowEdge[n];}

double Atlfast::BinID::high ( int  n = 0  )  const

Returns high edge of bin in nth dimension

Definition at line 25 of file BinID.cxx.

00025 {return m_highEdge[n];}

bool Atlfast::BinID::isInBin ( const double &  var  )  const

Checks whether value is in between bin limits: 1D

Definition at line 27 of file BinID.cxx.

00027                                           {
00028   std::vector<double> vec(1, var);
00029   return this->isInBin(vec);
00030 }

bool Atlfast::BinID::isInBin ( const std::vector< double > &  var  )  const

Checks whether value is in between bin limits: any-dimensional

Definition at line 32 of file BinID.cxx.

00032                                                      {
00033   std::vector<double>::const_iterator vIter = var.begin();
00034   std::vector<double>::const_iterator vEnd = var.end();
00035   std::vector<double>::const_iterator lowIter = m_lowEdge.begin();
00036   std::vector<double>::const_iterator highIter = m_highEdge.begin();
00037   
00038   assert(var.size() <=m_lowEdge.size() );
00039 
00040   for (;vIter != vEnd; ++vIter) {
00041     if ( (*vIter) < (*lowIter) || (*vIter) > (*highIter) ) {
00042       return false;
00043     }   
00044     ++lowIter;
00045     ++highIter;
00046   }
00047   return true;
00048 }

bool Atlfast::BinID::operator< ( const BinID other  )  const

Is this bin index lower than the input bin's index?

Definition at line 51 of file BinID.cxx.

00051                                               {
00052   return (m_int < other.m_int);
00053 }


Member Data Documentation

int Atlfast::BinID::m_int [private]

Definition at line 42 of file BinID.h.

std::vector<double> Atlfast::BinID::m_lowEdge [private]

Definition at line 43 of file BinID.h.

std::vector<double> Atlfast::BinID::m_highEdge [private]

Definition at line 44 of file BinID.h.


The documentation for this class was generated from the following files:
Generated on Mon Sep 24 14:19:34 2007 for AtlfastAlgs by  doxygen 1.5.1