source: trunk/MagicSoft/Mars/mpedestal/MPedPhotCam.cc@ 4256

Last change on this file since 4256 was 3803, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 4.9 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): Thomas Bretz, 12/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2003
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MPedPhotCam
28//
29// Hold the Pedestal information for all pixels in the camera (in usints
30// of photons)
31//
32/////////////////////////////////////////////////////////////////////////////
33#include "MPedPhotCam.h"
34#include "MPedPhotPix.h"
35
36#include <TClonesArray.h>
37
38#include "MLog.h"
39#include "MLogManip.h"
40
41#include "MGeomCam.h"
42
43ClassImp(MPedPhotCam);
44
45using namespace std;
46
47// --------------------------------------------------------------------------
48//
49// Default constructor. Creates a MPedPhotPix object for each pixel
50//
51MPedPhotCam::MPedPhotCam(const char *name, const char *title)
52{
53 fName = name ? name : "MPedPhotCam";
54 fTitle = title ? title : "Storage container for all Pedestal Information in the camera (in units of photons)";
55
56 fArray = new TClonesArray("MPedPhotPix", 1);
57
58// for (int i=0; i<577; i++)
59// new ((*fArray)[i]) MPedPhotPix;
60}
61
62// --------------------------------------------------------------------------
63//
64// Delete the array conatining the pixel pedest information
65//
66MPedPhotCam::~MPedPhotCam()
67{
68 delete fArray;
69}
70
71// --------------------------------------------------------------------------
72//
73// Set the size of the camera
74//
75void MPedPhotCam::InitSize(const UInt_t i)
76{
77 fArray->ExpandCreate(i);
78}
79
80// --------------------------------------------------------------------------
81//
82// Get the size of the MPedPhotCam
83//
84Int_t MPedPhotCam::GetSize() const
85{
86 return fArray->GetEntriesFast();
87}
88
89// --------------------------------------------------------------------------
90//
91// Get i-th pixel (pixel number)
92//
93MPedPhotPix &MPedPhotCam::operator[](Int_t i)
94{
95 return *static_cast<MPedPhotPix*>(fArray->UncheckedAt(i));
96}
97
98// --------------------------------------------------------------------------
99//
100// Get i-th pixel (pixel number)
101//
102MPedPhotPix &MPedPhotCam::operator[](Int_t i) const
103{
104 return *static_cast<MPedPhotPix*>(fArray->UncheckedAt(i));
105}
106
107/*
108// --------------------------------------------------------------------------
109//
110// Check if position i is inside bounds
111//
112Bool_t MPedPhotCam::CheckBounds(Int_t i)
113{
114 return i < fArray->GetEntriesFast();
115}
116*/
117void MPedPhotCam::Clear(Option_t *o)
118{
119 fArray->ForEach(TObject, Clear)();
120}
121
122void MPedPhotCam::Print(Option_t *o) const
123{
124 *fLog << all << GetDescriptor() << ":" << endl;
125 int id = 0;
126
127 TIter Next(fArray);
128 MPedPhotPix *pix;
129 while ((pix=(MPedPhotPix*)Next()))
130 {
131 id++;
132
133 if (!pix->IsValid())
134 continue;
135
136 *fLog << id-1 << ": ";
137 *fLog << pix->GetMean() << " " << pix->GetRms() << endl;
138 }
139}
140/*
141Float_t MPedPhotCam::GetPedestalMin(const MGeomCam *geom) const
142{
143 if (fArray->GetEntries() <= 0)
144 return 50.;
145
146 Float_t minval = (*this)[0].GetPedestalRms();
147
148 for (Int_t i=1; i<fArray->GetEntries(); i++)
149 {
150 const MPedPhotPix &pix = (*this)[i];
151
152 Float_t testval = pix.GetPedestalRms();
153
154 if (geom)
155 testval *= geom->GetPixRatio(i);
156
157 if (testval < minval)
158 minval = testval;
159 }
160 return minval;
161}
162
163Float_t MPedPhotCam::GetPedestalMax(const MGeomCam *geom) const
164{
165 if (fArray->GetEntries() <= 0)
166 return 50.;
167
168 Float_t maxval = (*this)[0].GetPedestalRms();
169
170 for (Int_t i=1; i<fArray->GetEntries(); i++)
171 {
172 const MPedPhotPix &pix = (*this)[i];
173
174 Float_t testval = pix.GetPedestalRms();
175
176 if (geom)
177 testval *= geom->GetPixRatio(i);
178
179 if (testval > maxval)
180 maxval = testval;
181 }
182 return maxval;
183}
184*/
185Bool_t MPedPhotCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
186{
187 switch (type)
188 {
189 case 0:
190 val = (*this)[idx].GetMean();
191 break;
192 case 1:
193 val = (*this)[idx].GetRms();
194 break;
195 default:
196 return kFALSE;
197 }
198 return val>=0;
199}
200
201void MPedPhotCam::DrawPixelContent(Int_t num) const
202{
203 *fLog << warn << "MPedPhotCam::DrawPixelContent - not available." << endl;
204}
Note: See TracBrowser for help on using the repository browser.