1 void plot_matscan(
const std::string &datfile,
const int plot_theta = 0)
3 FILE *
f = fopen(datfile.c_str(),
"r");
6 cout <<
"file " << datfile <<
" cannot be opened" << endl;
14 vector<float> thetavec;
17 vector<float> lamda0vec;
19 float thetamax = -10000;
21 float phimax = -10000;
23 float x0max = -100000;
24 float lamda0min = 100000;
25 float lamda0max = -100000;
26 while (fscanf(f,
"%f %f %f %f %f", &theta, &phi, &path, &x0, &lamda0) != EOF)
28 cout <<
"theta: " << theta
32 <<
", lamda0: " << lamda0
37 theta = log(TMath::Tan(theta / 2.));
63 if (lamda0 > lamda0max)
67 if (lamda0 < lamda0min)
71 thetavec.push_back(theta);
72 phivec.push_back(phi);
74 lamda0vec.push_back(lamda0);
76 float *thetaarr =
new float[thetavec.size()];
77 float *phiarr =
new float[phivec.size()];
78 float *x0arr =
new float[x0vec.size()];
79 float *lamda0arr =
new float[lamda0vec.size()];
80 for (
int i = 0; i < phivec.size(); i++)
82 thetaarr[i] = thetavec[i];
83 phiarr[i] = phivec[i];
85 lamda0arr[i] = lamda0vec[i];
87 TCanvas *
c =
new TCanvas(
"c1",
"material scan");
91 char htitlelamda[100];
95 TGraph *grl =
nullptr;
101 sprintf(htitlex,
"x0 vs theta");
102 sprintf(htitlelamda,
"lamda0 vs theta");
108 sprintf(htitlex,
"x0 vs eta");
109 sprintf(htitlelamda,
"lamda0 vs eta");
110 xmin = thetamin - 0.1;
111 xmax = thetamax + 0.1;
114 gr =
new TGraph(thetavec.size(), thetaarr, x0arr);
115 grl =
new TGraph(thetavec.size(), thetaarr, lamda0arr);
119 sprintf(htitlex,
"x0 vs phi");
120 sprintf(htitlelamda,
"lamda0 vs phi");
123 gr =
new TGraph(phivec.size(), phiarr, x0arr);
124 grl =
new TGraph(phivec.size(), phiarr, lamda0arr);
126 TH2 *
h2 =
new TH2F(
"hx2", htitlex, 2, xmin, xmax, 2, 0, x0max + 0.1 * x0max);
127 h2->SetStats(kFALSE);
129 gr->SetMarkerStyle(21);
130 gr->SetMarkerSize(0.1);
133 TH2 *hl2 =
new TH2F(
"hlamda2", htitlelamda, 2, xmin, xmax, 2, 0, lamda0max + lamda0max / 10.);
134 hl2->SetStats(kFALSE);
136 grl->SetMarkerStyle(21);
137 grl->SetMarkerSize(0.1);
145 FILE *
f = fopen(datfile,
"r");
148 cout <<
"file " << datfile <<
" cannot be opened" << endl;
156 vector<float> thetavec;
157 vector<float> phivec;
159 vector<float> lamda0vec;
161 float thetamax = 1.1;
163 float phimax = -10000;
164 float x0min = 100000;
165 float x0max = -100000;
166 float lamda0min = 100000;
167 float lamda0max = -100000;
168 while (fscanf(f,
"%f %f %f %f %f", &theta, &phi, &path, &x0, &lamda0) != EOF)
170 theta = (theta + 90) / 180. *
M_PI;
171 theta = log(TMath::Tan(theta / 2.));
172 cout <<
"theta: " << theta
174 <<
", path: " << path
176 <<
", lamda0: " << lamda0
194 if (lamda0 > lamda0max)
198 if (lamda0 < lamda0min)
202 thetavec.push_back(theta);
203 phivec.push_back(phi);
205 lamda0vec.push_back(lamda0);
207 float *thetaarr =
new float[thetavec.size()];
208 float *phiarr =
new float[phivec.size()];
209 float *x0arr =
new float[x0vec.size()];
210 float *lamda0arr =
new float[lamda0vec.size()];
211 for (
int i = 0; i < phivec.size(); i++)
213 thetaarr[i] = thetavec[i];
214 phiarr[i] = phivec[i];
216 lamda0arr[i] = lamda0vec[i];
218 TCanvas *
c =
new TCanvas(
"c1",
"material scan");
220 char htitlelamda[100];
221 char titlexaxis[100];
224 TGraph *gr =
nullptr;
225 TGraph *grl =
nullptr;
229 sprintf(htitlex,
"x0 vs theta");
230 sprintf(htitlelamda,
"");
231 sprintf(titlexaxis,
"#eta");
234 gr =
new TGraph(thetavec.size(), thetaarr, x0arr);
235 grl =
new TGraph(thetavec.size(), thetaarr, lamda0arr);
239 sprintf(htitlex,
"x0 vs phi");
240 sprintf(htitlelamda,
"");
241 sprintf(titlexaxis,
"#phi");
244 gr =
new TGraph(phivec.size(), phiarr, x0arr);
245 grl =
new TGraph(phivec.size(), phiarr, lamda0arr);
247 TH2 *hl2 =
new TH2F(
"hlamda2", htitlelamda, 2, xmin, xmax, 2, 0, lamda0max + lamda0max / 10.);
248 hl2->SetStats(kFALSE);
249 hl2->GetXaxis()->SetTitle(titlexaxis);
250 hl2->GetXaxis()->SetTitleSize(0.05);
251 hl2->GetXaxis()->SetLabelSize(0.04);
252 hl2->GetXaxis()->SetTitleOffset(0.8);
253 hl2->GetYaxis()->SetTitle(
"#lambda_{0}");
254 hl2->GetYaxis()->SetTitleSize(0.05);
255 hl2->GetYaxis()->SetTitleOffset(0.6);
256 hl2->GetYaxis()->SetLabelSize(0.04);
258 grl->SetMarkerStyle(21);
259 grl->SetMarkerSize(0.1);
260 grl->SetLineWidth(2);