Skip to content

Commit 06f8546

Browse files
Add momentum dependent pid sel in cf tracks
1 parent 8d9b971 commit 06f8546

File tree

1 file changed

+31
-35
lines changed

1 file changed

+31
-35
lines changed

PWGCF/TableProducer/filter2Prong.cxx

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,13 @@ struct Filter2Prong {
4444
O2_DEFINE_CONFIGURABLE(cfgYMax, float, -1.0f, "Maximum candidate rapidity")
4545
O2_DEFINE_CONFIGURABLE(cfgImPart1Mass, float, o2::constants::physics::MassKPlus, "Daughter particle 1 mass in GeV")
4646
O2_DEFINE_CONFIGURABLE(cfgImPart2Mass, float, o2::constants::physics::MassKMinus, "Daughter particle 2 mass in GeV")
47+
// O2_DEFINE_CONFIGURABLE(cfgImPart1PID, int, o2::track::PID::Kaon, "PID of daughter particle 1 (O2 PID ID)")
48+
// O2_DEFINE_CONFIGURABLE(cfgImPart2PID, int, o2::track::PID::Kaon, "PID of daughter particle 2 (O2 PID ID)")
49+
O2_DEFINE_CONFIGURABLE(cfgMomDepPID, bool, 1, "Use mommentum dependent PID for Phi meson")
4750
O2_DEFINE_CONFIGURABLE(cfgImCutPt, float, 0.2f, "Minimal pT for candidates")
4851
O2_DEFINE_CONFIGURABLE(cfgImMinInvMass, float, 0.95f, "Minimum invariant mass (GeV)")
4952
O2_DEFINE_CONFIGURABLE(cfgImMaxInvMass, float, 1.07f, "Maximum invariant mass (GeV)")
53+
// O2_DEFINE_CONFIGURABLE(cfgImSigmaFormula, std::string, "(z < 0.5 && x < 3.0) || (z >= 0.5 && x < 2.5 && y < 3.0)", "pT dependent daughter track sigma pass condition (x = TPC sigma, y = TOF sigma, z = pT)")
5054
O2_DEFINE_CONFIGURABLE(cfgDoPhi, bool, false, "Store phi information")
5155
O2_DEFINE_CONFIGURABLE(cfgDoV0, bool, true, "Store V0s candidates")
5256
O2_DEFINE_CONFIGURABLE(tpcNClsCrossedRowsTrackMin, float, 70, "Minimum number of crossed rows in TPC")
@@ -104,8 +108,12 @@ struct Filter2Prong {
104108
using PIDTrack = soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, aod::pidTPCPi, aod::pidTPCKa, aod::pidTPCPr, aod::pidTOFPi, aod::pidTOFKa, aod::pidTOFPr, aod::pidTOFbeta>;
105109
using ResoV0s = aod::V0Datas;
106110

111+
// std::unique_ptr<TFormula> sigmaFormula;
112+
107113
void init(InitContext&)
108114
{
115+
// if (doprocessDataInvMass)
116+
// sigmaFormula = std::make_unique<TFormula>("sigmaFormula", cfgImSigmaFormula.value.c_str());
109117
}
110118

111119
template <class HFCandidatesType>
@@ -343,20 +351,22 @@ struct Filter2Prong {
343351
template <typename T>
344352
bool selectionPID(const T& candidate)
345353
{
346-
if (!candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) {
347-
return true;
348-
}
349-
if (candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF) {
350-
return true;
351-
}
352-
return false;
353-
}
354-
355-
template <typename T>
356-
bool selectionPID2(const T& candidate)
357-
{
358-
if (candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF) {
359-
return true;
354+
if (cfgMomDepPID) {
355+
if (candidate.p() < 0.5) {
356+
if (!candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) {
357+
return true;
358+
} else if (candidate.hasTOF() && TMath::Sqrt(candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa() + candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) < nsigmaCutTOF && candidate.beta() > cfgCutTOFBeta) {
359+
return true;
360+
}
361+
} else if (candidate.hasTOF() && TMath::Sqrt(candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa() + candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) < nsigmaCutTOF && candidate.beta() > cfgCutTOFBeta) {
362+
return true;
363+
}
364+
} else if (!cfgMomDepPID) {
365+
if (!candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) {
366+
return true;
367+
} else if (candidate.hasTOF() && TMath::Sqrt(candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa() + candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) < nsigmaCutTOF && candidate.beta() > cfgCutTOFBeta) {
368+
return true;
369+
}
360370
}
361371
return false;
362372
}
@@ -372,52 +382,38 @@ struct Filter2Prong {
372382
if (cfgDoPhi) { // Process Phi mesons
373383
for (const auto& cftrack1 : cftracks) { // Loop over first track
374384
const auto& p1 = tracks.iteratorAt(cftrack1.trackId() - tracks.begin().globalIndex());
375-
if (p1.sign() != 1) // Only consider positive tracks
376-
continue;
377-
/*if (sigmaFormula->Eval(o2::aod::pidutils::tpcNSigma(cfgImPart1PID, p1), o2::aod::pidutils::tofNSigma(cfgImPart1PID, p1)) <= 0.0f)
378-
{
379-
continue;
380-
}*/
381-
if (!isTOFOnly && !selectionPID(p1)) {
385+
if (p1.sign() != 1) {
382386
continue;
383387
}
384-
if (isTOFOnly && !selectionPID2(p1)) {
388+
if (ITSPIDSelection && p1.p() < ITSPIDPthreshold.value && !(itsResponse.nSigmaITS<o2::track::PID::Kaon>(p1) > -ITSPIDNsigma.value && itsResponse.nSigmaITS<o2::track::PID::Kaon>(p1) < ITSPIDNsigma.value)) { // Check ITS PID condition
385389
continue;
386390
}
387-
if (ITSPIDSelection && p1.p() < ITSPIDPthreshold.value && !(itsResponse.nSigmaITS<o2::track::PID::Kaon>(p1) > -ITSPIDNsigma.value && itsResponse.nSigmaITS<o2::track::PID::Kaon>(p1) < ITSPIDNsigma.value)) { // Check ITS PID condition
391+
if (!selectionPID(p1)) {
388392
continue;
389393
}
390394
if (removefaketrack && isFakeKaon(p1)) { // Check if the track is a fake kaon
391395
continue;
392396
}
393-
394397
for (const auto& cftrack2 : cftracks) { // Loop over second track
395398
if (cftrack2.globalIndex() == cftrack1.globalIndex()) // Skip if it's the same track as the first one
396399
continue;
397400

398401
const auto& p2 = tracks.iteratorAt(cftrack2.trackId() - tracks.begin().globalIndex());
399-
if (p2.sign() != -1) // Only consider negative tracks
400-
continue;
401-
/*if (sigmaFormula->Eval(o2::aod::pidutils::tpcNSigma(cfgImPart2PID, p2), o2::aod::pidutils::tofNSigma(cfgImPart2PID, p2)) <= 0.0f)
402-
{
403-
continue;
404-
}*/
405-
if (!isTOFOnly && !selectionPID(p2)) {
402+
if (p2.sign() != -1) {
406403
continue;
407404
}
408-
if (isTOFOnly && !selectionPID2(p2)) {
405+
if (!selectionPID(p2)) {
409406
continue;
410407
}
411408
if (ITSPIDSelection && p2.p() < ITSPIDPthreshold.value && !(itsResponse.nSigmaITS<o2::track::PID::Kaon>(p2) > -ITSPIDNsigma.value && itsResponse.nSigmaITS<o2::track::PID::Kaon>(p2) < ITSPIDNsigma.value)) { // Check ITS PID condition
412409
continue;
413410
}
414-
if (!selectionPair(p1, p2)) {
411+
if (removefaketrack && isFakeKaon(p2)) { // Check if the track is a fake kaon
415412
continue;
416413
}
417-
if (removefaketrack && isFakeKaon(p2)) {
414+
if (!selectionPair(p1, p2)) {
418415
continue;
419416
}
420-
421417
ROOT::Math::PtEtaPhiMVector vec1(p1.pt(), p1.eta(), p1.phi(), cfgImPart1Mass);
422418
ROOT::Math::PtEtaPhiMVector vec2(p2.pt(), p2.eta(), p2.phi(), cfgImPart2Mass);
423419
ROOT::Math::PtEtaPhiMVector s = vec1 + vec2;

0 commit comments

Comments
 (0)