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

Last change on this file since 7804 was 7804, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 4.7 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.), fNdf(-1)
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->R__FOR_EACH(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
116Float_t MExtractedSignalCam::GetProb( const Int_t pixidx ) const
117{
118 if (pixidx > GetSize()-1)
119 return -1.;
120
121 return TMath::Prob((*this)[pixidx].GetChisquare(),fNdf);
122}
123
124void MExtractedSignalCam::Clear(Option_t *o)
125{
126 fArray->R__FOR_EACH(TObject, Clear)();
127}
128
129void MExtractedSignalCam::Print(Option_t *o) const
130{
131 *fLog << all << GetDescriptor() << ":" << endl;
132 int idx = -1;
133
134 TIter Next(fArray);
135 MExtractedSignalPix *pix;
136 while ((pix=(MExtractedSignalPix*)Next()))
137 {
138 idx++;
139
140 if (!pix->IsValid())
141 continue;
142
143 *fLog << idx << ": ";
144 pix->Print();
145 }
146}
147
148Bool_t MExtractedSignalCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
149{
150 switch (type)
151 {
152 case 0:
153 val = (*this)[idx].GetExtractedSignalHiGain();
154 break;
155 case 1:
156 val = (*this)[idx].GetExtractedSignalHiGainError();
157 break;
158 case 2:
159 val = (*this)[idx].GetExtractedSignalLoGain();
160 break;
161 case 3:
162 val = (*this)[idx].GetExtractedSignalLoGainError();
163 break;
164 default:
165 return kFALSE;
166 }
167 return val>=0;
168}
169
170void MExtractedSignalCam::DrawPixelContent(Int_t num) const
171{
172 *fLog << warn << "MExtractedSignaCam::DrawPixelContent - not available." << endl;
173}
Note: See TracBrowser for help on using the repository browser.