本文整理汇总了C++中TPad::SetBottomMargin方法的典型用法代码示例。如果您正苦于以下问题:C++ TPad::SetBottomMargin方法的具体用法?C++ TPad::SetBottomMargin怎么用?C++ TPad::SetBottomMargin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPad
的用法示例。
在下文中一共展示了TPad::SetBottomMargin方法的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: plot_ratio
TPad* plot_ratio(TCanvas *canv, bool up){
canv->SetFillColor (0);
canv->SetBorderMode (0);
canv->SetBorderSize (10);
// Set margins to reasonable defaults
canv->SetLeftMargin (0.18);
canv->SetLeftMargin (0.17);
canv->SetRightMargin (0.05);
canv->SetTopMargin (0.12);
canv->SetBottomMargin (0.18);
// Setup a frame which makes sense
canv->SetFrameFillStyle (0);
canv->SetFrameLineStyle (0);
canv->SetFrameBorderMode(0);
canv->SetFrameBorderSize(10);
canv->SetFrameFillStyle (0);
canv->SetFrameLineStyle (0);
canv->SetFrameBorderMode(0);
canv->SetFrameBorderSize(10);
canv->cd();
TPad *pad = 0;
if (up){
pad = new TPad("upper","pad",0, 0.26 ,1 ,1);
pad->SetBottomMargin(0.05);
pad->SetTopMargin(0.09);
pad->Draw();
pad->cd();
return pad;
}
else {
pad = new TPad("lower","pad",0, 0,1 ,0.26);
pad->SetTopMargin(0.05);
pad->SetBottomMargin(0.24);
pad->Draw();
pad->cd();
return pad;
}
};
示例3: 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();
}
示例4: 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();
}
示例5: 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");
}
示例6: setStyle
makeLTauStack(TString name,TString file,TString dir,int s,TString labelX,TString units = "GeV",bool left=false,TString channel = "",bool log = false,bool dndm=false,bool doRatio = false)
{
setStyle();
float xR=0.45;
if(left)
xR=0.2;
if(doRatio){
TCanvas * c = new TCanvas(name,name,600,600);
}
else{
TCanvas * c = new TCanvas(name,name,600,600);
c->SetLeftMargin (0.18);
c->SetRightMargin (0.05);
c->SetTopMargin (0.08);
c->SetBottomMargin (0.15);
}
c->cd();
if(doRatio){
TPad * plotPad = new TPad("pad1","",0.0,0.3,1.0,1.0);
plotPad->SetLeftMargin (0.18);
plotPad->SetTopMargin (0.10);
plotPad->SetRightMargin (0.07);
plotPad->SetBottomMargin(0.03);
TPad * ratioPad = new TPad("pad2","",0.0,0.0,1.0,0.3);
ratioPad->SetLeftMargin (0.18);
ratioPad->SetTopMargin (0.00);
ratioPad->SetRightMargin (0.07);
ratioPad->SetBottomMargin(0.30);
ratioPad->SetGridy(1);
}
else{
TPad * plotPad = new TPad("pad1","",0.0,0.0,1.0,1.0);
plotPad->SetLeftMargin (0.18);
plotPad->SetRightMargin (0.05);
plotPad->SetTopMargin (0.08);
plotPad->SetBottomMargin (0.15);
}
plotPad->Draw();
plotPad->cd();
TFile *f = new TFile(file);
TH1F * data = (TH1F*)(f->Get(dir+"/data_obs"));
if (dndm) convertToDNDM(data);
applyDATAStyle(data);
TH1F * QCD = (TH1F*)(f->Get(dir+"/QCD"));
if (dndm) convertToDNDM(QCD);
applyStyle(QCD,kMagenta-10,1,1001);
TH1F * ttbar = (TH1F*)(f->Get(dir+"/TT"));
if (dndm) convertToDNDM(ttbar);
applyStyle(ttbar,kBlue-8,1,1001);
if(channel == "#tau_{e}#tau_{h}"){
TH1F * EWK = (TH1F*)(f->Get(dir+"/W"));
EWK->Add((TH1F*)(f->Get(dir+"/VV")));
if (dndm) convertToDNDM(EWK);
applyStyle(EWK,kRed+2,1,1001);
if(f->Get(dir+"/ZL")!=0)
TH1F * ZEE = (TH1F*)(f->Get(dir+"/ZL"));
if(f->Get(dir+"/ZJ")!=0)
ZEE->Add((TH1F*)(f->Get(dir+"/ZJ")));
if(f->Get(dir+"/ZLL")!=0)
TH1F * ZEE = (TH1F*)(f->Get(dir+"/ZLL")));
if (dndm) convertToDNDM(ZEE);
applyStyle(ZEE,kAzure+2,1,1001);
}
示例7: t1pfmetPhiwithCorr
void t1pfmetPhiwithCorr(double pt1min, double pt2min, double METmin, double DPHImin){
gStyle->SetPadTickY(1);
gStyle->SetPadTickX(1);
int i = 0;
TLegend* leg = new TLegend(0.35,0.65,0.87,0.87);
leg->SetNColumns(2);
leg->SetBorderSize(0);
leg->SetFillStyle(0);
TCanvas *canvas = new TCanvas("c1n","",500,600);
TPad *mainPad = new TPad("mainPad","",0,0.3,1,1);
TPad *smallPad = new TPad("smallPad","",0,0.05,1,0.3);
mainPad->SetBottomMargin(0.015);
smallPad->SetTopMargin(0.05);
smallPad->SetBottomMargin(0.25);
canvas->cd();
mainPad->Draw();
mainPad->cd();
// gPad->SetLogy();
TCut mggmax = "mgg<180";
TCut mggmin = "mgg>100";
TCut pt1Cut = Form("pt1/mgg>%lf",pt1min);
TCut pt2Cut = Form("pt2/mgg>%lf",pt2min);
// TCut METCut = Form("t1pfmetCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0)>%lf",METmin);
TCut METCut = "";
TCut DPHICut = Form("Delta(pt1,eta1,phi1,pt2,eta2,phi2,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>%lf",DPHImin);
TCut eveto1 = "eleveto1 == 1";
TCut eveto2 = "eleveto2 == 1";
TCut eveto = eveto1 && eveto2;
TCut genmatch = "((genmatch1==1 && genmatch2==0)||(genmatch1==0 && genmatch2==1)||(genmatch1==0 && genmatch2==0))";
TCut metF = "((metF_GV==1) && (metF_HBHENoise==1) && (metF_HBHENoiseIso==1) && (metF_CSC==1) && (metF_eeBadSC==1))";
TCut NegWeight = "weight>0.";
/*
TFile *M1 = TFile::Open("./50ns_betaV3/NewWeightDMHtoGG_M1.root","READ");
TFile *M10 = TFile::Open("./50ns_betaV3/NewWeightDMHtoGG_M10.root","READ");
TFile *M100 = TFile::Open("./50ns_betaV3/NewWeightDMHtoGG_M100.root","READ");
TFile *M1000 = TFile::Open("./50ns_betaV3/NewWeightDMHtoGG_M1000.root","READ");
*/
TFile *data = TFile::Open("./25ns_2246inv_v3/DoubleEG.root","READ");
TFile *sig1 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP600.root","READ");
TFile *sig2 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP800.root","READ");
TFile *sig3 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP1000.root","READ");
TFile *sig4 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP1200.root","READ");
TFile *sig5 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP1400.root","READ");
TFile *sig6 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP1700.root","READ");
TFile *sig7 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP2500.root","READ");
/*
TFile *bkg1 = TFile::Open("./50ns_betaV3/DiPhoton.root","READ");
TFile *bkg2 = TFile::Open("./50ns_betaV3/DYJetsToLL.root","READ");
TFile *bkg3 = TFile::Open("./50ns_betaV3/GJets.root","READ");
TFile *bkg4 = TFile::Open("./50ns_betaV3/GluGluHToGG.root","READ");
TFile *bkg5 = TFile::Open("./50ns_betaV3/QCD.root","READ");
TFile *bkg6 = TFile::Open("./50ns_betaV3/VH.root","READ");
*/
TFile *bkg1 = TFile::Open("./25ns_2246inv_v3/DiPhoton.root","READ");
TFile *bkg2 = TFile::Open("./25ns_2246inv_v3/DYJetsToLL.root","READ");
TFile *bkg3 = TFile::Open("./25ns_2246inv_v3/GJets.root","READ");
TFile *bkg4 = TFile::Open("./25ns_2246inv_v3/GluGluHToGG.root","READ");
TFile *bkg5 = TFile::Open("./25ns_2246inv_v3/QCD.root","READ");
TFile *bkg6 = TFile::Open("./25ns_2246inv_v3/VH.root","READ");
TFile *bkg7 = TFile::Open("./25ns_2246inv_v3/ttHJetToGG.root","READ");
TFile *bkg8 = TFile::Open("./25ns_2246inv_v3/VBFHToGG.root","READ");
TFile *bkg9 = TFile::Open("./25ns_2246inv_v3/TGJets.root","READ");
TFile *bkg10 = TFile::Open("./25ns_2246inv_v3/TTGJets.root","READ");
TFile *bkg11 = TFile::Open("./25ns_2246inv_v3/WGToLNuG.root","READ");
TFile *bkg12 = TFile::Open("./25ns_2246inv_v3/ZGTo2LG.root","READ");
/*
TTree *tree_M1 = (TTree*) M1->Get("DiPhotonTree");
TTree *tree_M10 = (TTree*) M10->Get("DiPhotonTree");
TTree *tree_M100 = (TTree*) M100->Get("DiPhotonTree");
TTree *tree_M1000 = (TTree*) M1000->Get("DiPhotonTree");
*/
TTree *tree_data = (TTree*) data->Get("DiPhotonTree");
TTree *tree_sig1 = (TTree*) sig1->Get("DiPhotonTree");
TTree *tree_sig2 = (TTree*) sig2->Get("DiPhotonTree");
TTree *tree_sig3 = (TTree*) sig3->Get("DiPhotonTree");
TTree *tree_sig4 = (TTree*) sig4->Get("DiPhotonTree");
TTree *tree_sig5 = (TTree*) sig5->Get("DiPhotonTree");
TTree *tree_sig6 = (TTree*) sig6->Get("DiPhotonTree");
TTree *tree_sig7 = (TTree*) sig7->Get("DiPhotonTree");
//.........这里部分代码省略.........
示例8: 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);
//.........这里部分代码省略.........
示例9: makePlot
void makePlot(const TString& title,
TGraphAsymmErrors* graph_Data_passed, TF1* fit_Data_passed, const TString& legendEntry_Data_passed,
TGraphAsymmErrors* graph_mcSum_passed, TF1* fit_mcSum_passed, const TString& legendEntry_mcSum_passed,
TGraphAsymmErrors* graph_Data_failed, TF1* fit_Data_failed, const TString& legendEntry_Data_failed,
TGraphAsymmErrors* graph_mcSum_failed, TF1* fit_mcSum_failed, const TString& legendEntry_mcSum_failed,
const TString& outputFileName)
{
TCanvas* canvas = new TCanvas("canvas", "canvas", 800, 900);
canvas->SetFillColor(10);
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);
TPad* topPad = new TPad("topPad", "topPad", 0.00, 1.00 - 0.65*(0.93/0.84), 1.00, 1.00);
topPad->SetFillColor(10);
topPad->SetTopMargin(0.04);
topPad->SetLeftMargin(0.15);
//topPad->SetBottomMargin(0.03);
topPad->SetBottomMargin(0.12);
topPad->SetRightMargin(0.05);
topPad->SetGridx();
topPad->SetGridy();
canvas->cd();
topPad->Draw();
topPad->cd();
TH1* dummyHistogram_top = new TH1D("dummyHistogram_top", "dummyHistogram_top", 10, 0., 100.);
dummyHistogram_top->SetTitle("");
dummyHistogram_top->SetStats(false);
dummyHistogram_top->SetMaximum(1.2);
dummyHistogram_top->SetMinimum(0.);
TAxis* xAxis_top = dummyHistogram_top->GetXaxis();
xAxis_top->SetTitle("calo-E_{T}^{miss} / GeV");
xAxis_top->SetTitleOffset(1.15);
//xAxis_top->SetLabelColor(10);
//xAxis_top->SetTitleColor(10);
TAxis* yAxis_top = dummyHistogram_top->GetYaxis();
yAxis_top->SetTitle("#varepsilon");
yAxis_top->SetTitleOffset(1.2);
dummyHistogram_top->Draw();
//dummyHistogram_top->Draw("axis");
//graph_Data_passed->SetLineColor(4);
//graph_Data_passed->SetMarkerColor(4);
//graph_Data_passed->SetMarkerStyle(20);
//graph_Data_passed->Draw("p");
//fit_Data_passed->SetLineColor(graph_Data_passed->GetLineColor());
//fit_Data_passed->SetLineWidth(2);
//fit_Data_passed->Draw("same");
graph_mcSum_passed->SetLineColor(7);
graph_mcSum_passed->SetMarkerColor(7);
graph_mcSum_passed->SetMarkerStyle(24);
graph_mcSum_passed->Draw("p");
fit_mcSum_passed->SetLineColor(graph_mcSum_passed->GetLineColor());
fit_mcSum_passed->SetLineWidth(2);
fit_mcSum_passed->Draw("same");
graph_Data_failed->SetLineColor(2);
graph_Data_failed->SetMarkerColor(2);
graph_Data_failed->SetMarkerStyle(21);
//graph_Data_failed->Draw("p");
fit_Data_failed->SetLineColor(graph_Data_failed->GetLineColor());
fit_Data_failed->SetLineWidth(2);
//fit_Data_failed->Draw("same");
graph_mcSum_failed->SetLineColor(6);
graph_mcSum_failed->SetMarkerColor(6);
graph_mcSum_failed->SetMarkerStyle(25);
graph_mcSum_failed->Draw("p");
fit_mcSum_failed->SetLineColor(graph_mcSum_failed->GetLineColor());
fit_mcSum_failed->SetLineWidth(2);
fit_mcSum_failed->Draw("same");
TLegend* legend = new TLegend(0.61, 0.16, 0.89, 0.47, "", "brNDC");
legend->SetBorderSize(0);
legend->SetFillColor(0);
//legend->AddEntry(graph_Data_passed, legendEntry_Data_passed.Data(), "p");
legend->AddEntry(graph_mcSum_passed, legendEntry_mcSum_passed.Data(), "p");
//legend->AddEntry(graph_Data_failed, legendEntry_Data_failed.Data(), "p");
legend->AddEntry(graph_mcSum_failed, legendEntry_mcSum_failed.Data(), "p");
legend->Draw();
TPaveText* label = 0;
if ( title.Length() > 0 ) {
label = new TPaveText(0.175, 0.89, 0.48, 0.94, "NDC");
label->AddText(title.Data());
label->SetTextAlign(13);
label->SetTextSize(0.045);
label->SetFillStyle(0);
label->SetBorderSize(0);
//.........这里部分代码省略.........
示例10: doComparisonPlots_Et
void doComparisonPlots_Et(){
// gROOT->ProcessLine(".x /Users/Arabella/Public/style.C");
std::string plotDir = "../../NonGlobe/PLOTS_vsEt";
std::string plotDirOut = "2011vs2012_vsEt";
std::cout << " ci sono " << std::endl;
// std::string plotDir = "PLOTS_false_Sh";
// std::string plotDirOut = "2011vs2012_false_Sh";
for(int ii=0; ii<4; ++ii){
std::string category;
if(ii == 0) category = "EB_HIGH_scE_reg";
if(ii == 1) category = "EB_LOW_scE_reg";
if(ii == 2) category = "EE_HIGH_scE_reg";
if(ii == 3) category = "EE_LOW_scE_reg";
std::string file2011 = plotDir+"/results_"+category+"_2011.root";
std::string file2012 = plotDir+"/results_"+category+"_2012.root";
TFile f2012(file2012.c_str(),"read");
TFile f2011(file2011.c_str(),"read");
TGraphErrors* graph2012 = (TGraphErrors*)f2012.Get("finalGraph");
TGraphErrors* graph2011 = (TGraphErrors*)f2011.Get("finalGraph");
graph2012->SetMarkerColor(kGreen+2);
graph2011->SetMarkerColor(kRed+2);
if(ii == 0 || ii == 2){
graph2012->SetMarkerStyle(20);
graph2011->SetMarkerStyle(20);
}
if(ii == 1 || ii == 3){
graph2012->SetMarkerStyle(21);
graph2011->SetMarkerStyle(21);
}
TCanvas* cplot = new TCanvas("gplot", "gplot",100,100,725,500);
cplot->cd();
TPad *cLeft = new TPad("pad_0","pad_0",0.00,0.00,1.00,1.00);
cLeft->SetLeftMargin(0.17);
cLeft->SetRightMargin(0.025);
cLeft->SetBottomMargin(0.17);
cLeft->Draw();
float tYoffset = 1.75;
float tXoffset = 1.6;
float labSize = 0.04;
float labSize2 = 0.07;
cLeft->cd();
cLeft->SetGridx();
cLeft->SetGridy();
// pad settings
TH1F *hPad = (TH1F*)gPad->DrawFrame(20.,-0.02,120.,0.02);
hPad->GetXaxis()->SetTitle("E_{T}");
hPad->GetYaxis()->SetTitle("E/p_{data}-E/p_{mc}");
hPad->GetYaxis()->SetTitleOffset(tYoffset);
hPad->GetXaxis()->SetTitleOffset(tXoffset);
hPad->GetXaxis()->SetLabelSize(labSize);
hPad->GetXaxis()->SetTitleSize(labSize);
hPad->GetYaxis()->SetLabelSize(labSize);
hPad->GetYaxis()->SetTitleSize(labSize);
TLegend *tspec = new TLegend(0.64,0.80,0.99,0.99);
tspec->SetFillColor(0);
tspec->SetTextFont(42);
if(ii == 0){
tspec->AddEntry(graph2012,"2012 EB hR9","PL");
tspec->AddEntry(graph2011,"2011 EB hR9","PL");
}
if(ii == 1){
tspec->AddEntry(graph2012,"2012 EB lR9","PL");
tspec->AddEntry(graph2011,"2011 EB lR9","PL");
}
if(ii == 2){
tspec->AddEntry(graph2012,"2012 EE hR9","PL");
tspec->AddEntry(graph2011,"2011 EE hR9","PL");
}
if(ii == 3){
tspec->AddEntry(graph2012,"2012 EE lR9","PL");
tspec->AddEntry(graph2011,"2011 EE lR9","PL");
}
graph2012->Draw("P");
graph2011->Draw("P,same");
tspec->Draw("same");
cplot->Print( (plotDirOut+"/EoP_vs_Et_"+category+".png").c_str(),".png");
// cplot->Print( (plotDirOut+"/"+histoName+".png").c_str(),".png");
}
// tutto EB in 1 plot
std::string f11_h = plotDir+"/results_EB_HIGH_scE_reg_2011.root";
//.........这里部分代码省略.........
示例11: compareplots_noRatio
//.........这里部分代码省略.........
for(size_t i=0;i<histos.size();i++){
histos.at(i)->Sumw2();
histos.at(i)->Scale(1./histos.at(i)->Integral(),"width");
}
// Set axis title
histos.at(0)->GetYaxis()->SetTitle("Normalized units");
std::string const histogramName = histos.at(1)->GetName();
histos.at(0)->GetXaxis()->SetLabelSize(0.05);
histos.at(0)->GetXaxis()->SetLabelOffset(0.006);
histos.at(0)->GetYaxis()->SetLabelSize(0.05);
histos.at(0)->GetYaxis()->SetLabelOffset(0.006);
histos.at(0)->GetXaxis()->SetTitleSize(0.06);
histos.at(0)->GetXaxis()->SetTitleOffset(1.1);
histos.at(0)->GetYaxis()->SetTitleSize(0.06);
histos.at(0)->GetYaxis()->SetTitleOffset(1.15);
histos.at(0)->GetXaxis()->SetTitle(titles.at(run));
run = run+1;
if(run == (3*8)){
run = 0;
}
// If only two histograms per plot make a ratio plot
if(histos.size() == 2)
{
//create main pad
TPad *mainPad = new TPad("","",0.0,0.0,1.0,1.0);
mainPad->SetNumber(1);
mainPad->SetBottomMargin(0.15);
mainPad->SetRightMargin(0.04);
mainPad->SetLeftMargin(0.13);
mainPad->Draw();
gStyle->SetOptTitle(0);
//create ratio pad
/*TPad *ratioPad = new TPad("","",0.0,0.0,1.0,0.3);
ratioPad->SetTopMargin(0.0);
ratioPad->SetBottomMargin(0.4);
ratioPad->SetLeftMargin(0.13);
ratioPad->SetRightMargin(0.04);
gStyle->SetOptTitle(0);
ratioPad->SetFillColor(0);
ratioPad->SetNumber(2);
ratioPad->SetGridy();
ratioPad->Draw();*/
// Draw both histograms first
c->cd(1);
histos.at(0)->Draw("histo E");
histos.at(1)->Draw("histo same E");
// Show legend and statistical tests in first pad
for(size_t i=0;i<histos.size()-1;i=i+2){
double ksresult = histos.at(i)->KolmogorovTest(histos.at(i+1));
ksresult=floor(ksresult*1000+0.5)/1000;
double chi2result =histos.at(i)->Chi2Test(histos.at(i+1),"WW");
chi2result=floor(chi2result*1000+0.5)/1000;
stringstream ss;
//ss << " KS: " <<std::setprecision(3) << ksresult << " chi2: " <<std::setprecision(3) << chi2result << " Private Work";
示例12: fit
//.........这里部分代码省略.........
leg->SetBorderSize(0);
leg->SetTextSize(0.04);
leg->SetTextFont(42);
leg->SetFillStyle(0);
leg->AddEntry(h,"Data","pl");
leg->AddEntry(f,"Fit","l");
leg->AddEntry(mass,"D^{0}+#bar{D^{#lower[0.2]{0}}} Signal","f");
leg->AddEntry(massSwap,"K-#pi swapped","f");
leg->AddEntry(background,"Combinatorial","l");
leg->Draw("same");
TLatex* texCms = new TLatex(0.18,0.93, "#scale[1.25]{CMS} Preliminary");
texCms->SetNDC();
texCms->SetTextAlign(12);
texCms->SetTextSize(0.04);
texCms->SetTextFont(42);
texCms->Draw();
TLatex* texCol = new TLatex(0.96,0.93, Form("%s #sqrt{s_{NN}} = 5.02 TeV",collisionsystem.Data()));
texCol->SetNDC();
texCol->SetTextAlign(32);
texCol->SetTextSize(0.04);
texCol->SetTextFont(42);
texCol->Draw();
TLatex* texPt = new TLatex(0.22,0.78,Form("%.1f < p_{T} < %.1f GeV/c",ptmin,ptmax));
texPt->SetNDC();
texPt->SetTextFont(42);
texPt->SetTextSize(0.04);
texPt->SetLineWidth(2);
texPt->Draw();
TLatex* texY = new TLatex(0.22,0.83,"|y| < 1.0");
texY->SetNDC();
texY->SetTextFont(42);
texY->SetTextSize(0.04);
texY->SetLineWidth(2);
texY->Draw();
TLatex* texYield = new TLatex(0.22,0.73,Form("N_{D} = %.0f #pm %.0f",yield,yieldErr));
texYield->SetNDC();
texYield->SetTextFont(42);
texYield->SetTextSize(0.04);
texYield->SetLineWidth(2);
texYield->Draw();
c->SaveAs(Form("plotFits/DMass_expo_%s_%.0f_%.0f.pdf",collisionsystem.Data(),ptmin,ptmax));
TCanvas* cPull = new TCanvas(Form("cPull_%.0f_%.0f",ptmin,ptmax),"",600,700);
TH1D* hPull = (TH1D*)h->Clone("hPull");
for(int i=0;i<h->GetNbinsX();i++)
{
Double_t nfit = f->Integral(h->GetBinLowEdge(i+1),h->GetBinLowEdge(i+1)+h->GetBinWidth(i+1))/h->GetBinWidth(i+1);
hPull->SetBinContent(i+1,(h->GetBinContent(i+1)-nfit)/h->GetBinError(i+1));
hPull->SetBinError(i+1,0);
}
hPull->SetMinimum(-4.);
hPull->SetMaximum(4.);
hPull->SetYTitle("Pull");
hPull->GetXaxis()->SetTitleOffset(1.);
hPull->GetYaxis()->SetTitleOffset(0.65);
hPull->GetXaxis()->SetLabelOffset(0.007);
hPull->GetYaxis()->SetLabelOffset(0.007);
hPull->GetXaxis()->SetTitleSize(0.12);
hPull->GetYaxis()->SetTitleSize(0.12);
hPull->GetXaxis()->SetLabelSize(0.1);
hPull->GetYaxis()->SetLabelSize(0.1);
hPull->GetYaxis()->SetNdivisions(504);
TLine* lPull = new TLine(1.7, 0, 2., 0);
lPull->SetLineWidth(1);
lPull->SetLineStyle(7);
lPull->SetLineColor(1);
TPad* pFit = new TPad("pFit","",0,0.3,1,1);
pFit->SetBottomMargin(0);
pFit->Draw();
pFit->cd();
h->Draw("e");
background->Draw("same");
mass->Draw("same");
massSwap->Draw("same");
f->Draw("same");
leg->Draw("same");
texCms->Draw();
texCol->Draw();
texPt->Draw();
texY->Draw();
texYield->Draw();
cPull->cd();
TPad* pPull = new TPad("pPull","",0,0,1,0.3);
pPull->SetTopMargin(0);
pPull->SetBottomMargin(0.3);
pPull->Draw();
pPull->cd();
hPull->Draw("p");
lPull->Draw();
cPull->cd();
cPull->SaveAs(Form("plotFits/DMass_expo_%s_%.0f_%.0f_Pull.pdf",collisionsystem.Data(),ptmin,ptmax));
return mass;
}
示例13: Ratio
void Ratio()
{
gStyle->SetOptStat(0);
gStyle->SetOptTitle(0);
double baseline[6]={0.496651, 0.491322, 0.554113, 1.62655-0.03, 1.62818, 1.6321+0.03};
//double baseline[6]={0.571804, 0.567082, 0.592606, 1.63217-0.03, 1.63368, 1.63768+0.03};
double be[6]={0,0,0,0,0,0};
double ratio[6]={0.9834, 0.9849, 0.9864, 0.9282, 0.9086, 0.9571};
//0.9834_0.0069 & 0.9849_0.0069 & 0.9864_0.0073 & 0.9282_0.0160 & 0.9086_0.0161 & 0.9571_0.0166
double ratioe[6]={0.0069, 0.0069, 0.0073, 0.0160, 0.0161, 0.0166};
double t13 = 8.78022e-02;
double t13e = 1.63739e-02;
double chi2 = 4.54385;
double x[6],y[4];
x[0] = 0;
x[1] = t13 - 3.2*t13e;
x[2] = t13 - t13e;
x[3] = t13 + t13e;
x[4] = t13 + 3.1*t13e;
x[5] = t13 + 5.2*t13e;
y[0] = 0;
y[1] = chi2+1;
y[2] = chi2+9;
y[3] = chi2+25;
TGraphErrors *ratiog = new TGraphErrors(6,baseline, ratio, be, ratioe);
TCanvas* c = new TCanvas("c1","multipads",600,500);
c->SetLeftMargin(0.15);
ratiog->GetYaxis()->SetRangeUser(0.88,1.15);
ratiog->GetXaxis()->SetLimits(0.0,2.0);
ratiog->SetMarkerStyle(25);
ratiog->SetLineColor(4);
ratiog->SetLineWidth(2);
ratiog->GetYaxis()->SetTitle("Measured/Prediction");
ratiog->GetYaxis()->SetTitleOffset(1.5);
ratiog->GetXaxis()->SetTitle("Weighted baseline [km]");
ratiog->Draw("AP");
TLine line;
line.SetLineStyle(2);
line.DrawLine(0,1,2,1);
// Make the red curve
TFile f("result.root");
TH1D * Truth_16 = (TH1D*)f.Get("Truth_13");
int nbins = Truth_16->GetNbinsX();
double emin = Truth_16->GetXaxis()->GetXmin();
double emax = Truth_16->GetXaxis()->GetXmax();
double eng[nbins];
double num[nbins];
for( int b=1; b<=nbins; b++ ) {
eng[b-1] = emin + (emax-emin)/nbins * (b-0.5);
num[b-1] = Truth_16->GetBinContent(b);
//cout<<b<<" "<<eng[b-1]<<" "<<num[b-1]<<endl;
}
TGraph* Disp;
int npt = 30;
double dist[30];
double lost[30];
for( int dc=0; dc<npt; dc++ ) {
dist[ dc ] = 2.0/(npt-1) * dc;
// Calculate the survival probability
double noos=0;
double osci=0;
for(int idx=15; idx<nbins; idx++) {
//cout<<eng[idx]<<endl;
noos += num[idx];
osci += num[idx] * SurvProb(t13, dist[dc]*1000, eng[idx]+0.792);
}
lost[ dc ] = osci/noos;
}
Disp = new TGraph(npt, dist, lost);
Disp->SetLineColor(kRed);
Disp->SetLineWidth(2);
Disp->Draw("lsame");
{
TPad* pad = new TPad("name","Title",0.35, 0.47, 0.96, 0.95);
pad->Draw();
pad->cd();
pad->SetLeftMargin(0.15);
pad->SetBottomMargin(0.15);
TGraph* Graph;
const int n = 20;
double S13[n] = {0.000000, 0.009250, 0.018500, 0.027750, 0.037000, 0.046250, 0.055500, 0.064750, 0.074000, 0.083250, 0.092500, 0.101750, 0.111000, 0.120250, 0.129500, 0.138750, 0.148000, 0.157250, 0.166500, 0.175750};
double Chi[n] = {28.838118, 24.120320, 19.884366, 16.140633, 12.899639, 10.172040, 7.968632, 6.300351, 5.178271, 4.613608, 4.617718, 5.202101, 6.378396, 8.158386, 10.553995, 13.577293, 17.240488, 21.555937, 26.536136, 32.193726};
Graph = new TGraph(n, S13, Chi);
Graph->GetYaxis()->SetRangeUser(0.0, 34.0);
Graph->GetYaxis()->SetTitle("#chi^{2}");
//Graph->GetYaxis()->SetTitleOffset(1.5);
Graph->GetYaxis()->SetLabelSize(0.07);
Graph->GetYaxis()->SetTitleSize(0.07);
//.........这里部分代码省略.........
示例14: DrawGraphs
void SingleAnalysis::DrawGraphs()
{
std::cout << "Drawing graphs" << std::endl;
// special case for erec and deviation
m_pERecCanvas->cd();
TPad *pERecPad = new TPad("ERecPad", "ERecPad", 0.02, 0.37, 0.95, 0.99);
pERecPad->Draw();
pERecPad->cd();
pERecPad->Range(-19.23077,0.01,96.15385,1428.571);
pERecPad->SetFillColor(0);
pERecPad->SetBorderMode(0);
pERecPad->SetBorderSize(2);
pERecPad->SetTickx(1);
pERecPad->SetTicky(1);
pERecPad->SetLeftMargin(0.1666667);
pERecPad->SetRightMargin(0.01);
pERecPad->SetTopMargin(0.02);
pERecPad->SetBottomMargin(0.0);
pERecPad->SetFrameLineWidth(1);
pERecPad->SetFrameBorderMode(0);
m_canvasMultiGraphMap[E_REC].second->Draw("ap");
this->PostDrawMultiGraph(E_REC, m_canvasMultiGraphMap[E_REC].second);
TLegend *pLegend = pERecPad->BuildLegend();
pLegend->SetBorderSize(0);
pLegend->SetLineColor(0);
pLegend->SetLineStyle(0);
pLegend->SetLineWidth(1);
pLegend->SetFillColor(0);
pLegend->SetFillStyle(0);
pLegend->SetTextSize(0.04);
pERecPad->Modified();
m_pERecCanvas->cd();
TPad *pERecDeviationPad = new TPad("ERecDeviationPad", "ERecDeviationPad", 0.02, 0, 0.95, 0.37);
pERecDeviationPad->Draw();
pERecDeviationPad->cd();
pERecDeviationPad->Range(-19.23077,-0.3993507,96.15385,0.25);
pERecDeviationPad->SetFillColor(0);
pERecDeviationPad->SetBorderMode(0);
pERecDeviationPad->SetBorderSize(2);
pERecDeviationPad->SetTickx(1);
pERecDeviationPad->SetTicky(1);
pERecDeviationPad->SetLeftMargin(0.1666667);
pERecDeviationPad->SetRightMargin(0.01);
pERecDeviationPad->SetTopMargin(0);
pERecDeviationPad->SetBottomMargin(0.23);
pERecDeviationPad->SetFrameLineWidth(1);
pERecDeviationPad->SetFrameBorderMode(0);
m_canvasMultiGraphMap[E_REC_DEVIATION].second->Draw("ap");
TF1 *pLin = new TF1("lin", "0", 0, 90);
pLin->SetLineColor(kBlack);
pLin->SetLineWidth(1);
pLin->SetLineStyle(2);
pLin->Draw("same");
this->PostDrawMultiGraph(E_REC_DEVIATION, m_canvasMultiGraphMap[E_REC_DEVIATION].second);
pERecDeviationPad->Modified();
for(CanvasMultiGraphMap::iterator graphIter = m_canvasMultiGraphMap.begin(), graphEndIter = m_canvasMultiGraphMap.end() ;
graphEndIter != graphIter ; ++graphIter)
{
if(graphIter->first == E_REC || graphIter->first == E_REC_DEVIATION)
continue;
graphIter->second.first->cd();
graphIter->second.second->Draw("ap");
this->PostDrawMultiGraph(graphIter->first, graphIter->second.second);
TLegend *pLegend = graphIter->second.first->BuildLegend();
pLegend->SetBorderSize(0);
pLegend->SetLineColor(0);
pLegend->SetLineStyle(1);
pLegend->SetLineWidth(1);
pLegend->SetFillColor(0);
pLegend->SetFillStyle(0);
pLegend->SetTextSize(0.04);
}
}
示例15: Plot_muons
void Plot_muons(){
gStyle->SetOptStat(0);
gStyle->SetOptDate(0);
gStyle->SetOptFit(0111);
int ChComb=1;// 0=Same-charge, 1=Mixed-charge
int kTbin_L=5, kTbin_H=6;
int binKT3=1;//1-2
//TFile *_file0= new TFile("Results/PDC_12a17a_muons_R6.root","READ");
//TFile *_file0= new TFile("Results/PDC_13b2_efix_p1_muons_R2.root","READ");
TFile *_file0= new TFile("Results/PDC_12a17e_muons_R4.root","READ");
TList *MyList=(TList*)_file0->Get("MyList");
_file0->Close();
TH1D *PionCandidates=(TH1D*)MyList->FindObject("fPionCandidates");
PionCandidates->GetXaxis()->SetTitle("PDG code");
//PionCandidates->Draw();
//
TH1D *MuonParentsPrimary=(TH1D*)MyList->FindObject("fMuonParents");
MuonParentsPrimary->GetXaxis()->SetTitle("PDG code");
MuonParentsPrimary->SetFillColor(1);
//MuonParentsPrimary->Draw();
//
TH1D *MuonParentsSecondary=(TH1D*)MyList->FindObject("fSecondaryMuonParents");
MuonParentsSecondary->GetXaxis()->SetTitle("PDG code");
MuonParentsSecondary->SetFillColor(1);
//MuonParentsSecondary->Draw();
//
// M0 R10-R6, M6 for R4, M17 for R2
TH3D *PurityNum_3D = (TH3D*)MyList->FindObject("Explicit2_Charge1_1_Charge2_1_SC_0_M_6_ED_0_Term_1_PIDpurityNum");
TH2D *PurityDen_2D = (TH2D*)MyList->FindObject("Explicit2_Charge1_1_Charge2_1_SC_0_M_6_ED_0_Term_1_PIDpurityDen");
TH1D *PurityNum=PurityNum_3D->ProjectionX("PurityNum",kTbin_L,kTbin_H,1,20);
double PurityNorm=PurityDen_2D->Integral(kTbin_L,kTbin_H,1,20);
PurityNum->Scale(1/PurityNorm);
char *namesAxis[15]={"e-e","e-mu","e-pi","e-k","e-p","mu-mu","mu-pi","mu-k","mu-p","pi-pi","pi-k","pi-p","k-k","k-p","p-p"};
for(int i=1; i<=15; i++) PurityNum->GetXaxis()->SetBinLabel(i, namesAxis[i-1]);
PurityNum->GetXaxis()->SetRange(1,15);
PurityNum->GetYaxis()->SetTitle("Probability");
PurityNum->Draw();
//
//
TCanvas *can = new TCanvas("can", "can",800,0,800,800);// 11,53,700,500
can->SetHighLightColor(2);
gStyle->SetOptFit(0111);
can->SetFillColor(10);//10
can->SetBorderMode(0);
can->SetBorderSize(2);
can->SetFrameFillColor(0);
can->SetFrameBorderMode(0);
can->SetFrameBorderMode(0);
can->cd();
TPad *pad = new TPad("pad","pad",0.,0.,1.,1.);
gPad->SetTickx();
gPad->SetTicky();
pad->SetGridx();
pad->SetGridy();
pad->SetTopMargin(0.02);//0.05
pad->SetRightMargin(0.02);//3e-2
pad->SetBottomMargin(0.1);//0.12
pad->SetLeftMargin(0.1);
pad->Draw();
pad->cd();
TLegend *legend = new TLegend(.5,.65, .9,.95,NULL,"brNDC");//.45 or .4 for x1
legend->SetBorderSize(0);
legend->SetFillColor(0);
legend->SetTextFont(42);
legend->SetTextSize(0.03);
//
TH3D *MuonSmearedNum2_3=(TH3D*)MyList->FindObject("fMuonContamSmearedNum2");
TH3D *MuonSmearedDen2_3=(TH3D*)MyList->FindObject("fMuonContamSmearedDen2");
TH3D *PionNum2_3=(TH3D*)MyList->FindObject("fMuonContamIdealNum2");
TH3D *PionDen2_3=(TH3D*)MyList->FindObject("fMuonContamIdealDen2");
TH3D *PionPionK2_3=(TH3D*)MyList->FindObject("fPionPionK2");
//
TH3D *MuonSmearedNum3_3=(TH3D*)MyList->FindObject("fMuonContamSmearedNum3");
TH3D *MuonSmearedDen3_3=(TH3D*)MyList->FindObject("fMuonContamSmearedDen3");
TH3D *PionNum3_3=(TH3D*)MyList->FindObject("fMuonContamIdealNum3");
TH3D *PionDen3_3=(TH3D*)MyList->FindObject("fMuonContamIdealDen3");
TH3D *PionPionK3_3=(TH3D*)MyList->FindObject("fPionPionK3");
TH3D *MuonPionK3_3=(TH3D*)MyList->FindObject("fMuonPionK3");
TH1D *MuonSmearedNum2[2];// SC/MC
TH1D *MuonSmearedDen2[2];
TH1D *PionNum2[2];
TH1D *PionDen2[2];
TH1D *PionPionK2[2];
//
TH1D *MuonSmearedNum3[2];// SC/MC
TH1D *MuonSmearedDen3[2];
TH1D *PionNum3[2];
TH1D *PionDen3[2];
TH1D *PionPionK3[2];
//
TH1D *C2muonSmeared[2];
TH1D *C2pion[2];
//.........这里部分代码省略.........