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

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