Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:49:08

0001 void oriCode(int & binoffy, int & pitchMul) {
0002   int  m_pitchy=1;
0003   int local_pitchy=1;
0004   if (binoffy>416) {            // ROC 8, not real ROC
0005     binoffy=binoffy+17;
0006   } else if (binoffy==416) {    // ROC 8
0007     binoffy=binoffy+16;
0008     local_pitchy = 2 * m_pitchy;
0009     
0010   } else if (binoffy==415) {    // ROC 7, last big pixel
0011       binoffy=binoffy+15;
0012       local_pitchy = 2 * m_pitchy;
0013   } else if (binoffy>364) {     // ROC 7
0014     binoffy=binoffy+15;
0015   } else if (binoffy==364) {    // ROC 7
0016     binoffy=binoffy+14;
0017     local_pitchy = 2 * m_pitchy;
0018     
0019   } else if (binoffy==363) {      // ROC 6
0020     binoffy=binoffy+13;
0021     local_pitchy = 2 * m_pitchy;    
0022   } else if (binoffy>312) {       // ROC 6
0023     binoffy=binoffy+13;
0024   } else if (binoffy==312) {      // ROC 6
0025     binoffy=binoffy+12;
0026     local_pitchy = 2 * m_pitchy;
0027     
0028   } else if (binoffy==311) {      // ROC 5
0029     binoffy=binoffy+11;
0030     local_pitchy = 2 * m_pitchy;    
0031   } else if (binoffy>260) {       // ROC 5
0032     binoffy=binoffy+11;
0033   } else if (binoffy==260) {      // ROC 5
0034     binoffy=binoffy+10;
0035     local_pitchy = 2 * m_pitchy;
0036     
0037   } else if (binoffy==259) {      // ROC 4
0038     binoffy=binoffy+9;
0039     local_pitchy = 2 * m_pitchy;    
0040   } else if (binoffy>208) {       // ROC 4
0041       binoffy=binoffy+9;
0042   } else if (binoffy==208) {      // ROC 4
0043     binoffy=binoffy+8;
0044     local_pitchy = 2 * m_pitchy;
0045     
0046   } else if (binoffy==207) {      // ROC 3
0047     binoffy=binoffy+7;
0048       local_pitchy = 2 * m_pitchy;    
0049   } else if (binoffy>156) {       // ROC 3
0050     binoffy=binoffy+7;
0051   } else if (binoffy==156) {      // ROC 3
0052       binoffy=binoffy+6;
0053       local_pitchy = 2 * m_pitchy;
0054       
0055   } else if (binoffy==155) {      // ROC 2
0056     binoffy=binoffy+5;
0057       local_pitchy = 2 * m_pitchy;    
0058   } else if (binoffy>104) {       // ROC 2
0059     binoffy=binoffy+5;
0060   } else if (binoffy==104) {      // ROC 2
0061       binoffy=binoffy+4;
0062       local_pitchy = 2 * m_pitchy;
0063       
0064     } else if (binoffy==103) {      // ROC 1
0065     binoffy=binoffy+3;
0066     local_pitchy = 2 * m_pitchy;    
0067   } else if (binoffy>52) {       // ROC 1
0068       binoffy=binoffy+3;
0069   } else if (binoffy==52) {      // ROC 1
0070     binoffy=binoffy+2;
0071       local_pitchy = 2 * m_pitchy;
0072       
0073   } else if (binoffy==51) {      // ROC 0
0074       binoffy=binoffy+1;
0075       local_pitchy = 2 * m_pitchy;    
0076   } else if (binoffy>0) {        // ROC 0
0077     binoffy=binoffy+1;
0078     } else if (binoffy==0) {       // ROC 0
0079     binoffy=binoffy+0;
0080     local_pitchy = 2 * m_pitchy;
0081   }
0082   pitchMul=local_pitchy;
0083 }
0084 
0085 
0086 #include<algorithm>
0087 void newCode(int & binoffy, int & pitchMul) {
0088   int offIndex[] = {0,51,52,103,104,155,156,207,208,259,260,311,312,363,364,415,416,511};
0089   pitchMul=1;
0090   auto const j = std::lower_bound(std::begin(offIndex),std::end(offIndex),binoffy);
0091   if (*j==binoffy) pitchMul=2;
0092   binoffy+= (j-offIndex);
0093 }
0094 
0095 #include<cstdio>
0096 int main() {
0097   for (int i=0; i!=511; ++i) {
0098     int oldb=i; int newb=i; int op=0; int np=0;
0099     oriCode(oldb,op);
0100     newCode(newb,np);
0101     if (oldb!=newb || op!=np)
0102       printf("%d: %d,%d  %d,%d\n",i, oldb,newb,op,np);
0103   }
0104   return 0;
0105 }