Skip to content

Commit 64dbb89

Browse files
committed
Merge branch 'master' of https://github.com/AliceO2Group/O2Physics into doublephi23042025
2 parents d114165 + e478b4d commit 64dbb89

36 files changed

+4275
-3276
lines changed

.github/workflows/o2-linter.yml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# Find issues in O2 code
33
name: O2 linter
44

5-
'on': [pull_request, push]
5+
"on": [pull_request_target, push]
66
permissions: {}
77
env:
8-
MAIN_BRANCH: master
8+
BRANCH_MAIN: master
99

1010
concurrency:
1111
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
@@ -15,20 +15,47 @@ jobs:
1515
o2-linter:
1616
name: O2 linter
1717
runs-on: ubuntu-24.04
18+
permissions:
19+
pull-requests: write
1820
steps:
21+
- name: Set branches
22+
run: |
23+
if [[ "${{ github.event_name }}" == "push" ]]; then
24+
branch_head="${{ github.ref }}"
25+
branch_base="${{ env.BRANCH_MAIN }}"
26+
else
27+
branch_head="refs/pull/${{ github.event.pull_request.number }}/merge"
28+
branch_base="${{ github.event.pull_request.base.ref }}"
29+
fi
30+
echo BRANCH_HEAD="$branch_head" >> "$GITHUB_ENV"
31+
echo BRANCH_BASE="$branch_base" >> "$GITHUB_ENV"
1932
- name: Checkout Code
2033
uses: actions/checkout@v4
2134
with:
35+
ref: ${{ env.BRANCH_HEAD }}
2236
fetch-depth: 0 # needed to get the full history
2337
- name: Run tests
38+
id: linter
2439
run: |
25-
# Diff against the common ancestor of the source branch and the main branch.
26-
readarray -t files < <(git diff --diff-filter d --name-only origin/${{ env.MAIN_BRANCH }}...)
40+
# Diff against the common ancestor of the source (head) branch and the target (base) branch.
41+
echo "Diffing ${{ env.BRANCH_HEAD }} against ${{ env.BRANCH_BASE }}."
42+
readarray -t files < <(git diff --diff-filter d --name-only origin/${{ env.BRANCH_BASE }}...)
2743
if [ ${#files[@]} -eq 0 ]; then
2844
echo "::notice::No files to lint."
45+
echo "linter_ran=0" >> "$GITHUB_OUTPUT"
2946
exit 0
3047
fi
31-
[ ${{ github.event_name }} == 'pull_request' ] && options="-g"
48+
echo "linter_ran=1" >> "$GITHUB_OUTPUT"
49+
[[ "${{ github.event_name }}" == "pull_request_target" ]] && options="-g"
3250
# shellcheck disable=SC2086 # Ignore unquoted options.
3351
python3 Scripts/o2_linter.py $options "${files[@]}"
3452
echo "Tip: If you allow actions in your fork repository, O2 linter will run when you push commits."
53+
- name: Comment PR
54+
if: (success() || failure()) && (github.event_name == 'pull_request_target' && steps.linter.outputs.linter_ran == 1)
55+
uses: thollander/actions-comment-pull-request@v3
56+
with:
57+
comment-tag: o2-linter
58+
message: "**O2 linter results:**
59+
❌ ${{ steps.linter.outputs.n_issues }} errors,
60+
⚠️ ${{ steps.linter.outputs.n_tolerated }} warnings,
61+
🔕 ${{ steps.linter.outputs.n_disabled }} disabled"

DPG/Tasks/TPC/tpcSkimsTableCreator.cxx

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <CCDB/BasicCCDBManager.h>
2121
#include <cmath>
2222
#include <vector>
23+
#include <string>
2324
/// ROOT
2425
#include "TRandom3.h"
2526
/// O2
@@ -53,6 +54,7 @@ struct TreeWriterTpcV0 {
5354
using Trks = soa::Join<aod::Tracks, aod::V0Bits, aod::TracksExtra, aod::pidTPCFullEl, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr, aod::pidTOFFullEl, aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr, aod::TrackSelection>;
5455
using Colls = soa::Join<aod::Collisions, aod::Mults, aod::EvSels>;
5556
using MyBCTable = soa::Join<aod::BCsWithTimestamps, aod::BCTFinfoTable>;
57+
using V0sWithID = soa::Join<aod::V0Datas, aod::V0MapID>;
5658

5759
/// Tables to be produced
5860
Produces<o2::aod::SkimmedTPCV0Tree> rowTPCTree;
@@ -63,6 +65,7 @@ struct TreeWriterTpcV0 {
6365
Configurable<float> nClNorm{"nClNorm", 152., "Number of cluster normalization. Run 2: 159, Run 3 152"};
6466
Configurable<int> applyEvSel{"applyEvSel", 2, "Flag to apply rapidity cut: 0 -> no event selection, 1 -> Run 2 event selection, 2 -> Run 3 event selection"};
6567
Configurable<int> trackSelection{"trackSelection", 1, "Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks"};
68+
Configurable<std::string> irSource{"irSource", "T0VTX", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"};
6669
/// Configurables downsampling
6770
Configurable<double> dwnSmplFactor_Pi{"dwnSmplFactor_Pi", 1., "downsampling factor for pions, default fraction to keep is 1."};
6871
Configurable<double> dwnSmplFactor_Pr{"dwnSmplFactor_Pr", 1., "downsampling factor for protons, default fraction to keep is 1."};
@@ -90,6 +93,7 @@ struct TreeWriterTpcV0 {
9093
{
9194

9295
const double ncl = track.tpcNClsFound();
96+
const double nclPID = track.tpcNClsFindableMinusPID();
9397
const double p = track.tpcInnerParam();
9498
const double mass = o2::track::pid_constants::sMasses[id];
9599
const double bg = p / mass;
@@ -118,6 +122,7 @@ struct TreeWriterTpcV0 {
118122
bg,
119123
multTPC / 11000.,
120124
std::sqrt(nClNorm / ncl),
125+
nclPID,
121126
id,
122127
nSigmaTPC,
123128
nSigmaTOF,
@@ -140,6 +145,7 @@ struct TreeWriterTpcV0 {
140145
{
141146

142147
const double ncl = track.tpcNClsFound();
148+
const double nclPID = track.tpcNClsFindableMinusPID();
143149
const double p = track.tpcInnerParam();
144150
const double mass = o2::track::pid_constants::sMasses[id];
145151
const double bg = p / mass;
@@ -168,6 +174,7 @@ struct TreeWriterTpcV0 {
168174
bg,
169175
multTPC / 11000.,
170176
std::sqrt(nClNorm / ncl),
177+
nclPID,
171178
id,
172179
nSigmaTPC,
173180
nSigmaTOF,
@@ -252,22 +259,25 @@ struct TreeWriterTpcV0 {
252259
}
253260

254261
/// Apply a track quality selection with a filter!
255-
void processStandard(Colls::iterator const& collision, soa::Filtered<Trks> const& tracks, aod::V0Datas const& v0s, aod::BCsWithTimestamps const&)
262+
void processStandard(Colls::iterator const& collision, soa::Filtered<Trks> const& tracks, V0sWithID const& v0s, aod::BCsWithTimestamps const&)
256263
{
257264
/// Check event slection
258265
if (!isEventSelected(collision, tracks)) {
259266
return;
260267
}
261268
auto bc = collision.bc_as<aod::BCsWithTimestamps>();
262269
const int runnumber = bc.runNumber();
263-
float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, "ZNC hadronic") * 1.e-3;
270+
float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * 1.e-3;
264271

265272
rowTPCTree.reserve(tracks.size());
266273

267274
/// Loop over v0 candidates
268275
for (const auto& v0 : v0s) {
269276
auto posTrack = v0.posTrack_as<soa::Filtered<Trks>>();
270277
auto negTrack = v0.negTrack_as<soa::Filtered<Trks>>();
278+
if (v0.v0addid() == -1) {
279+
continue;
280+
}
271281
// gamma
272282
if (static_cast<bool>(posTrack.pidbit() & (1 << 0)) && static_cast<bool>(negTrack.pidbit() & (1 << 0))) {
273283
if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisElectrons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Electron], maxPt4dwnsmplTsalisElectrons)) {
@@ -313,8 +323,8 @@ struct TreeWriterTpcV0 {
313323
PROCESS_SWITCH(TreeWriterTpcV0, processStandard, "Standard V0 Samples for PID", true);
314324

315325
Preslice<Trks> perCollisionTracks = aod::track::collisionId;
316-
Preslice<aod::V0Datas> perCollisionV0s = aod::v0data::collisionId;
317-
void processWithTrQA(Colls const& collisions, Trks const& myTracks, aod::V0Datas const& myV0s, MyBCTable const&, aod::TracksQA_002 const& tracksQA)
326+
Preslice<V0sWithID> perCollisionV0s = aod::v0data::collisionId;
327+
void processWithTrQA(Colls const& collisions, Trks const& myTracks, V0sWithID const& myV0s, MyBCTable const&, aod::TracksQA_002 const& tracksQA)
318328
{
319329
std::vector<int64_t> labelTrack2TrackQA;
320330
labelTrack2TrackQA.clear();
@@ -333,7 +343,7 @@ struct TreeWriterTpcV0 {
333343
}
334344
auto bc = collision.bc_as<MyBCTable>();
335345
const int runnumber = bc.runNumber();
336-
float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, "ZNC hadronic") * 1.e-3;
346+
float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * 1.e-3;
337347
const int bcGlobalIndex = bc.globalIndex();
338348
const int bcTimeFrameId = bc.tfId();
339349
const int bcBcInTimeFrame = bc.bcInTF();
@@ -342,6 +352,9 @@ struct TreeWriterTpcV0 {
342352
for (const auto& v0 : v0s) {
343353
auto posTrack = v0.posTrack_as<Trks>();
344354
auto negTrack = v0.negTrack_as<Trks>();
355+
if (v0.v0addid() == -1) {
356+
continue;
357+
}
345358
aod::TracksQA_002::iterator posTrackQA;
346359
aod::TracksQA_002::iterator negTrackQA;
347360
bool existPosTrkQA;
@@ -432,6 +445,7 @@ struct TreeWriterTPCTOF {
432445
Configurable<int> applyEvSel{"applyEvSel", 2, "Flag to apply rapidity cut: 0 -> no event selection, 1 -> Run 2 event selection, 2 -> Run 3 event selection"};
433446
Configurable<int> applyTrkSel{"applyTrkSel", 1, "Flag to apply track selection: 0 -> no track selection, 1 -> track selection"};
434447
Configurable<int> trackSelection{"trackSelection", 1, "Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks"};
448+
Configurable<std::string> irSource{"irSource", "T0VTX", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"};
435449
/// Triton
436450
Configurable<float> maxMomTPCOnlyTr{"maxMomTPCOnlyTr", 1.5, "Maximum momentum for TPC only cut triton"};
437451
Configurable<float> maxMomHardCutOnlyTr{"maxMomHardCutOnlyTr", 50, "Maximum TPC inner momentum for triton"};
@@ -517,6 +531,7 @@ struct TreeWriterTPCTOF {
517531
{
518532

519533
const double ncl = track.tpcNClsFound();
534+
const double nclPID = track.tpcNClsFindableMinusPID();
520535
const double p = track.tpcInnerParam();
521536
const double mass = o2::track::pid_constants::sMasses[id];
522537
const double bg = p / mass;
@@ -538,6 +553,7 @@ struct TreeWriterTPCTOF {
538553
bg,
539554
multTPC / 11000.,
540555
std::sqrt(nClNorm / ncl),
556+
nclPID,
541557
id,
542558
nSigmaTPC,
543559
nSigmaTOF,
@@ -553,6 +569,7 @@ struct TreeWriterTPCTOF {
553569
{
554570

555571
const double ncl = track.tpcNClsFound();
572+
const double nclPID = track.tpcNClsFindableMinusPID();
556573
const double p = track.tpcInnerParam();
557574
const double mass = o2::track::pid_constants::sMasses[id];
558575
const double bg = p / mass;
@@ -574,6 +591,7 @@ struct TreeWriterTPCTOF {
574591
bg,
575592
multTPC / 11000.,
576593
std::sqrt(nClNorm / ncl),
594+
nclPID,
577595
id,
578596
nSigmaTPC,
579597
nSigmaTOF,
@@ -628,7 +646,7 @@ struct TreeWriterTPCTOF {
628646
}
629647
auto bc = collision.bc_as<aod::BCsWithTimestamps>();
630648
const int runnumber = bc.runNumber();
631-
float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, "ZNC hadronic") * 1.e-3;
649+
float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * 1.e-3;
632650

633651
rowTPCTOFTree.reserve(tracks.size());
634652
for (auto const& trk : tracks) {
@@ -688,7 +706,7 @@ struct TreeWriterTPCTOF {
688706
}
689707
auto bc = collision.bc_as<MyBCTable>();
690708
const int runnumber = bc.runNumber();
691-
float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, "ZNC hadronic") * 1.e-3;
709+
float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * 1.e-3;
692710
const int bcGlobalIndex = bc.globalIndex();
693711
const int bcTimeFrameId = bc.tfId();
694712
const int bcBcInTimeFrame = bc.bcInTF();

DPG/Tasks/TPC/tpcSkimsTableCreator.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ DECLARE_SOA_COLUMN(Mass, mass, float);
3333
DECLARE_SOA_COLUMN(BetaGamma, bg, float);
3434
DECLARE_SOA_COLUMN(NormMultTPC, normMultTPC, float);
3535
DECLARE_SOA_COLUMN(NormNClustersTPC, normNClustersTPC, float);
36+
DECLARE_SOA_COLUMN(NormNClustersTPCPID, normNClustersTPCPID, float);
3637
DECLARE_SOA_COLUMN(PidIndex, pidIndexTPC, uint8_t);
3738
DECLARE_SOA_COLUMN(NSigTPC, nsigTPC, float);
3839
DECLARE_SOA_COLUMN(NSigTOF, nsigTOF, float);
@@ -64,6 +65,7 @@ DECLARE_SOA_TABLE(SkimmedTPCV0Tree, "AOD", "TPCSKIMV0TREE",
6465
tpcskims::BetaGamma,
6566
tpcskims::NormMultTPC,
6667
tpcskims::NormNClustersTPC,
68+
tpcskims::NormNClustersTPCPID,
6769
tpcskims::PidIndex,
6870
tpcskims::NSigTPC,
6971
tpcskims::NSigTOF,
@@ -90,6 +92,7 @@ DECLARE_SOA_TABLE(SkimmedTPCV0TreeWithTrkQA, "AOD", "TPCSKIMV0WQA",
9092
tpcskims::BetaGamma,
9193
tpcskims::NormMultTPC,
9294
tpcskims::NormNClustersTPC,
95+
tpcskims::NormNClustersTPCPID,
9396
tpcskims::PidIndex,
9497
tpcskims::NSigTPC,
9598
tpcskims::NSigTOF,
@@ -129,6 +132,7 @@ DECLARE_SOA_TABLE(SkimmedTPCTOFTree, "AOD", "TPCTOFSKIMTREE",
129132
tpcskims::BetaGamma,
130133
tpcskims::NormMultTPC,
131134
tpcskims::NormNClustersTPC,
135+
tpcskims::NormNClustersTPCPID,
132136
tpcskims::PidIndex,
133137
tpcskims::NSigTPC,
134138
tpcskims::NSigTOF,
@@ -150,6 +154,7 @@ DECLARE_SOA_TABLE(SkimmedTPCTOFTreeWithTrkQA, "AOD", "TPCTOFSKIMWQA",
150154
tpcskims::BetaGamma,
151155
tpcskims::NormMultTPC,
152156
tpcskims::NormNClustersTPC,
157+
tpcskims::NormNClustersTPCPID,
153158
tpcskims::PidIndex,
154159
tpcskims::NSigTPC,
155160
tpcskims::NSigTOF,

EventFiltering/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ o2physics_add_dpl_workflow(hf-filter-prepare-ml-samples
5454

5555
o2physics_add_dpl_workflow(cf-filter
5656
SOURCES PWGCF/CFFilterAll.cxx
57-
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
57+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore KFParticle::KFParticle O2::ReconstructionDataFormats O2::DetectorsBase
5858
COMPONENT_NAME Analysis)
5959

6060
o2physics_add_dpl_workflow(cf-filter-qa

0 commit comments

Comments
 (0)