File indexing completed on 2025-01-18 10:18:32
0001
0002
0003
0004
0005
0006 #include "TMath.h"
0007
0008 void phi_code_dirc()
0009 {
0010 int kTargetBar = -1;
0011 double fTargetBarY = 0;
0012 double fBarsGap = 0.15;
0013 double momentum = 6.0;
0014 double fRadiatorW = 34.865;
0015
0016 double theta_value[25];
0017 double phi_value[25];
0018
0019 for(int i=0; i < 25; i++)
0020 {
0021 theta_value[i] = 30 + 5*i;
0022 double theta = theta_value[i];
0023
0024 kTargetBar = 4;
0025 fTargetBarY = ((double)(kTargetBar-5))*(fRadiatorW + fBarsGap) + fRadiatorW/2. + fBarsGap/2.;
0026
0027
0028
0029
0030
0031 double partheta = 180. - theta;
0032 double distheta = fabs(partheta-90.);
0033
0034 double Bval = (-1.75 + (1.75-1.6)*(distheta/60.));
0035
0036
0037 double pt = momentum*TMath::Sin(theta*TMath::DegToRad());
0038
0039
0040 double R = 1000.*pt/0.3/fabs(Bval);
0041 double x1 = 0;
0042 double y1 = 0;
0043 double x2 = 708.5;
0044
0045 double y2 = fTargetBarY;
0046 double xa = (x2 - x1)/2.;
0047 double ya = (y2 - y1)/2.;
0048 double x0 = x1 + xa;
0049 double y0 = y1 + ya;
0050 double a = sqrt(xa*xa + ya*ya);
0051 double b = sqrt(R*R - a*a);
0052 double x3 = x0 + b*ya/a;
0053 double y3 = y0 - b*xa/a;
0054 double x4 = x0 - b*ya/a;
0055 double y4 = y0 + b*xa/a;
0056 double ang3 = atan2(x3,y3);
0057
0058 double ang4 = atan2(x4,y4);
0059
0060
0061
0062
0063 phi_value[i] = 360 - ang4*TMath::RadToDeg();
0064
0065 std::cout << phi_value[i] << "\t";
0066 if(i==24) std::cout << "\n" << std::endl;
0067
0068
0069
0070 }
0071
0072 for(int i=0; i < 25; i++)
0073 {
0074 std::cout << "theta = " << theta_value[i] << "\t" << "phi = " << phi_value[i] << std::endl;
0075 }
0076
0077 }
0078
0079
0080