PandaRoot
FitParams.h
Go to the documentation of this file.
1 // ******************************************************
2 // DecayTreeFitter Package
3 // We thank the original author Wouter Hulsbergen
4 // (BaBar, LHCb) for providing the sources.
5 // http://arxiv.org/abs/physics/0503191v1 (2005)
6 // Adaptation & Development for PANDA: Ralf Kliemt (2015)
7 // ******************************************************
8 #ifndef FITPARAMS_H
9 #define FITPARAMS_H 1
10 
11 #include <iostream>
12 #include <vector>
13 #include <cmath>
14 #include <map>
15 #include "TVectorD.h"
16 #include "TMatrixDSym.h"
17 #include "ChiSquare.h"
18 #include "Rtypes.h"
19 
20 namespace DecayTreeFitter {
21 class ParticleBase;
22 
23 class FitParams {
24  public:
25  // Class that contains the parameters and covariance for the
26  // vertex fit.
27  FitParams(int dim);
28 
29  FitParams(const FitParams &par);
30  virtual ~FitParams();
31 
32  TMatrixDSym &cov() { return m_cov; }
33  TVectorD &par() { return m_par; }
34  double &par(int row) { return m_par(row); }
35 
36  TMatrixDSym cov(const std::vector<int> &indexVec) const;
37  TVectorD par(const std::vector<int> &indexVec) const;
38 
39  const TMatrixDSym &cov() const { return m_cov; }
40  const TVectorD &par() const { return m_par; }
41  const double &par(int row) const { return m_par(row); }
42 
43  // TMatrixDSym& scale() { return m_scale ; }
44 
45  int &nConstraintsVec(int row) { return m_nConstraintsVec[row /*-1*/]; }
46 
47  // int dim() const { return m_par.num_row() ; }
48  int dim() const { return m_dim; }
49  double chiSquare() const { return m_chiSquare; }
50 
51  int nConstraints() const { return m_nConstraints; }
52  int nDof() const { return nConstraints() - dim(); }
53  double err(int row) const { return sqrt(m_cov(row, row)); }
54 
55  void resize(int newdim);
56  void reset(int newdim);
57  void resetPar();
58  void resetCov(double scale = 100);
59  void print() const;
60  bool testCov() const;
61  void addChiSquare(double chi2, int nconstraints, const ParticleBase *p);
62  ChiSquare chiSquare(const ParticleBase &p) const;
63 
64  protected:
65  FitParams(){};
66 
67  private:
68  int m_dim;
69  TVectorD m_par;
70  TMatrixDSym m_cov;
71  // TMatrixDSym m_scale ;
72  double m_chiSquare;
73  int m_nConstraints;
74  std::vector<int> m_nConstraintsVec; // vector with number of constraints per parameter
75  std::map<const ParticleBase *, ChiSquare> m_chiSquareMap;
76  ClassDef(FitParams, 1)
77 };
78 } // namespace DecayTreeFitter
79 
80 #endif
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:28
void addChiSquare(double chi2, int nconstraints, const ParticleBase *p)
int nConstraints() const
Definition: FitParams.h:51
double err(int row) const
Definition: FitParams.h:53
const double & par(int row) const
Definition: FitParams.h:41
void resize(int newdim)
const TMatrixDSym & cov() const
Definition: FitParams.h:39
double chiSquare() const
Definition: FitParams.h:49
void resetCov(double scale=100)
int & nConstraintsVec(int row)
Definition: FitParams.h:45
double & par(int row)
Definition: FitParams.h:34
void reset(int newdim)
TMatrixDSym & cov()
Definition: FitParams.h:32
const TVectorD & par() const
Definition: FitParams.h:40