91 vector<int> DTTFWordContainer;
92 vector<int>::iterator DTTFiterator;
100 int addr1[2] = { 3, 3};
101 int addr2[2] = {15, 15};
102 int addr3[2] = {15, 15};
103 int addr4[2] = {15, 15};
113 if ( dttfdata.
size() == 0 )
return;
115 int* dataWord1 =
new int;
116 int* dataWord2 =
new int;
117 unsigned char* LineFED=dttfdata.
data();
118 *dataWord2=*((
int*)LineFED);
120 *dataWord1=*((
int*)LineFED);
123 BOEevTy = ((*dataWord1)&0xFF000000)>>24;
124 DTTFId = ((*dataWord2)&0x000FFF00)>>8;
126 if( (BOEevTy != 0x50) || ( DTTFId != 0x030C) ){
128 <<
"Not a DTTF header " << hex << *dataWord1;
135 calcCRC(*dataWord1, *dataWord2, newCRC);
141 *dataWord2=*((
int*)LineFED);
143 *dataWord1=*((
int*)LineFED);
144 int chkEOE = ((*dataWord1)&0xFFF00000)>>20;
147 while(chkEOE != 0xA00){
149 calcCRC(*dataWord1, *dataWord2, newCRC);
151 DTTFWord = *dataWord1;
152 DTTFWordContainer.push_back(DTTFWord);
153 DTTFWord = *dataWord2;
154 DTTFWordContainer.push_back(DTTFWord);
157 *dataWord2=*((
int*)LineFED);
159 *dataWord1=*((
int*)LineFED);
160 chkEOE = ((*dataWord1)&0xFFF00000)>>20;
165 <<
"Warning : number of DTTF lines > 3026 ";
176 evtLgth = ((*dataWord1)&0x00FFFFFF);
177 CRC = ((*dataWord2)&0xFFFF0000)>>16;
179 calcCRC(*dataWord1, (*dataWord2)&0xFFFF, newCRC);
182 <<
"Calculated CRC " << hex << newCRC <<
" differs from CRC in trailer " << hex << CRC;
188 if( lines != evtLgth){
190 <<
"Number of words read != event length " <<
dec << lines <<
" " << evtLgth;
199 for( DTTFiterator = DTTFWordContainer.begin();
200 DTTFiterator != DTTFWordContainer.end();
203 DTTFChan = ((*DTTFiterator)&0xFF000000)>>24;
205 bitsID = ((*DTTFiterator)&0xF0000000)>>28;
207 int bxID =
bxNr(DTTFChan);
208 if(bxID == -999)
continue;
209 int wheelID =
wheel(DTTFChan);
210 if(wheelID == -999)
continue;
211 int sectorID =
sector(DTTFChan);
212 if(sectorID == -999)
continue;
215 if(wheelID!=0 && bitsID<=0x9){
217 int wheelPh = (
abs(wheelID)-1)*wheelID/
abs(wheelID);
224 if ( ( bitsID >> 1 ) == 0 ){ stationID = 1;}
225 if ( ( bitsID >> 1 ) == 1 ){ stationID = 2;}
226 if ( ( bitsID >> 1 ) == 4 ){ stationID = 3;}
227 if ( ( bitsID >> 1 ) == 2 ){ stationID = 4;}
231 ts2tag = (bitsID)&0x1;
232 tsqual = (~(*DTTFiterator)&0x07)-1;
233 ba = (~(*DTTFiterator)&0x1FF8)>>3;
234 if( ba>0x1FF) ba-=0x400;
235 ra = (~(*DTTFiterator)&0x1FFE000)>>13;
236 if( ra>0x7FF) ra-=0x1000;
240 ts2tag = (bitsID)&0x1;
241 tsqual = (~(*DTTFiterator)&0x07)-1;
242 ra = (~(*DTTFiterator)&0x7FF8)>>3;
243 if( ra>0x7FF) ra-=0x1000;
246 if(tsqual!=7 && wheelID!=-1){
249 ra, ba, tsqual, ts2tag, 0) );
255 if(wheelID==0 && bitsID<=0x4){
257 int wheelTh = bitsID-2;
259 int posALL, posBTI[7];
261 if ( wheelTh == -2 || wheelTh == -1 ||
262 ( wheelTh == 0 && (sectorID == 0 || sectorID == 3 || sectorID == 4 || sectorID == 7 || sectorID == 8 || sectorID == 11) ) ) {
264 posALL = ~(*DTTFiterator)&0x7F;
265 posBTI[0] = ~(*DTTFiterator)&0x01;
266 posBTI[1] = (~(*DTTFiterator)&0x02)>>1;
267 posBTI[2] = (~(*DTTFiterator)&0x04)>>2;
268 posBTI[3] = (~(*DTTFiterator)&0x08)>>3;
269 posBTI[4] = (~(*DTTFiterator)&0x10)>>4;
270 posBTI[5] = (~(*DTTFiterator)&0x20)>>5;
271 posBTI[6] = (~(*DTTFiterator)&0x40)>>6;
278 posALL = ~(*DTTFiterator)&0x3F80;
279 posBTI[0] = (~(*DTTFiterator)&0x0080)>>7;
280 posBTI[1] = (~(*DTTFiterator)&0x0100)>>8;
281 posBTI[2] = (~(*DTTFiterator)&0x0200)>>9;
282 posBTI[3] = (~(*DTTFiterator)&0x0400)>>10;
283 posBTI[4] = (~(*DTTFiterator)&0x0800)>>11;
284 posBTI[5] = (~(*DTTFiterator)&0x1000)>>12;
285 posBTI[6] = (~(*DTTFiterator)&0x2000)>>13;
292 posALL = ~(*DTTFiterator)&0x1FC000;
293 posBTI[0] = (~(*DTTFiterator)&0x004000)>>14;
294 posBTI[1] = (~(*DTTFiterator)&0x008000)>>15;
295 posBTI[2] = (~(*DTTFiterator)&0x010000)>>16;
296 posBTI[3] = (~(*DTTFiterator)&0x020000)>>17;
297 posBTI[4] = (~(*DTTFiterator)&0x040000)>>18;
298 posBTI[5] = (~(*DTTFiterator)&0x080000)>>19;
299 posBTI[6] = (~(*DTTFiterator)&0x100000)>>20;
309 posALL = ~(*DTTFiterator)&0x7F;
310 posBTI[6] = ~(*DTTFiterator)&0x01;
311 posBTI[5] = (~(*DTTFiterator)&0x02)>>1;
312 posBTI[4] = (~(*DTTFiterator)&0x04)>>2;
313 posBTI[3] = (~(*DTTFiterator)&0x08)>>3;
314 posBTI[2] = (~(*DTTFiterator)&0x10)>>4;
315 posBTI[1] = (~(*DTTFiterator)&0x20)>>5;
316 posBTI[0] = (~(*DTTFiterator)&0x40)>>6;
323 posALL = ~(*DTTFiterator)&0x3F80;
324 posBTI[6] = (~(*DTTFiterator)&0x0080)>>7;
325 posBTI[5] = (~(*DTTFiterator)&0x0100)>>8;
326 posBTI[4] = (~(*DTTFiterator)&0x0200)>>9;
327 posBTI[3] = (~(*DTTFiterator)&0x0400)>>10;
328 posBTI[2] = (~(*DTTFiterator)&0x0800)>>11;
329 posBTI[1] = (~(*DTTFiterator)&0x1000)>>12;
330 posBTI[0] = (~(*DTTFiterator)&0x2000)>>13;
337 posALL = ~(*DTTFiterator)&0x1FC000;
338 posBTI[6] = (~(*DTTFiterator)&0x004000)>>14;
339 posBTI[5] = (~(*DTTFiterator)&0x008000)>>15;
340 posBTI[4] = (~(*DTTFiterator)&0x010000)>>16;
341 posBTI[3] = (~(*DTTFiterator)&0x020000)>>17;
342 posBTI[2] = (~(*DTTFiterator)&0x040000)>>18;
343 posBTI[1] = (~(*DTTFiterator)&0x080000)>>19;
344 posBTI[0] = (~(*DTTFiterator)&0x100000)>>20;
355 if(wheelID!=0 && bitsID>=0xA && bitsID<=0xB){
357 int candID = bitsID - 0xA;
359 addr4[candID] = ((*DTTFiterator)&0x0F);
360 addr3[candID] = ((*DTTFiterator)&0xF0)>>4;
361 addr2[candID] = ((*DTTFiterator)&0xF00)>>8;
362 addr1[candID] = ((*DTTFiterator)&0x3000)>>12;
367 if(wheelID!=0 && bitsID>=0xC){
375 muonID = (bitsID&0x1);
376 qual = (~(*DTTFiterator)&0x07);
377 phi = ((*DTTFiterator)&0x7F8)>>3;
378 ch = (~(*DTTFiterator)&0x800)>>11;
379 pt = (~(*DTTFiterator)&0x1F000)>>12;
383 L1MuDTTrackCand( 0, phi, 0, pt, ch, 1, 0, qual, bxID, wheelID, sectorID,
384 muonID, addr1[muonID], addr2[muonID], addr3[muonID], addr4[muonID] ) );
390 if(wheelID==0 && bitsID>=0x8){
392 int wheelTh = bitsID&0x7;
396 etaALL = ~(*DTTFiterator)&0x007F;
398 etTrack[bxID+1][sectorID][wheelTh][0] = (*DTTFiterator)&0x003F;
399 efTrack[bxID+1][sectorID][wheelTh][0] = (~(*DTTFiterator)&0x0040)>>6;
402 etaALL = (~(*DTTFiterator)&0x3F80)>>7;
404 etTrack[bxID+1][sectorID][wheelTh][1]= ( (*DTTFiterator)&0x1F80)>>7;
405 efTrack[bxID+1][sectorID][wheelTh][1]= (~(*DTTFiterator)&0x2000)>>13;
bool getByToken(EDGetToken token, Handle< PROD > &result) const
L1MuDTChambPhContainer::Phi_Container phiSegments
unsigned int etTrack[3][12][6][2]
size_t size() const
Lenght of the data buffer in bytes.
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Abs< T >::type abs(const T &t)
L1MuDTChambThContainer::The_Container theSegments
L1MuDTTrackContainer::TrackContainer dtTracks
edm::EDGetTokenT< FEDRawDataCollection > Raw_token
unsigned int efTrack[3][12][6][2]
void calcCRC(int myD1, int myD2, int &myC)
char data[epos_bytes_allocation]
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.