Skip to content

Commit 01e0a67

Browse files
authored
Merge branch 'AliceO2Group:master' into master
2 parents 2f8682c + 75894b3 commit 01e0a67

430 files changed

Lines changed: 55952 additions & 16790 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.

.github/workflows/mega-linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
id: ml
3939
# You can override MegaLinter flavor used to have faster performances
4040
# More info at https://megalinter.io/flavors/
41-
uses: oxsecurity/megalinter@v9.4.0
41+
uses: oxsecurity/megalinter@v9.5.0
4242
env:
4343
# All available variables are described in documentation:
4444
# https://megalinter.io/configuration/

.mega-linter.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ DISABLE_LINTERS:
2121
- REPOSITORY_DEVSKIM
2222
- REPOSITORY_GITLEAKS
2323
- REPOSITORY_KICS
24+
- REPOSITORY_OSV_SCANNER
2425
- REPOSITORY_SECRETLINT
2526
- REPOSITORY_TRIVY
2627
- YAML_PRETTIER
2728
- YAML_V8R
2829
DISABLE_ERRORS_LINTERS: # If errors are found by these linters, they will be considered as non blocking.
30+
- ACTION_ZIZMOR
2931
- PYTHON_BANDIT # The bandit check is overly broad and complains about subprocess usage.
3032
SHOW_ELAPSED_TIME: true
3133
FILEIO_REPORTER: false
@@ -42,3 +44,4 @@ CPP_CLANG_FORMAT_FILE_EXTENSIONS: [".C", ".c", ".c++", ".cc", ".cl", ".cpp", ".c
4244
CPP_CPPCHECK_FILE_EXTENSIONS: [".C", ".c", ".c++", ".cc", ".cl", ".cpp", ".cu", ".cuh", ".cxx", ".cxx.in", ".h", ".h++", ".hh", ".h.in", ".hpp", ".hxx", ".inc", ".inl", ".macro"]
4345
CPP_CPPCHECK_ARGUMENTS: --language=c++ --std=c++20 --check-level=exhaustive --suppressions-list=cppcheck_config
4446
REPOSITORY_GITLEAKS_PR_COMMITS_SCAN: true
47+
ACTION_ZIZMOR_UNSECURED_ENV_VARIABLES: [GITHUB_TOKEN]

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: 49 additions & 16 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,32 @@ 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 (particle.has_daughters()) {
62+
mIndicesDaughter = {particle.daughtersIds().front(), particle.daughtersIds().back()};
63+
}
64+
if constexpr (requires { particle.decayerBits(); }) {
65+
mBits = particle.decayerBits();
66+
} else {
67+
// If we are here, we created particle in the standard workflow -- without secondaries
68+
// Then we should set all particles as physical primaries accordingly
69+
setBitOn(DecayerBits::IsPrimary);
70+
}
5471
}
5572

5673
// Setters
57-
void setIsAlive(const bool isAlive) { mIsAlive = isAlive; }
5874
void setIsPrimary(const bool isPrimary) { mIsPrimary = isPrimary; }
5975
void setCollisionId(const int collisionId) { mCollisionId = collisionId; }
6076
void setPDG(const int pdg) { mPdgCode = pdg; }
6177
void setIndicesMother(const int start, const int stop) { mIndicesMother = {start, stop}; }
6278
void setIndicesDaughter(const int start, const int stop) { mIndicesDaughter = {start, stop}; }
6379
void setProductionTime(const float vt) { mVt = vt; }
80+
void setFlags(uint8_t flag) { mFlag = flag; }
6481
void setVxVyVz(const float vx, const float vy, const float vz)
6582
{
6683
mVx = vx;
@@ -74,6 +91,14 @@ class OTFParticle
7491
mPz = pz;
7592
mE = e;
7693
}
94+
void setIndexOffset(const std::size_t offset)
95+
{
96+
static constexpr int NotFound = -1;
97+
mIndicesMother[0] = (mIndicesMother[0] >= 0) ? mIndicesMother[0] + static_cast<int>(offset) : NotFound;
98+
mIndicesMother[1] = (mIndicesMother[1] >= 0) ? mIndicesMother[1] + static_cast<int>(offset) : NotFound;
99+
mIndicesDaughter[0] = (mIndicesDaughter[0] >= 0) ? mIndicesDaughter[0] + static_cast<int>(offset) : NotFound;
100+
mIndicesDaughter[1] = (mIndicesDaughter[1] >= 0) ? mIndicesDaughter[1] + static_cast<int>(offset) : NotFound;
101+
}
77102

78103
// Getters
79104
int pdgCode() const { return mPdgCode; }
@@ -87,16 +112,8 @@ class OTFParticle
87112
static constexpr float Weight = 1.f;
88113
return Weight;
89114
}
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-
}
115+
uint8_t flags() const { return mFlag; }
116+
int statusCode() const { return mStatusCode; }
100117
float vx() const { return mVx; }
101118
float vy() const { return mVy; }
102119
float vz() const { return mVz; }
@@ -112,7 +129,8 @@ class OTFParticle
112129
float phi() const { return o2::constants::math::PI + std::atan2(-1.0f * py(), -1.0f * px()); }
113130
float eta() const
114131
{
115-
// As https://github.com/AliceO2Group/AliceO2/blob/dev/Framework/Core/include/Framework/AnalysisDataModel.h#L1943
132+
// Conditionally defined to avoid FPEs
133+
// As https://github.com/AliceO2Group/AliceO2/blob/dev/Framework/Core/include/Framework/AnalysisDataModel.h#L1959
116134
static constexpr float Tolerance = 1e-7f;
117135
if ((p() - mPz) < Tolerance) {
118136
return (mPz < 0.0f) ? -100.0f : 100.0f;
@@ -122,7 +140,8 @@ class OTFParticle
122140
}
123141
float y() const
124142
{
125-
// As https://github.com/AliceO2Group/AliceO2/blob/dev/Framework/Core/include/Framework/AnalysisDataModel.h#L1922
143+
// Conditionally defined to avoid FPEs
144+
// As https://github.com/AliceO2Group/AliceO2/blob/dev/Framework/Core/include/Framework/AnalysisDataModel.h#L1980
126145
static constexpr float Tolerance = 1e-7f;
127146
if ((e() - mPz) < Tolerance) {
128147
return (mPz < 0.0f) ? -100.0f : 100.0f;
@@ -139,8 +158,8 @@ class OTFParticle
139158
std::span<const int> getMotherSpan() const { return hasMothers() ? std::span<const int>(mIndicesMother.data(), 2) : std::span<const int>(); }
140159

141160
// Checks
142-
bool hasDaughters() const { return (mIndicesDaughter[0] > 0); }
143-
bool hasMothers() const { return (mIndicesMother[0] > 0); }
161+
bool hasDaughters() const { return (mIndicesDaughter[0] >= 0); }
162+
bool hasMothers() const { return (mIndicesMother[0] >= 0); }
144163
bool hasNaN() const
145164
{
146165
return std::isnan(mPx) || std::isnan(mPy) || std::isnan(mPz) || std::isnan(mE) ||
@@ -151,13 +170,27 @@ class OTFParticle
151170
return (mGlobalIndex != -1);
152171
}
153172

173+
// Bits
174+
bool checkBit(DecayerBits bit) const { return mBits.test(static_cast<size_t>(bit)); }
175+
void setBit(DecayerBits bit, bool value = true) { mBits.set(static_cast<size_t>(bit), value); }
176+
void setBitOn(DecayerBits bit) { mBits.set(static_cast<size_t>(bit), true); }
177+
void setBitOff(DecayerBits bit) { mBits.set(static_cast<size_t>(bit), false); }
178+
179+
std::bitset<8> getBits() const { return mBits; }
180+
uint8_t getBitsValue() const { return static_cast<uint8_t>(mBits.to_ulong()); }
181+
void setBits(std::bitset<8> bits) { mBits = bits; }
182+
154183
private:
155184
int mPdgCode{}, mGlobalIndex{-1};
156-
int mCollisionId{};
185+
int mCollisionId{-1};
157186
float mVx{}, mVy{}, mVz{}, mVt{};
158187
float mPx{}, mPy{}, mPz{}, mE{};
159188
bool mIsAlive{}, mIsFromMcParticles{false};
160189
bool mIsPrimary{};
190+
191+
int mStatusCode{};
192+
uint8_t mFlag{};
193+
std::bitset<8> mBits{};
161194
std::array<int, 2> mIndicesMother{-1, -1}, mIndicesDaughter{-1, -1};
162195
};
163196

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/OTFStrangeness.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ DECLARE_SOA_INDEX_COLUMN_FULL(PosTrack, posTrack, int, Tracks, "_Pos");
3737
DECLARE_SOA_INDEX_COLUMN_FULL(NegTrack, negTrack, int, Tracks, "_Neg"); //!
3838
DECLARE_SOA_INDEX_COLUMN_FULL(BachTrack, bachTrack, int, Tracks, "_Bach"); //!
3939

40+
DECLARE_SOA_INDEX_COLUMN(McParticle, mcParticle);
41+
4042
// topo vars
4143
DECLARE_SOA_COLUMN(DcaV0Daughters, dcaV0Daughters, float);
4244
DECLARE_SOA_COLUMN(DcaCascadeDaughters, dcaCascadeDaughters, float);
@@ -70,6 +72,9 @@ DECLARE_SOA_TABLE(UpgradeCascades, "AOD", "UPGRADECASCADES",
7072

7173
using UpgradeCascade = UpgradeCascades::iterator;
7274

75+
DECLARE_SOA_TABLE(A3CascadeMcLabels, "AOD", "A3CASCADEMCLABELS",
76+
o2::soa::Index<>, otfcascade::McParticleId);
77+
7378
namespace otfv0
7479
{
7580
DECLARE_SOA_INDEX_COLUMN(Collision, collision); //!
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
///
13+
/// \file collisionExtra.h
14+
/// \author David Dobrigkeit Chinellato
15+
/// \since 11/05/2023
16+
/// \brief Table for ALICE 3 collision-related info
17+
///
18+
19+
#ifndef ALICE3_DATAMODEL_PREFILTERDILEPTON_H_
20+
#define ALICE3_DATAMODEL_PREFILTERDILEPTON_H_
21+
22+
// O2 includes
23+
#include <Framework/AnalysisDataModel.h>
24+
25+
namespace o2::aod
26+
{
27+
28+
namespace dileptonanalysisflags
29+
{
30+
// DECLARE_SOA_COLUMN(IsMCEventSelected, isMCEventSelected, int);
31+
DECLARE_SOA_COLUMN(IsEventCentSelected, isEventCentSelected, int);
32+
DECLARE_SOA_COLUMN(IsTrackPrefilter, isTrackPrefilter, int);
33+
} // namespace dileptonanalysisflags
34+
35+
// DECLARE_SOA_TABLE(EventMCCuts, "AOD", "EVENTMCCUTS", emanalysisflags::IsMCEventSelected);
36+
DECLARE_SOA_TABLE(DiEventCentCuts, "AOD", "DIEVENTCENTCUTS", dileptonanalysisflags::IsEventCentSelected);
37+
DECLARE_SOA_TABLE(DiTrackPrefilter, "AOD", "DITRACKPREFILTER", dileptonanalysisflags::IsTrackPrefilter);
38+
39+
} // namespace o2::aod
40+
41+
#endif // ALICE3_DATAMODEL_PREFILTERDILEPTON_H_

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)