Skip to content

Commit 39b855e

Browse files
authored
[PWGCF] Update in D0 analysis (MC,ML, SB) (#10031)
1 parent 410a6e5 commit 39b855e

File tree

4 files changed

+730
-252
lines changed

4 files changed

+730
-252
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
// Copyright 2019-2022 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file FemtoUniverseSoftPionRemoval.h
13+
/// \brief FemtoUniverseSoftPionRemoval - Checking the soft pions from D* decay and removing them
14+
/// \author Katarzyna Gwiździel, WUT, katarzyna.gwizdziel@cern.ch
15+
16+
#ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSESOFTPIONREMOVAL_H_
17+
#define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSESOFTPIONREMOVAL_H_
18+
19+
#include <vector>
20+
21+
#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h"
22+
#include "Framework/HistogramRegistry.h"
23+
24+
namespace o2::analysis::femto_universe
25+
{
26+
27+
/// \class FemtoUniverseSoftPionRemoval
28+
/// \brief Class taking care of removing soft pions from D* decays
29+
/// \tparam partOne Type of particle 1 (Track/D0/...)
30+
/// \tparam partTwo Type of particle 2 (Track/D0/...)
31+
template <o2::aod::femtouniverseparticle::ParticleType partOne, o2::aod::femtouniverseparticle::ParticleType partTwo>
32+
class FemtoUniverseSoftPionRemoval
33+
{
34+
public:
35+
/// Destructor
36+
virtual ~FemtoUniverseSoftPionRemoval() = default;
37+
38+
/// Initialization of the QA histograms
39+
/// \param registry HistogramRegistry
40+
void init(HistogramRegistry* registry)
41+
{
42+
if (registry) {
43+
mHistogramRegistry = registry;
44+
mHistogramRegistry->add("SoftPion/softPionMassVsPt", "; M(K#pi#pi-K#pi); p_{T}", kTH2F, {{200, 0.0, 0.2}, {36, 0., 36.}});
45+
}
46+
}
47+
48+
/// Check whether a track is a soft pion from D* decay
49+
/// \tparam Part Data type of the particle
50+
/// \tparam Parts Data type of the collection of all particles
51+
/// \param part1 Particle 1
52+
/// \param part2 Particle 2
53+
/// \param particles Collection of all particles passed to the task
54+
/// \return Whether the track is a soft pion
55+
template <typename Part, typename Parts>
56+
bool isSoftPion(Part const& part1, Part const& part2, Parts const& particles, bool isD0Cand, bool isD0barCand, double sigma)
57+
{
58+
if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kD0) {
59+
/// Track-D0 combination part1 is hadron and part2 is D0
60+
if (part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kD0) {
61+
LOG(fatal) << "FemtoUniverseSoftPionRemoval: passed arguments don't agree with FemtoUniverseSoftPionRemoval instantiation! Please provide second argument kD0 candidate.";
62+
return false;
63+
}
64+
// Getting D0 (part2) children
65+
const auto& posChild = particles.iteratorAt(part2.index() - 2);
66+
const auto& negChild = particles.iteratorAt(part2.index() - 1);
67+
// Pion and kaon mass
68+
double massPion = o2::constants::physics::MassPiPlus;
69+
double massKaon = o2::constants::physics::MassKPlus;
70+
// D* reconstruction
71+
double pSum2 = std::pow(posChild.px() + negChild.px() + part1.px(), 2.0) + std::pow(posChild.py() + negChild.py() + part1.py(), 2.0) + std::pow(posChild.pz() + negChild.pz() + part1.pz(), 2.0);
72+
// Energies of the daughters -> D0->K-pi+
73+
double e1Pi = std::sqrt(std::pow(massPion, 2.0) + std::pow(posChild.px(), 2.0) + std::pow(posChild.py(), 2.0) + std::pow(posChild.pz(), 2.0));
74+
double e1K = std::sqrt(std::pow(massKaon, 2.0) + std::pow(negChild.px(), 2.0) + std::pow(negChild.py(), 2.0) + std::pow(negChild.pz(), 2.0));
75+
// Energies of the daughters -> D0bar->K+pi-
76+
double e2Pi = std::sqrt(std::pow(massPion, 2.0) + std::pow(negChild.px(), 2.0) + std::pow(negChild.py(), 2.0) + std::pow(negChild.pz(), 2.0));
77+
double e2K = std::sqrt(std::pow(massKaon, 2.0) + std::pow(posChild.px(), 2.0) + std::pow(posChild.py(), 2.0) + std::pow(posChild.pz(), 2.0));
78+
// Soft pion energy
79+
auto ePion = RecoDecay::e(massPion, part1.p());
80+
// D* masses
81+
double mDstar1 = std::sqrt(std::pow(e1Pi + e1K + ePion, 2.0) - pSum2);
82+
double mDstar2 = std::sqrt(std::pow(e2Pi + e2K + ePion, 2.0) - pSum2);
83+
84+
bool isSoftPion = false;
85+
double softPiMass = 0.14542; // pion mass in D*->D0pi decay
86+
double lowMassLimitSoftPion = softPiMass - 3.0 * sigma;
87+
double highMassLimitSoftPion = softPiMass + 3.0 * sigma;
88+
89+
if (isD0Cand) {
90+
if (mDstar1 - part2.mLambda() > 0.) {
91+
mHistogramRegistry->fill(HIST("SoftPion/softPionMassVsPt"), mDstar1 - part2.mLambda(), part2.pt());
92+
}
93+
if ((std::abs(mDstar1 - part2.mLambda()) > lowMassLimitSoftPion) && (std::abs(mDstar1 - part2.mLambda()) < highMassLimitSoftPion)) {
94+
isSoftPion = true;
95+
}
96+
}
97+
98+
if (isD0barCand) {
99+
if (mDstar2 - part2.mAntiLambda() > 0.) {
100+
mHistogramRegistry->fill(HIST("SoftPion/softPionMassVsPt"), mDstar2 - part2.mAntiLambda(), part2.pt());
101+
}
102+
if ((std::abs(mDstar2 - part2.mAntiLambda()) > lowMassLimitSoftPion) && (std::abs(mDstar2 - part2.mAntiLambda()) < highMassLimitSoftPion)) {
103+
isSoftPion = true;
104+
}
105+
}
106+
return isSoftPion;
107+
} else {
108+
LOG(fatal) << "FemtoUniverseSoftPionRemoval: Combination of objects not defined - quitting!";
109+
return false;
110+
}
111+
}
112+
113+
private:
114+
HistogramRegistry* mHistogramRegistry; ///< For QA output
115+
static constexpr o2::aod::femtouniverseparticle::ParticleType kPartOneType = partOne; ///< Type of particle 1
116+
static constexpr o2::aod::femtouniverseparticle::ParticleType kPartTwoType = partTwo; ///< Type of particle 2
117+
};
118+
} // namespace o2::analysis::femto_universe
119+
120+
#endif // PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSESOFTPIONREMOVAL_H_

PWGCF/FemtoUniverse/DataModel/FemtoDerived.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ DECLARE_SOA_DYNAMIC_COLUMN(Theta, theta, //! Compute the theta of the track
105105
});
106106
DECLARE_SOA_DYNAMIC_COLUMN(Px, px, //! Compute the momentum in x in GeV/c
107107
[](float pt, float phi) -> float {
108-
return pt * std::sin(phi);
108+
return pt * std::cos(phi);
109109
});
110110
DECLARE_SOA_DYNAMIC_COLUMN(Py, py, //! Compute the momentum in y in GeV/c
111111
[](float pt, float phi) -> float {
112-
return pt * std::cos(phi);
112+
return pt * std::sin(phi);
113113
});
114114
DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, //! Compute the momentum in z in GeV/c
115115
[](float pt, float eta) -> float {
@@ -123,7 +123,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, //! Compute the overall momentum in GeV/c
123123
DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! Sign of the track charge
124124
DECLARE_SOA_COLUMN(TpcNClsFound, tpcNClsFound, uint8_t); //! Number of TPC clusters
125125
DECLARE_SOA_COLUMN(TpcNClsCrossedRows, tpcNClsCrossedRows, uint8_t); //! Number of TPC crossed rows
126-
DECLARE_SOA_COLUMN(TPCFractionSharedCls, tpcFractionSharedCls, float); //! Number of TPC crossed rows
126+
DECLARE_SOA_COLUMN(TpcFractionSharedCls, tpcFractionSharedCls, float); //! Number of TPC crossed rows
127127
DECLARE_SOA_COLUMN(ItsNCls, itsNCls, uint8_t); //! Number of ITS clusters
128128
DECLARE_SOA_COLUMN(ItsNClsInnerBarrel, itsNClsInnerBarrel, uint8_t); //! Number of ITS clusters in the inner barrel //! TPC signal
129129
DECLARE_SOA_DYNAMIC_COLUMN(TpcCrossedRowsOverFindableCls, tpcCrossedRowsOverFindableCls, //! Compute the number of crossed rows over findable TPC clusters
@@ -182,7 +182,7 @@ DECLARE_SOA_TABLE(FDExtParticles, "AOD", "FDEXTPARTICLE",
182182
track::TPCNClsFindable,
183183
femtouniverseparticle::TpcNClsCrossedRows,
184184
track::TPCNClsShared,
185-
femtouniverseparticle::TPCFractionSharedCls,
185+
femtouniverseparticle::TpcFractionSharedCls,
186186
track::TPCInnerParam,
187187
femtouniverseparticle::ItsNCls,
188188
femtouniverseparticle::ItsNClsInnerBarrel,
@@ -260,6 +260,8 @@ enum ParticleOriginMCTruth {
260260
kFake, //! particle, that has NOT the PDG code of the current analysed particle
261261
kDaughterLambda, //! Daughter from a Lambda decay
262262
kDaughterSigmaplus, //! Daughter from a Sigma^plus decay
263+
kPrompt, //! Orgin for D0/D0bar mesons
264+
kNonPrompt, //! Orgin for D0/D0bar mesons
263265
kNOriginMCTruthTypes
264266
};
265267

@@ -271,7 +273,9 @@ static constexpr std::string_view ParticleOriginMCTruthName[kNOriginMCTruthTypes
271273
"_NotPrimary",
272274
"_Fake",
273275
"_DaughterLambda",
274-
"DaughterSigmaPlus"};
276+
"DaughterSigmaPlus",
277+
"_Prompt",
278+
"_NonPrompt"};
275279

276280
/// Distinguished between reconstructed and truth
277281
enum MCType {

0 commit comments

Comments
 (0)