21 {
22
24 const TString file_name = Form(
"DedxConst_%d-%d_705.root",
run_begin,
run_end);
25 const TString str_eps = Form(
"figs/gain_vs_run_%d-%d.eps",
run_begin,
run_end);
26 const TString str_eps2 = Form(
"figs/resol_vs_run_%d-%d.eps",
run_begin,
run_end);
27 const TString str_eps3 = Form(
"figs/rel_resol_vs_run_%d-%d.eps",
run_begin,
run_end);
28
29 gStyle->SetOptStat(0);
31
33 TTree *o_tree_run = (TTree*)o_file.Get("runcalib");
34 Int_t o_run, n_run;
35 Double_t o_gain, o_resol, o_wireg, n_mean, n_wireg;
36 o_tree_run->SetBranchAddress("runno", &o_run);
37 o_tree_run->SetBranchAddress("rungain", &o_gain);
38 o_tree_run->SetBranchAddress("runresol", &o_resol);
39 Int_t m_len = o_tree_run->GetEntries();
40 Int_t m_count(0), p_run(-1);
41 for(int i=0; i<m_len; i++){
42 o_tree_run->GetEntry(i);
45 if(o_run != p_run){
46 p_run = o_run;
47 m_count ++;
48 }
49 if(
m_debug) cout <<
"x " <<
x[i] <<
" y " <<
y[i] << endl;
50 }
51 TGraph *
gr =
new TGraph(m_len, x,
y);
52 gr->SetTitle(
"gain constant vs. run");
53 TCanvas *c1 = new TCanvas("c1", "c1", 10, 10, 800, 642);
55 c1->SaveAs(str_eps);
56
57 c1->Clear();
58 for(int i=0; i<m_len; i++){
59 o_tree_run->GetEntry(i);
60 yy[i] = o_resol;
61 if(
y[i]) yyy[i] = 100.*(yy[i]/
y[i]/550.);
62 if(
m_debug) cout <<
"x " <<
x[i] <<
" y " << yy[i] << endl;
63 }
64 gr =
new TGraph(m_len, x, yy);
65 gr->SetTitle(
"resolution vs. run");
67 c1->SaveAs(str_eps2);
68
69 c1->Clear();
70 gr =
new TGraph(m_len, x, yyy);
71 gr->SetTitle(
"relative resolution vs. run (%)");
73 c1->SaveAs(str_eps3);
74
75 cout << "There are total " << m_count << " runs (not entries)." << endl;
76}