本文整理汇总了C++中TH1::SetMarkerStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ TH1::SetMarkerStyle方法的具体用法?C++ TH1::SetMarkerStyle怎么用?C++ TH1::SetMarkerStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TH1
的用法示例。
在下文中一共展示了TH1::SetMarkerStyle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeNsignalEff_pt15
void MakeNsignalEff_pt15(){
setTDRStyle();
gStyle->SetPalette(1);
TH1* medium = makehist("PreSelection_medium_pt15");
TH1* tight = makehist("PreSelection_tight_pt15");
TH1* tight_dxy10= makehist("PreSelection_iso_10_10_pt15");
TH1* tight_anal = makehist("PreSelection_pt15");
TLegend* legendH = new TLegend(0.6, 0.7, 0.9, 0.9);
legendH->SetFillColor(kWhite);
legendH->SetTextSize(0.03);
medium->GetXaxis()->SetTitle("m_{N} GeV");
medium->GetYaxis()->SetTitle("ID efficiency");
medium->SetMarkerColor(kRed);
tight->SetMarkerColor(kRed);
tight_dxy10->SetMarkerColor(kRed);
tight_anal->SetMarkerColor(kRed);
medium->SetMarkerStyle(20.);
tight->SetMarkerStyle(21.);
tight_dxy10->SetMarkerStyle(22.);
tight_anal->SetMarkerStyle(23.);
legendH->AddEntry(medium, "medium ID", "p");
legendH->AddEntry(tight, "tight ID", "p");
legendH->AddEntry(tight_dxy10, "tight+ dxy ", "p");
legendH->AddEntry(tight_anal, "tight+ dxy+ iso ", "p");
medium->Draw("p");
tight->Draw("psame");
tight_dxy10->Draw("psame");
tight_anal->Draw("psame");
legendH->Draw();
TGraphAsymmErrors * g = new TGraphAsymmErrors(heff);
g->SetLineWidth(2.0);
g->SetMarkerSize(2.);
// g->Draw( "9pXsame" );
CMS_lumi( c1, 2, 11 );
c1->Update();
c1->RedrawAxis();
c1->SaveAs(("/home/jalmond/WebPlots/PreApproval/SignalPlots/SignalEff_presel_med_tight_pt15.pdf" ));
}
示例2: DrawEmpirical
void DrawEmpirical(const char* filename="Empirical.root",
Bool_t fmd=true)
{
gStyle->SetOptTitle(0);
TFile* file = TFile::Open(filename, "READ");
if (!file) return;
Double_t yr = 0.3;
TCanvas* c = new TCanvas("c","c", 1000,1000);
TPad* p1 = new TPad("p1","p1",0,0,1,yr);
TPad* p2 = new TPad("p2","p2",0,yr,1,1);
c->cd(); p1->Draw();
c->cd(); p2->Draw();
gDirectory->cd("Forward");
THStack* r = DrawOne(p1, yr, false, gDirectory, "ratios");
THStack* e = DrawOne(p2, yr, true, gDirectory, "empirical");
r->SetMinimum(0.945);
r->SetMaximum(1.055);
r->GetXaxis()->SetTitle("#it{#eta}");
r->GetYaxis()->SetTitle("Ratio to mean");
e->SetMinimum(0.005);
e->GetYaxis()->SetTitle("#it{E_{c}}(#it{#eta})");
TIter nextE(e->GetHists());
TIter nextR(r->GetHists());
TH1* hist = 0;
Color_t cols[] = { kRed+2, kGreen+2, kBlue+2, kMagenta+2, 0 };
Color_t *ptr = cols;
Style_t stys[] = { 20, 21, 22, 23 };
Style_t* sty = stys;
while (*ptr) {
hist = static_cast<TH1*>(nextE());
hist->SetMarkerColor(*ptr);
hist->SetMarkerSize(2);
hist->SetMarkerStyle(*sty);
hist = static_cast<TH1*>(nextR());
hist->SetMarkerColor(*ptr);
hist->SetMarkerSize(2);
hist->SetMarkerStyle(*sty);
ptr++;
sty++;
}
TLegend* l = p2->BuildLegend(0.35, .2, .65, .8);
l->SetFillColor(0);
l->SetFillStyle(0);
l->SetBorderSize(0);
c->Modified();
c->Update();
c->cd();
c->Print("empirical.png");
}
示例3: draw_output_stat
void plotter::draw_output_stat(TH1* output_, TH1* stat_, TH1D* truth_, bool norm, TString file_name){
// std::vector<double> sys = get_sys_errors();
// TH1* output_sys = add_error_bar(output, sys);
TH1* output = (TH1*) output_->Clone("output");
TH1* stat = (TH1*) stat_->Clone("stat");
TH1D* truth = (TH1D*) truth_->Clone("truth");
TCanvas *c = new TCanvas("c","",600,600);
double ymax;
gPad->SetLeftMargin(0.15);
if(truth->GetMaximum() > output->GetMaximum()) ymax = 1.5 * truth->GetMaximum();
else ymax = 1.5 * output->GetMaximum();
TGaxis::SetMaxDigits(3);
output->SetTitle(" ");
output->GetYaxis()->SetRangeUser(0., ymax);
output->GetXaxis()->SetTitle("Leading-jet mass [GeV]");
if(norm) output->GetYaxis()->SetTitle("#frac{1}{#sigma} #frac{d#sigma}{dm_{jet}} [#frac{1}{GeV}]");
else output->GetYaxis()->SetTitle("events");
output->GetYaxis()->SetTitleOffset(1.1);
output->GetXaxis()->SetTitleOffset(0.9);
output->GetYaxis()->SetTitleSize(0.05);
output->GetXaxis()->SetTitleSize(0.05);
output->GetYaxis()->SetNdivisions(505);
output->SetLineColor(kBlack);
output->SetMarkerColor(kBlack);
output->SetMarkerStyle(8);
output->SetMarkerSize(1);
output->Draw("E1");
stat->SetLineColor(kBlack);
stat->SetMarkerColor(kBlack);
stat->SetMarkerStyle(8);
stat->SetMarkerSize(1);
gStyle->SetEndErrorSize(5);
truth->SetLineWidth(3);
truth->SetLineColor(kRed);
truth->SetLineStyle(2);
truth->Draw("HIST SAME");
stat->Draw("E1 SAME");
output->Draw("E1 SAME");
TLegend *l=new TLegend(0.5,0.65,0.85,0.85);
l->SetBorderSize(0);
l->SetFillStyle(0);
l->AddEntry(output,"data unfolded","pl");
l->AddEntry(truth,"MC particle level","pl");
l->SetTextSize(0.04);
l->Draw();
c->SaveAs(directory + file_name + ".pdf");
delete c;
}
示例4: makeplots1D
// Make 1D comparison plots
void makeplots1D( TH1& eff, TH1& base, TH1& destination, TString name) {
gROOT->ProcessLine(".L ~/tdrstyle.C");
setTDRStyle();
TGraphAsymmErrors *g1 = new TGraphAsymmErrors();
g1->BayesDivide(&destination, &base, "");
g1->GetYaxis()->SetRangeUser(0.5, 1.05);
eff.SetLineColor(2);
eff.SetMarkerStyle(22);
eff.SetMarkerSize(1.4);
eff.SetMarkerColor(2);
//
g1->GetYaxis()->SetTitle("Efficiency");
if(name.Contains("_Eta"))
g1->GetXaxis()->SetTitle("#eta");
if(name.Contains("_Phi"))
g1->GetXaxis()->SetTitle("#phi");
if(name.Contains("_Pt"))
g1->GetXaxis()->SetTitle("p_{T} (GeV/c)");
TCanvas canvas("canvas",name,600,600);
g1->Draw("APE");
eff.Draw("same");
canvas.SaveAs(name + TString(".eps"));
canvas.SaveAs(name + TString(".gif"));
canvas.Close();
delete g1;
}
示例5: SetColorAndStyleHisto
/**
SetColor/Style Histo
*/
void SetColorAndStyleHisto(TH1 & histo , EColor color){
histo.SetFillColor (color) ;
histo.SetLineColor (color) ;
histo.SetMarkerColor (color) ;
histo.SetMarkerSize (1) ;
histo.SetMarkerStyle (20) ;
}
示例6: ratioPlots
void ratioPlots( TCanvas* c1, TH1* h_r, TH1* h_i,
string xTitle, string yTitle, string savePath,
double fitMin=-100000, double fitMax=100000, bool doubleColFit=0 ){
double xMaximum = h_r->GetXaxis()->GetBinUpEdge(h_r->GetXaxis()->GetLast());
double xMinimum = h_r->GetXaxis()->GetBinLowEdge(h_r->GetXaxis()->GetFirst());
double yMaximum;
double yMinimum;
h_i->Sumw2();
h_r->Sumw2();
TLine* line1 = new TLine(xMinimum,1,xMaximum,1);
line1->SetLineColor(1);
line1->SetLineWidth(2);
line1->SetLineStyle(7);
TF1* fpol1 = new TF1("fpol1", "pol1", fitMin, fitMax);
fpol1->SetLineColor(2);
fpol1->SetLineWidth(3);
fpol1->SetLineStyle(7);
TH1* hRatio = (TH1*)h_r->Clone("clone_record");
hRatio->Divide(h_i);
yMaximum = hRatio->GetMaximum();
yMinimum = hRatio->GetMinimum(0);
hRatio->GetYaxis()->SetRangeUser(yMinimum/2.5,yMaximum+yMaximum/5);
hRatio->SetXTitle(xTitle.c_str());
hRatio->SetYTitle(yTitle.c_str());
hRatio->SetLineColor(9);
hRatio->SetLineWidth(2);
hRatio->SetMarkerStyle(8);
hRatio->Draw("e");
hRatio->Fit("fpol1", "L");
line1->Draw("SAME");
if(doubleColFit){
double p0=fpol1->GetParameter(0);
double p1=fpol1->GetParameter(1);
double endPoint=double(fitMax*p1)+p0;
double p1new=(endPoint-1)/(fitMax-fitMin);
char fun[100], text[100];
sprintf(fun,"x*(%f)+1",p1new);
sprintf(text,"Tangent: %f",p1new);
TF1* fnew = new TF1("fnew", fun, fitMin, fitMax);
fnew->SetLineColor(2);
fnew->SetLineWidth(3);
fnew->Draw("SAME");
TText* Title = new TText( fitMax/12, yMinimum, text);
Title->SetTextColor(2);
Title->SetTextSize(0.035);
Title->Draw("SAME");
}
c1->SaveAs(savePath.c_str());
c1->cd();
}
示例7: draw_output_pseudo
void plotter::draw_output_pseudo(TH1* output_, TH1D* pseudotruth_, TH1D* mctruth_, bool norm, TString file_name){
TH1* output = (TH1*) output_->Clone("output");
TH1D* pseudotruth = (TH1D*) pseudotruth_->Clone("pseudotruth");
TH1D* mctruth = (TH1D*) mctruth_->Clone("mctruth");
double ymax_temp = 0;
if(pseudotruth->GetMaximum() > ymax_temp) ymax_temp = pseudotruth->GetMaximum();
if(mctruth->GetMaximum() > ymax_temp) ymax_temp = mctruth->GetMaximum();
if(output->GetMaximum() > ymax_temp) ymax_temp = output->GetMaximum();
double ymax = 1.5 * ymax_temp;
pseudotruth->SetTitle(" ");
pseudotruth->GetYaxis()->SetRangeUser(0., ymax);
pseudotruth->GetXaxis()->SetTitle("Leading-jet mass [GeV]");
if(norm) pseudotruth->GetYaxis()->SetTitle("#frac{1}{#sigma} #frac{d#sigma}{dm_{jet}} [#frac{1}{GeV}]");
else pseudotruth->GetYaxis()->SetTitle("events");
pseudotruth->GetYaxis()->SetTitleOffset(1.1);
pseudotruth->GetXaxis()->SetTitleOffset(0.9);
pseudotruth->GetYaxis()->SetTitleSize(0.05);
pseudotruth->GetXaxis()->SetTitleSize(0.05);
pseudotruth->GetYaxis()->SetNdivisions(505);
pseudotruth->SetLineWidth(4);
pseudotruth->SetLineColor(kRed);
mctruth->SetLineWidth(3);
mctruth->SetLineStyle(2);
mctruth->SetLineColor(kBlue);
output->SetLineColor(kBlack);
output->SetMarkerColor(kBlack);
output->SetMarkerStyle(8);
output->SetMarkerSize(1);
TCanvas *c= new TCanvas("Particle Level","",600,600);
gPad->SetLeftMargin(0.15);
TGaxis::SetMaxDigits(3);
pseudotruth->Draw("HIST SAME");
mctruth->Draw("HIST SAME");
output->Draw("E1 SAME");
TLegend *l;
if(mctruth->GetSize() > 20) l=new TLegend(0.2,0.6,0.4,0.85);
else l=new TLegend(0.55,0.6,0.85,0.85);
l->SetBorderSize(0);
l->SetFillStyle(0);
l->AddEntry(output,"pseudo data","pl");
l->AddEntry(pseudotruth,"pseudo data truth","pl");
l->AddEntry(mctruth,"MC truth","pl");
l->SetTextSize(0.04);
l->Draw();
gPad->RedrawAxis();
c->SaveAs(directory + file_name + ".pdf");
delete c;
}
示例8:
Double_t fitgp0( char* hs ) {
TH1 *h = (TH1*)gDirectory->Get(hs);
if( h == NULL ){
cout << hs << " does not exist\n";
return 0;
}
h->SetMarkerStyle(21);
h->SetMarkerSize(0.8);
h->SetStats(1);
gStyle->SetOptFit(101);
gROOT->ForceStyle();
double dx = h->GetBinWidth(1);
double nmax = h->GetBinContent(h->GetMaximumBin());
double xmax = h->GetBinCenter(h->GetMaximumBin());
double nn = 7*nmax;
int nb = h->GetNbinsX();
double n1 = h->GetBinContent(1);
double n9 = h->GetBinContent(nb);
double bg = 0.5*(n1+n9);
double x1 = h->GetBinCenter(1);
double x9 = h->GetBinCenter(nb);
// create a TF1 with the range from x1 to x9 and 4 parameters
TF1 *gp0Fcn = new TF1( "gp0Fcn", gp0Fit, x1, x9, 4 );
gp0Fcn->SetParName( 0, "mean" );
gp0Fcn->SetParName( 1, "sigma" );
gp0Fcn->SetParName( 2, "area" );
gp0Fcn->SetParName( 3, "BG" );
gp0Fcn->SetNpx(500);
gp0Fcn->SetLineWidth(4);
gp0Fcn->SetLineColor(kMagenta);
gp0Fcn->SetLineColor(kGreen);
// set start values for some parameters:
gp0Fcn->SetParameter( 0, xmax ); // peak position
gp0Fcn->SetParameter( 1, 4*dx ); // width
gp0Fcn->SetParameter( 2, nn ); // N
gp0Fcn->SetParameter( 3, bg );
// N: not drawing
// Q: quiet
// R: use specified range
h->Fit( "gp0Fcn", "NQR", "ep" );
return gp0Fcn->GetParameter(1);
}
示例9: showTauIsolation
void showTauIsolation(TFile* inputFile, const TString& dqmDirectory, const TString& meName,
const char* dqmSubDirectoryTauJet, const char* dqmSubDirectoryMuon, const char* dqmSubDirectoryElectron,
TCanvas* canvas, TPostScript* ps, const char* outputFileLabel, bool useLogScale)
{
canvas->SetLogy(useLogScale);
TLegend legend(0.74, 0.71, 0.89, 0.89, "", "brNDC");
legend.SetBorderSize(0);
legend.SetFillColor(0);
TH1* meTauJet = getMonitorElement(inputFile, dqmDirectory, dqmSubDirectoryTauJet, meName);
meTauJet->SetMarkerStyle(20);
meTauJet->SetMarkerColor(kRed);
meTauJet->SetLineColor(kRed);
meTauJet->Draw("e1p");
legend.AddEntry(meTauJet, "#tau-Jet", "p");
if ( dqmSubDirectoryMuon != "" ) {
TH1* meMuon = getMonitorElement(inputFile, dqmDirectory, dqmSubDirectoryMuon, meName);
meMuon->SetMarkerStyle(21);
meMuon->SetMarkerColor(kBlue);
meMuon->SetLineColor(kBlue);
meMuon->Draw("e1psame");
legend.AddEntry(meMuon, "#mu", "p");
}
if ( dqmSubDirectoryElectron != "" ) {
TH1* meElectron = getMonitorElement(inputFile, dqmDirectory, dqmSubDirectoryElectron, meName);
meElectron->SetMarkerStyle(23);
meElectron->SetMarkerColor(kGreen);
meElectron->SetLineColor(kGreen);
meElectron->Draw("e1psame");
legend.AddEntry(meElectron, "e", "p");
}
legend.Draw();
canvas->Update();
TString outputFileName = TString("plot").Append(meTauJet->GetName()).Append("_").Append(outputFileLabel).Append(".png");
canvas->Print(outputFileName.Data());
//ps->NewPage();
}
示例10: SetStyle
void SetStyle(TH1& h, double size, int color, int style, int fillstyle=0, int linestyle=1){
h.SetMarkerSize(size);
h.SetMarkerColor(color);
h.SetLineColor(color);
h.SetMarkerStyle(style);
h.SetFillStyle(fillstyle);
h.SetLineStyle(linestyle);
h.GetXaxis()->SetTitleFont(42);
h.GetYaxis()->SetTitleFont(42);
h.GetXaxis()->SetTitleSize(0.048);
h.GetYaxis()->SetTitleSize(0.048);
h.GetXaxis()->CenterTitle();
h.GetYaxis()->CenterTitle();
}
示例11: histogramStyle
void histogramStyle(TH1& hist, int color, int lineStyle, int markerStyle, float markersize, int filled)
{
hist.SetLineWidth(3);
hist.SetStats(kFALSE);
hist.SetLineColor (color);
hist.SetMarkerColor(color);
hist.SetMarkerStyle(markerStyle);
hist.SetMarkerSize(markersize);
hist.SetLineStyle(lineStyle);
if(filled==1){
hist.SetFillStyle(1001);
hist.SetFillColor(color);
}
else{
hist.SetFillStyle(0);
}
}
示例12: Legend
void Legend()
{
TLegend* leg = new TLegend(.6, .6, .9, .85);
leg->SetFillStyle(0);
TH1* dummy = new TH1F("", "", 1, 0, 1);
dummy->SetMarkerStyle(kFullCircle);
leg->AddEntry(dummy->Clone(), "Fake Data", "lep");
dummy->SetLineColor(kTotalMCColor);
leg->AddEntry(dummy->Clone(), "Total MC", "l");
dummy->SetLineColor(kNCBackgroundColor);
leg->AddEntry(dummy->Clone(), "NC", "l");
dummy->SetLineColor(kNumuBackgroundColor);
leg->AddEntry(dummy->Clone(), "#nu_{#mu} CC", "l");
dummy->SetLineColor(kBeamNueBackgroundColor);
leg->AddEntry(dummy->Clone(), "Beam #nu_{e} CC", "l");
leg->Draw();
}
示例13: boostcontrolplots
void boostcontrolplots( TDirectory *boostdir ) {
const Int_t nPlots = 4;
Int_t width = 900;
Int_t height = 600;
char cn[100];
const TString titName = boostdir->GetName();
sprintf( cn, "cv_%s", titName.Data() );
TCanvas *c = new TCanvas( cn, Form( "%s Control Plots", titName.Data() ),
width, height );
c->Divide(2,2);
const TString titName = boostdir->GetName();
TString hname[nPlots]={"Booster_BoostWeight","Booster_MethodWeight","Booster_ErrFraction","Booster_OrigErrFraction"};
for (Int_t i=0; i<nPlots; i++){
Int_t color = 4;
TPad * cPad = (TPad*)c->cd(i+1);
TH1 *h = (TH1*) boostdir->Get(hname[i]);
TString plotname = h->GetName();
h->SetMaximum(h->GetMaximum()*1.3);
h->SetMinimum( 0 );
h->SetMarkerColor(color);
h->SetMarkerSize( 0.7 );
h->SetMarkerStyle( 24 );
h->SetLineWidth(1);
h->SetLineColor(color);
h->Draw();
c->Update();
}
// write to file
TString fname = Form( "plots/%s_ControlPlots", titName.Data() );
TMVAGlob::imgconv( c, fname );
}
示例14: SetAxisLabels
void SetAxisLabels(TH1& hist, char* xtitle, char* ytitle="",
double xoffset=1.1, double yoffset=1.4) {
TAxis* x = hist.GetXaxis();
TAxis* y = hist.GetYaxis();
x->SetTitle(xtitle);
x->SetTitleSize(0.06);
x->SetLabelSize(0.05);
x->SetTitleOffset(xoffset);
x->SetNdivisions(505);
y->SetTitle(ytitle);
y->SetTitleSize(0.06);
y->SetLabelSize(0.05);
y->SetTitleOffset(yoffset);
y->SetNoExponent();
hist.SetLineWidth(2);
hist.SetMarkerStyle(20);
std::stringstream str;
str << "Events / " << (int) lumi << " pb^{-1} ";
std::string defYtitle = str.str();
if(ytitle=="") y->SetTitle( defYtitle.c_str() );
}
示例15: Project
void DrawTree::Project(Params& A) {
char name[128];
sprintf(name,"drawTree%d_%d",fN,_countAdd++);
A._Hname=name;
_tree->Project(name,A._varexp.c_str(),A._selection.c_str(),A._option.c_str(),A._nentries,A._firstentry);
TH1* h = (TH1*)gDirectory->Get(A._Hname.c_str());
h->SetMarkerStyle(_MarkerStyle+(_MarkerCount0++));
h->SetMarkerColor(_MarkerColor+(_MarkerCount1++));
A._TH=h;
_stack.Add(h);
cout << A._legend.c_str() << endl;
_legend->AddEntry(h,A._legend.c_str(),"P");
float axmin=h->GetXaxis()->GetXmin();
float axmax=h->GetXaxis()->GetXmax();
if (xmin>axmin)
xmin=axmin;
if (xmax<axmax)
xmax=axmax;
if (A._varexp.find(":") != string::npos) {
A._1D=false;
float aymin=h->GetYaxis()->GetXmin();
float aymax=h->GetYaxis()->GetXmax();
if (ymin>aymin)
ymin=aymin;
if (ymax<aymax)
ymax=aymax;
}
}