Skip to content

Commit 602db8e

Browse files
[PWGHF] Add TTree to charm flow task for pt bin centering (#11932)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent d8b3775 commit 602db8e

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
/// \author S. Politanò, INFN Torino, Italy
1616
/// \author Wu Chuntai, CUG, China
1717
/// \author Ran Tu, Fudan University, China
18+
/// \author Marcello Di Costanzo <marcello.di.costanzo@cern.ch>, Polytechnic University of Turin and INFN
1819

1920
#include "PWGHF/Core/CentralityEstimation.h"
2021
#include "PWGHF/Core/HfHelper.h"
@@ -59,6 +60,23 @@ using namespace o2::hf_centrality;
5960
using namespace o2::hf_occupancy;
6061
using namespace o2::hf_evsel;
6162

63+
namespace o2::aod
64+
{
65+
namespace full
66+
{
67+
DECLARE_SOA_COLUMN(M, m, float); //! Invariant mass of candidate (GeV/c2)
68+
DECLARE_SOA_COLUMN(Pt, pt, float); //! Transverse momentum of candidate (GeV/c)
69+
// ML scores
70+
DECLARE_SOA_COLUMN(MlScore0, mlScore0, float); //! ML score of the first configured index
71+
DECLARE_SOA_COLUMN(MlScore1, mlScore1, float); //! ML score of the second configured index
72+
} // namespace full
73+
DECLARE_SOA_TABLE(HfCandPtCent, "AOD", "HFCANDPTCENT",
74+
full::M,
75+
full::Pt,
76+
full::MlScore0,
77+
full::MlScore1);
78+
} // namespace o2::aod
79+
6280
enum DecayChannel { DplusToPiKPi = 0,
6381
DsToKKPi,
6482
DsToPiKK,
@@ -80,6 +98,8 @@ enum QvecEstimator { FV0A = 0,
8098
TPCTot };
8199

82100
struct HfTaskFlowCharmHadrons {
101+
Produces<o2::aod::HfCandPtCent> rowCandidateMassPtMlScores;
102+
83103
Configurable<int> harmonic{"harmonic", 2, "harmonic number"};
84104
Configurable<int> qvecDetector{"qvecDetector", 3, "Detector for Q vector estimation (FV0A: 0, FT0M: 1, FT0A: 2, FT0C: 3, TPC Pos: 4, TPC Neg: 5, TPC Tot: 6)"};
85105
Configurable<int> centEstimator{"centEstimator", 2, "Centrality estimation (FT0A: 1, FT0C: 2, FT0M: 3, FV0A: 4)"};
@@ -88,6 +108,9 @@ struct HfTaskFlowCharmHadrons {
88108
Configurable<float> centralityMax{"centralityMax", 100., "Maximum centrality accepted in SP/EP computation (not applied in resolution process)"};
89109
Configurable<bool> storeEP{"storeEP", false, "Flag to store EP-related axis"};
90110
Configurable<bool> storeMl{"storeMl", false, "Flag to store ML scores"};
111+
Configurable<bool> fillMassPtMlTree{"fillMassPtMlTree", false, "Flag to fill mass and pt tree"};
112+
Configurable<float> downSampleFactor{"downSampleFactor", 1., "Fraction of candidates to keep in TTree"};
113+
Configurable<float> ptDownSampleMax{"ptDownSampleMax", 10., "Maximum pt for the application of the downsampling factor"};
91114
Configurable<bool> storeResoOccu{"storeResoOccu", false, "Flag to store Occupancy in resolution ThnSparse"};
92115
Configurable<bool> storeEpCosSin{"storeEpCosSin", false, "Flag to store cos and sin of EP angle in ThnSparse"};
93116
Configurable<int> occEstimator{"occEstimator", 0, "Occupancy estimation (0: None, 1: ITS, 2: FT0C)"};
@@ -274,6 +297,20 @@ struct HfTaskFlowCharmHadrons {
274297
}
275298
}; // end init
276299

300+
/// Fill the mass, pt and ML scores of a candidate
301+
/// \param mass is the candidate mass
302+
/// \param pt is the candidate transverse momentum
303+
/// \param mlscore0 is the first ML score
304+
/// \param mlscore1 is the second ML score
305+
void fillMassPt(const float mass, const float pt, const float mlscore0, const float mlscore1)
306+
{
307+
rowCandidateMassPtMlScores(
308+
mass,
309+
pt,
310+
mlscore0,
311+
mlscore1);
312+
}
313+
277314
/// Compute the Q vector for the candidate's tracks
278315
/// \param cand is the candidate
279316
/// \param tracksQx is the X component of the Q vector for the tracks
@@ -651,7 +688,17 @@ struct HfTaskFlowCharmHadrons {
651688
float scalprodCand = cosNPhi * xQVec + sinNPhi * yQVec;
652689
float cosDeltaPhi = std::cos(harmonic * (phiCand - evtPl));
653690

654-
fillThn(massCand, ptCand, cent, cosNPhi, sinNPhi, cosDeltaPhi, scalprodCand, outputMl, occupancy, hfevflag);
691+
if (fillMassPtMlTree && storeMl) {
692+
if (downSampleFactor < 1.) {
693+
float pseudoRndm = ptCand * 1000. - static_cast<int64_t>(ptCand * 1000);
694+
if (ptCand < ptDownSampleMax && pseudoRndm >= downSampleFactor) {
695+
continue;
696+
}
697+
}
698+
fillMassPt(massCand, ptCand, outputMl[0], outputMl[1]);
699+
} else {
700+
fillThn(massCand, ptCand, cent, cosNPhi, sinNPhi, cosDeltaPhi, scalprodCand, outputMl, occupancy, hfevflag);
701+
}
655702
}
656703
}
657704

0 commit comments

Comments
 (0)