Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

BinID.cxx

Go to the documentation of this file.
00001 #include "AtlfastAlgs/BinID.h"
00002 
00003 namespace Atlfast {
00004 
00005 BinID::BinID(int intID, double low1, double high1): m_int(intID) { 
00006   m_lowEdge.push_back(low1);
00007   m_highEdge.push_back(high1);
00008 }
00009     
00010 BinID::BinID(int intID, double low1, double high1, double low2,double high2):
00011   m_int(intID) {
00012   m_lowEdge.push_back(low1);
00013   m_lowEdge.push_back(low2);
00014   m_highEdge.push_back(high1);
00015   m_highEdge.push_back(high2);
00016 }
00017 
00018 BinID::BinID(int intID, vector<double> low, vector<double> high):m_int(intID),
00019                                                                  m_lowEdge(low),
00020                                                                  m_highEdge(high) {}
00021 
00022     
00023 double BinID::low(int n) const {return m_lowEdge[n];}
00024 
00025 double BinID::high(int n) const {return m_highEdge[n];}
00026 
00027 bool BinID::isInBin(const double& var) const{
00028   vector<double> vec(1, var);
00029   return this->isInBin(vec);
00030 }
00031 
00032 bool BinID::isInBin(const vector<double>& var) const{
00033   vector<double>::const_iterator vIter = var.begin();
00034   vector<double>::const_iterator vEnd = var.end();
00035   vector<double>::const_iterator lowIter = m_lowEdge.begin();
00036   vector<double>::const_iterator highIter = m_highEdge.begin();
00037   
00038   if (var.size() > m_lowEdge.size() ) {
00039     cout << "Warning: BinID - more variables than bin dimensions" << endl;
00040     return false;
00041   }
00042   for (;vIter != vEnd; ++vIter) {
00043     if ( (*vIter) < (*lowIter) || (*vIter) > (*highIter) ) {
00044       return false;
00045     }   
00046     ++lowIter;
00047     ++highIter;
00048   }
00049   return true;
00050 }
00051 
00052 
00053 bool BinID::operator<(const BinID& other) const {
00054   return (m_int < other.m_int);
00055 }
00056 
00057 }

Generated on Tue Mar 18 11:18:22 2003 for AtlfastAlgs by doxygen1.3-rc1