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


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

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


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

示例1: etaDependence_V2Ana


//.........这里部分代码省略.........
  tex2->SetLineWidth(2);
  tex2->Draw();

  TLatex *tex3 = new TLatex(0.25,0.83,"L_{int} = 150 #mub^{-1}");
  tex3->SetNDC();
  tex3->SetTextAlign(13);
  tex3->SetTextFont(43);
  tex3->SetTextSize(18);
  tex3->SetLineWidth(2);
  tex3->Draw();

  lt1->DrawLatex(0.75,0.25,Form("%s",legend[choseSignal]));  // what signal is
  if(bSavePlots)
    {
      pc1->SaveAs(Form("%s_%s_Jpsi_%d_%d_150mub.png",chosenSignal,nameoutfile[1],vcts1,vcts2));
      pc1->SaveAs(Form("%s_%s_Jpsi_%d_%d_150mub.pdf",chosenSignal,nameoutfile[1],vcts1,vcts2));
      
      pc1->Clear();
    }
    }// centrality loop

  //_______________ SUMMARY!!!!
  TCanvas *c2 = new TCanvas("c2","c2");
  // makeMultiPanelCanvas(c2,1,1,0.0,0.0,0.2,0.15,0.02);
  
  double ptBinsFwd[2]      = {4.75, 23.5};
  double ptErrsFwd[3]      = {0.0, 0.0};
  double ptBinsBar[2]      = {23.5};
  double ptErrsBar[2]      = {0.0};

  TH1F *hPad2 = new TH1F("hPad2",";p_{T};Uncorrected v2;",1,0,40);
  hPad2->SetMaximum(0.3);
  hPad2->SetMinimum(-0.3);
  TLegend *leg1 = new TLegend(0.2,0.75,0.45,0.9);
  leg1->SetFillColor(0);
  c2->cd(1);
      
  // [centrality][rapidity][pt]
  double v2PtBarr[1]    = {pr[0][0][1]};
  double v2PtBarrErr[1] = {ep[0][0][1]};

  double v2PtForw[2]    = {pr[0][2][0], pr[0][2][1]};  
  double v2PtForwErr[2] = {ep[0][2][0], ep[0][2][1]};
  
  TGraphErrors *gPtBarr = new TGraphErrors(1, ptBinsBar, v2PtBarr, ptErrsBar, v2PtBarrErr);  
  TGraphErrors *gPtForw = new TGraphErrors(2, ptBinsFwd, v2PtForw, ptErrsFwd, v2PtForwErr);  
  gPtBarr->SetMarkerStyle(20);
  gPtBarr->SetMarkerSize(1.2);
  gPtBarr->SetMarkerColor(kBlue+2);
  
  gPtForw->SetMarkerStyle(21);
  gPtForw->SetMarkerSize(1.2);
  gPtForw->SetMarkerColor(kRed+2);
  
  hPad2->Draw();
  gPtBarr->Draw("p");
  gPtForw->Draw("p");
  c2->Update();
 
  leg1->AddEntry(gPtBarr,"|y| < 1.2","P");
  leg1->AddEntry(gPtForw,"1.6 < |y| < 2.4","P");
  lt1->DrawLatex(0.7,0.15,Form("%s",eventPlane[1]));
  lt1->SetTextSize(0.06);
  lt1->DrawLatex(0.7,0.25,Form("%d - %d %%",cts[0],cts[1]));


  //_______ stuff to write
  leg1->Draw("same");
 TLatex *tex4 = new TLatex(0.65,0.93,"CMS Preliminary");
  tex4->SetNDC();
  tex4->SetTextAlign(13);
  tex4->SetTextFont(43);
  tex4->SetTextSize(23);
  tex4->SetLineWidth(1);
  tex4->Draw();

  TLatex *tex5 = new TLatex(0.65,0.87,"PbPb  #sqrt{s_{NN}} = 2.76 TeV");
  tex5->SetNDC();
  tex5->SetTextAlign(13);
  tex5->SetTextFont(43);
  tex5->SetTextSize(18);
  tex5->SetLineWidth(2);
  tex5->Draw();

  TLatex *tex6 = new TLatex(0.65,0.81,"L_{int} = 150 #mub^{-1}");
  tex6->SetNDC();
  tex6->SetTextAlign(13);
  tex6->SetTextFont(43);
  tex6->SetTextSize(18);
  tex6->SetLineWidth(2);
  tex6->Draw();
  lt1->DrawLatex(0.8,0.6,Form("%s",legend[choseSignal]));  // what signal is
  c2->Update();
  if(bSavePlots)
    {
      c2->SaveAs(Form("%s_jpsi_%s_v2_y.png",chosenSignal,nameoutfile[1]));
      c2->SaveAs(Form("%s_jpsi_%s_v2_y.pdf",chosenSignal,nameoutfile[1]));
    }
 
}
开发者ID:cmironov,项目名称:UserCode,代码行数:101,代码来源:etaDependence_V2Ana.C

示例2: extractK


//.........这里部分代码省略.........
    cout << "total : " << tot << endl;
    cout << "Z     : " <<   Z << endl;
    cout << "K     : " << Form("%.2f +/- %.3f",K[i],Kerr[i]) << endl << endl;
    cout << "MC    : " << endl;
    cout << "total : " << totMC << endl;
    cout << "Z     : " <<   ZMC << endl;
    cout << "K     : " << Form("%.2f +/- %.3f",KMC[i],KMCerr[i]) << endl;
    cout << "--------------------------------------------------------------" << endl;
    cout << endl;
  }

  float x[nbins];
  float xerr[nbins];
  
  for(int i = 0 ; i < nbins ; ++i ){
    x[i]    = i+1;
    xerr[i] = 0;
  }

  TCanvas *c1 = new TCanvas();
  c1->cd();
  gPad->SetGridy();

  TH2F* hdummy = new TH2F("hdummy","",nbins,0.5,nbins+0.5,10,0,0.2);
  hdummy->Draw();
  hdummy->GetXaxis()->SetTitle("E_{T}^{miss} [GeV]");
  hdummy->GetYaxis()->SetTitle("K");
  if( bveto ){
    if( exclusive ){
      hdummy->GetXaxis()->SetBinLabel(1,"0-30");
      hdummy->GetXaxis()->SetBinLabel(2,"30-60");
      hdummy->GetXaxis()->SetBinLabel(3,"60-80");
      hdummy->GetXaxis()->SetBinLabel(4,"80-100");
      hdummy->GetXaxis()->SetBinLabel(5,"100-150");
      hdummy->GetXaxis()->SetBinLabel(6,"150-200");
      hdummy->GetXaxis()->SetBinLabel(7,">200");
    }
    else{
      hdummy->GetXaxis()->SetBinLabel(1,">0");
      hdummy->GetXaxis()->SetBinLabel(2,">30");
      hdummy->GetXaxis()->SetBinLabel(3,">60");
      hdummy->GetXaxis()->SetBinLabel(4,">80");
      hdummy->GetXaxis()->SetBinLabel(5,">100");
      hdummy->GetXaxis()->SetBinLabel(6,">150");
      hdummy->GetXaxis()->SetBinLabel(7,">200");
    }
  }
  else{
    if( exclusive ){
      hdummy->GetXaxis()->SetBinLabel(1,"0-30");
      hdummy->GetXaxis()->SetBinLabel(2,"30-60");
      hdummy->GetXaxis()->SetBinLabel(3,"60-100");
      hdummy->GetXaxis()->SetBinLabel(4,"100-200");
      hdummy->GetXaxis()->SetBinLabel(5,"200-300");
      hdummy->GetXaxis()->SetBinLabel(6,">300");
    }
    else{
      hdummy->GetXaxis()->SetBinLabel(1,">0");
      hdummy->GetXaxis()->SetBinLabel(2,">30");
      hdummy->GetXaxis()->SetBinLabel(3,">60");
      hdummy->GetXaxis()->SetBinLabel(4,">100");
      hdummy->GetXaxis()->SetBinLabel(5,">200");
      hdummy->GetXaxis()->SetBinLabel(6,">300");
    }
  }

  TGraphErrors *gr   = new TGraphErrors(nbins,x,K,xerr,Kerr);
  TGraphErrors *grMC = new TGraphErrors(nbins,x,KMC,xerr,KMCerr);
  gr->GetXaxis()->SetTitle("E_{T}^{miss} bin");
  gr->GetYaxis()->SetTitle("K");
  gr->SetMaximum(0.2);
  grMC->SetLineColor(2);
  grMC->SetMarkerColor(2);
  grMC->SetMarkerStyle(25);

  gr->Draw("sameP");
  grMC->Draw("sameP");

  TLegend* leg = new TLegend(0.2,0.2,0.4,0.4);
  leg->AddEntry(gr,"data","lp");
  leg->AddEntry(grMC,"MC","lp");
  leg->SetFillColor(0);
  leg->SetBorderSize(1);
  leg->Draw();

  if( printplot ){

    if( bveto ){
      if(exclusive ) c1->Print("../plots/extractK_exclusive_bveto.pdf");
      else           c1->Print("../plots/extractK_inclusive_bveto.pdf");
    }

    else{
      if(exclusive ) c1->Print("../plots/extractK_exclusive.pdf");
      else           c1->Print("../plots/extractK_inclusive.pdf");
    }

  }

}
开发者ID:cmstas,项目名称:ZMet2012,代码行数:101,代码来源:extractK.C

示例3: compare_y


//.........这里部分代码省略.........
        nonPrJpsiTrad_mb[0]  = raaTrad_npr;
        nonPrJpsiTradErr_mb[0]  = raaTradErr_npr;


        break;
      }
    }//loop end: for(int ibin=1; ibin<=numBins; ibin++)
  }//loop end: for(int ih=0; ih<nInHist;ih++)

  // ***** //Drawing
  // pr
  TGraphErrors *gPrJpsi     = new TGraphErrors(nBinsY, binsY, prJpsi_y, binsYErr, prJpsiErr_y);
  TGraphErrors *gPrJpsi_mb  = new TGraphErrors(nBinsMB, binsYMB, prJpsi_mb, binsYMBErr, prJpsiErr_mb);
  TGraphErrors *gPrJpsi_y_y = new TGraphErrors(nBinsY3, binsY3, prJpsi_y_y, binsY3Err, prJpsiErr_y_y);
 
  // nonPr   
  TGraphErrors *gNonPrJpsi    = new TGraphErrors(nBinsY, binsY, nonPrJpsi_y, binsYErr, nonPrJpsiErr_y);
  TGraphErrors *gNonPrJpsi_mb = new TGraphErrors(nBinsMB, binsYMB, nonPrJpsi_mb, binsYMBErr, nonPrJpsiErr_mb);
  TGraphErrors *gNonPrJpsi_y_y= new TGraphErrors(nBinsY3, binsY3, nonPrJpsi_y_y, binsY3Err, nonPrJpsiErr_y_y);

  //------------ trad
// pr
  TGraphErrors *gPrJpsiTrad    = new TGraphErrors(nBinsY, binsY, prJpsiTrad_y, binsYErr, prJpsiTradErr_y);
  TGraphErrors *gPrJpsiTrad_mb = new TGraphErrors(nBinsMB, binsYMB, prJpsiTrad_mb, binsYMBErr, prJpsiTradErr_mb);
  TGraphErrors *gPrJpsiTrad_y_y= new TGraphErrors(nBinsY3, binsY3, prJpsiTrad_y_y, binsY3Err, prJpsiTradErr_y_y);
 
  // nonPr   
  TGraphErrors *gNonPrJpsiTrad    = new TGraphErrors(nBinsY, binsY, nonPrJpsiTrad_y, binsYErr, nonPrJpsiTradErr_y);
  TGraphErrors *gNonPrJpsiTrad_mb = new TGraphErrors(nBinsMB, binsYMB, nonPrJpsiTrad_mb, binsYMBErr, nonPrJpsiTradErr_mb);
  TGraphErrors *gNonPrJpsiTrad_y_y= new TGraphErrors(nBinsY3, binsY3, nonPrJpsiTrad_y_y, binsY3Err, nonPrJpsiTradErr_y_y);

  //-------------------------------------------------------------------
  // **************** marker colors
  gPrJpsi->SetMarkerColor(kRed);
  gNonPrJpsi->SetMarkerColor(kOrange+2);

  //mnbias colors
  gPrJpsi_mb->SetMarkerColor(kCyan+2);
  gNonPrJpsi_mb->SetMarkerColor(kCyan+2);

  gPrJpsi_y_y->SetMarkerColor(kBlue-4);
  gNonPrJpsi_y_y->SetMarkerColor(kBlue-4);

  //--------- marker style  
  gPrJpsi->SetMarkerStyle(21);
  gPrJpsi_y_y->SetMarkerStyle(34);
  gNonPrJpsi->SetMarkerStyle(29);
  gNonPrJpsi_y_y->SetMarkerStyle(34);

  //mb
  gPrJpsi_mb->SetMarkerStyle(33);
  gNonPrJpsi_mb->SetMarkerStyle(33);
  
  // marker size
  gPrJpsi->SetMarkerSize(1.2);
  gPrJpsi_y_y->SetMarkerSize(1.7);
  gNonPrJpsi->SetMarkerSize(1.7);
  gNonPrJpsi_y_y->SetMarkerSize(1.7);

  //mb
  gPrJpsi_mb->SetMarkerSize(1.5);
  gNonPrJpsi_mb->SetMarkerSize(1.5);


  //--------------- traditional stuff
  gPrJpsiTrad->SetMarkerStyle(25);
开发者ID:goni,项目名称:Dimuons,代码行数:67,代码来源:compare_y.C

示例4: PlotPtTresh2

void PlotPtTresh2() {
	//  gROOT->ProcessLine(".L ./tdrstyle.C");
	//  setTDRStyle();
	Int_t r=1; 
	

	TFile *f1 = new TFile("histo_file_QCDPU50GEM2019.root");
	
	char  histo[40], histo1[40], histo2[40], histoDC[40];
	
	TH1F *hInitialBarrel = (TH1F*)f1->Get("hInitialBarrel"); 
	TH1F *hInitialEndcap = (TH1F*)f1->Get("hInitialEndcap"); 	
	
	TH1F *hPtBarrel = (TH1F*)f1->Get("hMuonPtFinal_Barrel"); 
	TH1F *hPtHE = (TH1F*)f1->Get("hMuonPtFinal_HE"); 
	TH1F *hPtFull = (TH1F*)f1->Get("hMuonPtFinal_Full"); 
	TH1F *hInitial = (TH1F*)f1->Get("entries_after_vertex"); 
	TH1F *hWP2012Pt = (TH1F*)f1->Get("hMuonPtWP2012"); 
	TH1F *h_HTot = (TH1F*)f1->Get("H_tot"); 
	TH1F *initial_entries = (TH1F*)f1->Get("initial_entries"); 
	
	cout<<"Htot"<<h_HTot->Integral()<<"  initial entries  "<<initial_entries->Integral()<<endl;
	
	int  Ninitial=hInitial->Integral();    
	cout<<" initial  "<<Ninitial<<endl;
	cout<<" initial  barrel "<<hInitialBarrel->Integral()<<endl;
	cout<<" initial endcap"<<hInitialEndcap->Integral()<<endl;
	
	cout<<" after muon barrel  "<<hPtBarrel->Integral()<<endl;
	cout<<" after muon HE  "<<hPtHE->Integral()<<endl;
	
	float MuonEff2012[1] =0;
	MuonEff2012[0]= hWP2012Pt->Integral()/hInitial->Integral();
	float Err_MuonEff2012[1];
	Err_MuonEff2012[0]=(TMath::Sqrt(Err_MuonEff2012[0]*(1-Err_MuonEff2012[0])))/Ninitial;
	//cout<<"Muon Eff WP 2012 "<<hWP2012Pt->Integral()/hInitial->Integral()<<endl;
	
	/////////////////////////compute selection eff as a function of muon pt threshold/////////////////////////////
	int EvAfterPtCut_HE[100]; float EffSel[100], xgr[100], ex[100],ey[100], EffSelFull[100], eyfull[100], Eff_Barrel[100], Eff_Endcap[100], err_Eff_barrel[100],err_Eff_endcap[100];
	int EvAfterPtCut_Barrel[100]; 
	int EvAfterPtCut[100];
	int EvAfterPtCut_BB[100];	
	int EvAfterPtCut_EE[100];	
	
	//  std::cout<<" Muon Pt in |eta|<2.4 "<<hMuonTot->Integral(0,200)<<endl;
	
	for(int i=0;i<40;i++){
		EvAfterPtCut_Barrel[i]=hPtBarrel->Integral(10,100);
		EvAfterPtCut_HE[i]=hPtHE->Integral(i+1,100);
		
		EvAfterPtCut[i]=hPtFull->Integral(i+1,100); 
		EvAfterPtCut_BB[i] =hPtBarrel->Integral(i+1,100);
		EvAfterPtCut_EE[i] =hPtHE->Integral(i+1,100);
		
		EffSelFull[i] = EvAfterPtCut[i] / (hInitialBarrel->Integral() + hInitialEndcap->Integral() );		
		Eff_Barrel[i]= EvAfterPtCut_BB[i]/hInitialBarrel->Integral();  
		Eff_Endcap[i]=EvAfterPtCut_EE[i]/hInitialEndcap->Integral();  
		
		std::cout<<i*2<<" nev after pt cut barrel "<<EvAfterPtCut_BB[i]<<"  nev after pt cut endcap  "<<EvAfterPtCut_HE[i]<<"  eff sel  "<<endl;
		
		xgr[i]=i*2;
		ex[i]=0; 
		EffSel[i]=(EvAfterPtCut_Barrel[i]+EvAfterPtCut_HE[i])/(hInitial->Integral());
		
		ey[i]=TMath::Sqrt((EffSel[i]*(1-EffSel[i])))/hInitial->Integral();
		eyfull[i]=TMath::Sqrt((EffSelFull[i]*(1-EffSelFull[i])))/hInitial->Integral();
		//  std::cout<<i*2<<" nev after pt cut barrel || endcap "<<EvAfterPtCut_Barrel[i]+EvAfterPtCut_HE[i]<<" eff sel  "<<EffSel[i]<<" errore "<<ey[i]<<endl;
	}
	
	double xgr12[1]; xgr12[0]=13.0; 
	double ex12[1]; ex12[0]=0.; 
	TGraphErrors* gr = new TGraphErrors(26,xgr,EffSel,ex,ey);
	TGraphErrors* gr_full = new TGraphErrors(26,xgr,EffSelFull,ex,eyfull);
	TGraph* gr12 = new TGraph(1);
	gr12->SetPoint(0,20,MuonEff2012[0]);
	
	TGraphErrors* gr_BB = new TGraphErrors(26,xgr,Eff_Barrel,ex,ey);	
	TGraphErrors* gr_EE = new TGraphErrors(26,xgr,Eff_Endcap,ex,ey);	
	
	///////////////////////////////////////////************************************////////////////////////////////////////////
	TCanvas *Canv5 = new TCanvas("Canv5","Palle",800,700);
	gr->SetMarkerStyle(24);  
	gr12->SetMarkerStyle(23); 
	gr->SetMarkerColor(kRed);  
	gr12->SetMarkerColor(kBlue);  
	gr->SetTitle(" Selection Efficiency as a function of muon pt threshold ");
	gr->GetYaxis()->SetTitle("Selection Efficiency");
	gr->GetYaxis()->SetTitleOffset(1.4);
	gr->GetXaxis()->SetTitle("P_{T}^{#mu Endcap} Cut (GeV/c)");
	
	gr->SetMarkerSize(1.2);  
	gr12->SetMarkerSize(1.4); 
	
	gr->Draw("ACP");
	gr12->Draw("CP");
	gr->SetMinimum(0.5);
	TLegend* legend = new TLegend( 0.15, 0.5, 0.75, 0.7);
	legend->SetTextSize(0.025);
	legend->SetFillColor(0);
	legend->AddEntry(gr, "PU=50 wGEM (P_{T}^{#mu, barrel}>20, |#eta|<2.1)","p");
//.........这里部分代码省略.........
开发者ID:rvenditti,项目名称:H2tau_GEMAnalysis,代码行数:101,代码来源:PlotPtTresh2.C

示例5: ofsfit


//.........这里部分代码省略.........
  hframe->Draw();

  /* Create legend */
  TLegend* leg_eta = new TLegend( 0.2, 0.6, 0.5, 0.9);
  leg_eta->SetNColumns(2);

  /* Create ofstream to write fit parameter results */
  ofstream ofsfit("track_momres_new.csv");
  ofsfit<<"eta,par1,par1err,par2,par2err"<<endl;

  /* Create resolution-vs-momentum plot with fits for each selected theta value */
  for ( int i = 0; i < etas_fit.size(); i++ )
    {
      /* Switch to scratch canvas */
      cscratch->cd();

      double eta = etas_fit.at(i);

      /* No tracking outside -4 < eta < 4 */
      if ( eta < -4 || eta > 4 )
	continue;

      cout << "\n***Eta = " << eta << endl;

      /* Define range of theta because float comparison with fixed value doesn't work
	 too well for cuts in ROOT trees */
      double eta_min = eta * 0.999;
      double eta_max = eta * 1.001;

      /* Cut for tree */
      TCut cutx( Form("ptrue > 1 && ( (etatrue > 0 && (etatrue > %f && etatrue < %f)) || (etatrue < 0 && (etatrue < %f && etatrue > %f)) )", eta_min, eta_max, eta_min, eta_max) );

      /* "Draw" tree on scratch canvas to fill V1...V4 arrays */
      tres->Draw("psig:ptrue:psig_err:0", cutx );

      /* Create TGraphErrors with selected data from tree */
      TGraphErrors *gres = new TGraphErrors( tres->GetEntries(cutx),
					     &(tres->GetV2())[0],
					     &(tres->GetV1())[0],
					     &(tres->GetV4())[0],
					     &(tres->GetV3())[0] );

      /* reset function parameters before fit */
      f_momres->SetParameter(0,0.1);
      f_momres->SetParameter(1,0.1);

      /* Only plot pseudorapidities listed on etas_vis; if not plotting, still do the fit */
      bool vis = false;
      int vi = 0;

      for ( vi = 0; vi < etas_vis.size(); vi++ )
	{
	  if ( abs( etas_vis.at(vi) - eta ) < 0.001 )
	    {
	      vis = true;
	      break;
	    }
	}

      if ( vis )
	{
	  /* Add graph to legend */
	  leg_eta->AddEntry(gres, Form("#eta = %.1f", eta), "P");

	  /* Add graph to plot */
	  c1->cd();
	  gres->SetMarkerColor(colors[vi]);
	  gres->Draw("Psame");
	  f_momres->SetLineColor(colors[vi]);
	  gres->Fit(f_momres);
	}
      else
	{
	  gres->Fit(f_momres);
	}

      /* Write fir results to file */
      double par1 = f_momres->GetParameter(0);
      double par1err = f_momres->GetParError(0);
      double par2 = f_momres->GetParameter(1);
      double par2err = f_momres->GetParError(1);
      ofsfit << eta << "," << par1 << "," << par1err << "," << par2 << "," << par2err << endl;

    }

  /* Draw legend */
  c1->cd();
  //TCanvas *c2 = new TCanvas();
  //hframe->Draw();
  leg_eta->Draw();

  /* Print plots */
  c1->Print("track_momres_vareta.eps");
  //c2->Print("track_momres_vareta_legend.eps");

  /* Close output stream */
  ofsfit.close();

  return 0;
}
开发者ID:sPHENIX-Collaboration,项目名称:analysis,代码行数:101,代码来源:TrackParametrization.C

示例6: acceptance_cT


//.........这里部分代码省略.........
   0.07862374,
   0.06748737,
   0.04597222,
   0.01659091,
   0.005892857,
   0.001868687,
   0.0009974747,
   0.0004419192};
   Double_t Graph1_fex1002[9] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t Graph1_fey1002[9] = {
   0.0009753636,
   0.000956385,
   0.000891407,
   0.0007441589,
   0.0004538785,
   0.0002733515,
   0.0001534615,
   0.0001121687,
   7.468147e-05};
   gre = new TGraphErrors(9,Graph1_fx1002,Graph1_fy1002,Graph1_fex1002,Graph1_fey1002);
   gre->SetName("Graph1");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetLineColor(2);
   gre->SetMarkerColor(2);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1002 = new TH1F("Graph_Graph1002","Graph",100,0,5.5);
   Graph_Graph1002->SetMinimum(0);
   Graph_Graph1002->SetMaximum(0.09132784);
   Graph_Graph1002->SetDirectory(0);
   Graph_Graph1002->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1002->SetLineColor(ci);
   Graph_Graph1002->GetXaxis()->SetLabelFont(42);
   Graph_Graph1002->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1002->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1002->GetXaxis()->SetTitleFont(42);
   Graph_Graph1002->GetYaxis()->SetLabelFont(42);
   Graph_Graph1002->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1002->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1002->GetYaxis()->SetTitleFont(42);
   Graph_Graph1002->GetZaxis()->SetLabelFont(42);
   Graph_Graph1002->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1002->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1002->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1002);
   
   gre->Draw(" pl");
   
   Double_t Graph2_fx1003[6] = {
   0,
   0.1,
   0.2,
   0.5,
开发者ID:cms-tamu,项目名称:MuJetAnalysis,代码行数:67,代码来源:acceptance_cT.C

示例7: if


//.........这里部分代码省略.........
      h1[iw]->GetYaxis()->SetTitleSize(textsize);
      h1[iw]->GetYaxis()->SetTitleOffset(3.5);
      h1[iw]->GetYaxis()->SetLabelSize(textsize);
      h1[iw]->GetXaxis()->SetTitleSize(textsize);
      h1[iw]->GetXaxis()->SetTitleOffset(3.0);
      h1[iw]->GetXaxis()->SetLabelSize(textsize);
     // h1[iw]->GetXaxis()->SetLabelOffset(1.2);

    h1[iw]->Draw();
  }
  //
  // Draw! 
  //
  cout << "Now Draw!" << endl;
  TGraphErrors *ge;
  for (int iw=0;iw<nw;iw++)
  {
    can->cd(iw+1);

    //
    if (iw==0)
    {
      tex=new TLatex(1.1,0.08,"CMS PbPb #sqrt{s_{NN}}=2.76TeV");
      tex->SetTextSize(textsize*0.85);
      //tex->Draw();
      tex=new TLatex(1.5,0.07,"|#eta|<0.8");
      tex->SetTextSize(textsize);
      //tex->Draw();
    }
    if (iw < 4) tex=new TLatex(ptit[iw][0]*1.1,ptit[iw][1]*1.1,htit[iw]);
    else tex=new TLatex(ptit[iw][0]*1.1,ptit[iw][1]*1.1,htit[iw]);
    if ( iw == 0)   tex->SetTextSize(textsize);
    else if (iw == 8) tex->SetTextSize(textsize);
    else  tex->SetTextSize(textsize);
    tex->Draw();
    //
    // Legend
    //
    TLegend *leg = new TLegend(lxmin[iw]*0.6,lymin[iw],lxmax[iw]*0.6,lymax[iw]*1.2);
    leg->SetTextSize(textsize);
    //
    // Read data
    //
    for (int im=0;im<1;im++)
    {
      int j=im*12+iw;
      int col=4;
      //if (ndp[j]==0) continue;
      ge=new TGraphErrors(16,&mxa[j][0],&mya[j][0],&mxe[j][0],&mye[j][0]);
      ge->SetTitle("");
      ge->SetMarkerStyle(24);
      //      ge->SetMarkerStyle(msty[im]);
      ge->SetMarkerSize(msiz[im]);
      ge->SetMarkerColor(col);
      ge->SetLineWidth(1.2);
      ge->SetLineColor(col);
      ge->Draw("pe");
      leg->AddEntry(ge,"v_{6}{SP}(Sanders,|#eta|<0.8)","p");
    }
    for (int im=0;im<1;im++)
    {
      int j=im*12+iw;
      int col=1;
      //if (ndp[j]==0) continue;
      ge=new TGraphErrors(19,&xa[j][0],&ya[j][0],&xe[j][0],&ye[j][0]);
      ge->SetTitle("");
      ge->SetMarkerStyle(msty[im][1]);
      //      ge->SetMarkerStyle(msty[im]);
      ge->SetMarkerSize(msiz[im]);
      ge->SetMarkerColor(col);
      ge->SetLineWidth(1.2);
      ge->SetLineColor(col);
      ge->Draw("pe");
      leg->AddEntry(ge,"v_{6}{SP} (Tuo, |#eta|<0.8)","p");
    }
    if (iw==9) leg->Draw();

    for (int im=0;im<1;im++)
    {
      int j=im*12+iw;
      int col=2;
      //if (ndp[j]==0) continue;
      ge=new TGraphErrors(19,&nxa[j][0],&nya[j][0],&nxe[j][0],&nye[j][0]);
      ge->SetTitle("");
      ge->SetMarkerStyle(25);
      //      ge->SetMarkerStyle(msty[im]);
      ge->SetMarkerSize(msiz[im]);
      ge->SetMarkerColor(col);
      ge->SetLineWidth(1.2);
      ge->SetLineColor(col);
      ge->Draw("pe");
      leg->AddEntry(ge,"v_{6}{EP} (11005, |#eta|<0.8)","p");
    }

  }
  cout << "end of process" << endl;
  can->cd();
  can->Print("./figures/v62_pt_5TeVShengquanSteve.png");
  can->Print("./figures/v62_pt_5TeVShengquanSteve.pdf");
}
开发者ID:tuos,项目名称:FlowAndCorrelations,代码行数:101,代码来源:v62pt_compare.C

示例8: ana_Run11_eff

void ana_Run11_eff()
{

  const int rebin = 1;

  TFile *f = TFile::Open("Rootfiles/Run11_eff.root","read");

  // Run with weigth
  TH2F *hMcPtVsEta = (TH2F*)f->Get("mcJpsiPtY");
  TH2F *hRcPtVsEta = (TH2F*)f->Get("hHt2JpsiPE");

  draw2D(hMcPtVsEta);
  draw2D(hRcPtVsEta);

  hMcPtVsEta->GetXaxis()->SetRangeUser(-1+1e-6,1-1e-6);
  TH1F *hMcPt = (TH1F*)hMcPtVsEta->ProjectionY("hMcPt");
  hMcPt->Rebin(rebin);
  hMcPt->SetMarkerStyle(20);
  draw1D(hMcPt,"",kTRUE);

  hRcPtVsEta->GetXaxis()->SetRangeUser(-1+1e-6,1-1e-6);
  TH1F *hRcPt = (TH1F*)hRcPtVsEta->ProjectionY("hRcPt");
  hRcPt->Rebin(rebin);
  hRcPt->SetMarkerStyle(21);
  hRcPt->SetMarkerColor(2);
  hRcPt->SetLineColor(2);
  hRcPt->Draw("sames P");

  TH1F *hRatio = (TH1F*)hRcPt->Clone("hRatio_fromRunning");
  hRatio->Rebin(100);
  hMcPt->Rebin(100);
  hRatio->Divide(hMcPt);
  cEff = draw1D(hRatio,"");

  // Run without weight
  TH2F *hMcPtVsEtaNoWeight = (TH2F*)f->Get("mcJpsiPtY_Or");
  draw2D(hMcPtVsEtaNoWeight);  

  TH2F *hMcPtVsRcNoWeight = (TH2F*)f->Get("hJpsiRcvsMC_Cut1");
  hMcPtVsRcNoWeight->RebinX(rebin);
  hMcPtVsRcNoWeight->RebinY(rebin);
  draw2D(hMcPtVsRcNoWeight);

  hMcPtVsEtaNoWeight->GetXaxis()->SetRangeUser(-1+1e-6,1-1e-6);
  TH1F *hMcPtNoWeight = (TH1F*)hMcPtVsEtaNoWeight->ProjectionY("hMcPtNoWeight");
  hMcPtNoWeight->Rebin(rebin);
  hMcPtNoWeight->SetMarkerStyle(20);
  hMcPtNoWeight->SetMinimum(1);
  draw1D(hMcPtNoWeight,"",kTRUE);

  TH1F *hRcPtNoWeight = (TH1F*)hMcPtVsRcNoWeight->ProjectionX("hRcPtNoWeight");
  hRcPtNoWeight->SetMarkerStyle(21);
  hRcPtNoWeight->SetMarkerColor(2);
  hRcPtNoWeight->SetLineColor(2);
  hRcPtNoWeight->Draw("sames P");

  TH1F *hRatioNoWeight = (TH1F*)hRcPtNoWeight->Clone("hRatioNoWeight");
  hRatioNoWeight->Divide(hMcPtNoWeight);
  cEff->cd();
  hRatioNoWeight->SetMarkerColor(4);
  hRatioNoWeight->Draw("samesP");

  // weight with input histogram
  TH1F *hMcPtWeight = (TH1F*)hMcPtNoWeight->Clone("hMcPtWeight");
  TH2F *hMcPtVsRcWeight = (TH2F*)hMcPtVsRcNoWeight->Clone("hMcPtVsRcWeight");
  for(int ibin=1; ibin<=hMcPtVsRcNoWeight->GetNbinsX(); ibin++)
    {
      double scale = hMcPt->GetBinContent(ibin);
      hMcPtWeight->SetBinContent(ibin,hMcPtWeight->GetBinContent(ibin)*scale);
      hMcPtWeight->SetBinError(ibin,hMcPtWeight->GetBinError(ibin)*scale);
      for(int jbin=1; jbin<=hMcPtVsRcNoWeight->GetNbinsY(); jbin++)
	{
	  hMcPtVsRcWeight->SetBinContent(ibin,jbin,hMcPtVsRcWeight->GetBinContent(ibin,jbin)*scale);
	  hMcPtVsRcWeight->SetBinError(ibin,jbin,hMcPtVsRcWeight->GetBinError(ibin,jbin)*scale);
	}
    }
  TH1F *hRcPtWeight = (TH1F*)hMcPtVsRcWeight->ProjectionY("hRcPtWeight");
  hRcPtWeight->SetMarkerStyle(21);
  hRcPtWeight->SetMarkerColor(2);
  hRcPtWeight->SetLineColor(2);

  draw2D(hMcPtVsRcWeight);
  draw1D(hMcPtWeight,"",kTRUE);
  hRcPtWeight->Draw("sames P");
  
  TH1F *hRatioWeight = (TH1F*)hRcPtWeight->Clone("hRatioWeight");
  hRatioWeight->Divide(hMcPtWeight);
  cEff->cd();
  hRatioWeight->SetMarkerColor(6);
  hRatioWeight->Draw("samesP");

  TH1F *hCheck = (TH1F*)hRatioWeight->Clone("check");
  hCheck->Divide(hRatio);
  draw1D(hCheck);

  // weight with fitted function
  TCanvas *c = new TCanvas("Fit","Fit",800,600);
  SetPadMargin(gPad,0.15,0.15);
  gPad->SetLogy();
  TH1F *h = new TH1F("histogram",";;;",7,0,30);
//.........这里部分代码省略.........
开发者ID:marrbnl,项目名称:STAR,代码行数:101,代码来源:ana_Run11_eff.C

示例9: plotpidket

void plotpidket(){
  gStyle->SetOptTitle(0);
  gStyle->SetOptStat(0);
  gStyle->SetStripDecimals(0);

  float mpion = 0.13957;
  float mkaon = 0.49368;
  float mproton = 0.93827;

  float pt[13], ept[12], v2[13], ev2[13], sv2[13];
  ifstream fin("run12dAu_fvtx0s_hadron_v2_0_5.txt");
  for(int i=0; i<13; i++){
    ept[i]=0;
    fin>>pt[i]>>v2[i]>>ev2[i];
  }
  fin.close();

  TGraphErrors *grhadron = new TGraphErrors(13, pt, v2, ept, ev2);


  ifstream fin("run12dAu_fvtx0s_pion_v2_0_5.txt");

  for(int i=0; i<13; i++){
    ept[i]=0;
    fin>>pt[i]>>v2[i]>>ev2[i];
    pt[i]= sqrt(pt[i]**2+mpion**2)-mpion;

    pt[i] = pt[i]/2.0;
    v2[i] = v2[i]/2.0;
    ev2[i] = ev2[i]/2.0;
  }
  fin.close();

  TGraphErrors *grpion = new TGraphErrors(13, pt, v2, ept, ev2);

  ifstream fin("run12dAu_fvtx0s_kaon_v2_0_5.txt");

  for(int i=0; i<13; i++){
    ept[i]=0;
    fin>>pt[i]>>v2[i]>>ev2[i];
    pt[i]= sqrt(pt[i]**2+mkaon**2)-mkaon;

    pt[i] = pt[i]/2.0;
    v2[i] = v2[i]/2.0;
    ev2[i] = ev2[i]/2.0;
  }
  fin.close();

  TGraphErrors *grkaon = new TGraphErrors(13, pt, v2, ept, ev2);

  ifstream fin2("run12dAu_fvtx0s_proton_v2_0_5.txt");

  for(int i=0; i<13; i++){
    pt[i]=0;
    fin2>>pt[i]>>v2[i]>>ev2[i];
    pt[i]= sqrt(pt[i]**2+mproton**2)-mproton;

    pt[i] = pt[i]/3.0;
    v2[i] = v2[i]/3.0;
    ev2[i] = ev2[i]/3.0;

    cout<<pt[i]<<endl;
  }
  fin2.close();

  TGraphErrors *grproton = new TGraphErrors(13, pt, v2, ept, ev2);

  c1=new TCanvas("c1","c1");
  c1->SetFillColor(10);
  c1->cd();

  TH1F *h = new TH1F("h","h",21, 0, 2.1);
  h->SetMinimum(-0.02);
  h->SetMaximum(0.18);
  h->SetMarkerStyle(20);
  h->SetMarkerSize(1.2);
  h->Draw();

  h->GetYaxis()->SetTitleOffset(0.9);
  h->GetYaxis()->SetTitleSize(0.05);
  h->GetYaxis()->SetTitle("v_{2}/n_{q}");

  h->GetXaxis()->SetTitle("KE_{T}/n_{q} (GeV)");
  h->GetXaxis()->SetTitleSize(0.04);
  h->GetYaxis()->CenterTitle(kTRUE);
  h->GetXaxis()->CenterTitle(kTRUE);

  grkaon->SetMarkerStyle(21);
  grkaon->SetMarkerSize(1.2);
  grkaon->SetMarkerColor(6);
  grkaon->Draw("P");

  grpion->SetMarkerStyle(20);
  grpion->SetMarkerSize(1.2);
  grpion->SetMarkerColor(2);
  grpion->Draw("P");

  grproton->SetMarkerStyle(24);
  grproton->SetMarkerSize(1.2);
  grproton->SetMarkerColor(4);
//.........这里部分代码省略.........
开发者ID:XuQiao,项目名称:phenix,代码行数:101,代码来源:plotpidket2.C

示例10: higgs_hlt87


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

  float mass_value=55.;
  
  for(int k=0;k<19;k++){
    mass_value=mass_value+5.;
    x3[k]  = mass_value;
    ex3[k] = 0;
    avEFFggh[k] = efficiency(_fileggh[k]);
    avEFFtth[k] = efficiency(_filetth[k]);
    avEFFvbf[k] = efficiency(_filevbf[k]);
    avEFFwzh[k] = efficiency(_filewzh[k]);

    avERRggh[k] = error(_fileggh[k]);
    avERRwzh[k] = error(_filewzh[k]);
    avERRtth[k] = error(_filetth[k]);
    avERRvbf[k] = error(_filevbf[k]);
  }
 
  cout << x3[0] <<" : " << avEFFggh[0] << "------" << avERRggh[0] << endl;
  cout << x3[1] <<" : " << avEFFggh[1] << "------" << avERRggh[1] << endl;
  cout << x3[2] <<" : " << avEFFggh[2] << "------" << avERRggh[2] << endl;
  cout << x3[3] <<" : " << avEFFggh[3] << "------" << avERRggh[3] << endl;
    
  TGraphErrors * ggh = new TGraphErrors(19,x3,avEFFggh,ex3,avERRggh);
  TGraphErrors * vbf = new TGraphErrors(19,x3,avEFFvbf,ex3,avERRvbf);
  TGraphErrors * wzh = new TGraphErrors(19,x3,avEFFwzh,ex3,avERRwzh);
  TGraphErrors * tth = new TGraphErrors(19,x3,avEFFtth,ex3,avERRtth);

  ggh->SetMarkerStyle(22);ggh->SetMarkerSize(2.0); 
  vbf->SetMarkerStyle(23);vbf->SetMarkerSize(2.0); 
  wzh->SetMarkerStyle(20);wzh->SetMarkerSize(2.0); 
  tth->SetMarkerStyle(21);tth->SetMarkerSize(2.0); 

  ggh->SetMarkerColor(kRed);
  vbf->SetMarkerColor(kBlue);
  wzh->SetMarkerColor(kGreen);
  tth->SetMarkerColor(kBlack);

  tth->GetXaxis()->SetTitle("M_{H} (GeV)");  tth->GetYaxis()->SetTitle("#epsilon");
  ggh->GetXaxis()->SetTitle("M_{H} (GeV)");  ggh->GetYaxis()->SetTitle("#epsilon");
  vbf->GetXaxis()->SetTitle("M_{H} (GeV)");  vbf->GetYaxis()->SetTitle("#epsilon");
  wzh->GetXaxis()->SetTitle("M_{H} (GeV)");  wzh->GetYaxis()->SetTitle("#epsilon");
  
  TCanvas *C1 = new TCanvas("C1","Global Efficiency",200,10,1200,800);
  C1->SetFillColor(10);
  C1->Draw();
  C1->cd();

  float min=0.0;
  float max=1.0;
  ggh->SetMinimum(min);ggh->SetMaximum(max);
  vbf->SetMinimum(min);vbf->SetMaximum(max);
  wzh->SetMinimum(min);wzh->SetMaximum(max);
  tth->SetMinimum(min);tth->SetMaximum(max);
  
  ggh->Draw("AP"); 
  vbf->Draw("Psame"); 
  wzh->Draw("Psame"); 
  tth->Draw("Psame"); 

  C1->Update();

  TLegend *leg = new TLegend(0.6,0.35,0.7,0.2);
  //leg->AddEntry(glui,"gluino split-SUSY","lp");                                                                                                               
  //leg->AddEntry(stop,"stop MSSM","lp");                                                                                                                       
  leg->AddEntry(ggh,"ggh","p");
开发者ID:camilocarrillo,项目名称:hlt,代码行数:67,代码来源:higgs_hlt87.C

示例11: MakeRelDiffPlots

void MakeRelDiffPlots(TProfile *MC, TProfile *DATA, TProfile *GEO, std::string nametag, TFile* outputfile_ptr){
  std::string filename;

  //=========Macro generated from canvas: c1/c1
  //=========  (Wed Jul 27 17:25:29 2016) by ROOT version5.34/25
  TCanvas *c1 = new TCanvas("c1", "c1",19,48,700,500);

  c1->Range(-0.5063291,-0.1924051,2.658228,1.010127);
  c1->SetFillColor(0);
  c1->SetBorderMode(0);
  c1->SetBorderSize(2);
  c1->SetTickx(1);
  c1->SetTicky(1);
  c1->SetLeftMargin(0.16);
  c1->SetRightMargin(0.05);
  c1->SetTopMargin(0.05);
  c1->SetBottomMargin(0.16);
  c1->SetFrameBorderMode(0);

  c1->Modified();
  c1->cd();
  c1->SetSelected(c1);

std::cout << ">>> !!! DEBUG LINE: " << "1" << " !!!" << std::endl; 

  MC->SetMarkerColor(1);
  MC->SetMarkerStyle(20);
  MC->SetMarkerSize(0.9);
  //MC->SetMinimum(0);
  //MC->SetMaximum(2);
  MC->SetEntries(2552568);
  MC->SetStats(0);
  MC->SetLineWidth(2);
  MC->GetXaxis()->SetTitle("|#font[152]{h}_{#font[52]{e}}|");
  MC->GetXaxis()->SetLabelFont(42);
  MC->GetXaxis()->SetLabelSize(0.05);
  MC->GetXaxis()->SetTitleSize(0.05);
  MC->GetXaxis()->SetTitleOffset(1.4);
  MC->GetXaxis()->SetTitleFont(42);
  MC->GetYaxis()->SetTitle("E1/E2");
  MC->GetYaxis()->SetLabelFont(42);
  MC->GetYaxis()->SetLabelSize(0.05);
  MC->GetYaxis()->SetTitleSize(0.05);
  MC->GetYaxis()->SetTitleOffset(1.4);
  MC->GetYaxis()->SetTitleFont(42);
  MC->GetZaxis()->SetLabelFont(42);
  MC->GetZaxis()->SetLabelSize(0.05);
  MC->GetZaxis()->SetTitleSize(0.05);
  MC->GetZaxis()->SetTitleFont(42);
  MC->Draw();

std::cout << ">>> !!! DEBUG LINE: " << "2" << " !!!" << std::endl; 

  GEO->SetMarkerColor(2);
  GEO->SetMarkerStyle(15);
  GEO->SetMarkerSize(0.9);
  GEO->Draw("same");

  TLegend* legend = new TLegend(0.172,0.2,0.55,0.3);
  legend->SetBorderSize(0);  // no border
  legend->SetFillStyle(0);
  legend->SetTextSize(0.04);
  legend->AddEntry(MC,"MC15c nom. geo.","P");
  legend->AddEntry(GEO,"MC15c s2984","P");
  legend->Draw("same");

  filename = "output/E1E2" + nametag + "_mc2015_s2984.png";
  c1->SaveAs(filename.c_str());

  TH1D * temp1 = MC->ProjectionX("temp1");
  TH1D * temp2 = GEO->ProjectionX("temp2");
  TH1D * h3 = new TH1D(*temp1);

  h3->Add(MC, GEO, -1, 1);
  h3->Sumw2();
  h3->Divide(MC);
  h3->GetYaxis()->SetTitle("#font[152]{d}_{#font[52]{rel}}#font[52]{E_{1/2}}");
  MC->GetYaxis()->SetTitleSize(0.02);
  h3->SetMarkerColor(1);
  h3->SetMarkerStyle(20);
  h3->SetMarkerSize(0.9);
  h3->SetMinimum(-0.05);
  h3->SetMaximum(0.25);
  h3->Draw();

  TLine *line = new TLine(0,0,2.5,0);
  line->SetLineColor(kBlack);
  line->SetLineStyle(2);
  line->Draw("same");

  filename = "output/E1E2" + nametag + "_mc2015_s2984_Diff.png";
  c1->SaveAs(filename.c_str());

  outputfile_ptr->cd();
  filename = "E1E2" + nametag + "_mc2015_s2984_Diff";
  h3->Write(filename.c_str());


  //Different formatting on the above plot for OCIP symposium talk
  h3->GetYaxis()->SetTitle("#font[52]{E_{1/2}}");
//.........这里部分代码省略.........
开发者ID:andrehupe,项目名称:matStudiesTrials,代码行数:101,代码来源:E1E2_mc15c_GEO_s2984.C

示例12: if


//.........这里部分代码省略.........
    if(iw==3||iw==7||iw==11) gPad->SetRightMargin(0.02);
    char ch1[8];
    sprintf(ch1,"h1_%d",iw);
    h1[iw] = new TH1D(ch1,"",500,hxmin[iw],hxmax[iw]);
    h1[iw]->SetMinimum(hymin[iw]); h1[iw]->SetMaximum(hymax[iw]);
    h1[iw]->SetXTitle(atit[iw][0]); h1[iw]->SetYTitle(atit[iw][1]);
    h1[iw]->GetXaxis()->CenterTitle(1);
    h1[iw]->GetYaxis()->CenterTitle(1);

    // futz with the axes
    h1[iw]->GetYaxis()->SetNdivisions(606);
    h1[iw]->GetXaxis()->SetNdivisions(606);

      h1[iw]->GetYaxis()->SetTitleSize(textsize);
      h1[iw]->GetYaxis()->SetTitleOffset(3.0);
      h1[iw]->GetYaxis()->SetLabelSize(textsize);
      h1[iw]->GetXaxis()->SetTitleSize(textsize);
      h1[iw]->GetXaxis()->SetTitleOffset(3.0);
      h1[iw]->GetXaxis()->SetLabelSize(textsize);
     // h1[iw]->GetXaxis()->SetLabelOffset(1.2);

    h1[iw]->Draw();
  }
  //
  // Draw! 
  //
  cout << "Now Draw!" << endl;
  TGraphErrors *ge;
  for (int iw=0;iw<nw-2;iw++)
  {
    can->cd(iw+1);

    //
    if (iw==0)
    {
      tex=new TLatex(1.5,8.08,"CMS PbPb #sqrt{s_{NN}}=2.76TeV");
      tex->SetTextSize(textsize);
      //tex->Draw();
      tex=new TLatex(1.5,7.07,"|#eta|<0.8");
      tex->SetTextSize(textsize);
      tex->Draw();
    }
    if (iw < 4) tex=new TLatex(ptit[iw][0],ptit[iw][1],htit[iw]);
    else tex=new TLatex(ptit[iw][0],ptit[iw][1],htit[iw]);
    if ( iw == 0)   tex->SetTextSize(textsize);
    else if (iw == 8) tex->SetTextSize(textsize);
    else  tex->SetTextSize(textsize);
    tex->Draw();
    //
    // Legend
    //
    TLegend *leg = new TLegend(lxmin[iw]*3.3,lymin[iw]*1.3,lxmax[iw]*2.2,lymax[iw]*1.3);
    leg->SetTextSize(textsize);
    //
    // Read data
    //
    for (int im=0;im<1;im++)
    {
      int j=im*12+iw;
      int col=1;
      //if (ndp[j]==0) continue;
      ge=new TGraphErrors(16,&xa[j][0],&nya[j][0],&xe[j][0],&nye[j][0]);
      ge->SetTitle("");
      ge->SetMarkerStyle(msty[im][1]);
      //      ge->SetMarkerStyle(msty[im]);
      ge->SetMarkerSize(msiz[im]);
      ge->SetMarkerColor(col);
      ge->SetLineWidth(1.2);
      ge->SetLineColor(col);
      ge->Draw("pe");
      leg->AddEntry(ge,"Steve/Shengquan","p");
    }
    if (iw==1) leg->Draw();
    TLine *line = new TLine(0,1,6.8,1);
    line->SetLineStyle(2);
    line->Draw();
/*
    for (int im=0;im<1;im++)
    {
      int j=im*12+iw;
      int col=2;
      //if (ndp[j]==0) continue;
      ge=new TGraphErrors(16,&nxa[j][0],&nya[j][0],&nxe[j][0],&nye[j][0]);
      ge->SetTitle("");
      ge->SetMarkerStyle(25);
      //      ge->SetMarkerStyle(msty[im]);
      ge->SetMarkerSize(msiz[im]);
      ge->SetMarkerColor(col);
      ge->SetLineWidth(1.2);
      ge->SetLineColor(col);
      ge->Draw("pe");
      leg->AddEntry(ge,"Steve","p");
    }
*/
  }
  cout << "end of process" << endl;
  can->cd();
  can->Print("./figures/v723_pt_12cent.png");
  can->Print("./figures/v723_pt_12cent.pdf");
}
开发者ID:tuos,项目名称:FlowAndCorrelations,代码行数:101,代码来源:v723pt_compare.C

示例13: main


//.........这里部分代码省略.........
	TH2F * h2 = new TH2F("h2", "h2", 400, 0.5, 1.5, 400, 0.5, 1.5);
	TH2F * h2diff = (TH2F*)hcmap1->Clone("h2diff");
	h2diff->Reset();
	TH1F *hdiff = new TH1F("hdiff", "hdiff", 400, -0.5, 0.5);

	char hname[100];

	TH1F *hspread[172];
	for (int jbin = 1; jbin < hcmap1-> GetNbinsY() + 1; jbin++) {
		int etaring = hcmap1-> GetYaxis()->GetBinCenter(jbin);
		sprintf(hname, "hspread_ring_ieta%02d", etaring);
		hspread[jbin - 1] = new TH1F(hname, hname, 400, -0.5, 0.5);
	}

	for (int jbin = 1; jbin < hcmap1-> GetNbinsY() + 1; jbin++) {
		float etaring = hcmap1-> GetYaxis()->GetBinCenter(jbin);
		for (int ibin = 1; ibin < hcmap1-> GetNbinsX() + 1; ibin++) {
			float c1 = hcmap1->GetBinContent(ibin, jbin);
			float c2 = hcmap2->GetBinContent(ibin, jbin);
			if (c1 != 0 && c2 != 0 ) {
				hspread[jbin - 1]->Fill( c1 - c2 );
				h2->Fill(c1, c2);
				h2diff->SetBinContent(ibin, jbin, c1 - c2);
				if (fabs(etaring) < 40) hdiff->Fill(c1 - c2);

			}
		}
	}

/// Final Plot in eta ring (stat prescision and scale)
	TGraphErrors *sigma_vs_ieta = new TGraphErrors();
	sigma_vs_ieta->SetMarkerStyle(20);
	sigma_vs_ieta->SetMarkerSize(1);
	sigma_vs_ieta->SetMarkerColor(kBlue + 2);

	TGraphErrors *rms_vs_ieta = new TGraphErrors();
	rms_vs_ieta->SetMarkerStyle(24);
	rms_vs_ieta->SetMarkerSize(1);
	rms_vs_ieta->SetMarkerColor(kBlue + 2);

	TGraphErrors *scale_vs_ieta = new TGraphErrors();
	scale_vs_ieta->SetMarkerStyle(20);
	scale_vs_ieta->SetMarkerSize(1);
	scale_vs_ieta->SetMarkerColor(kBlue + 2);

/// Gaussian Fit of spread coefficient dstribution
	TF1 *fgaus = new TF1("fgaus", "gaus", -1, 1);
	int np = 0;
	for (int i = 1; i < hcmap1-> GetNbinsY() + 1; i++) {
		float etaring = hcmap1-> GetYaxis()->GetBinCenter(i);
		if (etaring == 0.5) continue;
		if ( hspread[i - 1]->GetEntries() == 0) {
			sigma_vs_ieta-> SetPoint(np, etaring, -100);
			np++;
			continue;
		}
		hspread[i - 1]->Fit("fgaus", "Q");
		sigma_vs_ieta-> SetPoint(np, etaring, fgaus->GetParameter(2));
		sigma_vs_ieta-> SetPointError(np, 0, fgaus->GetParError(2));
		rms_vs_ieta  -> SetPoint(np, etaring, hspread[i - 1]->GetRMS());
		rms_vs_ieta  -> SetPointError(np, 0, hspread[i - 1]->GetRMSError() );
		scale_vs_ieta-> SetPoint(np, etaring, fgaus->GetParameter(1));
		scale_vs_ieta-> SetPointError(np, 0, fgaus->GetParError(1));
		if( fabs(etaring) < 20 ) {
			hringdiff->Fill( fgaus->GetParameter(1) );
		}
开发者ID:ECALELFS,项目名称:ECALELF,代码行数:67,代码来源:CompareSCalibMCTruth_EB.cpp

示例14: FDC_Timing


//.........这里部分代码省略.........
    hWire->GetXaxis()->SetTitle("Wire Time (ns)");
    //hWire->Draw();

    int tzero_bin = hWire->GetMaximumBin();
    double tzero = hWire->GetXaxis()->GetBinCenter(tzero_bin);

    TF1 *fwire = new TF1("fwire", "gaus(0)", tzero - 10, tzero + 10);
    fwire->SetLineColor(2);
    fwire->SetNpx(600);
    fwire->SetParameter(1,tzero);
    hWire->Fit("fwire","q0r");
    wire[icell-1] = fwire->GetParameter(1);
    wire_err[icell-1] = fwire->GetParError(1);

    sprintf(hname, "hCathodeTime_cell[%d]", icell);
    TH1 *hCathode = (TH1*)(gDirectory->Get(hname));
      
    hCathode->GetXaxis()->SetTitle("Cathode Time (ns)");
    //hCathode->Draw();

    tzero_bin = hCathode->GetMaximumBin();
    tzero = hCathode->GetXaxis()->GetBinCenter(tzero_bin);
    hCathode->GetXaxis()->SetRangeUser(tzero-40,tzero+40);

    TF1 *fcath = new TF1("fcath", "gaus(0)", tzero - 20, tzero + 20);
    fcath->SetLineColor(2);
    fcath->SetNpx(600);
    fcath->SetParameter(1,tzero);
    hCathode->Fit("fcath","qr");
    cath[icell-1] = fcath->GetParameter(1);
    cath_err[icell-1] = fcath->GetParError(1);

    sprintf(hname, "hDeltaTime_cell[%d]", icell);
    TH1 *hDelta = (TH1*)(gDirectory->Get(hname));
      
    hDelta->GetXaxis()->SetTitle("Wire Time - Cathode Time (ns)");
    hDelta->Draw();

    tzero_bin = hDelta->GetMaximumBin();
    tzero = hDelta->GetXaxis()->GetBinCenter(tzero_bin);

    TF1 *fdelta = new TF1("fdelta", "gaus(0)", tzero - 5, tzero + 5);
    fdelta->SetLineColor(2);
    fdelta->SetNpx(600);
    fdelta->SetParameter(1,tzero);
    hDelta->Fit("fdelta","qr");
    delta[icell-1] = fdelta->GetParameter(1);
    delta_err[icell-1] = fdelta->GetParError(1);

    sprintf(hname, "hPullTime_cell[%d]", icell);
    TH1 *hPull = (TH1*)(gDirectory->Get(hname));

    hPull->GetXaxis()->SetTitle("Pseudo Time (from pull) (ns)");
    //hPull->Draw();

    tzero_bin = hPull->GetMaximumBin();
    tzero = hPull->GetXaxis()->GetBinCenter(tzero_bin);
    hPull->GetXaxis()->SetRangeUser(tzero-10,tzero+10);

    TF1 *fpull = new TF1("fpull", "gaus(0)", tzero - 5, tzero + 3);
    fpull->SetLineColor(2);
    fpull->SetNpx(600);
    fpull->SetParameter(1,tzero);
    hPull->Fit("fpull","q0r");
    pull[icell-1] = fpull->GetParameter(1);
    pull_err[icell-1] = fpull->GetParError(1);

  }
  
  TCanvas *cTiming = new TCanvas("cTiming", "Timing", 1400, 1000);
  cTiming->Divide(2,2);
  cTiming->cd(1);
  
  TGraphErrors *gWireTiming = new TGraphErrors(24, cell, wire, cell_err, wire_err);
  gWireTiming->SetTitle("; Cell # ; Wire Timing (ns)");
  gWireTiming->SetMarkerColor(1);
  gWireTiming->SetMarkerStyle(8);
  gWireTiming->Draw("AP");

  cTiming->cd(2);
  TGraphErrors *gCathTiming = new TGraphErrors(24, cell, cath, cell_err, cath_err);
  gCathTiming->SetTitle("; Cell # ; Cathode Timing (ns)");
  gCathTiming->SetMarkerColor(2);
  gCathTiming->SetMarkerStyle(8);
  gCathTiming->Draw("AP");

  cTiming->cd(3);
  TGraphErrors *gDelta = new TGraphErrors(24, cell, delta, cell_err, delta_err);
  gDelta->SetTitle("; Cell # ; Wire - Cathode Timing (ns)");
  gDelta->SetMarkerColor(4);
  gDelta->SetMarkerStyle(8);
  gDelta->Draw("AP");

  cTiming->cd(4);
  TGraphErrors *gPull = new TGraphErrors(24, cell, pull, cell_err, pull_err);
  gPull->SetTitle("; Cell # ; Pseudo Time from Pull (ns)");
  gPull->SetMarkerColor(6);
  gPull->SetMarkerStyle(8);
  gPull->Draw("AP");
}
开发者ID:JeffersonLab,项目名称:sim-recon,代码行数:101,代码来源:FDC_Timing.C

示例15: Fit


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

  HCapT_F.SetParLimits( 2, 0, 10000);

  //  TFile f("EH1_AD1.root");
  //  h->Fit("HCapT","","",5e-6,800e-6);
  //  return;

  const int TotalNo = 7;

  string file[7] = {
    "../01_MakeHisto/ForBi214/EH0_AD1.root",
    "../01_MakeHisto/Bi214/EH1_AD1.root",
    "../01_MakeHisto/Bi214/EH1_AD2.root",
    "../01_MakeHisto/Bi214/EH2_AD1.root",
    "../01_MakeHisto/Bi214/EH3_AD1.root",
    "../01_MakeHisto/Bi214/EH3_AD2.root",
    "../01_MakeHisto/Bi214/EH3_AD3.root"
  };

  string title[7] = {
    "EH0_AD1",
    "EH1_AD1",
    "EH1_AD2",
    "EH2_AD1",
    "EH3_AD1",
    "EH3_AD2",
    "EH3_AD3"
  };

  TH1F* h[7];  /* Fit result */
  double x[7];
  double x_e[7] = {0,0,0,0,0,0,0};
  double LambdaCap[7], LambdaCap_e[7];
  double Background[7], Background_e[7];

  for( int AdNo = 0; AdNo<TotalNo; AdNo++ )  {

    cout<<file[AdNo]<<endl;

    TFile f( file[AdNo].c_str() );
    h[AdNo] = (TH1F*)f.Get("h");

    HCapT_F.SetParameters(0.02, 4700     ,1);
    h[AdNo]->Fit("HCapT","L","",5e-6,1500e-6);

    x[AdNo]         = AdNo;

    LambdaCap[AdNo]   = HCapT_F.GetParameter(1);
    LambdaCap_e[AdNo] = HCapT_F.GetParError(1);
    
    Background[AdNo]  = HCapT_F.GetParameter(2);
    Background_e[AdNo]= HCapT_F.GetParError(2);
    f.Close();
  }
  
  for( int AdNo = 0; AdNo<TotalNo; AdNo++ )  {
    
    TCanvas* c = new TCanvas(file[AdNo].c_str(),file[AdNo].c_str());
    c->SetLogy();
    h[AdNo]->GetXaxis()->SetTitle("Capture time [s]");
    h[AdNo]->GetYaxis()->SetTitle("Entries / 3e-6 s");
    h[AdNo]->GetYaxis()->SetTitleOffset(1.2);
    h[AdNo]->SetTitle( title[AdNo].c_str() );
    h[AdNo]->SetName( title[AdNo].c_str() );
    h[AdNo]->Draw("E");
    
    cout<<"LambdaCap: "<<LambdaCap[AdNo]<<"+/-"<<LambdaCap_e[AdNo]
	<<"\t Background: "<<Background[AdNo]<<"+/-"<<Background_e[AdNo]<<endl;

    c->Print( (title[AdNo]+".ps").c_str() );
  }

  /* Calculate average with the first 3 ADs */
  double LambdaCap_ave = 0, LambdaCap_ttl_w = 0; 
  double LambdaCap_ave_err;
  double w;
  for( int AdNo = 1; AdNo<=6; AdNo++ )  {

    w = (1/LambdaCap_e[AdNo])*(1/LambdaCap_e[AdNo]);
    LambdaCap_ttl_w += w;
    LambdaCap_ave += LambdaCap[AdNo] * w;
  }
  LambdaCap_ave = LambdaCap_ave/LambdaCap_ttl_w;
  LambdaCap_ave_err = sqrt(1/LambdaCap_ttl_w);

  cout<<"Average: "<<endl;
  cout<<"LambdaCap: "<<LambdaCap_ave<<" +- "<<LambdaCap_ave_err<<endl;
  

  TGraphErrors* gLambdaCap = new TGraphErrors(TotalNo-1,&x[1],&LambdaCap[1],&x_e[1],&LambdaCap_e[1]);
  gLambdaCap->SetTitle("LambdaCap");
  gLambdaCap->SetMarkerColor(4);
  gLambdaCap->SetMarkerStyle(21);
  TCanvas* cLambdaCap = new TCanvas;
  gLambdaCap->GetXaxis()->SetTitle("Ad Number");
  gLambdaCap->GetYaxis()->SetTitle("1/Capture time [1/s]");
  gLambdaCap->GetYaxis()->SetTitleOffset(1.3);
  gLambdaCap->Draw("ALP");
  cLambdaCap->Print("LambdaCap.ps");
}
开发者ID:zhangzc11,项目名称:CPTV,代码行数:101,代码来源:Fit.C


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