Skip to content

Commit f24651b

Browse files
authored
[PWGLF] Add histo for signal matched to TOF (#9689)
1 parent d8720f3 commit f24651b

File tree

2 files changed

+53
-34
lines changed

2 files changed

+53
-34
lines changed

PWGLF/DataModel/spectraTOF.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ static constexpr const char* pN[Np] = {"el", "mu", "pi", "ka", "pr", "de", "tr",
4848
static constexpr const char* cN[NCharges] = {"pos", "neg"};
4949
static constexpr const char* pTCharge[NpCharge] = {"e^{-}", "#mu^{-}", "#pi^{+}", "K^{+}", "p", "d", "t", "{}^{3}He", "#alpha",
5050
"e^{+}", "#mu^{+}", "#pi^{-}", "K^{-}", "#bar{p}", "#bar{d}", "#bar{t}", "{}^{3}#bar{He}", "#bar{#alpha}"};
51+
static constexpr const char* pNCharge[NpCharge] = {"pos/el", "pos/mu", "pos/pi", "pos/ka", "pos/pr", "pos/de", "pos/tr", "pos/he", "pos/al",
52+
"neg/el", "neg/mu", "neg/pi", "neg/ka", "neg/pr", "neg/de", "neg/tr", "neg/he", "neg/al"};
5153
static constexpr int PDGs[NpCharge] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton, 1000010020, 1000010030, 1000020030, 1000020040,
5254
-kElectron, -kMuonMinus, -kPiPlus, -kKPlus, -kProton, -1000010020, -1000010030, -1000020030, -1000020040};
5355

PWGLF/Tasks/Nuspex/spectraTOF.cxx

Lines changed: 51 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ std::array<std::shared_ptr<TH2>, NpCharge> hDecayLengthMCCharm; // Decay Length
6969
std::array<std::shared_ptr<TH2>, NpCharge> hDecayLengthMCBeauty; // Decay Length in the MC for particles from charm
7070
std::array<std::shared_ptr<TH2>, NpCharge> hDecayLengthMCNotHF; // Decay Length in the MC for particles from not a HF
7171

72-
// Spectra tas
72+
std::array<std::shared_ptr<TH2>, NpCharge> hPtNumTOFMatchWithPIDSignalPrm; // Pt distribution of particles with a hit in the TOF and a compatible signal
73+
74+
// Spectra task
7375
struct tofSpectra {
7476
struct : ConfigurableGroup {
7577
Configurable<float> cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"};
@@ -666,6 +668,7 @@ struct tofSpectra {
666668
histos.add(hdcaz[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaZAxis});
667669
}
668670

671+
const std::string cpName = Form("/%s", pNCharge[i]);
669672
if (doprocessMC) {
670673
if (includeCentralityMC) {
671674
//*************************************RD**********************************************
@@ -708,6 +711,7 @@ struct tofSpectra {
708711
histos.add(hpt_numtof_mat[i].data(), pTCharge[i], kTH2D, {ptAxis, multAxis});
709712

710713
histos.add(hpt_numtofgoodmatch_prm[i].data(), pTCharge[i], kTH2D, {ptAxis, multAxis});
714+
hPtNumTOFMatchWithPIDSignalPrm[i] = histos.add<TH2>("MC" + cpName + "/prm/pt/numtofwithpid", pTCharge[i], kTH2D, {ptAxis, multAxis});
711715

712716
histos.add(hpt_den_prm[i].data(), pTCharge[i], kTH2D, {ptAxis, multAxis});
713717
histos.add(hpt_den_str[i].data(), pTCharge[i], kTH2D, {ptAxis, multAxis});
@@ -719,7 +723,6 @@ struct tofSpectra {
719723
}
720724
histos.add(hpt_den_prm_mcgoodev[i].data(), pTCharge[i], kTH2D, {ptAxis, multAxis});
721725
histos.add(hpt_den_prm_mcbadev[i].data(), pTCharge[i], kTH2D, {ptAxis, multAxis});
722-
const std::string cpName = Form("/%s/%s", (i < Np) ? "pos" : "neg", pN[i % Np]);
723726
if (enableDCAxyzHistograms) {
724727
hDcaXYZPrm[i] = histos.add<TH3>("dcaprm" + cpName, pTCharge[i], kTH3D, {ptAxis, dcaXyAxis, dcaZAxis});
725728
hDcaXYZStr[i] = histos.add<TH3>("dcastr" + cpName, pTCharge[i], kTH3D, {ptAxis, dcaXyAxis, dcaZAxis});
@@ -1444,21 +1447,20 @@ struct tofSpectra {
14441447
continue;
14451448
}
14461449
const auto& nsigmaTPCPi = o2::aod::pidutils::tpcNSigma<2>(track);
1447-
;
14481450
const auto& nsigmaTPCKa = o2::aod::pidutils::tpcNSigma<3>(track);
14491451
const auto& nsigmaTPCPr = o2::aod::pidutils::tpcNSigma<4>(track);
14501452

1451-
bool isTPCPion = std::abs(nsigmaTPCPi) < trkselOptions.cfgCutNsigma;
1452-
bool isTPCKaon = std::abs(nsigmaTPCKa) < trkselOptions.cfgCutNsigma;
1453-
bool isTPCProton = std::abs(nsigmaTPCPr) < trkselOptions.cfgCutNsigma;
1453+
const bool isTPCPion = std::abs(nsigmaTPCPi) < trkselOptions.cfgCutNsigma;
1454+
const bool isTPCKaon = std::abs(nsigmaTPCKa) < trkselOptions.cfgCutNsigma;
1455+
const bool isTPCProton = std::abs(nsigmaTPCPr) < trkselOptions.cfgCutNsigma;
14541456

14551457
const auto& nsigmaTOFPi = o2::aod::pidutils::tofNSigma<2>(track);
14561458
const auto& nsigmaTOFKa = o2::aod::pidutils::tofNSigma<3>(track);
14571459
const auto& nsigmaTOFPr = o2::aod::pidutils::tofNSigma<4>(track);
14581460

1459-
bool isTOFPion = track.hasTOF() && std::abs(nsigmaTOFPi) < trkselOptions.cfgCutNsigma;
1460-
bool isTOFKaon = track.hasTOF() && std::abs(nsigmaTOFKa) < trkselOptions.cfgCutNsigma;
1461-
bool isTOFProton = track.hasTOF() && std::abs(nsigmaTOFPr) < trkselOptions.cfgCutNsigma;
1461+
const bool isTOFPion = track.hasTOF() && std::abs(nsigmaTOFPi) < trkselOptions.cfgCutNsigma;
1462+
const bool isTOFKaon = track.hasTOF() && std::abs(nsigmaTOFKa) < trkselOptions.cfgCutNsigma;
1463+
const bool isTOFProton = track.hasTOF() && std::abs(nsigmaTOFPr) < trkselOptions.cfgCutNsigma;
14621464

14631465
// Apply rapidity cut for identified particles
14641466
if (isTPCPion && std::abs(track.rapidity(PID::getMass(2))) < trkselOptions.cfgCutY) {
@@ -1732,29 +1734,24 @@ struct tofSpectra {
17321734

17331735
const auto& mcCollision = collision.mcCollision_as<GenMCCollisions>();
17341736
const float multiplicity = getMultiplicityMC(mcCollision);
1735-
int occupancy = collision.trackOccupancyInTimeRange();
1736-
//************************************RD**************************************************
1737+
const int occupancy = collision.trackOccupancyInTimeRange();
17371738
const float impParam = mcCollision.impactParameter();
1738-
//************************************RD**************************************************
17391739

17401740
if (mcParticle.pdgCode() != PDGs[i]) {
17411741
return;
17421742
}
17431743
if (track.eta() < trkselOptions.cfgCutEtaMin || track.eta() > trkselOptions.cfgCutEtaMax) {
17441744
return;
17451745
}
1746-
17471746
if (std::abs(mcParticle.y()) > trkselOptions.cfgCutY) {
17481747
return;
17491748
}
17501749

17511750
const auto& nsigmaTPCKa = o2::aod::pidutils::tpcNSigma<3>(track);
1752-
1753-
bool isKaonTPC = std::abs(nsigmaTPCKa) < trkselOptions.cfgCutNsigma;
1751+
const bool isKaonTPC = std::abs(nsigmaTPCKa) < trkselOptions.cfgCutNsigma;
17541752

17551753
const auto& nsigmaTOFKa = o2::aod::pidutils::tofNSigma<3>(track);
1756-
1757-
bool isKaonTOF = std::abs(nsigmaTOFKa) < trkselOptions.cfgCutNsigma;
1754+
const bool isKaonTOF = std::abs(nsigmaTOFKa) < trkselOptions.cfgCutNsigma;
17581755

17591756
// Filling DCA info with the TPC+TOF PID
17601757
bool isDCAPureSample = (std::sqrt(nsigmaTOFKa * nsigmaTOFKa + nsigmaTPCKa * nsigmaTPCKa) < 2.f);
@@ -1769,7 +1766,7 @@ struct tofSpectra {
17691766
}
17701767

17711768
if (!mcParticle.isPhysicalPrimary()) { // Secondaries (weak decays and material)
1772-
if (mcParticle.getProcess() == 4) {
1769+
if (mcParticle.getProcess() == 4) { // Particles from decay
17731770
if (enableDCAxyzHistograms) {
17741771
hDcaXYZStr[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ());
17751772
} else {
@@ -1786,7 +1783,7 @@ struct tofSpectra {
17861783
hDecayLengthStr[i]->Fill(track.pt(), decayLength);
17871784
}
17881785
}
1789-
} else {
1786+
} else { // Particles from the material
17901787
if (enableDCAxyzHistograms) {
17911788
hDcaXYZMat[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ());
17921789
} else {
@@ -1890,21 +1887,21 @@ struct tofSpectra {
18901887
if (!passesDCAxyCut(track)) { // Skipping tracks that don't pass the standard cuts
18911888
return;
18921889
}
1893-
int pdgCode = mcParticle.pdgCode();
1890+
const int pdgCode = mcParticle.pdgCode();
18941891
const auto& nsigmaTPCPi = o2::aod::pidutils::tpcNSigma<2>(track);
18951892
const auto& nsigmaTPCPr = o2::aod::pidutils::tpcNSigma<4>(track);
18961893

1897-
bool isPionTPC = std::abs(nsigmaTPCPi) < trkselOptions.cfgCutNsigma;
1898-
bool isProtonTPC = std::abs(nsigmaTPCPr) < trkselOptions.cfgCutNsigma;
1894+
const bool isPionTPC = std::abs(nsigmaTPCPi) < trkselOptions.cfgCutNsigma;
1895+
const bool isProtonTPC = std::abs(nsigmaTPCPr) < trkselOptions.cfgCutNsigma;
18991896

19001897
const auto& nsigmaTOFPi = o2::aod::pidutils::tofNSigma<2>(track);
19011898
const auto& nsigmaTOFPr = o2::aod::pidutils::tofNSigma<4>(track);
19021899

1903-
bool isPionTOF = std::abs(nsigmaTOFPi) < trkselOptions.cfgCutNsigma;
1904-
bool isProtonTOF = std::abs(nsigmaTOFPr) < trkselOptions.cfgCutNsigma;
1900+
const bool isPionTOF = std::abs(nsigmaTOFPi) < trkselOptions.cfgCutNsigma;
1901+
const bool isProtonTOF = std::abs(nsigmaTOFPr) < trkselOptions.cfgCutNsigma;
19051902

1906-
if (!mcParticle.isPhysicalPrimary()) {
1907-
if (mcParticle.getProcess() == 4) {
1903+
if (!mcParticle.isPhysicalPrimary()) { // Is not physical primary
1904+
if (mcParticle.getProcess() == 4) { // Is from decay
19081905
if (includeCentralityMC) {
19091906
if (includeCentralityMC) {
19101907
histos.fill(HIST(hpt_num_str[i]), track.pt(), multiplicity, track.dcaXY());
@@ -1932,7 +1929,7 @@ struct tofSpectra {
19321929
}
19331930
}
19341931
}
1935-
} else {
1932+
} else { // Is physical primary
19361933
if (includeCentralityMC) {
19371934
if (isImpactParam) {
19381935
histos.fill(HIST(hpt_num_prm[i]), track.pt(), impParam, track.dcaXY(), occupancy);
@@ -2181,6 +2178,27 @@ struct tofSpectra {
21812178
histos.fill(HIST(hpt_numtofgoodmatch_prm[i]), track.pt(), multiplicity);
21822179
}
21832180
}
2181+
// Check if the signal is compatible with the PID hypothesis
2182+
float nsigma = 0.f;
2183+
switch (i) {
2184+
case 2:
2185+
case Np + 2:
2186+
nsigma = track.tofNSigmaPi();
2187+
break;
2188+
case 3:
2189+
case Np + 3:
2190+
nsigma = track.tofNSigmaKa();
2191+
break;
2192+
case 4:
2193+
case Np + 4:
2194+
nsigma = track.tofNSigmaPr();
2195+
break;
2196+
default:
2197+
break;
2198+
}
2199+
if (std::abs(nsigma) <= trkselOptions.cfgCutNsigma) {
2200+
hPtNumTOFMatchWithPIDSignalPrm[i]->Fill(track.pt(), multiplicity);
2201+
}
21842202
}
21852203

21862204
// Filling mismatched info for primary tracks
@@ -2536,21 +2554,20 @@ struct tofSpectra {
25362554
}
25372555

25382556
const auto& nsigmaTPCPi = o2::aod::pidutils::tpcNSigma<2>(track);
2539-
;
25402557
const auto& nsigmaTPCKa = o2::aod::pidutils::tpcNSigma<3>(track);
25412558
const auto& nsigmaTPCPr = o2::aod::pidutils::tpcNSigma<4>(track);
25422559

2543-
bool isPionTPC = std::abs(nsigmaTPCPi) < trkselOptions.cfgCutNsigma;
2544-
bool isKaonTPC = std::abs(nsigmaTPCKa) < trkselOptions.cfgCutNsigma;
2545-
bool isProtonTPC = std::abs(nsigmaTPCPr) < trkselOptions.cfgCutNsigma;
2560+
const bool isPionTPC = std::abs(nsigmaTPCPi) < trkselOptions.cfgCutNsigma;
2561+
const bool isKaonTPC = std::abs(nsigmaTPCKa) < trkselOptions.cfgCutNsigma;
2562+
const bool isProtonTPC = std::abs(nsigmaTPCPr) < trkselOptions.cfgCutNsigma;
25462563

25472564
const auto& nsigmaTOFPi = o2::aod::pidutils::tofNSigma<2>(track);
25482565
const auto& nsigmaTOFKa = o2::aod::pidutils::tofNSigma<3>(track);
25492566
const auto& nsigmaTOFPr = o2::aod::pidutils::tofNSigma<4>(track);
25502567

2551-
bool isPionTOF = track.hasTOF() && std::abs(nsigmaTOFPi) < trkselOptions.cfgCutNsigma;
2552-
bool isKaonTOF = track.hasTOF() && std::abs(nsigmaTOFKa) < trkselOptions.cfgCutNsigma;
2553-
bool isProtonTOF = track.hasTOF() && std::abs(nsigmaTOFPr) < trkselOptions.cfgCutNsigma;
2568+
const bool isPionTOF = track.hasTOF() && std::abs(nsigmaTOFPi) < trkselOptions.cfgCutNsigma;
2569+
const bool isKaonTOF = track.hasTOF() && std::abs(nsigmaTOFKa) < trkselOptions.cfgCutNsigma;
2570+
const bool isProtonTOF = track.hasTOF() && std::abs(nsigmaTOFPr) < trkselOptions.cfgCutNsigma;
25542571

25552572
if (isPionTPC || isKaonTPC || isProtonTPC) {
25562573
if (pdgCode == 2212) {

0 commit comments

Comments
 (0)