Skip to content

Commit 457ae60

Browse files
committed
fix comments from vit
1 parent 309a35b commit 457ae60

File tree

2 files changed

+70
-45
lines changed

2 files changed

+70
-45
lines changed

PWGHF/Core/SelectorCuts.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,20 @@ static const std::vector<std::string> labelsRowsPid = {"ProtonInLcToPKPi", "Prot
8484
namespace hf_presel_lightnuclei
8585
{
8686

87+
static constexpr int NParticleRows = 3; // number of particles / rows
88+
static constexpr int NVarCuts = 10; // number of cuts for each particles
89+
static constexpr int NBetheBlochParams = 6; // number of parameters for Bethe-Bloch
90+
8791
// default values for the track cuts for lightnuclei in the track-index-skim-creator
88-
constexpr float CutsTrackQuality[3][10] = {{-4, 3, 5., 0., 100, 100, 0.83, 160., 1., 5},
89-
{-4, 3, 5., 0., 100, 100, 0.83, 160., 1., 5},
90-
{-4, 3, 5., 0., 100, 100, 0.83, 160., 1., 5}};
92+
constexpr float CutsTrackQuality[NParticleRows][NVarCuts] = {{-4.f, 3.f, 5.f, 0.f, 100.f, 100.f, 0.83, 160.f, 1.f, 5.f},
93+
{-4.f, 3.f, 5.f, 0.f, 100.f, 100.f, 0.83, 160.f, 1.f, 5.f},
94+
{-4.f, 3.f, 5.f, 0.f, 100.f, 100.f, 0.83, 160.f, 1.f, 5.f}};
9195
static const std::vector<std::string> labelsCutsTrack = {"nSigmaMinIts", "minItsClusterSizes", "minItsCluster", "minItsIbCluster", "minTpcCluster", "minTpcRow", "minTpcCrossedOverFound", "maxTpcShared", "maxTpcFracShared", "maxTPCnSigmaBB"};
9296
static const std::vector<std::string> labelsRowsNucleiType = {"Deutron", "Triton", "Helium3"};
9397

94-
constexpr float BetheBlochParams[3][6] = {{5.39302, 7.859534, 0.004048, 2.323197, 1.609307, 0.09},
95-
{5.39302, 7.859534, 0.004048, 2.323197, 1.609307, 0.09},
96-
{-126.55736, -0.858569, 1.11164, 1.21032, 2.656374, 0.09}};
98+
constexpr float BetheBlochParams[NParticleRows][NBetheBlochParams] = {{5.39302, 7.859534, 0.004048, 2.323197, 1.609307, 0.09},
99+
{5.39302, 7.859534, 0.004048, 2.323197, 1.609307, 0.09},
100+
{-126.55736, -0.858569, 1.11164, 1.21032, 2.656374, 0.09}};
97101

98102
static const std::vector<std::string> labelsBetheBlochParams = {"p0", "p1", "p2", "p3", "p4", "resolution"};
99103

PWGHF/TableProducer/trackIndexSkimCreator.cxx

Lines changed: 60 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
#include "Common/DataModel/TrackSelectionTables.h"
4646
#include "Tools/ML/MlResponse.h"
4747

48-
#include "MathUtils/BetheBlochAleph.h"
4948
#include <CCDB/BasicCCDBManager.h> // for PV refit
5049
#include <CCDB/CcdbApi.h>
5150
#include <CommonConstants/PhysicsConstants.h>
@@ -66,6 +65,7 @@
6665
#include <Framework/InitContext.h>
6766
#include <Framework/Logger.h>
6867
#include <Framework/runDataProcessing.h>
68+
#include <MathUtils/BetheBlochAleph.h>
6969
#include <ReconstructionDataFormats/Track.h>
7070
#include <ReconstructionDataFormats/Vertex.h> // for PV refit
7171

@@ -1303,8 +1303,8 @@ struct HfTrackIndexSkimCreator {
13031303
Configurable<LabeledArray<double>> cutsDstarToD0Pi{"cutsDstarToD0Pi", {hf_cuts_presel_dstar::Cuts[0], hf_cuts_presel_dstar::NBinsPt, hf_cuts_presel_dstar::NCutVars, hf_cuts_presel_dstar::labelsPt, hf_cuts_presel_dstar::labelsCutVar}, "D*+->D0pi selections per pT bin"};
13041304

13051305
// CharmNuclei track selection
1306-
Configurable<LabeledArray<float>> selectionsLightNuclei{"selectionsLightNuclei", {hf_presel_lightnuclei::CutsTrackQuality[0], 3, 10, hf_presel_lightnuclei::labelsRowsNucleiType, hf_presel_lightnuclei::labelsCutsTrack}, "nuclei track selections for deuteron / triton / helium applied if proper process function enabled"};
1307-
Configurable<LabeledArray<float>> tpcPidBBParamsLightNuclei{"tpcPidBBParamsLightNuclei", {hf_presel_lightnuclei::BetheBlochParams[0], 3, 6, hf_presel_lightnuclei::labelsRowsNucleiType, hf_presel_lightnuclei::labelsBetheBlochParams},
1306+
Configurable<LabeledArray<float>> selectionsLightNuclei{"selectionsLightNuclei", {hf_presel_lightnuclei::CutsTrackQuality[0], hf_presel_lightnuclei::NParticleRows, hf_presel_lightnuclei::NVarCuts, hf_presel_lightnuclei::labelsRowsNucleiType, hf_presel_lightnuclei::labelsCutsTrack}, "nuclei track selections for deuteron / triton / helium applied if proper process function enabled"};
1307+
Configurable<LabeledArray<float>> tpcPidBBParamsLightNuclei{"tpcPidBBParamsLightNuclei", {hf_presel_lightnuclei::BetheBlochParams[0], hf_presel_lightnuclei::NParticleRows, hf_presel_lightnuclei::NBetheBlochParams, hf_presel_lightnuclei::labelsRowsNucleiType, hf_presel_lightnuclei::labelsBetheBlochParams},
13081308
"TPC PID Bethe–Bloch parameter configurations for light nuclei "
13091309
"(deuteron, triton, helium-3), used in BB-based PID when enabled"};
13101310

@@ -1676,71 +1676,67 @@ struct HfTrackIndexSkimCreator {
16761676
return false;
16771677
}
16781678

1679-
float nSigmaItsNuclei = -999.f;
1679+
float itsPidNsigma = -999.f;
16801680

16811681
switch (lightnuclei) {
16821682
case ChannelsNucleiQA::Deuteron:
1683-
nSigmaItsNuclei = track.itsNSigmaDe();
1683+
itsPidNsigma = track.itsNSigmaDe();
16841684
break;
16851685
case ChannelsNucleiQA::Triton:
1686-
nSigmaItsNuclei = track.itsNSigmaTr();
1686+
itsPidNsigma = track.itsNSigmaTr();
16871687
break;
16881688
case ChannelsNucleiQA::Helium3:
1689-
nSigmaItsNuclei = track.itsNSigmaHe();
1689+
itsPidNsigma = track.itsNSigmaHe();
16901690
break;
16911691
default:
1692-
return false;
1692+
LOG(fatal) << "Unhandled ChannelsNucleiQA " << static_cast<int>(lightnuclei);
16931693
}
16941694

16951695
// Load cuts for the selected species.
1696-
const float minItsNSigmaPid = config.selectionsLightNuclei->get(row, 0u);
1697-
const int minItsClusterSizes = config.selectionsLightNuclei->get(row, 1u);
1698-
const int minItsCluster = config.selectionsLightNuclei->get(row, 2u);
1699-
const int minItsIbCluster = config.selectionsLightNuclei->get(row, 3u);
1700-
const int minTpcCluster = config.selectionsLightNuclei->get(row, 4u);
1701-
const int minTpcRow = config.selectionsLightNuclei->get(row, 5u);
1702-
const float minTpcCrossedOverFound = config.selectionsLightNuclei->get(row, 6u);
1703-
const int maxTpcShared = config.selectionsLightNuclei->get(row, 7u);
1704-
const float maxTpcFracShared = config.selectionsLightNuclei->get(row, 8u);
1696+
const float itsPidNsigmaMin = config.selectionsLightNuclei->get(row, 0u);
1697+
const float itsClusterSizeMin = config.selectionsLightNuclei->get(row, 1u);
1698+
const float itsClusterMin = config.selectionsLightNuclei->get(row, 2u);
1699+
const float itsIbClusterMin = config.selectionsLightNuclei->get(row, 3u);
1700+
const float tpcClusterMin = config.selectionsLightNuclei->get(row, 4u);
1701+
const float tpcCrossedRowsMin = config.selectionsLightNuclei->get(row, 5u);
1702+
const float tpcCrossedRowsOverFindMin = config.selectionsLightNuclei->get(row, 6u);
1703+
const float tpcSharedMax = config.selectionsLightNuclei->get(row, 7u);
1704+
const float tpcFracSharedMax = config.selectionsLightNuclei->get(row, 8u);
17051705

17061706
// Optional: BB-based TPC nσ selection (only if enabled)
1707-
const float maxTPCnSigmaBB = config.selectionsLightNuclei->get(row, 9u);
1707+
const float tpcBbPidNsigmaMax = config.selectionsLightNuclei->get(row, 9u);
17081708

1709-
if (nSigmaItsNuclei < minItsNSigmaPid) {
1709+
if (itsPidNsigma < itsPidNsigmaMin) {
17101710
return false;
17111711
}
1712-
if (track.itsClusterSizes() < static_cast<unsigned int>(minItsClusterSizes)) {
1712+
if (track.itsClusterSizes() < static_cast<unsigned int>(itsClusterSizeMin)) {
17131713
return false;
17141714
}
1715-
if (track.itsNCls() < minItsCluster) {
1715+
if (track.itsNCls() < itsClusterMin) {
17161716
return false;
17171717
}
1718-
if (track.itsNClsInnerBarrel() < minItsIbCluster) {
1718+
if (track.itsNClsInnerBarrel() < itsIbClusterMin) {
17191719
return false;
17201720
}
1721-
if (track.tpcNClsFound() < minTpcCluster) {
1721+
if (track.tpcNClsFound() < tpcClusterMin) {
17221722
return false;
17231723
}
1724-
if (track.tpcNClsCrossedRows() < minTpcRow) {
1724+
if (track.tpcNClsCrossedRows() < tpcCrossedRowsMin) {
17251725
return false;
17261726
}
1727-
if (track.tpcCrossedRowsOverFindableCls() < minTpcCrossedOverFound) {
1727+
if (track.tpcCrossedRowsOverFindableCls() < tpcCrossedRowsOverFindMin) {
17281728
return false;
17291729
}
1730-
if (maxTpcShared >= 0 && track.tpcNClsShared() > maxTpcShared) {
1730+
if (track.tpcNClsShared() > tpcSharedMax) {
17311731
return false;
17321732
}
1733-
if (track.tpcFractionSharedCls() > maxTpcFracShared) {
1733+
if (track.tpcFractionSharedCls() > tpcFracSharedMax) {
17341734
return false;
17351735
}
17361736

17371737
if (config.applyLightNucleiTpcPidBasedOnBB) {
1738-
const float nSigmaTpcNuclei = getTPCnSigmaBB(track, lightnuclei);
1739-
if (nSigmaTpcNuclei < -999.f) { // invalid marker
1740-
return false;
1741-
}
1742-
// Correct inequality: reject if |nσ| exceeds allowed window
1743-
if (std::abs(nSigmaTpcNuclei) > maxTPCnSigmaBB) {
1738+
const float tpcBbPidNsigma = getTPCnSigmaBB(track, lightnuclei);
1739+
if (std::abs(tpcBbPidNsigma) > tpcBbPidNsigmaMax) {
17441740
return false;
17451741
}
17461742
}
@@ -1779,9 +1775,20 @@ struct HfTrackIndexSkimCreator {
17791775
}
17801776

17811777
// Mass/charge hypothesis for the selected nucleus.
1782-
const double mass =
1783-
(lightnuclei == ChannelsNucleiQA::Deuteron) ? MassDeuteron : (lightnuclei == ChannelsNucleiQA::Triton) ? MassTriton
1784-
: MassHelium3;
1778+
double mass = 0.;
1779+
switch (lightnuclei) {
1780+
case ChannelsNucleiQA::Deuteron:
1781+
mass = MassDeuteron;
1782+
break;
1783+
case ChannelsNucleiQA::Triton:
1784+
mass = MassTriton;
1785+
break;
1786+
case ChannelsNucleiQA::Helium3:
1787+
mass = MassHelium3;
1788+
break;
1789+
default:
1790+
LOG(fatal) << "Unhandled ChannelsNucleiQA " << static_cast<int>(lightnuclei);
1791+
}
17851792

17861793
const int charge = (lightnuclei == ChannelsNucleiQA::Helium3) ? 2 : 1;
17871794

@@ -1853,9 +1860,23 @@ struct HfTrackIndexSkimCreator {
18531860
iDecay3P == hf_cand_3prong::DecayType::CtToTrKPi ||
18541861
iDecay3P == hf_cand_3prong::DecayType::ChToHeKPi)) {
18551862

1856-
ChannelsNucleiQA nucleiType =
1857-
(iDecay3P == hf_cand_3prong::DecayType::CdToDeKPi) ? ChannelsNucleiQA::Deuteron : (iDecay3P == hf_cand_3prong::DecayType::CtToTrKPi) ? ChannelsNucleiQA::Triton
1858-
: ChannelsNucleiQA::Helium3;
1863+
ChannelsNucleiQA nucleiType;
1864+
1865+
switch (iDecay3P) {
1866+
case hf_cand_3prong::DecayType::CdToDeKPi:
1867+
nucleiType = ChannelsNucleiQA::Deuteron;
1868+
break;
1869+
case hf_cand_3prong::DecayType::CtToTrKPi:
1870+
nucleiType = ChannelsNucleiQA::Triton;
1871+
break;
1872+
case hf_cand_3prong::DecayType::ChToHeKPi:
1873+
nucleiType = ChannelsNucleiQA::Helium3;
1874+
break;
1875+
default:
1876+
LOG(fatal) << "Unhandled DecayType " << static_cast<int>(iDecay3P);
1877+
continue;
1878+
}
1879+
18591880
// hypo0: nucleus on track0
18601881
if (!applyTrackSelectionForCharmNuclei(track0, nucleiType)) {
18611882
CLRBIT(whichHypo[iDecay3P], 0);

0 commit comments

Comments
 (0)