source: trunk/MagicSoft/Mars/msignal/MExtractedSignalCam.cc@ 5035

Last change on this file since 5035 was 3720, checked in by gaug, 20 years ago
*** empty log message ***
File size: 4.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 12/2003 <mailto:markus@ifae.es>
19! Author(s): Thomas Bretz 12/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
20!
21! Copyright: MAGIC Software Development, 2000-2004
22!
23!
24\* ======================================================================== */
25
26/////////////////////////////////////////////////////////////////////////////
27//
28// MExtractedSignalCam
29//
30// Hold the Extracted Signal information for all pixels in the camera
31//
32/////////////////////////////////////////////////////////////////////////////
33#include "MExtractedSignalCam.h"
34
35#include <TClonesArray.h>
36
37#include "MLog.h"
38#include "MLogManip.h"
39
40#include "MExtractedSignalPix.h"
41
42ClassImp(MExtractedSignalCam);
43
44using namespace std;
45
46// --------------------------------------------------------------------------
47//
48// Default constructor. Creates a MExtractedSignalPix object for each pixel
49//
50MExtractedSignalCam::MExtractedSignalCam(const char *name, const char *title)
51 : fFirstUsedSliceHiGain(0), fFirstUsedSliceLoGain(0),
52 fLastUsedSliceHiGain(0), fLastUsedSliceLoGain(0),
53 fUsedWindowHiGain(0.), fUsedWindowLoGain(0.)
54{
55 fName = name ? name : "MExtractedSignalCam";
56 fTitle = title ? title : "Storage container for all Extracted Signal Information in the camera";
57
58 fArray = new TClonesArray("MExtractedSignalPix", 1);
59}
60
61// --------------------------------------------------------------------------
62//
63// Delete the array conatining the pixel pedest information
64//
65MExtractedSignalCam::~MExtractedSignalCam()
66{
67 delete fArray;
68}
69
70// --------------------------------------------------------------------------
71//
72// Distribute logging stream to all childs
73//
74void MExtractedSignalCam::SetLogStream(MLog *lg)
75{
76 fArray->ForEach(MParContainer, SetLogStream)(lg);
77 MParContainer::SetLogStream(lg);
78}
79
80// --------------------------------------------------------------------------
81//
82// Set the size of the camera
83//
84void MExtractedSignalCam::InitSize(const UInt_t i)
85{
86 fArray->ExpandCreate(i);
87}
88
89// --------------------------------------------------------------------------
90//
91// Get the size of the MExtractedSignalCam
92//
93Int_t MExtractedSignalCam::GetSize() const
94{
95 return fArray->GetEntriesFast();
96}
97
98// --------------------------------------------------------------------------
99//
100// Get i-th pixel (pixel index)
101//
102MExtractedSignalPix &MExtractedSignalCam::operator[](Int_t i)
103{
104 return *static_cast<MExtractedSignalPix*>(fArray->UncheckedAt(i));
105}
106
107// --------------------------------------------------------------------------
108//
109// Get i-th pixel (pixel index)
110//
111const MExtractedSignalPix &MExtractedSignalCam::operator[](Int_t i) const
112{
113 return *static_cast<MExtractedSignalPix*>(fArray->UncheckedAt(i));
114}
115
116void MExtractedSignalCam::Clear(Option_t *o)
117{
118 fArray->ForEach(TObject, Clear)();
119}
120
121void MExtractedSignalCam::Print(Option_t *o) const
122{
123 *fLog << all << GetDescriptor() << ":" << endl;
124 int idx = -1;
125
126 TIter Next(fArray);
127 MExtractedSignalPix *pix;
128 while ((pix=(MExtractedSignalPix*)Next()))
129 {
130 idx++;
131
132 if (!pix->IsValid())
133 continue;
134
135 *fLog << idx << ": ";
136 pix->Print();
137 }
138}
139
140Bool_t MExtractedSignalCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
141{
142 switch (type)
143 {
144 case 0:
145 val = (*this)[idx].GetExtractedSignalHiGain();
146 break;
147 case 1:
148 val = (*this)[idx].GetExtractedSignalHiGainError();
149 break;
150 case 2:
151 val = (*this)[idx].GetExtractedSignalLoGain();
152 break;
153 case 3:
154 val = (*this)[idx].GetExtractedSignalLoGainError();
155 break;
156 default:
157 return kFALSE;
158 }
159 return val>=0;
160}
161
162void MExtractedSignalCam::DrawPixelContent(Int_t num) const
163{
164 *fLog << warn << "MExtractedSignaCam::DrawPixelContent - not available." << endl;
165}
Note: See TracBrowser for help on using the repository browser.