Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:32:05

0001 void ruGrid(int mode = 1111){
0002   //EE-
0003   if(mode >= 1000) eeGrid(-39.5, .5, .2);
0004   //EB-
0005   if((mode % 1000) >= 100) ebGrid(-17.5, .5, .2, 10);
0006   //EB+
0007   if((mode % 100) >= 10) ebGrid(.5, .5, .2, 10);
0008   //EE+
0009   if((mode % 10) >= 1) eeGrid(20.5, .5, .2);
0010 }
0011 
0012 void xtalGrid(int mode = 1111){
0013   //EE-
0014   if(mode >= 1000) eeGrid(-199.5, .5, 1.);
0015   //EB-
0016   if((mode % 1000) >= 100) ebGrid(-85.5, .5, 1.);
0017   //EB+
0018   if((mode % 100) >= 10) ebGrid(.5, .5, 1.);
0019   //EE+
0020   if((mode % 10) >= 1) eeGrid(100.5, .5, 1.);
0021 }
0022 
0023 void tccGrid(int mode = 1111){
0024   //EE-
0025   if(mode >= 1000) drawGrid(-28.5, 0.5, -21.5, 72.5, 1, 18, 2);
0026   if(mode >= 1000) drawGrid(-21.5, 0.5, -17.5, 72.5, 1, 18, 2);
0027   //EB-
0028   if((mode % 1000) >= 100) drawGrid(-17.5, 0.5, -.5, 72.5, 1, 18, 2);
0029   //EB+
0030   if((mode % 100) >= 10) drawGrid(.5, 0.5, 17.5, 72.5, 1, 18, 2);
0031   //EE+
0032   if((mode % 10) >= 1) drawGrid(17.5, 0.5, 21.5, 72.5, 1, 18, 2);
0033   if((mode % 10) >= 1) drawGrid(21.5, 0.5, 28.5, 72.5, 1, 18, 2);
0034 }
0035 
0036 void ebGrid(float xOffset = .5, float yOffset = .5, float scale  = 1.,
0037             int phiOffset =0) {
0038   float x1 = 0 + xOffset;
0039   float y1 = 0 + yOffset;
0040 
0041   float x2 = 85*scale + xOffset;
0042   float y2 = 360*scale + yOffset;
0043   
0044   drawGrid(x1, y1, x2, y2, 1, 18, phiOffset*scale);
0045 }
0046 
0047 void eeGrid(float xOffset = .5, float yOffset = .5, float scale  = 1.){
0048   const unsigned n = 40;
0049   int x[n] = {  0,   3,  5,  8, 13, 15, 20, 25, 35, 40,
0050                 60, 65, 75, 80, 85, 87, 92, 95, 97,100,
0051                 97, 95, 92, 87, 85, 80, 75, 65, 60,
0052                 40, 35, 25, 20, 15, 13,  8,  5,  3, 0, 0
0053   };
0054   int y[n] = { 40,  35, 25, 20, 15, 13,  8,  5,  3, 0
0055                0,    3,  5,  8, 13, 15, 20, 25, 35, 40,
0056                60,  65, 75, 80, 85, 87, 92, 95, 97,
0057                100, 97, 95, 92, 87, 85, 80, 75, 65, 60, 40
0058   };
0059 
0060   stairDraw(n, x, y, xOffset, yOffset, scale);
0061 
0062   const unsigned in = 24;
0063   int ix[in] = {39, 40, 41, 42, 43, 45, 55, 57, 58, 59, 60, 61,
0064                 60, 59, 58, 57, 55, 45, 43, 42, 41, 40, 39, 39};
0065   int iy[in] = {45, 43, 42, 41, 40, 39, 40, 41, 42, 43, 45, 55,
0066                 57, 58, 59, 60, 61, 60, 59, 58, 57, 55, 45, 45};
0067 
0068   stairDraw(in, ix, iy, xOffset, yOffset, scale);
0069 
0070   int x1[] = {61, 65, 90, 98};
0071   int y1[] = {50, 55, 60, 60};
0072   stairDraw(sizeof(x1)/sizeof(x1[0]), x1, y1, xOffset, yOffset, scale);
0073   
0074   int x2[] = {57, 60, 65, 70, 75, 80, 80};
0075   int y2[] = {60, 65, 70, 75, 85, 88, 88};
0076   stairDraw(sizeof(x2)/sizeof(x2[0]), x2, y2, xOffset, yOffset, scale);
0077 
0078   int x3[] = { 50 , 50, 50};
0079   int y3[] = { 61, 100, 100};
0080   stairDraw(sizeof(x3)/sizeof(x3[0]), x3, y3, xOffset, yOffset, scale);
0081 
0082   int x4[] = {39, 35, 10, 2};
0083   int y4[] = {50, 55, 60, 60};
0084   stairDraw(sizeof(x4)/sizeof(x4[0]), x4, y4, xOffset, yOffset, scale);
0085   
0086   int x5[] = {43, 40, 35, 30, 25, 20, 20};
0087   int y5[] = {60, 65, 70, 75, 85, 88, 88};
0088   stairDraw(sizeof(x5)/sizeof(x5[0]), x5, y5, xOffset, yOffset, scale);
0089   
0090   int x6[] = {61, 65, 70, 80, 90, 92};
0091   int y6[] = {45, 40, 35, 30, 25, 25};
0092   stairDraw(sizeof(x6)/sizeof(x6[0]), x6, y6, xOffset, yOffset, scale);
0093   
0094   int x7[] = {55, 55, 60, 65, 65};
0095   int y7[] = {39, 30, 15, 3, 3};
0096   stairDraw(sizeof(x7)/sizeof(x7[0]), x7, y7, xOffset, yOffset, scale);
0097 
0098   int x8[] = { 45, 45, 40, 35, 35};
0099   int y8[] = { 39, 30, 15, 3, 3};
0100   stairDraw(sizeof(x8)/sizeof(x8[0]), x8, y8, xOffset, yOffset, scale);
0101   
0102   int x9[] = {39, 35, 30, 20, 10,  8};
0103   int y9[] = {45, 40, 35, 30, 25, 25};
0104   stairDraw(sizeof(x9)/sizeof(x9[0]), x9, y9, xOffset, yOffset, scale); 
0105 }
0106 
0107 void stairDraw(unsigned n, int x[], int y[],
0108                float xOffset = .5, float yOffset = .5, float scale  = 1.){
0109   Float_t* xx = new Float_t[2*n-1];
0110   Float_t* yy = new Float_t[2*n-1];
0111   
0112   for(unsigned i = 0; i < n-1; ++i){
0113     xx[2*i] = x[i]*scale + xOffset;
0114     yy[2*i] = y[i]*scale + yOffset;
0115     xx[2*i+1] = x[i+1]*scale + xOffset;
0116     yy[2*i+1] = y[i]*scale + yOffset; 
0117   }
0118   //  xx[2*n-2] = xx[0];
0119   // yy[2*n-2] = yy[0];
0120   
0121   TPolyLine* p = new TPolyLine(2*n-2, xx, yy);
0122   p->Draw();
0123 }
0124 
0125 
0126 void drawGrid(float x1, float y1, float x2, float y2,
0127               int nxbins, int nybins, float yOffset = 0.){
0128   float step = (x2-x1) / nxbins;
0129   TLine* l = new TLine(0,0,0,0);
0130   for(float x = x1; x < x2; x += step){
0131     l->DrawLine(x, y1, x, y2);
0132   }
0133   l->DrawLine(x2, y1, x2, y2);
0134 
0135   step = (y2-y1) / nybins;
0136 
0137   for(float y = y1; y < y2; y += step){
0138     l->DrawLine(x1, y+yOffset, x2, y+yOffset);
0139   }
0140   if(yOffset<1.e-9) l->DrawLine(x1, y2, x2, y2);
0141 }