ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
ISF
ISF_FastCaloSim
ISF_FastCaloSimParametrization
ISF_FastCaloSimParametrization
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
;
14
typedef
typename
std::map< _Key , _Tp >::iterator
iterator
;
15
typedef
typename
std::map< _Key , _Tp >::const_iterator
const_iterator
;
16
17
const_iterator
find_closest
(
const
key_type
& k)
const
{
18
if
(std::map< _Key , _Tp >::size()==0)
return
std::map< _Key , _Tp >::end();
19
const_iterator
i=std::map< _Key , _Tp >::lower_bound(k);
20
if
(i==std::map< _Key , _Tp >::end()) {
21
--i;
22
return
i;
23
}
24
if
(i==std::map< _Key , _Tp >::begin())
return
i;
25
26
const_iterator
il=i;
27
--il;
28
29
if
( fabs(il->first - k) > fabs(i->first - k) )
return
i;
30
else
return
il;
31
};
32
iterator
find_closest
(
const
key_type
& k) {
33
if
(std::map< _Key , _Tp >::size()==0)
return
std::map< _Key , _Tp >::end();
34
iterator
i=std::map< _Key , _Tp >::lower_bound(k);
35
if
(i==std::map< _Key , _Tp >::end()) {
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
FSmap
Definition
FSmap.h:11
FSmap::const_iterator
std::map< _Key, _Tp >::const_iterator const_iterator
Definition
FSmap.h:15
FSmap::iterator
std::map< _Key, _Tp >::iterator iterator
Definition
FSmap.h:14
FSmap::find_closest
const_iterator find_closest(const key_type &k) const
Definition
FSmap.h:17
FSmap::key_type
_Key key_type
Definition
FSmap.h:13
FSmap::find_closest
iterator find_closest(const key_type &k)
Definition
FSmap.h:32
Generated on
for ATLAS Offline Software by
1.17.0