Skip to content

Commit 6336bea

Browse files
Addressing comments (AliceO2Group#4332)
1 parent abc42b3 commit 6336bea

1 file changed

Lines changed: 70 additions & 39 deletions

File tree

PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx

Lines changed: 70 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,24 @@ struct HfTaskFlowCharmHadrons {
5959
ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {10, 0., 10.}, ""};
6060
ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {10000, 0., 100.}, ""};
6161
ConfigurableAxis thnConfigAxisCosNPhi{"thnConfigAxisCosNPhi", {100, -1., 1.}, ""};
62+
ConfigurableAxis thnConfigAxisCosDeltaPhi{"thnConfigAxisCosDeltaPhi", {100, -1., 1.}, ""};
6263
ConfigurableAxis thnConfigAxisScalarProd{"thnConfigAxisScalarProd", {100, 0., 1.}, ""};
6364
ConfigurableAxis thnConfigAxisMlOne{"thnConfigAxisMlOne", {1000, 0., 1.}, ""};
6465
ConfigurableAxis thnConfigAxisMlTwo{"thnConfigAxisMlTwo", {1000, 0., 1.}, ""};
6566

66-
using CandDsData = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelDsToKKPi, aod::HfMlDsToKKPi>>;
67-
using CandDplusData = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelDplusToPiKPi, aod::HfMlDplusToPiKPi>>;
67+
using CandDsDatawMl = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelDsToKKPi, aod::HfMlDsToKKPi>>;
68+
using CandDsData = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelDsToKKPi>>;
69+
using CandDplusDatawMl = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelDplusToPiKPi, aod::HfMlDplusToPiKPi>>;
70+
using CandDplusData = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelDplusToPiKPi>>;
6871
using CollsWithQvecs = soa::Join<aod::Collisions, aod::QvectorFT0Cs, aod::QvectorFT0As, aod::QvectorFT0Ms, aod::QvectorFV0As, aod::QvectorBPoss, aod::QvectorBNegs, aod::CentFV0As, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs>;
6972

7073
Filter filterSelectDsCandidates = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag || aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag;
7174
Filter filterSelectDplusCandidates = aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlag;
7275

7376
Partition<CandDsData> selectedDsToKKPi = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag;
7477
Partition<CandDsData> selectedDsToPiKK = aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag;
78+
Partition<CandDsDatawMl> selectedDsToKKPiwMl = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag;
79+
Partition<CandDsDatawMl> selectedDsToPiKKwMl = aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag;
7580

7681
HfHelper hfHelper;
7782
EventPlaneHelper epHelper;
@@ -84,11 +89,16 @@ struct HfTaskFlowCharmHadrons {
8489
const AxisSpec thnAxisPt{thnConfigAxisPt, "#it{p}_{T} (GeV/#it{c})"};
8590
const AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality"};
8691
const AxisSpec thnAxisCosNPhi{thnConfigAxisCosNPhi, Form("cos(%d#varphi)", harmonic.value)};
92+
const AxisSpec thnAxisCosDeltaPhi{thnConfigAxisCosDeltaPhi, Form("cos(%d(#varphi - #Psi_{sub}))", harmonic.value)};
8793
const AxisSpec thnAxisScalarProd{thnConfigAxisScalarProd, "SP"};
8894
const AxisSpec thnAxisMlOne{thnConfigAxisMlOne, "Bkg score"};
8995
const AxisSpec thnAxisMlTwo{thnConfigAxisMlTwo, "FD score"};
9096

91-
registry.add("hSparseFlowCharm", "THn for SP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCent, thnAxisCosNPhi, thnAxisScalarProd, thnAxisMlOne, thnAxisMlTwo});
97+
if (storeMl) {
98+
registry.add("hSparseFlowCharm", "THn for SP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCent, thnAxisCosNPhi, thnAxisCosDeltaPhi, thnAxisScalarProd, thnAxisMlOne, thnAxisMlTwo});
99+
} else {
100+
registry.add("hSparseFlowCharm", "THn for SP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCent, thnAxisCosNPhi, thnAxisCosDeltaPhi, thnAxisScalarProd});
101+
}
92102
registry.add("spReso/hSpResoFT0cFT0a", "hSpResoFT0cFT0a; centrality; Q_{FT0c} #bullet Q_{FT0a}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}});
93103
registry.add("spReso/hSpResoFT0cFT0m", "hSpResoFT0cFT0m; centrality; Q_{FT0c} #bullet Q_{FT0m}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}});
94104
registry.add("spReso/hSpResoFT0cFV0m", "hSpResoFT0cFV0m; centrality; Q_{FT0c} #bullet Q_{FV0m}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}});
@@ -136,15 +146,15 @@ struct HfTaskFlowCharmHadrons {
136146
float pXtrack0 = cand.pxProng0();
137147
float pYtrack0 = cand.pyProng0();
138148
float pTtrack0 = cand.ptProng0();
139-
float phiTrack0 = TMath::ATan2(pYtrack0, pXtrack0);
149+
float phiTrack0 = std::atan2(pYtrack0, pXtrack0);
140150
float pXtrack1 = cand.pxProng1();
141151
float pYtrack1 = cand.pyProng1();
142152
float pTtrack1 = cand.ptProng1();
143-
float phiTrack1 = TMath::ATan2(pYtrack1, pXtrack1);
153+
float phiTrack1 = std::atan2(pYtrack1, pXtrack1);
144154
float pXtrack2 = cand.pxProng2();
145155
float pYtrack2 = cand.pyProng2();
146156
float pTtrack2 = cand.ptProng2();
147-
float phiTrack2 = TMath::ATan2(pYtrack2, pXtrack2);
157+
float phiTrack2 = std::atan2(pYtrack2, pXtrack2);
148158

149159
tracksQx.push_back(cos(harmonic * phiTrack0) * pTtrack0 / ampl);
150160
tracksQy.push_back(sin(harmonic * phiTrack0) * pTtrack0 / ampl);
@@ -179,15 +189,19 @@ struct HfTaskFlowCharmHadrons {
179189
/// \param sp is the scalar product
180190
/// \param evtPlReso is the event plane resolution
181191
/// \param outputMl are the ML scores
182-
void fillThn(float mass,
183-
float pt,
184-
float cent,
185-
float cosNPhi,
186-
float cosDeltaPhi,
187-
float sp,
188-
std::vector<float> outputMl)
192+
void fillThn(float& mass,
193+
float& pt,
194+
float& cent,
195+
float& cosNPhi,
196+
float& cosDeltaPhi,
197+
float& sp,
198+
std::vector<float>& outputMl)
189199
{
190-
registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, cosNPhi, cosDeltaPhi, sp, outputMl[0], outputMl[1]);
200+
if (storeMl) {
201+
registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, cosNPhi, cosDeltaPhi, sp, outputMl[0], outputMl[1]);
202+
} else {
203+
registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, cosNPhi, cosDeltaPhi, sp);
204+
}
191205
}
192206

193207
/// Get the centrality
@@ -276,28 +290,28 @@ struct HfTaskFlowCharmHadrons {
276290
float massCand = 0.;
277291
std::vector<float> outputMl = {-999., -999.};
278292

279-
if constexpr (std::is_same<T1, CandDsData>::value) {
293+
if constexpr (std::is_same<T1, CandDsData>::value || std::is_same<T1, CandDsDatawMl>::value) {
280294
switch (DecayChannel) {
281295
case DecayChannel::DsToKKPi:
282296
massCand = hfHelper.invMassDsToKKPi(candidate);
283-
if (storeMl) {
297+
if constexpr (std::is_same<T1, CandDsDatawMl>::value) {
284298
for (unsigned int iclass = 0; iclass < classMl->size(); iclass++)
285299
outputMl[iclass] = candidate.mlProbDsToKKPi()[classMl->at(iclass)];
286300
}
287301
break;
288302
case DecayChannel::DsToPiKK:
289303
massCand = hfHelper.invMassDsToPiKK(candidate);
290-
if (storeMl) {
304+
if constexpr (std::is_same<T1, CandDsDatawMl>::value) {
291305
for (unsigned int iclass = 0; iclass < classMl->size(); iclass++)
292306
outputMl[iclass] = candidate.mlProbDsToPiKK()[classMl->at(iclass)];
293307
}
294308
break;
295309
default:
296310
break;
297311
}
298-
} else if constexpr (std::is_same<T1, CandDplusData>::value) {
312+
} else if constexpr (std::is_same<T1, CandDplusData>::value || std::is_same<T1, CandDplusDatawMl>::value) {
299313
massCand = hfHelper.invMassDplusToPiKPi(candidate);
300-
if (storeMl) {
314+
if constexpr (std::is_same<T1, CandDplusDatawMl>::value) {
301315
for (unsigned int iclass = 0; iclass < classMl->size(); iclass++)
302316
outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)];
303317
}
@@ -306,7 +320,7 @@ struct HfTaskFlowCharmHadrons {
306320
float phiCand = candidate.phi();
307321

308322
// If TPC is used for the SP estimation, the tracks of the hadron candidate must be removed from the TPC Q vector to avoid double counting
309-
if (qvecDetector == 4 || qvecDetector == 5) {
323+
if (qvecDetector == qvecEstimator::TPCNeg || qvecDetector == qvecEstimator::TPCPos) {
310324
float ampl = amplQVec - 3.;
311325
std::vector<float> tracksQx = {};
312326
std::vector<float> tracksQy = {};
@@ -317,16 +331,25 @@ struct HfTaskFlowCharmHadrons {
317331
}
318332
}
319333

320-
float cosNPhi = TMath::Cos(harmonic * phiCand);
321-
float sinNPhi = TMath::Sin(harmonic * phiCand);
334+
float cosNPhi = std::cos(harmonic * phiCand);
335+
float sinNPhi = std::sin(harmonic * phiCand);
322336
float scalprodCand = cosNPhi * xQVec + sinNPhi * yQVec;
323-
float cosDeltaPhi = TMath::Cos(harmonic * (phiCand - evtPl));
337+
float cosDeltaPhi = std::cos(harmonic * (phiCand - evtPl));
324338

325339
fillThn(massCand, ptCand, cent, cosNPhi, cosDeltaPhi, scalprodCand, outputMl);
326340
}
327341
}
328342

329-
// Ds
343+
// Ds with ML
344+
void processDsMl(CollsWithQvecs::iterator const& collision,
345+
CandDsDatawMl const& candidatesDs)
346+
{
347+
runFlowAnalysis<DecayChannel::DsToKKPi, Partition<CandDsDatawMl>>(collision, selectedDsToKKPiwMl);
348+
runFlowAnalysis<DecayChannel::DsToPiKK, Partition<CandDsDatawMl>>(collision, selectedDsToPiKKwMl);
349+
}
350+
PROCESS_SWITCH(HfTaskFlowCharmHadrons, processDsMl, "Process Ds candidates with ML", false);
351+
352+
// Ds with rectangular cuts
330353
void processDs(CollsWithQvecs::iterator const& collision,
331354
CandDsData const& candidatesDs)
332355
{
@@ -335,7 +358,15 @@ struct HfTaskFlowCharmHadrons {
335358
}
336359
PROCESS_SWITCH(HfTaskFlowCharmHadrons, processDs, "Process Ds candidates", false);
337360

338-
// Dplus
361+
// Dplus with ML
362+
void processDplusMl(CollsWithQvecs::iterator const& collision,
363+
CandDplusDatawMl const& candidatesDplus)
364+
{
365+
runFlowAnalysis<DecayChannel::DplusToPiKPi, CandDplusDatawMl>(collision, candidatesDplus);
366+
}
367+
PROCESS_SWITCH(HfTaskFlowCharmHadrons, processDplusMl, "Process Dplus candidates with ML", false);
368+
369+
// Dplus with rectangular cuts
339370
void processDplus(CollsWithQvecs::iterator const& collision,
340371
CandDplusData const& candidatesDplus)
341372
{
@@ -383,20 +414,20 @@ struct HfTaskFlowCharmHadrons {
383414
float epBPoss = epHelper.GetEventPlane(xQVecBPos, yQVecBPos, harmonic);
384415
float epBNegs = epHelper.GetEventPlane(xQVecBNeg, yQVecBNeg, harmonic);
385416

386-
registry.fill(HIST("epReso/hEpResoFT0cFT0a"), centrality, TMath::Cos(harmonic * getDeltaPsiInRange(epFT0c, epFT0a)));
387-
registry.fill(HIST("epReso/hEpResoFT0cFT0m"), centrality, TMath::Cos(harmonic * getDeltaPsiInRange(epFT0c, epFT0m)));
388-
registry.fill(HIST("epReso/hEpResoFT0cFV0m"), centrality, TMath::Cos(harmonic * getDeltaPsiInRange(epFT0c, epFV0a)));
389-
registry.fill(HIST("epReso/hEpResoFT0cTPCpos"), centrality, TMath::Cos(harmonic * getDeltaPsiInRange(epFT0c, epBPoss)));
390-
registry.fill(HIST("epReso/hEpResoFT0cTPCneg"), centrality, TMath::Cos(harmonic * getDeltaPsiInRange(epFT0c, epBNegs)));
391-
registry.fill(HIST("epReso/hEpResoFT0aFT0m"), centrality, TMath::Cos(harmonic * getDeltaPsiInRange(epFT0a, epFT0m)));
392-
registry.fill(HIST("epReso/hEpResoFT0aFV0m"), centrality, TMath::Cos(harmonic * getDeltaPsiInRange(epFT0a, epFV0a)));
393-
registry.fill(HIST("epReso/hEpResoFT0aTPCpos"), centrality, TMath::Cos(harmonic * getDeltaPsiInRange(epFT0a, epBPoss)));
394-
registry.fill(HIST("epReso/hEpResoFT0aTPCneg"), centrality, TMath::Cos(harmonic * getDeltaPsiInRange(epFT0a, epBNegs)));
395-
registry.fill(HIST("epReso/hEpResoFT0mFV0m"), centrality, TMath::Cos(harmonic * getDeltaPsiInRange(epFT0m, epFV0a)));
396-
registry.fill(HIST("epReso/hEpResoFT0mTPCpos"), centrality, TMath::Cos(harmonic * getDeltaPsiInRange(epFT0m, epBPoss)));
397-
registry.fill(HIST("epReso/hEpResoFT0mTPCneg"), centrality, TMath::Cos(harmonic * getDeltaPsiInRange(epFT0m, epBNegs)));
398-
registry.fill(HIST("epReso/hEpResoFV0mTPCpos"), centrality, TMath::Cos(harmonic * getDeltaPsiInRange(epFV0a, epBPoss)));
399-
registry.fill(HIST("epReso/hEpResoFV0mTPCneg"), centrality, TMath::Cos(harmonic * getDeltaPsiInRange(epFV0a, epBNegs)));
417+
registry.fill(HIST("epReso/hEpResoFT0cFT0a"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0c, epFT0a)));
418+
registry.fill(HIST("epReso/hEpResoFT0cFT0m"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0c, epFT0m)));
419+
registry.fill(HIST("epReso/hEpResoFT0cFV0m"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0c, epFV0a)));
420+
registry.fill(HIST("epReso/hEpResoFT0cTPCpos"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0c, epBPoss)));
421+
registry.fill(HIST("epReso/hEpResoFT0cTPCneg"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0c, epBNegs)));
422+
registry.fill(HIST("epReso/hEpResoFT0aFT0m"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0a, epFT0m)));
423+
registry.fill(HIST("epReso/hEpResoFT0aFV0m"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0a, epFV0a)));
424+
registry.fill(HIST("epReso/hEpResoFT0aTPCpos"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0a, epBPoss)));
425+
registry.fill(HIST("epReso/hEpResoFT0aTPCneg"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0a, epBNegs)));
426+
registry.fill(HIST("epReso/hEpResoFT0mFV0m"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0m, epFV0a)));
427+
registry.fill(HIST("epReso/hEpResoFT0mTPCpos"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0m, epBPoss)));
428+
registry.fill(HIST("epReso/hEpResoFT0mTPCneg"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0m, epBNegs)));
429+
registry.fill(HIST("epReso/hEpResoFV0mTPCpos"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFV0a, epBPoss)));
430+
registry.fill(HIST("epReso/hEpResoFV0mTPCneg"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFV0a, epBNegs)));
400431
}
401432
}
402433
PROCESS_SWITCH(HfTaskFlowCharmHadrons, processResolution, "Process resolution", false);

0 commit comments

Comments
 (0)