source: trunk/MagicSoft/Mars/mcalib/MCalibrationQECam.cc@ 3450

Last change on this file since 3450 was 3321, checked in by gaug, 21 years ago
*** empty log message ***
File size: 5.8 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!
19! Author(s): Markus Gaug 02/2004 <mailto:markus@ifae.es>
20!
21! Copyright: MAGIC Software Development, 2000-2004
22!
23!
24\* ======================================================================== */
25
26/////////////////////////////////////////////////////////////////////////////
27//
28// MCalibrationQECam
29//
30// Hold the calibrated QE information of the camera:
31//
32// 1) MCalibrationQECam initializes a TClonesArray whose elements are
33// pointers to MCalibrationQEPix Containers
34//
35/////////////////////////////////////////////////////////////////////////////
36#include "MCalibrationQECam.h"
37
38#include <TClonesArray.h>
39
40#include "MLog.h"
41#include "MLogManip.h"
42
43#include "MCalibrationQEPix.h"
44
45ClassImp(MCalibrationQECam);
46
47using namespace std;
48
49// --------------------------------------------------------------------------
50//
51// Default constructor.
52//
53// Creates a TClonesArray of MCalibrationPix containers, initialized to 1 entry
54// Later, a call to MCalibrationQECam::InitSize(Int_t size) has to be performed
55//
56// Creates an MCalibrationBlindPix container
57//
58MCalibrationQECam::MCalibrationQECam(const char *name, const char *title)
59{
60 fName = name ? name : "MCalibrationQECam";
61 fTitle = title ? title : "Storage container for the calibrated Quantrum Efficiency of the camera";
62
63 fPixels = new TClonesArray("MCalibrationQEPix",1);
64
65 Clear();
66}
67
68// --------------------------------------------------------------------------
69//
70MCalibrationQECam::~MCalibrationQECam()
71{
72
73 //
74 // delete fPixels should delete all Objects stored inside
75 //
76 delete fPixels;
77
78}
79
80// -------------------------------------------------------------------
81//
82void MCalibrationQECam::InitSize(const UInt_t i)
83{
84 fPixels->ExpandCreate(i);
85}
86
87// --------------------------------------------------------------------------
88//
89// This function returns the current size of the TClonesArray
90// independently if the MCalibrationPix is filled with values or not.
91//
92// It is the size of the array fPixels.
93//
94Int_t MCalibrationQECam::GetSize() const
95{
96 return fPixels->GetEntriesFast();
97}
98
99
100// --------------------------------------------------------------------------
101//
102// Get i-th pixel (pixel number)
103//
104MCalibrationQEPix &MCalibrationQECam::operator[](UInt_t i)
105{
106 return *static_cast<MCalibrationQEPix*>(fPixels->UncheckedAt(i));
107}
108
109// --------------------------------------------------------------------------
110//
111// Get i-th pixel (pixel number)
112//
113const MCalibrationQEPix &MCalibrationQECam::operator[](UInt_t i) const
114{
115 return *static_cast<MCalibrationQEPix*>(fPixels->UncheckedAt(i));
116}
117
118
119// --------------------------------------
120//
121void MCalibrationQECam::Clear(Option_t *o)
122{
123
124 fPixels->ForEach(TObject, Clear)();
125
126 return;
127}
128
129
130// --------------------------------------------------------------------------
131//
132// Print first the well fitted pixels
133// and then the ones which are not FitValid
134//
135void MCalibrationQECam::Print(Option_t *o) const
136{
137
138 *fLog << all << GetDescriptor() << ":" << endl;
139 int id = 0;
140
141 TIter Next(fPixels);
142 MCalibrationQEPix *pix;
143 while ((pix=(MCalibrationQEPix*)Next()))
144 {
145
146 if (!pix->IsExcluded() && pix->IsQEValid())
147 {
148 *fLog << all << "Pix " << pix->GetPixId()
149 << ": QE: " << pix->GetQE(kCT1) << " +- " << pix->GetQEErr(kCT1)
150 << endl;
151 id++;
152 }
153 }
154
155 *fLog << all << id << " succesful pixels :-))" << endl;
156 id = 0;
157
158 *fLog << all << endl;
159 *fLog << all << "Pixels with errors:" << endl;
160 *fLog << all << endl;
161
162 TIter Next2(fPixels);
163 while ((pix=(MCalibrationQEPix*)Next2()))
164 {
165
166 if (!pix->IsExcluded() && !pix->IsQEValid())
167 {
168 *fLog << all << "Pix " << pix->GetPixId()
169 << ": QE: " << pix->GetQE(kCT1) << " +- " << pix->GetQEErr(kCT1)
170 << endl;
171 id++;
172 }
173 }
174 *fLog << all << id << " pixels with errors :-((" << endl;
175
176
177 *fLog << all << endl;
178 *fLog << all << "Excluded pixels:" << endl;
179 *fLog << all << endl;
180
181 id = 0;
182
183 TIter Next4(fPixels);
184 while ((pix=(MCalibrationQEPix*)Next4()))
185 {
186 if (pix->IsExcluded())
187 {
188 *fLog << all << pix->GetPixId() << endl;
189 id++;
190 }
191 }
192 *fLog << all << id << " Excluded pixels " << endl;
193}
194
195//
196Bool_t MCalibrationQECam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
197{
198
199 if (idx > GetSize())
200 return kFALSE;
201
202 switch (type)
203 {
204 case 0:
205 if ((*this)[idx].IsExcluded())
206 return kFALSE;
207 val = (*this)[idx].GetQE(kCT1);
208 break;
209 case 1:
210 if ((*this)[idx].IsExcluded())
211 return kFALSE;
212 val = (*this)[idx].GetQEErr(kCT1);
213 break;
214 default:
215 return kFALSE;
216 }
217 return val!=-1.;
218}
219
220// --------------------------------------------------------------------------
221//
222// What MHCamera needs in order to draw an individual pixel in the camera
223//
224void MCalibrationQECam::DrawPixelContent(Int_t idx) const
225{
226 return;
227}
228
229
230
231
232
233
234
235
236
Note: See TracBrowser for help on using the repository browser.