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


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

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


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

示例1: SimplePlot2D


//.........这里部分代码省略.........
  can->SetLeftMargin(0.12);
  can->SetRightMargin(0.15);
  gStyle->SetOptStat(0);
  gStyle->SetOptTitle(0);

  can->Draw();
  can->SetGridx();
  can->SetGridy();
  
  can->cd();

  hist->Draw("COLZ");
  
  hist->GetXaxis()->SetTitle(varXname.c_str());
  hist->GetXaxis()->CenterTitle();
  hist->GetYaxis()->SetTitle(varYname.c_str());
  hist->GetYaxis()->CenterTitle();
  hist->GetYaxis()->SetTitleOffset(1.4);
  hist->GetYaxis()->CenterTitle();
  //hist->GetYaxis()->SetRangeUser(0.,hist->GetMaximum()*1.1) ;

  TCanvas* canN = new TCanvas("canN","canN",600,500);
  canN->SetTopMargin(0.05);
  canN->SetLeftMargin(0.12);
  canN->SetRightMargin(0.15);

  canN->Draw();
  canN->SetGridx();
  canN->SetGridy();
  
  canN->cd();

  histN->Draw("COLZ");
  
  histN->GetXaxis()->SetTitle(varXname.c_str());
  histN->GetXaxis()->CenterTitle();
  histN->GetYaxis()->SetTitle(varYname.c_str());
  histN->GetYaxis()->CenterTitle();
  histN->GetYaxis()->SetTitleOffset(1.4);
  histN->GetYaxis()->CenterTitle();
			     
  TCanvas* canchch = new TCanvas("canchch","canchch",600,500);
  canchch->SetTopMargin(0.05);
  canchch->SetLeftMargin(0.12);
  canchch->SetRightMargin(0.15);

  canchch->Draw();
  canchch->SetGridx();
  canchch->SetGridy();
  
  canchch->cd();
  histchch->Draw("COLZ");
  
  histchch->GetXaxis()->SetTitle("CH pulsed");
  histchch->GetXaxis()->CenterTitle();
  histchch->GetYaxis()->SetTitle("CH data");
  histchch->GetYaxis()->CenterTitle();
  histchch->GetYaxis()->SetTitleOffset(1.4);
  histchch->GetYaxis()->CenterTitle();
  histchch->GetZaxis()->SetTitle("Number of data events");
  histchch->GetZaxis()->SetTitleOffset(1.4);
  histchch->GetZaxis()->CenterTitle();
 
  l.DrawLatex(.54,65.2,"VMM 2");

  TCanvas* can_delay = new TCanvas("can_delay","can_delay",600,500);
  can_delay->Draw();
  can_delay->cd();

  for(int i = 0; i < 5; i++)
    count_tot[i] = count_right[i]/count_tot[i];
  TGraph* gr = new TGraph(5,delays,count_tot);
  gr->SetMarkerSize(4);
  gr->SetMarkerStyle(5);
  gr->Draw("AP");

  histDelay->Divide(histDelayD);

  TCanvas* canDelay = new TCanvas("canDelay","canDelay",600,500);
  canDelay->SetTopMargin(0.05);
  canDelay->SetLeftMargin(0.12);
  canDelay->SetRightMargin(0.15);

  canDelay->Draw();
  canDelay->SetGridx();
  canDelay->SetGridy();
  
  canDelay->cd();
  histDelay->Draw("COLZ");
  
  histDelay->GetXaxis()->SetTitle("CH pulsed");
  histDelay->GetXaxis()->CenterTitle();
  histDelay->GetYaxis()->SetTitle("Delay Count");
  histDelay->GetYaxis()->CenterTitle();
  histDelay->GetYaxis()->SetTitleOffset(1.4);
  histDelay->GetYaxis()->CenterTitle();
  histDelay->GetZaxis()->SetTitle("Fraction zeroes");
  histDelay->GetZaxis()->SetTitleOffset(1.4);
  histDelay->GetZaxis()->CenterTitle();
}
开发者ID:alexandertuna,项目名称:MMFE8,代码行数:101,代码来源:SimplePlot2D.C

示例2: ConfidenceIntervals

void ConfidenceIntervals()
{
//Illustrates TVirtualFitter::GetConfidenceIntervals
//This method computes confidence intervals for the fitted function
//Author: Anna Kreshuk
   
   TCanvas *myc = new TCanvas("myc", 
      "Confidence intervals on the fitted function",1200, 500);
   myc->Divide(3,1);

/////1. A graph
   //Create and fill a graph
   Int_t ngr = 100;
   TGraph *gr = new TGraph(ngr);
   gr->SetName("GraphNoError");
   Double_t x, y;
   Int_t i;
   for (i=0; i<ngr; i++){
      x = gRandom->Uniform(-1, 1);
      y = -1 + 2*x + gRandom->Gaus(0, 1);
      gr->SetPoint(i, x, y);
   }
   //Create the fitting function
   TF1 *fpol = new TF1("fpol", "pol1", -1, 1);
   fpol->SetLineWidth(2);
   gr->Fit(fpol, "Q");

   //Create a TGraphErrors to hold the confidence intervals
   TGraphErrors *grint = new TGraphErrors(ngr);
   grint->SetTitle("Fitted line with .95 conf. band");
   for (i=0; i<ngr; i++)
      grint->SetPoint(i, gr->GetX()[i], 0);
   //Compute the confidence intervals at the x points of the created graph
   (TVirtualFitter::GetFitter())->GetConfidenceIntervals(grint);
   //Now the "grint" graph contains function values as its y-coordinates
   //and confidence intervals as the errors on these coordinates
   //Draw the graph, the function and the confidence intervals
   myc->cd(1);
   grint->SetLineColor(kRed);
   grint->Draw("ap");
   gr->SetMarkerStyle(5);
   gr->SetMarkerSize(0.7);
   gr->Draw("psame");

/////2. A histogram
   myc->cd(2);
   //Create, fill and fit a histogram
   Int_t nh=5000;
   TH1D *h = new TH1D("h", 
      "Fitted gaussian with .95 conf.band", 100, -3, 3);
   h->FillRandom("gaus", nh);
   TF1 *f = new TF1("fgaus", "gaus", -3, 3);
   f->SetLineWidth(2);
   h->Fit(f, "Q");
   h->Draw();
   
   //Create a histogram to hold the confidence intervals
   TH1D *hint = new TH1D("hint", 
      "Fitted gaussian with .95 conf.band", 100, -3, 3);
   (TVirtualFitter::GetFitter())->GetConfidenceIntervals(hint);
   //Now the "hint" histogram has the fitted function values as the 
   //bin contents and the confidence intervals as bin errors
   hint->SetStats(kFALSE);
   hint->SetFillColor(2);
   hint->Draw("e3 same");

/////3. A 2d graph
   //Create and fill the graph
   Int_t ngr2 = 100;
   Double_t z, rnd, e=0.3;
   TGraph2D *gr2 = new TGraph2D(ngr2);
   gr2->SetName("Graph2DNoError");
   TF2  *f2 = new TF2("f2",
      "1000*(([0]*sin(x)/x)*([1]*sin(y)/y))+250",-6,6,-6,6);
   f2->SetParameters(1,1);
   for (i=0; i<ngr2; i++){
      f2->GetRandom2(x,y);
      // Generate a random number in [-e,e]
      rnd = 2*gRandom->Rndm()*e-e; 
      z = f2->Eval(x,y)*(1+rnd);
      gr2->SetPoint(i,x,y,z);
   }
   //Create a graph with errors to store the intervals
   TGraph2DErrors *grint2 = new TGraph2DErrors(ngr2);
   for (i=0; i<ngr2; i++)
      grint2->SetPoint(i, gr2->GetX()[i], gr2->GetY()[i], 0);

   //Fit the graph
   f2->SetParameters(0.5,1.5);
   gr2->Fit(f2, "Q");
   //Compute the confidence intervals
   (TVirtualFitter::GetFitter())->GetConfidenceIntervals(grint2);   
   //Now the "grint2" graph contains function values as z-coordinates
   //and confidence intervals as their errors
   //draw
   myc->cd(3);
   f2->SetNpx(30);
   f2->SetNpy(30);
   f2->SetFillColor(kBlue);
   f2->Draw("surf4");
//.........这里部分代码省略.........
开发者ID:My-Source,项目名称:root,代码行数:101,代码来源:ConfidenceIntervals.C

示例3: errftest


//.........这里部分代码省略.........
    //complexmath calculation
    TStopwatch *time1 = new TStopwatch();
    time1.Start();
    
    for(Int_t n = 0.; n<50; n++){
      
      t = -4 + 0.36*n;
      
      aa = (t/(TMath::Sqrt(2.)*s)) - (s/(TMath::Sqrt(2.)*t0));  
      bb = (s*s/(2.*t0*t0)) - t/t0;
      cc = s*dm/(TMath::Sqrt(2.));
      
      if(t >= tcompare){
	evilterm1=TMath::Exp(-(cc*cc))*2*TMath::Cos(2*aa*cc);
	evilterm2=TMath::Exp(-(cc*cc))*2*TMath::Cos(2*aa*cc);   
      }else if(t<= -tcompare){    
	evilterm1=0;
	evilterm2=0;    
      }else{
	
	wz1 = cxerf(cc,-aa);
	wzreneg1 = re(wz1);    
	evilterm1=TMath::Exp(-(aa*aa))*wzreneg1;
	func1 = 1./(2.*t0)*TMath::Exp(bb)*( 1 + TMath::Erf(aa) - tag*evilterm1 );
      }
    }
    
    time1.Stop();
    timer1R[ij] = time1.RealTime();
    timer1C[ij] = time1.CpuTime();
    
    //roomath calculation
    TStopwatch *time2 = new TStopwatch();
    time2.Start();
    
    for(Int_t n = 0.; n<50; n++){
      
      t = -4 + 0.36*n;
      
      aa = (t/(TMath::Sqrt(2.)*s)) - (s/(TMath::Sqrt(2.)*t0));  
      bb = (s*s/(2.*t0*t0)) - t/t0;
      cc = s*dm/(TMath::Sqrt(2.));
      
      if(t >= tcompare){
	evilterm1=TMath::Exp(-(cc*cc))*2*TMath::Cos(2*aa*cc);
	evilterm2=TMath::Exp(-(cc*cc))*2*TMath::Cos(2*aa*cc);   
      }else if(t<= -tcompare){    
	evilterm1=0;
	evilterm2=0;    
      }else{
	
	wz2 = RooMath::ComplexErrFunc(cc,-aa);
	wzreneg2 = wz2.re();    
	evilterm2=TMath::Exp(-(aa*aa))*wzreneg2;
	func2 = 1./(2.*t0)*TMath::Exp(bb)*( 1 + TMath::Erf(aa) - tag*evilterm2 );
      }
    }
    time2.Stop();
    timer2R[ij] = time2.RealTime();
    timer2C[ij] = time2.CpuTime();  
    xi[ij]=ij;
  }

  gROOT->SetStyle("Plain");

  TCanvas *realtime = new TCanvas("realtime", "realtime_compare", 500,500);
  realtime->SetGrid();

  TGraph *complextestRT = new TGraph(20,xi,timer1R);
  complextestRT->SetName("complextest-RT");
  complextestRT->SetTitle("Complexmath Test: Real Time");
  complextestRT->SetMarkerStyle(30);
  complextestRT->SetMarkerSize(2);
  complextestRT->Draw("ALP");
  
  TGraph *roofittestRT = new TGraph(20,xi,timer2R);
  roofittestRT->SetName("roofittest-RT");
  roofittestRT->SetMarkerStyle(29);
  roofittestRT->SetMarkerSize(1);
  roofittestRT->SetMarkerColor(4);
  roofittestRT->Draw("LP");
  
  TCanvas *cputime = new TCanvas("cputime", "cputime_compare", 500,500);
  cputime->SetGrid(); 

  TGraph *complextestCT = new TGraph(20,xi,timer1C);
  complextestCT->SetName("complextest-CT");
  complextestCT->SetTitle("Complexmath Test: CPU Time");
  complextestCT->SetMarkerStyle(30);
  complextestCT->SetMarkerSize(2);
  complextestCT->Draw("ALP");
  
  TGraph *roofittestCT = new TGraph(20,xi,timer2C);
  roofittestCT->SetName("roofittest-CT");
  roofittestCT->SetMarkerStyle(29);
  roofittestCT->SetMarkerSize(1);
  roofittestCT->SetMarkerColor(4);
  roofittestCT->Draw("LP");
  
}
开发者ID:complexbits,项目名称:HEP-archive,代码行数:101,代码来源:errftest.C

示例4: quantiles

void quantiles() {
   // demo for quantiles
   // Author; Rene Brun
   const Int_t nq = 100;
   const Int_t nshots = 10;
   Double_t xq[nq];  // position where to compute the quantiles in [0,1]
   Double_t yq[nq];  // array to contain the quantiles
   for (Int_t i=0;i<nq;i++) xq[i] = Float_t(i+1)/nq;

   TGraph *gr70 = new TGraph(nshots);
   TGraph *gr90 = new TGraph(nshots);
   TGraph *gr98 = new TGraph(nshots);
   TH1F *h = new TH1F("h","demo quantiles",50,-3,3);
   
   for (Int_t shot=0;shot<nshots;shot++) {
      h->FillRandom("gaus",50);
      h->GetQuantiles(nq,yq,xq);
      gr70->SetPoint(shot,shot+1,yq[70]);
      gr90->SetPoint(shot,shot+1,yq[90]);
      gr98->SetPoint(shot,shot+1,yq[98]);
   }
   
   //show the original histogram in the top pad
   TCanvas *c1 = new TCanvas("c1","demo quantiles",10,10,600,900);
   c1->SetFillColor(41);
   c1->Divide(1,3);
   c1->cd(1);
   h->SetFillColor(38);
   h->Draw();
   
   // show the final quantiles in the middle pad
   c1->cd(2);
   gPad->SetFrameFillColor(33);
   gPad->SetGrid();
   TGraph *gr = new TGraph(nq,xq,yq);
   gr->SetTitle("final quantiles");
   gr->SetMarkerStyle(21);
   gr->SetMarkerColor(kRed);
   gr->SetMarkerSize(0.3);
   gr->Draw("ap");
   
   // show the evolution of some  quantiles in the bottom pad
   c1->cd(3);
   gPad->SetFrameFillColor(17);
   gPad->DrawFrame(0,0,nshots+1,3.2);
   gPad->SetGrid();
   gr98->SetMarkerStyle(22);
   gr98->SetMarkerColor(kRed);
   gr98->Draw("lp");
   gr90->SetMarkerStyle(21);
   gr90->SetMarkerColor(kBlue);
   gr90->Draw("lp");
   gr70->SetMarkerStyle(20);
   gr70->SetMarkerColor(kMagenta);
   gr70->Draw("lp");
   // add a legend
   TLegend *legend = new TLegend(0.85,0.74,0.95,0.95);
   legend->SetTextFont(72);
   legend->SetTextSize(0.05);
   legend->AddEntry(gr98," q98","lp");
   legend->AddEntry(gr90," q90","lp");
   legend->AddEntry(gr70," q70","lp");
   legend->Draw();
}
开发者ID:alcap-org,项目名称:AlcapDAQ,代码行数:64,代码来源:quantiles.C

示例5: fit

void fit(){
  //int NumberOfLines();
  string input_name;
  cout << "Archivo de datos sin extension \n";
  cin >>  input_name;



  //const char *input_name = "para_grafica";
  string name = input_name+".txt";
  cout << name;
  ifstream file(name.c_str());

if (!file) {
  cout << "Archivo no encontado \n";
}
else{
  int N_Lines = NumberOfLines(file);
  printf("Number of lines: %i \n", N_Lines);

  int j = 0;
  float t, P;

  //int LinesCont = NumberOfLines(archivo);

   TVectorD X(N_Lines+1);
   TVectorD Y(N_Lines+1);

  while (!file.eof()){
    file >> t >> P;
    //printf("%i, %f, %f \n", j, t, P);
    //getchar();

    X(j) = t;
    Y(j) = P;

    ++j;

  }
  TCanvas *Grafico = new TCanvas("Grafico", "Grafico de P contra t", 200, 10, 700, 500);
  TGraph *gr = new TGraph(X,Y);

  TF1 *f = new TF1 ("fit", FitFunction, 20, 3000, 2);
  f -> SetParameters(700, 0.5);
  f -> SetParNames("PresionControl", "VelocidadEfectiva");
  f ->SetLineStyle(1);
  f ->SetLineColor(kBlue);
  gr -> Fit("fit", "R");

  gr->SetMarkerColor(kPink - 9);

  gr->SetMarkerStyle(23);
  gr->SetMarkerSize(0.5);
  gr->SetTitle("P(t) Muestra I");
  gr->GetXaxis()->SetTitle("Tiempo (s)");
  gr->GetYaxis()->SetTitle("Presion (Torr)");
  gr->GetYaxis()->SetRange(-100, 800);
  gr->Draw("AP");

  leg = new TLegend(0.63,0.70,0.87,0.88);
  leg->SetHeader("Muestra");
  leg->AddEntry("f","P=P_{0} e^{-S t/V}", "l");
  leg->AddEntry("gr","P(t)","lep");
  leg->AddEntry((TObject*)0, Form("S = %f", f->GetParameter(1)), "");
  leg->AddEntry((TObject*)0, Form("#sigma_{S} = %f", f->GetParError(1)), "");
  leg->Draw();

  //Grafico.SetLogy();
  Grafico->SetGrid();
  Grafico->Update();
  string save_file = input_name+".png";
  Grafico->Print(save_file.c_str());
  //printf("%i", cont);
}


  cout << "Funciona" << endl;
  Hola();

}
开发者ID:FernandaPerez,项目名称:LaboratorioContemporanea,代码行数:80,代码来源:fit.C

示例6: AnalysisSparse


//.........这里部分代码省略.........
             gr_true_eff->GetErrorX(i), gr_true_eff->GetErrorY(i));
      if (!save_output) continue;
      gSystem->mkdir(dir_prefix.Data());
      tout = Form("%f %f %f %f", oux, ouy, ouxe, ouye);
      if (i == 0)
        tout = Form("Printf(\"%s\"); > %s/effi_%s", tout.Data(),
                    dir_prefix.Data(), grapht.Data());
      else
        tout = Form("Printf(\"%s\"); >> %s/effi_%s", tout.Data(),
                    dir_prefix.Data(), grapht.Data());
      //      Printf(":::::: %s", tout.Data());
      gROOT->ProcessLine(tout.Data());
    }
    // ------------------
    c = new TCanvas("cfinal", "mc_effi", 1200, 450);
    c->Divide(2, 1, 0.001, 0.001); c->Modified(); c->Draw();
    c->cd(1);
    gr_true->SetMinimum(0);
    gr_true->SetTitle(Form("phi (true & raw), %s", gtitle.Data()));
    gr_true->SetMarkerColor(kGreen+1);
    gr_true->Draw("AP");
    gr->SetMarkerColor(kRed+1);
    gr->Draw("P");
    c->cd(2)->SetGrid();
    gr_true_eff->SetMinimum(0);
    gr_true_eff->SetTitle(Form("efficiency, %s", grapht.Data()));
    gr_true_eff->SetMarkerColor(kGreen+1);
    gr_true_eff->Draw("AP");
    gr_e->SetMarkerColor(kRed+1);
    gr_e->Draw("P");
    //    c->SaveAs(Form("%s_%s.eps", blabla.Data(), grapht.Data()));
    return;
  }

  //  TGraph *geff = new TGraph(Form("effi_raw_%s", grapht.Data()));
  //  TGraph *geff = new TGraph(Form("effi_true_%s", grapht.Data()));
  //  TGraph *geff = new TGraph("effi_true_Phi2010_qualityonly");
  TGraph *geff = new TGraph("effi_true_PhiNsigma_qualityonly");
  if (geff->IsZombie()) return;
  geff->SetMarkerStyle(22);
  geff->SetMarkerColor(kBlack);
  geff->GetXaxis()->SetTitle("p_{t}, GeV/c");
  geff->SetTitle(Form("efficiency, %s", grapht.Data()));
  c = new TCanvas();
  c->SetGrid();
  geff->Draw("AP");
  Double_t tpcsigma = 9999.9;
  if (ilist == 1) tpcsigma = 1.0;
  if (ilist == 2) tpcsigma = 1.5;
  if (ilist == 3) tpcsigma = 2.0;
  if (ilist == 4) tpcsigma = 2.5;
  if (ilist == 5) tpcsigma = 3.0;
  Double_t sss = TMath::Erf(tpcsigma/TMath::Sqrt(2.0));
  if (noSigma) sss = 1.0;
  Printf("sigma = %10f", sss);

  // for (Int_t i = 0; i < count; i++)
  //   geff->GetY()[i] = (sss*sss)/(geff->GetY()[i]);
  // geff->SetMaximum(1.0);
  // geff->Draw("AP");

  for (Int_t i = 0; i < count; i++) {
    Double_t deno = geff->Eval(grx[i])*sss*sss;
    if (deno < 0.00001) deno = 1;
    gry_fix[i] = gry[i]/deno;
  }
  new TCanvas;
  TGraph *gr_fix = new TGraph(count, grx, gry_fix);
  gr_fix->SetMarkerStyle(21);
  gr_fix->SetMarkerColor(hh->GetLineColor());
  gr_fix->GetXaxis()->SetTitle("p_{t}, GeV/c");
  gr_fix->SetTitle(Form("corrected phi * #sigma^{2}, %s", gtitle.Data()));
  if (noSigma)
    gr_fix->SetTitle(Form("corrected phi (no #sigma), %s", gtitle.Data()));
  gr_fix->Draw("AP");

  //---------------------
  c = new TCanvas("cfinald", "data_correct", 1200, 450);
  c->Divide(2, 1, 0.001, 0.001); c->Modified(); c->Draw();
  c->cd(1);
  gr->SetMinimum(0);
  gr->SetMarkerColor(kBlack);
  gr->Draw("AP");
  c->cd(2);
  gr_fix->SetMinimum(0);
  gr_fix->SetMarkerColor(kGreen+3);
  gr_fix->Draw("AP");
  TString bla9 = Form("qualityonly_PID2_%s", grapht.Data());
  if (noSigma) bla9 = Form("%s_noSig.C", bla9.Data());
  else         bla9 = Form("%s.C", bla9.Data());
  //  gr_fix->SaveAs(bla9.Data());
  //  TPad *cp = new TPad("cpf", "", 0.45,0.45,0.99,0.92);
  TPad *cp = new TPad("cpf", "", 0.60,0.55,0.99,0.93);
  cp->SetLogy(); cp->Draw(); cp->cd();
  TGraph *cloneg = ((TGraph *)gr_fix->Clone());
  cloneg->SetTitle(); cloneg->SetMarkerSize(0.8);
  cloneg->Draw("AP");
  //  c->SaveAs(Form("%s_%s.eps", blabla.Data(), grapht.Data()));
  f->Close();
}
开发者ID:musinsky,项目名称:bordel,代码行数:101,代码来源:Sparse_MC.C

示例7: PlotBlowoutScalings


//.........这里部分代码省略.........
  TGraph *gDeltaPsiFocus = new TGraph(Nsim,Current,DeltaPsiFocus);
  TGraph *gDeltaPsiLO = new TGraph(Nsim,Current,DeltaPsiLO);
  TGraph *gDeltaPsiLU = new TGraph(Nsim,Current,DeltaPsiLU);

  TGraph *gEzSlope = new TGraph(Nsim,Current,EzSlope);
  TGraph *gEzSlopeMaxFocus = new TGraph(Nsim,Current,EzSlopeMaxFocus);
  TGraph *gEzSlopeLO = new TGraph(Nsim,Current,EzSlopeLO);

  TGraph *gTransRatio = new TGraph(Nsim,Current,TransRatio);
  TGraph *gTransRatioFocus = new TGraph(Nsim,Current,TransRatioFocus);

  // Int_t color1 = kMagenta-8;
  // Int_t color2 = kMagenta-2;
  // Int_t color3 = kMagenta-4;
  // Int_t color4 = kAzure+1;
  // Int_t color5 = kGray+2;
  // Int_t markersty = 20;
  // Float_t markersiz = 1.0;
  // Int_t linewit = 2;

  Int_t color1 = kGray+3;
  Int_t color2 = kGray+2;
  Int_t color3 = kAzure+1;
  Int_t color4 = kRed;
  Int_t color5 = kGray+1;
  Int_t markersty = 20;
  Float_t markersiz = 1.0;
  Int_t linewit = 1;

  gRadiusX->SetLineColor(color1);
  gRadiusX->SetLineWidth(linewit);
  gRadiusX->SetMarkerColor(color1);
  gRadiusX->SetMarkerStyle(markersty);
  gRadiusX->SetMarkerSize(markersiz);

  gRadiusLU->SetLineColor(color1);
  gRadiusLU->SetLineWidth(1);
  gRadiusLU->SetLineStyle(4);
  gRadiusLU->SetMarkerColor(color1);
  gRadiusLU->SetMarkerStyle(markersty);
  gRadiusLU->SetMarkerSize(0.0);

  gRadiusZ->SetLineColor(color2);
  gRadiusZ->SetLineWidth(linewit);
  gRadiusZ->SetMarkerColor(color2);
  gRadiusZ->SetMarkerStyle(markersty);
  gRadiusZ->SetMarkerSize(markersiz);

  gRadiusLO->SetLineColor(color2);
  gRadiusLO->SetLineWidth(1);
  gRadiusLO->SetLineStyle(3);
  gRadiusLO->SetMarkerColor(color2);
  gRadiusLO->SetMarkerStyle(markersty);
  gRadiusLO->SetMarkerSize(0.0);

  gRadiusPsi->SetLineColor(color3);
  gRadiusPsi->SetLineWidth(linewit);
  gRadiusPsi->SetMarkerColor(color3);
  gRadiusPsi->SetMarkerStyle(markersty);
  gRadiusPsi->SetMarkerSize(markersiz);

  gEzMax->SetLineColor(color2);
  gEzMax->SetLineWidth(linewit);
  gEzMax->SetMarkerColor(color2);
  gEzMax->SetMarkerStyle(markersty);
  gEzMax->SetMarkerSize(markersiz);
开发者ID:delaossa,项目名称:ptools,代码行数:67,代码来源:PlotBlowoutScalings.C

示例8: PlotHARPHisto

void PlotHARPHisto( std::string beam, std::string target, std::string energy,
                    std::string secondary,
		    std::string region,
		    int ibin )
{
   
   // ReadHARPData( beam, target, energy, secondary, region );
   
   double ymin = 10000.; // something big... don't know if I can use FLT_MAX
   double ymax = -1. ;
   
   for ( int i=0; i<NPoints[ibin]; i++ )
   {
      if ( (Y[ibin][i]+EY[ibin][i]) > ymax ) ymax = Y[ibin][i]+EY[ibin][i];
      if ( (Y[ibin][i]-EY[ibin][i]) < ymin && (Y[ibin][i]-EY[ibin][i]) > 0. ) ymin = (Y[ibin][i]-EY[ibin][i]);
   }
   
   TH1F* hi[NModels];
   std::string YTitle;

   for ( int m=0; m<NModels; m++ )
   {

      std::string histofile = "";
      
      // histofile = "./harp-histo/";
      histofile = "./harp-histo-no-res-decays/";
      // histofile = "../t23-bld/harp-histo/";
      
      // std::string histofile = "./harp-histo/" + beam + target + energy + "GeV" + ModelName[m] + ".root"; 
      histofile += ( beam + target + energy + "GeV" + ModelName[m] + ".root" ); 
      
      // std::cout << " histofile = " << histofile << std::endl;
      
      TFile* f = new TFile( histofile.c_str() );
      
      char buf[5];
      sprintf( buf, "%i", ibin );      
      std::string histoname = secondary + "_" + region + "_";
      histoname.append( buf );
      
      hi[m] = (TH1F*)f->Get( histoname.c_str() );
      
      hi[m]->SetStats(0);
      hi[m]->SetLineColor(ColorModel[m]);
      hi[m]->SetLineWidth(2);
      
      int nx = hi[m]->GetNbinsX();
      for (int k=1; k <= nx; k++) 
      {
	double yy = hi[m]->GetBinContent(k);
	if ( yy > ymax ) ymax = yy;
	if ( yy < ymin && yy > 0. ) ymin = yy;
      }
      if ( m == 0 ) 
      {
         hi[m]->Draw();
	 hi[m]->GetXaxis()->SetTitle("momentum (GeV/c)");
	 //hi[m]->GetYaxis()->SetTitle( YTitle.c_str() );
	 // hi[m]->GetYaxis()->SetTitle("#frac{d^{2}#sigma}{dpd#Theta} [mb/(GeV/c/rad)]");
	 hi[m]->GetYaxis()->SetTitle("d^{2}#sigma / dpd#Theta [mb/(GeV/c/rad)]");
	 hi[m]->GetYaxis()->SetTitleOffset(1.5);
      }
      else hi[m]->Draw("same"); 
            
   }
   
   TLegend* leg = new TLegend(0.6, 0.70, 0.9, 0.9);
   
   for ( int m=0; m<NModels; m++ )
   {
      hi[m]->GetYaxis()->SetRangeUser(ymin,ymax*1.1); // hi[m]->SetTitle("");
      leg->AddEntry( hi[m], ModelName[m].c_str(), "L" );
   }
      
   float* X = new float[NPoints[ibin]];
   for ( int i=0; i<NPoints[ibin]; i++ )
   {
      X[i] = 0.5 * (XMin[ibin][i]+XMax[ibin][i]);
      //std::cout << "X[" << i << "] = " << X[i] << std::endl;
      //std::cout << "Y[" << i << "] = " << Y[0][i] << std::endl;
   }
   
   TGraph* gr = new TGraphErrors( NPoints[ibin], X, Y[ibin], 0, EY[ibin] );
   gr->SetMarkerColor(kBlue);
   gr->SetMarkerStyle(22);
   gr->SetMarkerSize(1.5);
    
   gr->Draw("p");
      
   leg->AddEntry( gr, "exp.data", "p");

   leg->Draw();
   leg->SetFillColor(kWhite);   


   return;

}
开发者ID:gpestana,项目名称:thesis,代码行数:99,代码来源:PlotHARPAnalysis.C


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