本文整理汇总了C++中TText::SetTextAngle方法的典型用法代码示例。如果您正苦于以下问题:C++ TText::SetTextAngle方法的具体用法?C++ TText::SetTextAngle怎么用?C++ TText::SetTextAngle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TText
的用法示例。
在下文中一共展示了TText::SetTextAngle方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PaintOverflow
void PaintOverflow(TH1 *h)
{
// This function paint the histogram h with an extra bin for overflows
char* name = h->GetName();
char* title = h->GetTitle();
Int_t nx = h->GetNbinsX()+1;
Double_t x1 = h->GetBinLowEdge(1);
Double_t bw = h->GetBinWidth(nx);
Double_t x2 = h->GetBinLowEdge(nx)+bw;
// Book a temporary histogram having ab extra bin for overflows
TH1F *htmp = new TH1F(name, title, nx, x1, x2);
// Fill the new hitogram including the extra bin for overflows
for (Int_t i=1; i<=nx; i++) {
htmp->Fill(htmp->GetBinCenter(i), h->GetBinContent(i));
}
// Fill the underflows
htmp->Fill(x1-1, h->GetBinContent(0));
// Restore the number of entries
htmp->SetEntries(h->GetEntries());
// Draw the temporary histogram
htmp->Draw();
TText *t = new TText(x2-bw/2,h->GetBinContent(nx),"Overflow");
t->SetTextAngle(90);
t->SetTextAlign(12);
t->SetTextSize(0.03);;
t->Draw();
}
示例2: mvas
//.........这里部分代码省略.........
legend->AddEntry(bgd,TString("Background") + ((htype == CompareType) ? " (test sample)" : ""), "F");
legend->SetBorderSize(1);
legend->SetMargin( (htype == CompareType ? 0.2 : 0.3) );
legend->Draw("same");
// overlay signal and background histograms
sig->Draw("samehist");
bgd->Draw("samehist");
if (htype == CompareType) {
// if overtraining check, load additional histograms
TH1* sigOv = 0;
TH1* bgdOv = 0;
TString ovname = hname += "_Train";
sigOv = dynamic_cast<TH1*>(titDir->Get( ovname + "_S" ));
bgdOv = dynamic_cast<TH1*>(titDir->Get( ovname + "_B" ));
if (sigOv == 0 || bgdOv == 0) {
cout << "+++ Problem in \"mvas.C\": overtraining check histograms do not exist" << endl;
}
else {
cout << "--- Found comparison histograms for overtraining check" << endl;
TLegend *legend2= new TLegend( 1 - c->GetRightMargin() - 0.42, 1 - c->GetTopMargin() - 0.12,
1 - c->GetRightMargin(), 1 - c->GetTopMargin() );
legend2->SetFillStyle( 1 );
legend2->SetBorderSize(1);
legend2->AddEntry(sigOv,"Signal (training sample)","P");
legend2->AddEntry(bgdOv,"Background (training sample)","P");
legend2->SetMargin( 0.1 );
legend2->Draw("same");
}
Int_t col = sig->GetLineColor();
sigOv->SetMarkerColor( col );
sigOv->SetMarkerSize( 0.7 );
sigOv->SetMarkerStyle( 20 );
sigOv->SetLineWidth( 1 );
sigOv->SetLineColor( col );
sigOv->Draw("e1same");
col = bgd->GetLineColor();
bgdOv->SetMarkerColor( col );
bgdOv->SetMarkerSize( 0.7 );
bgdOv->SetMarkerStyle( 20 );
bgdOv->SetLineWidth( 1 );
bgdOv->SetLineColor( col );
bgdOv->Draw("e1same");
ymax = TMath::Max( ymax, TMath::Max( sigOv->GetMaximum(), bgdOv->GetMaximum() )*maxMult );
frame->GetYaxis()->SetLimits( 0, ymax );
// for better visibility, plot thinner lines
sig->SetLineWidth( 1 );
bgd->SetLineWidth( 1 );
// perform K-S test
cout << "--- Perform Kolmogorov-Smirnov tests" << endl;
Double_t kolS = sig->KolmogorovTest( sigOv );
Double_t kolB = bgd->KolmogorovTest( bgdOv );
cout << "--- Goodness of signal (background) consistency: " << kolS << " (" << kolB << ")" << endl;
TString probatext = Form( "Kolmogorov-Smirnov test: signal (background) probability = %5.3g (%5.3g)", kolS, kolB );
TText* tt = new TText( 0.12, 0.74, probatext );
tt->SetNDC(); tt->SetTextSize( 0.032 ); tt->AppendPad();
}
// redraw axes
frame->Draw("sameaxis");
// text for overflows
Int_t nbin = sig->GetNbinsX();
Double_t dxu = sig->GetBinWidth(0);
Double_t dxo = sig->GetBinWidth(nbin+1);
TString uoflow = Form( "U/O-flow (S,B): (%.1f, %.1f)%% / (%.1f, %.1f)%%",
sig->GetBinContent(0)*dxu*100, bgd->GetBinContent(0)*dxu*100,
sig->GetBinContent(nbin+1)*dxo*100, bgd->GetBinContent(nbin+1)*dxo*100 );
TText* t = new TText( 0.975, 0.115, uoflow );
t->SetNDC();
t->SetTextSize( 0.030 );
t->SetTextAngle( 90 );
t->AppendPad();
// update canvas
c->Update();
// save canvas to file
TMVAGlob::plot_logo(1.058);
if (Save_Images) {
if (htype == MVAType) TMVAGlob::imgconv( c, Form("plots/mva_%s", methodTitle.Data()) );
else if (htype == ProbaType) TMVAGlob::imgconv( c, Form("plots/proba_%s", methodTitle.Data()) );
else if (htype == CompareType) TMVAGlob::imgconv( c, Form("plots/overtrain_%s", methodTitle.Data()) );
else TMVAGlob::imgconv( c, Form("plots/rarity_%s", methodTitle.Data()) );
}
countCanvas++;
}
}
}
}
示例3: visualizationTracker
int visualizationTracker(float minZ, float maxZ, float minX, float maxX, float theta, float phi){
gSystem->Load("libGeom");
//++++++++++++++++++++ Set up stuff ++++++++++++++++++++//
TGeoManager *geom = new TGeoManager("simple1", "Simple geometry");
//--- define some materials and media
TGeoMaterial *matVacuum = new TGeoMaterial("Vacuum", 0,0,0);
TGeoMedium *Vacuum = new TGeoMedium("Vacuum",1, matVacuum);
//--- make the top container volume
TGeoVolume *top = geom->MakeBox("TOP", Vacuum, 500., 500., 500.);
//TGeoVolume *toptop = geom->MakeBox("TOPTOP", Vacuum, 1000., 1000., 500.);
geom->SetTopVolume(top);
int count = 0;
for (int i = 0; i < _nEntries; ++i){
_inTree->GetEntry(i);
if (isRightSubDet()&&(_zVal >= minZ && _zVal < maxZ)&&(_xVal >= minX && _xVal < maxX)/*&&(_rVal <= 12)&&(_rVal >=8)*/){
char modName[192];
sprintf(modName, "testModule%i", i);
TGeoVolume* testMod = geom->MakeBox( modName, Vacuum, 90., 90., 40. );
getModule( geom, top, testMod );
count++;
}
}
if(count == 0) return -1;
getBeamVisuals(geom, top, minZ, maxZ);
//--- close the geometry
geom->CloseGeometry();
// -- draw
geom->SetVisLevel(4);
TCanvas * c = new TCanvas();
c->SetTheta(theta);
c->SetPhi(phi);
top->Draw();
//--- putting words on canvas...
bool with0T = true;
//can play with these numbers
double widthofeach = 0.07;
double textsize = 0.05;
double xmax = 2*widthofeach;
if (with0T) xmax = widthofeach;
TPaveText* pt = new TPaveText(0,0,xmax,1,"brNDC");
pt->SetBorderSize(0);
pt->SetFillStyle(0);
pt->SetTextAlign(22);
pt->SetTextFont(42);
pt->SetTextSize(0.1);
TText *text = pt->AddText(0,0,TString("#font[42]{"+_line1+"}"));
text->SetTextSize(textsize);
text->SetTextAngle(90);
pt->Draw();
TPaveText *pt2 = new TPaveText(widthofeach, 0, 2*widthofeach, 1, "brNDC");
pt2->SetBorderSize(0);
pt2->SetFillStyle(0);
pt2->SetTextAlign(22);
pt2->SetTextFont(42);
pt2->SetTextSize(0.1);
TText *text2 = pt2->AddText(0,0,TString("#font[42]{"+_line2+"}"));
text2->SetTextSize(textsize);
text2->SetTextAngle(90);
pt2->Draw();
TPaveText *pt3 = new TPaveText(2*widthofeach, 0, 3*widthofeach, 1, "brNDC");
pt3->SetBorderSize(0);
pt3->SetFillStyle(0);
pt3->SetTextAlign(22);
pt3->SetTextFont(42);
pt3->SetTextSize(0.1);
TText *text3 = pt3->AddText(0,0,TString("#font[42]{"+_line3+"}"));
text3->SetTextSize(textsize);
text3->SetTextAngle(90);
pt3->Draw();
string str = string("i") + to_string(_i) + string(".gif");
c->SaveAs(TString(str));
gSystem->Exec(TString("mv "+str+" images/"+str));
delete c;
cout << "Created image " << str << endl;
return 0;
}
示例4: massPlot
//.........这里部分代码省略.........
g_tps->SetLineWidth(3);
//g_tps->Draw("l");
g_thStop->SetLineColor(kOrange);
g_thStop->SetLineStyle(1);
g_thStop->SetLineWidth(2);
g_thStop->SetFillStyle(3001);
g_thStop->SetFillColor(kOrange-4);
g_thStop->Draw("l3");
*/
// mchamp curves
// 2 sigma band
g_exp_2sig->SetLineColor(0);
g_exp_2sig->SetLineStyle(0);
g_exp_2sig->SetLineWidth(0);
g_exp_2sig->SetFillColor(kYellow);
g_exp_2sig->SetFillStyle(1001);
g_exp_2sig->Draw("3");
// 1 sigma band
// g_exp_1sig->SetLineColor(8);
g_exp_1sig->SetLineColor(0);
g_exp_1sig->SetLineStyle(0);
g_exp_1sig->SetLineWidth(0);
// g_exp_1sig->SetFillColor(8);
g_exp_1sig->SetFillColor(kGreen);
g_exp_1sig->SetFillStyle(1001);
// g_exp_1sig->SetFillStyle(3005);
g_exp_1sig->Draw("3");
// g_exp_1sig->Draw("lX");
g_obs_mchamp->SetLineStyle(1);
g_obs_mchamp->SetLineWidth(2);
g_obs_mchamp->SetMarkerStyle(20);
g_obs_mchamp->SetMarkerSize(1);
g_obs_mchamp->Draw("pl");
//g_mchamp->SetLineColor(kBlue);
g_mchamp->SetLineStyle(2);
//g_mchamp->SetLineStyle(1);
g_mchamp->SetLineWidth(3);
g_mchamp->SetMarkerStyle(20);
g_mchamp->SetMarkerSize(1);
g_mchamp->Draw("l");
// theory line
g_thMchamp->SetLineColor(kRed);
g_thMchamp->SetLineStyle(1);
g_thMchamp->SetLineWidth(2);
g_thMchamp->SetFillStyle(3001);
g_thMchamp->SetFillColor(kRed-4);
g_thMchamp->Draw("l3");
// theory line label
TLatex* th = new TLatex(480., 4., "NLO+NLL #tilde{g}");
th->SetTextColor(kBlue);
th->SetTextFont(42);
th->SetTextSize(0.035);
//th->Draw();
TLatex* ths = new TLatex(330., 2., "NLO+NLL #tilde{t}");
ths->SetTextColor(kRed);
ths->SetTextFont(42);
ths->SetTextSize(0.035);
//ths->Draw();
TLatex* thm = new TLatex(480., 4., "NLO+NLL mchamp");
//thm->SetTextColor(kBlue);
thm->SetTextFont(42);
thm->SetTextSize(0.035);
//thm->Draw();
// not explored label
TText* ne = new TText(125., .2, "Not Sensitive");
ne->SetTextColor(kRed+1);
ne->SetTextFont(42);
ne->SetTextAngle(90);
ne->SetTextSize(0.035);
//ne->Draw();
//blurb->Draw();
canvas->RedrawAxis();
CMS_lumi(canvas, iPeriod, iPos);
canvas->Print("massLimit.pdf");
canvas->Print("massLimit.png");
canvas->Print("massLimit.C");
plots.calculateIntercepts();
TFile* fnew = new TFile("histos.root", "recreate");
fnew->cd();
g_obs_mchamp->Write();
g_mchamp->Write();
g_thMchamp->Write();
}
示例5: gluinoMass
//.........这里部分代码省略.........
leg->AddEntry(g_exp1, "Expected #pm1#sigma: 10 #mus - 1000 s Counting Exp. ", "f");
leg->AddEntry(g_exp2, "Expected #pm2#sigma: 10 #mus - 1000 s Counting Exp. ", "f");
// leg->AddEntry(graph3, "Obs.: 10^{6} s Counting Exp.", "l");
leg->AddEntry(g_gluino, "Obs.: 10 #mus - 1000 s Counting Exp. ", "l");
leg->AddEntry(g_tp, "Obs.: 10 #mus Timing Profile ", "l");
//leg->AddEntry(g_stop, "Obs.: 10 #mus - 1000 s Counting Exp. (#tilde{t})", "l");
//leg->AddEntry(graph_em, "Obs.: 10 #mus - 1000 s Counting Exp. (EM only)", "l");
// leg->AddEntry(graph1, "Obs.: 570 ns Counting Exp.", "l");
leg->Draw();
// 2 sigma expected band
g_exp2->SetLineColor(0);
g_exp2->SetLineStyle(0);
g_exp2->SetLineWidth(0);
g_exp2->SetFillColor(5);
g_exp2->SetFillStyle(1001);
g_exp2->Draw("3");
// 1 sigma expected band
g_exp1->SetLineColor(0);
g_exp1->SetLineStyle(0);
g_exp1->SetLineWidth(0);
g_exp1->SetFillColor(3);
g_exp1->SetFillStyle(1001);
g_exp1->Draw("3");
// expected line
g_exp->SetLineStyle(2);
g_exp->SetLineWidth(1);
g_exp->Draw("l");
// plateau limit - 1 ms
g_gluino->SetLineColor(1);
g_gluino->SetLineStyle(1);
g_gluino->SetLineWidth(2);
g_gluino->Draw("l");
// stop curve
g_stop->SetLineColor(1);
g_stop->SetLineStyle(5);
g_stop->SetLineWidth(2);
//g_stop->Draw("l");
// 1 mus lifetime fit limit
g_tp->SetLineColor(kRed);
g_tp->SetLineStyle(1);
g_tp->SetLineWidth(2);
g_tp->Draw("l");
// theory line
g_thGluino->SetLineColor(kBlue);
g_thGluino->SetLineStyle(1);
g_thGluino->SetLineWidth(2);
g_thGluino->SetFillStyle(3001);
g_thGluino->SetFillColor(kBlue-4);
g_thGluino->Draw("l3");
g_thStop->SetLineColor(kRed);
g_thStop->SetLineStyle(1);
g_thStop->SetLineWidth(2);
g_thStop->SetFillStyle(3001);
g_thStop->SetFillColor(kRed-4);
//g_thStop->Draw("l3");
// theory line label
TLatex* th = new TLatex(600., .3, "NLO+NLL #tilde{g}");
th->SetTextColor(kBlue);
th->SetTextFont(42);
th->SetTextSize(0.035);
th->Draw();
TLatex* ths = new TLatex(330., 2., "NLO+NLL #tilde{t}");
ths->SetTextColor(kRed);
ths->SetTextFont(42);
ths->SetTextSize(0.035);
//ths->Draw();
// not explored label
TText* ne = new TText(125., .2, "Not Sensitive");
ne->SetTextColor(kRed+1);
ne->SetTextFont(42);
ne->SetTextAngle(90);
ne->SetTextSize(0.035);
//ne->Draw();
blurb->Draw();
canvas->RedrawAxis();
canvas->Print("gluinoMassLimit.pdf");
canvas->Print("gluinoMassLimit.C");
plots.calculateIntercepts();
}
示例6: crossfeeds_nondiag
void crossfeeds_nondiag(TString title,
TString bkgfile,
TString epsfile,
TString txtfile,
Double_t alpha_,
Double_t mass_,
Double_t n_,
Double_t sigma_
)
{
RooRealVar mbc("mbc", "m_{BC}", 1.83, 1.89, "GeV");
RooRealVar ebeam("ebeam", "Ebeam", 0., 100., "GeV");
RooRealVar chg("chg", "Charge", -2, 2);
RooCategory passed("passed", "Event should be used for plot");
passed.defineType("yes", 1);
passed.defineType("no", 0);
RooRealVar arg_cutoff ("arg_cutoff", "Argus cutoff", 1.8865, 1.885, 1.8875,"GeV");
RooRealVar arg_slope ("arg_slope", "Argus slope", -13, -100, 40);
RooRealVar mbc_float ("mbc_float", "Floating D mass", mass_, "GeV");
RooRealVar sigma ("sigma", "CB width", sigma_, "GeV");
RooRealVar alpha("alpha", "CB shape cutoff", alpha_);
RooRealVar n("n", "CB tail parameter", n_);
RooCBShape cb_float ("cb_float", "Floating Crystal Barrel", mbc, mbc_float, sigma, alpha, n);
RooArgusBG argus("argus", "Argus BG", mbc, arg_cutoff, arg_slope);
RooRealVar yld("yield", "D yield", 0, -30, 100000);
RooRealVar bkg("bkg", "Background", 20, 0, 40000);
// Build pdf
RooAddPdf sumpdf_float("sumpdf_float", "Generic D sum pdf", RooArgList(cb_float, argus),
RooArgList(yld, bkg));
RooDataSet* dset = RooDataSet::read(bkgfile, RooArgList(mbc, ebeam, passed), "", "");
RooPlot* xframe = mbc.frame();
RooDataSet* dset2 = dset->reduce("passed==1");
dset2->plotOn(xframe);
// RooFitResult* rv = sumpdf_float.fitTo(*dset2, Extended(kTRUE), Save(kTRUE),
// Hesse(kTRUE), Verbose(kTRUE));
RooFitResult* rv = sumpdf_float.fitTo(*dset2, "ermh");
sumpdf_float.paramOn(xframe, dset2);
if ((yld.getVal() < 0) && (-yld.getVal()/bkg.getVal() > 0.5)){
yld.setVal(0);
bkg.setVal(1);
}
sumpdf_float.plotOn(xframe);
sumpdf_float.plotOn(xframe, Components(RooArgSet(argus)),
LineColor(kRed), LineStyle(kDashed));
TCanvas* c1 = new TCanvas("c1","Canvas", 2);
xframe->SetTitleOffset(2.2, "Y");
xframe->SetTitleOffset(1.1, "X");
xframe->SetTitle(title);
c1->SetLeftMargin(0.17);
xframe->Draw();
if ( rv && rv->covQual() != 3){
// fit has failed
TText *txt = new TText();
txt->SetTextSize(.08);
txt->SetTextAlign(22);
txt->SetTextAngle(30);
txt->DrawTextNDC(0.5, 0.5, "FAILED");
}
c1->Update();
c1->Print(epsfile);
c1->Clear();
FILE* table = fopen(txtfile.Data(), "w+");
fprintf(table, "Name\t|| Value\t|| Error\n");
// fprintf(table, "yldsigma\t| %.10f\t| \n", yld.getVal()/yld.getError());
fprintf(table, "entries\t| %.10f\t| \n", dset->numEntries());
fprintf(table, "yld\t| %.10f\t| %.10f\n", yld.getVal(), yld.getError());
// fprintf(table, "ratio\t| %.10f\t| \n", yld.getVal()/dset->numEntries());
// fprintf(table, "ratioerr\t| %.10f\t| \n", yld.getError()/dset->numEntries());
fclose(table);
cout << "Saved output as: " << txtfile << endl;
rv->Delete();
}
示例7: plot3
//.........这里部分代码省略.........
Float_t phixmin0[iSteps], phixmax0[iSteps], phixmin1[iSteps], phixmax1[iSteps];
Float_t phiymin0[iSteps], phiymax0[iSteps], phiymin1[iSteps], phiymax1[iSteps];
if ( (strpltmd.compare("tan") == 0) ||
(strpltmd.compare("cos") == 0) ||
(strpltmd.compare("sin") == 0) ) {
for(i=0; i<100; i++) {
fitx = fitxmin + i*deltax;
phixmin0[i] = fitx;
if (strpltmd.compare("tan") == 0) { phiymin0[i] = sphmin / cphmin; phiymax0[i] = sphmax / cphmax; }
if (strpltmd.compare("cos") == 0) { phiymin0[i] = sqrt(cphmin); phiymax0[i] = sqrt(cphmax); }
if (strpltmd.compare("sin") == 0) { phiymin0[i] = sqrt(sphmin); phiymax0[i] = sqrt(sphmax); }
}
TGraph *phiMin0 = new TGraph(iSteps,phixmin0,phiymin0);
TGraph *phiMax0 = new TGraph(iSteps,phixmin0,phiymax0);
} else if (strpltmd.compare("mmp") == 0) {
if ( (mdl.compare("lr") == 0) ||
(mdl.compare("lp") == 0) ||
(mdl.compare("hp") == 0) ||
(mdl.compare("fp") == 0) ) {
for(i=0; i<100; i++) {
fitx = fitxmin + i*deltax;
MMI(Cz1,Cz2,Cz3,Cw1,Cw2,Cw3,Cw4,fitx,sphmin,cphmin,0.0,phixmin0[i],phiymin0[i]);
MMI(Cz1,Cz2,Cz3,Cw1,Cw2,Cw3,Cw4,fitx,sphmin,cphmin,1.0,phixmin1[i],phiymin1[i]);
MMI(Cz1,Cz2,Cz3,Cw1,Cw2,Cw3,Cw4,fitx,sphmax,cphmax,0.0,phixmax0[i],phiymax0[i]);
MMI(Cz1,Cz2,Cz3,Cw1,Cw2,Cw3,Cw4,fitx,sphmax,cphmax,1.0,phixmax1[i],phiymax1[i]);
}
TGraph *phiMin0 = new TGraph(iSteps,phixmin0,phiymin0);
TGraph *phiMin1 = new TGraph(iSteps,phixmin1,phiymin1);
TGraph *phiMax0 = new TGraph(iSteps,phixmax0,phiymax0);
TGraph *phiMax1 = new TGraph(iSteps,phixmax1,phiymax1);
phiMin1->SetLineStyle(7);
phiMin1->SetMarkerStyle(22);
phiMin1->SetMarkerSize(1.0);
phiMax1->SetLineStyle(7);
phiMax1->SetMarkerStyle(22);
phiMax1->SetMarkerSize(1.0);
phiMin1->Draw("C");
phiMax1->Draw("C");
} else if ( (mdl.compare("uu") == 0) ||
(mdl.compare("nu") == 0) ) {
for(i=0; i<100; i++) {
fitx = fitxmin + i*deltax;
MMII(C1,C2,fitx,sphmin,cphmin,phixmin0[i],phiymin0[i]);
MMII(C1,C2,fitx,sphmax,cphmax,phixmax0[i],phiymax0[i]);
}
TGraph *phiMin0 = new TGraph(iSteps,phixmin0,phiymin0);
TGraph *phiMax0 = new TGraph(iSteps,phixmax0,phiymax0);
}
}
phiMin0->SetLineStyle(3);
phiMin0->SetMarkerStyle(20);
phiMin0->SetMarkerSize(0.4);
phiMax0->SetLineStyle(3);
phiMax0->SetMarkerStyle(20);
phiMax0->SetMarkerSize(0.4);
phiMin0->Draw("C");
phiMax0->Draw("C");
// LABEL ALLOWED REGION ///////////////////////////////////////////////
TPaveText *allowed = new TPaveText(lblxmin,lblymin,lblxmax,lblymax,"NDC");
TText *text = allowed->AddText("#font[42]{allowed (95% CL)}");
allowed->SetTextSize(0.04);
if (strpltmd.compare("tan") == 0) text->SetTextAngle(270);
allowed->SetFillStyle(0);
allowed->SetLineColor(0);
allowed->SetBorderSize(1);
allowed->Draw();
// SAVE GRAPHIC ///////////////////////////////////////////////////////
MyC->Print(epsfile.c_str());
}
示例8: paxis
void t1bbbb_pl_plots() {
gStyle->SetPadGridX(1) ;
gStyle->SetPadGridY(1) ;
gStyle->SetOptStat(0.) ;
gStyle->SetOptTitle(0) ;
gStyle->SetPadRightMargin(0.20) ;
gStyle->SetPadLeftMargin(0.15) ;
gStyle->SetPadBottomMargin(0.15) ;
gStyle->SetTitleOffset(1.4,"x") ;
gStyle->SetTitleOffset(1.4,"y") ;
gStyle->SetBarOffset(0.1) ;
TText* text = new TText() ;
TCanvas* cxsec = new TCanvas("cxsec","cxsec") ;
gPad->SetLogz(1) ;
TPaletteAxis* paxis(0x0) ;
loadHist("an-11-257-v3-files/output-files/an-scanplot-unblind-t1bbbb-withcontam-ge1b-loose.root","ge1bloose" ) ;
loadHist("an-11-257-v3-files/output-files/an-scanplot-unblind-t1bbbb-withcontam-ge1b-tight.root","ge1btight" ) ;
loadHist("an-11-257-v3-files/output-files/an-scanplot-unblind-t1bbbb-withcontam-ge2b-loose.root","ge2bloose" ) ;
loadHist("an-11-257-v3-files/output-files/an-scanplot-unblind-t1bbbb-withcontam-ge2b-tight.root","ge2btight" ) ;
//--------
TH2F* hxsecul_ge1bloose = (TH2F*) gDirectory->FindObject("ge1bloose_hsusyscanXsecul") ;
hxsecul_ge1bloose->SetXTitle("Gluino mass (GeV)") ;
hxsecul_ge1bloose->SetYTitle("LSP mass (GeV)") ;
hxsecul_ge1bloose->UseCurrentStyle() ;
hxsecul_ge1bloose->SetMinimum(0.010) ;
hxsecul_ge1bloose->SetMaximum(150) ;
paxis = (TPaletteAxis*)hxsecul_ge1bloose->GetListOfFunctions()->FindObject("palette");
paxis->SetX1NDC(0.82) ;
paxis->SetX2NDC(0.86) ;
paxis->SetY1NDC(0.15) ;
paxis->SetY2NDC(0.90) ;
hxsecul_ge1bloose->DrawCopy("colz") ;
text->SetTextAngle(90.) ;
text->SetTextSize(0.04) ;
text->DrawTextNDC( 0.95, 0.15, "Maximum cross section [pb](PL 95% UL)" ) ;
text->SetTextAngle(0.) ;
text->SetTextSize(0.045) ;
text->DrawTextNDC( 0.15, 0.92, "T1bbbb: ge1bloose, PL cross section upper limit") ;
cxsec->SaveAs("an-11-257-v3-files/output-files/an-t1bbbb-pl-xsecul-ge1bloose.png") ;
//--------
TH2F* hxsecul_ge1btight = (TH2F*) gDirectory->FindObject("ge1btight_hsusyscanXsecul") ;
hxsecul_ge1btight->SetXTitle("Gluino mass (GeV)") ;
hxsecul_ge1btight->SetYTitle("LSP mass (GeV)") ;
hxsecul_ge1btight->UseCurrentStyle() ;
hxsecul_ge1btight->SetMinimum(0.010) ;
hxsecul_ge1btight->SetMaximum(150) ;
paxis = (TPaletteAxis*)hxsecul_ge1btight->GetListOfFunctions()->FindObject("palette");
paxis->SetX1NDC(0.82) ;
paxis->SetX2NDC(0.86) ;
paxis->SetY1NDC(0.15) ;
paxis->SetY2NDC(0.90) ;
hxsecul_ge1btight->DrawCopy("colz") ;
text->SetTextAngle(90.) ;
text->SetTextSize(0.04) ;
text->DrawTextNDC( 0.95, 0.15, "Maximum cross section [pb](PL 95% UL)" ) ;
text->SetTextAngle(0.) ;
text->SetTextSize(0.045) ;
text->DrawTextNDC( 0.15, 0.92, "T1bbbb: ge1btight, PL cross section upper limit") ;
cxsec->SaveAs("an-11-257-v3-files/output-files/an-t1bbbb-pl-xsecul-ge1btight.png") ;
//--------
TH2F* hxsecul_ge2bloose = (TH2F*) gDirectory->FindObject("ge2bloose_hsusyscanXsecul") ;
hxsecul_ge2bloose->SetXTitle("Gluino mass (GeV)") ;
hxsecul_ge2bloose->SetYTitle("LSP mass (GeV)") ;
hxsecul_ge2bloose->UseCurrentStyle() ;
hxsecul_ge2bloose->SetMinimum(0.010) ;
hxsecul_ge2bloose->SetMaximum(150) ;
paxis = (TPaletteAxis*)hxsecul_ge2bloose->GetListOfFunctions()->FindObject("palette");
paxis->SetX1NDC(0.82) ;
paxis->SetX2NDC(0.86) ;
paxis->SetY1NDC(0.15) ;
//.........这里部分代码省略.........
示例9: variables
//.........这里部分代码省略.........
// sig->SetTitle( tit.ReplaceAll("Input variable", "Regression target" ) );
// }
// }
sig->SetTitle( "" );
// finally plot and overlay
Float_t sc = 1.1;
if (countPad == 1) sc = 1.3;
sig->SetMaximum( TMath::Max( sig->GetMaximum(), bgd->GetMaximum() )*sc );
sig->Draw( "hist" );
cPad->SetLeftMargin( 0.17 );
sig->GetYaxis()->SetTitleOffset( 1.50 );
if (!isRegression) {
bgd->Draw("histsame");
TString ytit = TString("(1/N) ") + sig->GetYaxis()->GetTitle();
ytit = TString("Fraction of Events");
sig->GetYaxis()->SetTitle( ytit ); // histograms are normalised
}
if (countPad == 1) sig->GetXaxis()->SetTitle("Leading Lepton p_{T} [GeV/c]");
if (countPad == 2) sig->GetXaxis()->SetTitle("Trailing Lepton p_{T} [GeV/c]");
if (countPad == 3) sig->GetXaxis()->SetTitle("#Delta#phi(l,l)");
if (countPad == 4) sig->GetXaxis()->SetTitle("#Delta R(l,l)");
if (countPad == 5) sig->GetXaxis()->SetTitle("Dilepton Mass [GeV/c^{2}]");
if (countPad == 6) sig->GetXaxis()->SetTitle("Dilepton Flavor Final State");
if (countPad == 7) sig->GetXaxis()->SetTitle("M_{T} (Higgs) [GeV/c^{2}]");
if (countPad == 8) sig->GetXaxis()->SetTitle("#Delta#phi(Dilepton System, MET)");
if (countPad == 9) sig->GetXaxis()->SetTitle("#Delta#phi(Dilepton System, Jet)");
// Draw legend
// if (countPad == 1 && !isRegression) {
TLegend *legend= new TLegend( cPad->GetLeftMargin(),
1-cPad->GetTopMargin()-.15,
cPad->GetLeftMargin()+.4,
1-cPad->GetTopMargin() );
if(countPad == 1 || countPad == 2 ||countPad == 3 ||countPad == 4 ||countPad == 5 ||countPad == 7 ) {
legend= new TLegend( 0.50,
1-cPad->GetTopMargin()-.15,
0.90,
1-cPad->GetTopMargin() );
}
legend->SetFillStyle(0);
legend->AddEntry(sig,"Signal","F");
legend->AddEntry(bgd,"Background","F");
legend->SetBorderSize(0);
legend->SetMargin( 0.3 );
legend->SetTextSize( 0.03 );
legend->Draw("same");
// }
// redraw axes
sig->Draw("sameaxis");
// text for overflows
Int_t nbin = sig->GetNbinsX();
Double_t dxu = sig->GetBinWidth(0);
Double_t dxo = sig->GetBinWidth(nbin+1);
TString uoflow = "";
if (isRegression) {
uoflow = Form( "U/O-flow: %.1f%% / %.1f%%",
sig->GetBinContent(0)*dxu*100, sig->GetBinContent(nbin+1)*dxo*100 );
}
else {
uoflow = Form( "U/O-flow (S,B): (%.1f, %.1f)%% / (%.1f, %.1f)%%",
sig->GetBinContent(0)*dxu*100, bgd->GetBinContent(0)*dxu*100,
sig->GetBinContent(nbin+1)*dxo*100, bgd->GetBinContent(nbin+1)*dxo*100 );
}
TText* t = new TText( 0.98, 0.14, uoflow );
t->SetNDC();
t->SetTextSize( 0.040 );
t->SetTextAngle( 90 );
// t->AppendPad();
// save canvas to file
if (countPad%noPadPerCanv==0) {
TString fname = Form( "plots/%s_c%i", outfname.Data(), countCanvas );
TMVAGlob::plot_logo();
TMVAGlob::imgconv( canv, fname );
createNewFig = kFALSE;
}
else {
createNewFig = kTRUE;
}
}
if (createNewFig) {
TString fname = Form( "plots/%s_c%i", outfname.Data(), countCanvas );
TMVAGlob::plot_logo();
TMVAGlob::imgconv( canv, fname );
createNewFig = kFALSE;
}
return;
}
示例10: Drawmethodcomp
//.........这里部分代码省略.........
Gri101_graph->SetMarkerColor(4);
Gri101_graph->SetLineColor(4);
Gri101_graph->SetLineWidth(2);
Gri101_graph->SetMarkerSize(1.2);
Gri101_graph->Draw("Psameez");
*/
graphNpartDil->SetMarkerSize(1.2);
graphNpartDil->SetLineColor(2);
graphNpartDil->SetLineWidth(2);
graphNpartDil->SetMarkerStyle(33);
graphNpartDil->SetMarkerColor(2);
graphNcollDil->SetMarkerSize(1.2);
graphNcollDil->SetLineColor(2);
graphNcollDil->SetLineWidth(2);
graphNcollDil->SetMarkerStyle(33);
graphNcollDil->SetMarkerColor(2);
if(str=="Npart") graphNpartDil->Draw("Psame");
if(str=="Ncoll") graphNcollDil->Draw("Psame");
std::vector<TString> label(N);
for(int i=0;i<N;i++)
if(method==0)label[i] = Form("%.2f-%.2f%%",(*centbin)[i]*100,(*centbin)[i+1]*100);
else label[i] = Form("%.2f-%.2f",(*kpoint)[i],(*kpoint)[i+1]);
TLatex *tex1= new TLatex(0.2,0.9,"CMS Preliminary PbPb #sqrt{s_{NN}} = 2.76 TeV");
tex1->SetNDC();
tex1->SetTextColor(1);
tex1->SetTextFont(42);
tex1->SetTextSize(0.05);
tex1->Draw();
double y = gPad->GetUymin();
// - 0.2*h->GetYaxis()->GetBinWidth(1);
TText t;
t.SetTextAngle(45);
t.SetTextSize(0.03);
t.SetTextAlign(33);
for (int i=0;i<N;i++) {
double x = hist->GetXaxis()->GetBinCenter(i+1);
t.DrawText(x,y,label[i]);
}
TLegend *leg0 = new TLegend(0.18,0.70,0.50,0.85);
leg0->SetFillColor(10);
leg0->SetBorderSize(0);
leg0->SetTextFont(42);
leg0->SetTextSize(0.047);
leg0->AddEntry(graph,"From Ancestor fitting","p");
leg0->AddEntry(graph1,"From One Comp fitting","p");
// leg0->AddEntry(Gri055_graph,"Gribov #Omega=0.55","p");
// leg0->AddEntry(Gri101_graph,"Gribov #Omega=1.01","p");
if(str=="Npart") leg0->AddEntry(graphNpartDil,"Npart from run I","p");
if(str=="Ncoll") leg0->AddEntry(graphNcollDil,"Ncoll from run I","p");
leg0->Draw();
c1->SaveAs(Form("%sGri.png",str.Data()));
c1->SaveAs(Form("%sGri.pdf",str.Data()));
TCanvas *c2 = new TCanvas("c2","c2",1,1,550,460);
c2->SetFillColor(10);
c2->SetFrameFillColor(0);
c2->SetFrameBorderSize(0);
c2->SetFrameBorderMode(0);
c2->SetLeftMargin(0.15);
c2->SetBottomMargin(0.15);
c2->SetTopMargin(0.02);
c2->SetRightMargin(0.02);
c2->SetTicks(-1);
示例11: 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);
//.........这里部分代码省略.........
示例12: TLine
TH1F *draw_detector(string &name,map<string,void*> &card_channel)
{
TH1F *h=new TH1F(name.c_str(),name.c_str(),13*64,0,13*64);
h->SetMinimum(-2000);
h->SetMaximum(-300);
h->Draw();
gPad->Update();
if(1)
{
// Draw line between cards
TLine *l = new TLine(h->GetXaxis()->GetXmin(),-800,h->GetXaxis()->GetXmax(),-800);
//printf("(new TLine(%d,%d,%d,%d))->Draw();\n",i*64,h->GetMinimum(),i*64,h->GetMaximum());
l->SetLineStyle(1);
l->SetLineWidth(3);
l->SetLineColor(kRed);
l->Draw();
}
char
*cards_x[]={"-10-S1","-10-S2","-10-S3",
"- 6-S1","- 6-S2","- 6-S3","- 6-S4","- 6-S5","- 6-S6",
"-10-J3","-10-J2","-10-J1",
"- 6-ph"},
*cards_y[]={"-10-B1","-10-B2",
"- 6-B1","- 6-B2","- 6-B3","- 6-B4","- 6-B5","- 6-B6",
"-10-T2","-10-T1"};
char **cards = name[1]=='Y' ? cards_y : cards_x;
int cards_amount = name[1]=='Y' ? sizeof(cards_y)/sizeof(*cards_y) : sizeof(cards_x)/sizeof(*cards_x);
for( int i=0; i<cards_amount; i++ )
{
string s = name+string(cards[i]);
if(1)
{
// Draw line between cards
TLine *l = new TLine(i*64,h->GetMinimum(),i*64,h->GetMaximum());
//printf("(new TLine(%d,%d,%d,%d))->Draw();\n",i*64,h->GetMinimum(),i*64,h->GetMaximum());
l->SetLineStyle(2);
l->Draw();
}
if(1)
{
// Put the card name
TText *m = new TText(i*64+40,h->GetMinimum()+5,s.c_str());
m->SetTextAngle(90);
m->Draw();
}
vector<int> *v = card_channel[s];
if( v==NULL )
{
printf("Card not found: %s\n",s.c_str());
continue;
}
if( v->size()!=64 )
printf("Bad number of channels! %d\n",v->size());
for( int b=0; b<v->size(); b++ )
h->SetBinContent(i*64+b+1,(*v)[b]);
}
return h;
}
示例13: draw_mapping
//.........这里部分代码省略.........
cards.push_back("4U- 6-S6"); // 1
cards.push_back("4U- 6-S7"); // 2
cards.push_back("4U-10-J3"); // 3
cards.push_back("4U-10-J2"); // 4
cards.push_back("4U-10-J1"); // 5
cards.push_back("4U- 6-ph"); // 6
cards.push_back(" "); // 7
cards.push_back("6V-10-J1"); // 8
cards.push_back("6V-10-J2"); // 9
cards.push_back("6V-10-J3"); // 10
cards.push_back("6V- 6-S7"); // 11
cards.push_back("6V- 6-S6"); // 12
cards.push_back("6V- 6-S5"); // 13
cards.push_back("6V- 6-S4"); // 14
cards.push_back("6V- 6-S3"); // 15
break;
case 331:
cards.push_back("6V- 6-S2"); // 0
cards.push_back("6V- 6-S1"); // 1
cards.push_back("6V-10-S3"); // 2
cards.push_back("6V-10-S2"); // 3
cards.push_back("6V-10-S1"); // 4
cards.push_back("6V- 6-ph"); // 5
cards.push_back("6Y-10-T1"); // 6
cards.push_back("6Y-10-T2"); // 7
cards.push_back("6Y- 6-B6"); // 8
cards.push_back("6Y- 6-B5"); // 9
cards.push_back("6Y- 6-B4"); // 10
cards.push_back("6Y- 6-B3"); // 11
cards.push_back("6Y- 6-B2"); // 12
cards.push_back("6Y- 6-B1"); // 13
cards.push_back("6Y-10-B2"); // 14
cards.push_back("6Y-10-B1"); // 15
break;
case 332:
cards.push_back("6Y- 6-ph"); // 0
cards.push_back("6X-10-S1"); // 1
cards.push_back("6X-10-S2"); // 2
cards.push_back("6X-10-S3"); // 3
cards.push_back("6X- 6-S1"); // 4
cards.push_back("6X- 6-S2"); // 5
cards.push_back("6X- 6-S3"); // 6
cards.push_back("6X- 6-S4"); // 7
cards.push_back("6X- 6-S5"); // 8
cards.push_back("6X- 6-S6"); // 9
cards.push_back("6X- 6-S7"); // 10
cards.push_back("6X-10-J3"); // 11
cards.push_back("6X-10-J2"); // 12
cards.push_back("6X-10-J1"); // 13
cards.push_back("6X- 6-ph"); // 14
cards.push_back(" "); // 15
break;
default:
printf("No mapping found for catch %d!\n",ctch);
}
for( int port=0; port<16; port++ )
{
int pos_port=0, pos_det=0;
if( where==0 )
{
// histogram bottom
pos_port = h->GetMinimum();
pos_det = h->GetMinimum()+170;
}
else
{
// histogram top
pos_port = h->GetMaximum()-2;
pos_det = h->GetMaximum()-11;
}
TLine *l = new TLine(port*64,h->GetMinimum(),port*64,h->GetMaximum());
l->SetLineStyle(2);
l->Draw();
char buf[99];
sprintf(buf,"%d",port);
(new TText(10+port*64,pos_port,buf))->Draw();
if( cards.size()>=port+1 )
{
if( 1 )
{
vector<int> *v = new vector<int>;
card_channel[cards[port]] = v;
for( int echan=0; echan<64; echan++ )
v->push_back(h->GetBinContent(port*64+echan+1));
}
sprintf(buf,cards[port].c_str());
int offset=40;
TText *m = new TText(offset+port*64,pos_det,buf);
m->SetTextAngle(90);
m->Draw();
}
}
}