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 |
|
---|
46 | ClassImp(MExtractedSignalCam);
|
---|
47 |
|
---|
48 | using namespace std;
|
---|
49 |
|
---|
50 | // --------------------------------------------------------------------------
|
---|
51 | //
|
---|
52 | // Default constructor. Creates a MExtractedSignalPix object for each pixel
|
---|
53 | //
|
---|
54 | MExtractedSignalCam::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 | //
|
---|
69 | MExtractedSignalCam::~MExtractedSignalCam()
|
---|
70 | {
|
---|
71 | delete fArray;
|
---|
72 | }
|
---|
73 |
|
---|
74 | // --------------------------------------------------------------------------
|
---|
75 | //
|
---|
76 | // Distribute logging stream to all childs
|
---|
77 | //
|
---|
78 | void 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 | //
|
---|
88 | void MExtractedSignalCam::InitSize(const UInt_t i)
|
---|
89 | {
|
---|
90 | fArray->ExpandCreate(i);
|
---|
91 | }
|
---|
92 |
|
---|
93 | // --------------------------------------------------------------------------
|
---|
94 | //
|
---|
95 | // Get the size of the MExtractedSignalCam
|
---|
96 | //
|
---|
97 | Int_t MExtractedSignalCam::GetSize() const
|
---|
98 | {
|
---|
99 | return fArray->GetEntriesFast();
|
---|
100 | }
|
---|
101 |
|
---|
102 | // --------------------------------------------------------------------------
|
---|
103 | //
|
---|
104 | // Get i-th pixel (pixel index)
|
---|
105 | //
|
---|
106 | MExtractedSignalPix &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 | //
|
---|
115 | const MExtractedSignalPix &MExtractedSignalCam::operator[](Int_t i) const
|
---|
116 | {
|
---|
117 | return *static_cast<MExtractedSignalPix*>(fArray->UncheckedAt(i));
|
---|
118 | }
|
---|
119 |
|
---|
120 | /*
|
---|
121 | Float_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 |
|
---|
130 | void MExtractedSignalCam::Clear(Option_t *o)
|
---|
131 | {
|
---|
132 | fArray->R__FOR_EACH(TObject, Clear)();
|
---|
133 | }
|
---|
134 |
|
---|
135 | void 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 |
|
---|
154 | Bool_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();
|
---|
166 |
|
---|
167 | case 1:
|
---|
168 | val = pix.GetExtractedSignalHiGainError();
|
---|
169 | return val>0;
|
---|
170 |
|
---|
171 | case 2:
|
---|
172 | val = pix.GetExtractedSignalLoGain();
|
---|
173 | return pix.IsLoGainValid();
|
---|
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 | if (!pix.IsLoGainValid() || !pix.IsHiGainValid())
|
---|
183 | return kFALSE;
|
---|
184 |
|
---|
185 | val = pix.GetExtractedSignalHiGain()/pix.GetExtractedSignalLoGain();
|
---|
186 | return pix.GetExtractedSignalLoGain()>2 && val<25;
|
---|
187 |
|
---|
188 | default:
|
---|
189 | return kFALSE;
|
---|
190 | }
|
---|
191 |
|
---|
192 | return kFALSE;
|
---|
193 | }
|
---|
194 |
|
---|
195 | void MExtractedSignalCam::DrawPixelContent(Int_t num) const
|
---|
196 | {
|
---|
197 | *fLog << warn << "MExtractedSignaCam::DrawPixelContent - not available." << endl;
|
---|
198 | }
|
---|