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


C++ TLine::DrawLine方法代码示例

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


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

示例1: DrawFitValue

void DrawFitValue( TH2* frame, Double_t mean, Double_t err )                     
{
   Int_t DarkColor  = TColor::GetColor( "#115000" );
   Int_t LightColor = TColor::GetColor( "#bdff66" );
  
   Double_t xmin = mean - err;
   Double_t xmax = mean + err;
   Double_t ymin = frame->GetYaxis()->GetXmin();
   Double_t ymax = frame->GetYaxis()->GetXmax();
   
   Double_t x[5] = { xmin, xmin, xmax, xmax, xmin };
   Double_t y[5] = { ymin, ymax, ymax, ymin, ymin };
   TGraph *box = new TGraph( 5, x, y );
   box->SetLineColor( DarkColor );
   box->SetFillColor( LightColor );
   box->Draw("F");                          
      
   TLine* louter = new TLine;
   TLine* linner = new TLine;
   louter->SetLineWidth( 1 );
   louter->SetLineColor( DarkColor );
   linner->SetLineWidth( 1 );
   linner->SetLineStyle( 3 );
   linner->SetLineColor( DarkColor );
     
   louter->DrawLine( xmin, ymin, xmin, ymax );
   louter->DrawLine( xmax, ymin, xmax, ymax );
   linner->DrawLine( mean, ymin, mean, ymax );
}
开发者ID:libov,项目名称:zeus,代码行数:29,代码来源:AverageMW.C

示例2: table

void table(Float_t x1, Float_t x2, Float_t yrange, TText *t, 
   const char **symbol, Bool_t octal)
{
   Int_t i;
   Int_t n = 0;
   for (i=0;i<1000;i++) {
      if (!strcmp(symbol[i],"END")) break;
      n++;
   }
   Float_t y1  = 2.5;
   Float_t y2  = yrange - 0.5;
   Float_t dx  = (x2-x1)/5;
   Float_t dy  = (y2 - 1 -y1)/(n+1);
   Float_t y   = y2 - 1 - 0.7*dy;
   Float_t xc0 = x1  + 0.5*dx;
   Float_t xc1 = xc0 + dx;
   Float_t xc2 = xc1 + dx;
   Float_t xc3 = xc2 + dx;
   Float_t xc4 = xc3 + dx;
   TLine *line = new TLine();
   line->DrawLine(x1,y1,x1,y2);
   line->DrawLine(x1,y1,x2,y1);
   line->DrawLine(x1,y2,x2,y2);
   line->DrawLine(x2,y1,x2,y2);
   line->DrawLine(x1,y2-1,x2,y2-1);
   line->DrawLine(x1+  dx,y1,x1+  dx,y2);
   line->DrawLine(x1+2*dx,y1,x1+2*dx,y2);
   line->DrawLine(x1+3*dx,y1,x1+3*dx,y2);
   line->DrawLine(x1+4*dx,y1,x1+4*dx,y2);
   TText *tit = new TText(0,0,"a");
   tit->SetTextSize(0.015);
   tit->SetTextFont(72);
   tit->SetTextAlign(22);
   tit->DrawText(xc0,y2-0.6,"Input");
   tit->DrawText(xc1,y2-0.6,"Roman");
   tit->DrawText(xc2,y2-0.6,"Greek");
   tit->DrawText(xc3,y2-0.6,"Special");
   tit->DrawText(xc4,y2-0.6,"Zapf");
   char text[12];
   for (i=0;i<n;i++) {
      if (octal) {
         unsigned char value = *symbol[i];
         sprintf(text,"@\\ %3o",value);
      } else {
         strcpy(text,symbol[i]);
      }
      t->DrawText(xc0,y,text);
      sprintf(text,"%s",symbol[i]);
      t->DrawText(xc1,y,text);
      sprintf(text,"`%s",symbol[i]);
      t->DrawText(xc2,y,text);
      sprintf(text,"'%s",symbol[i]);
      t->DrawText(xc3,y,text);
      sprintf(text,"~%s",symbol[i]);
      t->DrawText(xc4,y,text);
      y -= dy;
   }
}
开发者ID:adevress,项目名称:root-1,代码行数:58,代码来源:pstable.C

示例3: DrawInsituCorr_vs_Eta

void DrawInsituCorr_vs_Eta(Str jetAlgo) {
  Nbins=sizeof(Ebins)/sizeof(double);
  myJES = new JetCalibrationTool(jetAlgo,_jesFile);

  TH1F *h = new TH1F("","",100,-4.8,4.8);
  h->SetXTitle("Jet #eta_{det}");
  h->SetYTitle("Residual correction for data only");
  h->SetMaximum(1.1); h->SetMinimum(0.85);

  h->Draw();
  TLine *l = new TLine(); 
  l->SetLineWidth(2); l->SetLineColor(kGray+2); l->SetLineStyle(4);
  l->DrawLine(-4.65,1,4.65,1);
  
  for (int i=0;i<Nbins;++i) {
    Graph *g = GetInsituGraph(Ebins[i]);
    FormatGraph(g,i); g->Draw("PL");
    double x=0.52, y=0.3-0.05*i;
    if (i>2) { x=0.74; y=0.3-0.05*(i-3); }
    DrawLabel(Form("p_{T} = %.0f GeV",Ebins[i]),x,y,i);
  }

  l->SetLineWidth(2);
  l->SetLineColor(kGray+2);
  l->SetLineStyle(1);

  tex->SetNDC(); tex->SetTextAlign(12);
  //tex->DrawLatex(0.18,0.975,myJES->AbsoluteJES_Description());
  tex->DrawLatex(0.18,0.9,GetJetDesc(jetAlgo));
}
开发者ID:affablelochan,项目名称:2013codev2,代码行数:30,代码来源:DrawJES.C

示例4: DrawInsituCorr_vs_Pt

void DrawInsituCorr_vs_Pt(Str jetAlgo) {
  myJES = new JetCalibrationTool(jetAlgo,_jesFile);
  TH1F *h = new TH1F("","",100,15,2500);
  h->SetXTitle("Jet p_{T}");
  h->SetYTitle("Residual correction for data only");
  h->SetMaximum(1.1); h->SetMinimum(0.85);
  h->Draw();
  TLine *l = new TLine(); 
  l->SetLineWidth(2); l->SetLineColor(kGray+2); l->SetLineStyle(4);
  l->DrawLine(16,1,2400,1);
  for (int i=0;i<6;++i) {
    double eta=4.0*i/5;
    Graph *g = GetInsituGraphVsPt(eta);
    FormatGraph(g,i); g->Draw("PL");
    double x=0.52, y=0.3-0.05*i;
    if (i>2) { x=0.74; y=0.3-0.05*(i-3); }
    DrawLabel(Form("#eta = %.1f",eta),x,y,i);
  }

  l->SetLineWidth(2);
  l->SetLineColor(kGray+2);
  l->SetLineStyle(1);

  tex->SetNDC(); tex->SetTextAlign(12);
  //tex->DrawLatex(0.18,0.975,myJES->AbsoluteJES_Description());
  tex->DrawLatex(0.18,0.9,GetJetDesc(jetAlgo));
}
开发者ID:affablelochan,项目名称:2013codev2,代码行数:27,代码来源:DrawJES.C

示例5: DrawJMS_vs_Eta

void DrawJMS_vs_Eta(Str jetAlgo) {
  double massEbins[] = {50, 100, 250, 500, 750, 1500};
  double massNbins = sizeof(massEbins)/sizeof(double);
  myJES = new JetCalibrationTool(jetAlgo,_jesFile);
  TH1F *h = new TH1F("","",100,-4.8,4.8);
  h->SetXTitle("Jet #eta_{det}"); h->SetYTitle("Jet mass response");
  h->SetMaximum(1.4); h->SetMinimum(0.6);
  h->Draw();
  
  TLine *l = new TLine(); 
  l->SetLineWidth(2); l->SetLineColor(kGray+2); l->SetLineStyle(4);
  l->DrawLine(-4.65,1,4.65,1);

  for (int i=0;i<massNbins;++i) {
    Graph *g = GetJMSGraph(massEbins[i]);
    FormatGraph(g,i);
    g->Draw("PL");
    double x=0.52, y=0.3-0.05*i;
    if (i>2) { x=0.74; y=0.3-0.05*(i-3); }
    DrawLabel(Form("E = %.0f GeV",massEbins[i]),x,y,i);
  }
  
  tex->SetNDC(); tex->SetTextAlign(12);
  tex->DrawLatex(0.18,0.975,myJES->AbsoluteJES_Description());
  tex->DrawLatex(0.18,0.9,jetAlgo);
}
开发者ID:affablelochan,项目名称:2013codev2,代码行数:26,代码来源:DrawJES.C

示例6: drawGrid

void drawGrid(float x1, float y1, float x2, float y2,
              int nxbins, int nybins, float yOffset = 0.){
  float step = (x2-x1) / nxbins;
  TLine* l = new TLine(0,0,0,0);
  for(float x = x1; x < x2; x += step){
    l->DrawLine(x, y1, x, y2);
  }
  l->DrawLine(x2, y1, x2, y2);

  step = (y2-y1) / nybins;

  for(float y = y1; y < y2; y += step){
    l->DrawLine(x1, y+yOffset, x2, y+yOffset);
  }
  if(yOffset<1.e-9) l->DrawLine(x1, y2, x2, y2);
}
开发者ID:Andrej-CMS,项目名称:cmssw,代码行数:16,代码来源:ecalGrid.C

示例7: drawcutline

void drawcutline(double cutval, double maximum)
{
  TLine *cut = new TLine();
  cut->SetLineWidth(3);
  cut->SetLineColor(28);
  cut->DrawLine(cutval,0.,cutval,maximum);
}
开发者ID:eschliec,项目名称:TopAnalysis,代码行数:7,代码来源:wjetsAsymmetrieEstimator.C

示例8: PlotBF

void HiggsPlot::PlotBF(int iDecay, double tBmH_max, double BF_max){
  if(iDecay<0 || iDecay>2) {cout<<"iDecay must be 0, 1 or 2"<<endl; return;}
  styles style; style.setPadsStyle(-1); style.setDefaultStyle();
  int nBins = 1000;
  TString hName, epsName = "public_html/Higgs_BF_TEMP_BaBar.eps", label, Llabel, Rlabel;
  TString yTitle[] = {"BF(B#rightarrow#tau#nu) (10^{-5})", "R(D)", "R(D*)"};
  TString TagDecay[] = {"BF", "R(D)", "R(D*)"};
  TCanvas can;
  TH1F *hBF[2];
  for(int his=0; his<1; his++) {
    hName = "hBF"; hName += his;
    hBF[his] = new TH1F(hName,"",nBins,0,tBmH_max);
  }
  double tBmH, BF[2];
  for(int bin=1; bin<=nBins; bin++){
    tBmH = hBF[0]->GetBinCenter(bin);
    Compute(tBmH,BF,iDecay);
    hBF[0]->SetBinContent(bin, BF[0]);
    hBF[0]->SetBinError(bin, BF[1]);
  }
  hBF[0]->SetFillColor(2); hBF[0]->SetLineColor(2);
  hName += "1";
  hBF[1] = static_cast<TH1F*>(hBF[0]->Clone(hName));
  for(int bin=1; bin<=nBins; bin++)hBF[1]->SetBinError(bin,0);
  hBF[1]->SetFillColor(0);hBF[1]->SetLineColor(1); hBF[1]->SetLineWidth(2);

  TBox box; box.SetLineColor(4);box.SetFillColor(4);
  TLine line; line.SetLineStyle(1); line.SetLineColor(4); line.SetLineWidth(3);
  if(BF_max>0) hBF[0]->SetMaximum(BF_max);
  hBF[0]->Draw("e3");
  box.SetFillStyle(3002); 
  box.DrawBox(0,Measurement[iDecay][0]-Measurement[iDecay][1],
	      tBmH_max,Measurement[iDecay][0]+Measurement[iDecay][1]);
  line.DrawLine(0,Measurement[iDecay][0],tBmH_max,Measurement[iDecay][0]);
  hBF[0]->Draw("e3 same");
  hBF[1]->Draw("c same");

  Compute(0,BF,iDecay);
  label = "#splitline{"; label += TagDecay[iDecay]; label += "_{SM} = ";
  if(iDecay==0){
    label+="(";label+=RoundNumber(BF[0],1); label+=" #pm ";
    label+=RoundNumber(BF[1],1); label+=")#times10^{-5}}{BF_{exp} = (";
    label+=RoundNumber(Measurement[iDecay][0],1); label+=" #pm ";
    label+=RoundNumber(Measurement[iDecay][1],1); label+=")#times10^{-5}}";
    Llabel = ""; Rlabel = label;
  } else {
    label+=RoundNumber(BF[0],3); label+=" #pm ";
    label+=RoundNumber(BF[1],3); label+="}{"; label += TagDecay[iDecay]; label += "_{exp} = ";
    label+=RoundNumber(Measurement[iDecay][0],3); label+=" #pm ";
    label+=RoundNumber(Measurement[iDecay][1],3); label+="}";
    Rlabel = ""; Llabel = label;
  }
  style.setTitles(hBF[0],"tan#beta/m_{H^{+}} (GeV^{-1})",yTitle[iDecay],Llabel,Rlabel);
  epsName.ReplaceAll("TEMP",DecayName[iDecay]);
  can.SaveAs(epsName);
  for(int his=0; his<2; his++) hBF[his]->Delete();
}
开发者ID:manuelfs,项目名称:babar_code,代码行数:57,代码来源:higgs_plots.cpp

示例9: SetupTowerDisplay

void SetupTowerDisplay(TH2F *hist)
{
  hist->SetStats(kFALSE);
  hist->SetXTitle("ieta");
  hist->SetYTitle("iphi");
  hist->GetXaxis()->CenterTitle();
  hist->GetYaxis()->CenterTitle();
  hist->GetXaxis()->SetNdivisions(65);
  hist->GetXaxis()->SetLabelColor(0);
  hist->GetXaxis()->SetTickLength(.78);
  hist->GetXaxis()->SetTitleOffset(0.95);
  hist->GetYaxis()->SetNdivisions(72);
  hist->GetYaxis()->SetLabelColor(0);
  hist->GetYaxis()->SetTitleOffset(0.85);
  TText *yLabel = new TText();
  TLine *pLine = new TLine();
  pLine->SetLineStyle(1);
  pLine->SetLineColor(1);
  pLine->SetLineWidth(1);
  yLabel->SetTextAlign(22);
  yLabel->SetTextSize(0.015);
  char phi_num[3];
  char eta_num[3];
  TText *xLabel = new TText();
  xLabel->SetTextSize(0.015);
  xLabel->SetTextAlign(22);
  for (Int_t i=1; i<73; ++i)
    {
      sprintf(phi_num,"%d",i);
      if(TMath::Abs(i%2)==1) {yLabel->DrawText(-33,0.5+i,phi_num);}
      else {yLabel->DrawText(-34.5,0.5+i,phi_num);}
      pLine->DrawLine(-32,i,33,i);
    }
  for (Int_t i=-32; i<33;++i)
    {
      sprintf(eta_num,"%d",i);
      if(TMath::Abs(i%2)==0) {xLabel->DrawText(0.5+i,-0.5,eta_num);}
      else {xLabel->DrawText(0.5+i,-2,eta_num);}
      pLine->DrawLine(i,1,i,72);
    }
}
开发者ID:Andrej-CMS,项目名称:cmssw,代码行数:41,代码来源:root_prefs.C

示例10: Draw2DHist

//========================================
void Draw2DHist(TH2F *h2D_Pt_Rap, Char_t *hltTag){

  gStyle->SetOptStat(0);
  gStyle->SetPadRightMargin(0.12);
  Char_t name[100];
  TCanvas *c2 = new TCanvas("c2a", "2D distribution", 600, 600);
  gPad->SetLogz();
  //  TH1F *hFrame = gPad->DrawFrame(
//   h2D_Pt_Rap->Draw("box");
  h2D_Pt_Rap->GetYaxis()->SetTitleOffset(1.6);
  h2D_Pt_Rap->SetAxisRange(0,30.,"y");
  h2D_Pt_Rap->SetMaximum(4000.);
  h2D_Pt_Rap->Draw("colz");
  h2D_Pt_Rap->SetXTitle("y");
  h2D_Pt_Rap->SetYTitle("p_{T} [GeV]");

  TLine *lineV = new TLine();
  lineV->SetLineColor(0); lineV->SetLineWidth(2);
  for(int iRap = 0; iRap < 2*onia::kNbRapBins+1; iRap++)
    lineV->DrawLine(onia::rapRange[iRap], 0., onia::rapRange[iRap], 30.);

  TLine *lineH = new TLine();
  lineH->SetLineColor(0); lineH->SetLineWidth(2);
  for(int iRap = 1; iRap < onia::kNbRapForPTBins+1; iRap++){
    for(int iPT = 1; iPT < onia::kNbPTBins[iRap]+1; iPT++){
      lineH->DrawLine(onia::rapForPTRange[iRap-1], onia::pTRange[iRap][iPT], onia::rapForPTRange[iRap], onia::pTRange[iRap][iPT]);
      lineH->DrawLine(-onia::rapForPTRange[iRap-1], onia::pTRange[iRap][iPT], -onia::rapForPTRange[iRap], onia::pTRange[iRap][iPT]);
    }
  }

//   TLatex *tex = new TLatex(-2.3, 27., hltTag);
//   tex->SetTextSize(0.045);
//   tex->Draw();

  // sprintf(name, "Figures/ptVsRap_%s.gif", hltTag);  c2->Print(name);
  // sprintf(name, "Figures/ptVsRap_%s.pdf", hltTag);  c2->Print(name);
  sprintf(name, "Figures/ptVsRap_Upsilons.gif");  c2->Print(name);
  sprintf(name, "Figures/ptVsRap_Upsilons.pdf");  c2->Print(name);
}
开发者ID:hwoehri,项目名称:UserCode,代码行数:40,代码来源:optimizeBinning.C

示例11: draw_diagonal_xchange

void draw_diagonal_xchange(int scantype, std::string scanx = "" ) {
  // Line marking the diagonal
  TLine *line;
  float verticaloffset=0.0;
  if(scantype==PlottingSetup::GMSB) verticaloffset=75.0;
  line = new TLine(50.+75.0, 50.0+verticaloffset, 1200., 1200.0-75.0+verticaloffset);
  line->SetLineStyle(7);
  line->SetLineWidth(4);
  //line->Draw("same"); // Do not draw: draw the other one instead
  
  // Add a dashed line to indicate where x changes
  float offset = 0.;
  if ( 0 == scanx.compare("0.5") ) { offset = 91/0.5; }
  else if ( 0 == scanx.compare("0.25") ) { offset = 91/0.25; }
  else if ( 0 == scanx.compare("0.75") ) { offset = 91/0.75; }
  else if ( scantype==PlottingSetup::GMSB) { offset = 0; };
  
  if ( offset>0. ) {
    line->DrawLine(50+offset, 50.0, 1175., 1175.0-offset);
  }else if ( scantype==PlottingSetup::GMSB ) {
    line->DrawLine(100, 100, 1175., 1175.0-offset);
 }
}
开发者ID:MarcoAndreaBuchmann,项目名称:CBAF,代码行数:23,代码来源:ExclusionPlot.C

示例12: TPTiming

void TPTiming ()
{
    TAxis * ax = TPMatchEmul2D->GetZaxis() ;
    ax->SetRangeUser(-1,6) ;

    TCanvas* canv = new TCanvas("canv", "canv") ;
    canv->SetLogz(0) ;
    gStyle->SetOptStat(10) ;
    int color[10]= {1,10,3,4,5,6,7,8,9,2} ;
    gStyle->SetPalette(7, color) ;
    TPMatchEmul2D->GetXaxis()->SetTitle("Phi index");
    TPMatchEmul2D->GetYaxis()->SetTitle("Eta index");
    TPMatchEmul2D->Draw("colz") ;

    TH2I * label = new TH2I("label", "",72, 1, 73, 38, -19, 19) ;
    label->SetMarkerSize(0.6);
    label->SetBit(kCanDelete);
    for (int x=3 ; x<73 ; x+=4) {
        for (int y=21; y<=37; y++) {
            int towernb = 4*(y-21)+1 ;
            label->SetBinContent(x-1, y, towernb) ; //EB+
            label->SetBinContent(x, 40-y, towernb) ; //EB-
        }
    }
    label->Draw("same text") ;

    TLatex txt;
    txt.SetTextSize(0.02);
    TLine line;
    line.SetLineColor(1) ;
    line.SetLineStyle(1) ;
    line.SetLineWidth(1) ;
    TAxis* xAxis = TPMatchEmul2D->GetXaxis();
    TAxis* yAxis = TPMatchEmul2D->GetYaxis();

    // draw SM borders and numbers
    float sm ;
    for (int i=0; i<36 ; i++ ) {
        if (i<18) {
            sm = 4*i+3 ;
            line.DrawLine(sm, 1, sm, 18) ;
            txt.SetTextAlign(32);
            txt.DrawText(sm-1+0.3, -17.7, Form("-%d",i+1));
        }
        else {
            sm = 4*(i-18)+3 ;
            line.DrawLine(sm, 0, sm, -17) ;
            txt.SetTextAlign(12);
            txt.DrawText(sm-2+0.3, 18.5, Form("+%d",i-17));
        }
    }
    line.DrawLine(1, 0, 73, 0) ;
    line.DrawLine(1, -17, 73, -17) ;
    line.DrawLine(1, 1, 73, 1) ;
    line.DrawLine(1, 18, 73, 18) ;

}
开发者ID:cms-ecal-L1TriggerTeam,项目名称:CMS-ECAL_TPGAnalysis,代码行数:57,代码来源:TPTiming.C

示例13: DrawMeasurement

void DrawMeasurement( TH1 *h, Int_t nbin, Double_t val, Double_t err )
{
   TAxis *axis   = h->GetYaxis();
   
   Double_t dy;
   Double_t x1,y1,x2,y2, ymin;
   
   Int_t i = nbin;
   
   ymin = axis->GetBinCenter(i)+1;
   dy   = axis->GetBinWidth(i);
   x1   = val - err;
   y1   = ymin - 0.05*dy;
   x2   = val + err;
   y2   = ymin + 0.05*dy;
  
   TLine* line = new TLine;
   TLine* lbar = new TLine;
   TLine* rbar = new TLine;
   TMarker* m2 = new TMarker( val, ymin, 20 );
   Int_t color = 1;
   line->SetLineColor( color );
   line->SetLineWidth( 2 );
   lbar->SetLineColor( color );
   lbar->SetLineWidth( 2 );
   rbar->SetLineColor( color );
   rbar->SetLineWidth( 2 );
   m2->SetMarkerColor( color );
   m2->SetMarkerSize( 1.2 );
   m2->SetMarkerStyle( 21 );
   
   line->DrawLine( x1, ymin, x2, ymin );
   lbar->DrawLine( x1, y1, x1, y2 );
   rbar->DrawLine( x2, y1, x2, y2 );
   m2->Draw();
}
开发者ID:libov,项目名称:zeus,代码行数:36,代码来源:AverageMW.C

示例14: DrawHijing2GeV

void DrawHijing2GeV()
{
  TCanvas *c1 = new TCanvas();
TFile *fin = TFile::Open("Gamma_Neutron_Hijing_Energy_Graphs.root");
gROOT->cd();
TH1 *h1lim = new TH1F("h1lim","",1,0,0.1);
TH1 *hjbkg = (TH1 *) fin->Get("hjbkg")->Clone();
TGraph *anti_neutron2GeV = (TGraph *) fin->Get("anti_neutron2GeV")->Clone();
TGraph *neutron2GeV = (TGraph *) fin->Get("neutron2GeV")->Clone();
h1lim->SetStats(0);
h1lim->SetMaximum(0.3);
h1lim->SetTitle("2 GeV Hadronic Showers with HIJING background");
h1lim->GetYaxis()->SetTitle("Deposited Energey [GeV]");
h1lim->GetYaxis()->SetTitleOffset(1.2);
h1lim->GetXaxis()->SetTitle("cone size (#sqrt{#Delta#Phi^{2}+#Delta#Theta^{2}})");
h1lim->GetXaxis()->SetTitleOffset(1.2);
h1lim->Draw();
hjbkg->SetStats(0);
hjbkg->SetLineColor(6);
hjbkg->SetMaximum(5.5);
hjbkg->SetLineWidth(2);
hjbkg->Draw("same");
anti_neutron2GeV->SetLineColor(4);
anti_neutron2GeV->SetLineWidth(2);
anti_neutron2GeV->Draw("same");
neutron2GeV->SetLineColor(2);
neutron2GeV->SetLineWidth(2);
neutron2GeV->Draw("same");
TLine *tl = new TLine();
tl->SetLineStyle(2);
tl->DrawLine(0.024,0,0.024,0.3);
TLegend *legrda = new TLegend(0.67,0.34,0.87,0.54,NULL,"brNDC");
  legrda->SetLineColor(1);
  legrda->SetLineStyle(1);
  legrda->SetLineWidth(1);
  legrda->SetFillColor(10);
  legrda->SetFillStyle(1001);
  legrda->SetBorderSize(0);
//  legrda->SetTextSize(labelsize);
  legrda->AddEntry(hjbkg,"HIJING bkg"); 
  legrda->AddEntry(anti_neutron2GeV,"2 GeV Anti Neutron","l"); 
  legrda->AddEntry(neutron2GeV,"2 GeV Neutron", "l"); 
  legrda->AddEntry(tl,"EMCal tower size","l"); 
  legrda->Draw();
 
fin->Close();
c1->Print("Hijing2GeV.png");
}
开发者ID:kurthill,项目名称:analysis,代码行数:48,代码来源:GammaNeutronEnergyHijing.C

示例15: draw_graphs

void draw_graphs(void)
{
	const char title[4][20] = {"Na_mean;um", "Na_sigma;um", "Co_mean;um", "Co_sigma;um"};
	const double tgt[4] = {1.787, 0.394, 2.082, 0.473};
	const double mc[4][4] = {{2.008, 1.985, 1.974, 1.933}, {0.319, 0.326, 0.330, 0.336}, 
		{2.233, 2.211, 2.185, 2.149}, {0.377, 0.385, 0.394, 0.405}};
	const double dl[4] = {0, 50, 100, 200};
	const double mm[4][2] = {{1.7, 2.1}, {0.3, 0.4}, {2.0, 2.3}, {0.35, 0.5}};
	TGraph *gr;
	TLine *ln;
	TH1D *h;
	TLegend *lg;
	int i;
	
	TCanvas *cv = new TCanvas;
	cv->Divide(2,2);
	gr = new TGraph;
	ln = new TLine;
	gr->SetMarkerStyle(kFullCircle);
	gr->SetMarkerSize(1.5);
	gr->SetMarkerColor(kBlue);
	ln->SetLineWidth(4);
	ln->SetLineColor(kRed);
	lg = new TLegend(0.65, 0.65, 0.95, 0.85);
	lg->AddEntry(ln, "Exp.", "L");
	lg->AddEntry(gr, "MC", "P");
	for (i=0; i<4; i++) {
		cv->cd(i+1);
		
		h = new TH1D(title[i], title[i], 100, 0, 200);
		h->SetMinimum(mm[i][0]);
		h->SetMaximum(mm[i][1]);
		h->DrawCopy();
		gr->DrawGraph(4, dl, mc[i], "P");
		ln->DrawLine(0, tgt[i], 200, tgt[i]);
		lg->Draw();
		delete h;
	}
}
开发者ID:lab305itep,项目名称:digi,代码行数:39,代码来源:draw_22Na_v2.C


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