From 2b62a133921de5cc89f43ba3c6442415fd7c0491 Mon Sep 17 00:00:00 2001 From: Luca Barioglio Date: Fri, 8 Oct 2021 15:21:17 +0200 Subject: [PATCH] Add labelled array --- .../femtoDreamPairTaskTrackTrack.cxx | 56 ++++++++++--------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/PWGCF/FemtoDream/femtoDreamPairTaskTrackTrack.cxx b/PWGCF/FemtoDream/femtoDreamPairTaskTrackTrack.cxx index b77ece52474..6b9ae0b3f38 100644 --- a/PWGCF/FemtoDream/femtoDreamPairTaskTrackTrack.cxx +++ b/PWGCF/FemtoDream/femtoDreamPairTaskTrackTrack.cxx @@ -27,6 +27,17 @@ using namespace o2::analysis::femtoDream; using namespace o2::framework; using namespace o2::framework::expressions; +namespace +{ +static constexpr int nPart = 2; +static constexpr int nCuts = 5; +static const std::vector partNames{"PartOne", "PartTwo"}; +static const std::vector cutNames{"MinPt", "MaxPt", "MaxEta", "MaxDCAxy", "PIDthr"}; +static const float cutsTable[nPart][nCuts]{ + {0.4f, 4.05f, 0.4f, 0.1f, 0.75f}, + {0.4f, 4.05f, 0.4f, 0.1f, 0.75f}}; +} // namespace + struct femtoDreamPairTaskTrackTrack { /// Particle selection part @@ -34,24 +45,22 @@ struct femtoDreamPairTaskTrackTrack { // \todo checky why is the enum not working in the partition uint8_t Track = 0; // Track + /// Table for both particles + Configurable> cfgCutTable{"cfgCutTable", {cutsTable[0], nPart, nCuts, partNames, cutNames}, "Particle selections"}; + /// Particle 1 Configurable ConfPDGCodePartOne{"ConfPDGCodePartOne", 2212, "Particle 1 - PDG code"}; - Configurable ConfCutPartOne{"ConfCutPartOne", 1040230, "Particle 1 - Selection bit"}; - Configurable ConfPtMinPartOne{"ConfPtMinPartOne", 0.4f, "Particle 1 - min. pT selection (GeV/c)"}; - Configurable ConfPtMaxPartOne{"ConfPtMaxPartOne", 4.05f, "Particle 1 - max. pT selection (GeV/c)"}; - Configurable ConfEtaMaxPartOne{"ConfEtaMaxPartOne", 0.8f, "Particle 1 - max. eta selection"}; - Configurable ConfDCAxyMaxPartOne{"ConfDCAxyMaxPartOne", 0.1f, "Particle 1 - max. DCA_xy selection (cm)"}; - Configurable ConfPIDThreshPartOne{"ConfPIDThreshPartOne", 0.75f, "Particle 1 - TPC / TPC+TOF PID momentum threshold"}; + Configurable ConfCutPartOne{"ConfCutPartOne", 693386, "Particle 1 - Selection bit"}; Configurable> ConfTPCPIDPartOne{"ConfTPCPIDPartOne", std::vector{13}, "Particle 1 - TPC PID bits"}; // we also need the possibility to specify whether the bit is true/false ->std>>vector> Configurable> ConfCombPIDPartOne{"ConfCombPIDPartOne", std::vector{12}, "Particle 1 - Combined PID bits"}; // we also need the possibility to specify whether the bit is true/false ->std>>vector> /// Partition for particle 1 Partition partsOne = (aod::femtodreamparticle::partType == Track) && - ((aod::femtodreamparticle::cut & ConfCutPartOne) == ConfCutPartOne) && // not working, need for bit-mask - (aod::femtodreamparticle::pt > ConfPtMinPartOne) && - (aod::femtodreamparticle::pt < ConfPtMaxPartOne) && - (nabs(aod::femtodreamparticle::tempFitVar) < ConfDCAxyMaxPartOne) && - (nabs(aod::femtodreamparticle::eta) < ConfEtaMaxPartOne); + ((aod::femtodreamparticle::cut & ConfCutPartOne) == ConfCutPartOne) && + (aod::femtodreamparticle::pt > cfgCutTable->get("PartOne", "MinPt")) && + (aod::femtodreamparticle::pt < cfgCutTable->get("PartOne", "MaxPt")) && + (nabs(aod::femtodreamparticle::tempFitVar) < cfgCutTable->get("PartOne", "MaxDCAxy")) && + (nabs(aod::femtodreamparticle::eta) < cfgCutTable->get("PartOne", "MaxEta")); /// Histogramming for particle 1 FemtoDreamParticleHisto trackHistoPartOne; @@ -59,22 +68,17 @@ struct femtoDreamPairTaskTrackTrack { /// Particle 2 Configurable ConfIsSame{"ConfIsSame", false, "Pairs of the same particle"}; Configurable ConfPDGCodePartTwo{"ConfPDGCodePartTwo", 2212, "Particle 2 - PDG code"}; - Configurable ConfCutPartTwo{"ConfCutPartTwo", 1040230, "Particle 2 - Selection bit"}; - Configurable ConfPtMinPartTwo{"ConfPtMinPartTwo", 0.4f, "Particle 2 - min. pT selection (GeV/c)"}; - Configurable ConfPtMaxPartTwo{"ConfPtMaxPartTwo", 4.05f, "Particle 2 - max. pT selection (GeV/c)"}; - Configurable ConfEtaMaxPartTwo{"ConfEtaMaxPartTwo", 0.8f, "Particle 2 - max. eta selection"}; - Configurable ConfDCAxyMaxPartTwo{"ConfDCAxyMaxPartTwo", 0.1f, "Particle 2 - max. DCA_xy selection (cm)"}; - Configurable ConfPIDThreshPartTwo{"ConfPIDThreshPartTwo", 0.75f, "Particle 2 - TPC / TPC+TOF PID momentum threshold"}; + Configurable ConfCutPartTwo{"ConfCutPartTwo", 693386, "Particle 2 - Selection bit"}; Configurable> ConfTPCPIDPartTwo{"ConfTPCPIDPartTwo", std::vector{13}, "Particle 2 - TPC PID bits"}; // we also need the possibility to specify whether the bit is true/false ->std>>vector> Configurable> ConfCombPIDPartTwo{"ConfCombPIDPartTwo", std::vector{12}, "Particle 2 - Combined PID bits"}; // we also need the possibility to specify whether the bit is true/false ->std>>vector> /// Partition for particle 2 Partition partsTwo = (aod::femtodreamparticle::partType == Track) && - ((aod::femtodreamparticle::cut & ConfCutPartTwo) == ConfCutPartTwo) && // not working, need for bit-mask - (aod::femtodreamparticle::pt > ConfPtMinPartTwo) && - (aod::femtodreamparticle::pt < ConfPtMaxPartTwo) && - (nabs(aod::femtodreamparticle::tempFitVar) < ConfDCAxyMaxPartTwo) && - (nabs(aod::femtodreamparticle::eta) < ConfEtaMaxPartTwo); + ((aod::femtodreamparticle::cut & ConfCutPartTwo) == ConfCutPartTwo) && + (aod::femtodreamparticle::pt > cfgCutTable->get("PartTwo", "MinPt")) && + (aod::femtodreamparticle::pt < cfgCutTable->get("PartTwo", "MaxPt")) && + (nabs(aod::femtodreamparticle::tempFitVar) < cfgCutTable->get("PartTwo", "MaxDCAxy")) && + (nabs(aod::femtodreamparticle::eta) < cfgCutTable->get("PartTwo", "MaxEta")); /// Histogramming for particle 2 FemtoDreamParticleHisto trackHistoPartTwo; @@ -161,14 +165,14 @@ struct femtoDreamPairTaskTrackTrack { const int multCol = col.multV0M(); /// Histogramming same event for (auto& part : partsOne) { - if (!isFullPIDSelected(part.pidcut(), part.p(), ConfPIDThreshPartOne, vecTPCPIDPartOne, vecCombPIDPartOne)) { + if (!isFullPIDSelected(part.pidcut(), part.p(), cfgCutTable->get("PartOne", "PIDthr"), vecTPCPIDPartOne, vecCombPIDPartOne)) { continue; } trackHistoPartOne.fillQA(part); } if (!ConfIsSame) { for (auto& part : partsTwo) { - if (!isFullPIDSelected(part.pidcut(), part.p(), ConfPIDThreshPartTwo, vecTPCPIDPartTwo, vecCombPIDPartTwo)) { + if (!isFullPIDSelected(part.pidcut(), part.p(), cfgCutTable->get("PartTwo", "PIDthr"), vecTPCPIDPartTwo, vecCombPIDPartTwo)) { continue; } trackHistoPartTwo.fillQA(part); @@ -176,7 +180,7 @@ struct femtoDreamPairTaskTrackTrack { } /// Now build the combinations for (auto& [p1, p2] : combinations(partsOne, partsTwo)) { - if (!isFullPIDSelected(p1.pidcut(), p1.p(), ConfPIDThreshPartOne, vecTPCPIDPartOne, vecCombPIDPartOne) || !isFullPIDSelected(p2.pidcut(), p2.p(), ConfPIDThreshPartTwo, vecTPCPIDPartTwo, vecCombPIDPartTwo)) { + if (!isFullPIDSelected(p1.pidcut(), p1.p(), cfgCutTable->get("PartOne", "PIDthr"), vecTPCPIDPartOne, vecCombPIDPartOne) || !isFullPIDSelected(p2.pidcut(), p2.p(), cfgCutTable->get("PartTwo", "PIDthr"), vecTPCPIDPartTwo, vecCombPIDPartTwo)) { continue; } @@ -241,7 +245,7 @@ struct femtoDreamPairTaskTrackTrack { // if (partsOne.size() == 0 || nPart2Evt1 == 0 || nPart1Evt2 == 0 || partsTwo.size() == 0 ) continue; for (auto& [p1, p2] : combinations(partsOne, partsTwo)) { - if (!isFullPIDSelected(p1.pidcut(), p1.p(), ConfPIDThreshPartOne, vecTPCPIDPartOne, vecCombPIDPartOne) || !isFullPIDSelected(p2.pidcut(), p2.p(), ConfPIDThreshPartTwo, vecTPCPIDPartTwo, vecCombPIDPartTwo)) { + if (!isFullPIDSelected(p1.pidcut(), p1.p(), cfgCutTable->get("PartOne", "PIDthr"), vecTPCPIDPartOne, vecCombPIDPartOne) || !isFullPIDSelected(p2.pidcut(), p2.p(), cfgCutTable->get("PartTwo", "PIDthr"), vecTPCPIDPartTwo, vecCombPIDPartTwo)) { continue; } mixedEventCont.setPair(p1, p2, collision1.multV0M()); // < \todo dirty trick, the multiplicity will be of course within the bin width used for the hashes