CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
draw_txt.cxx File Reference
#include <fstream>
#include <iostream>
#include <cmath>

Go to the source code of this file.

Functions

int draw_txt ()
 

Function Documentation

◆ draw_txt()

int draw_txt ( )

Definition at line 9 of file draw_txt.cxx.

10{
11 const int nfile = 5;
12 double momentum[nfile] = {150, 200, 300, 500, 1000};
13 double sigma[nfile][25] = {0};
14 double error[nfile][25] = {0};
15
16 int l(0),i,file,last(-1);
17 double s(0),e(0);
18 string strcom;
19 ifstream fin("log",ios::in);
20 //std::getline(fin, strcom);
21 //fin >> l >> s >> e;
22 //cout<<l<<" "<<s<<" "<<e<<endl;
23 while(std::getline(fin, strcom)){
24 fin >> l >> s >> e;
25 if(l == last)continue;
26 if(l==0)i=0;
27 sigma[file][i] = s;
28 error[file][i] = e;
29 //cout<<l<<" "<<s<<" "<<e<<endl;
30 //cout<<i<<" "<<sigma[file][i]<<" "<<error[file][i]<<endl;
31 i++;
32 if(l==24)file++;
33 last = l;
34 //cout<<l<<" "<<s<<" "<<e<<endl;
35 }
36///*
37 stringstream ssname;
38 string sname;
39 const char * name;
40 TAxis *x_axis,*y_axis;
41 TGraphErrors *gr_sigma_pt;
42 TCanvas *c_pt = new TCanvas("sigma_pt","sigma_pt",2500,2500 );
43 c_pt->Divide(5,5);
44 for(int i=0;i<25;i++){
45 TGraphErrors *gr_sigma_pt = new TGraphErrors();
46 for(int file=0;file<nfile;file++){
47 //cout<<i<<" "<<sigma[file][i]<<" "<<error[file][i]<<endl;
48 gr_sigma_pt->SetPoint(file,momentum[file],sigma[file][i]);
49 gr_sigma_pt->SetPointError(file,0,error[file][i]);
50 }
51 c_pt->cd(i+1);
52 gr_sigma_pt->Draw("APLsame");
53 gr_sigma_pt->SetMarkerStyle(20);
54 gr_sigma_pt->SetMarkerSize(1.0);
55 gr_sigma_pt->SetMarkerColor(3);
56 gr_sigma_pt->SetLineColor(3);
57 x_axis = gr_sigma_pt->GetXaxis();
58 y_axis = gr_sigma_pt->GetYaxis();
59 x_axis->SetTitle("transverse momentum (MeV)");
60 x_axis->CenterTitle();
61 x_axis->SetTitleSize(0.05);
62 x_axis->SetLabelSize(0.04);
63 x_axis->SetTitleOffset(1.05);
64 y_axis->SetTitle("#sigma (cm)");
65 y_axis->CenterTitle();
66 y_axis->SetTitleSize(0.05);
67 y_axis->SetLabelSize(0.04);
68 //y_axis->SetTitleOffset(1.05);
69 ssname.str("");
70 if(i<3){ssname <<"layer"<<i+1;}
71 else if(i<15){ssname <<"layer"<<i+6;}
72 else if(i<22){ssname <<"layer"<<i+22;}
73 else if(i==22){ssname <<"1~3layer";}
74 else if(i==23){ssname <<"9~20layer";}
75 else if(i==24){ssname <<"37~43layer";}
76 //if(l<=3){ssname <<"layer "<<l;cut=1;}
77 //else if(l<=15){ssname <<"layer "<<l+5;cut=1;}
78 //else if(l<=22){ssname <<"layer "<<l+21;cut=1;}
79 //else if(l==23){ssname <<"1~3 layer";cut=1;}
80 //else if(l==24){ssname <<"9~20 layer";cut=1;}
81 //else if(l==25){ssname <<"37~43 layer";cut=1;}
82 sname = ssname.str();
83 name = sname.c_str();
84 gr_sigma_pt->SetTitle(name);
85 }
86 c_pt->SaveAs("sigma_pt.png");
87 c_pt->SaveAs("sigma_pt.pdf");
88 c_pt->SaveAs("sigma_pt.eps");
89 TCanvas *c_pt_layer = new TCanvas("sigma_pt_layer","sigma_pt_layer",1000,1000 );
90 TLegend* leg = new TLegend(0.30,0.60,0.60,0.88);
91 for(int file=0;file<nfile;file++){
92 TGraphErrors *gr_sigma_pt_layer = new TGraphErrors();
93 for(int i=0;i<22;i++){
94 int layer;
95 if(i<3){layer = i+1;}
96 else if(i<15){layer = i+6;}
97 else if(i<22){layer = i+22;}
98 //cout<<i<<" "<<layer<<" "<<sigma[file][i]<<endl;
99 gr_sigma_pt_layer->SetPoint(i,layer,sigma[file][i]);
100 gr_sigma_pt_layer->SetPointError(i,0,error[file][i]);
101 }
102 if(file==0)gr_sigma_pt_layer->Draw("APLsame");
103 else gr_sigma_pt_layer->Draw("PLsame");
104 gr_sigma_pt_layer->SetMarkerStyle(20);
105 gr_sigma_pt_layer->SetMarkerSize(1.0);
106 gr_sigma_pt_layer->SetMarkerColor(file+1);
107 gr_sigma_pt_layer->SetLineColor(file+1);
108 x_axis = gr_sigma_pt_layer->GetXaxis();
109 y_axis = gr_sigma_pt_layer->GetYaxis();
110 x_axis->SetTitle("layer");
111 x_axis->CenterTitle();
112 x_axis->SetTitleSize(0.05);
113 x_axis->SetLabelSize(0.04);
114 x_axis->SetTitleOffset(1.05);
115 y_axis->SetTitle("#sigma (cm)");
116 y_axis->CenterTitle();
117 y_axis->SetTitleSize(0.05);
118 y_axis->SetLabelSize(0.04);
119 //y_axis->SetTitleOffset(1.05);
120 //ssname.str("");
121 //if(i<3){ssname <<"layer"<<i+1;}
122 //else if(i<15){ssname <<"layer"<<i+6;}
123 //else if(i<22){ssname <<"layer"<<i+22;}
124 //else if(i==22){ssname <<"1~3layer";}
125 //else if(i==23){ssname <<"9~20layer";}
126 //else if(i==24){ssname <<"37~43layer";}
127 //if(l<=3){ssname <<"layer "<<l;cut=1;}
128 //else if(l<=15){ssname <<"layer "<<l+5;cut=1;}
129 //else if(l<=22){ssname <<"layer "<<l+21;cut=1;}
130 //else if(l==23){ssname <<"1~3 layer";cut=1;}
131 //else if(l==24){ssname <<"9~20 layer";cut=1;}
132 //else if(l==25){ssname <<"37~43 layer";cut=1;}
133 //sname = ssname.str();
134 //name = sname.c_str();
135 ssname.str("");
136 ssname <<momentum[file]<<"MeV";
137 sname = ssname.str();
138 name = sname.c_str();
139 gr_sigma_pt_layer->SetTitle("sigma_layer");
140 leg->AddEntry(gr_sigma_pt_layer,name,"pl");
141
142 }
143 leg->Draw();
144 leg->SetFillColor(kWhite);
145 leg->SetLineColor(kWhite);
146 c_pt_layer->SaveAs("sigma_pt_layer.png");
147 c_pt_layer->SaveAs("sigma_pt_layer.pdf");
148 c_pt_layer->SaveAs("sigma_pt_layer.eps");
149//*/
150}
**********INTEGER nmxhep !maximum number of particles DOUBLE PRECISION vhep INTEGER jdahep COMMON hepevt $ !serial number $ !number of particles $ !status code $ !particle ident KF $ !parent particles $ !childreen particles $ !four momentum
XmlRpcServer s
Definition: HelloServer.cpp:11