CondFormats
HcalObjects
interface
HcalLinearCompositionFunctor.h
Go to the documentation of this file.
1
#ifndef CondFormats_HcalObjects_HcalLinearCompositionFunctor_h
2
#define CondFormats_HcalObjects_HcalLinearCompositionFunctor_h
3
4
#include "
FWCore/Utilities/interface/Exception.h
"
5
6
#include "
CondFormats/HcalObjects/interface/AbsHcalFunctor.h
"
7
8
#include "boost/serialization/access.hpp"
9
#include "boost/serialization/version.hpp"
10
#include "boost/serialization/shared_ptr.hpp"
11
12
//
13
// A functor returning a linearly transformed value
14
// of another functor: f(x) = a*p(x) + b. Useful for
15
// implementing cuts symmetric about 0, etc.
16
//
17
class
HcalLinearCompositionFunctor
:
public
AbsHcalFunctor
{
18
public
:
19
// Dummy constructor, to be used for deserialization only
20
inline
HcalLinearCompositionFunctor
() :
a_
(0.0),
b_
(0.0) {}
21
22
// Normal constructor
23
HcalLinearCompositionFunctor
(std::shared_ptr<AbsHcalFunctor>
p
,
double
a
,
double
b
);
24
25
inline
~HcalLinearCompositionFunctor
()
override
{}
26
27
double
operator()
(
double
x
)
const override
;
28
29
inline
double
xmin
()
const override
{
return
other_
->xmin(); }
30
inline
double
xmax
()
const override
{
return
other_
->xmax(); }
31
32
inline
double
a
()
const
{
return
a_
; }
33
inline
double
b
()
const
{
return
b_
; }
34
35
protected
:
36
inline
bool
isEqual
(
const
AbsHcalFunctor
&
other
)
const override
{
37
const
HcalLinearCompositionFunctor
&
r
= static_cast<const HcalLinearCompositionFunctor&>(
other
);
38
return
*
other_
== *
r
.other_ &&
a_
==
r
.a_ &&
b_
==
r
.b_;
39
}
40
41
private
:
42
std::shared_ptr<AbsHcalFunctor>
other_
;
43
double
a_
;
44
double
b_
;
45
46
friend
class
boost::serialization::access
;
47
48
template
<
class
Archive>
49
inline
void
serialize
(Archive& ar,
unsigned
/* version */
) {
50
boost::serialization::base_object<AbsHcalFunctor>(*
this
);
51
// Direct polymorphic serialization of shared_ptr is broken
52
// in boost for versions 1.56, 1.57, 1.58. For detail, see
53
// https://svn.boost.org/trac/boost/ticket/10727
54
#if BOOST_VERSION < 105600 || BOOST_VERSION > 105800
55
ar&
other_
&
a_
&
b_
;
56
#else
57
throw
cms::Exception
(
58
"HcalLinearCompositionFunctor can not be"
59
" serialized with this version of boost"
);
60
#endif
61
}
62
};
63
64
BOOST_CLASS_VERSION(
HcalLinearCompositionFunctor
, 1)
65
BOOST_CLASS_EXPORT_KEY(
HcalLinearCompositionFunctor
)
66
67
#endif // CondFormats_HcalObjects_HcalLinearCompositionFunctor_h
HcalLinearCompositionFunctor::b_
double b_
Definition:
HcalLinearCompositionFunctor.h:44
HcalLinearCompositionFunctor::b
double b() const
Definition:
HcalLinearCompositionFunctor.h:33
AbsHcalFunctor
Definition:
AbsHcalFunctor.h:19
HcalLinearCompositionFunctor
Definition:
HcalLinearCompositionFunctor.h:17
HcalLinearCompositionFunctor::serialize
void serialize(Archive &ar, unsigned)
Definition:
HcalLinearCompositionFunctor.h:49
HcalLinearCompositionFunctor::a_
double a_
Definition:
HcalLinearCompositionFunctor.h:43
AlCaHLTBitMon_ParallelJobs.p
p
Definition:
AlCaHLTBitMon_ParallelJobs.py:153
HcalLinearCompositionFunctor::HcalLinearCompositionFunctor
HcalLinearCompositionFunctor()
Definition:
HcalLinearCompositionFunctor.h:20
HcalLinearCompositionFunctor::a
double a() const
Definition:
HcalLinearCompositionFunctor.h:32
DDAxes::x
HcalLinearCompositionFunctor::~HcalLinearCompositionFunctor
~HcalLinearCompositionFunctor() override
Definition:
HcalLinearCompositionFunctor.h:25
HcalLinearCompositionFunctor::isEqual
bool isEqual(const AbsHcalFunctor &other) const override
Definition:
HcalLinearCompositionFunctor.h:36
HcalLinearCompositionFunctor::xmax
double xmax() const override
Definition:
HcalLinearCompositionFunctor.h:30
trackingPlots.other
other
Definition:
trackingPlots.py:1460
HcalLinearCompositionFunctor::operator()
double operator()(double x) const override
Definition:
HcalLinearCompositionFunctor.cc:15
AbsHcalFunctor.h
alignCSCRings.r
r
Definition:
alignCSCRings.py:93
HcalLinearCompositionFunctor::xmin
double xmin() const override
Definition:
HcalLinearCompositionFunctor.h:29
Exception
Definition:
hltDiff.cc:245
Exception.h
HcalLinearCompositionFunctor::other_
std::shared_ptr< AbsHcalFunctor > other_
Definition:
HcalLinearCompositionFunctor.h:42
HcalLinearCompositionFunctor::access
friend class boost::serialization::access
Definition:
HcalLinearCompositionFunctor.h:46
Generated for CMSSW Reference Manual by
1.8.16