source: trunk/MagicSoft/Mars/mhcalib/MHGausEvents.h@ 4959

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