source: tags/Mars-V0.10/msignal/MExtractedSignalCam.cc

Last change on this file was 7876, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 5.8 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->IsLoGainValid() && ! pix->IsHiGainValid())
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 if (idx>=GetSize())
157 return kFALSE;
158
159 const MExtractedSignalPix &pix = (*this)[idx];
160
161 switch (type)
162 {
163 case 0:
164 val = pix.GetExtractedSignalHiGain();
165 return pix.IsHiGainValid() && !pix.IsHiGainSaturated();
166
167 case 1:
168 val = pix.GetExtractedSignalHiGainError();
169 return val>0;
170
171 case 2:
172 val = pix.GetExtractedSignalLoGain();
173 return pix.IsLoGainValid() && !pix.IsLoGainSaturated();
174
175 case 3:
176 val = pix.GetExtractedSignalLoGainError();
177 return val>0;
178
179 // This is for the case the signal has been
180 // extracted from lo- and hi-gain
181 case 4:
182 // Lo- and hi-gain must be successfully extracted
183 if (!pix.IsLoGainValid() || !pix.IsHiGainValid())
184 return kFALSE;
185
186 // Lo- and hi-gain must not be saturated
187 if (pix.IsLoGainSaturated() || pix.IsHiGainSaturated())
188 return kFALSE;
189
190 // Both signals must have a positive value
191 if (pix.GetExtractedSignalLoGain()<=0 || pix.GetExtractedSignalHiGain()<=0)
192 return kFALSE;
193
194 //val = log10(pix.GetExtractedSignalHiGain())-log10(pix.GetExtractedSignalLoGain());
195 //return TMath::Abs(val-1)<0.4;
196 val = pix.GetExtractedSignalHiGain()/pix.GetExtractedSignalLoGain();
197 //return val>4 && val<30;
198 return val>4 && val<35;
199
200 default:
201 return kFALSE;
202 }
203
204 return kFALSE;
205}
206
207void MExtractedSignalCam::DrawPixelContent(Int_t num) const
208{
209 *fLog << warn << "MExtractedSignaCam::DrawPixelContent - not available." << endl;
210}
Note: See TracBrowser for help on using the repository browser.