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
82 changes: 75 additions & 7 deletions PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
Expand Down Expand Up @@ -46,7 +46,10 @@
D0ToPiK,
D0ToKPi,
LcToPKPi,
LcToPiKP };
LcToPiKP,
XicToPKPi,
XicToPiKP
};

enum QvecEstimator { FV0A = 0,
FT0M,
Expand All @@ -66,15 +69,17 @@
Configurable<bool> storeEP{"storeEP", false, "Flag to store EP-related axis"};
Configurable<bool> storeMl{"storeMl", false, "Flag to store ML scores"};
Configurable<bool> storeResoOccu{"storeResoOccu", false, "Flag to store Occupancy in resolution ThnSparse"};
Configurable<bool> storeEpCosSin{"storeEpCosSin", false, "Flag to store cos and sin of EP angle in ThnSparse"};
Configurable<int> occEstimator{"occEstimator", 0, "Occupancy estimation (0: None, 1: ITS, 2: FT0C)"};
Configurable<bool> saveEpResoHisto{"saveEpResoHisto", false, "Flag to save event plane resolution histogram"};
Configurable<std::string> ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Configurable<std::vector<int>> classMl{"classMl", {0, 2}, "Indexes of BDT scores to be stored. Two indexes max."};

ConfigurableAxis thnConfigAxisInvMass{"thnConfigAxisInvMass", {100, 1.78, 2.05}, ""};

Check warning on line 78 in PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

HfTaskFlowCharmHadrons: ConfigurableAxis appears too early (before end of Partition<).
ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {10, 0., 10.}, ""};
ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {10000, 0., 100.}, ""};
ConfigurableAxis thnConfigAxisCosNPhi{"thnConfigAxisCosNPhi", {100, -1., 1.}, ""};
ConfigurableAxis thnConfigAxisPsi{"thnConfigAxisPsi", {6000, 2. * TMath::Pi(), 2. * TMath::Pi()}, ""};

Check warning on line 82 in PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

Use multiples/fractions of PI defined in o2::constants::math.

Check warning on line 82 in PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
ConfigurableAxis thnConfigAxisCosDeltaPhi{"thnConfigAxisCosDeltaPhi", {100, -1., 1.}, ""};
ConfigurableAxis thnConfigAxisScalarProd{"thnConfigAxisScalarProd", {100, 0., 1.}, ""};
ConfigurableAxis thnConfigAxisMlOne{"thnConfigAxisMlOne", {1000, 0., 1.}, ""};
Expand All @@ -90,12 +95,14 @@
ConfigurableAxis thnConfigAxisResoFT0cTPCtot{"thnConfigAxisResoFT0cTPCtot", {160, -8, 8}, ""};
ConfigurableAxis thnConfigAxisResoFV0aTPCtot{"thnConfigAxisResoFV0aTPCtot", {160, -8, 8}, ""};

using CandDsDataWMl = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelDsToKKPi, aod::HfMlDsToKKPi>>;

Check warning on line 98 in PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

HfTaskFlowCharmHadrons: using appears too early (before end of SliceCache).
using CandDsData = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelDsToKKPi>>;
using CandDplusDataWMl = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelDplusToPiKPi, aod::HfMlDplusToPiKPi>>;
using CandDplusData = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelDplusToPiKPi>>;
using CandLcData = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelLc>>;
using CandLcDataWMl = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelLc, aod::HfMlLcToPKPi>>;
using CandXicData = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelXicToPKPi>>;
using CandXicDataWMl = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelXicToPKPi, aod::HfMlXicToPKPi>>;
using CandD0DataWMl = soa::Filtered<soa::Join<aod::HfCand2Prong, aod::HfSelD0, aod::HfMlD0>>;
using CandD0Data = soa::Filtered<soa::Join<aod::HfCand2Prong, aod::HfSelD0>>;
using CollsWithQvecs = soa::Join<aod::Collisions, aod::EvSels, aod::QvectorFT0Cs, aod::QvectorFT0As, aod::QvectorFT0Ms, aod::QvectorFV0As, aod::QvectorBPoss, aod::QvectorBNegs, aod::QvectorBTots, aod::CentFV0As, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs>;
Expand All @@ -104,6 +111,7 @@
Filter filterSelectDplusCandidates = aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlag;
Filter filterSelectD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlag || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlag;
Filter filterSelectLcCandidates = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlag || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlag;
Filter filterSelectXicCandidates = aod::hf_sel_candidate_xic::isSelXicToPKPi >= selectionFlag || aod::hf_sel_candidate_xic::isSelXicToPiKP >= selectionFlag;

Partition<CandDsData> selectedDsToKKPi = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag;
Partition<CandDsData> selectedDsToPiKK = aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag;
Expand All @@ -117,8 +125,12 @@
Partition<CandLcData> selectedLcToPiKP = aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlag;
Partition<CandLcDataWMl> selectedLcToPKPiWMl = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlag;
Partition<CandLcDataWMl> selectedLcToPiKPWMl = aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlag;
Partition<CandXicData> selectedXicToPKPi = aod::hf_sel_candidate_xic::isSelXicToPKPi >= selectionFlag;
Partition<CandXicData> selectedXicToPiKP = aod::hf_sel_candidate_xic::isSelXicToPiKP >= selectionFlag;
Partition<CandXicDataWMl> selectedXicToPKPiWMl = aod::hf_sel_candidate_xic::isSelXicToPKPi >= selectionFlag;
Partition<CandXicDataWMl> selectedXicToPiKPWMl = aod::hf_sel_candidate_xic::isSelXicToPiKP >= selectionFlag;

SliceCache cache;

Check warning on line 133 in PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

HfTaskFlowCharmHadrons: SliceCache appears too early (before end of HfHelper).
HfHelper hfHelper;
EventPlaneHelper epHelper;
HfEventSelection hfEvSel; // event selection and monitoring
Expand All @@ -135,6 +147,8 @@
const AxisSpec thnAxisPt{thnConfigAxisPt, "#it{p}_{T} (GeV/#it{c})"};
const AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality"};
const AxisSpec thnAxisCosNPhi{thnConfigAxisCosNPhi, Form("cos(%d#varphi)", harmonic.value)};
const AxisSpec thnAxisSinNPhi{thnConfigAxisCosNPhi, Form("sin(%d#varphi)", harmonic.value)};
const AxisSpec thnAxisPsi{thnConfigAxisPsi, Form("#Psi_{%d}", harmonic.value)};
const AxisSpec thnAxisCosDeltaPhi{thnConfigAxisCosDeltaPhi, Form("cos(%d(#varphi - #Psi_{sub}))", harmonic.value)};
const AxisSpec thnAxisScalarProd{thnConfigAxisScalarProd, "SP"};
const AxisSpec thnAxisMlOne{thnConfigAxisMlOne, "Bkg score"};
Expand All @@ -153,7 +167,7 @@

std::vector<AxisSpec> axes = {thnAxisInvMass, thnAxisPt, thnAxisCent, thnAxisScalarProd};
if (storeEP) {
axes.insert(axes.end(), {thnAxisCosNPhi, thnAxisCosDeltaPhi});
axes.insert(axes.end(), {thnAxisCosNPhi, thnAxisSinNPhi, thnAxisCosDeltaPhi});
}
if (storeMl) {
axes.insert(axes.end(), {thnAxisMlOne, thnAxisMlTwo});
Expand All @@ -173,6 +187,10 @@
registry.add("trackOccVsFT0COcc", "trackOccVsFT0COcc; trackOcc; FT0COcc", {HistType::kTH2F, {thnAxisOccupancyITS, thnAxisOccupancyFT0C}});
}

if (storeEpCosSin) {
registry.add("ep/hSparseEp", "THn for Event Plane distirbution", {HistType::kTHnSparseF, {thnAxisCent, thnAxisPsi, thnAxisCosNPhi, thnAxisSinNPhi}});
}

if (doprocessResolution) { // enable resolution histograms only for resolution process
registry.add("spReso/hSpResoFT0cFT0a", "hSpResoFT0cFT0a; centrality; Q_{FT0c} #bullet Q_{FT0a}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}});
registry.add("spReso/hSpResoFT0cFV0a", "hSpResoFT0cFV0a; centrality; Q_{FT0c} #bullet Q_{FV0a}", {HistType::kTH2F, {thnAxisCent, thnAxisScalarProd}});
Expand Down Expand Up @@ -213,7 +231,7 @@
}

if (storeResoOccu) {
std::vector<AxisSpec> axes_reso = {thnAxisCent, thnAxisResoFT0cFV0a, thnAxisResoFT0cTPCtot, thnAxisResoFV0aTPCtot};

Check warning on line 234 in PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

Use lowerCamelCase for names of functions and variables.
if (occEstimator == 1) {
axes_reso.insert(axes_reso.end(), {thnAxisOccupancyITS, thnAxisNoSameBunchPileup, thnAxisOccupancy,
thnAxisNoCollInTimeRangeNarrow, thnAxisNoCollInTimeRangeStandard, thnAxisNoCollInRofStandard});
Expand Down Expand Up @@ -276,9 +294,9 @@
float deltaPsi = psi1 - psi2;
if (std::abs(deltaPsi) > constants::math::PI / harmonic) {
if (deltaPsi > 0.)
deltaPsi -= constants::math::TwoPI / harmonic;

Check warning on line 297 in PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

Use RecoDecay::constrainAngle to restrict angle to a given range.
else
deltaPsi += constants::math::TwoPI / harmonic;

Check warning on line 299 in PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

Use RecoDecay::constrainAngle to restrict angle to a given range.
}
return deltaPsi;
}
Expand All @@ -300,6 +318,7 @@
/// \param pt is the transverse momentum of the candidate
/// \param cent is the centrality of the collision
/// \param cosNPhi is the cosine of the n*phi angle
/// \param sinNPhi is the sine of the n*phi angle
/// \param cosDeltaPhi is the cosine of the n*(phi - evtPl) angle
/// \param sp is the scalar product
/// \param outputMl are the ML scores
Expand All @@ -309,6 +328,7 @@
float& pt,
float& cent,
float& cosNPhi,
float& sinNPhi,
float& cosDeltaPhi,
float& sp,
std::vector<float>& outputMl,
Expand All @@ -319,15 +339,15 @@
std::vector<int> evtSelFlags = getEventSelectionFlags(hfevselflag);
if (storeMl) {
if (storeEP) {
registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp, cosNPhi, cosDeltaPhi, outputMl[0], outputMl[1], occupancy,
registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp, cosNPhi, sinNPhi, cosDeltaPhi, outputMl[0], outputMl[1], occupancy,
evtSelFlags[0], evtSelFlags[1], evtSelFlags[2], evtSelFlags[3], evtSelFlags[4]);
} else {
registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp, outputMl[0], outputMl[1], occupancy,
evtSelFlags[0], evtSelFlags[1], evtSelFlags[2], evtSelFlags[3], evtSelFlags[4]);
}
} else {
if (storeEP) {
registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp, cosNPhi, cosDeltaPhi, occupancy,
registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp, cosNPhi, sinNPhi, cosDeltaPhi, occupancy,
evtSelFlags[0], evtSelFlags[1], evtSelFlags[2], evtSelFlags[3], evtSelFlags[4]);
} else {
registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp, occupancy,
Expand All @@ -337,13 +357,13 @@
} else {
if (storeMl) {
if (storeEP) {
registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp, cosNPhi, cosDeltaPhi, outputMl[0], outputMl[1]);
registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp, cosNPhi, sinNPhi, cosDeltaPhi, outputMl[0], outputMl[1]);
} else {
registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp, outputMl[0], outputMl[1]);
}
} else {
if (storeEP) {
registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp, cosNPhi, cosDeltaPhi);
registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp, cosNPhi, sinNPhi, cosDeltaPhi);
} else {
registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp);
}
Expand Down Expand Up @@ -513,6 +533,25 @@
default:
break;
}
} else if constexpr (std::is_same_v<T1, CandXicData> || std::is_same_v<T1, CandXicDataWMl>) {
switch (channel) {
case DecayChannel::XicToPKPi:
massCand = hfHelper.invMassXicToPKPi(candidate);
if constexpr (std::is_same_v<T1, CandXicDataWMl>) {
for (unsigned int iclass = 0; iclass < classMl->size(); iclass++)
outputMl[iclass] = candidate.mlProbXicToPKPi()[classMl->at(iclass)];
}
break;
case DecayChannel::XicToPiKP:
massCand = hfHelper.invMassXicToPiKP(candidate);
if constexpr (std::is_same_v<T1, CandXicDataWMl>) {
for (unsigned int iclass = 0; iclass < classMl->size(); iclass++)
outputMl[iclass] = candidate.mlProbXicToPiKP()[classMl->at(iclass)];
}
break;
default:
break;
}
}

float ptCand = candidate.pt();
Expand All @@ -536,7 +575,7 @@
float scalprodCand = cosNPhi * xQVec + sinNPhi * yQVec;
float cosDeltaPhi = std::cos(harmonic * (phiCand - evtPl));

fillThn(massCand, ptCand, cent, cosNPhi, cosDeltaPhi, scalprodCand, outputMl, occupancy, hfevflag);
fillThn(massCand, ptCand, cent, cosNPhi, sinNPhi, cosDeltaPhi, scalprodCand, outputMl, occupancy, hfevflag);
}
}

Expand Down Expand Up @@ -622,6 +661,28 @@
}
PROCESS_SWITCH(HfTaskFlowCharmHadrons, processLc, "Process Lc candidates", false);

// Xic with ML
void processXicMl(CollsWithQvecs::iterator const& collision,
CandXicDataWMl const&)
{
auto candsXicToPKPiWMl = selectedXicToPKPiWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache);
auto candsXicToPiKPWMl = selectedXicToPiKPWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache);
runFlowAnalysis<DecayChannel::XicToPKPi>(collision, candsXicToPKPiWMl);
runFlowAnalysis<DecayChannel::XicToPiKP>(collision, candsXicToPiKPWMl);
}
PROCESS_SWITCH(HfTaskFlowCharmHadrons, processXicMl, "Process Xic candidates with ML", false);

// Xic with rectangular cuts
void processXic(CollsWithQvecs::iterator const& collision,
CandXicData const&)
{
auto candsXicToPKPi = selectedXicToPKPi->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache);
auto candsXicToPiKP = selectedXicToPiKP->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache);
runFlowAnalysis<DecayChannel::XicToPKPi>(collision, candsXicToPKPi);
runFlowAnalysis<DecayChannel::XicToPiKP>(collision, candsXicToPiKP);
}
PROCESS_SWITCH(HfTaskFlowCharmHadrons, processXic, "Process Xic candidates", false);

// Resolution
void processResolution(CollsWithQvecs::iterator const& collision,
aod::BCsWithTimestamps const& bcs)
Expand Down Expand Up @@ -705,6 +766,13 @@
registry.fill(HIST("epReso/hEpResoFV0aTPCtot"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFV0a, epBTots)));
registry.fill(HIST("epReso/hEpResoTPCposTPCneg"), centrality, std::cos(harmonic * getDeltaPsiInRange(epBPoss, epBNegs)));
}

if (storeEpCosSin) {
registry.fill(HIST("ep/hSparseEp"), centrality,
epHelper.GetEventPlane(xQVecFT0c, yQVecFT0c, harmonic),
std::cos(harmonic * epHelper.GetEventPlane(xQVecFT0c, yQVecFT0c, harmonic)),
std::sin(harmonic * epHelper.GetEventPlane(xQVecFT0c, yQVecFT0c, harmonic)));
}
}
PROCESS_SWITCH(HfTaskFlowCharmHadrons, processResolution, "Process resolution", false);

Expand Down
Loading