PhysicsTools
Utilities
interface
Sgn.h
Go to the documentation of this file.
1
#ifndef PhysicsTools_Utilities_Sgn_h
2
#define PhysicsTools_Utilities_Sgn_h
3
4
namespace
funct
{
5
6
template
<
typename
T>
7
struct
SgnStruct
{
8
SgnStruct
(
const
T
&
t
) :
_
(
t
) {}
9
inline
double
operator()
()
const
{
return
_
() >= 0 ? 1 : -1; }
10
inline
operator
double()
const
{
return
_
() >= 0 ? 1 : -1; }
11
T
_
;
12
};
13
14
template
<
typename
T>
15
struct
Sgn
{
16
typedef
SgnStruct<T>
type
;
17
inline
static
type
compose
(
const
T
&
t
) {
return
type
(
t
); }
18
};
19
20
template
<
typename
T>
21
inline
typename
Sgn<T>::type
sgn
(
const
T
&
t
) {
22
return
Sgn<T>::compose
(
t
);
23
}
24
25
}
// namespace funct
26
27
#endif
funct::SgnStruct
Definition:
Sgn.h:7
funct::SgnStruct::SgnStruct
SgnStruct(const T &t)
Definition:
Sgn.h:8
funct::Sgn::compose
static type compose(const T &t)
Definition:
Sgn.h:17
funct::SgnStruct::operator()
double operator()() const
Definition:
Sgn.h:9
funct::Sgn::type
SgnStruct< T > type
Definition:
Sgn.h:16
funct::SgnStruct::_
T _
Definition:
Sgn.h:11
funct::Sgn
Definition:
Sgn.h:15
T
long double T
Definition:
Basic3DVectorLD.h:48
funct::sgn
Sgn< T >::type sgn(const T &t)
Definition:
Sgn.h:21
submitPVValidationJobs.t
string t
Definition:
submitPVValidationJobs.py:644
funct
Definition:
Abs.h:5
Generated for CMSSW Reference Manual by
1.8.16