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
PulseChiSqSNNLS::invcov
const SampleMatrix & invcov() const
Definition: PulseChiSqSNNLS.h:26
PulseChiSqSNNLS::NNLSConstrainParameter
void NNLSConstrainParameter(Index minratioidx)
Definition: PulseChiSqSNNLS.cc:407
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
PulseChiSqSNNLS::_invcov
SampleMatrix _invcov
Definition: PulseChiSqSNNLS.h:48
FullSampleMatrix
Eigen::Matrix< double, FullSampleVectorSize, FullSampleVectorSize > FullSampleMatrix
Definition: EigenMatrixTypes.h:18
SampleMatrix
Eigen::Matrix< double, SampleVectorSize, SampleVectorSize > SampleMatrix
Definition: EigenMatrixTypes.h:17
PulseChiSqSNNLS::aTamat
PulseMatrix aTamat
Definition: PulseChiSqSNNLS.h:65
PulseChiSqSNNLS::_errvec
PulseVector _errvec
Definition: PulseChiSqSNNLS.h:51
PulseChiSqSNNLS::Index
BXVector::Index Index
Definition: PulseChiSqSNNLS.h:12
PulseChiSqSNNLS::NNLSUnconstrainParameter
void NNLSUnconstrainParameter(Index idxp)
Definition: PulseChiSqSNNLS.cc:397
PulseChiSqSNNLS::X
const PulseVector & X() const
Definition: PulseChiSqSNNLS.h:28
PulseChiSqSNNLS::_pulsedecomp
PulseDecompLDLT _pulsedecomp
Definition: PulseChiSqSNNLS.h:57
SampleGainVector
Eigen::Matrix< char, SampleVectorSize, 1 > SampleGainVector
Definition: EigenMatrixTypes.h:16
PulseChiSqSNNLS::invcovp
SamplePulseMatrix invcovp
Definition: PulseChiSqSNNLS.h:64
PulseDecompLDLT
Eigen::LDLT< PulseMatrix > PulseDecompLDLT
Definition: EigenMatrixTypes.h:23
PulseChiSqSNNLS::_pulsemat
SamplePulseMatrix _pulsemat
Definition: PulseChiSqSNNLS.h:49
EgammaValidation_cff.samples
samples
Definition: EgammaValidation_cff.py:19
PulseChiSqSNNLS::_computeErrors
bool _computeErrors
Definition: PulseChiSqSNNLS.h:72
BXVector
Definition: BXVector.h:15
PulseChiSqSNNLS::_bxs
BXVector _bxs
Definition: PulseChiSqSNNLS.h:59
PulseVector
Eigen::Matrix< double, Eigen::Dynamic, 1, 0, PulseVectorSize, 1 > PulseVector
Definition: EigenMatrixTypes.h:14
PulseChiSqSNNLS::setMaxIters
void setMaxIters(int n)
Definition: PulseChiSqSNNLS.h:34
PulseChiSqSNNLS::_bxsmin
BXVector _bxsmin
Definition: PulseChiSqSNNLS.h:60
PulseChiSqSNNLS::_maxiters
int _maxiters
Definition: PulseChiSqSNNLS.h:73
PulseChiSqSNNLS::ampvecpermtest
PulseVector ampvecpermtest
Definition: PulseChiSqSNNLS.h:69
PulseChiSqSNNLS::_npulsetot
unsigned int _npulsetot
Definition: PulseChiSqSNNLS.h:61
PulseChiSqSNNLS::DoFit
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())
Definition: PulseChiSqSNNLS.cc:59
PulseChiSqSNNLS::PulseChiSqSNNLS
PulseChiSqSNNLS()
Definition: PulseChiSqSNNLS.cc:55
SampleDecompLLT
Eigen::LLT< SampleMatrix > SampleDecompLLT
Definition: EigenMatrixTypes.h:21
EigenMatrixTypes.h
b
double b
Definition: hdecay.h:118
PulseChiSqSNNLS::pulsemat
const SamplePulseMatrix & pulsemat() const
Definition: PulseChiSqSNNLS.h:25
PulseChiSqSNNLS::BXs
const BXVector & BXs() const
Definition: PulseChiSqSNNLS.h:30
PulseChiSqSNNLS::Minimize
bool Minimize(const SampleMatrix &samplecov, const FullSampleMatrix &fullpulsecov)
Definition: PulseChiSqSNNLS.cc:214
PulseChiSqSNNLS::_maxiterwarnings
bool _maxiterwarnings
Definition: PulseChiSqSNNLS.h:74
PulseChiSqSNNLS::OnePulseMinimize
bool OnePulseMinimize()
Definition: PulseChiSqSNNLS.cc:417
PulseChiSqSNNLS::updatework
PulseVector updatework
Definition: PulseChiSqSNNLS.h:67
PulseChiSqSNNLS::_sampvec
SampleVector _sampvec
Definition: PulseChiSqSNNLS.h:47
PulseChiSqSNNLS::_chisq
double _chisq
Definition: PulseChiSqSNNLS.h:71
PulseChiSqSNNLS::_ampvec
PulseVector _ampvec
Definition: PulseChiSqSNNLS.h:50
SamplePulseMatrix
Eigen::Matrix< double, SampleVectorSize, Eigen::Dynamic, 0, SampleVectorSize, PulseVectorSize > SamplePulseMatrix
Definition: EigenMatrixTypes.h:20
SampleVector
Eigen::Matrix< double, SampleVectorSize, 1 > SampleVector
Definition: EigenMatrixTypes.h:12
FullSampleVector
Eigen::Matrix< double, FullSampleVectorSize, 1 > FullSampleVector
Definition: EigenMatrixTypes.h:13
PulseChiSqSNNLS::ChiSq
double ChiSq() const
Definition: PulseChiSqSNNLS.h:32
PulseMatrix
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, 0, PulseVectorSize, PulseVectorSize > PulseMatrix
Definition: EigenMatrixTypes.h:19
PulseChiSqSNNLS::ComputeApproxUncertainty
double ComputeApproxUncertainty(unsigned int ipulse)
Definition: PulseChiSqSNNLS.cc:289
PulseChiSqSNNLS::ComputeChiSq
double ComputeChiSq()
Definition: PulseChiSqSNNLS.cc:282
PulseChiSqSNNLS
Definition: PulseChiSqSNNLS.h:10
PulseChiSqSNNLS::_covdecomp
SampleDecompLLT _covdecomp
Definition: PulseChiSqSNNLS.h:54
PulseChiSqSNNLS::_nP
unsigned int _nP
Definition: PulseChiSqSNNLS.h:62
PulseChiSqSNNLS::_ampvecmin
PulseVector _ampvecmin
Definition: PulseChiSqSNNLS.h:52
PulseChiSqSNNLS::disableErrorCalculation
void disableErrorCalculation()
Definition: PulseChiSqSNNLS.h:33
PulseChiSqSNNLS::~PulseChiSqSNNLS
~PulseChiSqSNNLS()
Definition: PulseChiSqSNNLS.cc:57
PulseChiSqSNNLS::Errors
const PulseVector & Errors() const
Definition: PulseChiSqSNNLS.h:29
PulseChiSqSNNLS::NNLS
bool NNLS()
Definition: PulseChiSqSNNLS.cc:297
PulseChiSqSNNLS::setMaxIterWarnings
void setMaxIterWarnings(bool b)
Definition: PulseChiSqSNNLS.h:35
PulseChiSqSNNLS::updateCov
bool updateCov(const SampleMatrix &samplecov, const FullSampleMatrix &fullpulsecov)
Definition: PulseChiSqSNNLS.cc:252
PulseChiSqSNNLS::aTbvec
PulseVector aTbvec
Definition: PulseChiSqSNNLS.h:66
PulseChiSqSNNLS::_covdecompLinv
SampleMatrix _covdecompLinv
Definition: PulseChiSqSNNLS.h:55
PulseChiSqSNNLS::_topleft_work
PulseMatrix _topleft_work
Definition: PulseChiSqSNNLS.h:56