Skip to content

Commit 8ea40f2

Browse files
author
ayatsuji
committed
Merge remote-tracking branch 'upstream/master' into track-rotation-ep-preserving-mepm-rotated-legs
2 parents 99c6855 + 94313d8 commit 8ea40f2

796 files changed

Lines changed: 75927 additions & 31112 deletions

File tree

Some content is hidden

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

‎.clang-tidy‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,56 @@ WarningsAsErrors: >-
113113
-readability-suspicious-call-argument,
114114
-modernize-*,
115115
-readability-*,
116+
-bugprone-assignment-in-if-condition,
117+
-bugprone-branch-clone,
118+
-bugprone-copy-constructor-init,
119+
-bugprone-empty-catch,
120+
-bugprone-exception-escape,
121+
-bugprone-fold-init-type,
122+
-bugprone-incorrect-roundings,
123+
-bugprone-integer-division,
124+
-bugprone-macro-parentheses,
125+
-bugprone-narrowing-conversions,
126+
-bugprone-non-zero-enum-to-bool-conversion,
127+
-bugprone-redundant-branch-condition,
128+
-bugprone-reserved-identifier,
129+
-bugprone-suspicious-include,
130+
-bugprone-suspicious-missing-comma,
131+
-bugprone-switch-missing-default-case,
132+
-bugprone-too-small-loop-variable,
133+
-bugprone-unchecked-optional-access,
134+
-bugprone-unsafe-functions,
135+
-bugprone-unused-local-non-trivial-variable,
136+
-cppcoreguidelines-avoid-const-or-ref-data-members,
137+
-cppcoreguidelines-avoid-non-const-global-variables,
138+
-cppcoreguidelines-init-variables,
139+
-cppcoreguidelines-macro-usage,
140+
-cppcoreguidelines-missing-std-forward,
141+
-cppcoreguidelines-prefer-member-initializer,
142+
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
143+
-cppcoreguidelines-pro-type-const-cast,
144+
-cppcoreguidelines-pro-type-cstyle-cast,
145+
-cppcoreguidelines-pro-type-member-init,
146+
-cppcoreguidelines-pro-type-reinterpret-cast,
147+
-cppcoreguidelines-pro-type-static-cast-downcast,
148+
-cppcoreguidelines-pro-type-union-access,
149+
-cppcoreguidelines-slicing,
150+
-cppcoreguidelines-virtual-class-destructor,
151+
# Positives for the following checks are currently being fixed and should be reported as errors.
152+
# clang-analyzer-*
153+
# clang-diagnostic-*
154+
# google-default-arguments
155+
# misc-include-cleaner
156+
# misc-redundant-expression
157+
# misc-unused-parameters
158+
# performance-for-range-copy
159+
# performance-inefficient-string-concatenation
160+
# performance-inefficient-vector-operation
161+
# performance-move-const-arg
162+
# performance-no-automatic-move
163+
# performance-type-promotion-in-math-fn
164+
# performance-unnecessary-copy-initialization
165+
# performance-unnecessary-value-param
116166
CheckOptions:
117167
modernize-avoid-c-arrays.AllowStringArrays: true
118168
# Common tolerated conversions

‎ALICE3/Core/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ o2physics_add_library(ALICE3Core
2020
o2physics_target_root_dictionary(ALICE3Core
2121
HEADERS TrackUtilities.h
2222
FlatLutEntry.h
23+
OTFParticle.h
2324
GeometryContainer.h
2425
LINKDEF ALICE3CoreLinkDef.h)
2526

‎ALICE3/Core/Decayer.h‎

Lines changed: 54 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,12 @@
3131
#include <TLorentzVector.h>
3232
#include <TRandom3.h>
3333

34+
#include <array>
3435
#include <cmath>
3536
#include <cstddef>
3637
#include <vector>
3738

38-
namespace o2
39-
{
40-
namespace upgrade
39+
namespace o2::upgrade
4140
{
4241

4342
class Decayer
@@ -47,44 +46,27 @@ class Decayer
4746
Decayer() = default;
4847

4948
template <typename TDatabase>
50-
std::vector<o2::upgrade::OTFParticle> decayParticle(const TDatabase& pdgDB, const OTFParticle& particle)
49+
std::vector<o2::upgrade::OTFParticle> decayParticle(const OTFParticle& particle, const TDatabase& pdgDB)
5150
{
52-
const auto& particleInfo = pdgDB->GetParticle(particle.pdgCode());
51+
auto particleInfo = pdgDB->GetParticle(particle.pdgCode());
5352
if (!particleInfo) {
5453
return {};
5554
}
5655

5756
const int charge = particleInfo->Charge() / 3;
5857
const double mass = particleInfo->Mass();
59-
60-
const double u = mRand3.Uniform(0.001, 0.999);
61-
const double ctau = o2::constants::physics::LightSpeedCm2S * particleInfo->Lifetime(); // cm
62-
const double betaGamma = particle.p() / mass;
63-
const double rxyz = -betaGamma * ctau * std::log(1 - u);
64-
double px, py, e;
58+
std::array<double, 3> decayVtx = generateDecayVertex<double>(particle, pdgDB);
59+
mVx = decayVtx[0];
60+
mVy = decayVtx[1];
61+
mVz = decayVtx[2];
62+
double px{}, py{}, e{};
6563

6664
if (!charge) {
67-
mVx = particle.vx() + rxyz * (particle.px() / particle.p());
68-
mVy = particle.vy() + rxyz * (particle.py() / particle.p());
69-
mVz = particle.vz() + rxyz * (particle.pz() / particle.p());
7065
px = particle.px();
7166
py = particle.py();
7267
} else {
73-
o2::track::TrackParCov track;
74-
o2::math_utils::CircleXYf_t circle;
75-
o2::upgrade::convertOTFParticleToO2Track(particle, track, pdgDB);
76-
77-
float sna{}, csa{};
78-
track.getCircleParams(mBz, circle, sna, csa);
79-
const double rxy = rxyz / std::sqrt(1. + track.getTgl() * track.getTgl());
80-
const double theta = rxy / circle.rC;
81-
82-
mVx = ((particle.vx() - circle.xC) * std::cos(theta) - (particle.vy() - circle.yC) * std::sin(theta)) + circle.xC;
83-
mVy = ((particle.vy() - circle.yC) * std::cos(theta) + (particle.vx() - circle.xC) * std::sin(theta)) + circle.yC;
84-
mVz = particle.vz() + rxyz * (particle.pz() / track.getP());
85-
86-
px = particle.px() * std::cos(theta) - particle.py() * std::sin(theta);
87-
py = particle.py() * std::cos(theta) + particle.px() * std::sin(theta);
68+
px = particle.px() * std::cos(mTheta) - particle.py() * std::sin(mTheta);
69+
py = particle.py() * std::cos(mTheta) + particle.px() * std::sin(mTheta);
8870
}
8971

9072
double brTotal = 0.;
@@ -133,6 +115,42 @@ class Decayer
133115
return decayProducts;
134116
}
135117

118+
template <typename T = float, typename TDatabase, typename TParticle>
119+
std::array<T, 3> generateDecayVertex(const TParticle& particle, const TDatabase& pdgDB)
120+
{
121+
std::array<T, 3> decayVertex{};
122+
auto particleInfo = pdgDB->GetParticle(particle.pdgCode());
123+
if (!particleInfo) {
124+
return {};
125+
}
126+
127+
const int charge = particleInfo->Charge() / 3;
128+
const double mass = particleInfo->Mass();
129+
const double u = mRand3.Uniform(0.001, 0.999);
130+
const double ctau = o2::constants::physics::LightSpeedCm2S * particleInfo->Lifetime(); // cm
131+
const double betaGamma = particle.p() / mass;
132+
const double rxyz = -betaGamma * ctau * std::log(1 - u);
133+
134+
if (!charge) {
135+
decayVertex[0] = particle.vx() + rxyz * (particle.px() / particle.p());
136+
decayVertex[1] = particle.vy() + rxyz * (particle.py() / particle.p());
137+
decayVertex[2] = particle.vz() + rxyz * (particle.pz() / particle.p());
138+
} else {
139+
o2::math_utils::CircleXYf_t circle;
140+
o2::track::TrackParCov track = o2::upgrade::convertMCParticleToO2Track(particle, pdgDB);
141+
142+
float sna{}, csa{};
143+
track.getCircleParams(mBz, circle, sna, csa);
144+
const double rxy = rxyz / std::sqrt(1. + track.getTgl() * track.getTgl());
145+
mTheta = rxy / circle.rC;
146+
147+
decayVertex[0] = ((particle.vx() - circle.xC) * std::cos(mTheta) - (particle.vy() - circle.yC) * std::sin(mTheta)) + circle.xC;
148+
decayVertex[1] = ((particle.vy() - circle.yC) * std::cos(mTheta) + (particle.vx() - circle.xC) * std::sin(mTheta)) + circle.yC;
149+
decayVertex[2] = particle.vz() + rxyz * (particle.pz() / track.getP());
150+
}
151+
return decayVertex;
152+
}
153+
136154
// Setters
137155
void setBField(const double b) { mBz = b; }
138156
void setSeed(const int seed)
@@ -142,18 +160,18 @@ class Decayer
142160
}
143161

144162
// Getters
145-
float getSecondaryVertexX() const { return static_cast<float>(mVx); }
146-
float getSecondaryVertexY() const { return static_cast<float>(mVy); }
147-
float getSecondaryVertexZ() const { return static_cast<float>(mVz); }
148-
float getDecayRadius() const { return static_cast<float>(std::hypot(mVx, mVy)); }
163+
[[nodiscard]] float getSecondaryVertexX() const { return static_cast<float>(mVx); }
164+
[[nodiscard]] float getSecondaryVertexY() const { return static_cast<float>(mVy); }
165+
[[nodiscard]] float getSecondaryVertexZ() const { return static_cast<float>(mVz); }
166+
[[nodiscard]] float getDecayRadius() const { return static_cast<float>(std::hypot(mVx, mVy)); }
149167

150168
private:
151169
double mBz{20.}; // kG
152170
double mVx{-1.}, mVy{-1.}, mVz{-1.};
153-
TRandom3 mRand3{};
171+
double mTheta{};
172+
TRandom3 mRand3;
154173
};
155174

156-
} // namespace upgrade
157-
} // namespace o2
175+
} // namespace o2::upgrade
158176

159177
#endif // ALICE3_CORE_DECAYER_H_

‎ALICE3/Core/DelphesO2LutWriter.cxx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ void DelphesO2LutWriter::diagonalise(lutEntry_t& lutEntry)
376376
// m.Print();
377377
TMatrixDSymEigen eigen(m);
378378
// eigenvalues vector
379-
TVectorD eigenVal = eigen.GetEigenValues();
379+
const TVectorD& eigenVal = eigen.GetEigenValues();
380380
for (int i = 0; i < kEig; ++i)
381381
lutEntry.eigval[i] = eigenVal[i];
382382
// eigenvectors matrix

0 commit comments

Comments
 (0)