11 #include <analysis/modules/PseudoVertexFitter/PseudoVertexFitterModule.h>
12 #include <analysis/dataobjects/Particle.h>
13 #include <analysis/dataobjects/ParticleList.h>
14 #include <framework/database/DBObjPtr.h>
38 setDescription(
"Pseudo fitter adds a covariance matrix which is sum of the daughter covariance matrices.");
39 setPropertyFlags(c_ParallelProcessingCertified);
42 addParam(
"listName", m_listName,
"name of particle list",
string(
""));
45 void PseudoVertexFitterModule::initialize()
47 if (m_listName ==
"") {
48 B2ERROR(
"No list name specified! Please enter the list name of the particle you want to add a covariance matrix to.");
51 B2INFO(
"PseudoVertexFitter: adding covariance matrix to " << m_listName);
55 void PseudoVertexFitterModule::event()
59 B2ERROR(
"ParticleList " << m_listName <<
" not found");
63 std::vector<unsigned int> toRemove;
64 unsigned int n = plist->getListSize();
65 for (
unsigned i = 0; i < n; i++) {
66 Particle* particle = plist->getParticle(i);
68 bool ok = add_matrix(particle);
70 if (!ok) particle->setPValue(-1);
74 bool PseudoVertexFitterModule::add_matrix(
Particle* mother)
77 if (mother->getNDaughters() < 2)
return false;
81 const std::vector<Particle*> daughters = mother->getDaughters();
82 std::vector<TMatrixFSym> daughter_matrices;
83 daughter_matrices.reserve(daughters.size());
84 for (
auto daughter : daughters) {
85 daughter_matrices.push_back(daughter->getMomentumVertexErrorMatrix());
88 TMatrixFSym mother_errMatrix(7);
89 for (
int i = 0; i < 7; i++) {
90 for (
int j = 0; j < 7; j++) {
91 for (
unsigned int k = 0; k < daughters.size(); k++) {
92 mother_errMatrix[i][j] += daughter_matrices[k][i][j];
97 mother->setMomentumVertexErrorMatrix(mother_errMatrix);
98 if (mother->getMomentumVertexErrorMatrix() == mother_errMatrix) {
101 if (!ok)
return false;