CDF II
CDF KITS
source navigation ]
diff markup ]
identifier search ]
freetext search ]
file search ]
 
Architecture: i386 ]
Version: 4.10.4 ] [ 4.10.5 ] [ 4.8.4 ] [ 4.8.4l3s ] [ 4.8.5 ] [ 4.9.0 ] [ 4.9.1 ] [ 4.9.1.hpt3 ] [ 4.9.1hpt3 ] [ 4.9.1top1 ] [ 5.0.0 ] [ 5.1.0 ] [ 5.1.0beamonly ] [ 5.1.1 ] [ 5.2.0 ] [ 5.3.0 ] [ 5.3.1 ] [ 5.3.1dsp ] [ 5.3.3 ] [ 5.3.3_nt ] [ 5.3.4 ] [ 6.1.1 ] [ 6.1.1b ] [ 6.1.2 ] [ 6.1.3 ] [ 6.1.4 ] [ 6.1.4int3 ] [ 6.1.4mc ] [ 6.1.4mc_a ] [ 6.1.6 ] [ development ]

001 /**********************************************************************
002  xtrpMapGen.cc 
003 
004  Does the actual mapping.
005 **********************************************************************/
006 
007 #include <cstdio>
008 #include <math.h>
009 #include <iostream>
010 
011 #include "AbsEnv/AbsEnv.hh"
012 #include "XTRPSim/XTRPMap.hh"
013 
014 int i2pow(int i) { return((int)pow(2.0,(double)i)); }
015 
016 int OinkyDoinky(int CaseF, int iXFTSlice, int Bits, float ptBin[2][128], float dptXFT[2], detType Det[nDet+1],int iwedge,int Stereo[14]) {
017   /* usual suspects */
018   int i = 0;
019   int j = 0;
020   int k = 0;
021   int m = 0;
022 
023   int hitMap = 0;
024 
025   int Tix[4];
026 
027   int DType = 0;
028 
029   float phi_H = 0.;
030   float phi_L = 0.;
031   float sigma = 0.;
032   float pt = 0.;
033   float phiXFT = 0.;
034   float dPhiCrk = 0.;
035   int nCrack = 2;
036 
037   int iPtCutFlg = 0;
038   int HitFlg = 0;
039   int loPtBit = 0;
040   int hiPtBit = 0;
041   int calBitBase0 = 0;
042   int calBitBase1 = 0;
043   int iCal = 0;
044 
045   int CType = 0;
046   int iPhi = 0;
047   int iShort = 0;
048   int iPtBin = 0;
049   int iStereo = 0;
050   int muStereoConf[3];
051 
052 
053   int DiracStereoConf[8];
054   int CMUStereoConf[3];
055   int CMXStereoConf[3];
056   int TrkStereoConf;
057   int PhiGapStereoConf;
058 
059   bool once=true;
060 
061   if(once){
062   once=false;
063   for(int jj = 0; jj<2; jj++){
064           DiracStereoConf[jj]=Stereo[jj];
065           CMUStereoConf[jj]=Stereo[jj+8];
066           CMXStereoConf[jj]=Stereo[jj+10];
067           }
068   for(int jj = 2; jj<8; jj++){
069           DiracStereoConf[jj]=Stereo[jj];
070         }
071   TrkStereoConf = Stereo[12];
072   PhiGapStereoConf = Stereo[13];
073 
074   //std::cout << " testing: TrkStereoConf = " << TrkStereoConf << std::endl;
075   //Init variables BW 8-6-2003-------------------
076 
077   for(int jj = 0; jj < 3; jj++ )
078     {
079           muStereoConf[jj] = 0;
080     }
081   }
082   for(int jj = 0; jj < 4; jj++ )
083   {
084           Tix[jj] = -9999;
085   }
086 
087   //---------------------------------------------
088 
089 
090   /* decoding address */
091   CType  =  (Bits &  (i2pow(nTypeBit )-1));
092   iPhi   = ((Bits & ((i2pow(nPhiBit  )-1) << nTypeBit)) >> nTypeBit);
093   iShort = ((Bits & ((i2pow(nShortBit)-1) << (nTypeBit+nPhiBit))) >>
094             (nTypeBit+nPhiBit));
095   iPtBin = ((Bits & ((i2pow(nPtBinBit)-1) << (nTypeBit+nPhiBit+nShortBit))) >>
096             (nTypeBit+nPhiBit+nShortBit));
097   iStereo = ((Bits >> 13) & 1);
098 
099   for(int jj=0; jj<3; jj++) {muStereoConf[jj]=0;}
100 
101 
102 
103 
104   /* decipher CType and CaseF into detector code */
105   if (CaseF == 0) {
106     if (CType == 0 || CType == 1) {
107       DType = Cmu;
108     } else if (CType == 2 || CType == 3) {
109       DType = Cmx;
110     } else {
111       return(-1);
112     }
113   } else if(CaseF == 1) {
114     if (CType == 0) {
115       DType = Cal;
116     } else if (CType == 1) {
117       DType = Crk;
118     } else if (CType == 2 || CType == 3) {
119       DType = Imu;
120     } else {
121       return(-1);
122     }
123   } else {
124    return(-1);
125   }
126 
127   if (DType == Cmu){
128     muStereoConf[0] = CMUStereoConf[0]; 
129     muStereoConf[1] = CMUStereoConf[1]; 
130     muStereoConf[2] = CMUStereoConf[1]; 
131    }
132   else if (DType == Cmx){
133     muStereoConf[0] = CMXStereoConf[0]; 
134     muStereoConf[1] = CMXStereoConf[1]; 
135     muStereoConf[2] = CMXStereoConf[1]; 
136    }
137 
138   hitMap = 0;
139 
140   /* angle of XFT mini-slices */
141   phiXFT = (iXFTSlice+(iPhi+0.5)/8.0)*1.25;
142 
143   /* iShort == 1 -> short track! */
144   pt = ptBin[iShort][iPtBin];
145 
146   if (DType == Crk) {
147       hitMap = 0;
148       loPtBit = -1;
149       hiPtBit = -1;
150       dPhiCrk = 1.2;
151       nCrack = 2;
152       if (fabs(pt) > 0) {
153         /* calculate the track footprint for CMU Crack*/
154         sigma = sqrt(pow((double)Det[Cmu].xi,2.0)*
155                    (pow((double)Det[Cmu].dk/pt,2.0)+
156                     pow((double)(dptXFT[iShort]*Det[Cmu].k),2.0)) + 
157                    pow((double)Det[Cmu].misAlign,2.0));
158         phi_L = Det[Cmu].k/pt + phiXFT - sigma; 
159         phi_H = Det[Cmu].k/pt + phiXFT + sigma; 
160         //if (iXFTSlice == 0 && iPtBin ==41){
161         //std::cout << "slice=" << iXFTSlice << " Pt=" << iPtBin << std::endl;
162         //std::cout << "miniphi=" << iPhi << "short=" << iShort << std::endl;
163         //std::cout << "philo=" << phi_L << " phi_H=" << phi_H << std::endl;
164         //std::cout << "dPhiCrk=" << dPhiCrk << std::endl;  
165         //}
166         for (i=0; i<nCrack; i++) {
167           if ((phi_L < (1-i)*15.0-dPhiCrk && phi_H > (1-i)*15.0-dPhiCrk) ||
168              (phi_L > (1-i)*15.0-dPhiCrk && phi_L < (1-i)*15.0+dPhiCrk)) {
169             if((PhiGapStereoConf == 0 || iStereo == 1)){
170             if(iwedge == 0){
171               hiPtBit = i*6; 
172             /* loPtBit = hiPtBit + 1; lowPtBit unused! */ 
173             }
174             else{
175                hiPtBit = -4*i + 10; 
176             /*  loPtBit = hiPtBit + 1; lowPtBit unused! */ 
177             }
178             }
179         //if (iXFTSlice == 0 && iPtBin ==41){
180         // std::cout << "iwedge = " << iwedge << std::endl;
181         // std::cout << "i=" << i << " hiPtBit=" << hiPtBit << " loPtBit=" << loPtBit << std::endl;
182         //}
183             if (fabs((double)pt) > Det[DType].ptCut[TrgMe] && iShort == 0) {/* 4 layer kludge */
184               hitMap = hitMap + i2pow(hiPtBit);
185             }
186             
187             if (fabs((double)pt) > Det[DType].ptCut[TrgLo] && iShort == 0) {/* 4 layer kludge */
188               /* hitMap = hitMap + i2pow(loPtBit);  */
189             }
190           }
191         }
192 
193         /* overkill */
194         if (hiPtBit < 0) hitMap = 0;
195       }
196 
197       /* calculate the track footprint for TOF
198       sigma = sqrt(pow((double)Det[Crk].xi,2.0)*
199                    (pow((double)Det[Crk].dk/pt,2.0)+
200                     pow((double)(dptXFT[iShort]*Det[Crk].k),2.0)) + 
201                    pow((double)Det[Crk].misAlign,2.0));
202       sigma = 3.0;
203       phi_L = phiXFT - sigma; 
204       phi_H = phiXFT + sigma; 
205       if (fabs((double)pt) > Det[DType].ptCut[TrgHi] && iShort == 0) {
206         dPhiCrk = 7.5;
207         for (i=0; i<nWedge; i++) {
208           if ((phi_L < (1-i)*15.0 && phi_H > (1-i)*15.0) ||
209               (phi_L > (1-i)*15.0 && phi_L < (1-i)*15.0+dPhiCrk)) 
210             hitMap |= i2pow(i*6+2);
211           if ((phi_L < (1-i)*15.0+dPhiCrk && phi_H > (1-i)*15.0+dPhiCrk) ||
212               (phi_L > (1-i)*15.0+dPhiCrk && phi_L < (1-i)*15.0+2*dPhiCrk)) 
213             hitMap |= i2pow(i*6+3);
214         }
215       }
216       */
217 
218       /* kludge to always set CMX crack bits for TOF */
219       //  hitMap |= i2pow(8) + i2pow(9);
220       hitMap = hitMap + i2pow(8) + i2pow(9);
221 
222       return(hitMap);
223   }
224 
225 
226   if ((int)pt == 0) {
227     goto GoKilDong;
228   }
229   /* calculate the track footprint */
230   sigma = sqrt(pow((double)Det[DType].xi,2.0)*
231                (pow((double)Det[DType].dk/pt,2.0)+
232                 pow((double)(dptXFT[iShort]*Det[DType].k),2.0)) + 
233                pow((double)Det[DType].misAlign,2.0));
234 
235   phi_L = Det[DType].k/pt + phiXFT - sigma; 
236   phi_H = Det[DType].k/pt + phiXFT + sigma; 
237 
238   if (DType == Cmu || DType == Cmx|| DType == Imu) {
239     m = NtCmu;
240   } else if (DType == Cal) {
241     m = NtCal;
242   } else {
243     m = NtCrk;
244   }
245 
246   /* Set the ``hitmap'' bits */
247   //  this piece is for the tighter IMU maps 
248   // after the fall 2003 shutdown.
249   if ((DType == Imu) && (gblEnv->runNumber() > 174850)){
250 
251     for (j=0;j<nWedge;j++) {
252       for (k=0;k<m;k++) {
253         Det[DType].Tower[k][j] =0;
254       }
255     }
256   /* for (j=0;j<nWedge;j++) { */
257     j=1;
258     for (k=0;k<m;k++) {
259       if ((phi_L > Det[DType].phiLo[k][j] &&
260            phi_H < Det[DType].phiHi[k][j]) ||
261           (phi_L < Det[DType].phiLo[k][j] &&
262            phi_H > Det[DType].phiLo[k][j] &&
263            phi_H < Det[DType].phiHi[k][j]) ||
264           (phi_L > Det[DType].phiLo[k][j] &&
265            phi_L < Det[DType].phiHi[k][j] &&
266            phi_H > Det[DType].phiHi[k][j]) ||
267           (phi_L < Det[DType].phiLo[k][j] &&
268            phi_H > Det[DType].phiHi[k][j])) {
269         Det[DType].Tower[k][j] =1;
270       }
271     }
272   /* }  */
273     /* extra piece for A-> B boundary */
274     if(iwedge==0){
275       j=2;
276       for(k=0;k<2;k++){
277         if ((phi_L > Det[DType].phiLo[k][j] &&
278              phi_H < Det[DType].phiHi[k][j]) ||
279             (phi_L < Det[DType].phiLo[k][j] &&
280              phi_H > Det[DType].phiLo[k][j] &&
281              phi_H < Det[DType].phiHi[k][j]) ||
282             (phi_L > Det[DType].phiLo[k][j] &&
283              phi_L < Det[DType].phiHi[k][j] &&
284              phi_H > Det[DType].phiHi[k][j]) ||
285             (phi_L < Det[DType].phiLo[k][j] &&
286              phi_H > Det[DType].phiHi[k][j])) {
287           Det[DType].Tower[k][j] =1;
288         }
289       }
290     }else{
291       j=0;
292       for(k=4;k<6;k++){
293         if ((phi_L > Det[DType].phiLo[k][j] &&
294              phi_H < Det[DType].phiHi[k][j]) ||
295             (phi_L < Det[DType].phiLo[k][j] &&
296              phi_H > Det[DType].phiLo[k][j] &&
297              phi_H < Det[DType].phiHi[k][j]) ||
298             (phi_L > Det[DType].phiLo[k][j] &&
299              phi_L < Det[DType].phiHi[k][j] &&
300              phi_H > Det[DType].phiHi[k][j]) ||
301             (phi_L < Det[DType].phiLo[k][j] &&
302              phi_H > Det[DType].phiHi[k][j])) {
303           Det[DType].Tower[k][j] =1;
304         }
305       }
306     }
307     
308   }
309   else {
310     /* cmu, cmx cases ok */
311   for (j=0;j<nWedge;j++) {
312     for (k=0;k<m;k++) {
313       Det[DType].Tower[k][j] =0;
314       if ((phi_L > Det[DType].phiLo[k][j] &&
315            phi_H < Det[DType].phiHi[k][j]) ||
316           (phi_L < Det[DType].phiLo[k][j] &&
317            phi_H > Det[DType].phiLo[k][j] &&
318            phi_H < Det[DType].phiHi[k][j]) ||
319           (phi_L > Det[DType].phiLo[k][j] &&
320            phi_L < Det[DType].phiHi[k][j] &&
321            phi_H > Det[DType].phiHi[k][j]) ||
322           (phi_L < Det[DType].phiLo[k][j] &&
323            phi_H > Det[DType].phiHi[k][j])) {
324         Det[DType].Tower[k][j] =1;
325       }
326     }
327   }
328   }
329   HitFlg = 0;
330   for (j=0;j<nWedge;j++) {
331     for (k=0;k<m;k++) {
332       if (Det[DType].Tower[k][j] == 1 && HitFlg == 0) {
333         Det[DType].iPhiPik[Low][0] = j;
334         Det[DType].iPhiPik[Low][1] = k;
335         HitFlg = 1;
336       }
337       if (Det[DType].Tower[k][j] == 0 && HitFlg == 1) {
338         if (k == 0) {
339           Det[DType].iPhiPik[High][0] = j-1;
340           Det[DType].iPhiPik[High][1] = m-1;
341         } else {
342           Det[DType].iPhiPik[High][0] = j;
343           Det[DType].iPhiPik[High][1] = k-1;
344         }
345         goto KoBongI;
346       }
347     }
348   }
349   /* hit on the tower (nWedge-1:m-1) */ 
350   if (HitFlg == 1) {
351     Det[DType].iPhiPik[High][0] = nWedge-1;
352     Det[DType].iPhiPik[High][1] = m-1;
353     goto KoBongI;
354   }
355   Tix[0] = -9999;
356 
357   goto GoKilDong;
358 
359 KoBongI:
360   Tix[0] = Det[DType].iPhiPik[Low][0];
361   Tix[1] = Det[DType].iPhiPik[Low][1];
362   Tix[2] = Det[DType].iPhiPik[High][0];
363   Tix[3] = Det[DType].iPhiPik[High][1];
364   if (Tix[0] < 0 || Tix[2] > nWedge || 
365       Tix[1] < 0 || Tix[3] > 6) {
366     Tix[0] = -9999;
367 
368     goto GoKilDong;
369   }  
370 
371 
372   if (Det[DType].phiLo[Tix[1]][Tix[0]] <= 
373       Det[DType].phiHi[Tix[3]][Tix[2]]) {
374     if (DType == Cmu || DType == Cmx || DType == Imu) {
375       iPtCutFlg = (int)fmod((float)CType,2.0);
376       /* phase */
377       /* 4&i=0  -> 3-layer, 4&i=4-> 4-layer, 8&i=8-> 3 or 4-layer */
378       /* 12&i=12 -> not assigned */
379       if (iPtCutFlg == High) {
380         /* high -> medium */
381         //        if ((fabs((double)pt) > Det[DType].ptCut[TrgMe]) 
382         //    && (iShort == 0)) { /* kludge for 4 layer */
383          i = (SHORT_TRK_BIT & Det[DType].AttrBit[TrgMe]) >> 2;
384          if ((fabs((double)pt) > Det[DType].ptCut[TrgMe]) 
385             && ((i == iShort) || (i == TRK_BOTH_LEN))
386              &&((muStereoConf[TrgMe]==0) || (iStereo ==1))) {
387           goto GoKilDong;
388         }else{
389           Tix[0] = -9999;
390           goto GoKilDong;
391         }
392       } else {
393         /* low <x< med or hi <x set the bit to 1 */ 
394         // if (((fabs((double)pt) > Det[DType].ptCut[TrgLo]  && 
395         //     fabs((double)pt) < Det[DType].ptCut[TrgMe]) ||
396         //     fabs((double)pt) > Det[DType].ptCut[TrgHi])
397         //    && (iShort == 0)) { /* kludge for 4 layer */
398          i = (SHORT_TRK_BIT & Det[DType].AttrBit[TrgLo]) >> 2;
399          if (((fabs((double)pt) > Det[DType].ptCut[TrgLo]  && 
400              fabs((double)pt) < Det[DType].ptCut[TrgMe]) ||
401              fabs((double)pt) > Det[DType].ptCut[TrgHi])
402             && ((i == iShort) || (i == TRK_BOTH_LEN)) 
403              &&((muStereoConf[TrgLo]==0) || (iStereo ==1))) {
404               goto GoKilDong;
405         }else{
406           Tix[0] = -9999;
407           goto GoKilDong;
408         }
409       }
410     } else if(DType == Cal) {
411       if (iXFTSlice > 5) {
412         calBitBase0 = CAL_BASE_LO_SEG;
413         calBitBase1 = CAL_BASE_HI_SEG;
414       } else {
415         calBitBase0 = CAL_BASE_HI_SEG;
416         calBitBase1 = CAL_BASE_LO_SEG;
417       }
418       for (iCal = 0; iCal < Det[Cal].nTrg; iCal ++){
419         // std::cout << " iCal " << iCal << " pT " << pt << " cut =" << Det[DType].ptCut[iCal] << std::endl;
420         if (fabs((double)pt) > Det[DType].ptCut[iCal]) {
421           // std::cout << " in here " << std::endl;
422           //i = (SHORT_TRK_BIT & Det[DType].AttrBit[iCal]);
423           i = (SHORT_TRK_BIT & Det[DType].AttrBit[iCal]) >> 2;         
424           /* iShort = 1 -> 3SL. 3SL and 4SL are exclusive according to Mel */ 
425           /* 4&i=0  -> 3-layer, 4&i=4-> 4-layer, 8&i=8-> 3 or 4-layer */
426           /* 12&i=12 -> not assigned */
427           //if (((i/SHORT_TRK_BASE != iShort) && (i != TRK_BOTH_LEN)) || (i == TRK_BOTH_LEN)) {
428           if ((i == iShort) || (i == TRK_BOTH_LEN)) {
429             /* track sign requirement */
430             if (((( TRK_SIGN_BIT & Det[DType].AttrBit[iCal]) == TRK_POSI_SIGN ) &&
431                   ( pt > 0 )) || 
432                 ((( TRK_SIGN_BIT & Det[DType].AttrBit[iCal]) == TRK_NEGA_SIGN ) &&
433                   ( pt < 0 )) ||
434                 ((  TRK_SIGN_BIT & Det[DType].AttrBit[iCal]) == TRK_BOTH_SIGN )
435                 //include stereo confirmation
436                 && (DiracStereoConf[iCal]==0 || iStereo==1)){
437               /* write CAL trigger info */ 
438               if (phi_L < 0.0 && phi_L >-15.0) {
439                 /* -15.0 < phiXFT-x*sigma< phiXFT+x*sigma<0.0 */
440                 if ( phi_H < 0.0) {
441                   if ( iXFTSlice < 6) 
442                     hitMap = hitMap + i2pow(iCal + calBitBase1);
443                 /* -15.0 < phiXFT-x*sigma, phiXFT+x*sigma>0.0 (<15.0) */
444                 } else if ( phi_H > 0.0 ) {
445                   if ( iXFTSlice < 6) 
446                     hitMap = hitMap + i2pow(iCal + calBitBase0)
447                     + i2pow(iCal + calBitBase1);
448                   else
449                     hitMap = hitMap + i2pow(iCal + calBitBase0);
450                 }
451               } else if (phi_L >0.0 && phi_L <15.0) {
452                 /* 0.0 < phiXFT-x*sigma< phiXFT+x*sigma<15.0 */
453                 if (phi_H>0.0 && phi_H< 15.0) {
454                   hitMap = hitMap + i2pow(iCal + calBitBase0);
455                 /* 0.0 < phiXFT-x*sigma, phiXFT+x*sigma>15.0 (<30.0) */
456                 } else if (phi_H> 15.0) {
457                   if (iXFTSlice < 6)
458                     hitMap = hitMap + i2pow(iCal + calBitBase0);
459                   else
460                     hitMap = hitMap + i2pow(iCal + calBitBase0)
461                     + i2pow(iCal + calBitBase1);
462                 }
463               /* 15.0 < phiXFT-x*sigma<30.0, phiXFT+x*sigma>30.0 */
464               } else if (phi_L >15.0 && phi_L < 30.0) {
465                 if (iXFTSlice < 6)
466                   hitMap = hitMap + i2pow(iCal + calBitBase0); 
467                 else 
468                   hitMap = hitMap + i2pow(iCal + calBitBase0) 
469                          + i2pow(iCal + calBitBase1); 
470               }
471             }
472           }
473         }
474       }
475       /* for two track trigger */
476       if ((fabs((double)pt) > Det[Trk].ptCut[TrgLo]) && 
477           (TrkStereoConf==0  ||  iStereo ==1)) {
478         if (Det[Trk].AttrBit[TrgLo] == 0) 
479           hitMap = hitMap + i2pow(TWO_TRK_BIT);
480         else if (Det[Trk].AttrBit[TrgLo] == 1 && iShort == 1)
481           hitMap = hitMap + i2pow(TWO_TRK_BIT);
482         else if (Det[Trk].AttrBit[TrgLo] == 2 && iShort == 0)
483         hitMap = hitMap + i2pow(TWO_TRK_BIT);
484           // std::cout << " here: TrkStereoConf = " << TrkStereoConf << "iStereo = " << iStereo << "address = " << Bits << std::endl; 
485       }
486       /* CAL has a different lookup table format */ 
487       
488       return (hitMap);
489     }
490   } else {
491     Tix[0] = -9999;
492     goto GoKilDong;
493   }
494   /* Owww, shuddup! */
495 GoKilDong:
496   hitMap = TowerBitPrint(DType,pt,Tix,phiXFT);  
497 /* this is the line that turns the IMU on */
498  /* if (DType == Imu){hitMap = 262143;} */
499   return(hitMap);
500 } 
501 
502 int TowerBitPrint(int Type, float pt, int Tix[4], float phi) {
503   int TowerBit[6][nWedge];
504   int i,j,k;
505   int Bits;
506   for (i=0;i<nWedge;i++) {
507     for (j=0;j<6;j++)TowerBit[j][i] = 0;
508   }
509 
510   if (Type == Cmu ||Type == Cmx || Type == Imu || Type == Cal) {
511     if (Type == Cal) {
512       k = NtCal;
513     } else {
514       k = NtNrm;
515     }
516     for (i=0;i<nWedge;i++) {
517       for (j=0;j<k;j++) {
518         if (Tix[0] == -9999 ||  pt == 0.0) {
519           TowerBit[j][i] = 0;
520         } else {
521           if (i*6+j>=Tix[0]*NtNrm+Tix[1] && i*NtNrm+j<=Tix[2]*NtNrm+Tix[3]) {
522             if (Type == Cal) {
523               for (k=0;k<NtNrm;k++) TowerBit[k][i] = 1;
524             } else {
525               TowerBit[j][i] = 1;
526             }
527           }
528         }
529       }
530     }
531   } else if (Type == Crk) {
532     /* Crack needs a special treatment */
533     for (i=0;i<nWedge;i++) {
534       for (j=0;j<NtCrk;j++) {
535         if (Tix[0] == -9999 ||  pt == 0.0) {
536           TowerBit[j][i] = 0;
537         } else {
538           if (i*NtCrk+j>=Tix[0]*NtCrk+Tix[1] && 
539               i*NtCrk+j<=Tix[2]*NtCrk+Tix[3]) {
540             /* there are only two choices j=0 or 1 */
541             if (j==0) {
542               for (k=0;k<NtNrm/2;k++) TowerBit[k][i] = 1; 
543             } else {
544               for (k=NtNrm/2;k<NtNrm;k++) TowerBit[k][i] = 1; 
545             }
546           }
547         }
548       }
549     }
550   }
551   Bits = 0;
552 /* Since hit map for phi should be loaded to XTRP RAMs in the following format
553 
554                   5-4-3-2-1-0/5-4-3-2-1-0/5-4-3-2-1-0 
555                   ^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^
556                     (n-1)th       nth       (n+1)th
557 
558    do wedge swapping here */
559 
560   for (i=0;i<3;i++) {
561     for (k=0;k<6;k++) {
562 /*
563       Bits = Bits + TowerBit[k][i]*i2pow(i*6+k);
564 */
565       Bits = Bits + TowerBit[k][i]*i2pow((2-i)*6+k);
566     }
567   }
568 
569   return(Bits);
570 }
571 
572 

source navigation ] diff markup ] identifier search ] freetext search ] file search ]

This page was automatically generated by the LXR engine.
The LXR team
Valid HTML 4.01!

Send problems or questions to cdfcode@fnal.gov