source: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsIntensityCam.cc@ 4983

Last change on this file since 4983 was 4957, checked in by gaug, 20 years ago
*** empty log message ***
File size: 6.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 11/2003 <mailto:markus@ifae.es>
19!
20! Copyright: MAGIC Software Development, 2000-2004
21!
22!
23\* ======================================================================== */
24/////////////////////////////////////////////////////////////////////////////
25//
26// MBadPixelsIntensityCam
27//
28// Base class for intensity calibration results
29//
30// Contains TClonesArrays for the following objects:
31// - fCams: Array of classes derived from MBadPixelsCam, one entry
32// per calibration camera result. Has to be created
33//
34// See also: MCalibrationIntensityChargeCam, MCalibrationIntensityQECam,
35// MCalibrationIntensityRelTimeCam,
36// MCalibrationCam, MCalibrationPix,
37// MCalibrationQECam, MCalibrationQEPix,
38// MHCalibrationChargePix, MHCalibrationChargeCam
39// MCalibrationChargeBlindPix, MCalibrationChargePINDiode
40//
41//
42/////////////////////////////////////////////////////////////////////////////
43#include "MBadPixelsIntensityCam.h"
44
45#include <TClonesArray.h>
46
47#include "MGeomCam.h"
48
49ClassImp(MBadPixelsIntensityCam);
50
51using namespace std;
52// --------------------------------------------------------------------------
53//
54// Default constructor.
55//
56// Set the following pointer to NULL:
57// - fCams
58//
59MBadPixelsIntensityCam::MBadPixelsIntensityCam(const char *name, const char *title)
60 : fCams(NULL)
61{
62
63 fName = name ? name : "MBadPixelsIntensityCam";
64 fTitle = title ? title : "Base container for the Intensity Calibration";
65
66}
67
68// --------------------------------------------------------------------------
69//
70// Deletes the histograms if they exist
71//
72MBadPixelsIntensityCam::~MBadPixelsIntensityCam()
73{
74 if (fCams)
75 delete fCams;
76}
77
78// --------------------------------------------------------------------------
79//
80// Add a new MBadPixelsCam to fCams, give it the name "name" and initialize
81// it with geom.
82//
83void MBadPixelsIntensityCam::AddToList( const char* name, const MGeomCam &geom)
84{
85
86 fCams->ExpandCreate(GetSize()+1);
87
88 GetCam()->SetName(name);
89 GetCam()->Init(geom);
90}
91
92
93
94// --------------------------------------------------------------------------
95//
96// Copy 'constructor'
97//
98void MBadPixelsIntensityCam::Copy(TObject& object) const
99{
100
101 MBadPixelsIntensityCam &calib = (MBadPixelsIntensityCam&)object;
102
103 MParContainer::Copy(calib);
104
105 const UInt_t n = GetSize();
106 if (n != 0)
107 {
108 calib.InitSize(n);
109 for (UInt_t i=0; i<n; i++)
110 GetCam(i)->Copy(*(calib.GetCam(i)));
111 }
112
113}
114
115// -----------------------------------------------------
116//
117// Calls Clear() for all entries fCams
118//
119void MBadPixelsIntensityCam::Clear(Option_t *o)
120{
121
122 fCams->ForEach(MBadPixelsCam, Clear)();
123
124 return;
125}
126
127// -----------------------------------------------------
128//
129// Calls Print(o) for all entries fCams
130//
131void MBadPixelsIntensityCam::Print(Option_t *o) const
132{
133 fCams->ForEach(MBadPixelsCam, Print)(o);
134}
135
136
137// -------------------------------------------------------------------
138//
139// Calls TClonesArray::ExpandCreate() for fCams
140//
141void MBadPixelsIntensityCam::InitSize(const UInt_t n)
142{
143 fCams->ExpandCreate(n);
144}
145
146// -------------------------------------------------------------------
147//
148// If size is still 0, Intialize a first Cam.
149// Calls Init(geom) for all fCams
150//
151void MBadPixelsIntensityCam::Init(const MGeomCam &geom)
152{
153 if (GetSize() == 0)
154 InitSize(1);
155 fCams->ForEach(MBadPixelsCam,Init)(geom);
156}
157
158
159// --------------------------------------------------------------------------
160//
161// Returns the current size of the TClonesArray fCams
162// independently if the MBadPixelsCam is filled with values or not.
163//
164Int_t MBadPixelsIntensityCam::GetSize() const
165{
166 return fCams->GetEntriesFast();
167}
168
169// --------------------------------------------------------------------------
170//
171// Get i-th pixel from current camera
172//
173MBadPixelsPix &MBadPixelsIntensityCam::operator[](Int_t i)
174{
175 return (*GetCam(GetSize()-1))[i];
176}
177
178// --------------------------------------------------------------------------
179//
180// Get i-th pixel from current camera
181//
182const MBadPixelsPix &MBadPixelsIntensityCam::operator[](Int_t i) const
183{
184 return (*GetCam(GetSize()-1))[i];
185}
186
187
188// --------------------------------------------------------------------------
189//
190// Get i-th camera
191//
192MBadPixelsCam *MBadPixelsIntensityCam::GetCam(Int_t i)
193{
194 return static_cast<MBadPixelsCam*>(fCams->UncheckedAt(i==-1 ? GetSize()-1 : i));
195}
196
197// --------------------------------------------------------------------------
198//
199// Get i-th camera
200//
201const MBadPixelsCam *MBadPixelsIntensityCam::GetCam(Int_t i) const
202{
203 return static_cast<MBadPixelsCam*>(fCams->UncheckedAt(i==-1 ? GetSize()-1 : i));
204}
205
206// --------------------------------------------------------------------------
207//
208// Get camera with name 'name'
209//
210MBadPixelsCam *MBadPixelsIntensityCam::GetCam(const char *name )
211{
212 return static_cast<MBadPixelsCam*>(fCams->FindObject(name));
213}
214
215// --------------------------------------------------------------------------
216//
217// Get camera with name 'name'
218//
219const MBadPixelsCam *MBadPixelsIntensityCam::GetCam(const char *name ) const
220{
221 return static_cast<MBadPixelsCam*>(fCams->FindObject(name));
222}
223
224// --------------------------------------------------------------------------
225//
226// Calls GetPixelContent for the current entry in fCams
227//
228Bool_t MBadPixelsIntensityCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
229{
230 return GetCam()->GetPixelContent(val,idx,cam,type);
231}
232
233// --------------------------------------------------------------------------
234//
235// Calls DrawPixelContent for the current entry in fCams
236//
237void MBadPixelsIntensityCam::DrawPixelContent( Int_t num ) const
238{
239 return GetCam()->DrawPixelContent(num);
240}
241
Note: See TracBrowser for help on using the repository browser.