92 vector<int> DTTFWordContainer;
93 vector<int>::iterator DTTFiterator;
100 int DTTFChan, bitsID;
101 int addr1[2] = { 3, 3};
102 int addr2[2] = {15, 15};
103 int addr3[2] = {15, 15};
104 int addr4[2] = {15, 15};
114 if ( dttfdata.
size() == 0 )
return;
116 int* dataWord1 =
new int;
117 int* dataWord2 =
new int;
118 unsigned char* LineFED=dttfdata.
data();
119 *dataWord2=*((
int*)LineFED);
121 *dataWord1=*((
int*)LineFED);
124 BOEevTy = ((*dataWord1)&0xFF000000)>>24;
125 DTTFId = ((*dataWord2)&0x000FFF00)>>8;
127 if( (BOEevTy != 0x50) || ( DTTFId != 0x030C) ){
129 <<
"Not a DTTF header " << hex << *dataWord1;
136 calcCRC(*dataWord1, *dataWord2, newCRC);
142 *dataWord2=*((
int*)LineFED);
144 *dataWord1=*((
int*)LineFED);
145 int chkEOE = ((*dataWord1)&0xFFF00000)>>20;
148 while(chkEOE != 0xA00){
150 calcCRC(*dataWord1, *dataWord2, newCRC);
152 DTTFWord = *dataWord1;
153 DTTFWordContainer.push_back(DTTFWord);
154 DTTFWord = *dataWord2;
155 DTTFWordContainer.push_back(DTTFWord);
158 *dataWord2=*((
int*)LineFED);
160 *dataWord1=*((
int*)LineFED);
161 chkEOE = ((*dataWord1)&0xFFF00000)>>20;
166 <<
"Warning : number of DTTF lines > 3026 ";
177 evtLgth = ((*dataWord1)&0x00FFFFFF);
178 CRC = ((*dataWord2)&0xFFFF0000)>>16;
180 calcCRC(*dataWord1, (*dataWord2)&0xFFFF, newCRC);
183 <<
"Calculated CRC " << hex << newCRC <<
" differs from CRC in trailer " << hex << CRC;
189 if( lines != evtLgth){
191 <<
"Number of words read != event length " << dec << lines <<
" " << evtLgth;
200 for( DTTFiterator = DTTFWordContainer.begin();
201 DTTFiterator != DTTFWordContainer.end();
204 DTTFChan = ((*DTTFiterator)&0xFF000000)>>24;
206 bitsID = ((*DTTFiterator)&0xF0000000)>>28;
208 int bxID =
bxNr(DTTFChan);
209 if(bxID == -999)
continue;
210 int wheelID =
wheel(DTTFChan);
211 if(wheelID == -999)
continue;
212 int sectorID =
sector(DTTFChan);
213 if(sectorID == -999)
continue;
216 if(wheelID!=0 && bitsID<=0x9){
218 int wheelPh = (
abs(wheelID)-1)*wheelID/
abs(wheelID);
225 if ( ( bitsID >> 1 ) == 0 ){ stationID = 1;}
226 if ( ( bitsID >> 1 ) == 1 ){ stationID = 2;}
227 if ( ( bitsID >> 1 ) == 4 ){ stationID = 3;}
228 if ( ( bitsID >> 1 ) == 2 ){ stationID = 4;}
232 ts2tag = (bitsID)&0x1;
233 tsqual = (~(*DTTFiterator)&0x07)-1;
234 ba = (~(*DTTFiterator)&0x1FF8)>>3;
235 if( ba>0x1FF) ba-=0x400;
236 ra = (~(*DTTFiterator)&0x1FFE000)>>13;
237 if( ra>0x7FF) ra-=0x1000;
241 ts2tag = (bitsID)&0x1;
242 tsqual = (~(*DTTFiterator)&0x07)-1;
243 ra = (~(*DTTFiterator)&0x7FF8)>>3;
244 if( ra>0x7FF) ra-=0x1000;
247 if(tsqual!=7 && wheelID!=-1){
250 ra, ba, tsqual, ts2tag, 0) );
256 if(wheelID==0 && bitsID<=0x4){
258 int wheelTh = bitsID-2;
260 int posALL, posBTI[7];
262 if ( wheelTh == -2 || wheelTh == -1 ||
263 ( wheelTh == 0 && (sectorID == 0 || sectorID == 3 || sectorID == 4 || sectorID == 7 || sectorID == 8 || sectorID == 11) ) ) {
265 posALL = ~(*DTTFiterator)&0x7F;
266 posBTI[0] = ~(*DTTFiterator)&0x01;
267 posBTI[1] = (~(*DTTFiterator)&0x02)>>1;
268 posBTI[2] = (~(*DTTFiterator)&0x04)>>2;
269 posBTI[3] = (~(*DTTFiterator)&0x08)>>3;
270 posBTI[4] = (~(*DTTFiterator)&0x10)>>4;
271 posBTI[5] = (~(*DTTFiterator)&0x20)>>5;
272 posBTI[6] = (~(*DTTFiterator)&0x40)>>6;
279 posALL = ~(*DTTFiterator)&0x3F80;
280 posBTI[0] = (~(*DTTFiterator)&0x0080)>>7;
281 posBTI[1] = (~(*DTTFiterator)&0x0100)>>8;
282 posBTI[2] = (~(*DTTFiterator)&0x0200)>>9;
283 posBTI[3] = (~(*DTTFiterator)&0x0400)>>10;
284 posBTI[4] = (~(*DTTFiterator)&0x0800)>>11;
285 posBTI[5] = (~(*DTTFiterator)&0x1000)>>12;
286 posBTI[6] = (~(*DTTFiterator)&0x2000)>>13;
293 posALL = ~(*DTTFiterator)&0x1FC000;
294 posBTI[0] = (~(*DTTFiterator)&0x004000)>>14;
295 posBTI[1] = (~(*DTTFiterator)&0x008000)>>15;
296 posBTI[2] = (~(*DTTFiterator)&0x010000)>>16;
297 posBTI[3] = (~(*DTTFiterator)&0x020000)>>17;
298 posBTI[4] = (~(*DTTFiterator)&0x040000)>>18;
299 posBTI[5] = (~(*DTTFiterator)&0x080000)>>19;
300 posBTI[6] = (~(*DTTFiterator)&0x100000)>>20;
310 posALL = ~(*DTTFiterator)&0x7F;
311 posBTI[6] = ~(*DTTFiterator)&0x01;
312 posBTI[5] = (~(*DTTFiterator)&0x02)>>1;
313 posBTI[4] = (~(*DTTFiterator)&0x04)>>2;
314 posBTI[3] = (~(*DTTFiterator)&0x08)>>3;
315 posBTI[2] = (~(*DTTFiterator)&0x10)>>4;
316 posBTI[1] = (~(*DTTFiterator)&0x20)>>5;
317 posBTI[0] = (~(*DTTFiterator)&0x40)>>6;
324 posALL = ~(*DTTFiterator)&0x3F80;
325 posBTI[6] = (~(*DTTFiterator)&0x0080)>>7;
326 posBTI[5] = (~(*DTTFiterator)&0x0100)>>8;
327 posBTI[4] = (~(*DTTFiterator)&0x0200)>>9;
328 posBTI[3] = (~(*DTTFiterator)&0x0400)>>10;
329 posBTI[2] = (~(*DTTFiterator)&0x0800)>>11;
330 posBTI[1] = (~(*DTTFiterator)&0x1000)>>12;
331 posBTI[0] = (~(*DTTFiterator)&0x2000)>>13;
338 posALL = ~(*DTTFiterator)&0x1FC000;
339 posBTI[6] = (~(*DTTFiterator)&0x004000)>>14;
340 posBTI[5] = (~(*DTTFiterator)&0x008000)>>15;
341 posBTI[4] = (~(*DTTFiterator)&0x010000)>>16;
342 posBTI[3] = (~(*DTTFiterator)&0x020000)>>17;
343 posBTI[2] = (~(*DTTFiterator)&0x040000)>>18;
344 posBTI[1] = (~(*DTTFiterator)&0x080000)>>19;
345 posBTI[0] = (~(*DTTFiterator)&0x100000)>>20;
356 if(wheelID!=0 && bitsID>=0xA && bitsID<=0xB){
358 int candID = bitsID - 0xA;
360 addr4[candID] = ((*DTTFiterator)&0x0F);
361 addr3[candID] = ((*DTTFiterator)&0xF0)>>4;
362 addr2[candID] = ((*DTTFiterator)&0xF00)>>8;
363 addr1[candID] = ((*DTTFiterator)&0x3000)>>12;
368 if(wheelID!=0 && bitsID>=0xC){
376 muonID = (bitsID&0x1);
377 qual = (~(*DTTFiterator)&0x07);
378 phi = ((*DTTFiterator)&0x7F8)>>3;
379 ch = (~(*DTTFiterator)&0x800)>>11;
380 pt = (~(*DTTFiterator)&0x1F000)>>12;
384 L1MuDTTrackCand( 0, phi, 0, pt, ch, 1, 0, qual, bxID, wheelID, sectorID,
385 muonID, addr1[muonID], addr2[muonID], addr3[muonID], addr4[muonID] ) );
391 if(wheelID==0 && bitsID>=0x8){
393 int wheelTh = bitsID&0x7;
397 etaALL = ~(*DTTFiterator)&0x007F;
399 etTrack[bxID+1][sectorID][wheelTh][0] = (*DTTFiterator)&0x003F;
400 efTrack[bxID+1][sectorID][wheelTh][0] = (~(*DTTFiterator)&0x0040)>>6;
403 etaALL = (~(*DTTFiterator)&0x3F80)>>7;
405 etTrack[bxID+1][sectorID][wheelTh][1]= ( (*DTTFiterator)&0x1F80)>>7;
406 efTrack[bxID+1][sectorID][wheelTh][1]= (~(*DTTFiterator)&0x2000)>>13;
L1MuDTChambPhContainer::Phi_Container phiSegments
unsigned int etTrack[3][12][6][2]
size_t size() const
Lenght of the data buffer in bytes.
Abs< T >::type abs(const T &t)
L1MuDTChambThContainer::The_Container theSegments
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
L1MuDTTrackContainer::TrackContainer dtTracks
unsigned int efTrack[3][12][6][2]
void calcCRC(int myD1, int myD2, int &myC)
edm::InputTag getDTTFInputTag()
char data[epos_bytes_allocation]
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.