Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunecore
dunecore
DuneCommon
Utility
GausRmsFitter.h
Go to the documentation of this file.
1
// GausRmsFitter.h
2
3
#ifndef GausRmsFitter_H
4
#define GausRmsFitter_H
5
6
// David Adams
7
// December 2018
8
//
9
// Utility to evaluate the mean and RMS for a peak in a histogram and
10
// return those and the selected range in an attached gaus function with
11
// fitted height.
12
//
13
// There are two configuration parameters: sigma0 and nsigma.
14
// Calls to fit a histogram add a starting mean, mean0.
15
//
16
// If both sigma0 and nsigma are valid (i.e. are > 0), then the RMS is
17
// evaluated iteratively over the range (mean-nsigma*sigma, mean+nsigma*sigma)
18
// until it coverges on a value for sigma. The range is restricted to that of
19
// the input, i.e. its default or the value set with axis SetRange or SetRangeUser.
20
// The starting values for the iteration are mean0 and sigma0 and the iteration
21
// stops when the evaluated value for sigma is less or close to that used to
22
// define the range.
23
//
24
// If sigma0 is valid and nsigma is not, then those are used for the
25
// corresponding function values.
26
//
27
// If both are invalid, mean0 is ignored and man and RMS for the full range
28
// are used to construct the function.
29
//
30
// Any other configuration results in a fit error.
31
32
#include <string>
33
class
TH1;
34
35
class
GausRmsFitter
{
36
37
public
:
38
39
using
Name
=
std::string
;
40
using
Index
=
unsigned
int
;
41
42
// Ctor for fit of full histogram.
43
GausRmsFitter
(
Name
fnam);
44
45
// Ctor to fit range of n-sigma starting with sigma0.
46
GausRmsFitter
(
double
sigma0,
double
nsigma,
Name
fnam);
47
48
// Fit a histogram with the provided starting mean.
49
// Returns 0 for success.
50
// If successful, a gaus function is attached to the histogram.
51
// This function has the assigned mean, sigma and fit range and the fitted height.
52
int
fit
(TH1* ph,
double
mean0)
const
;
53
54
// Set the log level.
55
void
setLogLevel
(
Index
lev) {
m_LogLevel
= lev; }
56
57
private
:
58
59
double
m_sigma0
;
60
double
m_nsigma
;
61
Name
m_fnam
;
62
Index
m_LogLevel
;
63
64
};
65
66
#endif
GausRmsFitter::Name
std::string Name
Definition:
GausRmsFitter.h:39
string
std::string string
Definition:
nybbler.cc:12
GausRmsFitter::m_fnam
Name m_fnam
Definition:
GausRmsFitter.h:61
GausRmsFitter::GausRmsFitter
GausRmsFitter(Name fnam)
Definition:
GausRmsFitter.cxx:18
GausRmsFitter
Definition:
GausRmsFitter.h:35
keras_to_tensorflow.int
int
Definition:
keras_to_tensorflow.py:69
GausRmsFitter::m_nsigma
double m_nsigma
Definition:
GausRmsFitter.h:60
GausRmsFitter::fit
int fit(TH1 *ph, double mean0) const
Definition:
GausRmsFitter.cxx:28
GausRmsFitter::Index
unsigned int Index
Definition:
GausRmsFitter.h:40
GausRmsFitter::m_LogLevel
Index m_LogLevel
Definition:
GausRmsFitter.h:62
GausRmsFitter::m_sigma0
double m_sigma0
Definition:
GausRmsFitter.h:59
GausRmsFitter::setLogLevel
void setLogLevel(Index lev)
Definition:
GausRmsFitter.h:55
Generated by
1.8.11