source: trunk/MagicSoft/Mars/mcalib/MHGausEvents.h@ 4308

Last change on this file since 4308 was 4128, checked in by gaug, 21 years ago
*** empty log message ***
File size: 9.5 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;
18class MHGausEvents : public MH
19{
20private:
21
22 const static Int_t fgBinsAfterStripping; //! Default for fBinsAfterStripping (now set to: 40)
23 const static Float_t fgBlackoutLimit; //! Default for fBlackoutLimit (now set to: 5. )
24 const static Int_t fgNDFLimit; //! Default for fNDFLimit (now set to: 2)
25 const static Float_t fgProbLimit; //! Default for fProbLimit (now set to: 0.001)
26 const static Float_t fgPickupLimit; //! Default for fPickupLimit (now set to: 5. )
27 const static Int_t fgPowerProbabilityBins; //! Default for fPowerProbabilityBins (now set to: 20)
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 Float_t fEventFrequency; // Event frequency in Hertz (to be set)
32 Byte_t fFlags; // Bit field for the fit result bits
33 Int_t fPowerProbabilityBins; // Bins for the projected power spectrum
34
35 TH1I *fHPowerProbability; // Fourier transform of fEvents projected on y-axis
36 TArrayF *fPowerSpectrum; // Fourier transform of fEvents
37 TGraph *fGraphEvents; //! TGraph to display the event array (will not be cloned!!)
38 TGraph *fGraphPowerSpectrum; //! TGraph to display the power spectrum array (will not be cloned!!)
39
40 enum { kGausFitOK, kExpFitOK, kFourierSpectrumOK, kExcluded }; // Bits for information about fit results
41
42protected:
43
44 Float_t fBlackoutLimit; // Lower number sigmas from mean until event is considered blackout
45 TArrayF 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 TH1F fHGausHist; // Histogram to hold the Gaussian distribution
50 Axis_t fLast; // Upper histogram edge for fHGausHist (used by InitBins())
51 Double_t fMean; // Mean of the Gauss fit
52 Double_t fMeanErr; // Error of the mean of the Gauss fit
53 Int_t fNbins; // Number histogram bins for fHGausHist (used by InitBins())
54 Int_t fNDFLimit; // NDF limit for judgement if fit is OK
55 Float_t fSaturated; // Number of events classified as saturated
56 Double_t fSigma; // Sigma of the Gauss fit
57 Double_t fSigmaErr; // Error of the sigma of the Gauss fit
58 Float_t fPickupLimit; // Upper number sigmas from mean until event is considered pickup
59 Int_t fPixId; // Pixel ID
60 Double_t fProb; // Probability of the Gauss fit
61 Float_t fProbLimit; // Probability limit for judgement if fit is OK
62
63 Float_t *CreateEventXaxis(Int_t n); // Create an x-axis for the Event TGraphs
64 Float_t *CreatePSDXaxis(Int_t n); // Create an x-axis for the PSD TGraphs
65
66 void DrawEvents(); // Draw graph of fEvents
67 void DrawPowerSpectrum(TVirtualPad &pad, Int_t i); // Draw graph of fPowerSpectrum and fHPowerProbability
68
69 // Setters
70 void SetBinsAfterStripping ( const Int_t nbins=fgBinsAfterStripping ) { fBinsAfterStripping =nbins; }
71 void SetPowerProbabilityBins ( const Int_t nbins=fgPowerProbabilityBins ) { fPowerProbabilityBins=nbins; }
72
73 public:
74
75 MHGausEvents(const char* name=NULL, const char* title=NULL);
76 ~MHGausEvents();
77
78 virtual void Clear(Option_t *o="");
79 virtual void Reset();
80 virtual void InitBins();
81
82 // Draws
83 virtual void Draw(Option_t *option=""); // Default Draw
84
85 // Getters
86 const Double_t GetBlackout() const;
87 const Double_t GetChiSquare() const;
88 const Double_t GetExpChiSquare() const;
89 const Int_t GetExpNdf() const;
90 const Double_t GetExpProb() const;
91 TArrayF *GetEvents() { return &fEvents; }
92 const TArrayF *GetEvents() const { return &fEvents; }
93 TF1 *GetFExpFit() { return fFExpFit; }
94 const TF1 *GetFExpFit() const { return fFExpFit; }
95 TF1 *GetFGausFit() { return fFGausFit; }
96 const TF1 *GetFGausFit() const { return fFGausFit; }
97 TGraph *GetGraphEvents() { return fGraphEvents; }
98 const TGraph *GetGraphEvents() const { return fGraphEvents; }
99 TGraph *GetGraphPowerSpectrum() { return fGraphPowerSpectrum; }
100 const TGraph *GetGraphPowerSpectrum() const { return fGraphPowerSpectrum; }
101 TH1F *GetHGausHist() { return &fHGausHist; }
102 const TH1F *GetHGausHist() const { return &fHGausHist; }
103 TH1I *GetHPowerProbability() { return fHPowerProbability; }
104 const TH1I *GetHPowerProbability() const { return fHPowerProbability; }
105 const Double_t GetMean() const { return fMean; }
106 const Double_t GetMeanErr() const { return fMeanErr; }
107 const Int_t GetNdf() const;
108 const Double_t GetOffset() const;
109 const Double_t GetPickup() const;
110 const Int_t GetPixId() const { return fPixId; }
111 TArrayF *GetPowerSpectrum() { return fPowerSpectrum; }
112 const TArrayF *GetPowerSpectrum() const { return fPowerSpectrum; }
113 const Double_t GetProb() const { return fProb; }
114 const Float_t GetSaturated() const { return fSaturated; }
115 const Double_t GetSigma() const { return fSigma; }
116 const Double_t GetSigmaErr() const { return fSigmaErr; }
117 const Double_t GetSlope() const;
118
119 const Bool_t IsExcluded() const;
120 const Bool_t IsExpFitOK() const;
121 const Bool_t IsEmpty() const;
122 const Bool_t IsFourierSpectrumOK() const;
123 const Bool_t IsGausFitOK() 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 Bool_t RepeatFit(const Option_t *option="RQ0"); // Repeat fit within limits defined by fPickupLimit
135 void BypassFit(); // Take mean and RMS from the histogram
136
137 // Prints
138 virtual void Print(const Option_t *o="") const; // Default Print
139
140 // Setters
141 void SetBlackoutLimit ( const Float_t lim=fgBlackoutLimit ) { fBlackoutLimit = lim; }
142 void SetEventFrequency ( const Float_t f ) { fEventFrequency = f; }
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 SetPickupLimit ( const Float_t lim=fgPickupLimit ) { fPickupLimit = lim; }
154 void SetPixId ( const Int_t i ) { fPixId = i; }
155 void SetProb ( const Double_t d ) { fProb = d; }
156 void SetProbLimit ( const Float_t lim=fgProbLimit ) { fProbLimit = lim; }
157 void SetSaturated ( const Float_t f ) { fSaturated += f; }
158 void SetSigma ( const Double_t d ) { fSigma = d; }
159 void SetSigmaErr ( const Double_t d ) { fSigmaErr = d; }
160
161 // Miscelleaneous
162 virtual void ChangeHistId(const Int_t id); // Changes names and titles of the histogram
163 virtual void Renorm(); // Re-normalize the results
164
165 void CreateFourierSpectrum(); // Create the fourier spectrum out of fEvents
166 void CreateGraphEvents(); // Create the TGraph fGraphEvents of fEvents
167 void CreateGraphPowerSpectrum(); // Create the TGraph fGraphPowerSpectrum out of fPowerSpectrum
168
169 ClassDef(MHGausEvents, 1) // Base class for events with Gaussian distributed values
170};
171
172#endif
Note: See TracBrowser for help on using the repository browser.