Generate and fill FED raw data for a full event.
61 lines += phtrig->
bxSize(-1, 1);
65 lines += thtrig->
bxSize(-1, 1);
69 lines += trtrig->
bxSize(-1, 1)*3;
73 unsigned char* LineFED=dttfdata.
data();
75 int* dataWord1 =
new int;
76 int* dataWord2 =
new int;
80 *dataWord1 = 0x50000000
82 *dataWord2 = 0x00030C00;
85 calcCRC(*dataWord1, *dataWord2, newCRC);
86 *((
int*)LineFED)=*dataWord2;
88 *((
int*)LineFED)=*dataWord1;
92 int TS1Id[4], TS2Id[4];
108 if ( tsphi->code() != 7 ) {
110 int wheelID = tsphi->whNum()+1;
111 if ( wheelID <= 0 ) wheelID -= 2;
112 int stationID = tsphi->stNum()-1;
113 int is2nd = tsphi->Ts2Tag();
115 int channelNr =
channel(wheelID, tsphi->scNum(), tsphi->bxNum()-is2nd);
116 if ( channelNr == 255 )
continue;
117 int TSId = ( is2nd == 0 ) ? TS1Id[stationID] : TS2Id[stationID];
119 *dataWord1 = ((channelNr&0xFF)<<24)
122 if ( stationID != 2 ){
123 *dataWord2 = ( (TSId&0x0FF)<<24)
124 + (~(tsphi->code()+1)&0x007)
125 + ( (~tsphi->phiB()&0x3FF)<<3)
126 + ( (~tsphi->phi()&0xFFF)<<13);
129 *dataWord2 = ( (TSId&0xFFFFF)<<12)
130 + (~(tsphi->code()+1)&0x00007)
131 + ( (~tsphi->phi()&0x00FFF)<<3);
134 calcCRC(*dataWord1, *dataWord2, newCRC);
136 *((
int*)LineFED)=*dataWord2;
138 *((
int*)LineFED)=*dataWord1;
150 int wheelTh = tsthe->whNum();
151 int sectorID = tsthe->scNum();
153 int channelNr =
channel(0, sectorID, tsthe->bxNum());
154 if ( channelNr == 255 )
continue;
155 int TSId = wheelTh+2;
157 *dataWord1 = ((channelNr&0xFF)<<24)
160 *dataWord2 = ((TSId&0x07)<<28)
163 int stationID = tsthe->stNum()-1;
164 for (
int bti = 0; bti < 7; bti++ )
165 if ( wheelTh == -2 || wheelTh == -1 ||
166 ( wheelTh == 0 && (sectorID == 0 || sectorID == 3 || sectorID == 4 || sectorID == 7 || sectorID == 8 || sectorID == 11) ) )
167 *dataWord2 -= (tsthe->position(bti)&0x1)<<(stationID*7+bti);
169 *dataWord2 -= (tsthe->position(6-bti)&0x1)<<(stationID*7+bti);
171 calcCRC(*dataWord1, *dataWord2, newCRC);
173 *((
int*)LineFED)=*dataWord2;
175 *((
int*)LineFED)=*dataWord1;
186 int channelNr =
channel(tstrk->whNum(), tstrk->scNum(), tstrk->bx());
187 if ( channelNr == 255 )
continue;
188 int TSId = ( tstrk->TrkTag() == 0 ) ? 0xAFFF : 0xBFFF;
190 *dataWord1 = ((channelNr&0xFF)<<24)
193 *dataWord2 = ( (TSId&0xFFFF)<<16)
194 + ( tstrk->stNum(4)&0x0000F)
195 + ((tstrk->stNum(3)&0x0000F)<<4)
196 + ((tstrk->stNum(2)&0x0000F)<<8)
197 + ((tstrk->stNum(1)&0x00003)<<12);
199 calcCRC(*dataWord1, *dataWord2, newCRC);
201 *((
int*)LineFED)=*dataWord2;
203 *((
int*)LineFED)=*dataWord1;
205 TSId = ( tstrk->TrkTag() == 0 ) ? 0xCFFE : 0xDFFE;
207 *dataWord1 = ((channelNr&0xFF)<<24)
210 *dataWord2 = ( (TSId&0xFFFE)<<16)
211 + ( ~tstrk->quality_packed()&0x0007)
212 + ( (tstrk->phi_packed()&0x00FF)<<3)
213 + ( (~tstrk->charge_packed()&0x0001)<<11)
214 + ( (~tstrk->pt_packed()&0x001F)<<12);
216 calcCRC(*dataWord1, *dataWord2, newCRC);
218 *((
int*)LineFED)=*dataWord2;
220 *((
int*)LineFED)=*dataWord1;
222 channelNr =
channel(0, tstrk->scNum(), tstrk->bx());
223 if ( channelNr == 255 )
continue;
224 TSId = (tstrk->whNum()+3)<<16;
225 TSId += ( tstrk->whNum() < 0 ) ? 0x8FFFC : 0x7FFFC;
227 *dataWord1 = ((channelNr&0xFF)<<24)
230 *dataWord2 = (TSId&0xFFFFC)<<12;
232 if ( tstrk->TrkTag() == 0 ) {
234 + ( tstrk->eta_packed()&0x003F)
235 + ((~tstrk->finehalo_packed()&0x0001)<<6);
239 + ( ( tstrk->eta_packed()&0x003F)<<7)
240 + ((~tstrk->finehalo_packed()&0x0001)<<13);
243 calcCRC(*dataWord1, *dataWord2, newCRC);
245 *((
int*)LineFED)=*dataWord2;
247 *((
int*)LineFED)=*dataWord1;
253 *dataWord1 = 0xA0000000
257 calcCRC(*dataWord1, *dataWord2&0xFFFF, newCRC);
259 *dataWord2 += (newCRC&0xFFFF)<<16;
262 *((
int*)LineFED)=*dataWord2;
264 *((
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)
void calcCRC(int myD1, int myD2, int &myC)
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
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