Generate and fill FED raw data for a full event.
60 lines += phtrig->
bxSize(-1, 1);
64 lines += thtrig->
bxSize(-1, 1);
68 lines += trtrig->
bxSize(-1, 1) * 3;
71 dttfdata.
resize(lines * 8);
72 unsigned char *LineFED = dttfdata.
data();
74 int *dataWord1 =
new int;
75 int *dataWord2 =
new int;
79 *dataWord1 = 0x50000000 + (
eventNum & 0xFFFFFF);
80 *dataWord2 = 0x00030C00;
85 *((
int *)LineFED) = *dataWord2;
87 *((
int *)LineFED) = *dataWord1;
91 int TS1Id[4], TS2Id[4];
106 if (tsphi->code() != 7) {
108 int wheelID = tsphi->whNum() + 1;
111 int stationID = tsphi->stNum() - 1;
112 int is2nd = tsphi->Ts2Tag();
114 int channelNr =
channel(wheelID, tsphi->scNum(), tsphi->bxNum() - is2nd);
115 if (channelNr == 255)
117 int TSId = (is2nd == 0) ? TS1Id[stationID] : TS2Id[stationID];
119 *dataWord1 = ((channelNr & 0xFF) << 24) + 0x00FFFFFF;
121 if (stationID != 2) {
122 *dataWord2 = ((TSId & 0x0FF) << 24) + (~(tsphi->code() + 1) & 0x007) +
123 ((~tsphi->phiB() & 0x3FF) << 3) +
124 ((~tsphi->phi() & 0xFFF) << 13);
126 *dataWord2 = ((TSId & 0xFFFFF) << 12) +
127 (~(tsphi->code() + 1) & 0x00007) +
128 ((~tsphi->phi() & 0x00FFF) << 3);
134 *((
int *)LineFED) = *dataWord2;
136 *((
int *)LineFED) = *dataWord1;
147 int wheelTh = tsthe->whNum();
148 int sectorID = tsthe->scNum();
150 int channelNr =
channel(0, sectorID, tsthe->bxNum());
151 if (channelNr == 255)
153 int TSId = wheelTh + 2;
155 *dataWord1 = ((channelNr & 0xFF) << 24) + 0x00FFFFFF;
157 *dataWord2 = ((TSId & 0x07) << 28) + 0x0FFFFFFF;
159 int stationID = tsthe->stNum() - 1;
160 for (
int bti = 0; bti < 7; bti++)
161 if (wheelTh == -2 || wheelTh == -1 ||
162 (wheelTh == 0 && (sectorID == 0 || sectorID == 3 || sectorID == 4 ||
163 sectorID == 7 || sectorID == 8 || sectorID == 11)))
164 *dataWord2 -= (tsthe->position(bti) & 0x1) << (stationID * 7 + bti);
166 *dataWord2 -= (tsthe->position(6 - bti) & 0x1) << (stationID * 7 + bti);
171 *((
int *)LineFED) = *dataWord2;
173 *((
int *)LineFED) = *dataWord1;
183 int channelNr =
channel(tstrk->whNum(), tstrk->scNum(), tstrk->bx());
184 if (channelNr == 255)
186 int TSId = (tstrk->TrkTag() == 0) ? 0xAFFF : 0xBFFF;
188 *dataWord1 = ((channelNr & 0xFF) << 24) + 0x00FFFFFF;
190 *dataWord2 = ((TSId & 0xFFFF) << 16) + (tstrk->stNum(4) & 0x0000F) +
191 ((tstrk->stNum(3) & 0x0000F) << 4) +
192 ((tstrk->stNum(2) & 0x0000F) << 8) +
193 ((tstrk->stNum(1) & 0x00003) << 12);
198 *((
int *)LineFED) = *dataWord2;
200 *((
int *)LineFED) = *dataWord1;
202 TSId = (tstrk->TrkTag() == 0) ? 0xCFFE : 0xDFFE;
204 *dataWord1 = ((channelNr & 0xFF) << 24) + 0x00FFFFFF;
206 *dataWord2 = ((TSId & 0xFFFE) << 16) + (~tstrk->quality_packed() & 0x0007) +
207 ((tstrk->phi_packed() & 0x00FF) << 3) +
208 ((~tstrk->charge_packed() & 0x0001) << 11) +
209 ((~tstrk->pt_packed() & 0x001F) << 12);
214 *((
int *)LineFED) = *dataWord2;
216 *((
int *)LineFED) = *dataWord1;
218 channelNr =
channel(0, tstrk->scNum(), tstrk->bx());
219 if (channelNr == 255)
221 TSId = (tstrk->whNum() + 3) << 16;
222 TSId += (tstrk->whNum() < 0) ? 0x8FFFC : 0x7FFFC;
224 *dataWord1 = ((channelNr & 0xFF) << 24) + 0x00FFFFFF;
226 *dataWord2 = (TSId & 0xFFFFC) << 12;
228 if (tstrk->TrkTag() == 0) {
229 *dataWord2 += 0x3F80 + (tstrk->eta_packed() & 0x003F) +
230 ((~tstrk->finehalo_packed() & 0x0001) << 6);
232 *dataWord2 += 0x007F + ((tstrk->eta_packed() & 0x003F) << 7) +
233 ((~tstrk->finehalo_packed() & 0x0001) << 13);
239 *((
int *)LineFED) = *dataWord2;
241 *((
int *)LineFED) = *dataWord1;
247 *dataWord1 = 0xA0000000 + (lines & 0xFFFFFF);
252 *dataWord2 += (newCRC & 0xFFFF) << 16;
255 *((
int *)LineFED) = *dataWord2;
257 *((
int *)LineFED) = *dataWord1;
EventNumber_t event() const
The_Container const * getContainer() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
int bxSize(int step1, int step2) const
edm::EDGetTokenT< L1MuDTChambThContainer > ChTh_tok
The_Container::const_iterator The_iterator
int bxSize(int step1, int step2) const
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void resize(size_t newsize)
Phi_Container::const_iterator Phi_iterator
int channel(int wheel, int sector, int bx)
TrackContainer::const_iterator Trackiterator
Phi_Container const * getContainer() const
int bxSize(int step1, int step2) const
void calcCRC(long, int &)
edm::EDGetTokenT< L1MuDTTrackContainer > Trk_tok
edm::EDGetTokenT< L1MuDTChambPhContainer > ChPh_tok
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
TrackContainer const * getContainer() const