9 #include <analysis/variables/BelleVariables.h>
11 #include <analysis/dataobjects/Particle.h>
12 #include <analysis/variables/Variables.h>
13 #include <analysis/variables/VertexVariables.h>
14 #include <analysis/variables/ECLVariables.h>
15 #include <analysis/variables/TrackVariables.h>
16 #include <analysis/variables/V0DaughterTrackVariables.h>
17 #include <mdst/dataobjects/Track.h>
18 #include <analysis/variables/VertexVariables.h>
20 #include <framework/logging/Logger.h>
21 #include <framework/gearbox/Const.h>
23 #include <framework/database/DBObjPtr.h>
24 #include <mdst/dbobjects/BeamSpot.h>
26 #include <framework/datastore/StoreArray.h>
27 #include <b2bii/dataobjects/BelleTrkExtra.h>
39 double goodBelleKshort(
const Particle* KS)
42 if (KS->getNDaughters() != 2) {
43 B2WARNING(
"goodBelleKshort is only defined for a particle with two daughters");
46 const Particle* d0 = KS->getDaughter(0);
47 const Particle* d1 = KS->getDaughter(1);
48 if ((d0->getCharge() == 0) || (d1->getCharge() == 0)) {
49 B2WARNING(
"goodBelleKshort is only defined for a particle with charged daughters");
53 B2WARNING(
"goodBelleKshort is being applied to a candidate with PDG " << KS->getPDGCode());
56 if (KS->hasExtraInfo(
"goodKs")) {
57 return KS->getExtraInfo(
"goodKs");
61 double p = particleP(KS);
62 double fl = particleDRho(KS);
63 double dphi = acos(((particleDX(KS) * particlePx(KS)) + (particleDY(KS) * particlePy(KS))) / (fl * sqrt(particlePx(KS) * particlePx(
64 KS) + particlePy(KS) * particlePy(KS))));
66 double dr = std::min(abs(particleDRho(d0)), abs(particleDRho(d1)));
67 double zdist = v0DaughterZ0Diff(KS);
69 bool low = p < 0.5 && abs(zdist) < 0.8 && dr > 0.05 && dphi < 0.3;
70 bool mid = p < 1.5 && p > 0.5 && abs(zdist) < 1.8 && dr > 0.03 && dphi < 0.1 && fl > .08;
71 bool high = p > 1.5 && abs(zdist) < 2.4 && dr > 0.02 && dphi < 0.03 && fl > .22;
73 if (low || mid || high) {
80 double goodBelleLambda(
const Particle* Lambda)
82 if (Lambda->getNDaughters() != 2) {
83 B2WARNING(
"goodBelleLambda is only defined for a particle with two daughters");
86 const Particle* d0 = Lambda->getDaughter(0);
87 const Particle* d1 = Lambda->getDaughter(1);
88 if ((d0->getCharge() == 0) || (d1->getCharge() == 0)) {
89 B2WARNING(
"goodBelleLambda is only defined for a particle with charged daughters");
93 B2WARNING(
"goodBelleLambda is being applied to a candidate with PDG " << Lambda->getPDGCode());
96 if (Lambda->hasExtraInfo(
"goodLambda"))
97 return Lambda->getExtraInfo(
"goodLambda");
99 double p = particleP(Lambda);
100 double dr = std::min(abs(particleDRho(d0)), abs(particleDRho(d1)));
101 double zdist = v0DaughterZ0Diff(Lambda);
102 double dphi = acos(cosAngleBetweenMomentumAndVertexVectorInXYPlane(Lambda));
104 double fl = particleDRho(Lambda);
107 bool high1 = p >= 1.5 && abs(zdist) < 12.9 && dr > 0.008 && dphi < 0.09 && fl > 0.22;
108 bool mid1 = p >= 0.5 && p < 1.5 && abs(zdist) < 9.8 && dr > 0.01 && dphi < 0.18 && fl > 0.16;
109 bool low1 = p < 0.5 && abs(zdist) < 2.4 && dr > 0.027 && dphi < 1.2 && fl > 0.11;
112 bool high2 = p >= 1.5 && abs(zdist) < 7.7 && dr > 0.018 && dphi < 0.07 && fl > 0.35;
113 bool mid2 = p >= 0.5 && p < 1.5 && abs(zdist) < 2.1 && dr > 0.033 && dphi < 0.10 && fl > 0.24;
114 bool low2 = p < 0.5 && abs(zdist) < 1.9 && dr > 0.059 && dphi < 0.6 && fl > 0.17;
116 if (low2 || mid2 || high2) {
118 }
else if (low1 || mid1 || high1) {
126 bool isGoodBelleGamma(
int region,
double energy)
128 bool goodGammaRegion1, goodGammaRegion2, goodGammaRegion3;
129 goodGammaRegion1 = region == 1 && energy > 0.100;
130 goodGammaRegion2 = region == 2 && energy > 0.050;
131 goodGammaRegion3 = region == 3 && energy > 0.150;
133 return goodGammaRegion1 || goodGammaRegion2 || goodGammaRegion3;
136 double goodBelleGamma(
const Particle* particle)
138 double energy = eclClusterE(particle);
139 int region = eclClusterDetectionRegion(particle);
141 return (
double) isGoodBelleGamma(region, energy);
144 BelleTrkExtra* getBelleTrkExtraInfoFromParticle(Particle
const* particle)
146 const Track* track = particle->getTrack();
150 auto belleTrkExtra = track->getRelatedTo<BelleTrkExtra>();
151 if (!belleTrkExtra) {
154 return belleTrkExtra;
157 double BelleFirstCDCHitX(
const Particle* particle)
159 auto belleTrkExtra = getBelleTrkExtraInfoFromParticle(particle);
160 if (!belleTrkExtra) {
161 B2WARNING(
"Cannot find BelleTrkExtra, did you forget to enable BelleTrkExtra during the conversion?");
162 return std::numeric_limits<double>::quiet_NaN();
164 return belleTrkExtra->getTrackFirstX();
167 double BelleFirstCDCHitY(
const Particle* particle)
169 auto belleTrkExtra = getBelleTrkExtraInfoFromParticle(particle);
170 if (!belleTrkExtra) {
171 B2WARNING(
"Cannot find BelleTrkExtra, did you forget to enable BelleTrkExtra during the conversion?");
172 return std::numeric_limits<double>::quiet_NaN();
174 return belleTrkExtra->getTrackFirstY();
177 double BelleFirstCDCHitZ(
const Particle* particle)
179 auto belleTrkExtra = getBelleTrkExtraInfoFromParticle(particle);
180 if (!belleTrkExtra) {
181 B2WARNING(
"Cannot find BelleTrkExtra, did you forget to enable BelleTrkExtra during the conversion?");
182 return std::numeric_limits<double>::quiet_NaN();
184 return belleTrkExtra->getTrackFirstZ();
187 double BelleLastCDCHitX(
const Particle* particle)
189 auto belleTrkExtra = getBelleTrkExtraInfoFromParticle(particle);
190 if (!belleTrkExtra) {
191 B2WARNING(
"Cannot find BelleTrkExtra, did you forget to enable BelleTrkExtra during the conversion?");
192 return std::numeric_limits<double>::quiet_NaN();
194 return belleTrkExtra->getTrackLastX();
197 double BelleLastCDCHitY(
const Particle* particle)
199 auto belleTrkExtra = getBelleTrkExtraInfoFromParticle(particle);
200 if (!belleTrkExtra) {
201 B2WARNING(
"Cannot find BelleTrkExtra, did you forget to enable BelleTrkExtra during the conversion?");
202 return std::numeric_limits<double>::quiet_NaN();
204 return belleTrkExtra->getTrackLastY();
207 double BelleLastCDCHitZ(
const Particle* particle)
209 auto belleTrkExtra = getBelleTrkExtraInfoFromParticle(particle);
210 if (!belleTrkExtra) {
211 B2WARNING(
"Cannot find BelleTrkExtra, did you forget to enable BelleTrkExtra during the conversion?");
212 return std::numeric_limits<double>::quiet_NaN();
214 return belleTrkExtra->getTrackLastZ();
217 double BellePi0InvariantMassSignificance(
const Particle* particle)
219 TMatrixFSym covarianceMatrix(Particle::c_DimMomentum);
220 for (
auto daughter : particle->getDaughters()) {
221 covarianceMatrix += daughter->getMomentumErrorMatrix();
224 TVectorF jacobian(Particle::c_DimMomentum);
225 jacobian[0] = -1.0 * particle->getPx() / particle->getMass();
226 jacobian[1] = -1.0 * particle->getPy() / particle->getMass();
227 jacobian[2] = -1.0 * particle->getPz() / particle->getMass();
228 jacobian[3] = 1.0 * particle->getEnergy() / particle->getMass();
230 double massErrSquared = jacobian * (covarianceMatrix * jacobian);
232 if (massErrSquared < 0.0)
233 return std::numeric_limits<double>::quiet_NaN();
235 double invMass = particleInvariantMassFromDaughters(particle);
236 double nomMass = particle->getPDGMass();
238 return (invMass - nomMass) / sqrt(massErrSquared);
241 VARIABLE_GROUP(
"Belle Variables");
243 REGISTER_VARIABLE(
"goodBelleKshort", goodBelleKshort, R
"DOC(
244 [Legacy] GoodKs Returns 1.0 if a :math:`K_{S}^0\to\pi\pi` candidate passes the Belle algorithm:
245 a momentum-binned selection including requirements on impact parameter of, and
246 angle between the daughter pions as well as separation from the vertex and
247 flight distance in the transverse plane.
250 REGISTER_VARIABLE("goodBelleLambda", goodBelleLambda, R
"DOC(
251 [Legacy] Returns 2.0, 1.0, 0.0 as an indication of goodness of :math:`\Lambda^0` candidates,
254 * The distance of the two daughter tracks at their interception at z axis,
255 * the minimum distance of the daughter tracks and the IP in xy plane,
256 * the difference of the azimuthal angle of the vertex vector and the momentum vector,
257 * and the flight distance of the Lambda0 candidates in xy plane.
259 It reproduces the ``goodLambda()`` function in Belle.
261 ``goodBelleLambda`` selection 1 (selected with: ``goodBelleLambda>0``) should be used with ``atcPIDBelle(4,2) > 0.6``,
262 and ``goodBelleLambda`` selection 2 (``goodBelleLambda>1``) can be used without a proton PID cut.
263 The former cut is looser than the latter.".
265 .. warning:: ``goodBelleLambda`` is not optimized or tested on Belle II data.
268 * `BN-684`_ Lambda selection at Belle. K F Chen et al.
269 * The ``FindLambda`` class can be found at ``/belle_legacy/findLambda/findLambda.h``
271 .. _BN-684: https://belle.kek.jp/secured/belle_note/gn684/bn684.ps.gz
275 REGISTER_VARIABLE("goodBelleGamma", goodBelleGamma, R
"DOC(
276 [Legacy] Returns 1.0 if photon candidate passes simple region dependent
277 energy selection for Belle data and MC (50/100/150 MeV).
280 REGISTER_VARIABLE("BelleFirstCDCHitX", BelleFirstCDCHitX, R
"DOC(
281 [Legacy] Returns x component of starting point of the track near the 1st SVD or CDC hit for SVD1 data (exp. 7 - 27) or the 1st CDC hit for SVD2 data (from exp. 31). (Belle only, originally stored in mdst_trk_fit.)
284 REGISTER_VARIABLE("BelleFirstCDCHitY", BelleFirstCDCHitY, R
"DOC(
285 [Legacy] Returns y component of starting point of the track near the 1st SVD or CDC hit for SVD1 data (exp. 7 - 27) or the 1st CDC hit for SVD2 data (from exp. 31). (Belle only, originally stored in mdst_trk_fit.)
288 REGISTER_VARIABLE("BelleFirstCDCHitZ", BelleFirstCDCHitZ, R
"DOC(
289 [Legacy] Returns z component of starting point of the track near the 1st SVD or CDC hit for SVD1 data (exp. 7 - 27) or the 1st CDC hit for SVD2 data (from exp. 31). (Belle only, originally stored in mdst_trk_fit.)
292 REGISTER_VARIABLE("BelleLastCDCHitX", BelleLastCDCHitX, R
"DOC(
293 [Legacy] Returns x component of end point of the track near the last CDC hit. (Belle only, originally stored in mdst_trk_fit.)
296 REGISTER_VARIABLE("BelleLastCDCHitY", BelleLastCDCHitY, R
"DOC(
297 [Legacy] Returns y component of end point of the track near the last CDC hit. (Belle only, originally stored in mdst_trk_fit.)
300 REGISTER_VARIABLE("BelleLastCDCHitZ", BelleLastCDCHitZ, R
"DOC(
301 [Legacy] Returns z component of end point of the track near the last CDC hit. (Belle only, originally stored in mdst_trk_fit.)
304 REGISTER_VARIABLE("BellePi0SigM", BellePi0InvariantMassSignificance, R
"DOC(
305 [Legacy] Returns the significance of the pi0 mass used in the FEI for B2BII.
306 The significance is calculated as the difference between the reconstructed and the nominal mass divided by the mass uncertainty.
307 Since the pi0's covariance matrix for B2BII is empty, the latter is calculated using the photon daughters' covariance matrices.
311 REGISTER_VARIABLE(
"clusterBelleQuality", eclClusterDeltaL, R
"DOC(
312 [Legacy] Returns ECL cluster's quality indicating a good cluster in GSIM (stored in deltaL of ECL cluster object).
313 Belle analysis typically used clusters with quality == 0 in their :math:`E_{\text{extra ECL}}` (Belle only).
int getPDGCode() const
PDG code.
static const ParticleType Lambda
Lambda particle.
static const ParticleType Kshort
K^0_S particle.
Abstract base class for different kinds of events.