Belle II Software development
GlobalDerivatives.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <root/TMatrixD.h>
12
13#include <vector>
14
15namespace Belle2 {
20 namespace alignment {
28 public:
32 explicit GlobalDerivatives(int dim = 2) {m_globals.second.ResizeTo(dim, 0);}
34 explicit GlobalDerivatives(const std::pair<std::vector<int>, TMatrixD>& globals);
36 GlobalDerivatives(const std::vector<int>& labels, const TMatrixD& derivs);
39 operator std::pair<std::vector<int>, TMatrixD>() {return passGlobals(m_globals);}
41 operator std::vector<int>() {return passGlobals(m_globals).first;}
43 operator TMatrixD() {return passGlobals(m_globals).second;}
45 const std::vector<int>& getLabels() const {return m_globals.first;}
47 const TMatrixD& getDerivatives() const {return m_globals.second;}
49 void add(const std::pair<std::vector<int>, TMatrixD>& globals);
53 void add(int paramLabel, std::vector<double> dResiduals_dParam);
57 void add(int paramLabel, double drudp);
60 static std::pair<std::vector<int>, TMatrixD> passGlobals(std::pair<std::vector<int>, TMatrixD> globals);
61 private:
63 std::pair<std::vector<int>, TMatrixD> m_globals {{}, TMatrixD()};
64 };
65 }
67}
Class for easier manipulation with global derivatives (and their labels)
static std::pair< std::vector< int >, TMatrixD > passGlobals(std::pair< std::vector< int >, TMatrixD > globals)
Static convenient function to remove columns with zero labels (make error in Pede btw....
GlobalDerivatives(int dim=2)
Constructor for empty derivative matrix and label vector.
void add(const std::pair< std::vector< int >, TMatrixD > &globals)
Add another set of global labels and derivatives.
const std::vector< int > & getLabels() const
Get stored lables (includes zeros)
const TMatrixD & getDerivatives() const
Return the derivative matrix (includes columns with zero labels)
std::pair< std::vector< int >, TMatrixD > m_globals
The global labels and derivatives matrix.
Abstract base class for different kinds of events.