5#include "TrigScint/Firmware/objdef.h"
6#include "TrigScint/Firmware/trackproducer.h"
11#ifdef TS_NOT_EMULATION
12#pragma HLS ARRAY_PARTITION variable = Pad1 dim = 0 complete
13#pragma HLS ARRAY_PARTITION variable = Pad2 dim = 0 complete
14#pragma HLS ARRAY_PARTITION variable = Pad3 dim = 0 complete
15#pragma HLS ARRAY_PARTITION variable = outTrk dim = 0 complete
16#pragma HLS ARRAY_PARTITION variable = lookup dim = 0 complete
17#pragma HLS PIPELINE II = 10
20#ifdef TS_NOT_EMULATION
21#pragma HLS ARRAY_PARTITION variable = test complete
35 for (
int i = 0; i < NTRK; i++) {
36 if (2 * Pad1[i].Seed.bID > 2 * NCHAN) {
39 for (
int I = 0; I < COMBO; I++) {
41 if (not(Pad1[i].Seed.Amp > 0)) {
45 if (Pad1[i].Sec.Amp > 0) {
48 cpyCluster(test.Pad1, Pad1[i]);
49 if ((lookup[centroid][I][0] == -1) or (lookup[centroid][I][1] == -1)) {
52 if (not(Pad2[lookup[centroid][I][0] / 4].Seed.Amp > 0)) {
55 if ((lookup[centroid][I][0] % 4 == 0) and
56 ((Pad2[lookup[centroid][I][0] / 4].Sec.bID >= 0) or
57 (Pad2[lookup[centroid][I][0] / 4].Seed.bID % 2 == 1))) {
60 if ((lookup[centroid][I][0] % 4 == 1) and
61 ((Pad2[lookup[centroid][I][0] / 4].Sec.bID < 0) or
62 (Pad2[lookup[centroid][I][0] / 4].Seed.bID % 2 == 1))) {
65 if ((lookup[centroid][I][0] % 4 == 2) and
66 ((Pad2[lookup[centroid][I][0] / 4].Sec.bID >= 0) or
67 (Pad2[lookup[centroid][I][0] / 4].Seed.bID % 2 == 0))) {
70 if ((lookup[centroid][I][0] % 4 == 3) and
71 ((Pad2[lookup[centroid][I][0] / 4].Sec.bID < 0) or
72 (Pad2[lookup[centroid][I][0] / 4].Seed.bID % 2 == 0))) {
75 if (not(Pad3[lookup[centroid][I][1] / 4].Seed.Amp > 0)) {
78 if ((lookup[centroid][I][1] % 4 == 0) and
79 ((Pad3[lookup[centroid][I][1] / 4].Sec.bID >= 0) or
80 (Pad3[lookup[centroid][I][1] / 4].Seed.bID % 2 == 1))) {
83 if ((lookup[centroid][I][1] % 4 == 1) and
84 ((Pad3[lookup[centroid][I][1] / 4].Sec.bID < 0) or
85 (Pad3[lookup[centroid][I][1] / 4].Seed.bID % 2 == 1))) {
88 if ((lookup[centroid][I][1] % 4 == 2) and
89 ((Pad3[lookup[centroid][I][1] / 4].Sec.bID >= 0) or
90 (Pad3[lookup[centroid][I][1] / 4].Seed.bID % 2 == 0))) {
93 if ((lookup[centroid][I][1] % 4 == 3) and
94 ((Pad3[lookup[centroid][I][1] / 4].Sec.bID < 0) or
95 (Pad3[lookup[centroid][I][1] / 4].Seed.bID % 2 == 0))) {
98 cpyCluster(test.Pad2, Pad2[lookup[centroid][I][0] / 4]);
99 cpyCluster(test.Pad3, Pad3[lookup[centroid][I][1] / 4]);
101 if (test.resid < outTrk[i].resid) {
102 cpyTrack(outTrk[i], test);
110 for (
int i = 1; i < NTRK - 1; i++) {
111 if ((outTrk[i - 1].Pad2.Seed.bID == outTrk[i].Pad2.Seed.bID) and
112 (outTrk[i].Pad2.Seed.bID >= 0)) {
113 if (outTrk[i - 1].resid <= outTrk[i].resid) {
114 clearTrack(outTrk[i]);
116 clearTrack(outTrk[i - 1]);
119 if ((outTrk[i].Pad2.Seed.bID == outTrk[i + 1].Pad2.Seed.bID) and
120 (outTrk[i + 1].Pad2.Seed.bID >= 0)) {
121 if (outTrk[i + 1].resid <= outTrk[i].resid) {
122 clearTrack(outTrk[i]);
124 clearTrack(outTrk[i + 1]);
127 if ((outTrk[i - 1].Pad2.Seed.bID == outTrk[i + 1].Pad2.Seed.bID) and
128 (outTrk[i + 1].Pad2.Seed.bID >= 0)) {
129 if (outTrk[i - 1].resid <= outTrk[i + 1].resid) {
130 clearTrack(outTrk[i + 1]);
132 clearTrack(outTrk[i - 1]);
136 for (
int i = 1; i < NTRK - 1; i++) {
137 if ((outTrk[i - 1].Pad3.Seed.bID == outTrk[i].Pad3.Seed.bID) and
138 (outTrk[i].Pad3.Seed.bID >= 0)) {
139 if (outTrk[i - 1].resid <= outTrk[i].resid) {
140 clearTrack(outTrk[i]);
142 clearTrack(outTrk[i - 1]);
145 if ((outTrk[i].Pad3.Seed.bID == outTrk[i + 1].Pad3.Seed.bID) and
146 (outTrk[i + 1].Pad3.Seed.bID >= 0)) {
147 if (outTrk[i + 1].resid <= outTrk[i].resid) {
148 clearTrack(outTrk[i]);
150 clearTrack(outTrk[i + 1]);
153 if ((outTrk[i - 1].Pad3.Seed.bID == outTrk[i + 1].Pad3.Seed.bID) and
154 (outTrk[i + 1].Pad3.Seed.bID >= 0)) {
155 if (outTrk[i - 1].resid <= outTrk[i + 1].resid) {
156 clearTrack(outTrk[i + 1]);
158 clearTrack(outTrk[i - 1]);
Sign Arbitrary Precision Type.