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