Skip to content

Commit 2f144fe

Browse files
Merge branch 'master' into NewStraEvSelDataModel
2 parents 5959fc9 + eadcb31 commit 2f144fe

130 files changed

Lines changed: 10958 additions & 3863 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.

ALICE3/Core/Decayer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ class Decayer
126126
particle.setPDG(pdgCodesDaughters[i]);
127127
particle.setVxVyVz(mVx, mVy, mVz);
128128
particle.setPxPyPzE(dau.Px(), dau.Py(), dau.Pz(), dau.E());
129+
particle.setBitOn(o2::upgrade::DecayerBits::ProducedByDecayer);
129130
decayProducts.push_back(particle);
130131
}
131132

ALICE3/Core/OTFParticle.h

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,18 @@
2121
#include <CommonConstants/MathConstants.h>
2222

2323
#include <array>
24+
#include <bitset>
2425
#include <cmath>
2526
#include <cstdint>
2627
#include <span>
2728

2829
namespace o2::upgrade
2930
{
3031

32+
enum class DecayerBits { ProducedByDecayer = 0,
33+
IsPrimary,
34+
IsAlive };
35+
3136
class OTFParticle
3237
{
3338
public:
@@ -47,20 +52,29 @@ class OTFParticle
4752
mVy = particle.vy();
4853
mVz = particle.vz();
4954
mVt = particle.vt();
55+
mFlag = particle.flags();
56+
mStatusCode = particle.statusCode();
5057
mIsFromMcParticles = true;
5158
if (particle.has_mothers()) {
5259
mIndicesMother = {particle.mothersIds().front(), particle.mothersIds().back()};
5360
}
61+
if constexpr (requires { particle.decayerBits(); }) {
62+
mBits = particle.decayerBits();
63+
} else {
64+
// If we are here, we created particle in the standard workflow -- without secondaries
65+
// Then we should set all particles as physical primaries accordingly
66+
setBitOn(DecayerBits::IsPrimary);
67+
}
5468
}
5569

5670
// Setters
57-
void setIsAlive(const bool isAlive) { mIsAlive = isAlive; }
5871
void setIsPrimary(const bool isPrimary) { mIsPrimary = isPrimary; }
5972
void setCollisionId(const int collisionId) { mCollisionId = collisionId; }
6073
void setPDG(const int pdg) { mPdgCode = pdg; }
6174
void setIndicesMother(const int start, const int stop) { mIndicesMother = {start, stop}; }
6275
void setIndicesDaughter(const int start, const int stop) { mIndicesDaughter = {start, stop}; }
6376
void setProductionTime(const float vt) { mVt = vt; }
77+
void setFlags(uint8_t flag) { mFlag = flag; }
6478
void setVxVyVz(const float vx, const float vy, const float vz)
6579
{
6680
mVx = vx;
@@ -87,16 +101,8 @@ class OTFParticle
87101
static constexpr float Weight = 1.f;
88102
return Weight;
89103
}
90-
uint8_t flags() const
91-
{
92-
static constexpr uint8_t Flags = 1;
93-
return Flags; // todo
94-
}
95-
int statusCode() const
96-
{
97-
static constexpr int StatusCode = 1;
98-
return StatusCode; // todo
99-
}
104+
uint8_t flags() const { return mFlag; }
105+
int statusCode() const { return mStatusCode; }
100106
float vx() const { return mVx; }
101107
float vy() const { return mVy; }
102108
float vz() const { return mVz; }
@@ -112,7 +118,8 @@ class OTFParticle
112118
float phi() const { return o2::constants::math::PI + std::atan2(-1.0f * py(), -1.0f * px()); }
113119
float eta() const
114120
{
115-
// As https://github.com/AliceO2Group/AliceO2/blob/dev/Framework/Core/include/Framework/AnalysisDataModel.h#L1943
121+
// Conditionally defined to avoid FPEs
122+
// As https://github.com/AliceO2Group/AliceO2/blob/dev/Framework/Core/include/Framework/AnalysisDataModel.h#L1959
116123
static constexpr float Tolerance = 1e-7f;
117124
if ((p() - mPz) < Tolerance) {
118125
return (mPz < 0.0f) ? -100.0f : 100.0f;
@@ -122,7 +129,8 @@ class OTFParticle
122129
}
123130
float y() const
124131
{
125-
// As https://github.com/AliceO2Group/AliceO2/blob/dev/Framework/Core/include/Framework/AnalysisDataModel.h#L1922
132+
// Conditionally defined to avoid FPEs
133+
// As https://github.com/AliceO2Group/AliceO2/blob/dev/Framework/Core/include/Framework/AnalysisDataModel.h#L1980
126134
static constexpr float Tolerance = 1e-7f;
127135
if ((e() - mPz) < Tolerance) {
128136
return (mPz < 0.0f) ? -100.0f : 100.0f;
@@ -151,13 +159,27 @@ class OTFParticle
151159
return (mGlobalIndex != -1);
152160
}
153161

162+
// Bits
163+
bool checkBit(DecayerBits bit) const { return mBits.test(static_cast<size_t>(bit)); }
164+
void setBit(DecayerBits bit, bool value = true) { mBits.set(static_cast<size_t>(bit), value); }
165+
void setBitOn(DecayerBits bit) { mBits.set(static_cast<size_t>(bit), true); }
166+
void setBitOff(DecayerBits bit) { mBits.set(static_cast<size_t>(bit), false); }
167+
168+
std::bitset<8> getBits() const { return mBits; }
169+
uint8_t getBitsValue() const { return static_cast<uint8_t>(mBits.to_ulong()); }
170+
void setBits(std::bitset<8> bits) { mBits = bits; }
171+
154172
private:
155173
int mPdgCode{}, mGlobalIndex{-1};
156174
int mCollisionId{};
157175
float mVx{}, mVy{}, mVz{}, mVt{};
158176
float mPx{}, mPy{}, mPz{}, mE{};
159177
bool mIsAlive{}, mIsFromMcParticles{false};
160178
bool mIsPrimary{};
179+
180+
int mStatusCode{};
181+
uint8_t mFlag{};
182+
std::bitset<8> mBits{};
161183
std::array<int, 2> mIndicesMother{-1, -1}, mIndicesDaughter{-1, -1};
162184
};
163185

ALICE3/Core/TrackUtilities.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
#include "TrackUtilities.h"
1919

20+
#include <CommonConstants/PhysicsConstants.h>
21+
#include <MathUtils/Primitive2D.h>
2022
#include <MathUtils/Utils.h>
2123
#include <ReconstructionDataFormats/Track.h>
2224

ALICE3/Core/TrackUtilities.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424

2525
#include <TLorentzVector.h>
2626

27-
#include <array>
2827
#include <cmath>
29-
#include <span>
3028
#include <vector>
3129

3230
namespace o2::upgrade

ALICE3/DataModel/OTFMCParticle.h

Lines changed: 0 additions & 94 deletions
This file was deleted.

ALICE3/DataModel/tracksAlice3.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,15 @@ namespace mcparticle_alice3
5050
{
5151
DECLARE_SOA_COLUMN(NHits, nHits, int); //! number of silicon hits
5252
DECLARE_SOA_COLUMN(Charge, charge, float); //! particle charge
53+
DECLARE_SOA_BITMAP_COLUMN(DecayerBits, decayerBits, 8); //! Bit mask for particle produced by the OTF decayer
5354
} // namespace mcparticle_alice3
5455
DECLARE_SOA_TABLE(MCParticlesExtraA3, "AOD", "MCParticlesExtraA3",
5556
mcparticle_alice3::NHits,
5657
mcparticle_alice3::Charge);
5758
using MCParticleExtraA3 = MCParticlesExtraA3::iterator;
59+
60+
DECLARE_SOA_TABLE(OTFDecayerBits, "AOD", "OTFDecayerBits", mcparticle_alice3::DecayerBits);
61+
5862
} // namespace o2::aod
5963

6064
#endif // ALICE3_DATAMODEL_TRACKSALICE3_H_

0 commit comments

Comments
 (0)