Skip to content

Commit 7ca039a

Browse files
authored
Merge branch 'AliceO2Group:master' into master
2 parents 144dfe4 + 0af789a commit 7ca039a

File tree

101 files changed

+8949
-3145
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+8949
-3145
lines changed

ALICE3/Tasks/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,10 @@ o2physics_add_dpl_workflow(alice3-efficiency
6868
SOURCES alice3Efficiency.cxx
6969
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
7070
COMPONENT_NAME Analysis)
71+
72+
o2physics_add_dpl_workflow(alice3-tracking-performance
73+
SOURCES alice3TrackingPerformance.cxx
74+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
75+
COMPONENT_NAME Analysis)
76+
77+
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
///
12+
/// \file alice3TrackingPerformance.cxx
13+
///
14+
/// \brief This task produces the tracking performance
15+
///
16+
/// \author Nicolò Jacazio, Universita del Piemonte Orientale (IT)
17+
/// \since May 27, 2025
18+
///
19+
20+
#include "Common/DataModel/TrackSelectionTables.h"
21+
22+
#include "Framework/AnalysisTask.h"
23+
#include "Framework/ConfigParamRegistry.h"
24+
#include "Framework/HistogramRegistry.h"
25+
#include "Framework/runDataProcessing.h"
26+
27+
#include <map>
28+
#include <vector>
29+
30+
using namespace o2;
31+
using namespace o2::framework;
32+
std::map<int, std::shared_ptr<TH2>> ptResolutionVsPt;
33+
std::map<int, std::shared_ptr<TH2>> invPtResolutionVsPt;
34+
std::map<int, std::shared_ptr<TH2>> dcaXyResolutionVsPt;
35+
std::map<int, std::shared_ptr<TH2>> dcaZResolutionVsPt;
36+
37+
struct alice3TrackingPerformance {
38+
Configurable<std::vector<int>> pdgCodes{"pdgCodes", {211}, "List of PDG codes to consider for efficiency calculation"};
39+
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
40+
Configurable<std::pair<float, float>> etaRange{"etaRange", {-5.f, 5.f}, "Eta range for efficiency calculation"};
41+
42+
void init(o2::framework::InitContext&)
43+
{
44+
const AxisSpec axisPt{100, 0, 10, "p_{T} (GeV/c)"};
45+
const AxisSpec axisPtDelta{100, -1, 1, "p_{T}^{gen} - p_{T}^{reco} (GeV/c)"};
46+
const AxisSpec axisInvPtDelta{100, -1, 1, "1./p_{T}^{gen} - 1./p_{T}^{reco} (GeV/c)^{-1}"};
47+
const AxisSpec axisDcaXy{100, -1, 1, "DCA_{xy} (cm)"};
48+
const AxisSpec axisDcaZ{100, -1, 1, "DCA_{z} (cm)"};
49+
for (auto pdg : pdgCodes.value) {
50+
ptResolutionVsPt[pdg] = histos.add<TH2>(Form("ptResolutionVsPt_%d", pdg), "", kTH2D, {axisPt, axisPtDelta});
51+
invPtResolutionVsPt[pdg] = histos.add<TH2>(Form("invPtResolutionVsPt_%d", pdg), "", kTH2D, {axisPt, axisInvPtDelta});
52+
dcaXyResolutionVsPt[pdg] = histos.add<TH2>(Form("dcaXyResolutionVsPt_%d", pdg), "", kTH2D, {axisPt, axisDcaXy});
53+
dcaZResolutionVsPt[pdg] = histos.add<TH2>(Form("dcaZResolutionVsPt_%d", pdg), "", kTH2D, {axisPt, axisDcaZ});
54+
}
55+
}
56+
57+
void process(soa::Join<aod::Tracks, o2::aod::McTrackLabels, o2::aod::TracksDCA> const& tracks,
58+
aod::McParticles const&)
59+
{
60+
auto isParticleSelected = [&](const o2::aod::McParticle& p) {
61+
if (!p.isPhysicalPrimary()) {
62+
return false;
63+
}
64+
if (p.eta() < etaRange.value.first) {
65+
return false;
66+
}
67+
if (p.eta() > etaRange.value.second) {
68+
return false;
69+
}
70+
return true;
71+
};
72+
for (const auto& track : tracks) {
73+
if (!track.has_mcParticle()) {
74+
continue;
75+
}
76+
const auto& mcParticle = track.mcParticle();
77+
if (!isParticleSelected(mcParticle)) {
78+
continue;
79+
}
80+
if (ptResolutionVsPt.find(mcParticle.pdgCode()) == ptResolutionVsPt.end()) {
81+
continue;
82+
}
83+
ptResolutionVsPt[mcParticle.pdgCode()]->Fill(mcParticle.pt(), mcParticle.pt() - track.pt());
84+
invPtResolutionVsPt[mcParticle.pdgCode()]->Fill(mcParticle.pt(), 1.f / mcParticle.pt() - 1.f / track.pt());
85+
dcaXyResolutionVsPt[mcParticle.pdgCode()]->Fill(mcParticle.pt(), track.dcaXY());
86+
dcaZResolutionVsPt[mcParticle.pdgCode()]->Fill(mcParticle.pt(), track.dcaZ());
87+
}
88+
}
89+
};
90+
91+
WorkflowSpec defineDataProcessing(ConfigContext const& ctx)
92+
{
93+
return WorkflowSpec{adaptAnalysisTask<alice3TrackingPerformance>(ctx)};
94+
}

Common/DataModel/PIDResponseITS.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ struct ITSResponse {
8383
template <o2::track::PID::ID id>
8484
static float nSigmaITS(uint32_t itsClusterSizes, float momentum, float eta)
8585
{
86+
unsigned int charge = (id == o2::track::PID::Helium3 || id == o2::track::PID::Alpha) ? 2 : 1;
87+
momentum *= charge;
8688
const float exp = expSignal<id>(momentum);
8789
const float average = averageClusterSize(itsClusterSizes);
8890
const float coslInv = 1. / std::cosh(eta);
@@ -93,8 +95,7 @@ struct ITSResponse {
9395
template <o2::track::PID::ID id, typename T>
9496
static float nSigmaITS(const T& track)
9597
{
96-
unsigned int charge = (id == o2::track::PID::Helium3 || id == o2::track::PID::Alpha) ? 2 : 1;
97-
return nSigmaITS<id>(track.itsClusterSizes(), charge * track.p(), track.eta());
98+
return nSigmaITS<id>(track.itsClusterSizes(), track.p(), track.eta());
9899
}
99100

100101
static void setParameters(float p0, float p1, float p2,

Common/TableProducer/PID/pidITS.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ using namespace o2::framework;
4040
using namespace o2::framework::expressions;
4141
using namespace o2::track;
4242

43-
MetadataHelper metadataInfo;
43+
o2::common::core::MetadataHelper metadataInfo;
4444

4545
static constexpr int nCases = 2;
4646
static constexpr int nParameters = 12;

Common/TableProducer/PID/pidTOFMerge.cxx

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,38 @@
1515
/// \author Nicolò Jacazio nicolo.jacazio@cern.ch
1616
///
1717

18-
#include <utility>
19-
#include <vector>
20-
#include <string>
2118
#include <map>
19+
#include <string>
2220
#include <unordered_map>
21+
#include <utility>
22+
#include <vector>
2323

2424
// O2 includes
25-
#include "Framework/runDataProcessing.h"
25+
#include "CCDB/BasicCCDBManager.h"
2626
#include "Framework/AnalysisTask.h"
2727
#include "Framework/HistogramRegistry.h"
28+
#include "Framework/runDataProcessing.h"
2829
#include "ReconstructionDataFormats/Track.h"
29-
#include "CCDB/BasicCCDBManager.h"
3030
#include "TOFBase/EventTimeMaker.h"
3131

3232
// O2Physics includes
33-
#include "TableHelper.h"
34-
#include "MetadataHelper.h"
3533
#include "CollisionTypeHelper.h"
34+
#include "MetadataHelper.h"
35+
#include "TableHelper.h"
3636
#include "pidTOFBase.h"
37-
#include "Common/DataModel/TrackSelectionTables.h"
37+
3838
#include "Common/DataModel/EventSelection.h"
3939
#include "Common/DataModel/FT0Corrected.h"
4040
#include "Common/DataModel/Multiplicity.h"
41+
#include "Common/DataModel/TrackSelectionTables.h"
4142

4243
using namespace o2;
4344
using namespace o2::framework;
4445
using namespace o2::pid;
4546
using namespace o2::framework::expressions;
4647
using namespace o2::track;
4748

48-
MetadataHelper metadataInfo;
49+
o2::common::core::MetadataHelper metadataInfo;
4950

5051
// Input data types
5152
using Run3Trks = o2::soa::Join<aod::TracksIU, aod::TracksExtra>;
@@ -924,7 +925,7 @@ struct tofPidMerge {
924925
doprocessRun2.value = false;
925926
} else {
926927
if (mTOFCalibConfig.autoSetProcessFunctions()) {
927-
LOG(info) << "Autodetecting process functions for mass and beta";
928+
LOG(info) << "Autodetecting process functions";
928929
if (metadataInfo.isFullyDefined()) {
929930
if (metadataInfo.isRun3()) {
930931
doprocessRun3.value = true;
@@ -972,17 +973,24 @@ struct tofPidMerge {
972973
doprocessRun2BetaM.value = false;
973974
doprocessRun3BetaM.value = false;
974975
} else {
976+
LOG(info) << "Table for TOF beta is " << (enableTableBeta ? "enabled" : "disabled");
977+
LOG(info) << "Table for TOF mass is " << (enableTableMass ? "enabled" : "disabled");
975978
if (mTOFCalibConfig.autoSetProcessFunctions()) {
976979
LOG(info) << "Autodetecting process functions for mass and beta";
977-
if (metadataInfo.isFullyDefined()) {
980+
if (metadataInfo.isInitialized()) {
978981
if (metadataInfo.isRun3()) {
979982
doprocessRun3BetaM.value = true;
980983
doprocessRun2BetaM.value = false;
981984
} else {
982985
doprocessRun2BetaM.value = true;
983986
doprocessRun3BetaM.value = false;
984987
}
988+
} else {
989+
metadataInfo.print();
990+
LOG(warning) << "Metadata is not defined, cannot autodetect process functions for mass and beta";
985991
}
992+
} else {
993+
LOG(info) << "Process functions for mass and beta are set manually";
986994
}
987995
if (doprocessRun2BetaM && doprocessRun3BetaM) {
988996
LOG(fatal) << "Both processRun2BetaM and processRun3BetaM are enabled. Pick one of the two";

Common/TableProducer/PID/pidTPC.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ using namespace o2::framework::expressions;
5555
using namespace o2::track;
5656
using namespace o2::ml;
5757

58-
MetadataHelper metadataInfo; // Metadata helper
58+
o2::common::core::MetadataHelper metadataInfo; // Metadata helper
5959

6060
void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
6161
{

Common/TableProducer/centralityTable.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
using namespace o2;
3939
using namespace o2::framework;
4040

41-
MetadataHelper metadataInfo; // Metadata helper
41+
o2::common::core::MetadataHelper metadataInfo; // Metadata helper
4242

4343
static constexpr int kCentRun2V0Ms = 0;
4444
static constexpr int kCentRun2V0As = 1;

Common/TableProducer/eventSelection.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ using namespace o2;
4747
using namespace o2::framework;
4848
using namespace o2::aod::evsel;
4949

50-
MetadataHelper metadataInfo; // Metadata helper
50+
o2::common::core::MetadataHelper metadataInfo; // Metadata helper
5151

5252
using BCsWithRun2InfosTimestampsAndMatches = soa::Join<aod::BCs, aod::Run2BCInfos, aod::Timestamps, aod::Run2MatchedToBCSparse>;
5353
using BCsWithRun3Matchings = soa::Join<aod::BCs, aod::Timestamps, aod::Run3MatchedToBCSparse>;

Common/TableProducer/eventSelectionService.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
using namespace o2;
4545
using namespace o2::framework;
4646

47-
MetadataHelper metadataInfo; // Metadata helper
47+
o2::common::core::MetadataHelper metadataInfo; // Metadata helper
4848

4949
using BCsWithRun2InfosAndMatches = soa::Join<aod::BCs, aod::Run2BCInfos, aod::Run2MatchedToBCSparse>;
5050
using BCsWithRun3Matchings = soa::Join<aod::BCs, aod::Run3MatchedToBCSparse>;

Common/TableProducer/multCentTable.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ using namespace o2;
4646
using namespace o2::framework;
4747
// using namespace o2::framework::expressions;
4848

49-
MetadataHelper metadataInfo; // Metadata helper
49+
o2::common::core::MetadataHelper metadataInfo; // Metadata helper
5050

5151
struct MultCentTable {
5252
o2::common::multiplicity::standardConfigurables opts;
@@ -75,7 +75,7 @@ struct MultCentTable {
7575
ccdb->setFatalWhenNull(false); // please never crash on your own, all exceptions captured (as they always should)
7676

7777
// task-specific
78-
module.init(opts, initContext);
78+
module.init(metadataInfo, opts, initContext);
7979
}
8080

8181
void processRun2(soa::Join<aod::Collisions, aod::Run2MatchedSparse> const& collisions,

0 commit comments

Comments
 (0)