source: trunk/MagicSoft/Mars/mcalib/MCalibrationBlindCam.cc@ 5074

Last change on this file since 5074 was 5043, checked in by gaug, 20 years ago
*** empty log message ***
File size: 5.5 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// 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
49ClassImp(MCalibrationBlindCam);
50
51using namespace std;
52// --------------------------------------------------------------------------
53//
54// Default constructor.
55//
56MCalibrationBlindCam::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
65void MCalibrationBlindCam::Add(const UInt_t a, const UInt_t b)
66{
67 for (UInt_t i=a; i<b; i++)
68 fPixels->AddAt(new MCalibrationBlindPix,i);
69}
70
71// --------------------------------------------------------------------------
72//
73// Copy 'constructor'
74//
75void MCalibrationBlindCam::Copy(TObject& object) const
76{
77
78 MCalibrationBlindCam &calib = (MCalibrationBlindCam&)object;
79
80 MCalibrationCam::Copy(calib);
81
82 /*
83 const UInt_t n = GetSize();
84 if (n != 0)
85 {
86 calib.InitSize(n);
87 for (UInt_t i=0; i<n; i++)
88 (*this)[i].Copy(calib[i]);
89 }
90 */
91}
92
93
94
95// --------------------------------------------------------------------------
96//
97// Return true, if any of the blind pixels have an available photon flux
98//
99Bool_t MCalibrationBlindCam::IsFluxInsidePlexiglassAvailable() const
100{
101 for (Int_t i=0; i<GetSize(); i++)
102 {
103 MCalibrationBlindPix &bp = (MCalibrationBlindPix&)(*this)[i];
104 if (bp.IsFluxInsidePlexiglassAvailable())
105 return kTRUE;
106 }
107
108 return kFALSE;
109}
110
111// --------------------------------------------------------------------------
112//
113// Returns weighted average of the flux calculated by each blind pixel
114//
115Float_t MCalibrationBlindCam::GetFluxInsidePlexiglass() const
116{
117
118 Float_t flux = 0.;
119 Float_t fluxvar = 0.;
120
121 for (Int_t i=0; i<GetSize(); i++)
122 {
123 MCalibrationBlindPix &bp = (MCalibrationBlindPix&)(*this)[i];
124 if (bp.IsFluxInsidePlexiglassAvailable())
125 {
126 const Float_t weight = 1./
127 bp.GetFluxInsidePlexiglassErr()
128 / bp.GetFluxInsidePlexiglassErr();
129 flux += weight * bp.GetFluxInsidePlexiglass();
130 fluxvar += weight;
131 }
132 }
133 return fluxvar > 0.0001 ? flux / fluxvar : -1.;
134}
135
136// --------------------------------------------------------------------------
137//
138// Returns weighted variance of the flux calculated by each blind pixel
139//
140Float_t MCalibrationBlindCam::GetFluxInsidePlexiglassVar() const
141{
142
143 Float_t fluxvar = 0.;
144
145 for (Int_t i=0; i<GetSize(); i++)
146 {
147 MCalibrationBlindPix &bp = (MCalibrationBlindPix&)(*this)[i];
148 if (bp.IsFluxInsidePlexiglassAvailable())
149 {
150 const Float_t weight = 1./
151 bp.GetFluxInsidePlexiglassErr()
152 / bp.GetFluxInsidePlexiglassErr();
153 fluxvar += weight;
154 }
155 }
156 return fluxvar > 0.0001 ? 1. / fluxvar : -1.;
157}
158
159// --------------------------------------------------------------------------
160//
161// Returns weighted rel. variance of the flux calculated by each blind pixel
162//
163Float_t MCalibrationBlindCam::GetFluxInsidePlexiglassRelVar() const
164{
165
166 Float_t flux = 0.;
167 Float_t fluxvar = 0.;
168
169 for (Int_t i=0; i<GetSize(); i++)
170 {
171 MCalibrationBlindPix &bp = (MCalibrationBlindPix&)(*this)[i];
172 if (bp.IsFluxInsidePlexiglassAvailable())
173 {
174 const Float_t weight = 1./
175 bp.GetFluxInsidePlexiglassErr()
176 / bp.GetFluxInsidePlexiglassErr();
177 flux += weight * bp.GetFluxInsidePlexiglass();
178 fluxvar += weight;
179 }
180 }
181
182 return fluxvar > 0.0001 ? flux * fluxvar : -1.;
183}
184
185
Note: See TracBrowser for help on using the repository browser.