File indexing completed on 2024-04-06 12:24:18
0001 #ifndef PhysicsTools_Utilities_ZMuMu_BreitWigner_h
0002 #define PhysicsTools_Utilities_ZMuMu_BreitWigner_h
0003 #include "PhysicsTools/Utilities/interface/Parameter.h"
0004
0005 #include <cmath>
0006
0007 namespace funct {
0008 const double twoOverPi = 2. / M_PI;
0009
0010 struct BreitWigner {
0011 BreitWigner(const Parameter& m, const Parameter& g) : mass(m.ptr()), width(g.ptr()) {}
0012 BreitWigner(std::shared_ptr<double> m, std::shared_ptr<double> g) : mass(m), width(g) {}
0013 BreitWigner(double m, double g) : mass(new double(m)), width(new double(g)) {}
0014 double operator()(double x) const {
0015 double m2 = *mass * (*mass);
0016 double g2 = *width * (*width);
0017 double g2OverM2 = g2 / m2;
0018 double s = x * x;
0019 double deltaS = s - m2;
0020 double lineShape = 0;
0021 if (fabs(deltaS / m2) < 16) {
0022 double prop = deltaS * deltaS + s * s * g2OverM2;
0023 lineShape = twoOverPi * (*width) * s / prop;
0024 }
0025 return lineShape;
0026 }
0027 std::shared_ptr<double> mass, width;
0028 };
0029
0030 }
0031
0032 #endif