本文整理汇总了C++中TBox::SetLineWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ TBox::SetLineWidth方法的具体用法?C++ TBox::SetLineWidth怎么用?C++ TBox::SetLineWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBox
的用法示例。
在下文中一共展示了TBox::SetLineWidth方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawSysBox
void drawSysBox(TGraph* gr, int fillcolor=TColor::GetColor("#ffff00"), double xwidth=0.3, double percent=0, double xshift=0)
{
TBox* box;
for(int n=0;n<gr->GetN();n++)
{
double x,y;
gr->GetPoint(n,x,y);
//double percent=0;
//if(x>=260) percent=0.074;
//else if(x<260 && x>=200) percent=0.055;
//else percent=0.039;
double yerr = y*percent*0.01;
box = new TBox(x+xshift-xwidth,y-fabs(yerr),x+xwidth,y+fabs(yerr));
//box->SetFillStyle(3001);
//box->SetFillColor(fillcolor);
//box->SetFillColor(2);
box->SetLineWidth(0);
box->SetFillColor(kGray);
box->Draw("Fsame");
//box->Draw();
}
}
示例2: drawSysBoxValue
void drawSysBoxValue(TGraph* gr, int fillcolor=TColor::GetColor("#ffff00"), double xwidth=0.3, double *percent, double xshift=0)
{
TBox* box;
for(int n=0;n<gr->GetN();n++)
{
double x,y;
gr->GetPoint(n,x,y);
double yerr = percent[n]*1.0;
box = new TBox(x+xshift-xwidth,y-fabs(yerr),x+xwidth,y+fabs(yerr));
//box->SetFillStyle(3001);
//box->SetFillColor(fillcolor);
//box->SetFillColor(2);
box->SetLineWidth(0);
box->SetFillColor(kGray);
box->Draw("Fsame");
//box->Draw();
}
}
示例3: DrawTargetBoundaries
//--------------------------
// DrawTargetBoundaries
//--------------------------
void DrawTargetBoundaries(int color=target_color)
{
double Zlo = 50.0;
double Zhi = Zlo + 30.0;
double Rlo = 0.0;
double Rhi = Rlo + 1.5;
if (full) { Rlo=-1.5; Rhi=Rlo+3; }
TBox *box = new TBox(Zlo, Rlo, Zhi, Rhi);
box->SetLineWidth(2.0);
if (fill_detectors) { box->SetFillColor(color); box->SetFillStyle(1001); }
else box->SetFillStyle(0);
box->SetLineColor(color);
box->Draw();
TLatex *lab = new TLatex(Zlo-5, 0, "target");
if (full) lab->SetTextAlign(32); else lab->SetTextAlign(31);
lab->SetTextSize(0.02);
lab->SetTextColor(color);
lab->Draw();
}
示例4: DrawWaveform
void DrawWaveform(char *file, int event, int col, int row, bool common_mode_subtract = false) {
TFile *f1 = new TFile(file);
TTree *EventTree = (TTree *) f1->Get("EventTree");
float ASIC_ADC[4][4][8][4][64];
unsigned short int ASIC_OriginWindow[4][4][8][4];
bool ASIC_TriggerStream[4][4][8][16];
EventTree->SetBranchAddress("ASIC_ADC",ASIC_ADC);
EventTree->SetBranchAddress("ASIC_OriginWindow",ASIC_OriginWindow);
EventTree->SetBranchAddress("ASIC_TriggerStream",ASIC_TriggerStream);
TCanvas *C = new TCanvas("Waveforms","Waveforms",1024,768);
C->Divide(4,2);
TGraph *graph[8];
while(1) {
EventTree->GetEvent(event);
for (int i = 0; i < 8; ++i) {
graph[i] = NULL;
}
for (int ch = 0; ch < 8; ++ch) {
if (graph[ch]) {
delete graph[ch];
}
graph[ch] = new TGraph();
for (int i = 0; i < 4; ++i) {
int this_origin_window = ASIC_OriginWindow[col][row][ch][i];
for (int j = 0; j < 64; ++j) {
float value = ASIC_ADC[col][row][ch][i][j];
if (common_mode_subtract) {
value -= ASIC_ADC[col][row][(ch+1)%8][i][j];
}
graph[ch]->SetPoint(i*64+j,(float) i*64+j,value);
}
}
C->cd(ch+1);
graph[ch]->Draw("APL");
double low = graph[ch]->GetYaxis()->GetXmin();
double high = graph[ch]->GetYaxis()->GetXmax();
for (int i = 0; i < 4*2; ++i) {
int offset = 2;
// cout << "Checking window " << offset + i << " : " << ASIC_TriggerStream[col][row][ch][offset+i] << endl;
if (ASIC_TriggerStream[col][row][ch][offset+i]) {
int window = 8 - i - 1;
TBox *highlight = new TBox(window*32,low,(window+1)*32,high);
highlight->SetFillColor(kRed);
highlight->SetLineColor(kRed);
highlight->SetLineWidth(2);
highlight->SetFillStyle(0);
highlight->Draw();
}
}
bool any_hit = false;
for (int i = 0; i < 16; ++i) {
if (ASIC_TriggerStream[col][row][ch][offset+i]) {
any_hit = true;
break;
}
}
cout << "Window begin at: " << ASIC_OriginWindow[col][row][ch][0] << endl;
cout << "Hit status (from trigger stream): " << any_hit << endl;
}
C->Modified();
C->Update();
getchar();
event++;
}
}
示例5: NuclearModificationY
//.........这里部分代码省略.........
yFONLL[i]=yRpA[i];
yPercRpAsystFONLLhigh[i]=(yPercPPsystFONLLlow[i]/(1-yPercPPsystFONLLlow[i]));
yPercRpAsystFONLLlow[i]=(yPercPPsystFONLLhigh[i]/(1+yPercPPsystFONLLhigh[i]));
yRpAsystFONLLhigh[i]=yPercRpAsystFONLLhigh[i]*yRpA[i];
yRpAsystFONLLlow[i]=yPercRpAsystFONLLlow[i]*yRpA[i];
yRpPbSystTotHigh[i]=yPercSigmapPbSystTotHigh[i]*yRpA[i];
yRpPbSystTotLow[i]=yPercSigmapPbSystTotLow[i]*yRpA[i];
std::cout << i << " , " << xbins[i] << " , " << ySigmapPb[i] << " , sta: " << ySigmapPbStat[i] << " , syslow: " << ySigmapPbSystTotLow[i] << " ,syshigh: " << ySigmapPbSystTotHigh[i] << std::endl;
std::cout << "FONLL: " << yRefPP[i] << " - " << yPPsystFONLLlow[i] << " + " << yPPsystFONLLhigh[i] << std::endl;
std::cout << i << " ####### " << xbins[i] << " , " << yRpA[i] << " , sta: " << yRpAStat[i] << " , syslow: " << yRpPbSystTotLow[i] << " ,syshigh: " << yRpPbSystTotHigh[i] << " ,FONLLlow: " << yRpAsystFONLLlow[i] << " , FONLLhigh: " << yRpAsystFONLLhigh[i] << std::endl;
}
//RFB stuff
//central value
yRFB[0] = ySigmapPb[3]/ySigmapPb[2];
yRFB[1] = ySigmapPb[4]/ySigmapPb[1];
//Stat.
yRFBStat[0] = yRFB[0]*sqrt(pow(ySigmapPbStat[2]/ySigmapPb[2],2)+pow(ySigmapPbStat[3]/ySigmapPb[3],2));
yRFBStat[1] = yRFB[1]*sqrt(pow(ySigmapPbStat[4]/ySigmapPb[4],2)+pow(ySigmapPbStat[1]/ySigmapPb[1],2));
//Syst.
yRFBSystTotHigh[0] = yRFB[0]*yRFBSystTotHighRel[0];
yRFBSystTotLow[0] = yRFB[0]*yRFBSystTotLowRel[0];
yRFBSystTotHigh[1] = yRFB[1]*yRFBSystTotHighRel[1];
yRFBSystTotLow[1] = yRFB[1]*yRFBSystTotLowRel[1];
TGraphAsymmErrors *gSigmasyst = new TGraphAsymmErrors(nbins,xbins,ySigmapPb,exl2,exl2,ySigmapPbSystTotLow,ySigmapPbSystTotHigh);
//###TGraphAsymmErrors *gSigmasyst = new TGraphAsymmErrors(nbins,xbins,ySigmapPb,exl,exl,ySigmapPbSystTotLow,ySigmapPbSystTotHigh);
gSigmasyst->SetTitle("Sigma syst uncertainty from pPb");
gSigmasyst->SetMarkerColor(1);
gSigmasyst->SetLineColor(1);
gSigmasyst->SetLineWidth(3);
gSigmasyst->SetMarkerStyle(21);
gSigmasyst->SetMarkerColor(1);
gSigmasyst->SetFillColor(kYellow-7);//5
gSigmasyst->SetFillStyle(1001);
TGraphAsymmErrors*gSigmasyst2=(TGraphAsymmErrors*)gSigmasyst->Clone();
gSigmasyst2->SetMarkerColor(1);
gSigmasyst2->SetMarkerStyle(25);
gSigmasyst2->SetFillColor(0);
gSigmasyst2->SetFillStyle(0);
gSigmasyst2->SetLineColor(1);//5
gSigmasyst2->SetLineStyle(1);
gSigmasyst2->SetLineWidth(3);
//###TGraphAsymmErrors *gSigmastat = new TGraphAsymmErrors(nbins,xbins,ySigmapPb,exl,exl,ySigmapPbStat,ySigmapPbStat);
TGraphAsymmErrors *gSigmastat = new TGraphAsymmErrors(nbins,xbins,ySigmapPb,exl0,exl0,ySigmapPbStat,ySigmapPbStat);
gSigmastat->SetTitle("Sigma stat uncertainty from pPb");
gSigmastat->SetMarkerColor(1);
gSigmastat->SetLineColor(1);
gSigmastat->SetLineWidth(3);
gSigmastat->SetMarkerStyle(21);
gSigmastat->SetMarkerColor(1);
gSigmastat->SetFillColor(0);
gSigmastat->SetFillStyle(0);
//###TCanvas *canvasSigma=new TCanvas("canvasSigma","canvasSigma",600,500);
TCanvas *canvasSigma=new TCanvas("canvasSigma","canvasSigma",500,500);
示例6: Optimize2D
void Optimize2D(TString signal, TString background, TString histname,
int minxwidth = 2, int minywidth = 2, float minsigeff=0.5){
TFile *sigfile = TFile::Open(signal);
TFile *bkgfile = TFile::Open(background);
TH2F *sighist = (TH2F*)sigfile->Get(histname);
TH2F *bkghist = (TH2F*)bkgfile->Get(histname);
int nxbins = sighist->GetNbinsX();
int nybins = sighist->GetNbinsY();
if ( nxbins != bkghist->GetNbinsX() || nybins != bkghist->GetNbinsY() ) {
cout << "Error! The two input histograms do not have the same number of bins!" << endl;
return; }
int nsigtot = sighist->Integral(1,nxbins,1,nybins);
int nbkgtot = bkghist->Integral(1,nxbins,1,nybins);
cout << "Total number of entries in the signal histogram: " << nsigtot << endl;
cout << "Total number of entries in the bkgrnd histogram: " << nbkgtot << endl;
if ( nsigtot==0 || nbkgtot==0 ) {
cout << "Error! At least one of the input histograms is empty!" << endl;
return; }
TH1D *projx = sighist->ProjectionX("projx");
TH1D *projy = sighist->ProjectionY("projy");
float bestsob = (float)nsigtot / nbkgtot;
cout << "Starting with a \"no-cuts\" s/b of " << bestsob << endl;
float x1=0, y1=0, x2=0, y2=0; // corner coordinates for the window
for (int i=1; i<=nxbins; ++i)
for (int j=minxwidth-1; i+j<=nxbins; ++j)
for (int k=1; k<=nybins; ++k)
for (int l=minywidth-1; k+l<=nybins; ++l) {
int nsig = sighist->Integral(i, i+j, k, k+l);
if ( nsig == 0 ) continue;
if ( nsig < nsigtot*minsigeff ) continue;
int nbkg = bkghist->Integral(i, i+j, k, k+l);
if ( nbkg == 0 ) continue;
float sob = (float)nsig / nbkg;
if ( (float)nsig / nbkg > bestsob ) {
bestsob = sob;
x1 = projx->GetBinLowEdge(i);
x2 = projx->GetBinLowEdge(i+j+1);
y1 = projy->GetBinLowEdge(k);
y2 = projy->GetBinLowEdge(k+l+1);
cout << "x-range " << i << " (" << x1
<< ") to " << i+j << " (" << x2
<< ") ; \t y-range " << k << " (" << y1
<<") to " << k+l << " (" << y2
<< ") ; \t signal= " << nsig
<< " bkgrnd= " << nbkg << " s/b= " << sob << endl;
}
}
TCanvas *cnv = TCanvas::MakeDefCanvas();
cnv->Divide(2);
TBox *box = new TBox(x1, y1, x2, y2);
box->SetFillStyle(0);
box->SetLineColor(2);
box->SetLineWidth(2);
cnv->cd(1); sighist->Draw("colbox"); box->Draw();
cnv->cd(2); bkghist->Draw("colbox"); box->Draw();
cnv->SaveAs("Optimize2D"+histname+".eps");
}
示例7: makePlotsPP
void makePlotsPP(Settings s)
{
for(int j = 0; j<s.nTriggers; j++)
{
s.ppByTrigger[j]->SetLineColor(j+1);
s.ppByTrigger[j]->SetLineWidth(1);
s.ppByTrigger[j]->SetMarkerColor(j+1);
s.ppByTrigger[j]->SetFillColor(j+1);
s.ppUsedByTrigger[j]->SetLineColor(kBlack);
s.ppUsedByTrigger[j]->SetLineWidth(2);
s.ppUsedByTrigger[j]->SetMarkerColor(j+1);
s.ppUsedByTrigger[j]->SetMarkerSize(0);
s.ppUsedByTrigger[j]->SetFillColor(j+1);
s.ppJetsByTrigger[j]->SetLineColor(j+1);
s.ppJetsByTrigger[j]->SetLineWidth(1);
s.ppJetsByTrigger[j]->SetMarkerColor(j+1);
s.ppJetsByTrigger[j]->SetMarkerSize(0.8);
s.ppJetsByTrigger[j]->SetFillColor(j+1);
}
for(int j = 0; j<s.nTriggers_trk; j++)
{
s.ppByTrigger_trk[j]->SetLineColor(j+1);
s.ppByTrigger_trk[j]->SetLineWidth(1);
s.ppByTrigger_trk[j]->SetMarkerColor(j+1);
s.ppByTrigger_trk[j]->SetFillColor(j+1);
s.ppUsedByTrigger_trk[j]->SetLineColor(kBlack);
s.ppUsedByTrigger_trk[j]->SetLineWidth(2);
s.ppUsedByTrigger_trk[j]->SetMarkerColor(j+1);
s.ppUsedByTrigger_trk[j]->SetMarkerSize(0);
s.ppUsedByTrigger_trk[j]->SetFillColor(j+1);
s.ppMaxtrkByTrigger[j]->SetLineColor(j+1);
s.ppMaxtrkByTrigger[j]->SetLineWidth(1);
s.ppMaxtrkByTrigger[j]->SetMarkerColor(j+1);
s.ppMaxtrkByTrigger[j]->SetMarkerSize(0.8);
s.ppMaxtrkByTrigger[j]->SetFillColor(j+1);
}
//******************************************************************************************************************
//************************************************JET TRIGGER PLOTS**********************************************************
//******************************************************************************************************************
TCanvas * c1 = new TCanvas("c1","c1",800,600);
c1->SetLogy();
s.ppJets->Scale(100);
float Ymin = 0.00000000001;
float Ymax = 10;
s.ppJets->GetYaxis()->SetRangeUser(Ymin,Ymax);
s.ppJets->Draw("h");
for(int i = 0; i<s.nTriggers; i++) s.ppJetsByTrigger[i]->Draw("same");
TLegend * leg = new TLegend(0.47,0.62,0.87,0.92);
leg->AddEntry(s.ppJets,"Jet Spectrum (x100)","l");
leg->AddEntry(s.ppJetsByTrigger[0],"MB (I)","p");
leg->AddEntry(s.ppJetsByTrigger[1],"jet 40 (II)","p");
leg->AddEntry(s.ppJetsByTrigger[2],"jet 60 (III)","p");
leg->AddEntry(s.ppJetsByTrigger[3],"jet 80 (IV)","p");
leg->AddEntry((TObject*)0,"ak4Calo Jets, |#eta|<2","");
leg->Draw("same");
c1->SaveAs("plots/png/ppJets_FullSpectrum.png");
c1->SaveAs("plots/pdf/ppJets_FullSpectrum.pdf");
s.ppJets->GetXaxis()->SetRangeUser(20,200);
Ymin = 0.0000001;
Ymax = 100;
s.ppJets->GetYaxis()->SetRangeUser(0.0000001,100);
s.ppJets->Draw("h");
for(int i = 0; i<s.nTriggers; i++) s.ppJetsByTrigger[i]->Draw("same");
leg->Draw("same");
TLine * l[3];
for(int i = 0; i<3; i++)
{
l[i] = new TLine(s.triggerBins[i+1],Ymin,s.triggerBins[i+1],Ymax);
l[i]->SetLineWidth(2);
l[i]->SetLineStyle(2);
l[i]->SetLineColor(1);
l[i]->Draw("same");
}
TLatex * lat = new TLatex(1,1,"test");
lat->DrawLatex(45,Ymin*3,"I");
lat->DrawLatex(65,Ymin*3,"II");
lat->DrawLatex(85,Ymin*3,"III");
lat->DrawLatex(105,Ymin*3,"IV");
c1->SaveAs("plots/png/ppJets_FullSpectrum_XZoom.png");
c1->SaveAs("plots/pdf/ppJets_FullSpectrum_XZoom.pdf");
c1->SetLogy(0);
for(int i = 0; i<s.nTriggers-1; i++) s.ppJetsByTrigger[s.nTriggers-1-i]->Divide(s.ppJetsByTrigger[s.nTriggers-2-i]);
s.ppJetsByTrigger[1]->GetYaxis()->SetRangeUser(0,2);
s.ppJetsByTrigger[1]->GetXaxis()->SetRangeUser(20,140);
s.ppJetsByTrigger[1]->GetXaxis()->SetTitle("Leading jet p_{T}");
s.ppJetsByTrigger[1]->Draw();
s.ppJetsByTrigger[2]->Draw("same");
s.ppJetsByTrigger[3]->Draw("same");
TLegend * leg2 = new TLegend(0.2,0.6,0.5,0.9);
leg2->AddEntry(s.ppJetsByTrigger[1],"Jet40/MB","p");
leg2->AddEntry(s.ppJetsByTrigger[2],"Jet60/Jet40","p");
leg2->AddEntry(s.ppJetsByTrigger[3],"Jet80/Jet60","p");
leg2->Draw("same");
c1->SaveAs("plots/png/JetRelativeTurnOnes.png");
c1->SaveAs("plots/pdf/JetRelativeTurnOnes.pdf");
c1->SetLogy();
c1->SetLogx();
//.........这里部分代码省略.........