9 #include <analysis/modules/PseudoVertexFitter/PseudoVertexFitterModule.h>
10 #include <analysis/dataobjects/Particle.h>
11 #include <analysis/dataobjects/ParticleList.h>
12 #include <framework/database/DBObjPtr.h>
36 setDescription(
"Pseudo fitter adds a covariance matrix which is sum of the daughter covariance matrices.");
37 setPropertyFlags(c_ParallelProcessingCertified);
40 addParam(
"listName", m_listName,
"name of particle list",
string(
""));
43 void PseudoVertexFitterModule::initialize()
45 if (m_listName ==
"") {
46 B2ERROR(
"No list name specified! Please enter the list name of the particle you want to add a covariance matrix to.");
49 B2INFO(
"PseudoVertexFitter: adding covariance matrix to " << m_listName);
53 void PseudoVertexFitterModule::event()
57 B2ERROR(
"ParticleList " << m_listName <<
" not found");
61 std::vector<unsigned int> toRemove;
62 unsigned int n = plist->getListSize();
63 for (
unsigned i = 0; i < n; i++) {
64 Particle* particle = plist->getParticle(i);
66 bool ok = add_matrix(particle);
68 if (!ok) particle->setPValue(-1);
72 bool PseudoVertexFitterModule::add_matrix(
Particle* mother)
75 if (mother->getNDaughters() < 2)
return false;
79 const std::vector<Particle*> daughters = mother->getDaughters();
80 std::vector<TMatrixFSym> daughter_matrices;
81 daughter_matrices.reserve(daughters.size());
82 for (
auto daughter : daughters) {
83 daughter_matrices.push_back(daughter->getMomentumVertexErrorMatrix());
86 TMatrixFSym mother_errMatrix(7);
87 for (
int i = 0; i < 7; i++) {
88 for (
int j = 0; j < 7; j++) {
89 for (
unsigned int k = 0; k < daughters.size(); k++) {
90 mother_errMatrix[i][j] += daughter_matrices[k][i][j];
95 mother->setMomentumVertexErrorMatrix(mother_errMatrix);
96 if (mother->getMomentumVertexErrorMatrix() == mother_errMatrix) {
99 if (!ok)
return false;
Class to store reconstructed particles.
Pseudo Vertex fitter module.
Type-safe access to single objects in the data store.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.