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 | // MCalibrationBlindCam
|
---|
28 | //
|
---|
29 | // Base class for Blind Pixels Calibration results. Derived classes intialize
|
---|
30 | // the actual values of the MCalibrationBlindPix's.
|
---|
31 | //
|
---|
32 | // Contains TOrdCollections for the following objects:
|
---|
33 | // - fPixels: Array of classes derived from MCalibrationBlindPix, one entry
|
---|
34 | // per blind pixel.
|
---|
35 | //
|
---|
36 | // All TOrdCollections have to enlarged by the corresponding calls to (e.g. in MGeomApply):
|
---|
37 | // - InitSize()
|
---|
38 | //
|
---|
39 | // See also: MCalibrationBlindCamOneOldStyle, MCalibrationBlindCamTwoNewStyle
|
---|
40 | //
|
---|
41 | /////////////////////////////////////////////////////////////////////////////
|
---|
42 | #include "MCalibrationBlindCam.h"
|
---|
43 | #include "MCalibrationBlindPix.h"
|
---|
44 |
|
---|
45 | #include <TOrdCollection.h>
|
---|
46 |
|
---|
47 | #include "MLogManip.h"
|
---|
48 |
|
---|
49 | ClassImp(MCalibrationBlindCam);
|
---|
50 |
|
---|
51 | using namespace std;
|
---|
52 | // --------------------------------------------------------------------------
|
---|
53 | //
|
---|
54 | // Default constructor.
|
---|
55 | //
|
---|
56 | MCalibrationBlindCam::MCalibrationBlindCam(Int_t nblind,const char *name, const char *title)
|
---|
57 | {
|
---|
58 |
|
---|
59 | fName = name ? name : "MCalibrationBlindCam";
|
---|
60 | fTitle = title ? title : "Calibration Information of blinded pixels in camera";
|
---|
61 |
|
---|
62 | InitSize(nblind);
|
---|
63 |
|
---|
64 | }
|
---|
65 |
|
---|
66 | void MCalibrationBlindCam::Add(const UInt_t a, const UInt_t b)
|
---|
67 | {
|
---|
68 |
|
---|
69 | for (UInt_t i=a; i<b; i++)
|
---|
70 | fPixels->AddAt(new MCalibrationBlindPix,i);
|
---|
71 |
|
---|
72 | }
|
---|
73 |
|
---|
74 | // --------------------------------------------------------------------------
|
---|
75 | //
|
---|
76 | // Copy 'constructor'
|
---|
77 | //
|
---|
78 | void MCalibrationBlindCam::Copy(TObject& object) const
|
---|
79 | {
|
---|
80 |
|
---|
81 | MCalibrationBlindCam &calib = (MCalibrationBlindCam&)object;
|
---|
82 |
|
---|
83 | MCalibrationCam::Copy(calib);
|
---|
84 |
|
---|
85 | /*
|
---|
86 | const UInt_t n = GetSize();
|
---|
87 | if (n != 0)
|
---|
88 | {
|
---|
89 | calib.InitSize(n);
|
---|
90 | for (UInt_t i=0; i<n; i++)
|
---|
91 | (*this)[i].Copy(calib[i]);
|
---|
92 | }
|
---|
93 | */
|
---|
94 | }
|
---|
95 |
|
---|
96 |
|
---|
97 |
|
---|
98 | // --------------------------------------------------------------------------
|
---|
99 | //
|
---|
100 | // Return true, if any of the blind pixels have an available photon flux
|
---|
101 | //
|
---|
102 | Bool_t MCalibrationBlindCam::IsFluxInsidePlexiglassAvailable() const
|
---|
103 | {
|
---|
104 | for (Int_t i=0; i<GetSize(); i++)
|
---|
105 | {
|
---|
106 | MCalibrationBlindPix &bp = (MCalibrationBlindPix&)(*this)[i];
|
---|
107 | if (bp.IsFluxInsidePlexiglassAvailable())
|
---|
108 | return kTRUE;
|
---|
109 | }
|
---|
110 |
|
---|
111 | return kFALSE;
|
---|
112 | }
|
---|
113 |
|
---|
114 | // --------------------------------------------------------------------------
|
---|
115 | //
|
---|
116 | // Returns weighted average of the flux calculated by each blind pixel
|
---|
117 | //
|
---|
118 | Float_t MCalibrationBlindCam::GetFluxInsidePlexiglass() const
|
---|
119 | {
|
---|
120 |
|
---|
121 | Float_t flux = 0.;
|
---|
122 | Float_t fluxvar = 0.;
|
---|
123 |
|
---|
124 | for (Int_t i=0; i<GetSize(); i++)
|
---|
125 | {
|
---|
126 | MCalibrationBlindPix &bp = (MCalibrationBlindPix&)(*this)[i];
|
---|
127 | if (bp.IsFluxInsidePlexiglassAvailable())
|
---|
128 | {
|
---|
129 | const Float_t weight = 1./
|
---|
130 | bp.GetFluxInsidePlexiglassErr()
|
---|
131 | / bp.GetFluxInsidePlexiglassErr();
|
---|
132 | flux += weight * bp.GetFluxInsidePlexiglass();
|
---|
133 | fluxvar += weight;
|
---|
134 | }
|
---|
135 | }
|
---|
136 | return fluxvar > 0.0001 ? flux / fluxvar : -1.;
|
---|
137 | }
|
---|
138 |
|
---|
139 | // --------------------------------------------------------------------------
|
---|
140 | //
|
---|
141 | // Returns weighted variance of the flux calculated by each blind pixel
|
---|
142 | //
|
---|
143 | Float_t MCalibrationBlindCam::GetFluxInsidePlexiglassVar() const
|
---|
144 | {
|
---|
145 |
|
---|
146 | Float_t fluxvar = 0.;
|
---|
147 |
|
---|
148 | for (Int_t i=0; i<GetSize(); i++)
|
---|
149 | {
|
---|
150 | MCalibrationBlindPix &bp = (MCalibrationBlindPix&)(*this)[i];
|
---|
151 | if (bp.IsFluxInsidePlexiglassAvailable())
|
---|
152 | {
|
---|
153 | const Float_t weight = 1./
|
---|
154 | bp.GetFluxInsidePlexiglassErr()
|
---|
155 | / bp.GetFluxInsidePlexiglassErr();
|
---|
156 | fluxvar += weight;
|
---|
157 | }
|
---|
158 | }
|
---|
159 | return fluxvar > 0.0001 ? 1. / fluxvar : -1.;
|
---|
160 | }
|
---|
161 |
|
---|
162 | // --------------------------------------------------------------------------
|
---|
163 | //
|
---|
164 | // Returns weighted rel. variance of the flux calculated by each blind pixel
|
---|
165 | //
|
---|
166 | Float_t MCalibrationBlindCam::GetFluxInsidePlexiglassRelVar() const
|
---|
167 | {
|
---|
168 |
|
---|
169 | Float_t flux = 0.;
|
---|
170 | Float_t fluxvar = 0.;
|
---|
171 |
|
---|
172 | for (Int_t i=0; i<GetSize(); i++)
|
---|
173 | {
|
---|
174 | MCalibrationBlindPix &bp = (MCalibrationBlindPix&)(*this)[i];
|
---|
175 | if (bp.IsFluxInsidePlexiglassAvailable())
|
---|
176 | {
|
---|
177 | const Float_t weight = 1./
|
---|
178 | bp.GetFluxInsidePlexiglassErr()
|
---|
179 | / bp.GetFluxInsidePlexiglassErr();
|
---|
180 | flux += weight * bp.GetFluxInsidePlexiglass();
|
---|
181 | fluxvar += weight;
|
---|
182 | }
|
---|
183 | }
|
---|
184 |
|
---|
185 | return fluxvar > 0.0001 ? flux * fluxvar : -1.;
|
---|
186 | }
|
---|
187 |
|
---|
188 |
|
---|
189 | // --------------------------------------------------------------------------
|
---|
190 | //
|
---|
191 | // Set color to this class and to the MCalibrationBlindPix's
|
---|
192 | //
|
---|
193 | void MCalibrationBlindCam::SetPulserColor ( const MCalibrationCam::PulserColor_t col )
|
---|
194 | {
|
---|
195 |
|
---|
196 | fPulserColor = col;
|
---|
197 | fPixels->ForEach(MCalibrationBlindPix, SetColor)(col);
|
---|
198 |
|
---|
199 | }
|
---|