Rivet: /Users/chrisg/software/rivet/include/Rivet/Tools/MomentumSmearingFunctions.hh Source File

| Rivet 3.1.9

MomentumSmearingFunctions.hh
1// -*- C++ -*-
2#ifndef RIVET_MomentumSmearingFunctions_HH
3#define RIVET_MomentumSmearingFunctions_HH
4
5#include "Rivet/Math/Vector4.hh"
6#include "Rivet/Tools/Random.hh"
7
8namespace Rivet {
9
10
13
16
18 typedef std::function<FourMomentum(const FourMomentum&)> P4SmearFn;
19
21 typedef std::function<double(const FourMomentum&)> P4EffFn;
22
23
25 inline double P4_EFF_ZERO(const FourMomentum& ) { return 0; }
27 inline double P4_FN0(const FourMomentum& ) { return 0; }
28
30 inline double P4_EFF_ONE(const FourMomentum& ) { return 1; }
32 inline double P4_FN1(const FourMomentum& ) { return 1; }
33
35 struct P4_EFF_CONST {
36 P4_EFF_CONST(double x) : _x(x) {}
37 double operator () (const FourMomentum& ) const { return _x; }
38 double _x;
39 };
40
41
43 inline FourMomentum P4_SMEAR_IDENTITY(const FourMomentum& p) { return p; }
45 inline FourMomentum P4_SMEAR_PERFECT(const FourMomentum& p) { return p; }
46
49 inline FourMomentum P4_SMEAR_E_GAUSS(const FourMomentum& p, double resolution) {
50 const double mass = p.mass2() > 0 ? p.mass() : 0; //< numerical carefulness...
51 const double smeared_E = max(randnorm(p.E(), resolution), mass); //< can't let the energy go below the mass!
52 return FourMomentum::mkEtaPhiME(p.eta(), p.phi(), mass, smeared_E);
53 }
54
56 inline FourMomentum P4_SMEAR_PT_GAUSS(const FourMomentum& p, double resolution) {
57 const double smeared_pt = max(randnorm(p.pT(), resolution), 0.);
58 const double mass = p.mass2() > 0 ? p.mass() : 0; //< numerical carefulness...
59 return FourMomentum::mkEtaPhiMPt(p.eta(), p.phi(), mass, smeared_pt);
60 }
61
63 inline FourMomentum P4_SMEAR_MASS_GAUSS(const FourMomentum& p, double resolution) {
64 const double smeared_mass = max(randnorm(p.mass(), resolution), 0.);
65 return FourMomentum::mkEtaPhiMPt(p.eta(), p.phi(), smeared_mass, p.pT());
66 }
67
69
70
71
74
76 inline double P3_EFF_ZERO(const Vector3& p) { return 0; }
78 inline double P3_FN0(const Vector3& p) { return 0; }
79
81 inline double P3_EFF_ONE(const Vector3& p) { return 1; }
83 inline double P3_FN1(const Vector3& p) { return 1; }
84
86 struct P3_EFF_CONST {
87 P3_EFF_CONST(double x) : _x(x) {}
88 double operator () (const Vector3& ) const { return _x; }
89 double _x;
90 };
91
92
94 inline Vector3 P3_SMEAR_IDENTITY(const Vector3& p) { return p; }
96 inline Vector3 P3_SMEAR_PERFECT(const Vector3& p) { return p; }
97
99 inline Vector3 P3_SMEAR_LEN_GAUSS(const Vector3& p, double resolution) {
100 const double smeared_mod = max(randnorm(p.mod(), resolution), 0.); //< can't let the energy go below the mass!
101 return smeared_mod * p.unit();
102 }
103
105
107
108}
109
110#endif
Rivet::FourMomentum
Specialized version of the FourVector with momentum/energy functionality.
Definition Vector4.hh:316
Rivet::Vector3
Three-dimensional specialisation of Vector.
Definition Vector3.hh:40
Rivet::FourMomentum::mkEtaPhiME
static FourMomentum mkEtaPhiME(double eta, double phi, double mass, double E)
Make a vector from (eta,phi,energy) coordinates and the mass.
Definition Vector4.hh:793
Rivet::FourMomentum::mkEtaPhiMPt
static FourMomentum mkEtaPhiMPt(double eta, double phi, double mass, double pt)
Make a vector from (eta,phi,pT) coordinates and the mass.
Definition Vector4.hh:798
Rivet::Kin::mass
double mass(const ParticleBase &p)
Unbound function access to mass.
Definition ParticleBaseUtils.hh:705
Rivet::Kin::p
double p(const ParticleBase &p)
Unbound function access to p.
Definition ParticleBaseUtils.hh:684
Rivet::P4EffFn
std::function< double(const FourMomentum &)> P4EffFn
Typedef for FourMomentum efficiency functions/functors.
Definition MomentumSmearingFunctions.hh:21
Rivet::P4_EFF_ONE
double P4_EFF_ONE(const FourMomentum &)
Take a FourMomentum and return 1.
Definition MomentumSmearingFunctions.hh:30
Rivet::P4_SMEAR_IDENTITY
FourMomentum P4_SMEAR_IDENTITY(const FourMomentum &p)
Take a FourMomentum and return it unmodified.
Definition MomentumSmearingFunctions.hh:43
Rivet::P4_SMEAR_E_GAUSS
FourMomentum P4_SMEAR_E_GAUSS(const FourMomentum &p, double resolution)
Definition MomentumSmearingFunctions.hh:49
Rivet::P3_SMEAR_PERFECT
Vector3 P3_SMEAR_PERFECT(const Vector3 &p)
Alias for P3_SMEAR_IDENTITY.
Definition MomentumSmearingFunctions.hh:96
Rivet::P4_SMEAR_PERFECT
FourMomentum P4_SMEAR_PERFECT(const FourMomentum &p)
Alias for P4_SMEAR_IDENTITY.
Definition MomentumSmearingFunctions.hh:45
Rivet::P3_EFF_ZERO
double P3_EFF_ZERO(const Vector3 &p)
Take a Vector3 and return 0.
Definition MomentumSmearingFunctions.hh:76
Rivet::P3_SMEAR_IDENTITY
Vector3 P3_SMEAR_IDENTITY(const Vector3 &p)
Take a Vector3 and return it unmodified.
Definition MomentumSmearingFunctions.hh:94
Rivet::P4_FN1
double P4_FN1(const FourMomentum &)
Definition MomentumSmearingFunctions.hh:32
Rivet::P3_FN0
double P3_FN0(const Vector3 &p)
Definition MomentumSmearingFunctions.hh:78
Rivet::P4_SMEAR_MASS_GAUSS
FourMomentum P4_SMEAR_MASS_GAUSS(const FourMomentum &p, double resolution)
Smear a FourMomentum's mass using a Gaussian of absolute width resolution.
Definition MomentumSmearingFunctions.hh:63
Rivet::P3_FN1
double P3_FN1(const Vector3 &p)
Definition MomentumSmearingFunctions.hh:83
Rivet::P4SmearFn
std::function< FourMomentum(const FourMomentum &)> P4SmearFn
Typedef for FourMomentum smearing functions/functors.
Definition MomentumSmearingFunctions.hh:18
Rivet::P4_FN0
double P4_FN0(const FourMomentum &)
Definition MomentumSmearingFunctions.hh:27
Rivet::P4_EFF_ZERO
double P4_EFF_ZERO(const FourMomentum &)
Take a FourMomentum and return 0.
Definition MomentumSmearingFunctions.hh:25
Rivet::P3_SMEAR_LEN_GAUSS
Vector3 P3_SMEAR_LEN_GAUSS(const Vector3 &p, double resolution)
Smear a Vector3's length using a Gaussian of absolute width resolution.
Definition MomentumSmearingFunctions.hh:99
Rivet::P3_EFF_ONE
double P3_EFF_ONE(const Vector3 &p)
Take a Vector3 and return 1.
Definition MomentumSmearingFunctions.hh:81
Rivet::P4_SMEAR_PT_GAUSS
FourMomentum P4_SMEAR_PT_GAUSS(const FourMomentum &p, double resolution)
Smear a FourMomentum's transverse momentum using a Gaussian of absolute width resolution.
Definition MomentumSmearingFunctions.hh:56
Rivet
Definition MC_Cent_pPb.hh:10
Rivet::max
std::enable_if< std::is_arithmetic< N1 >::value &&std::is_arithmetic< N2 >::value, typenamestd::common_type< N1, N2 >::type >::type max(N1 a, N2 b)
Get the maximum of two numbers.
Definition MathUtils.hh:111
Rivet::randnorm
double randnorm(double loc, double scale)
Return a random number sampled from a Gaussian/normal distribution.
Rivet::P3_EFF_CONST
Take a Vector3 and return a constant number.
Definition MomentumSmearingFunctions.hh:86
Rivet::P4_EFF_CONST
Take a FourMomentum and return a constant number.
Definition MomentumSmearingFunctions.hh:35