RFFHitFitter.h
Go to the documentation of this file.
1 #ifndef RFFHITFITTER_H
2 #define RFFHITFITTER_H
3 
4 /*!
5  * Title: RFFHitFitter Class
6  * Author: Wes Ketchum (wketchum@lanl.gov)
7  *
8  * Description:
9  * Class that does the base RFF algorithm. RFF works by simplifiying a Gaussian
10  * fit by dividing a pulse by its derivative. for a Guassian, the result is a
11  * line, with the slope and intercept related to the sigma and mean of the
12  * Gaussian.
13  *
14  * Input: Signal (vector of floats)
15  * Output: Guassian means and sigmas
16 */
17 
18 #include <vector>
19 #include <set>
20 
21 #include "GaussianEliminationAlg.h"
22 
23 namespace hit{
24 
25  struct SignalSetComp{
26  bool operator() (const std::pair<float,float>& lhs,
27  const std::pair<float,float>& rhs) const
28  { return lhs.first < rhs.first; }
29  };
30 
31  class RFFHitFitter {
32 
33  typedef std::pair<float,float> MeanSigmaPair;
34 
35  public:
36  RFFHitFitter(float,unsigned int,float,float step=0.1,float max=5.0);
37  RFFHitFitter(float step=0.1,float max=5.0);
38 
39  void SetFitterParams(float,unsigned int,float);
40 
41  void RunFitter(const std::vector<float>& signal);
42 
43  const std::vector<float>& MeanVector() { return fMeanVector; }
44  const std::vector<float>& SigmaVector() { return fSigmaVector; }
45  const std::vector<float>& MeanErrorVector() { return fMeanErrorVector; }
46  const std::vector<float>& SigmaErrorVector() { return fSigmaErrorVector; }
47  const std::vector<float>& AmplitudeVector() { return fAmpVector; }
48  const std::vector<float>& AmplitudeErrorVector() { return fAmpErrorVector; }
49  unsigned int NHits() { return fMeanVector.size(); }
50 
51  void ClearResults();
52 
53  void PrintResults();
54 
55  private:
57  unsigned int fMinMergeMultiplicity;
59 
60  // Clang: private field is not used (x2):
61  // float fGEAlgStepSize;
62  // float fGEAlgMax;
64 
65  std::vector<float> fMeanVector;
66  std::vector<float> fSigmaVector;
67  std::vector<float> fMeanErrorVector;
68  std::vector<float> fSigmaErrorVector;
69  std::vector<float> fAmpVector;
70  std::vector<float> fAmpErrorVector;
71 
72  std::multiset< MeanSigmaPair, SignalSetComp > fSignalSet;
75 
76  void CalculateAllMeansAndSigmas(const std::vector<float>& signal);
77  void CalculateMergedMeansAndSigmas(std::size_t signal_size);
78  void CalculateAmplitudes(const std::vector<float>& signal);
79  void CreateMergeVector();
80 
81  bool HitsBelowThreshold();
82 
83  };
84 
85 }
86 
87 #endif
intermediate_table::iterator iterator
const std::vector< float > & AmplitudeVector()
Definition: RFFHitFitter.h:47
std::vector< float > fAmpErrorVector
Definition: RFFHitFitter.h:70
unsigned int fMinMergeMultiplicity
Definition: RFFHitFitter.h:57
const std::vector< float > & MeanVector()
Definition: RFFHitFitter.h:43
const std::vector< float > & SigmaVector()
Definition: RFFHitFitter.h:44
std::vector< float > fSigmaVector
Definition: RFFHitFitter.h:66
std::vector< std::vector< std::multiset< MeanSigmaPair >::iterator > > fMergeVector
Definition: RFFHitFitter.h:74
util::GaussianEliminationAlg fGEAlg
Definition: RFFHitFitter.h:63
float fFinalAmpThreshold
Definition: RFFHitFitter.h:58
static int max(int a, int b)
const std::vector< float > & MeanErrorVector()
Definition: RFFHitFitter.h:45
std::multiset< MeanSigmaPair, SignalSetComp > fSignalSet
Definition: RFFHitFitter.h:72
std::vector< float > fAmpVector
Definition: RFFHitFitter.h:69
Detector simulation of raw signals on wires.
std::vector< float > fSigmaErrorVector
Definition: RFFHitFitter.h:68
std::pair< float, float > MeanSigmaPair
Definition: RFFHitFitter.h:33
float fMeanMatchThreshold
Definition: RFFHitFitter.h:56
unsigned int NHits()
Definition: RFFHitFitter.h:49
const std::vector< float > & AmplitudeErrorVector()
Definition: RFFHitFitter.h:48
bool operator()(const std::pair< float, float > &lhs, const std::pair< float, float > &rhs) const
Definition: RFFHitFitter.h:26
std::vector< float > fMeanVector
Definition: RFFHitFitter.h:65
std::vector< float > fMeanErrorVector
Definition: RFFHitFitter.h:67
const std::vector< float > & SigmaErrorVector()
Definition: RFFHitFitter.h:46