CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/ElectroWeakAnalysis/ZMuMu/interface/ZMuMuBackNorm.h

Go to the documentation of this file.
00001 #ifndef ElectroWeakAnalysis_ZMuMu_ZMuMuBackNorm_h
00002 #define ElectroWeakAnalysis_ZMuMu_ZMuMuBackNorm_h
00003 
00004 #include "PhysicsTools/Utilities/interface/Exponential.h"
00005 #include "PhysicsTools/Utilities/interface/Polynomial.h"
00006 #include <boost/shared_ptr.hpp>
00007 #include <cmath> 
00008 
00009 namespace function {
00010   class ZMuMuBackNorm {
00011    public:
00012     enum{ arguments = 2 };
00013     enum{ parameters = 3 };
00014     ZMuMuBackNorm(boost::shared_ptr<double> l, boost::shared_ptr<double> a, boost::shared_ptr<double> b):
00015       lambda(l), a1(a), a2(b), 
00016       expo_(-(*l)), 
00017       pol_(-pow(*l, 2)- (*l) * (*a) - 2 * (*b), -pow(*l, 2) * (*a) - 2 * (*l) * (*b), -pow(*l, 2) * (*b)) {}
00018     ZMuMuBackNorm(double l, double a, double b): 
00019       lambda(new double(l)), a1(new double(a)), a2(new double(b)), 
00020       expo_(-l), pol_(-pow(l, 2)-l*a-2*b, -pow(l, 2)*a-2*l*b, -pow(l, 2)*b) {}
00021     ZMuMuBackNorm(const Exponential & expo, const Polynomial<2> & pol) : expo_(expo), pol_(pol) { }
00022     double operator()(const int x_min, const int x_max) const {
00023       double l = - (*(expo_.lambda)); //the exponential is constructed as negative!!
00024       double l3inv = 1/(l*l*l);
00025       double N1 = expo_(x_max)*l3inv * pol_(x_max);
00026       double N2 = expo_(x_min)*l3inv * pol_(x_min);
00027       return 1/(N1 - N2);
00028     }
00029     void setParameters(double l, double a, double b) { 
00030       expo_.setParameters(-l);
00031       double l2 = l*l;
00032       pol_.setParameters(-l2-l*a-2*b, -l2*a-2*l*b, -l2*b);
00033     }
00034     boost::shared_ptr<double> lambda, a1, a2;
00035   private:
00036     Exponential expo_;
00037     Polynomial<2> pol_; 
00038   };
00039 }
00040 
00041 #endif