Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 25 additions & 21 deletions PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,24 @@ namespace full
{
DECLARE_SOA_COLUMN(M, m, float); //! Invariant mass of candidate (GeV/c2)
DECLARE_SOA_COLUMN(Pt, pt, float); //! Transverse momentum of candidate (GeV/c)
// ML scores
DECLARE_SOA_COLUMN(MlScore0, mlScore0, float); //! ML score of the first configured index
DECLARE_SOA_COLUMN(MlScore1, mlScore1, float); //! ML score of the second configured index
DECLARE_SOA_COLUMN(ScalarProd, scalarProd, float); //! Scalar product
DECLARE_SOA_COLUMN(Cent, cent, float); //! Centrality
} // namespace full
DECLARE_SOA_TABLE(HfCandPtCent, "AOD", "HFCANDPTCENT",
DECLARE_SOA_TABLE(HfCandMPtInfos, "AOD", "HFCANDMPTINFO",
full::M,
full::Pt,
full::MlScore0,
full::MlScore1);

DECLARE_SOA_TABLE(HfCandFlowInfos, "AOD", "HFCANDFLOWINFO",
full::M,
full::Pt,
full::MlScore0,
full::MlScore1,
full::ScalarProd,
full::Cent);
} // namespace o2::aod

enum DecayChannel { DplusToPiKPi = 0,
Expand All @@ -98,7 +107,8 @@ enum QvecEstimator { FV0A = 0,
TPCTot };

struct HfTaskFlowCharmHadrons {
Produces<o2::aod::HfCandPtCent> rowCandidateMassPtMlScores;
Produces<o2::aod::HfCandMPtInfos> rowCandMassPtMl;
Produces<o2::aod::HfCandFlowInfos> rowCandMassPtMlSpCent;

Configurable<int> harmonic{"harmonic", 2, "harmonic number"};
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)"};
Expand All @@ -108,7 +118,9 @@ struct HfTaskFlowCharmHadrons {
Configurable<float> centralityMax{"centralityMax", 100., "Maximum centrality accepted in SP/EP computation (not applied in resolution process)"};
Configurable<bool> storeEP{"storeEP", false, "Flag to store EP-related axis"};
Configurable<bool> storeMl{"storeMl", false, "Flag to store ML scores"};
Configurable<bool> fillMassPtMlTree{"fillMassPtMlTree", false, "Flag to fill mass and pt tree"};
Configurable<bool> fillMassPtMlTree{"fillMassPtMlTree", false, "Flag to fill mass, pt and ML scores tree"};
Configurable<bool> fillMassPtMlSpCentTree{"fillMassPtMlSpCentTree", false, "Flag to fill mass, pt, ML scores, SP and centrality tree"};
Configurable<bool> fillSparse{"fillSparse", true, "Flag to fill sparse"};
Configurable<float> downSampleFactor{"downSampleFactor", 1., "Fraction of candidates to keep in TTree"};
Configurable<float> ptDownSampleMax{"ptDownSampleMax", 10., "Maximum pt for the application of the downsampling factor"};
Configurable<bool> storeResoOccu{"storeResoOccu", false, "Flag to store Occupancy in resolution ThnSparse"};
Expand Down Expand Up @@ -297,20 +309,6 @@ struct HfTaskFlowCharmHadrons {
}
}; // end init

/// Fill the mass, pt and ML scores of a candidate
/// \param mass is the candidate mass
/// \param pt is the candidate transverse momentum
/// \param mlscore0 is the first ML score
/// \param mlscore1 is the second ML score
void fillMassPt(const float mass, const float pt, const float mlscore0, const float mlscore1)
{
rowCandidateMassPtMlScores(
mass,
pt,
mlscore0,
mlscore1);
}

/// Compute the Q vector for the candidate's tracks
/// \param cand is the candidate
/// \param tracksQx is the X component of the Q vector for the tracks
Expand Down Expand Up @@ -698,15 +696,21 @@ struct HfTaskFlowCharmHadrons {
float const scalprodCand = cosNPhi * xQVec + sinNPhi * yQVec;
float const cosDeltaPhi = std::cos(harmonic * (phiCand - evtPl));

if (fillMassPtMlTree && storeMl) {
if (fillMassPtMlTree || fillMassPtMlSpCentTree) {
if (downSampleFactor < 1.) {
float const pseudoRndm = ptCand * 1000. - static_cast<int64_t>(ptCand * 1000);
if (ptCand < ptDownSampleMax && pseudoRndm >= downSampleFactor) {
continue;
}
}
fillMassPt(massCand, ptCand, outputMl[0], outputMl[1]);
} else {
if (fillMassPtMlTree) {
rowCandMassPtMl(massCand, ptCand, outputMl[0], outputMl[1]);
}
if (fillMassPtMlSpCentTree) {
rowCandMassPtMlSpCent(massCand, ptCand, outputMl[0], outputMl[1], scalprodCand, cent);
}
}
if (fillSparse) {
fillThn(massCand, ptCand, cent, cosNPhi, sinNPhi, cosDeltaPhi, scalprodCand, outputMl, occupancy, hfevflag);
}
}
Expand Down
Loading