Skip to content

Commit d3f8e5e

Browse files
Merge branch 'AliceO2Group:master' into master
2 parents 36c3698 + f640ac8 commit d3f8e5e

393 files changed

Lines changed: 35002 additions & 14972 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.

.github/workflows/o2-linter.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
# Find issues in O2 code
3+
name: O2 linter
4+
5+
'on': [pull_request, push]
6+
permissions: {}
7+
env:
8+
MAIN_BRANCH: master
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
o2-linter:
16+
name: O2 linter
17+
runs-on: ubuntu-24.04
18+
steps:
19+
- name: Checkout Code
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0 # needed to get the full history
23+
- name: Run tests
24+
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 }}...)
27+
if [ ${#files[@]} -eq 0 ]; then
28+
echo "::notice::No files to lint."
29+
exit 0
30+
fi
31+
[ ${{ github.event_name }} == 'pull_request' ] && options="-g"
32+
# shellcheck disable=SC2086 # Ignore unquoted options.
33+
python3 Scripts/o2_linter.py $options "${files[@]}"
34+
echo "Tip: If you allow actions in your fork repository, O2 linter will run when you push commits."

ALICE3/TableProducer/OTF/onTheFlyTOFPID.cxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ struct OnTheFlyTOFPID {
8181
Configurable<int> nBinsTrackDeltaLength{"nBinsTrackDeltaLength", 100, "number of bins in delta track length"};
8282
Configurable<int> nBinsNsigmaCorrectSpecies{"nBinsNsigmaCorrectSpecies", 200, "number of bins in Nsigma plot (correct speies)"};
8383
Configurable<int> nBinsNsigmaWrongSpecies{"nBinsNsigmaWrongSpecies", 200, "number of bins in Nsigma plot (wrong species)"};
84+
Configurable<float> minNsigmaRange{"minNsigmaRange", -10, "lower limit for the nsigma axis"};
85+
Configurable<float> maxNsigmaRange{"maxNsigmaRange", +10, "upper limit for the nsigma axis"};
8486
Configurable<int> nBinsTimeRes{"nBinsTimeRes", 400, "number of bins plots time resolution"};
8587
Configurable<int> nBinsRelativeEtaPt{"nBinsRelativeEtaPt", 400, "number of bins plots pt and eta relative errors"};
8688
Configurable<int> nBinsEta{"nBinsEta", 400, "number of bins plot relative eta error"};
@@ -138,7 +140,7 @@ struct OnTheFlyTOFPID {
138140
}
139141

140142
if (doQAplots) {
141-
const AxisSpec axisMomentum{static_cast<int>(nBinsP), 0.0f, +4.0f, "#it{p} (GeV/#it{c})"};
143+
const AxisSpec axisMomentum{static_cast<int>(nBinsP), 0.0f, +10.0f, "#it{p} (GeV/#it{c})"};
142144
const AxisSpec axisMomentumSmall{static_cast<int>(nBinsP), 0.0f, +1.0f, "#it{p} (GeV/#it{c})"};
143145
const AxisSpec axisVelocity{static_cast<int>(nBinsBeta), 0.0f, +1.1f, "Measured #beta"};
144146
const AxisSpec axisTrackLengthInner{static_cast<int>(nBinsTrackLengthInner), 0.0f, 60.0f, "Track length (cm)"};
@@ -182,11 +184,11 @@ struct OnTheFlyTOFPID {
182184
std::string name_title_inner = "h2dInnerNsigmaTrue" + particle_names2[i_true] + "Vs" + particle_names2[i_hyp] + "Hypothesis";
183185
std::string name_title_outer = "h2dOuterNsigmaTrue" + particle_names2[i_true] + "Vs" + particle_names2[i_hyp] + "Hypothesis";
184186
if (i_true == i_hyp) {
185-
const AxisSpec axisNsigmaCorrect{static_cast<int>(nBinsNsigmaCorrectSpecies), -10.0f, +10.0f, "N#sigma - True " + particle_names1[i_true] + " vs " + particle_names1[i_hyp] + " hypothesis"};
187+
const AxisSpec axisNsigmaCorrect{static_cast<int>(nBinsNsigmaCorrectSpecies), minNsigmaRange, maxNsigmaRange, "N#sigma - True " + particle_names1[i_true] + " vs " + particle_names1[i_hyp] + " hypothesis"};
186188
histos.add(name_title_inner.c_str(), name_title_inner.c_str(), kTH2F, {axisMomentum, axisNsigmaCorrect});
187189
histos.add(name_title_outer.c_str(), name_title_outer.c_str(), kTH2F, {axisMomentum, axisNsigmaCorrect});
188190
} else {
189-
const AxisSpec axisNsigmaWrong{static_cast<int>(nBinsNsigmaWrongSpecies), -10.0f, +10.0f, "N#sigma - True " + particle_names1[i_true] + " vs " + particle_names1[i_hyp] + " hypothesis"};
191+
const AxisSpec axisNsigmaWrong{static_cast<int>(nBinsNsigmaWrongSpecies), minNsigmaRange, maxNsigmaRange, "N#sigma - True " + particle_names1[i_true] + " vs " + particle_names1[i_hyp] + " hypothesis"};
190192
histos.add(name_title_inner.c_str(), name_title_inner.c_str(), kTH2F, {axisMomentum, axisNsigmaWrong});
191193
histos.add(name_title_outer.c_str(), name_title_outer.c_str(), kTH2F, {axisMomentum, axisNsigmaWrong});
192194
}

CODEOWNERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
/PWGCF/TableProducer @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye
3434
/PWGCF/Tasks @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye
3535
/PWGDQ @alibuild @iarsene @dsekihat @feisenhu @lucamicheletti93
36-
/PWGEM @alibuild @mikesas @rbailhac @feisenhu
36+
/PWGEM @alibuild @feisenhu @dsekihat @ivorobye
3737
/PWGEM/Dilepton @alibuild @mikesas @rbailhac @dsekihat @ivorobye @feisenhu
3838
/PWGEM/PhotonMeson @alibuild @mikesas @rbailhac @m-c-danisch @novitzky @mhemmer-cern @dsekihat
3939
/PWGHF @alibuild @vkucera @fcolamar @fgrosa @fcatalan92 @mfaggin @mmazzilli @deepathoms @NicoleBastid @hahassan7 @jpxrk @apalasciano
@@ -43,8 +43,8 @@
4343
/PWGLF/TableProducer/GlobalEventProperties @alibuild @njacazio @skundu692 @gbencedi @omvazque
4444
/PWGLF/Tasks/Nuspex @alibuild @njacazio @skundu692 @fmazzasc @chiarapinto @maciacco
4545
/PWGLF/TableProducer/Nuspex @alibuild @njacazio @skundu692 @fmazzasc @chiarapinto @maciacco
46-
/PWGLF/Tasks/Resonances @alibuild @njacazio @skundu692 @BongHwi @smaff92
47-
/PWGLF/TableProducer/Resonances @alibuild @njacazio @skundu692 @BongHwi @smaff92
46+
/PWGLF/Tasks/Resonances @alibuild @njacazio @skundu692 @dmallick2 @smaff92
47+
/PWGLF/TableProducer/Resonances @alibuild @njacazio @skundu692 @dmallick2 @smaff92
4848
/PWGLF/Tasks/Strangeness @alibuild @njacazio @skundu692 @ercolessi @ChiaraDeMartin95
4949
/PWGLF/TableProducer/Strangeness @alibuild @njacazio @skundu692 @ercolessi @ChiaraDeMartin95
5050

Common/CCDB/EventSelectionParams.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ const char* selectionLabels[kNsel] = {
6060
"kNoCollInTimeRangeStandard",
6161
"kNoCollInTimeRangeVzDependent",
6262
"kNoCollInRofStrict",
63-
"kNoCollInRofStandard"};
63+
"kNoCollInRofStandard",
64+
"kNoHighMultCollInPrevRof"};
6465
} // namespace o2::aod::evsel
6566

6667
using namespace o2::aod::evsel;

Common/CCDB/EventSelectionParams.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ enum EventSelectionFlags {
6666
kNoCollInTimeRangeVzDependent, // no other collisions in vZ-dependent time range near a given collision
6767
kNoCollInRofStrict, // no other collisions in this Readout Frame
6868
kNoCollInRofStandard, // no other collisions in this Readout Frame with per-collision multiplicity above threshold
69+
kNoHighMultCollInPrevRof, // veto an event if FT0C amplitude in previous ITS ROF is above threshold
6970
kNsel // counter
7071
};
7172

Common/Core/PID/PIDTOF.h

Lines changed: 66 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ static constexpr float kCSPEDDInv = 1.f / kCSPEED; /// Inverse of
4646
static constexpr float defaultReturnValue = -999.f; /// Default return value in case TOF measurement is not available
4747

4848
/// \brief Class to handle the the TOF detector response for the TOF beta measurement
49-
template <typename TrackType>
5049
class Beta
5150
{
5251
public:
@@ -62,11 +61,19 @@ class Beta
6261
/// Gets the beta for the track of interest
6362
/// \param track Track of interest
6463
/// \param collisionTime Collision time
65-
static float GetBeta(const TrackType& track, const float collisionTime) { return track.hasTOF() ? GetBeta(track.length(), track.tofSignal(), collisionTime) : defaultReturnValue; }
64+
template <typename TrackType>
65+
static float GetBeta(const TrackType& track, const float collisionTime)
66+
{
67+
return track.hasTOF() ? GetBeta(track.length(), track.tofSignal(), collisionTime) : defaultReturnValue;
68+
}
6669

6770
/// Gets the beta for the track of interest
6871
/// \param track Track of interest
69-
static float GetBeta(const TrackType& track) { return GetBeta(track, track.tofEvTime()); }
72+
template <typename TrackType>
73+
static float GetBeta(const TrackType& track)
74+
{
75+
return GetBeta(track, track.tofEvTime());
76+
}
7077

7178
/// Computes the expected uncertainty on the beta measurement
7279
/// \param length Length in cm of the track
@@ -77,7 +84,11 @@ class Beta
7784

7885
/// Gets the expected uncertainty on the beta measurement of the track of interest
7986
/// \param track Track of interest
80-
float GetExpectedSigma(const TrackType& track) const { return GetExpectedSigma(track.length(), track.tofSignal(), track.tofEvTime(), mExpectedResolution); }
87+
template <typename TrackType>
88+
float GetExpectedSigma(const TrackType& track) const
89+
{
90+
return GetExpectedSigma(track.length(), track.tofSignal(), track.tofEvTime(), mExpectedResolution);
91+
}
8192

8293
/// Gets the expected beta for a given mass hypothesis (no energy loss taken into account)
8394
/// \param momentum momentum in GeV/c of the track
@@ -86,15 +97,15 @@ class Beta
8697

8798
/// Gets the expected beta given the particle index (no energy loss taken into account) of the track of interest
8899
/// \param track Track of interest
89-
template <o2::track::PID::ID id>
100+
template <o2::track::PID::ID id, typename TrackType>
90101
float GetExpectedBeta(const TrackType& track) const
91102
{
92103
return GetExpectedBeta(track.p(), o2::track::PID::getMass2Z(id));
93104
}
94105

95106
/// Gets the number of sigmas with respect the approximate beta (no energy loss taken into account) of the track of interest
96107
/// \param track Track of interest
97-
template <o2::track::PID::ID id>
108+
template <o2::track::PID::ID id, typename TrackType>
98109
float GetSeparation(const TrackType& track) const
99110
{
100111
return (GetBeta(track) - GetExpectedBeta<id>(track)) / GetExpectedSigma(track);
@@ -104,7 +115,6 @@ class Beta
104115
};
105116

106117
/// \brief Class to handle the the TOF detector response for the TOF mass measurement
107-
template <typename TrackType>
108118
class TOFMass
109119
{
110120
public:
@@ -118,11 +128,19 @@ class TOFMass
118128

119129
/// Gets the TOF mass for the track of interest
120130
/// \param track Track of interest
121-
static float GetTOFMass(const TrackType& track, const float beta) { return track.hasTOF() ? GetTOFMass(track.p(), beta) : defaultReturnValue; }
131+
template <typename TrackType>
132+
static float GetTOFMass(const TrackType& track, const float beta)
133+
{
134+
return track.hasTOF() ? GetTOFMass(track.p(), beta) : defaultReturnValue;
135+
}
122136

123137
/// Gets the TOF mass for the track of interest
124138
/// \param track Track of interest
125-
static float GetTOFMass(const TrackType& track) { return track.hasTOF() ? GetTOFMass(track.p(), Beta<TrackType>::GetBeta(track)) : defaultReturnValue; }
139+
template <typename TrackType>
140+
static float GetTOFMass(const TrackType& track)
141+
{
142+
return track.hasTOF() ? GetTOFMass(track.p(), Beta::GetBeta<TrackType>(track)) : defaultReturnValue;
143+
}
126144
};
127145

128146
/// \brief Next implementation class to store TOF response parameters for exp. times
@@ -219,7 +237,7 @@ class TOFResoParamsV2 : public o2::tof::Parameters<13>
219237
}
220238
f.Close();
221239
}
222-
LOG(info) << "Set the Time Shift parameters from file " << filename << " and object " << objname << " for " << (positive ? "positive" : "negative");
240+
LOG(info) << "Set the Time Shift parameters from file " << filename << " and object " << objname << " for " << (positive ? "positive" : "negative") << " example of shift at eta 0: " << getTimeShift(0, positive);
223241
}
224242
void setTimeShiftParameters(TGraph* g, bool positive)
225243
{
@@ -266,7 +284,7 @@ class TOFResoParamsV3 : public o2::tof::Parameters<13>
266284
"time_resolution", "time_resolution", "time_resolution", "time_resolution"},
267285
"TOFResoParamsV3")
268286
{
269-
setParameters(std::array<float, 13>{60.0});
287+
setParameters(std::array<float, 13>{60.0, 60.0, 60.0, 60.0, 60.0, 60.0, 60.0, 60.0, 60.0, 60.0, 60.0, 60.0, 60.0});
270288
} // Default constructor with default parameters
271289

272290
~TOFResoParamsV3() = default;
@@ -372,6 +390,20 @@ class TOFResoParamsV3 : public o2::tof::Parameters<13>
372390
return gNegEtaTimeCorr->Eval(eta);
373391
}
374392

393+
void printTimeShiftParameters() const
394+
{
395+
if (gPosEtaTimeCorr) {
396+
LOG(info) << "Using a time shift for Pos " << gPosEtaTimeCorr->GetName() << " " << gPosEtaTimeCorr->GetTitle() << " value at 0: " << gPosEtaTimeCorr->Eval(0) << " vs correction " << getTimeShift(0, 1);
397+
} else {
398+
LOG(info) << "Using no time shift for Pos vs correction " << getTimeShift(0, 1);
399+
}
400+
if (gNegEtaTimeCorr) {
401+
LOG(info) << "Using a time shift for Neg " << gNegEtaTimeCorr->GetName() << " " << gNegEtaTimeCorr->GetTitle() << " value at 0: " << gNegEtaTimeCorr->Eval(0) << " vs correction " << getTimeShift(0, -1);
402+
} else {
403+
LOG(info) << "Using no time shift for Neg vs correction " << getTimeShift(0, -1);
404+
}
405+
}
406+
375407
void setResolutionParametrization(std::unordered_map<std::string, float> const& pars)
376408
{
377409
static constexpr std::array<const char*, 9> particleNames = {"El", "Mu", "Pi", "Ka", "Pr", "De", "Tr", "He", "Al"};
@@ -382,6 +414,9 @@ class TOFResoParamsV3 : public o2::tof::Parameters<13>
382414
if (key.find(baseOpt) == 0) {
383415
// Remove from the key the baseOpt
384416
const std::string fun = key.substr(baseOpt.size());
417+
if (mResolution[i]) {
418+
delete mResolution[i];
419+
}
385420
mResolution[i] = new TF2(baseOpt.c_str(), fun.c_str(), 0., 20, -1, 1.);
386421
LOG(info) << "Set the resolution function for " << particleNames[i] << " with formula " << mResolution[i]->GetFormula()->GetExpFormula();
387422
break;
@@ -404,6 +439,26 @@ class TOFResoParamsV3 : public o2::tof::Parameters<13>
404439
return mResolution[pid]->Eval(p, eta);
405440
}
406441

442+
void printResolution() const
443+
{
444+
static constexpr std::array<const char*, 9> particleNames = {"El", "Mu", "Pi", "Ka", "Pr", "De", "Tr", "He", "Al"};
445+
// Print a summary
446+
for (int i = 0; i < 9; ++i) {
447+
if (!mResolution[i]) {
448+
LOG(info) << "Resolution function for " << particleNames[i] << " is not defined yet";
449+
continue;
450+
}
451+
LOG(info) << "Resolution function for " << particleNames[i] << " is " << mResolution[i]->GetName() << " with formula " << mResolution[i]->GetFormula()->GetExpFormula();
452+
}
453+
}
454+
void printFullConfig() const
455+
{
456+
print();
457+
printMomentumChargeShiftParameters();
458+
printTimeShiftParameters();
459+
printResolution();
460+
}
461+
407462
private:
408463
// Charge calibration
409464
int mEtaN = 0; // Number of eta bins, 0 means no correction

Common/Core/RecoDecay.h

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -208,18 +208,23 @@ struct RecoDecay {
208208
/// Constrains angle to be within a range.
209209
/// \note Inspired by TVector2::Phi_0_2pi in ROOT.
210210
/// \param angle angle
211-
/// \param min minimum of the range
212-
/// \return value within [min, min + 2π).
211+
/// \param minimum minimum of the range
212+
/// \param harmonic harmonic number
213+
/// \return value of angle within [minimum, minimum + 2π / harmonic).
213214
template <typename T, typename U = float>
214-
static T constrainAngle(T angle, U min = 0.)
215+
static T constrainAngle(T angle, U minimum = 0.0F, unsigned int harmonic = 1U)
215216
{
216-
while (angle < min) {
217-
angle += o2::constants::math::TwoPI;
217+
auto period = o2::constants::math::TwoPI;
218+
if (harmonic != 1U) {
219+
period /= harmonic;
218220
}
219-
while (angle >= min + o2::constants::math::TwoPI) {
220-
angle -= o2::constants::math::TwoPI;
221+
while (angle < minimum) {
222+
angle += period;
221223
}
222-
return (T)angle;
224+
while (angle >= minimum + period) {
225+
angle -= period;
226+
}
227+
return angle;
223228
}
224229

225230
/// Calculates cosine of pointing angle.
@@ -1072,7 +1077,7 @@ struct RecoDecay {
10721077
auto mother = particlesMC.rawIteratorAt(particleMother.mothersIds().front() - particlesMC.offset());
10731078
auto PDGParticleIMother = std::abs(mother.pdgCode()); // PDG code of the mother
10741079
if (PDGParticleIMother < 9 || (PDGParticleIMother > 20 && PDGParticleIMother < 38)) {
1075-
auto PDGPaticle = std::abs(particleMother.pdgCode());
1080+
// auto PDGPaticle = std::abs(particleMother.pdgCode());
10761081
if (
10771082
(PDGParticleIMother / 100 == 5 || // b mesons
10781083
PDGParticleIMother / 1000 == 5) // b baryons
@@ -1095,7 +1100,7 @@ struct RecoDecay {
10951100
}
10961101
auto mother = particlesMC.rawIteratorAt(iMother - particlesMC.offset());
10971102
// Check status code
1098-
auto motherStatusCode = std::abs(mother.getGenStatusCode());
1103+
// auto motherStatusCode = std::abs(mother.getGenStatusCode());
10991104
auto PDGParticleIMother = std::abs(mother.pdgCode()); // PDG code of the mother
11001105
// Check mother's PDG code.
11011106
// printf("getMother: ");

0 commit comments

Comments
 (0)