Skip to content

Commit 965c55b

Browse files
mtorresc15njacazio
andauthored
[spectraTOF] add more DCA histograms (#7754)
- add DCA per mother --------- Co-authored-by: Nicolò Jacazio <nicolo.jacazio@cern.ch> Co-authored-by: Nicolò Jacazio <njacazio@users.noreply.github.com>
1 parent 4afd797 commit 965c55b

2 files changed

Lines changed: 95 additions & 19 deletions

File tree

PWGLF/DataModel/spectraTOF.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,11 @@ DECLARE_SOA_DYNAMIC_COLUMN(TRDSignal, trdSignal, //! Dummy
398398
[](float /*v*/) -> float { return 0.f; });
399399
DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float signedpt, float eta) -> float { return std::abs(signedpt) * cosh(eta); });
400400
DECLARE_SOA_DYNAMIC_COLUMN(TrackType, trackType, [](float /*v*/) -> uint8_t { return o2::aod::track::TrackTypeEnum::Track; });
401-
DECLARE_SOA_COLUMN(IsGlobalTrack, isGlobalTrack, bool); // if a track passed the isGlobalTrack requirement
402-
DECLARE_SOA_COLUMN(IsGlobalTrackWoDCA, isGlobalTrackWoDCA, bool); // if a track passed the isGlobalTrackWoDCA requirement
403-
DECLARE_SOA_DYNAMIC_COLUMN(Flags, flags, [](float /*v*/) -> uint32_t { return 0; }); // Dummy
401+
DECLARE_SOA_COLUMN(IsGlobalTrack, isGlobalTrack, bool); // if a track passed the isGlobalTrack requirement
402+
DECLARE_SOA_COLUMN(IsGlobalTrackWoDCA, isGlobalTrackWoDCA, bool); // if a track passed the isGlobalTrackWoDCA requirement
403+
DECLARE_SOA_DYNAMIC_COLUMN(Flags, flags, [](float /*v*/) -> uint32_t { return 0; }); // Dummy
404404
DECLARE_SOA_DYNAMIC_COLUMN(TRDPattern, trdPattern, [](float /*v*/) -> uint8_t { return 0; }); // Dummy
405-
DECLARE_SOA_DYNAMIC_COLUMN(Rapidity, rapidity, //! Track rapidity, computed under the mass assumption given as input
405+
DECLARE_SOA_DYNAMIC_COLUMN(Rapidity, rapidity, //! Track rapidity, computed under the mass assumption given as input
406406
[](float signedPt, float eta, float mass) -> float {
407407
const auto pt = std::abs(signedPt);
408408
const auto p = std::abs(signedPt) * cosh(eta);

PWGLF/Tasks/Nuspex/spectraTOF.cxx

Lines changed: 91 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include "Framework/O2DatabasePDGPlugin.h"
3737
#include "PWGLF/Utils/inelGt.h"
3838
#include "PWGLF/DataModel/mcCentrality.h"
39-
39+
#include "Common/Core/RecoDecay.h"
4040
#include "TPDGCode.h"
4141

4242
using namespace o2;
@@ -52,6 +52,16 @@ 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
5565

5666
// Spectra task
5767
struct tofSpectra {
@@ -83,6 +93,7 @@ struct tofSpectra {
8393
Configurable<bool> enableTPCTOFHistograms{"enableTPCTOFHistograms", true, "Enables TPC TOF histograms"};
8494
Configurable<bool> enableDCAxyzHistograms{"enableDCAxyzHistograms", false, "Enables DCAxyz correlation histograms"};
8595
Configurable<bool> enableDCAxyphiHistograms{"enableDCAxyphiHistograms", false, "Enables DCAxyphi correlation histograms"};
96+
Configurable<bool> enableDCAvsmotherHistograms{"enableDCAvsmotherHistograms", false, "Enables DCA vs mother histograms"};
8697

8798
struct : ConfigurableGroup {
8899
ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.12, 0.14, 0.16, 0.18, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0}, "Binning of the pT axis"};
@@ -611,17 +622,19 @@ struct tofSpectra {
611622
histos.add(hpt_den_prm_mcgoodev[i].data(), pTCharge[i], kTH2D, {ptAxis, multAxis});
612623
histos.add(hpt_den_prm_mcbadev[i].data(), pTCharge[i], kTH2D, {ptAxis, multAxis});
613624

625+
const std::string cpName = Form("/%s/%s", (i < Np) ? "pos" : "neg", pN[i % Np]);
614626
if (enableDCAxyzHistograms) {
615-
hDcaXYZPrm[i] = histos.add<TH3>(Form("dcaprm/%s/%s", (i < Np) ? "pos" : "neg", pN[i % Np]), pTCharge[i], kTH3D, {ptAxis, dcaXyAxis, dcaZAxis});
616-
hDcaXYZStr[i] = histos.add<TH3>(Form("dcastr/%s/%s", (i < Np) ? "pos" : "neg", pN[i % Np]), pTCharge[i], kTH3D, {ptAxis, dcaXyAxis, dcaZAxis});
617-
hDcaXYZMat[i] = histos.add<TH3>(Form("dcamat/%s/%s", (i < Np) ? "pos" : "neg", pN[i % Np]), pTCharge[i], kTH3D, {ptAxis, dcaXyAxis, dcaZAxis});
627+
hDcaXYZPrm[i] = histos.add<TH3>("dcaprm" + cpName, pTCharge[i], kTH3D, {ptAxis, dcaXyAxis, dcaZAxis});
628+
hDcaXYZStr[i] = histos.add<TH3>("dcastr" + cpName, pTCharge[i], kTH3D, {ptAxis, dcaXyAxis, dcaZAxis});
629+
hDcaXYZMat[i] = histos.add<TH3>("dcamat" + cpName, pTCharge[i], kTH3D, {ptAxis, dcaXyAxis, dcaZAxis});
618630
if (enableDcaGoodEvents) {
619631
histos.add(hdcaxyprmgoodevs[i].data(), pTCharge[i], kTH3D, {ptAxis, dcaXyAxis, dcaZAxis});
620632
}
621633
} else {
622-
hDcaXYWrongCollisionPrm[i] = histos.add<TH2>(Form("dcaxywrongcollprm/%s/%s", (i < Np) ? "pos" : "neg", pN[i % Np]), pTCharge[i], kTH2D, {ptAxis, dcaXyAxis});
623-
hDcaXYWrongCollisionStr[i] = histos.add<TH2>(Form("dcaxywrongcollstr/%s/%s", (i < Np) ? "pos" : "neg", pN[i % Np]), pTCharge[i], kTH2D, {ptAxis, dcaXyAxis});
624-
hDcaXYWrongCollisionMat[i] = histos.add<TH2>(Form("dcaxywrongcollmat/%s/%s", (i < Np) ? "pos" : "neg", pN[i % Np]), pTCharge[i], kTH2D, {ptAxis, dcaXyAxis});
634+
hDcaXYWrongCollisionPrm[i] = histos.add<TH2>("dcaxywrongcollprm" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaXyAxis});
635+
hDcaXYWrongCollisionStr[i] = histos.add<TH2>("dcaxywrongcollstr" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaXyAxis});
636+
hDcaXYWrongCollisionMat[i] = histos.add<TH2>("dcaxywrongcollmat" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaXyAxis});
637+
625638
histos.add(hdcaxyprm[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaXyAxis});
626639
histos.add(hdcazprm[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaZAxis});
627640
histos.add(hdcaxystr[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaXyAxis});
@@ -632,6 +645,18 @@ struct tofSpectra {
632645
histos.add(hdcaxyprmgoodevs[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaXyAxis});
633646
histos.add(hdcazprmgoodevs[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaZAxis});
634647
}
648+
if (enableDCAvsmotherHistograms) {
649+
hDcaXYMC[i] = histos.add<TH2>("dcaxymc" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaXyAxis});
650+
hDcaZMC[i] = histos.add<TH2>("dcazmc" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaZAxis});
651+
hDcaXYMCNotHF[i] = histos.add<TH2>("dcaxynothf" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaXyAxis});
652+
hDcaZMCNotHF[i] = histos.add<TH2>("dcaznothf" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaZAxis});
653+
hDcaXYMCD0[i] = histos.add<TH2>("dcaxyD0" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaXyAxis});
654+
hDcaZMCD0[i] = histos.add<TH2>("dcazD0" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaZAxis});
655+
hDcaXYMCCharm[i] = histos.add<TH2>("dcaxycharm" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaXyAxis});
656+
hdcaZMCCharm[i] = histos.add<TH2>("dcazcharm" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaZAxis});
657+
hDcaXYMCBeauty[i] = histos.add<TH2>("dcaxybeauty" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaXyAxis});
658+
hDcaZMCBeauty[i] = histos.add<TH2>("dcazbeauty" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaZAxis});
659+
}
635660
}
636661

637662
// Mismatched info
@@ -1314,7 +1339,7 @@ struct tofSpectra {
13141339
histos.fill(HIST("nsigmatof/test_occupancy/neg/pr"), track.pt(), nsigmaTOFPr, multiplicity, occupancy);
13151340

13161341
} // track
1317-
} // process function
1342+
} // process function
13181343
PROCESS_SWITCH(tofSpectra, processOccupancy, "check for occupancy plots", false);
13191344

13201345
void processStandard(CollisionCandidates::iterator const& collision,
@@ -1525,7 +1550,10 @@ struct tofSpectra {
15251550

15261551
using RecoMCCollisions = soa::Join<aod::Collisions, aod::McCollisionLabels, aod::EvSels, aod::CentFT0As, aod::CentFT0Cs, aod::TPCMults, aod::PVMults, aod::MultZeqs, aod::CentFT0Ms>; // RD
15271552
template <std::size_t i, typename TrackType, typename ParticleType>
1528-
void fillTrackHistograms_MC(TrackType const& track, ParticleType const& mcParticle, RecoMCCollisions::iterator const& collision)
1553+
void fillTrackHistograms_MC(TrackType const& track,
1554+
ParticleType::iterator const& mcParticle,
1555+
RecoMCCollisions::iterator const& collision,
1556+
ParticleType const& mcParticles)
15291557
{
15301558
if (!isParticleEnabled<i>()) { // Check if the particle is enabled
15311559
return;
@@ -1549,7 +1577,12 @@ struct tofSpectra {
15491577
if (std::abs(mcParticle.y()) > trkselOptions.cfgCutY) {
15501578
return;
15511579
}
1552-
if (!mcParticle.isPhysicalPrimary()) {
1580+
1581+
if (enableDCAvsmotherHistograms) {
1582+
hDcaXYMC[i]->Fill(track.pt(), track.dcaXY());
1583+
hDcaZMC[i]->Fill(track.pt(), track.dcaZ());
1584+
}
1585+
if (!mcParticle.isPhysicalPrimary()) { // Secondaries (weak decays and material)
15531586
if (mcParticle.getProcess() == 4) {
15541587
if (enableDCAxyzHistograms) {
15551588
hDcaXYZStr[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ());
@@ -1565,18 +1598,61 @@ struct tofSpectra {
15651598
histos.fill(HIST(hdcazmat[i]), track.pt(), track.dcaZ());
15661599
}
15671600
}
1568-
} else {
1601+
} else { // Primaries
15691602
if (enableDCAxyzHistograms) {
15701603
hDcaXYZPrm[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ());
15711604
if (enableDcaGoodEvents.value && collision.has_mcCollision()) {
15721605
histos.fill(HIST(hdcaxyprmgoodevs[i]), track.pt(), track.dcaXY(), track.dcaZ());
15731606
}
15741607
} else {
1608+
// DCAxy for all primaries
15751609
histos.fill(HIST(hdcaxyprm[i]), track.pt(), track.dcaXY());
15761610
histos.fill(HIST(hdcazprm[i]), track.pt(), track.dcaZ());
1577-
if (enableDcaGoodEvents.value && collision.has_mcCollision()) {
1578-
histos.fill(HIST(hdcaxyprmgoodevs[i]), track.pt(), track.dcaXY());
1579-
histos.fill(HIST(hdcazprmgoodevs[i]), track.pt(), track.dcaZ());
1611+
}
1612+
if (enableDcaGoodEvents.value && collision.has_mcCollision()) {
1613+
histos.fill(HIST(hdcaxyprmgoodevs[i]), track.pt(), track.dcaXY());
1614+
histos.fill(HIST(hdcazprmgoodevs[i]), track.pt(), track.dcaZ());
1615+
}
1616+
1617+
if (enableDCAvsmotherHistograms) {
1618+
bool IsD0Mother = false;
1619+
bool IsCharmMother = false;
1620+
bool IsBeautyMother = false;
1621+
1622+
if (mcParticle.has_mothers()) {
1623+
const int charmOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, false);
1624+
for (const auto& mother : mcParticle.template mothers_as<aod::McParticles>()) {
1625+
const int motherPdgCode = mother.pdgCode();
1626+
if (motherPdgCode == 421) {
1627+
IsD0Mother = true;
1628+
}
1629+
if (charmOrigin == RecoDecay::OriginType::NonPrompt) {
1630+
if ((motherPdgCode) / 1000 == 5 || (motherPdgCode) / 100 == 5) {
1631+
IsBeautyMother = true;
1632+
}
1633+
}
1634+
if (charmOrigin == RecoDecay::OriginType::Prompt) {
1635+
if ((motherPdgCode) / 1000 == 4 || (motherPdgCode) / 100 == 4) {
1636+
IsCharmMother = true;
1637+
}
1638+
}
1639+
}
1640+
}
1641+
if (IsD0Mother) {
1642+
hDcaXYMCD0[i]->Fill(track.pt(), track.dcaXY());
1643+
hDcaZMCD0[i]->Fill(track.pt(), track.dcaZ());
1644+
}
1645+
if (IsCharmMother) {
1646+
hDcaXYMCCharm[i]->Fill(track.pt(), track.dcaXY());
1647+
hdcaZMCCharm[i]->Fill(track.pt(), track.dcaZ());
1648+
}
1649+
if (IsBeautyMother) {
1650+
hDcaXYMCBeauty[i]->Fill(track.pt(), track.dcaXY());
1651+
hDcaZMCBeauty[i]->Fill(track.pt(), track.dcaZ());
1652+
}
1653+
if (!IsCharmMother && !IsBeautyMother) {
1654+
hDcaXYMCNotHF[i]->Fill(track.pt(), track.dcaXY());
1655+
hDcaZMCNotHF[i]->Fill(track.pt(), track.dcaZ());
15801656
}
15811657
}
15821658
}
@@ -1817,7 +1893,7 @@ struct tofSpectra {
18171893
const auto& mcParticle = track.mcParticle();
18181894

18191895
static_for<0, 17>([&](auto i) {
1820-
fillTrackHistograms_MC<i>(track, mcParticle, track.collision_as<RecoMCCollisions>());
1896+
fillTrackHistograms_MC<i>(track, mcParticle, track.collision_as<RecoMCCollisions>(), mcParticles);
18211897
});
18221898
}
18231899
if (includeCentralityMC) {

0 commit comments

Comments
 (0)