Skip to content

Commit dd57421

Browse files
committed
Merge remote-tracking branch 'upstream/master' into OccupancySlimTables
2 parents 54e5502 + 6d42fed commit dd57421

991 files changed

Lines changed: 114467 additions & 41023 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: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Checks:
4242
- google-default-arguments
4343
# - google-explicit-constructor # triggered for O2 columns
4444
- google-global-names-in-headers
45+
- google-readability-casting # same as cpplint:readability/casting
4546
# - misc-const-correctness # to be checked
4647
- misc-header-include-cycle
4748
- misc-include-cleaner
@@ -111,8 +112,6 @@ WarningsAsErrors: >-
111112
*,
112113
-readability-braces-around-statements,
113114
-readability-suspicious-call-argument,
114-
-modernize-*,
115-
-readability-*,
116115
-bugprone-assignment-in-if-condition,
117116
-bugprone-branch-clone,
118117
-bugprone-copy-constructor-init,
@@ -140,17 +139,20 @@ WarningsAsErrors: >-
140139
-cppcoreguidelines-missing-std-forward,
141140
-cppcoreguidelines-prefer-member-initializer,
142141
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
143-
-cppcoreguidelines-pro-type-const-cast,
144-
-cppcoreguidelines-pro-type-cstyle-cast,
145142
-cppcoreguidelines-pro-type-member-init,
146-
-cppcoreguidelines-pro-type-reinterpret-cast,
147-
-cppcoreguidelines-pro-type-static-cast-downcast,
148143
-cppcoreguidelines-pro-type-union-access,
149144
-cppcoreguidelines-slicing,
150145
-cppcoreguidelines-virtual-class-destructor,
146+
-modernize-*,
147+
-readability-*,
148+
readability-redundant-casting,
151149
# Positives for the following checks are currently being fixed and should be reported as errors.
152150
# clang-analyzer-*
153151
# clang-diagnostic-*
152+
# cppcoreguidelines-pro-type-const-cast
153+
# cppcoreguidelines-pro-type-cstyle-cast
154+
# cppcoreguidelines-pro-type-reinterpret-cast
155+
# cppcoreguidelines-pro-type-static-cast-downcast
154156
# google-default-arguments
155157
# misc-include-cleaner
156158
# misc-redundant-expression

‎.github/workflows/mega-linter.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
id: ml
4040
# You can override MegaLinter flavor used to have faster performances
4141
# More info at https://megalinter.io/flavors/
42-
uses: oxsecurity/megalinter@v10.1.0
42+
uses: oxsecurity/megalinter@v10.2.0
4343
env:
4444
# All available variables are described in documentation:
4545
# https://megalinter.io/configuration/

‎.pre-commit-config.yaml‎

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,47 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v6.0.0
5+
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
66
hooks:
7-
- id: trailing-whitespace
7+
- id: check-added-large-files
8+
- id: check-ast
9+
- id: check-case-conflict
10+
- id: check-executables-have-shebangs
11+
- id: check-merge-conflict
12+
- id: check-symlinks
13+
- id: check-yaml
814
- id: end-of-file-fixer
15+
- id: trailing-whitespace
16+
- repo: https://github.com/shellcheck-py/shellcheck-py
17+
rev: a6564f5d57444e123433a5c9af733e3975c77229 # frozen: v0.11.0.1-1
18+
hooks:
19+
- id: shellcheck
20+
- repo: https://github.com/astral-sh/ruff-pre-commit
21+
rev: f12be1ebaa5351c1fc76472de98db2c3446c8253 # frozen: v0.16.10
22+
hooks:
23+
- id: ruff-check # linter
24+
args: ["--fix"]
25+
- id: ruff-format # formatter
26+
- repo: local
27+
hooks:
28+
- id: format-includes
29+
name: format includes
30+
language: python
31+
entry: Scripts/format_includes.py
32+
types: [c++]
933
- repo: https://github.com/pre-commit/mirrors-clang-format
10-
rev: v20.1.3 # clang-format version (keep synced with https://github.com/alisw/ali-bot/blob/master/.github/workflows/c++-code-formatting.yml)
34+
# clang-format version (keep synced with https://github.com/alisw/ali-bot/blob/master/.github/workflows/c++-code-formatting.yml)
35+
rev: 7ec07eeb4135dc6ecf410d24ac4ead986a5d413d # frozen: v20.1.3
1136
hooks:
1237
- id: clang-format
1338
- repo: https://github.com/cpplint/cpplint
14-
rev: 2.0.2
39+
rev: 350702a4d39395571bd118c9a3cff0a573488d61 # frozen: 2.0.2
1540
hooks:
1641
- id: cpplint
42+
- repo: local
43+
hooks:
44+
- id: O2 linter
45+
name: O2 linter
46+
language: python
47+
entry: Scripts/o2_linter.py
48+
types_or: [c++, cmake, python]

‎ALICE3/Core/CMakeLists.txt‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@ o2physics_add_library(ALICE3Core
1313
SOURCES TrackUtilities.cxx
1414
ConfigurationParser.cxx
1515
FlatLutEntry.cxx
16+
FlatLutRootWriter.cxx
1617
FlatTrackSmearer.cxx
1718
GeometryContainer.cxx
1819
PUBLIC_LINK_LIBRARIES O2::Framework
19-
O2Physics::AnalysisCore)
20+
O2Physics::AnalysisCore
21+
PRIVATE_LINK_LIBRARIES ROOT::Core
22+
ROOT::RIO
23+
ROOT::Tree)
2024

2125
o2physics_target_root_dictionary(ALICE3Core
2226
HEADERS TrackUtilities.h

‎ALICE3/Core/DetLayer.h‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,25 +108,25 @@ struct DetLayer {
108108
TString mName;
109109

110110
// position variables
111-
float mR; // radius in centimeters
112-
float mZ; // mZ dimension in centimeters
111+
float mR{}; // radius in centimeters
112+
float mZ{}; // mZ dimension in centimeters
113113

114114
// material variables
115-
float mX0; // radiation length
116-
float mXrho; // density
115+
float mX0{}; // radiation length
116+
float mXrho{}; // density
117117

118118
// resolution variables for active layers
119-
float mResRPhi; // RPhi resolution in centimeters
120-
float mResZ; // Z resolution in centimeters
119+
float mResRPhi{}; // RPhi resolution in centimeters
120+
float mResZ{}; // Z resolution in centimeters
121121

122122
// efficiency
123-
float mEff; // detection efficiency
123+
float mEff{1.f}; // detection efficiency
124124

125125
// dead regions in phi (in radians)
126126
TGraph* mDeadPhiRegions = nullptr;
127127

128128
// layer type
129-
int mType; // 0: undefined/inert, 1: silicon, 2: gas/tpc
129+
int mType{0}; // 0: undefined/inert, 1: silicon, 2: gas/tpc
130130
};
131131

132132
} // namespace o2::fastsim

‎ALICE3/Core/FastTracker.cxx‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ int FastTracker::fastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa
312312
nIntercepts = 0;
313313
nSiliconPoints = 0;
314314
nGasPoints = 0;
315+
trackIU = -1.f;
316+
trackOU = -1.f;
315317
std::array<float, 3> posIni{}; // provision for != PV
316318
inputTrack.getXYZGlo(posIni);
317319
const float initialRadius = std::hypot(posIni[0], posIni[1]);
@@ -416,6 +418,9 @@ int FastTracker::fastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa
416418
firstLayerReached = il;
417419
}
418420
lastLayerReached = il;
421+
if (layers[il].isTOF()) {
422+
continue; // TOF layers are not used for tracking, but are kept in range for the innermost/outermost update
423+
}
419424
nIntercepts++;
420425
}
421426

@@ -475,7 +480,7 @@ int FastTracker::fastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa
475480
continue;
476481
}
477482

478-
if (!layers[il].isInert()) { // only update covm for tracker hits
483+
if (!layers[il].isInert() && !layers[il].isTOF()) { // only update covm for tracker hits
479484
const o2::track::TrackParametrization<float>::dim2_t hitpoint = {xyz1[1], xyz1[2]};
480485
const o2::track::TrackParametrization<float>::dim3_t hitpointcov = {layers[il].getResolutionRPhi() * layers[il].getResolutionRPhi(), 0.f, layers[il].getResolutionZ() * layers[il].getResolutionZ()};
481486

@@ -510,7 +515,14 @@ int FastTracker::fastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa
510515
}
511516

512517
hits.push_back(thisHit);
513-
if (!layers[il].isInert()) { // good hit probability calculation
518+
if (!layers[il].isInert()) {
519+
trackIU = std::hypot(spacePoint[0], spacePoint[1]);
520+
if (trackOU < 0.f) {
521+
trackOU = trackIU;
522+
}
523+
}
524+
525+
if (!layers[il].isInert() && !layers[il].isTOF()) { // good hit probability calculation
514526
float sigYCmb = o2::math_utils::sqrt(inwardTrack.getSigmaY2() + layers[il].getResolutionRPhi() * layers[il].getResolutionRPhi());
515527
float sigZCmb = o2::math_utils::sqrt(inwardTrack.getSigmaZ2() + layers[il].getResolutionZ() * layers[il].getResolutionZ());
516528
goodHitProbability[il] = probGoodChiSqHit(layers[il].getRadius() * 100, sigYCmb * 100, sigZCmb * 100);

‎ALICE3/Core/FastTracker.h‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class FastTracker
5858
/// \param phiEnd End angle of the dead region (in radians)
5959
void addDeadPhiRegionInLayer(const std::string& layerName, float phiStart, float phiEnd);
6060
[[nodiscard]] DetLayer getLayer(const int layer) const { return layers[layer]; }
61-
[[nodiscard]] std::vector<DetLayer> getLayers() const { return layers; }
61+
[[nodiscard]] const std::vector<DetLayer>& getLayers() const { return layers; }
6262
[[nodiscard]] int getLayerIndex(const std::string& name) const;
6363
[[nodiscard]] size_t getNLayers() const { return layers.size(); }
6464
[[nodiscard]] bool isLayerInert(const int layer) const { return layers[layer].isInert(); }
@@ -127,6 +127,8 @@ class FastTracker
127127
[[nodiscard]] int getNIntercepts() const { return nIntercepts; }
128128
[[nodiscard]] int getNSiliconPoints() const { return nSiliconPoints; }
129129
[[nodiscard]] int getNGasPoints() const { return nGasPoints; }
130+
[[nodiscard]] float getTrackIU() const { return trackIU; }
131+
[[nodiscard]] float getTrackOU() const { return trackOU; }
130132
[[nodiscard]] float getGoodHitProb(int layer) const
131133
{
132134
return (layer >= 0 && static_cast<size_t>(layer) < goodHitProbability.size()) ? goodHitProbability[layer] : 0.0f;
@@ -172,6 +174,8 @@ class FastTracker
172174
int nIntercepts = 0; /// found in first outward propagation
173175
int nSiliconPoints = 0; /// silicon-based space points added to track
174176
int nGasPoints = 0; /// tpc-based space points added to track
177+
float trackIU = -1.f; /// innermost update: radius of the innermost active-layer hit added to track
178+
float trackOU = -1.f; /// outermost update: radius of the outermost active-layer hit added to track
175179
std::vector<float> goodHitProbability;
176180

177181
ClassDef(FastTracker, 1);

‎ALICE3/Core/FlatLutEntry.cxx‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,23 +140,23 @@ size_t FlatLutData::getEntryOffset(int nch_bin, int rad_bin, int eta_bin, int pt
140140
const lutEntry_t* FlatLutData::getEntryRef(int nch_bin, int rad_bin, int eta_bin, int pt_bin) const
141141
{
142142
size_t offset = getEntryOffset(nch_bin, rad_bin, eta_bin, pt_bin);
143-
return reinterpret_cast<const lutEntry_t*>(mDataRef.data() + offset);
143+
return reinterpret_cast<const lutEntry_t*>(mDataRef.data() + offset); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
144144
}
145145

146146
lutEntry_t* FlatLutData::getEntry(int nch_bin, int rad_bin, int eta_bin, int pt_bin)
147147
{
148148
size_t offset = getEntryOffset(nch_bin, rad_bin, eta_bin, pt_bin);
149-
return reinterpret_cast<lutEntry_t*>(mData.data() + offset);
149+
return reinterpret_cast<lutEntry_t*>(mData.data() + offset); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
150150
}
151151

152152
const lutHeader_t& FlatLutData::getHeaderRef() const
153153
{
154-
return *static_cast<const lutHeader_t*>(static_cast<const void*>(mDataRef.data()));
154+
return *reinterpret_cast<const lutHeader_t*>(mDataRef.data()); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
155155
}
156156

157157
lutHeader_t& FlatLutData::getHeader()
158158
{
159-
return *static_cast<lutHeader_t*>(static_cast<void*>(mData.data()));
159+
return *reinterpret_cast<lutHeader_t*>(mData.data()); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
160160
}
161161

162162
void FlatLutData::updateRef()
@@ -216,7 +216,7 @@ lutHeader_t FlatLutData::previewHeader(const uint8_t* buffer, size_t size)
216216
if (size < sizeof(lutHeader_t)) {
217217
throw framework::runtime_error_f("Buffer too small for LUT header: expected at least %zu, got %zu", sizeof(lutHeader_t), size);
218218
}
219-
const auto* header = static_cast<const lutHeader_t*>(static_cast<const void*>(buffer));
219+
const auto* header = reinterpret_cast<const lutHeader_t*>(buffer); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
220220
if (!header->checkVersion()) {
221221
throw framework::runtime_error_f("LUT header version mismatch: expected %d, got %d", LUTCOVM_VERSION, header->version);
222222
}
@@ -246,7 +246,7 @@ FlatLutData FlatLutData::ViewFromBuffer(const uint8_t* buffer, size_t size)
246246

247247
FlatLutData FlatLutData::ViewFromBuffer(std::span<std::byte> const& span)
248248
{
249-
return ViewFromBuffer(reinterpret_cast<const uint8_t*>(span.data()), span.size_bytes());
249+
return ViewFromBuffer(reinterpret_cast<const uint8_t*>(span.data()), span.size_bytes()); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
250250
}
251251

252252
bool FlatLutData::isLoaded() const
@@ -257,7 +257,7 @@ bool FlatLutData::isLoaded() const
257257
lutHeader_t FlatLutData::previewHeader(std::ifstream& file, const char* filename)
258258
{
259259
lutHeader_t tempHeader;
260-
file.read(reinterpret_cast<char*>(&tempHeader), sizeof(lutHeader_t));
260+
file.read(reinterpret_cast<char*>(&tempHeader), sizeof(lutHeader_t)); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
261261
if (file.gcount() != static_cast<std::streamsize>(sizeof(lutHeader_t))) {
262262
throw framework::runtime_error_f("Failed to read LUT header from %s", filename);
263263
}
@@ -282,7 +282,7 @@ FlatLutData FlatLutData::loadFromFile(std::ifstream& file, const char* filename)
282282
size_t numEntries = static_cast<size_t>(data.mNchBins) * data.mRadBins * data.mEtaBins * data.mPtBins;
283283
size_t entriesSize = numEntries * sizeof(lutEntry_t);
284284

285-
file.read(reinterpret_cast<char*>(data.data() + headerSize), entriesSize);
285+
file.read(reinterpret_cast<char*>(data.data() + headerSize), entriesSize); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
286286
if (file.gcount() != static_cast<std::streamsize>(entriesSize)) {
287287
throw framework::runtime_error_f("Failed to read LUT entries from %s: expected %zu bytes, got %zu", filename, entriesSize, static_cast<size_t>(file.gcount()));
288288
}

0 commit comments

Comments
 (0)