本文整理汇总了C++中TPad::SetLeftMargin方法的典型用法代码示例。如果您正苦于以下问题:C++ TPad::SetLeftMargin方法的具体用法?C++ TPad::SetLeftMargin怎么用?C++ TPad::SetLeftMargin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPad
的用法示例。
在下文中一共展示了TPad::SetLeftMargin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitSubPad
void InitSubPad(TPad* pad, int i)
{
//printf("Pad: %p, index: %d\n",pad,i);
pad->cd(i);
TPad *tmpPad = (TPad*) pad->GetPad(i);
tmpPad->SetLeftMargin (0.20);
tmpPad->SetTopMargin (0.05);
tmpPad->SetRightMargin (0.07);
tmpPad->SetBottomMargin(0.15);
return;
}
示例2: ALICEWorkInProgress
void ALICEWorkInProgress(TCanvas *c,TString today){
//date must be in the form: 04/05/2010
if(today=="today"){
TDatime startt;
int date=startt.GetDate();
int y=date/10000;
int m=(date%10000)/100;
int d=date%100;
today="";
today+=d;
if(m<10)
today.Append("/0");
else today.Append("/");
today+=m;
today.Append("/");
today+=y;
}
TPad *myPadLogo = new TPad("myPadLogo", "Pad for ALICE Logo",0.67,0.65,0.82,0.89);
// myPadLogo->SetFillColor(2);
myPadLogo->SetBorderMode(0);
myPadLogo->SetBorderSize(2);
myPadLogo->SetFrameBorderMode(0);
myPadLogo->SetLeftMargin(0.0);
myPadLogo->SetTopMargin(0.0);
myPadLogo->SetBottomMargin(0.0);
myPadLogo->SetRightMargin(0.0);
myPadLogo->Draw();
myPadLogo->cd();
TASImage *myAliceLogo = new TASImage("/u/mfasel/work/electron/Spectrum/alice_logo.png");
myAliceLogo->Draw();
c->cd();
TPaveText* t1=new TPaveText(0.59,0.59,0.89,0.66,"NDC");
t1->SetFillStyle(0);
t1->SetBorderSize(0);
t1->AddText(0.,0.,"ALICE Performance");
t1->SetTextColor(kRed);
t1->SetTextFont(42);
t1->Draw();
TPaveText* t2=new TPaveText(0.59,0.54,0.89,0.60,"NDC");
t2->SetFillStyle(0);
t2->SetBorderSize(0);
t2->SetTextColor(kRed);
t2->SetTextFont(52);
t2->AddText(0.,0.,today.Data());
t2->Draw();
}
示例3: DrawALICELogo
void DrawALICELogo(Bool_t prel, Float_t x1, Float_t y1, Float_t x2, Float_t y2)
{
// correct for aspect ratio of figure plus aspect ratio of pad (coordinates are NDC!)
x2 = x1 + (y2 - y1) * (466. / 523) * gPad->GetWh() * gPad->GetHNDC() / (gPad->GetWNDC() * gPad->GetWw());
// Printf("%f %f %f %f", x1, x2, y1, y2);
TPad *myPadLogo = new TPad("myPadLogo", "Pad for ALICE Logo", x1, y1, x2, y2);
myPadLogo->SetLeftMargin(0);
myPadLogo->SetTopMargin(0);
myPadLogo->SetRightMargin(0);
myPadLogo->SetBottomMargin(0);
myPadLogo->Draw();
myPadLogo->cd();
TASImage *myAliceLogo = new TASImage((prel) ? "~/alice_logo_preliminary.eps" : "~/alice_logo_performance.eps");
myAliceLogo->Draw();
}
示例4: DrawALICELogo
void DrawALICELogo(Float_t x1, Float_t y1, Float_t x2, Float_t y2)
{
// Correct for aspect ratio of figure plus aspect ratio of pad.
// Coordinates are NDC!
x2 = x1 + (y2 - y1)*0.891*gPad->GetCanvas()->GetWindowHeight()*gPad->GetHNDC() / (gPad->GetWNDC() * gPad->GetCanvas()->GetWindowWidth());
TPad *myPadLogo = new TPad("myPadLogo","Pad for ALICE Logo", x1, y1, x2, y2);
myPadLogo->SetLeftMargin(0);
myPadLogo->SetTopMargin(0);
myPadLogo->SetRightMargin(0);
myPadLogo->SetBottomMargin(0);
myPadLogo->Draw();
myPadLogo->cd();
TASImage *myAliceLogo =
new TASImage("alice_logo_preliminary.eps");
myAliceLogo->Draw("same");
}
示例5: variables
//.........这里部分代码省略.........
TH1 *bgd = (TH1*)dir->Get(bgname);
if (bgd == NULL) {
cout << "ERROR!!! couldn't find background histo for" << hname << endl;
exit;
}
//normalize to 1
NormalizeHist(bgd);
// this is set but not stored during plot creation in MVA_Factory
TMVAGlob::SetSignalAndBackgroundStyle( sig, (isRegression ? 0 : bgd) );
sig->SetTitle( TString( htitle ) + ": " + sig->GetTitle() );
TMVAGlob::SetFrameStyle( sig, 1.2 );
// normalise both signal and background
// if (!isRegression) TMVAGlob::NormalizeHists( sig, bgd );
// else {
// // change histogram title for target
// TString nme = sig->GetName();
// if (nme.Contains( "_target" )) {
// TString tit = sig->GetTitle();
// 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() );
示例6: zj_ptj_8TeV
void zj_ptj_8TeV()
{
//=========Macro generated from canvas: default_Canvas/defaultCanvas
//========= (Thu Apr 28 10:19:34 2016) by ROOT version6.04/10
TCanvas *default_Canvas = new TCanvas("default_Canvas", "defaultCanvas",0,0,800,800);
gStyle->SetOptStat(0);
gStyle->SetOptTitle(0);
default_Canvas->SetHighLightColor(2);
default_Canvas->Range(0,0,1,1);
default_Canvas->SetFillColor(0);
default_Canvas->SetBorderMode(0);
default_Canvas->SetBorderSize(2);
default_Canvas->SetTickx(1);
default_Canvas->SetTicky(1);
default_Canvas->SetLeftMargin(0.14);
default_Canvas->SetRightMargin(0.05);
default_Canvas->SetTopMargin(0.05);
default_Canvas->SetBottomMargin(0.16);
default_Canvas->SetFrameLineWidth(2);
default_Canvas->SetFrameBorderMode(0);
// ------------>Primitives in pad: bottomPad
TPad *bottomPad = new TPad("bottomPad", "bottomPad",0.005,0.05,0.995,0.995);
bottomPad->Draw();
bottomPad->cd();
bottomPad->Range(0,0,1,1);
bottomPad->SetFillColor(0);
bottomPad->SetFillStyle(4000);
bottomPad->SetBorderMode(0);
bottomPad->SetBorderSize(2);
bottomPad->SetTickx(1);
bottomPad->SetTicky(1);
bottomPad->SetLeftMargin(0.14);
bottomPad->SetRightMargin(0.05);
bottomPad->SetTopMargin(0.05);
bottomPad->SetBottomMargin(0.16);
bottomPad->SetFrameLineWidth(2);
bottomPad->SetFrameBorderMode(0);
bottomPad->Modified();
default_Canvas->cd();
// ------------>Primitives in pad: upperPad
TPad *upperPad = new TPad("upperPad", "upperPad",0.005,0.05,0.995,0.995);
upperPad->Draw();
upperPad->cd();
upperPad->Range(6.172839,-0.2132695,104.9383,0.4330016);
upperPad->SetFillColor(0);
upperPad->SetFillStyle(4000);
upperPad->SetBorderMode(0);
upperPad->SetBorderSize(2);
upperPad->SetTickx(1);
upperPad->SetTicky(1);
upperPad->SetLeftMargin(0.14);
upperPad->SetRightMargin(0.05);
upperPad->SetTopMargin(0.05);
upperPad->SetBottomMargin(0.33);
upperPad->SetFrameLineWidth(2);
upperPad->SetFrameBorderMode(0);
upperPad->SetFrameLineWidth(2);
upperPad->SetFrameBorderMode(0);
Double_t xAxis19[6] = {20, 25, 30, 40, 50, 100};
TH1F *z_ptj_toterr__19 = new TH1F("z_ptj_toterr__19","z_ptj",5, xAxis19);
z_ptj_toterr__19->SetBinContent(1,0.3608738);
z_ptj_toterr__19->SetBinContent(2,0.225932);
z_ptj_toterr__19->SetBinContent(3,0.1253807);
z_ptj_toterr__19->SetBinContent(4,0.06703913);
z_ptj_toterr__19->SetBinContent(5,0.01561868);
z_ptj_toterr__19->SetBinContent(6,0.780934);
z_ptj_toterr__19->SetBinError(1,0.02073388);
z_ptj_toterr__19->SetBinError(2,0.01400757);
z_ptj_toterr__19->SetBinError(3,0.009350811);
z_ptj_toterr__19->SetBinError(4,0.004623786);
z_ptj_toterr__19->SetBinError(5,0.001395185);
z_ptj_toterr__19->SetBinError(6,0.06975923);
z_ptj_toterr__19->SetEntries(12);
z_ptj_toterr__19->SetStats(0);
Int_t ci; // for color index setting
TColor *color; // for color definition with alpha
ci = TColor::GetColor("#ffff00");
z_ptj_toterr__19->SetFillColor(ci);
ci = TColor::GetColor("#ffff00");
z_ptj_toterr__19->SetLineColor(ci);
z_ptj_toterr__19->SetLineWidth(2);
ci = TColor::GetColor("#ffff00");
z_ptj_toterr__19->SetMarkerColor(ci);
z_ptj_toterr__19->SetMarkerStyle(0);
z_ptj_toterr__19->GetXaxis()->SetNdivisions(4);
z_ptj_toterr__19->GetXaxis()->SetLabelFont(132);
z_ptj_toterr__19->GetXaxis()->SetLabelOffset(999);
z_ptj_toterr__19->GetXaxis()->SetLabelSize(0);
z_ptj_toterr__19->GetXaxis()->SetTitleSize(0.06);
z_ptj_toterr__19->GetXaxis()->SetTitleFont(132);
z_ptj_toterr__19->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d#it{p}_{T}^{jet} [pb/GeV]");
z_ptj_toterr__19->GetYaxis()->SetLabelFont(132);
z_ptj_toterr__19->GetYaxis()->SetLabelSize(0.05);
z_ptj_toterr__19->GetYaxis()->SetTitleSize(0.06);
//.........这里部分代码省略.........
示例7: test3
void test3()
{
//=========Macro generated from canvas: default_Canvas/defaultCanvas
//========= (Fri May 6 10:50:13 2016) by ROOT version6.04/10
TCanvas *default_Canvas = new TCanvas("default_Canvas", "defaultCanvas",0,0,700,500);
gStyle->SetOptStat(0);
gStyle->SetOptTitle(0);
default_Canvas->SetHighLightColor(2);
default_Canvas->Range(0,0,1,1);
default_Canvas->SetFillColor(0);
default_Canvas->SetBorderMode(0);
default_Canvas->SetBorderSize(2);
default_Canvas->SetTickx(1);
default_Canvas->SetTicky(1);
default_Canvas->SetLeftMargin(0.14);
default_Canvas->SetRightMargin(0.05);
default_Canvas->SetTopMargin(0.05);
default_Canvas->SetBottomMargin(0.16);
default_Canvas->SetFrameLineWidth(2);
default_Canvas->SetFrameBorderMode(0);
// ------------>Primitives in pad: upperPad
TPad *upperPad = new TPad("upperPad", "upperPad",0.005,0.05,0.995,0.995);
upperPad->Draw();
upperPad->cd();
upperPad->Range(1.567901,0.02811051,4.654321,0.1367104);
upperPad->SetFillColor(0);
upperPad->SetFillStyle(4000);
upperPad->SetBorderMode(0);
upperPad->SetBorderSize(2);
upperPad->SetTickx(1);
upperPad->SetTicky(1);
upperPad->SetLeftMargin(0.14);
upperPad->SetRightMargin(0.05);
upperPad->SetTopMargin(0.05);
upperPad->SetBottomMargin(0.14);
upperPad->SetFrameLineWidth(2);
upperPad->SetFrameBorderMode(0);
upperPad->SetFrameLineWidth(2);
upperPad->SetFrameBorderMode(0);
TH1F *test3_red_0_0_norm__1 = new TH1F("test3_red_0_0_norm__1","ETA",10,2,4.5);
test3_red_0_0_norm__1->SetBinContent(1,0.1040398);
test3_red_0_0_norm__1->SetBinContent(2,0.1186439);
test3_red_0_0_norm__1->SetBinContent(3,0.1256071);
test3_red_0_0_norm__1->SetBinContent(4,0.1229555);
test3_red_0_0_norm__1->SetBinContent(5,0.118442);
test3_red_0_0_norm__1->SetBinContent(6,0.1127067);
test3_red_0_0_norm__1->SetBinContent(7,0.09951538);
test3_red_0_0_norm__1->SetBinContent(8,0.08332527);
test3_red_0_0_norm__1->SetBinContent(9,0.06651872);
test3_red_0_0_norm__1->SetBinContent(10,0.0482457);
test3_red_0_0_norm__1->SetBinError(1,0.001708584);
test3_red_0_0_norm__1->SetBinError(2,0.001736969);
test3_red_0_0_norm__1->SetBinError(3,0.001484444);
test3_red_0_0_norm__1->SetBinError(4,0.001426268);
test3_red_0_0_norm__1->SetBinError(5,0.001336676);
test3_red_0_0_norm__1->SetBinError(6,0.00122978);
test3_red_0_0_norm__1->SetBinError(7,0.00125216);
test3_red_0_0_norm__1->SetBinError(8,0.00113555);
test3_red_0_0_norm__1->SetBinError(9,0.0009819959);
test3_red_0_0_norm__1->SetBinError(10,0.0009418311);
test3_red_0_0_norm__1->SetEntries(58129);
test3_red_0_0_norm__1->SetStats(0);
Int_t ci; // for color index setting
TColor *color; // for color definition with alpha
ci = TColor::GetColor("#ff0000");
test3_red_0_0_norm__1->SetFillColor(ci);
test3_red_0_0_norm__1->SetFillStyle(0);
ci = TColor::GetColor("#ff0000");
test3_red_0_0_norm__1->SetLineColor(ci);
test3_red_0_0_norm__1->SetLineWidth(2);
ci = TColor::GetColor("#ff0000");
test3_red_0_0_norm__1->SetMarkerColor(ci);
test3_red_0_0_norm__1->SetMarkerStyle(20);
test3_red_0_0_norm__1->GetXaxis()->SetTitle("#eta");
test3_red_0_0_norm__1->GetXaxis()->SetNdivisions(1005);
test3_red_0_0_norm__1->GetXaxis()->SetLabelFont(132);
test3_red_0_0_norm__1->GetXaxis()->SetLabelOffset(0.02);
test3_red_0_0_norm__1->GetXaxis()->SetLabelSize(0.05);
test3_red_0_0_norm__1->GetXaxis()->SetTitleSize(0.06);
test3_red_0_0_norm__1->GetXaxis()->SetTitleFont(132);
test3_red_0_0_norm__1->GetYaxis()->SetNdivisions(505);
test3_red_0_0_norm__1->GetYaxis()->SetLabelFont(132);
test3_red_0_0_norm__1->GetYaxis()->SetLabelSize(0.05);
test3_red_0_0_norm__1->GetYaxis()->SetTitleSize(0.06);
test3_red_0_0_norm__1->GetYaxis()->SetTitleFont(132);
test3_red_0_0_norm__1->GetZaxis()->SetLabelFont(132);
test3_red_0_0_norm__1->GetZaxis()->SetLabelSize(0.05);
test3_red_0_0_norm__1->GetZaxis()->SetTitleSize(0.06);
test3_red_0_0_norm__1->GetZaxis()->SetTitleFont(132);
test3_red_0_0_norm__1->Draw("");
Double_t xAxis1[11] = {2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4, 4.25, 4.5};
TH1F *test3_green_0_1_norm__2 = new TH1F("test3_green_0_1_norm__2","ETA",10, xAxis1);
test3_green_0_1_norm__2->SetBinContent(1,0.1214835);
test3_green_0_1_norm__2->SetBinContent(2,0.1235428);
//.........这里部分代码省略.........
示例8: makePlot
//.........这里部分代码省略.........
TH1* histogram_fakes_density = 0;
if ( histogram_fakes ) {
if ( histogram_data ) checkCompatibleBinning(histogram_fakes, histogram_data);
histogram_fakes_density = divideHistogramByBinWidth(histogram_fakes);
}
histogram_fakes_density->SetFillColor(1);
histogram_fakes_density->SetFillStyle(3005);
histogram_fakes_density->SetLineColor(1);
histogram_fakes_density->SetLineWidth(1);
TH1* histogramSum_mc_density = 0;
if ( histogramSum_mc ) {
if ( histogram_data ) checkCompatibleBinning(histogramSum_mc, histogram_data);
histogramSum_mc_density = divideHistogramByBinWidth(histogramSum_mc);
}
std::cout << "histogramSum_mc_density = " << histogramSum_mc_density << std::endl;
dumpHistogram(histogramSum_mc_density);
TH1* histogramErr_mc_density = 0;
if ( histogramErr_mc ) {
if ( histogram_data ) checkCompatibleBinning(histogramErr_mc, histogram_data);
histogramErr_mc_density = divideHistogramByBinWidth(histogramErr_mc);
}
setStyle_uncertainty(histogramErr_mc_density);
TCanvas* canvas = new TCanvas("canvas", "canvas", 950, 1100);
canvas->SetFillColor(10);
canvas->SetBorderSize(2);
canvas->Draw();
TPad* topPad = new TPad("topPad", "topPad", 0.00, 0.34, 1.00, 0.995);
topPad->SetFillColor(10);
topPad->SetTopMargin(0.065);
topPad->SetLeftMargin(0.20);
topPad->SetBottomMargin(0.00);
topPad->SetRightMargin(0.04);
topPad->SetLogy(useLogScale);
TPad* bottomPad = new TPad("bottomPad", "bottomPad", 0.00, 0.01, 1.00, 0.335);
bottomPad->SetFillColor(10);
bottomPad->SetTopMargin(0.085);
bottomPad->SetLeftMargin(0.20);
bottomPad->SetBottomMargin(0.35);
bottomPad->SetRightMargin(0.04);
bottomPad->SetLogy(false);
canvas->cd();
topPad->Draw();
topPad->cd();
THStack* histogramStack_mc = new THStack();
histogramStack_mc->Add(histogram_fakes_density);
histogramStack_mc->Add(histogram_Rares_density);
histogramStack_mc->Add(histogram_EWK_density);
histogramStack_mc->Add(histogram_ttW_density);
histogramStack_mc->Add(histogram_ttZ_density);
histogramStack_mc->Add(histogram_ttH_density);
TH1* histogram_ref = histogram_data_density;
histogram_ref->SetTitle("");
histogram_ref->SetStats(false);
histogram_ref->SetMaximum(yMax);
histogram_ref->SetMinimum(yMin);
TAxis* xAxis_top = histogram_ref->GetXaxis();
assert(xAxis_top);
示例9: markerwarning
void markerwarning()
{
const int Nph = 14;
double np_ph[Nph] = {353.4,300.2,254.3,215.2,181.0,151.3,125.2,102.7, 83.3, 66.7, 52.5, 40.2, 30.2, 22.0};
double nc_ph[Nph] = {3.890,3.734,3.592,3.453,3.342,3.247,3.151,3.047,2.965,2.858,2.701,2.599,2.486,2.328};
double npe_ph[Nph] = {10.068,9.004,8.086,7.304,6.620,6.026,5.504,5.054,4.666,4.334,4.050,3.804,3.604,3.440};
double nce_ph[Nph] = {0.235,0.217,0.210,0.206,0.213,0.223,0.239,0.260,0.283,0.318,0.356,0.405,0.465,0.545};
const int Nbr = 6;
double np_br[Nbr] = {357.0,306.0,239.0,168.0,114.0, 73.0};
double nc_br[Nbr] = {3.501,3.275,3.155,3.060,3.053,3.014};
double npe_br[Nbr] = {8.000,11.000,10.000,9.000,9.000,8.000};
double nce_br[Nbr] = {0.318,0.311,0.306,0.319,0.370,0.429};
TGraphErrors *phUP = new TGraphErrors(Nph,np_ph,nc_ph,npe_ph,nce_ph);
TGraphErrors *phDN = new TGraphErrors(Nph,np_ph,nc_ph,npe_ph,nce_ph);
TGraphErrors *brUP = new TGraphErrors(Nbr,np_br,nc_br,npe_br,nce_br);
TGraphErrors *brDN = new TGraphErrors(Nbr,np_br,nc_br,npe_br,nce_br);
float Top_margin = 0.;
float Left_margin = 0.025;
float Right_margin = 0.005;
float maxPlotPart = 395;
float Marker_Size = 1.3;
int Marker_Style = 8;
float Et_200_Min = 0.71;
float Et_200_Max = 3.80;
float Et_130_Min = 1.21;
float Et_130_Max = 3.29;
float Nc_200_Min = 1.31;
float Nc_200_Max = 4.30;
float Nc_130_Min = 1.51;
float Nc_130_Max = 3.89;
TCanvas *canvasNc = new TCanvas("canvasNc", "Multiplicity",630,10,600,500);
gStyle->SetOptStat(0);
canvasNc->SetFillColor(10);
canvasNc->SetBorderSize(0);
// Primitives in Nc200 pad
TPad *padNcUP = new TPad("padNcUP","200 GeV",0.07,0.60,1.,1.00);
padNcUP->Draw();
padNcUP->cd();
padNcUP->SetFillColor(10);
padNcUP->SetFrameFillColor(10);
padNcUP->SetBorderSize(0);
padNcUP->SetLeftMargin(Left_margin);
padNcUP->SetRightMargin(Right_margin);
padNcUP->SetTopMargin(Top_margin+0.005);
padNcUP->SetBottomMargin(0.00);
TH1F* frameNcUP = new TH1F("frameNcUP","",100,0,maxPlotPart);
frameNcUP->GetYaxis()->SetLabelOffset(0.005);
frameNcUP->GetYaxis()->SetLabelSize(0.10);
frameNcUP->SetMinimum(Nc_200_Min);
frameNcUP->SetMaximum(Nc_200_Max);
frameNcUP->SetNdivisions(505,"Y");
frameNcUP->SetNdivisions(505,"X");
frameNcUP->Draw();
brUP->SetMarkerStyle(22);
brUP->SetMarkerSize (2.0);
brUP->Draw("P");
phDN->SetMarkerStyle(23);
phDN->SetMarkerSize (2);
phDN->Draw("P");
canvasNc->cd();
// Primitives in Nc130 pad
TPad *padNcDN = new TPad("padNcDN","130 GeV",0.07,0.02,1.,0.60);
padNcDN->Draw();
padNcDN->cd();
padNcDN->SetFillColor(10);
padNcDN->SetFrameFillColor(10);
padNcDN->SetBorderSize(0);
padNcDN->SetLeftMargin(Left_margin);
padNcDN->SetRightMargin(Right_margin);
padNcDN->SetTopMargin(Top_margin+0.005);
padNcDN->SetBottomMargin(0.30);
TH1F* frameNcDN = new TH1F("frameNcDN","",100,0,maxPlotPart);
frameNcDN->GetYaxis()->SetLabelOffset(0.005);
frameNcDN->GetYaxis()->SetLabelSize(0.07);
frameNcDN->GetXaxis()->SetLabelOffset(0.005);
frameNcDN->GetXaxis()->SetLabelSize(0.07);
frameNcDN->SetMinimum(Nc_200_Min);
frameNcDN->SetMaximum(Nc_200_Max);
frameNcDN->SetNdivisions(505,"Y");
frameNcDN->SetNdivisions(505,"X");
frameNcDN->Draw();
brDN->SetMarkerStyle(23);
brDN->SetMarkerSize (2.0);
brDN->Draw("P");
//.........这里部分代码省略.........
示例10: plot1d
void plot1d(int hid) {
gStyle->SetOptStat(0);
char c[50];
c1->Clear();
if(m1dHist[hid]==0){
c1->Divide(2,2);
for(int quad=0; quad<kFgtNumQuads; quad++){
TVirtualPad* pad1 = c1->cd(quad+1);
pad1->SetLogy(l1dHist[hid]);
double xmin, xmax, ymin=0.0, ymax=0.0;
if(l1dHist[hid]==1) ymin=0.1;
for(int disc=0; disc<kFgtNumDiscs; disc++){
sprintf(c,"%1d%1s-%s",disc+1,cquad[quad],c1dHist[hid]);
//printf("Getting %s\n",c);
TH1F *h = hist1[disc][quad][hid] = (TH1F*)file->Get(c);
xmin=h->GetXaxis()->GetXmin();
xmax=h->GetXaxis()->GetXmax();
double m=h->GetMaximum();
if(ymax<m) ymax=m;
printf("disc=%d max=%6.1f ymax=%6.1f xmin=%6.1f xmax=%6.1f\n",disc+1,m,ymax,xmin,xmax);
}
sprintf(c,"Quad%1s-%s",cquad[quad],c1dHist[hid]);
TH2F *frame = new TH2F(c,c,1,xmin,xmax,1,ymin,ymax*1.2); frame->SetStats(0); frame->Draw();
for(int disc=0; disc<kFgtNumDiscs; disc++){
TH1F *h=hist1[disc][quad][hid];
h->SetLineColor(color[disc]); h->SetLineWidth(3); h->Draw("SAME");
if(f1dHist[hid]==0){
float mean=h->GetMean();
sprintf(c,"%1d%s mean=%6.2f",disc+1,cquad[quad],mean);
}else if(f1dHist[hid]==1){
int res = h->Fit("gaus","0Q");
TF1 *f = h->GetFunction("gaus");
float sig = f->GetParameter(2);
if(res==0 && sig>0.0001 && h->GetEntries()>5){
f->SetLineColor(color[disc]); f->SetLineWidth(2); f->Draw("SAME");
sprintf(c,"%1d%s sig=%6.3f",disc+1,cquad[quad],sig);
}else{
sprintf(c,"%1d%s",disc+1,cquad[quad]);
}
}else if(f1dHist[hid]==2){
int res = h->Fit("landau","0Q");
TF1 *f = h->GetFunction("landau");
float peak = f->GetParameter(1);
if(res==0 && peak>0 && h->GetEntries()>5){
f->SetLineColor(color[disc]); f->SetLineWidth(2); f->Draw("SAME");
sprintf(c,"%1d%s mpv=%6.0f",disc+1,cquad[quad],peak);
}else{
sprintf(c,"%1d%s",disc+1,cquad[quad]);
}
}
TText *t1;
float x1= 0.2, x2= 0.55;
float y1=0.8 - 0.07*disc;
float y2=0.8 - 0.07*(disc-3);
if(disc<3) { t1 = new TText(x1,y1,c); }
else { t1 = new TText(x2,y2,c); }
t1->SetNDC();
t1->SetTextSize(0.04);
t1->SetTextColor(color[disc]);
t1->Draw();
}
}
}else{
c1->Divide(4,6);
gStyle->SetOptStat(0);
gStyle->SetOptTitle(0);
gStyle->SetOptFit(0);
for(int disc=0; disc<kFgtNumDiscs; disc++){
for(int quad=0; quad<kFgtNumQuads; quad++){
TPad* pad = c1->cd(disc*4+quad+1);
pad->SetRightMargin(0.01); pad->SetLeftMargin(0.1);
pad->SetTopMargin(0.01); pad->SetBottomMargin(0.1);
pad->SetLogy(l1dHist[hid]);
sprintf(c,"%1d%1s-%s",disc+1,cquad[quad],c1dHist[hid]);
TH1F *h = hist1[disc][quad][hid] = (TH1F*)file->Get(c);
h->SetFillColor(color[disc]);
h->GetXaxis()->SetLabelSize(0.1);
h->GetYaxis()->SetLabelSize(0.1);
h->GetXaxis()->SetNdivisions(205);
h->Draw();
if(f1dHist[hid]==0){
float mean=h->GetMean();
sprintf(c,"%1d%s mean=%6.2f",disc+1,cquad[quad],mean);
}else if(f1dHist[hid]==1){
int res = h->Fit("gaus","0Q");
TF1 *f = h->GetFunction("gaus");
float sig = f->GetParameter(2);
if(res==0 && sig>0.0001 && h->GetEntries()>5){
f->SetLineColor(color[disc]); f->SetLineWidth(2); f->Draw("SAME");
sprintf(c,"%1d%s sig=%6.3f",disc+1,cquad[quad],sig);
}else{
sprintf(c,"%1d%s",disc+1,cquad[quad]);
}
}else if(f1dHist[hid]==2){
int res = h->Fit("landau","0Q");
TF1 *f = h->GetFunction("landau");
float peak = f->GetParameter(1);
if(res==0 && peak>0 && h->GetEntries()>5){
f->SetLineColor(1); f->SetLineWidth(2); f->Draw("SAME");
//.........这里部分代码省略.........
示例11: wmj_fit_stack
void wmj_fit_stack()
{
//=========Macro generated from canvas: default_Canvas/defaultCanvas
//========= (Tue May 3 07:35:30 2016) by ROOT version6.04/10
TCanvas *default_Canvas = new TCanvas("default_Canvas", "defaultCanvas",0,0,700,500);
gStyle->SetOptStat(0);
gStyle->SetOptTitle(0);
default_Canvas->SetHighLightColor(2);
default_Canvas->Range(0,0,1,1);
default_Canvas->SetFillColor(0);
default_Canvas->SetBorderMode(0);
default_Canvas->SetBorderSize(2);
default_Canvas->SetTickx(1);
default_Canvas->SetTicky(1);
default_Canvas->SetLeftMargin(0.14);
default_Canvas->SetRightMargin(0.05);
default_Canvas->SetTopMargin(0.05);
default_Canvas->SetBottomMargin(0.16);
default_Canvas->SetFrameLineWidth(2);
default_Canvas->SetFrameBorderMode(0);
// ------------>Primitives in pad: upperPad
TPad *upperPad = new TPad("upperPad", "upperPad",0.005,0.05,0.995,0.995);
upperPad->Draw();
upperPad->cd();
upperPad->Range(-0.1730123,-5358.989,1.06279,32919.5);
upperPad->SetFillColor(0);
upperPad->SetFillStyle(4000);
upperPad->SetBorderMode(0);
upperPad->SetBorderSize(2);
upperPad->SetTickx(1);
upperPad->SetTicky(1);
upperPad->SetLeftMargin(0.14);
upperPad->SetRightMargin(0.05);
upperPad->SetTopMargin(0.05);
upperPad->SetBottomMargin(0.14);
upperPad->SetFrameLineWidth(2);
upperPad->SetFrameBorderMode(0);
upperPad->SetFrameLineWidth(2);
upperPad->SetFrameBorderMode(0);
Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fx3005[20] = {
0.025,
0.075,
0.125,
0.175,
0.225,
0.275,
0.325,
0.375,
0.425,
0.475,
0.525,
0.575,
0.625,
0.675,
0.725,
0.775,
0.825,
0.875,
0.925,
0.975};
Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fy3005[20] = {
0,
0,
9,
26,
118,
315,
881,
1812,
3086,
4575,
5856,
6537,
6824,
6348,
5662,
4769,
4941,
6726,
13179,
28019};
Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_felx3005[20] = {
0.025,
0.025,
0.025,
0.025,
0.025,
0.025,
0.025,
0.025,
0.025,
0.025,
0.025,
0.025,
0.025,
0.025,
0.025,
0.025,
//.........这里部分代码省略.........
示例12: main
//.........这里部分代码省略.........
} // Loop on the cut list
} // Loop on the events
TFile* outputEfficiency = new TFile(("output/"+outputPlotDirectory+"/outputEfficiency.root").c_str(),"RECREATE");
for(map<string,TH1F*>::const_iterator itMap = histoCutEff.begin(); itMap != histoCutEff.end(); itMap++){
itMap->second->Scale(1./itMap->second->GetBinContent(1));
itMap->second->Write();
}
outputEfficiency->Close();
// make the canvas and basic banners
TCanvas *cCanvas = new TCanvas("cCanvas","",1,52,550,550);
cCanvas->SetTicks();
cCanvas->SetFillColor(0);
cCanvas->SetBorderMode(0);
cCanvas->SetBorderSize(2);
cCanvas->SetTickx(1);
cCanvas->SetTicky(1);
cCanvas->SetRightMargin(0.05);
cCanvas->SetBottomMargin(0.12);
cCanvas->SetFrameBorderMode(0);
cCanvas->cd();
TPad* upperPad = new TPad("upperPad", "upperPad", .005, .180, .995, .980);
TPad* lowerPad = new TPad("lowerPad", "lowerPad", .005, .005, .995, .18);
lowerPad->SetGridx();
lowerPad->SetGridy();
upperPad->SetLeftMargin(0.12);
upperPad->SetRightMargin(0.1);
lowerPad->SetLeftMargin(0.12);
lowerPad->SetRightMargin(0.1);
lowerPad->SetTopMargin(0.002);
lowerPad->Draw();
upperPad->Draw();
TCanvas *cCanvasNorm = new TCanvas("cCanvasNorm","",1,52,550,550);
cCanvasNorm->SetTicks();
cCanvasNorm->SetFillColor(0);
cCanvasNorm->SetBorderMode(0);
cCanvasNorm->SetBorderSize(2);
cCanvasNorm->SetTickx(1);
cCanvasNorm->SetTicky(1);
cCanvasNorm->SetRightMargin(0.05);
cCanvasNorm->SetBottomMargin(0.12);
cCanvasNorm->SetFrameBorderMode(0);
TLatex * tex = new TLatex(0.88,0.92," 14 TeV");
tex->SetNDC();
tex->SetTextAlign(31);
tex->SetTextFont(42);
tex->SetTextSize(0.045);
tex->SetLineWidth(2);
TLatex * tex2 = new TLatex(0.14,0.92,"Delphes");
tex2->SetNDC();
tex2->SetTextFont(61);
tex2->SetTextSize(0.045);
tex2->SetLineWidth(2);
TLatex * tex3 = new TLatex(0.295,0.92,"Simulation Preliminary");
tex3->SetNDC();
示例13: limit
void limit()
{
//=========Macro generated from canvas: limit/limit
//========= (Thu Apr 27 14:38:33 2017) by ROOT version6.02/05
TCanvas *limit = new TCanvas("limit", "limit",0,0,600,600);
gStyle->SetOptFit(1);
gStyle->SetOptStat(0);
gStyle->SetOptTitle(0);
limit->SetHighLightColor(2);
limit->Range(0,0,1,1);
limit->SetFillColor(0);
limit->SetBorderMode(0);
limit->SetBorderSize(2);
limit->SetLeftMargin(0.16);
limit->SetRightMargin(0.04);
limit->SetTopMargin(0.06);
limit->SetBottomMargin(0.12);
limit->SetFrameFillStyle(0);
limit->SetFrameBorderMode(0);
// ------------>Primitives in pad: pad
TPad *pad = new TPad("pad", "pad",0,0,1,1);
pad->Draw();
pad->cd();
pad->Range(-59.99999,-2.046818,1565,15.01);
pad->SetFillColor(0);
pad->SetBorderMode(0);
pad->SetLogy();
pad->SetBorderSize(2);
pad->SetTickx(1);
pad->SetTicky(1);
pad->SetLeftMargin(0.16);
pad->SetRightMargin(0.04);
pad->SetTopMargin(0.06);
pad->SetBottomMargin(0.12);
pad->SetFrameFillStyle(0);
pad->SetFrameBorderMode(0);
pad->SetFrameFillStyle(0);
pad->SetFrameBorderMode(0);
TH1F *tmp01 = new TH1F("tmp01","Graph",100,200,1500);
tmp01->SetMinimum(0.);
tmp01->SetMaximum(13.98659);
tmp01->SetStats(0);
tmp01->SetLineStyle(0);
tmp01->SetMarkerStyle(20);
tmp01->GetXaxis()->SetTitle("m_{H} (GeV)");
tmp01->GetXaxis()->SetLabelFont(42);
tmp01->GetXaxis()->SetLabelOffset(0.01);
tmp01->GetXaxis()->SetTitleSize(0.05);
tmp01->GetXaxis()->SetTickLength(0.02);
tmp01->GetXaxis()->SetTitleOffset(1.08);
tmp01->GetXaxis()->SetTitleFont(42);
tmp01->GetYaxis()->SetTitle("95% CL limit on #sigma/#sigma_{SM}");
tmp01->GetYaxis()->SetLabelFont(42);
tmp01->GetYaxis()->SetLabelOffset(0.007);
tmp01->GetYaxis()->SetTitleSize(0.05);
tmp01->GetYaxis()->SetTickLength(0.02);
tmp01->GetYaxis()->SetTitleOffset(1.56);
tmp01->GetYaxis()->SetTitleFont(42);
tmp01->GetZaxis()->SetLabelFont(42);
tmp01->GetZaxis()->SetLabelOffset(0.007);
tmp01->GetZaxis()->SetTitleSize(0.05);
tmp01->GetZaxis()->SetTickLength(0.02);
tmp01->GetZaxis()->SetTitleFont(42);
tmp01->Draw("AXIS");
TH1F *tmp02 = new TH1F("tmp02","Graph",100,200,1500);
tmp02->SetMinimum(0);
tmp02->SetMaximum(13.98659);
tmp02->SetStats(0);
tmp02->SetLineStyle(0);
tmp02->SetMarkerStyle(20);
tmp02->GetXaxis()->SetTitle("m_{H} (GeV)");
tmp02->GetXaxis()->SetLabelFont(42);
tmp02->GetXaxis()->SetLabelOffset(0.01);
tmp02->GetXaxis()->SetTitleSize(0.05);
tmp02->GetXaxis()->SetTickLength(0.02);
tmp02->GetXaxis()->SetTitleOffset(1.08);
tmp02->GetXaxis()->SetTitleFont(42);
tmp02->GetYaxis()->SetTitle("95% CL limit on #sigma/#sigma_{SM}");
tmp02->GetYaxis()->SetLabelFont(42);
tmp02->GetYaxis()->SetLabelOffset(0.007);
tmp02->GetYaxis()->SetTitleSize(0.05);
tmp02->GetYaxis()->SetTickLength(0.02);
tmp02->GetYaxis()->SetTitleOffset(1.56);
tmp02->GetYaxis()->SetTitleFont(42);
tmp02->GetZaxis()->SetLabelFont(42);
tmp02->GetZaxis()->SetLabelOffset(0.007);
tmp02->GetZaxis()->SetTitleSize(0.05);
tmp02->GetZaxis()->SetTickLength(0.02);
tmp02->GetZaxis()->SetTitleFont(42);
tmp02->Draw("AXIGSAME");
Double_t Graph0_fx3001[27] = {
200,
250,
300,
350,
400,
//.........这里部分代码省略.........
示例14: main
//.........这里部分代码省略.........
s_EoC->SetY1NDC(0.59);
s_EoC->SetY2NDC(0.79);
s_EoC -> Draw("sames");
gPad -> Update();
h_EoP_chi2 -> GetXaxis() -> SetTitle("#chi^{2}/N_{dof}");
h_EoP_chi2 -> Draw("sames");
gPad -> Update();
TPaveStats* s_EoP = new TPaveStats;
s_EoP = (TPaveStats*)(h_EoP_chi2->GetListOfFunctions()->FindObject("stats"));
s_EoP -> SetStatFormat("1.4g");
s_EoP -> SetTextColor(kRed+2);
s_EoP->SetY1NDC(0.79);
s_EoP->SetY2NDC(0.99);
s_EoP -> Draw("sames");
gPad -> Update();
//-------------------
// Final plot vs date
//-------------------
TCanvas* cplot = new TCanvas("cplot", "history plot vs date",100,100,1000,500);
cplot->cd();
TPad *cLeft = new TPad("pad_0","pad_0",0.00,0.00,0.75,1.00);
TPad *cRight = new TPad("pad_1","pad_1",0.75,0.00,1.00,1.00);
cLeft->SetLeftMargin(0.15);
cLeft->SetRightMargin(0.025);
cRight->SetLeftMargin(0.025);
cLeft->Draw();
cRight->Draw();
float tYoffset = 1.0;
float labSize = 0.05;
float labSize2 = 0.06;
cLeft->cd();
cLeft->SetGridx();
cLeft->SetGridy();
TH1F *hPad = (TH1F*)gPad->DrawFrame(t1,0.9,t2,1.05);
hPad->GetXaxis()->SetTimeFormat("%d/%m%F1970-01-01 00:00:00");
hPad->GetXaxis()->SetTimeDisplay(1);
hPad->GetXaxis() -> SetRangeUser(MinTime[0]-43200,MaxTime[nBins-1]+43200);
hPad->GetXaxis()->SetTitle("date (day/month)");
if( strcmp(EBEE,"EB") == 0 )
hPad->GetYaxis()->SetTitle("Relative E/p scale");
else
hPad->GetYaxis()->SetTitle("Relative E/p scale");
hPad->GetYaxis()->SetTitleOffset(tYoffset);
hPad->GetXaxis()->SetLabelSize(labSize);
hPad->GetXaxis()->SetTitleSize(labSize2);
hPad->GetYaxis()->SetLabelSize(labSize);
hPad->GetYaxis()->SetTitleSize(labSize2);
hPad -> SetMinimum(yMIN);
hPad -> SetMaximum(yMAX);
示例15: makePlot
void makePlot(double canvasSizeX, double canvasSizeY,
TH1* histogramTTH,
TH1* histogramData,
TH1* histogramTT,
TH1* histogramTTV,
TH1* histogramEWK,
TH1* histogramRares,
TH1* histogramBgrSum,
TH1* histogramBgrUncertainty,
const std::string& xAxisTitle, double xAxisOffset,
bool useLogScale, double yMin, double yMax, const std::string& yAxisTitle, double yAxisOffset,
const std::string& outputFileName)
{
TH1* histogramTTH_density = 0;
if ( histogramTTH ) {
if ( histogramData ) checkCompatibleBinning(histogramTTH, histogramData);
histogramTTH_density = divideHistogramByBinWidth(histogramTTH);
}
TH1* histogramData_density = 0;
if ( histogramData ) {
histogramData_density = divideHistogramByBinWidth(histogramData);
}
TH1* histogramTT_density = 0;
if ( histogramTT ) {
if ( histogramData ) checkCompatibleBinning(histogramTT, histogramData);
histogramTT_density = divideHistogramByBinWidth(histogramTT);
}
TH1* histogramTTV_density = 0;
if ( histogramTTV ) {
if ( histogramData ) checkCompatibleBinning(histogramTTV, histogramData);
histogramTTV_density = divideHistogramByBinWidth(histogramTTV);
}
TH1* histogramEWK_density = 0;
if ( histogramEWK ) {
if ( histogramData ) checkCompatibleBinning(histogramEWK, histogramData);
histogramEWK_density = divideHistogramByBinWidth(histogramEWK);
}
TH1* histogramRares_density = 0;
if ( histogramRares ) {
if ( histogramData ) checkCompatibleBinning(histogramRares, histogramData);
histogramRares_density = divideHistogramByBinWidth(histogramRares);
}
TH1* histogramBgrSum_density = 0;
if ( histogramBgrSum ) {
if ( histogramData ) checkCompatibleBinning(histogramBgrSum, histogramData);
histogramBgrSum_density = divideHistogramByBinWidth(histogramBgrSum);
}
TH1* histogramBgrUncertainty_density = 0;
if ( histogramBgrUncertainty ) {
if ( histogramData ) checkCompatibleBinning(histogramBgrUncertainty, histogramData);
histogramBgrUncertainty_density = divideHistogramByBinWidth(histogramBgrUncertainty);
}
TCanvas* canvas = new TCanvas("canvas", "", canvasSizeX, canvasSizeY);
canvas->SetFillColor(10);
canvas->SetFillStyle(4000);
canvas->SetFillColor(10);
canvas->SetTicky();
canvas->SetBorderSize(2);
canvas->SetLeftMargin(0.12);
canvas->SetBottomMargin(0.12);
TPad* topPad = new TPad("topPad", "topPad", 0.00, 0.35, 1.00, 1.00);
topPad->SetFillColor(10);
topPad->SetTopMargin(0.065);
topPad->SetLeftMargin(0.15);
topPad->SetBottomMargin(0.03);
topPad->SetRightMargin(0.05);
topPad->SetLogy(useLogScale);
TPad* bottomPad = new TPad("bottomPad", "bottomPad", 0.00, 0.00, 1.00, 0.35);
bottomPad->SetFillColor(10);
bottomPad->SetTopMargin(0.02);
bottomPad->SetLeftMargin(0.15);
bottomPad->SetBottomMargin(0.31);
bottomPad->SetRightMargin(0.05);
bottomPad->SetLogy(false);
canvas->cd();
topPad->Draw();
topPad->cd();
TAxis* xAxis_top = histogramData_density->GetXaxis();
xAxis_top->SetTitle(xAxisTitle.data());
xAxis_top->SetTitleOffset(xAxisOffset);
xAxis_top->SetLabelColor(10);
xAxis_top->SetTitleColor(10);
TAxis* yAxis_top = histogramData_density->GetYaxis();
yAxis_top->SetTitle(yAxisTitle.data());
yAxis_top->SetTitleOffset(yAxisOffset);
yAxis_top->SetTitleSize(0.085);
yAxis_top->SetLabelSize(0.05);
yAxis_top->SetTickLength(0.04);
TLegend* legend = new TLegend(0.66, 0.45, 0.94, 0.92, NULL, "brNDC");
legend->SetFillStyle(0);
legend->SetBorderSize(0);
legend->SetFillColor(10);
legend->SetTextSize(0.055);
//.........这里部分代码省略.........