Skip to content

Commit 54a7ec5

Browse files
committed
Check directly He3 PID in the V0s
1 parent 3df6c65 commit 54a7ec5

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

EventFiltering/PWGLF/nucleiFilter.cxx

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ struct nucleiFilter {
108108
Configurable<LabeledArray<double>> cfgMinTPCmom{"cfgMinTPCmom", {minTPCmom[0], nNuclei, 2, nucleiNames, matterOrNot}, "Minimum TPC p/Z for nuclei PID"};
109109

110110
Configurable<LabeledArray<float>> cfgCutsPID{"nucleiCutsPID", {cutsPID[0], nNuclei, nCutsPID, nucleiNames, cutsNames}, "Nuclei PID selections"};
111-
Configurable<bool> fixTPCinnerParam{"fixTPCinnerParam", false, "Fix TPC inner param"};
111+
Configurable<bool> cfgFixTPCinnerParam{"cfgFixTPCinnerParam", false, "Fix TPC inner param"};
112112

113113
// variable/tool for hypertriton 3body decay
114114
int mRunNumber;
@@ -348,9 +348,17 @@ struct nucleiFilter {
348348
{charges[2] * cfgMomentumScalingBetheBloch->get(2u, 0u) / masses[2], charges[2] * cfgMomentumScalingBetheBloch->get(2u, 1u) / masses[2]}};
349349

350350
constexpr int nucleusIndex[nNuclei]{kH2, -1, kHe}; /// remap for nuclei triggers
351-
std::vector<int> h3indices, he3indices;
351+
std::vector<int> h3indices;
352352
std::vector<ROOT::Math::PtEtaPhiMVector> h3vectors;
353-
for (auto& track : tracks) { // start loop over tracks
353+
354+
auto getNsigma = [&](const auto& track, int iN, int iC) {
355+
float fixTPCrigidity{(cfgFixTPCinnerParam && (track.pidForTracking() == track::PID::Helium3 || track.pidForTracking() == track::PID::Alpha)) ? 0.5f : 1.f};
356+
double expBethe{tpc::BetheBlochAleph(static_cast<double>(track.tpcInnerParam() * fixTPCrigidity * bgScalings[iN][iC]), cfgBetheBlochParams->get(iN, 0u), cfgBetheBlochParams->get(iN, 1u), cfgBetheBlochParams->get(iN, 2u), cfgBetheBlochParams->get(iN, 3u), cfgBetheBlochParams->get(iN, 4u))};
357+
double expSigma{expBethe * cfgBetheBlochParams->get(iN, 5u)};
358+
return static_cast<float>((track.tpcSignal() - expBethe) / expSigma);
359+
};
360+
361+
for (const auto& track : tracks) { // start loop over tracks
354362
if (track.itsNCls() >= cfgCutNclusExtremeIonisationITS) {
355363
double avgClsSize{0.};
356364
double cosL{std::sqrt(1. / (1. + track.tgl() * track.tgl()))};
@@ -380,7 +388,7 @@ struct nucleiFilter {
380388
track.tofNSigmaDe(), track.tofNSigmaTr(), track.tofNSigmaHe()};
381389
const int iC{track.sign() < 0};
382390

383-
float fixTPCrigidity{(fixTPCinnerParam && (track.pidForTracking() == track::PID::Helium3 || track.pidForTracking() == track::PID::Alpha)) ? 0.5f : 1.f};
391+
float fixTPCrigidity{(cfgFixTPCinnerParam && (track.pidForTracking() == track::PID::Helium3 || track.pidForTracking() == track::PID::Alpha)) ? 0.5f : 1.f};
384392

385393
// fill QA hist: dEdx for all charged tracks
386394
qaHists.fill(HIST("fTPCsignalAll"), track.sign() * track.tpcInnerParam() * fixTPCrigidity, track.tpcSignal());
@@ -392,9 +400,7 @@ struct nucleiFilter {
392400
}
393401

394402
if (cfgBetheBlochParams->get(iN, 5u) > 0.f) {
395-
double expBethe{tpc::BetheBlochAleph(static_cast<double>(track.tpcInnerParam() * fixTPCrigidity * bgScalings[iN][iC]), cfgBetheBlochParams->get(iN, 0u), cfgBetheBlochParams->get(iN, 1u), cfgBetheBlochParams->get(iN, 2u), cfgBetheBlochParams->get(iN, 3u), cfgBetheBlochParams->get(iN, 4u))};
396-
double expSigma{expBethe * cfgBetheBlochParams->get(iN, 5u)};
397-
nSigmaTPC[iN] = static_cast<float>((track.tpcSignal() - expBethe) / expSigma);
403+
nSigmaTPC[iN] = getNsigma(track, iN, iC);
398404
}
399405
h2TPCnSigma[iN]->Fill(track.sign() * track.tpcInnerParam() * fixTPCrigidity, nSigmaTPC[iN]);
400406
if (nSigmaTPC[iN] < cfgCutsPID->get(iN, 0u) || nSigmaTPC[iN] > cfgCutsPID->get(iN, 1u)) {
@@ -407,9 +413,6 @@ struct nucleiFilter {
407413
h3indices.push_back(track.globalIndex());
408414
h3vectors.emplace_back(track.pt(), track.eta(), track.phi(), masses[iN]);
409415
}
410-
if (iN == 2) {
411-
he3indices.push_back(track.globalIndex());
412-
}
413416
if (nucleusIndex[iN] < 0) {
414417
continue;
415418
}
@@ -424,7 +427,7 @@ struct nucleiFilter {
424427
track.tpcNClsFound() < cfgCutNclusTPC ||
425428
std::abs(track.dcaXY()) > cfgCutDCAxy ||
426429
std::abs(track.dcaZ()) > cfgCutDCAz ||
427-
std::abs(track.eta()) > 0.9) {
430+
std::abs(track.eta()) > cfgCutEta) {
428431
continue;
429432
}
430433
const ROOT::Math::PtEtaPhiMVector trackVector(track.pt(), track.eta(), track.phi(), constants::physics::MassPiMinus);
@@ -445,13 +448,18 @@ struct nucleiFilter {
445448
}
446449

447450
for (const auto& v0 : v0s) {
448-
for (const auto& he3 : he3indices) {
449-
if (v0.posTrackId() == he3 || v0.negTrackId() == he3) {
450-
keepEvent[kHeV0] = true;
451-
break;
452-
}
451+
const auto& posTrack = tracks.rawIteratorAt(v0.posTrackId());
452+
const auto& negTrack = tracks.rawIteratorAt(v0.negTrackId());
453+
if ((posTrack.itsNCls() < cfgCutNclusITS || posTrack.tpcNClsFound() < cfgCutNclusTPC) &&
454+
(negTrack.itsNCls() < cfgCutNclusITS || negTrack.tpcNClsFound() < cfgCutNclusTPC)) {
455+
continue;
453456
}
454-
if (keepEvent[kHeV0]) {
457+
float nSigmas[2]{
458+
cfgBetheBlochParams->get(2, 5u) > 0.f ? getNsigma(posTrack, 2, 0) : posTrack.tpcNSigmaHe(),
459+
cfgBetheBlochParams->get(2, 5u) > 0.f ? getNsigma(negTrack, 2, 1) : negTrack.tpcNSigmaHe()};
460+
if ((nSigmas[0] > cfgCutsPID->get(2, 0u) && nSigmas[0] < cfgCutsPID->get(2, 1u)) ||
461+
(nSigmas[1] > cfgCutsPID->get(2, 0u) && nSigmas[1] < cfgCutsPID->get(2, 1u))) {
462+
keepEvent[kHeV0] = true;
455463
break;
456464
}
457465
}

0 commit comments

Comments
 (0)