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> 
   34    double hasCharmedDaughter(
const Particle* particle, 
const std::vector<double>& transition)
 
   39      if (abs(transition[0]) != 1) {
 
   40        B2ERROR(
"The parameter variable hasCharmedDaughter() only accepts 1 or -1 as an argument.");
 
   46        B2ERROR(
"This particle does not exist!");
 
   51      const MCParticle* mcp = particle->getMCParticle();
 
   56      if (abs(mcp->getPDG()) != 511 and abs(mcp->getPDG()) != 521)
 
   60      int nDaughters = int(mcp->getNDaughters());
 
   62        B2ERROR(
"This particle does not have any daughters!");
 
   67      int motherPDGSign = (particle->getPDGCode()) / (abs(particle->getPDGCode()));
 
   68      std::vector<MCParticle*> mcDaughters = mcp->getDaughters();
 
   70      for (
int iDaughter = 0; iDaughter < nDaughters; iDaughter++) {
 
   71        int daughterPDG = mcDaughters[iDaughter]->getPDG();
 
   72        int daughterPDGSign = daughterPDG / (abs(daughterPDG));
 
   74        if (transition[0] == 1) {
 
   75          if (((abs(daughterPDG) / 100) % 10 == 4 || (abs(daughterPDG) / 1000) % 10 == 4)
 
   76              && motherPDGSign == daughterPDGSign) 
 
   78        } 
else if (transition[0] == -1) {
 
   79          if (((abs(daughterPDG) / 100) % 10 == 4 || (abs(daughterPDG) / 1000) % 10 == 4)
 
   80              && motherPDGSign == -daughterPDGSign) 
 
   88    double hasCharmoniumDaughter(
const Particle* particle)
 
   94        B2ERROR(
"This particle does not exist!");
 
   99      const MCParticle* mcp = particle->getMCParticle();
 
  104      if (abs(mcp->getPDG()) != 511 and abs(mcp->getPDG()) != 521)
 
  108      int nDaughters = int(mcp->getNDaughters());
 
  109      if (nDaughters < 1) {
 
  110        B2ERROR(
"This particle does not have any daughters!");
 
  115      std::vector<MCParticle*> mcDaughters = mcp->getDaughters();
 
  117      for (
int iDaughter = 0; iDaughter < nDaughters; iDaughter++) {
 
  118        int daughterPDG = mcDaughters[iDaughter]->getPDG();
 
  119        if ((abs(daughterPDG) / 10) % 10 == 4 && (abs(daughterPDG) / 100) % 10 == 4) 
 
  126    double hasRealPhotonDaughter(
const Particle* particle)
 
  132        B2ERROR(
"This particle does not exist!");
 
  137      int nDaughters = int(particle->getNDaughters());
 
  138      if (nDaughters < 1) {
 
  139        B2ERROR(
"This particle does not have any daughters!");
 
  144      const std::vector<Particle*> daughters = particle->getDaughters();
 
  146      for (
int iDaughter = 0; iDaughter < nDaughters; iDaughter++) {
 
  147        double photosFlag = particleMCPhotosParticle(daughters[iDaughter]);
 
  148        int PDGcode = daughters[iDaughter]->getPDGCode();
 
  151        if (PDGcode == 
Const::photon.getPDGCode() && photosFlag > -0.5 && photosFlag < 0.5) {  
 
  159    VARIABLE_GROUP(
"DirectDaughterInfo");
 
  160    REGISTER_VARIABLE(
"hasCharmedDaughter(i)", hasCharmedDaughter,
 
  161                      "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" 
  162                      "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" 
  163                      "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.");
 
  164    REGISTER_VARIABLE(
"hasCharmoniumDaughter", hasCharmoniumDaughter,
 
  165                      "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" 
  166                      "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.");
 
  167    REGISTER_VARIABLE(
"hasRealPhotonDaughter", hasRealPhotonDaughter,
 
  168                      "Returns 1 if on MC truth level there is at least one real photon daughter, a photon that was not created by photos.\n" 
  169                      "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
Abstract base class for different kinds of events.