source: trunk/MagicSoft/Mars/manalysis/MHPedestalPix.cc@ 5207

Last change on this file since 5207 was 4905, checked in by gaug, 20 years ago
*** empty log message ***
File size: 4.3 KB
Line 
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 MHCalibrationPix, fits the pedestals to a Gaussian and performs
39// a Fourier analysis.
40//
41//////////////////////////////////////////////////////////////////////////////
42#include "MHPedestalPix.h"
43
44#include "MLog.h"
45#include "MLogManip.h"
46
47#include <TH1.h>
48
49ClassImp(MHPedestalPix);
50
51using namespace std;
52//
53const Int_t MHPedestalPix::fgChargeNbins = 500;
54const Axis_t MHPedestalPix::fgChargeFirst = -49.5;
55const Axis_t MHPedestalPix::fgChargeLast = 449.5;
56// --------------------------------------------------------------------------
57//
58// Default Constructor.
59//
60// Sets:
61// - the default number for fNbins (fgChargeNbins)
62// - the default number for fFirst (fgChargeFirst)
63// - the default number for fLast (fgChargeLast)
64//
65// - the default name of the fHGausHist ("HPedestalCharge")
66// - the default title of the fHGausHist ("Distribution of Summed FADC Pedestal slices Pixel ")
67// - the default x-axis title for fHGausHist ("Sum FADC Slices")
68// - the default y-axis title for fHGausHist ("Nr. of events")
69// - TH1::Sumw2() for fHGausHist
70//
71// Initializes:
72// - fNSlices to 1
73// - fProbLimit to 0.01
74//
75MHPedestalPix::MHPedestalPix(const char *name, const char *title)
76 : fNSlices(1.)
77{
78
79 fName = name ? name : "MHPedestalPix";
80 fTitle = title ? title : "Histogrammed Pedestal events";
81
82 SetNbins( fgChargeNbins );
83 SetFirst( fgChargeFirst );
84 SetLast( fgChargeLast );
85
86 SetProbLimit(0.01);
87
88 // Create a large number of bins, later we will rebin
89 fHGausHist.SetName("HPedestalCharge");
90 fHGausHist.SetTitle("Distribution of Summed FADC Pedestal Slices Pixel ");
91 fHGausHist.SetXTitle("Sum FADC Slices");
92 fHGausHist.SetYTitle("Nr. of events");
93 fHGausHist.Sumw2();
94
95}
96
97// --------------------------------------------------------------------------
98//
99// If mean and sigma have not yet been set, returns.
100//
101// Renormalizes the pedestal fit results by the following formulae:
102//
103// - Mean Pedestal / slice = Mean Pedestal / Number slices
104// - Mean Pedestal Error / slice = Mean Pedestal Error / Number slices
105// - Sigma Pedestal / slice = Sigma Pedestal / Sqrt (Number slices)
106// - Sigma Pedestal Error / slice = Sigma Pedestal Error / Sqrt (Number slices)
107//
108void MHPedestalPix::Renorm()
109{
110
111 //
112 // One never knows...
113 //
114 if (fNSlices <= 0)
115 return;
116
117 const Float_t sqslices = TMath::Sqrt(fNSlices);
118
119 SetMean ( GetMean() / fNSlices );
120 //
121 // Mean error goes with PedestalRMS/Sqrt(entries) -> scale with slices
122 //
123 SetMeanErr ( GetMeanErr() / fNSlices );
124 //
125 // Sigma goes like PedestalRMS -> scale with sqrt(slices)
126 //
127 SetSigma ( GetSigma() / sqslices );
128 //
129 // Sigma error goes like PedestalRMS/2.(entries) -> scale with sqrt(slices)
130 //
131 SetSigmaErr ( GetSigmaErr() / sqslices );
132
133}
134
Note: See TracBrowser for help on using the repository browser.