CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OOTPileupCorrDataFcn.h
Go to the documentation of this file.
1 #ifndef CondFormats_HcalObjects_OOTPileupCorrDataFcn_h_
2 #define CondFormats_HcalObjects_OOTPileupCorrDataFcn_h_
3 
6 
8 {
9 public:
11 
15  const ScalingExponential& a_1)
16  : a1_(a1), a2_(a2), a3_(a3), a_1_(a_1) {}
17 
18  inline bool operator==(const OOTPileupCorrDataFcn& r) const
19  {return a1_ == r.a1_ && a2_ == r.a2_ && a3_ == r.a3_ && a_1_ == r.a_1_;}
20 
21  inline bool operator!=(const OOTPileupCorrDataFcn& r) const
22  {return !(*this == r);}
23 
24  inline void pucorrection(double *ts, const int tsTrig) const
25  {
26  // TS4 correction with functions a1(x) and a2(x)
27  double ts20 = ts[tsTrig-2];
28  double ts30 = ts[tsTrig-1] - a_1_(ts[tsTrig]); // ts[3] correction with a_1(x)
29  double ts21 = ts20 > 0 ? a2_(ts20) : 0;
30  double ts22 = ts20 > 0 ? a1_(ts20) : 0;
31  double ts321 = ts30 - ts22 > 0 ? a1_(ts30 - ts22) : 0;
32  ts[tsTrig] -= (ts321 + ts21); // ts[4] after pu correction
33 
34  // ts5 estimation from ts4
35  ts[tsTrig+1] = a1_(ts[tsTrig]);
36  }
37 
38  // Access the correction functions
39  inline const PiecewiseScalingPolynomial& getA1() const {return a1_;}
40  inline const PiecewiseScalingPolynomial& getA2() const {return a2_;}
41  inline const PiecewiseScalingPolynomial& getA3() const {return a3_;}
42  inline const ScalingExponential& getA_1() const {return a_1_;}
43 
44 private:
47 
49 
50  template<class Archive>
51  inline void serialize(Archive & ar, unsigned /* version */)
52  {
53  ar & a1_ & a2_ & a3_ & a_1_;
54  }
55 };
56 
57 BOOST_CLASS_VERSION(OOTPileupCorrDataFcn, 1)
58 
59 #endif // CondFormats_HcalObjects_OOTPileupCorrDataFcn_h_
const PiecewiseScalingPolynomial & getA1() const
const PiecewiseScalingPolynomial & getA2() const
PiecewiseScalingPolynomial a1_
bool operator!=(const OOTPileupCorrDataFcn &r) const
void pucorrection(double *ts, const int tsTrig) const
const ScalingExponential & getA_1() const
PiecewiseScalingPolynomial a3_
PiecewiseScalingPolynomial a2_
OOTPileupCorrDataFcn(const PiecewiseScalingPolynomial &a1, const PiecewiseScalingPolynomial &a2, const PiecewiseScalingPolynomial &a3, const ScalingExponential &a_1)
bool operator==(const OOTPileupCorrDataFcn &r) const
const PiecewiseScalingPolynomial & getA3() const
friend class boost::serialization::access
void serialize(Archive &ar, unsigned)
ScalingExponential a_1_