本文整理汇总了C++中TArrow::DrawArrow方法的典型用法代码示例。如果您正苦于以下问题:C++ TArrow::DrawArrow方法的具体用法?C++ TArrow::DrawArrow怎么用?C++ TArrow::DrawArrow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TArrow
的用法示例。
在下文中一共展示了TArrow::DrawArrow方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: event
void event(){
TCanvas *c1 = new TCanvas("c1","ROOT Event description",700,500);
c1->Range(0,0,14,15.5);
TPaveText *event = new TPaveText(1,13,3,15);
event->SetFillColor(11);
event->Draw();
event->AddText("Event");
TLine *line = new TLine(1.1,13,1.1,1.5);
line->SetLineWidth(2);
line->Draw();
line->DrawLine(1.3,13,1.3,3.5);
line->DrawLine(1.5,13,1.5,5.5);
line->DrawLine(1.7,13,1.7,7.5);
line->DrawLine(1.9,13,1.9,9.5);
line->DrawLine(2.1,13,2.1,11.5);
TArrow *arrow = new TArrow(1.1,1.5,3.9,1.5,0.02,"|>");
arrow->SetFillStyle(1001);
arrow->SetFillColor(1);
arrow->Draw();
arrow->DrawArrow(1.3,3.5,3.9,3.5,0.02,"|>");
arrow->DrawArrow(1.5,5.5,3.9,5.5,0.02,"|>");
arrow->DrawArrow(1.7,7.5,3.9,7.5,0.02,"|>");
arrow->DrawArrow(1.9,9.5,3.9,9.5,0.02,"|>");
arrow->DrawArrow(2.1,11.5,3.9,11.5,0.02,"|>");
TPaveText *p1 = new TPaveText(4,1,11,2);
p1->SetTextAlign(12);
p1->SetFillColor(42);
p1->AddText("1 Mbyte");
p1->Draw();
TPaveText *p2 = new TPaveText(4,3,10,4);
p2->SetTextAlign(12);
p2->SetFillColor(42);
p2->AddText("100 Kbytes");
p2->Draw();
TPaveText *p3 = new TPaveText(4,5,9,6);
p3->SetTextAlign(12);
p3->SetFillColor(42);
p3->AddText("10 Kbytes");
p3->Draw();
TPaveText *p4 = new TPaveText(4,7,8,8);
p4->SetTextAlign(12);
p4->SetFillColor(42);
p4->AddText("1 Kbytes");
p4->Draw();
TPaveText *p5 = new TPaveText(4,9,7,10);
p5->SetTextAlign(12);
p5->SetFillColor(42);
p5->AddText("100 bytes");
p5->Draw();
TPaveText *p6 = new TPaveText(4,11,6,12);
p6->SetTextAlign(12);
p6->SetFillColor(42);
p6->AddText("10 bytes");
p6->Draw();
TText *text = new TText();
text->SetTextAlign(12);
text->SetTextSize(0.04);
text->SetTextFont(72);
text->DrawText(6.2,11.5,"Header:Event_flag");
text->DrawText(7.2,9.5,"Trigger_Info");
text->DrawText(8.2,7.5,"Muon_Detector: TOF");
text->DrawText(9.2,5.5,"Calorimeters");
text->DrawText(10.2,3.5,"Forward_Detectors");
text->DrawText(11.2,1.5,"TPCs");
}
示例2: toyns
void toyplotsge1btight() {
gStyle->SetPadBottomMargin(0.15) ;
gStyle->SetPadLeftMargin(0.15) ;
gStyle->SetOptTitle(0) ;
TCanvas* c1 = new TCanvas("c1","c1") ;
TArrow* arrow = new TArrow() ;
arrow->SetLineWidth(3) ;
TChain toyns("tt_toy_nosusyfit") ;
toyns.Add("an-11-257-v3-files/output-files/toyge1btight-smonly-mctest.root") ;
TChain bgo("tt_cls_bgonly") ;
TChain spb("tt_cls_splusb") ;
bgo.Add("an-11-257-v3-files/output-files/toyge1btight-smonly-mctest.root") ;
spb.Add("an-11-257-v3-files/output-files/toyge1btight-smonly-mctest.root") ;
//============ fit values
gStyle->SetOptStat("emr") ;
TH1F* httwjfit = new TH1F("httwjfit","ttwj",40, 0., 45. ) ;
TH1F* hqcdfit = new TH1F("hqcdfit" ,"qcd" ,40, 0., 10. ) ;
TH1F* hznnfit = new TH1F("hznnfit" ,"znn" ,40, 0., 20. ) ;
toyns.Draw("ttwj_sig_fit>>httwjfit","") ;
toyns.Draw("qcd_sig_fit>>hqcdfit","") ;
toyns.Draw("znn_sig_fit>>hznnfit","") ;
httwjfit->SetLineWidth(2) ;
hqcdfit->SetLineWidth(2) ;
hznnfit->SetLineWidth(2) ;
httwjfit->SetFillColor(11) ;
hqcdfit->SetFillColor(11) ;
hznnfit->SetFillColor(11) ;
httwjfit->SetXTitle("Fit ttwj SIG events") ;
hqcdfit->SetXTitle("Fit QCD SIG events") ;
hznnfit->SetXTitle("Fit Znn SIG events") ;
httwjfit->SetYTitle("Toy experiments") ;
hqcdfit->SetYTitle("Toy experiments") ;
hznnfit->SetYTitle("Toy experiments") ;
httwjfit->Draw() ;
arrow->DrawArrow(19.6,40,19.6,0) ;
c1->SaveAs("an-11-257-v3-files/output-files/toymc-ttwj-sig-fit-ge1btight.png") ;
hqcdfit->Draw() ;
arrow->DrawArrow(1.3,60,1.3,0) ;
c1->SaveAs("an-11-257-v3-files/output-files/toymc-qcd-sig-fit-ge1btight.png") ;
hznnfit->Draw() ;
arrow->DrawArrow(4.25,40,4.25,0) ;
c1->SaveAs("an-11-257-v3-files/output-files/toymc-znn-sig-fit-ge1btight.png") ;
//============ fit uncertainty
TH1F* httwjerr = new TH1F("httwjerr","ttwj",40, 0., 10. ) ;
TH1F* hqcderr = new TH1F("hqcderr" ,"qcd" ,40, 0., 8. ) ;
TH1F* hznnerr = new TH1F("hznnerr" ,"znn" ,40, 0., 10. ) ;
toyns.Draw("ttwj_sig_err>>httwjerr","") ;
toyns.Draw("qcd_sig_err>>hqcderr","") ;
toyns.Draw("znn_sig_err>>hznnerr","") ;
httwjerr->SetLineWidth(2) ;
hqcderr->SetLineWidth(2) ;
hznnerr->SetLineWidth(2) ;
httwjerr->SetFillColor(11) ;
hqcderr->SetFillColor(11) ;
hznnerr->SetFillColor(11) ;
httwjerr->SetXTitle("err ttwj SIG events") ;
hqcderr->SetXTitle("err QCD SIG events") ;
hznnerr->SetXTitle("err Znn SIG events") ;
httwjerr->SetYTitle("Toy experiments") ;
hqcderr->SetYTitle("Toy experiments") ;
hznnerr->SetYTitle("Toy experiments") ;
httwjerr->Draw() ;
c1->SaveAs("an-11-257-v3-files/output-files/toymc-ttwj-sig-err-ge1btight.png") ;
hqcderr->Draw() ;
c1->SaveAs("an-11-257-v3-files/output-files/toymc-qcd-sig-err-ge1btight.png") ;
hznnerr->Draw() ;
c1->SaveAs("an-11-257-v3-files/output-files/toymc-znn-sig-err-ge1btight.png") ;
//============ q value distributions.
gStyle->SetOptStat(0) ;
//.........这里部分代码省略.........
示例3: DrawDataStackedMC
//.........这里部分代码省略.........
const std::string & dataName = "Data",
const Int_t mcBaseColor = 2,
const Int_t mcColorOffset = 1,
const Int_t mcFillStyle = 3001,
const char * xaxislabel = "",
const char * yaxislabel = "",
bool cov_area_normalize = false
)
*/
plotter->DrawDataStackedMC(h_data, mc_hists, POT_ratio, "N", "Data (3.33e20 POT)", 0, 0, 3002);
// Add Legend
double leg_x_min = 0.55;
double leg_x_max = 0.90;
double leg_y_min = 0.55;
double leg_y_max = 0.85;
h_data->SetMarkerStyle(plotter->data_marker);
h_data->SetMarkerSize(plotter->data_marker_size);
h_data->SetMarkerColor(plotter->data_color);
h_data->SetLineColor(plotter->data_color);
h_data->SetLineWidth(plotter->data_line_width);
TLegend *legend = new TLegend(leg_x_min, leg_y_min, leg_x_max, leg_y_max);
legend->SetBorderSize(0);
legend->SetFillColor(-1);
legend->SetFillStyle(0);
legend->SetTextFont(42);
legend->SetTextSize(0.04);
legend->AddEntry(h_data, "Data", "lep");
legend->AddEntry(h_signal, "Signal", "f");
legend->AddEntry(h_WithPi0, "Bkgrd: #pi^{0} + meson(s)", "f");
legend->AddEntry(h_QELike, "Bkgrd: zero meson", "f");
legend->AddEntry(h_SinglePiPlus, "Bkgrd: charged meson(s)", "f");
legend->AddEntry(h_Other, "Bkgrd: other", "f");
legend->SetTextSize(0.04);
legend->SetTextFont(42);
legend->Draw();
// Add Alines if Original Side Band
//if (false) {
if (sb_name.compare("Original") == 0) {
double max_bin = h_data->GetMaximumBin();
double hist_max = h_data->GetBinContent(max_bin)*1.2;
TLine line;
TArrow arrow;
// Cut Line at 60 MeV
line.SetLineWidth(2);
line.SetLineStyle(2);
line.SetLineColor(kBlack);
arrow.SetLineWidth(2);
arrow.SetLineColor(kBlack);
line.DrawLine(60.0, 0.0, 60.0, hist_max);
arrow.DrawArrow(60.0, hist_max, 50.0, hist_max, 0.01);
line.DrawLine(200.0, 0.0, 200.0, hist_max);
arrow.DrawArrow(200.0, hist_max, 210.0, hist_max, 0.01);
arrow.SetLineColor(kBlue);
arrow.DrawArrow(134.98,hist_max/8,134.98,0, 0.01);
}
// Add Normalization Label
TLatex norm_text;
norm_text.SetNDC();
norm_text.SetTextColor(kBlue);
norm_text.SetTextSize(0.03);
norm_text.SetTextAlign(22);
norm_text.DrawLatex(0.35,0.85,"POT Normalized");
double info_text_x = 0.85;
double info_text_y = 0.85;
TLatex info_text;
info_text.SetNDC();
info_text.SetTextColor(kBlack);
info_text.SetTextFont(62);
info_text.SetTextAlign(12);
info_text.SetTextSize(0.04);
if ( ind == 0) info_text.DrawLatex(info_text_x, info_text_y, "(a)");
else info_text.DrawLatex(info_text_x, info_text_y, "(b)");
// Plot Output
c->Update();
std::string plotDir = Folder_List::plotDir_Paper;
std::string out_name;
out_name = plotDir + var_name + "_" + sb_name + "_" + type + "_" + norm + ".pdf";
c->Print(out_name.c_str(),"pdf");
delete h_data;
delete h_signal;
delete h_WithPi0;
delete h_QELike;
delete h_SinglePiPlus;
delete h_Other;
delete legend;
delete c;
delete plotter;
}
示例4: analyze
void analyze() {
TCanvas *c1 = new TCanvas("c1","Analyze.mac",620,790);
c1->Range(-1,0,19,30);
TPaveLabel *pl1 = new TPaveLabel(0,27,3.5,29,"Analyze");
pl1->SetFillColor(42);
pl1->Draw();
TPaveText *pt1 = new TPaveText(0,22.8,4,25.2);
TText *t1 = pt1->AddText("Parenthesis matching");
TText *t2 = pt1->AddText("Remove unnecessary");
TText *t2a = pt1->AddText("parenthesis");
pt1->Draw();
TPaveText *pt2 = new TPaveText(6,23,10,25);
TText *t3 = pt2->AddText("break of");
TText *t4 = pt2->AddText("Analyze");
pt2->Draw();
TPaveText *pt3 = new TPaveText(0,19,4,21);
t4=pt3->AddText("look for simple");
TText *t5 = pt3->AddText("operators");
pt3->Draw();
TPaveText *pt4 = new TPaveText(0,15,4,17);
TText *t6 = pt4->AddText("look for an already");
TText *t7 = pt4->AddText("defined expression");
pt4->Draw();
TPaveText *pt5 = new TPaveText(0,11,4,13);
TText *t8 = pt5->AddText("look for usual");
TText *t9 = pt5->AddText("functions :cos sin ..");
pt5->Draw();
TPaveText *pt6 = new TPaveText(0,7,4,9);
TText *t10 = pt6->AddText("look for a");
TText *t11 = pt6->AddText("numeric value");
pt6->Draw();
TPaveText *pt7 = new TPaveText(6,18.5,10,21.5);
TText *t12 = pt7->AddText("Analyze left and");
TText *t13 = pt7->AddText("right part of");
TText *t14 = pt7->AddText("the expression");
pt7->Draw();
TPaveText *pt8 = new TPaveText(6,15,10,17);
TText *t15 = pt8->AddText("Replace expression");
pt8->Draw();
TPaveText *pt9 = new TPaveText(6,11,10,13);
TText *t16 = pt9->AddText("Analyze");
pt9->SetFillColor(42);
pt9->Draw();
TPaveText *pt10 = new TPaveText(6,7,10,9);
TText *t17 = pt10->AddText("Error");
TText *t18 = pt10->AddText("Break of Analyze");
pt10->Draw();
TPaveText *pt11 = new TPaveText(14,22,17,24);
pt11->SetFillColor(42);
TText *t19 = pt11->AddText("Analyze");
TText *t19a = pt11->AddText("Left");
pt11->Draw();
TPaveText *pt12 = new TPaveText(14,19,17,21);
pt12->SetFillColor(42);
TText *t20 = pt12->AddText("Analyze");
TText *t20a = pt12->AddText("Right");
pt12->Draw();
TPaveText *pt13 = new TPaveText(14,15,18,18);
TText *t21 = pt13->AddText("StackNumber++");
TText *t22 = pt13->AddText("operator[StackNumber]");
TText *t23 = pt13->AddText("= operator found");
pt13->Draw();
TPaveText *pt14 = new TPaveText(12,10.8,17,13.2);
TText *t24 = pt14->AddText("StackNumber++");
TText *t25 = pt14->AddText("operator[StackNumber]");
TText *t26 = pt14->AddText("= function found");
pt14->Draw();
TPaveText *pt15 = new TPaveText(6,7,10,9);
TText *t27 = pt15->AddText("Error");
TText *t28 = pt15->AddText("break of Analyze");
pt15->Draw();
TPaveText *pt16 = new TPaveText(0,2,7,5);
TText *t29 = pt16->AddText("StackNumber++");
TText *t30 = pt16->AddText("operator[StackNumber] = 0");
TText *t31 = pt16->AddText("value[StackNumber] = value found");
pt16->Draw();
TArrow *ar = new TArrow(2,27,2,25.4,0.012,"|>");
ar->SetFillColor(1);
ar->Draw();
ar->DrawArrow(2,22.8,2,21.2,0.012,"|>");
ar->DrawArrow(2,19,2,17.2,0.012,"|>");
ar->DrawArrow(2,15,2,13.2,0.012,"|>");
ar->DrawArrow(2,11,2, 9.2,0.012,"|>");
ar->DrawArrow(2, 7,2, 5.2,0.012,"|>");
ar->DrawArrow(4,24,6,24,0.012,"|>");
ar->DrawArrow(4,20,6,20,0.012,"|>");
ar->DrawArrow(4,16,6,16,0.012,"|>");
ar->DrawArrow(4,12,6,12,0.012,"|>");
ar->DrawArrow(4, 8,6, 8,0.012,"|>");
ar->DrawArrow(10,20,14,20,0.012,"|>");
ar->DrawArrow(12,23,14,23,0.012,"|>");
ar->DrawArrow(12,16.5,14,16.5,0.012,"|>");
ar->DrawArrow(10,12,12,12,0.012,"|>");
TText *ta = new TText(2.2,22.2,"err = 0");
ta->SetTextFont(71);
ta->SetTextSize(0.015);
ta->SetTextColor(4);
ta->SetTextAlign(12);
ta->Draw();
ta->DrawText(2.2,18.2,"not found");
//.........这里部分代码省略.........
示例5: toyplotsge1btight
void toyplotsge1btight() {
gStyle->SetPadBottomMargin(0.15) ;
gStyle->SetPadLeftMargin(0.15) ;
gStyle->SetOptTitle(0) ;
TCanvas* c1 = new TCanvas("c1","c1") ;
TArrow* arrow = new TArrow() ;
arrow->SetLineWidth(3) ;
TChain toyns("toytt") ;
toyns.Add("output-files/toy-data-ge1btight.root") ;
//--- extract true values from TTree.
double fit_tru_ttwj ;
TBranch* b_fit_tru_ttwj ;
toyns.SetBranchAddress("fit_tru_ttwj", &fit_tru_ttwj, &b_fit_tru_ttwj ) ;
toyns.GetEntry() ;
printf("\n\n true value for ttwj : %8.2f\n", fit_tru_ttwj ) ;
double fit_tru_qcd ;
TBranch* b_fit_tru_qcd ;
toyns.SetBranchAddress("fit_tru_qcd", &fit_tru_qcd, &b_fit_tru_qcd ) ;
toyns.GetEntry() ;
printf("\n\n true value for qcd : %8.2f\n", fit_tru_qcd ) ;
double fit_tru_znn ;
TBranch* b_fit_tru_znn ;
toyns.SetBranchAddress("fit_tru_znn", &fit_tru_znn, &b_fit_tru_znn ) ;
toyns.GetEntry() ;
printf("\n\n true value for znn : %8.2f\n", fit_tru_znn ) ;
//============ fit values
gStyle->SetOptStat("emr") ;
TH1F* httwjfit = new TH1F("httwjfit","ttwj",40, 0., 40. ) ;
TH1F* hqcdfit = new TH1F("hqcdfit" ,"qcd" ,40, 0., 15. ) ;
TH1F* hznnfit = new TH1F("hznnfit" ,"znn" ,40, 0., 25. ) ;
toyns.Draw("fit_val_ttwj>>httwjfit","fit_cov_qual==3") ;
toyns.Draw("fit_val_qcd>>hqcdfit","fit_cov_qual==3") ;
toyns.Draw("fit_val_znn>>hznnfit","fit_cov_qual==3") ;
httwjfit->SetLineWidth(2) ;
hqcdfit->SetLineWidth(2) ;
hznnfit->SetLineWidth(2) ;
httwjfit->SetFillColor(11) ;
hqcdfit->SetFillColor(11) ;
hznnfit->SetFillColor(11) ;
httwjfit->SetXTitle("Fit ttwj SIG events") ;
hqcdfit->SetXTitle("Fit QCD SIG events") ;
hznnfit->SetXTitle("Fit Znn SIG events") ;
httwjfit->SetYTitle("Toy experiments") ;
hqcdfit->SetYTitle("Toy experiments") ;
hznnfit->SetYTitle("Toy experiments") ;
httwjfit->Draw() ;
arrow->DrawArrow(fit_tru_ttwj, 0.4*(httwjfit->GetMaximum()), fit_tru_ttwj, 0) ;
c1->SaveAs("output-files/toymc-ttwj-sig-fit-ge1btight.png") ;
hqcdfit->Draw() ;
arrow->DrawArrow(fit_tru_qcd, 0.4*(hqcdfit->GetMaximum()), fit_tru_qcd, 0) ;
c1->SaveAs("output-files/toymc-qcd-sig-fit-ge1btight.png") ;
hznnfit->Draw() ;
arrow->DrawArrow(fit_tru_znn, 0.4*(hznnfit->GetMaximum()), fit_tru_znn, 0) ;
c1->SaveAs("output-files/toymc-znn-sig-fit-ge1btight.png") ;
//============ fit uncertainty
TH1F* httwjerr = new TH1F("httwjerr","ttwj",40, 0., 15. ) ;
TH1F* hqcderr = new TH1F("hqcderr" ,"qcd" ,40, 0., 10. ) ;
TH1F* hznnerr = new TH1F("hznnerr" ,"znn" ,40, 0., 15. ) ;
toyns.Draw("fit_err_ttwj>>httwjerr","fit_cov_qual==3") ;
toyns.Draw("fit_err_qcd>>hqcderr","fit_cov_qual==3") ;
toyns.Draw("fit_err_znn>>hznnerr","fit_cov_qual==3") ;
httwjerr->SetLineWidth(2) ;
hqcderr->SetLineWidth(2) ;
hznnerr->SetLineWidth(2) ;
httwjerr->SetFillColor(11) ;
hqcderr->SetFillColor(11) ;
hznnerr->SetFillColor(11) ;
httwjerr->SetXTitle("err ttwj SIG events") ;
hqcderr->SetXTitle("err QCD SIG events") ;
hznnerr->SetXTitle("err Znn SIG events") ;
httwjerr->SetYTitle("Toy experiments") ;
//.........这里部分代码省略.........
示例6: fildir
void fildir(){
TCanvas *c1 = new TCanvas("c1","ROOT FilDir description",700,900);
c1->Range(1,1,19,24.5);
TPaveLabel *title = new TPaveLabel(4,23,16,24.2,"ROOT File/Directory/Key description");
title->SetFillColor(16);
title->Draw();
Int_t keycolor = 42;
Int_t dircolor = 21;
Int_t objcolor = 46;
TPaveText *file = new TPaveText(2,19,6,22);
file->SetFillColor(39);
file->Draw();
file->SetTextSize(0.04);
file->AddText("TFile");
file->AddText("Header");
TArrow *arrow = new TArrow(6,20.5,17,20.5,0.02,"|>");
arrow->SetFillStyle(1001);
arrow->SetLineWidth(2);
arrow->Draw();
TPaveText *free1 = new TPaveText(8,20,11,21);
free1->SetFillColor(18);
free1->Draw();
free1->AddText("First:Last");
TPaveText *free2 = new TPaveText(12,20,15,21);
free2->SetFillColor(18);
free2->Draw();
free2->AddText("First:Last");
TText *tfree = new TText(6.2,21.2,"fFree = TList of free blocks");
tfree->SetTextSize(0.02);
tfree->Draw();
TText *tkeys = new TText(5.2,18.2,"fKeys = TList of Keys");
tkeys->SetTextSize(0.02);
tkeys->Draw();
TText *tmemory = new TText(3.2,15.2,"fListHead = TList of Objects in memory");
tmemory->SetTextSize(0.02);
tmemory->Draw();
arrow->DrawArrow(5,17,17,17,0.02,"|>");
TLine *line = new TLine(5,19,5,17);
line->SetLineWidth(2);
line->Draw();
TPaveText *key0 = new TPaveText(7,16,10,18);
key0->SetTextSize(0.04);
key0->SetFillColor(keycolor);
key0->AddText("Key 0");
key0->Draw();
TPaveText *key1 = new TPaveText(12,16,15,18);
key1->SetTextSize(0.04);
key1->SetFillColor(keycolor);
key1->AddText("Key 1");
key1->Draw();
line->DrawLine(3,19,3,14);
line->DrawLine(3,14,18,14);
TPaveText *obj0 = new TPaveText(5,13,8,15);
obj0->SetFillColor(objcolor);
obj0->AddText("Object");
obj0->Draw();
TPaveText *dir1 = new TPaveText(10,13,13,15);
dir1->SetFillColor(dircolor);
dir1->AddText("SubDir");
dir1->Draw();
TPaveText *obj1 = new TPaveText(15,13,18,15);
obj1->SetFillColor(objcolor);
obj1->AddText("Object");
obj1->Draw();
arrow->DrawArrow(12,11,17,11,0.015,"|>");
arrow->DrawArrow(11,9,17,9,0.015,"|>");
line->DrawLine(12,13,12,11);
line->DrawLine(11,13,11,9);
TPaveText *key2 = new TPaveText(14,10.5,16,11.5);
key2->SetFillColor(keycolor);
key2->AddText("Key 0");
key2->Draw();
TPaveText *obj2 = new TPaveText(14,8.5,16,9.5);
obj2->SetFillColor(objcolor);
obj2->AddText("Object");
obj2->Draw();
TLine *ldot = new TLine(10,15,2,11);
ldot->SetLineStyle(2);
ldot->Draw();
ldot->DrawLine(13,15,8,11);
ldot->DrawLine(13,13,8,5);
TPaveText *dirdata = new TPaveText(2,5,8,11);
dirdata->SetTextAlign(12);
dirdata->SetFillColor(dircolor);
dirdata->Draw();
dirdata->SetTextSize(0.015);
dirdata->AddText("fModified: True if directory is modified");
dirdata->AddText("fWritable: True if directory is writable");
dirdata->AddText("fDatimeC: Creation Date/Time");
dirdata->AddText("fDatimeM: Last mod Date/Time");
dirdata->AddText("fNbytesKeys: Number of bytes of key");
dirdata->AddText("fNbytesName : Header length up to title");
dirdata->AddText("fSeekDir: Start of Directory on file");
dirdata->AddText("fSeekParent: Start of Parent Directory");
dirdata->AddText("fSeekKeys: Pointer to Keys record");
TPaveText *keydata = new TPaveText(10,2,17,7);
//.........这里部分代码省略.........
示例7: file
void file(){
TCanvas *c1 = new TCanvas("c1","ROOT File description",200,10,700,550);
c1->Range(0,-0.25,21,14);
TPaveLabel *title = new TPaveLabel(5,12,15,13.7,c1->GetTitle());
title->SetFillColor(16);
title->Draw();
// horizonthal file layout
TPave *file = new TPave(1,8.5,20,11);
file->SetFillColor(11);
file->Draw();
TPave *fileh = new TPave(1,8.5,2.5,11);
fileh->SetFillColor(44);
fileh->Draw();
TPave *lrh = new TPave(2.5,8.5,3.3,11,1);
lrh->SetFillColor(33);
lrh->Draw();
lrh->DrawPave(6.9,8.5,7.7,11,1);
lrh->DrawPave(10.5,8.5,11.3,11,1);
lrh->DrawPave(14.5,8.5,15.3,11,1);
TLine *ldot = new TLine(1,8.5,0.5,6.5);
ldot->SetLineStyle(2);
ldot->Draw();
ldot->DrawLine(2.5, 8.5, 9.4, 6.5);
ldot->DrawLine(10.5, 8.5, 10, 6.5);
ldot->DrawLine(11.3, 8.5, 19.5, 6.5);
TLine *line = new TLine(2.6,11,2.6,11.5);
line->Draw();
line->DrawLine(2.6,11.5,7,11.5);
TArrow *arrow = new TArrow(7,11.5,7,11.1,0.01,"|>");
arrow->SetFillStyle(1001);
arrow->Draw();
line->DrawLine( 7, 8.5, 7, 8.0);
line->DrawLine( 7, 8.0, 10.6, 8);
arrow->DrawArrow( 10.6,8, 10.6, 8.4,0.01,"|>");
line->DrawLine( 10.6, 11, 10.6, 11.5);
line->DrawLine( 10.6, 11.5, 14.6, 11.5);
arrow->DrawArrow( 14.6,11.5, 14.6,11.1,0.01,"|>");
line->DrawLine( 14.6, 8.5, 14.6, 8.0);
line->DrawLine( 14.6, 8.0, 16, 8);
ldot->DrawLine(16, 8, 19, 8);
TText *vert = new TText(1.5,9.75,"File");
vert->SetTextAlign(21);
vert->SetTextAngle(90);
vert->SetTextSize(0.025);
vert->Draw();
vert->DrawText(2.0, 9.75,"Header");
vert->DrawText(2.9, 9.75,"Logical Record");
vert->DrawText(3.2, 9.75,"Header");
vert->DrawText(7.3, 9.75,"Logical Record");
vert->DrawText(7.6, 9.75,"Header");
vert->DrawText(10.9,9.75,"Logical Record");
vert->DrawText(11.2,9.75,"Header");
vert->DrawText(14.9,9.75,"Logical Record");
vert->DrawText(15.2,9.75,"Header");
TText *hori = new TText(4.75,10,"Object");
hori->SetTextAlign(22);
hori->SetTextSize(0.035);
hori->Draw();
hori->DrawText(4.75, 9.5,"Data");
hori->DrawText(9.2, 10,"Deleted");
hori->DrawText(9.2, 9.5,"Object");
line->DrawLine( 6.9, 8.5, 10.5, 11);
line->DrawLine( 6.9, 11, 10.5, 8.5);
TText *tbig = new TText(17,9.75,"............");
tbig->SetTextAlign(22);
tbig->SetTextSize(0.03);
tbig->Draw();
tbig->DrawText(2.6, 7, "fBEGIN");
tbig->DrawText(20., 7, "fEND");
arrow->DrawArrow( 2.6,7, 2.6,8.4,0.01,"|>");
arrow->DrawArrow( 20,7, 20,8.4,0.01,"|>");
//file header
TPaveText *header = new TPaveText(0.5,.2,9.4,6.5);
header->SetFillColor(44);
header->Draw();
TText *fh=header->AddText("File Header");
fh->SetTextAlign(22);
fh->SetTextSize(0.04);
header->SetTextSize(0.027);
header->SetTextAlign(12);
header->AddText(" ");
header->AddLine(0,0,0,0);
header->AddText("\"root\": Root File Identifier");
header->AddText("fVersion: File version identifier");
header->AddText("fBEGIN: Pointer to first data record");
header->AddText("fEND: Pointer to first free word at EOF");
header->AddText("fSeekFree: Pointer to FREE data record");
header->AddText("fNbytesFree: Number of bytes in FREE");
header->AddText("fNfree: Number of free data records");
header->AddText("fNbytesName: Number of bytes in name/title");
header->AddText("fUnits: Number of bytes for pointers");
header->AddText("fCompress: Compression level");
//logical record header
TPaveText *lrecord = new TPaveText(10,0.2,19.5,6.5);
lrecord->SetFillColor(33);
//.........这里部分代码省略.........
示例8: EvtSel_Q2Pmiss
void EvtSel_Q2Pmiss(){
Styles style2; style2.setPadsStyle(2); style2.applyStyle();
TString NameTrees[3] = {"AWG82/ntuples/small/RAll_RunAll.root",
"AWG82/ntuples/small/uds_RunAll.root", "AWG82/ntuples/small/ccbar_RunAll.root"};
TChain gen("ntp1"), cont("ntp1");
gen.Add(NameTrees[0]);
for(int t=1; t<3; t++) cont.Add(NameTrees[t]);
double totMCB = 0, totuds = 0, totccbar = 0, totdata = 0, totOffdata = 0;
getNumberB(NameTrees[0], "All", totMCB, totdata, totuds, totccbar, totOffdata);
double wuds = totMCB/totuds*2.09/1.05;
TH1F *hCount = new TH1F("hCount","",100,-4,12);
gen.Draw("candM2>>hCount","weight");
double nTotal = hCount->Integral();
cont.Draw("candM2>>hCount","weight");
nTotal += hCount->Integral()*wuds;
TLine line; line.SetLineStyle(2); line.SetLineColor(28); line.SetLineWidth(2);
TArrow arrow; arrow.SetLineColor(28); arrow.SetFillColor(28); arrow.SetLineWidth(2);
TCanvas can("can","Pmiss and q2 cuts");
can.Divide(2,1); TPad *cPad = (TPad *)can.cd(1);
int bins[] = {42,40}, colors[2][4] = {{8,4,1,3},{8,2,4,1}};
double xrange[2][2] = {{0,4.2},{-3,13}}, yield[2][4], maxi[] = {-99,-99};
TString Variable[] = {"candPMiss","candQ2"};
TString labels[2][4] = {{"Signal (", "Normaliz. (","Had. bkg. (",""},
{"Signal (", "D l #nu (", "D* l #nu (", "Bkg. ("}};
// TString labels[2][4] = {{"Signal", "Normaliz.","Had. Bkg.",""},
// {"Signal", "D l #nu", "D* l #nu", "Bkg."}};
TString cuts[2][4] = {{"(candType<3&&MCType>4&&MCType<7||candType>2&&MCType>10&&MCType<13)*weight",
"(candType<3&&MCType>0&&MCType<5||candType>2&&MCType>6&&MCType<11)*weight",
"(MCType==0&&MCCombmode==12)*weight", ""},
{"(candType<3&&MCType>4&&MCType<7||candType>2&&MCType>10&&MCType<13)*weight",
"(candType<3&&(MCType==1||MCType==3)||candType>2&&(MCType==7||MCType==9))*weight",
"(candType<3&&(MCType==2||MCType==4)||candType>2&&(MCType==8||MCType==10))*weight",
"(!(candType<3&&MCType>0&&MCType<7||candType>2&&MCType>6&&MCType<13))*weight"}};
double legW = 0.4, legH = 0.225;
double legX = 1-style2.PadRightMargin-0.02, legY = 1-style2.PadTopMargin-0.02;
TLegend *leg[2];
leg[0] = new TLegend(legX-legW, legY-legH, legX, legY);
legW = 0.24; legH = 0.285; legX = 0.47;
leg[1] = new TLegend(legX-legW, legY-legH, legX, legY);
TH1F* h[2][4];
for(int pad=0; pad<2; pad++){
leg[pad]->SetTextSize(style2.LabelSize); leg[pad]->SetFillColor(0);
leg[pad]->SetTextFont(style2.nFont); leg[pad]->SetBorderSize(0);
for(int i=0; i<4; i++) {
if(pad==0 && i==3) continue;
TString hname = "h"; hname += pad; hname += i;
h[pad][i] = new TH1F(hname,"",bins[pad],xrange[pad][0],xrange[pad][1]);
h[pad][i]->SetLineWidth(2); h[pad][i]->SetLineColor(colors[pad][i]);
TString vari = Variable[pad]; vari += ">>"; vari += hname;
gen.Draw(vari,cuts[pad][i]);
if(i==3){
hname = "hCont"; hname += pad; hname += i;
TH1F *hCont = new TH1F(hname,"",bins[pad],xrange[pad][0],xrange[pad][1]);
TString vari = Variable[pad]; vari += ">>"; vari += hname;
cont.Draw(vari,cuts[pad][i]);
hCont->Scale(wuds);
h[pad][i]->Add(hCont);
hCont->Delete();
}
yield[pad][i] = h[pad][i]->Integral();
h[pad][i]->Scale(1000/h[pad][i]->Integral());
if(h[pad][i]->GetMaximum()>maxi[pad]) maxi[pad] = h[pad][i]->GetMaximum();
labels[pad][i] += RoundNumber(yield[pad][i]*100,0,nTotal); labels[pad][i] += "%)";
leg[pad]->AddEntry(h[pad][i],labels[pad][i]);
}
h[pad][0]->SetMaximum(maxi[pad]*1.22);
}
h[0][0]->Draw();
style2.fixYAxis(h[0][0],cPad);
style2.setTitles(h[0][0],"|p_{miss}| (GeV)","Entries/(100 MeV)","a)");
h[0][1]->Draw("same");h[0][2]->Draw("same");
leg[0]->Draw();
line.DrawLine(0.2,h[0][0]->GetMinimum(), 0.2,maxi[0]/1.45);
arrow.DrawArrow(0.2,maxi[0]/1.65,0.5,maxi[0]/1.65,0.01,"|>");
cPad = (TPad *)can.cd(2);
h[1][0]->Draw();
style2.fixYAxis(h[1][0],cPad);
style2.setTitles(h[1][0],"q^{2} (GeV^{2})","Entries/(0.4 GeV^{2})","b)");
h[1][1]->Draw("same"); h[1][2]->Draw("same"); h[1][3]->Draw("same");
leg[1]->Draw();
line.DrawLine(4,h[1][0]->GetMinimum(), 4,maxi[1]/1.45);
arrow.DrawArrow(4,maxi[1]/1.65,5.4,maxi[1]/1.65,0.01,"|>");
TString pName = "public_html/EvtSel_Q2Pmiss.eps";
can.SaveAs(pName);
for(int pad=0; pad<2; pad++){
leg[pad]->Delete();
for(int i=0; i<4; i++){
if(pad==0 && i==3) continue;
h[pad][i]->Delete();
}
}
hCount->Delete();
}