source: branches/Mars_use_drstimefiles/msignal/MExtractedSignalCam.cc@ 18605

Last change on this file since 18605 was 14078, checked in by tbretz, 12 years ago
Added a case 5 to GetPixelValue
File size: 6.1 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// Class Version 4:
37// ----------------
38// - Byte_t fFirstUsedSliceLoGain; // First Low Gain FADC used for extraction (incl.)
39// + Int_t fFirstUsedSliceLoGain; // First Low Gain FADC used for extraction (incl.)
40//
41/////////////////////////////////////////////////////////////////////////////
42#include "MExtractedSignalCam.h"
43
44#include <TClonesArray.h>
45
46#include "MLog.h"
47#include "MLogManip.h"
48
49#include "MExtractedSignalPix.h"
50
51ClassImp(MExtractedSignalCam);
52
53using namespace std;
54
55// --------------------------------------------------------------------------
56//
57// Default constructor. Creates a MExtractedSignalPix object for each pixel
58//
59MExtractedSignalCam::MExtractedSignalCam(const char *name, const char *title)
60 : fFirstUsedSliceHiGain(0), fFirstUsedSliceLoGain(0),
61 fLastUsedSliceHiGain(0), fLastUsedSliceLoGain(0),
62 fUsedWindowHiGain(0.), fUsedWindowLoGain(0.)
63{
64 fName = name ? name : "MExtractedSignalCam";
65 fTitle = title ? title : "Storage container for all Extracted Signal Information in the camera";
66
67 fArray = new TClonesArray("MExtractedSignalPix", 1);
68}
69
70// --------------------------------------------------------------------------
71//
72// Delete the array conatining the pixel pedest information
73//
74MExtractedSignalCam::~MExtractedSignalCam()
75{
76 delete fArray;
77}
78
79// --------------------------------------------------------------------------
80//
81// Distribute logging stream to all childs
82//
83void MExtractedSignalCam::SetLogStream(MLog *lg)
84{
85 fArray->R__FOR_EACH(MParContainer, SetLogStream)(lg);
86 MParContainer::SetLogStream(lg);
87}
88
89// --------------------------------------------------------------------------
90//
91// Set the size of the camera
92//
93void MExtractedSignalCam::InitSize(const UInt_t i)
94{
95 fArray->ExpandCreate(i);
96}
97
98// --------------------------------------------------------------------------
99//
100// Get the size of the MExtractedSignalCam
101//
102Int_t MExtractedSignalCam::GetSize() const
103{
104 return fArray->GetEntriesFast();
105}
106
107// --------------------------------------------------------------------------
108//
109// Get i-th pixel (pixel index)
110//
111MExtractedSignalPix &MExtractedSignalCam::operator[](Int_t i)
112{
113 return *static_cast<MExtractedSignalPix*>(fArray->UncheckedAt(i));
114}
115
116// --------------------------------------------------------------------------
117//
118// Get i-th pixel (pixel index)
119//
120const MExtractedSignalPix &MExtractedSignalCam::operator[](Int_t i) const
121{
122 return *static_cast<MExtractedSignalPix*>(fArray->UncheckedAt(i));
123}
124
125/*
126Float_t MExtractedSignalCam::GetProb( const Int_t pixidx ) const
127{
128 if (pixidx > GetSize()-1)
129 return -1.;
130
131 return TMath::Prob((*this)[pixidx].GetChisquare(),fNdf);
132}
133*/
134
135void MExtractedSignalCam::Clear(Option_t *o)
136{
137 fArray->R__FOR_EACH(TObject, Clear)();
138}
139
140void MExtractedSignalCam::Print(Option_t *o) const
141{
142 *fLog << all << GetDescriptor() << ":" << endl;
143 int idx = -1;
144
145 TIter Next(fArray);
146 MExtractedSignalPix *pix;
147 while ((pix=(MExtractedSignalPix*)Next()))
148 {
149 idx++;
150
151 if (!pix->IsLoGainValid() && ! pix->IsHiGainValid())
152 continue;
153
154 *fLog << idx << ": ";
155 pix->Print();
156 }
157}
158
159Bool_t MExtractedSignalCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
160{
161 if (idx>=GetSize())
162 return kFALSE;
163
164 const MExtractedSignalPix &pix = (*this)[idx];
165
166 switch (type)
167 {
168 case 0:
169 val = pix.GetExtractedSignalHiGain();
170 return pix.IsHiGainValid() && !pix.IsHiGainSaturated();
171
172 case 1:
173 val = pix.GetExtractedSignalHiGainError();
174 return val>0;
175
176 case 2:
177 val = pix.GetExtractedSignalLoGain();
178 return pix.IsLoGainValid() && !pix.IsLoGainSaturated();
179
180 case 3:
181 val = pix.GetExtractedSignalLoGainError();
182 return val>0;
183
184 // This is for the case the signal has been
185 // extracted from lo- and hi-gain
186 case 4:
187 // Lo- and hi-gain must be successfully extracted
188 if (!pix.IsLoGainValid() || !pix.IsHiGainValid())
189 return kFALSE;
190
191 // Lo- and hi-gain must not be saturated
192 if (pix.IsLoGainSaturated() || pix.IsHiGainSaturated())
193 return kFALSE;
194
195 // Both signals must have a positive value
196 if (pix.GetExtractedSignalLoGain()<=0 || pix.GetExtractedSignalHiGain()<=0)
197 return kFALSE;
198
199 //val = log10(pix.GetExtractedSignalHiGain())-log10(pix.GetExtractedSignalLoGain());
200 //return TMath::Abs(val-1)<0.4;
201 val = pix.GetExtractedSignalHiGain()/pix.GetExtractedSignalLoGain();
202 //return val>4 && val<30;
203 return val>4 && val<35;
204
205 case 5:
206 val = pix.GetExtractedSignalHiGain();
207 return pix.IsHiGainValid() && !pix.IsHiGainSaturated() && val>100;
208
209 default:
210 return kFALSE;
211 }
212
213 return kFALSE;
214}
215
216void MExtractedSignalCam::DrawPixelContent(Int_t num) const
217{
218 *fLog << warn << "MExtractedSignaCam::DrawPixelContent - not available." << endl;
219}
Note: See TracBrowser for help on using the repository browser.