Skip to content

Commit e45f1a8

Browse files
committed
cleanup
1 parent 2768d7d commit e45f1a8

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

ALICE3/Core/Decayer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
/// \file Decayer.h
1414
/// \author Jesper Karlsson Gumprecht
1515
/// \since 15/12/2025
16+
/// \brief Basic class to handle short-lived particle decays in the fast simulation
1617
///
1718

1819
#ifndef ALICE3_CORE_DECAYER_H_

ALICE3/DataModel/OTFMCParticle.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/// \file OTFMCParticle.h
1414
/// \author Jesper Karlsson Gumprecht
1515
/// \since 16/12/2025
16-
/// \brief
16+
/// \brief Redefinition of the mcparticles table specifically for the fast sim
1717
///
1818

1919
#ifndef ALICE3_DATAMODEL_OTFMCPARTICLE_H_

ALICE3/TableProducer/OTF/onTheFlyDecayer.cxx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@
4747
using namespace o2;
4848
using namespace o2::framework;
4949

50-
static constexpr int kNumDecays = 7;
51-
static constexpr int kNumParameters = 1;
52-
static constexpr int defaultParameters[kNumDecays][kNumParameters]{{1}, {1}, {1}, {1}, {1}, {1}, {1}};
50+
static constexpr int NumDecays = 7;
51+
static constexpr int NumParameters = 1;
52+
static constexpr int DefaultParameters[NumDecays][NumParameters]{{1}, {1}, {1}, {1}, {1}, {1}, {1}};
53+
static constexpr float VerySmall = 1e-7f;
5354
static const std::vector<std::string> parameterNames{"enable"};
5455
static const std::vector<std::string> particleNames{"K0s",
5556
"Lambda",
@@ -76,7 +77,7 @@ struct OnTheFlyDecayer {
7677
Configurable<int> seed{"seed", 0, "Set seed for particle decayer"};
7778
Configurable<float> magneticField{"magneticField", 20., "Magnetic field (kG)"};
7879
Configurable<LabeledArray<int>> enabledDecays{"enabledDecays",
79-
{defaultParameters[0], kNumDecays, kNumParameters, particleNames, parameterNames},
80+
{DefaultParameters[0], NumDecays, NumParameters, particleNames, parameterNames},
8081
"Enable option for particle to be decayed: 0 - no, 1 - yes"};
8182

8283
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
@@ -87,7 +88,7 @@ struct OnTheFlyDecayer {
8788
{
8889
decayer.setSeed(seed);
8990
decayer.setBField(magneticField);
90-
for (int i = 0; i < kNumDecays; ++i) {
91+
for (int i = 0; i < NumDecays; ++i) {
9192
if (enabledDecays->get(particleNames[i].c_str(), "enable")) {
9293
mEnabledDecays.push_back(pdgCodes[i]);
9394
}
@@ -114,7 +115,7 @@ struct OnTheFlyDecayer {
114115
for (int64_t index{0}; index < mcParticles.size(); ++index) {
115116
const auto& particle = mcParticles.iteratorAt(index);
116117
std::vector<o2::upgrade::OTFParticle> decayDaughters;
117-
static constexpr int kMaxNestedDecays = 10;
118+
static constexpr int MaxNestedDecays = 10;
118119
int nDecays = 0;
119120
if (canDecay(particle.pdgCode())) {
120121
o2::track::TrackParCov o2track;
@@ -128,7 +129,7 @@ struct OnTheFlyDecayer {
128129
std::vector<o2::upgrade::OTFParticle> cascadingDaughers = decayer.decayParticle(pdgDB, dauTrack, dau.pdgCode());
129130
for (const auto& daudau : cascadingDaughers) {
130131
decayDaughters.push_back(daudau);
131-
if (kMaxNestedDecays < ++nDecays) {
132+
if (MaxNestedDecays < ++nDecays) {
132133
LOG(error) << "Seemingly stuck trying to perpetually decay products from pdg: " << particle.pdgCode();
133134
}
134135
}
@@ -171,18 +172,18 @@ struct OnTheFlyDecayer {
171172
nStoredDaughters += decayDaughters.size();
172173

173174
float phi = o2::constants::math::PI + std::atan2(-1.0f * particle.py(), -1.0f * particle.px());
174-
float eta; // Conditional as https://github.com/AliceO2Group/AliceO2/blob/dev/Framework/Core/include/Framework/AnalysisDataModel.h#L1922
175+
float eta; // As https://github.com/AliceO2Group/AliceO2/blob/dev/Framework/Core/include/Framework/AnalysisDataModel.h#L1922
175176
float pt = std::sqrt(particle.px() * particle.px() + particle.py() * particle.py());
176177
float p = std::sqrt(particle.px() * particle.px() + particle.py() * particle.py() + particle.pz() * particle.pz());
177-
float y; // Conditional as https://github.com/AliceO2Group/AliceO2/blob/dev/Framework/Core/include/Framework/AnalysisDataModel.h#L1943
178+
float y; // As https://github.com/AliceO2Group/AliceO2/blob/dev/Framework/Core/include/Framework/AnalysisDataModel.h#L1943
178179

179-
if ((p - particle.pz()) < 1e-7f) {
180+
if ((p - particle.pz()) < VerySmall) {
180181
eta = (particle.pz() < 0.0f) ? -100.0f : 100.0f;
181182
} else {
182183
eta = 0.5f * std::log((p + particle.pz()) / (p - particle.pz()));
183184
}
184185

185-
if ((particle.e() - particle.pz()) < 1e-7f) {
186+
if ((particle.e() - particle.pz()) < VerySmall) {
186187
y = (particle.pz() < 0.0f) ? -100.0f : 100.0f;
187188
} else {
188189
y = 0.5f * std::log((particle.e() + particle.pz()) / (particle.e() - particle.pz()));
@@ -215,13 +216,13 @@ struct OnTheFlyDecayer {
215216
float p = std::sqrt(dau.px() * dau.px() + dau.py() * dau.py() + dau.pz() * dau.pz());
216217
float y; // Conditional as https://github.com/AliceO2Group/AliceO2/blob/dev/Framework/Core/include/Framework/AnalysisDataModel.h#L1943
217218

218-
if ((p - dau.pz()) < 1e-7f) {
219+
if ((p - dau.pz()) < VerySmall) {
219220
eta = (dau.pz() < 0.0f) ? -100.0f : 100.0f;
220221
} else {
221222
eta = 0.5f * std::log((p + dau.pz()) / (p - dau.pz()));
222223
}
223224

224-
if ((dau.e() - dau.pz()) < 1e-7f) {
225+
if ((dau.e() - dau.pz()) < VerySmall) {
225226
y = (dau.pz() < 0.0f) ? -100.0f : 100.0f;
226227
} else {
227228
y = 0.5f * std::log((dau.e() + dau.pz()) / (dau.e() - dau.pz()));

0 commit comments

Comments
 (0)