1 #include "/phenix/u/shlim/Style.h"
5 int bPOST_ALIGN =
false;
6 int bPRE_ALIGN =
false;
13 gStyle->SetOptStat(0);
15 const int nColor[4] = {1, 2, 4, 8};
17 TFile *
infile =
new TFile(Form(
"MvtxQAHisto-%08d-%04d.root",
runnumber,segnumber),
"read");
21 TH1F *h1d_hit_per_evt[4];
24 TH1F *h1d_hit_trk_x[4];
25 TH1F *h1d_hit_trk_y[4];
27 TH1F *h1d_clus_size_x[4];
28 TH1F *h1d_clus_size_z[4];
30 TH1F *h1d_clus_per_evt[4];
32 TH1F *h1d_clus_res_x[4];
33 TH1F *h1d_clus_res_z[4];
34 TProfile *h1p_clus_res_x[4];
35 TProfile *h1p_clus_res_z[4];
37 TF1 *f1p_clus_res_x[4];
38 TF1 *f1p_clus_res_z[4];
41 for (
int ichip=0; ichip<4; ichip++){
42 h2d_hit[ichip] = (TH2F*)infile->Get(Form(
"h2d_hit_chip%d",ichip));
43 h2d_hit_trk[ichip] = (TH2F*)infile->Get(Form(
"h2d_hit_trk_chip%d",ichip));
44 h1d_hit_per_evt[ichip] = (TH1F*)infile->Get(Form(
"h1d_hit_per_evt_chip%d",ichip));
46 h1d_hit_x[ichip] = (TH1F*)h2d_hit[ichip]->ProjectionX(Form(
"h1d_hit_x_chip%d",ichip));
47 h1d_hit_y[ichip] = (TH1F*)h2d_hit[ichip]->
ProjectionY(Form(
"h1d_hit_y_chip%d",ichip));
48 h1d_hit_x[ichip]->SetLineColor(1);
49 h1d_hit_y[ichip]->SetLineColor(1);
51 h1d_hit_trk_x[ichip] = (TH1F*)h2d_hit_trk[ichip]->ProjectionX(Form(
"h1d_hit_trk_x_chip%d",ichip));
52 h1d_hit_trk_y[ichip] = (TH1F*)h2d_hit_trk[ichip]->
ProjectionY(Form(
"h1d_hit_trk_y_chip%d",ichip));
53 h1d_hit_trk_x[ichip]->SetLineColor(1);
54 h1d_hit_trk_y[ichip]->SetLineColor(1);
56 h2d_clus[ichip] = (TH2F*)infile->Get(Form(
"h2d_clus_chip%d",ichip));
58 h1d_clus_size_x[ichip] = (TH1F*)infile->Get(Form(
"h1d_clus_size_x_chip%d",ichip));
59 h1d_clus_size_z[ichip] = (TH1F*)infile->Get(Form(
"h1d_clus_size_z_chip%d",ichip));
61 h1d_clus_per_evt[ichip] = (TH1F*)infile->Get(Form(
"h1d_clus_per_evt_chip%d",ichip));
63 h1d_clus_size_x[ichip]->SetLineColor(1);
64 h1d_clus_size_z[ichip]->SetLineColor(2);
66 h1d_clus_res_x[ichip] = (TH1F*)infile->Get(Form(
"h1d_clus_res_x_chip%d",ichip));
67 h1d_clus_res_z[ichip] = (TH1F*)infile->Get(Form(
"h1d_clus_res_z_chip%d",ichip));
69 h1d_clus_res_x[ichip]->SetLineColor(nColor[ichip]);
70 h1d_clus_res_z[ichip]->SetLineColor(nColor[ichip]);
72 h1p_clus_res_x[ichip] = (TProfile*)infile->Get(Form(
"h1p_clus_res_x_chip%d",ichip));
73 h1p_clus_res_z[ichip] = (TProfile*)infile->Get(Form(
"h1p_clus_res_z_chip%d",ichip));
75 h1p_clus_res_x[ichip]->SetLineColor(nColor[ichip]);
76 h1p_clus_res_z[ichip]->SetLineColor(nColor[ichip]);
79 TH1F *h1d_clus_eff = (TH1F*)infile->Get(
"h1d_clus_eff");
80 TH1F *h1d_clus_associated = (TH1F*)infile->Get(
"h1d_clus_associated");
82 TCanvas *c0 =
new TCanvas(
"c0",
"c0",1.1*2*400,400);
89 htmp = (TH1F*)gPad->DrawFrame(0,1,50,1.5*h1d_hit_per_evt[0]->GetMaximum());
92 for (
int ichip=0; ichip<4; ichip++){
93 h1d_hit_per_evt[ichip]->SetLineColor(nColor[ichip]);
94 h1d_hit_per_evt[ichip]->SetLineWidth(2);
95 h1d_hit_per_evt[ichip]->Draw(
"same");
102 htmp = (TH1F*)gPad->DrawFrame(0,1,10,1.5*h1d_clus_per_evt[0]->GetMaximum());
105 for (
int ichip=0; ichip<4; ichip++){
106 h1d_clus_per_evt[ichip]->SetLineColor(nColor[ichip]);
107 h1d_clus_per_evt[ichip]->SetLineWidth(2);
108 h1d_clus_per_evt[ichip]->Draw(
"same");
117 sprintf(fname,
"beamcenter/beamcenter_%08d.txt",
runnumber);
121 TCanvas *c1 =
new TCanvas(
"c1",
"c1",150*1.1*3,150*4);
124 for (
int ichip=0; ichip<4; ichip++){
130 htmp = (TH1F*)h2d_hit[ichip];
138 htmp = (TH1F*)h1d_hit_x[ichip];
142 TF1 *fx =
new TF1(
"fx",
"gaus",z_min,z_max);
146 fx->SetRange(fx->GetParameter(1)-fx->GetParameter(2), fx->GetParameter(1)+fx->GetParameter(2));
165 htmp = (TH1F*)h1d_hit_y[ichip];
169 TF1 *fy =
new TF1(
"fy",
"gaus",x_min,x_max);
173 fy->SetRange(fy->GetParameter(1)-fy->GetParameter(2), fy->GetParameter(1)+fy->GetParameter(2));
189 double offset_xx = fx->GetParameter(1);
190 double offset_yy = fy->GetParameter(1);
202 fpre << ichip <<
" 0 " << ichip <<
" " << offset_yy <<
" " << -2.2*ichip/(28
e-4) <<
" " << offset_xx << endl;
203 cout << ichip <<
" 0 " << ichip <<
" " << offset_yy <<
" " << -2.2*ichip/(28
e-4) <<
" " << offset_xx << endl;
223 TCanvas *c3 =
new TCanvas(
"c3",
"c3",200*1.1*2,200*2);
226 for (
int ichip=0; ichip<4; ichip++){
231 htmp = (TH1F*)gPad->DrawFrame(0,5,10,1.5*h1d_clus_size_x[ichip]->GetMaximum());
234 h1d_clus_size_x[ichip]->Draw(
"same");
235 h1d_clus_size_z[ichip]->Draw(
"same");
240 TCanvas *c4 =
new TCanvas(
"c4",
"c4",300*1.1*2,300*2);
247 htmp = (TH1F*)gPad->DrawFrame(-6,1,6,1.5*h1d_clus_res_z[0]->GetMaximum());
250 for (
int ichip=0; ichip<4; ichip++){
251 h1d_clus_res_z[ichip]->SetLineWidth(2);
252 h1d_clus_res_z[ichip]->Draw(
"same");
259 htmp = (TH1F*)gPad->DrawFrame(0,-2.5,1024,+2.5);
263 for (
int ichip=0; ichip<4; ichip++){
264 h1p_clus_res_z[ichip]->Draw(
"same");
266 f1p_clus_res_z[ichip] =
new TF1(Form(
"f1p_clus_res_z_%d",ichip),
"pol1",z_min,z_max);
267 h1p_clus_res_z[ichip]->Fit(f1p_clus_res_z[ichip],
"R0Q");
268 f1p_clus_res_z[ichip]->SetLineColor(nColor[ichip]);
270 f1p_clus_res_z[ichip]->Draw(
"same");
277 htmp = (TH1F*)gPad->DrawFrame(-6,1,6,1.5*h1d_clus_res_x[0]->GetMaximum());
280 for (
int ichip=0; ichip<4; ichip++){
281 h1d_clus_res_x[ichip]->SetLineWidth(2);
282 h1d_clus_res_x[ichip]->Draw(
"same");
289 htmp = (TH1F*)gPad->DrawFrame(0,-2.5,512,+2.5);
292 for (
int ichip=0; ichip<4; ichip++){
293 h1p_clus_res_x[ichip]->Draw(
"same");
295 f1p_clus_res_x[ichip] =
new TF1(Form(
"f1p_clus_res_x_%d",ichip),
"pol1",x_min,x_max);
296 h1p_clus_res_x[ichip]->Fit(f1p_clus_res_x[ichip],
"R0Q");
297 f1p_clus_res_x[ichip]->SetLineColor(nColor[ichip]);
299 f1p_clus_res_x[ichip]->Draw(
"same");
304 sprintf(fname,
"beamcenter/beamcenter_%08d.txt",
runnumber);
307 int tmp_layer, tmp_stave, tmp_chip;
308 double tmp_xx, tmp_yy, tmp_zz;
310 double par_xx[4], par_yy[4], par_zz[4];
312 while ( fpar >> tmp_layer >> tmp_stave >> tmp_chip >> tmp_xx >> tmp_yy >> tmp_zz ){
313 par_xx[tmp_chip] = tmp_xx;
314 par_yy[tmp_chip] = tmp_yy;
315 par_zz[tmp_chip] = tmp_zz;
320 sprintf(fname,
"beamcenter/beamcenter_%08d.txt",
runnumber);
321 fpar_out.open(fname);
323 for (
int ichip=0; ichip<4; ichip++){
328 << par_xx[ichip] + (f1p_clus_res_x[ichip]->Eval(par_xx[0]) - f1p_clus_res_x[0]->Eval(par_xx[0])) <<
" "
329 << par_yy[ichip] <<
" "
330 << par_zz[ichip] + (f1p_clus_res_z[ichip]->Eval(par_zz[0]) - f1p_clus_res_z[0]->Eval(par_zz[0]))
337 << par_xx[ichip] + (f1p_clus_res_x[ichip]->Eval(par_xx[0]) - f1p_clus_res_x[0]->Eval(par_xx[0])) <<
" "
338 << par_yy[ichip] <<
" "
339 << par_zz[ichip] + (f1p_clus_res_z[ichip]->Eval(par_zz[0]) - f1p_clus_res_z[0]->Eval(par_zz[0]))