source: trunk/Mars/mcalib/MCalibrationBlindCam.cc@ 14636

Last change on this file since 14636 was 7804, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 5.3 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}
65
66void 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// Return true, if any of the blind pixels have an available photon flux
77//
78Bool_t MCalibrationBlindCam::IsFluxInsidePlexiglassAvailable() const
79{
80 for (Int_t i=0; i<GetSize(); i++)
81 {
82 MCalibrationBlindPix &bp = (MCalibrationBlindPix&)(*this)[i];
83 if (bp.IsFluxInsidePlexiglassAvailable())
84 return kTRUE;
85 }
86
87 return kFALSE;
88}
89
90// --------------------------------------------------------------------------
91//
92// Returns weighted average of the flux calculated by each blind pixel
93//
94Float_t MCalibrationBlindCam::GetFluxInsidePlexiglass() const
95{
96
97 Float_t flux = 0.;
98 Float_t fluxvar = 0.;
99
100 for (Int_t i=0; i<GetSize(); i++)
101 {
102 MCalibrationBlindPix &bp = (MCalibrationBlindPix&)(*this)[i];
103 if (bp.IsFluxInsidePlexiglassAvailable())
104 {
105 const Float_t weight = 1./
106 bp.GetFluxInsidePlexiglassErr()
107 / bp.GetFluxInsidePlexiglassErr();
108 flux += weight * bp.GetFluxInsidePlexiglass();
109 fluxvar += weight;
110 }
111 }
112 return fluxvar > 0.0001 ? flux / fluxvar : -1.;
113}
114
115// --------------------------------------------------------------------------
116//
117// Returns weighted variance of the flux calculated by each blind pixel
118//
119Float_t MCalibrationBlindCam::GetFluxInsidePlexiglassVar() const
120{
121
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 fluxvar += weight;
133 }
134 }
135 return fluxvar > 0.0001 ? 1. / fluxvar : -1.;
136}
137
138// --------------------------------------------------------------------------
139//
140// Returns weighted rel. variance of the flux calculated by each blind pixel
141//
142Float_t MCalibrationBlindCam::GetFluxInsidePlexiglassRelVar() const
143{
144
145 Float_t flux = 0.;
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 flux += weight * bp.GetFluxInsidePlexiglass();
157 fluxvar += weight;
158 }
159 }
160
161 return fluxvar > 0.0001 ? flux * fluxvar : -1.;
162}
163
164
165// --------------------------------------------------------------------------
166//
167// Set color to this class and to the MCalibrationBlindPix's
168//
169void MCalibrationBlindCam::SetPulserColor ( const MCalibrationCam::PulserColor_t col )
170{
171
172 fPulserColor = col;
173 fPixels->R__FOR_EACH(MCalibrationBlindPix, SetColor)(col);
174
175}
Note: See TracBrowser for help on using the repository browser.