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


C++ TGraph::GetYaxis方法代码示例

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


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

示例1: TGraph

TGraph *graphLH(std::string nuisname, double err ,std::string whichfit){

	w->loadSnapshot(whichfit.c_str()); // SetTo BestFit values as start

	// Get The parameter we want 
	RooRealVar *nuis =(RooRealVar*) w->var(nuisname.c_str());
	double bf = nuis->getVal();
	double nll_0=nll->getVal();


	TGraph *gr = new TGraph(2*npoints+1);
	for (int i=-1*npoints;i<=npoints;i++){
		nuis->setVal(bf+err*( ((float)i)*nsigma/npoints));
		double nll_v = nll->getVal();
		gr->SetPoint(i+npoints,nuis->getVal(),nll_v-nll_0);
	}

	gr->SetTitle("");
	gr->GetYaxis()->SetTitle("NLL - obs data");
	gr->GetYaxis()->SetTitleOffset(1.1);
	gr->GetXaxis()->SetTitleSize(0.05);
	gr->GetYaxis()->SetTitleSize(0.05);
	gr->GetXaxis()->SetTitle(nuisname.c_str());
	gr->SetLineColor(4);
	gr->SetLineWidth(2);
	gr->SetMarkerStyle(21);
	gr->SetMarkerSize(0.6);
	
	return gr;
	

}
开发者ID:VecbosApp,项目名称:HiggsAnalysisTools,代码行数:32,代码来源:plotParametersFromToys.C

示例2: title

//Return a graph of the llscan
TGraph * LLscanResult::GetGraph() 
{
	double*  pvs = new double[parameterValues.size()] ;
	double* llvs = new double[parameterValues.size()] ;
	double llmax = 0 ;	
	for(unsigned int i=0; i< parameterValues.size() ; ++i ){
		pvs[i] = parameterValues[i] ;
		llvs[i] = llvalues_offset[i] ;
		if( llvs[i] > llmax ) llmax = llvs[i] ;
	}	

	TGraph* gr = new TGraph( Int_t(parameterValues.size()), pvs, llvs ) ;
	//gr->SetTitle("LL Scan for Parameter xxx");	
	gr->SetMarkerStyle(1);
	gr->SetLineWidth(2);
	gr->SetMarkerColor(4);
	gr->SetLineColor(4);
	gr->GetYaxis()->SetRangeUser( 0., llmax*1.2 );
	gr->GetYaxis()->SetLimits( 0., llmax*1.2 );
	gr->SetMinimum( 0.0 );
	gr->SetMaximum( llmax*1.2 );
	gr->Draw("ALP");
	string title("LL Scan for Parameter ") ;
	title+=parameterName.c_str();
	gr->SetTitle(title.c_str());	
	gr->GetXaxis()->SetTitle(parameterName.c_str());

	return gr ;
}
开发者ID:abmorris,项目名称:RapidFit,代码行数:30,代码来源:LLscanResult.cpp

示例3: SetStyle

void SetStyle(TGraph& g, double size, int color, int style, int fillstyle=0, int linestyle=1){
	g.SetMarkerSize(size);
	g.SetMarkerColor(color);
	g.SetLineColor(color);
	g.SetMarkerStyle(style);
	g.SetFillStyle(fillstyle);
	g.SetLineStyle(linestyle);
	g.GetXaxis()->SetTitleFont(42);
	g.GetYaxis()->SetTitleFont(42);
	g.GetXaxis()->SetTitleSize(0.048);
	g.GetYaxis()->SetTitleSize(0.048);
	g.GetXaxis()->CenterTitle();
	g.GetYaxis()->CenterTitle();
}
开发者ID:XuQiao,项目名称:phenix,代码行数:14,代码来源:SimplifyLife.C

示例4: testing

void testing() { //new
   TCanvas *c1 = new TCanvas("c1","A Simple Graph Example",200,10,700,500);
   c1->SetFillColor(42);
   c1->SetGrid();
   
   const int n = 20;
   double x[n], y[n];
   for (int i=0;i<n;i++) {
      x[i] = i;
      y[i] = 2*i;
      cout<<x[i]<<"\t"<<y[i]<<endl;
   }
   
   TGraph *gr = new TGraph(n,x,y);
   gr->SetLineColor(2);
   gr->SetLineWidth(4);
   gr->SetMarkerColor(4);
   gr->SetMarkerStyle(21);
   gr->SetTitle("a simple graph");
   gr->GetXaxis()->SetTitle("X title");
   gr->GetYaxis()->SetTitle("Y title");
   gr->Draw("ACP");
   
   c1->Update();
   c1->Modified();
   c1->Connect("Closed()", "TApplication", gApplication, "Terminate()"); //new
}
开发者ID:alicerobson,项目名称:fastsim_cc,代码行数:27,代码来源:main.cpp

示例5: makeOBV

TGraph * makeOBV(TGraph *Graph1){

	TGraph *gr = new TGraph();
	double X;
	double Y;
	int pp=0;
	Graph1->GetPoint(1,X,Y);
	for (double MDM=1;MDM<=Y;MDM+=0.1){

		gr->SetPoint(pp,MDM,vecF(X,MDM));
		pp++;
	}
	for (int p =1;p<Graph1->GetN();p++){
		Graph1->GetPoint(p,X,Y);
		if (!(X >1)) continue;
		
		std::cout << X << "  " << Y << std::endl;
		gr->SetPoint(pp,Y,vecF(X,Y));	
		pp++;
	}
	gr->GetXaxis()->SetTitle("m_{DM}");
	gr->GetYaxis()->SetTitle("#sigma_{SD}");
	gr->SetName(Form("%s_DD",Graph1->GetName()));
	gr->SetLineStyle(Graph1->GetLineStyle());
	gr->SetLineColor(Graph1->GetLineColor());
	gr->SetLineWidth(Graph1->GetLineWidth());

	return gr;	
}
开发者ID:nucleosynthesis,项目名称:EXOpaper,代码行数:29,代码来源:buildPlotAxial_DD.C

示例6: treegraph

void treegraph(TString filename) {
   gROOT->SetStyle("Plain");
   gStyle->SetOptDate();


   Double_t x, y;
   Int_t nlines = 0;
   TFile *f = new TFile("graph.root","RECREATE");

   TCanvas *canvas_graph = new TCanvas("canvas_graph", "y vs x",467,89,400,700);

   TTree t;
   t.ReadFile(filename,"x:y");
   t.Draw("x:y","","goff");

   TGraph *g = new TGraph(t.GetSelectedRows(),t.GetV1(),t.GetV2());
   g->SetTitle(filename+": Y vs X");
   g->GetXaxis()->SetTitle("x[a.u.]");
   g->GetYaxis()->SetTitle("y[a.u.]");

   g->SetMarkerStyle(21);
   g->Draw("AP");

   f->Write();
}
开发者ID:bdorney,项目名称:TurboSoftware,代码行数:25,代码来源:treegraph.C

示例7: plotChi2

void plotChi2(TTree *dataTree, TTree *mcTree,
	      TCut dataCandidateCut, TCut sidebandCut,
	      TCut mcSignalCut,
	      Double_t backgroundShift, Double_t purityBinVal)
{
  dtree_ = dataTree;
  mtree_ = mcTree;
  dCut_ = dataCandidateCut;
  sCut_ = sidebandCut;
  mCut_ = mcSignalCut;
  bkg_shift_ = backgroundShift;
  purityBinVal_ = purityBinVal;

  const int bins = 100;//0.001/0.00001;
  double x[bins];
  double y[bins];
  
  for(int i = 0; i < bins; i++)
  {
    double shift = -0.0005 + 0.001 * ((double)i/bins);
    x[i] = shift;
    y[i] = minimizerPurity(shift);    
  }

  TGraph *plot = new TGraph(bins,x,y);
  plot->GetYaxis()->SetTitle("#chi^2/ndf");
  plot->GetXaxis()->SetTitle("signal distribution shift");
  plot->Draw("AP");
}
开发者ID:CmsHI,项目名称:gammaJetAnalysis,代码行数:29,代码来源:photonChi2Min.C

示例8: particleinteractions2

void particleinteractions2() {
  //Draw a simple graph
  // To see the output of this macro, click begin_html <a href="gif/graph.gif">here</a>. end_html
  //Author: Rene Brun

  TCanvas *c1 = new TCanvas("c1","A Simple Graph Example",200,10,700,500);

  c1->SetFillColor(42);
  c1->SetGrid();

  const Int_t n = 1000;
  Double_t x[n], y[n];
  int minEnergy = ceil(mass*pow(c,2));
  for (Int_t i=0; i < 1000;i++) {
    double  energy = minEnergy+i;
    x[i] = energy;
    y[i] = exp(-mass*c/(lifetime*sqrt(energy*energy-mass*mass*pow(c, 4))));
    printf(" i %i %f %f \n",i,x[i],y[i]);
  }
  TGraph *gr = new TGraph(n,x,y);
  gr->SetLineColor(2);
  gr->SetLineWidth(4);
  gr->SetMarkerColor(4);
  gr->SetMarkerStyle(21);
  gr->SetTitle("Particle Decay Graph");
  gr->GetXaxis()->SetTitle("Energy (MeV)");
  gr->GetYaxis()->SetTitle("Probability");
  gr->Draw("ACP");

  // TCanvas::Update() draws the frame, after which one can change it
  c1->Update();
  c1->GetFrame()->SetFillColor(21);
  c1->GetFrame()->SetBorderSize(12);
  c1->Modified();
}
开发者ID:eshantewari,项目名称:UMD2015,代码行数:35,代码来源:particleinteractions2.C

示例9: graph

void graph() {
   TCanvas *c1 = new TCanvas("c1","A Simple Graph Example",200,10,700,500);

   c1->SetFillColor(42);
   c1->SetGrid();

   const Int_t n = 20;
   Double_t x[n], y[n];
   for (Int_t i=0;i<n;i++) {
     x[i] = i*0.1;
     y[i] = 10*sin(x[i]+0.2);
     printf(" i %i %f %f \n",i,x[i],y[i]);
   }
   TGraph *gr = new TGraph(n,x,y);
   gr->SetLineColor(2);
   gr->SetLineWidth(4);
   gr->SetMarkerColor(4);
   gr->SetMarkerStyle(21);
   gr->SetTitle("a simple graph");
   gr->GetXaxis()->SetTitle("X title");
   gr->GetYaxis()->SetTitle("Y title");
   gr->Draw("ACP");

   // TCanvas::Update() draws the frame, after which one can change it
   c1->Update();
   c1->GetFrame()->SetFillColor(21);
   c1->GetFrame()->SetBorderSize(12);
   c1->Modified();
}
开发者ID:bbannier,项目名称:root-1,代码行数:29,代码来源:graph.C

示例10: draw_axis_lambda

void draw_axis_lambda(const char *opt = "")
{
    const Int_t nn = 2;
    Double_t xx[nn] = {LAMBDA_MIN, LAMBDA_MAX};
    Double_t yy[nn] = {LAMBDA_INT_MIN, LAMBDA_INT_MAX};
    TGraph *ga = new TGraph(nn, xx, yy);
    ga->SetTitle(Form("Intensity (Lambda) %s", opt));
    ga->GetXaxis()->SetTitle("Lambda");
    ga->GetYaxis()->SetTitle("Intensity");
    ga->Draw("ap");
}
开发者ID:akusumoto,项目名称:root-tomoyori-bragg,代码行数:11,代码来源:compare_integration.C

示例11: draw_axis_tof

void draw_axis_tof(const char *opt = "")
{
    const Int_t nn = 2;
    Double_t xx[nn] = {TOF_MIN, TOF_MAX};
    Double_t yy[nn] = {TOF_INT_MIN, TOF_INT_MAX};
    TGraph *ga = new TGraph(nn, xx, yy);
    ga->SetTitle(Form("Intensity (TOF) %s", opt));
    ga->GetXaxis()->SetTitle("TOF");
    ga->GetYaxis()->SetTitle("Intensity");
    ga->Draw("ap");
}
开发者ID:akusumoto,项目名称:root-tomoyori-bragg,代码行数:11,代码来源:compare_integration.C

示例12: draw_rhotau

void plotter::draw_rhotau(TSpline *rhotau, double tau, TString file_name){
  TCanvas *c = new TCanvas("c","",600,600);
  gPad->SetLeftMargin(0.15);
  TGaxis::SetMaxDigits(3);
  double logtau = TMath::Log10(tau);
  std::vector<double> Xpoint = {logtau};
  std::vector<double> Ypoint = {rhotau->Eval(logtau)};
  TGraph * point = new TGraph(1, &Xpoint[0], &Ypoint[0]);
  point->SetTitle(" ");
  point->GetXaxis()->SetTitle("log #tau");
  point->GetYaxis()->SetTitle("#rho(log #tau)");
  point->GetYaxis()->SetTitleOffset(1.5);
  point->GetXaxis()->SetNdivisions(505);
  point->GetYaxis()->SetNdivisions(505);
  point->SetMarkerStyle(20);
  point->SetMarkerSize(1.5);
  point->SetLineColor(1);
  point->Draw("AP");
  point->GetXaxis()->SetLimits(-4.0, -1.5);
  double ymin = Ypoint[0]*0.95;
  double ymax = 1.15;
  point->GetYaxis()->SetRangeUser(ymin, ymax);
  point->Draw("AP");
  c->Update();

  // gPad->SetLogx();

  rhotau->SetLineColor(kCyan+2);
  rhotau->SetLineWidth(2);
  rhotau->Draw("L SAME");
  point->Draw("P SAME");

  TLegend *l=new TLegend(0.55,0.65,0.85,0.8);
  l->SetBorderSize(0);
  l->SetFillStyle(0);
  l->AddEntry(point,"final #tau value","pl");
  l->AddEntry(rhotau,"#tau scan","l");
  l->Draw();
  c->SaveAs(directory + file_name + ".pdf");
  delete c;
}
开发者ID:UHH2,项目名称:MTopJet,代码行数:41,代码来源:plotter.C

示例13: SimpleGraph

/*  Read data from FILE, which has HEADER_SIZE header lines
 *  before data text and NUM_POINTS total data points. Make a
 *  TGraph titled TITLE, x-axis labeled XTITLE, y-axis labeled
 *  YTITLE.
 */
void SimpleGraph(char file[] = "",
                 int header_size = 4, int num_points = 30,
                 char title[] = "Graph",
                 char xtitle[] = "wavelength [nm]", 
                 char ytitle[] = "Intensity [photons/sec]") {
                 
    TGraph* plot = new TGraph();
    FILE *data = fopen(file, "r");
    if (!data) {
        printf("Options: \"filename\", header size, num points, \"title\", \"x-axis label\", \"y-axis label\".\n");
        return;
    }
    
    char line[LINE_SIZE];
    char* p;
    int index = 0;
    for (int h = 0; h < header_size; h++) 
        fgets(line, sizeof(line), data);
    while(fgets(line, sizeof(line), data)) {
        strtok(line, "\n");
        if (index > num_points) break;
        double x = strtod(line, &p);
        double y = atof(p);
        plot->SetPoint(index, x, y);
        index++;
    }
    fclose(data);
    
    plot->SetTitle(title);
    plot->GetXaxis()->SetTitle(xtitle);
    plot->GetYaxis()->SetTitle(ytitle);
    plot->GetYaxis()->SetTitleOffset(1.5);
    plot->SetMarkerColor(4);
    plot->SetMarkerStyle(20);
    plot->SetMarkerSize(.7);
    plot->Draw();
}
开发者ID:lbignell,项目名称:WbLS-Quantum-Yield,代码行数:42,代码来源:SimpleGraph.C

示例14: plot_purity_massbin

//final purity plot vs diphoton mass bins
//TODO plot as bin on the x-axis, not as marker point
int plot_purity_massbin(double mass[], double masserr[],double pur[],double purerr[])  {
	TCanvas* cgr =new TCanvas("cgr","cgr");
 	TLegend* leg = new TLegend(0.6,0.7,0.7,0.8);
   	leg->SetFillColor(10);
    leg->SetLineColor(10);
    leg->SetTextSize(0.03);
    leg->SetTextFont(42);
 	TGraph *gr = new TGraphErrors(nq_q,mass, pur,masserr,purerr);
//	cgr->SetLogx();
	cgr->SetGridy();
	gr->SetTitle(Form("mgg %s",eta_q.Data()));
	gr->SetMarkerStyle(20);
    gr->SetMarkerSize(1.3);
    gr->GetYaxis()->SetTitle("purity");
    gr->GetXaxis()->SetTitle("diphoton mass [GeV]");
    gr->GetYaxis()->SetRangeUser(0.,1.);
    gr->GetYaxis()->SetTitleOffset(1.2);
    leg->AddEntry(gr,"template fit purity ","p");    
    gr->Draw("AP+");
    leg->Draw();
    cgr->Print(Form("../plots/150309_%s_purity_%s_massbin_%u_range_%u_%u.root",(truthfit) ? "truth": "rcone_sideb",eta_q.Data(),ntot_q,startbin_q,endbin_q),"root");
    cgr->Print(Form("../plots/150309_%s_purity_%s_massbin_%u_range_%u_%u.png",(truthfit) ? "truth": "rcone_sideb",eta_q.Data(),ntot_q,startbin_q,endbin_q),"png");
    return 0;
}
开发者ID:quittnat,项目名称:light_diphoton,代码行数:26,代码来源:fit1d.C

示例15: drawHistoTracker

void drawHistoTracker(TH1F* histo, const TString option, const unsigned int color, vector<vector<HistoHolder> > & histos)
{
  // +1 because the array returned by the histogram starts from the underflow bin
  Float_t * summedValues = histo->GetArray()+1;
  unsigned int size = histo->GetNbinsX();
  double * summedValuesArray = duplicateForGraph(size, summedValues);
  TGraph * graph = new TGraph(histos[0][0].getSize(1, 0), histos[0][0].time(1, 0), summedValuesArray);
  graph->Draw(option);
  graph->SetLineColor(color);
  graph->GetXaxis()->SetTimeDisplay(1);
  graph->GetXaxis()->SetLabelOffset(0.02);
  graph->GetXaxis()->SetTimeFormat("#splitline{  %d}{%H:%M}");
  graph->GetXaxis()->SetTimeOffset(0,"gmt");
  graph->GetYaxis()->SetRangeUser(0,16000);
  graph->GetXaxis()->SetTitle("day/hour");
  graph->GetXaxis()->SetTitleSize(0.03);
  graph->GetXaxis()->SetTitleColor(kBlack);
  graph->GetXaxis()->SetTitleOffset(1.80);
  graph->GetYaxis()->SetTitle("number of modules off");
  graph->GetYaxis()->SetTitleSize(0.03);
  graph->GetYaxis()->SetTitleColor(kBlack);
  graph->GetYaxis()->SetTitleOffset(1.80);
  graph->SetTitle();
}
开发者ID:Andrej-CMS,项目名称:cmssw,代码行数:24,代码来源:ExtractTrends.C


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