1 | /* ======================================================================== *\
|
---|
2 | !
|
---|
3 | ! *
|
---|
4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
---|
6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
---|
8 | ! *
|
---|
9 | ! * Permission to use, copy, modify and distribute this software and its
|
---|
10 | ! * documentation for any purpose is hereby granted without fee,
|
---|
11 | ! * provided that the above copyright notice appear in all copies and
|
---|
12 | ! * that both that copyright notice and this permission notice appear
|
---|
13 | ! * in supporting documentation. It is provided "as is" without express
|
---|
14 | ! * or implied warranty.
|
---|
15 | ! *
|
---|
16 | !
|
---|
17 | !
|
---|
18 | ! Author(s): Markus Gaug 02/2004 <mailto:markus@ifae.es>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2004
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | //////////////////////////////////////////////////////////////////////////////
|
---|
26 | //
|
---|
27 | // MHPedestalPix
|
---|
28 | //
|
---|
29 | // Histogram class for pedestal analysis.
|
---|
30 | // Stores and fits the pedestals taken from MPedestalPix on an event-by-event
|
---|
31 | // basis. The results are re-normalized to a value per slice with the formulae:
|
---|
32 | //
|
---|
33 | // - Mean Pedestal / slice = Mean Pedestal / Number slices
|
---|
34 | // - Mean Pedestal Error / slice = Mean Pedestal Error / Number slices
|
---|
35 | // - Sigma Pedestal / slice = Sigma Pedestal / Sqrt (Number slices)
|
---|
36 | // - Sigma Pedestal Error / slice = Sigma Pedestal Error / Sqrt (Number slices)
|
---|
37 | //
|
---|
38 | // Derives from MHGausEvents, fits the pedestals to a Gaussian and performs
|
---|
39 | // a Fourier analysis.
|
---|
40 | //
|
---|
41 | //////////////////////////////////////////////////////////////////////////////
|
---|
42 | #include "MHPedestalPix.h"
|
---|
43 |
|
---|
44 | #include <TH1.h>
|
---|
45 |
|
---|
46 | ClassImp(MHPedestalPix);
|
---|
47 |
|
---|
48 | using namespace std;
|
---|
49 | //
|
---|
50 | const Int_t MHPedestalPix::fgChargeNbins = 450 ;
|
---|
51 | const Axis_t MHPedestalPix::fgChargeFirst = -0.5;
|
---|
52 | const Axis_t MHPedestalPix::fgChargeLast = 449.5;
|
---|
53 | // --------------------------------------------------------------------------
|
---|
54 | //
|
---|
55 | // Default Constructor.
|
---|
56 | //
|
---|
57 | // Sets:
|
---|
58 | // - the default number for fNbins (fgChargeNbins)
|
---|
59 | // - the default number for fFirst (fgChargeFirst)
|
---|
60 | // - the default number for fLast (fgChargeLast)
|
---|
61 | //
|
---|
62 | // - the default name of the fHGausHist ("HPedestalCharge")
|
---|
63 | // - the default title of the fHGausHist ("Distribution of Summed FADC Pedestal slices Pixel ")
|
---|
64 | // - the default x-axis title for fHGausHist ("Sum FADC Slices")
|
---|
65 | // - the default y-axis title for fHGausHist ("Nr. of events")
|
---|
66 | // - TH1::Sumw2() for fHGausHist
|
---|
67 | //
|
---|
68 | // Initializes:
|
---|
69 | // - fNSlices to 1
|
---|
70 | //
|
---|
71 | MHPedestalPix::MHPedestalPix(const char *name, const char *title)
|
---|
72 | : fNSlices(1)
|
---|
73 | {
|
---|
74 |
|
---|
75 | fName = name ? name : "MHPedestalPix";
|
---|
76 | fTitle = title ? title : "Histogrammed Pedestal events";
|
---|
77 |
|
---|
78 | SetNbins( fgChargeNbins );
|
---|
79 | SetFirst( fgChargeFirst );
|
---|
80 | SetLast( fgChargeLast );
|
---|
81 |
|
---|
82 | // Create a large number of bins, later we will rebin
|
---|
83 | fHGausHist.SetName("HPedestalCharge");
|
---|
84 | fHGausHist.SetTitle("Distribution of Summed FADC Pedestal Slices Pixel ");
|
---|
85 | fHGausHist.SetXTitle("Sum FADC Slices");
|
---|
86 | fHGausHist.SetYTitle("Nr. of events");
|
---|
87 | fHGausHist.Sumw2();
|
---|
88 |
|
---|
89 | }
|
---|
90 |
|
---|
91 | // --------------------------------------------------------------------------
|
---|
92 | //
|
---|
93 | // If mean and sigma have not yet been set, returns.
|
---|
94 | //
|
---|
95 | // Renormalizes the pedestal fit results by the following formulae:
|
---|
96 | //
|
---|
97 | // - Mean Pedestal / slice = Mean Pedestal / Number slices
|
---|
98 | // - Mean Pedestal Error / slice = Mean Pedestal Error / Number slices
|
---|
99 | // - Sigma Pedestal / slice = Sigma Pedestal / Sqrt (Number slices)
|
---|
100 | // - Sigma Pedestal Error / slice = Sigma Pedestal Error / Sqrt (Number slices)
|
---|
101 | //
|
---|
102 | void MHPedestalPix::Renorm()
|
---|
103 | {
|
---|
104 |
|
---|
105 | if (fMean == fMeanErr == fSigma == fSigmaErr == 0.)
|
---|
106 | return;
|
---|
107 |
|
---|
108 | //
|
---|
109 | // One never knows...
|
---|
110 | //
|
---|
111 | if (fNSlices <= 0)
|
---|
112 | return;
|
---|
113 |
|
---|
114 | const Float_t sqslices = TMath::Sqrt(fNSlices);
|
---|
115 |
|
---|
116 | SetMean ( GetMean() / fNSlices );
|
---|
117 | //
|
---|
118 | // Mean error goes with PedestalRMS/Sqrt(entries) -> scale with slices
|
---|
119 | //
|
---|
120 | SetMeanErr ( GetMeanErr() / fNSlices );
|
---|
121 | //
|
---|
122 | // Sigma goes like PedestalRMS -> scale with sqrt(slices)
|
---|
123 | //
|
---|
124 | SetSigma ( GetSigma() / sqslices );
|
---|
125 | //
|
---|
126 | // Sigma error goes like PedestalRMS/2.(entries) -> scale with sqrt(slices)
|
---|
127 | //
|
---|
128 | SetSigmaErr ( GetSigmaErr() / sqslices );
|
---|
129 |
|
---|
130 | }
|
---|
131 |
|
---|