本文整理汇总了C++中TCanvas::GetUxmax方法的典型用法代码示例。如果您正苦于以下问题:C++ TCanvas::GetUxmax方法的具体用法?C++ TCanvas::GetUxmax怎么用?C++ TCanvas::GetUxmax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCanvas
的用法示例。
在下文中一共展示了TCanvas::GetUxmax方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: good_bad
void plotter::good_bad(vector<double> &vecx, vector<double> &best_gen, vector<double> &smeared_gen, string filename, string title, string xaxis_label)
{
cout << "scattering plot" << endl;
int n = vecx.size();
double arrx[n];
double arry[n];
for (int i=0; i<n; i++){
//arrx[i] = log10(vecx.at(i)+1e-20);
arrx[i] = vecx.at(i);
double dif = abs(best_gen.at(i)) - abs(smeared_gen.at(i));
arry[i] = dif;
}
cout << "created arrs" << endl;
TCanvas* canvas = new TCanvas("canvas");
TGraph *g = new TGraph(n, arrx, arry);
g->SetMarkerStyle(2);
cout << "getting axes" << endl;
g->Draw("ap");
g->GetXaxis()->SetTitle(xaxis_label.c_str());
g->GetYaxis()->SetTitle("abs(best_gen) - abs(smeared_gen)");
//g->GetXaxis()->SetRangeUser(0,1);
//g->GetYaxis()->SetRangeUser(0,20000);
g->SetTitle((title).c_str());
canvas->Update();
TLine *l = new TLine(canvas->GetUxmin(), 0.0, canvas->GetUxmax(), 0.0);
l->SetLineColor(kBlue);
l->Draw();
cout << "before draw" << endl;
//g->Draw("ap");
canvas->Update();
cout << "after draw" << endl;
canvas->Print(filename.c_str());
cout << "after print" << endl;
}
示例2: drawEvent
void drawEvent(TString str){
Int_t nseries,nrun,nevent,ch;
Char_t type;
TString temp=str(TPRegexp("[SCD*]\\d+"));
type=temp(TPRegexp("[SCD]"));
TPRegexp digits("\\d+");
temp=temp(digits);
nseries=temp.Atoi();
temp=str(TPRegexp("r\\d+"));
temp=temp(digits);
nrun=temp.Atoi();
temp=str(TPRegexp("e\\d+"));
temp=temp(digits);
nevent=temp.Atoi();
temp=str(TPRegexp("c\\d+"));
temp=temp(digits);
ch=temp.Atoi();
//cout<<"*"<<nseries<<"r"<<nrun<<"e"<<nevent<<"c"<<ch<<endl;
RawFileReader reader;
reader.open(type,nseries,nrun);
reader.seek(nevent);
Entry entry;
RawData rdata;
reader.readNext(entry,rdata);
reader.close();
g.SetLineColor(kBlue);
Float_t g_min=rdata.ch[ch][0],g_max=g_min,h_min=rdata.ch[15][0],h_max=h_min;
for(Int_t i=1;i<2048;i++){
if(rdata.ch[ch][i]>g_max){
g_max=rdata.ch[ch][i];
}else if(rdata.ch[ch][i]<g_min){
g_min=rdata.ch[ch][i];
}
if(rdata.ch[15][i]>h_max){
h_max=rdata.ch[15][i];
}else if(rdata.ch[15][i]<h_min){
h_min=rdata.ch[15][i];
}
}
Float_t scale=(h_max-h_min)/(g_max-g_min),shift=(g_max*h_min-g_min*h_max)/(g_max-g_min);
for(Int_t i=0;i<2048;i++){
g.SetPoint(i,0.04*i,scale*rdata.ch[ch][i]+shift);
h.SetPoint(i,0.04*i,rdata.ch[15][i]);
}
g.GetXaxis()->SetRangeUser(0,2047*0.04);
h.GetXaxis()->SetRangeUser(0,2047*0.04);
h.Draw("al");
g.Draw("same");
if(axis){
delete axis;
}
c1.Update();
Float_t min=(gPad->GetUymin()-shift)/scale;
Float_t max=(gPad->GetUymax()-shift)/scale;
axis=new TGaxis(c1.GetUxmax(),c1.GetUymin(),c1.GetUxmax(),c1.GetUymax(),min,max,510,"+L");
axis->SetLineColor(kBlue);
axis->SetLabelColor(kBlue);
axis->Draw();
cout<<g_min<<endl;
cout<<g_max<<endl;
}