Skip to content

Commit 28bd70a

Browse files
authored
Merge branch 'AliceO2Group:master' into master
2 parents 1542a77 + d546429 commit 28bd70a

1,327 files changed

Lines changed: 150049 additions & 58875 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: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
CheckOptions:
2-
- { key: CheckPathRegex, value: ".*/O2/.*" }
32
# Naming conventions
43
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
54
- { key: readability-identifier-naming.ClassMemberPrefix, value: m }
65
- { key: readability-identifier-naming.ConceptCase, value: CamelCase }
76
- { key: readability-identifier-naming.ConstexprVariableCase, value: CamelCase }
8-
- { key: readability-identifier-naming.ConstexprVariableIgnoredRegexp, value: "^k[A-Z].*$" } # Allow "k" prefix.
97
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
108
- { key: readability-identifier-naming.EnumConstantCase, value: CamelCase }
11-
- { key: readability-identifier-naming.EnumConstantIgnoredRegexp, value: "^k[A-Z].*$" } # Allow "k" prefix.
9+
- { key: readability-identifier-naming.EnumConstantIgnoredRegexp, value: "^k?[A-Z][a-zA-Z0-9_]*$" } # Allow "k" prefix and non-trailing underscores in PDG names.
1210
- { key: readability-identifier-naming.FunctionCase, value: camelBack }
1311
- { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE }
14-
- { key: readability-identifier-naming.MacroDefinitionIgnoredRegexp, value: "^[A-Z]+(_[A-Z]+)*_$" } # Allow the trailing underscore in header guards.
12+
- { key: readability-identifier-naming.MacroDefinitionIgnoredRegexp, value: "^[A-Z][A-Z0-9_]*_$" } # Allow the trailing underscore in header guards.
1513
- { key: readability-identifier-naming.MemberCase, value: camelBack }
1614
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
1715
- { key: readability-identifier-naming.ParameterCase, value: camelBack }

.github/labeler.yml

Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,89 @@
11
---
2-
alice3:
2+
infrastructure:
33
- changed-files:
4-
- any-glob-to-any-file: ['ALICE3/**']
4+
- any-glob-to-any-file:
5+
- ".checkov.yml"
6+
- ".clang-format"
7+
- ".clang-tidy"
8+
- ".flake8"
9+
- ".git-blame-ignore-revs"
10+
- ".github/**"
11+
- ".gitignore"
12+
- ".mega-linter.yml"
13+
- ".pre-commit-config.yaml"
14+
- "cmake/**"
15+
- "CMakeLists.txt"
16+
- "CODEOWNERS"
17+
- "COPYING"
18+
- "cppcheck_config"
19+
- "CPPLINT.cfg"
20+
- "dependencies/**"
21+
- "o2linter_config"
22+
- "packaging/**"
23+
- "pyproject.toml"
24+
- "README.md"
525

6-
common:
26+
datamodel:
727
- changed-files:
8-
- any-glob-to-any-file: ['Common/**']
28+
- any-glob-to-any-file: ["DataModel/**", "**/DataModel/**"]
929

10-
infrastructure:
30+
alice3:
1131
- changed-files:
12-
- any-glob-to-any-file:
13-
- '.clang-format'
14-
- '.clang-tidy'
15-
- '.flake8'
16-
- '.github/**'
17-
- '.checkov.yml'
18-
- '.mega-linter.yml'
19-
- '.pre-commit-config.yaml'
20-
- 'cmake/**'
21-
- 'CODEOWNERS'
22-
- 'CPPLINT.cfg'
23-
- 'dependencies/**'
24-
- 'packaging/**'
25-
- 'pyproject.toml'
32+
- any-glob-to-any-file: ["ALICE3/**"]
2633

27-
datamodel:
34+
common:
2835
- changed-files:
29-
- any-glob-to-any-file: ['DataModel/**', '**/DataModel/**']
36+
- any-glob-to-any-file: ["Common/**"]
3037

3138
dpg:
3239
- changed-files:
33-
- any-glob-to-any-file: ['DPG/**']
40+
- any-glob-to-any-file: ["DPG/**"]
3441

3542
pwgcf:
3643
- changed-files:
37-
- any-glob-to-any-file: ['PWGCF/**', '*/PWGCF/**']
44+
- any-glob-to-any-file: ["PWGCF/**", "*/PWGCF/**"]
3845

3946
pwgdq:
4047
- changed-files:
41-
- any-glob-to-any-file: ['PWGDQ/**', '*/PWGDQ/**']
48+
- any-glob-to-any-file: ["PWGDQ/**", "*/PWGDQ/**"]
4249

4350
pwgem:
4451
- changed-files:
45-
- any-glob-to-any-file: ['PWGEM/**', '*/PWGEM/**']
52+
- any-glob-to-any-file: ["PWGEM/**", "*/PWGEM/**"]
4653

4754
pwghf:
4855
- changed-files:
49-
- any-glob-to-any-file: ['PWGHF/**', '*/PWGHF/**']
56+
- any-glob-to-any-file: ["PWGHF/**", "*/PWGHF/**"]
5057

5158
pwgje:
5259
- changed-files:
53-
- any-glob-to-any-file: ['PWGJE/**', '*/PWGJE/**']
60+
- any-glob-to-any-file: ["PWGJE/**", "*/PWGJE/**"]
5461

5562
pwglf:
5663
- changed-files:
57-
- any-glob-to-any-file: ['PWGLF/**', '*/PWGLF/**', 'PWGMM/**', '*/PWGMM/**']
64+
- any-glob-to-any-file:
65+
["PWGLF/**", "*/PWGLF/**", "PWGMM/**", "*/PWGMM/**"]
66+
67+
pwgmm:
68+
- changed-files:
69+
- any-glob-to-any-file: ["PWGMM/**", "*/PWGMM/**"]
5870

5971
pwgud:
6072
- changed-files:
61-
- any-glob-to-any-file: ['PWGUD/**', '*/PWGUD/**']
73+
- any-glob-to-any-file: ["PWGUD/**", "*/PWGUD/**"]
74+
75+
scripts:
76+
- changed-files:
77+
- any-glob-to-any-file: ["Scripts/**"]
78+
79+
tools:
80+
- changed-files:
81+
- any-glob-to-any-file: ["Tools/**"]
6282

6383
trigger:
6484
- changed-files:
65-
- any-glob-to-any-file: ['EventFiltering/**']
85+
- any-glob-to-any-file: ["EventFiltering/**"]
6686

6787
tutorial:
6888
- changed-files:
69-
- any-glob-to-any-file: ['Tutorials/**']
89+
- any-glob-to-any-file: ["Tutorials/**"]

.github/workflows/mega-linter.yml

Lines changed: 3 additions & 3 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@v5
26+
uses: actions/checkout@v6
2727
with:
2828
# Checkout the HEAD of the PR instead of the merge commit.
2929
ref: ${{ github.event.pull_request.head.sha }}
@@ -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.0.1
41+
uses: oxsecurity/megalinter@v9.2.0
4242
env:
4343
# All available variables are described in documentation:
4444
# https://megalinter.io/configuration/
@@ -49,7 +49,7 @@ jobs:
4949

5050
# Upload MegaLinter artifacts
5151
- name: Archive production artifacts
52-
uses: actions/upload-artifact@v4
52+
uses: actions/upload-artifact@v5
5353
if: success() || failure()
5454
with:
5555
name: MegaLinter reports

.github/workflows/o2-linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ 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@v5
33+
uses: actions/checkout@v6
3434
with:
3535
ref: ${{ env.BRANCH_HEAD }}
3636
fetch-depth: 0 # needed to get the full history

.github/workflows/stale.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
with:
1818
repo-token: ${{ secrets.GITHUB_TOKEN }}
1919
stale-pr-message: 'This PR has not been updated in the last 30 days. Is it still needed? Unless further action is taken, it will be closed in 5 days.'
20+
stale-issue-message: 'This issue has not been updated in the last 30 days. Is it still needed? Unless further action is taken, it will be closed in 5 days.'
2021
stale-pr-label: stale
2122
days-before-stale: 30
2223
days-before-close: 5
24+
exempt-issue-labels: bug,enhancement

.mega-linter.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@ PYTHON_PYRIGHT_CONFIG_FILE: pyproject.toml
3939
PYTHON_RUFF_CONFIG_FILE: pyproject.toml
4040
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"]
4141
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"]
42+
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"]
4243
CPP_CPPCHECK_ARGUMENTS: --language=c++ --std=c++20 --check-level=exhaustive --suppressions-list=cppcheck_config
4344
REPOSITORY_GITLEAKS_PR_COMMITS_SCAN: true

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
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: v5.0.0
5+
rev: v6.0.0
66
hooks:
77
- id: trailing-whitespace
88
- id: end-of-file-fixer
99
- repo: https://github.com/pre-commit/mirrors-clang-format
10-
rev: v20.1.5 # clang-format version
10+
rev: v21.1.8 # clang-format version
1111
hooks:
1212
- id: clang-format
1313
- repo: https://github.com/cpplint/cpplint

ALICE3/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ add_subdirectory(Core)
1414
# add_subdirectory(DataModel)
1515
add_subdirectory(Tasks)
1616
add_subdirectory(TableProducer)
17-
# add_subdirectory(Tools)
17+
add_subdirectory(Macros)

ALICE3/Core/DelphesO2TrackSmearer.cxx

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ bool TrackSmearer::loadTable(int pdg, const char* filename, bool forceReload)
6666
std::string path = std::string(filename).substr(5); // Remove "ccdb:" prefix
6767
const std::string outPath = "/tmp/LUTs/";
6868
filename = Form("%s/%s/snapshot.root", outPath.c_str(), path.c_str());
69+
LOG(info) << " --- Local LUT filename will be: " << filename;
6970
std::ifstream checkFile(filename); // Check if file already exists
7071
if (!checkFile.is_open()) { // File does not exist, retrieve from CCDB
7172
LOG(info) << " --- CCDB source detected for PDG " << pdg << ": " << path;
@@ -76,6 +77,15 @@ bool TrackSmearer::loadTable(int pdg, const char* filename, bool forceReload)
7677
mCcdbManager->getCCDBAccessor().retrieveBlob(path, outPath, metadata, 1);
7778
// Add CCDB handling logic here if needed
7879
LOG(info) << " --- Now retrieving LUT file from CCDB to: " << filename;
80+
if (mCleanupDownloadedFile) { // Clean up the downloaded file if needed
81+
bool status = loadTable(pdg, filename, forceReload);
82+
if (std::remove(filename) != 0) {
83+
LOG(warn) << " --- Could not remove temporary LUT file: " << filename;
84+
} else {
85+
LOG(info) << " --- Removed temporary LUT file: " << filename;
86+
}
87+
return status;
88+
}
7989
} else { // File exists, proceed to load
8090
LOG(info) << " --- LUT file already exists: " << filename << ". Skipping download.";
8191
checkFile.close();
@@ -153,12 +163,13 @@ bool TrackSmearer::loadTable(int pdg, const char* filename, bool forceReload)
153163

154164
/*****************************************************************/
155165

156-
lutEntry_t*
157-
TrackSmearer::getLUTEntry(int pdg, float nch, float radius, float eta, float pt, float& interpolatedEff)
166+
lutEntry_t* TrackSmearer::getLUTEntry(const int pdg, const float nch, const float radius, const float eta, const float pt, float& interpolatedEff)
158167
{
159-
auto ipdg = getIndexPDG(pdg);
160-
if (!mLUTHeader[ipdg])
168+
const int ipdg = getIndexPDG(pdg);
169+
if (!mLUTHeader[ipdg]) {
161170
return nullptr;
171+
}
172+
162173
auto inch = mLUTHeader[ipdg]->nchmap.find(nch);
163174
auto irad = mLUTHeader[ipdg]->radmap.find(radius);
164175
auto ieta = mLUTHeader[ipdg]->etamap.find(eta);
@@ -280,7 +291,6 @@ bool TrackSmearer::smearTrack(O2Track& o2track, lutEntry_t* lutEntry, float inte
280291

281292
bool TrackSmearer::smearTrack(O2Track& o2track, int pdg, float nch)
282293
{
283-
284294
auto pt = o2track.getPt();
285295
switch (pdg) {
286296
case o2::constants::physics::kHelium3:
@@ -290,56 +300,56 @@ bool TrackSmearer::smearTrack(O2Track& o2track, int pdg, float nch)
290300
}
291301
auto eta = o2track.getEta();
292302
float interpolatedEff = 0.0f;
293-
auto lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, interpolatedEff);
303+
lutEntry_t* lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, interpolatedEff);
294304
if (!lutEntry || !lutEntry->valid)
295305
return false;
296306
return smearTrack(o2track, lutEntry, interpolatedEff);
297307
}
298308

299309
/*****************************************************************/
300310
// relative uncertainty on pt
301-
double TrackSmearer::getPtRes(int pdg, float nch, float eta, float pt)
311+
double TrackSmearer::getPtRes(const int pdg, const float nch, const float eta, const float pt)
302312
{
303313
float dummy = 0.0f;
304-
auto lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, dummy);
314+
lutEntry_t* lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, dummy);
305315
auto val = std::sqrt(lutEntry->covm[14]) * lutEntry->pt;
306316
return val;
307317
}
308318

309319
/*****************************************************************/
310320
// relative uncertainty on eta
311-
double TrackSmearer::getEtaRes(int pdg, float nch, float eta, float pt)
321+
double TrackSmearer::getEtaRes(const int pdg, const float nch, const float eta, const float pt)
312322
{
313323
float dummy = 0.0f;
314-
auto lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, dummy);
324+
lutEntry_t* lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, dummy);
315325
auto sigmatgl = std::sqrt(lutEntry->covm[9]); // sigmatgl2
316326
auto etaRes = std::fabs(std::sin(2.0 * std::atan(std::exp(-eta)))) * sigmatgl; // propagate tgl to eta uncertainty
317327
etaRes /= lutEntry->eta; // relative uncertainty
318328
return etaRes;
319329
}
320330
/*****************************************************************/
321331
// absolute uncertainty on pt
322-
double TrackSmearer::getAbsPtRes(int pdg, float nch, float eta, float pt)
332+
double TrackSmearer::getAbsPtRes(const int pdg, const float nch, const float eta, const float pt)
323333
{
324334
float dummy = 0.0f;
325-
auto lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, dummy);
335+
lutEntry_t* lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, dummy);
326336
auto val = std::sqrt(lutEntry->covm[14]) * lutEntry->pt * lutEntry->pt;
327337
return val;
328338
}
329339

330340
/*****************************************************************/
331341
// absolute uncertainty on eta
332-
double TrackSmearer::getAbsEtaRes(int pdg, float nch, float eta, float pt)
342+
double TrackSmearer::getAbsEtaRes(const int pdg, const float nch, const float eta, const float pt)
333343
{
334344
float dummy = 0.0f;
335-
auto lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, dummy);
345+
lutEntry_t* lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, dummy);
336346
auto sigmatgl = std::sqrt(lutEntry->covm[9]); // sigmatgl2
337347
auto etaRes = std::fabs(std::sin(2.0 * std::atan(std::exp(-eta)))) * sigmatgl; // propagate tgl to eta uncertainty
338348
return etaRes;
339349
}
340350
/*****************************************************************/
341351
// efficiency
342-
double TrackSmearer::getEfficiency(int pdg, float nch, float eta, float pt)
352+
double TrackSmearer::getEfficiency(const int pdg, const float nch, const float eta, const float pt)
343353
{
344354
float efficiency = 0.0f;
345355
getLUTEntry(pdg, nch, 0., eta, pt, efficiency);
@@ -360,7 +370,7 @@ double TrackSmearer::getEfficiency(int pdg, float nch, float eta, float pt)
360370
// return true;
361371

362372
// #if 0
363-
// auto lutEntry = getLUTEntry(track.PID, 0., 0., track.Eta, track.PT);
373+
// lutEntry_t* lutEntry = getLUTEntry(track.PID, 0., 0., track.Eta, track.PT);
364374
// if (!lutEntry)
365375
// return;
366376

ALICE3/Core/DelphesO2TrackSmearer.h

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -180,23 +180,24 @@ class TrackSmearer
180180

181181
/** LUT methods **/
182182
bool loadTable(int pdg, const char* filename, bool forceReload = false);
183-
void useEfficiency(bool val) { mUseEfficiency = val; } //;
184-
void interpolateEfficiency(bool val) { mInterpolateEfficiency = val; } //;
185-
void skipUnreconstructed(bool val) { mSkipUnreconstructed = val; } //;
186-
void setWhatEfficiency(int val) { mWhatEfficiency = val; } //;
187-
lutHeader_t* getLUTHeader(int pdg) { return mLUTHeader[getIndexPDG(pdg)]; } //;
188-
lutEntry_t* getLUTEntry(int pdg, float nch, float radius, float eta, float pt, float& interpolatedEff);
183+
bool hasTable(int pdg) { return (mLUTHeader[getIndexPDG(pdg)] != nullptr); } //;
184+
void useEfficiency(bool val) { mUseEfficiency = val; } //;
185+
void interpolateEfficiency(bool val) { mInterpolateEfficiency = val; } //;
186+
void skipUnreconstructed(bool val) { mSkipUnreconstructed = val; } //;
187+
void setWhatEfficiency(int val) { mWhatEfficiency = val; } //;
188+
lutHeader_t* getLUTHeader(int pdg) { return mLUTHeader[getIndexPDG(pdg)]; } //;
189+
lutEntry_t* getLUTEntry(const int pdg, const float nch, const float radius, const float eta, const float pt, float& interpolatedEff);
189190

190191
bool smearTrack(O2Track& o2track, lutEntry_t* lutEntry, float interpolatedEff);
191192
bool smearTrack(O2Track& o2track, int pdg, float nch);
192193
// bool smearTrack(Track& track, bool atDCA = true); // Only in DelphesO2
193-
double getPtRes(int pdg, float nch, float eta, float pt);
194-
double getEtaRes(int pdg, float nch, float eta, float pt);
195-
double getAbsPtRes(int pdg, float nch, float eta, float pt);
196-
double getAbsEtaRes(int pdg, float nch, float eta, float pt);
197-
double getEfficiency(int pdg, float nch, float eta, float pt);
194+
double getPtRes(const int pdg, const float nch, const float eta, const float pt);
195+
double getEtaRes(const int pdg, const float nch, const float eta, const float pt);
196+
double getAbsPtRes(const int pdg, const float nch, const float eta, const float pt);
197+
double getAbsEtaRes(const int pdg, const float nch, const float eta, const float pt);
198+
double getEfficiency(const int pdg, const float nch, const float eta, const float pt);
198199

199-
int getIndexPDG(int pdg)
200+
int getIndexPDG(const int pdg)
200201
{
201202
switch (abs(pdg)) {
202203
case 11:
@@ -249,6 +250,7 @@ class TrackSmearer
249250
}
250251
void setdNdEta(float val) { mdNdEta = val; } //;
251252
void setCcdbManager(o2::ccdb::BasicCCDBManager* mgr) { mCcdbManager = mgr; } //;
253+
void setCleanupDownloadedFile(bool val) { mCleanupDownloadedFile = val; } //;
252254

253255
protected:
254256
static constexpr unsigned int nLUTs = 9; // Number of LUT available
@@ -262,6 +264,7 @@ class TrackSmearer
262264

263265
private:
264266
o2::ccdb::BasicCCDBManager* mCcdbManager = nullptr;
267+
bool mCleanupDownloadedFile = true;
265268
};
266269

267270
} // namespace delphes

0 commit comments

Comments
 (0)