10#include <analysis/variables/ParticleDaughterVariables.h>
13#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>
23#include <framework/gearbox/Const.h>
37 double hasCharmedDaughter(
const Particle* particle,
const std::vector<double>& transition)
42 if (abs(transition[0]) != 1) {
43 B2ERROR(
"The parameter variable hasCharmedDaughter() only accepts 1 or -1 as an argument.");
49 B2ERROR(
"This particle does not exist!");
59 if (abs(mcp->getPDG()) != 511 and abs(mcp->getPDG()) != 521)
63 int nDaughters = int(mcp->getNDaughters());
65 B2ERROR(
"This particle does not have any daughters!");
70 int motherPDGSign = (particle->getPDGCode()) / (abs(particle->getPDGCode()));
71 std::vector<MCParticle*> mcDaughters = mcp->getDaughters();
73 for (
int iDaughter = 0; iDaughter < nDaughters; iDaughter++) {
74 int daughterPDG = mcDaughters[iDaughter]->getPDG();
75 int daughterPDGSign = daughterPDG / (abs(daughterPDG));
77 if (transition[0] == 1) {
78 if (((abs(daughterPDG) / 100) % 10 == 4 || (abs(daughterPDG) / 1000) % 10 == 4)
79 && motherPDGSign == daughterPDGSign)
81 }
else if (transition[0] == -1) {
82 if (((abs(daughterPDG) / 100) % 10 == 4 || (abs(daughterPDG) / 1000) % 10 == 4)
83 && motherPDGSign == -daughterPDGSign)
91 double hasCharmoniumDaughter(
const Particle* particle)
97 B2ERROR(
"This particle does not exist!");
107 if (abs(mcp->getPDG()) != 511 and abs(mcp->getPDG()) != 521)
111 int nDaughters = int(mcp->getNDaughters());
112 if (nDaughters < 1) {
113 B2ERROR(
"This particle does not have any daughters!");
118 std::vector<MCParticle*> mcDaughters = mcp->getDaughters();
120 for (
int iDaughter = 0; iDaughter < nDaughters; iDaughter++) {
121 int daughterPDG = mcDaughters[iDaughter]->getPDG();
122 if ((abs(daughterPDG) / 10) % 10 == 4 && (abs(daughterPDG) / 100) % 10 == 4)
129 double hasRealPhotonDaughter(
const Particle* particle)
135 B2ERROR(
"This particle does not exist!");
140 int nDaughters = int(particle->getNDaughters());
141 if (nDaughters < 1) {
142 B2ERROR(
"This particle does not have any daughters!");
147 const std::vector<Particle*> daughters = particle->getDaughters();
149 for (
int iDaughter = 0; iDaughter < nDaughters; iDaughter++) {
150 double photosFlag = particleMCPhotosParticle(daughters[iDaughter]);
151 int PDGcode = daughters[iDaughter]->getPDGCode();
154 if (PDGcode ==
Const::photon.getPDGCode() && photosFlag > -0.5 && photosFlag < 0.5) {
162 VARIABLE_GROUP(
"DirectDaughterInfo");
163 REGISTER_VARIABLE(
"hasCharmedDaughter(i)", hasCharmedDaughter,
164 "If i = 1 is provided it checks for b -> anti-c / anti-b -> c transition and for i = -1 it checks for b -> c / anti-b -> anti-c transitions.\n"
165 "Returns 1 if at least one of the daughters on MC truth level is a charm meson. The particle's MC partner must be a B-meson.\n"
166 "Returns 0 if no charmed daughter found on MC truth level and NaN if no MC partner was found or the related MC particle isn't a B-meson.");
167 REGISTER_VARIABLE(
"hasCharmoniumDaughter", hasCharmoniumDaughter,
168 "Returns 1 if at least one of the daughters on MC truth level is a ccbar resonance. The particle's MC partner must be a B-meson.\n"
169 "Returns 0 if no ccbar resonance found on MC truth level and NaN if no MC partner was found or the related MC particle isn't a B-meson.");
170 REGISTER_VARIABLE(
"hasRealPhotonDaughter", hasRealPhotonDaughter,
171 "Returns 1 if on MC truth level there is at least one real photon daughter, a photon that was not created by photos.\n"
172 "Returns 0 if no real photon daughter found and NaN if the particle has no daughters.");
static const double doubleNaN
quiet_NaN
static const ParticleType photon
photon particle
const MCParticle * getMCParticle() const
Returns the pointer to the MCParticle object that was used to create this Particle (ParticleType == c...
Abstract base class for different kinds of events.