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


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

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


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

示例1: DRateQuasiFree

void DRateQuasiFree()
{
  cout<<"============= Quasi Free =================== "<<endl;
  

  Double_t TMax=0.450;
  Double_t TMin=0.180;
  
  Double_t TStep=0.001;
  Int_t NNT = (TMax-TMin)/TStep;
  cout<<NNT<<endl; 
  Double_t TT[1000];
  
  Double_t SigmaQuasiT[1000];

  Double_t SigmaGluonDissVacT[1000];

  Double_t SigmaQuasiFreeGluonT[1000];
 
  Double_t aMuT[1000];
  
  Double_t EDJPsi[1000];
  Double_t EDUpsilon[1000];
 
  Double_t Temp=0;
  cout<<" T:  "<<"  Mu  "<<"  EDiss J "<<"  EDiss Y "<<endl;

  //NNT =1;
  for(int i=0;i<NNT;i++)
    {
      Temp=TMin+(TStep*i);
      TT[i]=Temp;
      
      aMuT[i]= MuT(Temp);
      EDJPsi[i]=EDiss(1,Temp);
      EDUpsilon[i]=EDiss(2,Temp);

      SigmaQuasiT[i]=SigmaQuasiQuark(0.0,Temp);
      
      SigmaGluonDissVacT[i]= SigmaQuasiGluon(1,0.0, Temp);
      SigmaQuasiFreeGluonT[i]= SigmaQuasiGluon(2,0.0, Temp);

      

      cout<<TT[i]<<"  "<<aMuT[i]<<"  "<<EDJPsi[i]<<"  "<<EDUpsilon[i]<<endl;


    } 
  TGraph *GrfSigmaQ = new TGraph(NNT,TT,SigmaQuasiT);
  GrfSigmaQ->SetLineWidth(2);
  GrfSigmaQ->SetLineColor(2);
 
  GrfSigmaQ->GetXaxis()->SetTitle("T(MeV/c)");
  GrfSigmaQ->GetYaxis()->SetTitle("#Gamma (MeV)");

  new TCanvas;
  gPad->SetTicks(1);
  GrfSigmaQ->Draw("APL");

  
  TGraph *GrfSigmaGluonT = new TGraph(NNT,TT,SigmaGluonDissVacT);
  GrfSigmaGluonT->SetLineWidth(2);
  GrfSigmaGluonT->SetLineColor(2);
 
  GrfSigmaGluonT->GetXaxis()->SetTitle("T(MeV/c)");
  GrfSigmaGluonT->GetYaxis()->SetTitle("#Gamma_{J/#psig} (MeV)");

  GrfSigmaGluonT->GetXaxis()->SetRangeUser(0.15,0.45);
  GrfSigmaGluonT->GetYaxis()->SetRangeUser(1.0,1000.0);


  TGraph *GrfSigmaQuasiFreeGluonT = new TGraph(NNT,TT,SigmaQuasiFreeGluonT);
  GrfSigmaQuasiFreeGluonT->SetLineWidth(2);
  GrfSigmaQuasiFreeGluonT->SetLineColor(4);

  new TCanvas;
  gPad->SetTicks(1);
  gPad->SetLogy(1);

  GrfSigmaGluonT->Draw("APL");
  GrfSigmaQuasiFreeGluonT->Draw("PLsame");

  return;









  TGraph *GrfMuT = new TGraph(NNT,TT,aMuT);
  GrfMuT->SetLineWidth(2);
  GrfMuT->SetLineColor(4);

  GrfMuT->GetXaxis()->SetTitle("T(MeV/c)");
  GrfMuT->GetYaxis()->SetTitle("#mu_{D}(GeV)");

  new TCanvas;
//.........这里部分代码省略.........
开发者ID:vineetsalar,项目名称:JPsiProduction,代码行数:101,代码来源:DRateQuasiFree.C

示例2: compareBestFit


//.........这里部分代码省略.........
      }
      else{
	x_title = std::string("best fit for #sigma/#sigma_{SM}");
      }
      
      gr->GetXaxis()->SetTitle(x_title.c_str());
      gr->GetXaxis()->SetLabelFont(62);
      gr->GetXaxis()->SetTitleFont(62);
      gr->GetXaxis()->SetTitleColor(1);
      gr->GetXaxis()->SetTitleOffset(1.05);
      gr->GetXaxis()->SetLimits(minimum, maximum);

      BAND->GetXaxis()->SetTitle(x_title.c_str());
      BAND->GetXaxis()->SetLabelFont(62);
      BAND->GetXaxis()->SetTitleFont(62);
      BAND->GetXaxis()->SetTitleColor(1);
      BAND->GetXaxis()->SetTitleOffset(1.05);
      BAND->GetXaxis()->SetLimits(minimum, maximum);

      // format y-axis
      //BAND->GetYaxis()->Set(hexp.size(), 0, hexp.size());
      gr  ->GetYaxis()->Set(hexp.size(), 0, hexp.size());
      //std::cout<<gr->GetYaxis()->GetBinCenter(hexp.size()-i)<<std::endl;
      //BAND->GetYaxis()->SetBinLabel(hexp.size()-1, legendEntry(channels[hexp.size()-1]).c_str());
      for(unsigned int j=0; j<hexp.size(); ++j){
	gr  ->GetYaxis()->SetBinLabel(hexp.size()-j, legendEntry(channels[j]).c_str());
      }
      gr->GetYaxis()->SetTickLength(0);
      gr->GetYaxis()->SetLabelFont(62);
      gr->GetYaxis()->SetTitleFont(62);
      gr->GetYaxis()->SetLabelSize(0.07);
      gr->GetYaxis()->SetTitle("");
      gr->GetYaxis()->SetLabelFont(62);
      gr->GetYaxis()->SetTitleOffset(1.05);
      gr->GetYaxis()->SetLabelSize(0.03);           
      gr->GetYaxis()->SetLabelOffset(-0.32);           

      BAND->GetYaxis()->SetLabelFont(62);
      BAND->GetYaxis()->SetTitleFont(62);
      BAND->GetYaxis()->SetLabelSize(0.07);
      BAND->GetYaxis()->SetTitle("");
      BAND->GetYaxis()->SetLabelFont(62);
      BAND->GetYaxis()->SetTitleOffset(1.05);
      BAND->GetYaxis()->SetLabelSize(0.03);           
      BAND->GetYaxis()->SetLabelOffset(-0.32);           
    }
    BAND->GetYaxis()->SetLabelSize(0.07);
    BAND->SetTitle("");
    gr  ->GetYaxis()->SetLabelSize(0.07);
    gr->SetTitle("");
    gr->SetLineStyle( 1.);
    gr->SetLineWidth( 2.); 
    //gr->SetLineColor(colorzxs.find(channels[i])->second);
    gr->SetLineColor(kBlack);
    gr->SetMarkerStyle(kFullCircle);
    gr->SetMarkerSize(MARKER_SIZE);
    //gr->SetMarkerColor(colors.find(channels[i])->second);
    gr->SetMarkerColor(kBlack);
    cout << "===> " << gr->GetErrorYhigh(0) << endl;
    
    //cout << "==> "<< BAND->GetYaxis()->GetMaximum() << endl;
    if(firstPlot) gr->Draw("AP");  
    if(firstPlot) {
      BAND->Draw("Fsame");  
      BEST->Draw("l");
      TLine *lLine = new TLine(minimum,1.0,maximum,1.0); lLine->SetLineWidth(3); lLine->SetLineColor(kBlue+2);
      lLine->Draw();
      SM->SetLineWidth(3);
      SM->SetLineColor(kGreen+3);
      if(std::string(type).find("mssm")==std::string::npos) SM->Draw("same");
    }
    gr->Draw(firstPlot ? "Psame" : "Psame");
    //gr->Draw(firstPlot ? "AL" : "Lsame");
    firstPlot=false;
  }
  ZERO->SetLineWidth(3);
  ZERO->SetLineColor(kBlue);
  ZERO->SetLineStyle(11);
  //ZERO->Draw("same");
  

  //TPaveText *pt = new TPaveText(2*(maximum+minimum)/3,hexp.size()-0.3,maximum,hexp.size()-0.02);
  TPaveText *pt = new TPaveText(0.76, 0.88, 1.0, 1.0, "NDC");
  if(std::string(type).find("mssm")!=std::string::npos) pt->AddText(TString::Format("m_{A} = %0.0f GeV" , mass));
  else pt->AddText(TString::Format("m_{H} = %0.0f GeV" , mass));
  pt->SetBorderSize(   0 );
  pt->SetFillStyle(    0 );
  pt->SetTextAlign(   12 );
  pt->SetTextSize ( 0.03 );
  pt->SetTextColor(    1 );
  pt->SetTextFont (   62 );
  pt->Draw("same");
  canv1->RedrawAxis();
  CMSPrelim(label, "", 0.15, 0.835);
  
  canv1->Print(std::string("BestFit").append(std::string(type).find("mssm")!=std::string::npos ? "_mssm.png" : "_sm.png").c_str());
  canv1->Print(std::string("BestFit").append(std::string(type).find("mssm")!=std::string::npos ? "_mssm.pdf" : "_sm.pdf").c_str());
  canv1->Print(std::string("BestFit").append(std::string(type).find("mssm")!=std::string::npos ? "_mssm.pdf" : "_sm.eps").c_str());
  return;
}
开发者ID:aashaqshah,项目名称:cmssw-1,代码行数:101,代码来源:compareBestFit.C

示例3: SPICE_step3_offset_gain_final_calfile

int SPICE_step3_offset_gain_final_calfile() {
  
  // Declaring arrays for the TGraphs
  vector <double> Bi207 = {481.6935,553.8372,565.8473,975.651,1047.795,1059.805};
  vector<float> experimental_Bi207;
   vector <float> c; 
  vector<float> d;
//double energy_152eu[7] = {121.782, 244.697, 344.279, 443.965, 778.904, 964.079, 1408.006}; //energies of the gamma-rays associated with Eu-152, retrieved from the Idaho National Laboratory Catalogue
//double charge_152eu[448];
vector <double> channel_centroids;

// Declaring fit parameter variables
double a, b;

ifstream fin("energycalonly_centroids.txt");
ofstream outfile("offset_gain_energycalonly.txt");
/* file contains calculated charges from the centroids and energy coefficients. After every six lines is a new core number. Also note that all of the DIV/0 errors were replaced with zeros in this file */
cout << fin <<endl;

int fSize = Bi207.size();
double inValue;
while (true) {
  channel_centroids.clear();
  for (int i=0; i<fSize; i++) {
      fin >> inValue;
      channel_centroids.push_back(inValue);      
  }
  
  if (fin.eof()) break;
  // Here will be plotting
    
  
  TGraph *gr = new TGraph(fSize, &channel_centroids[0], &Bi207[0]);
  gr->SetMarkerStyle(8); // makes points bigger
  gr->Draw("ap");
  
  TF1 *f1 = new TF1("f1", "pol1", 1000, 3000 );
  gr->Fit(f1, "RQ");
  
  a = f1->GetParameter(0);
  b = f1->GetParameter(1);
  c.push_back(a);
  d.push_back(b);
  //Writing parameters to text file
  outfile  << a << " " << b << endl;
   
}
//string datafile="spice_check.root";
string calfile="SPICE_blank_calfile.txt";
//string path="singles/SPICE_energy_";



//Check if cal exists
ifstream calin(calfile.c_str());
if(!calin.is_open())return 0;

//Check if data file exists
ofstream calout("SPICE_energycalonly.cal");
unsigned int fSegment=0;
string line;
//for (int i=0; i<fSegment; i++) {
while(getline(calin,line)){
  
	if(line.find("EngCoeff")<=1 && line.size()>1 && fSegment<120){
		stringstream parsestream;
		parsestream<<line;
		string first;
		parsestream>>first;
		string buf;
		buf.assign(first,7,2);
			
		calout<<"	EngCoeff: "<< " "<< c[fSegment]<< " "<< d[fSegment] <<endl;//fOffset[fSegment]<<" "<<fGain[fSegment]<<endl;
			
	}else{
		if(line.find("SPI00XN")<=1&&line.size()>1){
开发者ID:jsmallcombe,项目名称:james_library,代码行数:76,代码来源:SPICE_step3_offset_gain_final_calfile.C

示例4: Riemann


//.........这里部分代码省略.........
    //   double x = xP/p;
    //  double y = yP/p;
    double z = R2/p;

    cout << "x = " << x << " y = " << y << " z = " << z << " mG = " << Mg[0][2] << endl;
    
    TMatrix K(1,3);

    K[0][0] = (x-Mg[0][0]);
    K[0][1] = (y-Mg[0][1]);
    K[0][2] = (z-Mg[0][2]);
    
    
    TMatrix ntR = K;
    TMatrix tR = K.Transpose(K);

    TMatrix F = tR*ntR;
  

    for(int m = 0; m < 3; m++){
      for(int l = 0; l < 3; l++)
	cout << " " << F[m][l];
      cout << " is F"<<endl;
    }
    //    p = sqrt(p);
    p = 1;
    A += p*p*F;
    
  }

  TH1D* PLOTTER = new TH1D("", "", 1, -3, 3);
  PLOTTER->SetMaximum(3);
  PLOTTER->SetMinimum(-3);
  PLOTTER->Draw();
  //  g->SetMarkerSize(1);
  g->SetMarkerStyle(20);
  g->Draw();

  

  /*

  for (int i = 1; i< hFIT->GetXaxis()->GetNbins()+1; i++){
    double xbin = hFIT->GetXaxis()->GetBinCenter(i);

    for (int j = 1; j< hFIT->GetYaxis()->GetNbins()+1; j++){
      double ybin = hFIT->GetYaxis()->GetBinCenter(j);
      double R2 = ybin*ybin + xbin*xbin;
      double R = sqrt(R2);
      double p = (1+R2);

      if (R < 2.5 || R > 3.3 ) continue;

      double cosPhi = xbin/R;
      double sinPhi = ybin/R;
      double x = R*R*cosPhi*cosPhi/p;
      double y = R*R*sinPhi*sinPhi/p;
      double z = R2/p;

      M[0][0] += p*x*hFIT->GetBinContent(i, j);
      M[0][1] += p*y*hFIT->GetBinContent(i, j);
      M[0][2] += p*z*hFIT->GetBinContent(i, j);
      
      Mg[0][0] += p*p*x*hFIT->GetBinContent(i, j);
      Mg[0][1] += p*p*y*hFIT->GetBinContent(i, j);
      Mg[0][2] += p*p*z*hFIT->GetBinContent(i, j);
开发者ID:GiacomoSguazzoni,项目名称:MaterialBudgetStudies,代码行数:67,代码来源:Riemann.C

示例5: 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

示例6: drawGraphEnv

//Draw an error envelop from a TGraphAsymmErrors
void drawGraphEnv(TGraphAsymmErrors* g, float scale = 1, bool doAxis = false,
                  int linestyle = 1, int linewidth = 2, int linecolor = 4,
                  bool fill = false,
                  TH1** ppGl = 0, TH1** ppGh = 0){
  //                  const char* opth = "", const char* optl = ""){
  char buffer[256];
  int n = g->GetN();
  double* x = new double[n+2];
  double* yh = new double[n+2];
  double* yl = new double[n+2];

  for(int i = 0; i < n; ++i){
    x[i+1]  = g->GetX()[i];
    yh[i+1] = g->GetY()[i] + g->GetEYhigh()[i] * scale;
    yl[i+1] = g->GetY()[i] - g->GetEYlow()[i] * scale;
  }

  x[0] = g->GetX()[0] - g->GetEXlow()[0];
  yl[0] = yl[1] - (yl[2]-yl[1])/(x[2]-x[1])*g->GetEXlow()[0];
  yh[0] = yh[1] - (yh[2]-yh[1])/(x[2]-x[1])*g->GetEXlow()[0];

  x[n+1] = g->GetX()[n-1] + g->GetEXhigh()[n-1];
  yl[n+1] = yl[n] + (yl[n]-yl[n-1])/(x[n]-x[n-1])*g->GetEXhigh()[n-1];
  yh[n+1] = yh[n] + (yh[n]-yh[n-1])/(x[n]-x[n-1])*g->GetEXhigh()[n-1];

  TGraph* gl = new TGraph(n+2, x, yl);
  gl->SetTitle(g->GetTitle());
  TGraph* gh = new TGraph(n+2, x, yh);
  gh->SetTitle(g->GetTitle());
  const char* opt = "l,same";
  
  sprintf(buffer, "%s_eh", g->GetName());
  gh->SetName(buffer);
  
  sprintf(buffer, "%s_el", g->GetName());
  gl->SetName(buffer);

  if(doAxis){
    g->Draw("AP");
    TH1* h = g->GetHistogram();
    gPad->Clear();
    h->Draw();
  }

  if(fill){
    gl->SetFillStyle(linestyle);
    gl->SetFillColor(linecolor);
    gl->SetLineColor(linecolor);
  
    gh->SetFillStyle(linestyle);
    gh->SetFillColor(linecolor);
    gh->SetLineColor(linecolor);
  } else{
    gl->SetLineStyle(linestyle);
    gl->SetLineWidth(linewidth);
    gl->SetLineColor(linecolor);
    
    gh->SetLineStyle(linestyle);
    gh->SetLineWidth(linewidth);
    gh->SetLineColor(linecolor);
  }
  
  gh->Draw(opt);
  gl->Draw(opt);

  if(ppGh) *ppGh = gh;
  if(ppGl) *ppGl = gl;
}
开发者ID:ferriff,项目名称:usercode,代码行数:69,代码来源:drawGraphEnv.C

示例7: kirk_dune


//.........这里部分代码省略.........
  h2->GetYaxis()->SetRangeUser(1, 1e4);
  gPad->SetLogy();
  gPad->Print("components_pid_rhc.pdf");
  gPad->Print("components_pid_rhc.C");

  new TCanvas;
  TH1* h = DataMCComparisonComponents(mockNuePID, &predNuePID, calc);
  h->SetTitle("#nu_{e} FHC 3.5yrs #times 40kt");
  CenterTitles(h);
  Legend();
  h->GetYaxis()->SetRangeUser(0, 600);
  gPad->Print("components_nue_pid.pdf");
  gPad->Print("components_nue_pid.C");

  new TCanvas;
  TH1* hd = DataMCComparisonComponents(mockNue2d, &predNue2d, calc);
  hd->SetTitle("#nu_{e} FHC 3.5yrs #times 40kt");
  CenterTitles(h);
  Legend();
  h->GetYaxis()->SetRangeUser(0, 600);
  gPad->Print("components_nue_pid_2d.pdf");
  gPad->Print("components_nue_pid_2d.C");

  new TCanvas;
  TH1* hr = DataMCComparisonComponents(mockNuePIDRHC, &predNuePIDRHC, calc);
  h->SetTitle("#nu_{e} RHC 3.5yrs #times 40kt");
  CenterTitles(h);
  Legend();
  h->GetYaxis()->SetRangeUser(0, 600);
  gPad->Print("components_nue_pid_rhc.pdf");
  gPad->Print("components_nue_pid_rhc.C");

  new TCanvas;
  surf.DrawContour(Gaussian90Percent2D(surf), kSolid, 4);
  //  surfRHC.DrawContour(Gaussian90Percent2D(surfRHC), kSolid, kGreen+2);
  surf2d.DrawContour(Gaussian90Percent2D(surf2d), kSolid, 1);
  surf2dcheck.DrawContour(Gaussian90Percent2D(surf2d), kSolid, 1); // if there are 2 solid black lines there is a problem
  surf2dsysts.DrawContour(Gaussian90Percent2D(surf2dsysts), kSolid, kGreen+2);
  surf2dsystsall.DrawContour(Gaussian90Percent2D(surf2dsystsall), kSolid, 2);
  surf.DrawBestFit(kRed);
  surfAll.DrawContour(Gaussian90Percent2D(surfAll), 1, kMagenta);
  gPad->Print("cont.pdf");

  new TCanvas;
  surfNue.DrawContour(Gaussian90Percent2D(surfNue), kSolid, 4);
  surfNue2d.DrawContour(Gaussian90Percent2D(surfNue2d), kSolid, 1);
  surfNue2dsysts.DrawContour(Gaussian90Percent2D(surfNue2dsysts), kSolid, kGreen+2);
  surfNue2dsystsall.DrawContour(Gaussian90Percent2D(surfNue2dsystsall), kSolid, 2);
  //  surfNue2dsystsall2.DrawContour(Gaussian90Percent2D(surfNue2dsystsall2), kSolid, kMagenta); // just a check that a 50% NC syst is same as a 5%
  surfNueAll.DrawContour(Gaussian90Percent2D(surfNueAll), kSolid, kMagenta);
  surfNue.DrawBestFit(kRed);
  gPad->Print("cont_nue.pdf");

  Spectrum testnom = preddunenumu.Predict(calc);
  Spectrum scaleshifted = preddunenumu.PredictSyst(calc,scaleshift);
  Spectrum resshifted = preddunenumu.PredictSyst(calc,resshift);

  new TCanvas;

  TH1* htestnom = testnom.ToTH1(pot);
  TH1* hscaleshifted = scaleshifted.ToTH1(pot);
  TH1* hresshifted = resshifted.ToTH1(pot);

  htestnom->SetLineWidth(2);
  hscaleshifted->SetLineWidth(2);
  hresshifted->SetLineWidth(2);
开发者ID:DUNE,项目名称:lblpwgtools,代码行数:67,代码来源:kirk_dune.C

示例8: proj_npe_7


//.........这里部分代码省略.........
   2371.061,
   2594.067,
   2630.891,
   2704.654,
   2727.792,
   2773.388,
   2784.73,
   2845.592,
   2924.958,
   3198.695};
   Double_t _fy8[40] = {
   2.75,
   2.65,
   2.65,
   2.7,
   2.35,
   2.45,
   140.25,
   2.65,
   2.15,
   2.55,
   2.35,
   2.45,
   2.3,
   2.5,
   2.65,
   4.05,
   2.55,
   2.5,
   2.35,
   2.25,
   2.6,
   2.7,
   2.7,
   2.6,
   2.4,
   2.35,
   2.8,
   2.55,
   2.35,
   2.8,
   2.4,
   2.35,
   2.6,
   2.6,
   2.45,
   2.45,
   2.65,
   2.55,
   2.55,
   2.65};
   TGraph *graph = new TGraph(40,_fx8,_fy8);
   graph->SetName("");
   graph->SetTitle("npe values of flashes in event: 7");
   graph->SetFillColor(1);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#0000ff");
   graph->SetMarkerColor(ci);
   graph->SetMarkerStyle(20);
   
   TH1F *Graph_Graph8 = new TH1F("Graph_Graph8","npe values of flashes in event: 7",100,-2006.917,3671.932);
   Graph_Graph8->SetMinimum(0);
   Graph_Graph8->SetMaximum(154.06);
   Graph_Graph8->SetDirectory(0);
   Graph_Graph8->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph8->SetLineColor(ci);
   Graph_Graph8->GetXaxis()->SetTitle("flash_t");
   Graph_Graph8->GetXaxis()->SetLabelFont(42);
   Graph_Graph8->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph8->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph8->GetXaxis()->SetTitleFont(42);
   Graph_Graph8->GetYaxis()->SetTitle("flash_npe");
   Graph_Graph8->GetYaxis()->SetLabelFont(42);
   Graph_Graph8->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph8->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph8->GetYaxis()->SetTitleFont(42);
   Graph_Graph8->GetZaxis()->SetLabelFont(42);
   Graph_Graph8->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph8->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph8->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph8);
   
   graph->Draw("ap");
   
   TPaveText *pt = new TPaveText(0.1823077,0.9368947,0.8176923,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   TText *AText = pt->AddText("npe values of flashes in event: 7");
   pt->Draw();
   c->Modified();
   c->cd();
   c->SetSelected(c);
}
开发者ID:nikihowe,项目名称:flash,代码行数:101,代码来源:proj_npe_7.C

示例9: Neutrals

void Neutrals (/*TH1 *h1*/)//const char *part="e")//,int nevent = 1000)
{
  cout << "TEST VII" << endl; 
  char infile[100];
  int pz[9] = {1,2,4,8,12,16,32,40,50};
  double x[9];
  double means[9] = {0};
  double y[9];
  double mval = 0;
  int lastbincont = 0;
  bool lastbin = false;
  int var = 11;
  double intnum[1000]  = {0};
  double varnum[1000] = {0};
  char *part[] = {"gamma","neutron","anti_neutron"};
  int i = 0;
  int w =4;
  //TCanvas *c3 = new TCanvas("TresGraphitos","stupid graph",1);
  // TH1F *h4 = new TH1F("histo","histo",1000,0,.5);
  //TH2F *h3 = new TH2F("HistoGraph","HistoGraph",1000,0,.55,1000,0,1.2);
  // TMarker *grmark = new TMarker();
  //	  TCanvas *c19 = new TCanvas();
  // h3->Draw();
  for (int q=0; q<3; q++) 
  {
    for (int w=0; w<9;w++)
    {
      cout << "TEST VI" << endl;
      char ffile[100];
      sprintf(ffile,"/phenix/u/jpinkenburg/sPHENIX/analysis/AntiSigma/macros/HistoBaseFiles/%s_ThinBins.root", part[q]);
      TFile *f = TFile::Open(ffile);
      char hname[100];
      sprintf(hname,"%s%dd",part[q],pz[w]);
      TH1F *h1 = (TH1F *)f->Get(hname);
      var = 11;
      i = 0;
      while (var <= 8001)
      {

	if (i<1000)
	{
	  varnum[i] = .005*(i);
	  intnum[i] = (h1->Integral(var-10,var))/10000.;//(h1->Integral());
	  i++;
	}
	var+=10;
      }
      // varnum[0] = 0;
      // intnum[0] = 0;
      char fname [100];
      sprintf(fname, "Gamma_Neutron_Hijing_Energy_Graphs.root");
      TFile *fout = TFile::Open(fname,"UPDATE");
      // h1->Write();
      //fout->Write();
      f->Close();
      //char hname[100];
      //sprintf(hname,"%s%dGeV",part[q],pz[w]);
      // cout << h1->Integral() << " "  <<  hname << " " << pz[i] << endl;
      //TH2 *h2 = new TH2F("hname","hname",1,0,5,1,0,1.2);
      gStyle->SetOptStat(0);

	  
      TMarker *mean = new TMarker();
      mean->SetMarkerStyle(20);
      mean->SetMarkerColor(3);
      char canvname[100];
      sprintf(canvname,"%s%d",part[q],pz[w]);
      //TCanvas *c3 = new TCanvas(canvname,"stupid graph",1);
      //double dtot[9] = {0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9}; 
      cout << "TEST V" << endl;
      TGraph *gr = new TGraph((i-2),varnum,intnum);
      char gtitle[100];
      sprintf(gtitle,"%s%dGeV;ConeSize;Percentage of Energy Deposited",part[q],pz[w]);
      char gname[100];
      sprintf(gname,"%s%dGeV",part[q],pz[w]);
      cout << intnum[50] << " " << varnum[50] << endl;
      gr->SetTitle(gtitle);
      gr->SetName(gname);
      gr->SetMarkerStyle(20);
      if (part[q] == "anti_neutron")
      {
	gr->SetMarkerColor(4);
      }
      else if (part[q] == "neutron")
      {
	gr->SetMarkerColor(2);
      }
      else if (part[q] == "gamma")
      {
	gr->SetMarkerColor(3);
      }
      else 
      {
	cout << "idiot" << endl;
      }
//	  gr->SetMaximum(1.2);
      //h2->Draw();
      //gr->Draw("A*");
      gr->Draw("ALP");
      //c3->DrawFrame(0,0,0.5,1.2);
//.........这里部分代码省略.........
开发者ID:kurthill,项目名称:analysis,代码行数:101,代码来源:GammaNeutronEnergyHijing.C


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