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


C++ TPaveText::SetY2NDC方法代码示例

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


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

示例1: DrawPrelimLabel

// Draw label for Decay Channel in upper left corner of plot
void DrawPrelimLabel(int cmsprelim, double textSize) {

    TPaveText *cms = new TPaveText();
    cms->AddText("CMS");

    cms->SetX1NDC(      gStyle->GetPadLeftMargin() + gStyle->GetTickLength()        );
    cms->SetY1NDC(1.0 - gStyle->GetPadTopMargin()  - gStyle->GetTickLength() - 0.05 );
    cms->SetX2NDC(      gStyle->GetPadLeftMargin() + gStyle->GetTickLength() + 0.15 );
    cms->SetY2NDC(1.0 - gStyle->GetPadTopMargin()  - gStyle->GetTickLength()        );

    cms->SetFillStyle(0);
    cms->SetBorderSize(0);
    if (textSize!=0) cms->SetTextSize(textSize*1.1);
    cms->SetTextAlign(12);
    cms->SetTextFont(61);
    cms->Draw("same");

    if(cmsprelim > 0) {
      TPaveText *extra = new TPaveText();
      if(cmsprelim == 2) { extra->AddText("Private Work"); }
      else { extra->AddText("Preliminary"); }

      extra->SetX1NDC(      gStyle->GetPadLeftMargin() + gStyle->GetTickLength()        );
      extra->SetY1NDC(1.0 - gStyle->GetPadTopMargin()  - gStyle->GetTickLength() - 0.10 );
      extra->SetX2NDC(      gStyle->GetPadLeftMargin() + gStyle->GetTickLength() + 0.15 );
      extra->SetY2NDC(1.0 - gStyle->GetPadTopMargin()  - gStyle->GetTickLength() - 0.05 );

      extra->SetFillStyle(0);
      extra->SetBorderSize(0);
      if (textSize!=0) extra->SetTextSize(textSize);
      extra->SetTextAlign(12);
      extra->SetTextFont(52);
      extra->Draw("same");
    }
}
开发者ID:schuetzepaul,项目名称:testbeam-analysis,代码行数:36,代码来源:plotter.C

示例2: DrawCMSLabels

// Draw statistics info above plot
void DrawCMSLabels(double lumi, double energy, double textSize) {

  //const char *text = "%2.1f #times 10^{6} clusters (fiducial) (%1.1f GeV)";
  const char *text;
  if(lumi > 10000000) {
    lumi /= 10000000;
    text = "%2.1f #times 10^{7} tracks (%1.1f GeV)";
  }
  else {
    lumi /= 1000000;
    text = "%2.1f #times 10^{6} tracks (%1.1f GeV)";
  }
    
  TPaveText *label = new TPaveText();
  label->SetX1NDC(gStyle->GetPadLeftMargin());
  label->SetY1NDC(1.0-gStyle->GetPadTopMargin());
  label->SetX2NDC(1.0-gStyle->GetPadRightMargin());
  label->SetY2NDC(1.0);
  label->SetTextFont(42);
  label->AddText(Form(text, lumi, energy));
  label->SetFillStyle(0);
  label->SetBorderSize(0);
  if (textSize!=0) label->SetTextSize(textSize);
  label->SetTextAlign(32);
  label->Draw("same");
}
开发者ID:schuetzepaul,项目名称:testbeam-analysis,代码行数:27,代码来源:plotter.C

示例3: DrawDecayChLabel

// Draw label for Decay Channel in upper left corner of plot
void DrawDecayChLabel(TString decaychannel, double textSize) {

    TPaveText *decch = new TPaveText();

    decch->AddText(decaychannel);

    decch->SetX1NDC(      gStyle->GetPadLeftMargin() + gStyle->GetTickLength()        );
    decch->SetY1NDC(1.0 - gStyle->GetPadTopMargin()  - gStyle->GetTickLength() - 0.05 );
    decch->SetX2NDC(      gStyle->GetPadLeftMargin() + gStyle->GetTickLength() + 0.15 );
    decch->SetY2NDC(1.0 - gStyle->GetPadTopMargin()  - gStyle->GetTickLength()        );

    decch->SetFillStyle(0);
    decch->SetBorderSize(0);
    if (textSize!=0) decch->SetTextSize(textSize);
    decch->SetTextAlign(12);
    decch->Draw("same");
}
开发者ID:simonspa,项目名称:topmassextractor,代码行数:18,代码来源:combine_closure.C

示例4: DrawFreeCMSLabels

void DrawFreeCMSLabels(char* text, double textSize) {

  //const char *text = "%2.1f #times 10^{6} clusters (fiducial) (%1.1f GeV)";
  //char *text = "%2.1f #times 10^{6} clusters (fiducial)";
    
  TPaveText *label = new TPaveText();
  label->SetX1NDC(gStyle->GetPadLeftMargin());
  label->SetY1NDC(1.0-gStyle->GetPadTopMargin());
  label->SetX2NDC(1.0-gStyle->GetPadRightMargin());
  label->SetY2NDC(1.0);
  label->SetTextFont(42);
  label->AddText(text);
  label->SetFillStyle(0);
  label->SetBorderSize(0);
  if (textSize!=0) label->SetTextSize(textSize);
  label->SetTextAlign(32);
  label->Draw("same");
}
开发者ID:schuetzepaul,项目名称:testbeam-analysis,代码行数:18,代码来源:plotter.C

示例5: DrawCMSLabels

// Draw official labels (CMS Preliminary, luminosity and CM energy) above plot
void DrawCMSLabels(int cmsprelim=1, double energy=8, double textSize=0.04) {

    const char *text;
    if(cmsprelim ==2 ) {//Private work for PhDs students
        text = "Private Work, Simulation at #sqrt{s} = %2.f TeV";
    } else if (cmsprelim==1) {//CMS preliminary label
        text = "CMS Preliminary, Simulation at #sqrt{s} = %2.f TeV";
    } else {//CMS label
        text = "CMS, Simulation at #sqrt{s} = %2.f TeV";
    }
    
    TPaveText *label = new TPaveText();
    label->SetX1NDC(gStyle->GetPadLeftMargin());
    label->SetY1NDC(1.0-gStyle->GetPadTopMargin());
    label->SetX2NDC(1.0-gStyle->GetPadRightMargin());
    label->SetY2NDC(1.0);
    label->SetTextFont(42);
    label->AddText(Form(text, energy));
    label->SetFillStyle(0);
    label->SetBorderSize(0);
    if (textSize!=0) label->SetTextSize(textSize);
    label->SetTextAlign(32);
    label->Draw("same");
}
开发者ID:simonspa,项目名称:topmassextractor,代码行数:25,代码来源:combine_closure.C

示例6: fgtRawSpectraQA


//.........这里部分代码省略.........

   TH2F *dummy[4];
   const Char_t dummyNames[4][20] = { "dummy1", "dummy2", "dummy3", "dummy4" };

   Float_t xMin = qaMkr->getHist(0)->GetXaxis()->GetXmin();
   Float_t xMax = qaMkr->getHist(0)->GetXaxis()->GetXmax();
   Float_t yMin = qaMkr->getHist(0)->GetYaxis()->GetXmin();
   Float_t yMax = qaMkr->getHist(0)->GetYaxis()->GetXmax();

   for( Int_t i=0; i<4; ++i )
      dummy[i] = new TH2F( dummyNames[i], "", 5, xMin, xMax, 1, yMin, yMax );

   std::stringstream ss;

   Int_t subpad = 1;
   idx = 0;
   for( Int_t rdo = 1; rdo < 3; ++rdo ){
      for( Int_t arm = 0; arm < 6; ++arm ){
         for( Int_t startIdx = 0; startIdx < 4; ++startIdx, ++idx ){
            for( Int_t oct = 0; oct < 1; ++oct ){

               cout << "rdo/arm/disc/oct = " << rdo << '/' << arm << '/' << startIdx << '/' << oct << endl;
               if( qaMkr->getHist(idx)->GetEntries() > 0 ){
                  can->cd(subpad);
                  gPad->SetLeftMargin( 0.06 );
                  gPad->SetRightMargin( 0.05 );
                  gPad->SetBottomMargin( 0.11 );

                  qaMkr->getHist(idx)->SetMaximum( max );
                  dummy[subpad-1]->GetXaxis()->SetTitleOffset(0.9);
                  dummy[subpad-1]->GetXaxis()->SetTitleSize(0.06);
                  dummy[subpad-1]->GetXaxis()->SetLabelSize(0.06);
                  dummy[subpad-1]->GetYaxis()->SetTitleOffset(0.55);
                  dummy[subpad-1]->GetYaxis()->SetTitleSize(0.06);
                  dummy[subpad-1]->GetYaxis()->SetLabelSize(0.06);

                  gPad->SetGridx(0);
                  gPad->SetGridy(0);

                  for( Int_t i = 0; i<5; ++i ){
                     ss.str("");
                     ss.clear();
                     ss << "channels in APV "; // startArray[startIdx]+i;
                     dummy[subpad-1]->GetXaxis()->SetBinLabel( i+1, ss.str().data() );
                  };
                  dummy[subpad-1]->GetXaxis()->SetNdivisions(222,0);
                  dummy[subpad-1]->SetMinimum( 0 );
                  dummy[subpad-1]->SetMaximum( max );
                  dummy[subpad-1]->SetTitle( qaMkr->getHist(idx)->GetTitle() );
                  qaMkr->getHist(idx)->SetTitle("");

                  dummy[subpad-1]->GetYaxis()->SetTitle( qaMkr->getHist(idx)->GetYaxis()->GetTitle() );
                  qaMkr->getHist(idx)->GetYaxis()->SetTitle("");
                  dummy[subpad-1]->Draw("COLZ");

                  qaMkr->getHist(idx)->Draw("COLZ SAME");

                  gPad->Update();
                  gPad->Modified();

                  TPaveText *title = (TPaveText*)(gPad->GetPrimitive("title"));
                  if( title ){
                     title->SetX1NDC( 0.045 );
                     title->SetX2NDC( 0.55 );
                     title->SetY1NDC( 0.91 ) ;
                     title->SetY2NDC( 0.999 );
                     title->SetBorderSize(0);
                     title->SetTextAlign( 12 );
                     title->SetTextColor(kBlue);
                     title->Draw();
                  };

                  TPave *palette = (TPave*)(gPad->GetPrimitive("palette"));
                  if( palette ){
                     palette->SetX1NDC( 0.955 );
                     palette->SetX2NDC( 0.985 );
                     palette->Draw();
                  };

                  ++subpad;
                  if( subpad == 5 ){
                     subpad = 1;
                     can->Print( (std::string(filebaseOut) + ".ps").data() );
                  };
               };
            };
         };
      };
   };

   if( subpad != 1 )
      can->Print( (std::string(filebaseOut) + ".ps").data() );
   can->Print( (std::string(filebaseOut) + ".ps]").data() );

   gSystem->Exec(( std::string("ps2pdf -dAutoRotatePages=/None ") + filebaseOut + ".ps" ).data());


   cerr << "\tall done" << endl;
   return;
};
开发者ID:star-bnl,项目名称:star-fgt,代码行数:101,代码来源:fgtRawSpectraQA.C

示例7: makeMuonTimingPlot


//.........这里部分代码省略.........
        if (!foundHist)
        {
            h1 = (TH1F*)h0->Clone();
            h1->Sumw2();
            foundHist = true;
        }
        else
        {
            h1->Add(h0);
        }        
    }

    TH1F *h2 = new TH1F("h2", "h2", 200, -100, 100);
    h2->GetXaxis()->SetTitle("muon time (ns)");
    h2->GetYaxis()->SetTitle("Fraction of Muons/ns");
    h2->GetYaxis()->SetTitleOffset(1.1);
    h2->GetXaxis()->SetTitleOffset(0.8);        
    h2->SetTitle("CSC Muon Time");
    h2->SetTitleFont(42);
    h2->SetTitleSize(0.052);    
 
    h2->Sumw2();
    h2->SetLineColor(kCyan+3);
    h2->SetFillColor(kCyan+3);

    for (int ibin = 1; ibin <= 200; ibin++)
    {
        h2->SetBinContent(ibin, h1->GetBinContent(ibin));
        h2->SetBinError(ibin, h1->GetBinError(ibin));
        if (ibin == 200)
            h2->SetEntries(h1->GetEntries());
    }
    
    TCanvas c1("c1", "c1", 600, 400);
    gStyle->SetOptStat("");

    double rms = h2->GetRMS();
    double avg = h2->GetMean();
    
    TLatex cms(0.17, 0.83, "CMS");
    cms.SetNDC();
    cms.SetTextFont(61);
    cms.SetTextSize(0.06);

    TLatex prelim(0.17, 0.81, "Preliminary");
    prelim.SetNDC();
    prelim.SetTextAlign(13);
    prelim.SetTextFont(52);
    prelim.SetTextSize(0.0456);

    TLatex data(0.17, 0.76, "Data 2016");
    data.SetNDC();
    data.SetTextAlign(13);
    data.SetTextFont(52);
    data.SetTextSize(0.0456);

    TLatex lumi(0.9, 0.93, "4.0 fb^{-1} (13 TeV)");
    lumi.SetNDC();
    lumi.SetTextAlign(31);
    lumi.SetTextFont(42);
    lumi.SetTextSize(0.052);    

    TLatex mean(0.7, 0.81, Form("Mean  %2.1f", avg));
    mean.SetNDC();
    mean.SetTextAlign(11);
    mean.SetTextFont(61);
    mean.SetTextSize(0.06);

    TLatex stdev(0.7, 0.76, Form("RMS   %2.1f", rms));
    stdev.SetNDC();
    stdev.SetTextAlign(11);
    stdev.SetTextFont(61);
    stdev.SetTextSize(0.06);

    h2->GetXaxis()->SetRangeUser(-6*rms,6*rms);   
    TH1F* h2norm = (TH1F*)h2->DrawNormalized("hist");
    gPad->Update();
    cms.Draw();
    prelim.Draw();
    data.Draw();
    lumi.Draw();
    mean.Draw();
    stdev.Draw();
    
    TPaveText *title = (TPaveText*)gPad->GetPrimitive("title");
    title->SetBorderSize(0);
    title->SetFillColor(0);
    title->SetFillStyle(0);    
    title->SetX1NDC(0.13);
    title->SetY1NDC(0.88);
    title->SetX2NDC(0.9);
    title->SetY2NDC(0.98);
    title->SetTextFont(42);
    title->SetTextSize(0.052);    
    title->SetTextAlign(11);
    
    c1.Print("plots/muon_time_all.pdf");
    c1.Print("plots/muon_time_all.png");
    c1.Print("plots/muon_time_all.root");
}
开发者ID:fgolf,项目名称:CSCOfflineTiming,代码行数:101,代码来源:makeMuonTimingPlot.C

示例8: AnalyzeWaveforms


//.........这里部分代码省略.........
	// note that there is a manual correction on the x axis for the adder output to compare it better in the multigraph
	
	Double_t *xArray = g3ChannelsSumNoDelay->GetX();
	graphPoints = g3ChannelsSumNoDelay->GetN();
	
	for(Int_t i = 0; i < graphPoints; i++) {
		xArray[i] -= 600E-12;
	}
	
	// comparison among the computed adder output ,the real one and the sum of the comparator outputs with alpha coefficients correction
	
	TMultiGraph *mgSumNoDelay = new TMultiGraph();
	mgSumNoDelay->Add(g3ChannelsSumNoDelay);
	mgSumNoDelay->Add(gAdderSum);
	mgSumNoDelay->Add(gCompSum);
	mgSumNoDelay->SetTitle("Collection of graphs for 3 channels sum with no delay");
	
	TCanvas *cmgSumNoDelay = new TCanvas("cmgSumNoDelay", "Collection of graphs for 3 channels sum with no delay", 1200,800);
	cmgSumNoDelay->Update();
	mgSumNoDelay->Draw("AL");
	
	legend = new TLegend(0.6,0.78,0.99,0.99);
	legend->AddEntry(g3ChannelsSumNoDelay, "Actual sum done by the adder", "lp");
	legend->AddEntry(gAdderSum, "Sum of the adder outputs", "lp");
	legend->AddEntry(gCompSum, "Sum of the comparator outputs","lp");
	legend->Draw();
	
	mgSumNoDelay->GetXaxis()->SetTitle("Seconds");
	mgSumNoDelay->GetYaxis()->SetTitle("Volts");
	TPaveText *title = (TPaveText*)cmgSumNoDelay->GetPrimitive("title");
	title->SetX1NDC(0.009);
	title->SetY1NDC(0.94);
	title->SetX2NDC(0.56);
	title->SetY2NDC(0.99);
	cmgSumNoDelay->Modified();
*/
	
	
	// analysis for delayed adder outputs
	
	Int_t nAdderWaves = listOfAdderWaves->GetEntries();

	TGraphErrors *g3ChannelsSumDelay = listOfGraphs->FindObject("sum_output_3_channels_(1-1-1) graph");
	g3ChannelsSumDelay->SetLineColor(kRed);
	g3ChannelsSumDelay->SetLineWidth(2);

	// Delay coming from cables are written "hard coded" here
	Float_t cablesDelayArray[3] = {0,1.45E-9,3.21E-9};
	
	graphPoints = g3ChannelsSumDelay->GetN();
	//g3ChannelsSumDelay->GetPoint(0,xMin,yStart);
	//g3ChannelsSumDelay->GetPoint(graphPoints - 1,xMax,yEnd);
	xMin = 6E-9;
	xMax = 16E-9;
	step = (xMax - xMin)/graphPoints;
	cout << "Sum of the adder outputs with delay" << endl;
	cout << "xMin : " << xMin << "  xMax : " << xMax << endl;

	TGraphErrors *gAdderSumDelay = new TGraphErrors(graphPoints);
	gAdderSumDelay->SetLineColor(kBlue);
	gAdderSumDelay->SetLineWidth(2);
	gAdderSumDelay->SetName("Sum of the adder outputs with delay");
	gAdderSumDelay->SetTitle("Sum of the adder outputs with delay");

	gy = 0;
	
开发者ID:matteodepalo,项目名称:l-zero-trigger-board,代码行数:66,代码来源:AnalyzeWaveforms.C

示例9: sigmapeak

/*
root -l 'sigmapeak.C+(0.025)'
// 
Processing sigmapeak.C+(0.025)...
background only: bkg_nsigma_0_99 = -0.352803
sig_nsigma_0_59  = -0.608621
sig_nsigma_0_99  = 2.1472
sig_nsigma_60_99 = 4.14042
sig_nsigma_70_90 = 5.57689
sig_nsigma_75_85 = 8.056
*/
void sigmapeak(Double_t signal_area=0.025)
{
   Double_t bkg_mean = 0;
   Double_t bkg_sigma = 0.001;

   Double_t x[100];
   Double_t y[100];
   Int_t np = 100;
   
   TRandom3 rand;
   
   for (int i=0; i<np; ++i) {
      x[i] = i;
      y[i] = rand.Gaus(bkg_mean,bkg_sigma);
   }
   
   TGraph* gr = new TGraph(np,x,y);
   gr->SetNameTitle("gr",Form("#sigma = %0.1f",bkg_sigma));
   gr->SetMarkerStyle(7);
   gr->SetMarkerColor(46);
   new TCanvas();
   gr->Draw("ap");

   Double_t bkg_nsigma_0_99 = Nsigma(gr->GetY(), 0,99, bkg_sigma);
   cout<< "background only: bkg_nsigma_0_99 = " << bkg_nsigma_0_99 <<endl;

   // add signal

   Double_t signal_mean = 80;
   Double_t signal_sigma = 3;

   for (int i=0; i<gr->GetN(); ++i) {
      Double_t xx = (gr->GetX()[i] - signal_mean)/signal_sigma;
      Double_t arg = 0.5*xx*xx;
      Double_t exp = arg < 50? TMath::Exp(-arg): 0;
      Double_t signal = signal_area/(TMath::Sqrt(TMath::TwoPi())*signal_sigma) * exp;
      gr->SetPoint(i, gr->GetX()[i], gr->GetY()[i] + signal);
   }

   gr->SetTitle(Form("#sigma_{bkg} = %0.3f signal: area = %0.3f mean = %0.0f sigma = %0.1f", bkg_sigma,signal_area,signal_mean,signal_sigma));

   gr->Draw("apl");
   gr->Fit("gaus", "R", "", signal_mean - 5*signal_sigma, signal_mean+5*signal_sigma);
   Double_t fit_area = 2.5 * gr->GetFunction("gaus")->GetParameter("Constant") * gr->GetFunction("gaus")->GetParameter("Sigma");
   cout<< "Area under fitted gaussian = " << fit_area <<endl;

   // titmax();
   gPad->Modified();    // to create box (NB: the pad was not drawn yet at this point!)
   gPad->Update();
   TPaveText* tit = (TPaveText*)gPad->GetPrimitive("title");
   tit->SetX1NDC(0.);
   tit->SetX2NDC(1.);
   tit->SetY1NDC(0.9);
   tit->SetY2NDC(1.);
   gPad->Modified();    // to update the pad
   gPad->Update();

   Double_t sig_nsigma_0_59 = Nsigma(gr->GetY(), 0,59, bkg_sigma);
   cout<< "sig_nsigma_0_59  = " << sig_nsigma_0_59 <<endl;

   Double_t sig_nsigma_0_99 = Nsigma(gr->GetY(), 0,99, bkg_sigma);
   cout<< "sig_nsigma_0_99  = " << sig_nsigma_0_99 <<endl;

   Double_t sig_nsigma_60_99 = Nsigma(gr->GetY(), 60,99, bkg_sigma);
   cout<< "sig_nsigma_60_99 = " << sig_nsigma_60_99 <<endl;

   Double_t sig_nsigma_70_90 = Nsigma(gr->GetY(), 70,90, bkg_sigma);
   cout<< "sig_nsigma_70_90 = " << sig_nsigma_70_90 <<endl;

   Double_t sig_nsigma_75_85 = Nsigma(gr->GetY(), 75,85, bkg_sigma);
   cout<< "sig_nsigma_75_85 = " << sig_nsigma_75_85 <<endl;

   Double_t ys5[100];
   smooth5(np, gr->GetY(), ys5);
   TGraph* gr5 = new TGraph(np, x, ys5);
   gr5->SetNameTitle("gr5","smoothed on 5 points");
   gr5->SetMarkerStyle(7);
   gr5->SetMarkerColor(2);
   gr5->SetLineColor(2);
   new TCanvas;
   gr5->Draw("apl");

   Double_t ys7[100];
   smooth7(np, gr->GetY(), ys7);
   TGraph* gr7 = new TGraph(np, x, ys7);
   gr7->SetNameTitle("gr7","smoothed on 7 points");
   gr7->SetMarkerStyle(7);
   gr7->SetMarkerColor(8);
   gr7->SetLineColor(8);
//.........这里部分代码省略.........
开发者ID:zatserkl,项目名称:root-macros,代码行数:101,代码来源:sigmapeak.C


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