CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  typedef BXVector::Index Index;
13 
16 
17  bool DoFit(const SampleVector &samples,
18  const SampleMatrix &samplecov,
19  const BXVector &bxs,
20  const FullSampleVector &fullpulse,
21  const FullSampleMatrix &fullpulsecov,
22  const SampleGainVector &gains = -1 * SampleGainVector::Ones(),
23  const SampleGainVector &badSamples = SampleGainVector::Zero());
24 
25  const SamplePulseMatrix &pulsemat() const { return _pulsemat; }
26  const SampleMatrix &invcov() const { return _invcov; }
27 
28  const PulseVector &X() const { return _ampvecmin; }
29  const PulseVector &Errors() const { return _errvec; }
30  const BXVector &BXs() const { return _bxsmin; }
31 
32  double ChiSq() const { return _chisq; }
34  void setMaxIters(int n) { _maxiters = n; }
36 
37 protected:
38  bool Minimize(const SampleMatrix &samplecov, const FullSampleMatrix &fullpulsecov);
39  bool NNLS();
41  void NNLSConstrainParameter(Index minratioidx);
42  bool OnePulseMinimize();
43  bool updateCov(const SampleMatrix &samplecov, const FullSampleMatrix &fullpulsecov);
44  double ComputeChiSq();
45  double ComputeApproxUncertainty(unsigned int ipulse);
46 
53 
58 
61  unsigned int _npulsetot;
62  unsigned int _nP;
63 
68 
70 
71  double _chisq;
73  int _maxiters;
75 };
76 
77 #endif
PulseMatrix aTamat
void setMaxIterWarnings(bool b)
void setMaxIters(int n)
Eigen::Matrix< double, SampleVectorSize, Eigen::Dynamic, 0, SampleVectorSize, PulseVectorSize > SamplePulseMatrix
void NNLSUnconstrainParameter(Index idxp)
unsigned int _npulsetot
unsigned int _nP
Eigen::Matrix< double, FullSampleVectorSize, FullSampleVectorSize > FullSampleMatrix
PulseVector _ampvecmin
Eigen::LLT< SampleMatrix > SampleDecompLLT
void disableErrorCalculation()
Eigen::Matrix< double, FullSampleVectorSize, 1 > FullSampleVector
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
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
double ChiSq() const
PulseVector updatework
SampleVector _sampvec
double b
Definition: hdecay.h:118
Eigen::Matrix< double, SampleVectorSize, 1 > SampleVector
Eigen::Matrix< double, SampleVectorSize, SampleVectorSize > SampleMatrix
SampleMatrix _invcov
Eigen::Matrix< char, SampleVectorSize, 1 > SampleGainVector
const BXVector & BXs() const
PulseVector _errvec
BXVector::Index Index
void NNLSConstrainParameter(Index minratioidx)
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, 0, PulseVectorSize, PulseVectorSize > PulseMatrix
SamplePulseMatrix invcovp
PulseVector _ampvec
const SampleMatrix & invcov() const