Belle II Software  release-05-01-25
GlobalDerivatives.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Tadeas Bilka *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <root/TMatrixD.h>
14 
15 #include <vector>
16 
17 namespace Belle2 {
22  namespace alignment {
29  class GlobalDerivatives {
30  public:
34  explicit GlobalDerivatives(int dim = 2) {m_globals.second.ResizeTo(dim, 0);}
36  explicit GlobalDerivatives(const std::pair<std::vector<int>, TMatrixD>& globals);
38  GlobalDerivatives(const std::vector<int>& labels, const TMatrixD& derivs);
41  operator std::pair<std::vector<int>, TMatrixD>() {return passGlobals(m_globals);}
43  operator std::vector<int>() {return passGlobals(m_globals).first;}
45  operator TMatrixD() {return passGlobals(m_globals).second;}
47  const std::vector<int>& getLabels() const {return m_globals.first;}
49  const TMatrixD& getDerivatives() const {return m_globals.second;}
51  void add(const std::pair<std::vector<int>, TMatrixD>& globals);
55  void add(int paramLabel, std::vector<double> dResiduals_dParam);
59  void add(int paramLabel, double drudp);
62  static std::pair<std::vector<int>, TMatrixD> passGlobals(std::pair<std::vector<int>, TMatrixD> globals);
63  private:
65  std::pair<std::vector<int>, TMatrixD> m_globals {{}, TMatrixD()};
66  };
67  }
69 }
Belle2::alignment::GlobalDerivatives::m_globals
std::pair< std::vector< int >, TMatrixD > m_globals
The global labels and derivatives matrix.
Definition: GlobalDerivatives.h:73
Belle2::alignment::GlobalDerivatives::GlobalDerivatives
GlobalDerivatives(int dim=2)
Constructor for empty derivative matrix and label vector.
Definition: GlobalDerivatives.h:42
Belle2::alignment::GlobalDerivatives::getDerivatives
const TMatrixD & getDerivatives() const
Return the derivative matrix (includes columns with zero labels)
Definition: GlobalDerivatives.h:57
Belle2::alignment::GlobalDerivatives::passGlobals
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....
Definition: GlobalDerivatives.cc:77
Belle2::alignment::GlobalDerivatives::getLabels
const std::vector< int > & getLabels() const
Get stored lables (includes zeros)
Definition: GlobalDerivatives.h:55
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::alignment::GlobalDerivatives::add
void add(const std::pair< std::vector< int >, TMatrixD > &globals)
Add another set of global labels and derivatives.
Definition: GlobalDerivatives.cc:39