本文整理汇总了C++中TPaveText::SetFillColor方法的典型用法代码示例。如果您正苦于以下问题:C++ TPaveText::SetFillColor方法的具体用法?C++ TPaveText::SetFillColor怎么用?C++ TPaveText::SetFillColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPaveText
的用法示例。
在下文中一共展示了TPaveText::SetFillColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: surfaces
void surfaces() {
//Draw 2-Dim functions
// To see the output of this macro, click begin_html <a href="gif/surfaces.gif">here</a> end_html
//Author: Rene Brun
TCanvas *c1 = new TCanvas("c1","Surfaces Drawing Options",200,10,700,900);
c1->SetFillColor(42);
gStyle->SetFrameFillColor(42);
TPaveText *title = new TPaveText(.2,0.96,.8,.995);
title->SetFillColor(33);
title->AddText("Examples of Surface options");
title->Draw();
TPad *pad1 = new TPad("pad1","Gouraud shading",0.03,0.50,0.98,0.95,21);
TPad *pad2 = new TPad("pad2","Color mesh",0.03,0.02,0.98,0.48,21);
pad1->Draw();
pad2->Draw();
//
// We generate a 2-D function
TF2 *f2 = new TF2("f2","x**2 + y**2 - x**3 -8*x*y**4",-1,1.2,-1.5,1.5);
f2->SetContour(48);
f2->SetFillColor(45);
// Draw this function in pad1 with Gouraud shading option
pad1->cd();
pad1->SetPhi(-80);
pad1->SetLogz();
f2->Draw("surf4");
// Draw this function in pad2 with color mesh option
pad2->cd();
pad2->SetTheta(25);
pad2->SetPhi(-110);
pad2->SetLogz();
f2->SetLineWidth(1);
f2->SetLineColor(5);
f2->Draw("surf1");
//add axis titles. The titles are set on the intermediate
//histogram used for visualisation. We must force this histogram
//to be created, then force the redrawing of the two pads
pad2->Update();
f2->GetHistogram()->GetXaxis()->SetTitle("x title");
f2->GetHistogram()->GetYaxis()->SetTitle("y title");
f2->GetHistogram()->GetXaxis()->SetTitleOffset(1.4);
f2->GetHistogram()->GetYaxis()->SetTitleOffset(1.4);
pad1->Modified();
pad2->Modified();
}
示例2: makeZPhiArrowPlot
int makeZPhiArrowPlot( TTree* data, const char* name, double zLim, double phiLim, double level, double sublevel, double zMin, double zMax, double rMin, double rMax, double barrelRPhiRescale){
TCanvas* OBPCanvas = new TCanvas(name,name,1050,875);
OBPCanvas->DrawFrame(-zLim, -phiLim, 1.2*zLim, phiLim, ";module position z [cm];module position r*phi [cm]");
OBPCanvas->SetFillColor(0);
OBPCanvas->SetFrameBorderMode(0);
TFrame* aFrame = OBPCanvas->GetFrame();
aFrame->SetFillColor(0);
int passcut = 0;
for(int entry = 0;entry<data->GetEntries(); entry++)
{
data->GetEntry(entry);
if ((level_ == level)&&(((sublevel_ == sublevel)&&(sublevel != 0))||(sublevel == 0))){
if ((z_ <= zMax)&&(z_ > zMin)&&(r_ <= rMax)&&(r_ > rMin)){
TArrow* aArraw = new TArrow( z_, r_*phi_ , z_ + barrelRPhiRescale*dz_, r_*phi_+barrelRPhiRescale*r_*dphi_,0.0075,">");
aArraw->Draw();
passcut++;
}
}
}
DrawRPhiLegend( zLim, phiLim, barrelRPhiRescale );
char sliceLeg[192];
sprintf( sliceLeg, "%s: %f < r <= %f", name, rMin, rMax );
//Plot10Mu( name, xLim/2, yLim, 0.2*xLim );
TPaveText* atext = new TPaveText(0.2*zLim,0.85*phiLim,0.66*zLim,0.99*phiLim);
atext->AddText(sliceLeg);
atext->SetLineColor(0);
atext->SetFillColor(0);
atext->SetTextFont(42);
atext->SetTextSize(0.04);
atext->Draw();
char outfile[192];
sprintf( outfile, "%s/%s.png", outputDir_, name );
OBPCanvas->Print( outfile );
return passcut;
}
示例3: getHeader
TPaveText* getHeader(double lumi, TString channelName)
{
TPaveText* pt = new TPaveText(0.18,0.75,0.18,0.88,"brNDC");
pt->SetBorderSize(1);
pt->SetTextFont(42);
pt->SetTextSize(0.04);
pt->SetLineColor(0);
pt->SetLineStyle(1);
pt->SetLineWidth(1);
pt->SetFillColor(0);
pt->SetFillStyle(1001);
pt->SetTextAlign(12);
pt->AddText("CMS Preliminary");
pt->AddText(Form("%.1f fb^{-1} at #sqrt{s} = 7 TeV", lumi));
if ( channelName != "" ) pt->AddText(channelName);
return pt;
}
示例4: tpcdraw
void tpcdraw(Int_t sec, Int_t row, Int_t pad)
{
gStyle->SetOptStat(0);
//calculate occupancy for selected sector and pad row
//for selected pad is obtained signal shape
Double_t par[3];
gtpc.SetSecRowTime(sec,row);
gtpc.SetHisto(pad);
gtpc.Draw("box");
//plot histograms with specified options
//move pads to another position be possible add text
gtpc.GetPad1().SetPad(0.05,0.72,0.95,0.95);
gtpc.GetPad2().SetPad(0.05,0.47,0.95,0.70);
gtpc.GetPad3().SetPad(0.05,0.22,0.95,0.45);
//fit histogram of occupancy on specified range <150,500>
gtpc.GetPad2().cd();
g1 = new TF1("pol0_r","pol0",150,500);
gtpc.GetHis3()->Fit("pol0_r","R0Q");
g1->GetParameters(&par[0]);
Float_t error = g1->GetParError(0);
fitText = new TPaveText(0.15,0.7,0.3,0.9,"NDC");
fitText->AddText("p0 fit on interval <150-500>");
char s[100];
sprintf(s,"%0.3f+- %0.3f",par[0],error);
fitText->AddText(s);
fitText->Draw();
gtpc.GetPad2().Update();
//set logarithmic
gtpc.GetPad3().cd();
gtpc.GetPad3().SetLogy();
gtpc.GetPad3().Draw();
//add comments to the histograms
gtpc.GetCanvas().cd();
TPaveText * comment = new TPaveText(0.05,0.03,0.95,0.2,"NDC");
comment->SetTextAlign(12);
comment->SetFillColor(42);
comment->ReadFile("comment.txt");
comment->Draw();
gtpc.GetCanvas().Update();
}
示例5: TCanvas
TCanvas *hlabels2()
{
const Int_t nx = 12;
const Int_t ny = 20;
const char *month[nx] = {"January","February","March","April","May",
"June","July","August","September","October","November",
"December"};
const char *people[ny] = {"Jean","Pierre","Marie","Odile","Sebastien",
"Fons","Rene","Nicolas","Xavier","Greg","Bjarne","Anton",
"Otto","Eddy","Peter","Pasha","Philippe","Suzanne","Jeff",
"Valery"};
TCanvas *c1 = new TCanvas("c1","demo bin labels",10,10,600,600);
c1->SetGrid();
c1->SetLeftMargin(0.15);
c1->SetBottomMargin(0.15);
TH2F *h = new TH2F("h","test",3,0,3,2,0,2);
h->SetCanExtend(TH1::kAllAxes);
h->SetStats(0);
gRandom->SetSeed();
for (Int_t i=0;i<15000;i++) {
Int_t rx = gRandom->Rndm()*nx;
Int_t ry = gRandom->Rndm()*ny;
h->Fill(people[ry],month[rx],1);
}
h->LabelsDeflate("X");
h->LabelsDeflate("Y");
h->LabelsOption("v");
h->Draw("text");
TPaveText *pt = new TPaveText(0.6,0.85,0.98,0.98,"brNDC");
pt->SetFillColor(18);
pt->SetTextAlign(12);
pt->AddText("Use the axis Context Menu LabelsOption");
pt->AddText(" \"a\" to sort by alphabetic order");
pt->AddText(" \">\" to sort by decreasing values");
pt->AddText(" \"<\" to sort by increasing values");
pt->Draw();
return c1;
}
示例6: GetSinglePlotRateVsLumiSingleRoll
ExampleSingleRoll(){
TGraph* mg2 = GetSinglePlotRateVsLumiSingleRoll(
corr = false,
Area_ = "EndCap",
Wheel_ = "+3",
Sector_ = "2",
Number_ = "22",
Letter_ = "F",
Year_ = "2011",
Corr_ = "UnCorrected",
PlotName_ = "RateVsLumi_",
RunNumber_ = 180252,
PartNo_ = "1",
kBlue, 20
);
mg2->Draw("AP");
gStyle->SetOptFit(0000);
string RollName= GetRollName("RE+3_2_22", "1");
TPaveText* text = new TPaveText(0.2, 0.7, 0.4, 0.8, "NDC");
text->SetFillColor(0);
text->AddText(RollName.c_str());
text->Draw("same");
}
示例7: result_JES_akPu4PF_
void result_JES_akPu4PF_(refpt> 75 && refpt < 120)&&(abs(refeta)<2)_Centrality()
{
//=========Macro generated from canvas: Can_result_0/
//========= (Mon Apr 18 02:39:41 2016) by ROOT version6.02/13
TCanvas *Can_result_0 = new TCanvas("Can_result_0", "",18,40,700,500);
gStyle->SetOptFit(1);
Can_result_0->Range(-18.75,0.9236134,118.75,1.043845);
Can_result_0->SetFillColor(0);
Can_result_0->SetBorderMode(0);
Can_result_0->SetBorderSize(2);
Can_result_0->SetFrameBorderMode(0);
Can_result_0->SetFrameBorderMode(0);
TMultiGraph *multigraph = new TMultiGraph();
multigraph->SetName("name");
multigraph->SetTitle("JES_akPu4PF");
Double_t Graph_fx1001[4] = {
5,
20,
40,
75};
Double_t Graph_fy1001[4] = {
1.025461,
0.982262,
0.9644553,
0.970611};
Double_t Graph_fex1001[4] = {
5,
10,
10,
25};
Double_t Graph_fey1001[4] = {
0.001598024,
0.0009318739,
0.0008002418,
0.0004502591};
TGraphErrors *gre = new TGraphErrors(4,Graph_fx1001,Graph_fy1001,Graph_fex1001,Graph_fey1001);
gre->SetName("Graph");
gre->SetTitle("some title_0");
gre->SetFillColor(1);
gre->SetFillStyle(0);
TH1F *Graph_Graph1001 = new TH1F("Graph_Graph1001","some title_0",100,0,110);
Graph_Graph1001->SetMinimum(0.9573146);
Graph_Graph1001->SetMaximum(1.0334);
Graph_Graph1001->SetDirectory(0);
Graph_Graph1001->SetStats(0);
Int_t ci; // for color index setting
TColor *color; // for color definition with alpha
ci = TColor::GetColor("#000099");
Graph_Graph1001->SetLineColor(ci);
Graph_Graph1001->GetXaxis()->SetLabelFont(42);
Graph_Graph1001->GetXaxis()->SetLabelSize(0.035);
Graph_Graph1001->GetXaxis()->SetTitleSize(0.035);
Graph_Graph1001->GetXaxis()->SetTitleFont(42);
Graph_Graph1001->GetYaxis()->SetLabelFont(42);
Graph_Graph1001->GetYaxis()->SetLabelSize(0.035);
Graph_Graph1001->GetYaxis()->SetTitleSize(0.035);
Graph_Graph1001->GetYaxis()->SetTitleFont(42);
Graph_Graph1001->GetZaxis()->SetLabelFont(42);
Graph_Graph1001->GetZaxis()->SetLabelSize(0.035);
Graph_Graph1001->GetZaxis()->SetTitleSize(0.035);
Graph_Graph1001->GetZaxis()->SetTitleFont(42);
gre->SetHistogram(Graph_Graph1001);
multigraph->Add(gre,"");
Double_t Graph_fx1002[4] = {
5,
20,
40,
75};
Double_t Graph_fy1002[4] = {
1.025808,
0.9823451,
0.964104,
0.9707841};
Double_t Graph_fex1002[4] = {
5,
10,
10,
25};
Double_t Graph_fey1002[4] = {
0.001641175,
0.0009556419,
0.0008206184,
0.000461058};
gre = new TGraphErrors(4,Graph_fx1002,Graph_fy1002,Graph_fex1002,Graph_fey1002);
gre->SetName("Graph");
gre->SetTitle("some title_1");
gre->SetFillColor(1);
gre->SetFillStyle(0);
gre->SetLineColor(2);
gre->SetMarkerColor(2);
TH1F *Graph_Graph1002 = new TH1F("Graph_Graph1002","some title_1",100,0,110);
Graph_Graph1002->SetMinimum(0.9568668);
Graph_Graph1002->SetMaximum(1.033866);
//.........这里部分代码省略.........
开发者ID:Jelov,项目名称:JetEnergy_SR,代码行数:101,代码来源:result_JES_akPu4PF_(refpt>+75+&&+refpt+<+120)&&(abs(refeta)<2)_Centrality.C
示例8: plot_Significance
//.........这里部分代码省略.........
while(iMH<nMH){
double mhTMP=v_mhTMP.at(iMH);
for(int i=0;i<N;i++){
tobs->GetEntry(i);
if(obsM!=mhTMP)continue;//follow exactly the order of v_mhTMP
arrObs[iMH]=obsS;
}
iMH++;
}
for(int i=0;i<N;i++){
cout<<"M="<<arrM[i]<<" ExpSig="<<arrExp[i]<<flush;
if(unblind)cout<<" ObsSig="<<arrObs[i] <<endl;
else cout<<endl;
}
arrM[N]=arrM[N-1];
arrExp[N]=arrExp[N-1];
arrObs[N]=arrObs[N-1];
TGraph *grExp=new TGraph(N+1,arrM,arrExp);
TGraph *grObs=new TGraph(N+1,arrM,arrObs);
grExp->SetMarkerStyle(7);
grObs->SetMarkerStyle(20);
grExp->SetLineStyle(kDashed);
grObs->SetLineStyle(kSolid);
grExp->SetTitle("");
TLegend *l=new TLegend(0.50,0.15,0.89,0.38);
l->SetTextSize(0.025);
l->AddEntry(grExp,"Expected Significance","L");
if(unblind)l->AddEntry(grObs,"Observed Significance","LP");
l->SetFillColor(kWhite);
TCanvas *cS=new TCanvas("canSig","Significance EXO-VV",800,700);
cS->cd();
double fr_left=0.750, fr_down=1e-06,fr_right=4.050,fr_up=0.6;
grExp->GetXaxis()->SetTitle("M_{G_{Bulk}} (TeV)");
grExp->GetYaxis()->SetTitle("p-value");// #rightarrow 2l2q
grExp->GetYaxis()->SetTitleOffset(1.6);
grExp->SetLineWidth(3.0);
grExp->Draw("AL");
grObs->SetLineWidth(3.0);
if(unblind) grObs->Draw("LP");
grExp->GetXaxis()->SetRangeUser(fr_left,fr_right);
grExp->GetYaxis()->SetRangeUser(fr_down,fr_up);
cS->SetGrid();
gPad->SetLogy();
l->Draw();
// gPad->RedrawAxis("");
const double quant1sigma=1.58655253931457074e-01;
const double quant2sigma=2.27501319481792155e-02;
const double quant3sigma=1.34989803163009588e-03;
const double quant4sigma=3.16712418331199785e-05;
TLine *l1=new TLine();
l1->SetLineStyle(2);
l1->SetLineWidth(3.0);
l1->SetLineColor(kRed);
l1->DrawLine(0.8,quant1sigma,4.0,quant1sigma);
TLine *l2=new TLine();
l2->SetLineStyle(2);
l2->SetLineWidth(3.0);
示例9: drawLaser
void drawLaser(TString infile="laser_3fibers1M_sig15_inc4.root"){
//void drawLaser(TString infile="../build/laser_monbars.root"){
if(infile=="") return;
const Int_t Nfibers = 3;
TFile* output = new TFile("lasertime.root", "RECREATE");
const int nmcp = 70, npix = 64;
TH1F * hPTime[nmcp][npix];
TH1F * hTime = new TH1F("time",";time, [ns];entries, [#]",500,0,150);
for(Int_t m=0; m<nmcp; m++){
for(Int_t p=0; p<npix; p++){
hPTime[m][p] = new TH1F(Form("hPTime_%d",m*100+p),Form("mcp %d, pixel %d",m, p),400,0,25);//200); //800,1800
axisTime800x500(hPTime[m][p]);
// gStyle->SetOptTitle(0);
hPTime[m][p]->SetStats(1);
hPTime[m][p]->SetLineColor(1);
hPTime[m][p]->SetLineWidth(3);
}
}
gSystem->Load("../build/libGlxDirc.so");
TFile* f = new TFile(infile);
TTree* t = (TTree*)f->Get("glxlut");
TClonesArray *fLut[Nfibers];
for(int ifib=0;ifib<Nfibers;ifib++){
fLut[ifib] = new TClonesArray("GlxLutNode");
//t->SetBranchAddress("LUT_0", &fLut);
t->SetBranchAddress(Form("LUT_%d",ifib),&fLut[ifib]);
}
t->GetEntry(0);
Double_t evtime;
GlxLutNode* node;
Int_t mcpid, pixid;
for(int i=0; i<20000; i++){
for(int jfib=0;jfib<Nfibers;jfib++){
node = (GlxLutNode*) fLut[jfib]->At(i);
Int_t size = node->Entries();
if(size > 0){
// cout<<"node "<<node->GetDetectorId()<<" has "<<size<<" entries, mcp = "<<i/100<<", pix = "<<i%100<<endl;
mcpid = i/100;
pixid = i%100-1;
for(int u=0; u<size; u++){
evtime = node->GetTime(u);
hPTime[mcpid][pixid]->Fill(evtime);
}
}
}
}
output->Write();
gStyle->SetOptStat("e");
gStyle->SetOptFit(0001);
SetRootPalette(1);
//TCanvas* big = new TCanvas("big","big", 1400, 500);
//big->Divide(14,5);
TH2F * hPMToc[nmcp];
for(int ipad=0;ipad<nmcp;ipad++){
hPMToc[ipad] = new TH2F(Form("hPMToc_%d",ipad),Form("PMT %d",ipad),8,0,8,8,0,8);
hPMToc[ipad]->SetStats(0);
//big->cd(ipad);
//gPad->SetBottomMargin(0.001);
//gPad->SetLeftMargin(0.001);
//gPad->SetRightMargin(0.001);
//gPad->SetTopMargin(0.001);
//gPad->SetFrameBorderSize(0.01);
}
TCanvas* c = new TCanvas("c","c",800,600);
TF1* fit = new TF1("fit","gaus(0)",0.,10.);
TPaveText* tit;
gStyle->SetOptFit(0001);
//gStyle->SetOptStat(1111111);
Double_t y1,y2,prob;
for(Int_t m=0; m<nmcp; m++){
for(Int_t p=0; p<npix; p++){
hPMToc[m]->SetBinContent(p%8+1, 8-p/8, hPTime[m][p]->GetEntries());
// cout<<"bin "<<p+1<<" filled with "<< hPTime[m][p]->GetEntries()<<endl;
if(hPTime[m][p]->GetEntries() > 10){
c->Update();
fit->SetParameter(1,2.5);
fit->SetParameter(2,0.3);
fit->SetParameter(0,200.);
//hPTime[m][p]->Fit("fit","R","",0.,7.);
//hPTime[m][p]->Fit("fit","M","",0.,7.);
//hPTime[m][p]->Fit("fit","MW","",0.,7.);
//cout<<"maximum - "<<hPTime[m][p]->GetMaximum()<<endl;
y1 = hPTime[m][p]->GetMaximum()/2.;
y2 = hPTime[m][p]->GetMaximum()/3.*2.;
prob = hPTime[m][p]->GetEntries()/1000000.;
tit = new TPaveText(17.0,y1,25.,y2,"NB");
tit->SetFillColor(0);
tit->AddText(Form("prob = %f", prob));
hPTime[m][p]->Draw();
tit->Draw();
c->Update();
c->SaveAs(Form("pixels_3fibers_sig15_inc4/%d.png", m*100+p));
//.........这里部分代码省略.........
示例10: CreateBkgTemplates
//.........这里部分代码省略.........
sprintf(name,"Z_sigma_CAT%d",counter);
RooRealVar sZ(name,name,12,9,20);
sprintf(name,"Z_mean_shifted_CAT%d",counter);
RooFormulaVar mZShift(name,"@0*@1",RooArgList(mZ,*(kJES[isel])));
sprintf(name,"Z_sigma_shifted_CAT%d",counter);
RooFormulaVar sZShift(name,"@0*@1",RooArgList(sZ,*(kJER[isel])));
sprintf(name,"Z_a_CAT%d",counter);
RooRealVar aZ(name,name,-1,-10,10);
sprintf(name,"Z_n_CAT%d",counter);
RooRealVar nZ(name,name,1,0,10);
RooRealVar Zb0("Z_b0_CAT"+TString::Format("%d",counter),"Z_b0_CAT"+TString::Format("%d",counter),0.5,0,1.);
RooRealVar Zb1("Z_b1_CAT"+TString::Format("%d",counter),"Z_b1_CAT"+TString::Format("%d",counter),0.5,0,1.);
RooRealVar Zb2("Z_b2_CAT"+TString::Format("%d",counter),"Z_b2_CAT"+TString::Format("%d",counter),0.5,0,1.);
RooBernstein Zbkg("Z_bkg_CAT"+TString::Format("%d",counter),"Z_bkg_CAT"+TString::Format("%d",counter),x,RooArgSet(Zb0,Zb1,Zb2));
RooRealVar fZsig("fZsig_CAT"+TString::Format("%d",counter),"fZsig_CAT"+TString::Format("%d",counter),0.7,0.,1.);
RooCBShape Zcore("Zcore_CAT"+TString::Format("%d",counter),"Zcore_CAT"+TString::Format("%d",counter),x,mZShift,sZShift,aZ,nZ);
RooAddPdf modelZ("Z_model_CAT"+TString::Format("%d",counter),"Z_model_CAT"+TString::Format("%d",counter),RooArgList(Zcore,Zbkg),fZsig);
RooFitResult *resZ = modelZ.fitTo(*roohist_Z[icat],RooFit::Save(),RooFit::SumW2Error(kFALSE),"q");
canZ->cd(icat+1);
RooPlot* frame = x.frame();
roohist_Z[icat]->plotOn(frame);
modelZ.plotOn(frame,RooFit::LineWidth(2));
frame->GetXaxis()->SetTitle("M_{bb} (GeV)");
frame->Draw();
TPaveText *pave = new TPaveText(0.7,0.76,0.9,0.9,"NDC");
pave->SetTextAlign(11);
pave->SetFillColor(0);
pave->SetBorderSize(0);
pave->SetTextFont(62);
pave->SetTextSize(0.045);
pave->AddText(TString::Format("%s selection",SELNAME[isel].Data()));
pave->AddText(TString::Format("CAT%d",counter));
TText *lastline = pave->AddText("Z template");
pave->SetY1NDC(pave->GetY2NDC()-0.055*3);
TPaveText *paveorig = (TPaveText*)pave->Clone();
paveorig->Draw();
sprintf(name,"roohist_T_CAT%d",counter);
if (icat < 3) {
roohist_T[icat] = new RooDataHist(name,name,x,hTopYield);
}
else {
roohist_T[icat] = new RooDataHist(name,name,x,hSTYield);
}
sprintf(name,"Top_mean_CAT%d",counter);
RooRealVar mT(name,name,130,0,200);
sprintf(name,"Top_sigma_CAT%d",counter);
RooRealVar sT(name,name,50,0,200);
sprintf(name,"Top_mean_shifted_CAT%d",counter);
RooFormulaVar mTShift(name,"@0*@1",RooArgList(mT,*(kJES[isel])));
sprintf(name,"Top_sigma_shifted_CAT%d",counter);
RooFormulaVar sTShift(name,"@0*@1",RooArgList(sT,*(kJER[isel])));
sprintf(name,"Top_model_CAT%d",counter);
RooGaussian *modelT = new RooGaussian(name,name,x,mTShift,sTShift);
示例11: BtagEfficiencies
int BtagEfficiencies()
{
// Define sample
TFile* TTJets = new TFile("TTJetsFall11.root" , "READ");
TFile* WJetsHT = new TFile("WJetsHT.root" , "READ");
TFile* SingleTop = new TFile("SingleTop.root" , "READ");
// addSample(TFile* sample, TString name)
addSample(TTJets, "t#bar{t}+Jets", kRed, 21, 0.9, 7);
addSample(SingleTop, "single top", kBlue, 20, 1.0, 7);
addSample(WJetsHT, "W+Jets", kGreen+2, 23, 1.1, 7);
//addSample(SingleTop, "single top", kBlue, 24, 1, 7);
//addSample(WJetsHT, "W+Jets", kGreen, 25, 1, 7);
// addAlgorithm(TString name)
addAlgorithm("TCHEM");
// addSelectionStep(TString name, int lc, TString sn);
addSelectionStep("", 8, "RA4b");
// Flavors
Flavors.push_back("B");
Flavors.push_back("C");
Flavors.push_back("L");
// global settings
// gStyle->SetCanvasColor(10);
// gStyle->SetOptStat(0);
// gStyle->SetPalette(1);
// gStyle->SetTitleFillColor(0);
setTDRStyle();
// loop over algorithms
for(int a=0; a<Algos.size(); ++a)
{
std::cout << Algos[a] << std::endl;
// loop over flavor
for(int flv=0; flv<(int)Flavors.size(); ++flv)
{
// loop over selection steps
for(int s=0; s < Steps.size(); ++s)
{
std::cout << "Selection step " << Steps[s] << std::endl;
// Define canvas and legend/afs/desy.de/user/n/npietsch
TCanvas *canvas =new TCanvas(SelectionNames[s]+"_"+Algos[a]+"_"+Flavors[flv]+"_Pt",SelectionNames[s]+"_"+Algos[a]+"_"+Flavors[flv]+"_Pt",1);
TLegend *leg = new TLegend(.64,.18,.91,.35);
leg->SetTextFont(42);
leg->SetFillColor(0);
leg->SetLineColor(1);
TPaveText *label = new TPaveText(0.14,0.91,0.6,0.99,"NDC");
label->SetFillColor(0);
label->SetTextFont(42);
label->SetBorderSize(0);
TText *text=label->AddText("CMS Simulation, #sqrt{s}=7 TeV");
text->SetTextAlign(22);
TPaveText *label2 = new TPaveText(0.33,0.23,0.53,0.33,"NDC");
label2->SetFillColor(0);
label2->SetTextFont(62);
label2->SetBorderSize(0);
TText *text2=label2->AddText("0 < |#eta| < 0.8");
text2->SetTextAlign(22);
// declare maximum and ybin
double Maximum=0;
double ybin=1;
// loop over files
for(int f=0; f<(int)Files.size(); ++f)
{
TH2F* Pt_=(TH2F*)Files[f]->Get("bTagEffRA4bMu"+Algos[a]+Steps[s]+"/Num"+Flavors[flv]+"JetsPtEta");
TH2F* Pt2_=(TH2F*)Files[f]->Get("bTagEffRA4bEl"+Algos[a]+Steps[s]+"/Num"+Flavors[flv]+"JetsPtEta");
Pt_->Add(Pt2_);
TH2F* TaggedPt_=(TH2F*)Files[f]->Get("bTagEffRA4bMu"+Algos[a]+Steps[s]+"/Num"+Flavors[flv]+"JetsTaggedPtEta");
TH2F* TaggedPt2_=(TH2F*)Files[f]->Get("bTagEffRA4bEl"+Algos[a]+Steps[s]+"/Num"+Flavors[flv]+"JetsTaggedPtEta");
TaggedPt_->Add(TaggedPt2_);
TaggedPt_->Divide(Pt_);
//--------------------------------------
// Draw x and y errors
//--------------------------------------
// define shifts
double shift_=4*(f-1);
double shift2_=5*(f-1);
double shift3_=6*(f-1);
// define array xbinsPt
Int_t nBins=TaggedPt_->GetNbinsX();
double xbinsPt[18];
double xbinsPtX[18];
//.........这里部分代码省略.........
示例12: proj_npe_1
void proj_npe_1()
{
//=========Macro generated from canvas: c/
//========= (Wed Jul 15 16:16:05 2015) by ROOT version6.04/00
TCanvas *c = new TCanvas("c", "",0,45,600,500);
c->SetHighLightColor(2);
c->Range(-2655.754,-5.755,4350.289,51.795);
c->SetFillColor(0);
c->SetBorderMode(0);
c->SetBorderSize(2);
c->SetFrameBorderMode(0);
c->SetFrameBorderMode(0);
Double_t _fx2[39] = {
-1488.08,
-1403.181,
-1178.164,
-1033.78,
-849.3154,
-838.8983,
-788.1957,
-701.2156,
-654.0264,
-163.6875,
1.142557,
54.07047,
256.5688,
531.8203,
632.5535,
750.8472,
835.9491,
859.9519,
970.3359,
1013.975,
1084.685,
1488.872,
1635.959,
1867.579,
1967.102,
2022.346,
2109.155,
2234.388,
2395.154,
2415.658,
2534.104,
2547.086,
2643.154,
2683.775,
2846.919,
3002.304,
3074.222,
3131.044,
3182.615};
Double_t _fy2[39] = {
2.55,
2.3,
2.55,
2.7,
2.4,
2.65,
2.75,
2.5,
2.4,
2.45,
42.05,
2.55,
2.6,
2.6,
2.85,
2.7,
2.55,
2.6,
2.6,
2.6,
2.55,
2.25,
2.65,
2.6,
2.55,
2.25,
2.55,
2.45,
2.65,
2.65,
2.65,
2.6,
2.6,
2.35,
2.55,
2.15,
2.45,
2.75,
2.3};
TGraph *graph = new TGraph(39,_fx2,_fy2);
graph->SetName("");
graph->SetTitle("Event 1");
graph->SetFillColor(1);
Int_t ci; // for color index setting
TColor *color; // for color definition with alpha
//.........这里部分代码省略.........
示例13: plot_golfcourse_Asymptotic
//.........这里部分代码省略.........
grobslim_cls->SetName("LimitObservedCLs");
TGraphAsymmErrors *grmedian_cls=new TGraphAsymmErrors(nMassEff1,mass1,medianD);
grmedian_cls->SetName("LimitExpectedCLs");
TGraphAsymmErrors *gr68_cls=new TGraphAsymmErrors(nMassEff1,mass1,medianD,0,0,down68err,up68err);
gr68_cls->SetName("Limit68CLs");
TGraphAsymmErrors *gr95_cls=new TGraphAsymmErrors(nM95,mass95,median95,0,0,down95err,up95err);
gr95_cls->SetName("Limit95CLs");
// TGraphAsymmErrors *grthSM=new TGraphAsymmErrors(nMassEff1,mass1,xs,0,0,0,0);//xs_downerr,xs_uperr);
TGraph *grthSM=new TGraph(nMassEff1,mass1,xs);//xs_downerr,xs_uperr);
grthSM->SetName("SMXSection");
// TGraphAsymmErrors *grthSM10=new TGraphAsymmErrors(nMassEff1,mass1,xs10,0,0,0,0);
TGraph *grthSM10=new TGraph(nMassEff1,mass1,xs10);
grthSM10->SetName("SMXSection_2nd");
// cout<<"Plotting"<<endl;
double fr_left=590.0, fr_down=0.0005,fr_right=2020.0,fr_up=1.0;
if(!isZZChannel){fr_left=1000.0, fr_down=0.0000005,fr_right=2500.0,fr_up=10.0;}
TCanvas *cMCMC=new TCanvas("c_lim_Asymp","canvas with limits for Asymptotic CLs",630,600);
cMCMC->cd();
cMCMC->SetGridx(1);
cMCMC->SetGridy(1);
// draw a frame to define the range
TH1F *hr = cMCMC->DrawFrame(fr_left,fr_down,fr_right,fr_up,"");
TString VV = "ZZ";
if(!isZZChannel)VV="WW";
hr->SetXTitle("M_{1} [GeV]");
hr->SetYTitle("#sigma_{95%} #times BR(G #rightarrow "+VV+") [pb]");// #rightarrow 2l2q
// cMCMC->GetFrame()->SetFillColor(21);
//cMCMC->GetFrame()->SetBorderSize(12);
gr95_cls->SetFillColor(kYellow);
gr95_cls->SetFillStyle(1001);//solid
gr95_cls->SetLineStyle(kDashed);
gr95_cls->SetLineWidth(3);
gr95_cls->GetXaxis()->SetTitle("M_{1} [GeV]");
gr95_cls->GetYaxis()->SetTitle("#sigma_{95%} #times BR(G #rightarrow "+VV+") [pb]");// #rightarrow 2l2q
gr95_cls->GetXaxis()->SetRangeUser(fr_left,fr_right);
gr95_cls->Draw("3");
gr68_cls->SetFillColor(kGreen);
gr68_cls->SetFillStyle(1001);//solid
gr68_cls->SetLineStyle(kDashed);
gr68_cls->SetLineWidth(3);
gr68_cls->Draw("3same");
grmedian_cls->GetXaxis()->SetTitle("M_{1} [GeV]");
grmedian_cls->GetYaxis()->SetTitle("#sigma_{95%} #times BR(G #rightarrow "+VV+") [pb]");// #rightarrow 2l2q
grmedian_cls->SetMarkerStyle(24);//25=hollow squre
grmedian_cls->SetMarkerColor(kBlack);
grmedian_cls->SetLineStyle(2);
grmedian_cls->SetLineWidth(3);
grmedian_cls->SetMinimum(0.0);
grmedian_cls->SetMaximum(8.0);
grobslim_cls->SetMarkerColor(kBlack);
grobslim_cls->SetMarkerStyle(20);//24=hollow circle // 20 = solid circle
grobslim_cls->SetMarkerSize(0.7);
grobslim_cls->SetLineStyle(1);
grobslim_cls->SetLineWidth(1);
grthSM->SetLineColor(kRed);
grthSM->SetLineWidth(2);
grthSM->SetLineStyle(kSolid);
示例14: acceptance_mass
void acceptance_mass()
{
//=========Macro generated from canvas: c2/c2
//========= (Mon Oct 26 11:11:00 2015) by ROOT version6.02/05
TCanvas *c2 = new TCanvas("c2", "c2",20,42,700,500);
gStyle->SetOptStat(0);
c2->Range(-1.3125,-0.025,9.8125,0.225);
c2->SetFillColor(0);
c2->SetBorderMode(0);
c2->SetBorderSize(2);
c2->SetFrameBorderMode(0);
c2->SetFrameBorderMode(0);
TH2F *dummy42 = new TH2F("dummy42","dummy4",178,-0.2,8.7,100,0,0.2);
dummy42->SetStats(0);
Int_t ci; // for color index setting
TColor *color; // for color definition with alpha
ci = TColor::GetColor("#000099");
dummy42->SetLineColor(ci);
dummy42->GetXaxis()->SetTitle("Mass [GeV]");
dummy42->GetXaxis()->SetLabelFont(42);
dummy42->GetXaxis()->SetLabelSize(0.035);
dummy42->GetXaxis()->SetTitleSize(0.035);
dummy42->GetXaxis()->SetTitleFont(42);
dummy42->GetYaxis()->SetTitle("#epsilon_{rec} = N_{rec}/N_{tot}");
dummy42->GetYaxis()->SetLabelFont(42);
dummy42->GetYaxis()->SetLabelSize(0.035);
dummy42->GetYaxis()->SetTitleSize(0.035);
dummy42->GetYaxis()->SetTitleFont(42);
dummy42->GetZaxis()->SetLabelFont(42);
dummy42->GetZaxis()->SetLabelSize(0.035);
dummy42->GetZaxis()->SetTitleSize(0.035);
dummy42->GetZaxis()->SetTitleFont(42);
dummy42->Draw("");
Double_t Graph0_fx1006[5] = {
0.25,
0.275,
0.3,
2,
8.5};
Double_t Graph0_fy1006[5] = {
0.0865404,
0.08208333,
0.0749858,
0.05958333,
0.1375897};
Double_t Graph0_fex1006[5] = {
0,
0,
0,
0,
0};
Double_t Graph0_fey1006[5] = {
0.0009990599,
0.0009753636,
0.0009926071,
0.0008541653,
0.001244048};
TGraphErrors *gre = new TGraphErrors(5,Graph0_fx1006,Graph0_fy1006,Graph0_fex1006,Graph0_fey1006);
gre->SetName("Graph0");
gre->SetTitle("Graph");
gre->SetFillColor(1);
gre->SetMarkerStyle(7);
gre->SetMarkerSize(5);
TH1F *Graph_Graph1006 = new TH1F("Graph_Graph1006","Graph",100,0,9.325);
Graph_Graph1006->SetMinimum(0.05071871);
Graph_Graph1006->SetMaximum(0.1468442);
Graph_Graph1006->SetDirectory(0);
Graph_Graph1006->SetStats(0);
ci = TColor::GetColor("#000099");
Graph_Graph1006->SetLineColor(ci);
Graph_Graph1006->GetXaxis()->SetLabelFont(42);
Graph_Graph1006->GetXaxis()->SetLabelSize(0.035);
Graph_Graph1006->GetXaxis()->SetTitleSize(0.035);
Graph_Graph1006->GetXaxis()->SetTitleFont(42);
Graph_Graph1006->GetYaxis()->SetLabelFont(42);
Graph_Graph1006->GetYaxis()->SetLabelSize(0.035);
Graph_Graph1006->GetYaxis()->SetTitleSize(0.035);
Graph_Graph1006->GetYaxis()->SetTitleFont(42);
Graph_Graph1006->GetZaxis()->SetLabelFont(42);
Graph_Graph1006->GetZaxis()->SetLabelSize(0.035);
Graph_Graph1006->GetZaxis()->SetTitleSize(0.035);
Graph_Graph1006->GetZaxis()->SetTitleFont(42);
gre->SetHistogram(Graph_Graph1006);
gre->Draw(" pl");
Double_t Graph1_fx1007[4] = {
0.25,
0.275,
2,
8.5};
Double_t Graph1_fy1007[4] = {
0.08294682,
0.07862374,
0.06207908,
//.........这里部分代码省略.........
示例15: csv2
//.........这里部分代码省略.........
std::vector<std::vector<double_t> > vecplus(photondownhists[0]->GetNbinsX(), vector<double>(18));
std::vector<std::vector<double_t> > vecminus(photondownhists[0]->GetNbinsX(), vector<double>(18));
for(int p = 0; p <photondownhists[0]->GetNbinsX(); p++){ //loop over bins
for(int m = 0; m < 18; m++){ //loop over systematics
vecplus[p][m]=0;
vecminus[p][m]=0;
if (vec[p][m]>sum_h->GetBinContent(p+1)) vecplus[p][m] = vec[p][m]-sum_h->GetBinContent(p+1);
else if (vec[p][m]<sum_h->GetBinContent(p+1)) vecminus[p][m] = sum_h->GetBinContent(p+1)-vec[p][m];
cout<<vecplus[p][m]<<endl;
}}
TCanvas *c1 = new TCanvas("c1","signal region",50,50,865,780);
c1->cd();
TPad *pad1 = new TPad("pad1","pad1",0,0.25,1,1);
pad1->SetFillStyle(0);
pad1->SetFrameFillStyle(0);
pad1->SetBottomMargin(0);
TPad *pad2 = new TPad("pad2","pad2",0,0,1,0.25);
pad2->SetFillStyle(0);
pad2->SetFrameFillStyle(0);
pad2->SetTopMargin(0);
pad2->SetBottomMargin(0.12/0.46);
pad2->Draw();
pad1->Draw();
pad1->cd();
//W+jet
revDATAhists[2]->SetFillColor(kBlue-2);
revDATAhists[2]->SetLineColor(kBlack);
hs1->Add(revDATAhists[2]);
//Z+jet
hists[1]->SetFillColor(kOrange-4);
hists[1]->SetLineColor(kBlack);
hs1->Add(hists[1]);
//photon+jet
hists[3]->Add(hists[2]);
hists[4]->Add(hists[3]);
hists[5]->Add(hists[4]);
hists[6]->Add(hists[5]);
hists[7]->Add(hists[6]);
hists[7]->SetFillColor(19);
//hs1->Add(hists[7]);
//W+photon+jet
datahists[3]->SetFillColor(kGreen-3);
datahists[3]->SetLineColor(kBlack);
hs1->Add(datahists[3]);
//single top+singletop photon
hists[5+5]->Add(hists[4+5]);
hists[6+5]->Add(hists[5+5]);
hists[7+5]->Add(hists[6+5]);
hists[8+5]->Add(hists[7+5]);
hists[9+5]->Add(hists[8+5]);
hists[19+5]->Add(hists[9+5]);
hists[20+5]->Add(hists[19+5]);
hists[20+5]->SetFillColor(kRed+3);
hists[20+5]->SetLineColor(kBlack);
hs1->Add(hists[20+5]);
//hists[9+5]->SetFillColor(kAzure+10);
//hs1->Add(hists[9+5]);