Skip to content

Commit 8265260

Browse files
authored
Refactor SigmaCPr parameters and cleanup code
1 parent 6cfddc4 commit 8265260

File tree

1 file changed

+64
-61
lines changed

1 file changed

+64
-61
lines changed

EventFiltering/PWGHF/HFFilterHelpers.h

Lines changed: 64 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,9 @@ static const std::vector<std::string> labelsRowsCutsPt = {"Minimum", "Maximum"};
315315

316316
// PID cuts
317317
constexpr float cutsNsigma[4][9] = {
318-
{3., 3., 3., 5., 3., 3., 5., 3., 3.}, // TPC proton from Lc, pi/K from D0, K from 3-prong, femto selected proton, pi/K from Xic/Omegac, K from Xic*->SigmaC-Kaon, femto selected deuteron, K/p from beauty->JPsiX, proton from SigmaC-Pr correaltion
319-
{3., 3., 3., 2.5, 3., 3., 5., 3., 3.}, // TOF proton from Lc, pi/K from D0, K from 3-prong, femto selected proton, pi/K from Xic/Omegac, K from Xic*->SigmaC-Kaon, femto selected deuteron, K/p from beauty->JPsiX, proton from SigmaC-Pr correaltion
320-
{999., 999., 999., 2.5, 999., 999., 5., 999., 3.}, // Sum in quadrature of TPC and TOF (used only for femto selected proton and deuteron for pT < 4 GeV/c)
318+
{3., 3., 3., 5., 3., 3., 5., 3., 3.}, // TPC proton from Lc, pi/K from D0, K from 3-prong, femto selected proton, pi/K from Xic/Omegac, K from Xic*->SigmaC-Kaon, femto selected deuteron, K/p from beauty->JPsiX, proton from SigmaC-Pr correaltion
319+
{3., 3., 3., 2.5, 3., 3., 5., 3., 3.}, // TOF proton from Lc, pi/K from D0, K from 3-prong, femto selected proton, pi/K from Xic/Omegac, K from Xic*->SigmaC-Kaon, femto selected deuteron, K/p from beauty->JPsiX, proton from SigmaC-Pr correaltion
320+
{999., 999., 999., 2.5, 999., 999., 5., 999., 3.}, // Sum in quadrature of TPC and TOF (used only for femto selected proton and deuteron for pT < 4 GeV/c)
321321
{999., 999., 999., 999., 999., 999., -4., 999., 999.} // ITS used only for femto selected deuteron for less than pt threshold
322322
};
323323
static const std::vector<std::string> labelsColumnsNsigma = {"PrFromLc", "PiKaFromDZero", "KaFrom3Prong", "PrForFemto", "PiKaFromCharmBaryon", "SoftKaonFromXicResoToSigmaC", "DeForFemto", "KaPrFromBeautyToJPsi", "PrFromSigmaCPr"};
@@ -381,20 +381,20 @@ static const std::vector<std::string> labelsColumnsCascades = {"PtBachelor", "Pt
381381
constexpr float cutsCharmBaryons[1][15] = {{5., 5., 1000., 2.35, 2.60, 2.35, 3., 3., 2.7, -2., -2., 1.e6, 1.e6, -1., -1.}}; // MinPtXiPi, MinPtXiKa, MinPtXiPiPi, MinMassXiPi, MinMassXiKa, MinMassXiPiPi, MaxMassXiPi, MaxMassXiKa, MaxMassXiPiPi, CosPaXiBach, CosPaXiBachBach, Chi2PcaXiBach, Chi2PcaXiBachBach, DecLenXiBach, DecLenBachBach
382382
static const std::vector<std::string> labelsColumnsCharmBarCuts = {"MinPtXiPi", "MinPtXiKa", "MinPtXiPiPi", "MinMassXiPi", "MinMassXiKa", "MinMassXiPiPi", "MaxMassXiPi", "MaxMassXiKa", "MaxMassXiPiPi", "CosPaXiBach", "CosPaXiBachBach", "Chi2PcaXiBach", "Chi2PcaXiBachBach", "DecLenXiBach", "DecLenBachBach"};
383383

384-
// proton for SigmaC-pr trigger
385-
constexpr float cutsSigmaCPrDefault[4][1] = {
386-
{0.399}, // ptPrMin
387-
{4.501}, // ptPrMax
388-
{1}, // forceTOF (0=false, 1=true)
389-
{1.0} // ptTOFThreshold
384+
//proton for SigmaC-pr trigger
385+
constexpr float cutsSigmaCPrDefault[3][1] = {
386+
{0.399}, // ptPrMin
387+
{4.501}, // ptPrMax
388+
{1.0} // ptTOFThreshold
390389
};
391390
static const std::vector<std::string> labelsRowsSigmaCPr = {
392391
"ptPrMin",
393392
"ptPrMax",
394-
"forceTOF",
395-
"ptTOFThreshold"};
393+
"ptTOFThreshold"
394+
};
396395
static const std::vector<std::string> labelsColumnsSigmaCPr = {
397-
"SigmaCPr"};
396+
"SigmaCPr"
397+
};
398398

399399
constexpr int requireStrangenessTrackedXi[1][2] = {{1, 0}};
400400
static const std::vector<std::string> labelsColumnsCharmBaryons = {"CharmBarToXiBach", "CharmBarToXiBachBach"};
@@ -496,18 +496,18 @@ class HfFilterHelper
496496
mPtMinSigmaCPlusPlus = minPtSigmaCPlusPlus;
497497
mPtMinSigmaC2520PlusPlus = minPtSigmaC2520PlusPlus;
498498
}
499-
void setParSigmaCPr(float minDeltaMassSigmaC, float maxDeltaMassSigmaC, float minPtSigmaC, float minPtProton, float maxPtProton, bool forceTOF, float minPtForTOF)
499+
void setParSigmaCPr(float minDeltaMassSigmaC, float maxDeltaMassSigmaC, float minPtSigmaC, float minPtProton, float maxPtProton, float minPtForTOF, bool forceTOF)
500500
{
501-
minDeltaMassScSigmaCPr = minDeltaMassSigmaC;
502-
maxDeltaMassScSigmaCPr = maxDeltaMassSigmaC;
501+
mMinDeltaMassScSigmaCPr = minDeltaMassSigmaC;
502+
mMaxDeltaMassScSigmaCPr = maxDeltaMassSigmaC;
503503

504-
minPtScSigmaPr = minPtSigmaC;
504+
mMinPtScSigmaPr = minPtSigmaC;
505505

506-
minPtPrSigmaCPr = minPtProton;
507-
maxPtPrSigmaCPr = maxPtProton;
506+
mMinPtPrSigmaCPr = minPtProton;
507+
mMaxPtPrSigmaCPr = maxPtProton;
508508

509-
forceTOFForPrSigmaCPr = forceTOF;
510-
thresholdPtTOFForPrSigmaCPr = minPtForTOF;
509+
mForceTOFForPrSigmaCPr = forceTOF;
510+
mThresholdPtTOFForPrSigmaCPr = minPtForTOF;
511511
}
512512
void setPtRangeSoftKaonXicResoToSigmaC(float minPt, float maxPt)
513513
{
@@ -531,7 +531,7 @@ class HfFilterHelper
531531
}
532532

533533
void setNsigmaProtonCutsForFemto(std::array<float, 4> nSigmaCuts) { mNSigmaPrCutsForFemto = nSigmaCuts; }
534-
void setNsigmaDeuteronCutsForFemto(std::array<float, 4> nSigmaCuts) { mNSigmaDeCutsForFemto = nSigmaCuts; }
534+
void setNsigmaDeuteronCutsForFemto(std::array<float, 4> nSigmaCuts) { mNSigmaDeCutsForFemto = nSigmaCuts;}
535535
void setNsigmaProtonCutsForSigmaCPr(std::array<float, 4> nSigmaCuts) { mNSigmaPrCutsForSigmaCPr = nSigmaCuts; }
536536

537537
void setDeuteronTrackSelectionForFemto(float minTpcCluster, float minTpcRow, float minTpcCrossedOverFound, float maxTpcShared, float maxTpcFracShared, float minItsCluster, float minItsIbCluster)
@@ -839,14 +839,14 @@ class HfFilterHelper
839839
float mMaxTpcFracShared{1.}; // Maximum allowed fraction of shared TPC clusters relative to total clusters
840840
float mMinItsCluster{1.}; // Minimum required number of ITS clusters
841841
float mMinItsIbCluster{1.}; // Minimum required number of ITS clusters for IB
842-
// SigmaC–p (ScPr) trigger
843-
float minDeltaMassScSigmaCPr{0.15f}; // min Delta mass (SigmaC)
844-
float maxDeltaMassScSigmaCPr{0.19f}; // max Delta mass (SigmaC)
845-
float minPtScSigmaPr{4.99f}; // min pT(SigmaC)
846-
float minPtPrSigmaCPr{0.399f}; // min pT(proton)
847-
float maxPtPrSigmaCPr{4.501f}; // max pT(proton)
848-
bool forceTOFForPrSigmaCPr{true}; // force TOF for proton
849-
float thresholdPtTOFForPrSigmaCPr{1.0f}; // pT threshold above which TOF is required
842+
// SigmaC–p (ScPr) trigger
843+
float mMinDeltaMassScSigmaCPr{0.15f}; // min Delta mass (SigmaC) for SigmaC-Proton trigger
844+
float mMaxDeltaMassScSigmaCPr{0.19f}; // max Delta mass (SigmaC) for SigmaC-Proton trigger
845+
float mMinPtScSigmaPr{4.99f}; // min pT(SigmaC) for SigmaC-Proton trigger
846+
float mMinPtPrSigmaCPr{0.399f}; // min pT(proton) for SigmaC-Proton trigger
847+
float mMaxPtPrSigmaCPr{4.501f}; // max pT(proton) for SigmaC-Proton trigger
848+
bool mForceTOFForPrSigmaCPr{true}; // force TOF for protonfor SigmaC-Proton trigger
849+
float mThresholdPtTOFForPrSigmaCPr{1.0f}; // pT threshold above which TOF is required for SigmaC-Proton trigger
850850

851851
// PID recalibrations
852852
int mTpcPidCalibrationOption{0}; // Option for TPC PID calibration (0 -> AO2D, 1 -> postcalibrations, 2 -> alternative bethe bloch parametrisation)
@@ -1002,11 +1002,11 @@ inline bool HfFilterHelper::isSelectedTrack4Corr(const T1& track, const T2& trac
10021002
ptThresholdPidStrategy = mPtThresholdDeuteronForFemto;
10031003
break;
10041004
case kProtonForScPrCorr:
1005-
ptMin = minPtPrSigmaCPr;
1006-
ptMax = maxPtPrSigmaCPr;
1005+
ptMin = mMinPtPrSigmaCPr;
1006+
ptMax = mMaxPtPrSigmaCPr;
10071007
nSigmaCuts = mNSigmaPrCutsForSigmaCPr;
1008-
forceTof = forceTOFForPrSigmaCPr;
1009-
ptThresholdPidStrategy = thresholdPtTOFForPrSigmaCPr;
1008+
forceTof = mForceTOFForPrSigmaCPr;
1009+
ptThresholdPidStrategy = mThresholdPtTOFForPrSigmaCPr;
10101010
break;
10111011
default:
10121012
return false; // Unknown particle type
@@ -1385,29 +1385,30 @@ inline int8_t HfFilterHelper::isSelectedSigmaCInDeltaMassRange(const T& pTrackSa
13851385
} else if constexpr (charge == 2) {
13861386
isSigmaC2455 = (mDeltaMassMinSigmaCPlusPlus < deltaMassPKPi && deltaMassPKPi < mDeltaMassMaxSigmaCPlusPlus && ptSigmaC > mPtMinSigmaCPlusPlus);
13871387
isSigmaC2520 = (mDeltaMassMinSigmaC2520PlusPlus < deltaMassPKPi && deltaMassPKPi < mDeltaMassMaxSigmaC2520PlusPlus && ptSigmaC > mPtMinSigmaC2520PlusPlus);
1388+
} else if constexpr (charge == -1){
1389+
if (deltaMassPKPi > mMinDeltaMassScSigmaCPr && deltaMassPKPi < mMaxDeltaMassScSigmaCPr && ptSigmaC > mMinPtScSigmaPr){ // sigmaC charge independent for SigmaCPr
1390+
SETBIT(retValue, 4); // SigmaCPr bit
1391+
if (activateQA) {
1392+
hMassVsPt->Fill(ptSigmaC, deltaMassPKPi);
1393+
}
1394+
}
13881395
}
1396+
13891397
if (isSigmaC2455 || isSigmaC2520) {
13901398
retValue |= BIT(0);
1391-
if (isSigmaC2455)
1399+
if (isSigmaC2455) {
13921400
SETBIT(retValue, 2);
1393-
if (isSigmaC2520)
1401+
}
1402+
if (isSigmaC2520) {
13941403
SETBIT(retValue, 3);
1395-
}
1396-
1397-
// --- SigmaCPr selection ---
1398-
if constexpr (charge == -1) {
1399-
if (deltaMassPKPi > minDeltaMassScSigmaCPr &&
1400-
deltaMassPKPi < maxDeltaMassScSigmaCPr &&
1401-
ptSigmaC > minPtScSigmaPr) // proton cuts
1402-
{
1403-
SETBIT(retValue, 4); // SigmaCPr bit
1404+
}
1405+
/// QA plot
1406+
if (activateQA) {
1407+
hMassVsPt->Fill(ptSigmaC, deltaMassPKPi);
14041408
}
14051409
}
1406-
1407-
if (activateQA)
1408-
hMassVsPt->Fill(ptSigmaC, deltaMassPKPi);
1409-
}
1410-
1410+
}
1411+
14111412
if (TESTBIT(isSelectedLc, 1)) {
14121413
/// Lc->piKp case
14131414
auto invMassLcToPiKP = RecoDecay::m(std::array{pTrackSameChargeFirst, pTrackOppositeCharge, pTrackSameChargeSecond}, std::array{massPi, massKa, massProton});
@@ -1422,25 +1423,27 @@ inline int8_t HfFilterHelper::isSelectedSigmaCInDeltaMassRange(const T& pTrackSa
14221423
} else if constexpr (charge == 2) {
14231424
isSigmaC2455 = (mDeltaMassMinSigmaCPlusPlus < deltaMassPiKP && deltaMassPiKP < mDeltaMassMaxSigmaCPlusPlus && ptSigmaC > mPtMinSigmaCPlusPlus);
14241425
isSigmaC2520 = (mDeltaMassMinSigmaC2520PlusPlus < deltaMassPiKP && deltaMassPiKP < mDeltaMassMaxSigmaC2520PlusPlus && ptSigmaC > mPtMinSigmaC2520PlusPlus);
1426+
} else if constexpr (charge == -1){
1427+
if (deltaMassPiKP > mMinDeltaMassScSigmaCPr && deltaMassPiKP < mMaxDeltaMassScSigmaCPr && ptSigmaC > mMinPtScSigmaPr){ // sigmaC charge independent for SigmaCPr
1428+
SETBIT(retValue, 4); // SigmaCPr bit
1429+
if (activateQA) {
1430+
hMassVsPt->Fill(ptSigmaC, deltaMassPiKP);
1431+
}
1432+
}
14251433
}
14261434
if (isSigmaC2455 || isSigmaC2520) {
14271435
retValue |= BIT(1);
1428-
if (isSigmaC2455)
1436+
if (isSigmaC2455) {
14291437
SETBIT(retValue, 2);
1430-
if (isSigmaC2520)
1438+
}
1439+
if (isSigmaC2520) {
14311440
SETBIT(retValue, 3);
1432-
}
1433-
1434-
// --- SigmaCPr selection ---
1435-
if constexpr (charge == -1) {
1436-
if (deltaMassPiKP > minDeltaMassScSigmaCPr &&
1437-
deltaMassPiKP < maxDeltaMassScSigmaCPr &&
1438-
ptSigmaC > minPtScSigmaPr) {
1439-
SETBIT(retValue, 4); // SigmaCPr bit
1441+
}
1442+
/// QA plot
1443+
if (activateQA) {
1444+
hMassVsPt->Fill(ptSigmaC, deltaMassPiKP);
14401445
}
14411446
}
1442-
if (activateQA)
1443-
hMassVsPt->Fill(ptSigmaC, deltaMassPiKP);
14441447
}
14451448
/// TODO: add QA plot
14461449

0 commit comments

Comments
 (0)