source: trunk/Mars/mhcalib/MHCalibrationChargeBlindPix.h@ 19344

Last change on this file since 19344 was 8911, checked in by tbretz, 17 years ago
*** empty log message ***
File size: 6.3 KB
Line 
1#ifndef MARS_MHCalibrationChargeBlindPix
2#define MARS_MHCalibrationChargeBlindPix
3
4#ifndef MARS_MHCalibrationPix
5#include "MHCalibrationPix.h"
6#endif
7
8#include <TMath.h>
9
10#ifndef ROOT_TF1
11#include <TF1.h>
12#endif
13
14#ifndef ROOT_TVector
15#include <TVector.h>
16#endif
17
18class TH1F;
19class TPaveText;
20class TText;
21class MExtractedSignalBlindPixel;
22class MRawEvtPixelIter;
23
24class MHCalibrationChargeBlindPix : public MHCalibrationPix
25{
26private:
27
28 static const Float_t fgNumSinglePheLimit; //! Default for fNumSinglePheLimit (now set to: 50)
29 static const Float_t gkSignalInitializer; //! Signal initializer (-9999.)
30
31 static const Double_t gkElectronicAmp; // Electronic Amplification after the PMT (in FADC counts/N_e)
32 static const Double_t gkElectronicAmpErr; // Error of the electronic amplification
33
34 Float_t fSinglePheCut; // Value of summed FADC slices upon which event considered as single-phe
35 Float_t fNumSinglePheLimit; // Minimum number of single-phe events
36
37// TVector fASinglePheFADCSlices; //! Averaged FADC slice entries supposed single-phe events
38// TVector fAPedestalFADCSlices; //! Averaged FADC slice entries supposed pedestal events
39
40 TF1 *fSinglePheFit; // Single Phe Fit (Gaussians convoluted with Poisson)
41
42 UInt_t fNumSinglePhes; // Number of entries in fASinglePheFADCSlices
43 UInt_t fNumPedestals; // Number of entries in fAPedestalFADCSlices
44
45 Double_t fLambda; // Poisson mean from Single-phe fit
46 Double_t fLambdaCheck; // Poisson mean from Pedestal fit alone
47 Double_t fMu0; // Mean of the pedestal
48 Double_t fMu1; // Mean of single-phe peak
49 Double_t fSigma0; // Sigma of the pedestal
50 Double_t fSigma1; // Sigma of single-phe peak
51 Double_t fLambdaErr; // Error of Poisson mean from Single-phe fit
52 Double_t fLambdaCheckErr; // Error of Poisson mean from Pedestal fit alone
53 Double_t fMu0Err; // Error of Mean of the pedestal
54 Double_t fMu1Err; // Error of Mean of single-phe peak
55 Double_t fSigma0Err; // Error of Sigma of the pedestal
56 Double_t fSigma1Err; // Error of Sigma of single-phe peak
57 Double_t fChisquare; // Chisquare of single-phe fit
58 Int_t fNDF; // Ndof of single-phe fit
59 Double_t fProb; // Probability of singleo-phe fit
60
61 Byte_t fFlags; // Bit-field for the flags
62 enum { kSinglePheFitOK, kPedestalFitOK }; // Possible bits to be set
63
64 static Double_t FitFuncMichele(Double_t *x, Double_t *par);
65 static Double_t PoissonKto4(Double_t *x, Double_t *par);
66 static Double_t PoissonKto5(Double_t *x, Double_t *par);
67 static Double_t PoissonKto6(Double_t *x, Double_t *par);
68 static Double_t Polya(Double_t *x, Double_t *par);
69
70public:
71
72 enum FitFunc_t { kEPoisson4, kEPoisson5,
73 kEPoisson6, kEPoisson7,
74 kEPolya, kEMichele }; // Possible fit functions types
75
76private:
77
78 FitFunc_t fFitFunc;
79
80 TPaveText *fFitLegend; //! Some legend to display the fit results
81 TH1F *fHSinglePheFADCSlices; // A histogram created and deleted only in Draw()
82 TH1F *fHPedestalFADCSlices; // A histogram created and deleted only in Draw()
83
84 // Fit
85 Bool_t InitFit();
86 void ExitFit();
87
88 void DrawLegend(Option_t *opt="");
89
90public:
91
92 MHCalibrationChargeBlindPix(const char *name=NULL, const char *title=NULL);
93 ~MHCalibrationChargeBlindPix();
94
95 void Clear(Option_t *o="");
96 void Reset() {}
97
98 // Getters
99 const Double_t GetLambda () const { return fLambda; }
100 const Double_t GetLambdaCheck () const { return fLambdaCheck; }
101 const Double_t GetMu0 () const { return fMu0; }
102 const Double_t GetMu1 () const { return fMu1; }
103 const Double_t GetSigma0 () const { return fSigma0; }
104 const Double_t GetSigma1 () const { return fSigma1; }
105 const Double_t GetLambdaErr () const { return fLambdaErr; }
106 const Double_t GetLambdaCheckErr() const { return fLambdaCheckErr; }
107 const Double_t GetMu0Err () const { return fMu0Err; }
108 const Double_t GetMu1Err () const { return fMu1Err; }
109 const Double_t GetSigma0Err () const { return fSigma0Err; }
110 const Double_t GetSigma1Err () const { return fSigma1Err; }
111 const Float_t GetSinglePheCut () const { return fSinglePheCut; }
112
113// TVector &GetASinglePheFADCSlices() { return fASinglePheFADCSlices; }
114// const TVector &GetASinglePheFADCSlices() const { return fASinglePheFADCSlices; }
115
116// TVector &GetAPedestalFADCSlices() { return fAPedestalFADCSlices; }
117// const TVector &GetAPedestalFADCSlices() const { return fAPedestalFADCSlices; }
118
119 const Bool_t IsSinglePheFitOK() const;
120 const Bool_t IsPedestalFitOK() const;
121
122 // Setters
123 void SetFitFunc ( const FitFunc_t func ) { fFitFunc = func; }
124 void SetSinglePheCut ( const Float_t cut = 0. ) { fSinglePheCut = cut; }
125 void SetNumSinglePheLimit ( const Float_t lim =fgNumSinglePheLimit ) { fNumSinglePheLimit = lim; }
126
127 void SetSinglePheFitOK ( const Bool_t b=kTRUE);
128 void SetPedestalFitOK ( const Bool_t b=kTRUE);
129
130 // Fill histos
131// void FillSinglePheFADCSlices(const MRawEvtPixelIter &iter);
132// void FillPedestalFADCSlices( const MRawEvtPixelIter &iter);
133// void FinalizeSinglePheSpectrum();
134
135 // Draws
136 void Draw(Option_t *opt="");
137
138 // Fits
139 Bool_t FitSinglePhe (Option_t *opt="RL0+Q");
140 void FitPedestal (Option_t *opt="RL0+Q");
141
142 // Simulation
143 Bool_t SimulateSinglePhe(const Double_t lambda,
144 const Double_t mu0, const Double_t mu1,
145 const Double_t sigma0, const Double_t sigma1);
146
147 ClassDef(MHCalibrationChargeBlindPix, 1) // Histogram class for Charge Blind Pixel Calibration
148};
149
150#endif /* MARS_MHCalibrationChargeBlindPix */
Note: See TracBrowser for help on using the repository browser.