Skip to content

Commit e7ebc6f

Browse files
authored
[PWGCF] Fix remaining issues in pair efficiency task (#16034)
1 parent 041b0f4 commit e7ebc6f

1 file changed

Lines changed: 33 additions & 13 deletions

File tree

PWGCF/Femto/Tasks/femtoPairEfficiency.cxx

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ struct FemtoPairEfficiency {
194194

195195
struct : ConfigurableGroup {
196196
string prefix = string("TrackSel1");
197+
Configurable<float> ptMin{"ptMin", 0.f, "Minimum pT of track"};
198+
Configurable<float> ptMax{"ptMax", 999.f, "Maximum pT of track"};
199+
Configurable<float> etaMax{"etaMax", 0.8f, "Maximum |eta| of track"};
197200
Configurable<float> tpcClustersMin{"tpcClustersMin", {90.f}, "Minimum number of clusters in TPC"};
198201
Configurable<float> tpcCrossedRowsMin{"tpcCrossedRowsMin", {80.f}, "Minimum number of crossed rows in TPC"};
199202
Configurable<float> tpcClustersOverCrossedRows{"tpcClustersOverCrossedRows", {0.83f}, "Minimum fraction of clusters over crossed rows in TPC"};
@@ -211,6 +214,9 @@ struct FemtoPairEfficiency {
211214

212215
struct : ConfigurableGroup {
213216
string prefix = string("TrackSel2");
217+
Configurable<float> ptMin{"ptMin", 0.f, "Minimum pT of track"};
218+
Configurable<float> ptMax{"ptMax", 999.f, "Maximum pT of track"};
219+
Configurable<float> etaMax{"etaMax", 0.8f, "Maximum |eta| of track"};
214220
Configurable<float> tpcClustersMin{"tpcClustersMin", {90.f}, "Minimum number of clusters in TPC"};
215221
Configurable<float> tpcCrossedRowsMin{"tpcCrossedRowsMin", {80.f}, "Minimum number of crossed rows in TPC"};
216222
Configurable<float> tpcClustersOverCrossedRows{"tpcClustersOverCrossedRows", {0.83f}, "Minimum fraction of clusters over crossed rows in TPC"};
@@ -335,6 +341,10 @@ struct FemtoPairEfficiency {
335341
template <typename T, typename S>
336342
bool checkTrack(T const& track, S const& sel)
337343
{
344+
if (track.pt() < sel.ptMin.value || track.pt() > sel.ptMax.value)
345+
return false;
346+
if (std::fabs(track.eta()) > sel.etaMax.value)
347+
return false;
338348
if (track.tpcNClsFound() < sel.tpcClustersMin.value)
339349
return false;
340350
if (track.tpcNClsCrossedRows() < sel.tpcCrossedRowsMin.value)
@@ -401,21 +411,17 @@ struct FemtoPairEfficiency {
401411

402412
float getKstar(ROOT::Math::PtEtaPhiMVector const& part1, ROOT::Math::PtEtaPhiMVector const& part2)
403413
{
404-
// compute pair momentum
405-
auto sum = part1 + part2;
406-
// Boost particle 1 to the pair rest frame (Prf) and calculate k* (would be equivalent using particle 2)
407-
// make a copy of particle 1
408-
auto particle1Prf = ROOT::Math::PtEtaPhiMVector(part1);
409-
// get lorentz boost into pair rest frame
414+
ROOT::Math::PxPyPzEVector p1(part1);
415+
ROOT::Math::PxPyPzEVector p2(part2);
416+
auto sum = p1 + p2;
410417
ROOT::Math::Boost boostPrf(sum.BoostToCM());
411-
// boost particle 1 into pair rest frame and calculate its momentum, which has the same value as k*
412-
return static_cast<float>(boostPrf(particle1Prf).P());
418+
return static_cast<float>(boostPrf(p1).P());
413419
}
414420

415421
template <typename T>
416422
bool hasPair(const T& tracks)
417423
{
418-
bool hasPair = false;
424+
bool foundPair = false;
419425
float mass1 = o2::analysis::femto::utils::getPdgMass(TrackSel1.pdgCode.value);
420426
float mass2 = o2::analysis::femto::utils::getPdgMass(TrackSel2.pdgCode.value);
421427
float kstar;
@@ -456,9 +462,21 @@ struct FemtoPairEfficiency {
456462
histos.fill(HIST("hTrack2Phi"), RecoDecay::constrainAngle(particle2.Phi()));
457463
histos.fill(HIST("hPairKstar"), kstar);
458464

459-
hasPair = true;
465+
foundPair = true;
460466
}
461-
return hasPair;
467+
return foundPair;
468+
}
469+
470+
template <typename T, typename S>
471+
bool checkTrackMC(T const& particle, S const& sel)
472+
{
473+
if (!particle.isPhysicalPrimary()) // add this
474+
return false;
475+
if (particle.pt() < sel.ptMin.value || particle.pt() > sel.ptMax.value)
476+
return false;
477+
if (std::abs(particle.eta()) > sel.etaMax.value)
478+
return false;
479+
return true;
462480
}
463481

464482
template <typename T>
@@ -469,9 +487,11 @@ struct FemtoPairEfficiency {
469487

470488
for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsUpperIndexPolicy(tracks, tracks))) {
471489

472-
bool order1 = std::abs(p1.pdgCode()) == std::abs(TrackSel1.pdgCode.value) &&
490+
bool order1 = checkTrackMC(p1, TrackSel1) && checkTrackMC(p2, TrackSel2) &&
491+
std::abs(p1.pdgCode()) == std::abs(TrackSel1.pdgCode.value) &&
473492
std::abs(p2.pdgCode()) == std::abs(TrackSel2.pdgCode.value);
474-
bool order2 = std::abs(p1.pdgCode()) == std::abs(TrackSel2.pdgCode.value) &&
493+
bool order2 = checkTrackMC(p2, TrackSel1) && checkTrackMC(p1, TrackSel2) &&
494+
std::abs(p1.pdgCode()) == std::abs(TrackSel2.pdgCode.value) &&
475495
std::abs(p2.pdgCode()) == std::abs(TrackSel1.pdgCode.value);
476496

477497
if (!order1 && !order2) {

0 commit comments

Comments
 (0)