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

Last change on this file since 3162 was 3162, checked in by gaug, 21 years ago
*** empty log message ***
File size: 3.0 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. Holds the histogrammed pedestals,
30// derives from MHGausEvents, perform Fourier analysis
31//
32//////////////////////////////////////////////////////////////////////////////
33#include "MHPedestalPix.h"
34
35#include <TH1.h>
36#include <TF1.h>
37
38#include <TCanvas.h>
39
40#include "MH.h"
41
42#include "MLog.h"
43#include "MLogManip.h"
44
45ClassImp(MHPedestalPix);
46
47using namespace std;
48//
49const Int_t MHPedestalPix::fgChargeNbins = 450 ;
50const Axis_t MHPedestalPix::fgChargeFirst = -0.5;
51const Axis_t MHPedestalPix::fgChargeLast = 449.5;
52// --------------------------------------------------------------------------
53//
54// Default Constructor.
55//
56MHPedestalPix::MHPedestalPix(const char *name, const char *title)
57 : fPixId(-1)
58{
59
60 fName = name ? name : "MHPedestalPix";
61 fTitle = title ? title : "Histogrammed Pedestal events";
62
63 SetChargeNbins();
64 SetChargeFirst();
65 SetChargeLast();
66
67 // Create a large number of bins, later we will rebin
68 fHGausHist.SetName("HPedestalCharge");
69 fHGausHist.SetTitle("Distribution of Summed FADC Pedestal Slices Pixel ");
70 fHGausHist.SetXTitle("Sum FADC Slices");
71 fHGausHist.SetYTitle("Nr. of events");
72 fHGausHist.Sumw2();
73
74}
75
76MHPedestalPix::~MHPedestalPix()
77{
78}
79
80
81void MHPedestalPix::InitBins()
82{
83
84 fHGausHist.SetBins(fChargeNbins,fChargeFirst,fChargeLast);
85
86}
87
88
89void MHPedestalPix::ChangeHistId(Int_t id)
90{
91
92 fPixId = id;
93
94 fHGausHist.SetName(Form("%s%d", fHGausHist.GetName(), id));
95 fHGausHist.SetTitle(Form("%s%d", fHGausHist.GetTitle(), id));
96}
97
98
99void MHPedestalPix::Renorm(const Float_t nslices)
100{
101
102 if (!IsGausFitOK())
103 return;
104
105 Float_t sqslices = TMath::Sqrt(nslices);
106
107 SetMean(GetMean()/nslices);
108 //
109 // Mean error goes with PedestalRMS/Sqrt(entries) -> scale with slices
110 //
111 SetMeanErr(GetMeanErr()/nslices);
112 //
113 // Sigma goes like PedestalRMS -> scale with sqrt(slices)
114 //
115 SetSigma(GetSigma()/sqslices);
116 //
117 // Sigma error goes like PedestalRMS/2.(entries) -> scale with slices
118 //
119 SetSigmaErr(GetSigmaErr()/nslices);
120
121}
122
Note: See TracBrowser for help on using the repository browser.