CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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/cstdint.hpp"
7 #include "boost/serialization/version.hpp"
8 
10 {
11 public:
12  inline ScalingExponential() : p0_(0.0), p1_(0.0), linear_(0) {}
13 
14  inline ScalingExponential(const double p0, const double p1,
15  const bool isLinear=false)
16  : p0_(p0), p1_(p1), linear_(isLinear) {}
17 
18  inline double operator()(const double x) const
19  {
20  const double scale = linear_ ? p0_*x + p1_ : p0_*(1.0 - exp(-x/p1_));
21  return scale*x;
22  }
23 
24  inline bool operator==(const ScalingExponential& r) const
25  {return p0_ == r.p0_ && p1_ == r.p1_ && linear_ == r.linear_;}
26 
27  inline bool operator!=(const ScalingExponential& r) const
28  {return !(*this == r);}
29 
30 private:
31  double p0_;
32  double p1_;
33  uint8_t linear_;
34 
36 
37  template<class Archive>
38  inline void serialize(Archive & ar, unsigned /* version */)
39  {
40  ar & p0_ & p1_ & linear_;
41  }
42 };
43 
44 BOOST_CLASS_VERSION(ScalingExponential, 1)
45 
46 #endif // CondFormats_HcalObjects_ScalingExponential_h_
ScalingExponential(const double p0, const double p1, const bool isLinear=false)
bool operator==(const ScalingExponential &r) const
friend class boost::serialization::access
double operator()(const double x) const
void serialize(Archive &ar, unsigned)
bool operator!=(const ScalingExponential &r) const
double p1[4]
Definition: TauolaWrapper.h:89