HitLineFitAlg.h
Go to the documentation of this file.
1 #ifndef HITLINEFITALG_H
2 #define HITLINEFITALG_H
3 
6 
8 
9 #include "TVector3.h"
10 #include "TRandom3.h"
11 #include "TF1.h"
12 #include "TFitResult.h"
13 #include "TMath.h"
14 #include "TGraphAsymmErrors.h"
15 
16 #include <algorithm>
17 #include <memory>
18 #include <vector>
19 
20 namespace dune {
21 
22  class HitLineFitAlg {
23 public:
24 
25  struct HitLineFitData {
26  double hitHoriz;
27  double hitHorizErrLo;
28  double hitHorizErrHi;
29  double hitVert;
30  double hitVertErrLo;
31  double hitVertErrHi;
32  bool hitREAL;
33  };
34 
36  std::map<int,float> bestVal;
37  std::map<int,float> bestValError;
38  double chi2;
39  double sum2resid;
40  double mle;
41  int ndf;
42  bool fitsuccess;
43  };
44 
45  struct ParVals {
46  double start;
47  double min;
48  double max;
49  };
50 
52 
53  void reconfigure(fhicl::ParameterSet const& p);
54 
55  int FitLine(std::vector<HitLineFitData> & data, HitLineFitResults & bestfit);
56  void SetParameter(int i, double startValue, double minValue, double maxValue);
57  void SetHorizVertRanges(float hmin, float hmax, float vmin, float vmax);
58  void SetSeed(UInt_t seed) {
59  fSeedValue = seed;
60  }
61 
62 private:
63  float PointToLineDist(TVector3 ptloc, TVector3 linept1, TVector3 linept2);
64  void DeterministicShuffle(std::vector<unsigned int> & vec);
65  bool CheckModelParameters();
66 
71 
72  std::map<int,ParVals> fParIVal;
73 
74  UInt_t fSeedValue;
75 
76  int fFitPolN;
81  int fLogLevel;
82  };
83 
84 }
85 
86 #endif
float PointToLineDist(TVector3 ptloc, TVector3 linept1, TVector3 linept2)
HitLineFitAlg(fhicl::ParameterSet const &pset)
std::map< int, ParVals > fParIVal
Definition: HitLineFitAlg.h:72
int FitLine(std::vector< HitLineFitData > &data, HitLineFitResults &bestfit)
void SetSeed(UInt_t seed)
Definition: HitLineFitAlg.h:58
std::map< int, float > bestValError
Definition: HitLineFitAlg.h:37
void SetParameter(int i, double startValue, double minValue, double maxValue)
p
Definition: test.py:223
void reconfigure(fhicl::ParameterSet const &p)
void DeterministicShuffle(std::vector< unsigned int > &vec)
void SetHorizVertRanges(float hmin, float hmax, float vmin, float vmax)