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


C++ TGraphErrors::SetFillStyle方法代码示例

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


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

示例1: plot_mc

void plot_mc(string name="g", double q2=1.9, Int_t n=0)
{
//    SetAtlasStyle();
    TGraphErrors *p;

    TString nn;
    nn.Form("ave_%s_vs_x_for_Q2=%g",name.c_str(),q2);
    gDirectory->GetObject(nn,p);

//    p->Print();

    Double_t ratsize = 0.0;

    TCanvas *c = new TCanvas("PDF","pdf",600,600);
    TPad *pad1 = new TPad("pad1","pad1",0.,ratsize,1.,1.);
    pad1->SetLogx();
    pad1->Draw();
    pad1->cd();
    p->GetXaxis()->Set(101,0.0001,1.);
    p->SetFillColor(kRed-2);
    p->SetFillStyle(3001);
    p->SetLineWidth(1);
    p->SetLineColor(kRed);
    p->GetYaxis()->SetTitle(name.c_str());

    p->GetYaxis()->SetTitleSize(0.06);
    p->GetYaxis()->SetTitleOffset(1.);
    p->GetXaxis()->Set(101,0.0001,1.);
    p->Draw("ALE3");

    Double_t av = 0;
    Double_t av2 = 0;

    for (Int_t i = 1; i<n+1 ; i++) {
        nn.Form("%s_vs_x_for_Q^{2}=%g_%i",name.c_str(),q2,i);
        TGraph *pp = NULL;
        gDirectory->GetObject(nn,pp);
        if (pp != NULL) {
            pp->SetLineColor(kGreen);
            pp->Draw("L");

            av  += pp->GetY()[0];
            av2 += pp->GetY()[0]*pp->GetY()[0];
            cout << i << " "<<pp->GetY()[0] << endl;


        }
    }

    av  /= n;
    av2 = sqrt(av2/n - av*av);
//    cout << n << " "<<av << " "<< av2<<endl;


    p->Draw("E3C");


}
开发者ID:hep-mirrors,项目名称:h1fitter,代码行数:58,代码来源:plot_pdf.C

示例2: plotter

void plotter(Int_t octant=1){

gROOT->Reset();
gROOT->SetStyle("Plain");

TString runNums[5] = {"14296","15736","16654","17635","18875"};

TCanvas *c1 = new TCanvas();

TGraphErrors *gPos = new TGraphErrors(Form("md%dpos.dat",octant),"%lg %lg %lg");
TGraphErrors *gNeg = new TGraphErrors(Form("md%dneg.dat",octant),"%lg %lg %lg");

gPos->SetMarkerColor(kBlue);
gNeg->SetMarkerColor(kRed);
gPos->SetLineColor(kBlue);
gNeg->SetLineColor(kRed);
gPos->SetFillStyle(0);
gNeg->SetFillStyle(0);
gPos->SetTitle(Form("MD%dPOS",octant));
gNeg->SetTitle(Form("MD%dNEG",octant));

TMultiGraph *gm = new TMultiGraph("gm",Form("1/Yield for MD%d",octant));
gm->Add(gPos);
gm->Add(gNeg);

gm->Draw("ap");

gm->GetYaxis()->SetTitle("1/Yield (uA/V)");
gm->GetXaxis()->SetTitle("Run Number");

gm->GetXaxis()->SetNdivisions(505,kTRUE);

for(Int_t i=0; i<5; i++){
	gm->GetXaxis()->SetBinLabel(gm->GetXaxis()->FindBin(150000+i*10000),runNums[i].Data());

}
gm->GetXaxis()->SetTitleOffset(1.4);

c1->BuildLegend();


}
开发者ID:sjmacewan,项目名称:Qweak,代码行数:42,代码来源:plotter.C

示例3: plotObsScanCheck

///
/// Plot the discrepancy between the observable and the predicted
/// observable when making predictions about observables by scanning
/// them. This checks if the chi2 term of the observable is tight enough.
/// This only works for 1D scans for now.
///
void ParameterEvolutionPlotter::plotObsScanCheck()
{
	vector<RooSlimFitResult*> results = curveResults;

	cout << "ParameterEvolutionPlotter::plotObsScanCheck() : plotting ..." << endl;
	TCanvas *c2 = newNoWarnTCanvas("plotObsScanCheck"+getUniqueRootName(), title, 800,600);
	c2->SetLeftMargin(0.2);

	// get observable
	TGraphErrors *g = new TGraphErrors(results.size());
	int iGraph = 0;

	for ( int i=0; i<results.size(); i++ ){
		assert(results[i]);
		// get value of observable
		float obsValue = results[i]->getParVal(scanVar1);
		float obsError = w->var(scanVar1)->getError();

		// get value of theory prediction
		setParameters(w,parsName,results[i]);
		TString thName = scanVar1;
		thName.ReplaceAll("_obs","_th");
		if ( !w->function(thName) ){
			cout << "ParameterEvolutionPlotter::plotObsScanCheck() : ERROR : theory value not found: " << thName << endl;
			continue;
		}
		float thValue = w->function(thName)->getVal();
		g->SetPoint(iGraph, iGraph, obsValue-thValue);
		g->SetPointError(iGraph, 0., obsError);
		iGraph++;
	}

	g->SetTitle(scanVar1);
	g->GetXaxis()->SetTitle("scan step");
	g->GetYaxis()->SetTitleSize(0.06);
	g->GetYaxis()->SetLabelSize(0.04);
	g->GetYaxis()->SetTitleOffset(1.5);
	g->GetYaxis()->SetTitle(scanVar1);
	Int_t ci = 927;
	TColor *col = new TColor(ci, 0, 0, 1, " ", 0.5);
	g->SetFillColor(ci);
	g->SetFillStyle(1001);
	g->Draw("a3");
	g->Draw("lxsame");
	c2->Update();

	savePlot(c2, "parEvolutionObsSanCheck_"+name+"_"+scanVar1);
}
开发者ID:KonstantinSchubert,项目名称:gammacombo,代码行数:54,代码来源:ParameterEvolutionPlotter.cpp

示例4: drawDifference

void drawDifference(TH1* iH0,TH1 *iH1,TH1* iH2, TGraphErrors* iH3, int chnl,TGraphErrors* iH4,TGraphAsymmErrors* iH5,TH1* StatErrBand,TGraphErrors* iH6){
  std::string lName = std::string(iH0->GetName());
  TH1F *lHDiff  = new TH1F((lName+"Diff").c_str(),(lName+"Diff").c_str(),nBins-1,WptLogBins);// lHDiff->Sumw2();
  TH1F *lXHDiff1 = new TH1F((lName+"XDiff1").c_str(),(lName+"XDiff1").c_str(),iH0->GetNbinsX(),iH0->GetXaxis()->GetXmin(),iH0->GetXaxis()->GetXmax());
  int i1 = 0;
  lXHDiff1->SetLineWidth(2); lXHDiff1->SetLineColor(kBlack); //lXHDiff1->SetLineStyle(2);
  
  StatErrBand->SetMarkerStyle(kFullCircle); StatErrBand->SetMarkerColor(kBlack);StatErrBand->SetMarkerSize(0.6);
  StatErrBand->SetLineWidth(2); StatErrBand->SetLineColor(kBlack);

  //lHDiff->GetYaxis()->SetRangeUser(0.2,1.8);
  lHDiff->GetYaxis()->SetRangeUser(0.6,1.5);
  if (chnl == 2)
    lHDiff->GetYaxis()->SetRangeUser(0.4,1.4);
  if (chnl == 3)
    lHDiff->GetYaxis()->SetRangeUser(0.3,1.3);
  lHDiff->GetYaxis()->SetTitleOffset(0.4);
  lHDiff->GetYaxis()->SetTitleSize(0.12);
  lHDiff->GetYaxis()->SetLabelSize(0.12);
  lHDiff->GetYaxis()->CenterTitle();
  lHDiff->GetXaxis()->SetTitleOffset(1.);
  lHDiff->GetXaxis()->SetTitleSize(0.12);
  lHDiff->GetXaxis()->SetLabelSize(0);
  if(chnl==3)
    lHDiff->GetXaxis()->SetLabelSize(0.12);
  lHDiff->GetYaxis()->SetNdivisions(405);
  if (chnl == 3)
    lHDiff->GetXaxis()->SetTitle(" W p_{T} ");
  lHDiff->GetYaxis()->SetTitle("Theory/Data");
  //lHDiff->GetYaxis()->SetTitle("Data/ResBos");
  gStyle->SetOptStat(0);
  
  for(int i0 = 0; i0 < lHDiff->GetNbinsX()+1; i0++) {
    double lXCenter = lHDiff->GetBinCenter(i0);
    double lXVal     = iH0   ->GetBinContent(i0);
    lXHDiff1->SetBinContent(i0, 1.0);
    while(iH1->GetBinCenter(i1) < lXCenter) {i1++;}
    if(iH1->GetBinContent(i0) > 0) lHDiff->SetBinContent(i0,lXVal/(iH1->GetBinContent(i0)));
    //if(iH1->GetBinContent(i0) > 0) lHDiff->SetBinError(i0,iH0->GetBinError(i0)/(iH1->GetBinContent(i0)));
    if(iH1->GetBinContent(i0) > 0) lHDiff->SetBinError(i0,0.00001);
  }
  
  TGraphErrors* ErrBand = new TGraphErrors(iH2);
  ErrBand->SetFillColor(kBlack);
  ErrBand->SetFillStyle(3354);
  ErrBand->SetLineWidth(1);
  
  if (chnl == 1)
  {
    lHDiff->SetMarkerStyle(kOpenCircle);
    lHDiff->SetMarkerColor(kBlue);
    lHDiff->SetLineColor(kBlue);
  }
  if (chnl == 2)
  {
    lHDiff->SetMarkerStyle(kOpenTriangleUp);
    lHDiff->SetMarkerColor(kRed);
    lHDiff->SetLineColor(kRed);
  }
  if (chnl == 3)
  {
    lHDiff->SetMarkerStyle(kOpenSquare);
    lHDiff->SetMarkerColor(kGreen+3);
    lHDiff->SetLineColor(kGreen+3);
  }
  
  lHDiff->SetMarkerSize(0.8);
  
  //lHDiff->SetLineColor(kBlack); lHDiff->SetMarkerColor(kBlack);
  
  lHDiff->SetTitle("");
  lHDiff->Draw("E");
  if (chnl == 1)
    iH5->Draw("2same");
  if (chnl == 2 || chnl == 3)
    iH4->Draw("2same");
  if (chnl == 2 || chnl == 3)
    iH3->Draw("2same");
  if (chnl == 3)
    iH6->Draw("2");
  lXHDiff1->Draw("histsame");
  ErrBand->Draw("2same");
  lHDiff->Draw("Esame");
  StatErrBand->Draw("E1same");
}
开发者ID:d4space,项目名称:TerraNova5322,代码行数:85,代码来源:theoryStudy_separate.C

示例5: theoryStudy_separate


//.........这里部分代码省略.........
    hFewzScale->SetBinContent(ipt,hFewzLog->GetBinContent(ipt)/hDataLog->GetBinContent(ipt));  
    hFewzScale->SetBinError(ipt,fScale[ipt]/hDataNoLog->GetXaxis()->GetBinWidth(ipt));
    hFewzTheoryErrBand->SetBinContent(ipt,hFewzLog->GetBinContent(ipt)/hDataLog->GetBinContent(ipt));
    //hFewzTheoryErrBand->SetBinError(ipt,hFewzLog->GetBinError(ipt)/hDataLog->GetBinContent(ipt));
    //hFewzTheoryErrBand->SetBinError(ipt,0.01+hFewzLog->GetBinError(ipt)/hDataLog->GetBinContent(ipt));
    hFewzTheoryErrBand->SetBinError(ipt,0.01+(hFewzLog->GetBinError(ipt)+hFewzScale->GetBinError(ipt))/hDataLog->GetBinContent(ipt));
    hFewzScaleErrBand->SetBinContent(ipt,hFewzLog->GetBinContent(ipt)/hDataLog->GetBinContent(ipt));
    hFewzScaleErrBand->SetBinError(ipt,0.01+hFewzScale->GetBinError(ipt)/hDataLog->GetBinContent(ipt));
    
    resbVal[ipt-1]=hResbosLog30->GetBinContent(ipt)/hDataLog->GetBinContent(ipt);
    errResbosDataLo[ipt-1]=errMin[ipt-1]/hDataLog->GetBinContent(ipt);
    errResbosDataHi[ipt-1]=errMax[ipt-1]/hDataLog->GetBinContent(ipt);
    
    cout<<ipt<<"\t"<<errMin[ipt-1]<<"\t"<<errMax[ipt-1]<<"\t"<<hDataLog->GetBinContent(ipt)<<"\t"<<errResbosDataLo[ipt-1]<<"\t"<<errResbosDataHi[ipt-1]<<endl;
    //cout<<ipt<<"\t"<<hResbosLog30->GetBinContent(ipt)<<"\t"<<hDataLog->GetBinContent(ipt)<<"\t"<<hPowhegLog->GetBinError(ipt)<<endl;
  }

  hDataLog->SetMarkerStyle(kFullCircle); hDataLog->SetMarkerColor(kBlack); hDataLog->SetMarkerSize(1);
  hStatErr->SetMarkerStyle(kFullCircle); hStatErr->SetMarkerColor(kBlack); hStatErr->SetMarkerSize(0.6);

  TGraphErrors *hData = new TGraphErrors(hDataLog);
  TGraphErrors *hPowheg = new TGraphErrors(hPowhegLog);
  TGraphErrors *hFewz = new TGraphErrors(hFewzLog);
  TGraphAsymmErrors* hResbos = new TGraphAsymmErrors(nBins-1, ax, resb30, aex, aex, errMin, errMax);
  TGraphAsymmErrors* ResbosErrBand = new TGraphAsymmErrors(nBins-1, ax, resbVal, aex, aex, errResbosDataLo, errResbosDataHi);
  TGraphErrors* pRatio = new TGraphErrors(hPowhegErrBand);
  TGraphErrors* pRatioPDF = new TGraphErrors(hPowhegErrBandPDF);
  TGraphErrors* fRatio = new TGraphErrors(hFewzErrBand);
  TGraphErrors* fTheoryRatio = new TGraphErrors(hFewzTheoryErrBand);
  TGraphErrors* fScaleRatio = new TGraphErrors(hFewzScaleErrBand);
  
  TGraphErrors* dataErrBand = new TGraphErrors(hDataErrBand);
  dataErrBand->SetFillColor(kBlack);
  dataErrBand->SetFillStyle(3354);
  
  ResbosErrBand->SetFillColor(kBlue-7);
  ResbosErrBand->SetFillStyle(3001);
  
  //pRatio->SetFillColor(kRed-7);
  pRatio->SetFillColor(kRed-10);
  pRatio->SetFillStyle(3001);
  
  pRatioPDF->SetFillColor(kRed+2);
  pRatioPDF->SetFillStyle(3001);
  
  fRatio->SetFillColor(kGreen);
  fRatio->SetFillStyle(3001);
  
  //fTheoryRatio->SetFillColor(kGreen-9);
  fTheoryRatio->SetFillColor(kGreen+3);
  fTheoryRatio->SetFillStyle(3001);

  fScaleRatio->SetFillColor(kGreen+7);
  fScaleRatio->SetFillStyle(3001);

  hFewz->SetFillColor(kGreen);
  hFewz->SetFillStyle(3305);

  hPowheg->SetFillColor(kRed);
  hPowheg->SetFillStyle(3345);
  hResbos->SetFillColor(kBlue);
  hResbos->SetFillStyle(3354);

  TLegend *lL =new TLegend(0.2,0.2,0.52,0.38); lL->SetFillColor(0); lL->SetBorderSize(0);
  lL->AddEntry(hData,"Unfolded","PL");
  lL->AddEntry(hPowheg,"Powheg CT10 NLO","f");
开发者ID:d4space,项目名称:TerraNova5322,代码行数:67,代码来源:theoryStudy_separate.C

示例6: plot_cent_allQQ


//.........这里部分代码省略.........

  gInclJpsiCentSyst->SetName("gInclJpsiCentSyst");
  gPromptJpsiCentSyst->SetName("gPromptJpsiCentSyst");
  gNonPromptJpsiCentSyst->SetName("gNonPromptJpsiCentSyst");

  gInclJpsiMBSyst->SetName("gInclJpsiMBSyst");
  gPromptJpsiMBSyst->SetName("gPromptJpsiMBSyst");
  gNonPromptJpsiMBSyst->SetName("gNonPromptJpsiMBSyst");

  gUpsCentSyst->SetName("gUpsCentSyst");
  gUpsMBSyst->SetName("gUpsMBSyst");

  gInclJpsiCent2Syst->SetName("gInclJpsiCent2Syst");
  gPromptJpsiCent2Syst->SetName("gPromptJpsiCent2Syst");

  // gInclJpsiCentSyst->SetFillColor(kGray+1);
  // gPromptJpsiCentSyst->SetFillColor(kAzure-9);
  // gNonPromptJpsiCentSyst->SetFillColor(kRed-10);
  // gUpsCentSyst->SetFillColor(kGreen-10);
  // gInclJpsiMBSyst->SetFillColor(kGray+1);
  // gPromptJpsiMBSyst->SetFillColor(kAzure-9);
  // gNonPromptJpsiMBSyst->SetFillColor(kRed-10);
  // gUpsMBSyst->SetFillColor(kGreen-10);
  // gInclJpsiCent->SetMarkerColor(kBlack);
  // gPromptJpsiCent->SetMarkerColor(kBlue);
  // gNonPromptJpsiCent->SetMarkerColor(kRed);
  // gUpsCent->SetMarkerColor(kGreen+2);

  gInclJpsiCentSyst->SetFillColor(kAzure-9);
  gPromptJpsiCentSyst->SetFillColor(kRed-9);
  gNonPromptJpsiCentSyst->SetFillColor(kOrange-9);
  gUpsCentSyst->SetFillColor(kGreen-9);

  gInclJpsiMBSyst->SetFillStyle(0);
  gPromptJpsiMBSyst->SetFillStyle(0);
  gNonPromptJpsiMBSyst->SetFillStyle(0);
  gUpsMBSyst->SetFillStyle(0);

  gInclJpsiMBSyst->SetLineWidth(3);
  gPromptJpsiMBSyst->SetLineWidth(3);
  gNonPromptJpsiMBSyst->SetLineWidth(3);
  gUpsMBSyst->SetLineWidth(3);

  gInclJpsiMBSyst->SetLineColor(kAzure-9);
  gPromptJpsiMBSyst->SetLineColor(kRed-9);
  gNonPromptJpsiMBSyst->SetLineColor(kOrange-9);
  gUpsMBSyst->SetLineColor(kGreen-9);

  if (isPaper) {
    gInclJpsiCent->SetMarkerColor(kBlue+1);
    gPromptJpsiCent->SetMarkerColor(kRed+2);
  }
  else {
    gInclJpsiCent->SetMarkerColor(kBlue);
    gPromptJpsiCent->SetMarkerColor(kRed);
  }
  gNonPromptJpsiCent->SetMarkerColor(kOrange+2);
  gUpsCent->SetMarkerColor(kGreen+2);

  gInclJpsiCent->SetMarkerStyle(20);
  gPromptJpsiCent->SetMarkerStyle(21);
  gNonPromptJpsiCent->SetMarkerStyle(29);
  gUpsCent->SetMarkerStyle(33);

  if (isPaper) {
    gInclJpsiMB->SetMarkerColor(kBlue+1);
开发者ID:CMS-HIN-dilepton,项目名称:DimuonCADIs,代码行数:67,代码来源:plot_cent_allQQ.C

示例7: result_JES_akPu4PF_

void result_JES_akPu4PF_(refpt> 75 && refpt < 120)&&(abs(refeta)<2)_Centrality()
{
//=========Macro generated from canvas: Can_result_0/
//=========  (Mon Apr 18 02:39:41 2016) by ROOT version6.02/13
   TCanvas *Can_result_0 = new TCanvas("Can_result_0", "",18,40,700,500);
   gStyle->SetOptFit(1);
   Can_result_0->Range(-18.75,0.9236134,118.75,1.043845);
   Can_result_0->SetFillColor(0);
   Can_result_0->SetBorderMode(0);
   Can_result_0->SetBorderSize(2);
   Can_result_0->SetFrameBorderMode(0);
   Can_result_0->SetFrameBorderMode(0);
   
   TMultiGraph *multigraph = new TMultiGraph();
   multigraph->SetName("name");
   multigraph->SetTitle("JES_akPu4PF");
   
   Double_t Graph_fx1001[4] = {
   5,
   20,
   40,
   75};
   Double_t Graph_fy1001[4] = {
   1.025461,
   0.982262,
   0.9644553,
   0.970611};
   Double_t Graph_fex1001[4] = {
   5,
   10,
   10,
   25};
   Double_t Graph_fey1001[4] = {
   0.001598024,
   0.0009318739,
   0.0008002418,
   0.0004502591};
   TGraphErrors *gre = new TGraphErrors(4,Graph_fx1001,Graph_fy1001,Graph_fex1001,Graph_fey1001);
   gre->SetName("Graph");
   gre->SetTitle("some title_0");
   gre->SetFillColor(1);
   gre->SetFillStyle(0);
   
   TH1F *Graph_Graph1001 = new TH1F("Graph_Graph1001","some title_0",100,0,110);
   Graph_Graph1001->SetMinimum(0.9573146);
   Graph_Graph1001->SetMaximum(1.0334);
   Graph_Graph1001->SetDirectory(0);
   Graph_Graph1001->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   Graph_Graph1001->SetLineColor(ci);
   Graph_Graph1001->GetXaxis()->SetLabelFont(42);
   Graph_Graph1001->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1001->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1001->GetXaxis()->SetTitleFont(42);
   Graph_Graph1001->GetYaxis()->SetLabelFont(42);
   Graph_Graph1001->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1001->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1001->GetYaxis()->SetTitleFont(42);
   Graph_Graph1001->GetZaxis()->SetLabelFont(42);
   Graph_Graph1001->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1001->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1001->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1001);
   
   multigraph->Add(gre,"");
   
   Double_t Graph_fx1002[4] = {
   5,
   20,
   40,
   75};
   Double_t Graph_fy1002[4] = {
   1.025808,
   0.9823451,
   0.964104,
   0.9707841};
   Double_t Graph_fex1002[4] = {
   5,
   10,
   10,
   25};
   Double_t Graph_fey1002[4] = {
   0.001641175,
   0.0009556419,
   0.0008206184,
   0.000461058};
   gre = new TGraphErrors(4,Graph_fx1002,Graph_fy1002,Graph_fex1002,Graph_fey1002);
   gre->SetName("Graph");
   gre->SetTitle("some title_1");
   gre->SetFillColor(1);
   gre->SetFillStyle(0);
   gre->SetLineColor(2);
   gre->SetMarkerColor(2);
   
   TH1F *Graph_Graph1002 = new TH1F("Graph_Graph1002","some title_1",100,0,110);
   Graph_Graph1002->SetMinimum(0.9568668);
   Graph_Graph1002->SetMaximum(1.033866);
//.........这里部分代码省略.........
开发者ID:Jelov,项目名称:JetEnergy_SR,代码行数:101,代码来源:result_JES_akPu4PF_(refpt>+75+&&+refpt+<+120)&&(abs(refeta)<2)_Centrality.C

示例8: v2ExpOpen_pt

void v2ExpOpen_pt(bool bSavePlots = true, 
		  float rangeYAxis    = 0.6,
		  float rangeXAxis    = 30,
                  bool  bDrawCh       = true,
		  const char* inputDir= "../macro_v2/outRoot", // the place where the input root files, with the histograms are
		  const char* figNamePrefix="v2ExpOpen_pt")
{
  gSystem->mkdir(Form("./figs/png"), kTRUE);
  gSystem->mkdir(Form("./figs/pdf"), kTRUE);
  setTDRStyle();
  //  gStyle->SetCanvasPreferGL(1);
  // read CMS graphs
  TFile *pfV2Cms_cent   = new TFile(Form("%s/NPrp_v2_pt_plotter.root",inputDir));
  
  TGraphAsymmErrors *pgV2Low  = (TGraphAsymmErrors *)pfV2Cms_cent->Get("pgV2_low");
  TGraphErrors *pgV2LowSyst   = (TGraphErrors *)pfV2Cms_cent->Get("pgV2_low_sys");
  TGraphErrors *pgV2LowP      = (TGraphErrors *)pfV2Cms_cent->Get("pgV2_low_cont");

  TGraphAsymmErrors *pgV2High = (TGraphAsymmErrors *)pfV2Cms_cent->Get("pgV2");
  TGraphErrors *pgV2HighSyst  = (TGraphErrors *)pfV2Cms_cent->Get("pgV2_sys");
  TGraphErrors *pgV2HighP     = (TGraphErrors *)pfV2Cms_cent->Get("pgV2_cont");
  
  pgV2Low->SetName("pgV2Low");
  pgV2LowSyst->SetFillColorAlpha(kViolet-9,0.5);
  pgV2High->SetName("pgV2High");
  pgV2HighSyst->SetFillColorAlpha(kOrange-9,0.5);

  // -----------------------------------------------------------------------------------------
  // ----- charged hadrons
  TGraphErrors *gChar    = new TGraphErrors(19, pTChar, v2Char, chxerr, v2CharSt);
  TGraphErrors *gChar2   = new TGraphErrors(19, pTChar, v2Char, chxerr, v2CharSt2);
  TGraphErrors *gCharSys = new TGraphErrors(19, pTChar, v2Char, chxerr2, v2CharSys);
 
  gChar->SetName("gChar");
  gChar->SetMarkerStyle(20);
  gChar->SetMarkerColor(kTeal+3);
  gChar->SetLineColor(kTeal+3);
  gChar->SetMarkerSize(1.3);
  gChar2->SetMarkerStyle(24);
  gChar2->SetMarkerColor(kTeal+4);
  gChar2->SetLineColor(kTeal+4);
  gChar2->SetMarkerSize(1.3);
 
  gCharSys->SetFillColor(kTeal-9);

  //----------- D from ALICE
  TGraphErrors *pgAlice          = new TGraphErrors(6, v2AliceX_pt, v2Alice_pt, v2AliceXl, v2AliceStat_pt);
  TGraphErrors *pgAliceSys       = new TGraphErrors(6, v2AliceX_pt, v2Alice_pt, v2AliceXl, v2AliceSyst_pt);
  TGraphAsymmErrors *pgAliceSysB = new TGraphAsymmErrors(6, v2AliceX_pt, v2Alice_pt, v2AliceXl2, v2AliceXl2, v2AliceSystBLow_pt, v2AliceSystBHigh_pt);

 
  pgAlice->SetName("pgAlice");
  pgAlice->SetMarkerStyle(kOpenSquare);
  pgAlice->SetMarkerColor(kGray+2);
  pgAlice->SetLineColor(kGray+2);
  pgAlice->SetMarkerSize(1.0);
  
  pgAliceSys->SetFillStyle(0);
  pgAliceSys->SetMarkerStyle(27);
  pgAliceSys->SetMarkerColor(kGray+2);
  pgAliceSys->SetLineColor(kGray+2);
  pgAliceSys->SetMarkerSize(1.7);

  pgAliceSysB->SetFillColor(kGray);

  // drawing
  //------------------------------------------------------------------------
  // put everything on one plot
  TH1D *phAxis_v2 = new TH1D("phAxis_v2",";p_{T} (GeV/c);v_{2}",1,0,rangeXAxis);  
  phAxis_v2->SetDirectory(0);
  phAxis_v2->GetXaxis()->CenterTitle(true);
  phAxis_v2->GetXaxis()->LabelsOption("h");
  phAxis_v2->GetYaxis()->SetRangeUser(-0.01,rangeYAxis); 
  phAxis_v2->GetYaxis()->SetTitleOffset(1.25);
 
  TCanvas *pcCombi = new TCanvas("pcCombi","pcCombi");
  phAxis_v2->Draw();
  CMS_lumi(pcCombi,12001000,0);
 
  pgAliceSysB->Draw("2");
  pgAliceSys->Draw("2");
  pgAlice->Draw("pz");
 
  if (bDrawCh) {
    gCharSys->Draw("2");
    gChar->Draw("pz");
    gChar2->Draw("p");
  }
 
  pgV2LowSyst->Draw("2");
  pgV2Low->Draw("PZ");
  pgV2LowP->Draw("P");
 
  pgV2HighSyst->Draw("2");
  pgV2High->Draw("PZ");
  pgV2HighP->Draw("P");
  
  // --------- legends ----
  TLegend *leg = new TLegend(0.2,0.77,0.7,0.89,NULL,"brNDC"); // at top center
  leg->SetBorderSize(0);
//.........这里部分代码省略.........
开发者ID:CMS-HIN-dilepton,项目名称:DimuonCADIs,代码行数:101,代码来源:v2ExpOpen_pt.C

示例9: Plots


//.........这里部分代码省略.........
      gStyle->SetGridWidth(0.5);
      gStyle->SetGridColor(14);
      pad[1]->SetGridx();
      pad[1]->SetGridy();
      pad[1]->SetTopMargin(0.05);
      pad[1]->SetBottomMargin(0.4);
      pad[1]->SetRightMargin(0.04);
      
      //-------------------------------------------------------
      // Stack
      pad[0]->cd();

      Stack[h].mc[ch]->Draw("hist");

      Stack[h].mc[ch]->GetYaxis()->SetTitle("Events");
      Stack[h].mc[ch]->GetYaxis()->SetTitleOffset(1.2);
      Stack[h].mc[ch]->GetYaxis()->SetTitleSize(0.07);
      Stack[h].mc[ch]->GetYaxis()->SetLabelSize(0.055);
      Stack[h].mc[ch]->GetYaxis()->SetNdivisions(607);
      //Stack[h].mc[ch]->GetYaxis()->SetLabelSize(0.05);
      TGaxis *hYaxis = (TGaxis*)Stack[h].mc[ch]->GetYaxis();
      //hYaxis->SetMaxDigits(3);
      Stack[h].mc[ch]->GetXaxis()->SetLabelSize(0.0);
      Stack[h].mc[ch]->GetXaxis()->SetTitle("");

      float maxh = Data[h].hist[ch]->GetMaximum();
      if(maxh < Stack[h].mc[ch]->GetMaximum()) maxh = Stack[h].mc[ch]->GetMaximum();
      Stack[h].mc[ch]->SetMaximum(1.7*maxh);
      
      //-------------------------------------------------------
      // Band error
      TGraphErrors *thegraph = new TGraphErrors(Stack[h].hist[ch]);
      thegraph->SetName("thegraph");
      thegraph->SetFillStyle(1001);
      thegraph->SetFillColor(chatch);
      thegraph->SetLineColor(chatch);

      thegraph->Draw("e2SAME");

      //-------------------------------------------------------
      // Other ttbar generators
      ttbar_1[h].hist[ch]->SetLineColor(6);
      ttbar_1[h].hist[ch]->SetLineStyle(2);
      ttbar_1[h].hist[ch]->SetFillColor(0);
      ttbar_1[h].hist[ch]->Draw("histoSAME");

      ttbar_2[h].hist[ch]->SetLineColor(8);
      ttbar_2[h].hist[ch]->SetLineStyle(4);
      ttbar_2[h].hist[ch]->SetFillColor(0);
      ttbar_2[h].hist[ch]->Draw("histoSAME");
      //-------------------------------------------------------
      // Data Histogram
      Data[h].hist[ch]->SetMarkerStyle(20);
      Data[h].hist[ch]->SetMarkerSize(0.7);

      Data[h].hist[ch]->Draw("SAME");

      /***********************
             Legends
      ***********************/
      TLegend *leg;
      float legx1=0.76;
      float legy1=0.54;
      float legx2=0.90;
      float legy2=0.87;
      leg = new TLegend(legx1,legy1,legx2,legy2);
开发者ID:brochero,项目名称:TopCodeljets,代码行数:67,代码来源:Plots.C

示例10: gyieldsp


//.........这里部分代码省略.........
   6.164321,
   6.1019,
   4.954787,
   4.773841,
   2.599375};
   Double_t Graph2_fehx3023[10] = {
   0.2,
   0.25,
   0.25,
   0.25,
   0.25,
   0.25,
   0.25,
   0.25,
   0.25,
   0.2};
   Double_t Graph2_fehy3023[10] = {
   8.262572,
   7.14746,
   6.62492,
   6.725295,
   5.946212,
   5.838684,
   5.077774,
   5.257491,
   3.443198,
   2.602454};
   grae = new TGraphAsymmErrors(10,Graph2_fx3023,Graph2_fy3023,Graph2_felx3023,Graph2_fehx3023,Graph2_fely3023,Graph2_fehy3023);
   grae->SetName("Graph2");
   grae->SetTitle("Graph");

   ci = TColor::GetColor("#009900");
   grae->SetFillColor(ci);
   grae->SetFillStyle(3375);

   ci = TColor::GetColor("#009900");
   grae->SetLineColor(ci);
   grae->SetLineStyle(7);
   grae->SetLineWidth(4);
   grae->SetMarkerStyle(20);
   
   TH1F *Graph_Graph3023 = new TH1F("Graph_Graph3023","Graph",100,-2.88,2.88);
   Graph_Graph3023->SetMinimum(33.22782);
   Graph_Graph3023->SetMaximum(108.7062);
   Graph_Graph3023->SetDirectory(0);
   Graph_Graph3023->SetStats(0);
   Graph_Graph3023->SetLineStyle(0);
   Graph_Graph3023->SetMarkerStyle(20);
   Graph_Graph3023->GetXaxis()->SetLabelFont(42);
   Graph_Graph3023->GetXaxis()->SetLabelOffset(0.007);
   Graph_Graph3023->GetXaxis()->SetLabelSize(0.05);
   Graph_Graph3023->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph3023->GetXaxis()->SetTitleOffset(1.1);
   Graph_Graph3023->GetXaxis()->SetTitleFont(42);
   Graph_Graph3023->GetYaxis()->SetLabelFont(42);
   Graph_Graph3023->GetYaxis()->SetLabelOffset(0.007);
   Graph_Graph3023->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph3023->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph3023->GetYaxis()->SetTitleOffset(1.5);
   Graph_Graph3023->GetYaxis()->SetTitleFont(42);
   Graph_Graph3023->GetZaxis()->SetLabelFont(42);
   Graph_Graph3023->GetZaxis()->SetLabelOffset(0.007);
   Graph_Graph3023->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph3023->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph3023->GetZaxis()->SetTitleFont(42);
   grae->SetHistogram(Graph_Graph3023);
开发者ID:echapon,项目名称:HIN-13-007,代码行数:67,代码来源:gyieldsp.C

示例11: PostFitCombine


//.........这里部分代码省略.........
    gStyle->SetGridWidth(1);
    gStyle->SetGridColor(14);
    pad[1]->SetGridx();
    pad[1]->SetGridy();
    pad[1]->SetTopMargin(0.05);
    pad[1]->SetBottomMargin(0.4);
    pad[1]->SetRightMargin(0.04);

    //Plot Pad
    pad[2] = (TPad*)glpad[1]->GetPad(1);
    pad[2]->SetPad(0.01, 0.23, 0.99, 0.99);
    pad[2]->SetTopMargin(0.1);
    pad[2]->SetRightMargin(0.04);
    
    //Ratio Pad
    pad[3] = (TPad*)glpad[1]->GetPad(2);
    pad[3]->SetPad(0.01, 0.02, 0.99, 0.3);
    gStyle->SetGridWidth(1);
    gStyle->SetGridColor(14);
    pad[3]->SetGridx();
    pad[3]->SetGridy();
    pad[3]->SetTopMargin(0.05);
    pad[3]->SetBottomMargin(0.4);
    pad[3]->SetRightMargin(0.04);
    
    pad[0]->cd();

    hstyle->Draw();
    AllMC[ich] -> Draw("HISTSAME"); 
    hData[ich] -> Draw("PSAME"); 
    
    TH1D *RatioFull = HistoRatio (hData[ich] , (TH1D*) AllMC[ich]->GetStack()->Last());
    TGraphErrors *gRatioFull = new TGraphErrors(RatioFull);
    gRatioFull->SetFillStyle(1001);
    gRatioFull->SetFillColor(chatch);
    gRatioFull->SetName("gRatioFull");


    TLegend *leg;
    float legPos[4] = {0.70,  // x_o
		       0.40,  // y_o
		       0.94,  // x_f
		       0.87}; // y_f
 
    leg = new TLegend(legPos[0],legPos[1],legPos[2],legPos[3]);
    leg->SetFillColor(0);
    leg->SetLineColor(0);
    leg->SetLineWidth(0.0);
    leg->SetTextFont(62);
    leg->SetTextSize(0.03);
    leg->SetNColumns(2);
  
    leg->AddEntry(hData[ich],         "Data","PL");
    leg->AddEntry(hInput[ich].at(11), "Z+Jets","F");
    leg->AddEntry(hInput[ich].at(10), "VV","F");
    leg->AddEntry(hInput[ich].at(9),  "Single t","F");
    leg->AddEntry(hInput[ich].at(8),  "QCD","F");
    leg->AddEntry(hInput[ich].at(7),  "W+Jets","F");
    leg->AddEntry(hInput[ich].at(6),  "t#bar{t}+V","F");
    leg->AddEntry(hInput[ich].at(5),  "t#bar{t}+H","F");
    leg->AddEntry(hInput[ich].at(4),  "t#bar{t}+other","F");
    leg->AddEntry(hInput[ich].at(3),  "t#bar{t}+LF","F");
    leg->AddEntry(hInput[ich].at(2),  "t#bar{t}+cc","F");
    leg->AddEntry(hInput[ich].at(1),  "t#bar{t}+bj","F");
    leg->AddEntry(hInput[ich].at(0),  "t#bar{t}+bb","F");
    leg->AddEntry(gRatioFull,         "Stat. Unc.","F");
开发者ID:brochero,项目名称:LepJetsAnalyzer,代码行数:67,代码来源:PostFitCombine.C

示例12: draw

void draw(){
  
TGraphErrors *gll = new TGraphErrors();
TGraphErrors *gjj = new TGraphErrors();

 for (int i = 0 ; i < 15 ; ++i){
   float content = h_lep_m_signal->GetBinContent(i) + h_lep_m_background->GetBinContent(i) + h_lep_m_wjets->GetBinContent(i);
   gll -> SetPoint(i,i*100-50.,content);
   float errorb = h_lep_m_background->GetBinContent(i)*0.08*h_lep_m_background->GetBinContent(i);
   float errors = h_lep_m_signal->GetBinContent(i)*0.08*h_lep_m_signal->GetBinContent(i);
   float errorw = 0.40 * h_lep_m_wjets->GetBinContent(i)*h_lep_m_wjets->GetBinContent(i);
   float pesi = h_lep_m_background->GetBinContent(i) + h_lep_m_signal->GetBinContent(i) + h_lep_m_wjets->GetBinContent(i);
   float error = sqrt(errorb*errorb + errorw*errorw + errors*errors) / pesi;
   gll -> SetPointError(i,100/2.,error);
 }

for (int i = 0 ; i < 10 ; ++i){
  float content = h_jet_m_signal->GetBinContent(i) + h_jet_m_background->GetBinContent(i) + h_jet_m_wjets->GetBinContent(i);
  gjj -> SetPoint(i,i*500-250.,content);	
  float errorb = h_jet_m_background->GetBinContent(i)*0.08*h_jet_m_background->GetBinContent(i);
  float errors = h_jet_m_signal->GetBinContent(i)*0.08*h_jet_m_signal->GetBinContent(i);
  float errorw = 0.40 * h_jet_m_wjets->GetBinContent(i)*h_jet_m_wjets->GetBinContent(i);
  float pesi = h_jet_m_background->GetBinContent(i) + h_jet_m_signal->GetBinContent(i) + h_jet_m_wjets->GetBinContent(i);	
  float error = sqrt(errorb*errorb + errorw*errorw + errors*errors) / pesi;
  gjj -> SetPointError(i,500/2.,error);
 }
 
 gll->SetFillStyle(3002);
 gjj->SetFillStyle(3002);
 
 gll -> SetFillColor(kBlack);
 gjj -> SetFillColor(kBlack);
 
 
 cout<<"signal tot = "<<scontTot<<endl;
 cout<<"signal mjj = "<<scontMjj<<endl;
 cout<<"signal deta = "<<scontDeta<<endl;
 cout<<"signal mll = "<<scontMll<<endl;
 cout<<"signal dy = "<<scontDY<<endl;
 cout<<"signal met = "<<scontMET<<"\n"<<endl;
 
 cout<<"background tot = "<<contTot<<endl;
 cout<<"background mjj = "<<contMjj<<endl;
 cout<<"background deta = "<<contDeta<<endl;
 cout<<"background mll = "<<contMll<<endl;
 cout<<"background dy = "<<contDY<<endl;
 cout<<"background met = "<<contMET<<"\n"<<endl;
 
 cout<<"wjets tot = "<<wcontTot<<endl;
 cout<<"wjets mjj = "<<wcontMjj<<endl;
 cout<<"wjets deta = "<<wcontDeta<<endl;
 cout<<"wjets mll = "<<wcontMll<<endl;
 cout<<"wjets dy = "<<wcontDY<<endl;
 cout<<"wjets met = "<<wcontMET<<"\n"<<endl;
 
 TH1F *axis = new TH1F ("mll Signal & Backgrounds","mll Signal & Backgrounds",15,0.,1500.);
 axis -> GetXaxis() -> SetRangeUser(0.,1500.);
 axis -> GetYaxis() -> SetRangeUser(0.,120.);
 axis -> GetXaxis () -> SetTitle("Leptons Invariant Mass [GeV]");
 axis -> GetYaxis () -> SetTitle("Counts per Bin");
 axis -> GetYaxis () -> SetTitleOffset(1.3);
 axis -> SetStats(0);
 
 TH1F *axis2 = new TH1F ("mjj Signal & Backgrounds","mjj Signal & Backgrounds",10,0.,5000.);
 axis2 -> GetXaxis() -> SetRangeUser(0.,5000.);
 axis2 -> GetYaxis() -> SetRangeUser(0.,105.);
 axis2 -> GetXaxis () -> SetTitle("Tag Jets Invariant Mass [GeV]");
 axis2 -> GetYaxis () -> SetTitle("Counts per Bin");
 axis2 -> GetYaxis () -> SetTitleOffset(1.3);
 axis2 -> SetStats(0);
 
 THStack* hs = new THStack("hs","mll Signal & Background");
 
 h_lep_m_signal -> SetFillColor(kGreen+1);
 h_lep_m_background -> SetFillColor(kRed+1);
 h_lep_m_wjets -> SetFillColor(kBlue+1);
 
 hs -> Add ( h_lep_m_background );
 hs -> Add ( h_lep_m_wjets );
 hs -> Add ( h_lep_m_signal );
 
 TCanvas *c1 = new TCanvas("c1","c1",600.,600.);
 c1 -> cd();
 axis -> Draw();
 //c1 -> DrawFrame(0.,0.,1500.,40.);
 hs -> Draw("same");
 hs -> GetXaxis () -> SetTitle("Leptons Invariant Mass [GeV]");
 hs -> GetYaxis () -> SetRangeUser(0.,40.);
 TLegend *leg = new TLegend(0.54,0.3,0.89,0.5);
 leg->SetHeader("Luminosity = 300fb^{-1} @ 13TeV");
 leg->AddEntry(h_lep_m_signal,"Signal","f");
 leg->AddEntry(h_lep_m_background,"QCD Background","f");
 leg->AddEntry(h_lep_m_wjets,"W + Jets Background","f");
 leg->SetFillColor(kWhite);
 leg->SetLineColor(kWhite);
 leg->Draw();
 gll->Draw("same,2");
 c1 -> Print("stack.C");
 c1 -> Print("stack.pdf","pdf");
 c1 -> Print("stack.png","png");
//.........这里部分代码省略.........
开发者ID:NTrevisani,项目名称:WW13TeV,代码行数:101,代码来源:mva2.C

示例13: Pythia8_Dijet30_result_JER_akPu4PF_

void Pythia8_Dijet30_result_JER_akPu4PF_((abs(refeta)<2)&&(hiBin>60))&&(refpt>30)_refeta()
{
//=========Macro generated from canvas: Can_result_3/
//=========  (Mon Apr 18 04:08:04 2016) by ROOT version6.02/13
   TCanvas *Can_result_3 = new TCanvas("Can_result_3", "",18,40,700,500);
   gStyle->SetOptFit(1);
   Can_result_3->Range(-2.75,0.1715425,2.75,0.2926317);
   Can_result_3->SetFillColor(0);
   Can_result_3->SetBorderMode(0);
   Can_result_3->SetBorderSize(2);
   Can_result_3->SetFrameBorderMode(0);
   Can_result_3->SetFrameBorderMode(0);
   
   TMultiGraph *multigraph = new TMultiGraph();
   multigraph->SetName("name");
   multigraph->SetTitle("JER_akPu4PF");
   
   Double_t Graph_fx1007[9] = {
   -1.8,
   -1.4,
   -1,
   -0.6,
   -0.2,
   0.2,
   0.6,
   1,
   1.6};
   Double_t Graph_fy1007[9] = {
   0.2213775,
   0.2313726,
   0.212349,
   0.1992318,
   0.2015521,
   0.2047929,
   0.2065286,
   0.2141753,
   0.2298097};
   Double_t Graph_fex1007[9] = {
   0.2,
   0.2,
   0.2,
   0.2,
   0.2,
   0.2,
   0.2,
   0.2,
   0.4};
   Double_t Graph_fey1007[9] = {
   0.001529502,
   0.001378741,
   0.001274153,
   0.001286487,
   0.00132694,
   0.001354738,
   0.001397823,
   0.001305814,
   0.001034891};
   TGraphErrors *gre = new TGraphErrors(9,Graph_fx1007,Graph_fy1007,Graph_fex1007,Graph_fey1007);
   gre->SetName("Graph");
   gre->SetTitle("some title_0");
   gre->SetFillColor(1);
   gre->SetFillStyle(0);
   
   TH1F *Graph_Graph1007 = new TH1F("Graph_Graph1007","some title_0",100,-2.4,2.4);
   Graph_Graph1007->SetMinimum(0.1944648);
   Graph_Graph1007->SetMaximum(0.236232);
   Graph_Graph1007->SetDirectory(0);
   Graph_Graph1007->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   Graph_Graph1007->SetLineColor(ci);
   Graph_Graph1007->GetXaxis()->SetLabelFont(42);
   Graph_Graph1007->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetXaxis()->SetTitleFont(42);
   Graph_Graph1007->GetYaxis()->SetLabelFont(42);
   Graph_Graph1007->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetYaxis()->SetTitleFont(42);
   Graph_Graph1007->GetZaxis()->SetLabelFont(42);
   Graph_Graph1007->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1007);
   
   multigraph->Add(gre,"");
   
   Double_t Graph_fx1008[20] = {
   -1.9,
   -1.7,
   -1.5,
   -1.2,
   -0.9,
   -0.7,
   -0.5,
   -0.3,
   -0.1,
   0.1,
//.........这里部分代码省略.........
开发者ID:Jelov,项目名称:JetEnergy_SR,代码行数:101,代码来源:Pythia8_Dijet30_result_JER_akPu4PF_((abs(refeta)<2)&&(hiBin>60))&&(refpt>30)_refeta.C

示例14: vnpt_5panels_ratio


//.........这里部分代码省略.........

if(iw==0||iw<6){
    TF1 *fitFun = new TF1("fitFun","pol1", 0, 4);
    fitFun->SetLineColor(2);
    ge->Fit("fitFun","R+");
    fitFun->Draw("same");
cout<<fitFun->Eval(0.4)<<",  "<<fitFun->Eval(0.9)<<",  "<<fitFun->Eval(1.9)<<",  "<<fitFun->Eval(3.5)<<endl;
    double p0 = fitFun->GetParameter(0);
    double p0Err = fitFun->GetParError(0);
    double p1 = fitFun->GetParameter(1);
    double p1Err = fitFun->GetParError(1);
    //double p2 = fitFun->GetParameter(2);
    //double p2Err = fitFun->GetParError(2);

  //TF1 *fitFunE = new TF1("fitFunE","[0]+[1]*x+[2]*x*x", 0, 4);
  TF1 *fitFunE = new TF1("fitFunE","[0]+[1]*x", 0, 4);
  //fitFunE->SetParameters(p0+p0Err, p1+p1Err, p2+p2Err);
  fitFunE->SetParameters(p0+p0Err, p1);
  for(int ipt=0; ipt<nPlotBin; ipt++){
    ptPlot[ipt] = ipt*0.1+0.05;
    vnPlot[ipt] = fitFun->Eval(ptPlot[ipt]);
    errPlot[ipt] = fitFunE->Eval(ptPlot[ipt]) - fitFun->Eval(ptPlot[ipt]);
  }

  TGraphErrors *graph = new TGraphErrors(nPlotBin,ptPlot,vnPlot,0,errPlot);
  graph->SetTitle("");
  graph->SetMarkerStyle(20);
  graph->SetMarkerSize(1.0);
  graph->SetMarkerColor(1);
  graph->SetLineWidth(2);
  graph->SetLineColor(2);
MyStyle->SetFillColor(kRed+1);
  graph->SetFillColor(kRed+1);
graph->SetFillStyle(3002);
  graph->Draw("e3same");

}
else {
    TF1 *fitFun = new TF1("fitFun","pol1", 0, 4);
    fitFun->SetLineColor(4);
    ge->Fit("fitFun","R+");
    fitFun->Draw("same");
cout<<fitFun->Eval(0.4)<<",  "<<fitFun->Eval(0.9)<<",  "<<fitFun->Eval(1.9)<<",  "<<fitFun->Eval(3.5)<<endl;

}

    double chi2 = fitFun->GetChisquare();
    double ndf = fitFun->GetNDF();
   TLatex *tex = new TLatex(0.6,0.53,Form("#chi^{2}/ndf = %2.1f", chi2/ndf));
   tex->SetTextColor(2);
   tex->SetTextSize(16);
   tex->Draw("same");


    can->cd(iw+1+5);
    tex=new TLatex(2.1,1.4,htitc2[iw]);
    if ( iw == 0)   tex->SetTextSize(textsize);
    else if (iw == 8) tex->SetTextSize(textsize);
    else  tex->SetTextSize(textsize);
    tex->Draw();

    for (int im=0;im<1;im++)
    {
      int j=im*5+iw;
      int col=2;
      //if (ndp[j]==0) continue;
开发者ID:tuos,项目名称:FlowAndCorrelations,代码行数:67,代码来源:vnpt_5panels_ratio.C

示例15: DrawNCLUSTER

void DrawNCLUSTER()
{
  //=========Macro generated from canvas: r1/Energy
  //=========  (Fri Apr  6 17:14:48 2012) by ROOT version5.28/00g
  TCanvas *r1 = new TCanvas("r1", "Ncluster",12,24,550,741);
  gStyle->SetOptStat(0);
  gStyle->SetOptTitle(0);
  gStyle->SetFrameLineWidth(1);
  r1->Range(0,0,1,1);
  r1->SetFillColor(0);
  r1->SetBorderMode(0);
  r1->SetBorderSize(0);
  r1->SetTickx(1);
  r1->SetTicky(1);
  r1->SetLeftMargin(0.16);
  r1->SetRightMargin(0.01);
  r1->SetTopMargin(0.0256917);
  r1->SetBottomMargin(0.07692308);
  r1->SetFrameBorderMode();
  
  // ------------>Primitives in pad: r1_1
  TPad *r1_1 = new TPad("r1_1", "Energy_1",0.02,0.37,0.95,0.99);
  r1_1->Draw();
  r1_1->cd();
  r1_1->Range(-19,0.01,95,95);
  r1_1->SetFillColor(0);
  r1_1->SetBorderMode(0);
  r1_1->SetBorderSize(2);
  r1_1->SetTickx(1);
  r1_1->SetTicky(1);
  r1_1->SetLeftMargin(0.16);
  r1_1->SetRightMargin(0.01);
  r1_1->SetTopMargin(0.02);
  r1_1->SetBottomMargin(0);
  r1_1->SetFrameBorderMode(0);
  r1_1->SetFrameBorderMode(0);
   
  TH1D *he = new TH1D("he"," ",55,0,55);
  he->SetMinimum(0.01);
  he->SetMaximum(70);
  he->SetStats(0);
  he->GetXaxis()->SetTitle("E_{beam} [GeV]");
  he->GetXaxis()->SetLabelFont(43);
  he->GetXaxis()->SetLabelSize(0);
  he->GetXaxis()->SetTitleFont(43);
  he->GetXaxis()->SetTitleSize(0); 
  he->GetYaxis()->SetTitle("<N_{cluster}>");
  he->GetYaxis()->SetLabelFont(43);
  he->GetYaxis()->SetTitleSize(30);
  he->GetYaxis()->SetLabelSize(20);
  he->GetYaxis()->SetTitleFont(43);
  he->GetYaxis()->SetTitleOffset(1.7);
  he->GetZaxis()->SetLabelFont(42);
  he->GetZaxis()->SetTitleSize(0.05);
  he->GetZaxis()->SetTitleFont(42);
  he->Draw("");
   
  std::vector<result> resultData=readTXT(std::string("ncluster_augsep2012_electron.txt"));
  TGraphErrors *gre = new TGraphErrors(resultData.size());
  gre->SetName("Graph");
  gre->SetTitle("Graph");
  gre->SetLineColor(1);
  gre->SetFillStyle(1);
  gre->SetFillColor(1);
  gre->SetLineWidth(2);
  gre->SetMarkerColor(1);
  gre->SetMarkerStyle(34);
  gre->SetMarkerSize(1.2);
  for(unsigned int i=0; i<resultData.size(); i++){
    gre->SetPoint(i,resultData.at(i).ebeam,resultData.at(i).ncluster);
    gre->SetPointError(i,0,resultData.at(i).nclusterError);
  }

  TH1F *Graph_Graph3 = new TH1F("Graph_Graph3","Graph",100,0,87.5);
  Graph_Graph3->SetMinimum(0);
  Graph_Graph3->SetMaximum(1193.483);
  Graph_Graph3->SetDirectory(0);
  Graph_Graph3->SetStats(0);
  Graph_Graph3->GetXaxis()->SetLabelFont(42);
  Graph_Graph3->GetXaxis()->SetTitleSize(0.05);
  Graph_Graph3->GetXaxis()->SetTitleFont(42);
  Graph_Graph3->GetYaxis()->SetLabelFont(42);
  Graph_Graph3->GetYaxis()->SetTitleSize(0.05);
  Graph_Graph3->GetYaxis()->SetTitleFont(42);
  Graph_Graph3->GetZaxis()->SetLabelFont(42);
  Graph_Graph3->GetZaxis()->SetTitleSize(0.05);
  Graph_Graph3->GetZaxis()->SetTitleFont(42);
  gre->SetHistogram(Graph_Graph3);
   
  gre->Draw("p");
   
  std::vector<result> resultFTFP=readTXT(std::string("ncluster_ftfp_bert_hp_electron.txt"));
  gre = new TGraphErrors(resultFTFP.size());
  gre->SetName("Graph");
  gre->SetTitle("Graph");
  gre->SetFillColor(kRed-3);
  gre->SetMarkerColor(kRed-3);
  gre->SetLineWidth(2);
  gre->SetMarkerStyle(20);
  for(unsigned int i=0; i<resultFTFP.size(); i++){
//.........这里部分代码省略.........
开发者ID:arnaudsteen,项目名称:root_macros,代码行数:101,代码来源:NCLUSTERELECTRON.C


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