CMS 3D CMS Logo

PulseChiSqSNNLS.h
Go to the documentation of this file.
1 #ifndef PulseChiSqSNNLS_h
2 #define PulseChiSqSNNLS_h
3 
4 #define EIGEN_NO_DEBUG // kill throws in eigen code
6 
7 #include <set>
8 #include <array>
9 
11  public:
12 
13  typedef BXVector::Index Index;
14 
17 
18 
19  bool DoFit(const SampleVector &samples, const SampleMatrix &samplecov, const BXVector &bxs, const FullSampleVector &fullpulse, const FullSampleMatrix &fullpulsecov, const SampleGainVector &gains = -1*SampleGainVector::Ones(), const SampleGainVector &badSamples = SampleGainVector::Zero());
20 
21  const SamplePulseMatrix &pulsemat() const { return _pulsemat; }
22  const SampleMatrix &invcov() const { return _invcov; }
23 
24  const PulseVector &X() const { return _ampvecmin; }
25  const PulseVector &Errors() const { return _errvec; }
26  const BXVector &BXs() const { return _bxsmin; }
27 
28  double ChiSq() const { return _chisq; }
30  void setMaxIters(int n) { _maxiters = n;}
32 
33  protected:
34 
35  bool Minimize(const SampleMatrix &samplecov, const FullSampleMatrix &fullpulsecov);
36  bool NNLS();
37  void NNLSUnconstrainParameter(Index idxp);
38  void NNLSConstrainParameter(Index minratioidx);
39  bool OnePulseMinimize();
40  bool updateCov(const SampleMatrix &samplecov, const FullSampleMatrix &fullpulsecov);
41  double ComputeChiSq();
42  double ComputeApproxUncertainty(unsigned int ipulse);
43 
44 
51 
56 
59  unsigned int _npulsetot;
60  unsigned int _nP;
61 
66 
68 
69  double _chisq;
71  int _maxiters;
73 };
74 
75 #endif
PulseMatrix aTamat
void setMaxIterWarnings(bool b)
void setMaxIters(int n)
void NNLSUnconstrainParameter(Index idxp)
unsigned int _npulsetot
unsigned int _nP
PulseVector _ampvecmin
Eigen::LLT< SampleMatrix > SampleDecompLLT
void disableErrorCalculation()
const PulseVector & Errors() const
PulseVector aTbvec
Eigen::LDLT< PulseMatrix > PulseDecompLDLT
SampleMatrix _covdecompLinv
PulseVector ampvecpermtest
bool DoFit(const SampleVector &samples, const SampleMatrix &samplecov, const BXVector &bxs, const FullSampleVector &fullpulse, const FullSampleMatrix &fullpulsecov, const SampleGainVector &gains=-1 *SampleGainVector::Ones(), const SampleGainVector &badSamples=SampleGainVector::Zero())
const PulseVector & X() const
SamplePulseMatrix _pulsemat
Eigen::Matrix< char, SampleVectorSize, 1 > SampleGainVector
Eigen::Matrix< double, FullSampleVectorSize, 1 > FullSampleVector
double ComputeApproxUncertainty(unsigned int ipulse)
SampleDecompLLT _covdecomp
PulseDecompLDLT _pulsedecomp
bool updateCov(const SampleMatrix &samplecov, const FullSampleMatrix &fullpulsecov)
const SamplePulseMatrix & pulsemat() const
bool Minimize(const SampleMatrix &samplecov, const FullSampleMatrix &fullpulsecov)
Eigen::Matrix< double, SampleVectorSize, 1 > SampleVector
PulseMatrix _topleft_work
double ChiSq() const
PulseVector updatework
SampleVector _sampvec
Eigen::Matrix< double, FullSampleVectorSize, FullSampleVectorSize > FullSampleMatrix
Eigen::Matrix< double, SampleVectorSize, SampleVectorSize > SampleMatrix
double b
Definition: hdecay.h:120
Eigen::Matrix< double, Eigen::Dynamic, 1, 0, PulseVectorSize, 1 > PulseVector
SampleMatrix _invcov
const BXVector & BXs() const
Eigen::Matrix< double, SampleVectorSize, Eigen::Dynamic, 0, SampleVectorSize, PulseVectorSize > SamplePulseMatrix
PulseVector _errvec
BXVector::Index Index
void NNLSConstrainParameter(Index minratioidx)
SamplePulseMatrix invcovp
PulseVector _ampvec
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, 0, PulseVectorSize, PulseVectorSize > PulseMatrix
const SampleMatrix & invcov() const