1 |
+ |
|
2 |
+ |
///input iz, ix, iy, |
3 |
+ |
///iz = -1 /1; ix, iy >=1 && <=100; |
4 |
+ |
int iRingEndCap(int iz, int ix,int iy){ |
5 |
+ |
|
6 |
+ |
if(abs(iz) !=1 ){ |
7 |
+ |
|
8 |
+ |
cout<<"iRingEndcap.."<<iz<<endl; |
9 |
+ |
exit(1); |
10 |
+ |
|
11 |
+ |
} |
12 |
+ |
|
13 |
+ |
|
14 |
+ |
int izz = iz <0? 0: 1; |
15 |
+ |
|
16 |
+ |
int k = -1; |
17 |
+ |
for (int ring=0; ring<kEndcEtaRings; ring++) { |
18 |
+ |
|
19 |
+ |
if( fabs(etaEEAll[izz][ix][iy])>etaBoundary_eezside[izz][ring] && fabs(etaEEAll[izz][ix][iy]) < etaBoundary_eezside[izz][ring+1]){ |
20 |
+ |
k = ring; |
21 |
+ |
break; |
22 |
+ |
} |
23 |
+ |
} |
24 |
+ |
|
25 |
+ |
if(k<0){ |
26 |
+ |
cout<<"error.iringendcap;"<<iz<<" "<<ix<<" "<<iy<<" "<<etaEEAll[izz][ix][iy]<<endl; |
27 |
+ |
exit(1); |
28 |
+ |
} |
29 |
+ |
|
30 |
+ |
return k; |
31 |
+ |
|
32 |
+ |
|
33 |
+ |
} |
34 |
+ |
|
35 |
+ |
|
36 |
+ |
|
37 |
+ |
///eta lower and upper value of each eta ring in endcap |
38 |
+ |
void setEtaRingBoundaryEndcap(){ |
39 |
+ |
|
40 |
+ |
|
41 |
+ |
|
42 |
+ |
/// |
43 |
+ |
for(int k=0; k<kEndcEtaRings; k++){ |
44 |
+ |
|
45 |
+ |
///eta_ring_ee[k] = etaEEAll[1][k+1][51]; |
46 |
+ |
//updated to take average of both sized |
47 |
+ |
eta_ring_ee[k] = 0.5 * ( fabs(etaEEAll[0][k+1][51]) + fabs(etaEEAll[1][k+1][51])); |
48 |
+ |
|
49 |
+ |
///in data better use both size |
50 |
+ |
eta_ring_eezside[0][k] = fabs(etaEEAll[0][k+1][51]); |
51 |
+ |
eta_ring_eezside[1][k] = etaEEAll[1][k+1][51]; |
52 |
+ |
|
53 |
+ |
if(fabs(eta_ring_ee[k])<1.482){ |
54 |
+ |
cout<<"eroor..etaring..endcap? "<<eta_ring_ee[k] <<endl; |
55 |
+ |
exit(1); |
56 |
+ |
} |
57 |
+ |
// cout<<"k: "<<eta_ring_ee[k]<<endl; |
58 |
+ |
} |
59 |
+ |
|
60 |
+ |
etaBoundary_ee[0] = 1.482; |
61 |
+ |
etaBoundary_ee[39]=4.; |
62 |
+ |
|
63 |
+ |
etaBoundary_eezside[0][0] = 1.482; |
64 |
+ |
etaBoundary_eezside[0][39]=4.; |
65 |
+ |
etaBoundary_eezside[1][0] = 1.482; |
66 |
+ |
etaBoundary_eezside[1][39]=4.; |
67 |
+ |
|
68 |
+ |
|
69 |
+ |
for (int ring=1; ring<kEndcEtaRings; ring++) { |
70 |
+ |
etaBoundary_ee[ring] = (eta_ring_ee[ring]+eta_ring_ee[ring-1])/2.; |
71 |
+ |
|
72 |
+ |
etaBoundary_eezside[0][ring] = (eta_ring_eezside[0][ring]+eta_ring_eezside[0][ring-1])/2.; |
73 |
+ |
etaBoundary_eezside[1][ring] = (eta_ring_eezside[1][ring]+eta_ring_eezside[1][ring-1])/2.; |
74 |
+ |
cout<<"eta_ring_boudary: "<<etaBoundary_ee[ring]<<" "<< etaBoundary_eezside[0][ring]<<" "<< etaBoundary_eezside[1][ring]<<endl; |
75 |
+ |
} |
76 |
+ |
|
77 |
+ |
///# of xtal each ring |
78 |
+ |
for(int iz =0; iz<2 ;iz++){ |
79 |
+ |
|
80 |
+ |
for(int ix=1; ix<=100; ix++){ |
81 |
+ |
|
82 |
+ |
for(int iy=1; iy<=100; iy++){ |
83 |
+ |
|
84 |
+ |
if(fabs(etaEEAll[iz][ix][iy])>1.482){ |
85 |
+ |
|
86 |
+ |
int iring = iRingEndCap(2*iz-1,ix,iy); |
87 |
+ |
nxtal_ring_ee[iring] ++; |
88 |
+ |
} |
89 |
+ |
|
90 |
+ |
} |
91 |
+ |
} |
92 |
+ |
|
93 |
+ |
} |
94 |
+ |
|
95 |
+ |
///should be 14648; |
96 |
+ |
int ntotal = 0; |
97 |
+ |
|
98 |
+ |
for(int k=0; k<kEndcEtaRings; k++){ |
99 |
+ |
cout<<"nrystal ring "<<k<<" "<<nxtal_ring_ee[k]<<endl; |
100 |
+ |
ntotal += nxtal_ring_ee[k]; |
101 |
+ |
|
102 |
+ |
} |
103 |
+ |
|
104 |
+ |
cout<<"ntotal xtal : "<<ntotal<<endl; |
105 |
+ |
if( ntotal != 14648 ){ |
106 |
+ |
cout<<"checkntotalendcap " << ntotal <<endl; |
107 |
+ |
exit(1); |
108 |
+ |
} |
109 |
+ |
|
110 |
+ |
} |