BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
draw_plots.cxx File Reference

Go to the source code of this file.

Functions

void draw_plots ()
 

Variables

const int run_begin = 59163
 
const int run_end = 62823
 
const int max_len = 10000
 
bool m_debug = false
 

Function Documentation

◆ draw_plots()

void draw_plots ( )

Definition at line 21 of file FirstRung/draw_plots.cxx.

21 {
22// const TString old_path = "/afs/ihep.ac.cn/bes3/offline/CalibConst/dedx/6.6.3/";
23 const TString old_path = "./";
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);
30 Double_t x[max_len], y[max_len], yy[max_len], yyy[max_len];
31 // gain constant vs. run
32 TFile o_file(old_path + file_name);
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);
43 x[i] = o_run;
44 y[i] = o_gain;
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);
54 gr->Draw("a*");
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");
66 gr->Draw("a*");
67 c1->SaveAs(str_eps2);
68
69 c1->Clear();
70 gr = new TGraph(m_len, x, yyy);
71 gr->SetTitle("relative resolution vs. run (%)");
72 gr->Draw("a*");
73 c1->SaveAs(str_eps3);
74
75 cout << "There are total " << m_count << " runs (not entries)." << endl;
76}
Double_t x[10]
TGraph * gr
const int run_end
const int run_begin
bool m_debug
const int max_len
double y[1000]

Variable Documentation

◆ m_debug

bool m_debug = false

Definition at line 19 of file FirstRung/draw_plots.cxx.

Referenced by draw_plots().

◆ max_len

const int max_len = 10000

Definition at line 18 of file FirstRung/draw_plots.cxx.

Referenced by draw_plots().

◆ run_begin

const int run_begin = 59163

Definition at line 14 of file FirstRung/draw_plots.cxx.

Referenced by draw_plots().

◆ run_end

const int run_end = 62823

Definition at line 16 of file FirstRung/draw_plots.cxx.

Referenced by draw_plots().