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

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