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 | // Display the MAGIC Camera a draw the pixels corresponding to a given cell
|
---|
262 | // (preliminary) <to be fixed>
|
---|
263 | //
|
---|
264 | void MMcTriggerLvl2::DrawCell(Int_t cell)
|
---|
265 | {
|
---|
266 |
|
---|
267 | if(cell>18) return;
|
---|
268 |
|
---|
269 | //
|
---|
270 | // Use MCamDisplay class variable for avoiding to create a MCamDisplay each
|
---|
271 | // time this function is called. Also, now all the hexagons are drawn in
|
---|
272 | // the same camera pad
|
---|
273 | //
|
---|
274 | if (!fGeomcam)
|
---|
275 | fGeomcam = new MGeomCamMagic;
|
---|
276 | if (!fCam)
|
---|
277 | {
|
---|
278 | fCam = new MCamDisplay(fGeomcam);
|
---|
279 | fCam->Draw();
|
---|
280 | fCam->DrawPixelNumbers();
|
---|
281 | }
|
---|
282 |
|
---|
283 | //fCam->Draw();
|
---|
284 | fCam->Reset();
|
---|
285 |
|
---|
286 | int color=0;
|
---|
287 |
|
---|
288 | for(int i=0; i<36; i++)
|
---|
289 | {
|
---|
290 | color = (fPixels[i][cell]) ? 5 : 3;
|
---|
291 | fCam->SetPix( pixels_in_cell[i][cell]-1, color, 1, 5 );
|
---|
292 | }
|
---|
293 |
|
---|
294 | //
|
---|
295 | // Update the display (paint the camera with the new colors)
|
---|
296 | //
|
---|
297 | gPad->Modified();
|
---|
298 | gPad->Update();
|
---|
299 | }
|
---|
300 |
|
---|
301 |
|
---|
302 |
|
---|
303 | // --------------------------------------------------------------------------
|
---|
304 | //
|
---|
305 | // Display the MAGIC camera and draw all the pixel fired after Lvl1
|
---|
306 | // (preliminary) <to be fixed>
|
---|
307 | //
|
---|
308 | //
|
---|
309 | void MMcTriggerLvl2::DrawLv1()
|
---|
310 | {
|
---|
311 | //
|
---|
312 | // Use MCamDisplay class variable for avoiding to create a MCamDisplay each
|
---|
313 | // time this function is called. Also, now all the hexagons are drawn in
|
---|
314 | // the same camera pad
|
---|
315 | //
|
---|
316 | // !FixMe! Delete this method when the trigger display is available!
|
---|
317 | //
|
---|
318 | if (!fGeomcam)
|
---|
319 | fGeomcam = new MGeomCamMagic;
|
---|
320 | if (!fCam)
|
---|
321 | {
|
---|
322 | fCam = new MCamDisplay(fGeomcam);
|
---|
323 | fCam->Draw();
|
---|
324 | fCam->DrawPixelNumbers();
|
---|
325 | }
|
---|
326 |
|
---|
327 | //fCam->Draw();
|
---|
328 | //fCam->Reset();
|
---|
329 |
|
---|
330 | //
|
---|
331 | // Set the array of colors for each pixel (that will be painted after
|
---|
332 | // updating the dispaly)
|
---|
333 | //
|
---|
334 | int color=0;
|
---|
335 |
|
---|
336 | for(int i=0; i<577; i++)
|
---|
337 | {
|
---|
338 | color = (fMcTrig->IsPixelFired(i,0)) ? 5 : 3;
|
---|
339 | fCam->SetPix( i, color, 1, 5 );
|
---|
340 | }
|
---|
341 |
|
---|
342 | //
|
---|
343 | // Update the display (paint the camera with the new colors)
|
---|
344 | //
|
---|
345 | gPad->Modified();
|
---|
346 | gPad->Update();
|
---|
347 |
|
---|
348 | }
|
---|
349 |
|
---|
350 | // --------------------------------------------------------------------------
|
---|
351 | //
|
---|
352 | // For a given cell, just count how many pixels have been fired after Lvl1
|
---|
353 | //
|
---|
354 | Int_t MMcTriggerLvl2::GetCellNumberFired(int cell)
|
---|
355 | {
|
---|
356 | int size=0;
|
---|
357 |
|
---|
358 | for(int i=0; i<36; i++)
|
---|
359 | {
|
---|
360 | size += fPixels[i][cell];
|
---|
361 | }
|
---|
362 |
|
---|
363 | return size;
|
---|
364 |
|
---|
365 | }
|
---|
366 |
|
---|
367 |
|
---|
368 | // --------------------------------------------------------------------------
|
---|
369 | //
|
---|
370 | // Find the cell which the bigger number of fired pixels
|
---|
371 | //
|
---|
372 | //
|
---|
373 | Int_t MMcTriggerLvl2::CalcBiggerFiredCell()
|
---|
374 | {
|
---|
375 | int size=-1;
|
---|
376 | int cell=-1;
|
---|
377 |
|
---|
378 | for(int j=0; j<19; j++)
|
---|
379 | {
|
---|
380 | if (GetCellNumberFired(j) > size)
|
---|
381 | {
|
---|
382 | size = GetCellNumberFired(j);
|
---|
383 | cell = j;
|
---|
384 | }
|
---|
385 | }
|
---|
386 |
|
---|
387 | // *fLog << "size " <<size <<" in cell " << cell << endl;
|
---|
388 |
|
---|
389 | return cell;
|
---|
390 |
|
---|
391 | }
|
---|
392 |
|
---|
393 | // --------------------------------------------------------------------------
|
---|
394 | //
|
---|
395 | // Calculate the higher LutPseudoSize of one event defined as the higher number
|
---|
396 | // of compact pixel in the LUTs of the trigger cells.
|
---|
397 | // neighpix is the number of Next-Neighbors which defines the compact pixel
|
---|
398 | // topology (it can be 2-NN or 3-NN)
|
---|
399 | //
|
---|
400 | // It returns the cell and the LUT with the bigger LutPseudoSize, coded
|
---|
401 | // accordingly to: cell*10 + LUT
|
---|
402 | //
|
---|
403 | Int_t MMcTriggerLvl2::CalcBiggerLutPseudoSize(int neighpix)
|
---|
404 | {
|
---|
405 | int size=0;
|
---|
406 | int cell=-1;
|
---|
407 | int lut=-1;
|
---|
408 |
|
---|
409 | for(int j=0; j<19; j++)
|
---|
410 | {
|
---|
411 | for(int i=0; i<3; i++)
|
---|
412 | {
|
---|
413 | if (GetLutCompactPixel(j,i,neighpix) > size)
|
---|
414 | {
|
---|
415 | size = GetLutCompactPixel(j,i,neighpix);
|
---|
416 | cell = j;
|
---|
417 | lut = i;
|
---|
418 | }
|
---|
419 | }
|
---|
420 | }
|
---|
421 |
|
---|
422 | // *fLog <<"Max cell: " << cell+1 << " Max Lut: " << lut+1 << " PseudoSize: " << size <<endl;
|
---|
423 |
|
---|
424 |
|
---|
425 | return cell*10+lut;
|
---|
426 | }
|
---|
427 |
|
---|
428 |
|
---|
429 | // --------------------------------------------------------------------------
|
---|
430 | //
|
---|
431 | // Identify compact pixels in one LUT and calculate the LutPseudoSize
|
---|
432 | // (=number of compact pixels in one LUT)
|
---|
433 | // neighpix is the number of Next-Neighbors which defines the compact pixel
|
---|
434 | // topology.
|
---|
435 | // Up to now only 2NN or 3NN are considered
|
---|
436 | // <!if changed: change check made by Preprocess in MMcTriggerLvl2Calc>
|
---|
437 | //
|
---|
438 | // Returns:
|
---|
439 | // -1 wrong neighpix
|
---|
440 | // -2 wrong cell (<1 or >19)
|
---|
441 | // -3 wrong lut (<1 or >3)
|
---|
442 | // else:
|
---|
443 | // the number of compact pixels in one LUT.
|
---|
444 | //
|
---|
445 | Int_t MMcTriggerLvl2::GetLutCompactPixel(int cell, int lut, int neighpix)
|
---|
446 | {
|
---|
447 | int size=0;
|
---|
448 | int lutpix, a[12];
|
---|
449 |
|
---|
450 | if (neighpix >3 || neighpix < 2)
|
---|
451 | return(-1);
|
---|
452 |
|
---|
453 | if (cell<0 || cell>18)
|
---|
454 | return(-2);
|
---|
455 |
|
---|
456 | if (lut<0 || lut>2)
|
---|
457 | return(-3);
|
---|
458 |
|
---|
459 |
|
---|
460 | // LUT 1 and 2 are similar; LUT 3 differs
|
---|
461 |
|
---|
462 | for(int j=0; j<12; j++)
|
---|
463 | {
|
---|
464 | lutpix = pixels_in_lut[lut][j]-1;
|
---|
465 | // *fLog << "j=" <<j<<" lutpix="<<lutpix<<" Cell="<<cell<<endl;
|
---|
466 | a[j] = fPixels[lutpix][cell];
|
---|
467 | }
|
---|
468 |
|
---|
469 | //
|
---|
470 | // Look for compact pixels 2NN
|
---|
471 | //
|
---|
472 | if (neighpix==2)
|
---|
473 | {
|
---|
474 | // case Lut 1 and 2
|
---|
475 | if (lut == 0 || lut == 1)
|
---|
476 | {
|
---|
477 | if (a[0] && a[1] && a[4])
|
---|
478 | size ++;
|
---|
479 | if (a[1] && ((a[0] && a[4]) ||
|
---|
480 | (a[4] && a[5]) ||
|
---|
481 | (a[5] && a[2]) ))
|
---|
482 | size ++;
|
---|
483 | if (a[2] && ((a[1] && a[5]) ||
|
---|
484 | (a[5] && a[6]) ||
|
---|
485 | (a[6] && a[3]) ))
|
---|
486 | size ++;
|
---|
487 | if (a[3] && ((a[2] && a[6]) ||
|
---|
488 | (a[6] && a[7]) ))
|
---|
489 | size ++;
|
---|
490 | if (a[4] && ((a[0] && a[1]) ||
|
---|
491 | (a[1] && a[5]) ||
|
---|
492 | (a[5] && a[8]) ))
|
---|
493 | size ++;
|
---|
494 | if (a[5] && ((a[1] && a[2]) ||
|
---|
495 | (a[2] && a[6]) ||
|
---|
496 | (a[6] && a[9]) ||
|
---|
497 | (a[9] && a[8]) ||
|
---|
498 | (a[8] && a[4]) ||
|
---|
499 | (a[4] && a[1]) ))
|
---|
500 | size ++;
|
---|
501 | if (a[6] && ((a[2] && a[3]) ||
|
---|
502 | (a[3] && a[7]) ||
|
---|
503 | (a[7] && a[10]) ||
|
---|
504 | (a[10] && a[9]) ||
|
---|
505 | (a[9] && a[5]) ||
|
---|
506 | (a[5] && a[2]) ))
|
---|
507 | size ++;
|
---|
508 | if (a[7] && ((a[3] && a[6]) ||
|
---|
509 | (a[6] && a[10]) ||
|
---|
510 | (a[10] && a[11]) ))
|
---|
511 | size ++;
|
---|
512 | if (a[8] && ((a[4] && a[5]) ||
|
---|
513 | (a[5] && a[9]) ))
|
---|
514 | size ++;
|
---|
515 | if (a[9] && ((a[8] && a[5]) ||
|
---|
516 | (a[5] && a[6]) ||
|
---|
517 | (a[6] && a[10]) ))
|
---|
518 | size ++;
|
---|
519 | if (a[10] && ((a[9] && a[6]) ||
|
---|
520 | (a[6] && a[7]) ||
|
---|
521 | (a[7] && a[11]) ))
|
---|
522 | size ++;
|
---|
523 | if (a[11] && a[7] && a[10])
|
---|
524 | size ++;
|
---|
525 | }
|
---|
526 |
|
---|
527 | // case Lut 3
|
---|
528 | if (lut==2)
|
---|
529 | {
|
---|
530 | if (a[0] && a[1] && a[5])
|
---|
531 | size ++;
|
---|
532 | if (a[1] && ((a[0] && a[5]) ||
|
---|
533 | (a[5] && a[2]) ))
|
---|
534 | size ++;
|
---|
535 | if (a[2] && ((a[1] && a[5]) ||
|
---|
536 | (a[5] && a[6]) ||
|
---|
537 | (a[3] && a[4]) ||
|
---|
538 | (a[6] && a[3]) ))
|
---|
539 | size ++;
|
---|
540 | if (a[3] && ((a[2] && a[6]) ||
|
---|
541 | (a[6] && a[7]) ||
|
---|
542 | (a[2] && a[4]) ))
|
---|
543 | size ++;
|
---|
544 | if (a[4] && ((a[2] && a[3]) ))
|
---|
545 | size ++;
|
---|
546 | if (a[5] && ((a[1] && a[2]) ||
|
---|
547 | (a[2] && a[6]) ||
|
---|
548 | (a[6] && a[9]) ||
|
---|
549 | (a[9] && a[8]) ))
|
---|
550 | size ++;
|
---|
551 | if (a[6] && ((a[2] && a[3]) ||
|
---|
552 | (a[3] && a[7]) ||
|
---|
553 | (a[7] && a[10]) ||
|
---|
554 | (a[10] && a[9]) ||
|
---|
555 | (a[9] && a[5]) ||
|
---|
556 | (a[5] && a[2]) ))
|
---|
557 | size ++;
|
---|
558 | if (a[7] && ((a[3] && a[6]) ||
|
---|
559 | (a[6] && a[10]) ||
|
---|
560 | (a[10] && a[11]) ))
|
---|
561 | size ++;
|
---|
562 | if (a[8] && a[5] && a[9])
|
---|
563 | size ++;
|
---|
564 | if (a[9] && ((a[8] && a[5]) ||
|
---|
565 | (a[5] && a[6]) ||
|
---|
566 | (a[6] && a[10]) ))
|
---|
567 | size ++;
|
---|
568 | if (a[10] && ((a[9] && a[6]) ||
|
---|
569 | (a[6] && a[7]) ||
|
---|
570 | (a[7] && a[11]) ))
|
---|
571 | size ++;
|
---|
572 | if (a[11] && a[7] && a[10])
|
---|
573 | size ++;
|
---|
574 | }
|
---|
575 | }
|
---|
576 |
|
---|
577 | //
|
---|
578 | // Look for compact pixels 3NN
|
---|
579 | //
|
---|
580 | if (neighpix==3)
|
---|
581 | {
|
---|
582 | // case Lut 1 and 2
|
---|
583 | if (lut == 0 || lut == 1)
|
---|
584 | {
|
---|
585 | if (a[0] && a[1] && a[4] && a[5]) // pix 0 is compact if there is a 4NN
|
---|
586 | size ++;
|
---|
587 | if (a[1] && ((a[0] && a[4] && a[5]) ||
|
---|
588 | (a[2] && a[4] && a[5]) ))
|
---|
589 | size ++;
|
---|
590 | if (a[2] && ((a[1] && a[5] && a[6]) ||
|
---|
591 | (a[5] && a[6] && a[3]) ))
|
---|
592 | size ++;
|
---|
593 | if (a[3] && (a[2] && a[6] && a[7] ))
|
---|
594 | size ++;
|
---|
595 | if (a[4] && ((a[0] && a[1] && a[5]) ||
|
---|
596 | (a[1] && a[5] && a[8]) ))
|
---|
597 | size ++;
|
---|
598 | if (a[5] && ((a[1] && a[2] && a[6]) ||
|
---|
599 | (a[2] && a[6] && a[9]) ||
|
---|
600 | (a[6] && a[9] && a[8]) ||
|
---|
601 | (a[9] && a[8] && a[4]) ||
|
---|
602 | (a[8] && a[4] && a[1]) ||
|
---|
603 | (a[4] && a[1] && a[2]) ))
|
---|
604 | size ++;
|
---|
605 | if (a[6] && ((a[2] && a[3] && a[7]) ||
|
---|
606 | (a[3] && a[7] && a[10]) ||
|
---|
607 | (a[7] && a[10] && a[9]) ||
|
---|
608 | (a[10] && a[9] && a[5]) ||
|
---|
609 | (a[9] && a[5] && a[2]) ||
|
---|
610 | (a[5] && a[2] && a[3]) ))
|
---|
611 | size ++;
|
---|
612 | if (a[7] && ((a[3] && a[6] && a[10]) ||
|
---|
613 | (a[6] && a[10] && a[11]) ))
|
---|
614 | size ++;
|
---|
615 | if (a[8] && (a[4] && a[5] && a[9] ))
|
---|
616 | size ++;
|
---|
617 | if (a[9] && ((a[8] && a[5] && a[6]) ||
|
---|
618 | (a[5] && a[6] && a[10]) ))
|
---|
619 | size ++;
|
---|
620 | if (a[10] && ((a[9] && a[6] && a[7]) ||
|
---|
621 | (a[6] && a[7] && a[11]) ))
|
---|
622 | size ++;
|
---|
623 | if (a[11] && a[7] && a[10] && a[6]) //pix 0 is compact if there is a 4NN
|
---|
624 | size ++;
|
---|
625 | }
|
---|
626 |
|
---|
627 | // case Lut 3
|
---|
628 | if (lut==2)
|
---|
629 | {
|
---|
630 | if (a[0] && a[1] && a[5] && a[8]) // pix 0 is compact if there is a 4NN
|
---|
631 | size ++;
|
---|
632 | if (a[1] && (a[0] && a[5] && a[2])) //pix 0 is compact if there is a 4NN
|
---|
633 | size ++;
|
---|
634 | if (a[2] && ((a[1] && a[5] && a[6]) ||
|
---|
635 | (a[3] && a[5] && a[6]) ||
|
---|
636 | (a[6] && a[3] && a[4]) ))
|
---|
637 | size ++;
|
---|
638 | if (a[3] && ((a[2] && a[4] && a[6]) ||
|
---|
639 | (a[2] && a[6] && a[7]) ))
|
---|
640 | size ++;
|
---|
641 | if (a[4] && (a[2] && a[3] && a[6] ))
|
---|
642 | size ++;
|
---|
643 | if (a[5] && ((a[1] && a[2] && a[6]) ||
|
---|
644 | (a[2] && a[6] && a[9]) ||
|
---|
645 | (a[6] && a[9] && a[8]) ))
|
---|
646 | size ++;
|
---|
647 | if (a[6] && ((a[2] && a[3] && a[7]) ||
|
---|
648 | (a[3] && a[7] && a[10]) ||
|
---|
649 | (a[7] && a[10] && a[9]) ||
|
---|
650 | (a[10] && a[9] && a[5]) ||
|
---|
651 | (a[9] && a[5] && a[2]) ||
|
---|
652 | (a[5] && a[2] && a[3]) ))
|
---|
653 | size ++;
|
---|
654 | if (a[7] && ((a[3] && a[6] && a[10]) ||
|
---|
655 | (a[6] && a[10] && a[11]) ))
|
---|
656 | size ++;
|
---|
657 | if (a[8] && a[5] && a[9] && a[6]) //pix 0 is compact if there is a 4NN
|
---|
658 | size ++;
|
---|
659 | if (a[9] && ((a[8] && a[5] && a[6]) ||
|
---|
660 | (a[5] && a[6] && a[10]) ))
|
---|
661 | size ++;
|
---|
662 | if (a[10] && ((a[9] && a[6] && a[7]) ||
|
---|
663 | (a[6] && a[7] && a[11]) ))
|
---|
664 | size ++;
|
---|
665 | if (a[11] && a[7] && a[10] && a[6]) //pix 0 is compact if there is a 4NN
|
---|
666 | size ++;
|
---|
667 | }
|
---|
668 | }
|
---|
669 |
|
---|
670 |
|
---|
671 | return size;
|
---|
672 | }
|
---|
673 |
|
---|
674 |
|
---|
675 | // --------------------------------------------------------------------------
|
---|
676 | //
|
---|
677 | // Look for clusters and calculate the PseudoSize of one event,
|
---|
678 | // defined as the multiplicity of the bigger cluster.
|
---|
679 | //
|
---|
680 | // neighpix is the number of Next-Neighbors which defines the compact pixel
|
---|
681 | // topology (it can be 2-NN or 3-NN)
|
---|
682 | //
|
---|
683 | // !Not yet implemented!!
|
---|
684 | //
|
---|
685 | Int_t MMcTriggerLvl2::CalcPseudoSize(int neighpix)
|
---|
686 | {
|
---|
687 | int size=0;
|
---|
688 |
|
---|
689 | return size;
|
---|
690 | }
|
---|
691 |
|
---|