11 #include <analysis/modules/TagVertex/TagVertexModule.h>
17 #include <framework/datastore/StoreArray.h>
18 #include <framework/datastore/StoreObjPtr.h>
21 #include <framework/gearbox/Unit.h>
22 #include <framework/gearbox/Const.h>
23 #include <framework/logging/Logger.h>
26 #include <analysis/dataobjects/Particle.h>
27 #include <analysis/dataobjects/ParticleList.h>
28 #include <analysis/dataobjects/RestOfEvent.h>
29 #include <analysis/dataobjects/TagVertex.h>
30 #include <analysis/dataobjects/FlavorTaggerInfo.h>
33 #include <analysis/utility/PCmsLabTransform.h>
34 #include <analysis/variables/TrackVariables.h>
35 #include <analysis/utility/ParticleCopy.h>
36 #include <analysis/utility/CLHEPToROOT.h>
37 #include <analysis/utility/ROOTToCLHEP.h>
38 #include <analysis/utility/DistanceTools.h>
39 #include <analysis/utility/RotationTools.h>
42 #include <analysis/VertexFitting/KFit/VertexFitKFit.h>
45 #include <mdst/dataobjects/MCParticle.h>
46 #include <mdst/dataobjects/HitPatternVXD.h>
49 #include <framework/geometry/BFieldManager.h>
52 #include <TRotation.h>
64 static const double realNaN = std::numeric_limits<double>::quiet_NaN();
68 static const TMatrixDSym
matNaN(3, (
double [])
76 using RotationTools::rotateTensor;
77 using RotationTools::rotateTensorInv;
78 using RotationTools::toSymMatrix;
79 using RotationTools::toVec;
80 using RotationTools::getUnitOrthogonal;
92 m_Bfield(0), m_fitTruthStatus(0), m_rollbackStatus(0), m_fitPval(0), m_mcTagLifeTime(-1), m_mcPDG(0), m_mcLifeTimeReco(-1),
93 m_deltaT(0), m_deltaTErr(0), m_mcDeltaTau(0), m_mcDeltaT(0),
94 m_shiftZ(0), m_FitType(0), m_tagVl(0),
95 m_truthTagVl(0), m_tagVlErr(0), m_tagVol(0), m_truthTagVol(0), m_tagVolErr(0), m_tagVNDF(0), m_tagVChi2(0), m_tagVChi2IP(0),
99 setDescription(
"Tag side Vertex Fitter for modular analysis");
102 addParam(
"listName", m_listName,
"name of particle list",
string(
""));
103 addParam(
"confidenceLevel", m_confidenceLevel,
104 "required confidence level of fit to keep particles in the list. Note that even with confidenceLevel == 0.0, errors during the fit might discard Particles in the list. confidenceLevel = -1 if an error occurs during the fit",
106 addParam(
"MCAssociation", m_useMCassociation,
107 "'': no MC association. breco: use standard Breco MC association. internal: use internal MC association",
string(
"breco"));
108 addParam(
"constraintType", m_constraintType,
109 "Choose the type of the constraint: noConstraint, IP (tag tracks constrained to be within the beam spot), tube (long tube along the BTag line of flight, only for fully reconstruced B rec), boost (long tube along the Upsilon(4S) boost direction), (breco)",
111 addParam(
"trackFindingType", m_trackFindingType,
112 "Choose how to reconstruct the tracks on the tag side: standard, standard_PXD",
113 string(
"standard_PXD"));
114 addParam(
"maskName", m_roeMaskName,
115 "Choose ROE mask to get particles from ",
string(
""));
116 addParam(
"askMCInformation", m_mcInfo,
117 "TRUE when requesting MC Information from the tracks performing the vertex fit",
false);
118 addParam(
"reqPXDHits", m_reqPXDHits,
119 "Minimum number of PXD hits for a track to be used in the vertex fit", 0);
120 addParam(
"fitAlgorithm", m_fitAlgo,
121 "Fitter used for the tag vertex fit: Rave or KFit",
string(
"Rave"));
122 addParam(
"useTruthInFit", m_useTruthInFit,
123 "Use the true track parameters in the vertex fit",
false);
124 addParam(
"useRollBack", m_useRollBack,
125 "Use rolled back non-primary tracks",
false);
128 void TagVertexModule::initialize()
131 m_Bfield = BFieldManager::getField(m_BeamSpotCenter).Z() / Unit::T;
133 analysis::RaveSetup::initialize(1, m_Bfield);
134 B2INFO(
"TagVertexModule : magnetic field = " << m_Bfield);
136 if (m_useTruthInFit) m_fitTruthStatus = 1;
138 if (m_useRollBack) m_rollbackStatus = 1;
143 particles.isRequired();
146 verArray.registerInDataStore();
147 particles.registerRelationTo(verArray);
149 if (m_fitAlgo !=
"Rave" && m_fitAlgo !=
"KFit")
150 B2FATAL(
"TagVertexModule: invalid fitting algorithm (must be set to either Rave or KFit).");
151 if (m_useRollBack && m_useTruthInFit)
152 B2FATAL(
"TagVertexModule: invalid fitting option (useRollBack and useTruthInFit cannot be simultaneously set to true).");
154 if (m_trackFindingType ==
"singleTrack" || m_trackFindingType ==
"singleTrack_PXD")
155 B2FATAL(
"TagVertexModule : the singleTrack option is temporarily broken.");
158 void TagVertexModule::beginRun()
164 void TagVertexModule::event()
168 B2ERROR(
"TagVertexModule: ParticleList " << m_listName <<
" not found");
174 analysis::RaveSetup::initialize(1, m_Bfield);
176 std::vector<unsigned int> toRemove;
178 for (
unsigned i = 0; i < plist->getListSize(); ++i) {
181 Particle* particle = plist->getParticle(i);
182 if (m_useMCassociation ==
"breco" || m_useMCassociation ==
"internal") BtagMCVertex(particle);
183 bool ok = doVertexFit(particle);
184 if (ok) deltaT(particle);
186 if ((m_fitPval < m_confidenceLevel && m_confidenceLevel != 0)
187 || (m_fitPval <= m_confidenceLevel && m_confidenceLevel == 0)) {
188 toRemove.push_back(particle->getArrayIndex());
193 particle->addRelationTo(ver);
255 plist->removeParticles(toRemove);
259 analysis::RaveSetup::getInstance()->reset();
262 bool TagVertexModule::doVertexFit(
const Particle* Breco)
266 if (m_useTruthInFit) m_fitTruthStatus = 1;
270 if (m_useRollBack) m_rollbackStatus = 1;
282 B2ERROR(
"TagVertex: No magnetic field");
288 m_BeamSpotCenter = m_beamSpotDB->getIPPosition();
289 m_BeamSpotCov.ResizeTo(3, 3);
290 m_BeamSpotCov = m_beamSpotDB->getCovVertex();
295 double bg = beta / sqrt(1 - beta * beta);
298 double cut = 8.717575e-02 * bg;
299 m_shiftZ = 4.184436e+02 * bg * 0.0001;
303 m_constraintCov.ResizeTo(3, 3);
304 if (m_constraintType ==
"IP") tie(m_constraintCenter, m_constraintCov) = findConstraintBoost(cut);
305 else if (m_constraintType ==
"tube") tie(m_constraintCenter, m_constraintCov) = findConstraintBTube(Breco, 1000 * cut);
306 else if (m_constraintType ==
"boost") tie(m_constraintCenter, m_constraintCov) = findConstraintBoost(cut * 200000.);
307 else if (m_constraintType ==
"breco") tie(m_constraintCenter, m_constraintCov) = findConstraint(Breco, cut * 2000.);
308 else if (m_constraintType ==
"noConstraint") m_constraintCenter = TVector3();
310 B2ERROR(
"TagVertex: Invalid constraintType selected");
314 if (m_constraintCenter ==
vecNaN) {
315 B2ERROR(
"TagVertex: No correct fit constraint");
324 double minPVal = (m_fitAlgo !=
"KFit") ? 0.001 : 0.;
327 if (m_trackFindingType ==
"standard_PXD") {
328 m_tagParticles = getTagTracks_standardAlgorithm(Breco, 1);
329 if (m_tagParticles.size() > 0) {
330 ok = makeGeneralFit();
335 if (ok ==
false || m_fitPval < minPVal || m_trackFindingType ==
"standard") {
336 m_tagParticles = getTagTracks_standardAlgorithm(Breco, m_reqPXDHits);
337 ok = m_tagParticles.size() > 0;
339 ok = makeGeneralFit();
344 if ((ok ==
false || (m_fitPval <= 0. && m_fitAlgo ==
"Rave")) && m_constraintType !=
"noConstraint") {
345 tie(m_constraintCenter, m_constraintCov) = findConstraintBoost(cut * 200000.);
346 ok = (m_constraintCenter !=
vecNaN);
348 m_tagParticles = getTagTracks_standardAlgorithm(Breco, m_reqPXDHits);
349 ok = (m_tagParticles.size() > 0);
352 ok = makeGeneralFit();
363 static TLorentzVector flipVector(TLorentzVector vIn)
365 TLorentzVector vCMS = PCmsLabTransform::labToCms(vIn);
366 vCMS.SetVect(-vCMS.Vect());
367 return PCmsLabTransform::cmsToLab(vCMS);
371 pair<TVector3, TMatrixDSym> TagVertexModule::findConstraint(
const Particle* Breco,
double cut)
const
375 TMatrixDSym beamSpotCov(3);
376 beamSpotCov = m_beamSpotDB->getCovVertex();
378 analysis::RaveSetup::getInstance()->setBeamSpot(m_BeamSpotCenter, beamSpotCov);
381 double xmag = (Breco->
getVertex() - m_BeamSpotCenter).Mag();
385 TMatrixDSym PerrMatrix(7);
387 for (
int i = 0; i < 3; ++i) {
388 for (
int j = 0; j < 3; ++j) {
390 PerrMatrix(i, j) = (beamSpotCov(i, j) + TerrMatrix(i, j)) * pmag / xmag;
392 PerrMatrix(i, j) = TerrMatrix(i, j);
394 PerrMatrix(i + 4, j + 4) = TerrMatrix(i + 4, j + 4);
398 PerrMatrix(3, 3) = 0.;
401 Particle* Breco2 = ParticleCopy::copyParticle(Breco);
405 const Particle* BRecoRes = doVertexFitForBTube(Breco2,
"kalman");
415 TLorentzVector pBrecEstimate(pmag / BvertDiff.Mag() * BvertDiff, Breco->
getPDGMass());
416 TLorentzVector pBtagEstimate = flipVector(pBrecEstimate);
419 TMatrixD TubeZ = rotateTensorInv(pBrecEstimate.Vect(), errFinal);
421 TubeZ(2, 2) = cut * cut;
422 TubeZ(2, 0) = 0; TubeZ(0, 2) = 0;
423 TubeZ(2, 1) = 0; TubeZ(1, 2) = 0;
427 TMatrixD Tube = rotateTensor(pBtagEstimate.Vect(), TubeZ);
430 return make_pair(m_BeamSpotCenter, toSymMatrix(Tube));
433 pair<TVector3, TMatrixDSym> TagVertexModule::findConstraintBTube(
const Particle* Breco,
double cut)
437 B2WARNING(
"In TagVertexModule::findConstraintBTube: cannot get a proper vertex for BReco. BTube constraint replaced by Boost.");
438 return findConstraintBoost(cut);
444 const Particle* tubecreatorBCopy = doVertexFitForBTube(Breco,
"avf");
449 TLorentzVector pBrec = tubecreatorBCopy->
get4Vector();
452 if (m_useTruthInFit) {
457 m_fitTruthStatus = 2;
459 TLorentzVector pBtag = flipVector(pBrec);
467 B2DEBUG(10,
"Brec decay vertex before fit: " << printVector(Breco->
getVertex()));
468 B2DEBUG(10,
"Brec decay vertex after fit: " << printVector(tubecreatorBCopy->
getVertex()));
469 B2DEBUG(10,
"Brec direction before fit: " << printVector((1. / Breco->
getP()) * Breco->
getMomentum()));
470 B2DEBUG(10,
"Brec direction after fit: " << printVector((1. / tubecreatorBCopy->
getP()) * tubecreatorBCopy->
getMomentum()));
471 B2DEBUG(10,
"IP position: " << printVector(m_BeamSpotCenter));
472 B2DEBUG(10,
"IP covariance: " << printMatrix(m_BeamSpotCov));
473 B2DEBUG(10,
"Brec primary vertex: " << printVector(tubecreatorBCopy->
getVertex()));
474 B2DEBUG(10,
"Brec PV covariance: " << printMatrix(pv));
475 B2DEBUG(10,
"BTag direction: " << printVector((1. / pBtag.P())*pBtag.Vect()));
479 TMatrixD longerror(3, 3); longerror(2, 2) = cut * cut;
483 TMatrixD longerrorRotated = rotateTensor(pBtag.Vect(), longerror);
486 TMatrixD pvNew = TMatrixD(pv) + longerrorRotated;
489 TVector3 constraintCenter = tubecreatorBCopy->
getVertex();
492 if (m_useTruthInFit) {
500 B2DEBUG(10,
"IPTube covariance: " << printMatrix(pvNew));
506 m_tagMomentum = pBtag;
508 m_pvCov.ResizeTo(pv);
511 return make_pair(constraintCenter, toSymMatrix(pvNew));
514 pair<TVector3, TMatrixDSym> TagVertexModule::findConstraintBoost(
double cut,
double shiftAlongBoost)
const
517 TMatrixD longerror(3, 3); longerror(2, 2) = cut * cut;
519 TMatrixD longerrorRotated = rotateTensor(boostDir, longerror);
522 TMatrixDSym beamSpotCov = m_beamSpotDB->getCovVertex();
523 TMatrixD Tube = TMatrixD(beamSpotCov) + longerrorRotated;
526 TVector3 constraintCenter = m_BeamSpotCenter;
529 if (shiftAlongBoost > -1000) {
530 constraintCenter += shiftAlongBoost * boostDir;
533 return make_pair(constraintCenter, toSymMatrix(Tube));
539 double beta = mc->getMomentum().Mag() / mc->getEnergy();
540 return 1e3 * mc->getLifetime() * sqrt(1 - pow(beta, 2));
543 void TagVertexModule::BtagMCVertex(
const Particle* Breco)
547 vector<const MCParticle*> mcBs;
549 if (abs(mc.getPDG()) == abs(Breco->
getPDGCode()))
553 if (mcBs.size() < 2)
return;
555 if (mcBs.size() > 2) {
556 B2WARNING(
"TagVertexModule:: Too many Bs found in MC");
561 : compBrecoBgen(Breco, mc);
565 if (!isReco(mcBs[0]) && !isReco(mcBs[1])) {
570 if (!isReco(mcBs[0]) && isReco(mcBs[1]))
571 swap(mcBs[0], mcBs[1]);
574 if (isReco(mcBs[0]) && isReco(mcBs[1])) {
575 double dist0 = (mcBs[0]->getDecayVertex() - Breco->
getVertex()).Mag2();
576 double dist1 = (mcBs[1]->getDecayVertex() - Breco->
getVertex()).Mag2();
578 swap(mcBs[0], mcBs[1]);
581 m_mcVertReco = mcBs[0]->getDecayVertex();
583 m_mcTagV = mcBs[1]->getDecayVertex();
585 m_mcPDG = mcBs[1]->getPDG();
592 bool isDecMode =
true;
594 const std::vector<Belle2::Particle*> recDau = Breco->
getDaughters();
595 const std::vector<Belle2::MCParticle*> genDau = Bgen->
getDaughters();
597 if (recDau.size() > 0 && genDau.size() > 0) {
598 for (
auto dauRec : recDau) {
600 for (
auto dauGen : genDau) {
601 if (dauGen->getPDG() == dauRec->getPDGCode())
602 isDau = compBrecoBgen(dauRec, dauGen) ;
604 if (!isDau) isDecMode =
false;
607 if (recDau.size() == 0) {
609 }
else {isDecMode =
false;}
619 std::vector<const Particle*> TagVertexModule::getTagTracks_standardAlgorithm(
const Particle* Breco,
int reqPXDHits)
const
621 std::vector<const Particle*> fitParticles;
623 if (!roe)
return fitParticles;
625 std::vector<const Particle*> ROEParticles = roe->
getChargedParticles(m_roeMaskName, 0 ,
false);
626 if (ROEParticles.size() == 0)
return fitParticles;
628 for (
auto& ROEParticle : ROEParticles) {
629 HitPatternVXD roeTrackPattern = ROEParticle->getTrackFitResult()->getHitPatternVXD();
632 fitParticles.push_back(ROEParticle);
638 vector<ParticleAndWeight> TagVertexModule::getParticlesWithoutKS(
const vector<const Particle*>& tagParticles,
639 double massWindowWidth)
const
641 vector<ParticleAndWeight> particleAndWeights;
645 particleAndWeight.
weight = -1111.;
648 for (
unsigned i = 0; i < tagParticles.size(); ++i) {
649 const Particle* particle1 = tagParticles.at(i);
650 if (!particle1)
continue;
651 TLorentzVector mom1 = particle1->
get4Vector();
652 if (!isfinite(mom1.Mag2()))
continue;
655 bool isKsDau =
false;
656 for (
unsigned j = 0; j < tagParticles.size(); ++j) {
657 if (i == j)
continue;
658 const Particle* particle2 = tagParticles.at(j);
659 if (!particle2)
continue;
660 TLorentzVector mom2 = particle2->
get4Vector();
661 if (!isfinite(mom2.Mag2()))
continue;
662 double mass = (mom1 + mom2).M();
663 if (abs(mass - Const::K0Mass) < massWindowWidth) {
669 if (isKsDau)
continue;
671 particleAndWeight.
particle = particle1;
673 if (m_useMCassociation ==
"breco" || m_useMCassociation ==
"internal")
676 particleAndWeights.push_back(particleAndWeight);
680 return particleAndWeights;
683 bool TagVertexModule::makeGeneralFit()
685 if (m_fitAlgo ==
"Rave")
return makeGeneralFitRave();
686 else if (m_fitAlgo ==
"KFit")
return makeGeneralFitKFit();
690 void TagVertexModule::fillParticles(vector<ParticleAndWeight>& particleAndWeights)
692 unsigned n = particleAndWeights.size();
693 sort(particleAndWeights.begin(), particleAndWeights.end(),
696 m_raveParticles.resize(n);
697 m_raveWeights.resize(n);
698 m_raveMCParticles.resize(n);
700 for (
unsigned i = 0; i < n; ++i) {
701 m_raveParticles.at(i) = particleAndWeights.at(i).particle;
702 m_raveMCParticles.at(i) = particleAndWeights.at(i).mcParticle;
703 m_raveWeights.at(i) = particleAndWeights.at(i).weight;
707 void TagVertexModule::fillTagVinfo(
const TVector3& tagVpos,
const TMatrixDSym& tagVposErr)
711 if (m_constraintType !=
"noConstraint") {
712 TMatrixDSym tubeInv = m_constraintCov;
714 TVectorD dV = toVec(m_tagV - m_BeamSpotCenter);
715 m_tagVChi2IP = tubeInv.Similarity(dV);
718 m_tagVErrMatrix.ResizeTo(tagVposErr);
719 m_tagVErrMatrix = tagVposErr;
722 bool TagVertexModule::makeGeneralFitRave()
725 analysis::RaveSetup::getInstance()->unsetBeamSpot();
726 if (m_constraintType !=
"noConstraint")
727 analysis::RaveSetup::getInstance()->setBeamSpot(m_constraintCenter, m_constraintCov);
731 vector<ParticleAndWeight> particleAndWeights = getParticlesWithoutKS(m_tagParticles);
733 for (
const auto& pw : particleAndWeights) {
735 if (m_useTruthInFit) {
740 m_fitTruthStatus = 2;
741 }
else if (m_useRollBack) {
746 m_rollbackStatus = 2;
748 rFit.
addTrack(pw.particle->getTrackFitResult());
750 }
catch (
const rave::CheckedFloatException&) {
751 B2ERROR(
"Exception caught in TagVertexModule::makeGeneralFitRave(): Invalid inputs (nan/inf)?");
760 isGoodFit = rFit.
fit(
"avf");
762 if (isGoodFit < 1)
return false;
763 }
catch (
const rave::CheckedFloatException&) {
764 B2ERROR(
"Exception caught in TagVertexModule::makeGeneralFitRave(): Invalid inputs (nan/inf)?");
770 for (
unsigned int i(0); i < particleAndWeights.size() && isGoodFit >= 1; ++i)
771 particleAndWeights.at(i).weight = rFit.
getWeight(i);
775 fillParticles(particleAndWeights);
781 m_tagVNDF = rFit.
getNdf(0);
788 bool TagVertexModule::makeGeneralFitKFit()
792 kFit.setMagneticField(m_Bfield);
795 if (m_constraintType !=
"noConstraint") {
796 if (m_constraintType ==
"tube") {
797 CLHEP::HepSymMatrix err(7, 0);
799 err.sub(5, ROOTToCLHEP::getHepSymMatrix(m_pvCov));
800 kFit.setIpTubeProfile(
801 ROOTToCLHEP::getHepLorentzVector(m_tagMomentum),
802 ROOTToCLHEP::getPoint3D(m_constraintCenter),
806 kFit.setIpProfile(ROOTToCLHEP::getPoint3D(m_constraintCenter),
807 ROOTToCLHEP::getHepSymMatrix(m_constraintCov));
812 vector<ParticleAndWeight> particleAndWeights = getParticlesWithoutKS(m_tagParticles);
814 int nTracksAdded = 0;
815 for (
auto& pawi : particleAndWeights) {
817 if (m_useTruthInFit) {
818 if (pawi.mcParticle) {
819 addedOK = kFit.addTrack(
820 ROOTToCLHEP::getHepLorentzVector(pawi.mcParticle->get4Vector()),
821 ROOTToCLHEP::getPoint3D(getTruePoca(pawi)),
822 ROOTToCLHEP::getHepSymMatrix(pawi.particle->getMomentumVertexErrorMatrix()),
823 pawi.particle->getCharge());
825 m_fitTruthStatus = 2;
827 }
else if (m_useRollBack) {
828 if (pawi.mcParticle) {
829 addedOK = kFit.addTrack(
830 ROOTToCLHEP::getHepLorentzVector(pawi.mcParticle->get4Vector()),
831 ROOTToCLHEP::getPoint3D(getRollBackPoca(pawi)),
832 ROOTToCLHEP::getHepSymMatrix(pawi.particle->getMomentumVertexErrorMatrix()),
833 pawi.particle->getCharge());
835 m_rollbackStatus = 2;
838 addedOK = kFit.addParticle(pawi.particle);
845 B2WARNING(
"TagVertexModule::makeGeneralFitKFit: failed to add a track");
851 if ((nTracksAdded < 2 && m_constraintType ==
"noConstraint") || nTracksAdded < 1)
854 int isGoodFit = kFit.doFit();
855 if (isGoodFit != 0)
return false;
859 fillParticles(particleAndWeights);
862 fillTagVinfo(CLHEPToROOT::getTVector3(kFit.getVertex()),
863 CLHEPToROOT::getTMatrixDSym(kFit.getVertexError()));
865 m_tagVNDF = kFit.getNDF();
866 m_tagVChi2 = kFit.getCHIsq();
867 m_fitPval = TMath::Prob(m_tagVChi2, m_tagVNDF);
872 void TagVertexModule::deltaT(
const Particle* Breco)
876 TVector3 boostDir = boost.Unit();
877 double bg = boost.Mag() / sqrt(1 - boost.Mag2());
878 double c = Const::speedOfLight / 1000.;
881 TVector3 dVert = Breco->
getVertex() - m_tagV;
882 double dl = dVert.Dot(boostDir);
883 m_deltaT = dl / (bg * c);
886 TVector3 MCdVert = m_mcVertReco - m_mcTagV;
887 double MCdl = MCdVert.Dot(boostDir);
888 m_mcDeltaT = MCdl / (bg * c);
891 m_mcDeltaTau = m_mcLifeTimeReco - m_mcTagLifeTime;
892 if (m_mcLifeTimeReco == -1 || m_mcTagLifeTime == -1)
895 TVectorD bVec = toVec(boostDir);
898 m_tagVlErr = sqrt(m_tagVErrMatrix.Similarity(bVec));
904 m_deltaTErr = hypot(m_tagVlErr, bRecoErrL) / (bg * c);
906 m_tagVl = m_tagV.Dot(boostDir);
907 m_truthTagVl = m_mcTagV.Dot(boostDir);
910 TVector3 oboost = getUnitOrthogonal(boostDir);
911 TVectorD oVec = toVec(oboost);
914 m_tagVolErr = sqrt(m_tagVErrMatrix.Similarity(oVec));
916 m_tagVol = m_tagV.Dot(oboost);
917 m_truthTagVol = m_mcTagV.Dot(oboost);
920 Particle* TagVertexModule::doVertexFitForBTube(
const Particle* motherIn, std::string fitType)
const
923 Particle* mother = ParticleCopy::copyParticle(motherIn);
927 analysis::RaveSetup::getInstance()->setBeamSpot(m_BeamSpotCenter, m_BeamSpotCov);
931 int nvert = rsg.
fit(fitType);
933 mother->setPValue(-1);
946 B2ERROR(
"In TagVertexModule::getTrackWithTrueCoordinate: no MC particle set");
958 m_Bfield, 0, 0, tfr->
getNDF());
965 B2ERROR(
"In TagVertexModule::getTruePoca: no MC particle set");
966 return TVector3(0., 0., 0.);
984 m_Bfield, 0, 0, tfr->
getNDF());
990 B2ERROR(
"In TagVertexModule::getTruePoca: no MC particle set");
991 return TVector3(0., 0., 0.);
997 void TagVertexModule::resetReturnParams()
999 m_raveParticles.resize(0);
1000 m_raveMCParticles.resize(0);
1001 m_tagParticles.resize(0);
1002 m_raveWeights.resize(0);
1006 m_tagVErrMatrix.ResizeTo(
matNaN);
1007 m_tagVErrMatrix =
matNaN;
1013 m_constraintCov.ResizeTo(
matNaN);
1014 m_constraintCov =
matNaN;
1015 m_constraintCenter =
vecNaN;
1025 m_pvCov.ResizeTo(
matNaN);
1033 std::string TagVertexModule::printVector(
const TVector3& vec)
1035 std::ostringstream oss;
1037 oss <<
"(" << std::setw(w) << vec[0] <<
", " << std::setw(w) << vec[1] <<
", " << std::setw(w) << vec[2] <<
")" << std::endl;
1042 std::string TagVertexModule::printMatrix(
const TMatrixD& mat)
1044 std::ostringstream oss;
1046 for (
int i = 0; i < mat.GetNrows(); ++i) {
1047 for (
int j = 0; j < mat.GetNcols(); ++j) {
1048 oss << std::setw(w) << mat(i, j) <<
" ";
1056 std::string TagVertexModule::printMatrix(
const TMatrixDSym& mat)
1058 std::ostringstream oss;
1060 for (
int i = 0; i < mat.GetNrows(); ++i) {
1061 for (
int j = 0; j < mat.GetNcols(); ++j) {
1062 oss << std::setw(w) << mat(i, j) <<
" ";