94 vector<int> DTTFWordContainer;
95 vector<int>::iterator DTTFiterator;
102 int DTTFChan, bitsID;
103 int addr1[2] = { 3, 3};
104 int addr2[2] = {15, 15};
105 int addr3[2] = {15, 15};
106 int addr4[2] = {15, 15};
116 if ( dttfdata.
size() == 0 )
return;
118 int* dataWord1 =
new int;
119 int* dataWord2 =
new int;
120 unsigned char* LineFED=dttfdata.
data();
121 *dataWord2=*((
int*)LineFED);
123 *dataWord1=*((
int*)LineFED);
126 BOEevTy = ((*dataWord1)&0xFF000000)>>24;
127 DTTFId = ((*dataWord2)&0x000FFF00)>>8;
129 if( (BOEevTy != 0x50) || ( DTTFId != 0x030C) ){
131 <<
"Not a DTTF header " << hex << *dataWord1;
138 calcCRC(*dataWord1, *dataWord2, newCRC);
144 *dataWord2=*((
int*)LineFED);
146 *dataWord1=*((
int*)LineFED);
147 int chkEOE = ((*dataWord1)&0xFFF00000)>>20;
150 while(chkEOE != 0xA00){
152 calcCRC(*dataWord1, *dataWord2, newCRC);
154 DTTFWord = *dataWord1;
155 DTTFWordContainer.push_back(DTTFWord);
156 DTTFWord = *dataWord2;
157 DTTFWordContainer.push_back(DTTFWord);
160 *dataWord2=*((
int*)LineFED);
162 *dataWord1=*((
int*)LineFED);
163 chkEOE = ((*dataWord1)&0xFFF00000)>>20;
168 <<
"Warning : number of DTTF lines > 3026 ";
179 evtLgth = ((*dataWord1)&0x00FFFFFF);
180 CRC = ((*dataWord2)&0xFFFF0000)>>16;
182 calcCRC(*dataWord1, (*dataWord2)&0xFFFF, newCRC);
185 <<
"Calculated CRC " << hex << newCRC <<
" differs from CRC in trailer " << hex << CRC;
191 if( lines != evtLgth){
193 <<
"Number of words read != event length " << dec << lines <<
" " << evtLgth;
202 for( DTTFiterator = DTTFWordContainer.begin();
203 DTTFiterator != DTTFWordContainer.end();
206 DTTFChan = ((*DTTFiterator)&0xFF000000)>>24;
208 bitsID = ((*DTTFiterator)&0xF0000000)>>28;
210 int bxID =
bxNr(DTTFChan);
211 if(bxID == -999)
continue;
212 int wheelID =
wheel(DTTFChan);
213 if(wheelID == -999)
continue;
214 int sectorID =
sector(DTTFChan);
215 if(sectorID == -999)
continue;
218 if(wheelID!=0 && bitsID<=0x9){
220 int wheelPh = (
abs(wheelID)-1)*wheelID/
abs(wheelID);
227 if ( ( bitsID >> 1 ) == 0 ){ stationID = 1;}
228 if ( ( bitsID >> 1 ) == 1 ){ stationID = 2;}
229 if ( ( bitsID >> 1 ) == 4 ){ stationID = 3;}
230 if ( ( bitsID >> 1 ) == 2 ){ stationID = 4;}
234 ts2tag = (bitsID)&0x1;
235 tsqual = (~(*DTTFiterator)&0x07)-1;
236 ba = (~(*DTTFiterator)&0x1FF8)>>3;
237 if( ba>0x1FF) ba-=0x400;
238 ra = (~(*DTTFiterator)&0x1FFE000)>>13;
239 if( ra>0x7FF) ra-=0x1000;
243 ts2tag = (bitsID)&0x1;
244 tsqual = (~(*DTTFiterator)&0x07)-1;
245 ra = (~(*DTTFiterator)&0x7FF8)>>3;
246 if( ra>0x7FF) ra-=0x1000;
249 if(tsqual!=7 && wheelID!=-1){
252 ra, ba, tsqual, ts2tag, 0) );
258 if(wheelID==0 && bitsID<=0x4){
260 int wheelTh = bitsID-2;
262 int posALL, posBTI[7];
264 if ( wheelTh == -2 || wheelTh == -1 ||
265 ( wheelTh == 0 && (sectorID == 0 || sectorID == 3 || sectorID == 4 || sectorID == 7 || sectorID == 8 || sectorID == 11) ) ) {
267 posALL = ~(*DTTFiterator)&0x7F;
268 posBTI[0] = ~(*DTTFiterator)&0x01;
269 posBTI[1] = (~(*DTTFiterator)&0x02)>>1;
270 posBTI[2] = (~(*DTTFiterator)&0x04)>>2;
271 posBTI[3] = (~(*DTTFiterator)&0x08)>>3;
272 posBTI[4] = (~(*DTTFiterator)&0x10)>>4;
273 posBTI[5] = (~(*DTTFiterator)&0x20)>>5;
274 posBTI[6] = (~(*DTTFiterator)&0x40)>>6;
281 posALL = ~(*DTTFiterator)&0x3F80;
282 posBTI[0] = (~(*DTTFiterator)&0x0080)>>7;
283 posBTI[1] = (~(*DTTFiterator)&0x0100)>>8;
284 posBTI[2] = (~(*DTTFiterator)&0x0200)>>9;
285 posBTI[3] = (~(*DTTFiterator)&0x0400)>>10;
286 posBTI[4] = (~(*DTTFiterator)&0x0800)>>11;
287 posBTI[5] = (~(*DTTFiterator)&0x1000)>>12;
288 posBTI[6] = (~(*DTTFiterator)&0x2000)>>13;
295 posALL = ~(*DTTFiterator)&0x1FC000;
296 posBTI[0] = (~(*DTTFiterator)&0x004000)>>14;
297 posBTI[1] = (~(*DTTFiterator)&0x008000)>>15;
298 posBTI[2] = (~(*DTTFiterator)&0x010000)>>16;
299 posBTI[3] = (~(*DTTFiterator)&0x020000)>>17;
300 posBTI[4] = (~(*DTTFiterator)&0x040000)>>18;
301 posBTI[5] = (~(*DTTFiterator)&0x080000)>>19;
302 posBTI[6] = (~(*DTTFiterator)&0x100000)>>20;
312 posALL = ~(*DTTFiterator)&0x7F;
313 posBTI[6] = ~(*DTTFiterator)&0x01;
314 posBTI[5] = (~(*DTTFiterator)&0x02)>>1;
315 posBTI[4] = (~(*DTTFiterator)&0x04)>>2;
316 posBTI[3] = (~(*DTTFiterator)&0x08)>>3;
317 posBTI[2] = (~(*DTTFiterator)&0x10)>>4;
318 posBTI[1] = (~(*DTTFiterator)&0x20)>>5;
319 posBTI[0] = (~(*DTTFiterator)&0x40)>>6;
326 posALL = ~(*DTTFiterator)&0x3F80;
327 posBTI[6] = (~(*DTTFiterator)&0x0080)>>7;
328 posBTI[5] = (~(*DTTFiterator)&0x0100)>>8;
329 posBTI[4] = (~(*DTTFiterator)&0x0200)>>9;
330 posBTI[3] = (~(*DTTFiterator)&0x0400)>>10;
331 posBTI[2] = (~(*DTTFiterator)&0x0800)>>11;
332 posBTI[1] = (~(*DTTFiterator)&0x1000)>>12;
333 posBTI[0] = (~(*DTTFiterator)&0x2000)>>13;
340 posALL = ~(*DTTFiterator)&0x1FC000;
341 posBTI[6] = (~(*DTTFiterator)&0x004000)>>14;
342 posBTI[5] = (~(*DTTFiterator)&0x008000)>>15;
343 posBTI[4] = (~(*DTTFiterator)&0x010000)>>16;
344 posBTI[3] = (~(*DTTFiterator)&0x020000)>>17;
345 posBTI[2] = (~(*DTTFiterator)&0x040000)>>18;
346 posBTI[1] = (~(*DTTFiterator)&0x080000)>>19;
347 posBTI[0] = (~(*DTTFiterator)&0x100000)>>20;
358 if(wheelID!=0 && bitsID>=0xA && bitsID<=0xB){
360 int candID = bitsID - 0xA;
362 addr4[candID] = ((*DTTFiterator)&0x0F);
363 addr3[candID] = ((*DTTFiterator)&0xF0)>>4;
364 addr2[candID] = ((*DTTFiterator)&0xF00)>>8;
365 addr1[candID] = ((*DTTFiterator)&0x3000)>>12;
370 if(wheelID!=0 && bitsID>=0xC){
378 muonID = (bitsID&0x1);
379 qual = (~(*DTTFiterator)&0x07);
380 phi = ((*DTTFiterator)&0x7F8)>>3;
381 ch = (~(*DTTFiterator)&0x800)>>11;
382 pt = (~(*DTTFiterator)&0x1F000)>>12;
386 L1MuDTTrackCand( 0, phi, 0, pt, ch, 1, 0, qual, bxID, wheelID, sectorID,
387 muonID, addr1[muonID], addr2[muonID], addr3[muonID], addr4[muonID] ) );
393 if(wheelID==0 && bitsID>=0x8){
395 int wheelTh = bitsID&0x7;
399 etaALL = ~(*DTTFiterator)&0x007F;
401 etTrack[bxID+1][sectorID][wheelTh][0] = (*DTTFiterator)&0x003F;
402 efTrack[bxID+1][sectorID][wheelTh][0] = (~(*DTTFiterator)&0x0040)>>6;
405 etaALL = (~(*DTTFiterator)&0x3F80)>>7;
407 etTrack[bxID+1][sectorID][wheelTh][1]= ( (*DTTFiterator)&0x1F80)>>7;
408 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.
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()
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.