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

Last change on this file since 3157 was 3157, checked in by gaug, 21 years ago
*** empty log message ***
File size: 2.9 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() : fPixId(-1)
58{
59
60 SetChargeNbins();
61 SetChargeFirst();
62 SetChargeLast();
63
64 // Create a large number of bins, later we will rebin
65 fHGausHist.SetName("HPedestalCharge");
66 fHGausHist.SetTitle("Distribution of Summed FADC Pedestal Slices Pixel ");
67 fHGausHist.SetXTitle("Sum FADC Slices");
68 fHGausHist.SetYTitle("Nr. of events");
69 fHGausHist.Sumw2();
70
71}
72
73MHPedestalPix::~MHPedestalPix()
74{
75}
76
77
78void MHPedestalPix::InitBins()
79{
80
81 fHGausHist.SetBins(fChargeNbins,fChargeFirst,fChargeLast);
82
83}
84
85
86void MHPedestalPix::ChangeHistId(Int_t id)
87{
88
89 fPixId = id;
90
91 fHGausHist.SetName(Form("%s%d", fHGausHist.GetName(), id));
92 fHGausHist.SetTitle(Form("%s%d", fHGausHist.GetTitle(), id));
93}
94
95
96void MHPedestalPix::Renorm(const Float_t nslices)
97{
98
99 if (!IsGausFitOK())
100 return;
101
102 Float_t sqslices = TMath::Sqrt(nslices);
103
104 SetMean(GetMean()/nslices);
105 //
106 // Mean error goes with PedestalRMS/Sqrt(entries) -> scale with slices
107 //
108 SetMeanErr(GetMeanErr()/nslices);
109 //
110 // Sigma goes like PedestalRMS -> scale with sqrt(slices)
111 //
112 SetSigma(GetSigma()/sqslices);
113 //
114 // Sigma error goes like PedestalRMS/2.(entries) -> scale with slices
115 //
116 SetSigmaErr(GetSigmaErr()/nslices);
117
118}
119
Note: See TracBrowser for help on using the repository browser.