source: branches/removing_cpp11_features/msignal/MArrivalTimeCam.cc@ 19779

Last change on this file since 19779 was 10166, checked in by tbretz, 14 years ago
Removed the old obsolete cvs header line.
File size: 5.5 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! Author(s): Hendrik Bartko 02/2004 <mailto:hbartko@mppmu.mpg.de>
21!
22! Copyright: MAGIC Software Development, 2000-2006
23!
24!
25\* ======================================================================== */
26
27/////////////////////////////////////////////////////////////////////////////
28//
29// MArrivalTimeCam
30//
31// Hold the ArrivalTime information for all pixels in the camera
32//
33//
34// Class Version 2:
35// ----------------
36// - Byte_t fFirstUsedSliceHiGain;
37// - Byte_t fFirstUsedSliceLoGain;
38// - Byte_t fLastUsedSliceHiGain;
39// - Byte_t fLastUsedSliceLoGain;
40//
41/////////////////////////////////////////////////////////////////////////////
42#include "MArrivalTimeCam.h"
43
44#include <TClonesArray.h>
45
46#include "MLog.h"
47#include "MLogManip.h"
48
49#include "MArrivalTimePix.h"
50
51ClassImp(MArrivalTimeCam);
52
53using namespace std;
54
55// --------------------------------------------------------------------------
56//
57// Default constructor. Creates a MArrivalTimePix object for each pixel
58//
59MArrivalTimeCam::MArrivalTimeCam(const char *name, const char *title)
60{
61 fName = name ? name : "MArrivalTimeCam";
62 fTitle = title ? title : "Storage container for all Extracted Signal Information in the camera";
63
64 fArray = new TClonesArray("MArrivalTimePix", 1);
65}
66
67// --------------------------------------------------------------------------
68//
69// Delete the array conatining the pixel pedest information
70//
71MArrivalTimeCam::~MArrivalTimeCam()
72{
73 delete fArray;
74}
75
76// --------------------------------------------------------------------------
77//
78// Distribute logging stream to all childs
79//
80void MArrivalTimeCam::SetLogStream(MLog *lg)
81{
82 fArray->R__FOR_EACH(MParContainer, SetLogStream)(lg);
83 MParContainer::SetLogStream(lg);
84}
85
86// --------------------------------------------------------------------------
87//
88// Set the size of the camera
89//
90void MArrivalTimeCam::InitSize(const UInt_t i)
91{
92 fArray->ExpandCreate(i);
93}
94
95// --------------------------------------------------------------------------
96//
97// Get the size of the MArrivalTimeCam
98//
99Int_t MArrivalTimeCam::GetSize() const
100{
101 return fArray->GetEntriesFast();
102}
103
104// --------------------------------------------------------------------------
105//
106// Get i-th pixel (pixel index)
107//
108MArrivalTimePix &MArrivalTimeCam::operator[](Int_t i)
109{
110 return *static_cast<MArrivalTimePix*>(fArray->UncheckedAt(i));
111}
112
113// --------------------------------------------------------------------------
114//
115// Get i-th pixel (pixel index)
116//
117const MArrivalTimePix &MArrivalTimeCam::operator[](Int_t i) const
118{
119 return *static_cast<MArrivalTimePix*>(fArray->UncheckedAt(i));
120}
121
122void MArrivalTimeCam::Clear(Option_t *o)
123{
124 fArray->R__FOR_EACH(TObject, Clear)();
125}
126
127void MArrivalTimeCam::Print(Option_t *o) const
128{
129 *fLog << all << GetDescriptor() << ":" << endl;
130 int idx = -1;
131
132 TIter Next(fArray);
133 MArrivalTimePix *pix;
134 while ((pix=(MArrivalTimePix*)Next()))
135 {
136 idx++;
137
138 if (!pix->IsArrivalTimeValid())
139 continue;
140
141 *fLog << idx << ": ";
142 pix->Print();
143 }
144}
145
146Bool_t MArrivalTimeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
147{
148 if (idx>=GetSize())
149 return kFALSE;
150
151 const MArrivalTimePix &pix = (*this)[idx];
152
153 switch (type)
154 {
155 case 0:
156 val = pix.GetArrivalTimeHiGain();
157 return pix.IsHiGainValid() && !pix.IsHiGainSaturated();
158
159 case 1:
160 val = pix.GetArrivalTimeHiGainError();
161 return val>0;
162
163 case 2:
164 val = pix.GetArrivalTimeLoGain();
165 return pix.IsLoGainValid() && !pix.IsLoGainSaturated();
166
167 case 3:
168 val = pix.GetArrivalTimeLoGainError();
169 return val>0;
170
171 case 4:
172 case 6:
173 val = pix.GetArrivalTime();
174 return pix.IsArrivalTimeValid();
175
176 // This is for the case the signal has been
177 // extracted from lo- and hi-gain
178 case 7:
179 // Lo- and hi-gain must be successfully extracted
180 if (!pix.IsLoGainValid() || !pix.IsHiGainValid())
181 return kFALSE;
182
183 // Lo- and hi-gain must not be saturated
184 if (pix.IsLoGainSaturated() || pix.IsHiGainSaturated())
185 return kFALSE;
186
187// if (pix.GetArrivalTimeHiGain()<3 || pix.GetArrivalTimeHiGain()>12 ||
188// pix.GetArrivalTimeLoGain()<3 || pix.GetArrivalTimeLoGain()>12)
189// return kFALSE;
190
191 val = pix.GetArrivalTimeLoGain()-pix.GetArrivalTimeHiGain();
192 return TMath::Abs(val)<2; // FIXME: Is this a good value?
193
194 default:
195 return kFALSE;
196 }
197
198 return kFALSE;
199}
200
201void MArrivalTimeCam::DrawPixelContent(Int_t num) const
202{
203 *fLog << warn << "MArrivalTimeCam::DrawPixelContent - not available." << endl;
204}
Note: See TracBrowser for help on using the repository browser.