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
Eigen::Matrix< char, SampleVectorSize, 1 > SampleGainVector
unsigned int _nP
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, 0, PulseVectorSize, PulseVectorSize > PulseMatrix
PulseVector _ampvecmin
void disableErrorCalculation()
Eigen::Matrix< double, SampleVectorSize, 1 > SampleVector
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())
Eigen::Matrix< double, Eigen::Dynamic, 1, 0, PulseVectorSize, 1 > PulseVector
Eigen::Matrix< double, SampleVectorSize, SampleVectorSize > SampleMatrix
const PulseVector & X() const
SamplePulseMatrix _pulsemat
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)
PulseMatrix _topleft_work
Eigen::LLT< SampleMatrix > SampleDecompLLT
double ChiSq() const
PulseVector updatework
SampleVector _sampvec
double b
Definition: hdecay.h:120
Eigen::Matrix< double, SampleVectorSize, Eigen::Dynamic, 0, SampleVectorSize, PulseVectorSize > SamplePulseMatrix
SampleMatrix _invcov
const BXVector & BXs() const
PulseVector _errvec
Eigen::Matrix< double, FullSampleVectorSize, 1 > FullSampleVector
BXVector::Index Index
Eigen::Matrix< double, FullSampleVectorSize, FullSampleVectorSize > FullSampleMatrix
void NNLSConstrainParameter(Index minratioidx)
SamplePulseMatrix invcovp
PulseVector _ampvec
const SampleMatrix & invcov() const