1 | #include "MCerPhotEvt.h"
|
---|
2 |
|
---|
3 | #include <math.h>
|
---|
4 | #include <TClonesArray.h>
|
---|
5 | #include <TCanvas.h>
|
---|
6 |
|
---|
7 | #include "MCamGeom.h"
|
---|
8 | #include "MCamNeighbor.h"
|
---|
9 | #include "MCamDisplay.h"
|
---|
10 | #include "MHexagon.h"
|
---|
11 |
|
---|
12 | ClassImp(MCerPhotPix)
|
---|
13 | ClassImp(MCerPhotEvt)
|
---|
14 |
|
---|
15 | MCerPhotPix::MCerPhotPix(Int_t pix, Float_t phot , Float_t errphot )
|
---|
16 | {
|
---|
17 | // default constructor
|
---|
18 | fPixId = pix ;
|
---|
19 | fIsUsed = kTRUE ;
|
---|
20 | fIsCore = kFALSE ;
|
---|
21 | fPhot = phot ;
|
---|
22 | fErrPhot = errphot ;
|
---|
23 | }
|
---|
24 |
|
---|
25 | void MCerPhotPix::SetPixelContent(Int_t pix, Float_t phot , Float_t errphot)
|
---|
26 | {
|
---|
27 | fPixId = pix ;
|
---|
28 | fIsUsed = kTRUE ;
|
---|
29 | fIsUsed = kFALSE ;
|
---|
30 | fPhot = phot ;
|
---|
31 | fErrPhot = errphot ;
|
---|
32 | }
|
---|
33 |
|
---|
34 | void MCerPhotPix::Print()
|
---|
35 | {
|
---|
36 | // information about a pixel
|
---|
37 | cout << "MCerPhotPix: Pixel: "<< fPixId ;
|
---|
38 |
|
---|
39 | if ( fIsUsed == kTRUE )
|
---|
40 | cout << " Used " ;
|
---|
41 | else
|
---|
42 | if ( fIsUsed == kFALSE )
|
---|
43 | cout << " UnUsed " ;
|
---|
44 |
|
---|
45 | if ( fIsCore == kTRUE )
|
---|
46 | cout << " Core " ;
|
---|
47 | else
|
---|
48 | if ( fIsCore == kFALSE )
|
---|
49 | cout << " " ;
|
---|
50 |
|
---|
51 | cout << " Nphot= " << fPhot
|
---|
52 | << " Error(Nphot) = " << fErrPhot
|
---|
53 | << endl ;
|
---|
54 | }
|
---|
55 |
|
---|
56 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
---|
57 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
---|
58 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
---|
59 |
|
---|
60 |
|
---|
61 | MCerPhotEvt::MCerPhotEvt(const char *name, const char *title )
|
---|
62 | {
|
---|
63 | // the default constructor
|
---|
64 |
|
---|
65 |
|
---|
66 | *fName = name ? name : "MCerPhotEvt";
|
---|
67 | *fTitle = name ? name : "(Number of Photon)-Event Information";
|
---|
68 |
|
---|
69 | fType = 0 ;
|
---|
70 | fNbPixels = 0 ;
|
---|
71 |
|
---|
72 | fPixels = new TClonesArray ("MCerPhotPix", 577) ;
|
---|
73 |
|
---|
74 | fNN = new MCamNeighbor() ;
|
---|
75 |
|
---|
76 | fPixels->Clear() ;
|
---|
77 | }
|
---|
78 |
|
---|
79 | void MCerPhotEvt::Draw(Option_t* option)
|
---|
80 | {
|
---|
81 | // FIXME!!!
|
---|
82 | //
|
---|
83 |
|
---|
84 | MCamDisplay *disp = new MCamDisplay(fType) ;
|
---|
85 |
|
---|
86 | disp->Draw( this ) ;
|
---|
87 |
|
---|
88 | // disp->Draw() ;
|
---|
89 |
|
---|
90 | }
|
---|
91 |
|
---|
92 |
|
---|
93 |
|
---|
94 |
|
---|
95 | Int_t MCerPhotEvt::GetNbPixels()
|
---|
96 | {
|
---|
97 | return fNbPixels ;
|
---|
98 | }
|
---|
99 |
|
---|
100 | void MCerPhotEvt::AddPixel(Int_t id, Float_t nph, Float_t err)
|
---|
101 | {
|
---|
102 | TClonesArray &caP = *fPixels ;
|
---|
103 | new ( caP[fNbPixels++] ) MCerPhotPix( id, nph, err ) ;
|
---|
104 | }
|
---|
105 |
|
---|
106 | void MCerPhotEvt::Clear()
|
---|
107 | {
|
---|
108 | fNbPixels = 0 ;
|
---|
109 | fPixels->Clear() ;
|
---|
110 | }
|
---|
111 |
|
---|
112 | void MCerPhotEvt::Print()
|
---|
113 | {
|
---|
114 | cout << "MCerPhotEvt::Print()"
|
---|
115 | << "Number of Pixels: " << fNbPixels
|
---|
116 | << "(" << fPixels->GetEntries() << ")"
|
---|
117 | << endl ;
|
---|
118 |
|
---|
119 | for (Int_t il=0; il<fPixels->GetEntries(); il++ )
|
---|
120 | {
|
---|
121 | ((MCerPhotPix *) fPixels->At(il))->Print() ;
|
---|
122 | }
|
---|
123 | }
|
---|
124 |
|
---|
125 | void MCerPhotEvt::CleanLevel1()
|
---|
126 | {
|
---|
127 | // This method looks for all pixels with an entry (photons)
|
---|
128 | // that is three times bigger than the noise of the pixel
|
---|
129 |
|
---|
130 | Float_t entry, noise ;
|
---|
131 |
|
---|
132 | // first look for pixels above some noise level
|
---|
133 |
|
---|
134 | for (Int_t il=0; il<fPixels->GetEntries(); il++ )
|
---|
135 | {
|
---|
136 | entry = ((MCerPhotPix *) fPixels->At(il))->GetPhotons() ;
|
---|
137 | noise = ((MCerPhotPix *) fPixels->At(il))->GetErrorPhot() ;
|
---|
138 |
|
---|
139 | if (entry < 3 * noise )
|
---|
140 | ((MCerPhotPix *) fPixels->At(il))->SetPixelUnused() ;
|
---|
141 |
|
---|
142 | }
|
---|
143 | }
|
---|
144 |
|
---|
145 | void MCerPhotEvt::CleanLevel2()
|
---|
146 | {
|
---|
147 | // check if the survived pixel have a neighbor, that also
|
---|
148 | // survived
|
---|
149 |
|
---|
150 | Int_t id, id2 ;
|
---|
151 | Int_t itest ;
|
---|
152 |
|
---|
153 | for (Int_t il=0; il<fPixels->GetEntries(); il++ )
|
---|
154 | {
|
---|
155 | if ( ((MCerPhotPix *) fPixels->At(il))->IsPixelUsed() == kTRUE )
|
---|
156 | {
|
---|
157 | id = ((MCerPhotPix *) fPixels->At(il))->GetPixId() ;
|
---|
158 |
|
---|
159 | itest = 0 ;
|
---|
160 | for (Int_t in=0 ; in < 6 ; in++ ) {
|
---|
161 |
|
---|
162 | id2 = fNN->GetNN(id, in ) ;
|
---|
163 |
|
---|
164 | if (id2 >=0 ) {
|
---|
165 | if ( PixelIsUsed(id2) == kTRUE )
|
---|
166 | itest++ ;
|
---|
167 | }
|
---|
168 | }
|
---|
169 |
|
---|
170 | //
|
---|
171 | // check if no neighbor, then set unused
|
---|
172 | //
|
---|
173 | if ( itest == 0 )
|
---|
174 | {
|
---|
175 | ((MCerPhotPix *) fPixels->At(il))->SetPixelUnused() ;
|
---|
176 | }
|
---|
177 |
|
---|
178 | }
|
---|
179 | }
|
---|
180 |
|
---|
181 | // now we declare all pixels that survive as CorePixels
|
---|
182 |
|
---|
183 | for (Int_t il=0; il<fPixels->GetEntries(); il++ )
|
---|
184 | {
|
---|
185 | if ( ((MCerPhotPix *) fPixels->At(il))->IsPixelUsed() == kTRUE )
|
---|
186 | {
|
---|
187 | ((MCerPhotPix *) fPixels->At(il))->SetCorePixel() ;
|
---|
188 | }
|
---|
189 | }
|
---|
190 |
|
---|
191 | }
|
---|
192 |
|
---|
193 | void MCerPhotEvt::CleanLevel3()
|
---|
194 | {
|
---|
195 | // Look for the boundary pixels around the core pixels
|
---|
196 | // if a pixel has more than 2.5 sigma, and a core neigbor
|
---|
197 | // it is declared as used.
|
---|
198 |
|
---|
199 | Float_t entry, noise ;
|
---|
200 | Int_t id, id2 ;
|
---|
201 | for (Int_t il=0; il<fPixels->GetEntries(); il++ )
|
---|
202 | {
|
---|
203 | if ( ((MCerPhotPix *) fPixels->At(il))->IsCorePixel() == kFALSE )
|
---|
204 | {
|
---|
205 | entry = ((MCerPhotPix *) fPixels->At(il))->GetPhotons() ;
|
---|
206 | noise = ((MCerPhotPix *) fPixels->At(il))->GetErrorPhot() ;
|
---|
207 |
|
---|
208 | if (entry > 2.5 * noise ) {
|
---|
209 | id = ((MCerPhotPix *) fPixels->At(il))->GetPixId() ;
|
---|
210 | for (Int_t in=0 ; in < 6 ; in++ )
|
---|
211 | {
|
---|
212 | id2 = fNN->GetNN(id, in ) ;
|
---|
213 | if (id2 >=0 )
|
---|
214 | {
|
---|
215 | if ( PixelIsCore(id2) == kTRUE ) {
|
---|
216 | ((MCerPhotPix *) fPixels->At(il))->SetPixelUsed() ;
|
---|
217 | break ;
|
---|
218 | }
|
---|
219 | }
|
---|
220 | }
|
---|
221 | }
|
---|
222 | }
|
---|
223 | }
|
---|
224 | }
|
---|
225 |
|
---|
226 |
|
---|
227 |
|
---|
228 |
|
---|
229 | Bool_t MCerPhotEvt::PixelExist(Int_t id )
|
---|
230 | {
|
---|
231 | // Checks if in the pixel list is an entry with pixel id
|
---|
232 |
|
---|
233 | for (Int_t il=0; il<fPixels->GetEntries(); il++ )
|
---|
234 | {
|
---|
235 | if ( id == ((MCerPhotPix *) fPixels->At(il))->GetPixId() ) {
|
---|
236 |
|
---|
237 | // cout << " PixelExist " << il ;
|
---|
238 | return kTRUE ;
|
---|
239 | }
|
---|
240 | }
|
---|
241 |
|
---|
242 | return kFALSE ;
|
---|
243 |
|
---|
244 | }
|
---|
245 |
|
---|
246 | Bool_t MCerPhotEvt::PixelIsUsed(Int_t id )
|
---|
247 | {
|
---|
248 | // Checks if in the pixel list is an entry with pixel id
|
---|
249 |
|
---|
250 | for (Int_t il=0; il<fPixels->GetEntries(); il++ )
|
---|
251 | {
|
---|
252 | if ( id == ((MCerPhotPix *) fPixels->At(il))->GetPixId() &&
|
---|
253 | ((MCerPhotPix *) fPixels->At(il))->IsPixelUsed() == kTRUE ) {
|
---|
254 |
|
---|
255 | // cout << " PixelIsUsed " << il ;
|
---|
256 | return kTRUE ;
|
---|
257 | }
|
---|
258 | }
|
---|
259 |
|
---|
260 | return kFALSE ;
|
---|
261 |
|
---|
262 | }
|
---|
263 |
|
---|
264 | Bool_t MCerPhotEvt::PixelIsCore(Int_t id )
|
---|
265 | {
|
---|
266 | // Checks if in the pixel list is an entry with pixel id
|
---|
267 |
|
---|
268 | for (Int_t il=0; il<fPixels->GetEntries(); il++ )
|
---|
269 | {
|
---|
270 | if ( id == ((MCerPhotPix *) fPixels->At(il))->GetPixId() &&
|
---|
271 | ((MCerPhotPix *) fPixels->At(il))->IsCorePixel() == kTRUE ) {
|
---|
272 |
|
---|
273 | return kTRUE ;
|
---|
274 | }
|
---|
275 | }
|
---|
276 |
|
---|
277 | return kFALSE ;
|
---|
278 |
|
---|
279 | }
|
---|
280 |
|
---|
281 | Int_t MCerPhotEvt::GetPixelId(Int_t i )
|
---|
282 | {
|
---|
283 | return ( ( (MCerPhotPix *) fPixels->At(i))->GetPixId() ) ;
|
---|
284 | }
|
---|
285 |
|
---|
286 | Bool_t MCerPhotEvt::IsPixelUsed(Int_t i )
|
---|
287 | {
|
---|
288 | return ( ( (MCerPhotPix *) fPixels->At(i))->IsPixelUsed() ) ;
|
---|
289 | }
|
---|
290 |
|
---|
291 | Float_t MCerPhotEvt::GetPhotons(Int_t i )
|
---|
292 | {
|
---|
293 | return ( ( (MCerPhotPix *) fPixels->At(i))->GetPhotons() ) ;
|
---|
294 | }
|
---|
295 |
|
---|
296 | Float_t MCerPhotEvt::GetErrorPhot(Int_t i )
|
---|
297 | {
|
---|
298 | return ( ( (MCerPhotPix *) fPixels->At(i))->GetErrorPhot() ) ;
|
---|
299 | }
|
---|
300 |
|
---|
301 |
|
---|
302 | Float_t MCerPhotEvt::GetMinimumPhoton()
|
---|
303 | {
|
---|
304 | if ( fNbPixels <= 0 )
|
---|
305 | return -5. ;
|
---|
306 |
|
---|
307 | Float_t minWert ;
|
---|
308 | minWert = ((MCerPhotPix *) fPixels->At(0))->GetPhotons() ;
|
---|
309 |
|
---|
310 | Float_t testWert ;
|
---|
311 |
|
---|
312 | for ( Int_t i =0 ; i<fNbPixels ; i++ ) {
|
---|
313 | testWert = ((MCerPhotPix *) fPixels->At(i))->GetPhotons() ;
|
---|
314 |
|
---|
315 | if ( minWert >= testWert )
|
---|
316 | minWert = testWert ;
|
---|
317 | }
|
---|
318 |
|
---|
319 | return minWert ;
|
---|
320 | }
|
---|
321 |
|
---|
322 | Float_t MCerPhotEvt::GetMaximumPhoton()
|
---|
323 | {
|
---|
324 | if ( fNbPixels <= 0 )
|
---|
325 | return 50. ;
|
---|
326 |
|
---|
327 | Float_t maxWert ;
|
---|
328 | maxWert = ((MCerPhotPix *) fPixels->At(0))->GetPhotons() ;
|
---|
329 |
|
---|
330 | Float_t testWert ;
|
---|
331 |
|
---|
332 | for ( Int_t i =0 ; i<fNbPixels ; i++ ) {
|
---|
333 | testWert = ((MCerPhotPix *) fPixels->At(i))->GetPhotons() ;
|
---|
334 |
|
---|
335 | if ( maxWert <= testWert )
|
---|
336 | maxWert = testWert ;
|
---|
337 | }
|
---|
338 |
|
---|
339 | return maxWert ;
|
---|
340 | }
|
---|
341 |
|
---|