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

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