Skip to content

Commit 8f79c5d

Browse files
authored
Merge branch 'AliceO2Group:master' into master
2 parents 4783643 + 583c468 commit 8f79c5d

128 files changed

Lines changed: 9399 additions & 6971 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: 142 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,144 @@
1+
---
2+
Checks:
3+
# - clang-analyzer-* # enabled by default
4+
# - clang-diagnostic-* # enabled by default
5+
- -clang-diagnostic-unknown-pragmas
6+
- bugprone-*
7+
- -bugprone-assert-side-effect
8+
- -bugprone-bad-signal-to-kill-thread
9+
- -bugprone-bitwise-pointer-cast
10+
- -bugprone-bool-pointer-implicit-conversion
11+
- -bugprone-compare-pointer-to-member-virtual-function
12+
- -bugprone-crtp-constructor-accessibility
13+
- -bugprone-easily-swappable-parameters # Too sensitive
14+
- -bugprone-forwarding-reference-overload
15+
- -bugprone-implicit-widening-of-multiplication-result # Specific cases irrelevant in this repo
16+
- -bugprone-lambda-function-name
17+
- -bugprone-no-escape
18+
- -bugprone-posix-return
19+
- -bugprone-signal-handler
20+
- -bugprone-signed-char-misuse # Specific use cases. Probably very rare.
21+
- -bugprone-spuriously-wake-up-functions
22+
- -bugprone-suspicious-stringview-data-usage # Probably harmless in this repo
23+
- -bugprone-unused-raii
24+
- cppcoreguidelines-avoid-const-or-ref-data-members
25+
- cppcoreguidelines-avoid-goto
26+
- cppcoreguidelines-avoid-non-const-global-variables
27+
- cppcoreguidelines-init-variables
28+
- cppcoreguidelines-macro-usage
29+
- cppcoreguidelines-misleading-capture-default-by-value
30+
- cppcoreguidelines-missing-std-forward
31+
- cppcoreguidelines-prefer-member-initializer
32+
- cppcoreguidelines-pro-bounds-array-to-pointer-decay
33+
- cppcoreguidelines-pro-type-const-cast
34+
- cppcoreguidelines-pro-type-cstyle-cast
35+
- cppcoreguidelines-pro-type-member-init
36+
- cppcoreguidelines-pro-type-reinterpret-cast
37+
- cppcoreguidelines-pro-type-static-cast-downcast
38+
- cppcoreguidelines-pro-type-union-access
39+
- cppcoreguidelines-rvalue-reference-param-not-moved
40+
- cppcoreguidelines-slicing
41+
- cppcoreguidelines-virtual-class-destructor
42+
- google-default-arguments
43+
# - google-explicit-constructor # triggered for O2 columns
44+
- google-global-names-in-headers
45+
# - misc-const-correctness # to be checked
46+
- misc-header-include-cycle
47+
- misc-include-cleaner
48+
- misc-misplaced-const
49+
- misc-redundant-expression
50+
- misc-unconventional-assign-operator
51+
- misc-unused-alias-decls
52+
- misc-unused-parameters
53+
- misc-unused-using-decls
54+
- modernize-avoid-bind
55+
- modernize-avoid-c-arrays
56+
- modernize-concat-nested-namespaces
57+
- modernize-deprecated-headers
58+
- modernize-make-shared
59+
- modernize-make-unique
60+
- modernize-redundant-void-arg
61+
- modernize-return-braced-init-list
62+
- modernize-use-auto
63+
- modernize-use-default-member-init
64+
- modernize-use-designated-initializers
65+
- modernize-use-equals-default
66+
- modernize-use-equals-delete
67+
- modernize-use-nodiscard
68+
- modernize-use-nullptr
69+
- modernize-use-override
70+
- modernize-use-starts-ends-with
71+
- performance-for-range-copy
72+
- performance-implicit-conversion-in-loop
73+
- performance-inefficient-algorithm
74+
- performance-inefficient-string-concatenation
75+
- performance-inefficient-vector-operation
76+
- performance-move-const-arg
77+
- performance-no-automatic-move
78+
- performance-trivially-destructible
79+
- performance-type-promotion-in-math-fn
80+
- performance-unnecessary-copy-initialization
81+
- performance-unnecessary-value-param # slow
82+
- readability-avoid-unconditional-preprocessor-if
83+
- readability-braces-around-statements
84+
- readability-const-return-type
85+
- readability-container-contains
86+
- readability-container-data-pointer
87+
- readability-container-size-empty
88+
- readability-delete-null-pointer
89+
- readability-duplicate-include
90+
- readability-else-after-return
91+
- readability-enum-initial-value
92+
- readability-implicit-bool-conversion
93+
- readability-inconsistent-declaration-parameter-name
94+
- readability-misplaced-array-index
95+
- readability-non-const-parameter
96+
- readability-redundant-access-specifiers
97+
- readability-redundant-casting
98+
- readability-redundant-control-flow
99+
- readability-redundant-declaration
100+
- readability-redundant-member-init
101+
- readability-redundant-preprocessor
102+
- readability-redundant-string-cstr
103+
- readability-redundant-string-init
104+
- readability-reference-to-constructed-temporary
105+
- readability-simplify-boolean-expr
106+
- readability-static-definition-in-anonymous-namespace
107+
- readability-string-compare
108+
- readability-suspicious-call-argument
109+
# Select which of the enabled checks should be reported as errors instead of warnings.
110+
WarningsAsErrors: >-
111+
*,
112+
-readability-braces-around-statements,
113+
-readability-suspicious-call-argument,
1114
CheckOptions:
115+
modernize-avoid-c-arrays.AllowStringArrays: true
116+
# Common tolerated conversions
117+
bugprone-narrowing-conversions.WarnOnFloatingPointNarrowingConversion: false
118+
bugprone-narrowing-conversions.WarnOnIntegerNarrowingConversion: false
119+
bugprone-narrowing-conversions.WarnOnIntegerToFloatingPointNarrowingConversion: false
120+
readability-implicit-bool-conversion.AllowLogicalOperatorConversion: true
121+
readability-implicit-bool-conversion.AllowPointerConditions: true
122+
# Some data model structs are missing some special functions by design.
123+
cppcoreguidelines-special-member-functions.AllowMissingMoveFunctions: true
2124
# Naming conventions
3-
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
4-
- { key: readability-identifier-naming.ClassMemberPrefix, value: m }
5-
- { key: readability-identifier-naming.ConceptCase, value: CamelCase }
6-
- { key: readability-identifier-naming.ConstexprVariableCase, value: CamelCase }
7-
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
8-
- { key: readability-identifier-naming.EnumConstantCase, value: CamelCase }
9-
- { key: readability-identifier-naming.EnumConstantIgnoredRegexp, value: "^k?[A-Z][a-zA-Z0-9_]*$" } # Allow "k" prefix and non-trailing underscores in PDG names.
10-
- { key: readability-identifier-naming.FunctionCase, value: camelBack }
11-
- { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE }
12-
- { key: readability-identifier-naming.MacroDefinitionIgnoredRegexp, value: "^[A-Z][A-Z0-9_]*_$" } # Allow the trailing underscore in header guards.
13-
- { key: readability-identifier-naming.MemberCase, value: camelBack }
14-
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
15-
- { key: readability-identifier-naming.ParameterCase, value: camelBack }
16-
- { key: readability-identifier-naming.StructCase, value: CamelCase }
17-
- { key: readability-identifier-naming.TemplateParameterCase, value: CamelCase }
18-
- { key: readability-identifier-naming.TypeAliasCase, value: CamelCase }
19-
- { key: readability-identifier-naming.TypedefCase, value: CamelCase }
20-
- { key: readability-identifier-naming.TypeTemplateParameterCase, value: CamelCase }
21-
- { key: readability-identifier-naming.VariableCase, value: camelBack }
125+
readability-identifier-naming.ClassCase: CamelCase
126+
readability-identifier-naming.ClassMemberPrefix: m
127+
readability-identifier-naming.ConceptCase: CamelCase
128+
readability-identifier-naming.ConstexprVariableCase: CamelCase
129+
readability-identifier-naming.EnumCase: CamelCase
130+
readability-identifier-naming.EnumConstantCase: CamelCase
131+
readability-identifier-naming.EnumConstantIgnoredRegexp: "^k?[A-Z][a-zA-Z0-9_]*$" # Allow "k" prefix and non-trailing underscores in PDG names.
132+
readability-identifier-naming.FunctionCase: camelBack
133+
readability-identifier-naming.MacroDefinitionCase: UPPER_CASE
134+
readability-identifier-naming.MacroDefinitionIgnoredRegexp: "^[A-Z][A-Z0-9_]*_$" # Allow the trailing underscore in header guards.
135+
readability-identifier-naming.MemberCase: camelBack
136+
readability-identifier-naming.NamespaceCase: lower_case
137+
readability-identifier-naming.ParameterCase: camelBack
138+
readability-identifier-naming.StructCase: CamelCase
139+
readability-identifier-naming.TemplateParameterCase: CamelCase
140+
readability-identifier-naming.TypeAliasCase: CamelCase
141+
readability-identifier-naming.TypedefCase: CamelCase
142+
readability-identifier-naming.TypeTemplateParameterCase: CamelCase
143+
readability-identifier-naming.VariableCase: camelBack
144+
...

.github/workflows/mega-linter.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
steps:
2424
# Git Checkout
2525
- name: Checkout Code
26-
uses: actions/checkout@v6
26+
uses: actions/checkout@v7
2727
with:
2828
# Checkout the HEAD of the PR instead of the merge commit.
2929
ref: ${{ github.event.pull_request.head.sha }}
@@ -32,13 +32,14 @@ jobs:
3232
fetch-depth: 0
3333
# So we can use secrets.ALIBUILD_GITHUB_TOKEN to push later.
3434
persist-credentials: false
35+
allow-unsafe-pr-checkout: true # needed for pull_request_target
3536

3637
# MegaLinter
3738
- name: MegaLinter
3839
id: ml
3940
# You can override MegaLinter flavor used to have faster performances
4041
# More info at https://megalinter.io/flavors/
41-
uses: oxsecurity/megalinter@v9.5.0
42+
uses: oxsecurity/megalinter@v9.6.0
4243
env:
4344
# All available variables are described in documentation:
4445
# https://megalinter.io/configuration/

.github/workflows/o2-linter.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ jobs:
3030
echo BRANCH_HEAD="$branch_head" >> "$GITHUB_ENV"
3131
echo BRANCH_BASE="$branch_base" >> "$GITHUB_ENV"
3232
- name: Checkout Code
33-
uses: actions/checkout@v6
33+
uses: actions/checkout@v7
3434
with:
3535
ref: ${{ env.BRANCH_HEAD }}
3636
fetch-depth: 0 # needed to get the full history
37+
allow-unsafe-pr-checkout: true # needed for pull_request_target
3738
- name: Run tests
3839
id: linter
3940
run: |

.mega-linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ PYTHON_RUFF_CONFIG_FILE: pyproject.toml
4242
CPP_CPPLINT_FILE_EXTENSIONS: [".C", ".c", ".c++", ".cc", ".cl", ".cpp", ".cu", ".cuh", ".cxx", ".cxx.in", ".h", ".h++", ".hh", ".h.in", ".hpp", ".hxx", ".inc", ".inl", ".macro"]
4343
CPP_CLANG_FORMAT_FILE_EXTENSIONS: [".C", ".c", ".c++", ".cc", ".cl", ".cpp", ".cu", ".cuh", ".cxx", ".cxx.in", ".h", ".h++", ".hh", ".h.in", ".hpp", ".hxx", ".inc", ".inl", ".macro"]
4444
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"]
45-
CPP_CPPCHECK_ARGUMENTS: --language=c++ --std=c++20 --check-level=exhaustive --suppressions-list=cppcheck_config
45+
CPP_CPPCHECK_ARGUMENTS: --language=c++ --std=c++20 --enable=style --check-level=exhaustive --suppressions-list=cppcheck_suppressions --inline-suppr --force
4646
REPOSITORY_GITLEAKS_PR_COMMITS_SCAN: true
4747
ACTION_ZIZMOR_UNSECURED_ENV_VARIABLES: [GITHUB_TOKEN]

ALICE3/TableProducer/alice3MulticharmFinder.cxx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,6 @@ struct Alice3MulticharmFinder {
216216
std::array<float, 3> prong0mom;
217217
std::array<float, 3> prong1mom;
218218
std::array<float, o2::track::kLabCovMatSize> parentTrackCovMatrix;
219-
220-
// charm daughters
221-
int nSiliconHitsPiCC;
222-
int nTPCHitsPiCC;
223219
} thisXiccCandidate;
224220

225221
struct ProngInfo {
@@ -714,7 +710,7 @@ struct Alice3MulticharmFinder {
714710

715711
o2::track::TrackParCov xicTrack(thisXicCandidate.xyz, momentumC, thisXicCandidate.parentTrackCovMatrix, +1);
716712
float xicDecayRadius2D = std::hypot(thisXicCandidate.xyz[0], thisXicCandidate.xyz[1]);
717-
if (xicDecayRadius2D < xiccMinDecayRadius) {
713+
if (xicDecayRadius2D < xicMinDecayRadius) {
718714
continue; // do not take if radius too small, likely a primary combination
719715
}
720716

Common/Core/fwdtrackUtilities.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#ifndef COMMON_CORE_FWDTRACKUTILITIES_H_
1919
#define COMMON_CORE_FWDTRACKUTILITIES_H_
2020

21-
#include <Framework/AnalysisDataModel.h>
2221
#include <Framework/DataTypes.h>
2322
#include <GlobalTracking/MatchGlobalFwd.h>
2423
#include <MCHTracking/TrackExtrap.h>
@@ -48,22 +47,32 @@ using SMatrix55 = ROOT::Math::SMatrix<double, 5, 5, ROOT::Math::MatRepSym<double
4847
using SMatrix55Std = ROOT::Math::SMatrix<double, 5>;
4948
using SMatrix5 = ROOT::Math::SVector<double, 5>;
5049

50+
template <typename T>
51+
concept is_fwd_track = requires(T t) {
52+
{ t.rAtAbsorberEnd() } -> std::same_as<float>;
53+
};
54+
55+
template <typename T>
56+
concept is_fwd_cov = requires(T t) {
57+
{ t.sigmaX() } -> std::same_as<float>;
58+
};
59+
5160
/// Produce TrackParCovFwds for MFT and FwdTracks, w/ or w/o cov, with z shift
5261
template <typename TFwdTrack, typename... TCovariance>
5362
o2::track::TrackParCovFwd getTrackParCovFwdShift(TFwdTrack const& track, float zshift, TCovariance const&... covOpt)
5463
{
5564
double chi2 = track.chi2();
5665
if constexpr (sizeof...(covOpt) == 0) {
5766
// No covariance passed
58-
if constexpr (std::is_same_v<std::decay_t<TFwdTrack>, aod::FwdTracks::iterator>) {
67+
if constexpr (is_fwd_track<TFwdTrack>) {
5968
if (track.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) {
6069
chi2 = track.chi2() * (2.f * track.nClusters() - 5.f);
6170
}
6271
}
6372
} else {
6473
// Covariance passed
6574
using TCov = std::decay_t<decltype((covOpt, ...))>;
66-
if constexpr (std::is_same_v<TCov, aod::FwdTracksCov::iterator>) {
75+
if constexpr (is_fwd_cov<TCov>) {
6776
if (track.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) {
6877
chi2 = track.chi2() * (2.f * track.nClusters() - 5.f);
6978
}

Common/TableProducer/match-mft-ft0.cxx

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ T getCompatibleBCs(aod::AmbiguousMFTTrack const& atrack, aod::Collision const& c
124124
}
125125

126126
if (bcIt != bcs.end() && maxBCId >= minBCId) {
127-
T slice{{bcs.asArrowTable()->Slice(minBCId, maxBCId - minBCId + 1)}, (uint64_t)minBCId};
127+
auto slice = bcs.rawSlice(minBCId, maxBCId - minBCId + 1);
128128
bcs.copyIndexBindings(slice);
129129
return slice;
130130
} else {
131-
T slice{{bcs.asArrowTable()->Slice(minBCId, maxBCId - minBCId)}, (uint64_t)minBCId};
131+
auto slice = bcs.rawSlice(minBCId, maxBCId - minBCId);
132132
bcs.copyIndexBindings(slice);
133133
return slice;
134134
}
@@ -141,18 +141,10 @@ T getCompatibleBCs(aod::MFTTracks::iterator const& track, aod::Collision const&
141141
// define firstBC and lastBC (globalBC of beginning and end of the range, when no shift is applied)
142142

143143
auto bcIt = collOrig.bc_as<T>();
144-
// auto timstp = bcIt.timestamp();
145144

146145
int64_t firstBC = bcIt.globalBC() + (track.trackTime() - track.trackTimeRes()) / o2::constants::lhc::LHCBunchSpacingNS;
147146
int64_t lastBC = firstBC + 2 * track.trackTimeRes() / o2::constants::lhc::LHCBunchSpacingNS + 1; // to have a delta = 198 BC
148147

149-
// printf(">>>>>>>>>>>>>>>>>>>>>>>>>>> last-first %lld\n", lastBC-firstBC);
150-
151-
// int collTimeResInBC = collOrig.collisionTimeRes()/o2::constants::lhc::LHCBunchSpacingNS;
152-
153-
// int64_t collFirstBC = bcIt.globalBC() + (collOrig.collisionTime() - collOrig.collisionTimeRes())/o2::constants::lhc::LHCBunchSpacingNS;
154-
// int64_t collLastBC = collFirstBC + 2*collOrig.collisionTimeRes()/o2::constants::lhc::LHCBunchSpacingNS +1;
155-
156148
int64_t minBCId = bcIt.globalIndex();
157149

158150
if ((int64_t)bcIt.globalBC() < firstBC + deltaBC) {
@@ -195,9 +187,7 @@ T getCompatibleBCs(aod::MFTTracks::iterator const& track, aod::Collision const&
195187
{
196188
// means that the slice of compatible BCs is empty
197189

198-
T slice{{bcs.asArrowTable()->Slice(0, 0)}, (uint64_t)0};
199-
// bcs.copyIndexBindings(slice); REMOVED IT BECAUSE I DON'T KNOW WHAT IT DOES HERE
200-
return slice; // returns an empty slice
190+
return bcs.emptySlice();
201191
}
202192
}
203193
}
@@ -209,9 +199,7 @@ T getCompatibleBCs(aod::MFTTracks::iterator const& track, aod::Collision const&
209199
if (bcIt != bcs.end() && ((int64_t)bcIt.globalBC() > (int64_t)lastBC + deltaBC)) {
210200
// check the following element
211201

212-
T slice{{bcs.asArrowTable()->Slice(0, 0)}, (uint64_t)0};
213-
// bcs.copyIndexBindings(slice); REMOVED IT BECAUSE I DON'T KNOW WHAT IT DOES HERE
214-
return slice; // returns an empty slice
202+
return bcs.emptySlice();
215203
}
216204
}
217205

@@ -222,15 +210,10 @@ T getCompatibleBCs(aod::MFTTracks::iterator const& track, aod::Collision const&
222210
}
223211

224212
if (maxBCId < minBCId) {
225-
if (bcIt == bcs.end()) {
226-
printf("at the end of the bcs iterator %d\n", 1);
227-
}
228-
T slice{{bcs.asArrowTable()->Slice(0, 0)}, (uint64_t)0};
229-
// bcs.copyIndexBindings(slice); REMOVED IT BECAUSE I DON'T KNOW WHAT IT DOES HERE
230-
return slice; // returns an empty slice
213+
return bcs.emptySlice();
231214
}
232215

233-
T slice{{bcs.asArrowTable()->Slice(minBCId, maxBCId - minBCId + 1)}, (uint64_t)minBCId};
216+
auto slice = bcs.rawSlice(minBCId, maxBCId - minBCId + 1);
234217
bcs.copyIndexBindings(slice);
235218
return slice;
236219
}

0 commit comments

Comments
 (0)