CMS 3D CMS Logo

Phase2L1RCT.h
Go to the documentation of this file.
1 #ifndef L1Trigger_L1CaloTrigger_Phase2L1RCT
2 #define L1Trigger_L1CaloTrigger_Phase2L1RCT
3 
5 
7 // Other emulator helper functions
9 
11  ap_uint<5> Eta = 0x0;
12  ap_uint<5> Phi = 0x0;
13 
15 
16  out.etaStrip0.cr0.energy = temporary[Eta + 0][Phi + 0].energy;
17  out.etaStrip0.cr0.eta = 0;
18  out.etaStrip0.cr0.phi = 0;
19  out.etaStrip0.cr1.energy = temporary[Eta + 0][Phi + 1].energy;
20  out.etaStrip0.cr1.eta = 0;
21  out.etaStrip0.cr1.phi = 1;
22  out.etaStrip0.cr2.energy = temporary[Eta + 0][Phi + 2].energy;
23  out.etaStrip0.cr2.eta = 0;
24  out.etaStrip0.cr2.phi = 2;
25  out.etaStrip0.cr3.energy = temporary[Eta + 0][Phi + 3].energy;
26  out.etaStrip0.cr3.eta = 0;
27  out.etaStrip0.cr3.phi = 3;
28  out.etaStrip0.cr4.energy = temporary[Eta + 0][Phi + 4].energy;
29  out.etaStrip0.cr4.eta = 0;
30  out.etaStrip0.cr4.phi = 4;
31  out.etaStrip0.cr5.energy = temporary[Eta + 0][Phi + 5].energy;
32  out.etaStrip0.cr5.eta = 0;
33  out.etaStrip0.cr5.phi = 5;
34  out.etaStrip0.cr6.energy = temporary[Eta + 0][Phi + 6].energy;
35  out.etaStrip0.cr6.eta = 0;
36  out.etaStrip0.cr6.phi = 6;
37  out.etaStrip0.cr7.energy = temporary[Eta + 0][Phi + 7].energy;
38  out.etaStrip0.cr7.eta = 0;
39  out.etaStrip0.cr7.phi = 7;
40  out.etaStrip0.cr8.energy = temporary[Eta + 0][Phi + 8].energy;
41  out.etaStrip0.cr8.eta = 0;
42  out.etaStrip0.cr8.phi = 8;
43  out.etaStrip0.cr9.energy = temporary[Eta + 0][Phi + 9].energy;
44  out.etaStrip0.cr9.eta = 0;
45  out.etaStrip0.cr9.phi = 9;
46  out.etaStrip0.cr10.energy = temporary[Eta + 0][Phi + 10].energy;
47  out.etaStrip0.cr10.eta = 0;
48  out.etaStrip0.cr10.phi = 10;
49  out.etaStrip0.cr11.energy = temporary[Eta + 0][Phi + 11].energy;
50  out.etaStrip0.cr11.eta = 0;
51  out.etaStrip0.cr11.phi = 11;
52  out.etaStrip0.cr12.energy = temporary[Eta + 0][Phi + 12].energy;
53  out.etaStrip0.cr12.eta = 0;
54  out.etaStrip0.cr12.phi = 12;
55  out.etaStrip0.cr13.energy = temporary[Eta + 0][Phi + 13].energy;
56  out.etaStrip0.cr13.eta = 0;
57  out.etaStrip0.cr13.phi = 13;
58  out.etaStrip0.cr14.energy = temporary[Eta + 0][Phi + 14].energy;
59  out.etaStrip0.cr14.eta = 0;
60  out.etaStrip0.cr14.phi = 14;
61  out.etaStrip0.cr15.energy = temporary[Eta + 0][Phi + 15].energy;
62  out.etaStrip0.cr15.eta = 0;
63  out.etaStrip0.cr15.phi = 15;
64  out.etaStrip0.cr16.energy = temporary[Eta + 0][Phi + 16].energy;
65  out.etaStrip0.cr16.eta = 0;
66  out.etaStrip0.cr16.phi = 16;
67  out.etaStrip0.cr17.energy = temporary[Eta + 0][Phi + 17].energy;
68  out.etaStrip0.cr17.eta = 0;
69  out.etaStrip0.cr17.phi = 17;
70  out.etaStrip0.cr18.energy = temporary[Eta + 0][Phi + 18].energy;
71  out.etaStrip0.cr18.eta = 0;
72  out.etaStrip0.cr18.phi = 18;
73  out.etaStrip0.cr19.energy = temporary[Eta + 0][Phi + 19].energy;
74  out.etaStrip0.cr19.eta = 0;
75  out.etaStrip0.cr19.phi = 19;
76 
77  out.etaStrip1.cr0.energy = temporary[Eta + 1][Phi + 0].energy;
78  out.etaStrip1.cr0.eta = 1;
79  out.etaStrip1.cr0.phi = 0;
80  out.etaStrip1.cr1.energy = temporary[Eta + 1][Phi + 1].energy;
81  out.etaStrip1.cr1.eta = 1;
82  out.etaStrip1.cr1.phi = 1;
83  out.etaStrip1.cr2.energy = temporary[Eta + 1][Phi + 2].energy;
84  out.etaStrip1.cr2.eta = 1;
85  out.etaStrip1.cr2.phi = 2;
86  out.etaStrip1.cr3.energy = temporary[Eta + 1][Phi + 3].energy;
87  out.etaStrip1.cr3.eta = 1;
88  out.etaStrip1.cr3.phi = 3;
89  out.etaStrip1.cr4.energy = temporary[Eta + 1][Phi + 4].energy;
90  out.etaStrip1.cr4.eta = 1;
91  out.etaStrip1.cr4.phi = 4;
92  out.etaStrip1.cr5.energy = temporary[Eta + 1][Phi + 5].energy;
93  out.etaStrip1.cr5.eta = 1;
94  out.etaStrip1.cr5.phi = 5;
95  out.etaStrip1.cr6.energy = temporary[Eta + 1][Phi + 6].energy;
96  out.etaStrip1.cr6.eta = 1;
97  out.etaStrip1.cr6.phi = 6;
98  out.etaStrip1.cr7.energy = temporary[Eta + 1][Phi + 7].energy;
99  out.etaStrip1.cr7.eta = 1;
100  out.etaStrip1.cr7.phi = 7;
101  out.etaStrip1.cr8.energy = temporary[Eta + 1][Phi + 8].energy;
102  out.etaStrip1.cr8.eta = 1;
103  out.etaStrip1.cr8.phi = 8;
104  out.etaStrip1.cr9.energy = temporary[Eta + 1][Phi + 9].energy;
105  out.etaStrip1.cr9.eta = 1;
106  out.etaStrip1.cr9.phi = 9;
107  out.etaStrip1.cr10.energy = temporary[Eta + 1][Phi + 10].energy;
108  out.etaStrip1.cr10.eta = 1;
109  out.etaStrip1.cr10.phi = 10;
110  out.etaStrip1.cr11.energy = temporary[Eta + 1][Phi + 11].energy;
111  out.etaStrip1.cr11.eta = 1;
112  out.etaStrip1.cr11.phi = 11;
113  out.etaStrip1.cr12.energy = temporary[Eta + 1][Phi + 12].energy;
114  out.etaStrip1.cr12.eta = 1;
115  out.etaStrip1.cr12.phi = 12;
116  out.etaStrip1.cr13.energy = temporary[Eta + 1][Phi + 13].energy;
117  out.etaStrip1.cr13.eta = 1;
118  out.etaStrip1.cr13.phi = 13;
119  out.etaStrip1.cr14.energy = temporary[Eta + 1][Phi + 14].energy;
120  out.etaStrip1.cr14.eta = 1;
121  out.etaStrip1.cr14.phi = 14;
122  out.etaStrip1.cr15.energy = temporary[Eta + 1][Phi + 15].energy;
123  out.etaStrip1.cr15.eta = 1;
124  out.etaStrip1.cr15.phi = 15;
125  out.etaStrip1.cr16.energy = temporary[Eta + 1][Phi + 16].energy;
126  out.etaStrip1.cr16.eta = 1;
127  out.etaStrip1.cr16.phi = 16;
128  out.etaStrip1.cr17.energy = temporary[Eta + 1][Phi + 17].energy;
129  out.etaStrip1.cr17.eta = 1;
130  out.etaStrip1.cr17.phi = 17;
131  out.etaStrip1.cr18.energy = temporary[Eta + 1][Phi + 18].energy;
132  out.etaStrip1.cr18.eta = 1;
133  out.etaStrip1.cr18.phi = 18;
134  out.etaStrip1.cr19.energy = temporary[Eta + 1][Phi + 19].energy;
135  out.etaStrip1.cr19.eta = 1;
136  out.etaStrip1.cr19.phi = 19;
137 
138  out.etaStrip2.cr0.energy = temporary[Eta + 2][Phi + 0].energy;
139  out.etaStrip2.cr0.eta = 2;
140  out.etaStrip2.cr0.phi = 0;
141  out.etaStrip2.cr1.energy = temporary[Eta + 2][Phi + 1].energy;
142  out.etaStrip2.cr1.eta = 2;
143  out.etaStrip2.cr1.phi = 1;
144  out.etaStrip2.cr2.energy = temporary[Eta + 2][Phi + 2].energy;
145  out.etaStrip2.cr2.eta = 2;
146  out.etaStrip2.cr2.phi = 2;
147  out.etaStrip2.cr3.energy = temporary[Eta + 2][Phi + 3].energy;
148  out.etaStrip2.cr3.eta = 2;
149  out.etaStrip2.cr3.phi = 3;
150  out.etaStrip2.cr4.energy = temporary[Eta + 2][Phi + 4].energy;
151  out.etaStrip2.cr4.eta = 2;
152  out.etaStrip2.cr4.phi = 4;
153  out.etaStrip2.cr5.energy = temporary[Eta + 2][Phi + 5].energy;
154  out.etaStrip2.cr5.eta = 2;
155  out.etaStrip2.cr5.phi = 5;
156  out.etaStrip2.cr6.energy = temporary[Eta + 2][Phi + 6].energy;
157  out.etaStrip2.cr6.eta = 2;
158  out.etaStrip2.cr6.phi = 6;
159  out.etaStrip2.cr7.energy = temporary[Eta + 2][Phi + 7].energy;
160  out.etaStrip2.cr7.eta = 2;
161  out.etaStrip2.cr7.phi = 7;
162  out.etaStrip2.cr8.energy = temporary[Eta + 2][Phi + 8].energy;
163  out.etaStrip2.cr8.eta = 2;
164  out.etaStrip2.cr8.phi = 8;
165  out.etaStrip2.cr9.energy = temporary[Eta + 2][Phi + 9].energy;
166  out.etaStrip2.cr9.eta = 2;
167  out.etaStrip2.cr9.phi = 9;
168  out.etaStrip2.cr10.energy = temporary[Eta + 2][Phi + 10].energy;
169  out.etaStrip2.cr10.eta = 2;
170  out.etaStrip2.cr10.phi = 10;
171  out.etaStrip2.cr11.energy = temporary[Eta + 2][Phi + 11].energy;
172  out.etaStrip2.cr11.eta = 2;
173  out.etaStrip2.cr11.phi = 11;
174  out.etaStrip2.cr12.energy = temporary[Eta + 2][Phi + 12].energy;
175  out.etaStrip2.cr12.eta = 2;
176  out.etaStrip2.cr12.phi = 12;
177  out.etaStrip2.cr13.energy = temporary[Eta + 2][Phi + 13].energy;
178  out.etaStrip2.cr13.eta = 2;
179  out.etaStrip2.cr13.phi = 13;
180  out.etaStrip2.cr14.energy = temporary[Eta + 2][Phi + 14].energy;
181  out.etaStrip2.cr14.eta = 2;
182  out.etaStrip2.cr14.phi = 14;
183  out.etaStrip2.cr15.energy = temporary[Eta + 2][Phi + 15].energy;
184  out.etaStrip2.cr15.eta = 2;
185  out.etaStrip2.cr15.phi = 15;
186  out.etaStrip2.cr16.energy = temporary[Eta + 2][Phi + 16].energy;
187  out.etaStrip2.cr16.eta = 2;
188  out.etaStrip2.cr16.phi = 16;
189  out.etaStrip2.cr17.energy = temporary[Eta + 2][Phi + 17].energy;
190  out.etaStrip2.cr17.eta = 2;
191  out.etaStrip2.cr17.phi = 17;
192  out.etaStrip2.cr18.energy = temporary[Eta + 2][Phi + 18].energy;
193  out.etaStrip2.cr18.eta = 2;
194  out.etaStrip2.cr18.phi = 18;
195  out.etaStrip2.cr19.energy = temporary[Eta + 2][Phi + 19].energy;
196  out.etaStrip2.cr19.eta = 2;
197  out.etaStrip2.cr19.phi = 19;
198 
199  out.etaStrip3.cr0.energy = temporary[Eta + 3][Phi + 0].energy;
200  out.etaStrip3.cr0.eta = 3;
201  out.etaStrip3.cr0.phi = 0;
202  out.etaStrip3.cr1.energy = temporary[Eta + 3][Phi + 1].energy;
203  out.etaStrip3.cr1.eta = 3;
204  out.etaStrip3.cr1.phi = 1;
205  out.etaStrip3.cr2.energy = temporary[Eta + 3][Phi + 2].energy;
206  out.etaStrip3.cr2.eta = 3;
207  out.etaStrip3.cr2.phi = 2;
208  out.etaStrip3.cr3.energy = temporary[Eta + 3][Phi + 3].energy;
209  out.etaStrip3.cr3.eta = 3;
210  out.etaStrip3.cr3.phi = 3;
211  out.etaStrip3.cr4.energy = temporary[Eta + 3][Phi + 4].energy;
212  out.etaStrip3.cr4.eta = 3;
213  out.etaStrip3.cr4.phi = 4;
214  out.etaStrip3.cr5.energy = temporary[Eta + 3][Phi + 5].energy;
215  out.etaStrip3.cr5.eta = 3;
216  out.etaStrip3.cr5.phi = 5;
217  out.etaStrip3.cr6.energy = temporary[Eta + 3][Phi + 6].energy;
218  out.etaStrip3.cr6.eta = 3;
219  out.etaStrip3.cr6.phi = 6;
220  out.etaStrip3.cr7.energy = temporary[Eta + 3][Phi + 7].energy;
221  out.etaStrip3.cr7.eta = 3;
222  out.etaStrip3.cr7.phi = 7;
223  out.etaStrip3.cr8.energy = temporary[Eta + 3][Phi + 8].energy;
224  out.etaStrip3.cr8.eta = 3;
225  out.etaStrip3.cr8.phi = 8;
226  out.etaStrip3.cr9.energy = temporary[Eta + 3][Phi + 9].energy;
227  out.etaStrip3.cr9.eta = 3;
228  out.etaStrip3.cr9.phi = 9;
229  out.etaStrip3.cr10.energy = temporary[Eta + 3][Phi + 10].energy;
230  out.etaStrip3.cr10.eta = 3;
231  out.etaStrip3.cr10.phi = 10;
232  out.etaStrip3.cr11.energy = temporary[Eta + 3][Phi + 11].energy;
233  out.etaStrip3.cr11.eta = 3;
234  out.etaStrip3.cr11.phi = 11;
235  out.etaStrip3.cr12.energy = temporary[Eta + 3][Phi + 12].energy;
236  out.etaStrip3.cr12.eta = 3;
237  out.etaStrip3.cr12.phi = 12;
238  out.etaStrip3.cr13.energy = temporary[Eta + 3][Phi + 13].energy;
239  out.etaStrip3.cr13.eta = 3;
240  out.etaStrip3.cr13.phi = 13;
241  out.etaStrip3.cr14.energy = temporary[Eta + 3][Phi + 14].energy;
242  out.etaStrip3.cr14.eta = 3;
243  out.etaStrip3.cr14.phi = 14;
244  out.etaStrip3.cr15.energy = temporary[Eta + 3][Phi + 15].energy;
245  out.etaStrip3.cr15.eta = 3;
246  out.etaStrip3.cr15.phi = 15;
247  out.etaStrip3.cr16.energy = temporary[Eta + 3][Phi + 16].energy;
248  out.etaStrip3.cr16.eta = 3;
249  out.etaStrip3.cr16.phi = 16;
250  out.etaStrip3.cr17.energy = temporary[Eta + 3][Phi + 17].energy;
251  out.etaStrip3.cr17.eta = 3;
252  out.etaStrip3.cr17.phi = 17;
253  out.etaStrip3.cr18.energy = temporary[Eta + 3][Phi + 18].energy;
254  out.etaStrip3.cr18.eta = 3;
255  out.etaStrip3.cr18.phi = 18;
256  out.etaStrip3.cr19.energy = temporary[Eta + 3][Phi + 19].energy;
257  out.etaStrip3.cr19.eta = 3;
258  out.etaStrip3.cr19.phi = 19;
259 
260  out.etaStrip4.cr0.energy = temporary[Eta + 4][Phi + 0].energy;
261  out.etaStrip4.cr0.eta = 4;
262  out.etaStrip4.cr0.phi = 0;
263  out.etaStrip4.cr1.energy = temporary[Eta + 4][Phi + 1].energy;
264  out.etaStrip4.cr1.eta = 4;
265  out.etaStrip4.cr1.phi = 1;
266  out.etaStrip4.cr2.energy = temporary[Eta + 4][Phi + 2].energy;
267  out.etaStrip4.cr2.eta = 4;
268  out.etaStrip4.cr2.phi = 2;
269  out.etaStrip4.cr3.energy = temporary[Eta + 4][Phi + 3].energy;
270  out.etaStrip4.cr3.eta = 4;
271  out.etaStrip4.cr3.phi = 3;
272  out.etaStrip4.cr4.energy = temporary[Eta + 4][Phi + 4].energy;
273  out.etaStrip4.cr4.eta = 4;
274  out.etaStrip4.cr4.phi = 4;
275  out.etaStrip4.cr5.energy = temporary[Eta + 4][Phi + 5].energy;
276  out.etaStrip4.cr5.eta = 4;
277  out.etaStrip4.cr5.phi = 5;
278  out.etaStrip4.cr6.energy = temporary[Eta + 4][Phi + 6].energy;
279  out.etaStrip4.cr6.eta = 4;
280  out.etaStrip4.cr6.phi = 6;
281  out.etaStrip4.cr7.energy = temporary[Eta + 4][Phi + 7].energy;
282  out.etaStrip4.cr7.eta = 4;
283  out.etaStrip4.cr7.phi = 7;
284  out.etaStrip4.cr8.energy = temporary[Eta + 4][Phi + 8].energy;
285  out.etaStrip4.cr8.eta = 4;
286  out.etaStrip4.cr8.phi = 8;
287  out.etaStrip4.cr9.energy = temporary[Eta + 4][Phi + 9].energy;
288  out.etaStrip4.cr9.eta = 4;
289  out.etaStrip4.cr9.phi = 9;
290  out.etaStrip4.cr10.energy = temporary[Eta + 4][Phi + 10].energy;
291  out.etaStrip4.cr10.eta = 4;
292  out.etaStrip4.cr10.phi = 10;
293  out.etaStrip4.cr11.energy = temporary[Eta + 4][Phi + 11].energy;
294  out.etaStrip4.cr11.eta = 4;
295  out.etaStrip4.cr11.phi = 11;
296  out.etaStrip4.cr12.energy = temporary[Eta + 4][Phi + 12].energy;
297  out.etaStrip4.cr12.eta = 4;
298  out.etaStrip4.cr12.phi = 12;
299  out.etaStrip4.cr13.energy = temporary[Eta + 4][Phi + 13].energy;
300  out.etaStrip4.cr13.eta = 4;
301  out.etaStrip4.cr13.phi = 13;
302  out.etaStrip4.cr14.energy = temporary[Eta + 4][Phi + 14].energy;
303  out.etaStrip4.cr14.eta = 4;
304  out.etaStrip4.cr14.phi = 14;
305  out.etaStrip4.cr15.energy = temporary[Eta + 4][Phi + 15].energy;
306  out.etaStrip4.cr15.eta = 4;
307  out.etaStrip4.cr15.phi = 15;
308  out.etaStrip4.cr16.energy = temporary[Eta + 4][Phi + 16].energy;
309  out.etaStrip4.cr16.eta = 4;
310  out.etaStrip4.cr16.phi = 16;
311  out.etaStrip4.cr17.energy = temporary[Eta + 4][Phi + 17].energy;
312  out.etaStrip4.cr17.eta = 4;
313  out.etaStrip4.cr17.phi = 17;
314  out.etaStrip4.cr18.energy = temporary[Eta + 4][Phi + 18].energy;
315  out.etaStrip4.cr18.eta = 4;
316  out.etaStrip4.cr18.phi = 18;
317  out.etaStrip4.cr19.energy = temporary[Eta + 4][Phi + 19].energy;
318  out.etaStrip4.cr19.eta = 4;
319  out.etaStrip4.cr19.phi = 19;
320 
321  out.etaStrip5.cr0.energy = temporary[Eta + 5][Phi + 0].energy;
322  out.etaStrip5.cr0.eta = 5;
323  out.etaStrip5.cr0.phi = 0;
324  out.etaStrip5.cr1.energy = temporary[Eta + 5][Phi + 1].energy;
325  out.etaStrip5.cr1.eta = 5;
326  out.etaStrip5.cr1.phi = 1;
327  out.etaStrip5.cr2.energy = temporary[Eta + 5][Phi + 2].energy;
328  out.etaStrip5.cr2.eta = 5;
329  out.etaStrip5.cr2.phi = 2;
330  out.etaStrip5.cr3.energy = temporary[Eta + 5][Phi + 3].energy;
331  out.etaStrip5.cr3.eta = 5;
332  out.etaStrip5.cr3.phi = 3;
333  out.etaStrip5.cr4.energy = temporary[Eta + 5][Phi + 4].energy;
334  out.etaStrip5.cr4.eta = 5;
335  out.etaStrip5.cr4.phi = 4;
336  out.etaStrip5.cr5.energy = temporary[Eta + 5][Phi + 5].energy;
337  out.etaStrip5.cr5.eta = 5;
338  out.etaStrip5.cr5.phi = 5;
339  out.etaStrip5.cr6.energy = temporary[Eta + 5][Phi + 6].energy;
340  out.etaStrip5.cr6.eta = 5;
341  out.etaStrip5.cr6.phi = 6;
342  out.etaStrip5.cr7.energy = temporary[Eta + 5][Phi + 7].energy;
343  out.etaStrip5.cr7.eta = 5;
344  out.etaStrip5.cr7.phi = 7;
345  out.etaStrip5.cr8.energy = temporary[Eta + 5][Phi + 8].energy;
346  out.etaStrip5.cr8.eta = 5;
347  out.etaStrip5.cr8.phi = 8;
348  out.etaStrip5.cr9.energy = temporary[Eta + 5][Phi + 9].energy;
349  out.etaStrip5.cr9.eta = 5;
350  out.etaStrip5.cr9.phi = 9;
351  out.etaStrip5.cr10.energy = temporary[Eta + 5][Phi + 10].energy;
352  out.etaStrip5.cr10.eta = 5;
353  out.etaStrip5.cr10.phi = 10;
354  out.etaStrip5.cr11.energy = temporary[Eta + 5][Phi + 11].energy;
355  out.etaStrip5.cr11.eta = 5;
356  out.etaStrip5.cr11.phi = 11;
357  out.etaStrip5.cr12.energy = temporary[Eta + 5][Phi + 12].energy;
358  out.etaStrip5.cr12.eta = 5;
359  out.etaStrip5.cr12.phi = 12;
360  out.etaStrip5.cr13.energy = temporary[Eta + 5][Phi + 13].energy;
361  out.etaStrip5.cr13.eta = 5;
362  out.etaStrip5.cr13.phi = 13;
363  out.etaStrip5.cr14.energy = temporary[Eta + 5][Phi + 14].energy;
364  out.etaStrip5.cr14.eta = 5;
365  out.etaStrip5.cr14.phi = 14;
366  out.etaStrip5.cr15.energy = temporary[Eta + 5][Phi + 15].energy;
367  out.etaStrip5.cr15.eta = 5;
368  out.etaStrip5.cr15.phi = 15;
369  out.etaStrip5.cr16.energy = temporary[Eta + 5][Phi + 16].energy;
370  out.etaStrip5.cr16.eta = 5;
371  out.etaStrip5.cr16.phi = 16;
372  out.etaStrip5.cr17.energy = temporary[Eta + 5][Phi + 17].energy;
373  out.etaStrip5.cr17.eta = 5;
374  out.etaStrip5.cr17.phi = 17;
375  out.etaStrip5.cr18.energy = temporary[Eta + 5][Phi + 18].energy;
376  out.etaStrip5.cr18.eta = 5;
377  out.etaStrip5.cr18.phi = 18;
378  out.etaStrip5.cr19.energy = temporary[Eta + 5][Phi + 19].energy;
379  out.etaStrip5.cr19.eta = 5;
380  out.etaStrip5.cr19.phi = 19;
381 
382  out.etaStrip6.cr0.energy = temporary[Eta + 6][Phi + 0].energy;
383  out.etaStrip6.cr0.eta = 6;
384  out.etaStrip6.cr0.phi = 0;
385  out.etaStrip6.cr1.energy = temporary[Eta + 6][Phi + 1].energy;
386  out.etaStrip6.cr1.eta = 6;
387  out.etaStrip6.cr1.phi = 1;
388  out.etaStrip6.cr2.energy = temporary[Eta + 6][Phi + 2].energy;
389  out.etaStrip6.cr2.eta = 6;
390  out.etaStrip6.cr2.phi = 2;
391  out.etaStrip6.cr2.energy = temporary[Eta + 6][Phi + 2].energy;
392  out.etaStrip6.cr2.eta = 6;
393  out.etaStrip6.cr2.phi = 2;
394  out.etaStrip6.cr3.energy = temporary[Eta + 6][Phi + 3].energy;
395  out.etaStrip6.cr3.eta = 6;
396  out.etaStrip6.cr3.phi = 3;
397  out.etaStrip6.cr4.energy = temporary[Eta + 6][Phi + 4].energy;
398  out.etaStrip6.cr4.eta = 6;
399  out.etaStrip6.cr4.phi = 4;
400  out.etaStrip6.cr5.energy = temporary[Eta + 6][Phi + 5].energy;
401  out.etaStrip6.cr5.eta = 6;
402  out.etaStrip6.cr5.phi = 5;
403  out.etaStrip6.cr6.energy = temporary[Eta + 6][Phi + 6].energy;
404  out.etaStrip6.cr6.eta = 6;
405  out.etaStrip6.cr6.phi = 6;
406  out.etaStrip6.cr7.energy = temporary[Eta + 6][Phi + 7].energy;
407  out.etaStrip6.cr7.eta = 6;
408  out.etaStrip6.cr7.phi = 7;
409  out.etaStrip6.cr8.energy = temporary[Eta + 6][Phi + 8].energy;
410  out.etaStrip6.cr8.eta = 6;
411  out.etaStrip6.cr8.phi = 8;
412  out.etaStrip6.cr9.energy = temporary[Eta + 6][Phi + 9].energy;
413  out.etaStrip6.cr9.eta = 6;
414  out.etaStrip6.cr9.phi = 9;
415  out.etaStrip6.cr10.energy = temporary[Eta + 6][Phi + 10].energy;
416  out.etaStrip6.cr10.eta = 6;
417  out.etaStrip6.cr10.phi = 10;
418  out.etaStrip6.cr11.energy = temporary[Eta + 6][Phi + 11].energy;
419  out.etaStrip6.cr11.eta = 6;
420  out.etaStrip6.cr11.phi = 11;
421  out.etaStrip6.cr12.energy = temporary[Eta + 6][Phi + 12].energy;
422  out.etaStrip6.cr12.eta = 6;
423  out.etaStrip6.cr12.phi = 12;
424  out.etaStrip6.cr13.energy = temporary[Eta + 6][Phi + 13].energy;
425  out.etaStrip6.cr13.eta = 6;
426  out.etaStrip6.cr13.phi = 13;
427  out.etaStrip6.cr14.energy = temporary[Eta + 6][Phi + 14].energy;
428  out.etaStrip6.cr14.eta = 6;
429  out.etaStrip6.cr14.phi = 14;
430  out.etaStrip6.cr15.energy = temporary[Eta + 6][Phi + 15].energy;
431  out.etaStrip6.cr15.eta = 6;
432  out.etaStrip6.cr15.phi = 15;
433  out.etaStrip6.cr16.energy = temporary[Eta + 6][Phi + 16].energy;
434  out.etaStrip6.cr16.eta = 6;
435  out.etaStrip6.cr16.phi = 16;
436  out.etaStrip6.cr17.energy = temporary[Eta + 6][Phi + 17].energy;
437  out.etaStrip6.cr17.eta = 6;
438  out.etaStrip6.cr17.phi = 17;
439  out.etaStrip6.cr18.energy = temporary[Eta + 6][Phi + 18].energy;
440  out.etaStrip6.cr18.eta = 6;
441  out.etaStrip6.cr18.phi = 18;
442  out.etaStrip6.cr19.energy = temporary[Eta + 6][Phi + 19].energy;
443  out.etaStrip6.cr19.eta = 6;
444  out.etaStrip6.cr19.phi = 19;
445 
446  out.etaStrip7.cr0.energy = temporary[Eta + 7][Phi + 0].energy;
447  out.etaStrip7.cr0.eta = 7;
448  out.etaStrip7.cr0.phi = 0;
449  out.etaStrip7.cr1.energy = temporary[Eta + 7][Phi + 1].energy;
450  out.etaStrip7.cr1.eta = 7;
451  out.etaStrip7.cr1.phi = 1;
452  out.etaStrip7.cr2.energy = temporary[Eta + 7][Phi + 2].energy;
453  out.etaStrip7.cr2.eta = 7;
454  out.etaStrip7.cr2.phi = 2;
455  out.etaStrip7.cr3.energy = temporary[Eta + 7][Phi + 3].energy;
456  out.etaStrip7.cr3.eta = 7;
457  out.etaStrip7.cr3.phi = 3;
458  out.etaStrip7.cr4.energy = temporary[Eta + 7][Phi + 4].energy;
459  out.etaStrip7.cr4.eta = 7;
460  out.etaStrip7.cr4.phi = 4;
461  out.etaStrip7.cr5.energy = temporary[Eta + 7][Phi + 5].energy;
462  out.etaStrip7.cr5.eta = 7;
463  out.etaStrip7.cr5.phi = 5;
464  out.etaStrip7.cr6.energy = temporary[Eta + 7][Phi + 6].energy;
465  out.etaStrip7.cr6.eta = 7;
466  out.etaStrip7.cr6.phi = 6;
467  out.etaStrip7.cr7.energy = temporary[Eta + 7][Phi + 7].energy;
468  out.etaStrip7.cr7.eta = 7;
469  out.etaStrip7.cr7.phi = 7;
470  out.etaStrip7.cr8.energy = temporary[Eta + 7][Phi + 8].energy;
471  out.etaStrip7.cr8.eta = 7;
472  out.etaStrip7.cr8.phi = 8;
473  out.etaStrip7.cr9.energy = temporary[Eta + 7][Phi + 9].energy;
474  out.etaStrip7.cr9.eta = 7;
475  out.etaStrip7.cr9.phi = 9;
476  out.etaStrip7.cr10.energy = temporary[Eta + 7][Phi + 10].energy;
477  out.etaStrip7.cr10.eta = 7;
478  out.etaStrip7.cr10.phi = 10;
479  out.etaStrip7.cr11.energy = temporary[Eta + 7][Phi + 11].energy;
480  out.etaStrip7.cr11.eta = 7;
481  out.etaStrip7.cr11.phi = 11;
482  out.etaStrip7.cr12.energy = temporary[Eta + 7][Phi + 12].energy;
483  out.etaStrip7.cr12.eta = 7;
484  out.etaStrip7.cr12.phi = 12;
485  out.etaStrip7.cr13.energy = temporary[Eta + 7][Phi + 13].energy;
486  out.etaStrip7.cr13.eta = 7;
487  out.etaStrip7.cr13.phi = 13;
488  out.etaStrip7.cr14.energy = temporary[Eta + 7][Phi + 14].energy;
489  out.etaStrip7.cr14.eta = 7;
490  out.etaStrip7.cr14.phi = 14;
491  out.etaStrip7.cr15.energy = temporary[Eta + 7][Phi + 15].energy;
492  out.etaStrip7.cr15.eta = 7;
493  out.etaStrip7.cr15.phi = 15;
494  out.etaStrip7.cr16.energy = temporary[Eta + 7][Phi + 16].energy;
495  out.etaStrip7.cr16.eta = 7;
496  out.etaStrip7.cr16.phi = 16;
497  out.etaStrip7.cr17.energy = temporary[Eta + 7][Phi + 17].energy;
498  out.etaStrip7.cr17.eta = 7;
499  out.etaStrip7.cr17.phi = 17;
500  out.etaStrip7.cr18.energy = temporary[Eta + 7][Phi + 18].energy;
501  out.etaStrip7.cr18.eta = 7;
502  out.etaStrip7.cr18.phi = 18;
503  out.etaStrip7.cr19.energy = temporary[Eta + 7][Phi + 19].energy;
504  out.etaStrip7.cr19.eta = 7;
505  out.etaStrip7.cr19.phi = 19;
506 
507  out.etaStrip8.cr0.energy = temporary[Eta + 8][Phi + 0].energy;
508  out.etaStrip8.cr0.eta = 8;
509  out.etaStrip8.cr0.phi = 0;
510  out.etaStrip8.cr1.energy = temporary[Eta + 8][Phi + 1].energy;
511  out.etaStrip8.cr1.eta = 8;
512  out.etaStrip8.cr1.phi = 1;
513  out.etaStrip8.cr2.energy = temporary[Eta + 8][Phi + 2].energy;
514  out.etaStrip8.cr2.eta = 8;
515  out.etaStrip8.cr2.phi = 2;
516  out.etaStrip8.cr3.energy = temporary[Eta + 8][Phi + 3].energy;
517  out.etaStrip8.cr3.eta = 8;
518  out.etaStrip8.cr3.phi = 3;
519  out.etaStrip8.cr4.energy = temporary[Eta + 8][Phi + 4].energy;
520  out.etaStrip8.cr4.eta = 8;
521  out.etaStrip8.cr4.phi = 4;
522  out.etaStrip8.cr5.energy = temporary[Eta + 8][Phi + 5].energy;
523  out.etaStrip8.cr5.eta = 8;
524  out.etaStrip8.cr5.phi = 5;
525  out.etaStrip8.cr6.energy = temporary[Eta + 8][Phi + 6].energy;
526  out.etaStrip8.cr6.eta = 8;
527  out.etaStrip8.cr6.phi = 6;
528  out.etaStrip8.cr7.energy = temporary[Eta + 8][Phi + 7].energy;
529  out.etaStrip8.cr7.eta = 8;
530  out.etaStrip8.cr7.phi = 7;
531  out.etaStrip8.cr8.energy = temporary[Eta + 8][Phi + 8].energy;
532  out.etaStrip8.cr8.eta = 8;
533  out.etaStrip8.cr8.phi = 8;
534  out.etaStrip8.cr9.energy = temporary[Eta + 8][Phi + 9].energy;
535  out.etaStrip8.cr9.eta = 8;
536  out.etaStrip8.cr9.phi = 9;
537  out.etaStrip8.cr10.energy = temporary[Eta + 8][Phi + 10].energy;
538  out.etaStrip8.cr10.eta = 8;
539  out.etaStrip8.cr10.phi = 10;
540  out.etaStrip8.cr11.energy = temporary[Eta + 8][Phi + 11].energy;
541  out.etaStrip8.cr11.eta = 8;
542  out.etaStrip8.cr11.phi = 11;
543  out.etaStrip8.cr12.energy = temporary[Eta + 8][Phi + 12].energy;
544  out.etaStrip8.cr12.eta = 8;
545  out.etaStrip8.cr12.phi = 12;
546  out.etaStrip8.cr13.energy = temporary[Eta + 8][Phi + 13].energy;
547  out.etaStrip8.cr13.eta = 8;
548  out.etaStrip8.cr13.phi = 13;
549  out.etaStrip8.cr14.energy = temporary[Eta + 8][Phi + 14].energy;
550  out.etaStrip8.cr14.eta = 8;
551  out.etaStrip8.cr14.phi = 14;
552  out.etaStrip8.cr15.energy = temporary[Eta + 8][Phi + 15].energy;
553  out.etaStrip8.cr15.eta = 8;
554  out.etaStrip8.cr15.phi = 15;
555  out.etaStrip8.cr16.energy = temporary[Eta + 8][Phi + 16].energy;
556  out.etaStrip8.cr16.eta = 8;
557  out.etaStrip8.cr16.phi = 16;
558  out.etaStrip8.cr17.energy = temporary[Eta + 8][Phi + 17].energy;
559  out.etaStrip8.cr17.eta = 8;
560  out.etaStrip8.cr17.phi = 17;
561  out.etaStrip8.cr18.energy = temporary[Eta + 8][Phi + 18].energy;
562  out.etaStrip8.cr18.eta = 8;
563  out.etaStrip8.cr18.phi = 18;
564  out.etaStrip8.cr19.energy = temporary[Eta + 8][Phi + 19].energy;
565  out.etaStrip8.cr19.eta = 8;
566  out.etaStrip8.cr19.phi = 19;
567 
568  out.etaStrip9.cr0.energy = temporary[Eta + 9][Phi + 0].energy;
569  out.etaStrip9.cr0.eta = 9;
570  out.etaStrip9.cr0.phi = 0;
571  out.etaStrip9.cr1.energy = temporary[Eta + 9][Phi + 1].energy;
572  out.etaStrip9.cr1.eta = 9;
573  out.etaStrip9.cr1.phi = 1;
574  out.etaStrip9.cr2.energy = temporary[Eta + 9][Phi + 2].energy;
575  out.etaStrip9.cr2.eta = 9;
576  out.etaStrip9.cr2.phi = 2;
577  out.etaStrip9.cr3.energy = temporary[Eta + 9][Phi + 3].energy;
578  out.etaStrip9.cr3.eta = 9;
579  out.etaStrip9.cr3.phi = 3;
580  out.etaStrip9.cr4.energy = temporary[Eta + 9][Phi + 4].energy;
581  out.etaStrip9.cr4.eta = 9;
582  out.etaStrip9.cr4.phi = 4;
583  out.etaStrip9.cr5.energy = temporary[Eta + 9][Phi + 5].energy;
584  out.etaStrip9.cr5.eta = 9;
585  out.etaStrip9.cr5.phi = 5;
586  out.etaStrip9.cr6.energy = temporary[Eta + 9][Phi + 6].energy;
587  out.etaStrip9.cr6.eta = 9;
588  out.etaStrip9.cr6.phi = 6;
589  out.etaStrip9.cr7.energy = temporary[Eta + 9][Phi + 7].energy;
590  out.etaStrip9.cr7.eta = 9;
591  out.etaStrip9.cr7.phi = 7;
592  out.etaStrip9.cr8.energy = temporary[Eta + 9][Phi + 8].energy;
593  out.etaStrip9.cr8.eta = 9;
594  out.etaStrip9.cr8.phi = 8;
595  out.etaStrip9.cr9.energy = temporary[Eta + 9][Phi + 9].energy;
596  out.etaStrip9.cr9.eta = 9;
597  out.etaStrip9.cr9.phi = 9;
598  out.etaStrip9.cr10.energy = temporary[Eta + 9][Phi + 10].energy;
599  out.etaStrip9.cr10.eta = 9;
600  out.etaStrip9.cr10.phi = 10;
601  out.etaStrip9.cr11.energy = temporary[Eta + 9][Phi + 11].energy;
602  out.etaStrip9.cr11.eta = 9;
603  out.etaStrip9.cr11.phi = 11;
604  out.etaStrip9.cr12.energy = temporary[Eta + 9][Phi + 12].energy;
605  out.etaStrip9.cr12.eta = 9;
606  out.etaStrip9.cr12.phi = 12;
607  out.etaStrip9.cr13.energy = temporary[Eta + 9][Phi + 13].energy;
608  out.etaStrip9.cr13.eta = 9;
609  out.etaStrip9.cr13.phi = 13;
610  out.etaStrip9.cr14.energy = temporary[Eta + 9][Phi + 14].energy;
611  out.etaStrip9.cr14.eta = 9;
612  out.etaStrip9.cr14.phi = 14;
613  out.etaStrip9.cr15.energy = temporary[Eta + 9][Phi + 15].energy;
614  out.etaStrip9.cr15.eta = 9;
615  out.etaStrip9.cr15.phi = 15;
616  out.etaStrip9.cr16.energy = temporary[Eta + 9][Phi + 16].energy;
617  out.etaStrip9.cr16.eta = 9;
618  out.etaStrip9.cr16.phi = 16;
619  out.etaStrip9.cr17.energy = temporary[Eta + 9][Phi + 17].energy;
620  out.etaStrip9.cr17.eta = 9;
621  out.etaStrip9.cr17.phi = 17;
622  out.etaStrip9.cr18.energy = temporary[Eta + 9][Phi + 18].energy;
623  out.etaStrip9.cr18.eta = 9;
624  out.etaStrip9.cr18.phi = 18;
625  out.etaStrip9.cr19.energy = temporary[Eta + 9][Phi + 19].energy;
626  out.etaStrip9.cr19.eta = 9;
627  out.etaStrip9.cr19.phi = 19;
628 
629  out.etaStrip10.cr0.energy = temporary[Eta + 10][Phi + 0].energy;
630  out.etaStrip10.cr0.eta = 10;
631  out.etaStrip10.cr0.phi = 0;
632  out.etaStrip10.cr1.energy = temporary[Eta + 10][Phi + 1].energy;
633  out.etaStrip10.cr1.eta = 10;
634  out.etaStrip10.cr1.phi = 1;
635  out.etaStrip10.cr2.energy = temporary[Eta + 10][Phi + 2].energy;
636  out.etaStrip10.cr2.eta = 10;
637  out.etaStrip10.cr2.phi = 2;
638  out.etaStrip10.cr3.energy = temporary[Eta + 10][Phi + 3].energy;
639  out.etaStrip10.cr3.eta = 10;
640  out.etaStrip10.cr3.phi = 3;
641  out.etaStrip10.cr4.energy = temporary[Eta + 10][Phi + 4].energy;
642  out.etaStrip10.cr4.eta = 10;
643  out.etaStrip10.cr4.phi = 4;
644  out.etaStrip10.cr5.energy = temporary[Eta + 10][Phi + 5].energy;
645  out.etaStrip10.cr5.eta = 10;
646  out.etaStrip10.cr5.phi = 5;
647  out.etaStrip10.cr6.energy = temporary[Eta + 10][Phi + 6].energy;
648  out.etaStrip10.cr6.eta = 10;
649  out.etaStrip10.cr6.phi = 6;
650  out.etaStrip10.cr7.energy = temporary[Eta + 10][Phi + 7].energy;
651  out.etaStrip10.cr7.eta = 10;
652  out.etaStrip10.cr7.phi = 7;
653  out.etaStrip10.cr8.energy = temporary[Eta + 10][Phi + 8].energy;
654  out.etaStrip10.cr8.eta = 10;
655  out.etaStrip10.cr8.phi = 8;
656  out.etaStrip10.cr9.energy = temporary[Eta + 10][Phi + 9].energy;
657  out.etaStrip10.cr9.eta = 10;
658  out.etaStrip10.cr9.phi = 9;
659  out.etaStrip10.cr10.energy = temporary[Eta + 10][Phi + 10].energy;
660  out.etaStrip10.cr10.eta = 10;
661  out.etaStrip10.cr10.phi = 10;
662  out.etaStrip10.cr11.energy = temporary[Eta + 10][Phi + 11].energy;
663  out.etaStrip10.cr11.eta = 10;
664  out.etaStrip10.cr11.phi = 11;
665  out.etaStrip10.cr12.energy = temporary[Eta + 10][Phi + 12].energy;
666  out.etaStrip10.cr12.eta = 10;
667  out.etaStrip10.cr12.phi = 12;
668  out.etaStrip10.cr13.energy = temporary[Eta + 10][Phi + 13].energy;
669  out.etaStrip10.cr13.eta = 10;
670  out.etaStrip10.cr13.phi = 13;
671  out.etaStrip10.cr14.energy = temporary[Eta + 10][Phi + 14].energy;
672  out.etaStrip10.cr14.eta = 10;
673  out.etaStrip10.cr14.phi = 14;
674  out.etaStrip10.cr15.energy = temporary[Eta + 10][Phi + 15].energy;
675  out.etaStrip10.cr15.eta = 10;
676  out.etaStrip10.cr15.phi = 15;
677  out.etaStrip10.cr16.energy = temporary[Eta + 10][Phi + 16].energy;
678  out.etaStrip10.cr16.eta = 10;
679  out.etaStrip10.cr16.phi = 16;
680  out.etaStrip10.cr17.energy = temporary[Eta + 10][Phi + 17].energy;
681  out.etaStrip10.cr17.eta = 10;
682  out.etaStrip10.cr17.phi = 17;
683  out.etaStrip10.cr18.energy = temporary[Eta + 10][Phi + 18].energy;
684  out.etaStrip10.cr18.eta = 10;
685  out.etaStrip10.cr18.phi = 18;
686  out.etaStrip10.cr19.energy = temporary[Eta + 10][Phi + 19].energy;
687  out.etaStrip10.cr19.eta = 10;
688  out.etaStrip10.cr19.phi = 19;
689 
690  out.etaStrip11.cr0.energy = temporary[Eta + 11][Phi + 0].energy;
691  out.etaStrip11.cr0.eta = 11;
692  out.etaStrip11.cr0.phi = 0;
693  out.etaStrip11.cr1.energy = temporary[Eta + 11][Phi + 1].energy;
694  out.etaStrip11.cr1.eta = 11;
695  out.etaStrip11.cr1.phi = 1;
696  out.etaStrip11.cr2.energy = temporary[Eta + 11][Phi + 2].energy;
697  out.etaStrip11.cr2.eta = 11;
698  out.etaStrip11.cr2.phi = 2;
699  out.etaStrip11.cr3.energy = temporary[Eta + 11][Phi + 3].energy;
700  out.etaStrip11.cr3.eta = 11;
701  out.etaStrip11.cr3.phi = 3;
702  out.etaStrip11.cr4.energy = temporary[Eta + 11][Phi + 4].energy;
703  out.etaStrip11.cr4.eta = 11;
704  out.etaStrip11.cr4.phi = 4;
705  out.etaStrip11.cr5.energy = temporary[Eta + 11][Phi + 5].energy;
706  out.etaStrip11.cr5.eta = 11;
707  out.etaStrip11.cr5.phi = 5;
708  out.etaStrip11.cr6.energy = temporary[Eta + 11][Phi + 6].energy;
709  out.etaStrip11.cr6.eta = 11;
710  out.etaStrip11.cr6.phi = 6;
711  out.etaStrip11.cr7.energy = temporary[Eta + 11][Phi + 7].energy;
712  out.etaStrip11.cr7.eta = 11;
713  out.etaStrip11.cr7.phi = 7;
714  out.etaStrip11.cr8.energy = temporary[Eta + 11][Phi + 8].energy;
715  out.etaStrip11.cr8.eta = 11;
716  out.etaStrip11.cr8.phi = 8;
717  out.etaStrip11.cr9.energy = temporary[Eta + 11][Phi + 9].energy;
718  out.etaStrip11.cr9.eta = 11;
719  out.etaStrip11.cr9.phi = 9;
720  out.etaStrip11.cr10.energy = temporary[Eta + 11][Phi + 10].energy;
721  out.etaStrip11.cr10.eta = 11;
722  out.etaStrip11.cr10.phi = 10;
723  out.etaStrip11.cr11.energy = temporary[Eta + 11][Phi + 11].energy;
724  out.etaStrip11.cr11.eta = 11;
725  out.etaStrip11.cr11.phi = 11;
726  out.etaStrip11.cr12.energy = temporary[Eta + 11][Phi + 12].energy;
727  out.etaStrip11.cr12.eta = 11;
728  out.etaStrip11.cr12.phi = 12;
729  out.etaStrip11.cr13.energy = temporary[Eta + 11][Phi + 13].energy;
730  out.etaStrip11.cr13.eta = 11;
731  out.etaStrip11.cr13.phi = 13;
732  out.etaStrip11.cr14.energy = temporary[Eta + 11][Phi + 14].energy;
733  out.etaStrip11.cr14.eta = 11;
734  out.etaStrip11.cr14.phi = 14;
735  out.etaStrip11.cr15.energy = temporary[Eta + 11][Phi + 15].energy;
736  out.etaStrip11.cr15.eta = 11;
737  out.etaStrip11.cr15.phi = 15;
738  out.etaStrip11.cr16.energy = temporary[Eta + 11][Phi + 16].energy;
739  out.etaStrip11.cr16.eta = 11;
740  out.etaStrip11.cr16.phi = 16;
741  out.etaStrip11.cr17.energy = temporary[Eta + 11][Phi + 17].energy;
742  out.etaStrip11.cr17.eta = 11;
743  out.etaStrip11.cr17.phi = 17;
744  out.etaStrip11.cr18.energy = temporary[Eta + 11][Phi + 18].energy;
745  out.etaStrip11.cr18.eta = 11;
746  out.etaStrip11.cr18.phi = 18;
747  out.etaStrip11.cr19.energy = temporary[Eta + 11][Phi + 19].energy;
748  out.etaStrip11.cr19.eta = 11;
749  out.etaStrip11.cr19.phi = 19;
750 
751  out.etaStrip12.cr0.energy = temporary[Eta + 12][Phi + 0].energy;
752  out.etaStrip12.cr0.eta = 12;
753  out.etaStrip12.cr0.phi = 0;
754  out.etaStrip12.cr1.energy = temporary[Eta + 12][Phi + 1].energy;
755  out.etaStrip12.cr1.eta = 12;
756  out.etaStrip12.cr1.phi = 1;
757  out.etaStrip12.cr2.energy = temporary[Eta + 12][Phi + 2].energy;
758  out.etaStrip12.cr2.eta = 12;
759  out.etaStrip12.cr2.phi = 2;
760  out.etaStrip12.cr3.energy = temporary[Eta + 12][Phi + 3].energy;
761  out.etaStrip12.cr3.eta = 12;
762  out.etaStrip12.cr3.phi = 3;
763  out.etaStrip12.cr4.energy = temporary[Eta + 12][Phi + 4].energy;
764  out.etaStrip12.cr4.eta = 12;
765  out.etaStrip12.cr4.phi = 4;
766  out.etaStrip12.cr5.energy = temporary[Eta + 12][Phi + 5].energy;
767  out.etaStrip12.cr5.eta = 12;
768  out.etaStrip12.cr5.phi = 5;
769  out.etaStrip12.cr6.energy = temporary[Eta + 12][Phi + 6].energy;
770  out.etaStrip12.cr6.eta = 12;
771  out.etaStrip12.cr6.phi = 6;
772  out.etaStrip12.cr7.energy = temporary[Eta + 12][Phi + 7].energy;
773  out.etaStrip12.cr7.eta = 12;
774  out.etaStrip12.cr7.phi = 7;
775  out.etaStrip12.cr8.energy = temporary[Eta + 12][Phi + 8].energy;
776  out.etaStrip12.cr8.eta = 12;
777  out.etaStrip12.cr8.phi = 8;
778  out.etaStrip12.cr9.energy = temporary[Eta + 12][Phi + 9].energy;
779  out.etaStrip12.cr9.eta = 12;
780  out.etaStrip12.cr9.phi = 9;
781  out.etaStrip12.cr10.energy = temporary[Eta + 12][Phi + 10].energy;
782  out.etaStrip12.cr10.eta = 12;
783  out.etaStrip12.cr10.phi = 10;
784  out.etaStrip12.cr11.energy = temporary[Eta + 12][Phi + 11].energy;
785  out.etaStrip12.cr11.eta = 12;
786  out.etaStrip12.cr11.phi = 11;
787  out.etaStrip12.cr12.energy = temporary[Eta + 12][Phi + 12].energy;
788  out.etaStrip12.cr12.eta = 12;
789  out.etaStrip12.cr12.phi = 12;
790  out.etaStrip12.cr13.energy = temporary[Eta + 12][Phi + 13].energy;
791  out.etaStrip12.cr13.eta = 12;
792  out.etaStrip12.cr13.phi = 13;
793  out.etaStrip12.cr14.energy = temporary[Eta + 12][Phi + 14].energy;
794  out.etaStrip12.cr14.eta = 12;
795  out.etaStrip12.cr14.phi = 14;
796  out.etaStrip12.cr15.energy = temporary[Eta + 12][Phi + 15].energy;
797  out.etaStrip12.cr15.eta = 12;
798  out.etaStrip12.cr15.phi = 15;
799  out.etaStrip12.cr16.energy = temporary[Eta + 12][Phi + 16].energy;
800  out.etaStrip12.cr16.eta = 12;
801  out.etaStrip12.cr16.phi = 16;
802  out.etaStrip12.cr17.energy = temporary[Eta + 12][Phi + 17].energy;
803  out.etaStrip12.cr17.eta = 12;
804  out.etaStrip12.cr17.phi = 17;
805  out.etaStrip12.cr18.energy = temporary[Eta + 12][Phi + 18].energy;
806  out.etaStrip12.cr18.eta = 12;
807  out.etaStrip12.cr18.phi = 18;
808  out.etaStrip12.cr19.energy = temporary[Eta + 12][Phi + 19].energy;
809  out.etaStrip12.cr19.eta = 12;
810  out.etaStrip12.cr19.phi = 19;
811 
812  out.etaStrip13.cr0.energy = temporary[Eta + 13][Phi + 0].energy;
813  out.etaStrip13.cr0.eta = 13;
814  out.etaStrip13.cr0.phi = 0;
815  out.etaStrip13.cr1.energy = temporary[Eta + 13][Phi + 1].energy;
816  out.etaStrip13.cr1.eta = 13;
817  out.etaStrip13.cr1.phi = 1;
818  out.etaStrip13.cr2.energy = temporary[Eta + 13][Phi + 2].energy;
819  out.etaStrip13.cr2.eta = 13;
820  out.etaStrip13.cr2.phi = 2;
821  out.etaStrip13.cr3.energy = temporary[Eta + 13][Phi + 3].energy;
822  out.etaStrip13.cr3.eta = 13;
823  out.etaStrip13.cr3.phi = 3;
824  out.etaStrip13.cr4.energy = temporary[Eta + 13][Phi + 4].energy;
825  out.etaStrip13.cr4.eta = 13;
826  out.etaStrip13.cr4.phi = 4;
827  out.etaStrip13.cr5.energy = temporary[Eta + 13][Phi + 5].energy;
828  out.etaStrip13.cr5.eta = 13;
829  out.etaStrip13.cr5.phi = 5;
830  out.etaStrip13.cr6.energy = temporary[Eta + 13][Phi + 6].energy;
831  out.etaStrip13.cr6.eta = 13;
832  out.etaStrip13.cr6.phi = 6;
833  out.etaStrip13.cr7.energy = temporary[Eta + 13][Phi + 7].energy;
834  out.etaStrip13.cr7.eta = 13;
835  out.etaStrip13.cr7.phi = 7;
836  out.etaStrip13.cr8.energy = temporary[Eta + 13][Phi + 8].energy;
837  out.etaStrip13.cr8.eta = 13;
838  out.etaStrip13.cr8.phi = 8;
839  out.etaStrip13.cr9.energy = temporary[Eta + 13][Phi + 9].energy;
840  out.etaStrip13.cr9.eta = 13;
841  out.etaStrip13.cr9.phi = 9;
842  out.etaStrip13.cr10.energy = temporary[Eta + 13][Phi + 10].energy;
843  out.etaStrip13.cr10.eta = 13;
844  out.etaStrip13.cr10.phi = 10;
845  out.etaStrip13.cr11.energy = temporary[Eta + 13][Phi + 11].energy;
846  out.etaStrip13.cr11.eta = 13;
847  out.etaStrip13.cr11.phi = 11;
848  out.etaStrip13.cr12.energy = temporary[Eta + 13][Phi + 12].energy;
849  out.etaStrip13.cr12.eta = 13;
850  out.etaStrip13.cr12.phi = 12;
851  out.etaStrip13.cr13.energy = temporary[Eta + 13][Phi + 13].energy;
852  out.etaStrip13.cr13.eta = 13;
853  out.etaStrip13.cr13.phi = 13;
854  out.etaStrip13.cr14.energy = temporary[Eta + 13][Phi + 14].energy;
855  out.etaStrip13.cr14.eta = 13;
856  out.etaStrip13.cr14.phi = 14;
857  out.etaStrip13.cr15.energy = temporary[Eta + 13][Phi + 15].energy;
858  out.etaStrip13.cr15.eta = 13;
859  out.etaStrip13.cr15.phi = 15;
860  out.etaStrip13.cr16.energy = temporary[Eta + 13][Phi + 16].energy;
861  out.etaStrip13.cr16.eta = 13;
862  out.etaStrip13.cr16.phi = 16;
863  out.etaStrip13.cr17.energy = temporary[Eta + 13][Phi + 17].energy;
864  out.etaStrip13.cr17.eta = 13;
865  out.etaStrip13.cr17.phi = 17;
866  out.etaStrip13.cr18.energy = temporary[Eta + 13][Phi + 18].energy;
867  out.etaStrip13.cr18.eta = 13;
868  out.etaStrip13.cr18.phi = 18;
869  out.etaStrip13.cr19.energy = temporary[Eta + 13][Phi + 19].energy;
870  out.etaStrip13.cr19.eta = 13;
871  out.etaStrip13.cr19.phi = 19;
872 
873  out.etaStrip14.cr0.energy = temporary[Eta + 14][Phi + 0].energy;
874  out.etaStrip14.cr0.eta = 14;
875  out.etaStrip14.cr0.phi = 0;
876  out.etaStrip14.cr1.energy = temporary[Eta + 14][Phi + 1].energy;
877  out.etaStrip14.cr1.eta = 14;
878  out.etaStrip14.cr1.phi = 1;
879  out.etaStrip14.cr2.energy = temporary[Eta + 14][Phi + 2].energy;
880  out.etaStrip14.cr2.eta = 14;
881  out.etaStrip14.cr2.phi = 2;
882  out.etaStrip14.cr3.energy = temporary[Eta + 14][Phi + 3].energy;
883  out.etaStrip14.cr3.eta = 14;
884  out.etaStrip14.cr3.phi = 3;
885  out.etaStrip14.cr4.energy = temporary[Eta + 14][Phi + 4].energy;
886  out.etaStrip14.cr4.eta = 14;
887  out.etaStrip14.cr4.phi = 4;
888  out.etaStrip14.cr5.energy = temporary[Eta + 14][Phi + 5].energy;
889  out.etaStrip14.cr5.eta = 14;
890  out.etaStrip14.cr5.phi = 5;
891  out.etaStrip14.cr6.energy = temporary[Eta + 14][Phi + 6].energy;
892  out.etaStrip14.cr6.eta = 14;
893  out.etaStrip14.cr6.phi = 6;
894  out.etaStrip14.cr7.energy = temporary[Eta + 14][Phi + 7].energy;
895  out.etaStrip14.cr7.eta = 14;
896  out.etaStrip14.cr7.phi = 7;
897  out.etaStrip14.cr8.energy = temporary[Eta + 14][Phi + 8].energy;
898  out.etaStrip14.cr8.eta = 14;
899  out.etaStrip14.cr8.phi = 8;
900  out.etaStrip14.cr9.energy = temporary[Eta + 14][Phi + 9].energy;
901  out.etaStrip14.cr9.eta = 14;
902  out.etaStrip14.cr9.phi = 9;
903  out.etaStrip14.cr10.energy = temporary[Eta + 14][Phi + 10].energy;
904  out.etaStrip14.cr10.eta = 14;
905  out.etaStrip14.cr10.phi = 10;
906  out.etaStrip14.cr11.energy = temporary[Eta + 14][Phi + 11].energy;
907  out.etaStrip14.cr11.eta = 14;
908  out.etaStrip14.cr11.phi = 11;
909  out.etaStrip14.cr12.energy = temporary[Eta + 14][Phi + 12].energy;
910  out.etaStrip14.cr12.eta = 14;
911  out.etaStrip14.cr12.phi = 12;
912  out.etaStrip14.cr13.energy = temporary[Eta + 14][Phi + 13].energy;
913  out.etaStrip14.cr13.eta = 14;
914  out.etaStrip14.cr13.phi = 13;
915  out.etaStrip14.cr14.energy = temporary[Eta + 14][Phi + 14].energy;
916  out.etaStrip14.cr14.eta = 14;
917  out.etaStrip14.cr14.phi = 14;
918  out.etaStrip14.cr15.energy = temporary[Eta + 14][Phi + 15].energy;
919  out.etaStrip14.cr15.eta = 14;
920  out.etaStrip14.cr15.phi = 15;
921  out.etaStrip14.cr16.energy = temporary[Eta + 14][Phi + 16].energy;
922  out.etaStrip14.cr16.eta = 14;
923  out.etaStrip14.cr16.phi = 16;
924  out.etaStrip14.cr17.energy = temporary[Eta + 14][Phi + 17].energy;
925  out.etaStrip14.cr17.eta = 14;
926  out.etaStrip14.cr17.phi = 17;
927  out.etaStrip14.cr18.energy = temporary[Eta + 14][Phi + 18].energy;
928  out.etaStrip14.cr18.eta = 14;
929  out.etaStrip14.cr18.phi = 18;
930  out.etaStrip14.cr19.energy = temporary[Eta + 14][Phi + 19].energy;
931  out.etaStrip14.cr19.eta = 14;
932  out.etaStrip14.cr19.phi = 19;
933 
934  return out;
935 }
936 
937 //--------------------------------------------------------//
938 
939 // Compare two ecaltp_t and return the one with the larger pT.
940 inline p2eg::ecaltp_t p2eg::bestOf2(const p2eg::ecaltp_t ecaltp0, const p2eg::ecaltp_t ecaltp1) {
942  x = (ecaltp0.energy > ecaltp1.energy) ? ecaltp0 : ecaltp1;
943 
944  return x;
945 }
946 
947 //--------------------------------------------------------//
948 
949 // For a given etaStrip_t, find the ecaltp_t (out of 20 of them) with the largest pT, using pairwise comparison
951  p2eg::ecaltp_t best01 = p2eg::bestOf2(etaStrip.cr0, etaStrip.cr1);
952  p2eg::ecaltp_t best23 = p2eg::bestOf2(etaStrip.cr2, etaStrip.cr3);
953  p2eg::ecaltp_t best45 = p2eg::bestOf2(etaStrip.cr4, etaStrip.cr5);
954  p2eg::ecaltp_t best67 = p2eg::bestOf2(etaStrip.cr6, etaStrip.cr7);
955  p2eg::ecaltp_t best89 = p2eg::bestOf2(etaStrip.cr8, etaStrip.cr9);
956  p2eg::ecaltp_t best1011 = p2eg::bestOf2(etaStrip.cr10, etaStrip.cr11);
957  p2eg::ecaltp_t best1213 = p2eg::bestOf2(etaStrip.cr12, etaStrip.cr13);
958  p2eg::ecaltp_t best1415 = p2eg::bestOf2(etaStrip.cr14, etaStrip.cr15);
959  p2eg::ecaltp_t best1617 = p2eg::bestOf2(etaStrip.cr16, etaStrip.cr17);
960  p2eg::ecaltp_t best1819 = p2eg::bestOf2(etaStrip.cr18, etaStrip.cr19);
961 
962  p2eg::ecaltp_t best0123 = p2eg::bestOf2(best01, best23);
963  p2eg::ecaltp_t best4567 = p2eg::bestOf2(best45, best67);
964  p2eg::ecaltp_t best891011 = p2eg::bestOf2(best89, best1011);
965  p2eg::ecaltp_t best12131415 = p2eg::bestOf2(best1213, best1415);
966  p2eg::ecaltp_t best16171819 = p2eg::bestOf2(best1617, best1819);
967 
968  p2eg::ecaltp_t best01234567 = p2eg::bestOf2(best0123, best4567);
969  p2eg::ecaltp_t best89101112131415 = p2eg::bestOf2(best891011, best12131415);
970 
971  p2eg::ecaltp_t best0to15 = p2eg::bestOf2(best01234567, best89101112131415);
972  p2eg::ecaltp_t bestOf20 = p2eg::bestOf2(best0to15, best16171819);
973 
974  return bestOf20;
975 }
976 
977 //--------------------------------------------------------//
978 
979 // For a given etaStripPeak_t (representing the 15 crystals, one per row in eta, not necessarily with the same phi),
980 // return the crystal with the highest pT).
981 
984 
985  p2eg::ecaltp_t best01 = p2eg::bestOf2(etaStrip.pk0, etaStrip.pk1);
986  p2eg::ecaltp_t best23 = p2eg::bestOf2(etaStrip.pk2, etaStrip.pk3);
987  p2eg::ecaltp_t best45 = p2eg::bestOf2(etaStrip.pk4, etaStrip.pk5);
988  p2eg::ecaltp_t best67 = p2eg::bestOf2(etaStrip.pk6, etaStrip.pk7);
989  p2eg::ecaltp_t best89 = p2eg::bestOf2(etaStrip.pk8, etaStrip.pk9);
990  p2eg::ecaltp_t best1011 = p2eg::bestOf2(etaStrip.pk10, etaStrip.pk11);
991  p2eg::ecaltp_t best1213 = p2eg::bestOf2(etaStrip.pk12, etaStrip.pk13);
992 
993  p2eg::ecaltp_t best0123 = p2eg::bestOf2(best01, best23);
994  p2eg::ecaltp_t best4567 = p2eg::bestOf2(best45, best67);
995  p2eg::ecaltp_t best891011 = p2eg::bestOf2(best89, best1011);
996  p2eg::ecaltp_t best121314 = p2eg::bestOf2(best1213, etaStrip.pk14);
997 
998  p2eg::ecaltp_t best01234567 = p2eg::bestOf2(best0123, best4567);
999  p2eg::ecaltp_t best891011121314 = p2eg::bestOf2(best891011, best121314);
1000 
1001  p2eg::ecaltp_t bestOf15 = p2eg::bestOf2(best01234567, best891011121314);
1002 
1003  x.energy = bestOf15.energy;
1004  x.etaMax = bestOf15.eta;
1005  x.phiMax = bestOf15.phi;
1006 
1007  return x;
1008 }
1009 
1010 //--------------------------------------------------------//
1011 
1012 // Take a 3x4 ECAL region (i.e. 15x20 in crystals, add crystal energies in squares of 5x5, giving
1013 // 3x4 = 12 ECAL tower sums.) Store these 12 values in towerEt.
1014 
1016  ap_uint<12> towerEt[12]) {
1018  ap_uint<12> towerEtN[3][4][5];
1019  for (int i = 0; i < p2eg::CRYSTAL_IN_ETA; i++) {
1020  for (int k = 0; k < p2eg::CRYSTAL_IN_PHI; k++) {
1021  temp[i][k] = tempX[i][k].energy;
1022  }
1023  }
1024 
1025  for (int i = 0; i < p2eg::CRYSTAL_IN_ETA; i = i + 5) {
1026  for (int k = 0; k < p2eg::CRYSTAL_IN_PHI; k = k + 5) {
1027  towerEtN[i / 5][k / 5][0] = temp[i][k] + temp[i][k + 1] + temp[i][k + 2] + temp[i][k + 3] + temp[i][k + 4];
1028  towerEtN[i / 5][k / 5][1] =
1029  temp[i + 1][k] + temp[i + 1][k + 1] + temp[i + 1][k + 2] + temp[i + 1][k + 3] + temp[i + 1][k + 4];
1030  towerEtN[i / 5][k / 5][2] =
1031  temp[i + 2][k] + temp[i + 2][k + 1] + temp[i + 2][k + 2] + temp[i + 2][k + 3] + temp[i + 2][k + 4];
1032  towerEtN[i / 5][k / 5][3] =
1033  temp[i + 3][k] + temp[i + 3][k + 1] + temp[i + 3][k + 2] + temp[i + 3][k + 3] + temp[i + 3][k + 4];
1034  towerEtN[i / 5][k / 5][4] =
1035  temp[i + 4][k] + temp[i + 4][k + 1] + temp[i + 4][k + 2] + temp[i + 4][k + 3] + temp[i + 4][k + 4];
1036  }
1037  }
1038 
1039  for (int i = 0; i < 3; i++) {
1040  for (int j = 0; j < 4; j++) {
1041  int index = j + 4 * i;
1042  towerEt[index] = 0;
1043  for (int k = 0; k < 5; k++) {
1044  towerEt[index] += towerEtN[i][j][k];
1045  }
1046  }
1047  }
1048 
1049  ap_uint<12> totalEt;
1050  for (int i = 0; i < 12; i++) {
1051  totalEt += towerEt[i];
1052  }
1053 }
1054 
1055 //--------------------------------------------------------//
1056 
1058  p2eg::etaStripPeak_t etaStripPeak;
1059  p2eg::clusterInfo cluster;
1060 
1061  etaStripPeak.pk0 = p2eg::getPeakBin20N(ecalRegion.etaStrip0);
1062  etaStripPeak.pk1 = p2eg::getPeakBin20N(ecalRegion.etaStrip1);
1063  etaStripPeak.pk2 = p2eg::getPeakBin20N(ecalRegion.etaStrip2);
1064  etaStripPeak.pk3 = p2eg::getPeakBin20N(ecalRegion.etaStrip3);
1065  etaStripPeak.pk4 = p2eg::getPeakBin20N(ecalRegion.etaStrip4);
1066  etaStripPeak.pk5 = p2eg::getPeakBin20N(ecalRegion.etaStrip5);
1067  etaStripPeak.pk6 = p2eg::getPeakBin20N(ecalRegion.etaStrip6);
1068  etaStripPeak.pk7 = p2eg::getPeakBin20N(ecalRegion.etaStrip7);
1069  etaStripPeak.pk8 = p2eg::getPeakBin20N(ecalRegion.etaStrip8);
1070  etaStripPeak.pk9 = p2eg::getPeakBin20N(ecalRegion.etaStrip9);
1071  etaStripPeak.pk10 = p2eg::getPeakBin20N(ecalRegion.etaStrip10);
1072  etaStripPeak.pk11 = p2eg::getPeakBin20N(ecalRegion.etaStrip11);
1073  etaStripPeak.pk12 = p2eg::getPeakBin20N(ecalRegion.etaStrip12);
1074  etaStripPeak.pk13 = p2eg::getPeakBin20N(ecalRegion.etaStrip13);
1075  etaStripPeak.pk14 = p2eg::getPeakBin20N(ecalRegion.etaStrip14);
1076 
1077  p2eg::crystalMax peakIn15;
1078  peakIn15 = p2eg::getPeakBin15N(etaStripPeak);
1079 
1080  cluster.seedEnergy = peakIn15.energy;
1081  cluster.energy = 0;
1082  cluster.etaMax = peakIn15.etaMax;
1083  cluster.phiMax = peakIn15.phiMax;
1084  cluster.brems = 0;
1085  cluster.et5x5 = 0;
1086  cluster.et2x5 = 0;
1087 
1088  return cluster;
1089 }
1090 
1091 //--------------------------------------------------------//
1092 
1093 /*
1094 * Return initialized cluster with specified Et, eta, phi, with all other fields (saturation, Et2x5, Et5x5, brems, flags initialized to 0/ false).
1095 */
1096 inline p2eg::Cluster p2eg::packCluster(ap_uint<15>& clusterEt, ap_uint<5>& etaMax_t, ap_uint<5>& phiMax_t) {
1097  ap_uint<12> peggedEt;
1099 
1100  ap_uint<5> towerEta = (etaMax_t) / 5;
1101  ap_uint<2> towerPhi = (phiMax_t) / 5;
1102  ap_uint<3> clusterEta = etaMax_t - 5 * towerEta;
1103  ap_uint<3> clusterPhi = phiMax_t - 5 * towerPhi;
1104 
1105  peggedEt = (clusterEt > 0xFFF) ? (ap_uint<12>)0xFFF : (ap_uint<12>)clusterEt;
1106 
1107  pack = p2eg::Cluster(peggedEt, towerEta, towerPhi, clusterEta, clusterPhi, 0);
1108 
1109  return pack;
1110 }
1111 
1112 //--------------------------------------------------------//
1113 
1114 // Given the cluster seed_eta, seed_phi, and brems, remove the cluster energy
1115 // from the given crystal array temp. Functionally identical to "RemoveTmp".
1116 
1118  ap_uint<5> seed_eta,
1119  ap_uint<5> seed_phi,
1120  ap_uint<2> brems) {
1121  // Zero out the crystal energies in a 3 (eta) by 5 (phi) window (the clusters are 3x5 in crystals)
1122  for (int i = 0; i < p2eg::CRYSTAL_IN_ETA; i++) {
1123  for (int k = 0; k < p2eg::CRYSTAL_IN_PHI; k++) {
1124  if ((i >= (seed_eta - 1)) && (i <= (seed_eta + 1)) && (k >= (seed_phi - 2)) && (k <= (seed_phi + 2))) {
1125  temp[i][k].energy = 0;
1126  }
1127  }
1128  }
1129 
1130  // If brems flag is 1, *also* zero the energies in the 3x5 window to the "left" of the cluster
1131  // N.B. in the positive eta cards, "left" in the region = towards negative phi,
1132  // but for negative eta cards, everything is flipped, so "left" in the region" = towards positive phi
1133  if (brems == 1) {
1134  for (int i = 0; i < p2eg::CRYSTAL_IN_ETA; i++) {
1135  for (int k = 0; k < p2eg::CRYSTAL_IN_PHI; k++) {
1136  if ((i >= (seed_eta - 1)) && (i <= (seed_eta + 1)) && (k >= (seed_phi - 2 - 5)) && (k <= (seed_phi + 2 - 5))) {
1137  temp[i][k].energy = 0;
1138  }
1139  }
1140  }
1141  }
1142  // If brems flag is 2, *also* zero the energies in the 3x5 window to the "right" of the cluster
1143  // N.B. in the positive eta cards, "right" in the region = towards POSITIVE phi,
1144  // but for negative eta cards, everything is flipped, so "right" in the region = towards NEGATIVE phi
1145  else if (brems == 2) {
1146  for (int i = 0; i < p2eg::CRYSTAL_IN_ETA; i++) {
1147  for (int k = 0; k < p2eg::CRYSTAL_IN_PHI; k++) {
1148  if ((i >= (seed_eta - 1)) && (i <= (seed_eta + 1)) && (k >= (seed_phi - 2 + 5)) && (k <= (seed_phi + 2 + 5))) {
1149  temp[i][k].energy = 0;
1150  }
1151  }
1152  }
1153  }
1154 }
1155 
1156 //--------------------------------------------------------//
1157 
1158 // Given a 15x20 crystal tempX, and a seed with seed_eta and seed_phi, return a clusterInfo containing
1159 // the cluster energy for a positive bremmstrahulung shift
1160 
1162  ap_uint<5> seed_eta,
1163  ap_uint<5> seed_phi) {
1164  ap_uint<12> temp[p2eg::CRYSTAL_IN_ETA + 2][p2eg::CRYSTAL_IN_PHI + 4];
1165  ap_uint<12> phi0eta[3], phi1eta[3], phi2eta[3], phi3eta[3], phi4eta[3];
1166  ap_uint<12> eta_slice[3];
1167  p2eg::clusterInfo cluster_tmp;
1168 
1169  // Set all entries in a new ((15+2)x(20+4)) array to be zero.
1170  for (int i = 0; i < (p2eg::CRYSTAL_IN_ETA + 2); i++) {
1171  for (int j = 0; j < (p2eg::CRYSTAL_IN_PHI + 4); j++) {
1172  temp[i][j] = 0;
1173  }
1174  }
1175 
1176  // Read the energies of the input crystal tempX into the slightly larger array temp, with an offset so temp is tempX
1177  // except shifted +1 in eta, and -3 in phi.
1178  for (int i = 0; i < (p2eg::CRYSTAL_IN_ETA); i++) {
1179  for (int j = 0; j < (p2eg::CRYSTAL_IN_PHI - 3); j++) {
1180  temp[i + 1][j] = tempX[i][j + 3].energy;
1181  }
1182  }
1183 
1184  ap_uint<6> seed_eta1, seed_phi1;
1185  seed_eta1 = seed_eta; //to start from corner
1186  seed_phi1 = seed_phi; //to start from corner
1187 
1188  // now we are in the left bottom corner
1189  // Loop over the shifted array, and at the original location of the seed (seed_eta1/seed_phi1),
1190  // read a 3 (eta) x 5 (phi) rectangle of crystals where the original location of the seed is in the bottom left corner
1191  for (int j = 0; j < p2eg::CRYSTAL_IN_ETA; j++) {
1192  if (j == seed_eta1) {
1193  for (int k = 0; k < p2eg::CRYSTAL_IN_PHI; k++) {
1194  if (k == seed_phi1) {
1195  // Same eta as the seed, read next five crystals in phi
1196  phi0eta[0] = temp[j][k];
1197  phi1eta[0] = temp[j][k + 1];
1198  phi2eta[0] = temp[j][k + 2];
1199  phi3eta[0] = temp[j][k + 3];
1200  phi4eta[0] = temp[j][k + 4];
1201 
1202  // +1 eta from the seed, read next five crystals in phi
1203  phi0eta[1] = temp[j + 1][k];
1204  phi1eta[1] = temp[j + 1][k + 1];
1205  phi2eta[1] = temp[j + 1][k + 2];
1206  phi3eta[1] = temp[j + 1][k + 3];
1207  phi4eta[1] = temp[j + 1][k + 4];
1208 
1209  // +2 eta from the seed, read next five crystals in phi
1210  phi0eta[2] = temp[j + 2][k];
1211  phi1eta[2] = temp[j + 2][k + 1];
1212  phi2eta[2] = temp[j + 2][k + 2];
1213  phi3eta[2] = temp[j + 2][k + 3];
1214  phi4eta[2] = temp[j + 2][k + 4];
1215 
1216  continue;
1217  }
1218  }
1219  }
1220  }
1221 
1222  // Add up the energies in this 3x5 of crystals, initialize a cluster_tmp, and return it
1223  for (int i = 0; i < 3; i++) {
1224  eta_slice[i] = phi0eta[i] + phi1eta[i] + phi2eta[i] + phi3eta[i] + phi4eta[i];
1225  }
1226  cluster_tmp.energy = (eta_slice[0] + eta_slice[1] + eta_slice[2]);
1227 
1228  return cluster_tmp;
1229 }
1230 
1231 //--------------------------------------------------------//
1232 
1233 // Given a 15x20 crystal tempX, and a seed with seed_eta and seed_phi, return a clusterInfo containing
1234 // the cluster energy for a *negative* bremmstrahlung shift
1235 
1237  ap_uint<5> seed_eta,
1238  ap_uint<5> seed_phi) {
1239  ap_uint<12> temp[p2eg::CRYSTAL_IN_ETA + 2][p2eg::CRYSTAL_IN_PHI + 7];
1240  ap_uint<12> phi0eta[3], phi1eta[3], phi2eta[3], phi3eta[3], phi4eta[3];
1241 
1242  ap_uint<12> eta_slice[3];
1243 
1244  p2eg::clusterInfo cluster_tmp;
1245 
1246  // Initialize all entries in a new ((15+2)x(20+7)) array to be zero.
1247  for (int i = 0; i < (p2eg::CRYSTAL_IN_ETA + 2); i++) {
1248  for (int j = 0; j < (p2eg::CRYSTAL_IN_PHI + 7); j++) {
1249  temp[i][j] = 0;
1250  }
1251  }
1252 
1253  // Read the energies of the input crystal tempX into the slightly larger array temp, with an offset so temp is tempX
1254  // except shifted in +1 in eta and +7 in phi
1255  for (int i = 0; i < (p2eg::CRYSTAL_IN_ETA); i++) {
1256  for (int j = 0; j < (p2eg::CRYSTAL_IN_PHI - 1); j++) {
1257  temp[i + 1][j + 7] = tempX[i][j].energy;
1258  }
1259  }
1260 
1261  ap_uint<6> seed_eta1, seed_phi1;
1262  seed_eta1 = seed_eta; //to start from corner
1263  seed_phi1 = seed_phi; //to start from corner
1264 
1265  // Loop over the shifted array, and at the original location of the seed (seed_eta1/seed_phi1),
1266  // read a 3 (eta) x 5 (phi) rectangle of crystals where the original location of the seed is in the bottom left corner
1267  for (int j = 0; j < p2eg::CRYSTAL_IN_ETA; j++) {
1268  if (j == seed_eta1) {
1269  for (int k = 0; k < p2eg::CRYSTAL_IN_PHI; k++) {
1270  if (k == seed_phi1) {
1271  // Same eta as the seed, read next five crystals in phi
1272  phi0eta[0] = temp[j][k];
1273  phi1eta[0] = temp[j][k + 1];
1274  phi2eta[0] = temp[j][k + 2];
1275  phi3eta[0] = temp[j][k + 3];
1276  phi4eta[0] = temp[j][k + 4];
1277 
1278  // +1 eta from the seed, read next five crystals in phi
1279  phi0eta[1] = temp[j + 1][k];
1280  phi1eta[1] = temp[j + 1][k + 1];
1281  phi2eta[1] = temp[j + 1][k + 2];
1282  phi3eta[1] = temp[j + 1][k + 3];
1283  phi4eta[1] = temp[j + 1][k + 4];
1284 
1285  // +2 eta from the seed, read next five crystals in phi
1286  phi0eta[2] = temp[j + 2][k];
1287  phi1eta[2] = temp[j + 2][k + 1];
1288  phi2eta[2] = temp[j + 2][k + 2];
1289  phi3eta[2] = temp[j + 2][k + 3];
1290  phi4eta[2] = temp[j + 2][k + 4];
1291  continue;
1292  }
1293  }
1294  }
1295  }
1296 
1297  // Add up the energies in this 3x5 of crystals, initialize a cluster_tmp, and return it
1298  for (int i = 0; i < 3; i++) {
1299  eta_slice[i] = phi0eta[i] + phi1eta[i] + phi2eta[i] + phi3eta[i] + phi4eta[i];
1300  }
1301  cluster_tmp.energy = (eta_slice[0] + eta_slice[1] + eta_slice[2]);
1302 
1303  return cluster_tmp;
1304 }
1305 
1306 //--------------------------------------------------------//
1307 
1308 // Given a 15x20 crystal tempX, and a seed with seed_eta and seed_phi, return a clusterInfo containing
1309 // the cluster energy (central value)
1310 
1312  ap_uint<5> seed_eta,
1313  ap_uint<5> seed_phi) {
1314  ap_uint<12> temp[p2eg::CRYSTAL_IN_ETA + 4][p2eg::CRYSTAL_IN_PHI + 4];
1315  ap_uint<12> phi0eta[5], phi1eta[5], phi2eta[5], phi3eta[5], phi4eta[5];
1316  ap_uint<12> eta_slice[5];
1317  ap_uint<12> et2x5_1Tot, et2x5_2Tot, etSum2x5;
1318  ap_uint<12> et5x5Tot;
1319 
1320  p2eg::clusterInfo cluster_tmp;
1321  // Initialize empty (15+4)x(20+4) array
1322  for (int i = 0; i < (p2eg::CRYSTAL_IN_ETA + 4); i++) {
1323  for (int k = 0; k < (p2eg::CRYSTAL_IN_PHI + 4); k++) {
1324  temp[i][k] = 0;
1325  }
1326  }
1327 
1328  // Copy input array energies into temp array with +2 eta and +2 phi offset.
1329  for (int i = 0; i < (p2eg::CRYSTAL_IN_ETA); i++) {
1330  for (int k = 0; k < (p2eg::CRYSTAL_IN_PHI); k++) {
1331  temp[i + 2][k + 2] = tempX[i][k].energy;
1332  }
1333  }
1334 
1335  ap_uint<6> seed_eta1, seed_phi1;
1336  seed_eta1 = seed_eta; //to start from corner
1337  seed_phi1 = seed_phi; //to start from corner
1338 
1339  // now we are in the left bottom corner
1340  // Loop over the shifted array, and at the original location of the seed (seed_eta1/seed_phi1),
1341  // read a 5 (eta) x 5 (phi) rectangle of crystals where the original location of the seed is in the bottom left corner
1342  for (int j = 0; j < p2eg::CRYSTAL_IN_ETA; j++) {
1343  if (j == seed_eta1) {
1344  for (int k = 0; k < p2eg::CRYSTAL_IN_PHI; k++) {
1345  if (k == seed_phi1) {
1346  // Same eta as the seed, read next five crystals in phi
1347  phi0eta[0] = temp[j][k];
1348  phi1eta[0] = temp[j][k + 1];
1349  phi2eta[0] = temp[j][k + 2];
1350  phi3eta[0] = temp[j][k + 3];
1351  phi4eta[0] = temp[j][k + 4];
1352 
1353  // +1 eta from the seed, read next five crystals in phi
1354  phi0eta[1] = temp[j + 1][k];
1355  phi1eta[1] = temp[j + 1][k + 1];
1356  phi2eta[1] = temp[j + 1][k + 2];
1357  phi3eta[1] = temp[j + 1][k + 3];
1358  phi4eta[1] = temp[j + 1][k + 4];
1359 
1360  // +2 eta from the seed, read next five crystals in phi
1361  phi0eta[2] = temp[j + 2][k];
1362  phi1eta[2] = temp[j + 2][k + 1];
1363  phi2eta[2] = temp[j + 2][k + 2];
1364  phi3eta[2] = temp[j + 2][k + 3];
1365  phi4eta[2] = temp[j + 2][k + 4];
1366 
1367  // +3 eta from the seed, read next five crystals in phi
1368  phi0eta[3] = temp[j + 3][k];
1369  phi1eta[3] = temp[j + 3][k + 1];
1370  phi2eta[3] = temp[j + 3][k + 2];
1371  phi3eta[3] = temp[j + 3][k + 3];
1372  phi4eta[3] = temp[j + 3][k + 4];
1373 
1374  // +4 eta from the seed, read next five crystals in phi
1375  phi0eta[4] = temp[j + 4][k];
1376  phi1eta[4] = temp[j + 4][k + 1];
1377  phi2eta[4] = temp[j + 4][k + 2];
1378  phi3eta[4] = temp[j + 4][k + 3];
1379  phi4eta[4] = temp[j + 4][k + 4];
1380 
1381  continue;
1382  }
1383  }
1384  }
1385  }
1386 
1387  // Add the first three eta strips into the cluster energy
1388  for (int i = 0; i < 5; i++) {
1389  eta_slice[i] = phi0eta[i] + phi1eta[i] + phi2eta[i] + phi3eta[i] + phi4eta[i];
1390  }
1391 
1392  cluster_tmp.energy = (eta_slice[1] + eta_slice[2] + eta_slice[3]);
1393 
1394  // Get the energy totals in the 5x5 and also in two 2x5
1395  et5x5Tot = (eta_slice[0] + eta_slice[1] + eta_slice[2] + eta_slice[3] + eta_slice[4]);
1396  et2x5_1Tot = (eta_slice[1] + eta_slice[2]);
1397  et2x5_2Tot = (eta_slice[2] + eta_slice[3]);
1398 
1399  if (et2x5_1Tot >= et2x5_2Tot)
1400  etSum2x5 = et2x5_1Tot;
1401  else
1402  etSum2x5 = et2x5_2Tot;
1403 
1404  cluster_tmp.et5x5 = et5x5Tot;
1405  cluster_tmp.et2x5 = etSum2x5;
1406 
1407  return cluster_tmp;
1408 }
1409 
1410 //--------------------------------------------------------//
1411 
1412 // In 15x20 crystal array temp, return the next cluster, and remove the cluster's energy
1413 // from the crystal array.
1414 
1416  p2eg::Cluster returnCluster;
1417  p2eg::clusterInfo cluster_tmp;
1418  p2eg::clusterInfo cluster_tmpCenter;
1419  p2eg::clusterInfo cluster_tmpBneg;
1420  p2eg::clusterInfo cluster_tmpBpos;
1421 
1422  p2eg::ecalRegion_t ecalRegion;
1423  ecalRegion = p2eg::initStructure(temp);
1424 
1425  cluster_tmp = p2eg::getClusterPosition(ecalRegion);
1426 
1427  float seedEnergyFloat = cluster_tmp.seedEnergy * ECAL_LSB;
1428 
1429  // Do not make cluster if seed is less than 1.0 GeV
1430  if (seedEnergyFloat < 1.0) {
1431  cluster_tmp.energy = 0;
1432  cluster_tmp.phiMax = 0;
1433  cluster_tmp.etaMax = 0;
1434  return p2eg::packCluster(cluster_tmp.energy, cluster_tmp.phiMax, cluster_tmp.etaMax);
1435  }
1436 
1437  ap_uint<5> seed_phi = cluster_tmp.phiMax;
1438  ap_uint<5> seed_eta = cluster_tmp.etaMax;
1439 
1440  cluster_tmpCenter = p2eg::getClusterValues(temp, seed_eta, seed_phi);
1441  cluster_tmpBneg = p2eg::getBremsValuesNeg(temp, seed_eta, seed_phi);
1442  cluster_tmpBpos = p2eg::getBremsValuesPos(temp, seed_eta, seed_phi);
1443 
1444  cluster_tmp.energy = cluster_tmpCenter.energy;
1445  cluster_tmp.brems = 0;
1446 
1447  // Create a cluster
1448  if ((cluster_tmpBneg.energy > cluster_tmpCenter.energy / 8) && (cluster_tmpBneg.energy > cluster_tmpBpos.energy)) {
1449  cluster_tmp.energy = (cluster_tmpCenter.energy + cluster_tmpBneg.energy);
1450  cluster_tmp.brems = 1;
1451  } else if (cluster_tmpBpos.energy > cluster_tmpCenter.energy / 8) {
1452  cluster_tmp.energy = (cluster_tmpCenter.energy + cluster_tmpBpos.energy);
1453  cluster_tmp.brems = 2;
1454  }
1455 
1456  returnCluster = p2eg::packCluster(cluster_tmp.energy, cluster_tmp.etaMax, cluster_tmp.phiMax);
1457  p2eg::removeClusterFromCrystal(temp, seed_eta, seed_phi, cluster_tmp.brems);
1458 
1459  // Add clusterInfo members to the output cluster members
1460  returnCluster.brems = cluster_tmp.brems;
1461  returnCluster.et5x5 = cluster_tmpCenter.et5x5; // get et5x5 from the center value
1462  returnCluster.et2x5 = cluster_tmpCenter.et2x5; // get et2x5 from the center value
1463 
1464  return returnCluster;
1465 }
1466 
1467 //--------------------------------------------------------//
1468 
1469 // Stitch clusters in cluster_list across the boundary specified by
1470 // towerEtaUpper and towerEtaLower (using RCT card notation). Modifies the input vector
1471 // (passed by reference). If two clusters are combined, modify the higher-energy cluster and
1472 // zero out the energy of the smaller-energy cluster.
1473 // cc is the RCT card number (for print-out statements only).
1474 
1475 inline void p2eg::stitchClusterOverRegionBoundary(std::vector<Cluster>& cluster_list,
1476  int towerEtaUpper,
1477  int towerEtaLower,
1478  int cc) {
1479  (void)cc; // for printout statements
1480 
1481  int crystalEtaUpper = 0;
1482  int crystalEtaLower = 4;
1483 
1484  for (size_t i = 0; i < cluster_list.size(); i++) {
1485  for (size_t j = 0; j < cluster_list.size(); j++) {
1486  // Do not double-count
1487  if (i == j)
1488  continue;
1489 
1490  p2eg::Cluster c1 = cluster_list[i];
1491  p2eg::Cluster c2 = cluster_list[j];
1492 
1493  p2eg::Cluster newc1;
1494  p2eg::Cluster newc2;
1495 
1496  // Use the .towerEtaInCard() method to get the tower eta in the entire RCT card
1497  if ((c1.clusterEnergy() > 0) && (c1.towerEtaInCard() == towerEtaUpper) && (c1.clusterEta() == crystalEtaUpper)) {
1498  if ((c2.clusterEnergy() > 0) && (c2.towerEtaInCard() == towerEtaLower) &&
1499  (c2.clusterEta() == crystalEtaLower)) {
1500  ap_uint<5> phi1 = c1.towerPhi() * 5 + c1.clusterPhi();
1501  ap_uint<5> phi2 = c2.towerPhi() * 5 + c2.clusterPhi();
1502  ap_uint<5> dPhi;
1503  dPhi = (phi1 > phi2) ? (phi1 - phi2) : (phi2 - phi1);
1504 
1505  if (dPhi < 2) {
1506  ap_uint<12> totalEnergy = c1.clusterEnergy() + c2.clusterEnergy();
1507  ap_uint<15> totalEt2x5 = c1.uint_et2x5() + c2.uint_et2x5();
1508  ap_uint<15> totalEt5x5 = c1.uint_et5x5() + c2.uint_et5x5();
1509 
1510  bool rct_is_iso = false; // RCT has no isolation information
1511  bool rct_is_looseTkiso = false; // RCT has no isolation information
1512 
1513  // Initialize a cluster with the larger cluster's position and total energy
1514  if (c1.clusterEnergy() > c2.clusterEnergy()) {
1515  newc1 = p2eg::Cluster(totalEnergy,
1516  c1.towerEta(),
1517  c1.towerPhi(),
1518  c1.clusterEta(),
1519  c1.clusterPhi(),
1520  c1.satur(),
1521  totalEt5x5,
1522  totalEt2x5,
1523  c1.getBrems(),
1524  c1.getCalib(),
1525  c1.getIsSS(),
1526  c1.getIsLooseTkss(),
1527  rct_is_iso,
1528  rct_is_looseTkiso,
1529  c1.region());
1530  newc2 = p2eg::Cluster(0,
1531  c2.towerEta(),
1532  c2.towerPhi(),
1533  c2.clusterEta(),
1534  c2.clusterPhi(),
1535  c2.satur(),
1536  0,
1537  0,
1538  0,
1539  1.0,
1540  false,
1541  false,
1542  rct_is_iso,
1543  rct_is_looseTkiso,
1544  c2.region());
1545  cluster_list[i] = newc1;
1546  cluster_list[j] = newc2;
1547  } else {
1548  // Analogous to above portion
1549  newc1 = p2eg::Cluster(0,
1550  c1.towerEta(),
1551  c1.towerPhi(),
1552  c1.clusterEta(),
1553  c1.clusterPhi(),
1554  c1.satur(),
1555  0,
1556  0,
1557  0,
1558  1.0,
1559  false,
1560  false,
1561  rct_is_iso,
1562  rct_is_looseTkiso,
1563  c1.region());
1564  newc2 = p2eg::Cluster(totalEnergy,
1565  c2.towerEta(),
1566  c2.towerPhi(),
1567  c2.clusterEta(),
1568  c2.clusterPhi(),
1569  c2.satur(),
1570  totalEt5x5,
1571  totalEt2x5,
1572  c2.getBrems(),
1573  c2.getCalib(),
1574  c2.getIsSS(),
1575  c2.getIsLooseTkss(),
1576  rct_is_iso,
1577  rct_is_looseTkiso,
1578  c2.region());
1579  cluster_list[i] = newc1;
1580  cluster_list[j] = newc2;
1581  }
1582  }
1583  }
1584  }
1585  }
1586  }
1587 }
1588 
1589 //--------------------------------------------------------//
1590 
1591 #endif
ap_uint< 3 > clusterEta() const
def pack(high, low)
void getECALTowersEt(crystal tempX[CRYSTAL_IN_ETA][CRYSTAL_IN_PHI], ap_uint< 12 > towerEt[12])
ap_uint< 15 > uint_et2x5() const
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
clusterInfo getClusterValues(crystal tempX[CRYSTAL_IN_ETA][CRYSTAL_IN_PHI], ap_uint< 5 > seed_eta, ap_uint< 5 > seed_phi)
clusterInfo getClusterPosition(const ecalRegion_t ecalRegion)
Definition: Phase2L1RCT.h:1057
ap_uint< 15 > uint_et5x5() const
void removeClusterFromCrystal(crystal temp[CRYSTAL_IN_ETA][CRYSTAL_IN_PHI], ap_uint< 5 > seed_eta, ap_uint< 5 > seed_phi, ap_uint< 2 > brems)
TEMPL(T2) struct Divides void
Definition: Factorize.h:24
static constexpr int CRYSTAL_IN_ETA
Cluster getClusterFromRegion3x4(crystal temp[CRYSTAL_IN_ETA][CRYSTAL_IN_PHI])
ecalRegion_t initStructure(crystal temporary[CRYSTAL_IN_ETA][CRYSTAL_IN_PHI])
ecaltp_t getPeakBin20N(const etaStrip_t etaStrip)
Definition: Phase2L1RCT.h:950
ap_uint< 5 > towerEta() const
ap_uint< 3 > satur() const
static constexpr float ECAL_LSB
void stitchClusterOverRegionBoundary(std::vector< Cluster > &cluster_list, int towerEtaUpper, int towerEtaLower, int cc)
Definition: Phase2L1RCT.h:1475
ap_uint< 3 > clusterPhi() const
ap_uint< 2 > towerPhi() const
clusterInfo getBremsValuesPos(crystal tempX[CRYSTAL_IN_ETA][CRYSTAL_IN_PHI], ap_uint< 5 > seed_eta, ap_uint< 5 > seed_phi)
ap_uint< 12 > clusterEnergy() const
float x
crystalMax getPeakBin15N(const etaStripPeak_t etaStrip)
Definition: Phase2L1RCT.h:982
Cluster packCluster(ap_uint< 15 > &clusterEt, ap_uint< 5 > &etaMax_t, ap_uint< 5 > &phiMax_t)
Definition: Phase2L1RCT.h:1096
clusterInfo getBremsValuesNeg(crystal tempX[CRYSTAL_IN_ETA][CRYSTAL_IN_PHI], ap_uint< 5 > seed_eta, ap_uint< 5 > seed_phi)
static constexpr int CRYSTAL_IN_PHI
ecaltp_t bestOf2(const ecaltp_t ecaltp0, const ecaltp_t ecaltp1)
Definition: Phase2L1RCT.h:940