MarqFitAlg.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: MarqFitAlg
3 // Purpose: Fit gaussians
4 //
5 //
6 // Original code by Mike Wang, converted to a larsoft algorithm by S. Berkman
7 ////////////////////////////////////////////////////////////////////////
8 
9 #ifndef MARQFITALG_H
10 #define MARQFITALG_H
11 
12 #include <iostream>
13 #include <cmath>
14 #include <vector>
15 
16 //#include "fhiclcpp/ParameterSet.h"
17 //#include "lardataobj/RecoBase/Hit.h"
18 
19 namespace gshf{
20 
21  class MarqFitAlg {
22  public:
23  explicit MarqFitAlg();
24  virtual ~MarqFitAlg() {}
25 
26  int cal_perr(float p[], float y[], const int nParam, const int nData, float perr[]);
27  int mrqdtfit(float &lambda, float p[], float y[], const int nParam, const int nData, float &chiSqr, float &dchiSqr);
28  int mrqdtfit(float &lambda, float p[], float plimmin[], float plimmax[], float y[], const int nParam, const int nData, float &chiSqr, float &dchiSqr);
29 
30 
31  private:
32  //these functions are called by the public functions
33  void fgauss(const float yd[], const float p[], const int npar, const int ndat, std::vector<float> &res);
34  void dgauss(const float p[], const int npar, const int ndat, std::vector<float> &dydp);
35  float cal_xi2(const std::vector<float> &res, const int ndat);
36  void setup_matrix(const std::vector<float> &res, const std::vector<float> &dydp, const int npar, const int ndat, std::vector<float> &beta, std::vector<float> &alpha);
37  void solve_matrix(const std::vector<float> &beta, const std::vector<float> &alpha, const int npar, std::vector<float> &dp);
38  float invrt_matrix(std::vector<float> &alphaf, const int npar);
39 
40  };
41 
42 }//end namespace gshf
43 #endif
double beta(double KE, const simb::MCParticle *part)
void solve_matrix(const std::vector< float > &beta, const std::vector< float > &alpha, const int npar, std::vector< float > &dp)
Definition: MarqFitAlg.cxx:84
int mrqdtfit(float &lambda, float p[], float y[], const int nParam, const int nData, float &chiSqr, float &dchiSqr)
Definition: MarqFitAlg.cxx:274
int cal_perr(float p[], float y[], const int nParam, const int nData, float perr[])
Definition: MarqFitAlg.cxx:241
double alpha
Definition: doAna.cpp:15
void fgauss(const float yd[], const float p[], const int npar, const int ndat, std::vector< float > &res)
Definition: MarqFitAlg.cxx:8
p
Definition: test.py:223
float cal_xi2(const std::vector< float > &res, const int ndat)
Definition: MarqFitAlg.cxx:40
void dgauss(const float p[], const int npar, const int ndat, std::vector< float > &dydp)
Definition: MarqFitAlg.cxx:22
float invrt_matrix(std::vector< float > &alphaf, const int npar)
Definition: MarqFitAlg.cxx:130
virtual ~MarqFitAlg()
Definition: MarqFitAlg.h:24
void setup_matrix(const std::vector< float > &res, const std::vector< float > &dydp, const int npar, const int ndat, std::vector< float > &beta, std::vector< float > &alpha)
Definition: MarqFitAlg.cxx:51