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  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
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 BXVector & BXs() const
SamplePulseMatrix _pulsemat
double ComputeApproxUncertainty(unsigned int ipulse)
SampleDecompLLT _covdecomp
PulseDecompLDLT _pulsedecomp
bool updateCov(const SampleMatrix &samplecov, const FullSampleMatrix &fullpulsecov)
bool Minimize(const SampleMatrix &samplecov, const FullSampleMatrix &fullpulsecov)
constexpr float gains[NGAINS]
Definition: EcalConstants.h:11
PulseMatrix _topleft_work
PulseVector updatework
SampleVector _sampvec
double b
Definition: hdecay.h:118
Eigen::Matrix< double, SampleVectorSize, 1 > SampleVector
Eigen::Matrix< double, SampleVectorSize, SampleVectorSize > SampleMatrix
SampleMatrix _invcov
const PulseVector & Errors() const
Eigen::Matrix< char, SampleVectorSize, 1 > SampleGainVector
const SamplePulseMatrix & pulsemat() const
PulseVector _errvec
double ChiSq() const
BXVector::Index Index
const PulseVector & X() const
const SampleMatrix & invcov() const
void NNLSConstrainParameter(Index minratioidx)
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, 0, PulseVectorSize, PulseVectorSize > PulseMatrix
SamplePulseMatrix invcovp
PulseVector _ampvec