Go to the documentation of this file.00001 #include "ForIA/JetKey.hh"
00002
00003 namespace ForIA{
00004
00005 JetKey::JetKey(Jet::Algorithm alg, double rparam, Jet::Calibration calibration):
00006 m_alg(alg), m_rparam(rparam), m_calibration(calibration), m_filtered(false),
00007 m_gotRAsInt(false){
00008
00009 }
00010
00011 size_t JetKey::rAsInt()const{
00012 if(m_gotRAsInt) return m_rAsInt;
00013 m_rAsInt = boost::numeric_cast<size_t>(10000. * m_rparam);
00014 m_gotRAsInt = true;
00015 return m_rAsInt;
00016 }
00017
00018 bool JetKey::doubleEquals(double left, double right)const{
00019 if(left*right < 0.) return false;
00020 return fabs(left - right) < fabs(left + right) * 1.e-8;
00021 }
00022
00023 void JetKey::setFiltered(bool filtered){
00024 m_filtered = filtered;
00025 return;
00026 }
00027
00028 size_t hash_value(const JetKey &key){
00029 boost::hash<size_t> hasher;
00030 size_t filt = (key.filtered())? 100000000:0;
00031 return hasher(filt + 1000000 * (key.alg() + 1) + key.rAsInt());
00032 }
00033
00034 }
00035