source: tags/Mars-V0.10.2/msignal/MArrivalTimeCam.cc

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