Skip to content

Commit 2768d7d

Browse files
committed
Formatting
1 parent a569245 commit 2768d7d

File tree

5 files changed

+82
-80
lines changed

5 files changed

+82
-80
lines changed

ALICE3/Core/Decayer.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#define ALICE3_CORE_DECAYER_H_
2020

2121
#include "ALICE3/Core/TrackUtilities.h"
22+
2223
#include "ReconstructionDataFormats/Track.h"
2324

2425
#include <TDatabasePDG.h>
@@ -28,19 +29,19 @@
2829
#include <TParticlePDG.h>
2930
#include <TRandom3.h>
3031

32+
#include <array>
33+
#include <cmath>
3134
#include <string>
3235
#include <unordered_map>
3336
#include <vector>
34-
#include <array>
35-
#include <cmath>
36-
3737

3838
namespace o2
3939
{
4040
namespace upgrade
4141
{
4242

43-
class Decayer {
43+
class Decayer
44+
{
4445
public:
4546
// Default constructor
4647
Decayer() = default;
@@ -75,11 +76,11 @@ class Decayer {
7576
track.getCircleParams(mBz, circle, sna, csa);
7677
const double rxy = rxyz / std::sqrt(1. + track.getTgl() * track.getTgl());
7778
const double theta = rxy / circle.rC;
78-
79+
7980
vx = ((pos[0] - circle.xC) * std::cos(theta) - (pos[1] - circle.yC) * std::sin(theta)) + circle.xC;
8081
vy = ((pos[1] - circle.yC) * std::cos(theta) + (pos[0] - circle.xC) * std::sin(theta)) + circle.yC;
8182
vz = mom[2] + rxyz * (mom[2] / track.getP());
82-
83+
8384
px = mom[0] * std::cos(theta) - mom[1] * std::sin(theta);
8485
py = mom[1] * std::cos(theta) + mom[0] * std::sin(theta);
8586
}
@@ -89,7 +90,7 @@ class Decayer {
8990
for (int ch = 0; ch < particleInfo->NDecayChannels(); ++ch) {
9091
brTotal += particleInfo->DecayChannel(ch)->BranchingRatio();
9192
}
92-
93+
9394
double brSum = 0.;
9495
std::vector<double> dauMasses;
9596
std::vector<int> pdgCodesDaughters;
@@ -125,21 +126,20 @@ class Decayer {
125126
return decayProducts;
126127
}
127128

128-
129129
void setSeed(const int seed)
130130
{
131-
mRand3.SetSeed(seed); // For decay length sampling
131+
mRand3.SetSeed(seed); // For decay length sampling
132132
gRandom->SetSeed(seed); // For TGenPhaseSpace
133133
}
134134

135-
void setBField(const double b) { mBz = b; }
135+
void setBField(const double b) { mBz = b; }
136136

137137
private:
138138
TRandom3 mRand3;
139139
double mBz;
140140
};
141141

142-
} // namespace fastsim
142+
} // namespace upgrade
143143
} // namespace o2
144144

145145
#endif // ALICE3_CORE_DECAYER_H_

ALICE3/Core/TrackUtilities.h

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,36 @@
2121
#include "ReconstructionDataFormats/Track.h"
2222

2323
#include "TLorentzVector.h"
24-
#include <vector>
25-
2624

25+
#include <vector>
2726

2827
namespace o2::upgrade
2928
{
3029

31-
/// Function to convert a TLorentzVector into a perfect Track
32-
/// \param charge particle charge (integer)
33-
/// \param particle the particle to convert (TLorentzVector)
34-
/// \param productionVertex where the particle was produced
35-
/// \param o2track the address of the resulting TrackParCov
36-
void convertTLorentzVectorToO2Track(const int charge,
37-
const TLorentzVector particle,
38-
const std::vector<double> productionVertex,
39-
o2::track::TrackParCov& o2track);
40-
30+
/// Struct to store mc info for the otf decayer
4131
struct OTFParticle {
4232
int mPdgCode;
4333
float mE;
4434
float mVx, mVy, mVz;
4535
float mPx, mPy, mPz;
4636

37+
// Setters
4738
void setPDG(int pdg) { mPdgCode = pdg; }
48-
void setVxVyVz(float _vx, float _vy, float _vz) { mVx = _vx; mVy = _vy; mVz = _vz; }
49-
void setPxPyPzE(float _px, float _py, float _pz, float _e) { mPx = _px; mPy = _py; mPz = _pz; mE = _e; }
39+
void setVxVyVz(float vx, float vy, float vz)
40+
{
41+
mVx = vx;
42+
mVy = vy;
43+
mVz = vz;
44+
}
45+
void setPxPyPzE(float px, float py, float pz, float e)
46+
{
47+
mPx = px;
48+
mPy = py;
49+
mPz = pz;
50+
mE = e;
51+
}
52+
53+
// Getters
5054
int pdgCode() const { return mPdgCode; }
5155
float vx() const { return mVx; }
5256
float vy() const { return mVy; }
@@ -57,6 +61,16 @@ struct OTFParticle {
5761
float e() const { return mE; }
5862
};
5963

64+
/// Function to convert a TLorentzVector into a perfect Track
65+
/// \param charge particle charge (integer)
66+
/// \param particle the particle to convert (TLorentzVector)
67+
/// \param productionVertex where the particle was produced
68+
/// \param o2track the address of the resulting TrackParCov
69+
void convertTLorentzVectorToO2Track(const int charge,
70+
const TLorentzVector particle,
71+
const std::vector<double> productionVertex,
72+
o2::track::TrackParCov& o2track);
73+
6074
/// Function to convert a TLorentzVector into a perfect Track
6175
/// \param pdgCode particle pdg
6276
/// \param particle the particle to convert (TLorentzVector)

ALICE3/DataModel/OTFMCParticle.h

Lines changed: 19 additions & 19 deletions
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
1717
///
1818

1919
#ifndef ALICE3_DATAMODEL_OTFMCPARTICLE_H_
@@ -27,29 +27,29 @@ namespace o2::aod
2727

2828
namespace otfmcparticle
2929
{
30-
DECLARE_SOA_COLUMN(Phi, phi, float);
31-
DECLARE_SOA_COLUMN(Eta, eta, float);
32-
DECLARE_SOA_COLUMN(Pt, pt, float);
33-
DECLARE_SOA_COLUMN(P, p, float);
34-
DECLARE_SOA_COLUMN(Y, y, float);
35-
}
30+
DECLARE_SOA_COLUMN(Phi, phi, float);
31+
DECLARE_SOA_COLUMN(Eta, eta, float);
32+
DECLARE_SOA_COLUMN(Pt, pt, float);
33+
DECLARE_SOA_COLUMN(P, p, float);
34+
DECLARE_SOA_COLUMN(Y, y, float);
35+
} // namespace otfmcparticle
3636

3737
DECLARE_SOA_TABLE_FULL(McParticlesWithDau, "McParticlesWithDau", "AOD", "MCPARTICLEWITHDAU",
38-
o2::soa::Index<>,
38+
o2::soa::Index<>,
3939
mcparticle::McCollisionId,
40-
mcparticle::PdgCode,
41-
mcparticle::StatusCode,
40+
mcparticle::PdgCode,
41+
mcparticle::StatusCode,
4242
mcparticle::Flags,
43-
mcparticle::MothersIds,
44-
mcparticle::DaughtersIdSlice,
43+
mcparticle::MothersIds,
44+
mcparticle::DaughtersIdSlice,
4545
mcparticle::Weight,
46-
mcparticle::Px,
47-
mcparticle::Py,
48-
mcparticle::Pz,
46+
mcparticle::Px,
47+
mcparticle::Py,
48+
mcparticle::Pz,
4949
mcparticle::E,
50-
mcparticle::Vx,
51-
mcparticle::Vy,
52-
mcparticle::Vz,
50+
mcparticle::Vx,
51+
mcparticle::Vy,
52+
mcparticle::Vz,
5353
mcparticle::Vt,
5454
otfmcparticle::Phi,
5555
otfmcparticle::Eta,
@@ -68,4 +68,4 @@ using McParticleWithDau = McParticlesWithDau::iterator;
6868

6969
} // namespace o2::aod
7070

71-
#endif // ALICE3_DATAMODEL_OTFMCPARTICLE_H_
71+
#endif // ALICE3_DATAMODEL_OTFMCPARTICLE_H_

ALICE3/TableProducer/OTF/onTheFlyDecayer.cxx

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939

4040
#include <TPDGCode.h>
4141

42-
#include <string>
4342
#include <gsl/span>
4443
#include <span>
44+
#include <string>
4545
#include <vector>
4646

4747
using namespace o2;
@@ -68,25 +68,24 @@ static const std::vector<int> pdgCodes{kK0Short,
6868

6969
struct OnTheFlyDecayer {
7070
Produces<aod::McParticlesWithDau> tableMcParticlesWithDau;
71+
7172
o2::upgrade::Decayer decayer;
7273
Service<o2::framework::O2DatabasePDG> pdgDB;
73-
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
7474
std::map<int64_t, std::vector<o2::upgrade::OTFParticle>> mDecayDaughters;
7575

7676
Configurable<int> seed{"seed", 0, "Set seed for particle decayer"};
7777
Configurable<float> magneticField{"magneticField", 20., "Magnetic field (kG)"};
7878
Configurable<LabeledArray<int>> enabledDecays{"enabledDecays",
79-
{defaultParameters[0], kNumDecays, kNumParameters, particleNames, parameterNames},
80-
"Enable option for particle to be decayed: 0 - no, 1 - yes"};
81-
79+
{defaultParameters[0], kNumDecays, kNumParameters, particleNames, parameterNames},
80+
"Enable option for particle to be decayed: 0 - no, 1 - yes"};
8281

82+
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
8383
ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "pt axis for QA histograms"};
8484

85-
8685
std::vector<int> mEnabledDecays;
8786
void init(o2::framework::InitContext&)
8887
{
89-
decayer.setSeed(seed);
88+
decayer.setSeed(seed);
9089
decayer.setBField(magneticField);
9190
for (int i = 0; i < kNumDecays; ++i) {
9291
if (enabledDecays->get(particleNames[i].c_str(), "enable")) {
@@ -106,7 +105,7 @@ struct OnTheFlyDecayer {
106105
bool canDecay(const int pdgCode)
107106
{
108107
return std::find(mEnabledDecays.begin(), mEnabledDecays.end(), pdgCode) != mEnabledDecays.end();
109-
}
108+
}
110109

111110
void process(aod::McCollision const&, aod::McParticles const& mcParticles)
112111
{
@@ -141,8 +140,7 @@ struct OnTheFlyDecayer {
141140
continue;
142141
}
143142
}
144-
145-
143+
146144
if (particle.pdgCode() == kK0Short) {
147145
histos.fill(HIST("K0S/hGenK0S"), particle.pt());
148146
} else if (particle.pdgCode() == kLambda0) {
@@ -192,9 +190,9 @@ struct OnTheFlyDecayer {
192190

193191
// TODO: Particle status code
194192
// TODO: Expression columns
195-
tableMcParticlesWithDau(particle.mcCollisionId(), particle.pdgCode(), particle.statusCode(),
193+
tableMcParticlesWithDau(particle.mcCollisionId(), particle.pdgCode(), particle.statusCode(),
196194
particle.flags(), motherSpan, daughtersIdSlice, particle.weight(),
197-
particle.px(), particle.py(), particle.pz(), particle.e(),
195+
particle.px(), particle.py(), particle.pz(), particle.e(),
198196
particle.vx(), particle.vy(), particle.vz(), particle.vt(),
199197
phi, eta, pt, p, y);
200198
}
@@ -208,7 +206,7 @@ struct OnTheFlyDecayer {
208206
}
209207

210208
auto mother = mcParticles.iteratorAt(index);
211-
std::vector<int> motherIds = { static_cast<int>(index) };
209+
std::vector<int> motherIds = {static_cast<int>(index)};
212210
std::span<const int> motherSpan(motherIds.data(), motherIds.size());
213211

214212
float phi = o2::constants::math::PI + std::atan2(-1.0f * dau.py(), -1.0f * dau.px());
@@ -229,11 +227,11 @@ struct OnTheFlyDecayer {
229227
y = 0.5f * std::log((dau.e() + dau.pz()) / (dau.e() - dau.pz()));
230228
}
231229

232-
233230
// TODO: Particle status code
234231
// TODO: Expression columns
232+
// TODO: vt
235233
tableMcParticlesWithDau(mother.mcCollisionId(), dau.pdgCode(), 1,
236-
mother.flags(), motherSpan, daughtersIdSlice, mother.weight(),
234+
mother.flags(), motherSpan, daughtersIdSlice, mother.weight(),
237235
dau.px(), dau.py(), dau.pz(), dau.e(),
238236
dau.vx(), dau.vy(), dau.vz(), mother.vt(),
239237
phi, eta, pt, p, y);
@@ -242,8 +240,7 @@ struct OnTheFlyDecayer {
242240
}
243241
};
244242

245-
246243
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
247244
{
248245
return WorkflowSpec{adaptAnalysisTask<OnTheFlyDecayer>(cfgc)};
249-
}
246+
}

ALICE3/Tasks/alice3DecayerQA.cxx

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,49 +13,43 @@
1313
///
1414
/// \brief QA task for otf decayer
1515
///
16-
/// \author Jesper Karlsson Gumprecht <jesper.gumprecht@cern.ch>
16+
/// \author Jesper Karlsson Gumprecht <jesper.gumprecht@cern.ch>
1717
/// \since Dec 23, 2025
1818
///
1919

20-
#include <map>
21-
#include <vector>
20+
#include "ALICE3/DataModel/OTFMCParticle.h"
2221

23-
#include <Framework/AnalysisDataModel.h>
22+
#include "Framework/ASoAHelpers.h"
2423
#include "Framework/AnalysisTask.h"
25-
#include "Framework/runDataProcessing.h"
26-
#include "Framework/HistogramRegistry.h"
2724
#include "Framework/ConfigParamRegistry.h"
28-
#include "Framework/ASoAHelpers.h"
29-
30-
#include "ALICE3/DataModel/OTFMCParticle.h"
25+
#include "Framework/HistogramRegistry.h"
26+
#include "Framework/runDataProcessing.h"
27+
#include <Framework/AnalysisDataModel.h>
3128

3229
#include <TPDGCode.h>
3330

31+
#include <map>
32+
#include <vector>
3433

3534
using namespace o2;
3635
using namespace o2::framework;
3736

3837
struct Alice3DecayerQA {
3938
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
40-
41-
ConfigurableAxis axisLambdaMass{"axisLambdaMass", {200, 1.101f, 1.131f}, ""};
42-
ConfigurableAxis axisXiMass{"axisXiMass", {200, 1.22f, 1.42f}, ""};
43-
ConfigurableAxis axisRadius{"axisRadius", {1000, 0, 100}, "Radius"};
4439
ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "pt axis for QA histograms"};
4540

4641
Partition<aod::McParticles> trueEl = aod::mcparticle::pdgCode == static_cast<int>(kElectron);
4742
Partition<aod::McParticles> trueMu = aod::mcparticle::pdgCode == static_cast<int>(kMuonMinus);
4843
Partition<aod::McParticles> truePi = aod::mcparticle::pdgCode == static_cast<int>(kPiPlus);
4944
Partition<aod::McParticles> trueKa = aod::mcparticle::pdgCode == static_cast<int>(kKMinus);
5045
Partition<aod::McParticles> truePr = aod::mcparticle::pdgCode == static_cast<int>(kProton);
51-
46+
5247
Partition<aod::McParticlesWithDau> trueElWithDau = aod::mcparticle::pdgCode == static_cast<int>(kElectron);
5348
Partition<aod::McParticlesWithDau> trueMuWithDau = aod::mcparticle::pdgCode == static_cast<int>(kMuonMinus);
5449
Partition<aod::McParticlesWithDau> truePiWithDau = aod::mcparticle::pdgCode == static_cast<int>(kPiPlus);
5550
Partition<aod::McParticlesWithDau> trueKaWithDau = aod::mcparticle::pdgCode == static_cast<int>(kKMinus);
5651
Partition<aod::McParticlesWithDau> truePrWithDau = aod::mcparticle::pdgCode == static_cast<int>(kProton);
5752

58-
5953
void init(o2::framework::InitContext&)
6054
{
6155
histos.add("DefaultMC/hElPt", "hElPt", kTH1D, {axisPt});
@@ -69,9 +63,6 @@ struct Alice3DecayerQA {
6963
histos.add("MCWithDau/hPiPt", "hPiPt", kTH1D, {axisPt});
7064
histos.add("MCWithDau/hKaPt", "hKaPt", kTH1D, {axisPt});
7165
histos.add("MCWithDau/hPrPt", "hPrPt", kTH1D, {axisPt});
72-
73-
histos.add("Lambda/hGenLambda", "hGenLambda", kTH2D, {axisRadius, axisPt});
74-
histos.add("Xi/hGenXi", "hGenXi", kTH2D, {axisRadius, axisPt});
7566
}
7667

7768
void processMC(const aod::McParticles&)
@@ -113,7 +104,7 @@ struct Alice3DecayerQA {
113104
}
114105

115106
PROCESS_SWITCH(Alice3DecayerQA, processMC, "fill MC-only histograms", true);
116-
PROCESS_SWITCH(Alice3DecayerQA, processMCWithDau, "fill MC-only histograms", true);
107+
PROCESS_SWITCH(Alice3DecayerQA, processMCWithDau, "fill MC-with-dau histograms", true);
117108
};
118109

119110
WorkflowSpec defineDataProcessing(ConfigContext const& ctx)

0 commit comments

Comments
 (0)