rivet is hosted by Hepforge, IPPP Durham
Rivet 4.0.2
ParticleBase.hh
1#ifndef RIVET_ParticleBase_HH
2#define RIVET_ParticleBase_HH
3
4#include "Rivet/Config/RivetCommon.hh"
5#include "Rivet/Jet.fhh"
6#include "Rivet/Tools/Cuts.fhh"
7#include "Rivet/Math/Vectors.hh"
8
9namespace Rivet {
10
11
14 public:
15
18
20 virtual ~ParticleBase() { }
21
22
23 // /// @name Constituent accessors
24 // /// @{
25
26 // /// @todo Can't do this because a) ParticleBase is pure-virtual; b) inheritance causality for Particle... urk
27 // virtual const vector<ParticleBase>& constituents() const = 0;
28 // virtual const vector<ParticleBase>& rawConstituents() const = 0;
29
30 // /// @}
31
32
35
37 virtual const FourMomentum& momentum() const = 0;
39 const FourMomentum& mom() const { return momentum(); };
40
42 operator const FourMomentum& () const { return momentum(); }
43
45
46
49
51 double E() const { return momentum().E(); }
53 double energy() const { return momentum().E(); }
54
56 double E2() const { return momentum().E2(); }
58 double energy2() const { return momentum().E2(); }
59
61 double pt() const { return momentum().pt(); }
63 double pT() const { return pt(); }
65 double perp() const { return pt(); }
66
68 double pt2() const { return momentum().pt2(); }
70 double pT2() const { return pt2(); }
72 double perp2() const { return pt2(); }
73
75 double Et() const { return momentum().Et(); }
77 double Et2() const { return momentum().Et2(); }
78
80 double mass() const { return momentum().mass(); }
82 double mass2() const { return momentum().mass2(); }
83
85 double pseudorapidity() const { return momentum().eta(); }
87 double eta() const { return momentum().eta(); }
89 double abspseudorapidity() const { return momentum().abspseudorapidity(); }
91 double abseta() const { return momentum().abseta(); }
92
94 double rapidity() const { return momentum().rapidity(); }
96 double rap() const { return momentum().rapidity(); }
98 double absrapidity() const { return momentum().absrapidity(); }
100 double absrap() const { return momentum().absrap(); }
101
103 double azimuthalAngle(const PhiMapping mapping=ZERO_2PI) const { return momentum().azimuthalAngle(mapping); }
105 double phi(const PhiMapping mapping=ZERO_2PI) const { return momentum().phi(mapping); }
106
108 ThreeMomentum p3() const { return momentum().vector3(); }
110 double p() const { return momentum().p(); }
112 double p2() const { return momentum().p2(); }
113
115 Vector3 ptvec() const { return momentum().ptvec(); }
117 Vector3 pTvec() const { return momentum().pTvec(); }
118
120 double px() const { return momentum().x(); }
122 double py() const { return momentum().y(); }
124 double pz() const { return momentum().z(); }
125
127 double px2() const { return momentum().x2(); }
129 double py2() const { return momentum().y2(); }
131 double pz2() const { return momentum().z2(); }
132
134 double polarAngle() const { return momentum().polarAngle(); }
136 double theta() const { return momentum().theta(); }
137
139 double angle(const ParticleBase& v) const { return momentum().angle(v.momentum()); }
141 double angle(const FourVector& v) const { return momentum().angle(v); }
143 double angle(const Vector3& v3) const { return momentum().angle(v3); }
144
146 double dot(const ParticleBase& v) const { return momentum().dot(v.momentum()); }
148 double dot(const FourVector& v) const { return momentum().dot(v); }
149
151
152 };
153
154
157
158 inline double deltaR(const ParticleBase& p1, const ParticleBase& p2,
159 RapScheme scheme = PSEUDORAPIDITY) {
160 return deltaR(p1.momentum(), p2.momentum(), scheme);
161 }
162
163 inline double deltaR(const ParticleBase& p, const FourMomentum& v,
164 RapScheme scheme = PSEUDORAPIDITY) {
165 return deltaR(p.momentum(), v, scheme);
166 }
167
168 inline double deltaR(const ParticleBase& p, const FourVector& v,
169 RapScheme scheme = PSEUDORAPIDITY) {
170 return deltaR(p.momentum(), v, scheme);
171 }
172
173 inline double deltaR(const ParticleBase& p, const Vector3& v) {
174 return deltaR(p.momentum(), v);
175 }
176
177 inline double deltaR(const ParticleBase& p, double eta, double phi) {
178 return deltaR(p.momentum(), eta, phi);
179 }
180
181 inline double deltaR(const FourMomentum& v, const ParticleBase& p,
182 RapScheme scheme = PSEUDORAPIDITY) {
183 return deltaR(v, p.momentum(), scheme);
184 }
185
186 inline double deltaR(const FourVector& v, const ParticleBase& p,
187 RapScheme scheme = PSEUDORAPIDITY) {
188 return deltaR(v, p.momentum(), scheme);
189 }
190
191 inline double deltaR(const Vector3& v, const ParticleBase& p) {
192 return deltaR(v, p.momentum());
193 }
194
195 inline double deltaR(double eta, double phi, const ParticleBase& p) {
196 return deltaR(eta, phi, p.momentum());
197 }
198
199
200 inline double deltaPhi(const ParticleBase& p1, const ParticleBase& p2, bool sign=false) {
201 return deltaPhi(p1.momentum(), p2.momentum(), sign);
202 }
203
204 inline double deltaPhi(const ParticleBase& p, const FourMomentum& v, bool sign=false) {
205 return deltaPhi(p.momentum(), v, sign);
206 }
207
208 inline double deltaPhi(const ParticleBase& p, const FourVector& v, bool sign=false) {
209 return deltaPhi(p.momentum(), v, sign);
210 }
211
212 inline double deltaPhi(const ParticleBase& p, const Vector3& v, bool sign=false) {
213 return deltaPhi(p.momentum(), v, sign);
214 }
215
216 inline double deltaPhi(const ParticleBase& p, double phi, bool sign=false) {
217 return deltaPhi(p.momentum(), phi, sign);
218 }
219
220 inline double deltaPhi(const FourMomentum& v, const ParticleBase& p, bool sign=false) {
221 return deltaPhi(v, p.momentum(), sign);
222 }
223
224 inline double deltaPhi(const FourVector& v, const ParticleBase& p, bool sign=false) {
225 return deltaPhi(v, p.momentum(), sign);
226 }
227
228 inline double deltaPhi(const Vector3& v, const ParticleBase& p, bool sign=false) {
229 return deltaPhi(v, p.momentum(), sign);
230 }
231
232 inline double deltaPhi(double phi, const ParticleBase& p, bool sign=false) {
233 return deltaPhi(phi, p.momentum(), sign);
234 }
235
236
237 inline double deltaEta(const ParticleBase& p1, const ParticleBase& p2) {
238 return deltaEta(p1.momentum(), p2.momentum());
239 }
240
241 inline double deltaEta(const ParticleBase& p, const FourMomentum& v) {
242 return deltaEta(p.momentum(), v);
243 }
244
245 inline double deltaEta(const ParticleBase& p, const FourVector& v) {
246 return deltaEta(p.momentum(), v);
247 }
248
249 inline double deltaEta(const ParticleBase& p, const Vector3& v) {
250 return deltaEta(p.momentum(), v);
251 }
252
253 inline double deltaEta(const ParticleBase& p, double eta) {
254 return deltaEta(p.momentum(), eta);
255 }
256
257 inline double deltaEta(const FourMomentum& v, const ParticleBase& p) {
258 return deltaEta(v, p.momentum());
259 }
260
261 inline double deltaEta(const FourVector& v, const ParticleBase& p) {
262 return deltaEta(v, p.momentum());
263 }
264
265 inline double deltaEta(const Vector3& v, const ParticleBase& p) {
266 return deltaEta(v, p.momentum());
267 }
268
269 inline double deltaEta(double eta, const ParticleBase& p) {
270 return deltaEta(eta, p.momentum());
271 }
272
273
274 inline double deltaRap(const ParticleBase& p1, const ParticleBase& p2) {
275 return deltaRap(p1.momentum(), p2.momentum());
276 }
277
278 inline double deltaRap(const ParticleBase& p, const FourMomentum& v) {
279 return deltaRap(p.momentum(), v);
280 }
281
282 inline double deltaRap(const ParticleBase& p, double y) {
283 return deltaRap(p.momentum(), y);
284 }
285
286 inline double deltaRap(const FourMomentum& v, const ParticleBase& p) {
287 return deltaRap(v, p.momentum());
288 }
289
290 inline double deltaRap(double y, const ParticleBase& p) {
291 return deltaRap(y, p.momentum());
292 }
293
295
296
297}
298
299#endif
Specialized version of the FourVector with momentum/energy functionality.
Definition Vector4.hh:316
double p2() const
Get the modulus-squared of the 3-momentum.
Definition Vector4.hh:601
double E2() const
Get energy-squared .
Definition Vector4.hh:555
double mass() const
Get the mass (the Lorentz self-invariant).
Definition Vector4.hh:576
double rapidity() const
Calculate the rapidity.
Definition Vector4.hh:607
double p() const
Get the modulus of the 3-momentum.
Definition Vector4.hh:596
double pt() const
Calculate the transverse momentum .
Definition Vector4.hh:649
double Et() const
Calculate the transverse energy .
Definition Vector4.hh:658
double Et2() const
Calculate the transverse energy .
Definition Vector4.hh:654
double pt2() const
Calculate the squared transverse momentum .
Definition Vector4.hh:640
Vector3 pTvec() const
Calculate the transverse momentum vector .
Definition Vector4.hh:627
Vector3 ptvec() const
Synonym for pTvec.
Definition Vector4.hh:631
double mass2() const
Get the squared mass (the Lorentz self-invariant).
Definition Vector4.hh:587
double absrap() const
Absolute rapidity.
Definition Vector4.hh:622
double E() const
Get energy (time component of momentum).
Definition Vector4.hh:553
double absrapidity() const
Absolute rapidity.
Definition Vector4.hh:618
Specialisation of VectorN to a general (non-momentum) Lorentz 4-vector.
Definition Vector4.hh:30
Vector3 vector3() const
Get the spatial part of the 4-vector as a 3-vector.
Definition Vector4.hh:177
double angle(const FourVector &v) const
Angle between this vector and another.
Definition Vector4.hh:95
double phi(const PhiMapping mapping=ZERO_2PI) const
Synonym for azimuthalAngle.
Definition Vector4.hh:149
double abseta() const
Get the directly (alias).
Definition Vector4.hh:174
double azimuthalAngle(const PhiMapping mapping=ZERO_2PI) const
Angle subtended by the 3-vector's projection in x-y and the x-axis.
Definition Vector4.hh:145
double dot(const FourVector &v) const
Contract two 4-vectors, with metric signature (+ - - -).
Definition Vector4.hh:194
double eta() const
Synonym for pseudorapidity.
Definition Vector4.hh:167
double theta() const
Synonym for polarAngle.
Definition Vector4.hh:158
double polarAngle() const
Angle subtended by the 3-vector and the z-axis.
Definition Vector4.hh:154
double abspseudorapidity() const
Get the directly.
Definition Vector4.hh:172
Base class for particle-like things like Particle and Jet.
Definition ParticleBase.hh:13
double py() const
y component of momentum.
Definition ParticleBase.hh:122
double polarAngle() const
Angle subtended by the 3-vector and the z-axis.
Definition ParticleBase.hh:134
const FourMomentum & mom() const
Get equivalent single momentum four-vector (const) (alias).
Definition ParticleBase.hh:39
double dot(const ParticleBase &v) const
Lorentz dot product between this 4-vector and another.
Definition ParticleBase.hh:146
double pT() const
Get the directly (alias).
Definition ParticleBase.hh:63
double absrap() const
Get the directly (alias).
Definition ParticleBase.hh:100
double abspseudorapidity() const
Get the directly.
Definition ParticleBase.hh:89
double angle(const ParticleBase &v) const
Angle between this vector and another.
Definition ParticleBase.hh:139
double dot(const FourVector &v) const
Angle between this 4-vector and another.
Definition ParticleBase.hh:148
double pT2() const
Get the directly (alias).
Definition ParticleBase.hh:70
Vector3 ptvec() const
Get the transverse 3-momentum directly.
Definition ParticleBase.hh:115
double mass2() const
Get the mass**2 directly.
Definition ParticleBase.hh:82
double perp() const
Get the directly (alias).
Definition ParticleBase.hh:65
virtual const FourMomentum & momentum() const =0
Get equivalent single momentum four-vector (const).
double phi(const PhiMapping mapping=ZERO_2PI) const
Get the directly.
Definition ParticleBase.hh:105
double p() const
Get the 3-momentum magnitude directly.
Definition ParticleBase.hh:110
double energy2() const
Get the energy-squared (alias).
Definition ParticleBase.hh:58
ParticleBase()
Default constructor.
Definition ParticleBase.hh:17
double abseta() const
Get the directly (alias).
Definition ParticleBase.hh:91
double pt2() const
Get the directly.
Definition ParticleBase.hh:68
ThreeMomentum p3() const
Get the 3-momentum directly.
Definition ParticleBase.hh:108
double theta() const
Synonym for polarAngle.
Definition ParticleBase.hh:136
double perp2() const
Get the directly (alias).
Definition ParticleBase.hh:72
double mass() const
Get the mass directly.
Definition ParticleBase.hh:80
double pz() const
z component of momentum.
Definition ParticleBase.hh:124
double pt() const
Get the directly.
Definition ParticleBase.hh:61
double Et2() const
Get the directly.
Definition ParticleBase.hh:77
double rap() const
Get the directly (alias).
Definition ParticleBase.hh:96
double pz2() const
z component of momentum, squared.
Definition ParticleBase.hh:131
double px() const
x component of momentum.
Definition ParticleBase.hh:120
double eta() const
Get the directly (alias).
Definition ParticleBase.hh:87
double Et() const
Get the directly.
Definition ParticleBase.hh:75
double rapidity() const
Get the directly.
Definition ParticleBase.hh:94
Vector3 pTvec() const
Get the transverse 3-momentum directly.
Definition ParticleBase.hh:117
virtual ~ParticleBase()
Virtual destructor.
Definition ParticleBase.hh:20
double pseudorapidity() const
Get the directly.
Definition ParticleBase.hh:85
double angle(const FourVector &v) const
Angle between this vector and another.
Definition ParticleBase.hh:141
double E() const
Get the energy directly.
Definition ParticleBase.hh:51
double absrapidity() const
Get the directly.
Definition ParticleBase.hh:98
double py2() const
y component of momentum, squared.
Definition ParticleBase.hh:129
double energy() const
Get the energy directly (alias).
Definition ParticleBase.hh:53
double azimuthalAngle(const PhiMapping mapping=ZERO_2PI) const
Azimuthal angle .
Definition ParticleBase.hh:103
double px2() const
x component of momentum, squared.
Definition ParticleBase.hh:127
double angle(const Vector3 &v3) const
Angle between this vector and another (3-vector)
Definition ParticleBase.hh:143
double p2() const
Get the 3-momentum magnitude-squared directly.
Definition ParticleBase.hh:112
double E2() const
Get the energy-squared.
Definition ParticleBase.hh:56
Specialized version of the ThreeVector with momentum functionality.
Definition Vector3.hh:340
Three-dimensional specialisation of Vector.
Definition Vector3.hh:40
Definition MC_CENT_PPB_Projections.hh:10
constexpr std::enable_if_t< std::is_arithmetic_v< NUM >, int > sign(NUM val)
Find the sign of a number.
Definition MathUtils.hh:264
double deltaR(double rap1, double phi1, double rap2, double phi2)
Definition MathUtils.hh:697
double deltaPhi(double phi1, double phi2, bool sign=false)
Calculate the difference between two angles in radians.
Definition MathUtils.hh:667
double deltaEta(double eta1, double eta2, bool sign=false)
Definition MathUtils.hh:675
PhiMapping
Enum for range of to be mapped into.
Definition MathConstants.hh:49
RapScheme
Enum for rapidity variable to be used in calculating , applying rapidity cuts, etc.
Definition MathConstants.hh:46
double deltaRap(double y1, double y2, bool sign=false)
Definition MathUtils.hh:683