12 #include <analysis/variables/ParticleDaughterVariables.h>
14 #include <analysis/VariableManager/Manager.h>
15 #include <analysis/variables/MCTruthVariables.h>
18 #include <analysis/dataobjects/Particle.h>
19 #include <mdst/dataobjects/MCParticle.h>
22 #include <framework/logging/Logger.h>
36 double hasCharmedDaughter(
const Particle* particle,
const std::vector<double>& transition)
41 if (abs(transition[0]) != 1) {
42 B2ERROR(
"The parameter variable hasCharmedDaughter() only accepts 1 or -1 as an argument.");
43 return std::numeric_limits<float>::quiet_NaN();
48 B2ERROR(
"This particle does not exist!");
49 return std::numeric_limits<float>::quiet_NaN();
53 const MCParticle* mcp = particle->getRelated<MCParticle>();
55 return std::numeric_limits<float>::quiet_NaN();
58 if (abs(mcp->getPDG()) != 511 and abs(mcp->getPDG()) != 521)
59 return std::numeric_limits<float>::quiet_NaN();
62 int nDaughters = int(mcp->getNDaughters());
64 B2ERROR(
"This particle does not have any daughters!");
65 return std::numeric_limits<float>::quiet_NaN();
69 int motherPDGSign = (particle->getPDGCode()) / (abs(particle->getPDGCode()));
70 std::vector<MCParticle*> mcDaughters = mcp->getDaughters();
72 for (
int iDaughter = 0; iDaughter < nDaughters; iDaughter++) {
73 int daughterPDG = mcDaughters[iDaughter]->getPDG();
74 int daughterPDGSign = daughterPDG / (abs(daughterPDG));
76 if (transition[0] == 1) {
77 if (((abs(daughterPDG) / 100) % 10 == 4 || (abs(daughterPDG) / 1000) % 10 == 4)
78 && motherPDGSign == daughterPDGSign)
80 }
else if (transition[0] == -1) {
81 if (((abs(daughterPDG) / 100) % 10 == 4 || (abs(daughterPDG) / 1000) % 10 == 4)
82 && motherPDGSign == -daughterPDGSign)
90 double hasCharmoniumDaughter(
const Particle* particle)
96 B2ERROR(
"This particle does not exist!");
97 return std::numeric_limits<float>::quiet_NaN();
101 const MCParticle* mcp = particle->getRelated<MCParticle>();
103 return std::numeric_limits<float>::quiet_NaN();
106 if (abs(mcp->getPDG()) != 511 and abs(mcp->getPDG()) != 521)
107 return std::numeric_limits<float>::quiet_NaN();
110 int nDaughters = int(mcp->getNDaughters());
111 if (nDaughters < 1) {
112 B2ERROR(
"This particle does not have any daughters!");
113 return std::numeric_limits<float>::quiet_NaN();
117 std::vector<MCParticle*> mcDaughters = mcp->getDaughters();
119 for (
int iDaughter = 0; iDaughter < nDaughters; iDaughter++) {
120 int daughterPDG = mcDaughters[iDaughter]->getPDG();
121 if ((abs(daughterPDG) / 10) % 10 == 4 && (abs(daughterPDG) / 100) % 10 == 4)
128 double hasRealPhotonDaughter(
const Particle* particle)
134 B2ERROR(
"This particle does not exist!");
135 return std::numeric_limits<float>::quiet_NaN();
139 int nDaughters = int(particle->getNDaughters());
140 if (nDaughters < 1) {
141 B2ERROR(
"This particle does not have any daughters!");
142 return std::numeric_limits<float>::quiet_NaN();
146 const std::vector<Particle*> daughters = particle->getDaughters();
148 for (
int iDaughter = 0; iDaughter < nDaughters; iDaughter++) {
149 double photosFlag = particleMCPhotosParticle(daughters[iDaughter]);
150 int PDGcode = daughters[iDaughter]->getPDGCode();
153 if (PDGcode == 22 && photosFlag > -0.5 && photosFlag < 0.5) {
161 VARIABLE_GROUP(
"DirectDaughterInfo");
162 REGISTER_VARIABLE(
"hasCharmedDaughter(i)", hasCharmedDaughter,
163 "Returns information regarding the charm quark presence in the decay.");
164 REGISTER_VARIABLE(
"hasCharmoniumDaughter", hasCharmoniumDaughter,
165 "Returns information regarding the charmonium state presence in the decay.");
166 REGISTER_VARIABLE(
"hasRealPhotonDaughter", hasRealPhotonDaughter,
167 "Returns information regarding photon daughter origin for a particle.");