source: trunk/MagicSoft/Mars/manalysis/MExtractedSignalCam.cc@ 3094

Last change on this file since 3094 was 2914, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 4.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 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{
52 fName = name ? name : "MExtractedSignalCam";
53 fTitle = title ? title : "Storage container for all Extracted Signal Information in the camera";
54
55 fArray = new TClonesArray("MExtractedSignalPix", 1);
56}
57
58// --------------------------------------------------------------------------
59//
60// Delete the array conatining the pixel pedest information
61//
62MExtractedSignalCam::~MExtractedSignalCam()
63{
64 delete fArray;
65}
66
67// --------------------------------------------------------------------------
68//
69// Distribute logging stream to all childs
70//
71void MExtractedSignalCam::SetLogStream(MLog *lg)
72{
73 fArray->ForEach(MParContainer, SetLogStream)(lg);
74 MParContainer::SetLogStream(lg);
75}
76
77// --------------------------------------------------------------------------
78//
79// Set the size of the camera
80//
81void MExtractedSignalCam::InitSize(const UInt_t i)
82{
83 fArray->ExpandCreate(i);
84}
85
86// --------------------------------------------------------------------------
87//
88// Get the size of the MExtractedSignalCam
89//
90Int_t MExtractedSignalCam::GetSize() const
91{
92 return fArray->GetEntriesFast();
93}
94
95// --------------------------------------------------------------------------
96//
97// Get i-th pixel (pixel index)
98//
99MExtractedSignalPix &MExtractedSignalCam::operator[](Int_t i)
100{
101 return *static_cast<MExtractedSignalPix*>(fArray->UncheckedAt(i));
102}
103
104// --------------------------------------------------------------------------
105//
106// Get i-th pixel (pixel index)
107//
108const MExtractedSignalPix &MExtractedSignalCam::operator[](Int_t i) const
109{
110 return *static_cast<MExtractedSignalPix*>(fArray->UncheckedAt(i));
111}
112
113void MExtractedSignalCam::Clear(Option_t *o)
114{
115 fArray->ForEach(TObject, Clear)();
116}
117
118void MExtractedSignalCam::Print(Option_t *o) const
119{
120 *fLog << all << GetDescriptor() << ":" << endl;
121 int idx = -1;
122
123 TIter Next(fArray);
124 MExtractedSignalPix *pix;
125 while ((pix=(MExtractedSignalPix*)Next()))
126 {
127 idx++;
128
129 if (!pix->IsValid())
130 continue;
131
132 *fLog << idx << ": ";
133 pix->Print();
134 }
135}
136
137Bool_t MExtractedSignalCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
138{
139 switch (type)
140 {
141 case 0:
142 val = (*this)[idx].GetExtractedSignalHiGain();
143 break;
144 case 1:
145 val = (*this)[idx].GetExtractedSignalHiGainError();
146 break;
147 case 2:
148 val = (*this)[idx].GetExtractedSignalLoGain();
149 break;
150 case 3:
151 val = (*this)[idx].GetExtractedSignalLoGainError();
152 break;
153 default:
154 return kFALSE;
155 }
156 return val>=0;
157}
158
159void MExtractedSignalCam::DrawPixelContent(Int_t num) const
160{
161 *fLog << warn << "MExtractedSignaCam::DrawPixelContent - not available." << endl;
162}
Note: See TracBrowser for help on using the repository browser.