source: trunk/MagicSoft/Mars/manalysis/MCalibrationPix.cc@ 2535

Last change on this file since 2535 was 2525, checked in by gaug, 22 years ago
*** empty log message ***
File size: 3.6 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 11/2003 <mailto:markus@ifae.es>
19!
20! Copyright: MAGIC Software Development, 2000-2001
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26// //
27// MCalibrationPix //
28// //
29// This is the storage container to hold informations about the pedestal //
30// (offset) value of one Pixel (PMT). //
31// //
32/////////////////////////////////////////////////////////////////////////////
33#include "MCalibrationPix.h"
34
35#include "MLog.h"
36#include "MLogManip.h"
37
38ClassImp(MCalibrationPix);
39
40using namespace std;
41
42static const TString gsDefHTitle = "Calibration Histograms Pixel ";
43// --------------------------------------------------------------------------
44//
45// Default Constructor.
46//
47MCalibrationPix::MCalibrationPix(Int_t pix, const char *name, const char *title)
48 : fPixId(pix)
49{
50
51 fName = name ? name : "MCalibrationPixel";
52 fTitle = title ? title : "Container of the MHCalibrationPixels and the fit results";
53
54 fHist = new MHCalibrationPixel(fPixId,"MHCalibrationPixel",gsDefHTitle.Data()+fPixId);
55
56 fQ = fErrQ = 0.;
57 fPed = fPedRms = 0.;
58 fT = fErrT = 0.;
59 fRQ = fErrRQ = 0.;
60 fSigmaQ = fErrSigmaQ = 0.;
61
62}
63
64MCalibrationPix::~MCalibrationPix()
65{
66 delete fHist;
67}
68
69// ------------------------------------------------------------------------
70//
71// Invalidate values
72//
73void MCalibrationPix::Clear(Option_t *o)
74{
75 fHist->Reset();
76}
77
78Bool_t MCalibrationPix::FitQ()
79{
80
81 if (fHist->IsFitted())
82 return kTRUE;
83
84 if(!fHist->FitQ())
85 {
86 *fLog << warn << "Could not fit charges of pixel " << fPixId << endl;
87 fHist->PrintQFitResult();
88 return kFALSE;
89 }
90
91 fQ = fHist->GetQMean();
92 fErrQ = fHist->GetQMeanErr();
93 fSigmaQ = fHist->GetQSigma();
94 fErrSigmaQ = fHist->GetQSigmaErr();
95
96 if (fPed)
97 fRQ = fQ - fPed;
98 if (fPedRms)
99 fErrRQ = TMath::Sqrt(fErrQ*fErrQ + fPedRms*fPedRms);
100
101
102 return kTRUE;
103
104}
105
106void MCalibrationPix::SetPedestal(Float_t ped, Float_t pedrms)
107{
108
109 fPed = ped;
110 fPedRms = pedrms;
111
112 if ((!fRQ) && fQ)
113 fRQ = fQ - fPed;
114 if ((!fErrRQ) && fErrQ)
115 fErrRQ = TMath::Sqrt(fErrQ*fErrQ + fPedRms*fPedRms);
116
117}
118
119Bool_t MCalibrationPix::FitT()
120{
121
122 if(!fHist->FitT())
123 {
124 *fLog << warn << "Could not fit times of pixel " << fPixId << endl;
125 fHist->PrintTFitResult();
126 return kFALSE;
127 }
128
129 fT = fHist->GetTMean();
130 fErrT = fHist->GetTSigma();
131
132 return kTRUE;
133
134}
135
136void MCalibrationPix::Test()
137{
138 *fLog << "TEST: pixid: " << fPixId << endl;
139}
Note: See TracBrowser for help on using the repository browser.