本文整理汇总了C++中TPaveText::SetTextColor方法的典型用法代码示例。如果您正苦于以下问题:C++ TPaveText::SetTextColor方法的具体用法?C++ TPaveText::SetTextColor怎么用?C++ TPaveText::SetTextColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPaveText
的用法示例。
在下文中一共展示了TPaveText::SetTextColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawCell
void DrawCell( TMVA::PDEFoamCell *cell, TMVA::PDEFoam *foam,
Double_t x, Double_t y,
Double_t xscale, Double_t yscale )
{
// recursively draw cell and it's daughters
Float_t xsize = xscale*1.5;
Float_t ysize = yscale/3;
if (xsize > 0.15) xsize=0.1; //xscale/2;
if (cell->GetDau0() != NULL) {
TLine *a1 = new TLine(x-xscale/4, y-ysize, x-xscale, y-ysize*2);
a1->SetLineWidth(2);
a1->Draw();
DrawCell(cell->GetDau0(), foam, x-xscale, y-yscale, xscale/2, yscale);
}
if (cell->GetDau1() != NULL){
TLine *a1 = new TLine(x+xscale/4, y-ysize, x+xscale, y-ysize*2);
a1->SetLineWidth(2);
a1->Draw();
DrawCell(cell->GetDau1(), foam, x+xscale, y-yscale, xscale/2, yscale);
}
TPaveText *t = new TPaveText(x-xsize, y-ysize, x+xsize, y+ysize, "NDC");
t->SetBorderSize(1);
t->SetFillStyle(1);
// draw all cell elements
t->AddText( Form("Intg=%.5f", cell->GetIntg()) );
t->AddText( Form("Var=%.5f", cell->GetDriv()) );
TVectorD *vec = (TVectorD*) cell->GetElement();
if (vec != NULL){
for (Int_t i = 0; i < vec->GetNrows(); ++i) {
t->AddText( Form("E[%i]=%.5f", i, vec(i)) );
}
}
if (cell->GetStat() != 1) {
// cell is inactive --> draw split point
t->SetFillColor( TColor::GetColor("#BBBBBB") );
t->SetTextColor( TColor::GetColor("#000000") );
// cell position and size
TMVA::PDEFoamVect cellPosi(foam->GetTotDim()), cellSize(foam->GetTotDim());
cell->GetHcub(cellPosi, cellSize);
Int_t kBest = cell->GetBest(); // best division variable
Double_t xBest = cell->GetXdiv(); // best division point
t->AddText( Form("dim=%i", kBest) );
t->AddText( Form("cut=%.5g", foam->VarTransformInvers(kBest,cellPosi[kBest] + xBest*cellSize[kBest])) );
} else {
t->SetFillColor( TColor::GetColor("#DD0033") );
t->SetTextColor( TColor::GetColor("#FFFFFF") );
}
t->Draw();
return;
}
示例2: help
void help()
{
new TCanvas("chelp","Help on gldemos",200,10,700,600);
TPaveLabel *title = new TPaveLabel(0.04, 0.86, 0.96, 0.98, "These demos show different gl painters.");
title->SetFillColor(32);
title->Draw();
TPaveText *hdemo = new TPaveText(0.04, 0.04, 0.96, 0.8);
hdemo->SetTextAlign(12);
hdemo->SetTextFont(52);
hdemo->SetTextColor(kBlue);
hdemo->AddText("1. Glsurfaces demo shows glsurf4, glsurf1, glsurf3, glsurf1cyl, glsurfpol, gltf3 options.");
hdemo->AddText("2. Glrose demontrates \"glsurf2pol\" drawing option and user-defined palette.");
hdemo->AddText("3. Gltf3 demo shows \"gltf3\" option.");
hdemo->AddText("4. Glbox demo shows \"glbox\" and \"glbox1\" options for TH3.");
hdemo->AddText("5. Glparametric demo shows how to define and display parametric surfaces.");
hdemo->AddText("You can zoom any plot: press 'J', 'K', 'j', 'k' keys, or use mouse wheel.");
hdemo->AddText("Rotate any plot:");
hdemo->AddText(" ---select plot with mouse cursor,");
hdemo->AddText(" ---move mouse cursor, pressing and holding left mouse button ");
hdemo->AddText("Pan plot:");
hdemo->AddText(" ---select with mouse cursor a part of a plot, other than back box planes ,");
hdemo->AddText(" ---move mouse cursor, pressing and holding middle mouse button ");
hdemo->AddText("Selected part of a plot is higlighted (TF3 higlighting is not implemented yet.)");
hdemo->AddText("You can select one of back box planes, press middle mouse button and move cursor-");
hdemo->AddText("this will create \"slice\" (TF does not support yet).");
hdemo->AddText("After the slice was created, you can project it on a back box");
hdemo->AddText(" ---press key 'p' (now implemented only for surf options ).");
hdemo->AddText("Left double click removes all slices/projections.");
hdemo->Draw();
}
示例3: DrawStatBox
void DrawStatBox(TObject** Histos, std::vector<char*> legend, bool Mean, double X, double Y, double W, double H)
{
int N = legend.size();
char buffer[255];
if(Mean)H*=3;
for(int i=0;i<N;i++){
TPaveText* stat = new TPaveText(X,Y-(i*H), X+W, Y-(i+1)*H, "NDC");
TH1* Histo = (TH1*)Histos[i];
sprintf(buffer,"Entries : %i\n",(int)Histo->GetEntries());
stat->AddText(buffer);
if(Mean){
sprintf(buffer,"Mean : %6.2f\n",Histo->GetMean());
stat->AddText(buffer);
sprintf(buffer,"RMS : %6.2f\n",Histo->GetRMS());
stat->AddText(buffer);
}
stat->SetFillColor(0);
stat->SetLineColor(Color[i]);
stat->SetTextColor(Color[i]);
stat->SetBorderSize(0);
stat->SetMargin(0.05);
stat->SetTextAlign(12);
stat->Draw();
}
}
示例4: FitAdcHist
/************************************************************
* Fit ADC spectrum
************************************************************/
int FitAdcHist(TH1F *h, float data[NDATA], const int print ) {
TF1 *fadc;
TPaveText *adcPT;
// Protect for null histograms
if( h == 0 || h->GetEntries()<1000. ) return -1;
printf("Fitting %s\n",h->GetName());
gStyle->SetOptStat("emr");
adcPT = new TPaveText(0.58,0.315,0.98,0.635,"NDC");
// Refit ADC
Double_t n = h->GetEntries();
Double_t rms = h->GetRMS();
Double_t mean = h->GetMean();
Double_t ymin = mean-2*rms;
if( ymin < 60. ) ymin=60.;
Double_t ymax = mean+1.5*rms;
fadc = new TF1("adc_fun",skewnormal,ymin,ymax,4);
fadc->SetParameters(n,mean,rms,1.5);
fadc->SetParLimits(1,mean-rms,mean+0.5*rms);
fadc->SetParLimits(2,rms*0.5,rms*1.5);
fadc->SetParLimits(3,1.,4.);
h->Fit("adc_fun","r");
// If skew is too high refit with fixed skew
if( fadc->GetParameter(3) > 2.5 ) {
printf("REFIT %s\n",h->GetName());
fadc->SetParameter(3,1.6);
fadc->SetParLimits(3,1.6,1.6);
h->Fit("adc_fun","r") ;
}
// if have enough hits use fit results
if( n > MINHITS ) {
data[13] = fadc->GetParameter(1);
data[14] = fadc->GetParError(1);
data[15] = fadc->GetParameter(2);
data[16] = fadc->GetParError(2);
data[17] = fadc->GetParameter(3);
data[18] = fadc->GetParError(3);
double dof = fadc->GetNDF();
if( dof > 0. ) data[19] = fadc->GetChisquare()/dof;
adcPT->AddText(Form("Peak %.1lf #pm %.1lf",data[13],data[14]));
adcPT->AddText(Form("Width %.1lf #pm %.1lf",data[15],data[16]));
adcPT->AddText(Form("Skew %.2lf #pm %.2lf", data[17],data[18]));
if( dof > 0. ) adcPT->AddText(Form("#Chi^{2}/DoF %.2lf",data[19]));
adcPT->SetTextColor(2);
adcPT->Draw();
// if have too few hits use fit stats instead of fit results
} else {
data[12] = mean;
data[13] = h->GetMeanError();
data[14] = rms;
data[15] = h->GetRMSError();
data[16] = h->GetSkewness();
}
if( print ) c1->Print(Form("%s_%s.png",fname,h->GetName()));
return 0;
} //end FitAdcHist
示例5: PostDrawMultiGraph
void OverlayAnalysis::PostDrawMultiGraph(GraphName graphName, TMultiGraph *pMultiGraph) const
{
if(NULL == pMultiGraph)
return;
// base customize
pMultiGraph->GetXaxis()->SetTitle("Distance between showers [cm]");
pMultiGraph->GetXaxis()->SetLabelFont(42);
pMultiGraph->GetXaxis()->SetTitleSize(0.05);
pMultiGraph->GetXaxis()->SetTitleOffset(1.);
pMultiGraph->GetXaxis()->SetTitleFont(42);
pMultiGraph->GetXaxis()->SetRangeUser(std::max(static_cast<int>(m_startDistance) - 5, 0), m_endDistance + 5);
pMultiGraph->GetYaxis()->SetTitle("");
pMultiGraph->GetYaxis()->SetLabelFont(42);
pMultiGraph->GetYaxis()->SetTitleSize(0.045);
pMultiGraph->GetYaxis()->SetTitleOffset(1.3);
pMultiGraph->GetYaxis()->SetTitleFont(42);
pMultiGraph->GetYaxis()->SetLabelSize(0.035);
TPaveText *pt = new TPaveText(0.3, 0.2, 0.93, 0.3, "tbNDC");
pt->SetTextSize(0.05);
pt->SetTextColor(kGray+2);
pt->SetFillColor(0);
pt->SetLineWidth(0);
pt->SetBorderSize(0);
pt->AddText("CALICE SDHCAL");
pt->SetTextFont(62);
pt->Draw();
// plot per plot customize
switch(graphName)
{
case N_PFOS:
pMultiGraph->GetYaxis()->SetTitle("<N_{pfos}>");
pMultiGraph->GetYaxis()->SetRangeUser(1, 3);
break;
case NEUTRAL_PURITY:
pMultiGraph->GetYaxis()->SetTitle("#rho_{neutral}");
pMultiGraph->GetYaxis()->SetRangeUser(0, 1);
break;
case NEUTRAL_EFFICIENCY:
pMultiGraph->GetYaxis()->SetTitle("#varepsilon_{neutral}");
pMultiGraph->GetYaxis()->SetRangeUser(0, 1);
break;
case NEUTRAL_RECOVER_PROBA:
pMultiGraph->GetYaxis()->SetTitle("P_{n>0}");
pMultiGraph->GetYaxis()->SetRangeUser(0, 1);
break;
case NEUTRAL_ENERGY_DIFFERENCE_EFFICIENT:
pMultiGraph->GetYaxis()->SetTitle("<E_{n,rec} - E_{n,meas}>, n>0");
pMultiGraph->GetYaxis()->SetRangeUser(-5, 5);
break;
}
}
示例6: TPaveText
void
CMSPrelim(const char* dataset, const char* channel,const char* cat)
{
double lowX=0.16;
double lowY=0.835;
int color=1; int font = 62;
TPaveText* cmsprel = new TPaveText(lowX, lowY+0.06, lowX+0.30, lowY+0.16, "NDC");
cmsprel->SetBorderSize( 0 );
cmsprel->SetFillStyle( 0 );
cmsprel->SetTextAlign( 12 );
cmsprel->SetTextColor( color );
cmsprel->SetTextFont ( font );
//cmsprel->SetTextSize ( 0.035 );
//cmsprel->SetTextSize ( 0.027 );
cmsprel->SetTextSize ( 0.030 );
cmsprel->AddText(dataset);
cmsprel->Draw();
TPaveText* chan = new TPaveText(lowX+0.05, lowY-0.002, lowX+0.45, lowY+0.028, "NDC");
chan->SetBorderSize( 0 );
chan->SetFillStyle( 0 );
chan->SetTextAlign( 12 );
chan->SetTextSize ( 0.035 );
chan->SetTextColor( color );
chan->SetTextFont ( font );
chan->AddText(channel);
chan->Draw();
TPaveText* category = new TPaveText(lowX+0.05, lowY-0.002-0.06, lowX+0.45, lowY+0.028-0.06, "NDC");
category->SetBorderSize( 0 );
category->SetFillStyle( 0 );
category->SetTextAlign( 12 );
category->SetTextSize ( 0.035 );
category->SetTextColor( color );
category->SetTextFont ( font );
category->AddText(cat);
category->Draw();
}
示例7: BadDraw
void OnlineGUI::BadDraw(TString errMessage) {
// Routine to display (in Pad) why a particular draw method has
// failed.
TPaveText *pt = new TPaveText(0.1,0.1,0.9,0.9,"brNDC");
pt->SetBorderSize(3);
pt->SetFillColor(10);
pt->SetTextAlign(22);
pt->SetTextFont(72);
pt->SetTextColor(2);
pt->AddText(errMessage.Data());
pt->Draw();
// cout << errMessage << endl;
}
示例8: CMSPrelim
void CMSPrelim()
{
TPaveText* cmsprel = new TPaveText(0.19, 0.895 , 0.19 + 0.30, 0.895 + 0.10, "NDC");
cmsprel->SetBorderSize( 0 );
cmsprel->SetFillStyle( 0 );
cmsprel->SetTextAlign( 12 );
cmsprel->SetTextColor( 1 );
cmsprel->SetTextFont ( 62 );
//cmsprel->SetTextSize ( 0.035 );
//cmsprel->AddText("CMS Preliminary, #sqrt{s}=7-8 TeV, L=24.3 fb^{-1}, H#rightarrow#tau#tau");
//cmsprel->SetTextSize ( 0.027 );
//cmsprel->AddText("CMS Preliminary, L=4.9 fb^{-1}@#sqrt{s}=7 TeV, L=19.3 fb^{-1}@#sqrt{s}=8 TeV, H#rightarrow#tau#tau");
//cmsprel->AddText("CMS Preliminary, #sqrt{s}=7 TeV, L=4.9 fb^{-1}; #sqrt{s}=8 TeV, L=19.3 fb^{-1}; H#rightarrow#tau#tau");
cmsprel->SetTextSize ( 0.030 );
cmsprel->AddText("CMS Preliminary, H#rightarrow#tau#tau, 4.9 fb^{-1} at 7 TeV, 19.4 fb^{-1} at 8 TeV");
cmsprel->Draw();
}
示例9: FillTrendPlot
//.........这里部分代码省略.........
else if(TString(residualsPlot[0]->GetName()).Contains("IP2D")) res="IP2D";
else if(TString(residualsPlot[0]->GetName()).Contains("resz")) res="resz";
TCanvas *fitOutput = new TCanvas(Form("fitOutput_%s_%s_%s",res.Data(),var_.Data(),trendPlot->GetName()),Form("fitOutput_%s_%s",res.Data(),var_.Data()),1200,1200);
fitOutput->Divide(5,5);
TCanvas *fitPulls = new TCanvas(Form("fitPulls_%s_%s_%s",res.Data(),var_.Data(),trendPlot->GetName()),Form("fitPulls_%s_%s",res.Data(),var_.Data()),1200,1200);
fitPulls->Divide(5,5);
TH1F* residualsPull[nBins_];
for(Int_t i=0;i<nBins_;i++){
TF1 *tmp1 = (TF1*)residualsPlot[i]->GetListOfFunctions()->FindObject("tmp");
fitOutput->cd(i+1)->SetLogy();
fitOutput->cd(i+1)->SetBottomMargin(0.16);
//fitOutput->cd(i+1)->SetTopMargin(0.05);
//residualsPlot[i]->Sumw2();
MakeNicePlotStyle(residualsPlot[i]);
residualsPlot[i]->SetMarkerStyle(20);
residualsPlot[i]->SetMarkerSize(1.);
residualsPlot[i]->SetStats(0);
//residualsPlot[i]->GetXaxis()->SetRangeUser(-3*(tmp1->GetParameter(1)),3*(tmp1->GetParameter(1)));
residualsPlot[i]->Draw("e1");
residualsPlot[i]->GetYaxis()->UnZoom();
//std::cout<<"*********************"<<std::endl;
//std::cout<<"fitOutput->cd("<<i+1<<")"<<std::endl;
//std::cout<<"residualsPlot["<<i<<"]->GetTitle() = "<<residualsPlot[i]->GetTitle()<<std::endl;
// -- for chi2 ----
TPaveText *pt = new TPaveText(0.13,0.78,0.33,0.88,"NDC");
pt->SetFillColor(10);
pt->SetTextColor(1);
pt->SetTextSize(0.07);
pt->SetTextFont(42);
pt->SetTextAlign(11);
//TF1 *tmp1 = (TF1*)residualsPlot[i]->GetListOfFunctions()->FindObject("tmp");
TString COUT = Form("#chi^{2}/ndf=%.1f",tmp1->GetChisquare()/tmp1->GetNDF());
TText *text1 = pt->AddText(COUT);
text1->SetTextFont(72);
text1->SetTextColor(kBlue);
pt->Draw("same");
// -- for bins --
TPaveText *title = new TPaveText(0.1,0.93,0.8,0.95,"NDC");
title->SetFillColor(10);
title->SetTextColor(1);
title->SetTextSize(0.07);
title->SetTextFont(42);
title->SetTextAlign(11);
//TText *text2 = title->AddText(residualsPlot[i]->GetTitle());
//text2->SetTextFont(72);
//text2->SetTextColor(kBlue);
title->Draw("same");
fitPulls->cd(i+1);
fitPulls->cd(i+1)->SetBottomMargin(0.15);
fitPulls->cd(i+1)->SetLeftMargin(0.15);
fitPulls->cd(i+1)->SetRightMargin(0.05);
示例10: SetStyle
//.........这里部分代码省略.........
if(log){
Bbb ->Draw("histsame");
bbB ->Draw("histsame");
Cbb ->Draw("histsame");
bbX ->Draw("histsame");
Qbb ->Draw("histsame");
$DRAW_ERROR
#ifndef DROP_SIGNAL
bbH ->Draw("histsame");
#endif
}
else{
#ifndef DROP_SIGNAL
bbH ->Draw("histsame");
#endif
Bbb ->Draw("histsame");
bbB ->Draw("histsame");
Cbb ->Draw("histsame");
bbX ->Draw("histsame");
Qbb ->Draw("histsame");
$DRAW_ERROR
}
data->Draw("esame");
canv->RedrawAxis();
//CMSPrelim(dataset, "b#bar{b}", 0.17, 0.835);
CMSPrelim(dataset, "", 0.17, 0.835);
TPaveText* chan = new TPaveText(0.20, 0.74+0.061, 0.32, 0.74+0.161, "NDC");
chan->SetBorderSize( 0 );
chan->SetFillStyle( 0 );
chan->SetTextAlign( 12 );
chan->SetTextSize ( 0.05 );
chan->SetTextColor( 1 );
chan->SetTextFont ( 62 );
chan->AddText("b#bar{b}");
chan->Draw();
TPaveText* cat = new TPaveText(0.20, 0.68+0.061, 0.32, 0.68+0.161, "NDC");
cat->SetBorderSize( 0 );
cat->SetFillStyle( 0 );
cat->SetTextAlign( 12 );
cat->SetTextSize ( 0.05 );
cat->SetTextColor( 1 );
cat->SetTextFont ( 62 );
cat->AddText(category_extra);
cat->Draw();
#ifdef MSSM
TPaveText* massA = new TPaveText(0.75, 0.48+0.061, 0.85, 0.48+0.161, "NDC");
massA->SetBorderSize( 0 );
massA->SetFillStyle( 0 );
massA->SetTextAlign( 12 );
massA->SetTextSize ( 0.03 );
massA->SetTextColor( 1 );
massA->SetTextFont ( 62 );
massA->AddText("m_{A}=$MA GeV");
massA->Draw();
TPaveText* tanb = new TPaveText(0.75, 0.44+0.061, 0.85, 0.44+0.161, "NDC");
tanb->SetBorderSize( 0 );
tanb->SetFillStyle( 0 );
tanb->SetTextAlign( 12 );
tanb->SetTextSize ( 0.03 );
tanb->SetTextColor( 1 );
tanb->SetTextFont ( 62 );
示例11: makeMuVMassPlot
//.........这里部分代码省略.........
for(int i1 = 0; i1 < pContLevel->GetSize(); i1++){
for(int i2 = 0; i2 < pCurv->GetN(); i2++) {lX.push_back(pCurv->GetX()[i2]); lY.push_back(pCurv->GetY()[i2]);}
//pCurv->GetPoint(0, x0, y0);
pCurv->SetLineColor(kBlack);//kGreen+i0);
pCCurv = (TGraph*)pCurv->Clone();
if(i0 == 0) pCCurv->SetFillColor(0);
if(i0 == 1) pCCurv->SetFillColor(0);
//if(i0 == 1) pCCurv->SetLineStyle(kDashed);
pCCurv->SetLineWidth(3);
pCCurv->GetXaxis()->SetRangeUser(0,3.0);
//if(i0 == 0) pCCurv->Draw("AL");
//if(i0 != -10) pCCurv->Draw("LC");
//l.DrawLatex(x0,y0,val);
pCurv = (TGraph*)pContLevel->After(pCurv); // Get Next graph
}
TGraph *lTotal = new TGraph(lX.size(),&lX[0],&lY[0]);
lTotal->SetLineWidth(3);
lTotal->SetFillColor(kGreen+i0*2);
lTotal->SetFillStyle(3001);
//lTotal->Draw("lf");
//if(i0 == 0) lTotal->Draw("alf");
//if(i0 == 0) lTotal->Draw("alf");
//for(int iX = 0; iX < lTotal->GetN(); iX++) cout << "===> " << lTotal->GetX()[iX] << " -- " << lTotal->GetY()[iX] << endl;
//if(i0 != -10) lTotal->Draw("lfC");
bool pSwitch = false;
int pSign = -1.; if(lTotal->GetX()[0] > lTotal->GetX()[1]) pSign = 1;
double pXOld = lTotal->GetX()[lTotal->GetN()-1];
std::vector<double> pXLeft;
std::vector<double> pXRight;
std::vector<double> pYLeft;
std::vector<double> pYRight;
for(int iX = 0; iX < lTotal->GetN(); iX++) {
double pX = lTotal->GetX()[iX];
if(pSign*pX > pSign*pXOld ) {pSwitch = !pSwitch; pSign *= -1;}
if(!pSwitch) {pXLeft.push_back(lTotal->GetX()[iX]); pYLeft.push_back(lTotal->GetY()[iX]); }
if(pSwitch) {pXRight.push_back(lTotal->GetX()[iX]); pYRight.push_back(lTotal->GetY()[iX]); }
pXOld = pX;
}
TGraph *lLeftTotal = new TGraph(pXLeft.size() ,&pXLeft[0],&pYLeft[0]);
TGraph *lRightTotal = new TGraph(pXRight.size(),&pXRight[0],&pYRight[0]);
lLeftTotal->SetLineColor(kRed);
lRightTotal->SetLineColor(kBlue);
lLeftTotal->SetLineStyle(kDashed);
lRightTotal->SetLineStyle(kDashed);
//lLeftTotal->Draw("l");
//lRightTotal->Draw("l");
TGraphSmooth *lGS0 = new TGraphSmooth("normal");
TGraphSmooth *lGS1 = new TGraphSmooth("normal");
TGraph *lSmooth0 = lGS0->SmoothSuper(lRightTotal,"",0.,0.);
TGraph *lSmooth1 = lGS1->SmoothSuper(lLeftTotal,"",0.,0.) ;
lSmooth0->Draw("l");
lSmooth1->Draw("l");
std::vector<double> pXSmooth;
std::vector<double> pYSmooth;
std::vector<double> pXSmooth1;
std::vector<double> pYSmooth1;
cout << "==" << lSmooth0->GetN() << " -- " <<lSmooth1->GetN() << endl;
for(int iX = 0; iX < lSmooth0->GetN(); iX++) {pXSmooth.push_back(lSmooth0->GetX()[iX]); pYSmooth.push_back(lSmooth0->GetY()[iX]);}
for(int iX = 0; iX < lSmooth1->GetN(); iX++) {pXSmooth.push_back(lSmooth1->GetX()[lSmooth1->GetN()-iX-1]); pYSmooth.push_back(lSmooth1->GetY()[lSmooth1->GetN()-iX-1]);}
for(int iX = 0; iX < lSmooth0->GetN(); iX++) {pXSmooth1.push_back(lSmooth0->GetX()[iX]); pYSmooth1.push_back(lSmooth0->GetY()[iX]);}
for(int iX = 0; iX < lSmooth1->GetN(); iX++) {pXSmooth1.push_back(lSmooth1->GetX()[lSmooth1->GetN()-iX-1]); pYSmooth1.push_back(lSmooth1->GetY()[lSmooth1->GetN()-iX-1]);}
//if(i0 == 1) {pXSmooth1.push_back(lSmooth1->GetX()[0]); pYSmooth1.push_back(lSmooth1->GetY()[0]);}
TGraph *pSmoothShape = new TGraph(pXSmooth.size() ,&pXSmooth [0],&pYSmooth [0]);
TGraph *pSmoothShape1 = new TGraph(pXSmooth1.size(),&pXSmooth1[0],&pYSmooth1[0]);
if(i0 == 1) {TLine *lLine = new TLine(pXSmooth1[0],pYSmooth1[0],pXSmooth1[pXSmooth1.size()-1],pYSmooth1[pYSmooth1.size()-1]); lLine->Draw();}
pSmoothShape1->SetLineColor(kBlack);
pSmoothShape1->SetLineWidth(2);
pSmoothShape->SetFillColor(kGreen+i0*2);
pSmoothShape->SetFillStyle(3001);
pSmoothShape->Draw("lf");
pSmoothShape1->Draw("l");
if(i0 == 0) lL->AddEntry(lTotal,"95% CL","lf");
if(i0 == 1) lL->AddEntry(lTotal,"68% CL","lf");
}
lL->AddEntry(lSecond,"BestFit","p");
lSecond->Draw("lp");
lL->Draw();
std::string masslabel = "m_{H}"; double mass = 125;
TString label = TString::Format("%s = 135 GeV", masslabel.c_str());//, 125.);
TPaveText* textlabel = new TPaveText(0.18, 0.81, 0.50, 0.90, "NDC");
textlabel->SetBorderSize( 0 );
textlabel->SetFillStyle ( 0 );
textlabel->SetTextAlign ( 12 );
textlabel->SetTextSize (0.04 );
textlabel->SetTextColor ( 1 );
textlabel->SetTextFont ( 62 );
textlabel->AddText(label);
//textlabel->Draw();
CMSPrelim("Preliminary, H#rightarrow#tau#tau,L = 24.3 fb^{-1}", "", 0.145, 0.835);
gPad->RedrawAxis();
lCan->Update();
lCan->SaveAs("cmb+_muvmass.png");
lCan->SaveAs("cmb+_muvmass.pdf");
lCan->SaveAs("cmb+_muvmass.eps");
}
示例12: 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;
};
示例13: SetStyle
//.........这里部分代码省略.........
if(errorBand->GetBinContent(idx)>0){
std::cout << "Uncertainties on summed background samples: " << errorBand->GetBinError(idx)/errorBand->GetBinContent(idx) << std::endl;
break;
}
}
//if(log){
ZZ ->Draw("histsame");
Zjets->Draw("histsame");
$DRAW_ERROR
#ifndef DROP_SIGNAL
ZH_htt ->Draw("histsame");
#endif
//}
//else{
//#ifndef DROP_SIGNAL
// ggH ->Draw("histsame");
//#endif
// Ztt ->Draw("histsame");
// ttbar->Draw("histsame");
// EWK ->Draw("histsame");
// Fakes->Draw("histsame");
// $DRAW_ERROR
// }
data->Draw("esame");
canv->RedrawAxis();
// //CMSPrelim(dataset, "#tau_{e}#tau_{#mu}", 0.17, 0.835);
CMSPrelim(dataset, "", 0.16, 0.835);
TPaveText* chan = new TPaveText(0.20, 0.74+0.061, 0.32, 0.74+0.161, "NDC");
chan->SetBorderSize( 0 );
chan->SetFillStyle( 0 );
chan->SetTextAlign( 12 );
chan->SetTextSize ( 0.05 );
chan->SetTextColor( 1 );
chan->SetTextFont ( 62 );
if (directory=="eett_zh")
chan->AddText("#tau#tau");
else
chan->AddText("#mu#mu#tau#tau");
chan->Draw();
//
// TPaveText* cat = new TPaveText(0.20, 0.68+0.061, 0.32, 0.68+0.161, "NDC");
// cat->SetBorderSize( 0 );
// cat->SetFillStyle( 0 );
// cat->SetTextAlign( 12 );
// cat->SetTextSize ( 0.05 );
// cat->SetTextColor( 1 );
// cat->SetTextFont ( 62 );
// cat->AddText(category_extra);
// cat->Draw();
//
//#ifdef MSSM
// TPaveText* massA = new TPaveText(0.75, 0.48+0.061, 0.85, 0.48+0.161, "NDC");
// massA->SetBorderSize( 0 );
// massA->SetFillStyle( 0 );
// massA->SetTextAlign( 12 );
// massA->SetTextSize ( 0.03 );
// massA->SetTextColor( 1 );
// massA->SetTextFont ( 62 );
// massA->AddText("m_{A}=$MAGeV");
// massA->Draw();
//
// TPaveText* tanb = new TPaveText(0.75, 0.44+0.061, 0.85, 0.44+0.161, "NDC");
// tanb->SetBorderSize( 0 );
// tanb->SetFillStyle( 0 );
// tanb->SetTextAlign( 12 );
示例14: PlotChargeFieldFocus2D
//.........这里部分代码省略.........
TLine *lineEndNeutral = new TLine(zEndNeutral,ymin,zEndNeutral,ymax);
lineEndNeutral->SetLineColor(kGray+1);
lineEndNeutral->SetLineStyle(2);
lineEndNeutral->SetLineWidth(2);
// Plotting
// -----------------------------------------------
// Canvas setup
TCanvas *C;
if(opt.Contains("hres") && !opt.Contains("pdf")) // high resolution for plain grahics output.
C = new TCanvas("C","2D Charge density, Accelerating and focusing fields",1500,2000);
else
C = new TCanvas("C","2D Charge density, Accelerating and focusing fields",750,1000);
// Palettes setup
TExec *exPlasma = new TExec("exPlasma","plasmaPalette->cd();");
TExec *exHot = new TExec("exHot","hotPalette->cd();");
TExec *exElec = new TExec("exElec","electronPalette->cd();");
TExec *exField = new TExec("exField","rbow2Palette->cd();");
// Text objects
TPaveText *textTime = new TPaveText(0.7,0.83,0.85,0.90,"NDC");
PlasmaGlob::SetPaveTextStyle(textTime,32);
char ctext[128];
if(opt.Contains("units") && n0)
sprintf(ctext,"z = %5.1f #mum", Time * skindepth / PUnits::um);
else
sprintf(ctext,"t = %5.1f #omega_{p}^{-1}",Time);
textTime->AddText(ctext);
TPaveText *textDen = new TPaveText(0.13,0.83,0.38,0.90,"NDC");
PlasmaGlob::SetPaveTextStyle(textDen,12);
textDen->SetTextColor(kOrange+10);
if(opt.Contains("units") && n0)
sprintf(ctext,"n_{0} = %5.2f x 10^{15} / cm^{3}", 1e-15 * n0 * PUnits::cm3);
else if(pData->GetBeamDensity() && n0)
sprintf(ctext,"n_{b}/n_{0} = %5.2f", pData->GetBeamDensity()/n0);
textDen->AddText(ctext);
TPaveText *textWav = new TPaveText(0.13,0.75,0.38,0.82,"NDC");
PlasmaGlob::SetPaveTextStyle(textWav,12);
textWav->SetTextColor(kGray+2);
sprintf(ctext,"#lambda_{p} = %5.3f mm", skindepth * TMath::TwoPi() / PUnits::um);
textWav->AddText(ctext);
// Actual Plotting!
// ------------------------------------------------------------
// Output file
TString fOutName = Form("./%s/Plots/ChargeFieldFocus2D/ChargeFieldFocus2D",pData->GetPath().c_str());
fOutName += Form("-%s_%i",pData->GetName(),time);
// Setup Pad layout:
Double_t lMargin = 0.10;
Double_t rMargin = 0.12;
Double_t bMargin = 0.10;
Double_t tMargin = 0.02;
Double_t vSpacing = 0.01;
Double_t hStep = (1.-lMargin-rMargin);
Double_t vStep = (1.-bMargin-tMargin)/3.;
TPad *pad[3];
示例15: plotRegrVsNoRegr
void plotRegrVsNoRegr(int channel, int massBin) {
stringstream filenom, filenoregr;
filenom << "m4lplots/nominal/fitM" << massBin << "_channel" << channel << ".root";
filenoregr << "m4lplots/noregr/fitM" << massBin << "_channel" << channel << ".root";
int col;
if(channel==0) col=kOrange+7;
if(channel==1) col=kAzure+2;
if(channel==2) col=kGreen+3;
TCanvas *c1 = new TCanvas("c1","c1",750,750);
TFile *tfilenom = TFile::Open(filenom.str().c_str());
RooPlot *plotnom = (RooPlot*)tfilenom->Get("m4lplot");
plotnom->SetMarkerStyle(kOpenSquare);
plotnom->Draw();
TPaveText *pavenom = (TPaveText*)tfilenom->Get("TPave");
pavenom->SetTextColor(col);
pavenom->Draw("same");
TFile *tfilenoregr = TFile::Open(filenoregr.str().c_str());
RooPlot *plotnoregr = (RooPlot*)tfilenoregr->Get("m4lplot");
plotnoregr->Draw("same");
TPaveText *pavenoregr = (TPaveText*)tfilenoregr->Get("TPave");
pavenoregr->Draw("same");
// cosmetics
TLegend *legend = new TLegend(0.20,0.45,0.45,0.60,NULL,"brNDC");
legend->SetBorderSize( 0);
legend->SetFillColor ( 0);
legend->SetTextAlign ( 12);
legend->SetTextFont ( 42);
legend->SetTextSize (0.03);
TH1F *dummyPointsNom = new TH1F("dummyPNom","dummyPNom",1,0,1);
TH1F *dummyPointsNoRegr = new TH1F("dummyPNoregr","dummyPNoregr",1,0,1);
TH1F *dummyLine = new TH1F("dummyL","dummyL",1,0,1);
dummyPointsNoRegr->SetMarkerStyle(kFullCircle);
dummyPointsNoRegr->SetMarkerSize(1.1);
dummyPointsNom->SetMarkerStyle(kFullSquare);
dummyPointsNom->SetMarkerColor(col);
dummyPointsNom->SetLineColor(col);
dummyPointsNom->SetMarkerSize(1.1);
dummyLine->SetLineColor(col);
legend->AddEntry(dummyPointsNoRegr, "Simulation (E_{std}-p comb.)", "pel");
legend->AddEntry(dummyPointsNom, "Simulation (E_{regr}-p comb.)", "pel");
legend->Draw();
TPaveText *text = new TPaveText(0.15,0.90,0.77,0.98,"brNDC");
text->AddText("CMS Simulation");
text->SetBorderSize(0);
text->SetFillStyle(0);
text->SetTextAlign(12);
text->SetTextFont(42);
text->SetTextSize(0.03);
text->Draw();
stringstream frameTitle;
if(channel==0){frameTitle << "4#mu, m_{H} = ";}
if(channel==1){frameTitle << "4e, m_{H} = ";}
if(channel==2){frameTitle << "2e2#mu, m_{H} = ";}
frameTitle << massBin << " GeV";
TPaveText *titlet = new TPaveText(0.15,0.80,0.60,0.85,"brNDC");
titlet->AddText(frameTitle.str().c_str());
titlet->SetBorderSize(0);
titlet->SetFillStyle(0);
titlet->SetTextAlign(12);
titlet->SetTextFont(132);
titlet->SetTextSize(0.045);
titlet->Draw();
c1->SaveAs("comp.pdf");
}