FairRoot/PandaRoot
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
DecayTreeFitter::FitParams Class Reference

#include <FitParams.h>

Public Member Functions

 FitParams (int dim)
 
 FitParams (const FitParams &par)
 
virtual ~FitParams ()
 
TMatrixDSym & cov ()
 
TVectorD & par ()
 
double & par (int row)
 
TMatrixDSym cov (const std::vector< int > &indexVec) const
 
TVectorD par (const std::vector< int > &indexVec) const
 
const TMatrixDSym & cov () const
 
const TVectorD & par () const
 
const double & par (int row) const
 
int & nConstraintsVec (int row)
 
int dim () const
 
double chiSquare () const
 
int nConstraints () const
 
int nDof () const
 
double err (int row) const
 
void resize (int newdim)
 
void reset (int newdim)
 
void resetPar ()
 
void resetCov (double scale=100)
 
void print () const
 
bool testCov () const
 
void addChiSquare (double chi2, int nconstraints, const ParticleBase *p)
 
ChiSquare chiSquare (const ParticleBase &p) const
 

Protected Member Functions

 FitParams ()
 

Private Attributes

int m_dim
 
TVectorD m_par
 
TMatrixDSym m_cov
 
double m_chiSquare
 
int m_nConstraints
 
std::vector< int > m_nConstraintsVec
 
std::map< const ParticleBase
*, ChiSquare
m_chiSquareMap
 

Detailed Description

Definition at line 24 of file FitParams.h.

Constructor & Destructor Documentation

DecayTreeFitter::FitParams::FitParams ( int  dim)

Definition at line 15 of file FitParams.cxx.

16 : m_dim(adim),m_par(adim),m_cov(adim),//m_scale(adim),
18 {
20  //for(int i=0;i<adim;i++) m_scale[i][i]=1.;
21 }
std::vector< int > m_nConstraintsVec
Definition: FitParams.h:75
DecayTreeFitter::FitParams::FitParams ( const FitParams par)

Definition at line 22 of file FitParams.cxx.

References cov(), m_cov, m_par, and par().

23 : m_dim(fpar.dim()),m_par(fpar.dim()),m_cov(fpar.dim()),
25 {
26  m_par = fpar.par();
27  m_cov = fpar.cov();
28  //FIXME don't copy constraintsvector etc? Those are cleared anyways. I guess
29 }
std::vector< int > m_nConstraintsVec
Definition: FitParams.h:75
TFile * fpar
Definition: bump_analys.C:22
DecayTreeFitter::FitParams::~FitParams ( )
virtual

Definition at line 31 of file FitParams.cxx.

31  {
32  //std::cout<<"FitParams::~FitParams A ("<<&m_nConstraintsVec<<"); n="<<m_nConstraintsVec.size()<<" c="<<m_nConstraintsVec.capacity() <<std::endl;
33  //m_nConstraintsVec.clear();
34  //std::cout<<"FitParams::~FitParams B; n="<<m_nConstraintsVec.size()<<" c="<<m_nConstraintsVec.capacity() <<std::endl;
35  //m_chiSquareMap.clear() ;
36 }
DecayTreeFitter::FitParams::FitParams ( )
inlineprotected

Definition at line 67 of file FitParams.h.

67 {};

Member Function Documentation

void DecayTreeFitter::FitParams::addChiSquare ( double  chi2,
int  nconstraints,
const ParticleBase p 
)

Definition at line 141 of file FitParams.cxx.

References p.

Referenced by DecayTreeFitter::Constraint::filter().

142 {
143  m_chiSquare += chisq;
144  m_nConstraints += nconstraints ;
145  if( p ) m_chiSquareMap[ p ] += ChiSquare(chisq,nconstraints) ;
146 }
Double_t p
Definition: anasim.C:58
std::map< const ParticleBase *, ChiSquare > m_chiSquareMap
Definition: FitParams.h:76
double DecayTreeFitter::FitParams::chiSquare ( ) const
inline

Definition at line 51 of file FitParams.h.

References m_chiSquare.

Referenced by DecayTreeFitter::ParticleBase::chiSquare().

51 { return m_chiSquare ; }
ChiSquare DecayTreeFitter::FitParams::chiSquare ( const ParticleBase p) const

Definition at line 148 of file FitParams.cxx.

149 {
150  std::map<const ParticleBase*, ChiSquare>::const_iterator it = m_chiSquareMap.find( &p ) ;
151  return it != m_chiSquareMap.end() ? it->second : ChiSquare() ;
152 }
std::map< const ParticleBase *, ChiSquare > m_chiSquareMap
Definition: FitParams.h:76
TMatrixDSym& DecayTreeFitter::FitParams::cov ( )
inline
TMatrixDSym DecayTreeFitter::FitParams::cov ( const std::vector< int > &  indexVec) const

Definition at line 82 of file FitParams.cxx.

References col, and row.

82  {
83  int nrow = indexVec.size() ;
84  TMatrixDSym thecov(nrow) ;
85  for(int row=0; row<nrow; row++)
86  //for(int col=0; col<=row ; col++)//fix for TmatrixDSym (which is not really symmetric)
87  for(int col=0; col<nrow ; col++)
88  thecov(row,col) = m_cov(indexVec[row],indexVec[col]) ;
89  return thecov ;
90 }
int row
Definition: anaLmdDigi.C:67
int col
Definition: anaLmdDigi.C:67
const TMatrixDSym& DecayTreeFitter::FitParams::cov ( ) const
inline

Definition at line 41 of file FitParams.h.

References m_cov.

41 { return m_cov ; }
int DecayTreeFitter::FitParams::dim ( ) const
inline
double DecayTreeFitter::FitParams::err ( int  row) const
inline

Definition at line 55 of file FitParams.h.

References m_cov, and sqrt().

55 { return sqrt(m_cov(row,row)) ; }
int row
Definition: anaLmdDigi.C:67
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
int DecayTreeFitter::FitParams::nConstraints ( ) const
inline

Definition at line 53 of file FitParams.h.

References m_nConstraints.

Referenced by nDof().

53 { return m_nConstraints ; }
int& DecayTreeFitter::FitParams::nConstraintsVec ( int  row)
inline

Definition at line 47 of file FitParams.h.

References m_nConstraintsVec.

Referenced by DecayTreeFitter::KalmanCalculator::updateCov().

47 { return m_nConstraintsVec[row/*-1*/] ; }
int row
Definition: anaLmdDigi.C:67
std::vector< int > m_nConstraintsVec
Definition: FitParams.h:75
int DecayTreeFitter::FitParams::nDof ( ) const
inline

Definition at line 54 of file FitParams.h.

References dim(), and nConstraints().

54 { return nConstraints() - dim() ; }
int nConstraints() const
Definition: FitParams.h:53
TVectorD& DecayTreeFitter::FitParams::par ( )
inline
double& DecayTreeFitter::FitParams::par ( int  row)
inline

Definition at line 36 of file FitParams.h.

References m_par.

36 { return m_par(row) ; }
int row
Definition: anaLmdDigi.C:67
TVectorD DecayTreeFitter::FitParams::par ( const std::vector< int > &  indexVec) const

Definition at line 92 of file FitParams.cxx.

References row.

92  {
93  int nrow = indexVec.size() ;
94  TVectorD thepar(nrow) ;
95  for(int row=0; row<nrow; row++)
96  thepar(row) = m_par(indexVec[row]) ;
97  return thepar ;
98 }
int row
Definition: anaLmdDigi.C:67
const TVectorD& DecayTreeFitter::FitParams::par ( ) const
inline

Definition at line 42 of file FitParams.h.

References m_par.

42 { return m_par ; }
const double& DecayTreeFitter::FitParams::par ( int  row) const
inline

Definition at line 43 of file FitParams.h.

References m_par.

43 { return m_par(row) ; }
int row
Definition: anaLmdDigi.C:67
void DecayTreeFitter::FitParams::print ( ) const

Definition at line 72 of file FitParams.cxx.

References row, and sqrt().

72  {
73  std::cout << std::setw(3) << "index" << std::setw(15) << "val" << std::setw(15) << "err" << std::endl ;
74  std::cout << std::setprecision(5) ;
75  for(int row=0; row<m_dim; row++)
76  std::cout << std::setw(3) << row
77  << std::setw(15) << m_par(row)
78  << std::setw(15) << sqrt(m_cov(row,row)) << std::endl ;
79  std::cout << std::setprecision(10) ;
80 } ;
int row
Definition: anaLmdDigi.C:67
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
void DecayTreeFitter::FitParams::reset ( int  newdim)

Definition at line 100 of file FitParams.cxx.

Referenced by DecayTreeFitter::DecayChain::init().

101 {
102  resetPar();
103  resetCov();
104  if( newdim != m_dim )
105  {
106  m_par.ResizeTo(newdim);
107  m_cov.ResizeTo(newdim,newdim);
108  m_nConstraintsVec.resize(newdim,0) ;
109  }
110 }
std::vector< int > m_nConstraintsVec
Definition: FitParams.h:75
void resetCov(double scale=100)
Definition: FitParams.cxx:43
void DecayTreeFitter::FitParams::resetCov ( double  scale = 100)

Definition at line 43 of file FitParams.cxx.

References col, and row.

Referenced by DecayTreeFitter::DecayChain::filter(), and DecayTreeFitter::DecayChain::init().

43  {
44 
45  if(aScale > 0)
46  {
47  for(int row=0; row<m_dim; row++) {
48  for(int col=0; col<row; col++) {
49  m_cov(row,col) = 0 ;
50  m_cov(col,row) = 0 ;
51  }
52  m_cov(row,row) *= aScale ;
53  if(m_cov(row,row) < 0 ) m_cov(row,row)*=-1 ;
54  if(m_cov(row,row) == 0 ) m_cov(row,row)=aScale ;
55  }
56  }
57  m_chiSquare=0 ;
58  m_nConstraints=0 ;
59  for(int row=0; row<m_dim; row++) {
60  nConstraintsVec(row) = 0 ;
61  }
62  m_chiSquareMap.clear() ;
63 }
int row
Definition: anaLmdDigi.C:67
int col
Definition: anaLmdDigi.C:67
std::map< const ParticleBase *, ChiSquare > m_chiSquareMap
Definition: FitParams.h:76
int & nConstraintsVec(int row)
Definition: FitParams.h:47
void DecayTreeFitter::FitParams::resetPar ( )

Definition at line 38 of file FitParams.cxx.

References row.

Referenced by DecayTreeFitter::DecayChain::init().

38  {
39  for(int row=0; row<m_dim; row++)
40  m_par(row) = 0 ;
41 }
int row
Definition: anaLmdDigi.C:67
void DecayTreeFitter::FitParams::resize ( int  newdim)

Definition at line 112 of file FitParams.cxx.

113 {
114  if( newdim > m_dim ) {
115  m_dim = newdim ;
116  // very expensive, but okay ...
117  // TVectorD newpar(newdim) ;
118  // newpar.sub(1,m_par);
119  //
120  // TMatrixDSym newcov(newdim) ;
121  // newcov.sub(1,m_cov) ;
122  //
123  // // HepVector newpar(newdim,0) ;
124  // // HepSymMatrix newcov(newdim,0) ;
125  // // std::cout << newpar << std::endl ;
126  // // for(int row=0; row<m_dim ; row++) {
127  // // newpar(row) = m_par(row) ;
128  // // for(int col=0; col<=row; col++)
129  // // // newcov(row,col) = m_cov(row,col) ;
130  // // }
131  // // std::cout << m_par << " " << newpar << std::endl ;
132  //
133  // m_par = newpar ;
134  // m_cov = newcov ;
135  m_par.ResizeTo(newdim);
136  m_cov.ResizeTo(newdim,newdim);
137  m_nConstraintsVec.resize(newdim,0) ;
138  }
139 }
std::vector< int > m_nConstraintsVec
Definition: FitParams.h:75
bool DecayTreeFitter::FitParams::testCov ( ) const

Definition at line 65 of file FitParams.cxx.

References row.

Referenced by DecayTreeFitter::DecayChain::filter().

65  {
66  bool okay=true ;
67  for(int row=0; row<m_dim && okay; row++)
68  okay = m_cov(row,row)>=0 ;
69  return okay ;
70 }
int row
Definition: anaLmdDigi.C:67

Member Data Documentation

double DecayTreeFitter::FitParams::m_chiSquare
private

Definition at line 73 of file FitParams.h.

Referenced by chiSquare().

std::map<const ParticleBase*, ChiSquare> DecayTreeFitter::FitParams::m_chiSquareMap
private

Definition at line 76 of file FitParams.h.

TMatrixDSym DecayTreeFitter::FitParams::m_cov
private

Definition at line 71 of file FitParams.h.

Referenced by cov(), err(), and FitParams().

int DecayTreeFitter::FitParams::m_dim
private

Definition at line 67 of file FitParams.h.

Referenced by dim().

int DecayTreeFitter::FitParams::m_nConstraints
private

Definition at line 74 of file FitParams.h.

Referenced by nConstraints().

std::vector<int> DecayTreeFitter::FitParams::m_nConstraintsVec
private

Definition at line 75 of file FitParams.h.

Referenced by nConstraintsVec().

TVectorD DecayTreeFitter::FitParams::m_par
private

Definition at line 70 of file FitParams.h.

Referenced by FitParams(), and par().


The documentation for this class was generated from the following files: