本文整理汇总了C++中TGraph::SetMarkerStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ TGraph::SetMarkerStyle方法的具体用法?C++ TGraph::SetMarkerStyle怎么用?C++ TGraph::SetMarkerStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGraph
的用法示例。
在下文中一共展示了TGraph::SetMarkerStyle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: decorate
void decorate(TCanvas *can,TH2D &h, bool addLHC=true){
TLatex * tex = new TLatex();
tex->SetNDC();
tex->SetTextFont(42);
tex->SetLineWidth(2);
tex->SetTextSize(0.03);
tex->DrawLatex(0.32,0.93,"4.9 fb^{-1} (7 TeV) + 19.7 fb^{-1} (8 TeV) + 2.3 fb^{-1} (13 TeV)");
tex->SetTextFont(42);
tex->SetTextSize(0.06);
//if (!addLHC){
// tex->SetTextSize(0.04);
// tex->SetTextColor(kWhite);
// if (isPrelim) tex->DrawLatex(0.155, 0.85, "#bf{CMS} #it{Preliminary}");
// else tex->DrawLatex(0.155, 0.85, "#bf{CMS}");
//} else {
if (isPrelim) {
tex->SetTextSize(0.04);
tex->DrawLatex(0.155, 0.85, "#bf{CMS} #it{Preliminary}");
}
else tex->DrawLatex(0.14, 0.93, "#bf{CMS}");
//}
TGraph *SM = new TGraph();
SM->SetPoint(0,1,1);
SM->SetMarkerColor(kOrange);
SM->SetMarkerStyle(33);
SM->SetMarkerSize(4);
SM->Draw("Psame");
TLegend *leg;
if (addLHC) {
if (isPrelim) leg = new TLegend(0.14,0.56,0.4,0.83);
else leg = new TLegend(0.14,0.62,0.4,0.89);
}
else leg = new TLegend(0.52,0.84,0.78,0.89);
leg->SetTextSize(0.042);
leg->SetFillStyle(0);
leg->SetTextColor(kWhite);
leg->SetBorderSize(0);
TGraph *gr = new TGraph(); gr->SetLineWidth(2); gr->SetMarkerStyle(34); gr->SetLineColor(kWhite); gr->SetMarkerColor(kWhite);
TGraph *gr2 = new TGraph(); gr2->SetLineWidth(2); gr2->SetLineColor(kWhite); gr2->SetLineStyle(2);
gr->SetMarkerSize(2);
if (addLHC){
leg->AddEntry(SM,"SM production","P");
leg->AddEntry(gr,"LHC best fit","P");
leg->AddEntry(gr, "68% CL","L");
leg->AddEntry(gr2,"95% CL","L");
leg->Draw();
} else {
TLatex *lat = new TLatex();
lat->SetTextSize(0.04);
lat->SetTextColor(kWhite);
lat->DrawLatex(1.05,1.05,"SM production");
}
can->SetTicky();
can->SetTickx();
can->RedrawAxis();
}
示例2: CheckNorm
void CheckNorm(double Min, double Max, double Step) {
vector <double> Mass;
vector <double> BranchingRatio;
vector <double> XSection;
for (double i=Min; i<Max; i+=Step) {
Mass.push_back(i);
BranchingRatio.push_back(GetBR(i));
XSection.push_back(GetXsection(i));
}
TGraph* BranchGraph = new TGraph(Mass.size(),&Mass[0],&BranchingRatio[0]);
TGraph* XSectionGraph = new TGraph(Mass.size(),&Mass[0],&XSection[0]);
BranchGraph->SetTitle("Interpolated Branching Ratios");
XSectionGraph->SetTitle("Interpolated Cross Sections");
BranchGraph->SetMarkerStyle(20);
XSectionGraph->SetMarkerStyle(20);
BranchGraph->SetMarkerSize(1);
XSectionGraph->SetMarkerSize(1);
TCanvas* c1 = new TCanvas("c1","c1",800,650);
c1->cd();
BranchGraph->Draw("AP");
c1->SaveAs("BranchingRatios.png");
c1->Clear();
XSectionGraph->Draw("AP");
c1->SaveAs("XSections.png");
delete BranchGraph;
delete XSectionGraph;
delete c1;
}
示例3: PlotLine
// === FUNCTION ============================================================
// Name: GetLine
// Description:
// ===========================================================================
TGraph* PlotLine(int plateu, std::string pu, std::string det)
{
//----------------------------------------------------------------------------
// Default input cross section
//----------------------------------------------------------------------------
std::map<int, double> SigXs;
SigXs[112] = 46;
SigXs[200] = 11.47;
SigXs[500] = 0.45;
double x[3], y[3];
x[0] = 112;
x[1] = 200;
x[2] = 500;
for (int i = 0; i < 3; ++i)
{
y[i] = SigXs[x[i]] * GetNumber(plateu, x[i], pu, det) ;
std::cout << " pu " << pu << " det " << det <<" signal " << x[i] <<" scal " << y[i] << std::endl;
}
TGraph* xs = new TGraph(3, x, y);
xs->SetMarkerStyle(34);
return xs;
} // ----- end of function PlotLine -----
示例4: title
//Return a graph of the llscan
TGraph * LLscanResult::GetGraph()
{
double* pvs = new double[parameterValues.size()] ;
double* llvs = new double[parameterValues.size()] ;
double llmax = 0 ;
for(unsigned int i=0; i< parameterValues.size() ; ++i ){
pvs[i] = parameterValues[i] ;
llvs[i] = llvalues_offset[i] ;
if( llvs[i] > llmax ) llmax = llvs[i] ;
}
TGraph* gr = new TGraph( Int_t(parameterValues.size()), pvs, llvs ) ;
//gr->SetTitle("LL Scan for Parameter xxx");
gr->SetMarkerStyle(1);
gr->SetLineWidth(2);
gr->SetMarkerColor(4);
gr->SetLineColor(4);
gr->GetYaxis()->SetRangeUser( 0., llmax*1.2 );
gr->GetYaxis()->SetLimits( 0., llmax*1.2 );
gr->SetMinimum( 0.0 );
gr->SetMaximum( llmax*1.2 );
gr->Draw("ALP");
string title("LL Scan for Parameter ") ;
title+=parameterName.c_str();
gr->SetTitle(title.c_str());
gr->GetXaxis()->SetTitle(parameterName.c_str());
return gr ;
}
示例5: particleinteractions2
void particleinteractions2() {
//Draw a simple graph
// To see the output of this macro, click begin_html <a href="gif/graph.gif">here</a>. end_html
//Author: Rene Brun
TCanvas *c1 = new TCanvas("c1","A Simple Graph Example",200,10,700,500);
c1->SetFillColor(42);
c1->SetGrid();
const Int_t n = 1000;
Double_t x[n], y[n];
int minEnergy = ceil(mass*pow(c,2));
for (Int_t i=0; i < 1000;i++) {
double energy = minEnergy+i;
x[i] = energy;
y[i] = exp(-mass*c/(lifetime*sqrt(energy*energy-mass*mass*pow(c, 4))));
printf(" i %i %f %f \n",i,x[i],y[i]);
}
TGraph *gr = new TGraph(n,x,y);
gr->SetLineColor(2);
gr->SetLineWidth(4);
gr->SetMarkerColor(4);
gr->SetMarkerStyle(21);
gr->SetTitle("Particle Decay Graph");
gr->GetXaxis()->SetTitle("Energy (MeV)");
gr->GetYaxis()->SetTitle("Probability");
gr->Draw("ACP");
// TCanvas::Update() draws the frame, after which one can change it
c1->Update();
c1->GetFrame()->SetFillColor(21);
c1->GetFrame()->SetBorderSize(12);
c1->Modified();
}
示例6: counts
TGraph*
makeGraph(const TArrayI& adcs, Int_t rate)
{
Int_t last = adcs.fArray[0];
TArrayI counts(4);
TGraph* graph = new TGraph(rate * adcs.fN);
graph->SetLineColor(rate);
graph->SetMarkerColor(rate);
graph->SetMarkerStyle(20+rate);
graph->SetLineStyle(rate);
graph->SetName(Form("rate%d", rate));
graph->SetTitle(Form("Rate %d", rate));
for (Int_t i = 0; i < adcs.fN; i++) {
counts.Reset(-1);
convert(rate, adcs.fArray[i], last, counts);
for (Int_t j = 0; j < rate; j++) {
Int_t idx = (i * rate + j);
Double_t x = (i + (rate > 1 ? Float_t(j+1) / rate-1 : 0));
graph->SetPoint(idx, x, counts[j]);
}
last = counts[rate - 1];
}
return graph;
}
示例7: xt_to_pt
TGraph* xt_to_pt(TGraph* graph, Double_t roots) {
Double_t *xt,*y;
Double_t pt[256], ynew[256];
Int_t n = graph->GetN();
xt = graph->GetX();
y = graph->GetY();
Int_t validpoints = 0;
for(Int_t i=0; i<n; i++) {
pt[validpoints] = xt[i]*roots/2;
ynew[validpoints] = y[i];
if(pt[validpoints]!=0 && ynew[validpoints]!=0 && pt[validpoints]<200 && (pt[validpoints]<50 || roots>2000)) validpoints++;
else cout << "invalid point at i=" << i << endl;
cout << "i=" << i << "\tvalidpoints=" << validpoints << "\tpt=" << pt[validpoints] << "\tynew=" << ynew[validpoints]<< endl;
}
TGraph *out = new TGraph(validpoints,pt,ynew);
out->SetLineColor(graph->GetMarkerColor());
out->SetLineStyle(graph->GetLineStyle());
out->SetMarkerColor(graph->GetMarkerColor());
out->SetMarkerStyle(graph->GetMarkerStyle());
return out;
}
示例8: treegraph
void treegraph(TString filename) {
gROOT->SetStyle("Plain");
gStyle->SetOptDate();
Double_t x, y;
Int_t nlines = 0;
TFile *f = new TFile("graph.root","RECREATE");
TCanvas *canvas_graph = new TCanvas("canvas_graph", "y vs x",467,89,400,700);
TTree t;
t.ReadFile(filename,"x:y");
t.Draw("x:y","","goff");
TGraph *g = new TGraph(t.GetSelectedRows(),t.GetV1(),t.GetV2());
g->SetTitle(filename+": Y vs X");
g->GetXaxis()->SetTitle("x[a.u.]");
g->GetYaxis()->SetTitle("y[a.u.]");
g->SetMarkerStyle(21);
g->Draw("AP");
f->Write();
}
示例9: plotSignal
int plotSignal(bragg_signal sig, int same) {
float x[128]; for (int i=0; i<128; i++) x[i]=i*0.1;
float y[128]; for (int i=0; i<128; i++) y[i]=sig.s[i];
TGraph *g = new TGraph(128,x,y); // crea il grafico
g->SetMarkerStyle(7); // imposta alcuni attributi
g->SetLineColor(4);
g->SetLineWidth(2);
TCanvas *csig = (TCanvas*)gROOT->FindObject("csig"); // cerca l'oggetto "csig" (canvas)
if (!csig) {
csig=new TCanvas("csig"); // se non c'e' la crea nuova
csig->SetGridy();
g->Draw("apl"); // disegna il grafico e anche il frame con gli assi
}
else {
csig->cd(); // se c'e' si posiziona sulla canvas "csig"
if (same)
g->Draw("pl"); // disegna nel frame esistente
else {
csig->Clear();
g->Draw("apl"); // disegna in un nuovo frame
gSystem->Sleep(200); // aspetta 200 ms
}
}
csig->Modified(); // aggiorna la canvas
csig->Update();
gSystem->ProcessEvents(); // aggiorna la grafica
return 0;
}
示例10: TGraph
TGraph *graphLH(std::string nuisname, double err ){
w->loadSnapshot("bestfitall"); // SetTo BestFit values as start
// Get The parameter we want
RooRealVar *nuis =(RooRealVar*) w->var(nuisname.c_str());
double bf = nuis->getVal();
double nll_0=nll->getVal();
TGraph *gr = new TGraph(2*npoints+1);
for (int i=-1*npoints;i<=npoints;i++){
nuis->setVal(bf+err*( ((float)i)*nsigma/npoints));
double nll_v = nll->getVal();
gr->SetPoint(i+npoints,nuis->getVal(),nll_v-nll_0);
}
gr->SetTitle("");
gr->GetYaxis()->SetTitle("NLL - obs data");
gr->GetYaxis()->SetTitleOffset(1.1);
gr->GetXaxis()->SetTitleSize(0.05);
gr->GetYaxis()->SetTitleSize(0.05);
gr->GetXaxis()->SetTitle(nuisname.c_str());
gr->SetLineColor(4);
gr->SetLineWidth(2);
gr->SetMarkerStyle(21);
gr->SetMarkerSize(0.6);
return gr;
}
示例11: setGraphOptions
void setGraphOptions(TGraph &g)
{
g.SetTitle("");
g.SetMarkerColor(1);
g.SetMarkerStyle(24);
g.SetMarkerSize(.5);
}
示例12: test5
void test5()
{
TCanvas *c1 = new TCanvas("c1", "c1", 0, 0, 600, 300);
TCanvas *c2 = new TCanvas("c2", "c2", 605, 0, 600, 300);
const Int_t n = 20;
Double_t x[n], y[n];
for (Int_t i = 0; i < n; i++) {
x[i] = i;
y[i] = i;
}
TGraph *gr = new TGraph(n, x, y);
gr->SetMarkerStyle(20);
c1->cd();
c1->SetGrid();
gr->Draw("APC");
gr->SetHighlight();
TGraph::SetHighlightPad(c2);
TH1F *h[n];
for (Int_t i = 0; i < n; i++) {
h[i] = new TH1F(TString::Format("h_%02d", i), "", 100, -5.0, 5.0);
h[i]->SetTitle(h[i]->GetName());
h[i]->FillRandom("gaus");
gr->AddHighlight(i, h[i]);
}
gr->GetListOfHighlights()->SetOwner(kTRUE);
gr->RemovePoint(5);
gr->RemovePoint(9); // point with x = 10 (after remove previous point)
delete h[14];
delete h[17];
}
示例13: quantiles
//computes mass quantiles for diphoton mass binning and plots the result
int quantiles(TH1F* mass,double probtemp[], double dpmqtemp[] ) {
// demo for quantiles
cout << "define mass bins " << endl;
mass->Scale(1.0/mass->Integral());
for (Int_t i =0;i<nq_q;i++){
probtemp[i] = Float_t(i+startbin_q)/ntot_q;
mass->GetQuantiles(nq_q,dpmqtemp,probtemp);
cout << "quantile "<<probtemp[i] << " diphopt " << dpmqtemp[i] << endl;
}
//show the original histogram in the top pad
// if(debug){
TCanvas *cq = new TCanvas("cq","mass quantiles",10,10,700,900);
cq->Divide(1,2);
cq->cd(1);
cq->SetLogy();
cq->Update();
mass->Draw();
// show the quantiles in the bottom pad
cq->cd(2);
gPad->SetGrid();
TGraph *gr = new TGraph(nq_q,probtemp,dpmqtemp);
gr->SetMarkerStyle(21);
gr->Draw("alp");
cq->SaveAs(Form("../plots/massquantiles_%s_range_%u_%u_%s.root",(truthfit)? "truth": "rcone_sideb",startbin_q,endbin_q,eta_q.Data()));
cq->SaveAs(Form("../plots/massquantiles_%s_range_%u_%u_%s.png",(truthfit)? "truth": "rcone_sideb",startbin_q,endbin_q,eta_q.Data()));
// }
return 0;
}
示例14: TGraph
TGraph *plotGF(int isSum, int xtheta, double *r0_theta, double *G2_theta, int marker, int color){
if(isSum)
TFile *f = TFile::Open("mergedV_Sum.root");
else
TFile *f = TFile::Open("mergedV_Prod.root");
TVectorD *vecDr = f->Get(Form("D_%d/r",xbin));
TVectorD *vecDg2 = f->Get(Form("D_%d/D_0/D_%d/G2",xbin,xtheta));
TVectorD *vecDr0 = f->Get(Form("D_%d/D_0/r0",xbin,xtheta));
TVectorD *vecDr01 = f->Get(Form("D_%d/D_0/r01",xbin,xtheta));
double *r = vecDr->GetMatrixArray();
double *g2 = vecDg2->GetMatrixArray();
double *r0 = vecDr0->GetMatrixArray();
double *r01 = vecDr01->GetMatrixArray();
(*r0_theta) = r0[xtheta];
for(int ir=0;ir<nstepr;ir++)
if(r[ir] == r01[xtheta]) break;
(*G2_theta) = g2[ir];
TGraph *gr = new TGraph(nstepr,r,g2);
gr->SetMarkerSize(0.5);
gr->SetMarkerColor(color);
gr->SetMarkerStyle(marker);
f->Close();
return gr;
}
示例15: ProjectionX
void KVCanvas::ProjectionX(TH2* hh)
{
TString pname = Form("%s_px", hh->GetName());
Int_t ip = 1;
while (gROOT->FindObject(pname.Data())) {
pname = Form("%s_px%d", hh->GetName(), ip);
ip++;
}
TH1* px = hh->ProjectionX(pname.Data());
if (!px) return;
Double_t minY = (hh->GetYaxis()->GetXmin());
Double_t maxY = (hh->GetYaxis()->GetXmax());
Double_t dY = (maxY - minY) * 0.8;
Double_t maxH = px->GetBinContent(px->GetMaximumBin());
TGraph* gg = 0;
if ((gg = (TGraph*)gROOT->FindObject(Form("%s_gjx", hh->GetName())))) gg->Delete();
gg = new TGraph;
for (int i = 0; i < px->GetNbinsX(); i++) {
gg->SetPoint(i, px->GetBinCenter(i), minY + px->GetBinContent(i)*dY / maxH);
}
gg->SetName(Form("%s_gjx", hh->GetName()));
gg->SetTitle(Form("%s_gjx", hh->GetName()));
gg->SetLineColor(kBlack);
gg->SetMarkerColor(kBlack);
gg->SetMarkerStyle(8);
gg->Draw("PL");
Modified();
Update();
}