10#include <analysis/variables/TimeDependentVariables.h>
12#include <framework/dbobjects/BeamParameters.h>
15#include <analysis/dataobjects/Particle.h>
16#include <analysis/dataobjects/TagVertex.h>
17#include <mdst/dataobjects/MCParticle.h>
20#include <analysis/utility/DistanceTools.h>
21#include <analysis/utility/PCmsLabTransform.h>
22#include <analysis/utility/RotationTools.h>
23#include <analysis/utility/ReferenceFrame.h>
26#include <framework/gearbox/Const.h>
27#include <framework/geometry/B2Vector3.h>
45 using RotationTools::getUnitOrthogonal;
46 using RotationTools::toVec;
53 double particleTagVx(
const Particle* particle)
55 auto* vert = particle->getRelatedTo<TagVertex>();
57 return vert->getTagVertex().X();
60 double particleTagVy(
const Particle* particle)
62 auto* vert = particle->getRelatedTo<TagVertex>();
64 return vert->getTagVertex().Y();
67 double particleTagVz(
const Particle* particle)
69 auto* vert = particle->getRelatedTo<TagVertex>();
71 return vert->getTagVertex().Z();
74 double particleTruthTagVx(
const Particle* particle)
76 auto* vert = particle->getRelatedTo<TagVertex>();
78 return vert->getMCTagVertex().X();
81 double particleTruthTagVy(
const Particle* particle)
83 auto* vert = particle->getRelatedTo<TagVertex>();
85 return vert->getMCTagVertex().Y();
88 double particleTruthTagVz(
const Particle* particle)
90 auto* vert = particle->getRelatedTo<TagVertex>();
92 return vert->getMCTagVertex().Z();
95 double particleTagVxErr(
const Particle* particle)
97 auto* vert = particle->getRelatedTo<TagVertex>();
99 TMatrixDSym TagVErr = vert->getTagVertexErrMatrix();
100 return sqrt(TagVErr(0, 0));
103 double particleTagVyErr(
const Particle* particle)
105 auto* vert = particle->getRelatedTo<TagVertex>();
107 TMatrixDSym TagVErr = vert->getTagVertexErrMatrix();
108 return sqrt(TagVErr(1, 1));
111 double particleTagVzErr(
const Particle* particle)
113 auto* vert = particle->getRelatedTo<TagVertex>();
115 TMatrixDSym TagVErr = vert->getTagVertexErrMatrix();
116 return sqrt(TagVErr(2, 2));
119 double particleTagVpVal(
const Particle* particle)
121 auto* vert = particle->getRelatedTo<TagVertex>();
123 return vert->getTagVertexPval();
126 double particleTagVNTracks(
const Particle* particle)
128 auto* vert = particle->getRelatedTo<TagVertex>();
130 return vert->getNTracks();
133 double particleTagVNFitTracks(
const Particle* particle)
135 auto* vert = particle->getRelatedTo<TagVertex>();
137 return vert->getNFitTracks();
140 double particleTagVType(
const Particle* particle)
142 auto* vert = particle->getRelatedTo<TagVertex>();
144 return vert->getFitType();
147 double particleTagVNDF(
const Particle* particle)
149 auto* vert = particle->getRelatedTo<TagVertex>();
151 return vert->getTagVNDF();
154 double particleTagVChi2(
const Particle* particle)
156 auto* vert = particle->getRelatedTo<TagVertex>();
158 return vert->getTagVChi2();
161 double particleTagVChi2IP(
const Particle* particle)
163 auto* vert = particle->getRelatedTo<TagVertex>();
165 return vert->getTagVChi2IP();
170 double particleDeltaT(
const Particle* particle)
172 auto* vert = particle->getRelatedTo<TagVertex>();
174 return vert->getDeltaT();
177 double particleDeltaTErr(
const Particle* particle)
179 auto* vert = particle->getRelatedTo<TagVertex>();
181 return vert->getDeltaTErr();
184 double particleDeltaTRes(
const Particle* particle)
186 return particleDeltaT(particle) - particleMCDeltaT(particle);
189 double particleDeltaTBelle(
const Particle* particle)
191 double beta = PCmsLabTransform().getBoostVector().Mag();
192 double bg = beta /
sqrt(1 - beta * beta);
194 return particleDeltaZ(particle) / bg / c;
197 double particleMCDeltaTau(
const Particle* particle)
199 auto* vert = particle->getRelatedTo<TagVertex>();
201 return vert->getMCDeltaTau();
204 double particleMCDeltaT(
const Particle* particle)
206 auto* vert = particle->getRelatedTo<TagVertex>();
208 return vert->getMCDeltaT();
211 double particleMCDeltaBoost(
const Particle* particle)
213 auto* vert = particle->getRelatedTo<TagVertex>();
216 double beta = PCmsLabTransform().getBoostVector().Mag();
217 double bg = beta /
sqrt(1 - beta * beta);
219 return vert->getMCDeltaT() * bg * c;
222 double particleDeltaZ(
const Particle* particle)
224 auto* vert = particle->getRelatedTo<TagVertex>();
226 return particle->getZ() - vert->getTagVertex().Z();
229 double particleDeltaZErr(
const Particle* particle)
231 auto* vert = particle->getRelatedTo<TagVertex>();
234 double zVariance = particle->getVertexErrorMatrix()(2, 2);
235 double TagVZVariance = vert->getTagVertexErrMatrix()(2, 2);
236 double result =
sqrt(zVariance + TagVZVariance);
242 double particleDeltaB(
const Particle* particle)
244 auto* vert = particle->getRelatedTo<TagVertex>();
247 double beta = PCmsLabTransform().getBoostVector().Mag();
248 double bg = beta /
sqrt(1 - beta * beta);
250 return vert->getDeltaT() * bg * c;
253 double particleDeltaBErr(
const Particle* particle)
255 auto* vert = particle->getRelatedTo<TagVertex>();
258 double beta = PCmsLabTransform().getBoostVector().Mag();
259 double bg = beta /
sqrt(1 - beta * beta);
261 return vert->getDeltaTErr() * bg * c;
266 double vertexBoostDirection(
const Particle* part)
270 return pos.Dot(boostDir);
273 double vertexOrthogonalBoostDirection(
const Particle* part)
275 B2Vector3D boost = PCmsLabTransform().getBoostVector();
276 B2Vector3D orthBoostDir = getUnitOrthogonal(boost);
279 return pos.Dot(orthBoostDir);
282 double vertexTruthBoostDirection(
const Particle* part)
284 static DBObjPtr<BeamParameters> beamParamsDB;
285 B2Vector3D boostDir = -(beamParamsDB->getHER() + beamParamsDB->getLER()).BoostToCM().
Unit();
290 return pos.Dot(boostDir);
293 double vertexTruthOrthogonalBoostDirection(
const Particle* part)
295 static DBObjPtr<BeamParameters> beamParamsDB;
296 B2Vector3D boost = -(beamParamsDB->getHER() + beamParamsDB->getLER()).BoostToCM();
297 B2Vector3D orthBoostDir = getUnitOrthogonal(boost);
302 return pos.Dot(orthBoostDir);
305 double vertexErrBoostDirection(
const Particle* part)
307 TVectorD bDir = toVec(PCmsLabTransform().getBoostVector().Unit());
309 return sqrt(part->getVertexErrorMatrix().Similarity(bDir));
312 double vertexErrOrthBoostDirection(
const Particle* part)
314 TVectorD oDir = toVec(getUnitOrthogonal(PCmsLabTransform().getBoostVector()));
316 return sqrt(part->getVertexErrorMatrix().Similarity(oDir));
321 double tagVBoostDirection(
const Particle* part)
323 auto* vert = part->getRelatedTo<TagVertex>();
325 return vert->getTagVl();
328 double tagVOrthogonalBoostDirection(
const Particle* part)
330 auto* vert = part->getRelatedTo<TagVertex>();
332 return vert->getTagVol();
335 double tagVTruthBoostDirection(
const Particle* part)
337 auto* vert = part->getRelatedTo<TagVertex>();
339 return vert->getTruthTagVl();
342 double tagVTruthOrthogonalBoostDirection(
const Particle* part)
344 auto* vert = part->getRelatedTo<TagVertex>();
346 return vert->getTruthTagVol();
349 double tagVErrBoostDirection(
const Particle* part)
351 auto* vert = part->getRelatedTo<TagVertex>();
353 return vert->getTagVlErr();
356 double tagVErrOrthogonalBoostDirection(
const Particle* part)
358 auto* vert = part->getRelatedTo<TagVertex>();
360 return vert->getTagVolErr();
365 double particleCosThetaBoostDirection(
const Particle* part)
368 B2Vector3D boost = PCmsLabTransform().getBoostVector();
369 ROOT::Math::PxPyPzEVector pxpypze = frame.getMomentum(part);
370 B2Vector3D momentum(pxpypze.Px(), pxpypze.Py(), pxpypze.Pz());
371 return cos(momentum.Angle(boost));
374 double particleInternalTagVMCFlavor(
const Particle* part)
376 auto* vert = part->getRelatedTo<TagVertex>();
378 return vert->getMCTagBFlavor();
381 double tagTrackMomentum(
const Particle* part,
const std::vector<double>& trackIndex)
383 auto* vert = part->getRelatedTo<TagVertex>();
387 unsigned trackIndexInt = trackIndex.at(0);
389 return vert->getVtxFitTrackP(trackIndexInt).R();
392 double tagTrackMomentumX(
const Particle* part,
const std::vector<double>& trackIndex)
394 auto* vert = part->getRelatedTo<TagVertex>();
398 unsigned trackIndexInt = trackIndex.at(0);
400 return vert->getVtxFitTrackP(trackIndexInt).X();
403 double tagTrackMomentumY(
const Particle* part,
const std::vector<double>& trackIndex)
405 auto* vert = part->getRelatedTo<TagVertex>();
409 unsigned trackIndexInt = trackIndex.at(0);
411 return vert->getVtxFitTrackP(trackIndexInt).Y();
414 double tagTrackMomentumZ(
const Particle* part,
const std::vector<double>& trackIndex)
416 auto* vert = part->getRelatedTo<TagVertex>();
420 unsigned trackIndexInt = trackIndex.at(0);
422 return vert->getVtxFitTrackP(trackIndexInt).Z();
425 double tagTrackZ0(
const Particle* part,
const std::vector<double>& trackIndex)
427 auto* vert = part->getRelatedTo<TagVertex>();
431 unsigned trackIndexInt = trackIndex.at(0);
433 return vert->getVtxFitTrackZ0(trackIndexInt);
436 double tagTrackD0(
const Particle* part,
const std::vector<double>& trackIndex)
438 auto* vert = part->getRelatedTo<TagVertex>();
442 unsigned trackIndexInt = trackIndex.at(0);
444 return vert->getVtxFitTrackD0(trackIndexInt);
447 double tagTrackRaveWeight(
const Particle* part,
const std::vector<double>& trackIndex)
449 auto* vert = part->getRelatedTo<TagVertex>();
453 unsigned trackIndexInt = trackIndex.at(0);
455 return vert->getRaveWeight(trackIndexInt);
458 double tagTrackDistanceToConstraint(
const Particle* part,
const std::vector<double>& trackIndex)
460 auto* vert = part->getRelatedTo<TagVertex>();
464 unsigned trackIndexInt = trackIndex.at(0);
467 const Particle* tagParticle(vert->getVtxFitParticle(trackIndexInt));
471 tagParticle->getMomentum(),
472 vert->getConstraintCenter());
475 double tagTrackDistanceToConstraintErr(
const Particle* part,
const std::vector<double>& trackIndex)
477 auto* vert = part->getRelatedTo<TagVertex>();
481 unsigned trackIndexInt = trackIndex.at(0);
484 const Particle* tagParticle(vert->getVtxFitParticle(trackIndexInt));
488 TMatrixDSym trackPosCovMat = tagParticle->getVertexErrorMatrix();
491 tagParticle->getMomentum(),
492 vert->getConstraintCenter(),
494 vert->getConstraintCov());
497 double tagTrackDistanceToConstraintSignificance(
const Particle* part,
const std::vector<double>& trackIndex)
499 double val = tagTrackDistanceToConstraint(part, trackIndex);
501 double err = tagTrackDistanceToConstraintErr(part, trackIndex);
507 double tagVDistanceToConstraint(
const Particle* part)
509 auto* vert = part->getRelatedTo<TagVertex>();
515 vert->getTagVertex());
518 double tagVDistanceToConstraintErr(
const Particle* part)
520 auto* vert = part->getRelatedTo<TagVertex>();
528 TMatrixDSym emptyMat(3);
531 vert->getTagVertex(),
532 vert->getConstraintCov(),
536 double tagVDistanceToConstraintSignificance(
const Particle* part)
538 double val = tagVDistanceToConstraint(part);
540 double err = tagVDistanceToConstraintErr(part);
546 double tagTrackDistanceToTagV(
const Particle* part,
const std::vector<double>& trackIndex)
548 auto* vert = part->getRelatedTo<TagVertex>();
552 unsigned trackIndexInt = trackIndex.at(0);
554 const Particle* particle = vert->getVtxFitParticle(trackIndexInt);
558 particle->getMomentum(),
559 vert->getTagVertex());
562 double tagTrackDistanceToTagVErr(
const Particle* part,
const std::vector<double>& trackIndex)
564 auto* vert = part->getRelatedTo<TagVertex>();
568 unsigned trackIndexInt = trackIndex.at(0);
570 const Particle* tagParticle(vert->getVtxFitParticle(trackIndexInt));
574 TMatrixDSym trackPosCovMat = tagParticle->getVertexErrorMatrix();
580 TMatrixDSym emptyMat(3);
583 tagParticle->getMomentum(),
584 vert->getTagVertex(),
590 double tagTrackDistanceToTagVSignificance(
const Particle* part,
const std::vector<double>& trackIndex)
592 double val = tagTrackDistanceToTagV(part, trackIndex);
594 double err = tagTrackDistanceToTagVErr(part, trackIndex);
600 double tagTrackTrueDistanceToTagV(
const Particle* part,
const std::vector<double>& trackIndex)
602 auto* vert = part->getRelatedTo<TagVertex>();
606 unsigned trackIndexInt = trackIndex.at(0);
608 const MCParticle* mcParticle(vert->getVtxFitMCParticle(trackIndexInt));
613 if (mcTagV(0) == 0 && mcTagV(1) == 0 && mcTagV(2) == 0)
return Const::doubleNaN;
616 mcParticle->getMomentum(),
620 B2Vector3D tagTrackTrueVecToTagV(
const Particle* part,
const std::vector<double>& trackIndex)
622 auto* vert = part->getRelatedTo<TagVertex>();
623 if (!vert)
return vecNaN;
625 if (trackIndex.size() != 1)
return vecNaN;
626 unsigned trackIndexInt = trackIndex.
at(0);
628 const MCParticle* mcParticle(vert->getVtxFitMCParticle(trackIndexInt));
629 if (!mcParticle)
return vecNaN;
633 if (mcTagV(0) == 0 && mcTagV(1) == 0 && mcTagV(2) == 0)
return vecNaN;
636 mcParticle->getMomentum(),
640 double tagTrackTrueVecToTagVX(
const Particle* part,
const std::vector<double>& trackIndex)
642 B2Vector3D result = tagTrackTrueVecToTagV(part, trackIndex);
646 double tagTrackTrueVecToTagVY(
const Particle* part,
const std::vector<double>& trackIndex)
648 B2Vector3D result = tagTrackTrueVecToTagV(part, trackIndex);
652 double tagTrackTrueVecToTagVZ(
const Particle* part,
const std::vector<double>& trackIndex)
654 B2Vector3D result = tagTrackTrueVecToTagV(part, trackIndex);
658 B2Vector3D tagTrackTrueMomentum(
const Particle* part,
const std::vector<double>& trackIndex)
660 auto* vert = part->getRelatedTo<TagVertex>();
661 if (!vert)
return vecNaN;
663 if (trackIndex.size() != 1)
return vecNaN;
664 unsigned trackIndexInt = trackIndex.
at(0);
666 const MCParticle* mcParticle(vert->getVtxFitMCParticle(trackIndexInt));
667 if (!mcParticle)
return vecNaN;
669 return mcParticle->getMomentum();
672 double tagTrackTrueMomentumX(
const Particle* part,
const std::vector<double>& trackIndex)
674 B2Vector3D pTrue = tagTrackTrueMomentum(part, trackIndex);
678 double tagTrackTrueMomentumY(
const Particle* part,
const std::vector<double>& trackIndex)
680 B2Vector3D pTrue = tagTrackTrueMomentum(part, trackIndex);
684 double tagTrackTrueMomentumZ(
const Particle* part,
const std::vector<double>& trackIndex)
686 B2Vector3D pTrue = tagTrackTrueMomentum(part, trackIndex);
690 B2Vector3D tagTrackTrueOrigin(
const Particle* part,
const std::vector<double>& trackIndex)
692 auto* vert = part->getRelatedTo<TagVertex>();
693 if (!vert)
return vecNaN;
695 if (trackIndex.size() != 1)
return vecNaN;
696 unsigned trackIndexInt = trackIndex.
at(0);
698 const MCParticle* mcParticle(vert->getVtxFitMCParticle(trackIndexInt));
699 if (!mcParticle)
return vecNaN;
701 return mcParticle->getProductionVertex();
704 double tagTrackTrueOriginX(
const Particle* part,
const std::vector<double>& trackIndex)
706 B2Vector3D origin = tagTrackTrueOrigin(part, trackIndex);
710 double tagTrackTrueOriginY(
const Particle* part,
const std::vector<double>& trackIndex)
712 B2Vector3D origin = tagTrackTrueOrigin(part, trackIndex);
716 double tagTrackTrueOriginZ(
const Particle* part,
const std::vector<double>& trackIndex)
718 B2Vector3D origin = tagTrackTrueOrigin(part, trackIndex);
722 int fitTruthStatus(
const Particle* part)
724 auto* vert = part->getRelatedTo<TagVertex>();
725 if (!vert)
return -1;
726 return vert->getFitTruthStatus();
729 int rollbackStatus(
const Particle* part)
731 auto* vert = part->getRelatedTo<TagVertex>();
732 if (!vert)
return -1;
733 return vert->getRollBackStatus();
745 TagTrFPtr getTagTrackFunctionFromName(
string const& name)
747 if (name ==
"TagTrackMomentum")
return tagTrackMomentum;
748 else if (name ==
"TagTrackMomentumX")
return tagTrackMomentumX;
749 else if (name ==
"TagTrackMomentumY")
return tagTrackMomentumY;
750 else if (name ==
"TagTrackMomentumZ")
return tagTrackMomentumZ;
751 else if (name ==
"TagTrackZ0")
return tagTrackZ0;
752 else if (name ==
"TagTrackD0")
return tagTrackD0;
753 else if (name ==
"TagTrackRaveWeight")
return tagTrackRaveWeight;
754 else if (name ==
"TagTrackDistanceToConstraint")
return tagTrackDistanceToConstraint;
755 else if (name ==
"TagTrackDistanceToConstraintErr")
return tagTrackDistanceToConstraintErr;
756 else if (name ==
"TagTrackDistanceToConstraintSignificance")
return tagTrackDistanceToConstraintSignificance;
757 else if (name ==
"TagTrackDistanceToTagV")
return tagTrackDistanceToTagV;
758 else if (name ==
"TagTrackDistanceToTagVErr")
return tagTrackDistanceToTagVErr;
759 else if (name ==
"TagTrackDistanceToTagVSignificance")
return tagTrackDistanceToTagVSignificance;
760 else if (name ==
"TagTrackTrueDistanceToTagV")
return tagTrackTrueDistanceToTagV;
761 else if (name ==
"TagTrackTrueVecToTagVX")
return tagTrackTrueVecToTagVX;
762 else if (name ==
"TagTrackTrueVecToTagVY")
return tagTrackTrueVecToTagVY;
763 else if (name ==
"TagTrackTrueVecToTagVZ")
return tagTrackTrueVecToTagVZ;
764 else if (name ==
"TagTrackTrueMomentumX")
return tagTrackTrueMomentumX;
765 else if (name ==
"TagTrackTrueMomentumY")
return tagTrackTrueMomentumY;
766 else if (name ==
"TagTrackTrueMomentumZ")
return tagTrackTrueMomentumZ;
767 else if (name ==
"TagTrackTrueOriginX")
return tagTrackTrueOriginX;
768 else if (name ==
"TagTrackTrueOriginY")
return tagTrackTrueOriginY;
769 else if (name ==
"TagTrackTrueOriginZ")
return tagTrackTrueOriginZ;
771 B2ERROR(
"From TimeDependentVariables: Trying to access unknown tagTrack function");
775 double cumulate(
const Particle* part,
const std::vector<std::string>& variable,
double start,
776 std::function<
double(
double,
double,
double)> fun)
778 TagTrFPtr fptr(getTagTrackFunctionFromName(variable.at(0)));
779 auto* vert = part->getRelatedTo<TagVertex>();
781 int nTracks = vert->getNFitTracks();
785 for (
int i = 0; i < nTracks; ++i) {
786 vector<double> indx(1, i);
787 double w = tagTrackRaveWeight(part, indx);
788 double f = (*fptr)(part, indx);
790 acum = fun(acum, f, w);
798 if (variable.size() != 1) {
799 B2FATAL(
"Wrong number of arguments for meta function tagTrackAverage");
803 return [variable](
const Particle * part) ->
double {
804 double sum = cumulate(part, variable, 0, [](
double s,
double f,
double) {
return s + f;});
805 double tot = cumulate(part, variable, 0, [](
double s,
double,
double) {
return s + 1;});
812 if (variable.size() != 1) {
813 B2FATAL(
"Wrong number of arguments for meta function tagTrackAverageSquares");
817 return [variable](
const Particle * part) ->
double {
818 double sum = cumulate(part, variable, 0, [](
double s,
double f,
double) {
return s + f * f;});
819 double tot = cumulate(part, variable, 0, [](
double s,
double,
double) {
return s + 1;});
827 if (variable.size() != 1) {
828 B2FATAL(
"Wrong number of arguments for meta function tagTrackMax");
832 return [variable](
const Particle * part) ->
double {
833 double Max = cumulate(part, variable, -DBL_MAX, [](
double s,
double f,
double) {
return std::max(s, f);});
840 if (variable.size() != 1) {
841 B2FATAL(
"Wrong number of arguments for meta function tagTrackMin");
845 return [variable](
const Particle * part) ->
double {
846 double Min = cumulate(part, variable, +DBL_MAX, [](
double s,
double f,
double) {
return std::min(s, f);});
853 if (variable.size() != 1) {
854 B2FATAL(
"Wrong number of arguments for meta function tagTrackWeightedAverage");
858 return [variable](
const Particle * part) ->
double {
859 double num = cumulate(part, variable, 0, [](
double s,
double f,
double w) {
return s + w * f;});
860 double den = cumulate(part, variable, 0, [](
double s,
double,
double w) {
return s + w;});
867 if (variable.size() != 1) {
868 B2FATAL(
"Wrong number of arguments for meta function tagTrackWeightedAverageSquares");
872 return [variable](
const Particle * part) ->
double {
873 double num = cumulate(part, variable, 0, [](
double s,
double f,
double w) {
return s + w * f * f;});
874 double den = cumulate(part, variable, 0, [](
double s,
double,
double w) {
return s + w;});
881 if (variable.size() != 1) {
882 B2FATAL(
"Wrong number of arguments for meta function tagTrackSum");
886 return [variable](
const Particle * part) ->
double {
887 return cumulate(part, variable, 0, [](
double s,
double f,
double) {
return s + f;});
895 VARIABLE_GROUP(
"Time Dependent CPV Analysis Variables");
897 REGISTER_VARIABLE(
"TagVx", particleTagVx,
"Tag vertex X component\n\n",
"cm");
898 REGISTER_VARIABLE(
"TagVy", particleTagVy,
"Tag vertex Y component\n\n",
"cm");
899 REGISTER_VARIABLE(
"TagVz", particleTagVz,
"Tag vertex Z component\n\n",
"cm");
900 REGISTER_VARIABLE(
"mcTagVx", particleTruthTagVx,
"Generated Tag vertex X component\n\n",
"cm");
901 REGISTER_VARIABLE(
"mcTagVy", particleTruthTagVy,
"Generated Tag vertex Y component\n\n",
"cm");
902 REGISTER_VARIABLE(
"mcTagVz", particleTruthTagVz,
"Generated Tag vertex Z component\n\n",
"cm");
903 REGISTER_VARIABLE(
"TagVxErr", particleTagVxErr,
"Tag vertex X component uncertainty\n\n",
"cm");
904 REGISTER_VARIABLE(
"TagVyErr", particleTagVyErr,
"Tag vertex Y component uncertainty\n\n",
"cm");
905 REGISTER_VARIABLE(
"TagVzErr", particleTagVzErr,
"Tag vertex Z component uncertainty\n\n",
"cm");
906 REGISTER_VARIABLE(
"TagVpVal", particleTagVpVal,
"Tag vertex p-Value");
907 REGISTER_VARIABLE(
"TagVNTracks", particleTagVNTracks,
"Number of tracks in the tag vertex");
908 REGISTER_VARIABLE(
"TagVType", particleTagVType,
909 R
"DOC(Type of algorithm for the tag vertex. -1: failed (1,2: single track, deprecated), 3: standard, 4: standard_PXD, 5: no constraint)DOC");
910 REGISTER_VARIABLE("TagVNDF", particleTagVNDF,
"Number of degrees of freedom in the tag vertex fit");
911 REGISTER_VARIABLE(
"TagVChi2", particleTagVChi2,
"chi2 value of the tag vertex fit");
912 REGISTER_VARIABLE(
"TagVChi2IP", particleTagVChi2IP,
"IP component of chi2 value of the tag vertex fit");
914 REGISTER_VARIABLE(
"DeltaT", particleDeltaT, R
"DOC(
915 Proper decay time difference :math:`\Delta t` between signal B-meson :math:`(B_{rec})` and tag B-meson :math:`(B_{tag})`.
918 REGISTER_VARIABLE(
"DeltaTErr", particleDeltaTErr, R
"DOC(
919 Proper decay time difference :math:`\Delta t` uncertainty
922 REGISTER_VARIABLE(
"DeltaTRes", particleDeltaTRes, R
"DOC(
923 :math:`\Delta t` residual, to be used for resolution function studies
926 REGISTER_VARIABLE(
"DeltaTBelle", particleDeltaTBelle, R
"DOC(
927 [Legacy] :math:`\Delta t`, as it was used in Belle
930 REGISTER_VARIABLE(
"mcDeltaTau", particleMCDeltaTau,
931 R
"DOC(Generated proper decay time difference :math:`\Delta t`: :math:`\tau(B_{\rm rec})-\tau(B_{\rm tag})`
934 REGISTER_VARIABLE(
"mcDeltaT", particleMCDeltaT,
935 R
"DOC(Generated proper decay time difference (in z-difference approximation) :math:`\Delta t`:
936 :math:`(l(B_{\rm rec}) - l(B_{\rm tag}))/\beta_{\Upsilon(4S)}\gamma_{\Upsilon(4S)}`
939 REGISTER_VARIABLE("mcDeltaBoost", particleMCDeltaBoost,
940 R"DOC(True difference of decay vertex boost-direction components between signal B-meson :math:`(B_{rec})` and tag B-meson :math:`(B_{tag})`:
941:math:`\Delta l = l(B_{rec}) - l(B_{tag})`
944 REGISTER_VARIABLE(
"DeltaZ", particleDeltaZ,
945 R
"DOC(Difference of decay vertex longitudinal components between signal B-meson :math:`(B_{rec})` and tag B-meson :math:`(B_{tag})`:
946:math:`\Delta z = z(B_{rec}) - z(B_{tag})`
949 REGISTER_VARIABLE(
"DeltaZErr", particleDeltaZErr,
950 R
"DOC(Uncertainty of the difference :math:`z(B_{rec}) - z(B_{tag})`
953 REGISTER_VARIABLE(
"DeltaBoost", particleDeltaB, R
"DOC(:math:`\Delta z` in the boost direction
956 REGISTER_VARIABLE(
"DeltaBoostErr", particleDeltaBErr, R
"DOC(Uncertainty of :math:`\Delta z` in the boost direction
960 REGISTER_VARIABLE(
"LBoost", vertexBoostDirection,
961 "Returns the vertex component in the boost direction\n\n",
"cm");
962 REGISTER_VARIABLE(
"OBoost", vertexOrthogonalBoostDirection,
963 "Returns the vertex component in the direction orthogonal to the boost\n\n",
"cm");
964 REGISTER_VARIABLE(
"mcLBoost", vertexTruthBoostDirection,
965 "Returns the MC vertex component in the boost direction\n\n",
"cm");
966 REGISTER_VARIABLE(
"mcOBoost", vertexTruthOrthogonalBoostDirection,
967 "Returns the MC vertex component in the direction orthogonal to the boost\n\n",
"cm");
968 REGISTER_VARIABLE(
"LBoostErr", vertexErrBoostDirection,
969 "Returns the error of the vertex in the boost direction\n\n",
"cm");
970 REGISTER_VARIABLE(
"OBoostErr", vertexErrOrthBoostDirection,
971 "Returns the error of the vertex in the direction orthogonal to the boost\n\n",
"cm");
973 REGISTER_VARIABLE(
"TagVLBoost", tagVBoostDirection,
974 "Returns the TagV component in the boost direction\n\n",
"cm");
975 REGISTER_VARIABLE(
"TagVOBoost", tagVOrthogonalBoostDirection,
976 "Returns the TagV component in the direction orthogonal to the boost\n\n",
"cm");
977 REGISTER_VARIABLE(
"mcTagVLBoost", tagVTruthBoostDirection,
978 "Returns the MC TagV component in the boost direction\n\n",
"cm");
979 REGISTER_VARIABLE(
"mcTagVOBoost", tagVTruthOrthogonalBoostDirection,
980 "Returns the MC TagV component in the direction orthogonal to the boost\n\n",
"cm");
981 REGISTER_VARIABLE(
"TagVLBoostErr", tagVErrBoostDirection,
982 "Returns the error of TagV in the boost direction\n\n",
"cm");
983 REGISTER_VARIABLE(
"TagVOBoostErr", tagVErrOrthogonalBoostDirection,
984 "Returns the error of TagV in the direction orthogonal to the boost\n\n",
"cm");
986 REGISTER_VARIABLE(
"cosAngleBetweenMomentumAndBoostVector", particleCosThetaBoostDirection,
987 "cosine of the angle between momentum and boost vector");
989 REGISTER_VARIABLE(
"internalTagVMCFlavor", particleInternalTagVMCFlavor,
990 "[Expert] [Debugging] This variable is only for internal checks of the TagV module by developers. \n"
991 "It returns the internal mc flavor information of the tag-side B provided by the TagV module.");
993 REGISTER_VARIABLE(
"TagTrackMomentum(i) ", tagTrackMomentum,
994 "Returns the magnitude of the momentum of the ith track used in the tag vtx fit.\n\n",
"GeV/c");
995 REGISTER_VARIABLE(
"TagTrackMomentumX(i) ", tagTrackMomentumX,
996 "Returns the X component of the momentum of the ith track used in the tag vtx fit.\n\n",
"GeV/c");
997 REGISTER_VARIABLE(
"TagTrackMomentumY(i) ", tagTrackMomentumY,
998 "Returns the Y component of the momentum of the ith track used in the tag vtx fit.\n\n",
"GeV/c");
999 REGISTER_VARIABLE(
"TagTrackMomentumZ(i) ", tagTrackMomentumZ,
1000 "Returns the Z component of the momentum of the ith track used in the tag vtx fit.\n\n",
"GeV/c");
1002 REGISTER_VARIABLE(
"TagTrackZ0(i)", tagTrackZ0,
"Returns the z0 parameter of the ith track used in the tag vtx fit\n\n",
"cm");
1003 REGISTER_VARIABLE(
"TagTrackD0(i)", tagTrackD0,
"Returns the d0 parameter of the ith track used in the tag vtx fit\n\n",
"cm");
1006 REGISTER_VARIABLE(
"TagTrackRaveWeight(i)", tagTrackRaveWeight,
"Returns the weight assigned by Rave to track i");
1008 REGISTER_VARIABLE(
"TagVNFitTracks", particleTagVNFitTracks,
1009 "returns the number of tracks used by rave to fit the vertex (not counting the ones coming from Kshorts)");
1011 REGISTER_VARIABLE(
"TagTrackDistanceToConstraint(i)", tagTrackDistanceToConstraint,
1012 "Returns the measured distance between the ith tag track and the centre of the constraint.\n\n",
"cm");
1014 REGISTER_VARIABLE(
"TagTrackDistanceToConstraintErr(i)", tagTrackDistanceToConstraintErr,
1015 "Returns the estimated error on the distance between the ith tag track and the centre of the constraint.\n\n",
"cm");
1017 REGISTER_VARIABLE(
"TagTrackDistanceToConstraintSignificance(i)", tagTrackDistanceToConstraintSignificance,
1018 "Returns the significance of the distance between the centre of the constraint and the tag track indexed by track index (computed as distance / uncertainty)");
1021 REGISTER_VARIABLE(
"TagVDistanceToConstraint", tagVDistanceToConstraint,
1022 "returns the measured distance between the tag vtx and the centre of the constraint.\n\n",
"cm");
1024 REGISTER_VARIABLE(
"TagVDistanceToConstraintErr", tagVDistanceToConstraintErr,
1025 "returns the estimated error on the distance between the tag vtx and the centre of the constraint.\n\n",
"cm");
1027 REGISTER_VARIABLE(
"TagVDistanceToConstraintSignificance", tagVDistanceToConstraintSignificance,
1028 "returns the significance of the distance between the tag vtx and the centre of the constraint (computed as distance / uncertainty)");
1030 REGISTER_VARIABLE(
"TagTrackDistanceToTagV(i)", tagTrackDistanceToTagV,
1031 "Returns the measured distance between the ith tag track and the tag vtx.\n\n",
"cm");
1033 REGISTER_VARIABLE(
"TagTrackDistanceToTagVErr(i)", tagTrackDistanceToTagVErr, R
"DOC(
1034Returns the estimated error on the distance between the ith tag track and the tag vtx.
1036.. warning:: Only the uncertainties on the track position parameters are taken into account.
1040 REGISTER_VARIABLE(
"TagTrackDistanceToTagVSignificance(i)", tagTrackDistanceToTagVSignificance,
1041 "Returns the significance of the distance between the tag vtx and the tag track indexed by trackIndex (computed as distance / uncertainty)");
1043 REGISTER_VARIABLE(
"TagTrackTrueDistanceToTagV(i)", tagTrackTrueDistanceToTagV,
1044 "Returns the true distance between the true B Tag decay vertex and the particle corresponding to the ith tag vtx track.\n\n",
"cm");
1046 REGISTER_VARIABLE(
"TagTrackTrueVecToTagVX(i)", tagTrackTrueVecToTagVX,
1047 "Returns the X coordinate of the vector between the mc particle corresponding to the ith tag vtx track and the true tag B decay vertex.\n\n",
1050 REGISTER_VARIABLE(
"TagTrackTrueVecToTagVY(i)", tagTrackTrueVecToTagVY,
1051 "Returns the Y coordinate of the vector between the mc particle corresponding to the ith tag vtx track and the true tag B decay vertex.\n\n",
1054 REGISTER_VARIABLE(
"TagTrackTrueVecToTagVZ(i)", tagTrackTrueVecToTagVZ,
1055 "Returns the Z coordinate of the vector between the mc particle corresponding to the ith tag vtx track and the true tag B decay vertex.\n\n",
1058 REGISTER_VARIABLE(
"TagTrackTrueMomentumX(i)", tagTrackTrueMomentumX,
1059 "Returns the X component of the true momentum of the MC particle corresponding to the ith tag vtx track.\n\n",
"GeV/c");
1061 REGISTER_VARIABLE(
"TagTrackTrueMomentumY(i)", tagTrackTrueMomentumY,
1062 "Returns the Y component of the true momentum of the MC particle corresponding to the ith tag vtx track.\n\n",
"GeV/c");
1064 REGISTER_VARIABLE(
"TagTrackTrueMomentumZ(i)", tagTrackTrueMomentumZ,
1065 "Returns the Z component of the true momentum of the MC particle corresponding to the ith tag vtx track.\n\n",
"GeV/c");
1067 REGISTER_VARIABLE(
"TagTrackTrueOriginX(i)", tagTrackTrueOriginX,
1068 "Returns the X component of the true origin of the MC particle corresponding to the ith tag vtx track.\n\n",
"cm");
1070 REGISTER_VARIABLE(
"TagTrackTrueOriginY(i)", tagTrackTrueOriginY,
1071 "Returns the Y component of the true origin of the MC particle corresponding to the ith tag vtx track.\n\n",
"cm");
1073 REGISTER_VARIABLE(
"TagTrackTrueOriginZ(i)", tagTrackTrueOriginZ,
1074 "Returns the Z component of the true origin of the MC particle corresponding to the ith tag vtx track.\n\n",
"cm");
1076 REGISTER_VARIABLE(
"TagVFitTruthStatus", fitTruthStatus, R
"DOC(
1077Returns the status of the fit performed with the truth info. Possible values are:
1079- -1: no related TagVertex found
1080- 0: fit performed with measured parameters
1081- 1: fit performed with true parameters
1082- 2: unable to recover truth parameters
1085 REGISTER_VARIABLE("TagVRollBackStatus", rollbackStatus, R
"DOC(
1086Returns the status of the fit performed with rolled back tracks. Possible values are:
1088- -1: no related TagVertex found
1089- 0: fit performed with measured parameters
1090- 1: fit performed with true parameters
1091- 2: unable to recover truth parameters
1094 REGISTER_METAVARIABLE("TagTrackMax(var)", tagTrackMax,
1095 "return the maximum value of the variable ``var`` evaluated for each tag track. ``var`` must be one of the TagTrackXXX variables, for example: ``TagTrackMax(TagTrackDistanceToConstraint)``. The tracks that are assigned a zero weight are ignored.",
1096 Manager::VariableDataType::c_double);
1098 REGISTER_METAVARIABLE(
"TagTrackMin(var)", tagTrackMin,
1099 "return the minimum value of the variable ``var`` evaluated for each tag track. ``var`` must be one of the TagTrackXXX variables, for example: ``TagTrackMin(TagTrackDistanceToConstraint)``. The tracks that are assigned a zero weight are ignored.",
1100 Manager::VariableDataType::c_double);
1102 REGISTER_METAVARIABLE(
"TagTrackAverage(var)", tagTrackAverage,
1103 "return the average over the tag tracks of the variable ``var``. ``var`` must be one of the TagTrackXXX variables, for example: ``TagTrackAverage(TagTrackDistanceToConstraint)``. The tracks that are assigned a zero weight are ignored.",
1104 Manager::VariableDataType::c_double);
1106 REGISTER_METAVARIABLE(
"TagTrackAverageSquares(var)", tagTrackAverageSquares,
1107 "return the average over the tag tracks of the square of the variable ``var``. ``var`` must be one of the TagTrackXXX variables, for example: ``TagTrackAverageSquares(TagTrackDistanceToConstraint)``. The tracks that are assigned a zero weight are ignored.",
1108 Manager::VariableDataType::c_double);
1110 REGISTER_METAVARIABLE(
"TagTrackWeightedAverage(var)", tagTrackWeightedAverage,
1111 "return the average over the tag tracks of the variable ``var``, weighted by weights of the tag vertex fitter. ``var`` must be one of the TagTrackXXX variables, for example: ``TagTrackWeightedAverage(TagTrackDistanceToConstraint)``.",
1112 Manager::VariableDataType::c_double);
1114 REGISTER_METAVARIABLE(
"TagTrackWeightedAverageSquares(var)", tagTrackWeightedAverageSquares,
1115 "return the average over the tag tracks of the variable ``var``, weighted by weights of the tag vertex fitter. ``var`` must be one of the TagTrackXXX variables, for example: ``TagTrackWeightedAverageSquares(TagTrackDistanceToConstraint)``.",
1116 Manager::VariableDataType::c_double);
1118 REGISTER_METAVARIABLE(
"TagTrackSum(var)", tagTrackSum,
1119 "Returns the sum of the provided variable for all tag tracks. The variable must be one of the TagTrackXXX variables, "
1120 "for example ``TagTrackSum(TagTrackD0)``. The tracks that are assigned a zero weight are ignored.",
1121 Manager::VariableDataType::c_double);
B2Vector3< DataType > Unit() const
Unit vector parallel to this.
static const double speedOfLight
[cm/ns]
static const double doubleNaN
quiet_NaN
const MCParticle * getMCParticle() const
Returns the pointer to the MCParticle object that was used to create this Particle (ParticleType == c...
static const ReferenceFrame & GetCurrent()
Get current rest frame.
std::function< VarVariant(const Particle *)> FunctionPtr
functions stored take a const Particle* and return VarVariant.
B2Vector3< float > B2Vector3F
typedef for common usage with float
B2Vector3< double > B2Vector3D
typedef for common usage with double
DataType at(unsigned i) const
safe member access (with boundary check!)
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.