Skip to content

Commit 8ea2a08

Browse files
authored
Merge branch 'AliceO2Group:master' into rashi
2 parents 9ff65bb + b89197e commit 8ea2a08

1,078 files changed

Lines changed: 220047 additions & 81621 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-format

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ IncludeCategories:
4747
Priority: 2
4848
CaseSensitive: true
4949
# O2Physics, non-PWG
50-
- Regex: ^(<|")(Common|ALICE3|DPG|EventFiltering|Tools|Tutorials)/.*\.h
50+
- Regex: ^(<|")(Common|ALICE3|DPG|EventFiltering|PID|Tools|Tutorials)/.*\.h
5151
Priority: 3
5252
CaseSensitive: true
5353
# O2
54-
- Regex: ^(<|")(Algorithm|CCDB|Common[A-Z]|DataFormats|DCAFitter|Detectors|EMCAL|Field|Framework|FT0|FV0|GlobalTracking|GPU|ITS|MathUtils|MFT|MCH|MID|PHOS|PID|ReconstructionDataFormats|SimulationDataFormat|TOF|TPC|ZDC).*/.*\.h
54+
- Regex: ^(<|")(Algorithm|CCDB|Common[A-Z]|DataFormats|DCAFitter|Detectors|EMCAL|FDD|Field|Framework|FT0|FV0|GlobalTracking|GPU|ITS|MathUtils|MCH|MFT|MID|PHOS|ReconstructionDataFormats|SimulationDataFormat|TOF|TPC|ZDC).*/.*\.h
5555
Priority: 4
5656
CaseSensitive: true
5757
# ROOT
@@ -93,6 +93,7 @@ IncludeCategories:
9393
# rest
9494
- Regex: .*
9595
Priority: 100
96+
CaseSensitive: true
9697
SpaceBeforeAssignmentOperators: true
9798
SpaceBeforeParens: ControlStatements
9899
SpaceInEmptyParentheses: false

.clang-tidy

Lines changed: 144 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,146 @@
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,
114+
-modernize-*,
115+
-readability-*,
1116
CheckOptions:
117+
modernize-avoid-c-arrays.AllowStringArrays: true
118+
# Common tolerated conversions
119+
bugprone-narrowing-conversions.WarnOnFloatingPointNarrowingConversion: false
120+
bugprone-narrowing-conversions.WarnOnIntegerNarrowingConversion: false
121+
bugprone-narrowing-conversions.WarnOnIntegerToFloatingPointNarrowingConversion: false
122+
readability-implicit-bool-conversion.AllowLogicalOperatorConversion: true
123+
readability-implicit-bool-conversion.AllowPointerConditions: true
124+
# Some data model structs are missing some special functions by design.
125+
cppcoreguidelines-special-member-functions.AllowMissingMoveFunctions: true
2126
# 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 }
127+
readability-identifier-naming.ClassCase: CamelCase
128+
readability-identifier-naming.ClassMemberPrefix: m
129+
readability-identifier-naming.ConceptCase: CamelCase
130+
readability-identifier-naming.ConstexprVariableCase: CamelCase
131+
readability-identifier-naming.EnumCase: CamelCase
132+
readability-identifier-naming.EnumConstantCase: CamelCase
133+
readability-identifier-naming.EnumConstantIgnoredRegexp: "^k?[A-Z][a-zA-Z0-9_]*$" # Allow "k" prefix and non-trailing underscores in PDG names.
134+
readability-identifier-naming.FunctionCase: camelBack
135+
readability-identifier-naming.MacroDefinitionCase: UPPER_CASE
136+
readability-identifier-naming.MacroDefinitionIgnoredRegexp: "^[A-Z][A-Z0-9_]*_$" # Allow the trailing underscore in header guards.
137+
readability-identifier-naming.MemberCase: camelBack
138+
readability-identifier-naming.NamespaceCase: lower_case
139+
readability-identifier-naming.ParameterCase: camelBack
140+
readability-identifier-naming.StructCase: CamelCase
141+
readability-identifier-naming.TemplateParameterCase: CamelCase
142+
readability-identifier-naming.TypeAliasCase: CamelCase
143+
readability-identifier-naming.TypedefCase: CamelCase
144+
readability-identifier-naming.TypeTemplateParameterCase: CamelCase
145+
readability-identifier-naming.VariableCase: camelBack
146+
...

.claude/commands/migrate-ccdb.md

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
Migrate the specified file (or all files mentioned in the conversation) from `Service<o2::ccdb::BasicCCDBManager>` to the declarative CCDB table approach.
2+
3+
## Background
4+
5+
The old approach uses `Service<o2::ccdb::BasicCCDBManager>` and calls `ccdb->getForTimeStamp<T>(path, timestamp)` at runtime. The new approach declares CCDB columns and timestamped tables using macros, so the framework fetches objects automatically and exposes them as columns on BC rows.
6+
7+
**New API summary:**
8+
9+
```cpp
10+
// In namespace o2::aod (or a sub-namespace):
11+
DECLARE_SOA_CCDB_COLUMN(StructName, getterName, ConcreteType, "CCDB/Object/Path");
12+
13+
DECLARE_SOA_TIMESTAMPED_TABLE(TableName, aod::Timestamps, o2::aod::timestamp::Timestamp, 1, "TABLEDESC",
14+
ns::StructName, ns::OtherColumn);
15+
16+
// In the task — basic usage:
17+
using MyBCs = soa::Join<aod::BCsWithTimestamps, aod::TableName>;
18+
void process(MyBCs const& bcs) {
19+
for (auto const& bc : bcs) {
20+
auto const& obj = bc.getterName(); // reference to cached deserialized object; treat as immutable
21+
}
22+
}
23+
```
24+
25+
**Configurable CCDB paths** (`ConfigurableCCDBPath<Column>`):
26+
27+
If the original task used a `Configurable<std::string>` to supply the CCDB path, the path can remain user-overridable after migration using `ConfigurableCCDBPath<Column>`. This is a typed `Configurable<std::string>` whose option name is automatically set to `"ccdb:" + Column::mLabel` (where `mLabel = "f" + StructName`), defaulting to the compile-time path in the column declaration. The framework reads this option name when resolving CCDB URLs, so users can still redirect the path via JSON config.
28+
29+
The Configurable is purely declarative for the path-override mechanism: declaring it is sufficient — you do **not** pass `.value` to a getter or fetcher. The accessor remains `bc.getterName()`. The `.value` member is still available if the task wants to log the resolved path.
30+
31+
```cpp
32+
struct MyTask {
33+
// Replaces: Configurable<std::string> grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "..."};
34+
ConfigurableCCDBPath<ns::GRPMagField> grpMagFieldPath; // option name = "ccdb:fGRPMagField"
35+
36+
void process(MyBCs const& bcs) {
37+
auto const& grpmag = bcs.iteratorAt(0).grpMagField(); // path override is honoured automatically
38+
LOGP(info, "Using GRPMagField path: {}", grpMagFieldPath.value);
39+
}
40+
};
41+
```
42+
43+
Required headers (add if missing): `<Framework/ASoA.h>`, `<Framework/AnalysisDataModel.h>`, `<Framework/Configurable.h>`
44+
Headers to remove (if no longer needed): `<CCDB/BasicCCDBManager.h>`
45+
46+
## What to do
47+
48+
Read the target file(s) and perform the following migration. Do NOT do a complete migration if the patterns are ambiguous or out of scope — instead note what was skipped and why.
49+
50+
### Step 1 — Inventory
51+
52+
Find every `ccdb->getForTimeStamp<T>(path, ts)` call (and variants like `fCCDB->getForTimeStamp`, `mCcdb->getForTimeStamp`). For each call record:
53+
- The concrete C++ type `T`
54+
- The CCDB path string (may be a `Configurable` variable — record the default value and the Configurable's name)
55+
- The timestamp source (BC timestamp, computed value, etc.)
56+
- Where the result is used
57+
58+
**Deduplicate**: for the same (type, path) pair, declare only one CCDB column. Multiple call sites collapse into multiple uses of the same getter.
59+
60+
### Step 2 — Identify scope
61+
62+
Determine whether each fetch is:
63+
- **Per-BC/per-collision** (called inside `process()` with a timestamp from a BC) — these can be migrated
64+
- **Per-run** (called once when `runNumber` changes, guarded by `mRunNumber == ...`) — these can be migrated; the framework caches per unique timestamp automatically
65+
- **Global/init-time** (called in `init()` with a fixed timestamp, not keyed to a BC) — these **cannot** be migrated to CCDB tables; leave them as-is and note this
66+
67+
Skip the migration for any global/init-time fetches. Skip the whole file if all fetches are global.
68+
69+
### Step 3 — Declare CCDB columns and table
70+
71+
In the `o2::aod` namespace (or a private sub-namespace inside the file, before the task struct), declare:
72+
73+
```cpp
74+
namespace o2::aod
75+
{
76+
namespace myccdbtask // use a short, unique snake_case name derived from the task name
77+
{
78+
DECLARE_SOA_CCDB_COLUMN(StructName, getterName, fully::qualified::ConcreteType, "CCDB/Path"); //!
79+
// one per unique (type, path) pair
80+
} // namespace myccdbtask
81+
82+
DECLARE_SOA_TIMESTAMPED_TABLE(MyTaskCCDBObjects, aod::Timestamps, o2::aod::timestamp::Timestamp, 1, "MYTASKCCDB", //!
83+
myccdbtask::StructName /*, ... */);
84+
} // namespace o2::aod
85+
```
86+
87+
Rules for naming:
88+
- `StructName` / `getterName`: derive from the type name, e.g. `GRPMagField` / `grpMagField`, `MeanVertex` / `meanVertex`
89+
- Table name: `<TaskStruct>CCDBObjects`, e.g. `SkimmerDalitzEECCDBObjects`
90+
- `_Desc_` string: short ALL-CAPS string unique within the binary (≤ 16 chars to fit the AOD descriptor), e.g. `"DALZECC"`, `"TOFCALIB"`
91+
- Namespace: lowercase snake-case derived from the task name (avoid collisions with other CCDB column namespaces in the file)
92+
- Use the **default value** of any `Configurable` path as the compile-time path in the `DECLARE_SOA_CCDB_COLUMN` macro; if the path has no obvious default, leave a `// TODO: verify path` comment
93+
94+
### Step 4 — Update the task struct
95+
96+
1. **Remove** `Service<o2::ccdb::BasicCCDBManager> ccdb;` (and any variant field name)
97+
2. **Remove** `int mRunNumber;` (or similar run-caching variables) **only if** their sole purpose was to guard CCDB re-fetches
98+
3. **Remove** `ccdb->setURL(...)`, `ccdb->setCaching(...)`, `ccdb->setLocalObjectValidityChecking()`, `ccdb->setCreatedNotAfter(...)`, `ccdb->setFatalWhenNull(...)` from `init()`
99+
4. **Remove** the entire `initCCDB()`/`initMagField()` helper method if it only did CCDB fetching; otherwise remove just the CCDB lines from it
100+
5. **Handle path Configurables** — for each `Configurable<std::string>` that held a CCDB path:
101+
- If the path was used as the sole argument to `getForTimeStamp` and the user may want to override it at runtime: **replace** it with `ConfigurableCCDBPath<ns::ColumnName>` (e.g. `ConfigurableCCDBPath<ns::GRPMagField> grpMagFieldPath;`). The member name should match the getter for clarity. Keep a comment explaining what path it controls.
102+
- If the path was never intended to be user-facing (e.g. internal fixed paths): **remove** it outright; the compile-time path in `DECLARE_SOA_CCDB_COLUMN` is sufficient.
103+
- Always remove Configurables that were only used for CCDB manager setup and not for paths: `ccdb-url`, `ccdb-no-later-than`, `skipGRPOquery`, `d_bz_input` (if only used to bypass CCDB), etc.
104+
6. **Remove** cached pointer member variables (e.g. `GRPMagField* grpmag = nullptr`) if they were only populated by CCDB fetches that are now replaced
105+
106+
### Step 5 — Update process() signatures
107+
108+
Define one alias near the top of the task or just below the table declaration:
109+
```cpp
110+
using MyBCs = soa::Join<aod::BCsWithTimestamps, aod::MyTaskCCDBObjects>;
111+
```
112+
113+
Then for each `process()` that used to call `getForTimeStamp`:
114+
115+
- If `process()` already takes `aod::BCsWithTimestamps const&` directly: change it to `MyBCs const&`.
116+
- If `process()` accesses BCs via `collision.bc_as<aod::BCsWithTimestamps>()`: add `MyBCs const&` to the process signature (so the framework knows to provide it) and replace the `bc_as<>` type with `MyBCs`.
117+
- If `process()` does not currently mention BCs but called `ccdb->getForTimeStamp(path, collision.bc_as<...>().timestamp())`: add `MyBCs const&` to the signature and obtain the BC via `collision.bc_as<MyBCs>()`.
118+
- Replace every `ccdb->getForTimeStamp<T>(path, ts)` call with `bc.getterName()`. The returned reference is to a cached deserialized object; treat it as immutable.
119+
- Null-pointer checks (`if (!grpmag)`) on the result become unnecessary — the framework guarantees the object is present (or the task fails early). Remove them.
120+
- If a helper template like `initCCDB(collision)` was called per-collision, inline its remaining (non-CCDB) work or drop it.
121+
122+
### Step 6 — Fix includes
123+
124+
- Remove `#include <CCDB/BasicCCDBManager.h>` if no other code in the file still uses `BasicCCDBManager`
125+
- Ensure `#include <Framework/ASoA.h>` is present (may already be included transitively)
126+
- Keep all type headers (e.g. `<DataFormatsParameters/GRPMagField.h>`) since they are still needed for the concrete type
127+
128+
### Step 7 — Final review
129+
130+
After making changes:
131+
- Check that every remaining use of `ccdb` / `fCCDB` / `mCcdb` has been handled
132+
- Check that `mRunNumber` (or similar) is fully removed if unused
133+
- Check that any leftover `Configurable<std::string>` for a path is either replaced by `ConfigurableCCDBPath<>` or removed
134+
- Search for stale references to removed Configurables (e.g. `grpmagPath.value` lingering in log messages — switch to `grpMagFieldPath.value`)
135+
- If `init()` is now empty, it can be removed
136+
- Note any patterns that were intentionally skipped
137+
138+
## Important limitations — tell the user if any apply
139+
140+
- **Configurable paths**: CCDB column paths are compile-time constants in the macro. Add `ConfigurableCCDBPath<Column>` to allow runtime override; its default is `Column::query` so it always agrees with the macro by construction.
141+
- **`getRunDuration()` calls**: these use `BasicCCDBManager` statically and are unrelated to per-BC fetching — do not touch them.
142+
- **`ctpRateFetcher` / other helpers**: out of scope.
143+
- **Multiple tasks in one file**: tasks can share a single CCDB table declaration if they need the same objects; otherwise each task gets its own with a unique `_Desc_`.
144+
- **Non-BC timestamps**: if the timestamp comes from something other than a BC (e.g. computed manually), the migration is non-trivial — flag it instead of forcing it.
145+
- **Global/init-time fetches** (e.g. `efficiencyGlobal.cxx` style): not migratable — the timestamped-table mechanism requires a row in a BC-keyed table.
146+
- **Magnetic-field side effects**: tasks that compute `d_bz` from a fetched `GRPMagField` and seed a propagator can keep that logic, just sourcing the object from `bc.grpMagField()` instead of `ccdb->getForTimeStamp(...)`.
147+
148+
$ARGUMENTS

.github/workflows/clean-test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ name: Clean PR checks
3434
type: boolean
3535
default: true
3636

37+
'check_build/O2Physics/staging':
38+
description: build/O2Physics/staging
39+
type: boolean
40+
default: true
41+
3742
permissions: {}
3843

3944
jobs:

.github/workflows/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
steps:
1717
- name: Label the PR
1818
id: labeler
19-
uses: actions/labeler@v6
19+
uses: actions/labeler@v7
2020
with:
2121
repo-token: ${{ secrets.GITHUB_TOKEN }}
2222
sync-labels: true

0 commit comments

Comments
 (0)