BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
CheckRung/check/draw_plots.cxx
Go to the documentation of this file.
1/************* draw some plots for validate the dE/dx calibration
2Gain (Bhabha) plots:
3-- gain constant vs. run #
4-- mean dE/dx vs run# (with new constants applied)
5-- gain constant vs. wire #
6-- mean dE/dx vs wire# (with new constants applied)
7-- distribution of new wire gain - old wire gain (to see how stable they are)
8 (one 1-D plot of difference for all wires)
9***************************/
10
11TString old_path = "../../RungEangle/";
12const int max_len = 10000;
13bool m_debug = false;
14
16 gStyle->SetOptStat(0);
17 Double_t x[max_len], y[max_len];
18 // gain constant vs. run
19 TFile o_file(old_path + "rungain.root");
20 TTree *o_tree_run = (TTree*)o_file.Get("runcalib");
21 TTree *o_tree_wire = (TTree*)o_file.Get("wiregcalib");
22 Int_t o_run, n_run;
23 Double_t o_gain, o_wireg, n_mean, n_wireg;
24 o_tree_run->SetBranchAddress("runno", &o_run);
25 o_tree_run->SetBranchAddress("rungain", &o_gain);
26 Int_t m_len = o_tree_run->GetEntries();
27 for(int i=0; i<m_len; i++){
28 o_tree_run->GetEntry(i);
29 x[i] = o_run;
30 y[i] = o_gain;
31 if(m_debug) cout << "x " << x[i] << " y " << y[i] << endl;
32 }
33 TGraph *gr = new TGraph(m_len, x, y);
34 gr->SetTitle("gain constant vs. run");
35 TCanvas *c1 = new TCanvas("c1", "c1", 10, 10, 800, 642);
36 gr->Draw("a*");
37 c1->SaveAs("figs/gain_vs_run.eps");
38
39 // mean vs run
40 TFile n_file("../rungain.root");
41 TTree *n_tree_run = (TTree*)n_file.Get("runcalib");
42 n_tree_run->SetBranchAddress("runno", &n_run);
43 n_tree_run->SetBranchAddress("runmean", &n_mean);
44 if(m_len != n_tree_run->GetEntries()){
45 cout << "the num of enetries are different!" << endl;
46 cout << "old " << m_len << " new " << n_tree_run->GetEntries() << endl;
47 return 1;
48 }
49 for(int i=0; i<m_len; i++){
50 n_tree_run->GetEntry(i);
51 x[i] = n_run;
52 y[i] = n_mean;
53 }
54 gr = new TGraph(m_len, x, y);
55 gr->SetTitle("mean dE/dx vs. run (with new constants)");
56 c1->Clear();
57 gr->Draw("a*");
58 c1->SaveAs("figs/mean_vs_run.eps");
59
60 // gain constant vs wire
61 TFile o_file("../../WireGain/wiregain.root");
62 TTree *o_tree_wire = (TTree*)o_file.Get("wiregcalib");
63 o_tree_wire->SetBranchAddress("wireg", y);
64 o_tree_wire->GetEntry(0);
65 m_len = 6796;
66 for(int i=0; i<m_len; i++){
67 x[i] = i;
68 if(m_debug) cout << "i " << i << " y[i] " << y[i] << endl;
69 }
70 gr = new TGraph(m_len, x, y);
71 gr->SetTitle("gain constant vs. wire");
72 c1->Clear();
73 gr->Draw("a*");
74 c1->SaveAs("figs/wireg_vs_wire.eps");
75
76 // mean dE/dx vs wire
77 TFile n_file("wiregain.root");
78 TTree *n_tree_wire = (TTree*)n_file.Get("wiregcalib");
79 n_tree_wire->SetBranchAddress("fitmean", y);
80 n_tree_wire->GetEntry(0);
81 m_len = 6796;
82 for(int i=0; i<m_len; i++){
83 x[i] = i;
84 if(y[i]<480) y[i]=y[i-1];
85 if(m_debug) cout << "i " << i << " y[i] " << y[i] << endl;
86 }
87 gr = new TGraph(m_len, x, y);
88 gr->SetTitle("dE/dx vs. wire with new constants");
89 c1->Clear();
90 gr->Draw("a*");
91 c1->SaveAs("figs/mean_vs_wire.eps");
92
93 n_tree_wire->SetBranchAddress("fitsigma", y);
94 n_tree_wire->GetEntry(0);
95 m_len = 6796;
96 for(int i=0; i<m_len; i++){
97 x[i] = i;
98 if(m_debug) cout << "i " << i << " y[i] " << y[i] << endl;
99 }
100 gr = new TGraph(m_len, x, y);
101 gr->SetTitle("dE/dx sigma vs. wire with new constants");
102 c1->Clear();
103 gr->Draw("a*");
104 c1->SaveAs("figs/sigma_vs_wire.eps");
105
106
107// Hit-level Rad. Bhabha plots
108// -- "surface plot" of ave. per hit dE/dx vs. dca & entrance angle
109// (can show with and without correction applied)
110// -- Since 2-D surfaces can be hard to see clearly, one can also make 1-D plots:
111// cut in slices of dca and make several 1-D plots vs. angle,
112// cut in slices of angle and plot 1-D vs. dca
113 TFile o_file("../../DocaEangle/docaeangle.root");
114 TH2F *o_hist = (TH2F*)o_file.Get("dEdxVsDocaEAng");
115 o_hist->SetTitle("dE/dx vs. doca and enta, without new constants");
116 c1->Clear();
117// double m_max_dedx = o_hist->GetBinContent(o_hist->GetMaximumBin());
118// double m_min_dedx = o_hist->GetBinContent(o_hist->GetMinimumBin());
119// double m_col_ratio = (550.-m_min_dedx)/(m_max_dedx-m_min_dedx);
120// const UInt_t Number = 3;
121// Double_t Red[Number] = { 0.0, 0.00, 0.00};
122// Double_t Green[Number] = { 0.0, 52./255, 0.00};
123// Double_t Blue[Number] = { 0.0, 114./255, 0.00};
124// Double_t Length[Number] = { 0.00, m_col_ratio, 1.00};
125// Int_t nb=200;
126// TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb);
127 gStyle->SetPalette(1,0);
128 o_hist->Draw("colz");
129 c1->SaveAs("figs/dedx_vs_doca_and_enta_without_cor.eps");
130
131 TFile n_file("docaeangle.root");
132 TH2F *n_hist = (TH2F*)n_file.Get("dEdxVsDocaEAng");
133 n_hist->SetTitle("dE/dx vs. doca and enta, with new constants");
134 c1->Clear();
135// m_max_dedx = n_hist->GetBinContent(n_hist->GetMaximumBin());
136// m_min_dedx = n_hist->GetBinContent(n_hist->GetMinimumBin());
137// m_col_ratio = (550.-m_min_dedx)/(m_max_dedx-m_min_dedx);
138// Length[1] = m_col_ratio;
139// TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb);
140 n_hist->Draw("colz");
141 c1->SaveAs("figs/dedx_vs_doca_and_enta_with_cor.eps");
142
143 TFile o_file("dEdxVsCostheta.root");
144 TCanvas *on_can = (TCanvas*)o_file.Get("fitmean");
145 on_can->SetTitle("dE/dx vs. cos, with/without correction");
146 on_can->Draw();
147 on_can->SaveAs("figs/dedx_vs_cos_with_without_cor.eps");
148
149 on_can = (TCanvas*)o_file.Get("fitsigma");
150 on_can->SetTitle("dE/dx sigma vs. cos, with/without correction");
151 on_can->Draw();
152 on_can->SaveAs("figs/dedx_sigma_vs_cos_with_without_cor.eps");
153
154 TFile o_file("dEdxVsCosNP.root");
155 on_can = (TCanvas*)o_file.Get("fitmean");
156 on_can->SetTitle("dE/dx vs. cos, electron & positron");
157 on_can->Draw();
158 on_can->SaveAs("figs/dedx_vs_cos_NP.eps");
159
160 on_can = (TCanvas*)o_file.Get("fitsigma");
161 on_can->SetTitle("dE/dx sigma vs. cos, electron & positron");
162 on_can->Draw();
163 on_can->SaveAs("figs/dedx_sigma_vs_cos_NP.eps");
164
165}
void draw_plots()
TString old_path
const int max_len
double y[1000]
double x[1000]