BinID.cxx

Go to the documentation of this file.
00001 #include "AtlfastAlgs/BinID.h"
00002 #include <assert.h>
00003 
00004 namespace Atlfast {
00005 
00006 BinID::BinID(int intID, double low1, double high1): m_int(intID) { 
00007   m_lowEdge.push_back(low1);
00008   m_highEdge.push_back(high1);
00009 }
00010     
00011 BinID::BinID(int intID, double low1, double high1, double low2,double high2):
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 }
00018 
00019 BinID::BinID(int intID, std::vector<double> low, std::vector<double> high):
00020   m_int(intID), m_lowEdge(low), 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   std::vector<double> vec(1, var);
00029   return this->isInBin(vec);
00030 }
00031 
00032 bool BinID::isInBin(const std::vector<double>& var) const{
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 }
00049 
00050 
00051 bool BinID::operator<(const BinID& other) const {
00052   return (m_int < other.m_int);
00053 }
00054 
00055 }

Generated on Mon Sep 24 14:19:11 2007 for AtlfastAlgs by  doxygen 1.5.1