Go to the documentation of this file.00001 #ifndef PhysicsTools_Utilities_ZMuMu_BreitWigner_h
00002 #define PhysicsTools_Utilities_ZMuMu_BreitWigner_h
00003 #include "PhysicsTools/Utilities/interface/Parameter.h"
00004 #include <boost/shared_ptr.hpp>
00005 #include <cmath>
00006
00007 namespace funct {
00008 const double twoOverPi = 2./M_PI;
00009
00010 struct BreitWigner {
00011 BreitWigner(const Parameter& m, const Parameter& g):
00012 mass(m.ptr()), width(g.ptr()) { }
00013 BreitWigner(boost::shared_ptr<double> m, boost::shared_ptr<double> g):
00014 mass(m), width(g) {}
00015 BreitWigner(double m, double g):
00016 mass(new double(m)), width(new double(g)) {}
00017 double operator()(double x) const {
00018 double m2 = *mass * (*mass);
00019 double g2 = *width * (*width);
00020 double g2OverM2 = g2/m2;
00021 double s = x*x;
00022 double deltaS = s - m2;
00023 double lineShape = 0;
00024 if (fabs(deltaS/m2)<16) {
00025 double prop = deltaS*deltaS + s*s*g2OverM2;
00026 lineShape = twoOverPi * (*width) * s/prop;
00027 }
00028 return lineShape;
00029 }
00030 boost::shared_ptr<double> mass, width;
00031 };
00032
00033 }
00034
00035 #endif