CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/ElectroWeakAnalysis/ZMuMu/interface/ZMuMuBack.h

Go to the documentation of this file.
00001 #ifndef ElectroWeakAnalysis_ZMuMu_ZMuMuBack_h
00002 #define ElectroWeakAnalysis_ZMuMu_ZMuMuBack_h
00003 
00004 #include "PhysicsTools/Utilities/interface/Exponential.h"
00005 #include "PhysicsTools/Utilities/interface/Polynomial.h"
00006 #include <boost/shared_ptr.hpp>
00007 
00008 namespace function{
00009   class ZMuMuBack {
00010    public:
00011     enum{ arguments = 1 };
00012     enum{ parameters = 4 };
00013     ZMuMuBack(boost::shared_ptr<double> Nb, boost::shared_ptr<double> l, 
00014               boost::shared_ptr<double> a, boost::shared_ptr<double> b):
00015       Nbkg(Nb), lambda(l), a1(a), a2(b), 
00016       expo_(-(*l)), poly_(1., *a, *b) {}
00017     ZMuMuBack(double Nb, double l, double a, double b):
00018       Nbkg(new double(Nb)), lambda(new double(l)), a1(new double(a)), a2(new double(b)), 
00019       expo_(-l), poly_(1, a, b) {}
00020     double operator()(double x) const  {
00021       return *Nbkg * expo_(x) * poly_(x);
00022     }
00023     void setParameters(double Nb, double l, double a, double b) {
00024       *Nbkg = Nb; 
00025       *lambda = l;
00026       *a1 = a;
00027       *a2 = b;
00028       expo_.setParameters(-l);
00029       poly_.setParameters(1., a, b);
00030     }
00031     
00032     boost::shared_ptr<double> Nbkg, lambda, a1, a2;
00033   private:
00034     Exponential expo_;
00035     Polynomial<2> poly_;
00036   };
00037 }
00038 
00039 #endif