Skip to content

Commit 994266c

Browse files
ddobrigkalibuild
andauthored
[Common] Add synthetic flow MC QC task (AliceO2Group#9349)
Co-authored-by: ALICE Builder <[email protected]>
1 parent df16c73 commit 994266c

File tree

2 files changed

+231
-0
lines changed

2 files changed

+231
-0
lines changed

Common/Tasks/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,9 @@ o2physics_add_dpl_workflow(qvectors-correction
8282
o2physics_add_dpl_workflow(centrality-study
8383
SOURCES centralityStudy.cxx
8484
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
85+
COMPONENT_NAME Analysis)
86+
87+
o2physics_add_dpl_workflow(flow-test
88+
SOURCES flowTest.cxx
89+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
8590
COMPONENT_NAME Analysis)

Common/Tasks/flowTest.cxx

Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
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+
// flow test for QC of synthetic flow exercise
13+
// cross-PWG effort in tracking studies
14+
// includes basic tracking, V0s and Cascades
15+
16+
#include "Framework/AnalysisDataModel.h"
17+
#include "Framework/AnalysisTask.h"
18+
#include "Framework/HistogramRegistry.h"
19+
#include "Common/DataModel/TrackSelectionTables.h"
20+
#include "Common/Core/TrackSelection.h"
21+
#include "Common/Core/TrackSelectionDefaults.h"
22+
#include "ReconstructionDataFormats/Track.h"
23+
#include "Common/Core/trackUtilities.h"
24+
#include "CCDB/BasicCCDBManager.h"
25+
#include "DataFormatsParameters/GRPObject.h"
26+
#include "DataFormatsParameters/GRPMagField.h"
27+
#include "PWGLF/DataModel/LFStrangenessTables.h"
28+
29+
#include "PWGMM/Mult/DataModel/Index.h" // for Particles2Tracks table
30+
31+
using namespace o2;
32+
using namespace o2::framework;
33+
using namespace o2::framework::expressions;
34+
35+
#include "Framework/runDataProcessing.h"
36+
37+
struct flowTest {
38+
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
39+
40+
Configurable<float> minB{"minB", 0.0f, "min impact parameter"};
41+
Configurable<float> maxB{"maxB", 20.0f, "max impact parameter"};
42+
43+
ConfigurableAxis axisB{"axisB", {100, 0.0f, 20.0f}, ""};
44+
ConfigurableAxis axisPhi{"axisPhi", {100, 0.0f, 2.0f * TMath::Pi()}, ""};
45+
46+
ConfigurableAxis axisPt{"axisPt", {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}, "pt axis"};
47+
48+
void init(InitContext&)
49+
{
50+
// pT histograms
51+
histos.add<TH1>("hImpactParameter", "hImpactParameter", HistType::kTH1D, {axisB});
52+
histos.add<TH1>("hEventPlaneAngle", "hEventPlaneAngle", HistType::kTH1D, {axisPhi});
53+
histos.add<TH2>("hPtVsPhiGenerated", "hPtVsPhiGenerated", HistType::kTH2D, {axisPhi, axisPt});
54+
histos.add<TH2>("hPtVsPhiGlobal", "hPtVsPhiGlobal", HistType::kTH2D, {axisPhi, axisPt});
55+
histos.add<TH3>("hBVsPtVsPhiGenerated", "hBVsPtVsPhiGenerated", HistType::kTH3D, {axisB, axisPhi, axisPt});
56+
histos.add<TH3>("hBVsPtVsPhiGlobal", "hBVsPtVsPhiGlobal", HistType::kTH3D, {axisB, axisPhi, axisPt});
57+
histos.add<TH3>("hBVsPtVsPhiAny", "hBVsPtVsPhiAny", HistType::kTH3D, {axisB, axisPhi, axisPt});
58+
histos.add<TH3>("hBVsPtVsPhiTPCTrack", "hBVsPtVsPhiTPCTrack", HistType::kTH3D, {axisB, axisPhi, axisPt});
59+
histos.add<TH3>("hBVsPtVsPhiITSTrack", "hBVsPtVsPhiITSTrack", HistType::kTH3D, {axisB, axisPhi, axisPt});
60+
histos.add<TH3>("hBVsPtVsPhiITSABTrack", "hBVsPtVsPhiITSABTrack", HistType::kTH3D, {axisB, axisPhi, axisPt});
61+
62+
histos.add<TH3>("hBVsPtVsPhiGeneratedK0Short", "hBVsPtVsPhiGeneratedK0Short", HistType::kTH3D, {axisB, axisPhi, axisPt});
63+
histos.add<TH3>("hBVsPtVsPhiGlobalK0Short", "hBVsPtVsPhiGlobalK0Short", HistType::kTH3D, {axisB, axisPhi, axisPt});
64+
histos.add<TH3>("hBVsPtVsPhiGeneratedLambda", "hBVsPtVsPhiGeneratedLambda", HistType::kTH3D, {axisB, axisPhi, axisPt});
65+
histos.add<TH3>("hBVsPtVsPhiGlobalLambda", "hBVsPtVsPhiGlobalLambda", HistType::kTH3D, {axisB, axisPhi, axisPt});
66+
67+
histos.add<TH3>("hBVsPtVsPhiGeneratedXi", "hBVsPtVsPhiGeneratedXi", HistType::kTH3D, {axisB, axisPhi, axisPt});
68+
histos.add<TH3>("hBVsPtVsPhiGlobalXi", "hBVsPtVsPhiGlobalXi", HistType::kTH3D, {axisB, axisPhi, axisPt});
69+
histos.add<TH3>("hBVsPtVsPhiGeneratedOmega", "hBVsPtVsPhiGeneratedOmega", HistType::kTH3D, {axisB, axisPhi, axisPt});
70+
histos.add<TH3>("hBVsPtVsPhiGlobalOmega", "hBVsPtVsPhiGlobalOmega", HistType::kTH3D, {axisB, axisPhi, axisPt});
71+
}
72+
73+
using recoTracks = soa::Join<aod::TracksIU, aod::TracksExtra>;
74+
75+
void process(aod::McCollision const& mcCollision, soa::Join<aod::McParticles, aod::ParticlesToTracks> const& mcParticles, recoTracks const&)
76+
{
77+
78+
float imp = mcCollision.impactParameter();
79+
float evPhi = mcCollision.eventPlaneAngle();
80+
if (evPhi < 0)
81+
evPhi += 2. * TMath::Pi();
82+
83+
if (imp > minB && imp < maxB) {
84+
// event within range
85+
histos.fill(HIST("hImpactParameter"), imp);
86+
histos.fill(HIST("hEventPlaneAngle"), evPhi);
87+
88+
for (auto const& mcParticle : mcParticles) {
89+
// focus on bulk: e, mu, pi, k, p
90+
int pdgCode = TMath::Abs(mcParticle.pdgCode());
91+
if (pdgCode != 11 && pdgCode != 13 && pdgCode != 211 && pdgCode != 321 && pdgCode != 2212)
92+
continue;
93+
94+
if (!mcParticle.isPhysicalPrimary())
95+
continue;
96+
if (TMath::Abs(mcParticle.eta()) > 0.8) // main acceptance
97+
continue;
98+
99+
float deltaPhi = mcParticle.phi() - mcCollision.eventPlaneAngle();
100+
if (deltaPhi < 0)
101+
deltaPhi += 2. * TMath::Pi();
102+
if (deltaPhi > 2. * TMath::Pi())
103+
deltaPhi -= 2. * TMath::Pi();
104+
histos.fill(HIST("hPtVsPhiGenerated"), deltaPhi, mcParticle.pt());
105+
histos.fill(HIST("hBVsPtVsPhiGenerated"), imp, deltaPhi, mcParticle.pt());
106+
107+
bool validGlobal = false;
108+
bool validTrack = false;
109+
bool validTPCTrack = false;
110+
bool validITSTrack = false;
111+
bool validITSABTrack = false;
112+
if (mcParticle.has_tracks()) {
113+
auto const& tracks = mcParticle.tracks_as<recoTracks>();
114+
for (auto const& track : tracks) {
115+
if (track.hasTPC() && track.hasITS()) {
116+
validGlobal = true;
117+
}
118+
if (track.hasTPC() || track.hasITS()) {
119+
validTrack = true;
120+
}
121+
if (track.hasTPC()) {
122+
validTPCTrack = true;
123+
}
124+
if (track.hasITS() && track.itsChi2NCl() > -1e-6) {
125+
validITSTrack = true;
126+
}
127+
if (track.hasITS() && track.itsChi2NCl() < -1e-6) {
128+
validITSABTrack = true;
129+
}
130+
}
131+
}
132+
133+
// if valid global, fill
134+
if (validGlobal) {
135+
histos.fill(HIST("hPtVsPhiGlobal"), deltaPhi, mcParticle.pt());
136+
histos.fill(HIST("hBVsPtVsPhiGlobal"), imp, deltaPhi, mcParticle.pt());
137+
}
138+
// if any track present, fill
139+
if (validTrack)
140+
histos.fill(HIST("hBVsPtVsPhiAny"), imp, deltaPhi, mcParticle.pt());
141+
if (validTPCTrack)
142+
histos.fill(HIST("hBVsPtVsPhiTPCTrack"), imp, deltaPhi, mcParticle.pt());
143+
if (validITSTrack)
144+
histos.fill(HIST("hBVsPtVsPhiITSTrack"), imp, deltaPhi, mcParticle.pt());
145+
if (validITSABTrack)
146+
histos.fill(HIST("hBVsPtVsPhiITSABTrack"), imp, deltaPhi, mcParticle.pt());
147+
}
148+
}
149+
}
150+
151+
using LabeledCascades = soa::Join<aod::CascDataExt, aod::McCascLabels>;
152+
153+
void processCascade(aod::McParticle const& mcParticle, soa::SmallGroups<LabeledCascades> const& cascades, recoTracks const&, aod::McCollisions const&)
154+
{
155+
auto mcCollision = mcParticle.mcCollision();
156+
float imp = mcCollision.impactParameter();
157+
158+
int pdgCode = TMath::Abs(mcParticle.pdgCode());
159+
if (pdgCode != 3312 && pdgCode != 3334)
160+
return;
161+
162+
if (!mcParticle.isPhysicalPrimary())
163+
return;
164+
if (TMath::Abs(mcParticle.eta()) > 0.8)
165+
return;
166+
167+
float deltaPhi = mcParticle.phi() - mcCollision.eventPlaneAngle();
168+
if (deltaPhi < 0)
169+
deltaPhi += 2. * TMath::Pi();
170+
if (deltaPhi > 2. * TMath::Pi())
171+
deltaPhi -= 2. * TMath::Pi();
172+
if (pdgCode == 3312)
173+
histos.fill(HIST("hBVsPtVsPhiGeneratedXi"), imp, deltaPhi, mcParticle.pt());
174+
if (pdgCode == 3334)
175+
histos.fill(HIST("hBVsPtVsPhiGeneratedOmega"), imp, deltaPhi, mcParticle.pt());
176+
177+
if (cascades.size() > 0) {
178+
if (pdgCode == 3312)
179+
histos.fill(HIST("hBVsPtVsPhiGlobalXi"), imp, deltaPhi, mcParticle.pt());
180+
if (pdgCode == 3334)
181+
histos.fill(HIST("hBVsPtVsPhiGlobalOmega"), imp, deltaPhi, mcParticle.pt());
182+
}
183+
}
184+
PROCESS_SWITCH(flowTest, processCascade, "Process cascades", true);
185+
186+
using LabeledV0s = soa::Join<aod::V0Datas, aod::McV0Labels>;
187+
188+
void processV0s(aod::McParticle const& mcParticle, soa::SmallGroups<LabeledV0s> const& v0s, recoTracks const&, aod::McCollisions const&)
189+
{
190+
auto mcCollision = mcParticle.mcCollision();
191+
float imp = mcCollision.impactParameter();
192+
193+
int pdgCode = TMath::Abs(mcParticle.pdgCode());
194+
if (pdgCode != 310 && pdgCode != 3122)
195+
return;
196+
197+
if (!mcParticle.isPhysicalPrimary())
198+
return;
199+
if (TMath::Abs(mcParticle.eta()) > 0.8)
200+
return;
201+
202+
float deltaPhi = mcParticle.phi() - mcCollision.eventPlaneAngle();
203+
if (deltaPhi < 0)
204+
deltaPhi += 2. * TMath::Pi();
205+
if (deltaPhi > 2. * TMath::Pi())
206+
deltaPhi -= 2. * TMath::Pi();
207+
if (pdgCode == 310)
208+
histos.fill(HIST("hBVsPtVsPhiGeneratedK0Short"), imp, deltaPhi, mcParticle.pt());
209+
if (pdgCode == 3122)
210+
histos.fill(HIST("hBVsPtVsPhiGeneratedLambda"), imp, deltaPhi, mcParticle.pt());
211+
212+
if (v0s.size() > 0) {
213+
if (pdgCode == 310)
214+
histos.fill(HIST("hBVsPtVsPhiGlobalK0Short"), imp, deltaPhi, mcParticle.pt());
215+
if (pdgCode == 3122)
216+
histos.fill(HIST("hBVsPtVsPhiGlobalLambda"), imp, deltaPhi, mcParticle.pt());
217+
}
218+
}
219+
PROCESS_SWITCH(flowTest, processV0s, "Process V0s", true);
220+
};
221+
222+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
223+
{
224+
return WorkflowSpec{
225+
adaptAnalysisTask<flowTest>(cfgc)};
226+
}

0 commit comments

Comments
 (0)