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): Antonio Stamerra 1/2003 <mailto:antono.stamerra@pi.infn.it>
|
---|
19 | ! Author(s): Marcos Lopez 1/2003 <mailto:marcos@gae.ucm.es>
|
---|
20 | !
|
---|
21 | ! Copyright: MAGIC Software Development, 2000-2003
|
---|
22 | !
|
---|
23 | !
|
---|
24 | \* ======================================================================== */
|
---|
25 |
|
---|
26 | /////////////////////////////////////////////////////////////////////////////
|
---|
27 | // //
|
---|
28 | // MMcTriggerLvl2 //
|
---|
29 | // Storage container for the 2nd level trigger selection parameters //
|
---|
30 | // as part of the 2nd level trigger simulation //
|
---|
31 | // //
|
---|
32 | // //
|
---|
33 | // Basic L2T Selection Parameters: //
|
---|
34 | // //
|
---|
35 | // fLutPseudoSize number of compact pixels in one LUT //
|
---|
36 | // fPseudoSize Multiplicity of the bigger cluster //
|
---|
37 | // fSizeBiggerCell higher number of fired pixel in cell //
|
---|
38 | // //
|
---|
39 | /////////////////////////////////////////////////////////////////////////////
|
---|
40 |
|
---|
41 | #include "MMcTriggerLvl2.h"
|
---|
42 |
|
---|
43 | #include "MGeomCamMagic.h"
|
---|
44 | #include "MCamDisplay.h"
|
---|
45 |
|
---|
46 | #include "MMcTrig.hxx"
|
---|
47 |
|
---|
48 | #include "MLog.h"
|
---|
49 |
|
---|
50 | #include <TCanvas.h>
|
---|
51 |
|
---|
52 |
|
---|
53 | ClassImp(MMcTriggerLvl2)
|
---|
54 |
|
---|
55 | // ---------------------------
|
---|
56 | // Initialization of static const data members pixel_in_cell and pixel_in_lut
|
---|
57 |
|
---|
58 | //
|
---|
59 | // Correspondence TABLE between pixel numbering in the trigger cells and
|
---|
60 | // the standard spiral counting
|
---|
61 | // (Note: Pixels start to count from 1 instead of 0)
|
---|
62 | //
|
---|
63 | const Int_t MMcTriggerLvl2::pixels_in_cell[36][19] = {
|
---|
64 | {26, 91, 66, 71, 76, 81, 86, 269, 224, 233, 242, 251, 260, 391, 336, 347, 358, 369, 380},
|
---|
65 | {25, 61, 41, 45, 49, 53, 57, 215, 175, 183, 191, 199, 207, 325, 275, 285, 295, 305, 315},
|
---|
66 | {24, 37, 22, 25, 28, 31, 34, 167, 132, 139, 146, 153, 160, 265, 220, 229, 238, 247, 256},
|
---|
67 | {23, 19, 9, 11, 13, 15, 17, 125, 95, 101, 107, 113, 119, 211, 171, 179, 187, 195, 203},
|
---|
68 | {27, 62, 67, 72, 77, 82, 87, 270, 225, 234, 243, 252, 261, 392, 337, 348, 359, 370, 381},
|
---|
69 | {12, 38, 42, 46, 50, 54, 58, 216, 176, 184, 192, 200, 208, 326, 276, 286, 296, 306, 316},
|
---|
70 | {11, 20, 23, 26, 29, 32, 35, 168, 133, 140, 147, 154, 161, 266, 221, 230, 239, 248, 257},
|
---|
71 | {10, 8, 10, 12, 14, 16, 18, 126, 96, 102, 108, 114, 120, 212, 172, 180, 188, 196, 204},
|
---|
72 | {22, 2, 3, 4, 5, 6, 7, 90, 65, 70, 75, 80, 85, 164, 129, 136, 143, 150, 157},
|
---|
73 | {28, 93, 99, 105, 111, 117, 123, 271, 226, 235, 244, 253, 262, 393, 338, 349, 360, 371, 382},
|
---|
74 | {13, 63, 68, 73, 78, 83, 88, 217, 177, 185, 193, 201, 209, 327, 277, 287, 297, 307, 317},
|
---|
75 | { 4, 39, 43, 47, 51, 55, 59, 169, 134, 141, 148, 155, 162, 267, 222, 231, 240, 249, 258},
|
---|
76 | { 3, 21, 24, 27, 30, 33, 36, 127, 97, 103, 109, 115, 121, 213, 173, 181, 189, 197, 205},
|
---|
77 | { 9, 9, 11, 13, 15, 17, 19, 91, 66, 71, 76, 81, 86, 165, 130, 137, 144, 151, 158},
|
---|
78 | {21, 3, 4, 5, 6, 7, 2, 61, 41, 45, 49, 53, 57, 123, 93, 99, 105, 111, 117},
|
---|
79 | {29, 130, 137, 144, 151, 158, 165, 218, 227, 236, 245, 254, 263, 394, 339, 350, 361, 372, 383},
|
---|
80 | {14, 94, 100, 106, 112, 118, 124, 170, 178, 186, 194, 202, 210, 328, 278, 288, 298, 308, 318},
|
---|
81 | { 5, 64, 69, 74, 79, 84, 89, 128, 135, 142, 149, 156, 163, 268, 223, 232, 241, 250, 259},
|
---|
82 | { 1, 40, 44, 48, 52, 56, 60, 92, 98, 104, 110, 116, 122, 214, 174, 182, 190, 198, 206},
|
---|
83 | { 2, 22, 25, 28, 31, 34, 37, 62, 67, 72, 77, 82, 87, 166, 131, 138, 145, 152, 159},
|
---|
84 | { 8, 10, 12, 14, 16, 18, 8, 38, 42, 46, 50, 54, 58, 124, 94, 100, 106, 112, 118},
|
---|
85 | {20, 11, 13, 15, 17, 19, 9, 20, 23, 26, 29, 32, 35, 88, 63, 68, 73, 78, 83},
|
---|
86 | {30, 131, 138, 145, 152, 159, 166, 219, 228, 237, 246, 255, 264, 329, 279, 289, 299, 309, 319},
|
---|
87 | {15, 95, 101, 107, 113, 119, 125, 171, 179, 187, 195, 203, 211, 269, 224, 233, 242, 251, 260},
|
---|
88 | { 6, 65, 70, 75, 80, 85, 90, 129, 136, 143, 150, 157, 164, 215, 175, 183, 191, 199, 207},
|
---|
89 | { 7, 41, 45, 49, 53, 57, 61, 93, 99, 105, 111, 117, 123, 167, 132, 139, 146, 153, 160},
|
---|
90 | {19, 23, 26, 29, 32, 35, 20, 63, 68, 73, 78, 83, 88, 125, 95, 101, 107, 113, 119},
|
---|
91 | {37, 24, 27, 30, 33, 36, 21, 39, 43, 47, 51, 55, 59, 89, 64, 69, 74, 79, 84},
|
---|
92 | {31, 132, 139, 146, 153, 160, 167, 220, 229, 238, 247, 256, 265, 270, 225, 234, 243, 252, 261},
|
---|
93 | {16, 96, 102, 108, 114, 120, 126, 172, 180, 188, 196, 204, 212, 216, 176, 184, 192, 200, 208},
|
---|
94 | {17, 66, 71, 76, 81, 86, 91, 130, 137, 144, 151, 158, 165, 168, 133, 140, 147, 154, 161},
|
---|
95 | {18, 42, 46, 50, 54, 58, 38, 94, 100, 106, 112, 118, 124, 126, 96, 102, 108, 114, 120},
|
---|
96 | {36, 43, 47, 51, 55, 59, 39, 64, 69, 74, 79, 84, 89, 90, 65, 70, 75, 80, 85},
|
---|
97 | {32, 133, 140, 147, 154, 161, 168, 221, 230, 239, 248, 257, 266, 217, 177, 185, 193, 201, 209},
|
---|
98 | {33, 97, 103, 109, 115, 121, 127, 173, 181, 189, 197, 205, 213, 169, 134, 141, 148, 155, 162},
|
---|
99 | {35, 68, 73, 78, 83, 88, 63, 95, 101, 107, 113, 119, 125, 91, 66, 71, 76, 81, 86}
|
---|
100 | };
|
---|
101 |
|
---|
102 | //
|
---|
103 | // corrispondence between pixels in cell and lut (pix numbering starts from 1)
|
---|
104 | //
|
---|
105 | const Int_t MMcTriggerLvl2::pixels_in_lut[3][12] = {
|
---|
106 | { 1, 2, 3, 4, 6, 7, 8, 9, 12, 13, 14, 15},
|
---|
107 | {34, 29, 23, 16, 30, 24, 17, 10, 25, 18, 11, 5},
|
---|
108 | {35, 31, 26, 20, 19, 32, 27, 21, 36, 33, 28, 22},
|
---|
109 | };
|
---|
110 |
|
---|
111 |
|
---|
112 | // --------------------------------------------------------------------------
|
---|
113 | //
|
---|
114 | // Default constructor
|
---|
115 | //
|
---|
116 | MMcTriggerLvl2::MMcTriggerLvl2(const char *name, const char *title)
|
---|
117 | {
|
---|
118 | fName = name ? name : ClassName();
|
---|
119 | fTitle = title;
|
---|
120 |
|
---|
121 | *fLog << "created MMcTriggerLvl2" << endl;
|
---|
122 |
|
---|
123 | //
|
---|
124 | // Initialization of the fPixels array to zero
|
---|
125 | //
|
---|
126 |
|
---|
127 | memset (fPixels,0,36*19*sizeof(Int_t));
|
---|
128 |
|
---|
129 | }
|
---|
130 |
|
---|
131 | // --------------------------------------------------------------------------
|
---|
132 | //
|
---|
133 | // Print functions for debugging and testing
|
---|
134 | //
|
---|
135 | // Options available:
|
---|
136 | //
|
---|
137 | // "cell":
|
---|
138 | // Print out the pixel number of a given trigger cell
|
---|
139 | //
|
---|
140 | // "status":
|
---|
141 | // Print a table with the status (pixel is fired or not after Lvl1) for
|
---|
142 | // all the pixels in all the trigger cells
|
---|
143 | //
|
---|
144 | // no option:
|
---|
145 | // Print the value of the selection parameters
|
---|
146 | //
|
---|
147 | //
|
---|
148 | void MMcTriggerLvl2::Print(Option_t *opt) const
|
---|
149 | {
|
---|
150 | TString str(opt);
|
---|
151 |
|
---|
152 | if (str.Contains("status", TString::kIgnoreCase))
|
---|
153 | {
|
---|
154 | *fLog << " Status of cells 1-9" <<endl;
|
---|
155 | for(int i=0; i<36; i++)
|
---|
156 | {
|
---|
157 | for(int j=0; j<9; j++)
|
---|
158 | {
|
---|
159 | // *fLog.width(3);
|
---|
160 | *fLog <<pixels_in_cell[i][j]-1 << ":" << fPixels[i][j] << "\t ";
|
---|
161 | }
|
---|
162 | *fLog << endl;
|
---|
163 | }
|
---|
164 | }
|
---|
165 | else if (str.Contains("cell", TString::kIgnoreCase))
|
---|
166 | {
|
---|
167 | *fLog << " Pixel numbering in cells 1-9" <<endl;
|
---|
168 | for (int i=0;i<36;i++)
|
---|
169 | {
|
---|
170 | for(int j=0; j<9; j++)
|
---|
171 | {
|
---|
172 | *fLog << pixels_in_cell[i][j]-1 << "\t";
|
---|
173 | }
|
---|
174 | *fLog << endl;
|
---|
175 | }
|
---|
176 | }
|
---|
177 | else
|
---|
178 | {
|
---|
179 | *fLog << " L2T selection parameters:" << endl;
|
---|
180 | *fLog << " - LutPseudoSize = " << fLutPseudoSize << endl;
|
---|
181 | *fLog << " - PseudoSize = " << fPseudoSize << endl;
|
---|
182 | *fLog << " - BiggerCellSize = " << fSizeBiggerCell << endl;
|
---|
183 | }
|
---|
184 |
|
---|
185 | }
|
---|
186 |
|
---|
187 | // --------------------------------------------------------------------------
|
---|
188 | //
|
---|
189 | // Take the information supplied by the Lvl1 (it reads from the object MMcTrig
|
---|
190 | // the status of all pixels after Lvl1) and pass it to the Lvl2 (fill the
|
---|
191 | // array fPixels)
|
---|
192 | //
|
---|
193 | //
|
---|
194 | void MMcTriggerLvl2::SetLv1(MMcTrig *trig)
|
---|
195 | {
|
---|
196 | if (!trig)
|
---|
197 | return;
|
---|
198 |
|
---|
199 | fMcTrig = trig;
|
---|
200 |
|
---|
201 | //fMcTrig->PrintPixelsFirstLevel();
|
---|
202 |
|
---|
203 | for(int i=0; i<36; i++)
|
---|
204 | {
|
---|
205 | for(int j=0; j<19; j++)
|
---|
206 | {
|
---|
207 | int pixel = pixels_in_cell[i][j]-1;
|
---|
208 | fPixels[i][j] = (fMcTrig->IsPixelFired(pixel,0)) ? 1 : 0;
|
---|
209 | }
|
---|
210 | }
|
---|
211 | }
|
---|
212 |
|
---|
213 |
|
---|
214 | // --------------------------------------------------------------------------
|
---|
215 | //
|
---|
216 | // Set the trigger status ( pixel fired(=1) or not(=0) ) manually for a given
|
---|
217 | // pixel of a given cell
|
---|
218 | //
|
---|
219 | //
|
---|
220 | void MMcTriggerLvl2::SetPixelFired(Int_t pixel, Int_t fired)
|
---|
221 | {
|
---|
222 | for(int i=0; i<36; i++)
|
---|
223 | {
|
---|
224 | for(int j=0; j<19; j++)
|
---|
225 | {
|
---|
226 | if(pixels_in_cell[i][j]-1==pixel) fPixels[i][j]=fired;
|
---|
227 | }
|
---|
228 | }
|
---|
229 |
|
---|
230 | }
|
---|
231 |
|
---|
232 | // --------------------------------------------------------------------------
|
---|
233 | //
|
---|
234 | // Calculate the Level 2 Trigger (L2T) parameters. They can be used
|
---|
235 | // to select the events that have passed the L2T selection rule.
|
---|
236 | //
|
---|
237 | //
|
---|
238 | void MMcTriggerLvl2::Calc(int neighpix)
|
---|
239 | {
|
---|
240 | // Find the Lut and cell with the higher LutPseudoSize.
|
---|
241 | int lutcell = CalcBiggerLutPseudoSize(neighpix);
|
---|
242 | int maxcell = lutcell/10;
|
---|
243 | int maxlut = lutcell-maxcell*10;
|
---|
244 | fLutPseudoSize = GetLutCompactPixel(maxcell,maxlut,neighpix);
|
---|
245 |
|
---|
246 | fPseudoSize = CalcPseudoSize(neighpix);
|
---|
247 |
|
---|
248 | fSizeBiggerCell = GetCellNumberFired(CalcBiggerFiredCell());
|
---|
249 |
|
---|
250 |
|
---|
251 | }
|
---|
252 |
|
---|
253 |
|
---|
254 | // --------------------------------------------------------------------------
|
---|
255 | //
|
---|
256 | // Display the MAGIC Camera a draw the pixels corresponding to a given cell
|
---|
257 | // (preliminary) <to be fixed>
|
---|
258 | //
|
---|
259 | void MMcTriggerLvl2::DrawCell(Int_t cell)
|
---|
260 | {
|
---|
261 |
|
---|
262 | if(cell>18) return;
|
---|
263 |
|
---|
264 | //
|
---|
265 | // Use MCamDisplay class variable for avoiding to create a MCamDisplay each
|
---|
266 | // time this function is called. Also, now all the hexagons are drawn in
|
---|
267 | // the same camera pad
|
---|
268 | //
|
---|
269 | if (!fGeomcam)
|
---|
270 | fGeomcam = new MGeomCamMagic;
|
---|
271 | if (!fCam)
|
---|
272 | {
|
---|
273 | fCam = new MCamDisplay(fGeomcam);
|
---|
274 | fCam->Draw();
|
---|
275 | fCam->DrawPixelNumbers();
|
---|
276 | }
|
---|
277 |
|
---|
278 | //fCam->Draw();
|
---|
279 | fCam->Reset();
|
---|
280 |
|
---|
281 | int color=0;
|
---|
282 |
|
---|
283 | for(int i=0; i<36; i++)
|
---|
284 | {
|
---|
285 | color = (fPixels[i][cell]) ? 5 : 3;
|
---|
286 | fCam->SetPix( pixels_in_cell[i][cell]-1, color, 1, 5 );
|
---|
287 | }
|
---|
288 |
|
---|
289 | //
|
---|
290 | // Update the display (paint the camera with the new colors)
|
---|
291 | //
|
---|
292 | gPad->Modified();
|
---|
293 | gPad->Update();
|
---|
294 | }
|
---|
295 |
|
---|
296 |
|
---|
297 |
|
---|
298 | // --------------------------------------------------------------------------
|
---|
299 | //
|
---|
300 | // Display the MAGIC camera and draw all the pixel fired after Lvl1
|
---|
301 | // (preliminary) <to be fixed>
|
---|
302 | //
|
---|
303 | //
|
---|
304 | void MMcTriggerLvl2::DrawLv1()
|
---|
305 | {
|
---|
306 | //
|
---|
307 | // Use MCamDisplay class variable for avoiding to create a MCamDisplay each
|
---|
308 | // time this function is called. Also, now all the hexagons are drawn in
|
---|
309 | // the same camera pad
|
---|
310 | //
|
---|
311 | // !FixMe! Delete this method when the trigger display is available!
|
---|
312 | //
|
---|
313 | if (!fGeomcam)
|
---|
314 | fGeomcam = new MGeomCamMagic;
|
---|
315 | if (!fCam)
|
---|
316 | {
|
---|
317 | fCam = new MCamDisplay(fGeomcam);
|
---|
318 | fCam->Draw();
|
---|
319 | fCam->DrawPixelNumbers();
|
---|
320 | }
|
---|
321 |
|
---|
322 | //fCam->Draw();
|
---|
323 | //fCam->Reset();
|
---|
324 |
|
---|
325 | //
|
---|
326 | // Set the array of colors for each pixel (that will be painted after
|
---|
327 | // updating the dispaly)
|
---|
328 | //
|
---|
329 | int color=0;
|
---|
330 |
|
---|
331 | for(int i=0; i<577; i++)
|
---|
332 | {
|
---|
333 | color = (fMcTrig->IsPixelFired(i,0)) ? 5 : 3;
|
---|
334 | fCam->SetPix( i, color, 1, 5 );
|
---|
335 | }
|
---|
336 |
|
---|
337 | //
|
---|
338 | // Update the display (paint the camera with the new colors)
|
---|
339 | //
|
---|
340 | gPad->Modified();
|
---|
341 | gPad->Update();
|
---|
342 |
|
---|
343 | }
|
---|
344 |
|
---|
345 | // --------------------------------------------------------------------------
|
---|
346 | //
|
---|
347 | // For a given cell, just count how many pixels have been fired after Lvl1
|
---|
348 | //
|
---|
349 | Int_t MMcTriggerLvl2::GetCellNumberFired(int cell)
|
---|
350 | {
|
---|
351 | int size=0;
|
---|
352 |
|
---|
353 | for(int i=0; i<36; i++)
|
---|
354 | {
|
---|
355 | size += fPixels[i][cell];
|
---|
356 | }
|
---|
357 |
|
---|
358 | return size;
|
---|
359 |
|
---|
360 | }
|
---|
361 |
|
---|
362 |
|
---|
363 | // --------------------------------------------------------------------------
|
---|
364 | //
|
---|
365 | // Find the cell which the bigger number of fired pixels
|
---|
366 | //
|
---|
367 | //
|
---|
368 | Int_t MMcTriggerLvl2::CalcBiggerFiredCell()
|
---|
369 | {
|
---|
370 | int size=-1;
|
---|
371 | int cell=-1;
|
---|
372 |
|
---|
373 | for(int j=0; j<19; j++)
|
---|
374 | {
|
---|
375 | if (GetCellNumberFired(j) > size)
|
---|
376 | {
|
---|
377 | size = GetCellNumberFired(j);
|
---|
378 | cell = j;
|
---|
379 | }
|
---|
380 | }
|
---|
381 |
|
---|
382 | // *fLog << "size " <<size <<" in cell " << cell << endl;
|
---|
383 |
|
---|
384 | return cell;
|
---|
385 |
|
---|
386 | }
|
---|
387 |
|
---|
388 | // --------------------------------------------------------------------------
|
---|
389 | //
|
---|
390 | // Calculate the higher LutPseudoSize of one event defined as the higher number
|
---|
391 | // of compact pixel in the LUTs of the trigger cells.
|
---|
392 | // neighpix is the number of Next-Neighbors which defines the compact pixel
|
---|
393 | // topology (it can be 2-NN or 3-NN)
|
---|
394 | //
|
---|
395 | // It returns the cell and the LUT with the bigger LutPseudoSize, coded
|
---|
396 | // accordingly to: cell*10 + LUT
|
---|
397 | //
|
---|
398 | Int_t MMcTriggerLvl2::CalcBiggerLutPseudoSize(int neighpix)
|
---|
399 | {
|
---|
400 | int size=0;
|
---|
401 | int cell=-1;
|
---|
402 | int lut=-1;
|
---|
403 |
|
---|
404 | // only cases neighpix=2,3 (2NN,3NN) are considered
|
---|
405 | if (neighpix >3 || neighpix < 2) return(-1);
|
---|
406 |
|
---|
407 | for(int j=0; j<19; j++)
|
---|
408 | {
|
---|
409 | for(int i=0; i<3; i++)
|
---|
410 | {
|
---|
411 | if (GetLutCompactPixel(j,i,neighpix) > size)
|
---|
412 | {
|
---|
413 | size = GetLutCompactPixel(j,i,neighpix);
|
---|
414 | cell = j;
|
---|
415 | lut = i;
|
---|
416 | }
|
---|
417 | }
|
---|
418 | }
|
---|
419 |
|
---|
420 | // *fLog <<"Max cell: " << cell+1 << " Max Lut: " << lut+1 << " PseudoSize: " << size <<endl;
|
---|
421 |
|
---|
422 |
|
---|
423 | return cell*10+lut;
|
---|
424 | }
|
---|
425 |
|
---|
426 |
|
---|
427 | // --------------------------------------------------------------------------
|
---|
428 | //
|
---|
429 | // Identify compact pixels in one LUT and calculate the LutPseudoSize
|
---|
430 | // (=number of compact pixels in one LUT)
|
---|
431 | // neighpix is the number of Next-Neighbors which defines the compact pixel
|
---|
432 | // topology.
|
---|
433 | // Up to now only 2NN or 3NN are considered
|
---|
434 | // if changed: change also GetBiggerLutPseudoSize
|
---|
435 | //
|
---|
436 | // Returns:
|
---|
437 | // -1 wrong neighpix
|
---|
438 | // -2 wrong cell (<1 or >19)
|
---|
439 | // -3 wrong lut (<1 or >3)
|
---|
440 | // else:
|
---|
441 | // the number of compact pixels in one LUT.
|
---|
442 | //
|
---|
443 | Int_t MMcTriggerLvl2::GetLutCompactPixel(int cell, int lut, int neighpix)
|
---|
444 | {
|
---|
445 | int size=0;
|
---|
446 | int lutpix, a[12];
|
---|
447 |
|
---|
448 | if (neighpix >3 || neighpix < 2)
|
---|
449 | return(-1);
|
---|
450 |
|
---|
451 | if (cell<0 || cell>18)
|
---|
452 | return(-2);
|
---|
453 |
|
---|
454 | if (lut<0 || lut>2)
|
---|
455 | return(-3);
|
---|
456 |
|
---|
457 |
|
---|
458 | // LUT 1 and 2 are similar; LUT 3 differs
|
---|
459 |
|
---|
460 | for(int j=0; j<12; j++)
|
---|
461 | {
|
---|
462 | lutpix = pixels_in_lut[lut][j]-1;
|
---|
463 | // *fLog << "j=" <<j<<" lutpix="<<lutpix<<" Cell="<<cell<<endl;
|
---|
464 | a[j] = fPixels[lutpix][cell];
|
---|
465 | }
|
---|
466 |
|
---|
467 | //
|
---|
468 | // Look for compact pixels 2NN
|
---|
469 | //
|
---|
470 | if (neighpix==2)
|
---|
471 | {
|
---|
472 | // case Lut 1 and 2
|
---|
473 | if (lut == 0 || lut == 1)
|
---|
474 | {
|
---|
475 | if (a[0] && a[1] && a[4])
|
---|
476 | size ++;
|
---|
477 | if (a[1] && ((a[0] && a[4]) ||
|
---|
478 | (a[4] && a[5]) ||
|
---|
479 | (a[5] && a[2]) ))
|
---|
480 | size ++;
|
---|
481 | if (a[2] && ((a[1] && a[5]) ||
|
---|
482 | (a[5] && a[6]) ||
|
---|
483 | (a[6] && a[3]) ))
|
---|
484 | size ++;
|
---|
485 | if (a[3] && ((a[2] && a[6]) ||
|
---|
486 | (a[6] && a[7]) ))
|
---|
487 | size ++;
|
---|
488 | if (a[4] && ((a[0] && a[1]) ||
|
---|
489 | (a[1] && a[5]) ||
|
---|
490 | (a[5] && a[8]) ))
|
---|
491 | size ++;
|
---|
492 | if (a[5] && ((a[1] && a[2]) ||
|
---|
493 | (a[2] && a[6]) ||
|
---|
494 | (a[6] && a[9]) ||
|
---|
495 | (a[9] && a[8]) ||
|
---|
496 | (a[8] && a[4]) ||
|
---|
497 | (a[4] && a[1]) ))
|
---|
498 | size ++;
|
---|
499 | if (a[6] && ((a[2] && a[3]) ||
|
---|
500 | (a[3] && a[7]) ||
|
---|
501 | (a[7] && a[10]) ||
|
---|
502 | (a[10] && a[9]) ||
|
---|
503 | (a[9] && a[5]) ||
|
---|
504 | (a[5] && a[2]) ))
|
---|
505 | size ++;
|
---|
506 | if (a[7] && ((a[3] && a[6]) ||
|
---|
507 | (a[6] && a[10]) ||
|
---|
508 | (a[10] && a[11]) ))
|
---|
509 | size ++;
|
---|
510 | if (a[8] && ((a[4] && a[5]) ||
|
---|
511 | (a[5] && a[9]) ))
|
---|
512 | size ++;
|
---|
513 | if (a[9] && ((a[8] && a[5]) ||
|
---|
514 | (a[5] && a[6]) ||
|
---|
515 | (a[6] && a[10]) ))
|
---|
516 | size ++;
|
---|
517 | if (a[10] && ((a[9] && a[6]) ||
|
---|
518 | (a[6] && a[7]) ||
|
---|
519 | (a[7] && a[11]) ))
|
---|
520 | size ++;
|
---|
521 | if (a[11] && a[7] && a[10])
|
---|
522 | size ++;
|
---|
523 | }
|
---|
524 |
|
---|
525 | // case Lut 3
|
---|
526 | if (lut==2)
|
---|
527 | {
|
---|
528 | if (a[0] && a[1] && a[5])
|
---|
529 | size ++;
|
---|
530 | if (a[1] && ((a[0] && a[5]) ||
|
---|
531 | (a[5] && a[2]) ))
|
---|
532 | size ++;
|
---|
533 | if (a[2] && ((a[1] && a[5]) ||
|
---|
534 | (a[5] && a[6]) ||
|
---|
535 | (a[3] && a[4]) ||
|
---|
536 | (a[6] && a[3]) ))
|
---|
537 | size ++;
|
---|
538 | if (a[3] && ((a[2] && a[6]) ||
|
---|
539 | (a[6] && a[7]) ||
|
---|
540 | (a[2] && a[4]) ))
|
---|
541 | size ++;
|
---|
542 | if (a[4] && ((a[2] && a[3]) ))
|
---|
543 | size ++;
|
---|
544 | if (a[5] && ((a[1] && a[2]) ||
|
---|
545 | (a[2] && a[6]) ||
|
---|
546 | (a[6] && a[9]) ||
|
---|
547 | (a[9] && a[8]) ))
|
---|
548 | size ++;
|
---|
549 | if (a[6] && ((a[2] && a[3]) ||
|
---|
550 | (a[3] && a[7]) ||
|
---|
551 | (a[7] && a[10]) ||
|
---|
552 | (a[10] && a[9]) ||
|
---|
553 | (a[9] && a[5]) ||
|
---|
554 | (a[5] && a[2]) ))
|
---|
555 | size ++;
|
---|
556 | if (a[7] && ((a[3] && a[6]) ||
|
---|
557 | (a[6] && a[10]) ||
|
---|
558 | (a[10] && a[11]) ))
|
---|
559 | size ++;
|
---|
560 | if (a[8] && a[5] && a[9])
|
---|
561 | size ++;
|
---|
562 | if (a[9] && ((a[8] && a[5]) ||
|
---|
563 | (a[5] && a[6]) ||
|
---|
564 | (a[6] && a[10]) ))
|
---|
565 | size ++;
|
---|
566 | if (a[10] && ((a[9] && a[6]) ||
|
---|
567 | (a[6] && a[7]) ||
|
---|
568 | (a[7] && a[11]) ))
|
---|
569 | size ++;
|
---|
570 | if (a[11] && a[7] && a[10])
|
---|
571 | size ++;
|
---|
572 | }
|
---|
573 | }
|
---|
574 |
|
---|
575 | //
|
---|
576 | // Look for compact pixels 3NN
|
---|
577 | //
|
---|
578 | if (neighpix==3)
|
---|
579 | {
|
---|
580 | // case Lut 1 and 2
|
---|
581 | if (lut == 0 || lut == 1)
|
---|
582 | {
|
---|
583 | if (a[0] && a[1] && a[4] && a[5]) // pix 0 is compact if there is a 4NN
|
---|
584 | size ++;
|
---|
585 | if (a[1] && ((a[0] && a[4] && a[5]) ||
|
---|
586 | (a[2] && a[4] && a[5]) ))
|
---|
587 | size ++;
|
---|
588 | if (a[2] && ((a[1] && a[5] && a[6]) ||
|
---|
589 | (a[5] && a[6] && a[3]) ))
|
---|
590 | size ++;
|
---|
591 | if (a[3] && (a[2] && a[6] && a[7] ))
|
---|
592 | size ++;
|
---|
593 | if (a[4] && ((a[0] && a[1] && a[5]) ||
|
---|
594 | (a[1] && a[5] && a[8]) ))
|
---|
595 | size ++;
|
---|
596 | if (a[5] && ((a[1] && a[2] && a[6]) ||
|
---|
597 | (a[2] && a[6] && a[9]) ||
|
---|
598 | (a[6] && a[9] && a[8]) ||
|
---|
599 | (a[9] && a[8] && a[4]) ||
|
---|
600 | (a[8] && a[4] && a[1]) ||
|
---|
601 | (a[4] && a[1] && a[2]) ))
|
---|
602 | size ++;
|
---|
603 | if (a[6] && ((a[2] && a[3] && a[7]) ||
|
---|
604 | (a[3] && a[7] && a[10]) ||
|
---|
605 | (a[7] && a[10] && a[9]) ||
|
---|
606 | (a[10] && a[9] && a[5]) ||
|
---|
607 | (a[9] && a[5] && a[2]) ||
|
---|
608 | (a[5] && a[2] && a[3]) ))
|
---|
609 | size ++;
|
---|
610 | if (a[7] && ((a[3] && a[6] && a[10]) ||
|
---|
611 | (a[6] && a[10] && a[11]) ))
|
---|
612 | size ++;
|
---|
613 | if (a[8] && (a[4] && a[5] && a[9] ))
|
---|
614 | size ++;
|
---|
615 | if (a[9] && ((a[8] && a[5] && a[6]) ||
|
---|
616 | (a[5] && a[6] && a[10]) ))
|
---|
617 | size ++;
|
---|
618 | if (a[10] && ((a[9] && a[6] && a[7]) ||
|
---|
619 | (a[6] && a[7] && a[11]) ))
|
---|
620 | size ++;
|
---|
621 | if (a[11] && a[7] && a[10] && a[6]) //pix 0 is compact if there is a 4NN
|
---|
622 | size ++;
|
---|
623 | }
|
---|
624 |
|
---|
625 | // case Lut 3
|
---|
626 | if (lut==2)
|
---|
627 | {
|
---|
628 | if (a[0] && a[1] && a[5] && a[8]) // pix 0 is compact if there is a 4NN
|
---|
629 | size ++;
|
---|
630 | if (a[1] && (a[0] && a[5] && a[2])) //pix 0 is compact if there is a 4NN
|
---|
631 | size ++;
|
---|
632 | if (a[2] && ((a[1] && a[5] && a[6]) ||
|
---|
633 | (a[3] && a[5] && a[6]) ||
|
---|
634 | (a[6] && a[3] && a[4]) ))
|
---|
635 | size ++;
|
---|
636 | if (a[3] && ((a[2] && a[4] && a[6]) ||
|
---|
637 | (a[2] && a[6] && a[7]) ))
|
---|
638 | size ++;
|
---|
639 | if (a[4] && (a[2] && a[3] && a[6] ))
|
---|
640 | size ++;
|
---|
641 | if (a[5] && ((a[1] && a[2] && a[6]) ||
|
---|
642 | (a[2] && a[6] && a[9]) ||
|
---|
643 | (a[6] && a[9] && a[8]) ))
|
---|
644 | size ++;
|
---|
645 | if (a[6] && ((a[2] && a[3] && a[7]) ||
|
---|
646 | (a[3] && a[7] && a[10]) ||
|
---|
647 | (a[7] && a[10] && a[9]) ||
|
---|
648 | (a[10] && a[9] && a[5]) ||
|
---|
649 | (a[9] && a[5] && a[2]) ||
|
---|
650 | (a[5] && a[2] && a[3]) ))
|
---|
651 | size ++;
|
---|
652 | if (a[7] && ((a[3] && a[6] && a[10]) ||
|
---|
653 | (a[6] && a[10] && a[11]) ))
|
---|
654 | size ++;
|
---|
655 | if (a[8] && a[5] && a[9] && a[6]) //pix 0 is compact if there is a 4NN
|
---|
656 | size ++;
|
---|
657 | if (a[9] && ((a[8] && a[5] && a[6]) ||
|
---|
658 | (a[5] && a[6] && a[10]) ))
|
---|
659 | size ++;
|
---|
660 | if (a[10] && ((a[9] && a[6] && a[7]) ||
|
---|
661 | (a[6] && a[7] && a[11]) ))
|
---|
662 | size ++;
|
---|
663 | if (a[11] && a[7] && a[10] && a[6]) //pix 0 is compact if there is a 4NN
|
---|
664 | size ++;
|
---|
665 | }
|
---|
666 | }
|
---|
667 |
|
---|
668 |
|
---|
669 | return size;
|
---|
670 | }
|
---|
671 |
|
---|
672 |
|
---|
673 | // --------------------------------------------------------------------------
|
---|
674 | //
|
---|
675 | // Look for clusters and calculate the PseudoSize of one event,
|
---|
676 | // defined as the multiplicity of the bigger cluster.
|
---|
677 | //
|
---|
678 | // neighpix is the number of Next-Neighbors which defines the compact pixel
|
---|
679 | // topology (it can be 2-NN or 3-NN)
|
---|
680 | //
|
---|
681 | // !Not yet implemented!!
|
---|
682 | //
|
---|
683 | Int_t MMcTriggerLvl2::CalcPseudoSize(int neighpix)
|
---|
684 | {
|
---|
685 | int size=0;
|
---|
686 |
|
---|
687 | return size;
|
---|
688 | }
|
---|
689 |
|
---|