Generate and fill FED raw data for a full event.
62 lines += phtrig->
bxSize(-1, 1);
66 lines += thtrig->
bxSize(-1, 1);
70 lines += trtrig->
bxSize(-1, 1)*3;
74 unsigned char* LineFED=dttfdata.
data();
76 int* dataWord1 =
new int;
77 int* dataWord2 =
new int;
81 *dataWord1 = 0x50000000
83 *dataWord2 = 0x00030C00;
88 *((
int*)LineFED)=*dataWord2;
90 *((
int*)LineFED)=*dataWord1;
94 int TS1Id[4], TS2Id[4];
110 if ( tsphi->code() != 7 ) {
112 int wheelID = tsphi->whNum()+1;
113 if ( wheelID <= 0 ) wheelID -= 2;
114 int stationID = tsphi->stNum()-1;
115 int is2nd = tsphi->Ts2Tag();
117 int channelNr =
channel(wheelID, tsphi->scNum(), tsphi->bxNum()-is2nd);
118 if ( channelNr == 255 )
continue;
119 int TSId = ( is2nd == 0 ) ? TS1Id[stationID] : TS2Id[stationID];
121 *dataWord1 = ((channelNr&0xFF)<<24)
124 if ( stationID != 2 ){
125 *dataWord2 = ( (TSId&0x0FF)<<24)
126 + (~(tsphi->code()+1)&0x007)
127 + ( (~tsphi->phiB()&0x3FF)<<3)
128 + ( (~tsphi->phi()&0xFFF)<<13);
131 *dataWord2 = ( (TSId&0xFFFFF)<<12)
132 + (~(tsphi->code()+1)&0x00007)
133 + ( (~tsphi->phi()&0x00FFF)<<3);
139 *((
int*)LineFED)=*dataWord2;
141 *((
int*)LineFED)=*dataWord1;
153 int wheelTh = tsthe->whNum();
154 int sectorID = tsthe->scNum();
156 int channelNr =
channel(0, sectorID, tsthe->bxNum());
157 if ( channelNr == 255 )
continue;
158 int TSId = wheelTh+2;
160 *dataWord1 = ((channelNr&0xFF)<<24)
163 *dataWord2 = ((TSId&0x07)<<28)
166 int stationID = tsthe->stNum()-1;
167 for (
int bti = 0; bti < 7; bti++ )
168 if ( wheelTh == -2 || wheelTh == -1 ||
169 ( wheelTh == 0 && (sectorID == 0 || sectorID == 3 || sectorID == 4 || sectorID == 7 || sectorID == 8 || sectorID == 11) ) )
170 *dataWord2 -= (tsthe->position(bti)&0x1)<<(stationID*7+bti);
172 *dataWord2 -= (tsthe->position(6-bti)&0x1)<<(stationID*7+bti);
177 *((
int*)LineFED)=*dataWord2;
179 *((
int*)LineFED)=*dataWord1;
190 int channelNr =
channel(tstrk->whNum(), tstrk->scNum(), tstrk->bx());
191 if ( channelNr == 255 )
continue;
192 int TSId = ( tstrk->TrkTag() == 0 ) ? 0xAFFF : 0xBFFF;
194 *dataWord1 = ((channelNr&0xFF)<<24)
197 *dataWord2 = ( (TSId&0xFFFF)<<16)
198 + ( tstrk->stNum(4)&0x0000F)
199 + ((tstrk->stNum(3)&0x0000F)<<4)
200 + ((tstrk->stNum(2)&0x0000F)<<8)
201 + ((tstrk->stNum(1)&0x00003)<<12);
206 *((
int*)LineFED)=*dataWord2;
208 *((
int*)LineFED)=*dataWord1;
210 TSId = ( tstrk->TrkTag() == 0 ) ? 0xCFFE : 0xDFFE;
212 *dataWord1 = ((channelNr&0xFF)<<24)
215 *dataWord2 = ( (TSId&0xFFFE)<<16)
216 + ( ~tstrk->quality_packed()&0x0007)
217 + ( (tstrk->phi_packed()&0x00FF)<<3)
218 + ( (~tstrk->charge_packed()&0x0001)<<11)
219 + ( (~tstrk->pt_packed()&0x001F)<<12);
224 *((
int*)LineFED)=*dataWord2;
226 *((
int*)LineFED)=*dataWord1;
228 channelNr =
channel(0, tstrk->scNum(), tstrk->bx());
229 if ( channelNr == 255 )
continue;
230 TSId = (tstrk->whNum()+3)<<16;
231 TSId += ( tstrk->whNum() < 0 ) ? 0x8FFFC : 0x7FFFC;
233 *dataWord1 = ((channelNr&0xFF)<<24)
236 *dataWord2 = (TSId&0xFFFFC)<<12;
238 if ( tstrk->TrkTag() == 0 ) {
240 + ( tstrk->eta_packed()&0x003F)
241 + ((~tstrk->finehalo_packed()&0x0001)<<6);
245 + ( ( tstrk->eta_packed()&0x003F)<<7)
246 + ((~tstrk->finehalo_packed()&0x0001)<<13);
252 *((
int*)LineFED)=*dataWord2;
254 *((
int*)LineFED)=*dataWord1;
260 *dataWord1 = 0xA0000000
266 *dataWord2 += (newCRC&0xFFFF)<<16;
269 *((
int*)LineFED)=*dataWord2;
271 *((
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