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


C++ TPaveLabel::SetBorderSize方法代码示例

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


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

示例1: KolmogorovTest

////////////////////////////////////////////////////////////
//
// This function performs a compatibility test between two
// histogram based on the Kolmogorov-Smirnof algorithm. It
// also prints the value in a TPaveLabel at the upper-right
// corner.
// The return value contains the result of the test
//
double KolmogorovTest(TH1 *h1, TH1 *h2){

  double mya_array[1300], myb_array[1300];
  vector<double> mya;
  vector<double> myb;
  
  
  for (int i=0; i<h1->GetNbinsX(); i++){
    mya.push_back(h1->GetBinContent(i+1));
    myb.push_back(h2->GetBinContent(i+1));
  }

  sort(mya.begin(),mya.end());
  sort(myb.begin(),myb.end()); 
  copy(mya.begin(),mya.end(),mya_array);
  copy(myb.begin(),myb.end(),myb_array);
  
  const int nbinsa = h1->GetNbinsX();
  const int nbinsb = h2->GetNbinsX();
   
  double kstest = TMath::KolmogorovTest(nbinsa, mya_array,
					nbinsb, myb_array,
					"UOX");
  if (DEBUGP) cout << "   + KS value = " << kstest << endl;

  // Create text with the value
  TString legend = Form("KS=%4.2f", kstest);

  // Create a pave text to put the value inside

  TPaveLabel* pl = new TPaveLabel(0.79,0.91,0.93,0.96, legend.Data(), "NDC");

  // Tune style
  //pl->SetTextSize(0.04);
  pl->SetLineColor(41);
  pl->SetLineWidth(1);
  pl->SetLineStyle(1);
  pl->SetFillColor(41);
  pl->SetBorderSize(3);

  if (kstest < 0.7)
    pl->SetTextColor(kRed);

  pl->Draw();
  
  return kstest;
}
开发者ID:cardinia,项目名称:cmssw,代码行数:55,代码来源:new_PlotHelpers.C

示例2: drawValueBox

void drawValueBox(double x1, double x2, double x3, int colour)
{

  char optionfile[60];
  std::vector<double> options;
  
  double delta1(0.), delta2(0.), delta3(0.), delta4(0.);
  double tsize(0.7);

  sprintf(optionfile,"./config/drawValueBox.dat");
  
  readData(optionfile,options);
  delta1 = options[0];
  delta2 = options[1];
  delta3 = options[2];
  delta4 = options[3];
  tsize  = options[4];
  
  double xmin = x1 + delta1;
  double xmax = x1 + delta2;
  double ymin = x2 + delta3;
  double ymax = x2 + delta4;

  if ( x1 < 0 && x2 > 0) {
    xmin = x1 - delta1;
    xmax = x1 - delta2;
  } 
  else if ( x1 < 0 && x2 < 0) {
    xmin = x1 - delta1;
    xmax = x1 - delta2;
    ymin = x2 - delta3;
    ymax = x2 - delta4;
  }
  else if ( x1 > 0 && x2 < 0) {
    ymin = x2 - delta3;
    ymax = x2 - delta4;
  }
  else if ( x1 == 0.0 ) {
    xmin = xmin - delta1;
    xmax = xmax ;
  }
  else if ( x2 == 0.0 ) {
    ymin = ymin - delta3;
    ymax = ymax ;
  }
  else {}


  char label[10];
  sprintf(label,"%.1f",float(x3));

  TPaveLabel *box = new TPaveLabel(xmin,ymin,xmax,ymax,label);
  box->SetBorderSize(0);
  box->SetTextFont(42);
  box->SetTextSize(tsize);
  box->SetTextAlign(22);
  box->SetTextColor(colour);
  if (colour == 1) box->SetFillStyle(4000);
  else {
    box->SetFillColor(10);
    box->SetTextColor(colour);
    box->SetBorderSize(1);
  }
  box->Draw("same");
  
  TLine * ln = new TLine(x1,x2,xmin,ymin);
  ln->SetLineWidth(1);
  ln->SetLineStyle(1);
  ln->SetLineColor(14);
  ln->Draw("same");
  
}
开发者ID:andres0sorio,项目名称:CMSWork,代码行数:72,代码来源:Utilities.C

示例3: plotFinalEnergy

void plotFinalEnergy()  {

    
    gStyle->SetStatH(0.3);
    gStyle->SetStatY(0.88);
    gStyle->SetStatW(0.3);
    char canTitle[180];
    sprintf(canTitle,"Energy at Terminal Interaction (10000 tries)"); 
    TCanvas *canFinalEnergy = new TCanvas("canFinalEnergy","Final Energy",800,800);
    TPaveLabel *pl = new TPaveLabel(0.1,0.96,0.9,0.99,canTitle,"br NDC");
    pl->SetBorderSize(0);
    pl->SetFillColor(0);
    pl->SetFillStyle(0);
    pl->Draw();
    TPad *subCanFinalEnergy = new TPad("subCanFinalEnergy","",0,0,1,0.95);
    subCanFinalEnergy->Draw();
    subCanFinalEnergy->cd();
    subCanFinalEnergy->Divide(2,4);
    subCanFinalEnergy->Update();
    


//    gStyle->SetOptStat(0);
    char fileName[80];   
    char histTitle[80];

    char theEnergies[4][5]={"1e9","1e10","1e11","1e12"};

    int theColours[2][3]={{50,42,46},{40,30,38}};
    
    for(int isATau=0;isATau<=1;isATau++) {
	for(int i=0;i<4;i++) {		 
	    sprintf(fileName,
		    "newest%sFile%sIce.root",getParticleNameCaps(isATau),theEnergies[i]);
	    sprintf(histTitle,"%s -- %s GeV",getParticleNameCaps(isATau),theEnergies[i]);
	    TFile *fp = new TFile(fileName);
	    TH1F *histEnergy = 
		new TH1F("histEnergy",histTitle,100,7.5,12.5);
	    TH1F *histEnergy2 = 
		new TH1F("histEnergy2","Last Energy",100,7.5,12.5);
	    TH1F *histEnergy3 = 
		new TH1F("histEnergy3","Last Energy",100,7.5,12.5);

	    TTree *theTree = (TTree*) fp->Get("theTree");
	    cout << theTree->GetEntries() << endl;
	    subCanFinalEnergy->cd((2*i)+isATau+1);
	    gPad->SetTopMargin(0.12);
//	gPad->SetBottomMargin(0.2);
	    histEnergy->SetLineWidth(3);
	    histEnergy->SetLineColor(theColours[isATau][0]);
	    histEnergy2->SetLineWidth(3);
	    histEnergy2->SetLineColor(theColours[isATau][1]);
	    histEnergy3->SetLineWidth(3);
	    histEnergy3->SetLineColor(theColours[isATau][2]);
	    theTree->Draw("log10(stepIntEnergy)>>histEnergy","stepIntType>=4");
//	histEnergy->GetXaxis()->SetTitle("IntType (#mus)");
// 	histEnergy->GetXaxis()->SetBinLabel(2,"Bremsstrahlung");
// 	histEnergy->GetXaxis()->SetBinLabel(3,"Pair Production");
// 	histEnergy->GetXaxis()->SetBinLabel(4,"Photonuclear");
// 	histEnergy->GetXaxis()->SetLabelSize(0.09);
// 	histEnergy->GetXaxis()->SetLabelOffset(0.02);
 	    theTree->Draw("log10(stepIntEnergy)>>histEnergy2","stepIntType==4");
 	    theTree->Draw("log10(stepIntEnergy)>>histEnergy3","stepIntType==5");

	    histEnergy->DrawCopy();
	    if(histEnergy2->GetEntries())
		histEnergy2->DrawCopy("same");
	    if(histEnergy3->GetEntries())
		histEnergy3->DrawCopy("same");
	    
	    if(histEnergy->GetEntries())
		gPad->SetLogy();

	    if(i==0) {
		TLegend *leg = new TLegend(0.7,0.2,0.9,0.6);
		leg->SetFillColor(0);
		leg->SetFillStyle(0);
		leg->SetBorderSize(0);
		leg->AddEntry(histEnergy2,"Decay","l");
		leg->AddEntry(histEnergy3,"Weak (CC)","l");
		leg->AddEntry(histEnergy,"Either","l");
		leg->Draw("same");
	    }
	}
    } 
    for(int i=0;i<8;i++) {
//	cout << "Doing title "<< i+1 << endl;
	subCanFinalEnergy->cd(i+1);
	sortOutTitle(0.07);
    }
//    gStyle->SetOptStat(1110);

}
开发者ID:nichol77,项目名称:monte,代码行数:93,代码来源:plotFinalEnergy.C

示例4: geugd_riordan

void geugd_riordan() {
	gROOT->SetStyle("HALLA");
	TCanvas *cn = new TCanvas("cn");
	cn->Draw();
	cn->UseCurrentStyle();
	TH1F *frm = new TH1F("frm","",100,0.,12.);
	frm->GetXaxis()->SetTitle("Q^{2}  [GeV^{2}]");
	frm->GetXaxis()->CenterTitle();
	frm->GetYaxis()->SetTitle("G_{E}^{u}/G_{D}");
	frm->GetYaxis()->CenterTitle();
	frm->SetMinimum(.40);
	frm->SetMaximum(2.4);
	//frm->SetMaximum(0.3);
	frm->UseCurrentStyle();
	frm->Draw();
	frm->SetAxisRange(0.10,12.,"X");

	TF1* galster = new TF1("galster",
			"x/(4.*0.938*.938)*1.91/(1.+x/.71)^2/(1.+5.6*x/(4.*.938*.938))",
			0.,4.);
	galster->SetLineColor(kBlack);
	galster->SetLineStyle(kBlack);
	galster->SetLineWidth(2);

	TF1* gen0 = new TF1("gen0", f1dugen0, 0.,12.);
	gen0->SetLineColor(kBlack);
	gen0->SetLineStyle(kBlack);
	gen0->SetLineWidth(1);



	TF1 *genf = new TF1("genf",genff,1.,10.,1);
	genf->SetLineColor(kBlue);
	genf->SetLineStyle(1);
	genf->SetParameter(0,1.);
	// match to Madey point just below 1.5
	// genf->SetParameter(0,.0411/genf->Eval(1.45));
	//  genf->SetParameter(0,-0.558645);
	genf->SetParameter(0,-0.182645);

	TF1 *roberts_curve = new TF1("roberts",roberts_gen,0.035,12.344,1);
	roberts_curve->SetLineColor(kRed);
	roberts_curve->SetLineStyle(9);

	TF1 *ourfit = new TF1("ourfit",gen_ourfit,0.,10.,0);
	ourfit->SetLineColor(kBlue);
	ourfit->SetLineStyle(0);

	/*
	   TF1 *bbba05 = new TF1("BBBA05",gen_bbba05,0.,10.,0);
	   bbba05->SetLineColor(kGreen);
	   bbba05->SetLineStyle(3);
	   */

	//  TF1 *lomon = new TF1("Lomon",Lomon_GEn,0.,10.,0);
	// lomon->SetLineColor(7);
	// lomon->SetLineStyle(4);




	TMultiGraph* mgrDta = new TMultiGraph("Data","G_{E}^{n}");
	//TLegend *legDta = new TLegend(.3448,.6123,.6810,.9110,"","brNDC");
	TLegend *legDta = new TLegend(.6020,.4004,.9382,.9089,"","brNDC");

	TMultiGraph* wgr = mgrDta;
	TLegend *wlg = legDta;

	// the data
	legDta->SetBorderSize(0); // turn off border
	legDta->SetFillStyle(0);

	datafile_t *f = datafiles;
	TGraph* gr=0;
	TGraph* ogr=0;
	while ( f && f->filename ) {
		ogr=OneGraph(f);
		if (ogr) {
			gr = fromGEntransform(ogr);
			gr->SetLineStyle(0);
			if (f->lnpt) {
				mgrDta->Add(gr,f->lnpt);
				if( f->label[0] != 'x' )
					legDta->AddEntry(gr,f->label,f->lnpt);
			}
			mgrDta->Add(gr,"p");
			if( f->label[0] != 'x' )
				legDta->AddEntry(gr,f->label,"p");

			/*
			   else if (gr->GetMarkerStyle()>=20) {
			   mgrDta->Add(gr,"p");
			   if( f->label[0] != 'x' )
			   legDta->AddEntry(gr,f->label,"p");
			   }	
			   else {
			   mgrDta->Add(gr,"l");
			   if( f->label[0] != 'x' )
			   legDta->AddEntry(gr,f->label,"l");
			   }
//.........这里部分代码省略.........
开发者ID:ellie-long,项目名称:analysis-scripts,代码行数:101,代码来源:geugd_riordan.C


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