当前位置: 首页>>代码示例>>C++>>正文


C++ THStack::SetHistogram方法代码示例

本文整理汇总了C++中THStack::SetHistogram方法的典型用法代码示例。如果您正苦于以下问题:C++ THStack::SetHistogram方法的具体用法?C++ THStack::SetHistogram怎么用?C++ THStack::SetHistogram使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在THStack的用法示例。


在下文中一共展示了THStack::SetHistogram方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: StackPlots

void StackPlots( TFile* f1, vector<string> hist, vector<string> leg, vector<Color_t> color, string xtitle_, string ytitle_, string xunit, string savePath, bool ylog=0, int rebin=1){
	int Bins = 0;
	int x1 = 0;
	int x2 = 0;
	int size = hist.size();
	float binwidth = 0;
	char title[100], xtitle[100], ytitle[100];
	TH1F* h1[size];
	for(int i=0; i<size; i++){
		h1[i] = (TH1F*)f1->Get(hist[i].c_str());
		h1[i]->UseCurrentStyle();
		h1[i]->Rebin(rebin); 
		if( Bins != 0 ){ if( h1[i]->GetXaxis()->GetLast() != Bins ) { cout<<"Error: Exist different bin size( plot: "<<i<<")"<<endl; }}
		Bins = h1[i]->GetXaxis()->GetLast();
		binwidth = h1[i]->GetBinWidth(1);
		x1 = h1[i]->GetXaxis()->GetBinLowEdge(1);
		x2 = h1[i]->GetXaxis()->GetBinUpEdge(Bins);

		h1[i]->SetLineWidth(1);
		h1[i]->SetLineColor(color[i]);
		h1[i]->SetFillColor(color[i]);
	}

	sprintf(xtitle,"%s [%s]",xtitle_.c_str(),xunit.c_str());
	sprintf(ytitle,"%s / [%3.0f%s]",ytitle_.c_str(),binwidth,xunit.c_str());
	sprintf(title,";%s;%s",xtitle,ytitle);
	cout<<Bins<<" "<<x1<<" "<<x2<<endl;
	TH1F* hs_stack = new TH1F("hs_stack",title,Bins,x1,x2);
        THStack *hs = new THStack("hs","");

	TLegend* leg_ = new TLegend(0.65,0.65,0.85,0.85);
	TCanvas* c1 = new TCanvas("c1", "", 850, 700);
        c1->SetGridx();
        c1->SetGridy();
	gStyle->SetOptStat(0);
	gStyle->SetOptTitle(0);
	hs_stack->UseCurrentStyle();
	hs->SetHistogram(hs_stack);	
	for(int i=0; i<size; i++){
		hs->Add(h1[i]);
		leg_->AddEntry(h1[i],leg[i].c_str(),"f");
	}
        leg_->SetFillStyle(0);
        leg_->SetBorderSize(0);
        leg_->SetTextSize(0.042);
	if( ylog ) gPad->SetLogy();
	hs->SetMinimum(1);
	hs->SetMaximum(1e+13);
	hs->Draw();
	leg_->Draw();
	c1->SaveAs(savePath.c_str());
}
开发者ID:alphatsai,项目名称:ABCDCodes,代码行数:52,代码来源:test.C

示例2: GetBkgStack

THStack * GetBkgStack(TFile *f, const char * name, const char * xtitle, TLegend * leg, int mode=0){
   char full_name[200];

   if (leg) {
      leg->SetFillStyle(0);
      leg->SetBorderSize(0);
      leg->SetTextSize(0.04);
   }

   sprintf(full_name, "stack_%s", name);
   THStack * stack = new THStack(full_name, "");

   TH1F * h_base = (TH1F *)f->Get(name);
   h_base->SetXTitle(xtitle);
   stack->SetHistogram(h_base);

   if (mode == 0)
   {
/*
      AddHist(stack, leg, f, name, "vbh_h_zz_4l",   "VV > H > ZZ > 4L",  FILL0, MYGREEN2);
      AddHist(stack, leg, f, name, "gg_zz_4l",      "gg > ZZ > 4L",      FILL0, MYORANGE1);
      AddHist(stack, leg, f, name, "gg_zz_2l2l",    "gg > ZZ > 2L2L",    FILL0, MYBLUE1);
      AddHist(stack, leg, f, name, "qq_zz_2e2mu",   "qq > ZZ > 2e2mu",   FILL0, MYCYAN2);
      AddHist(stack, leg, f, name, "gg_h_zz_4l",    "gg > H > ZZ > 4L",  FILL0, MYMAGENTA2);
      AddHist(stack, leg, f, name, "qq_zz_4e",      "qq > ZZ > 4e",      FILL0, MYGREEN1);   
      AddHist(stack, leg, f, name, "qq_zz_4mu",     "qq > ZZ > 4mu",     FILL0, MYORANGE2);  
      AddHist(stack, leg, f, name, "wh_zh_tth_hzz", "HW HW Htt, H > ZZ", FILL0, MYCYAN1);   
      AddHist(stack, leg, f, name, "wh_zh_tth_hww", "HW HZ Htt, H > WW", FILL0, MYMAGENTA1);
*/
      AddHist(stack, leg, f, name, "zh_hzz",  "HZ, H > ZZ",  FILL0, MYCYAN1);   
      AddHist(stack, leg, f, name, "zh_hww",  "HZ, H > WW",  FILL0, MYMAGENTA1);
      AddHist(stack, leg, f, name, "h_zz_4l", "H > ZZ > 4L", FILL0, MYGREEN2);
      AddHist(stack, leg, f, name, "zz_4l",   "ZZ > 4L",     FILL0, MYBLUE2);
   }
   return stack;
}
开发者ID:dburns7,项目名称:Research,代码行数:36,代码来源:mkplots_13tev.C

示例3: ttbar_isojet1CSV

void ttbar_isojet1CSV()
{
//=========Macro generated from canvas: c1/c1
//=========  (Sun Dec 11 15:16:19 2016) by ROOT version6.06/01
   TCanvas *c1 = new TCanvas("c1", "c1",1,1,1200,1416);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   c1->SetHighLightColor(2);
   c1->Range(0,0,1,1);
   c1->SetFillColor(0);
   c1->SetBorderMode(0);
   c1->SetBorderSize(2);
   c1->SetTickx(1);
   c1->SetTicky(1);
   c1->SetLeftMargin(0.15);
   c1->SetRightMargin(0.05);
   c1->SetTopMargin(0.07);
   c1->SetBottomMargin(0.13);
   c1->SetFrameFillStyle(0);
   c1->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: pad1
   TPad *pad1 = new TPad("pad1", "pad1",0,0.3,1,1);
   pad1->Draw();
   pad1->cd();
   pad1->Range(-0.1875,0,1.0625,0.6289089);
   pad1->SetFillColor(0);
   pad1->SetBorderMode(0);
   pad1->SetBorderSize(2);
   pad1->SetTickx(1);
   pad1->SetTicky(1);
   pad1->SetLeftMargin(0.15);
   pad1->SetRightMargin(0.05);
   pad1->SetTopMargin(0.07);
   pad1->SetBottomMargin(0);
   pad1->SetFrameFillStyle(0);
   pad1->SetFrameBorderMode(0);
   pad1->SetFrameFillStyle(0);
   pad1->SetFrameBorderMode(0);
   
   THStack *h = new THStack();
   h->SetName("h");
   h->SetTitle("");
   h->SetMinimum(0);
   h->SetMaximum(0.5570336);
   
   TH1F *h_stack_23 = new TH1F("h_stack_23","",10,0,1);
   h_stack_23->SetMinimum(0);
   h_stack_23->SetMaximum(0.5848853);
   h_stack_23->SetDirectory(0);
   h_stack_23->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   h_stack_23->SetLineColor(ci);
   h_stack_23->GetXaxis()->SetLabelFont(42);
   h_stack_23->GetXaxis()->SetLabelOffset(0.007);
   h_stack_23->GetXaxis()->SetTitleSize(0.05);
   h_stack_23->GetXaxis()->SetTickLength(0.025);
   h_stack_23->GetXaxis()->SetTitleFont(42);
   h_stack_23->GetYaxis()->SetTitle("a.u.");
   h_stack_23->GetYaxis()->SetLabelFont(42);
   h_stack_23->GetYaxis()->SetLabelOffset(0.007);
   h_stack_23->GetYaxis()->SetTitleSize(0.05);
   h_stack_23->GetYaxis()->SetTickLength(0.025);
   h_stack_23->GetYaxis()->SetTitleOffset(1.5);
   h_stack_23->GetYaxis()->SetTitleFont(42);
   h_stack_23->GetZaxis()->SetLabelFont(42);
   h_stack_23->GetZaxis()->SetLabelOffset(0.007);
   h_stack_23->GetZaxis()->SetTitleSize(0.05);
   h_stack_23->GetZaxis()->SetTickLength(0.025);
   h_stack_23->GetZaxis()->SetTitleFont(42);
   h->SetHistogram(h_stack_23);
   
   
   TH1D *h_isojet1CSV_QCD__265 = new TH1D("h_isojet1CSV_QCD__265","",10,0,1);
   h_isojet1CSV_QCD__265->SetBinContent(1,0.002129117);
   h_isojet1CSV_QCD__265->SetBinContent(2,0.001248327);
   h_isojet1CSV_QCD__265->SetBinContent(3,0.0006205357);
   h_isojet1CSV_QCD__265->SetBinContent(4,0.001430306);
   h_isojet1CSV_QCD__265->SetBinContent(5,0.001031553);
   h_isojet1CSV_QCD__265->SetBinContent(6,0.0005098467);
   h_isojet1CSV_QCD__265->SetBinContent(7,0.0002095089);
   h_isojet1CSV_QCD__265->SetBinContent(8,9.216642e-05);
   h_isojet1CSV_QCD__265->SetBinContent(10,0.004314199);
   h_isojet1CSV_QCD__265->SetBinError(1,0.001510477);
   h_isojet1CSV_QCD__265->SetBinError(2,0.0006911766);
   h_isojet1CSV_QCD__265->SetBinError(3,0.0004578373);
   h_isojet1CSV_QCD__265->SetBinError(4,0.0008388365);
   h_isojet1CSV_QCD__265->SetBinError(5,0.0008715622);
   h_isojet1CSV_QCD__265->SetBinError(6,0.0005098467);
   h_isojet1CSV_QCD__265->SetBinError(7,0.0002095089);
   h_isojet1CSV_QCD__265->SetBinError(8,9.216642e-05);
   h_isojet1CSV_QCD__265->SetBinError(10,0.002213733);
   h_isojet1CSV_QCD__265->SetEntries(25);
   h_isojet1CSV_QCD__265->SetStats(0);

   ci = TColor::GetColor("#cccccc");
   h_isojet1CSV_QCD__265->SetFillColor(ci);
//.........这里部分代码省略.........
开发者ID:sundleeb,项目名称:AN-18-026,代码行数:101,代码来源:ttbar_isojet1CSV.C

示例4: ttbar_looseLep2Pt_logy

void ttbar_looseLep2Pt_logy()
{
//=========Macro generated from canvas: c1/c1
//=========  (Sun Dec 11 15:16:17 2016) by ROOT version6.06/01
   TCanvas *c1 = new TCanvas("c1", "c1",1,1,1200,1416);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   c1->SetHighLightColor(2);
   c1->Range(0,0,1,1);
   c1->SetFillColor(0);
   c1->SetBorderMode(0);
   c1->SetBorderSize(2);
   c1->SetTickx(1);
   c1->SetTicky(1);
   c1->SetLeftMargin(0.15);
   c1->SetRightMargin(0.05);
   c1->SetTopMargin(0.07);
   c1->SetBottomMargin(0.13);
   c1->SetFrameFillStyle(0);
   c1->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: pad1
   TPad *pad1 = new TPad("pad1", "pad1",0,0.3,1,1);
   pad1->Draw();
   pad1->cd();
   pad1->Range(-93.75,-6.459411,531.25,2.538922);
   pad1->SetFillColor(0);
   pad1->SetBorderMode(0);
   pad1->SetBorderSize(2);
   pad1->SetLogy();
   pad1->SetTickx(1);
   pad1->SetTicky(1);
   pad1->SetLeftMargin(0.15);
   pad1->SetRightMargin(0.05);
   pad1->SetTopMargin(0.07);
   pad1->SetBottomMargin(0);
   pad1->SetFrameFillStyle(0);
   pad1->SetFrameBorderMode(0);
   pad1->SetFrameFillStyle(0);
   pad1->SetFrameBorderMode(0);
   
   THStack *h = new THStack();
   h->SetName("h");
   h->SetTitle("");
   h->SetMinimum(1.61613e-06);
   h->SetMaximum(32.94396);
   
   TH1F *h_stack_8 = new TH1F("h_stack_8","",20,0,500);
   h_stack_8->SetMinimum(3.472076e-07);
   h_stack_8->SetMaximum(81.10342);
   h_stack_8->SetDirectory(0);
   h_stack_8->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   h_stack_8->SetLineColor(ci);
   h_stack_8->GetXaxis()->SetLabelFont(42);
   h_stack_8->GetXaxis()->SetLabelOffset(0.007);
   h_stack_8->GetXaxis()->SetTitleSize(0.05);
   h_stack_8->GetXaxis()->SetTickLength(0.025);
   h_stack_8->GetXaxis()->SetTitleFont(42);
   h_stack_8->GetYaxis()->SetTitle("a.u./25 GeV");
   h_stack_8->GetYaxis()->SetLabelFont(42);
   h_stack_8->GetYaxis()->SetLabelOffset(0.007);
   h_stack_8->GetYaxis()->SetTitleSize(0.05);
   h_stack_8->GetYaxis()->SetTickLength(0.025);
   h_stack_8->GetYaxis()->SetTitleOffset(1.5);
   h_stack_8->GetYaxis()->SetTitleFont(42);
   h_stack_8->GetZaxis()->SetLabelFont(42);
   h_stack_8->GetZaxis()->SetLabelOffset(0.007);
   h_stack_8->GetZaxis()->SetTitleSize(0.05);
   h_stack_8->GetZaxis()->SetTickLength(0.025);
   h_stack_8->GetZaxis()->SetTitleFont(42);
   h->SetHistogram(h_stack_8);
   
   
   TH1D *h_looseLep2Pt_QCD__85 = new TH1D("h_looseLep2Pt_QCD__85","",20,0,500);
   h_looseLep2Pt_QCD__85->SetBinContent(1,0.004168645);
   h_looseLep2Pt_QCD__85->SetBinContent(2,0.004299542);
   h_looseLep2Pt_QCD__85->SetBinContent(3,0.001765161);
   h_looseLep2Pt_QCD__85->SetBinContent(4,0.0008868067);
   h_looseLep2Pt_QCD__85->SetBinContent(6,0.0004026872);
   h_looseLep2Pt_QCD__85->SetBinContent(7,6.27175e-05);
   h_looseLep2Pt_QCD__85->SetBinError(1,0.001669574);
   h_looseLep2Pt_QCD__85->SetBinError(2,0.002080688);
   h_looseLep2Pt_QCD__85->SetBinError(3,0.001425843);
   h_looseLep2Pt_QCD__85->SetBinError(4,0.0005754946);
   h_looseLep2Pt_QCD__85->SetBinError(6,0.0004026872);
   h_looseLep2Pt_QCD__85->SetBinError(7,4.443558e-05);
   h_looseLep2Pt_QCD__85->SetEntries(25);
   h_looseLep2Pt_QCD__85->SetStats(0);

   ci = TColor::GetColor("#cccccc");
   h_looseLep2Pt_QCD__85->SetFillColor(ci);
   h_looseLep2Pt_QCD__85->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]");
   h_looseLep2Pt_QCD__85->GetXaxis()->SetLabelFont(42);
   h_looseLep2Pt_QCD__85->GetXaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_QCD__85->GetXaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_QCD__85->GetXaxis()->SetTickLength(0.025);
//.........这里部分代码省略.........
开发者ID:sundleeb,项目名称:AN-18-026,代码行数:101,代码来源:ttbar_looseLep2Pt_logy.C

示例5: runPFSortedJets

int runPFSortedJets(std::string fileName) {

    // Create file on which histogram(s) can be saved.
    TFile *inFile = new TFile(fileName.c_str(), "READ");
    THStack* partFracs = new THStack("particlestacks", "");

    // Read histograms.
    vector<TProfile*> fractionProfiles;
    for (int idx = 0; idx != 16; ++idx){
        std::stringstream tmpString("");
        tmpString << "a" << idx; 
        // a = all, g = gluonjets, q = quarkjets, lq = low pt quarks, hq = high pt quarks
        fractionProfiles.push_back( (TProfile*) inFile->Get( tmpString.str().c_str()) );
    }
    cout << fractionProfiles.size();

    vector<TH1D*> fractionHists;
    for (int idx = 0; idx != 16; ++idx){
        fractionHists.push_back( fractionProfiles[idx]->ProjectionX("","") );
    }
    vector<TH1D*> PFfracs;
    PFfracs.push_back( (TH1D*) fractionHists[0]->Clone("chf") );
    PFfracs[0]->Add( fractionHists[1] );
    PFfracs[0]->Add( fractionHists[3] );
    PFfracs[0]->Add( fractionHists[4] );
    PFfracs[0]->Add( fractionHists[7] );
    PFfracs[0]->Add( fractionHists[8] );
    PFfracs[0]->Add( fractionHists[13] );
    PFfracs.push_back( (TH1D*) fractionHists[2]->Clone("phf") );
    PFfracs[1]->Add( fractionHists[11] );
    PFfracs.push_back( (TH1D*) fractionHists[5]->Clone("nhf") );
    PFfracs[2]->Add( fractionHists[6] );
    PFfracs[2]->Add( fractionHists[9] );
    PFfracs[2]->Add( fractionHists[10] );
    PFfracs[2]->Add( fractionHists[12] );
    PFfracs.push_back( (TH1D*) fractionHists[14]->Clone("elf+muf") );
    PFfracs.push_back( (TH1D*) fractionHists[15]->Clone("others") );

    PFfracs[0]->SetFillColor(kRed);
    PFfracs[1]->SetFillColor(kBlue);
    PFfracs[2]->SetFillColor(kGreen);
    PFfracs[3]->SetFillColor(kYellow);
    PFfracs[4]->SetFillColor(kCyan);

    for (unsigned i = 0; i != PFfracs.size(); ++i){
        partFracs->Add( PFfracs[i] );
    }

    TCanvas *canv = tdrCanvas("c1",fractionHists[0],12,0,1);//new TCanvas("c1","c1",600,600);

    stackModify(fractionHists[0]);
    partFracs->SetHistogram( fractionHists[0] );
    partFracs->GetHistogram()->SetMaximum(1.01);
    partFracs->GetHistogram()->SetMinimum(-0.01);
    //partFracs->SetFillStyle(4000);

    TLegend *leg = tdrLeg(0.83,0.1,0.98,0.93);
    leg->AddEntry( PFfracs[4], "rest", "f" );
    leg->AddEntry( PFfracs[3], "elf+muf", "f" );
    leg->AddEntry( PFfracs[2], "nhf", "f" );
    leg->AddEntry( PFfracs[1], "phf", "f" );
    leg->AddEntry( PFfracs[0], "chf", "f" );
    leg->SetTextSize(0.045);

    TLatex latex;
    latex.SetNDC();
    latex.SetTextAngle(0);
    latex.SetTextColor(kBlack);

    latex.SetTextFont(42);
    latex.SetTextAlign(31);
    latex.SetTextSize(0.6*0.07);

    partFracs->Draw("same");
    latex.DrawLatex(0.77,0.85,"Pythia 6 Z2*");

    //fixOverlay();
    //canv->Print("efracs.pdf"); 
    // Done.
    return 0;
}
开发者ID:errai-,项目名称:jetscripts,代码行数:81,代码来源:runPFCoarse.C

示例6: plot_config_combsignal_category_monojet


//.........这里部分代码省略.........
   QCD_FITTY__1->GetYaxis()->SetTitleOffset(0.9);
   QCD_FITTY__1->GetYaxis()->SetTitleFont(42);
   QCD_FITTY__1->GetZaxis()->SetLabelFont(42);
   QCD_FITTY__1->GetZaxis()->SetLabelSize(0.035);
   QCD_FITTY__1->GetZaxis()->SetTitleSize(0.035);
   QCD_FITTY__1->GetZaxis()->SetTitleFont(42);
   QCD_FITTY__1->Draw("");
   
   THStack *bkg = new THStack();
   bkg->SetName("bkg");
   bkg->SetTitle("");
   Double_t xAxis2[17] = {200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000}; 
   
   TH1F *bkg_stack_1 = new TH1F("bkg_stack_1","",16, xAxis2);
   bkg_stack_1->SetMinimum(0.4825172);
   bkg_stack_1->SetMaximum(1930.069);
   bkg_stack_1->SetDirectory(0);
   bkg_stack_1->SetStats(0);

   ci = TColor::GetColor("#000099");
   bkg_stack_1->SetLineColor(ci);
   bkg_stack_1->GetXaxis()->SetLabelFont(42);
   bkg_stack_1->GetXaxis()->SetLabelSize(0.035);
   bkg_stack_1->GetXaxis()->SetTitleSize(0.035);
   bkg_stack_1->GetXaxis()->SetTitleFont(42);
   bkg_stack_1->GetYaxis()->SetLabelFont(42);
   bkg_stack_1->GetYaxis()->SetLabelSize(0.035);
   bkg_stack_1->GetYaxis()->SetTitleSize(0.035);
   bkg_stack_1->GetYaxis()->SetTitleFont(42);
   bkg_stack_1->GetZaxis()->SetLabelFont(42);
   bkg_stack_1->GetZaxis()->SetLabelSize(0.035);
   bkg_stack_1->GetZaxis()->SetTitleSize(0.035);
   bkg_stack_1->GetZaxis()->SetTitleFont(42);
   bkg->SetHistogram(bkg_stack_1);
   
   Double_t xAxis3[17] = {200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000}; 
   
   TH1F *signal_data__2 = new TH1F("signal_data__2","",16, xAxis3);
   signal_data__2->SetBinContent(1,3.366115);
   signal_data__2->SetBinContent(2,0.787499);
   signal_data__2->SetBinContent(3,0.1981346);
   signal_data__2->SetBinContent(4,0.05906976);
   signal_data__2->SetBinContent(5,0.02671834);
   signal_data__2->SetBinContent(6,0.009428909);
   signal_data__2->SetBinContent(7,0.003852866);
   signal_data__2->SetBinContent(9,0.001330514);
   signal_data__2->SetBinError(1,0.06263562);
   signal_data__2->SetBinError(2,0.03020511);
   signal_data__2->SetBinError(3,0.01526774);
   signal_data__2->SetBinError(4,0.008347501);
   signal_data__2->SetBinError(5,0.005865361);
   signal_data__2->SetBinError(6,0.003101941);
   signal_data__2->SetBinError(7,0.002245571);
   signal_data__2->SetBinError(9,0.001330514);
   signal_data__2->SetMinimum(0.02);
   signal_data__2->SetMaximum(20000);
   signal_data__2->SetEntries(93114);

   ci = TColor::GetColor("#006600");
   signal_data__2->SetFillColor(ci);
   signal_data__2->SetLineWidth(2);
   signal_data__2->GetXaxis()->SetLabelFont(42);
   signal_data__2->GetXaxis()->SetLabelSize(0);
   signal_data__2->GetXaxis()->SetTitleSize(0.035);
   signal_data__2->GetXaxis()->SetTitleFont(42);
   signal_data__2->GetYaxis()->SetTitle("Events/GeV");
开发者ID:nucleosynthesis,项目名称:EXOpaper,代码行数:67,代码来源:plot_config_combsignal_category_monojet.C

示例7: ttbar_nJet

void ttbar_nJet()
{
//=========Macro generated from canvas: c1/c1
//=========  (Sun Dec 11 15:16:19 2016) by ROOT version6.06/01
   TCanvas *c1 = new TCanvas("c1", "c1",1,1,1200,1416);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   c1->SetHighLightColor(2);
   c1->Range(0,0,1,1);
   c1->SetFillColor(0);
   c1->SetBorderMode(0);
   c1->SetBorderSize(2);
   c1->SetTickx(1);
   c1->SetTicky(1);
   c1->SetLeftMargin(0.15);
   c1->SetRightMargin(0.05);
   c1->SetTopMargin(0.07);
   c1->SetBottomMargin(0.13);
   c1->SetFrameFillStyle(0);
   c1->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: pad1
   TPad *pad1 = new TPad("pad1", "pad1",0,0.3,1,1);
   pad1->Draw();
   pad1->cd();
   pad1->Range(-2.1875,0,9.0625,0.5878968);
   pad1->SetFillColor(0);
   pad1->SetBorderMode(0);
   pad1->SetBorderSize(2);
   pad1->SetTickx(1);
   pad1->SetTicky(1);
   pad1->SetLeftMargin(0.15);
   pad1->SetRightMargin(0.05);
   pad1->SetTopMargin(0.07);
   pad1->SetBottomMargin(0);
   pad1->SetFrameFillStyle(0);
   pad1->SetFrameBorderMode(0);
   pad1->SetFrameFillStyle(0);
   pad1->SetFrameBorderMode(0);
   
   THStack *h = new THStack();
   h->SetName("h");
   h->SetTitle("");
   h->SetMinimum(0);
   h->SetMaximum(0.5207086);
   
   TH1F *h_stack_19 = new TH1F("h_stack_19","",9,-0.5,8.5);
   h_stack_19->SetMinimum(0);
   h_stack_19->SetMaximum(0.546744);
   h_stack_19->SetDirectory(0);
   h_stack_19->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   h_stack_19->SetLineColor(ci);
   h_stack_19->GetXaxis()->SetLabelFont(42);
   h_stack_19->GetXaxis()->SetLabelOffset(0.007);
   h_stack_19->GetXaxis()->SetTitleSize(0.05);
   h_stack_19->GetXaxis()->SetTickLength(0.025);
   h_stack_19->GetXaxis()->SetTitleFont(42);
   h_stack_19->GetYaxis()->SetTitle("a.u.");
   h_stack_19->GetYaxis()->SetLabelFont(42);
   h_stack_19->GetYaxis()->SetLabelOffset(0.007);
   h_stack_19->GetYaxis()->SetTitleSize(0.05);
   h_stack_19->GetYaxis()->SetTickLength(0.025);
   h_stack_19->GetYaxis()->SetTitleOffset(1.5);
   h_stack_19->GetYaxis()->SetTitleFont(42);
   h_stack_19->GetZaxis()->SetLabelFont(42);
   h_stack_19->GetZaxis()->SetLabelOffset(0.007);
   h_stack_19->GetZaxis()->SetTitleSize(0.05);
   h_stack_19->GetZaxis()->SetTickLength(0.025);
   h_stack_19->GetZaxis()->SetTitleFont(42);
   h->SetHistogram(h_stack_19);
   
   
   TH1D *h_nJet_QCD__217 = new TH1D("h_nJet_QCD__217","",9,-0.5,8.5);
   h_nJet_QCD__217->SetBinContent(2,0.001991738);
   h_nJet_QCD__217->SetBinContent(3,0.0005078625);
   h_nJet_QCD__217->SetBinContent(4,0.006489724);
   h_nJet_QCD__217->SetBinContent(5,0.001899386);
   h_nJet_QCD__217->SetBinContent(6,0.000696849);
   h_nJet_QCD__217->SetBinError(2,0.001424948);
   h_nJet_QCD__217->SetBinError(3,0.0005078625);
   h_nJet_QCD__217->SetBinError(4,0.00246407);
   h_nJet_QCD__217->SetBinError(5,0.001037545);
   h_nJet_QCD__217->SetBinError(6,0.0004566736);
   h_nJet_QCD__217->SetEntries(25);
   h_nJet_QCD__217->SetStats(0);

   ci = TColor::GetColor("#cccccc");
   h_nJet_QCD__217->SetFillColor(ci);
   h_nJet_QCD__217->GetXaxis()->SetTitle("N_{jet}");
   h_nJet_QCD__217->GetXaxis()->SetLabelFont(42);
   h_nJet_QCD__217->GetXaxis()->SetLabelOffset(0.007);
   h_nJet_QCD__217->GetXaxis()->SetTitleSize(0.05);
   h_nJet_QCD__217->GetXaxis()->SetTickLength(0.025);
   h_nJet_QCD__217->GetXaxis()->SetTitleFont(42);
   h_nJet_QCD__217->GetYaxis()->SetTitle("a.u.");
   h_nJet_QCD__217->GetYaxis()->SetLabelFont(42);
//.........这里部分代码省略.........
开发者ID:sundleeb,项目名称:AN-18-026,代码行数:101,代码来源:ttbar_nJet.C

示例8: ttbar_jet1CSV

void ttbar_jet1CSV()
{
//=========Macro generated from canvas: c1/c1
//=========  (Sun Dec 11 15:16:19 2016) by ROOT version6.06/01
   TCanvas *c1 = new TCanvas("c1", "c1",1,1,1200,1416);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   c1->SetHighLightColor(2);
   c1->Range(0,0,1,1);
   c1->SetFillColor(0);
   c1->SetBorderMode(0);
   c1->SetBorderSize(2);
   c1->SetTickx(1);
   c1->SetTicky(1);
   c1->SetLeftMargin(0.15);
   c1->SetRightMargin(0.05);
   c1->SetTopMargin(0.07);
   c1->SetBottomMargin(0.13);
   c1->SetFrameFillStyle(0);
   c1->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: pad1
   TPad *pad1 = new TPad("pad1", "pad1",0,0.3,1,1);
   pad1->Draw();
   pad1->cd();
   pad1->Range(-0.1875,0,1.0625,0.5424993);
   pad1->SetFillColor(0);
   pad1->SetBorderMode(0);
   pad1->SetBorderSize(2);
   pad1->SetTickx(1);
   pad1->SetTicky(1);
   pad1->SetLeftMargin(0.15);
   pad1->SetRightMargin(0.05);
   pad1->SetTopMargin(0.07);
   pad1->SetBottomMargin(0);
   pad1->SetFrameFillStyle(0);
   pad1->SetFrameBorderMode(0);
   pad1->SetFrameFillStyle(0);
   pad1->SetFrameBorderMode(0);
   
   THStack *h = new THStack();
   h->SetName("h");
   h->SetTitle("");
   h->SetMinimum(0);
   h->SetMaximum(0.4804993);
   
   TH1F *h_stack_21 = new TH1F("h_stack_21","",10,0,1);
   h_stack_21->SetMinimum(0);
   h_stack_21->SetMaximum(0.5045243);
   h_stack_21->SetDirectory(0);
   h_stack_21->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   h_stack_21->SetLineColor(ci);
   h_stack_21->GetXaxis()->SetLabelFont(42);
   h_stack_21->GetXaxis()->SetLabelOffset(0.007);
   h_stack_21->GetXaxis()->SetTitleSize(0.05);
   h_stack_21->GetXaxis()->SetTickLength(0.025);
   h_stack_21->GetXaxis()->SetTitleFont(42);
   h_stack_21->GetYaxis()->SetTitle("a.u.");
   h_stack_21->GetYaxis()->SetLabelFont(42);
   h_stack_21->GetYaxis()->SetLabelOffset(0.007);
   h_stack_21->GetYaxis()->SetTitleSize(0.05);
   h_stack_21->GetYaxis()->SetTickLength(0.025);
   h_stack_21->GetYaxis()->SetTitleOffset(1.5);
   h_stack_21->GetYaxis()->SetTitleFont(42);
   h_stack_21->GetZaxis()->SetLabelFont(42);
   h_stack_21->GetZaxis()->SetLabelOffset(0.007);
   h_stack_21->GetZaxis()->SetTitleSize(0.05);
   h_stack_21->GetZaxis()->SetTickLength(0.025);
   h_stack_21->GetZaxis()->SetTitleFont(42);
   h->SetHistogram(h_stack_21);
   
   
   TH1D *h_jet1CSV_QCD__241 = new TH1D("h_jet1CSV_QCD__241","",10,0,1);
   h_jet1CSV_QCD__241->SetBinContent(1,0.001669958);
   h_jet1CSV_QCD__241->SetBinContent(2,0.001297151);
   h_jet1CSV_QCD__241->SetBinContent(3,0.0001985037);
   h_jet1CSV_QCD__241->SetBinContent(4,0.001317617);
   h_jet1CSV_QCD__241->SetBinContent(5,0.001460061);
   h_jet1CSV_QCD__241->SetBinContent(6,0.0005098467);
   h_jet1CSV_QCD__241->SetBinContent(8,9.216642e-05);
   h_jet1CSV_QCD__241->SetBinContent(10,0.005040257);
   h_jet1CSV_QCD__241->SetBinError(1,0.001015339);
   h_jet1CSV_QCD__241->SetBinError(2,0.0006375418);
   h_jet1CSV_QCD__241->SetBinError(3,0.0001985037);
   h_jet1CSV_QCD__241->SetBinError(4,0.0007758122);
   h_jet1CSV_QCD__241->SetBinError(5,0.0009604397);
   h_jet1CSV_QCD__241->SetBinError(6,0.0005098467);
   h_jet1CSV_QCD__241->SetBinError(8,9.216642e-05);
   h_jet1CSV_QCD__241->SetBinError(10,0.002524985);
   h_jet1CSV_QCD__241->SetEntries(25);
   h_jet1CSV_QCD__241->SetStats(0);

   ci = TColor::GetColor("#cccccc");
   h_jet1CSV_QCD__241->SetFillColor(ci);
   h_jet1CSV_QCD__241->GetXaxis()->SetTitle("jet 1 CSV");
   h_jet1CSV_QCD__241->GetXaxis()->SetLabelFont(42);
//.........这里部分代码省略.........
开发者ID:sundleeb,项目名称:AN-18-026,代码行数:101,代码来源:ttbar_jet1CSV.C


注:本文中的THStack::SetHistogram方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。