10#include <analysis/variables/BasicParticleInformation.h>
13#include <analysis/VariableManager/Manager.h>
15#include <analysis/dataobjects/Particle.h>
24 bool particleIsFromECL(
const Particle* part)
26 return (part->getParticleSource() == Particle::EParticleSourceObject::c_ECLCluster);
29 bool particleIsFromKLM(
const Particle* part)
31 return (part->getParticleSource() == Particle::EParticleSourceObject::c_KLMCluster);
34 bool particleIsFromTrack(
const Particle* part)
36 return (part->getParticleSource() == Particle::EParticleSourceObject::c_Track);
39 bool particleIsFromV0(
const Particle* part)
41 return (part->getParticleSource() == Particle::EParticleSourceObject::c_V0);
44 int particleSource(
const Particle* part)
46 return part->getParticleSource();
49 int particleMdstArrayIndex(
const Particle* part)
51 return part->getMdstArrayIndex();
54 int uniqueParticleIdentifier(
const Particle* part)
56 return part->getMdstSource();
59 bool particleIsUnspecified(
const Particle* part)
61 int properties = part->getProperty();
65 double particlePvalue(
const Particle* part)
67 return part->getPValue();
70 int particleNDaughters(
const Particle* part)
72 return part->getNDaughters();
75 int particleFlavorType(
const Particle* part)
77 return part->getFlavorType();
80 double particleCharge(
const Particle* part)
82 return part->getCharge();
85 VARIABLE_GROUP(
"Basic particle information");
86 REGISTER_VARIABLE(
"isFromECL", particleIsFromECL,
87 "Returns 1.0 if this particle was created from an ``ECLCluster`` or 0.0 otherwise.");
88 REGISTER_VARIABLE(
"isFromKLM", particleIsFromKLM,
89 "Returns 1.0 if this particle was created from a ``KLMCluster`` or 0.0 otherwise.");
90 REGISTER_VARIABLE(
"isFromTrack", particleIsFromTrack,
"Returns 1.0 if this particle was created from a track or 0.0 otherwise.");
91 REGISTER_VARIABLE(
"isFromV0", particleIsFromV0, R
"DOC(
92Returns 1.0 if this particle was created from a V0 particle or 0.0 otherwise.
95 REGISTER_VARIABLE("particleSource", particleSource, R
"DOC(
97Returns the mDST source used to create the particle.
99The meaning of the values are:
102* 1: created from track
103* 2: created from an ``ECLCluster``
104* 3: created from a ``KLMCluster``
105* 4: created from a V0 particle
107* 6: composite particle
110 REGISTER_VARIABLE("mdstIndex", particleMdstArrayIndex, R
"DOC(
111Returns the store array index (0 - based) of the mDST object from which the particle was created. For composite particles, this returns 0.0.
114 Two particles of the same type can also have the same :b2:var:`mdstIndex`. This would mean that they are created from the same object.
115 For example, if pion and kaon have the same :b2:var:`mdstIndex` it means that they are created from the same track.
118 This variable is not a unique identifier of the particle. For example, a pion and a photon can have the same `mdstIndex`; even though
119 pions are created from tracks and photons are created from ECL clusters, as tracks and
120 ECL clusters are kept in different store arrays they can return the same index.
123 If you are looking for unique identifier of the particle, please use :b2:var:`uniqueParticleIdentifier`.
126 REGISTER_VARIABLE("uniqueParticleIdentifier", uniqueParticleIdentifier, R
"DOC(
127Returns the unique identifier of a final state particle.
128Particles created from the same object (e.g. from the same track) have different :b2:var:`uniqueParticleIdentifier` values.
132 REGISTER_VARIABLE("isUnspecified", particleIsUnspecified, R
"DOC(
133Returns 1.0 if the particle is marked as an unspecified object (like B0 -> @Xsd e+ e-) or 0.0 otherwise.
135.. note:: You can read more about how to define such particles here: :ref:`Marker of unspecified particle <Marker_of_unspecified_particle>`.
138 REGISTER_VARIABLE("chiProb", particlePvalue, R
"DOC(
139Returns a context-dependent :math:`\chi^2` probability for 'the fit' related to this particle.
143* If this particle is track-based, then it returns the p-value of the track fit (identical to :b2:var:`pValue`).
144* If this particle is composite, and a vertex fit has been performed, then it returns the :math:`\chi^2` probability of the vertex fit result.
145* If this particle is cluster-based then this variable is currently unused.
148 If multiple vertex fits have been performed then the last one sets the ``chiProb`` value and overwrites all the previous ones.
151 REGISTER_VARIABLE("nDaughters", particleNDaughters,
"Returns number of daughter particles or 0.0 otherwise for a particle with no daughters.");
152 REGISTER_VARIABLE(
"flavor", particleFlavorType,
"Returns 1.0 if particle has flavour or 0.0 if it is unflavored.");
153 REGISTER_VARIABLE(
"charge", particleCharge,
"Returns the electric charge of particle in units of :math:`e`.");
@ c_IsUnspecified
Ordinary particles.
Abstract base class for different kinds of events.