Generate and fill FED raw data for a full event.
69 unsigned char *LineFED = dttfdata.
data();
71 int *dataWord1 =
new int;
72 int *dataWord2 =
new int;
76 *dataWord1 = 0x50000000 + (
eventNum & 0xFFFFFF);
77 *dataWord2 = 0x00030C00;
82 *((
int *)LineFED) = *dataWord2;
84 *((
int *)LineFED) = *dataWord1;
88 int TS1Id[4], TS2Id[4];
102 if (tsphi->code() != 7) {
103 int wheelID = tsphi->whNum() + 1;
106 int stationID = tsphi->stNum() - 1;
107 int is2nd = tsphi->Ts2Tag();
109 int channelNr =
channel(wheelID, tsphi->scNum(), tsphi->bxNum() - is2nd);
110 if (channelNr == 255)
112 int TSId = (is2nd == 0) ? TS1Id[stationID] : TS2Id[stationID];
114 *dataWord1 = ((channelNr & 0xFF) << 24) + 0x00FFFFFF;
116 if (stationID != 2) {
117 *dataWord2 = ((TSId & 0x0FF) << 24) + (~(tsphi->code() + 1) & 0x007) + ((~tsphi->phiB() & 0x3FF) << 3) +
118 ((~tsphi->phi() & 0xFFF) << 13);
120 *dataWord2 = ((TSId & 0xFFFFF) << 12) + (~(tsphi->code() + 1) & 0x00007) + ((~tsphi->phi() & 0x00FFF) << 3);
126 *((
int *)LineFED) = *dataWord2;
128 *((
int *)LineFED) = *dataWord1;
137 int wheelTh = tsthe->whNum();
138 int sectorID = tsthe->scNum();
140 int channelNr =
channel(0, sectorID, tsthe->bxNum());
141 if (channelNr == 255)
143 int TSId = wheelTh + 2;
145 *dataWord1 = ((channelNr & 0xFF) << 24) + 0x00FFFFFF;
147 *dataWord2 = ((TSId & 0x07) << 28) + 0x0FFFFFFF;
149 int stationID = tsthe->stNum() - 1;
150 for (
int bti = 0; bti < 7; bti++)
151 if (wheelTh == -2 || wheelTh == -1 ||
153 (sectorID == 0 || sectorID == 3 || sectorID == 4 || sectorID == 7 || sectorID == 8 || sectorID == 11)))
154 *dataWord2 -= (tsthe->position(bti) & 0x1) << (stationID * 7 + bti);
156 *dataWord2 -= (tsthe->position(6 - bti) & 0x1) << (stationID * 7 + bti);
161 *((
int *)LineFED) = *dataWord2;
163 *((
int *)LineFED) = *dataWord1;
171 int channelNr =
channel(tstrk->whNum(), tstrk->scNum(), tstrk->bx());
172 if (channelNr == 255)
174 int TSId = (tstrk->TrkTag() == 0) ? 0xAFFF : 0xBFFF;
176 *dataWord1 = ((channelNr & 0xFF) << 24) + 0x00FFFFFF;
178 *dataWord2 = ((TSId & 0xFFFF) << 16) + (tstrk->stNum(4) & 0x0000F) + ((tstrk->stNum(3) & 0x0000F) << 4) +
179 ((tstrk->stNum(2) & 0x0000F) << 8) + ((tstrk->stNum(1) & 0x00003) << 12);
184 *((
int *)LineFED) = *dataWord2;
186 *((
int *)LineFED) = *dataWord1;
188 TSId = (tstrk->TrkTag() == 0) ? 0xCFFE : 0xDFFE;
190 *dataWord1 = ((channelNr & 0xFF) << 24) + 0x00FFFFFF;
192 *dataWord2 = ((TSId & 0xFFFE) << 16) + (~tstrk->quality_packed() & 0x0007) + ((tstrk->phi_packed() & 0x00FF) << 3) +
193 ((~tstrk->charge_packed() & 0x0001) << 11) + ((~tstrk->pt_packed() & 0x001F) << 12);
198 *((
int *)LineFED) = *dataWord2;
200 *((
int *)LineFED) = *dataWord1;
202 channelNr =
channel(0, tstrk->scNum(), tstrk->bx());
203 if (channelNr == 255)
205 TSId = (tstrk->whNum() + 3) << 16;
206 TSId += (tstrk->whNum() < 0) ? 0x8FFFC : 0x7FFFC;
208 *dataWord1 = ((channelNr & 0xFF) << 24) + 0x00FFFFFF;
210 *dataWord2 = (TSId & 0xFFFFC) << 12;
212 if (tstrk->TrkTag() == 0) {
213 *dataWord2 += 0x3F80 + (tstrk->eta_packed() & 0x003F) + ((~tstrk->finehalo_packed() & 0x0001) << 6);
215 *dataWord2 += 0x007F + ((tstrk->eta_packed() & 0x003F) << 7) + ((~tstrk->finehalo_packed() & 0x0001) << 13);
221 *((
int *)LineFED) = *dataWord2;
223 *((
int *)LineFED) = *dataWord1;
229 *dataWord1 = 0xA0000000 + (
lines & 0xFFFFFF);
234 *dataWord2 += (newCRC & 0xFFFF) << 16;
237 *((
int *)LineFED) = *dataWord2;
239 *((
int *)LineFED) = *dataWord1;
int bxSize(int step1, int step2) const
int bxSize(int step1, int step2) const
edm::EDGetTokenT< L1MuDTChambThContainer > ChTh_tok
The_Container::const_iterator The_iterator
The_Container const * getContainer() const
TrackContainer const * getContainer() const
Phi_Container::const_iterator Phi_iterator
int channel(int wheel, int sector, int bx)
TrackContainer::const_iterator Trackiterator
Phi_Container const * getContainer() const
void resize(size_t newsize, size_t wordsize=8)
void calcCRC(long, int &)
char data[epos_bytes_allocation]
edm::EDGetTokenT< L1MuDTTrackContainer > Trk_tok
int bxSize(int step1, int step2) const
edm::EDGetTokenT< L1MuDTChambPhContainer > ChPh_tok
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.