ATLAS Offline Software
FSmap.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ISF_FSmap_H
6 #define ISF_FSmap_H
7 
8 #include<map>
9 #include<math.h>
10 
11 template <class _Key, class _Tp > class FSmap : public std::map< _Key , _Tp > {
12 public:
13  typedef _Key key_type;
15  typedef typename std::map< _Key , _Tp >::const_iterator const_iterator;
16 
19  const_iterator i=std::map< _Key , _Tp >::lower_bound(k);
21  --i;
22  return i;
23  }
24  if(i==std::map< _Key , _Tp >::begin()) return i;
25 
27  --il;
28 
29  if( fabs(il->first - k) > fabs(i->first - k) ) return i;
30  else return il;
31  };
34  iterator i=std::map< _Key , _Tp >::lower_bound(k);
36  --i;
37  return i;
38  }
39  if(i==std::map< _Key , _Tp >::begin()) return i;
40 
41  iterator il=i;
42  --il;
43 
44  if( fabs(il->first - k) > fabs(i->first - k) ) return i;
45  else return il;
46  };
47 };
48 
49 #endif
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
PlotCalibFromCool.il
il
Definition: PlotCalibFromCool.py:381
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
FSmap
Definition: FSmap.h:11
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
lumiFormat.i
int i
Definition: lumiFormat.py:85
FSmap::key_type
_Key key_type
Definition: FSmap.h:13
FSmap::iterator
std::map< _Key, _Tp >::iterator iterator
Definition: FSmap.h:14
FSmap::find_closest
iterator find_closest(const key_type &k)
Definition: FSmap.h:32
FSmap::find_closest
const_iterator find_closest(const key_type &k) const
Definition: FSmap.h:17
fitman.k
k
Definition: fitman.py:528
FSmap::const_iterator
std::map< _Key, _Tp >::const_iterator const_iterator
Definition: FSmap.h:15