本文整理汇总了C++中TVirtualPad::SetTopMargin方法的典型用法代码示例。如果您正苦于以下问题:C++ TVirtualPad::SetTopMargin方法的具体用法?C++ TVirtualPad::SetTopMargin怎么用?C++ TVirtualPad::SetTopMargin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TVirtualPad
的用法示例。
在下文中一共展示了TVirtualPad::SetTopMargin方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeqaplot
void makeqaplot(int run=0, int plt=0, int save=0){
runnum=run;
yearday=run/1000;
if(save==0) {png=0; pdf=0;}
if(save==1) {png=1; pdf=0;}
if(save==2) {png=0; pdf=1;}
if(save==3) {png=1; pdf=1;}
c1 = new TCanvas("c1","QA",50,50,800,800);
gStyle->SetLabelSize(0.04,"xy");
//colortable();
gStyle->SetPalette(1);
gStyle->SetStatW(0.4);
char fname[50];
if(run==0) {sprintf(fname,"fgtQA.root");}
else {sprintf(fname,"%d/fgtQA_%d.root",yearday,run);}
cout << "Opening "<<fname<<endl;
file=new TFile(fname,"");
char c[50];
if(plt==0 || plt==1) {
gStyle->SetOptStat(111110);
c1->Divide(1,3);
for(int i=0; i<3; i++){
TVirtualPad* pad = c1->cd(i+1);
int log=0;
if(i>0) {log=1;}
pad->SetLogy(log);
hist0[i]=(TH1F*) file->Get(cHist[i]);
hist0[i]->SetFillColor(kBlue);
hist0[i]->Draw();
if(i==2){
float ntot = float(hist0[i]->GetEntries());
if(ntot>0.0){
int nbin = hist0[i]->GetNbinsX();
float nofgt = hist0[i]->Integral(1,1);
int bin = hist0[i]->FindBin(float(kFgtNumElecIds));
float nonzs = hist0[i]->Integral(bin-1,nbin+1);
float zs = hist0[i]->Integral(2,bin-2);
hist0[i]->GetXaxis()->SetRange(2, bin-2);
float mean = hist0[i]->GetMean() / float(kFgtNumElecIds);
char c[100];
sprintf(c,"Total %d",ntot); TText *t1 = new TText(0.3,0.8,c); t1->SetNDC(); t1->SetTextSize(0.06); t1->Draw();
sprintf(c,"NoFGT %d (%5.2f)",nofgt,nofgt/ntot); TText *t2 = new TText(0.3,0.7,c); t2->SetNDC(); t2->SetTextSize(0.06); t2->Draw();
sprintf(c,"NoneZS %d (%5.2f)",nonzs,nonzs/ntot); TText *t3 = new TText(0.3,0.6,c); t3->SetNDC(); t3->SetTextSize(0.06); t3->Draw();
sprintf(c,"ZS %d (%5.2f)",zs,zs/ntot); TText *t4 = new TText(0.3,0.5,c); t4->SetNDC(); t4->SetTextSize(0.06); t4->Draw();
sprintf(c,"Mean ZS data size/fullsize= %5.3f",mean); TText *t5 = new TText(0.3,0.4,c); t5->SetNDC(); t5->SetTextSize(0.06); t5->Draw();
if(mean>0.08) { t5->SetTextColor(2); }
else { t5->SetTextColor(4); }
}
}
}
c1->Update();
save("plot");
}
if(plt==0 || plt==2) {
c1->Clear();
gStyle->SetOptStat(0);
gStyle->SetOptTitle(0);
c1->Divide(1,3);
for(int i=3; i<6; i++){ hist0[i]=(TH1F*) file->Get(cHist[i]); }
int nevt=hist0[5]->GetEntries();
printf("Nevent=%d\n",nevt);
TVirtualPad* pad;
pad=c1->cd(1); pad->SetLogy(); pad->SetTopMargin(0.01); pad->SetRightMargin(0.01);
hist0[3]->GetXaxis()->SetLabelSize(0.07); hist0[3]->GetYaxis()->SetLabelSize(0.07);
hist0[3]->SetFillColor(kRed); hist0[3]->Scale(1/float(nevt)); hist0[3]->Draw();
TText *tx= new TText(0.87,0.0,"EleID"); tx->SetNDC(); tx->SetTextSize(0.1); tx->Draw();
TText *t3= new TText(0.05,0.1,"F3=frac in 3sig/2tb"); t3->SetNDC(); t3->SetTextSize(0.08); t3->SetTextAngle(90); t3->Draw();
pad=c1->cd(2); pad->SetLogy(); pad->SetTopMargin(0.01); pad->SetRightMargin(0.01);
hist0[4]->GetXaxis()->SetLabelSize(0.07); hist0[4]->GetYaxis()->SetLabelSize(0.07);
hist0[4]->SetFillColor(kBlue); hist0[4]->Scale(1/float(nevt)); hist0[4]->Draw();
tx->Draw();
TText *t4= new TText(0.05,0.1,"F10=frac in 10sig & >500"); t4->SetNDC(); t4->SetTextSize(0.08); t4->SetTextAngle(90); t4->Draw();
float min=-4;
int max=hist0[3]->GetNbinsX();
printf("Max=%d\n",max);
TH1F *h1 = new TH1F("ZSdataFrac","ZSdataFrac",50,min,0);
TH1F *h2 = new TH1F("10SigmaFrac","10SigmaFrac",50,min,0);
float f1[kFgtNumElecIds],f2[kFgtNumElecIds];
for(int i=0; i<max; i++){
f1[i] = log10(hist0[3]->GetBinContent(i+1)); if(f1[i]<min) {f1[i]=min;} h1->Fill(f1[i]);
f2[i] = log10(hist0[4]->GetBinContent(i+1)); if(f2[i]<min) {f2[i]=min;} h2->Fill(f2[i]);
}
pad = c1->cd(3); pad->Divide(2,1);
TVirtualPad *pad2;
pad2 = pad->cd(1);
pad2->SetLogy(); pad2->SetTopMargin(0.01); pad2->SetRightMargin(0.01);
h1->GetXaxis()->SetLabelSize(0.1); h1->GetYaxis()->SetLabelSize(0.1);
h2->GetXaxis()->SetLabelSize(0.1); h2->GetYaxis()->SetLabelSize(0.1);
h1->SetLineColor(kRed); h2->SetLineColor(kBlue);
if(h1->GetMaximum()>h2->GetMaximum()){
h1->Draw(); h2->Draw("SAME");
}else{
h2->Draw(); h1->Draw("SAME");
}
//.........这里部分代码省略.........
示例2: MakeIntegerAxis
//.........这里部分代码省略.........
// Fill into our base histogram
base->Fill(iEta, iPhi, m);
// Fill into poisson calculator
c->Fill(iEta, iPhi, m > 0, (useWeights ? m : 1));
}
}
// Calculate the result
TH2D* res = c->Result(correct);
// Now loop and compare
Double_t mBase = 0;
Double_t mPois = 0;
for (Int_t iEta = 0; iEta < nBin; iEta++) {
for (Int_t iPhi = 0; iPhi < nBin; iPhi++) {
Double_t p = res->GetBinContent(iEta, iPhi);
Double_t t = base->GetBinContent(iEta, iPhi);
mBase += t;
mPois += p;
corr->Fill(t, p);
diff->Fill(p-t);
}
}
Int_t nn = nBin * nBin;
mean->Fill(mBase / nn, mPois / nn);
}
TCanvas* cc = new TCanvas("c", "c", 900, 900);
cc->SetFillColor(0);
cc->SetFillStyle(0);
cc->SetBorderMode(0);
cc->SetRightMargin(0.02);
cc->SetTopMargin(0.02);
cc->Divide(2,2);
TVirtualPad* pp = cc->cd(1);
pp->SetFillColor(0);
pp->SetFillStyle(0);
pp->SetBorderMode(0);
pp->SetRightMargin(0.15);
pp->SetTopMargin(0.02);
pp->SetLogz();
pp->SetGridx();
pp->SetGridy();
corr->Draw();
lcorr->Draw();
pp = cc->cd(2);
pp->SetFillColor(0);
pp->SetFillStyle(0);
pp->SetBorderMode(0);
pp->SetRightMargin(0.02);
pp->SetTopMargin(0.02);
#if 0
c->GetMean()->Draw();
#elif 1
pp->SetLogy();
diff->Draw();
#elif 1
c->GetOccupancy()->Draw();
#else
pp->SetLogy();
dist->SetStats(0);
dist->Scale(1. / dist->Integral());
dist->Draw();
示例3: validation
//.........这里部分代码省略.........
legMap[it->first]->SetFillColor(0);
legMap[it->first]->SetTextFont(42);
legMap[it->first]->AddEntry(h1Map[it->first+"o"],"Official Z'_{SSM}","F");
legMap[it->first]->AddEntry(hDY,"Official DY#mu#mu","lep");
legMap[it->first]->AddEntry(h1Map[it->first+"t"],"ME^{2} method: Template w/o couplings scale","lep");
if(it->first=="2000")
{
legMap[it->first]->AddEntry(h1Template,"ME^{2} method: Template histogram at #it{g=1} (SSM)","lep");
legMap[it->first]->AddEntry(graphSSM, "ME^{2} method: Template function at #it{g=1} (SSM)","p");
legMap[it->first]->AddEntry(graphDY, "ME^{2} method: Template function at #it{g=0} (DY)","p");
}
if(!doTruth)
{
h1dTlvTmpltMap[it->first]->SetLineColor(kCyan+2);
h1dTlvTmpltMap[it->first]->SetMarkerColor(kCyan+2);
h1dTlvTmpltMap[it->first]->SetMarkerStyle(5);
h1dTlvTmpltMap[it->first]->SetMarkerSize(0.5);
legMap[it->first]->AddEntry(h1dTlvTmpltMap[it->first],"ME^{2} method: DY+Template (no interference)","p");
h1dBrandeisTmpltMap[it->first]->SetLineColor(kRed);
h1dBrandeisTmpltMap[it->first]->SetMarkerColor(kRed);
h1dBrandeisTmpltMap[it->first]->SetMarkerStyle(27);
h1dBrandeisTmpltMap[it->first]->SetMarkerSize(0.5);
legMap[it->first]->AddEntry(h1dBrandeisTmpltMap[it->first],"Flat Z' method: DY+Template (no interference)","p");
}
it->second->Divide(1,2);
TVirtualPad* ph = it->second->cd(1);
TVirtualPad* pr = it->second->cd(2);
ph->SetPad(0.00, 0.35, 1.00, 1.00);
pr->SetPad(0.00, 0.00, 1.00, 0.35);
ph->SetBottomMargin(0.012);
pr->SetBottomMargin(0.20);
pr->SetTopMargin(0.012);
ph->cd();
ph->Draw();
ph->SetTicks(1,1);
ph->SetLogy();
ph->SetLogx();
// h1Map[it->first+"o"]->SetMaximum( h1Map[it->first+"t"]->GetMaximum()*1.5 );
// h1Map[it->first+"o"]->Draw();
TH1D* hTmpNoErr = (TH1D*)resetErrors(h1Map[it->first+"o"])->Clone();
hTmpNoErr->SetMaximum( h1Map[it->first+"t"]->GetMaximum()*1.5 );
hTmpNoErr->SetLineStyle(1);
hTmpNoErr->SetLineColor(kBlack);
hTmpNoErr->SetFillColor(kAzure-9);
hTmpNoErr->Draw();
TH1D* hTmpErr = (TH1D*)ShiftLog(h1Map[it->first+"o"],0.2)->Clone();
hTmpErr->SetFillStyle(4000); //will be transparent
hTmpErr->SetFillColor(0);
hTmpErr->DrawCopy("epx0SAMES");
hDY->Draw("SAMES");
h1Map[it->first+"t"]->Draw("epSAMES");
//poissonGraphMap[it->first]->Draw("pSAMES");
if(it->first=="2000")
{
graphDY->Draw("SAMESp");
graphSSM->Draw("SAMESp");
h1Template->Draw("epSAMES");
}
_INFO("");
h1dTlvTmpltMap[it->first]->Draw("SAMESp");
h1dBrandeisTmpltMap[it->first]->Draw("SAMESp");
TLine* chopline = new TLine(0.12805,getYmin(h1Map[it->first+"o"]),0.12805,7.e5);
示例4: draw_R2m
void draw_R2m(void)
{
const double er[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
double ccnt[9];
double eccnt[9];
double dcnt[9];
TGraphErrors *gr;
TGraphErrors *grd;
TH1D *hst;
TH1D *hstd;
double effUp, effDown, C, shift, size;
double eeffUp, eeffDown, eC, eshift, esize;
double fmin, fedm, errdef;
int npari, nparx;
int i, irc;
char str[1024];
TF1 *fR2;
TVirtualPad *pd;
gStyle->SetOptStat(0);
gStyle->SetOptFit(0);
MyMinuit = new TMinuit(5);
MyMinuit->SetFCN(chi2fun);
MyMinuit->DefineParameter(0, "Const", 1000, 10, 0, 1E10);
MyMinuit->DefineParameter(1, "EffUp", 1, 0.1, 0.5, 1.5);
MyMinuit->DefineParameter(2, "EffDown", 1, 0.1, 0.5, 1.5);
MyMinuit->DefineParameter(3, "Shift", 0, 0.1, -10, 10);
MyMinuit->DefineParameter(4, "Size", 3, 1, 0, 10);
MyMinuit->FixParameter(3);
MyMinuit->FixParameter(4);
MyMinuit->Migrad();
MyMinuit->GetParameter(0, C, eC);
MyMinuit->GetParameter(1, effUp, eeffUp);
MyMinuit->GetParameter(2, effDown, eeffDown);
MyMinuit->GetParameter(3, shift, eshift);
MyMinuit->GetParameter(4, size, esize);
MyMinuit->mnstat(fmin, fedm, errdef, npari, nparx, irc);
// Renorm top and bottom sections to the middle
for (i=0; i<3; i++) {
ccnt[i] = DataArray.cnt[i] / effUp;
ccnt[i+3] = DataArray.cnt[i+3];
ccnt[i+6] = DataArray.cnt[i+6] / effDown;
eccnt[i] = DataArray.ecnt[i] / effUp;
eccnt[i+3] = DataArray.ecnt[i+3];
eccnt[i+6] = DataArray.ecnt[i+6] / effDown;
}
// for (i=0; i<9; i++) printf("L = %8.3f CNT = %6.1f +- %4.1f\n", r[i], cnt[i], ecnt[i]);
gr = new TGraphErrors(9, DataArray.r, ccnt, er, eccnt);
gr->SetLineColor(kBlue);
gr->SetLineWidth(4);
gr->SetMarkerStyle(20);
gr->SetMarkerColor(kBlue);
gr->SetMarkerSize(2);
fR2 = new TF1("fR2", "[0] / ((x - [1]) * (x - [1]) - [2] * [2] / 4.0)", 1, 100);
fR2->SetParameter(0, C);
fR2->SetParameter(1, shift);
fR2->SetParameter(2, size);
fR2->SetLineColor(kRed);
fR2->SetLineWidth(3);
hst = new TH1D("H", ";Distance to reactor core center, m;Events per day", 35, 10, 13.5);
hst->SetMinimum(DataArray.cnt[4] * 0.5);
hst->SetMaximum(DataArray.cnt[4] * 1.5);
hst->GetXaxis()->SetLabelSize(0.06);
hst->GetYaxis()->SetLabelSize(0.06);
hst->GetXaxis()->SetTitleSize(0.06);
hst->GetYaxis()->SetTitleSize(0.06);
hst->GetYaxis()->SetTitleOffset(1.25);
hstd = new TH1D("H", ";Distance to reactor core center, m;Events per day", 35, 10, 13.5);
hstd->SetMinimum(-40);
hstd->SetMaximum(40);
hstd->GetXaxis()->SetLabelSize(0.06);
hstd->GetYaxis()->SetLabelSize(0.06);
hstd->GetXaxis()->SetTitleSize(0.06);
hstd->GetYaxis()->SetTitleSize(0.06);
hstd->GetYaxis()->SetTitleOffset(1.25);
TCanvas *cv = new TCanvas("CV", "R2", 800, 1200);
cv->Divide(1, 2);
// Do common fit and draw
pd = cv->cd(1);
pd->SetLeftMargin(0.15);
pd->SetBottomMargin(0.15);
pd->SetTopMargin(0.03);
hst->Draw();
gr->Draw("p");
fR2->Draw("same");
TLatex txt;
txt.SetTextSize(0.07);
sprintf(str, "#chi^{2}/n.d.f. = %6.2f/5", fmin);
txt.DrawLatex(11.3, DataArray.cnt[4] * 1.3, str);
// Draw difference
for (i=0; i<9; i++) dcnt[i] = ccnt[i] - fR2->Eval(DataArray.r[i]);
grd = new TGraphErrors(9, DataArray.r, dcnt, er, eccnt);
grd->SetLineColor(kBlue);
grd->SetLineWidth(4);
//.........这里部分代码省略.........
示例5: plotParEvolution
///
/// Plot the evolution of best fit nuisance paramters
/// along the 1-CL curve.
///
/// By changing the code at the beginning of the function
/// one can chose whether all scan results are plotted, or
/// only those comprising the 1-CL curve.
///
void ParameterEvolutionPlotter::plotParEvolution()
{
vector<RooSlimFitResult*> results = allResults;
// vector<RooSlimFitResult*> results = curveResults;
cout << "ParameterEvolutionPlotter::plotParEvolution() : plotting ..." << endl;
selectNewCanvas(title+" 1");
// get all parameters, loop over them
TIterator* it = w->set(parsName)->createIterator();
while ( RooRealVar* p = (RooRealVar*)it->Next() )
{
if ( p->isConstant() && p->GetName()!=scanVar1 ) continue;
if ( arg->debug ) cout << "ParameterEvolutionPlotter::plotParEvolution() : var = " << p->GetName() << endl;
TVirtualPad *pad = selectNewPad();
pad->SetLeftMargin(0.25);
pad->SetTopMargin(0.10);
// create a graph of the nominal evolution of one parameter
TGraph *g = makeEvolutionGraph(curveResults, p->GetName());
g->SetTitle(p->GetTitle());
g->GetXaxis()->SetTitle(scanVar1);
g->GetXaxis()->SetTitleSize(0.08);
g->GetXaxis()->SetLabelSize(0.06);
g->GetXaxis()->SetNdivisions(-406);
g->GetYaxis()->SetTitleSize(0.08);
g->GetYaxis()->SetLabelSize(0.06);
g->GetYaxis()->SetTitleOffset(1.4);
g->GetYaxis()->SetTitle(p->GetName());
g->SetLineColor(kBlue);
g->SetLineWidth(2);
TGaxis::SetMaxDigits(3); // forces scienfific notation
g->Draw("al");
// add error bands
TGraphErrors *g2 = makeEvolutionGraphErrors(curveResults, p->GetName());
g2->SetFillColorAlpha(kBlue,0.15);
g2->Draw("3");
// create a graph of the full evolution of one parameter
if ( arg->isQuickhack(16) ){
TGraph *g3 = makeEvolutionGraph(allResults, p->GetName());
g3->Draw("p");
}
updateCurrentCanvas();
// plot a red line at minimum
drawLinesAtMinima(pad);
}
// plot the chi2 to the last pad
TVirtualPad *pad = selectNewPad();
pad->SetLeftMargin(0.25);
TGraph *g = makeChi2Graph(curveResults);
g->SetLineWidth(2);
g->SetTitle("chi2");
g->GetXaxis()->SetTitle(scanVar1);
g->GetXaxis()->SetTitleSize(0.08);
g->GetXaxis()->SetLabelSize(0.06);
g->GetXaxis()->SetNdivisions(-406);
g->GetYaxis()->SetTitleSize(0.08);
g->GetYaxis()->SetLabelSize(0.06);
g->GetYaxis()->SetTitleOffset(1.4);
g->GetYaxis()->SetTitle("#chi^{2}");
g->Draw("al");
drawLinesAtMinima(pad);
updateCurrentCanvas();
// save plots
saveEvolutionPlots();
}
示例6: Error
/**
* Draw the Poisson estimate of the occupancy
*
* @param filename Input file name
* @param folder Input folder name in file
*
* @deprecated Use QATrender instead
* @ingroup pwglf_forward_scripts_qa
*/
void
DrawOccupancy(const char* filename="forward.root",
const char* folder="ForwardResults")
{
gStyle->SetPalette(1);
gStyle->SetOptFit(0);
gStyle->SetOptStat(0);
gStyle->SetOptTitle(0);
gStyle->SetTitleW(.4);
gStyle->SetTitleH(.1);
gStyle->SetTitleX(.4);
// gStyle->SetTitleY(.1);
gStyle->SetTitleColor(0);
gStyle->SetTitleStyle(0);
gStyle->SetTitleBorderSize(0);
TFile* file = TFile::Open(filename, "READ");
if (!file) {
Error("DrawOccupancy", "failed to open %s", filename);
return;
}
TList* forward = static_cast<TList*>(file->Get(folder));
if (!forward) {
Error("DrawOccupancy", "List %s not found in %s", folder, filename);
return;
}
TList* dc = static_cast<TList*>(forward->FindObject("fmdDensityCalculator"));
if (!dc) {
Error("DrawOccupancy", "List fmdDensityCalculator not found in Forward");
return;
}
TCanvas* c = new TCanvas("occupancy",
"Mean Occupancy", 900, 700);
c->SetFillColor(0);
c->SetBorderSize(0);
c->SetBorderMode(0);
c->SetHighLightColor(0);
c->SetBottomMargin(.15);
c->SetTopMargin(.02);
c->SetRightMargin(.02);
c->SetLeftMargin(.15);
c->Divide(3, 2, 0, 0);
Double_t corrs[5];
c->cd(1); corrs[0] = DrawRingOccupancy(dc, 1, 'I');
c->cd(2); corrs[1] = DrawRingOccupancy(dc, 2, 'I');
c->cd(5); corrs[2] = DrawRingOccupancy(dc, 2, 'O');
c->cd(3); corrs[3] = DrawRingOccupancy(dc, 3, 'I');
c->cd(6); corrs[4] = DrawRingOccupancy(dc, 3, 'O');
TVirtualPad* p = c->cd(4);
p->SetTopMargin(0.05);
p->SetRightMargin(0.10);
p->SetLeftMargin(0.15);
p->SetBottomMargin(0.15);
p->SetFillColor(0);
TH1D* hc = new TH1D("occ", "Mean occupancy", 5, .5, 5.5);
hc->SetFillColor(kRed+1);
hc->SetFillStyle(3001);
hc->SetMinimum(0.0);
hc->GetXaxis()->SetBinLabel(1,"FMD1i"); hc->SetBinContent(1,corrs[0]);
hc->GetXaxis()->SetBinLabel(2,"FMD2i"); hc->SetBinContent(2,corrs[1]);
hc->GetXaxis()->SetBinLabel(3,"FMD2o"); hc->SetBinContent(3,corrs[2]);
hc->GetXaxis()->SetBinLabel(4,"FMD3i"); hc->SetBinContent(4,corrs[3]);
hc->GetXaxis()->SetBinLabel(5,"FMD3o"); hc->SetBinContent(5,corrs[4]);
hc->GetXaxis()->SetLabelSize(0.08);
hc->GetYaxis()->SetTitle("#bar{occupancy}");
hc->SetMarkerSize(1.5);
hc->Draw("text hist");
hc->SetMaximum(hc->GetMaximum()*1.5);
// TH2D* highCuts = static_cast<TH2D*>(dc->FindObject("highCuts"));
// if (highCuts) highCuts->Draw("colz");
c->cd();
c->SaveAs("occupancy.png");
}
示例7: make_v2_graphs
//.........这里部分代码省略.........
trig_dec_sys[i] = new TGraphErrors(4,pt_trig,dec_v2[i],pt_trig_err,dec_v2_sys[i]);
trig_dec_sys[i]->SetName(name.str().c_str());
trig_dec_sys[i]->SetTitle(name.str().c_str());
trig_dec_sys[i]->Write();
name.str("");
name << "pi0_v2_" << i;
trig_pi0_v2[i] = new TGraphErrors(4,pt_trig,pi0_v2[i],pt_trig_err,pi0_v2_err[i]);
trig_pi0_v2[i]->SetName(name.str().c_str());
trig_pi0_v2[i]->SetTitle(name.str().c_str());
trig_pi0_v2[i]->Write();
name.str("");
name << "pi0_v2sys_" << i;
trig_pi0_sys[i] = new TGraphErrors(4,pt_trig,pi0_v2[i],pt_trig_err,pi0_v2_sys[i]);
trig_pi0_sys[i]->SetName(name.str().c_str());
trig_pi0_sys[i]->SetTitle(name.str().c_str());
trig_pi0_sys[i]->Write();
name.str("");
name << "hadron_v2_" << i;
hassoc_v2[i] = new TGraphErrors(5,pt_assoc,hadron_v2[i],pt_assoc_err,hadron_v2_err[i]);
hassoc_v2[i]->SetName(name.str().c_str());
hassoc_v2[i]->SetTitle(name.str().c_str());
hassoc_v2[i]->Write();
name.str("");
name << "hadron_v2sys_" << i;
hassoc_sys[i] = new TGraphErrors(5,pt_assoc,hadron_v2[i],pt_assoc_err,hadron_v2_sys[i]);
hassoc_sys[i]->SetName(name.str().c_str());
hassoc_sys[i]->SetTitle(name.str().c_str());
hassoc_sys[i]->Write();
}
int cent[5] = {0,20,40,60,90};
int color[4] = {kBlack,kRed,kBlue,kViolet-7};
int sys_color[4] = {kGray,kRed-9,kBlue-9,kViolet-9};
TCanvas* can = new TCanvas("can","can");
can->Divide(2,2,0.001,0.001);
TH1D* thisto = new TH1D("thisto",";p^{#gamma}_{T} ;v_{2} ",100,0.0,15.0);
thisto->SetAxisRange(0.0,0.75,"Y");
thisto->SetAxisRange(4.5,14.0,"X");
TH1D* ahisto = new TH1D("ahisto",";p^{h}_{T} ;v_{2} ",100,0.0,15.0);
ahisto->SetAxisRange(0.0,0.75,"Y");
ahisto->SetAxisRange(0.0,6.0,"X");
for( int i = 0; i < 4; i++ )
{
TVirtualPad* pad = can->cd(i+1);
pad->SetRightMargin(0.01);
pad->SetTopMargin(0.01);
if( i < 3 ) thisto->Draw();
else ahisto->Draw();
}
TLegend* leg = new TLegend(0.5,0.5,0.9,0.9);
leg->SetBorderSize(0);
leg->SetFillColor(0);
for( int ic = 0; ic < 4; ic++ )
{
can->cd(1);
trig_inc_sys[ic]->SetMarkerSize(0);
trig_inc_sys[ic]->SetLineWidth(10);
trig_inc_sys[ic]->SetLineColor(sys_color[ic]);
trig_inc_sys[ic]->Draw("E1,Psame");
trig_inc_v2[ic]->SetMarkerColor(color[ic]);
trig_inc_v2[ic]->SetLineColor(color[ic]);
trig_inc_v2[ic]->Draw("Psame");
// trig_inc_v2[ic]->Write();
// trig_inc_sys[ic]->Write();
can->cd(2);
trig_dec_sys[ic]->SetMarkerSize(0);
trig_dec_sys[ic]->SetLineWidth(10);
trig_dec_sys[ic]->SetLineColor(sys_color[ic]);
trig_dec_sys[ic]->Draw("E1,Psame");
trig_dec_v2[ic]->SetMarkerColor(color[ic]);
trig_dec_v2[ic]->SetLineColor(color[ic]);
trig_dec_v2[ic]->Draw("Psame");
can->cd(3);
trig_pi0_sys[ic]->SetMarkerSize(0);
trig_pi0_sys[ic]->SetLineWidth(10);
trig_pi0_sys[ic]->SetLineColor(sys_color[ic]);
trig_pi0_sys[ic]->Draw("E1,Psame");
trig_pi0_v2[ic]->SetMarkerColor(color[ic]);
trig_pi0_v2[ic]->SetLineColor(color[ic]);
trig_pi0_v2[ic]->Draw("Psame");
can->cd(4);
hassoc_sys[ic]->SetMarkerSize(0);
hassoc_sys[ic]->SetLineWidth(10);
hassoc_sys[ic]->SetLineColor(sys_color[ic]);
hassoc_sys[ic]->Draw("E1,Psame");
hassoc_v2[ic]->SetMarkerColor(color[ic]);
hassoc_v2[ic]->SetLineColor(color[ic]);
hassoc_v2[ic]->Draw("Psame");
name.str("");
name << cent[ic] << " - " << cent[ic+1] << "%";
leg->AddEntry(trig_inc_v2[ic],name.str().c_str(),"P");
}
leg->Draw();
can->Write();
}
示例8: EstimateBg_76X
//.........这里部分代码省略.........
TCanvas *can = (TCanvas*)(f->Get(canname.c_str()));
can = (TCanvas*)can->Clone();
can->Draw();
TH1D *h_side = (TH1D*)can->GetListOfPrimitives()->At(i_h_side[iMethod]);
TH1D *h_signal = (TH1D*)can->GetListOfPrimitives()->At(i_h_signal[iMethod]);
// Simulate different cross section by scaling a certain background
if (iMethod==1) {
TH1D *h_side_temp_scaled = (TH1D*)h_side->Clone(); h_side_temp_scaled->Scale(scale_factors[iSample]);
TH1D *h_signal_temp_scaled = (TH1D*)h_signal->Clone(); h_signal_temp_scaled->Scale(scale_factors[iSample]);
if (iSample==0) {
h_side_sum = h_side_temp_scaled;
h_signal_sum = h_signal_temp_scaled;
} else {
h_side_sum->Add(h_side_temp_scaled);
h_signal_sum->Add(h_signal_temp_scaled);
}
} else if (iMethod==2) {
h_side = h_side_sum;
h_signal = h_signal_sum;
}
TH1D *h_pred =(TH1D*)h_side->Clone();
if (iMethod!=0&&rebin>1) { h_side->Rebin(rebin); h_signal->Rebin(rebin); h_pred->Rebin(rebin); }
TLegend *leg = (TLegend*)can->GetListOfPrimitives()->At(can->GetListOfPrimitives()->GetEntries()-1);
leg->SetX1(0.35); leg->SetX2(0.65); leg->SetY1(0.6);
// Add ratio plot
int y1 = 350;
int y2 = 150;
int mid2 = 10;
can->Divide(1,2);
// Pad 1 (80+500+20 x 40+500)
TVirtualPad* p = can->cd(1);
p->SetPad(0,(y2+60+mid2)/(y1+y2+100.0+mid2),1,1);
p->SetTopMargin(40.0/(y1+40));
p->SetBottomMargin(0);
p->SetRightMargin(0.05);
p->SetLogy(1);
h_side->GetYaxis()->SetRangeUser(1.00001e-4,1e4);
h_side->Draw("HIST");
h_signal->Draw("SAMEHISTE1");
leg->Draw();
// Pad 2 (80+500+20 x 200+60)
p = can->cd(2);
p->SetGrid(0,1);
p->SetPad(0,0,1,(y2+60+mid2)/(y1+y2+100.0+mid2));
p->SetTopMargin(((float)mid2)/(y2+60+mid2));
p->SetBottomMargin(60.0/(y2+60+mid2));
p->SetRightMargin(0.05);
TH1D* ratio = (TH1D*)h_signal->Clone();
TH1D* div = (TH1D*)h_side->Clone();
//ratio->Scale(1/ratio->GetSumOfWeights());
double sum_bins_ratio = iMethod==0 ? ratio->Integral():
ratio->Integral(ratio->FindBin(R_CUT_LOW),ratio->FindBin(Rranges_ABCD[iMethod][3]));
ratio->Scale(1/sum_bins_ratio);
ratio->SetTitleSize(32.0/(y2+60+mid2),"xyz");
ratio->SetLabelSize(20.0/(y2+60+mid2),"xyz");
//ratio->Scale(1/div->GetSumOfWeights());
double sum_bins_div = iMethod==0 ? div->Integral():
div->Integral(div->FindBin(R_CUT_LOW),div->FindBin(Rranges_ABCD[iMethod][3]));
div->Scale(1/sum_bins_div);
ratio->Divide(div);
//ratio->GetYaxis()->SetRangeUser(0,2);
ratio->GetXaxis()->SetTitleOffset(0.7);
ratio->GetYaxis()->SetNdivisions(305);
ratio->GetYaxis()->SetTitle("Ratio (Norm.)");
ratio->GetYaxis()->SetTitleOffset(0.4);