1 | #ifndef MARS_MHGausEvents
|
---|
2 | #define MARS_MHGausEvents
|
---|
3 |
|
---|
4 | #ifndef ROOT_TH1
|
---|
5 | #include <TH1.h>
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | #ifndef MARS_MH
|
---|
9 | #include "MH.h"
|
---|
10 | #endif
|
---|
11 |
|
---|
12 | #ifndef MARS_MArrayF
|
---|
13 | #include "MArrayF.h"
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | class TVirtualPad;
|
---|
17 | class TGraph;
|
---|
18 | class MArrayF;
|
---|
19 | class TH1F;
|
---|
20 | class TH1I;
|
---|
21 | class TF1;
|
---|
22 | class MHGausEvents : public MH
|
---|
23 | {
|
---|
24 | private:
|
---|
25 |
|
---|
26 | const static Int_t fgNDFLimit; //! Default for fNDFLimit (now set to: 2)
|
---|
27 | const static Float_t fgProbLimit; //! Default for fProbLimit (now set to: 0.001)
|
---|
28 | const static Int_t fgPowerProbabilityBins; //! Default for fPowerProbabilityBins (now set to: 20)
|
---|
29 |
|
---|
30 | protected:
|
---|
31 |
|
---|
32 | Int_t fBinsAfterStripping; // Bins for the Gauss Histogram after stripping off the zeros at both ends
|
---|
33 | UInt_t fCurrentSize; // Current size of the array fEvents
|
---|
34 | Byte_t fFlags; // Bit field for the fit result bits
|
---|
35 | Int_t fPowerProbabilityBins; // Bins for the projected power spectrum
|
---|
36 |
|
---|
37 | TH1I *fHPowerProbability; // Fourier transform of fEvents projected on y-axis
|
---|
38 | MArrayF *fPowerSpectrum; // Fourier transform of fEvents
|
---|
39 |
|
---|
40 | enum { kGausFitOK,
|
---|
41 | kExpFitOK,
|
---|
42 | kFourierSpectrumOK,
|
---|
43 | kExcluded }; // Bits for information about fit results
|
---|
44 |
|
---|
45 | MArrayF fEvents; // Array which holds the entries of GausHist
|
---|
46 | TF1 *fFGausFit; // Gauss fit for fHGausHist
|
---|
47 | TF1 *fFExpFit; // Exponential fit for FHPowerProbability
|
---|
48 | Axis_t fFirst; // Lower histogram edge for fHGausHist (used by InitBins())
|
---|
49 | TGraph *fGraphEvents; //! TGraph to display the event array (will not be cloned!!)
|
---|
50 | TGraph *fGraphPowerSpectrum; //! TGraph to display the power spectrum array (will not be cloned!!)
|
---|
51 | TH1F fHGausHist; // Histogram to hold the Gaussian distribution
|
---|
52 | Axis_t fLast; // Upper histogram edge for fHGausHist (used by InitBins())
|
---|
53 | Double_t fMean; // Mean of the Gauss fit
|
---|
54 | Double_t fMeanErr; // Error of the mean of the Gauss fit
|
---|
55 | Int_t fNbins; // Number histogram bins for fHGausHist (used by InitBins())
|
---|
56 | Int_t fNDFLimit; // NDF limit for judgement if fit is OK
|
---|
57 | Double_t fSigma; // Sigma of the Gauss fit
|
---|
58 | Double_t fSigmaErr; // Error of the sigma of the Gauss fit
|
---|
59 | Double_t fProb; // Probability of the Gauss fit
|
---|
60 | Float_t fProbLimit; // Probability limit for judgement if fit is OK
|
---|
61 |
|
---|
62 | virtual Float_t *CreateEventXaxis(Int_t n); // Create an x-axis for the Event TGraphs
|
---|
63 | virtual Float_t *CreatePSDXaxis(Int_t n); // Create an x-axis for the PSD TGraphs
|
---|
64 |
|
---|
65 | void DrawPowerSpectrum(TVirtualPad &pad, Int_t i); // Draw graph of fPowerSpectrum and fHPowerProbability
|
---|
66 |
|
---|
67 | // Setters
|
---|
68 | void SetBinsAfterStripping ( const Int_t nbins=0 ) { fBinsAfterStripping =nbins; }
|
---|
69 | void SetPowerProbabilityBins ( const Int_t nbins=fgPowerProbabilityBins ) { fPowerProbabilityBins=nbins; }
|
---|
70 |
|
---|
71 | public:
|
---|
72 |
|
---|
73 | MHGausEvents(const char* name=NULL, const char* title=NULL);
|
---|
74 | ~MHGausEvents();
|
---|
75 |
|
---|
76 | TObject *Clone(const char* name="") const;
|
---|
77 |
|
---|
78 | void Clear(Option_t *o="");
|
---|
79 | void Reset();
|
---|
80 |
|
---|
81 | // Draws
|
---|
82 | void Draw(Option_t *option=""); // Default Draw
|
---|
83 | void DrawEvents(Option_t *option=""); // Draw graph of fEvents
|
---|
84 |
|
---|
85 | // Inits
|
---|
86 | virtual void InitBins();
|
---|
87 |
|
---|
88 | // Getters
|
---|
89 | const Double_t GetChiSquare() const;
|
---|
90 | const Double_t GetExpChiSquare() const;
|
---|
91 | const Int_t GetExpNdf() const;
|
---|
92 | const Double_t GetExpProb() const;
|
---|
93 | MArrayF *GetEvents() { return &fEvents; }
|
---|
94 | const MArrayF *GetEvents() const { return &fEvents; }
|
---|
95 | TF1 *GetFExpFit() { return fFExpFit; }
|
---|
96 | const TF1 *GetFExpFit() const { return fFExpFit; }
|
---|
97 | TF1 *GetFGausFit() { return fFGausFit; }
|
---|
98 | const TF1 *GetFGausFit() const { return fFGausFit; }
|
---|
99 | TGraph *GetGraphEvents() { return fGraphEvents; }
|
---|
100 | const Double_t GetFirst() const { return fFirst; }
|
---|
101 | const Double_t GetLast () const { return fLast ; }
|
---|
102 | const TGraph *GetGraphEvents() const { return fGraphEvents; }
|
---|
103 | TGraph *GetGraphPowerSpectrum() { return fGraphPowerSpectrum; }
|
---|
104 | const TGraph *GetGraphPowerSpectrum() const { return fGraphPowerSpectrum; }
|
---|
105 | TH1F *GetHGausHist() { return &fHGausHist; }
|
---|
106 | const TH1F *GetHGausHist() const { return &fHGausHist; }
|
---|
107 | TH1I *GetHPowerProbability() { return fHPowerProbability; }
|
---|
108 | const TH1I *GetHPowerProbability() const { return fHPowerProbability; }
|
---|
109 | const Double_t GetMean() const { return fMean; }
|
---|
110 | const Double_t GetMeanErr() const { return fMeanErr; }
|
---|
111 | const Int_t GetNdf() const;
|
---|
112 | const Int_t GetNbins() const { return fNbins; }
|
---|
113 | const Double_t GetOffset() const;
|
---|
114 | MArrayF *GetPowerSpectrum() { return fPowerSpectrum; }
|
---|
115 | const MArrayF *GetPowerSpectrum() const { return fPowerSpectrum; }
|
---|
116 | const Double_t GetProb() const { return fProb; }
|
---|
117 | const Double_t GetSigma() const { return fSigma; }
|
---|
118 | const Double_t GetSigmaErr() const { return fSigmaErr; }
|
---|
119 | const Double_t GetSlope() const;
|
---|
120 |
|
---|
121 | const Bool_t IsExcluded() const;
|
---|
122 | const Bool_t IsExpFitOK() const;
|
---|
123 | const Bool_t IsEmpty() const;
|
---|
124 | const Bool_t IsFourierSpectrumOK() const;
|
---|
125 | const Bool_t IsGausFitOK() const;
|
---|
126 | const Bool_t IsOnlyOverflow() const;
|
---|
127 | const Bool_t IsOnlyUnderflow() const;
|
---|
128 |
|
---|
129 | // Fill
|
---|
130 | void FillArray ( const Float_t f ); // Fill only the array fEvents
|
---|
131 | Bool_t FillHist ( const Float_t f ); // Fill only the histogram HGausHist
|
---|
132 | Bool_t FillHistAndArray( const Float_t f ); // Fill bothe the array fEvents and the histogram HGausHist
|
---|
133 |
|
---|
134 | // Fits
|
---|
135 | Bool_t FitGaus( Option_t *option="RQ0",
|
---|
136 | const Double_t xmin=0.,
|
---|
137 | const Double_t xmax=0.); // Fit the histogram HGausHist with a Gaussian
|
---|
138 |
|
---|
139 | // Prints
|
---|
140 | virtual void Print(const Option_t *o="") const; // Default Print
|
---|
141 |
|
---|
142 | // Setters
|
---|
143 | void SetExcluded ( const Bool_t b=kTRUE );
|
---|
144 | void SetExpFitOK ( const Bool_t b=kTRUE );
|
---|
145 | void SetFourierSpectrumOK( const Bool_t b=kTRUE );
|
---|
146 | void SetGausFitOK ( const Bool_t b=kTRUE );
|
---|
147 | void SetLast ( const Double_t d ) { fLast = d; }
|
---|
148 | void SetFirst ( const Double_t d ) { fFirst = d; }
|
---|
149 | void SetMean ( const Double_t d ) { fMean = d; }
|
---|
150 | void SetMeanErr ( const Double_t d ) { fMeanErr = d; }
|
---|
151 | void SetNbins ( const Int_t i ) { fNbins = i; }
|
---|
152 | void SetNDFLimit ( const Int_t lim=fgNDFLimit ) { fNDFLimit = lim; }
|
---|
153 | void SetProb ( const Double_t d ) { fProb = d; }
|
---|
154 | void SetProbLimit ( const Float_t lim=fgProbLimit ) { fProbLimit = lim; }
|
---|
155 | void SetSigma ( const Double_t d ) { fSigma = d; }
|
---|
156 | void SetSigmaErr ( const Double_t d ) { fSigmaErr = d; }
|
---|
157 |
|
---|
158 | void CreateFourierSpectrum(); // Create the fourier spectrum out of fEvents
|
---|
159 | virtual void CreateGraphEvents(); // Create the TGraph fGraphEvents of fEvents
|
---|
160 | virtual void CreateGraphPowerSpectrum(); // Create the TGraph fGraphPowerSpectrum out of fPowerSpectrum
|
---|
161 |
|
---|
162 | ClassDef(MHGausEvents, 1) // Base class for events with Gaussian distributed values
|
---|
163 | };
|
---|
164 |
|
---|
165 | #endif
|
---|