Skip to content

Commit c4e4e64

Browse files
authored
Merge branch 'AliceO2Group:master' into at2024
2 parents 81790c5 + a5e761a commit c4e4e64

File tree

65 files changed

+4945
-1946
lines changed

Some content is hidden

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

65 files changed

+4945
-1946
lines changed

Common/LegacyDataQA/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,9 @@ o2physics_add_dpl_workflow(otfv0qa
1717
o2physics_add_dpl_workflow(centqa
1818
SOURCES centqa.cxx
1919
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
20+
COMPONENT_NAME Analysis)
21+
22+
o2physics_add_dpl_workflow(tpcpidqa
23+
SOURCES tpcpidqa.cxx
24+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
2025
COMPONENT_NAME Analysis)

Common/LegacyDataQA/otfv0qa.cxx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,6 @@
88
// In applying this license CERN does not waive the privileges and immunities
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
11-
//
12-
// This code calculates output histograms for centrality calibration
13-
// as well as vertex-Z dependencies of raw variables (either for calibration
14-
// of vtx-Z dependencies or for the calibration of those).
15-
//
16-
// This task is not strictly necessary in a typical analysis workflow,
17-
// except for centrality calibration! The necessary task is the multiplicity
18-
// tables.
19-
//
20-
// Comments, suggestions, questions? Please write to:
21-
// - victor.gonzalez@cern.ch
22-
// - david.dobrigkeit.chinellato@cern.ch
23-
//
2411

2512
#include "Framework/runDataProcessing.h"
2613
#include "Framework/AnalysisTask.h"
@@ -39,20 +26,33 @@ struct OTFV0Qa {
3926
// Raw multiplicities
4027
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
4128

29+
Configurable<float> maxGammaMassForXYplot{"maxGammaMassForXYplot", 0.1f, "Max photon mass for XY plot"};
30+
31+
ConfigurableAxis axisNCandidates{"axisNCandidates", {500, 0, 500}, "Number of OTF v0s"};
32+
ConfigurableAxis axisPosition{"axisPosition", {1000, -100, 100}, "position (cm)"};
33+
ConfigurableAxis axisMass{"axisMass", {100, 0.0f, 1.0f}, "Mass (GeV/c2)"};
34+
4235
void init(InitContext&)
4336
{
44-
const AxisSpec axisEvent{10, 0, 10, "Event counter"};
45-
const AxisSpec axisNCandidates{500, 0, 500, "Number of OTF v0s"};
37+
const AxisSpec axisPVz{30, -15, 15, "Primary vertex Z (cm)"};
4638

4739
// Base histograms
48-
histos.add("hEventCounter", "Event counter", kTH1F, {axisEvent});
40+
histos.add("hPrimaryVertexZ", "Event counter", kTH1F, {axisPVz});
4941
histos.add("hCandidates", "Number of OTF V0s", kTH1F, {axisNCandidates});
42+
histos.add("hGammaMass", "mass distribution", kTH1F, {axisMass});
43+
histos.add("h2dPosition", "xy positions", kTH2F, {axisPosition, axisPosition});
5044
}
5145

52-
void process(aod::Collision const&, aod::Run2OTFV0s const& v0s)
46+
void process(aod::Collision const& collision, aod::Run2OTFV0s const& v0s)
5347
{
54-
histos.fill(HIST("hEventCounter"), 0.5);
48+
histos.fill(HIST("hPrimaryVertexZ"), collision.posZ());
5549
histos.fill(HIST("hCandidates"), v0s.size());
50+
for (auto const& v0 : v0s) {
51+
histos.fill(HIST("hGammaMass"), v0.mass());
52+
if (v0.mass() < maxGammaMassForXYplot) {
53+
histos.fill(HIST("h2dPosition"), v0.x(), v0.y());
54+
}
55+
}
5656
}
5757
};
5858

Common/LegacyDataQA/tpcpidqa.cxx

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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+
// This task converts tiny PID tables into full PID tables.
13+
// It is meant to be used with Run 2 converted data to maintain
14+
// full compatibility with any task that may subscribe to the Full
15+
// tables (at the cost of some memory consumption).
16+
// It is also able to produce very simple QA plots on the stored
17+
// quantities (optionally disabled for simplicity)
18+
//
19+
// Warning: expected resolution is NOT provided.
20+
21+
#include "Framework/runDataProcessing.h"
22+
#include "Framework/AnalysisTask.h"
23+
#include "Framework/AnalysisDataModel.h"
24+
#include "Common/DataModel/PIDResponse.h"
25+
#include "TableHelper.h"
26+
27+
using namespace o2;
28+
using namespace o2::framework;
29+
30+
using tinyPidTracks = soa::Join<aod::Tracks, aod::pidTPCFullEl, aod::pidTPCFullMu, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr, aod::pidTPCFullDe, aod::pidTPCFullTr, aod::pidTPCFullHe, aod::pidTPCFullAl>;
31+
32+
static constexpr int nParameters = 1;
33+
static const std::vector<std::string> tableNames{"Electron", // 0
34+
"Muon", // 1
35+
"Pion", // 2
36+
"Kaon", // 3
37+
"Proton", // 4
38+
"Deuteron", // 5
39+
"Triton", // 6
40+
"Helium", // 7
41+
"Alpha"}; // 8
42+
static const std::vector<std::string> parameterNames{"enable"};
43+
static const int defaultParameters[9][nParameters]{{0}, {0}, {1}, {1}, {1}, {0}, {0}, {0}, {0}};
44+
45+
static constexpr int kPidEl = 0;
46+
static constexpr int kPidMu = 1;
47+
static constexpr int kPidPi = 2;
48+
static constexpr int kPidKa = 3;
49+
static constexpr int kPidPr = 4;
50+
static constexpr int kPidDe = 5;
51+
static constexpr int kPidTr = 6;
52+
static constexpr int kPidHe = 7;
53+
static constexpr int kPidAl = 8;
54+
static constexpr int nTables = 9;
55+
56+
struct TpcPidQa {
57+
Configurable<LabeledArray<int>> enabledTables{"enabledTables",
58+
{defaultParameters[0], nTables, nParameters, tableNames, parameterNames},
59+
"Produce QA for this species: 0 - no, 1 - yes"};
60+
std::vector<int> mEnabledTables; // Vector of enabled tables
61+
62+
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
63+
64+
ConfigurableAxis axisMomentum{"axisMomentum", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "momentum"};
65+
66+
ConfigurableAxis axisNSigma{"axisNSigma", {48, -6.0f, 6.0f}, "axisNSigma"};
67+
68+
void init(InitContext&)
69+
{
70+
mEnabledTables.resize(9, 0);
71+
72+
for (int i = 0; i < nTables; i++) {
73+
int f = enabledTables->get(tableNames[i].c_str(), "enable");
74+
if (f == 1) {
75+
mEnabledTables[i] = 1;
76+
histos.add(fmt::format("hNSigmaVsPTot{}", tableNames[i]).c_str(), "", kTH2F, {axisMomentum, axisNSigma});
77+
}
78+
}
79+
}
80+
81+
void process(tinyPidTracks const& tracks)
82+
{
83+
for (const auto& track : tracks) {
84+
if (mEnabledTables[kPidEl]) {
85+
histos.fill(HIST("hNSigmaVsPTotElectron"), track.p(), track.tpcNSigmaEl());
86+
}
87+
if (mEnabledTables[kPidMu]) {
88+
histos.fill(HIST("hNSigmaVsPTotMuon"), track.p(), track.tpcNSigmaMu());
89+
}
90+
if (mEnabledTables[kPidPi]) {
91+
histos.fill(HIST("hNSigmaVsPTotPion"), track.p(), track.tpcNSigmaPi());
92+
}
93+
if (mEnabledTables[kPidKa]) {
94+
histos.fill(HIST("hNSigmaVsPTotKaon"), track.p(), track.tpcNSigmaKa());
95+
}
96+
if (mEnabledTables[kPidPr]) {
97+
histos.fill(HIST("hNSigmaVsPTotProton"), track.p(), track.tpcNSigmaPr());
98+
}
99+
if (mEnabledTables[kPidDe]) {
100+
histos.fill(HIST("hNSigmaVsPTotDeuteron"), track.p(), track.tpcNSigmaDe());
101+
}
102+
if (mEnabledTables[kPidTr]) {
103+
histos.fill(HIST("hNSigmaVsPTotTriton"), track.p(), track.tpcNSigmaTr());
104+
}
105+
if (mEnabledTables[kPidHe]) {
106+
histos.fill(HIST("hNSigmaVsPTotHelium"), track.p(), track.tpcNSigmaHe());
107+
}
108+
if (mEnabledTables[kPidAl]) {
109+
histos.fill(HIST("hNSigmaVsPTotAlpha"), track.p(), track.tpcNSigmaAl());
110+
}
111+
}
112+
}
113+
};
114+
115+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
116+
{
117+
return WorkflowSpec{
118+
adaptAnalysisTask<TpcPidQa>(cfgc)};
119+
}

Common/TableProducer/Converters/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,7 @@ o2physics_add_dpl_workflow(run2-tracks-extra-converter
104104
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
105105
COMPONENT_NAME Analysis)
106106

107+
o2physics_add_dpl_workflow(run2-tiny-to-full-pid
108+
SOURCES run2TinyToFullPID.cxx
109+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
110+
COMPONENT_NAME Analysis)
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
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+
// This task converts tiny PID tables into full PID tables.
13+
// It is meant to be used with Run 2 converted data to maintain
14+
// full compatibility with any task that may subscribe to the Full
15+
// tables (at the cost of some memory consumption).
16+
// It is also able to produce very simple QA plots on the stored
17+
// quantities (optionally disabled for simplicity)
18+
//
19+
// Warning: expected resolution is NOT provided.
20+
21+
#include "Framework/runDataProcessing.h"
22+
#include "Framework/AnalysisTask.h"
23+
#include "Framework/AnalysisDataModel.h"
24+
#include "Common/DataModel/PIDResponse.h"
25+
#include "TableHelper.h"
26+
27+
using namespace o2;
28+
using namespace o2::framework;
29+
30+
using tinyPidTracks = soa::Join<aod::Tracks, aod::pidTPCEl, aod::pidTPCMu, aod::pidTPCPi, aod::pidTPCKa, aod::pidTPCPr, aod::pidTPCDe, aod::pidTPCTr, aod::pidTPCHe, aod::pidTPCAl>;
31+
32+
static constexpr int kPidEl = 0;
33+
static constexpr int kPidMu = 1;
34+
static constexpr int kPidPi = 2;
35+
static constexpr int kPidKa = 3;
36+
static constexpr int kPidPr = 4;
37+
static constexpr int kPidDe = 5;
38+
static constexpr int kPidTr = 6;
39+
static constexpr int kPidHe = 7;
40+
static constexpr int kPidAl = 8;
41+
static constexpr int nTables = 9;
42+
43+
static constexpr int nParameters = 1;
44+
static const std::vector<std::string> tableNames{"pidTPCFullEl", // 0
45+
"pidTPCFullMu", // 1
46+
"pidTPCFullPi", // 2
47+
"pidTPCFullKa", // 3
48+
"pidTPCFullPr", // 4
49+
"pidTPCFullDe", // 5
50+
"pidTPCFullTr", // 6
51+
"pidTPCFullHe", // 7
52+
"pidTPCFullAl"}; // 8
53+
static const std::vector<std::string> parameterNames{"enable"};
54+
static const int defaultParameters[nTables][nParameters]{{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}};
55+
56+
struct Run2TinyToFullPID {
57+
Produces<aod::pidTPCFullEl> pidTPCFullEl;
58+
Produces<aod::pidTPCFullMu> pidTPCFullMu;
59+
Produces<aod::pidTPCFullPi> pidTPCFullPi;
60+
Produces<aod::pidTPCFullKa> pidTPCFullKa;
61+
Produces<aod::pidTPCFullPr> pidTPCFullPr;
62+
Produces<aod::pidTPCFullDe> pidTPCFullDe;
63+
Produces<aod::pidTPCFullTr> pidTPCFullTr;
64+
Produces<aod::pidTPCFullHe> pidTPCFullHe;
65+
Produces<aod::pidTPCFullAl> pidTPCFullAl;
66+
67+
Configurable<LabeledArray<int>> enabledTables{"enabledTables",
68+
{defaultParameters[0], nTables, nParameters, tableNames, parameterNames},
69+
"Produce full PID tables depending on needs. Autodetect is -1, Force no is 0 and force yes is 1."};
70+
71+
std::vector<int> mEnabledTables; // Vector of enabled tables
72+
73+
void init(InitContext& context)
74+
{
75+
for (int i = 0; i < nTables; i++) {
76+
LOGF(info, "test %i", i);
77+
int f = enabledTables->get(tableNames[i].c_str(), "enable");
78+
enableFlagIfTableRequired(context, tableNames[i], f);
79+
if (f == 1) {
80+
mEnabledTables.push_back(i);
81+
}
82+
}
83+
}
84+
85+
void process(tinyPidTracks const& tracks)
86+
{
87+
// reserve memory
88+
for (auto i : mEnabledTables) {
89+
switch (i) {
90+
case kPidEl:
91+
pidTPCFullEl.reserve(tracks.size());
92+
break;
93+
case kPidMu:
94+
pidTPCFullMu.reserve(tracks.size());
95+
break;
96+
case kPidPi:
97+
pidTPCFullPi.reserve(tracks.size());
98+
break;
99+
case kPidKa:
100+
pidTPCFullKa.reserve(tracks.size());
101+
break;
102+
case kPidPr:
103+
pidTPCFullPr.reserve(tracks.size());
104+
break;
105+
case kPidDe:
106+
pidTPCFullDe.reserve(tracks.size());
107+
break;
108+
case kPidTr:
109+
pidTPCFullTr.reserve(tracks.size());
110+
break;
111+
case kPidHe:
112+
pidTPCFullHe.reserve(tracks.size());
113+
break;
114+
case kPidAl:
115+
pidTPCFullAl.reserve(tracks.size());
116+
break;
117+
default:
118+
LOG(fatal) << "Unknown table requested: " << i;
119+
break;
120+
}
121+
}
122+
123+
for (const auto& track : tracks) {
124+
for (auto i : mEnabledTables) {
125+
switch (i) {
126+
case kPidEl:
127+
pidTPCFullEl(0.0f, track.tpcNSigmaEl());
128+
break;
129+
case kPidMu:
130+
pidTPCFullMu(0.0f, track.tpcNSigmaMu());
131+
break;
132+
case kPidPi:
133+
pidTPCFullPi(0.0f, track.tpcNSigmaPi());
134+
break;
135+
case kPidKa:
136+
pidTPCFullKa(0.0f, track.tpcNSigmaKa());
137+
break;
138+
case kPidPr:
139+
pidTPCFullPr(0.0f, track.tpcNSigmaPr());
140+
break;
141+
case kPidDe:
142+
pidTPCFullDe(0.0f, track.tpcNSigmaDe());
143+
break;
144+
case kPidTr:
145+
pidTPCFullTr(0.0f, track.tpcNSigmaTr());
146+
break;
147+
case kPidHe:
148+
pidTPCFullHe(0.0f, track.tpcNSigmaHe());
149+
break;
150+
case kPidAl:
151+
pidTPCFullAl(0.0f, track.tpcNSigmaAl());
152+
break;
153+
default:
154+
LOG(fatal) << "Unknown table requested: " << i;
155+
break;
156+
}
157+
}
158+
}
159+
}
160+
};
161+
162+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
163+
{
164+
return WorkflowSpec{
165+
adaptAnalysisTask<Run2TinyToFullPID>(cfgc)};
166+
}

Common/TableProducer/multiplicityTable.cxx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ struct MultiplicityTable {
134134
TProfile* hVtxZFT0A;
135135
TProfile* hVtxZFT0C;
136136
TProfile* hVtxZFDDA;
137+
137138
TProfile* hVtxZFDDC;
138139
TProfile* hVtxZNTracks;
139140
std::vector<int> mEnabledTables; // Vector of enabled tables
@@ -160,6 +161,19 @@ struct MultiplicityTable {
160161
if (doprocessRun2 == true && doprocessRun3 == true) {
161162
LOGF(fatal, "Cannot enable processRun2 and processRun3 at the same time. Please choose one.");
162163
}
164+
165+
// exploratory
166+
auto& workflows = context.services().get<o2::framework::RunningWorkflowInfo const>();
167+
for (auto const& device : workflows.devices) {
168+
for (auto const& input : device.inputs) {
169+
// input.print();
170+
TString devNam = device.name.c_str();
171+
TString inBin = input.matcher.binding.c_str();
172+
// TString subSpec = input.matcher.subspec.c_str();
173+
LOGF(info, Form("device %s input binding %s subspec", devNam.Data(), inBin.Data()));
174+
}
175+
}
176+
163177
bool tEnabled[nTables] = {false};
164178
for (int i = 0; i < nTables; i++) {
165179
int f = enabledTables->get(tableNames[i].c_str(), "Enable");

0 commit comments

Comments
 (0)