CMS 3D CMS Logo

ScalingExponential.h
Go to the documentation of this file.
1 #ifndef CondFormats_HcalObjects_ScalingExponential_h_
2 #define CondFormats_HcalObjects_ScalingExponential_h_
3 
4 #include <cmath>
5 
6 #include "boost/serialization/access.hpp"
7 #include "boost/serialization/version.hpp"
8 #include <cstdint>
9 
11 public:
12  inline ScalingExponential() : p0_(0.0), p1_(0.0), linear_(0) {}
13 
14  inline ScalingExponential(const double p0, const double p1, const bool isLinear = false)
15  : p0_(p0), p1_(p1), linear_(isLinear) {}
16 
17  inline double operator()(const double x) const {
18  const double scale = linear_ ? p0_ * x + p1_ : p0_ * (1.0 - exp(-x / p1_));
19  return scale * x;
20  }
21 
22  inline bool operator==(const ScalingExponential& r) const {
23  return p0_ == r.p0_ && p1_ == r.p1_ && linear_ == r.linear_;
24  }
25 
26  inline bool operator!=(const ScalingExponential& r) const { return !(*this == r); }
27 
28 private:
29  double p0_;
30  double p1_;
31  uint8_t linear_;
32 
34 
35  template <class Archive>
36  inline void serialize(Archive& ar, unsigned /* version */) {
37  ar& p0_& p1_& linear_;
38  }
39 };
40 
41 BOOST_CLASS_VERSION(ScalingExponential, 1)
42 
43 #endif // CondFormats_HcalObjects_ScalingExponential_h_
ScalingExponential::ScalingExponential
ScalingExponential()
Definition: ScalingExponential.h:12
ScalingExponential::ScalingExponential
ScalingExponential(const double p0, const double p1, const bool isLinear=false)
Definition: ScalingExponential.h:14
ScalingExponential::access
friend class boost::serialization::access
Definition: ScalingExponential.h:33
DDAxes::x
ScalingExponential::serialize
void serialize(Archive &ar, unsigned)
Definition: ScalingExponential.h:36
ScalingExponential::p0_
double p0_
Definition: ScalingExponential.h:29
ScalingExponential::linear_
uint8_t linear_
Definition: ScalingExponential.h:31
Scenarios_cff.scale
scale
Definition: Scenarios_cff.py:2186
ScalingExponential
Definition: ScalingExponential.h:10
ScalingExponential::operator()
double operator()(const double x) const
Definition: ScalingExponential.h:17
ScalingExponential::p1_
double p1_
Definition: ScalingExponential.h:30
p1
double p1[4]
Definition: TauolaWrapper.h:89
alignCSCRings.r
r
Definition: alignCSCRings.py:93
ScalingExponential::operator==
bool operator==(const ScalingExponential &r) const
Definition: ScalingExponential.h:22
ScalingExponential::operator!=
bool operator!=(const ScalingExponential &r) const
Definition: ScalingExponential.h:26
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6