source: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeBlindCam.cc@ 4619

Last change on this file since 4619 was 4401, checked in by gaug, 20 years ago
*** empty log message ***
File size: 7.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 07/2004 <mailto:markus@ifae.es>
19!
20! Copyright: MAGIC Software Development, 2000-2004
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MCalibrationChargeBlindCam
28//
29// Base class for Blind Pixels Calibration results.
30//
31// Contains TClonesArrays for the following objects:
32// - fBlindPixels: Array of classes derived from MCalibrationChargeBlindPix, one entry
33// per blind pixel.
34//
35// All TClonesArrays have to enlarged by the corresponding calls to (e.g. in MGeomApply):
36// - InitSize()
37//
38/////////////////////////////////////////////////////////////////////////////
39#include "MCalibrationChargeBlindCam.h"
40#include "MCalibrationChargeBlindPix.h"
41
42#include "MCalibrationCam.h"
43#include "MCalibrationPix.h"
44
45#include "MLog.h"
46#include "MLogManip.h"
47
48#include <TClonesArray.h>
49
50ClassImp(MCalibrationChargeBlindCam);
51
52using namespace std;
53// --------------------------------------------------------------------------
54//
55// Default constructor.
56//
57// Set the following pointer to NULL:
58// - fBlindPixels
59//
60// Initializes:
61// - fPulserColor to kNONE
62//
63// Creates a TClonesArray of MCalibrationChargeBlindPix containers for the TClonesArray's:
64// - fBlindPixels
65// all initialized to 1 entry
66//
67// Later, a call to InitSize()
68// has to be performed in order to get the dimension correctly.
69//
70MCalibrationChargeBlindCam::MCalibrationChargeBlindCam(const char *name, const char *title)
71 : fPulserColor(MCalibrationCam::kNONE),
72 fBlindPixels(NULL),
73 fValid(kFALSE)
74{
75 fName = name ? name : "MCalibrationChargeBlindCam";
76 fTitle = title ? title : "Container for the Calibration Information of the blind pixels in the camera";
77
78 fBlindPixels = new TClonesArray("MCalibrationChargeBlindPix",1);
79}
80
81// --------------------------------------------------------------------------
82//
83// Deletes the following TClonesArray's of MCalibrationPix containers (if exist):
84// - fBlindPixels
85//
86MCalibrationChargeBlindCam::~MCalibrationChargeBlindCam()
87{
88
89 //
90 // delete fBlindPixels should delete all Objects stored inside
91 //
92 delete fBlindPixels;
93
94}
95
96// --------------------------------------
97//
98// Calls the ForEach macro for the TClonesArray fBlindPixels with the argument Clear()
99//
100void MCalibrationChargeBlindCam::Clear(Option_t *o)
101{
102
103 fBlindPixels->ForEach(TObject, Clear)();
104
105 return;
106}
107
108// -----------------------------------------------------
109//
110// own copy function to do the initialization correctly
111//
112void MCalibrationChargeBlindCam::Copy(TObject& object) const
113{
114
115 MCalibrationChargeBlindCam &calib = (MCalibrationChargeBlindCam&)object;
116
117 MParContainer::Copy(calib);
118
119 calib.fPulserColor = fPulserColor;
120
121 const Int_t n3 = GetSize();
122 if (n3 != 0)
123 {
124 calib.InitSize(n3);
125 for (int i=0; i<n3; i++)
126 (*this)[i].Copy(calib[i]);
127 }
128
129}
130
131// -------------------------------------------------------------------
132//
133// Calls TClonesArray::ExpandCreate() for fBlindPixels
134//
135void MCalibrationChargeBlindCam::InitSize(const UInt_t i)
136{
137 fBlindPixels->ExpandCreate(i);
138}
139
140
141// --------------------------------------------------------------------------
142//
143// Get i-th blind pixel (pixel number)
144//
145MCalibrationChargeBlindPix &MCalibrationChargeBlindCam::operator[](UInt_t i)
146{
147 return *static_cast<MCalibrationChargeBlindPix*>(fBlindPixels->UncheckedAt(i));
148}
149
150// --------------------------------------------------------------------------
151//
152// Get i-th pixel (pixel number)
153//
154const MCalibrationChargeBlindPix &MCalibrationChargeBlindCam::operator[](UInt_t i) const
155{
156 return *static_cast<MCalibrationChargeBlindPix*>(fBlindPixels->UncheckedAt(i));
157}
158
159// --------------------------------------------------------------------------
160//
161// Returns the current size of the TClonesArray fBlindPixels
162// independently if the MCalibrationChargeBlindPix is filled with values or not.
163//
164const Int_t MCalibrationChargeBlindCam::GetSize() const
165{
166 return fBlindPixels->GetEntriesFast();
167}
168
169// --------------------------------------------------------------------------
170//
171// Print first the results of the pixels
172// and then the ones which are not FitValid
173//
174void MCalibrationChargeBlindCam::Print(Option_t *o) const
175{
176
177 *fLog << all << GetDescriptor() << ":" << endl;
178 int id = 0;
179
180 *fLog << all << "Calibrated Blind pixels:" << endl;
181 *fLog << all << endl;
182
183 TIter Next(fBlindPixels);
184 MCalibrationChargeBlindPix *pix;
185 while ((pix=(MCalibrationChargeBlindPix*)Next()))
186 {
187
188 if (pix->IsSinglePheFitOK())
189 {
190
191 *fLog << all
192 << Form("%s%3i","BlindPixel: ",pix->GetPixId())
193 << Form("%s%4.2f%s%4.2f"," Lambda: ",pix->GetLambda(),"+-",pix->GetLambdaErr())
194 << Form("%s%4.2f%s%4.2f"," Mu0: ",pix->GetMu0(),"+-",pix->GetMu0Err())
195 << Form("%s%4.2f%s%4.2f"," Mu1: ",pix->GetMu1(),"+-",pix->GetMu1Err())
196 << Form("%s%4.2f%s%4.2f"," Sigma0: ",pix->GetSigma0(),"+-",pix->GetSigma0Err())
197 << Form("%s%4.2f%s%4.2f"," Sigma1: ",pix->GetSigma1(),"+-",pix->GetSigma1Err())
198 << endl;
199 *fLog << all
200 << " Pedestal Fit OK? :" << pix->IsPedestalFitOK()
201 << Form("%s%4.2f%s%4.2f"," Lambda (Check): " ,pix->GetLambdaCheck(),"+-",pix->GetLambdaCheckErr()) << endl;
202 *fLog << all
203 << " Flux available? :" << pix->IsFluxInsidePlexiglassAvailable()
204 << Form("%s%4.2f%s%4.2f"," Flux: " ,pix->GetFluxInsidePlexiglass(),"+-",pix->GetFluxInsidePlexiglassErr())
205 << endl;
206 id++;
207 }
208 }
209 *fLog << all << id << " blind pixels OK" << endl;
210 id = 0;
211
212 TIter Next2(fBlindPixels);
213 while ((pix=(MCalibrationChargeBlindPix*)Next2()))
214 {
215
216 if (!pix->IsSinglePheFitOK())
217 {
218
219 *fLog << all
220 << Form("%s%3i","BlindPixel: ",pix->GetPixId())
221 << Form("%s%4.2f%s%4.2f"," Lambda: ",pix->GetLambda(),"+-",pix->GetLambdaErr())
222 << Form("%s%4.2f%s%4.2f"," Mu0: ",pix->GetMu0(),"+-",pix->GetMu0Err())
223 << Form("%s%4.2f%s%4.2f"," Mu1: ",pix->GetMu1(),"+-",pix->GetMu1Err())
224 << Form("%s%4.2f%s%4.2f"," Sigma0: ",pix->GetSigma0(),"+-",pix->GetSigma0Err())
225 << Form("%s%4.2f%s%4.2f"," Sigma1: ",pix->GetSigma1(),"+-",pix->GetSigma1Err())
226 << endl;
227 *fLog << all
228 << " Pedestal Fit OK? :" << pix->IsPedestalFitOK()
229 << Form("%s%4.2f%s%4.2f"," Lambda (Check): " ,pix->GetLambdaCheck(),"+-",pix->GetLambdaCheckErr()) << endl;
230 *fLog << all
231 << " Flux available? :" << pix->IsFluxInsidePlexiglassAvailable()
232 << Form("%s%4.2f%s%4.2f"," Flux: " ,pix->GetFluxInsidePlexiglass(),"+-",pix->GetFluxInsidePlexiglassErr())
233 << endl;
234 id++;
235 }
236 }
237 *fLog << all << id << " blind pixels NOT OK" << endl;
238
239}
Note: See TracBrowser for help on using the repository browser.