Skip to content

Commit 4171bb5

Browse files
authored
RecoDecay: Standardise function names (#872)
1 parent 947f140 commit 4171bb5

44 files changed

Lines changed: 268 additions & 268 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Common/Core/RecoDecay.h

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -170,31 +170,31 @@ class RecoDecay
170170
/// \param mom 3-momentum array
171171
/// \return pseudorapidity
172172
template <typename T>
173-
static double Eta(const array<T, 3>& mom)
173+
static double eta(const array<T, 3>& mom)
174174
{
175175
// eta = arctanh(pz/p)
176176
if (std::abs(mom[0]) < Almost0 && std::abs(mom[1]) < Almost0) { // very small px and py
177177
return (double)(mom[2] > 0 ? VeryBig : -VeryBig);
178178
}
179-
return (double)(std::atanh(mom[2] / P(mom)));
179+
return (double)(std::atanh(mom[2] / p(mom)));
180180
}
181181

182182
/// Calculates rapidity.
183183
/// \param mom 3-momentum array
184184
/// \param mass mass
185185
/// \return rapidity
186186
template <typename T, typename U>
187-
static double Y(const array<T, 3>& mom, U mass)
187+
static double y(const array<T, 3>& mom, U mass)
188188
{
189189
// y = arctanh(pz/E)
190-
return std::atanh(mom[2] / E(mom, mass));
190+
return std::atanh(mom[2] / e(mom, mass));
191191
}
192192

193193
/// Calculates azimuth from x and y components.
194194
/// \param x,y {x, y} components
195195
/// \return azimuth within [0, 2π]
196196
template <typename T, typename U>
197-
static double Phi(T x, U y)
197+
static double phi(T x, U y)
198198
{
199199
// conversion from [-π, +π] returned by atan2 to [0, 2π]
200200
return std::atan2((double)(-y), (double)(-x)) + o2::constants::math::PI;
@@ -205,9 +205,9 @@ class RecoDecay
205205
/// \param vec vector (container of elements accessible by index)
206206
/// \return azimuth within [0, 2π]
207207
template <typename T>
208-
static double Phi(const T& vec)
208+
static double phi(const T& vec)
209209
{
210-
return Phi(vec[0], vec[1]);
210+
return phi(vec[0], vec[1]);
211211
}
212212

213213
/// Constrains angle to be within a range.
@@ -233,7 +233,7 @@ class RecoDecay
233233
/// \param mom 3-momentum array
234234
/// \return cosine of pointing angle
235235
template <typename T, typename U, typename V>
236-
static double CPA(const T& posPV, const U& posSV, const array<V, 3>& mom)
236+
static double cpa(const T& posPV, const U& posSV, const array<V, 3>& mom)
237237
{
238238
// CPA = (l . p)/(|l| |p|)
239239
auto lineDecay = array{posSV[0] - posPV[0], posSV[1] - posPV[1], posSV[2] - posPV[2]};
@@ -253,7 +253,7 @@ class RecoDecay
253253
/// \param mom {x, y, z} or {x, y} momentum array
254254
/// \return cosine of pointing angle in {x, y}
255255
template <std::size_t N, typename T, typename U, typename V>
256-
static double CPAXY(const T& posPV, const U& posSV, const array<V, N>& mom)
256+
static double cpaXY(const T& posPV, const U& posSV, const array<V, N>& mom)
257257
{
258258
// CPAXY = (r . pT)/(|r| |pT|)
259259
auto lineDecay = array{posSV[0] - posPV[0], posSV[1] - posPV[1]};
@@ -275,10 +275,10 @@ class RecoDecay
275275
/// \param length decay length
276276
/// \return proper lifetime times c
277277
template <typename T, typename U, typename V>
278-
static double Ct(const array<T, 3>& mom, U length, V mass)
278+
static double ct(const array<T, 3>& mom, U length, V mass)
279279
{
280280
// c t = l m c^2/(p c)
281-
return (double)length * (double)mass / P(mom);
281+
return (double)length * (double)mass / p(mom);
282282
}
283283

284284
/// Calculates cosine of θ* (theta star).
@@ -289,11 +289,11 @@ class RecoDecay
289289
/// \param iProng index of the prong
290290
/// \return cosine of θ* of the i-th prong under the assumption of the invariant mass
291291
template <typename T, typename U, typename V>
292-
static double CosThetaStar(const array<array<T, 3>, 2>& arrMom, const array<U, 2>& arrMass, V mTot, int iProng)
292+
static double cosThetaStar(const array<array<T, 3>, 2>& arrMom, const array<U, 2>& arrMass, V mTot, int iProng)
293293
{
294-
auto pVecTot = PVec(arrMom[0], arrMom[1]); // momentum of the mother particle
295-
auto pTot = P(pVecTot); // magnitude of the momentum of the mother particle
296-
auto eTot = E(pTot, mTot); // energy of the mother particle
294+
auto pVecTot = pVec(arrMom[0], arrMom[1]); // momentum of the mother particle
295+
auto pTot = p(pVecTot); // magnitude of the momentum of the mother particle
296+
auto eTot = e(pTot, mTot); // energy of the mother particle
297297
auto gamma = eTot / mTot; // γ, Lorentz gamma factor of the mother particle
298298
auto beta = pTot / eTot; // β, velocity of the mother particle
299299
auto pStar = std::sqrt(sq(sq(mTot) - sq(arrMass[0]) - sq(arrMass[1])) - sq(2 * arrMass[0] * arrMass[1])) / (2 * mTot); // p*, prong momentum in the rest frame of the mother particle
@@ -302,22 +302,22 @@ class RecoDecay
302302
// p_L,i = γ (p*_L,i + β E*_i)
303303
// p*_L,i = p_L,i/γ - β E*_i
304304
// cos(θ*_i) = (p_L,i/γ - β E*_i)/p*
305-
return (dotProd(arrMom[iProng], pVecTot) / (pTot * gamma) - beta * E(pStar, arrMass[iProng])) / pStar;
305+
return (dotProd(arrMom[iProng], pVecTot) / (pTot * gamma) - beta * e(pStar, arrMass[iProng])) / pStar;
306306
}
307307

308308
/// Sums 3-momenta.
309309
/// \param args pack of 3-momentum arrays
310310
/// \return total 3-momentum array
311311
template <typename... T>
312-
static auto PVec(const array<T, 3>&... args)
312+
static auto pVec(const array<T, 3>&... args)
313313
{
314314
return sumOfVec(args...);
315315
}
316316

317317
/// Calculates momentum squared from momentum components.
318318
/// \param px,py,pz {x, y, z} momentum components
319319
/// \return momentum squared
320-
static double P2(double px, double py, double pz)
320+
static double p2(double px, double py, double pz)
321321
{
322322
return sumOfSquares(px, py, pz);
323323
}
@@ -326,7 +326,7 @@ class RecoDecay
326326
/// \param args pack of 3-momentum arrays
327327
/// \return total momentum squared
328328
template <typename... T>
329-
static double P2(const array<T, 3>&... args)
329+
static double p2(const array<T, 3>&... args)
330330
{
331331
return sumOfSquares(getElement(0, args...), getElement(1, args...), getElement(2, args...));
332332
}
@@ -335,15 +335,15 @@ class RecoDecay
335335
/// \param args {x, y, z} momentum components or pack of 3-momentum arrays
336336
/// \return (total) momentum magnitude
337337
template <typename... T>
338-
static double P(const T&... args)
338+
static double p(const T&... args)
339339
{
340-
return std::sqrt(P2(args...));
340+
return std::sqrt(p2(args...));
341341
}
342342

343343
/// Calculates transverse momentum squared from momentum components.
344344
/// \param px,py {x, y} momentum components
345345
/// \return transverse momentum squared
346-
static double Pt2(double px, double py)
346+
static double pt2(double px, double py)
347347
{
348348
return sumOfSquares(px, py);
349349
}
@@ -352,7 +352,7 @@ class RecoDecay
352352
/// \param args pack of 3-(or 2-)momentum arrays
353353
/// \return total transverse momentum squared
354354
template <std::size_t N, typename... T>
355-
static double Pt2(const array<T, N>&... args)
355+
static double pt2(const array<T, N>&... args)
356356
{
357357
return sumOfSquares(getElement(0, args...), getElement(1, args...));
358358
}
@@ -361,17 +361,17 @@ class RecoDecay
361361
/// \param args {x, y} momentum components or pack of 3-(or 2-)momentum arrays
362362
/// \return (total) transverse momentum
363363
template <typename... T>
364-
static double Pt(const T&... args)
364+
static double pt(const T&... args)
365365
{
366-
return std::sqrt(Pt2(args...));
366+
return std::sqrt(pt2(args...));
367367
}
368368

369369
/// Calculates energy squared from momentum and mass.
370370
/// \param args momentum magnitude, mass
371371
/// \param args {x, y, z} momentum components, mass
372372
/// \return energy squared
373373
template <typename... T>
374-
static double E2(T... args)
374+
static double e2(T... args)
375375
{
376376
return sumOfSquares(args...);
377377
}
@@ -381,9 +381,9 @@ class RecoDecay
381381
/// \param mass mass
382382
/// \return energy squared
383383
template <typename T, typename U>
384-
static double E2(const array<T, 3>& mom, U mass)
384+
static double e2(const array<T, 3>& mom, U mass)
385385
{
386-
return E2(mom[0], mom[1], mom[2], mass);
386+
return e2(mom[0], mom[1], mom[2], mass);
387387
}
388388

389389
/// Calculates energy from momentum and mass.
@@ -392,16 +392,16 @@ class RecoDecay
392392
/// \param args 3-momentum array, mass
393393
/// \return energy
394394
template <typename... T>
395-
static double E(const T&... args)
395+
static double e(const T&... args)
396396
{
397-
return std::sqrt(E2(args...));
397+
return std::sqrt(e2(args...));
398398
}
399399

400400
/// Calculates invariant mass squared from momentum magnitude and energy.
401401
/// \param mom momentum magnitude
402402
/// \param energy energy
403403
/// \return invariant mass squared
404-
static double M2(double mom, double energy)
404+
static double m2(double mom, double energy)
405405
{
406406
return energy * energy - mom * mom;
407407
}
@@ -411,9 +411,9 @@ class RecoDecay
411411
/// \param energy energy
412412
/// \return invariant mass squared
413413
template <typename T>
414-
static double M2(const array<T, 3>& mom, double energy)
414+
static double m2(const array<T, 3>& mom, double energy)
415415
{
416-
return energy * energy - P2(mom);
416+
return energy * energy - p2(mom);
417417
}
418418

419419
/// Calculates invariant mass squared from momenta and masses of several particles (prongs).
@@ -422,17 +422,17 @@ class RecoDecay
422422
/// \param arrMass array of N masses (in the same order as arrMom)
423423
/// \return invariant mass squared
424424
template <std::size_t N, typename T, typename U>
425-
static double M2(const array<array<T, 3>, N>& arrMom, const array<U, N>& arrMass)
425+
static double m2(const array<array<T, 3>, N>& arrMom, const array<U, N>& arrMass)
426426
{
427427
array<double, 3> momTotal{0., 0., 0.}; // candidate momentum vector
428428
double energyTot{0.}; // candidate energy
429429
for (std::size_t iProng = 0; iProng < N; ++iProng) {
430430
for (std::size_t iMom = 0; iMom < 3; ++iMom) {
431431
momTotal[iMom] += arrMom[iProng][iMom];
432432
} // loop over momentum components
433-
energyTot += E(arrMom[iProng], arrMass[iProng]);
433+
energyTot += e(arrMom[iProng], arrMass[iProng]);
434434
} // loop over prongs
435-
return energyTot * energyTot - P2(momTotal);
435+
return energyTot * energyTot - p2(momTotal);
436436
}
437437

438438
/// Calculates invariant mass.
@@ -441,9 +441,9 @@ class RecoDecay
441441
/// \param args array of momenta, array of masses
442442
/// \return invariant mass
443443
template <typename... T>
444-
static double M(const T&... args)
444+
static double m(const T&... args)
445445
{
446-
return std::sqrt(M2(args...));
446+
return std::sqrt(m2(args...));
447447
}
448448

449449
// Calculation of topological quantities
@@ -454,11 +454,11 @@ class RecoDecay
454454
/// \param mom {x, y, z} particle momentum array
455455
/// \return impact parameter in {x, y}
456456
template <typename T, typename U, typename V>
457-
static double ImpParXY(const T& point, const U& posSV, const array<V, 3>& mom)
457+
static double impParXY(const T& point, const U& posSV, const array<V, 3>& mom)
458458
{
459459
// Ported from AliAODRecoDecay::ImpParXY
460460
auto flightLineXY = array{posSV[0] - point[0], posSV[1] - point[1]};
461-
auto k = dotProd(flightLineXY, array{mom[0], mom[1]}) / Pt2(mom);
461+
auto k = dotProd(flightLineXY, array{mom[0], mom[1]}) / pt2(mom);
462462
auto dx = flightLineXY[0] - k * (double)mom[0];
463463
auto dy = flightLineXY[1] - k * (double)mom[1];
464464
auto absImpPar = sqrtSumOfSquares(dx, dy);
@@ -482,7 +482,7 @@ class RecoDecay
482482
{
483483
// Ported from AliAODRecoDecayHF::Getd0MeasMinusExpProng adding normalization directly in the function
484484
auto sinThetaP = ((double)momProng[0] * (double)momMother[1] - (double)momProng[1] * (double)momMother[0]) /
485-
(Pt(momProng) * Pt(momMother));
485+
(pt(momProng) * pt(momMother));
486486
auto diff = impParProng - (double)decLenXY * sinThetaP;
487487
auto errImpParExpProng = (double)errDecLenXY * sinThetaP;
488488
auto errDiff = sqrtSumOfSquares(errImpParProng, errImpParExpProng);

0 commit comments

Comments
 (0)