Skip to content

Commit c95ba44

Browse files
Moving Ds task in D2H folder
1 parent 6353089 commit c95ba44

3 files changed

Lines changed: 230 additions & 5 deletions

File tree

PWGHF/D2H/Tasks/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
o2physics_add_dpl_workflow(task-ds
13+
SOURCES taskDs.cxx
14+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing
15+
COMPONENT_NAME Analysis)

PWGHF/D2H/Tasks/taskDs.cxx

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
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 taskDs.cxx
13+
/// \brief Ds± analysis task
14+
/// \note Extended from taskD0 and taskDplus
15+
///
16+
/// \author Stefano Politanò <stefano.politano@cern.ch>, Politecnico & INFN Torino
17+
18+
#include "Framework/AnalysisTask.h"
19+
#include "Framework/HistogramRegistry.h"
20+
#include "PWGHF/DataModel/HFSecondaryVertex.h"
21+
#include "PWGHF/DataModel/HFCandidateSelectionTables.h"
22+
23+
using namespace o2;
24+
using namespace o2::framework;
25+
using namespace o2::framework::expressions;
26+
using namespace o2::aod::hf_cand;
27+
using namespace o2::aod::hf_cand_prong3;
28+
29+
#include "Framework/runDataProcessing.h"
30+
31+
/// Ds± analysis task
32+
struct HfTaskDs {
33+
HistogramRegistry registry{
34+
"registry",
35+
{{"hPt", "3-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 100.}}}},
36+
{"hPtProng0", "3-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 100.}}}},
37+
{"hPtProng1", "3-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 100.}}}},
38+
{"hPtProng2", "3-prong candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 100.}}}},
39+
{"hCPARecSig", "3-prong candidates (matched);cosine of pointing angle;entries", {HistType::kTH1F, {{100, -1., 1.}}}},
40+
{"hCPARecBg", "3-prong candidates (unmatched);cosine of pointing angle;entries", {HistType::kTH1F, {{100, -1., 1.}}}},
41+
{"hEtaRecSig", "3-prong candidates (matched);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}},
42+
{"hEtaRecBg", "3-prong candidates (unmatched);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}},
43+
{"hEtaGen", "MC particles (matched);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}}}};
44+
45+
Configurable<int> selectionFlagDs{"selectionFlagDs", 7, "Selection Flag for Ds"};
46+
Configurable<double> cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"};
47+
Configurable<std::vector<double>> bins{"pTBins", std::vector<double>{hf_cuts_ds_tokkpi::pTBins_v}, "pT bin limits"};
48+
49+
void init(o2::framework::InitContext&)
50+
{
51+
auto vbins = (std::vector<double>)bins;
52+
registry.add("hMass", "3-prong candidates;inv. mass (K K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{350, 1.7, 2.05}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
53+
registry.add("hEta", "3-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
54+
registry.add("hCt", "3-prong candidates;proper lifetime (D_{s}^{#pm}) * #it{c} (cm);entries", {HistType::kTH2F, {{100, 0., 100}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
55+
registry.add("hDecayLength", "3-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
56+
registry.add("hDecayLengthXY", "3-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
57+
registry.add("hNormalisedDecayLengthXY", "3-prong candidates;norm. decay length xy;entries", {HistType::kTH2F, {{80, 0., 80.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
58+
registry.add("hCPA", "3-prong candidates;cos. pointing angle;entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
59+
registry.add("hCPAxy", "3-prong candidates;cos. pointing angle xy;entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
60+
registry.add("hImpactParameterXY", "3-prong candidates;impact parameter xy (cm);entries", {HistType::kTH2F, {{200, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
61+
registry.add("hMaxNormalisedDeltaIP", "3-prong candidates;norm. IP;entries", {HistType::kTH2F, {{200, -20., 20.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
62+
registry.add("hImpactParameterProngSqSum", "3-prong candidates;squared sum of prong imp. par. (cm^{2});entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
63+
registry.add("hDecayLengthError", "3-prong candidates;decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
64+
registry.add("hDecayLengthXYError", "3-prong candidates;decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
65+
registry.add("hImpactParameterError", "3-prong candidates;impact parameter error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
66+
registry.add("hd0Prong0", "3-prong candidates;prong 0 DCA to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
67+
registry.add("hd0Prong1", "3-prong candidates;prong 1 DCA to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
68+
registry.add("hd0Prong2", "3-prong candidates;prong 2 DCA to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
69+
registry.add("hPtRecSig", "3-prong candidates (matched);#it{p}_{T}^{rec.} (GeV/#it{c});entries", {HistType::kTH1F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}}});
70+
registry.add("hPtRecSigPrompt", "3-prong candidates (matched, prompt);#it{p}_{T}^{rec.} (GeV/#it{c});entries", {HistType::kTH1F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}}});
71+
registry.add("hPtRecSigNonPrompt", "3-prong candidates (matched, non-prompt);#it{p}_{T}^{rec.} (GeV/#it{c});entries", {HistType::kTH1F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}}});
72+
registry.add("hPtRecBg", "3-prong candidates (unmatched);#it{p}_{T}^{rec.} (GeV/#it{c});entries", {HistType::kTH1F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}}});
73+
registry.add("hPtGen", "MC particles (matched);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}}});
74+
registry.add("hPtGenSig", "MC particles (matched);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}}});
75+
registry.add("hPtGenPrompt", "MC particles (matched, prompt);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}}});
76+
registry.add("hPtGenNonPrompt", "MC particles (matched, non-prompt);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}}});
77+
registry.add("hPtvsYRecSigRecoPID", "3-prong candidates (RecoPID - matched);#it{p}_{T}^{rec.}; #it{y}", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}});
78+
registry.add("hPtvsYRecSigPromptRecoPID", "3-prong candidates (RecoPID - matched, prompt);#it{p}_{T}^{rec.}; #it{y}", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}});
79+
registry.add("hPtvsYRecSigNonPromptRecoPID", "3-prong candidates (RecoPID - matched, non-prompt);#it{p}_{T}^{rec.}; #it{y}", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}});
80+
registry.add("hPtvsYRecSigRecoTopol", "3-prong candidates (RecoTopol - matched);#it{p}_{T}^{rec.}; #it{y}", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}});
81+
registry.add("hPtvsYRecSigPromptRecoTopol", "3-prong candidates (RecoTopol - matched, prompt);#it{p}_{T}^{rec.}; #it{y}", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}});
82+
registry.add("hPtvsYRecSigNonPromptRecoTopol", "3-prong candidates (RecoTopol - matched, non-prompt);#it{p}_{T}^{rec.}; #it{y}", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}});
83+
registry.add("hPtvsYRecSigRecoSkim", "3-prong candidates (RecoSkim - matched);#it{p}_{T}^{rec.}; #it{y}", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}});
84+
registry.add("hPtvsYRecSigPromptRecoSkim", "3-prong candidates (RecoSkim - matched, prompt);#it{p}_{T}^{rec.}; #it{y}", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}});
85+
registry.add("hPtvsYRecSigNonPromptRecoSkim", "3-prong candidates (RecoSkim - matched, non-prompt);#it{p}_{T}^{rec.}; #it{y}", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}});
86+
registry.add("hPtvsYGen", "MC particles (matched);#it{p}_{T}^{gen.}; #it{y}", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}});
87+
registry.add("hPtvsYGenPrompt", "MC particles (matched, prompt);#it{p}_{T}^{gen.}; #it{y}", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}});
88+
registry.add("hPtvsYGenNonPrompt", "MC particles (matched, non-prompt);#it{p}_{T}^{gen.}; #it{y}", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}});
89+
}
90+
91+
Partition<soa::Join<aod::HfCandProng3, aod::HFSelDsToKKPiCandidate>> selectedDsCandidates = aod::hf_selcandidate_ds::isSelDsToKKPi >= selectionFlagDs || aod::hf_selcandidate_ds::isSelDsToPiKKPi >= selectionFlagDs;
92+
93+
void process(soa::Join<aod::HfCandProng3, aod::HFSelDsToKKPiCandidate> const& candidates)
94+
{
95+
for (auto& candidate : selectedDsCandidates) {
96+
// not possible in Filter since expressions do not support binary operators
97+
if (!(candidate.hfflag() & 1 << DecayType::DsToKKPi)) {
98+
continue;
99+
}
100+
if (cutYCandMax >= 0. && std::abs(YDs(candidate)) > cutYCandMax) {
101+
continue;
102+
}
103+
registry.fill(HIST("hMass"), InvMassDsKKPi(candidate), candidate.pt());
104+
registry.fill(HIST("hPt"), candidate.pt());
105+
registry.fill(HIST("hEta"), candidate.eta(), candidate.pt());
106+
registry.fill(HIST("hCt"), CtDs(candidate), candidate.pt());
107+
registry.fill(HIST("hDecayLength"), candidate.decayLength(), candidate.pt());
108+
registry.fill(HIST("hDecayLengthXY"), candidate.decayLengthXY(), candidate.pt());
109+
registry.fill(HIST("hNormalisedDecayLengthXY"), candidate.decayLengthXYNormalised(), candidate.pt());
110+
registry.fill(HIST("hCPA"), candidate.cpa(), candidate.pt());
111+
registry.fill(HIST("hCPAxy"), candidate.cpaXY(), candidate.pt());
112+
registry.fill(HIST("hImpactParameterXY"), candidate.impactParameterXY(), candidate.pt());
113+
registry.fill(HIST("hMaxNormalisedDeltaIP"), candidate.maxNormalisedDeltaIP(), candidate.pt());
114+
registry.fill(HIST("hImpactParameterProngSqSum"), candidate.impactParameterProngSqSum(), candidate.pt());
115+
registry.fill(HIST("hDecayLengthError"), candidate.errorDecayLength(), candidate.pt());
116+
registry.fill(HIST("hDecayLengthXYError"), candidate.errorDecayLengthXY(), candidate.pt());
117+
registry.fill(HIST("hImpactParameterError"), candidate.errorImpactParameter0(), candidate.pt());
118+
registry.fill(HIST("hImpactParameterError"), candidate.errorImpactParameter1(), candidate.pt());
119+
registry.fill(HIST("hImpactParameterError"), candidate.errorImpactParameter2(), candidate.pt());
120+
registry.fill(HIST("hPtProng0"), candidate.ptProng0());
121+
registry.fill(HIST("hPtProng1"), candidate.ptProng1());
122+
registry.fill(HIST("hPtProng2"), candidate.ptProng2());
123+
registry.fill(HIST("hd0Prong0"), candidate.impactParameter0(), candidate.pt());
124+
registry.fill(HIST("hd0Prong1"), candidate.impactParameter1(), candidate.pt());
125+
registry.fill(HIST("hd0Prong2"), candidate.impactParameter2(), candidate.pt());
126+
}
127+
}
128+
129+
Partition<soa::Join<aod::HfCandProng3, aod::HFSelDsToKKPiCandidate, aod::HfCandProng3MCRec>> recoFlagDsCandidates = aod::hf_selcandidate_ds::isSelDsToKKPi >= selectionFlagDs || aod::hf_selcandidate_ds::isSelDsTPiKK >= selectionFlagDs;
130+
131+
void processMC(soa::Join<aod::HfCandProng3, aod::HFSelDsToKKPiCandidate, aod::HfCandProng3MCRec> const& candidates,
132+
soa::Join<aod::McParticles, aod::HfCandProng3MCGen> const& particlesMC, aod::BigTracksMC const& tracks)
133+
{
134+
// MC rec.
135+
for (auto& candidate : recoFlagDsCandidates) {
136+
// not possible in Filter since expressions do not support binary operators
137+
if (!(candidate.hfflag() & 1 << DecayType::DsToKKPi)) {
138+
continue;
139+
}
140+
if (cutYCandMax >= 0. && std::abs(YDs(candidate)) > cutYCandMax) {
141+
continue;
142+
}
143+
if (std::abs(candidate.flagMCMatchRec()) == 1 << DecayType::DsToKKPi) {
144+
// Get the corresponding MC particle.
145+
auto indexMother = RecoDecay::getMother(particlesMC, candidate.index0_as<aod::BigTracksMC>().mcParticle_as<soa::Join<aod::McParticles, aod::HfCandProng3MCGen>>(), pdg::Code::kDs, true);
146+
auto particleMother = particlesMC.iteratorAt(indexMother);
147+
registry.fill(HIST("hPtGenSig"), particleMother.pt()); // gen. level pT
148+
auto ptRec = candidate.pt();
149+
auto yRec = YDs(candidate);
150+
auto DsToKKPi = candidate.isSelDsToKKPi();
151+
auto DsToPiKK = candidate.isSelDsToPiKK();
152+
registry.fill(HIST("hPtvsYRecSigRecoSkim"), ptRec, yRec);
153+
if (TESTBIT(DsToKKPi, aod::SelectionStep::RecoTopol) || TESTBIT(DsToPiKK, aod::SelectionStep::RecoTopol)) {
154+
registry.fill(HIST("hPtvsYRecSigRecoTopol"), ptRec, yRec);
155+
}
156+
if (TESTBIT(DsToKKPi, aod::SelectionStep::RecoPID) || TESTBIT(DsToPiKK, aod::SelectionStep::RecoPID)) {
157+
registry.fill(HIST("hPtvsYRecSigRecoPID"), ptRec, yRec);
158+
}
159+
registry.fill(HIST("hPtRecSig"), ptRec); // rec. level pT
160+
if (candidate.originMCRec() == OriginType::Prompt) {
161+
registry.fill(HIST("hPtvsYRecSigPromptRecoSkim"), ptRec, yRec);
162+
if (TESTBIT(DsToKKPi, aod::SelectionStep::RecoTopol) || TESTBIT(DsToPiKK, aod::SelectionStep::RecoTopol)) {
163+
registry.fill(HIST("hPtvsYRecSigPromptRecoTopol"), ptRec, yRec);
164+
}
165+
if (TESTBIT(DsToKKPi, aod::SelectionStep::RecoPID) || TESTBIT(DsToPiKK, aod::SelectionStep::RecoPID)) {
166+
registry.fill(HIST("hPtvsYRecSigPromptRecoPID"), ptRec, yRec);
167+
}
168+
registry.fill(HIST("hPtRecSigPrompt"), ptRec); // rec. level pT, prompt
169+
} else { // FD
170+
registry.fill(HIST("hPtvsYRecSigNonPromptRecoSkim"), ptRec, yRec);
171+
if (TESTBIT(DsToKKPi, aod::SelectionStep::RecoTopol) || TESTBIT(DsToPiKK, aod::SelectionStep::RecoTopol)) {
172+
registry.fill(HIST("hPtvsYRecSigNonPromptRecoTopol"), ptRec, yRec);
173+
}
174+
if (TESTBIT(DsToKKPi, aod::SelectionStep::RecoPID) || TESTBIT(DsToPiKK, aod::SelectionStep::RecoPID)) {
175+
registry.fill(HIST("hPtvsYRecSigNonPromptRecoPID"), ptRec, yRec);
176+
}
177+
registry.fill(HIST("hPtRecSigNonPrompt"), ptRec); // rec. level pT, non-prompt
178+
}
179+
registry.fill(HIST("hCPARecSig"), candidate.cpa());
180+
registry.fill(HIST("hEtaRecSig"), candidate.eta());
181+
} else {
182+
registry.fill(HIST("hPtRecBg"), candidate.pt());
183+
registry.fill(HIST("hCPARecBg"), candidate.cpa());
184+
registry.fill(HIST("hEtaRecBg"), candidate.eta());
185+
}
186+
}
187+
// MC gen.
188+
// Printf("MC Particles: %d", particlesMC.size());
189+
for (auto& particle : particlesMC) {
190+
if (std::abs(particle.flagMCMatchGen()) == 1 << DecayType::DsToKKPi) {
191+
auto ptGen = particle.pt();
192+
auto yGen = RecoDecay::Y(array{particle.px(), particle.py(), particle.pz()}, RecoDecay::getMassPDG(particle.pdgCode()));
193+
if (cutYCandMax >= 0. && std::abs(yGen) > cutYCandMax) {
194+
continue;
195+
}
196+
registry.fill(HIST("hPtGen"), ptGen);
197+
registry.fill(HIST("hPtvsYGen"), ptGen, yGen);
198+
if (particle.originMCGen() == OriginType::Prompt) {
199+
registry.fill(HIST("hPtGenPrompt"), ptGen);
200+
registry.fill(HIST("hPtvsYGenPrompt"), ptGen, yGen);
201+
} else {
202+
registry.fill(HIST("hPtGenNonPrompt"), ptGen);
203+
registry.fill(HIST("hPtvsYGenNonPrompt"), ptGen, yGen);
204+
}
205+
registry.fill(HIST("hEtaGen"), particle.eta());
206+
}
207+
}
208+
}
209+
PROCESS_SWITCH(HfTaskDs, processMC, "Process MC", false);
210+
};
211+
212+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
213+
{
214+
return WorkflowSpec{adaptAnalysisTask<HfTaskDs>(cfgc)};
215+
}

PWGHF/Tasks/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ o2physics_add_dpl_workflow(task-dplus
4444
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing
4545
COMPONENT_NAME Analysis)
4646

47-
o2physics_add_dpl_workflow(task-ds
48-
SOURCES taskDs.cxx
49-
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing
50-
COMPONENT_NAME Analysis)
51-
5247

5348
o2physics_add_dpl_workflow(task-lc-parametrized-pid-mc
5449
SOURCES taskLcparametrizedPID.cxx

0 commit comments

Comments
 (0)