PageRenderTime 20ms CodeModel.GetById 16ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/ElectroWeakAnalysis/ZMuMu/interface/ZMuMuBack.h

https://github.com/aivanov-cern/cmssw
C Header | 39 lines | 35 code | 4 blank | 0 comment | 0 complexity | ba33d7ce4bcfcbb5961c63249828277b MD5 | raw file
 1#ifndef ElectroWeakAnalysis_ZMuMu_ZMuMuBack_h
 2#define ElectroWeakAnalysis_ZMuMu_ZMuMuBack_h
 3
 4#include "PhysicsTools/Utilities/interface/Exponential.h"
 5#include "PhysicsTools/Utilities/interface/Polynomial.h"
 6#include <boost/shared_ptr.hpp>
 7
 8namespace function{
 9  class ZMuMuBack {
10   public:
11    enum{ arguments = 1 };
12    enum{ parameters = 4 };
13    ZMuMuBack(boost::shared_ptr<double> Nb, boost::shared_ptr<double> l, 
14	      boost::shared_ptr<double> a, boost::shared_ptr<double> b):
15      Nbkg(Nb), lambda(l), a1(a), a2(b), 
16      expo_(-(*l)), poly_(1., *a, *b) {}
17    ZMuMuBack(double Nb, double l, double a, double b):
18      Nbkg(new double(Nb)), lambda(new double(l)), a1(new double(a)), a2(new double(b)), 
19      expo_(-l), poly_(1, a, b) {}
20    double operator()(double x) const  {
21      return *Nbkg * expo_(x) * poly_(x);
22    }
23    void setParameters(double Nb, double l, double a, double b) {
24      *Nbkg = Nb; 
25      *lambda = l;
26      *a1 = a;
27      *a2 = b;
28      expo_.setParameters(-l);
29      poly_.setParameters(1., a, b);
30    }
31    
32    boost::shared_ptr<double> Nbkg, lambda, a1, a2;
33  private:
34    Exponential expo_;
35    Polynomial<2> poly_;
36  };
37}
38
39#endif