23 refidx1 = mean_refraction_index1;
29 refidx1 = mean_refraction_index2;
33 double eic_dual_rich::ind_ray(
double Ex,
double Ey,
double Ez,
double Dx,
double Dy,
double Dz,
double vx,
double vy,
double vz,
int select_radiator){
49 double eps = 0.00000000001;
54 double esx, esy, esz, es;
55 double ref_frac, theta1, theta2;
71 a = sqrt(cex*cex+cey*cey+cez*cez);
72 d = sqrt(cdx*cdx+cdy*cdy+cdz*cdz);
73 th = acos((cdx*cex+cdy*cey+cdz*cez)/a/d);
77 y = R*(a*sin(x)-d*sin(th-x))+a*d*sin(th-2*x);
78 y1 = R*(a*cos(x)+d*cos(th-x))-2*a*d*cos(th-2*x);
81 while(abs(dx)>eps && i<100){
84 y = R*(a*sin(x)-d*sin(th-x))+a*d*sin(th-2*x);
85 y1 = R*(a*cos(x)+d*cos(th-x))-2*a*d*cos(th-2*x);
91 if(i>=100) cout<<
"Not convergent"<<endl;
94 sx = cx + (R*cos(x)/a-R*sin(x)/tan(th)/
a)*cex + (R*sin(x)/d/sin(th))*cdx;
95 sy = cy + (R*cos(x)/a-R*sin(x)/tan(th)/
a)*cey + (R*sin(x)/d/sin(th))*cdy;
96 sz = cz + (R*cos(x)/a-R*sin(x)/tan(th)/
a)*cez + (R*sin(x)/d/sin(th))*cdz;
103 es = sqrt(esx*esx+esy*esy+esz*esz);
109 if(select_radiator == 1){
110 ref_frac = refidx2/refidx1;
113 theta1 = asin(sin(theta2)*ref_frac);
115 esx = esx*sin(theta1)/sin(theta2);
116 esy = esy*sin(theta1)/sin(theta2);
119 theta_c = acos((esx*vx+esy*vy+esz*vz));
127 ch_vector.push_back (angle);
133 vector<double> cut_vector;
135 for (
unsigned int i=0;
i<ch_vector.size();
i++){
137 if(theta_min<theta_max && ch_vector.at(
i)>=theta_min && ch_vector.at(
i)<=theta_max) cut_vector.push_back (ch_vector.at(
i));
138 else if (theta_min>=theta_max) cout<<
"Applied cut wrong: theta_min>theta_max"<<endl;
144 for (
unsigned int i=0;
i<cut_vector.size();
i++){
146 ch_vector.push_back(cut_vector.at(
i));
156 for (
unsigned int i=0;
i<ch_vector.size();
i++){
158 sum += ch_vector.at(
i);
162 sum = sum/ch_vector.size();
172 for (
unsigned int i=0;
i<ch_vector.size();
i++){
174 sum += (ch_vector.at(
i)-mean_cherenkov_angle())*(ch_vector.at(
i)-mean_cherenkov_angle());
178 sum = sum/ch_vector.size();