本文整理汇总了C++中TLine::SetLineColor方法的典型用法代码示例。如果您正苦于以下问题:C++ TLine::SetLineColor方法的具体用法?C++ TLine::SetLineColor怎么用?C++ TLine::SetLineColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLine
的用法示例。
在下文中一共展示了TLine::SetLineColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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));
}
示例2: TrialVisualizer
void TrialVisualizer()
{
Double_t width = 20;
Double_t xlow = 0;
Double_t xhi = 50;
Double_t x1=10;
for (Int_t i=0; i<n; i++)
{
TH1F *h = new TH1F(TString::Format("h%i",i),"",50,0,50);
Fill(h);
TLine *ll = new TLine(x1, 0, x1, 20);
ll->SetLineColor(3);
ll->SetLineWidth(3);
vlo.push_back(ll);
TLine *lh = new TLine(x1+width, 0, x1+width, 20);
lh->SetLineColor(3);
lh->SetLineWidth(3);
vhi.push_back(lh);
}
Visualizer vis;
vis.SetNRows(1);
vis.SetNColumns(4);
vis.Draw("h%i");
vis.DrawLines(vlo,"canvas=h color=3");
vis.DrawLines(vhi,"canvas=h color=2");
}
示例3: 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));
}
示例4: 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 );
}
示例5: PlotMinEtFromSim
void PlotMinEtFromSim(Bool_t isPhos = kFALSE){
gStyle->SetOptTitle(0);
gStyle->SetOptStat(0);
gStyle->SetOptFit(0);
Float_t min = 0;
float max = 1;
TString filename, detname;
if(isPhos){
min = 0.655;
max = 0.785;
detname = "PHOS";
filename = "rootFiles/LHC11a10a_bis/Et.ESD.simPbPb.PHOS.LHC11a10a_bis.Run139465.root";
}
else{
min = 0.58;
max = 0.725;
filename = "rootFiles/LHC11a10a_bis/Et.ESD.simPbPb.EMCal.LHC11a10a_bis.Run139465.root";
detname = "EMCal";
}
TFile *f = TFile::Open(filename, "READ");
TList *l = dynamic_cast<TList*>(f->Get("out1"));
TH1F *fHistSimulatedGammaEnergyAboveThreshold = l->FindObject("fHistSimulatedGammaEnergyAboveThreshold");
TH1F *fHistSimulatedGammaEnergy = l->FindObject("fHistSimulatedGammaEnergy");
SetStyles(fHistSimulatedGammaEnergyAboveThreshold,20,TColor::kRed);
fHistSimulatedGammaEnergyAboveThreshold->Divide(fHistSimulatedGammaEnergy);
TCanvas *c1 = new TCanvas("c1","Simulation",600,400);
c1->SetTopMargin(0.02);
c1->SetRightMargin(0.03);
c1->SetLeftMargin(0.11745);
c1->SetBottomMargin(0.11745);
c1->SetBorderSize(0);
c1->SetFillColor(0);
c1->SetFillColor(0);
c1->SetBorderMode(0);
c1->SetFrameFillColor(0);
c1->SetFrameBorderMode(0);
fHistSimulatedGammaEnergyAboveThreshold->SetMaximum(max +0.1);
fHistSimulatedGammaEnergyAboveThreshold->SetMinimum(min-0.1);
fHistSimulatedGammaEnergyAboveThreshold->GetXaxis()->SetTitle("Centrality bin");
fHistSimulatedGammaEnergyAboveThreshold->GetYaxis()->SetTitle("f_{minEt}");
fHistSimulatedGammaEnergyAboveThreshold->GetYaxis()->SetLabelSize(0.06);
fHistSimulatedGammaEnergyAboveThreshold->GetXaxis()->SetLabelSize(0.06);
fHistSimulatedGammaEnergyAboveThreshold->GetYaxis()->SetTitleSize(0.06);
fHistSimulatedGammaEnergyAboveThreshold->GetXaxis()->SetTitleSize(0.06);
fHistSimulatedGammaEnergyAboveThreshold->Draw();
TLine *lineMin = new TLine(-0.5,min,19.5,min);
lineMin->Draw();
TLine *lineMax = new TLine(-0.5,max,19.5,max);
lineMax->Draw();
lineMin->SetLineColor(TColor::kBlue);
lineMax->SetLineColor(TColor::kBlue);
lineMin->SetLineStyle(2);
lineMax->SetLineStyle(2);
TString outfile = "/tmp/MinEtFromSim"+detname+".png";
c1->SaveAs(outfile.Data());
}
示例6: drawcutline
void drawcutline(double cutval, double maximum)
{
TLine *cut = new TLine();
cut->SetLineWidth(3);
cut->SetLineColor(28);
cut->DrawLine(cutval,0.,cutval,maximum);
}
示例7: myBoxText
void myBoxText(Double_t x, Double_t y,Double_t boxsize,Int_t mcolor,char *text)
{
Double_t tsize=0.06;
TLatex l; l.SetTextAlign(12); //l.SetTextSize(tsize);
l.SetNDC();
l.DrawLatex(x,y,text);
Double_t y1=y-0.25*tsize;
Double_t y2=y+0.25*tsize;
Double_t x2=x-0.3*tsize;
Double_t x1=x2-boxsize;
printf("x1= %f x2= %f y1= %f y2= %f \n",x1,x2,y1,y2);
TPave *mbox= new TPave(x1,y1,x2,y2,0,"NDC");
mbox->SetFillColor(mcolor);
mbox->SetFillStyle(1001);
mbox->Draw();
TLine mline;
mline.SetLineWidth(4);
mline.SetLineColor(1);
mline.SetLineStyle(1);
Double_t y_new=(y1+y2)/2.;
mline.DrawLineNDC(x1,y_new,x2,y_new);
}
示例8: plotAndProfileXSpread
// Draw a 2-D plot within the specified Y range and superimpose its X profile,
// setting as sigmas that of the fit (and not the error of the mean)
void plotAndProfileXSpread (TH2* h2, float min, float max, bool profile=false, float ymin=-5., float ymax=5.) {
setStyle(h2);
gPad->SetGrid(1,1);
gStyle->SetGridColor(15);
gStyle->SetOptStat(0);
// h2->RebinX(3);
// h2->RebinY(2);
// h2->SetXTitle("distance from anode (cm)");
// h2->SetYTitle("(d_{reco}-d_{sim})/#sigma_{reco}");
h2->SetMarkerColor(2);
h2->SetLineColor(2);
h2->GetYaxis()->SetTitleOffset(1.4);
h2->GetXaxis()->SetRangeUser(min,max);
h2->GetYaxis()->SetRangeUser(ymin,ymax);
h2->DrawCopy("box");
if (profile) {
TProfile* prof = h2->ProfileX("profile",-1,-1,"s");
prof->SetMarkerStyle(20);
prof->SetMarkerSize(1.2);
prof->SetMarkerColor(1);
prof->SetLineColor(1);
prof->SetLineWidth(2);
prof->DrawCopy("same e1");
delete prof;
}
TLine * l = new TLine(h2->GetXaxis()->GetXmin(),0,h2->GetXaxis()->GetXmax(),0);
l->SetLineColor(3);
l->Draw();
}
示例9: plotLLRdistribution
void plotLLRdistribution(TTree *tree_, TFile *fdata_){
TCanvas *c = new TCanvas("llr","",960,800);
tree_->Draw("0*nll_nll0>>htemp_llr(100,0,4)","mu<0");
tree_->Draw("-2*nll_nll0>>htemp_llr_2(100,0,4)","mu>=0");
TH1F *ht0 = (TH1F*) gROOT->FindObject("htemp_llr");
TH1F *htmu = (TH1F*) gROOT->FindObject("htemp_llr_2");
ht0->Add(htmu);
ht0->GetXaxis()->SetRangeUser(0,4);
ht0->SetFillColor(kGray+3); ht0->SetLineColor(1);
ht0->GetXaxis()->SetTitle("-2 #times llr");
ht0->SetTitle("");
ht0->Scale(1./ht0->Integral());
ht0->GetYaxis()->SetTitleOffset(1.2); ht0->GetYaxis()->SetTitle("probability");
ht0->Draw();
if (fdata_!=0) {
TTree* trdata_ = (TTree*)fdata_->Get("tree_fit_sb");
double res; trdata_->SetBranchAddress("nll_nll0",&res);
trdata_->GetEntry(0);
double q0_obs = -2*res;
TLine* ldata = new TLine(q0_obs,0,q0_obs,ht0->GetMaximum());
ldata->SetLineColor(2);
ldata->SetLineWidth(2); ldata->Draw();
std::cout << "-2xllr observed = " << q0_obs << std::endl;
}
c->SetLogy();
c->SaveAs("llrdist.pdf");
}
示例10: drawline
void drawline(double xpos, int colour, int style)
{
TLine *line = new TLine(xpos,0,xpos,15);
line->SetLineStyle(style);
line->SetLineColor(colour);
line->Draw();
}
示例11: 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);
}
示例12: loglikdistrib
void loglikdistrib(Int_t ntrials = 10000, Bool_t print = kFALSE)
{
// compute distribution of log likelihood value
TH1D * hmc = gStack[gPadNr][gOrder[gPadNr][0]];
TH1D * hdata = gStack[gPadNr][gMaxProcess-1];
Int_t nbins = hmc->GetNbinsX();
Double_t loglik = loglikelihood(hmc, hdata, 1, nbins);
TH1D * htest = new TH1D(*hdata);
TH1D * lldistrib = new TH1D("lldistrib", "log(Likelihood) distribution",
1000, loglik-200, loglik+200);
setopt(lldistrib);
for (Int_t n = 0; n < ntrials; n++) {
// generate poisson around theorie
for (Int_t i = 1; i <= nbins; i++) {
htest->SetBinContent(i, gRandom->Poisson(hmc->GetBinContent(i)));
}
lldistrib->Fill(loglikelihood(hmc, htest, 1, nbins));
}
TCanvas * llcanvas = new TCanvas("llcanvas", "Log(Likelihood) distribution",
40, 40, 800, 600);
setopt(llcanvas);
lldistrib->SetFillColor(kYellow);
lldistrib->Draw();
lldistrib->GetYaxis()->SetTitle("Anzahl Ereignisse");
lldistrib->GetXaxis()->SetTitle("-ln L");
// autozoom
Int_t lowbin = 1;
while (lldistrib->GetBinContent(lowbin) == 0)
lowbin++;
Int_t highbin = lldistrib->GetNbinsX();
while (lldistrib->GetBinContent(highbin) == 0)
highbin--;
lldistrib->SetAxisRange(lldistrib->GetBinLowEdge(lowbin),
lldistrib->GetBinLowEdge(highbin));
TH1D * hworse = (TH1D *) lldistrib->Clone();
for (Int_t nbin = 1; nbin < 501; nbin++) {
hworse->SetBinContent(nbin, 0);
}
hworse->SetFillColor(95);
hworse->Draw("same");
Double_t pvalue = lldistrib->Integral(501,1000) / lldistrib->Integral();
TLatex * tex = new TLatex(0.18, 0.96, Form("-ln L_{obs} = %5.2f", loglik));
tex->SetNDC();
tex->SetTextAlign(13);
tex->Draw();
tex = new TLatex(0.18, 0.86, Form("CL_{obs} = %.3f", pvalue));
tex->SetNDC();
tex->SetTextAlign(13);
tex->Draw();
TLine * l = new TLine(loglik, 0, loglik, lldistrib->GetMaximum());
l->SetLineWidth(3);
l->SetLineColor(kBlue);
l->Draw();
llcanvas->Modified();
llcanvas->Update();
if (print)
llcanvas->Print("lldistrib.pdf");
cd(gPadNr+1);
}
示例13: 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) ;
}
示例14: 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();
}
示例15: DrawShashlikModule
void DrawShashlikModule(TPad* cc){
cc->cd();
for (int i=0; i<5; i++) {
// TString name = Form ("vert_%d",i);
// TLine* vert = new TLine (name.Data(),i*14-28,-28,i*14-28,28);
TLine* vert = new TLine (i*14-28,-28,i*14-28,28);
vert->SetLineColor(kRed);
vert->DrawClone("same");
}
for (int i=0; i<5; i++) {
// TString name = Form ("oriz_%d",i);
// TLine* oriz = new TLine (name.Data(),-28,i*14-28,28,i*14-28);
TLine* oriz = new TLine (-28,i*14-28,28,i*14-28);
oriz->SetLineColor(kRed);
oriz->DrawClone("same");
}
}