Skip to content

Commit 9625ee3

Browse files
[PWGCF] FemtoUniverse -- Add MC analysis to debug-V0 task. (#12307)
1 parent bc376c8 commit 9625ee3

File tree

1 file changed

+119
-45
lines changed

1 file changed

+119
-45
lines changed

PWGCF/FemtoUniverse/Tasks/femtoUniverseDebugV0.cxx

Lines changed: 119 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,30 @@
1313
/// \brief Tasks that reads the particle tables and fills QA histograms for V0s
1414
/// \author Luca Barioglio, TU München, luca.barioglio@cern.ch
1515
/// \author Zuzanna Chochulska, WUT Warsaw & CTU Prague, zchochul@cern.ch
16+
/// \author Anna-Mariia Andrushko, WUT Warsaw, anna-mariia.andrushko@cern.ch
1617

17-
#include <fairlogger/Logger.h>
18-
#include <cstdint>
19-
#include <vector>
20-
#include <TDatabasePDG.h>
18+
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h"
19+
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h"
20+
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h"
21+
#include "PWGCF/FemtoUniverse/Core/femtoUtils.h"
22+
#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h"
23+
24+
#include "Common/DataModel/PIDResponse.h"
25+
26+
#include "DataFormatsParameters/GRPObject.h"
27+
#include "Framework/ASoAHelpers.h"
2128
#include "Framework/AnalysisTask.h"
22-
#include "Framework/runDataProcessing.h"
2329
#include "Framework/HistogramRegistry.h"
24-
#include "Framework/ASoAHelpers.h"
30+
#include "Framework/O2DatabasePDGPlugin.h"
2531
#include "Framework/RunningWorkflowInfo.h"
2632
#include "Framework/StepTHn.h"
27-
#include "Framework/O2DatabasePDGPlugin.h"
28-
#include "DataFormatsParameters/GRPObject.h"
33+
#include "Framework/runDataProcessing.h"
34+
#include "ReconstructionDataFormats/PID.h"
2935

30-
#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h"
31-
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h"
32-
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h"
33-
#include "PWGCF/FemtoUniverse/Core/femtoUtils.h"
34-
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h"
36+
#include <fairlogger/Logger.h>
37+
38+
#include <cstdint>
39+
#include <vector>
3540

3641
using namespace o2;
3742
using namespace o2::analysis::femto_universe;
@@ -45,51 +50,70 @@ struct FemtoUniverseDebugV0 {
4550

4651
SliceCache cache;
4752

48-
Configurable<int> confPDGCodeV0{"confPDGCodeV0", 3122, "V0 -- PDG code"};
49-
Configurable<int> confPDGCodePositiveChild{"confPDGCodePositiveChild", 2212, "Positive Child -- PDG code"};
50-
Configurable<int> confPDGCodeNegativeChild{"confPDGCodeNegativeChild", 211, "Negative Child -- PDG code"};
51-
Configurable<uint32_t> confCutV0{"confCutV0", 338, "V0 -- Selection bit from cutCulator"};
52-
ConfigurableAxis confV0TempFitVarBins{"confV0TempFitVarBins", {300, 0.95, 1.}, "V0: binning of the TempFitVar in the pT vs. TempFitVar plot"};
53-
ConfigurableAxis confV0TempFitVarpTBins{"confV0TempFitVarpTBins", {20, 0.5, 4.05}, "V0: pT binning of the pT vs. TempFitVar plot"};
54-
55-
Configurable<uint32_t> confCutPositiveChild{"confCutPositiveChild", 150, "Positive Child of V0 -- Selection bit from cutCulator"};
56-
Configurable<uint32_t> confCutNegativeChild{"confCutNegativeChild", 149, "Negative Child of V0 -- Selection bit from cutCulator"};
57-
Configurable<float> confPositiveChildPIDnSigmaMax{"confPositiveChildPIDnSigmaMax", 3.f, "Positive Child of V0 -- Selection bit from cutCulator"};
58-
Configurable<float> confNegativeChildPIDnSigmaMax{"confNegativeChildPIDnSigmaMax", 3.f, "Negative Child of V0 -- Selection bit from cutCulator"};
59-
Configurable<int> confPositiveChildIndex{"confPositiveChildIndex", 1, "Positive Child of V0 -- Index from cutCulator"};
60-
Configurable<int> confNegativeChildIndex{"confNegativeChildIndex", 0, "Negative Child of V0 -- Index from cutCulator"};
61-
Configurable<std::vector<float>> confChildPIDnSigmaMax{"confChildPIDnSigmaMax", std::vector<float>{4.f, 3.f}, "V0 child selection: max. PID nSigma TPC"};
62-
Configurable<int> confChildnSpecies{"confChildnSpecies", 2, "Number of particle spieces (for V0 children) with PID info"};
63-
ConfigurableAxis confChildTempFitVarBins{"confChildTempFitVarBins", {300, -0.15, 0.15}, "V0 child: binning of the TempFitVar in the pT vs. TempFitVar plot"};
64-
ConfigurableAxis confChildTempFitVarpTBins{"confChildTempFitVarpTBins", {20, 0.5, 4.05}, "V0 child: pT binning of the pT vs. TempFitVar plot"};
65-
53+
/// V0 configurables
54+
struct : o2::framework::ConfigurableGroup {
55+
Configurable<int> confPDGCodeV0{"confPDGCodeV0", 3122, "V0 -- PDG code"};
56+
Configurable<int> confPDGCodePositiveChild{"confPDGCodePositiveChild", 2212, "Positive Child -- PDG code"};
57+
Configurable<int> confPDGCodeNegativeChild{"confPDGCodeNegativeChild", 211, "Negative Child -- PDG code"};
58+
Configurable<uint32_t> confCutV0{"confCutV0", 338, "V0 -- Selection bit from cutCulator"};
59+
ConfigurableAxis confV0TempFitVarBins{"confV0TempFitVarBins", {300, 0.95, 1.}, "V0: binning of the TempFitVar in the pT vs. TempFitVar plot"};
60+
ConfigurableAxis confV0TempFitVarpTBins{"confV0TempFitVarpTBins", {20, 0.5, 4.05}, "V0: pT binning of the pT vs. TempFitVar plot"};
61+
} V0configs; // o2-linter: disable=name/function-variable
62+
63+
/// Children configurables
64+
struct : o2::framework::ConfigurableGroup {
65+
Configurable<uint32_t> confCutPositiveChild{"confCutPositiveChild", 150, "Positive Child of V0 -- Selection bit from cutCulator"};
66+
Configurable<uint32_t> confCutNegativeChild{"confCutNegativeChild", 149, "Negative Child of V0 -- Selection bit from cutCulator"};
67+
Configurable<float> confPositiveChildPIDnSigmaMax{"confPositiveChildPIDnSigmaMax", 3.f, "Positive Child of V0 -- Selection bit from cutCulator"};
68+
Configurable<float> confNegativeChildPIDnSigmaMax{"confNegativeChildPIDnSigmaMax", 3.f, "Negative Child of V0 -- Selection bit from cutCulator"};
69+
Configurable<int> confPositiveChildIndex{"confPositiveChildIndex", 1, "Positive Child of V0 -- Index from cutCulator"};
70+
Configurable<int> confNegativeChildIndex{"confNegativeChildIndex", 0, "Negative Child of V0 -- Index from cutCulator"};
71+
Configurable<std::vector<float>> confChildPIDnSigmaMax{"confChildPIDnSigmaMax", std::vector<float>{4.f, 3.f}, "V0 child selection: max. PID nSigma TPC"};
72+
Configurable<int> confChildnSpecies{"confChildnSpecies", 2, "Number of particle spieces (for V0 children) with PID info"};
73+
ConfigurableAxis confChildTempFitVarBins{"confChildTempFitVarBins", {300, -0.15, 0.15}, "V0 child: binning of the TempFitVar in the pT vs. TempFitVar plot"};
74+
ConfigurableAxis confChildTempFitVarpTBins{"confChildTempFitVarpTBins", {20, 0.5, 4.05}, "V0 child: pT binning of the pT vs. TempFitVar plot"};
75+
} childconfigs;
76+
77+
Configurable<bool> confIsMC{"confIsMC", false, "Enable additional histograms in the case of a Monte Carlo run"};
78+
79+
/// Partitioning
6680
using FemtoFullParticles = soa::Join<aod::FDParticles, aod::FDExtParticles>;
67-
Partition<FemtoFullParticles> partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kV0)) && ((aod::femtouniverseparticle::cut & confCutV0) == confCutV0);
81+
82+
Partition<FemtoFullParticles> partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kV0)) && ((aod::femtouniverseparticle::cut & V0configs.confCutV0) == V0configs.confCutV0);
83+
84+
Partition<soa::Join<FemtoFullParticles, aod::FDMCLabels>> partsOneMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kV0)) && ((aod::femtouniverseparticle::cut & V0configs.confCutV0) == V0configs.confCutV0);
85+
6886
Preslice<FemtoFullParticles> perCol = aod::femtouniverseparticle::fdCollisionId;
6987

7088
/// Histogramming
7189
FemtoUniverseEventHisto eventHisto;
7290
FemtoUniverseParticleHisto<aod::femtouniverseparticle::ParticleType::kV0Child, 3> positiveChildHistos;
7391
FemtoUniverseParticleHisto<aod::femtouniverseparticle::ParticleType::kV0Child, 4> negativeChildHistos;
74-
FemtoUniverseParticleHisto<aod::femtouniverseparticle::ParticleType::kV0> V0Histos;
92+
FemtoUniverseParticleHisto<aod::femtouniverseparticle::ParticleType::kV0> V0Histos; // o2-linter: disable=name/function-variable
7593

7694
/// Histogram output
77-
HistogramRegistry EventRegistry{"Event", {}, OutputObjHandlingPolicy::AnalysisObject};
78-
HistogramRegistry V0Registry{"FullV0QA", {}, OutputObjHandlingPolicy::AnalysisObject};
95+
HistogramRegistry eventRegistry{"Event", {}, OutputObjHandlingPolicy::AnalysisObject};
96+
HistogramRegistry V0Registry{"FullV0QA", {}, OutputObjHandlingPolicy::AnalysisObject}; // o2-linter: disable=name/function-variable
7997
HistogramRegistry thetaRegistry{"ThetaQA", {}, OutputObjHandlingPolicy::AnalysisObject};
8098

8199
void init(InitContext&)
82100
{
83-
eventHisto.init(&EventRegistry);
84-
positiveChildHistos.init(&V0Registry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, confPDGCodePositiveChild.value, true);
85-
negativeChildHistos.init(&V0Registry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, confPDGCodeNegativeChild, true);
86-
V0Histos.init(&V0Registry, confV0TempFitVarpTBins, confV0TempFitVarBins, false, confPDGCodeV0.value, true);
101+
eventHisto.init(&eventRegistry);
102+
positiveChildHistos.init(&V0Registry, childconfigs.confChildTempFitVarpTBins, childconfigs.confChildTempFitVarBins, confIsMC, V0configs.confPDGCodePositiveChild.value, true);
103+
negativeChildHistos.init(&V0Registry, childconfigs.confChildTempFitVarpTBins, childconfigs.confChildTempFitVarBins, confIsMC, V0configs.confPDGCodeNegativeChild.value, true);
104+
V0Histos.init(&V0Registry, V0configs.confV0TempFitVarpTBins, V0configs.confV0TempFitVarBins, confIsMC, V0configs.confPDGCodeV0.value, true);
87105

88106
thetaRegistry.add("Theta/hTheta", " ; p (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}});
107+
thetaRegistry.add("Theta/PositiveChild/hThetaPt", " ; p_{T} (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}});
108+
thetaRegistry.add("Theta/PositiveChild/hThetaEta", " ; #eta; cos(#theta)", kTH2F, {{100, -1, 1}, {110, -1.1, 1.1}});
109+
thetaRegistry.add("Theta/PositiveChild/hThetaPhi", " ; #phi; cos(#theta)", kTH2F, {{100, -1, 7}, {110, -1.1, 1.1}});
110+
thetaRegistry.add("Theta/NegativeChild/hThetaPt", " ; p_{T} (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}});
111+
thetaRegistry.add("Theta/NegativeChild/hThetaEta", " ; #eta; cos(#theta)", kTH2F, {{100, -1, 1}, {110, -1.1, 1.1}});
112+
thetaRegistry.add("Theta/NegativeChild/hThetaPhi", " ; #phi; cos(#theta)", kTH2F, {{100, -1, 7}, {110, -1.1, 1.1}});
89113
}
90114

91-
/// Produce QA plots for V0 selection in FemtoUniverse framework
92-
void process(o2::aod::FdCollision const& col, FemtoFullParticles const& parts)
115+
/// Produce QA plots for V0 and its children on real data
116+
void processData(o2::aod::FdCollision const& col, FemtoFullParticles const& parts)
93117
{
94118
auto groupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache);
95119
eventHisto.fillQA(col);
@@ -107,20 +131,70 @@ struct FemtoUniverseDebugV0 {
107131
// Check cuts on V0 children
108132
if (positiveChild.partType() == uint8_t(aod::femtouniverseparticle::ParticleType::kV0Child) &&
109133
negativeChild.partType() == uint8_t(aod::femtouniverseparticle::ParticleType::kV0Child) &&
110-
isFullPIDSelected(positiveChild.pidCut(), positiveChild.p(), 999.f, confPositiveChildIndex.value, confChildnSpecies.value, confChildPIDnSigmaMax.value, confPositiveChildPIDnSigmaMax.value, 1.f) &&
111-
isFullPIDSelected(negativeChild.pidCut(), negativeChild.p(), 999.f, confNegativeChildIndex.value, confChildnSpecies.value, confChildPIDnSigmaMax.value, confNegativeChildPIDnSigmaMax.value, 1.f)) {
112-
auto positiveChildMass = pdg->Mass(confPDGCodePositiveChild);
113-
auto negativeChildMass = pdg->Mass(confPDGCodeNegativeChild);
134+
isFullPIDSelected(positiveChild.pidCut(), positiveChild.p(), 999.f, childconfigs.confPositiveChildIndex.value, childconfigs.confChildnSpecies.value, childconfigs.confChildPIDnSigmaMax.value, childconfigs.confPositiveChildPIDnSigmaMax.value, 1.f) &&
135+
isFullPIDSelected(negativeChild.pidCut(), negativeChild.p(), 999.f, childconfigs.confNegativeChildIndex.value, childconfigs.confChildnSpecies.value, childconfigs.confChildPIDnSigmaMax.value, childconfigs.confNegativeChildPIDnSigmaMax.value, 1.f)) {
136+
auto positiveChildMass = pdg->Mass(V0configs.confPDGCodePositiveChild);
137+
auto negativeChildMass = pdg->Mass(V0configs.confPDGCodeNegativeChild);
138+
auto positiveChildBoosted = FemtoUniverseMath::boostPRF<decltype(positiveChild)>(positiveChild, positiveChildMass, negativeChild, negativeChildMass);
139+
auto cosineTheta = (positiveChildBoosted.Px() * part.px() + positiveChildBoosted.Py() * part.py() + positiveChildBoosted.Pz() * part.pz()) / (positiveChildBoosted.P() * part.p());
140+
141+
V0Histos.fillQA<false, true>(part);
142+
positiveChildHistos.fillQA<false, true>(positiveChild);
143+
negativeChildHistos.fillQA<false, true>(negativeChild);
144+
145+
thetaRegistry.fill(HIST("Theta/hTheta"), part.p(), cosineTheta);
146+
thetaRegistry.fill(HIST("Theta/PositiveChild/hThetaPt"), positiveChild.pt(), cosineTheta);
147+
thetaRegistry.fill(HIST("Theta/PositiveChild/hThetaEta"), positiveChild.eta(), cosineTheta);
148+
thetaRegistry.fill(HIST("Theta/PositiveChild/hThetaPhi"), positiveChild.phi(), cosineTheta);
149+
thetaRegistry.fill(HIST("Theta/NegativeChild/hThetaPt"), negativeChild.pt(), cosineTheta);
150+
thetaRegistry.fill(HIST("Theta/NegativeChild/hThetaEta"), negativeChild.eta(), cosineTheta);
151+
thetaRegistry.fill(HIST("Theta/NegativeChild/hThetaPhi"), negativeChild.phi(), cosineTheta);
152+
}
153+
}
154+
}
155+
PROCESS_SWITCH(FemtoUniverseDebugV0, processData, "Enable processing on real data", true);
156+
157+
/// Produce QA plots for V0 and its children on Monte Carlo
158+
void processMC(o2::aod::FdCollision const& col, soa::Join<FemtoFullParticles, aod::FDMCLabels> const& parts, o2::aod::FdMCParticles const&)
159+
{
160+
auto groupPartsOne = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache);
161+
eventHisto.fillQA(col);
162+
for (const auto& part : groupPartsOne) {
163+
if (!part.has_children()) {
164+
continue;
165+
}
166+
const auto& positiveChild = parts.iteratorAt(part.index() - 2);
167+
const auto& negativeChild = parts.iteratorAt(part.index() - 1);
168+
if (positiveChild.globalIndex() != part.childrenIds()[0] || negativeChild.globalIndex() != part.childrenIds()[1]) {
169+
LOG(warn) << "Indices of V0 children do not match";
170+
continue;
171+
}
172+
173+
// Check cuts on V0 children
174+
if (positiveChild.partType() == uint8_t(aod::femtouniverseparticle::ParticleType::kV0Child) &&
175+
negativeChild.partType() == uint8_t(aod::femtouniverseparticle::ParticleType::kV0Child) &&
176+
isFullPIDSelected(positiveChild.pidCut(), positiveChild.p(), 999.f, childconfigs.confPositiveChildIndex.value, childconfigs.confChildnSpecies.value, childconfigs.confChildPIDnSigmaMax.value, childconfigs.confPositiveChildPIDnSigmaMax.value, 1.f) &&
177+
isFullPIDSelected(negativeChild.pidCut(), negativeChild.p(), 999.f, childconfigs.confNegativeChildIndex.value, childconfigs.confChildnSpecies.value, childconfigs.confChildPIDnSigmaMax.value, childconfigs.confNegativeChildPIDnSigmaMax.value, 1.f)) {
178+
auto positiveChildMass = pdg->Mass(V0configs.confPDGCodePositiveChild);
179+
auto negativeChildMass = pdg->Mass(V0configs.confPDGCodeNegativeChild);
114180
auto positiveChildBoosted = FemtoUniverseMath::boostPRF<decltype(positiveChild)>(positiveChild, positiveChildMass, negativeChild, negativeChildMass);
115181
auto cosineTheta = (positiveChildBoosted.Px() * part.px() + positiveChildBoosted.Py() * part.py() + positiveChildBoosted.Pz() * part.pz()) / (positiveChildBoosted.P() * part.p());
116182

117183
V0Histos.fillQA<false, true>(part);
118184
positiveChildHistos.fillQA<false, true>(positiveChild);
119185
negativeChildHistos.fillQA<false, true>(negativeChild);
186+
120187
thetaRegistry.fill(HIST("Theta/hTheta"), part.p(), cosineTheta);
188+
thetaRegistry.fill(HIST("Theta/PositiveChild/hThetaPt"), positiveChild.pt(), cosineTheta);
189+
thetaRegistry.fill(HIST("Theta/PositiveChild/hThetaEta"), positiveChild.eta(), cosineTheta);
190+
thetaRegistry.fill(HIST("Theta/PositiveChild/hThetaPhi"), positiveChild.phi(), cosineTheta);
191+
thetaRegistry.fill(HIST("Theta/NegativeChild/hThetaPt"), negativeChild.pt(), cosineTheta);
192+
thetaRegistry.fill(HIST("Theta/NegativeChild/hThetaEta"), negativeChild.eta(), cosineTheta);
193+
thetaRegistry.fill(HIST("Theta/NegativeChild/hThetaPhi"), negativeChild.phi(), cosineTheta);
121194
}
122195
}
123196
}
197+
PROCESS_SWITCH(FemtoUniverseDebugV0, processMC, "Enable processing on Monte Carlo", false);
124198
};
125199

126200
WorkflowSpec

0 commit comments

Comments
 (0)