11 #include <analysis/variables/BasicParticleInformation.h>
12 #include <analysis/VariableManager/Manager.h>
13 #include <analysis/dataobjects/Particle.h>
22 double particleIsFromECL(
const Particle* part)
24 return (part->getParticleSource() == Particle::EParticleSourceObject::c_ECLCluster);
27 double particleIsFromKLM(
const Particle* part)
29 return (part->getParticleSource() == Particle::EParticleSourceObject::c_KLMCluster);
32 double particleIsFromTrack(
const Particle* part)
34 return (part->getParticleSource() == Particle::EParticleSourceObject::c_Track);
37 double particleIsFromV0(
const Particle* part)
39 return (part->getParticleSource() == Particle::EParticleSourceObject::c_V0);
42 double particleSource(
const Particle* part)
44 return part->getParticleSource();
47 double particleMdstArrayIndex(
const Particle* part)
49 return part->getMdstArrayIndex();
52 double uniqueParticleIdentifier(
const Particle* part)
54 return part->getMdstSource();
57 double particleIsUnspecified(
const Particle* part)
59 int properties = part->getProperty();
60 return (properties & Particle::PropertyFlags::c_IsUnspecified) ? 1.0 : 0.0;
63 double particlePvalue(
const Particle* part)
65 return part->getPValue();
68 double particleNDaughters(
const Particle* part)
70 return part->getNDaughters();
73 double particleFlavorType(
const Particle* part)
75 return part->getFlavorType();
78 double particleCharge(
const Particle* part)
80 return part->getCharge();
83 VARIABLE_GROUP(
"Basic particle information");
84 REGISTER_VARIABLE(
"isFromECL", particleIsFromECL,
"Returns 1.0 if this particle was created from an ECLCluster, 0 otherwise.");
85 REGISTER_VARIABLE(
"isFromKLM", particleIsFromKLM,
"Returns 1.0 if this particle was created from a KLMCluster, 0 otherwise.");
86 REGISTER_VARIABLE(
"isFromTrack", particleIsFromTrack,
"Returns 1.0 if this particle was created from a track, 0 otherwise.");
87 REGISTER_VARIABLE(
"isFromV0", particleIsFromV0,
"Returns 1.0 if this particle was created from a V0, 0 otherwise.");
88 REGISTER_VARIABLE(
"particleSource", particleSource, R
"DOC(
89 Returns mdst source used to create the particle. The meaning of the values are
92 * 1: created from track
93 * 2: created from ECL cluster
94 * 3: created from KLM cluster
97 * 6: composite particle
100 REGISTER_VARIABLE("mdstIndex", particleMdstArrayIndex, R
"DOC(
101 Store array index (0 - based) of the MDST object from which the Particle was created.
102 It's 0 for composite particles.
105 It is not a unique identifier of particle. For example, a pion and a gamma can have the same `mdstIndex`:
106 pions are created from tracks whereas gammas are created from ECL clusters; tracks and
107 ECL clusters are stored in different arrays. A photon may be created from ECL cluster with index 0 and a
108 pion may be created from track with index 0 will both have :b2:var:`mdstIndex` equal to 0, but they will be different particles.
111 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.
112 For example, if pion and kaon have the same :b2:var:`mdstIndex` it means that they are created from the same track.
116 If you are looking for unique identifier of the particle, please use :b2:var:`uniqueParticleIdentifier`.
118 REGISTER_VARIABLE("uniqueParticleIdentifier", uniqueParticleIdentifier, R
"DOC(
119 Returns unique identifier of final state particle.
120 Particles created from the same object (e.g. from the same track) have different :b2:var:`uniqueParticleIdentifier` value.)DOC");
122 REGISTER_VARIABLE("isUnspecified", particleIsUnspecified,
123 "returns 1 if the particle is marked as an unspecified object (like B0 -> @Xsd e+ e-), 0 if not");
124 REGISTER_VARIABLE(
"chiProb", particlePvalue, R
"DOC(
125 A context-dependent :math:`\chi^2` probability for 'the fit' related to this particle.
127 * If this particle is track-based, then this is the pvalue of the track fit (identical to :b2:var:`pValue`).
128 * If this particle is cluster-based then this variable is currently unused.
129 * 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.
132 If multiple vertex fits are performed then the last one sets the ``chiProb`` overwriting all previous.
134 .. seealso:: :b2:var:`pValue` for tracks
136 REGISTER_VARIABLE("nDaughters", particleNDaughters,
137 "number of daughter particles");
138 REGISTER_VARIABLE(
"flavor", particleFlavorType,
139 "flavor type of decay(0 = unflavored, 1 = flavored)");
140 REGISTER_VARIABLE(
"charge", particleCharge,
"charge of particle");