File indexing completed on 2025-04-19 09:06:52
0001
0002 #ifndef RIVET_MomentumSmearingFunctions_HH
0003 #define RIVET_MomentumSmearingFunctions_HH
0004
0005 #include "Rivet/Math/Vector4.hh"
0006 #include "Rivet/Tools/Random.hh"
0007
0008 namespace Rivet {
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 typedef std::function<FourMomentum(const FourMomentum&)> P4SmearFn;
0019
0020
0021 typedef std::function<double(const FourMomentum&)> P4EffFn;
0022
0023
0024
0025 inline double P4_EFF_ZERO(const FourMomentum& ) { return 0; }
0026
0027
0028 inline double P4_EFF_ONE(const FourMomentum& ) { return 1; }
0029
0030
0031 struct P4_EFF_CONST {
0032 P4_EFF_CONST(double x) : _x(x) {}
0033 double operator () (const FourMomentum& ) const { return _x; }
0034 double _x;
0035 };
0036
0037
0038
0039 inline FourMomentum P4_SMEAR_IDENTITY(const FourMomentum& p) { return p; }
0040
0041 inline FourMomentum P4_SMEAR_PERFECT(const FourMomentum& p) { return p; }
0042
0043
0044
0045 inline FourMomentum P4_SMEAR_E_GAUSS(const FourMomentum& p, double resolution) {
0046 const double mass = p.mass2() > 0 ? p.mass() : 0;
0047 const double smeared_E = max(randnorm(p.E(), resolution), mass);
0048 return FourMomentum::mkEtaPhiME(p.eta(), p.phi(), mass, smeared_E);
0049 }
0050
0051
0052 inline FourMomentum P4_SMEAR_PT_GAUSS(const FourMomentum& p, double resolution) {
0053 const double smeared_pt = max(randnorm(p.pT(), resolution), 0.);
0054 const double mass = p.mass2() > 0 ? p.mass() : 0;
0055 return FourMomentum::mkEtaPhiMPt(p.eta(), p.phi(), mass, smeared_pt);
0056 }
0057
0058
0059 inline FourMomentum P4_SMEAR_MASS_GAUSS(const FourMomentum& p, double resolution) {
0060 const double smeared_mass = max(randnorm(p.mass(), resolution), 0.);
0061 return FourMomentum::mkEtaPhiMPt(p.eta(), p.phi(), smeared_mass, p.pT());
0062 }
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072 inline double P3_EFF_ZERO(const Vector3&) { return 0; }
0073
0074
0075 inline double P3_EFF_ONE(const Vector3&) { return 1; }
0076
0077
0078 struct P3_EFF_CONST {
0079 P3_EFF_CONST(double x) : _x(x) {}
0080 double operator () (const Vector3& ) const { return _x; }
0081 double _x;
0082 };
0083
0084
0085
0086 inline Vector3 P3_SMEAR_IDENTITY(const Vector3& p) { return p; }
0087
0088 inline Vector3 P3_SMEAR_PERFECT(const Vector3& p) { return p; }
0089
0090
0091 inline Vector3 P3_SMEAR_LEN_GAUSS(const Vector3& p, double resolution) {
0092 const double smeared_mod = max(randnorm(p.mod(), resolution), 0.);
0093 return smeared_mod * p.unit();
0094 }
0095
0096
0097
0098
0099
0100 }
0101
0102 #endif