9 #include <analysis/variables/BasicParticleInformation.h>
10 #include <analysis/VariableManager/Manager.h>
11 #include <analysis/dataobjects/Particle.h>
20 double particleIsFromECL(
const Particle* part)
22 return (part->getParticleSource() == Particle::EParticleSourceObject::c_ECLCluster);
25 double particleIsFromKLM(
const Particle* part)
27 return (part->getParticleSource() == Particle::EParticleSourceObject::c_KLMCluster);
30 double particleIsFromTrack(
const Particle* part)
32 return (part->getParticleSource() == Particle::EParticleSourceObject::c_Track);
35 double particleIsFromV0(
const Particle* part)
37 return (part->getParticleSource() == Particle::EParticleSourceObject::c_V0);
40 double particleSource(
const Particle* part)
42 return part->getParticleSource();
45 double particleMdstArrayIndex(
const Particle* part)
47 return part->getMdstArrayIndex();
50 double uniqueParticleIdentifier(
const Particle* part)
52 return part->getMdstSource();
55 double particleIsUnspecified(
const Particle* part)
57 int properties = part->getProperty();
58 return (properties & Particle::PropertyFlags::c_IsUnspecified) ? 1.0 : 0.0;
61 double particlePvalue(
const Particle* part)
63 return part->getPValue();
66 double particleNDaughters(
const Particle* part)
68 return part->getNDaughters();
71 double particleFlavorType(
const Particle* part)
73 return part->getFlavorType();
76 double particleCharge(
const Particle* part)
78 return part->getCharge();
81 VARIABLE_GROUP(
"Basic particle information");
82 REGISTER_VARIABLE(
"isFromECL", particleIsFromECL,
"Returns 1.0 if this particle was created from an ECLCluster, 0 otherwise.");
83 REGISTER_VARIABLE(
"isFromKLM", particleIsFromKLM,
"Returns 1.0 if this particle was created from a KLMCluster, 0 otherwise.");
84 REGISTER_VARIABLE(
"isFromTrack", particleIsFromTrack,
"Returns 1.0 if this particle was created from a track, 0 otherwise.");
85 REGISTER_VARIABLE(
"isFromV0", particleIsFromV0,
"Returns 1.0 if this particle was created from a V0, 0 otherwise.");
86 REGISTER_VARIABLE(
"particleSource", particleSource, R
"DOC(
87 Returns mdst source used to create the particle. The meaning of the values are
90 * 1: created from track
91 * 2: created from ECL cluster
92 * 3: created from KLM cluster
95 * 6: composite particle
98 REGISTER_VARIABLE("mdstIndex", particleMdstArrayIndex, R
"DOC(
99 Store array index (0 - based) of the MDST object from which the Particle was created.
100 It's 0 for composite particles.
103 It is not a unique identifier of particle. For example, a pion and a gamma can have the same `mdstIndex`:
104 pions are created from tracks whereas gammas are created from ECL clusters; tracks and
105 ECL clusters are stored in different arrays. A photon may be created from ECL cluster with index 0 and a
106 pion may be created from track with index 0 will both have :b2:var:`mdstIndex` equal to 0, but they will be different particles.
109 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.
110 For example, if pion and kaon have the same :b2:var:`mdstIndex` it means that they are created from the same track.
114 If you are looking for unique identifier of the particle, please use :b2:var:`uniqueParticleIdentifier`.
116 REGISTER_VARIABLE("uniqueParticleIdentifier", uniqueParticleIdentifier, R
"DOC(
117 Returns unique identifier of final state particle.
118 Particles created from the same object (e.g. from the same track) have different :b2:var:`uniqueParticleIdentifier` value.)DOC");
120 REGISTER_VARIABLE("isUnspecified", particleIsUnspecified,
121 "Returns 1 if the particle is marked as an unspecified object (like B0 -> @Xsd e+ e-), 0 otherwise");
122 REGISTER_VARIABLE(
"chiProb", particlePvalue, R
"DOC(
123 A context-dependent :math:`\chi^2` probability for 'the fit' related to this particle.
125 * If this particle is track-based, then this is the pvalue of the track fit (identical to :b2:var:`pValue`).
126 * If this particle is cluster-based then this variable is currently unused.
127 * If this particle is composite and a vertex fit has been performed, then this is the :math:`\chi^2` probability of the vertex fit result.
130 If multiple vertex fits are performed then the last one sets the ``chiProb`` overwriting all previous.
132 .. seealso:: :b2:var:`pValue` for tracks
134 REGISTER_VARIABLE("nDaughters", particleNDaughters,
135 "Returns number of daughter particles");
136 REGISTER_VARIABLE(
"flavor", particleFlavorType,
137 "Returns 1.0 if particle is flavored type, 0.0 if it is unflavored.");
138 REGISTER_VARIABLE(
"charge", particleCharge,
"Returns electric charge of particle in units of :math:`e`.");
Abstract base class for different kinds of events.