Skip to content

Commit 2b30012

Browse files
authored
[PWGLF] Update on spectraTOF.cxx (#8579)
1 parent 689bab6 commit 2b30012

File tree

1 file changed

+58
-20
lines changed

1 file changed

+58
-20
lines changed

PWGLF/Tasks/Nuspex/spectraTOF.cxx

Lines changed: 58 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,21 @@ std::array<std::shared_ptr<TH3>, NpCharge> hDcaXYZMat;
5252
std::array<std::shared_ptr<TH2>, NpCharge> hDcaXYWrongCollisionPrm;
5353
std::array<std::shared_ptr<TH2>, NpCharge> hDcaXYWrongCollisionStr;
5454
std::array<std::shared_ptr<TH2>, NpCharge> hDcaXYWrongCollisionMat;
55-
std::array<std::shared_ptr<TH2>, NpCharge> hDcaXYMC; // DCA xy in the MC
56-
std::array<std::shared_ptr<TH2>, NpCharge> hDcaZMC; // DCA z in the MC
57-
std::array<std::shared_ptr<TH2>, NpCharge> hDcaXYMCD0; // DCA xy in the MC for particles from D0
58-
std::array<std::shared_ptr<TH2>, NpCharge> hDcaZMCD0; // DCA z in the MC for particles from D0
59-
std::array<std::shared_ptr<TH2>, NpCharge> hDcaXYMCCharm; // DCA xy in the MC for particles from charm
60-
std::array<std::shared_ptr<TH2>, NpCharge> hdcaZMCCharm; // DCA z in the MC for particles from charm
61-
std::array<std::shared_ptr<TH2>, NpCharge> hDcaXYMCBeauty; // DCA xy in the MC for particles from beauty
62-
std::array<std::shared_ptr<TH2>, NpCharge> hDcaZMCBeauty; // DCA z in the MC for particles from beauty
63-
std::array<std::shared_ptr<TH2>, NpCharge> hDcaXYMCNotHF; // DCA xy in the MC for particles from not a HF
64-
std::array<std::shared_ptr<TH2>, NpCharge> hDcaZMCNotHF; // DCA z in the MC for particles from not a HF
55+
std::array<std::shared_ptr<TH2>, NpCharge> hDcaXYMC; // DCA xy in the MC
56+
std::array<std::shared_ptr<TH2>, NpCharge> hDcaZMC; // DCA z in the MC
57+
std::array<std::shared_ptr<TH2>, NpCharge> hDcaXYMCD0; // DCA xy in the MC for particles from D0
58+
std::array<std::shared_ptr<TH2>, NpCharge> hDcaZMCD0; // DCA z in the MC for particles from D0
59+
std::array<std::shared_ptr<TH2>, NpCharge> hDcaXYMCCharm; // DCA xy in the MC for particles from charm
60+
std::array<std::shared_ptr<TH2>, NpCharge> hdcaZMCCharm; // DCA z in the MC for particles from charm
61+
std::array<std::shared_ptr<TH2>, NpCharge> hDcaXYMCBeauty; // DCA xy in the MC for particles from beauty
62+
std::array<std::shared_ptr<TH2>, NpCharge> hDcaZMCBeauty; // DCA z in the MC for particles from beauty
63+
std::array<std::shared_ptr<TH2>, NpCharge> hDcaXYMCNotHF; // DCA xy in the MC for particles from not a HF
64+
std::array<std::shared_ptr<TH2>, NpCharge> hDcaZMCNotHF; // DCA z in the MC for particles from not a HF
65+
std::array<std::shared_ptr<TH2>, NpCharge> hDecayLengthStr; // Decay Length for particles from Strange
66+
std::array<std::shared_ptr<TH2>, NpCharge> hDecayLengthMCD0; // Decay Length in the MC for particles from D0
67+
std::array<std::shared_ptr<TH2>, NpCharge> hDecayLengthMCCharm; // Decay Length in the MC for particles from charm
68+
std::array<std::shared_ptr<TH2>, NpCharge> hDecayLengthMCBeauty; // Decay Length in the MC for particles from charm
69+
std::array<std::shared_ptr<TH2>, NpCharge> hDecayLengthMCNotHF; // Decay Length in the MC for particles from not a HF
6570

6671
// Spectra task
6772
struct tofSpectra {
@@ -335,6 +340,7 @@ struct tofSpectra {
335340
const AxisSpec phiAxis{200, 0, 7, "#it{#varphi} (rad)"};
336341
const AxisSpec dcaZAxis{binsOptions.binsDca, "DCA_{z} (cm)"};
337342
const AxisSpec lengthAxis{100, 0, 600, "Track length (cm)"};
343+
const AxisSpec decayLengthAxis{100, 0, 0.1, "Decay Length (cm)"};
338344

339345
if (enableTrackCutHistograms) {
340346
const AxisSpec chargeAxis{2, -2.f, 2.f, "Charge"};
@@ -653,6 +659,7 @@ struct tofSpectra {
653659
histos.add(hdcazstr[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaZAxis});
654660
histos.add(hdcaxymat[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaXyAxis});
655661
histos.add(hdcazmat[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaZAxis});
662+
hDecayLengthStr[i] = histos.add<TH2>("decaylengthstr" + cpName, pTCharge[i], kTH2D, {ptAxis, decayLengthAxis});
656663
if (enableDcaGoodEvents) {
657664
histos.add(hdcaxyprmgoodevs[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaXyAxis});
658665
histos.add(hdcazprmgoodevs[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaZAxis});
@@ -668,6 +675,10 @@ struct tofSpectra {
668675
hdcaZMCCharm[i] = histos.add<TH2>("dcazcharm" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaZAxis});
669676
hDcaXYMCBeauty[i] = histos.add<TH2>("dcaxybeauty" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaXyAxis});
670677
hDcaZMCBeauty[i] = histos.add<TH2>("dcazbeauty" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaZAxis});
678+
hDecayLengthMCD0[i] = histos.add<TH2>("decaylengthD0" + cpName, pTCharge[i], kTH2D, {ptAxis, decayLengthAxis});
679+
hDecayLengthMCCharm[i] = histos.add<TH2>("decaylengthcharm" + cpName, pTCharge[i], kTH2D, {ptAxis, decayLengthAxis});
680+
hDecayLengthMCBeauty[i] = histos.add<TH2>("decaylengthbeauty" + cpName, pTCharge[i], kTH2D, {ptAxis, decayLengthAxis});
681+
hDecayLengthMCNotHF[i] = histos.add<TH2>("decaylengthnothf" + cpName, pTCharge[i], kTH2D, {ptAxis, decayLengthAxis});
671682
}
672683
}
673684

@@ -1630,6 +1641,13 @@ struct tofSpectra {
16301641
histos.fill(HIST(hdcaxystr[i]), track.pt(), track.dcaXY());
16311642
histos.fill(HIST(hdcazstr[i]), track.pt(), track.dcaZ());
16321643
}
1644+
if (mcParticle.has_daughters()) {
1645+
auto daughter0 = mcParticle.template daughters_as<aod::McParticles>().begin();
1646+
double vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()};
1647+
double vertexPrimary[3] = {mcCollision.posX(), mcCollision.posY(), mcCollision.posZ()};
1648+
auto decayLength = RecoDecay::distance(vertexPrimary, vertexDau) / 10000;
1649+
hDecayLengthStr[i]->Fill(track.pt(), decayLength);
1650+
}
16331651
} else {
16341652
if (enableDCAxyzHistograms) {
16351653
hDcaXYZMat[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ());
@@ -1658,23 +1676,23 @@ struct tofSpectra {
16581676
bool IsD0Mother = false;
16591677
bool IsCharmMother = false;
16601678
bool IsBeautyMother = false;
1679+
bool IsNotHFMother = false;
16611680

16621681
if (mcParticle.has_mothers()) {
16631682
const int charmOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, false);
16641683
for (const auto& mother : mcParticle.template mothers_as<aod::McParticles>()) {
1665-
const int motherPdgCode = mother.pdgCode();
1684+
const int motherPdgCode = std::abs(mother.pdgCode());
16661685
if (motherPdgCode == 421) {
16671686
IsD0Mother = true;
16681687
}
1669-
if (charmOrigin == RecoDecay::OriginType::NonPrompt) {
1670-
if ((motherPdgCode) / 1000 == 5 || (motherPdgCode) / 100 == 5) {
1671-
IsBeautyMother = true;
1672-
}
1688+
if (charmOrigin == RecoDecay::OriginType::NonPrompt && ((motherPdgCode) / 1000 == 5 || (motherPdgCode) / 100 == 5)) {
1689+
IsBeautyMother = true;
1690+
}
1691+
if (charmOrigin == RecoDecay::OriginType::Prompt && ((motherPdgCode) / 1000 == 4 || (motherPdgCode) / 100 == 4)) {
1692+
IsCharmMother = true;
16731693
}
1674-
if (charmOrigin == RecoDecay::OriginType::Prompt) {
1675-
if ((motherPdgCode) / 1000 == 4 || (motherPdgCode) / 100 == 4) {
1676-
IsCharmMother = true;
1677-
}
1694+
if (!(motherPdgCode / 1000 == 4 || motherPdgCode / 100 == 4) && !(motherPdgCode / 1000 == 5 || motherPdgCode / 100 == 5)) {
1695+
IsNotHFMother = true;
16781696
}
16791697
}
16801698
}
@@ -1690,10 +1708,30 @@ struct tofSpectra {
16901708
hDcaXYMCBeauty[i]->Fill(track.pt(), track.dcaXY());
16911709
hDcaZMCBeauty[i]->Fill(track.pt(), track.dcaZ());
16921710
}
1693-
if (!IsCharmMother && !IsBeautyMother) {
1711+
if (IsNotHFMother) {
16941712
hDcaXYMCNotHF[i]->Fill(track.pt(), track.dcaXY());
16951713
hDcaZMCNotHF[i]->Fill(track.pt(), track.dcaZ());
16961714
}
1715+
1716+
if (mcParticle.has_daughters()) {
1717+
auto daughter0 = mcParticle.template daughters_as<aod::McParticles>().begin();
1718+
double vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()};
1719+
double vertexPrimary[3] = {mcCollision.posX(), mcCollision.posY(), mcCollision.posZ()};
1720+
auto decayLength = RecoDecay::distance(vertexPrimary, vertexDau) / 10000;
1721+
1722+
if (IsD0Mother) {
1723+
hDecayLengthMCD0[i]->Fill(track.pt(), decayLength);
1724+
}
1725+
if (IsCharmMother) {
1726+
hDecayLengthMCCharm[i]->Fill(track.pt(), decayLength);
1727+
}
1728+
if (IsBeautyMother) {
1729+
hDecayLengthMCBeauty[i]->Fill(track.pt(), decayLength);
1730+
}
1731+
if (IsNotHFMother) {
1732+
hDecayLengthMCNotHF[i]->Fill(track.pt(), decayLength);
1733+
}
1734+
}
16971735
}
16981736
}
16991737

0 commit comments

Comments
 (0)