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

Last change on this file since 3673 was 3644, checked in by gaug, 21 years ago
*** empty log message ***
File size: 7.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!
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// Storage container for the calibrated Quantum Efficiency of the whole camera.
31//
32// Individual pixels have to be cast when retrieved e.g.:
33// MCalibrationQEPix &avpix = (MCalibrationQEPix&)(*fQECam)[i]
34//
35// The following "calibration" constants can be retrieved from each pixel:
36// - GetQE ( const PulserColor_t color ): The mean quantum
37// efficiency obtained with the calibration pulser color (e.g. kGREEN, kBLUE, kUV)
38// - GetQEErr( const PulserColor_t color ): The uncertainty
39// of the mean quantum efficiency.
40//
41// Averaged values over one whole area index (e.g. inner or outer pixels for
42// the MAGIC camera), can be retrieved via:
43// MCalibrationRelTimePix &avpix = (MCalibrationRelTimePix&)fRelCam->GetAverageArea(i)
44//
45// Averaged values over one whole camera sector can be retrieved via:
46// MCalibrationRelTimePix &avpix = (MCalibrationRelTimePix&)fRelCam->GetAverageSector(i)
47//
48// Note the averageing has been done at the end of the calculation and NOT on an
49// event-by-event basis (like in other classes deriving from MCalibrationCam).
50//
51// See also: MHCalibrationChargePix, MHCalibrationChargeCam, MCalibrationChargeCalc
52//
53// The calculated values (types of GetPixelContent) are:
54//
55// 0: Mean Quantum Efficiency of the color: kCT1
56// 1: Error of the Mean Quantum Efficiency of the color: kCT1
57// 2: Mean Quantum Efficiency of the color: kGREEN
58// 3: Error of the Mean Quantum Efficiency of the color: kGreen
59// 4: Mean Quantum Efficiency of the color: kBLUE
60// 5: Error of the Mean Quantum Efficiency of the color: kBlue
61// 6: Mean Quantum Efficiency of the color: kUV
62// 7: Error of the Mean Quantum Efficiency of the color: kUV
63//
64/////////////////////////////////////////////////////////////////////////////
65#include "MCalibrationQECam.h"
66
67#include <TClonesArray.h>
68
69#include "MLog.h"
70#include "MLogManip.h"
71
72#include "MCalibrationQEPix.h"
73
74ClassImp(MCalibrationQECam);
75
76using namespace std;
77
78// --------------------------------------------------------------------------
79//
80// Default constructor.
81//
82// Creates a TClonesArray of MCalibrationQEPix containers, initialized to 1 entry, destinated
83// to hold one container per pixel. Later, a call to MCalibrationQECam::InitSize()
84// has to be performed (in MGeomApply).
85//
86MCalibrationQECam::MCalibrationQECam(const char *name, const char *title)
87{
88 fName = name ? name : "MCalibrationQECam";
89 fTitle = title ? title : "Storage container for the calibrated Quantrum Efficiency of the camera";
90
91 fPixels = new TClonesArray("MCalibrationQEPix",1);
92 fAverageAreas = new TClonesArray("MCalibrationQEPix",1);
93 fAverageSectors = new TClonesArray("MCalibrationQEPix",1);
94
95}
96
97
98// --------------------------------------------------------------------------
99//
100// Print first the well fitted pixels
101// and then the ones which are not FitValid
102//
103void MCalibrationQECam::Print(Option_t *o) const
104{
105
106 *fLog << all << GetDescriptor() << ":" << endl;
107 int id = 0;
108
109 TIter Next(fPixels);
110 MCalibrationQEPix *pix;
111 while ((pix=(MCalibrationQEPix*)Next()))
112 {
113
114 if (!pix->IsExcluded() && pix->IsValid())
115 {
116 *fLog << all << "Pix " << pix->GetPixId()
117 << ": QE: " << pix->GetQE(kCT1) << " +- " << pix->GetQEErr(kCT1)
118 << endl;
119 id++;
120 }
121 }
122
123 *fLog << all << id << " succesful pixels :-))" << endl;
124 id = 0;
125
126 *fLog << all << endl;
127 *fLog << all << "Pixels with errors:" << endl;
128 *fLog << all << endl;
129
130 TIter Next2(fPixels);
131 while ((pix=(MCalibrationQEPix*)Next2()))
132 {
133
134 if (!pix->IsExcluded() && !pix->IsValid())
135 {
136 *fLog << all << "Pix " << pix->GetPixId()
137 << ": QE: " << pix->GetQE(kCT1) << " +- " << pix->GetQEErr(kCT1)
138 << endl;
139 id++;
140 }
141 }
142 *fLog << all << id << " pixels with errors :-((" << endl;
143
144
145 *fLog << all << endl;
146 *fLog << all << "Excluded pixels:" << endl;
147 *fLog << all << endl;
148
149 id = 0;
150
151 TIter Next4(fPixels);
152 while ((pix=(MCalibrationQEPix*)Next4()))
153 {
154 if (pix->IsExcluded())
155 {
156 *fLog << all << pix->GetPixId() << endl;
157 id++;
158 }
159 }
160 *fLog << all << id << " Excluded pixels " << endl;
161}
162
163// --------------------------------------------------------------------
164//
165// The calculated values (types) are:
166//
167// 0: Mean Quantum Efficiency of the color: kCT1
168// 1: Error of the Mean Quantum Efficiency of the color: kCT1
169// 2: Mean Quantum Efficiency of the color: kGREEN
170// 3: Error of the Mean Quantum Efficiency of the color: kGreen
171// 4: Mean Quantum Efficiency of the color: kBLUE
172// 5: Error of the Mean Quantum Efficiency of the color: kBlue
173// 6: Mean Quantum Efficiency of the color: kUV
174// 7: Error of the Mean Quantum Efficiency of the color: kUV
175//
176Bool_t MCalibrationQECam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
177{
178
179 if (idx > GetSize())
180 return kFALSE;
181
182 MCalibrationQEPix &pix = (MCalibrationQEPix&)(*this)[idx];
183
184 if (pix.IsExcluded())
185 return kFALSE;
186
187 switch (type)
188 {
189 case 0:
190 val = pix.GetQE(kCT1);
191 break;
192 case 1:
193 val = pix.GetQEErr(kCT1);
194 break;
195 case 2:
196 val = pix.GetQE(kGREEN);
197 break;
198 case 3:
199 val = pix.GetQEErr(kGREEN);
200 break;
201 case 4:
202 val = pix.GetQE(kBLUE);
203 break;
204 case 5:
205 val = pix.GetQEErr(kBLUE);
206 break;
207 case 6:
208 val = pix.GetQE(kUV);
209 break;
210 case 7:
211 val = pix.GetQEErr(kUV);
212 break;
213 default:
214 return kFALSE;
215 }
216 return val!=-1.;
217}
218
219// --------------------------------------------------------------------------
220//
221// Not yet implemented
222//
223void MCalibrationQECam::DrawPixelContent(Int_t idx) const
224{
225 return;
226}
227
228
229
230
231
232
233
234
235
Note: See TracBrowser for help on using the repository browser.