本文整理汇总了C++中TLatex::SetTextFont方法的典型用法代码示例。如果您正苦于以下问题:C++ TLatex::SetTextFont方法的具体用法?C++ TLatex::SetTextFont怎么用?C++ TLatex::SetTextFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLatex
的用法示例。
在下文中一共展示了TLatex::SetTextFont方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: plot
// -------------------------------------------------------
int plot(){
TGraphErrors* intrinsic, *full;
TGraphErrors* Ratio;
TCanvas* canvas[20];
TCanvas* canvas2[4];
TFile *file;
TString fileName;
for(int j=10; j<12; j++){
fileName.Form("c%i",j);
canvas[j] = new TCanvas(fileName,fileName,0,0,500,500);
canvas[j] ->cd();
char file1[100] = "";
char file2[100] = "";
fileName.Form("root_files/jet_energy_resolution_for_1_eta_bin_%i_pTGamma_bin_imbalance_PFCHS_mc.root",j+1);
//fileName.Form("root_files/Scale_for_%i_eta_bin_PFCHS_mc.root",j+1);
file = TFile::Open(fileName);
file->GetObject("Graph",full);
full -> SetMarkerColor(1);
full -> SetLineColor(1);
full -> GetFunction("fResolutionAlpha")->SetLineColor(3);
full ->SetMaximum(0.12);
full ->SetMinimum(0.00);
full ->Draw("AP");
delete file;
TLatex* info = new TLatex();
char legname[100] = {0};
info->SetTextFont(132);
info-> SetNDC();
info->SetTextSize(0.040);
sprintf(legname,"#Chi^{2} = %f",full->GetFunction("fResolutionAlpha")->GetChisquare());
info->DrawLatex(0.60,0.80,legname);
delete info;
info = new TLatex();
info->SetTextFont(132);
info-> SetNDC();
info->SetTextSize(0.040);
sprintf(legname,"ndof = %i",full->GetFunction("fResolutionAlpha")->GetNDF());
info->DrawLatex(0.60,0.70,legname);
fileName.Form("jet_energy_resolution_imbalance_for_%i_pt_bin.pdf",j+1);
canvas[j]->SaveAs(fileName);
/*
const int numEntries = 9;
double xIntrinsic[numEntries] = {0};
double yIntrinsic[numEntries] = {0};
double xIntrinsicError[numEntries] = {0};
double yIntrinsicError[numEntries] = {0};
double xFull[numEntries] = {0};
double yFull[numEntries] = {0};
double xFullError[numEntries] = {0};
double yFullError[numEntries] = {0};
double x[numEntries] = {0};
double y[numEntries] = {0};
double xError[numEntries] = {0};
double yError[numEntries] = {0};
for(int i=0; i<numEntries; i++){
intrinsic -> GetPoint(i+0,xIntrinsic[i],yIntrinsic[i]);
full -> GetPoint(i+0,xFull[i],yFull[i]);
cout<<"xFull["<<i<<"] = "<<xFull[i]<<endl;
cout<<"xIntrinsic["<<i<<"] = "<<xIntrinsic[i]<<endl;
xIntrinsicError[i] = intrinsic -> GetErrorX(i+0);
yIntrinsicError[i] = intrinsic -> GetErrorY(i+0);
xFullError[i] = full -> GetErrorX(i+0);
yFullError[i] = full -> GetErrorY(i+0);
y[i] = yFull[i]/yIntrinsic[i] -1 ;
x[i] = 1./2.*(xFull[i]+xIntrinsic[i]);
yError[i] = TMath::Sqrt(TMath::Power((1./yIntrinsic[i]),2)*TMath::Power(yFullError[i],2)+TMath::Power((yFull[i]/(TMath::Power(yIntrinsic[i],2))),2)*TMath::Power(yIntrinsicError[i],2));
cout<<"y["<<i<<"] = "<<y[i]*100<<endl<<endl;
cout<<"yError["<<i<<"] = "<<yError[i]*100<<endl<<endl;
//.........这里部分代码省略.........
示例2: prepareAll
drawMultiplicity(const char* infilename, const char* system, Int_t rWrite, Int_t rPerformance) {
prepareAll();
TFile *f = new TFile(infilename, "read");
int minMultBin = 0; // 0, 2, 3
int maxMultBin = 6; // 2, 6, 8
double EvMultall = 0;
for (int i = minMultBin; i < maxMultBin; i++) {
if (i == minMultBin)
TH1D* hEvMult =(TH1D*)f->Get(Form("EvMultcutPass%stpcM%i",system,i));
else
hEvMult->Add((TH1D*)f->Get(Form("EvMultcutPass%stpcM%i",system,i)));
EvMultall += ((TH1D*)f->Get(Form("EvMultcutPass%stpcM%i",system,i)))->GetEntries();
cout << "MultBin " << i << " " << ((TH1D*)f->Get(Form("EvMultcutPass%stpcM%i",system,i)))->GetEntries() << endl;
//delete hEvMult;
}
cout << "Number of events (all bins): " << EvMultall << endl;
TCanvas *c2 = new TCanvas("mult", "Event Multiplicity");
c2->SetGridx();
c2->SetGridy();
c2->SetFillColor(10);
c2->SetLogy();
hEvMult->GetXaxis()->SetTitle("multiplicity");
hEvMult->GetYaxis()->SetTitle("number of events");
hEvMult->GetXaxis()->SetRangeUser(0,4000);
hEvMult->Draw("");
if (rPerformance){
TLatex *alice = new TLatex(0.35,0.27,"Performance");
alice->SetNDC();
alice->SetTextColor(myDarkRed);
alice->SetTextFont(42);
alice->SetTextSize(0.05);
alice->SetLineWidth(2);
alice->Draw();
TLatex *alice2 = new TLatex(0.32,0.21,"LHC10h - Pass2");
alice2->SetNDC();
alice2->SetTextColor(myDarkRed);
alice->SetTextFont(42);
alice2->SetTextSize(0.05);
alice2->SetLineWidth(2);
alice2->Draw();
TText *date = new TText(0.38,0.15,cStamp2);
date->SetNDC();
date->SetTextFont(42);
date->SetTextSize(0.04);
date->Draw();
//Acquire canvas proportions
Double_t AliLogo_LowX = 0.37;
Double_t AliLogo_LowY = 0.33;
Double_t AliLogo_Height = 0.22;
//ALICE logo is a png file that is 821x798 pixels->should be wider than a square
Double_t AliLogo_Width = (821./798.) * AliLogo_Height * gPad->GetWh() / gPad->GetWw();
TPad *myPadLogo = new TPad("myPadLogo", "Pad for ALICE Logo",AliLogo_LowX,AliLogo_LowY,AliLogo_LowX+AliLogo_Width,AliLogo_LowY+AliLogo_Height);
// myPadLogo->SetFillColor(2); // color to first figure out where is the pad then comment !
myPadSetUp(myPadLogo,0,0,0,0);
//myPadLogo->SetFixedAspectRatio(1);
myPadLogo->Draw();
myPadLogo->cd();
TASImage *myAliceLogo = new TASImage("alice_logo_transparent.png");
myAliceLogo->Draw();
}
if (rWrite == 1)
c2->SaveAs(Form("multiplicity%s.png",system));
if (rWrite == 2)
c2->SaveAs(Form("multiplicity%s.eps",system));
}
示例3: pi0MassFit
//.........这里部分代码省略.........
peakCentroid[nn] = parameterizedBackgroundFit[nn]->GetParameter(3);
peakCentroidError[nn] = parameterizedBackgroundFit[nn]->GetParError(3);
peakWidth[nn] = parameterizedBackgroundFit[nn]->GetParameter(4);
peakWidthError[nn] = parameterizedBackgroundFit[nn]->GetParError(4);
parameterizedBackground[nn]->SetParameters(bkgConst, bkgLin);
parameterizedBackground[nn]->SetLineColor(kRed);;
parameterizedBackground[nn]->Draw("same");
for(int kBin=1; kBin<=nMassBins; kBin++) {
double binCenter = _trueHisto[nn]->GetBinCenter(kBin);
if(binCenter < fitStart || binCenter > fitEnd) {
pi0MassSubtracted[nn]->SetBinContent(kBin, 0.0);
pi0MassSubtracted[nn]->SetBinError(kBin, 0.0);
} // check for mass value outside the fit range
else {
double sameEventContent = _trueHisto[nn]->GetBinContent(kBin);
double sameEventError = _trueHisto[nn]->GetBinError(kBin);
double calculatedBackground = parameterizedBackground[nn]->Eval(binCenter);
double subtractedYield = sameEventContent - calculatedBackground;
pi0MassSubtracted[nn]->SetBinContent(kBin, subtractedYield);
pi0MassSubtracted[nn]->SetBinError(kBin, sameEventError);
} // mass value within the fitted range
} // loop over mass bins
} // check on doing parameterized background fit
if(nn==0){
c1->cd(nn+1);
TLatex *tex = new TLatex(0.02, 0.9*histogramMaximumValue, dataText);
tex->SetTextFont(42);
tex->SetTextSize(0.06974556);
tex->SetLineWidth(2);
tex->Draw();
tex = new TLatex(0.02, 0.8*histogramMaximumValue,"|#eta|<1.5");
tex->SetTextFont(42);
tex->SetTextSize(0.06974556);
tex->SetLineWidth(2);
tex->Draw();
tex = new TLatex(0.09, 0.20*histogramMaximumValue, multiplicityText);
tex->SetTextFont(42);
tex->SetTextSize(0.06974556);
tex->SetLineWidth(2);
tex->Draw();
TLatex *tex2 = new TLatex(0.08, 0.10*histogramMaximumValue, Form("%5.1f < p_{T} < %5.1f (GeV/c)",pTbins[nn],pTbins[nn+1]));
tex2->SetTextFont(42);
tex2->SetTextSize(0.06974556);
tex2->SetLineWidth(2);
tex2->Draw();
}
if(nn>0){
TLatex *tex = new TLatex(0.014, 0.6*histogramMaximumValue ,Form("%5.1f < p_{T} < %5.1f (GeV/c)",pTbins[nn],pTbins[nn+1]));
tex->SetTextFont(42);
tex->SetTextSize(0.06974556);
tex->SetLineWidth(2);
tex->Draw();
} // check on upper left panel
(c1->cd(nn+1))->SetGrid();
} // Check on < 4 condition (top set of plots)
示例4: cccPlot
void cccPlot(int ndim) {
float fitval[4], fiterrl[4], fiterrh[4];
for(int cha=0; cha<4; ++cha) {
fiterrl[cha]=0;
fiterrh[cha]=0;
}
gStyle->SetOptStat(0);
gStyle->SetOptFit(1111);
TStyle *mystyle = RooHZZStyle("ZZ");
mystyle->cd();
stringstream file4mu,file4e,file2e2mu,filecomb;
file4mu << "higgsCombineSCAN" << ndim << "D4muFast.MultiDimFit.mH125.8.root";
file4e << "higgsCombineSCAN" << ndim << "D4eFast.MultiDimFit.mH125.8.root";
file2e2mu << "higgsCombineSCAN" << ndim << "D2e2muFast.MultiDimFit.mH125.8.root";
filecomb << "higgsCombineSCAN" << ndim << "DcombFast.MultiDimFit.mH125.8.root";
TFile *fit4mu = TFile::Open(file4mu.str().c_str());
TTree *tree4mu = (TTree*)fit4mu->Get("limit");
TFile *fit4e = TFile::Open(file4e.str().c_str());
TTree *tree4e = (TTree*)fit4e->Get("limit");
TFile *fit2e2mu = TFile::Open(file2e2mu.str().c_str());
TTree *tree2e2mu = (TTree*)fit2e2mu->Get("limit");
TFile *fitcomb = TFile::Open(filecomb.str().c_str());
TTree *treecomb = (TTree*)fitcomb->Get("limit");
vector<TTree*> trees;
trees.push_back(tree4mu);
trees.push_back(tree4e);
trees.push_back(tree2e2mu);
trees.push_back(treecomb);
for(int cha=0; cha<(int)trees.size(); ++cha) {
cout << "Analyzing scan for channel = " << cha << endl;
float MH;
float deltaNLL;
trees[cha]->SetBranchAddress("MH", &MH);
trees[cha]->SetBranchAddress("deltaNLL", &deltaNLL);
bool firstcross=false;
bool secondcross=false;
float prevStepMH=-1;
for(int i=0; i<(int)trees[cha]->GetEntries();++i) {
trees[cha]->GetEntry(i);
if(i==0) fitval[cha]=MH;
else {
if(2*deltaNLL<1 && firstcross==false) {
fiterrl[cha]=MH;
firstcross=true;
}
if(2*deltaNLL>1 && firstcross==true && secondcross==false) {
fiterrh[cha]=prevStepMH;
secondcross=true;
}
prevStepMH=MH;
}
}
}
for(int cha=0; cha<4; ++cha) {
fiterrl[cha]=fitval[cha]-fiterrl[cha];
fiterrh[cha]=fiterrh[cha]-fitval[cha];
// patch if the scan arrested too early
if(fiterrh[cha]==(-fitval[cha])) fiterrh[cha]=fiterrl[cha];
}
TLatex l; l.SetTextFont(43); l.SetNDC(); l.SetTextSize(25);
TCanvas *c1 = new TCanvas("c1","",750,750);
c1->SetLeftMargin(0.4);
c1->SetGridx(1);
int nChann = 3;
TH2F frame("frame",";best fit m_{X} (GeV);",1,122,132,nChann,0,nChann);
TGraphAsymmErrors points(nChann);
for (int cha=0; cha<3; ++cha) {
TString channame("");
if (cha==0) channame+=" 4#mu";
if (cha==1) channame+=" 4e";
if (cha==2) channame+=" 2e2#mu";
points.SetPoint(cha, fitval[cha], cha+0.5);
points.SetPointError(cha, fiterrl[cha], fiterrh[cha], 0, 0);
frame.GetYaxis()->SetBinLabel(cha+1, channame);
}
points.SetLineColor(kRed);
points.SetLineWidth(3);
points.SetMarkerStyle(21);
frame.GetXaxis()->SetNdivisions(5,kFALSE);
frame.GetXaxis()->SetTitleSize(0.05);
//.........这里部分代码省略.........
示例5: drawSpectra2D
//.........这里部分代码省略.........
setCanvasMargin(c, leftMargin, rightMargin, bottomMargin, topMargin);
setCanvasFinal(c, setLogx, setLogy, setLogz);
c->cd();
TLegend* leg = new TLegend();
std::string drawOption = "";
if (nDrawOptions == 1) drawOption = drawOptions.at(0).c_str();
else if (nDrawOptions == nHistosInput) drawOption = drawOptions.at(i%nDrawOptions).c_str();
h_draw[i]->Draw(drawOption.c_str());
if (nLegendEntryLabels == nHistosInput) {
std::string label = legendEntryLabels.at(i%nLegendEntryLabels).c_str();
std::string legendOption = "lpf";
if (drawOption.find("hist") != std::string::npos) legendOption = "lf";
if (label.compare(CONFIGPARSER::nullInput) != 0) leg->AddEntry(h_draw[i], label.c_str(), legendOption.c_str());
}
if (legendTextSize != 0) leg->SetTextSize(legendTextSize);
leg->SetBorderSize(legendBorderSize);
double height = calcTLegendHeight(leg);
double width = calcTLegendWidth(leg);
if (legendHeight != 0) height = legendHeight;
if (legendWidth != 0) width = legendWidth;
if (legendPosition.size() > 0) { // draw the legend if really a position is provided.
setLegendPosition(leg, legendPosition, c, height, width, legendOffsetX, legendOffsetY);
leg->Draw();
}
// add Text
TLatex* latex = 0;
if (nTextLines > 0) {
latex = new TLatex();
latex->SetTextFont(textFont);
latex->SetTextSize(textSize);
setTextAlignment(latex, textPosition);
std::vector<std::pair<float,float>> textCoordinates = calcTextCoordinates(textLines, textPosition, c, textOffsetX, textOffsetY);
for (int i = 0; i<nTextLines; ++i) {
float x = textCoordinates.at(i).first;
float y = textCoordinates.at(i).second;
latex->DrawLatexNDC(x, y, textLines.at(i).c_str());
}
}
// add Text above the pad
TLatex* latexOverPad = 0;
if (nTextsOverPad > 0) {
latexOverPad = new TLatex();
latexOverPad->SetTextFont(textAbovePadFont);
latexOverPad->SetTextSize(textAbovePadSize);
for (int i = 0; i < nTextsOverPad; ++i) {
int textOverPadAlignment = GRAPHICS::textAlign;
if (nTextsOverPadAlignments == 1) textOverPadAlignment = GraphicsConfigurationParser::ParseTextAlign(textsOverPadAlignments.at(0));
else if (nTextsOverPadAlignments == nTextsOverPad) textOverPadAlignment = GraphicsConfigurationParser::ParseTextAlign(textsOverPadAlignments.at(i));
latexOverPad->SetTextAlign(textOverPadAlignment);
setTextAbovePad(latexOverPad, c, textAbovePadOffsetX, textAbovePadOffsetY);
latexOverPad->DrawLatexNDC(latexOverPad->GetX(), latexOverPad->GetY(), textsOverPad.at(i).c_str());
}
}
// add TLine
TLine* line_horizontal[nTLines_horizontal];
for (int iLine = 0; iLine<nTLines_horizontal; ++iLine) {
// draw horizontal line
示例6: Draw
//.........这里部分代码省略.........
_hist[i]->SetLineColor(_sampleColor[i]);
// signal gets overlaid
if (i == itH) continue;
_hist[i]->SetFillColor(_sampleColor[i]);
_hist[i]->SetFillStyle(1001);
hstack->Add(_hist[i]);
}
if(_hist[itH]) _hist[itH]->SetLineWidth(3);
if(_data) _data->Rebin(rebin);
if(_data) _data->SetLineColor (kBlack);
if(_data) _data->SetMarkerStyle(kFullCircle);
if(_nostack) {
for(int ihist=0;ihist<(int)_hist.size();ihist++) {
_hist[ihist]->SetFillStyle(0);
_hist[ihist]->SetLineWidth(2);
}
hstack->Draw("hist,nostack");
if(_hist[itH]) _hist[itH]->Draw("hist,same");
if(_data) _data->Draw("ep,same");
} else {
hstack->Draw("hist");
if(_hist[itH]) _hist[itH]->Draw("hist,same");
if(_data) _data->Draw("ep,same");
}
//hstack->SetTitle("CMS preliminary");
Float_t theMax = hstack->GetMaximum();
Float_t theMin = hstack->GetMinimum();
theMax = 1.0;
//Float_t theMin = hstack->GetMinimum();
if (_hist[itH]) {
if (_hist[itH]->GetMaximum() > theMax) theMax = _hist[itH]->GetMaximum();
if (_hist[itH]->GetMinimum() < theMin) theMin = _hist[itH]->GetMinimum();
}
if (_data) {
Float_t dataMax = GetMaximumIncludingErrors(_data);
if (dataMax > theMax) theMax = dataMax;
}
if (gPad->GetLogy()) {
hstack->SetMaximum(500 * theMax);
hstack->SetMinimum(0.05);
} else {
hstack->SetMaximum(1.55 * theMax);
}
if(_breakdown) {
THStackAxisFonts(hstack, "y", "entries");
hstack->GetHistogram()->LabelsOption("v");
} else {
THStackAxisFonts(hstack, "x", TString::Format("%s [%s]",_xLabel.Data(),_units.Data()));
if(_units.Sizeof() == 1) {
THStackAxisFonts(hstack, "x", _xLabel.Data());
THStackAxisFonts(hstack, "y", "entries");
} else {
THStackAxisFonts(hstack, "x", TString::Format("%s [%s]",_xLabel.Data(),_units.Data()));
THStackAxisFonts(hstack, "y", TString::Format("entries / %.0f %s", _hist[iWZ]->GetBinWidth(0),_units.Data()));
}
}
// total mess to get it nice, should be redone
size_t j=0;
TString higgsLabel = " tH x 100";
//if(_mass != 0) higgsLabel.Form(" m_{H}=%d",_mass);
if(_data ) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _data, " data", "lp"); j++; }
if(_hist[itH ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[itH ], higgsLabel, "l" ); j++; }
if(_hist[iWZ ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[iWZ ], " WZ", "f" ); j++; }
if(_hist[iZZ ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[iZZ ], " ZZ", "f" ); j++; }
if(_hist[iWW ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[iWW ], " WW", "f" ); j++; }
if(_hist[itt ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[itt ], " tt", "f" ); j++; }
if(_hist[ittw ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[ittw ], " ttW", "f" ); j++; }
if(_hist[ittz ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[ittz ], " ttZ", "f" ); j++; }
if(_hist[iwww ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[iwww ], " WWW", "f" ); j++; }
if(_hist[iwwz ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[iwwz ], " WWZ", "f" ); j++; }
if(_hist[iwzz ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[iwzz ], " WZZ", "f" ); j++; }
if(_hist[idy ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[idy ], " Drell-Yan","f" ); j++; }
//TLatex* luminosity = new TLatex(0.9, 0.815, TString::Format("L = %.1f fb^{-1}",_lumi));
TLatex* luminosity = new TLatex(0.9, 0.95, TString::Format("CMS Preliminary \\sqrt{s} = 8 TeV, L = %.1f fb^{-1}",_lumi));
luminosity->SetNDC();
luminosity->SetTextAlign(32);
luminosity->SetTextFont(42);
luminosity->SetTextSize(_tsize);
luminosity->Draw("same");
// if(_extraLabel) _extraLabel->Draw("same");
// return hstack->GetHistogram();
}
示例7: comp
void comp(){
TLatex Tl; Tl.SetTextFont(43); Tl.SetTextSize(20);
c1 = new TCanvas("c1","Helix vs. KF fits",600,400);
TFile *f2 = TFile::Open("kfilt.root");
TH1F *h2 = new TH1F("hframe2","KF fit",500,-10.,5.);
ntuple2->Draw("pTresol_kf>>hframe2");
h2->Draw();
h2->SetLineColorAlpha(kRed, 0.6);
h2->GetXaxis()->SetTitle("p_{T} resol.");
TFile *f1 = TFile::Open("helix.root");
TH1F *h1 = new TH1F("hframe1","Helix fit",500,-10.,5.);
ntuple1->Draw("pTresol_helix>>hframe1","","same");
h1->Draw("same");
h1->SetLineColorAlpha(kBlue, 0.6);
gPad->SetLogy(1);
Tl.DrawLatex(0, 30, "red: p_{T} KF fit");
Tl.DrawLatex(0, 20, "blue: p_{T} Helix fit");
c2 = new TCanvas("c2","Helix vs. KF fits",600,400);
TFile *f2 = TFile::Open("kfilt.root");
TH1F *h2 = new TH1F("hframe2","KF fit",500,-15.,15.);
ntuple2->Draw("thetaDiff_kf>>hframe2");
h2->Draw();
h2->SetLineColorAlpha(kRed, 0.2);
h2->GetXaxis()->SetTitle("#Delta #theta (mrad)");
TFile *f1 = TFile::Open("helix.root");
TH1F *h1 = new TH1F("hframe1","Helix fit",500,-15.,15.);
ntuple1->Draw("thetaDiff_helix>>hframe1","","same");
h1->Draw("same");
h1->SetLineColorAlpha(kBlue, 0.2);
gPad->SetLogy(1);
Tl.DrawLatex(0, 30, "red: #theta KF fit");
Tl.DrawLatex(0, 20, "blue: #theta Helix fit");
c3 = new TCanvas("c3","Helix vs. KF fits",600,400);
TFile *f2 = TFile::Open("kfilt.root");
TH1F *h2 = new TH1F("hframe2","KF fit",500,-150.,150.);
ntuple2->Draw("phiDiff_kf>>hframe2");
h2->Draw();
h2->SetLineColorAlpha(kRed, 0.6);
h2->GetXaxis()->SetTitle("#Delta #phi (mrad)");
TFile *f1 = TFile::Open("helix.root");
TH1F *h1 = new TH1F("hframe1","Helix fit",500,-150.,150.);
ntuple1->Draw("phiDiff_helix>>hframe1","","same");
h1->Draw("same");
h1->SetLineColorAlpha(kBlue, 0.6);
gPad->SetLogy(1);
Tl.DrawLatex(0, 30, "red: #phi KF fit");
Tl.DrawLatex(0, 20, "blue: #phi Helix fit");
}
示例8: CMSLumi
void CMSLumi(TCanvas *& canvas, const Int_t iPosX, const Double_t inlumi){
canvas->cd();
TString cmsText = "CMS";
Double_t cmsTextFont = 61; // default is helvetic-bold
Bool_t writeExtraText = true;
TString extraText = "Preliminary";
Double_t extraTextFont = 52; // default is helvetica-italics
TString lumiText = Form("%1.1f fb^{-1} (13 TeV)", inlumi);
// text sizes and text offsets with respect to the top frame
// in unit of the top margin size
Double_t lumiTextSize = 0.6;
Double_t lumiTextOffset = 0.1;
Double_t cmsTextSize = 0.75;
Double_t cmsTextOffset = 0.05; // only used in outOfFrame version
Double_t relPosX = 0.003;//0.045;
Double_t relPosY = 0.035;
Double_t relExtraDY = 1.2;
// ratio of "CMS" and extra text size
Double_t extraOverCmsTextSize = 0.76;
Bool_t outOfFrame = false;
if ( iPosX/10 == 0 ) {
outOfFrame = true;
}
Int_t alignY_=3;
Int_t alignX_=2;
if (iPosX/10 == 0) {alignX_ = 1;}
if (iPosX == 0) {alignY_ = 1;}
if (iPosX/10 == 1) {alignX_ = 1;}
if (iPosX/10 == 2) {alignX_ = 2;}
if (iPosX/10 == 3) {alignX_ = 3;}
Int_t align_ = 10*alignX_ + alignY_;
Double_t H = canvas->GetWh();
Double_t W = canvas->GetWw();
Double_t l = canvas->GetLeftMargin();
Double_t t = canvas->GetTopMargin();
Double_t r = canvas->GetRightMargin();
Double_t b = canvas->GetBottomMargin();
Double_t e = 0.025;
TLatex latex;
latex.SetNDC();
latex.SetTextAngle(0);
latex.SetTextColor(kBlack);
Double_t extraTextSize = extraOverCmsTextSize*cmsTextSize;
latex.SetTextFont(42);
latex.SetTextAlign(31);
latex.SetTextSize(lumiTextSize*t);
latex.DrawLatex(1-r+0.08,1-t+lumiTextOffset*t+0.01,lumiText);
if (outOfFrame) {
latex.SetTextFont(cmsTextFont);
latex.SetTextAlign(11);
latex.SetTextSize(cmsTextSize*t);
latex.DrawLatex(l,1-t+cmsTextOffset*t,cmsText);
}
Double_t posX_;
if (iPosX%10 <= 1) {
posX_ = l + relPosX*(1-l-r);
}
else if (iPosX%10 == 2) {
posX_ = l + 0.5*(1-l-r);
}
else if (iPosX%10 == 3) {
posX_ = 1-r - relPosX*(1-l-r);
}
Double_t posY_ = 1-t - relPosY*(1-t-b);
if (!outOfFrame) {
latex.SetTextFont(cmsTextFont);
latex.SetTextSize(cmsTextSize*t);
latex.SetTextAlign(align_);
latex.DrawLatex(posX_, posY_, cmsText);
if (writeExtraText) {
latex.SetTextFont(extraTextFont);
latex.SetTextAlign(align_);
latex.SetTextSize(extraTextSize*t);
latex.DrawLatex(posX_, posY_- relExtraDY*cmsTextSize*t, extraText);
}
}
else if (outOfFrame && writeExtraText){
if (iPosX == 0) {
posX_ = l + relPosX*(1-l-r)+0.05;
posY_ = 1-t+lumiTextOffset*t;
}
latex.SetTextFont(extraTextFont);
//.........这里部分代码省略.........
示例9: MakeClosurePlot
//.........这里部分代码省略.........
for (Int_t i = 0; i < hPred->GetNbinsX()+2; i++) {
if (hPred->GetBinContent(i) > 1e-6) { //< not empty
double binerror2 = (pow(hPred->GetBinError(i), 2));
double binerror = sqrt(binerror2);
ratiosysterr->SetBinError(i, binerror / hPred->GetBinContent(i));
}
}
double max = hObs->GetMaximum();
if (hPred->GetMaximum() > max) max = hPred->GetMaximum();
if (logy) {
hPred->SetMaximum(max*10);
hPred->SetMinimum(0.09);
} else {
hPred->SetMaximum(max*1.5);
hPred->SetMinimum(0.);
}
hPred->GetYaxis()->SetTitle("Events / bin");
hPred->Draw("hist");
hObs->Draw("e1,same");
staterr->Draw("e2 same");
hPred->GetXaxis()->SetTitleSize(0.035);
hPred->GetXaxis()->SetLabelSize(0.035);
/* hObs->GetYaxis()->SetTitleSize(0.035); */
/* hObs->GetYaxis()->SetLabelSize(0.035); */
TLegend * leg2 = new TLegend(0.72, 0.68, 0.94, 0.92);
set_style(leg2,0.035);
leg2->AddEntry(hObs,"Obs.","elp");
leg2->AddEntry(hPred,"Pred.","f");
leg2->AddEntry(staterr, "Syst. uncert.", "f");
leg2->Draw();
TLatex * latex = new TLatex();
latex->SetNDC();
latex->SetTextAlign(12);
latex->SetTextFont(62);
latex->SetTextSize(0.042);
latex->DrawLatex(0.19, 0.89, "CMS Simulation");
latex->SetTextSize(0.03);
TString stamp = Form("#sqrt{s} = 13 TeV, L = %3.1f fb^{-1}", int_lumi);
latex->DrawLatex(0.19, 0.84, stamp);
pad2->cd();
pad2->SetGridy(0);
ratiostaterr->GetXaxis()->SetRangeUser(0,6);
ratiostaterr->Draw("e2");
//ratiosysterr->Draw("e2 same");
ratiostaterr->Draw("e2 same");
ratiounity->Draw();
ratio->Draw("e1 same");
TPaveText * pave = new TPaveText(0.18, 0.86, 0.4, 0.96, "brNDC");
pave->SetLineColor(0);
pave->SetFillColor(kWhite);
pave->SetShadowColor(0);
pave->SetBorderSize(1);
double nchisq = hObs->Chi2Test(hPred, "UWCHI2/NDF, P"); // MC uncert. (stat)
double p_value = hObs->Chi2Test(hPred, "UW"); // MC uncert. (stat)
// //double kolprob = hdata_obs->KolmogorovTest(hmc_pred); // MC uncert. (stat)
TText * text = pave->AddText(Form("#chi_{#nu}^{2}/ndf = %.3f, p = %.3f", nchisq, p_value));
// //TText * text = pave->AddText(Form("#chi_{#nu}^{2} = %.3f, K_{s} = %.3f", nchisq, kolprob));
text->SetTextFont(62);
text->SetTextSize(0.07);
// text->SetTextSize(0.06);
pave->Draw();
/* TLegend * ratioleg = new TLegend(0.72, 0.88, 0.94, 0.96); */
/* set_style(ratioleg); */
/* ratioleg->SetTextSize(0.07); */
/* ratioleg->AddEntry(ratiostaterr, "MC uncert. (stat)", "f"); */
/* ratioleg->Draw(); */
pad1->cd();
gPad->RedrawAxis();
gPad->Modified();
gPad->Update();
pad2->cd();
gPad->RedrawAxis();
gPad->Modified();
gPad->Update();
c1->cd();
c1->Print("Closure/plots/no_dp_cut/"+name+".pdf");
delete staterr;
delete ratio;
delete ratiostaterr;
delete ratiosysterr;
delete leg2;
// delete ratioleg;
delete pad1;
delete pad2;
delete c1;
delete latex;
}
示例10: Drawmorephibinvn
void Drawmorephibinvn(TH1D * vn_morephibin, TGraphErrors * gr_vn_morephibin_sys, TGraphAsymmErrors * gr_vn_morephibin_sys_Bfeeddown, TString trigname = "MBtrig", TString vnname = "v2", TString Ytitle = "v_{2}", int cent_low = 0, int cent_high = 100, double ptlow = 1.0, double pthigh = 40.0, TString fitoption = "poly3bkg", bool DrawsysBfeeddown_Alice = false, bool DrawsysBfeeddown_data = false)
{
TCanvas * cfg_vn = new TCanvas(Form("cfg_comparison_%s_%s", trigname.Data(), vnname.Data()));
gr_vn_morephibin_sys->GetY()[0] = 3.;
gr_vn_morephibin_sys->GetY()[1] = 3.;
gr_vn_morephibin_sys_Bfeeddown->GetY()[0] = 3.;
gr_vn_morephibin_sys_Bfeeddown->GetY()[1] = 3.;
if( cent_low == 0 && cent_high == 10 )
{
vn_morephibin->SetBinContent( vn_morephibin->FindBin(1.5), 3 );
vn_morephibin->SetBinError( vn_morephibin->FindBin(1.5), 0 );
gr_vn_morephibin_sys->GetY()[2] = 3.;
gr_vn_morephibin_sys->GetEY()[2] = 0.;
gr_vn_morephibin_sys_Bfeeddown->GetY()[2] = 3.;
gr_vn_morephibin_sys_Bfeeddown->GetEYlow()[2] = 0.;
gr_vn_morephibin_sys_Bfeeddown->GetEYhigh()[2] = 0.;
}
gr_vn_morephibin_sys->SetFillStyle(0);
gr_vn_morephibin_sys->SetLineColor(2.0);
gr_vn_morephibin_sys->SetMarkerSize(0);
vn_morephibin->SetLineWidth(0);
vn_morephibin->SetMarkerSize(0.8);
vn_morephibin->Draw();
for( int ibin = 0; ibin < gr_vn_morephibin_sys->GetN(); ibin++ )
gr_vn_morephibin_sys->GetEX()[ibin] = 0.5;
gr_vn_morephibin_sys->SetMarkerColor(4.0);
gr_vn_morephibin_sys->SetMarkerStyle(21);
//gr_vn_morephibin_sys->SetLineWidth(1);
gr_vn_morephibin_sys->SetLineWidth(0);//hard probes
gr_vn_morephibin_sys->SetFillStyle(0);
gr_vn_morephibin_sys->SetLineColor(4.0);
gr_vn_morephibin_sys_Bfeeddown->SetMarkerColor(4.0);
gr_vn_morephibin_sys_Bfeeddown->SetMarkerStyle(21);
gr_vn_morephibin_sys_Bfeeddown->SetLineWidth(0);
gr_vn_morephibin_sys_Bfeeddown->SetFillStyle(1001);
gr_vn_morephibin_sys_Bfeeddown->SetFillColor(kBlue-9);
gr_vn_morephibin_sys_Bfeeddown->SetLineColor(kBlue-9);
if( DrawsysBfeeddown_Alice || DrawsysBfeeddown_data ) gr_vn_morephibin_sys_Bfeeddown->Draw("2same");
if( fitoption == "poly3bkg" ) gr_vn_morephibin_sys->Draw("E2same");
vn_morephibin->Draw("same");
TLatex Tl;
Tl.SetNDC();
Tl.SetTextAlign(12);
Tl.SetTextSize(0.05);
Tl.SetTextFont(42);
Tl.DrawLatex(0.125,0.965, "#font[61]{CMS} #scale[0.8]{Preliminary}");
Tl.DrawLatex(0.57,0.965, "#scale[0.8]{PbPb #sqrt{s_{NN}} = 5.02 TeV}");
TLatex* tex;
tex = new TLatex(0.20,0.83,"|y| < 1.0");
tex->SetNDC();
tex->SetTextFont(42);
tex->SetTextSize(0.05);
tex->SetLineWidth(2);
tex->Draw();
tex = new TLatex(0.20,0.76,Form("Cent. %d-%d%%", cent_low, cent_high));
tex->SetNDC();
tex->SetTextFont(42);
tex->SetTextSize(0.05);
tex->SetLineWidth(2);
tex->Draw();
TF1 * fun = new TF1("fun", "0.0", 0, 100);
fun->SetLineColor(1.0);
fun->SetLineStyle(3);
fun->SetLineWidth(1);
fun->Draw("same");
if( DrawsysBfeeddown_Alice || DrawsysBfeeddown_data )
{
tex = new TLatex(0.3,0.25,"Filled box: syst. from non-prompt D^{0}");
tex->SetNDC();
tex->SetTextFont(42);
tex->SetTextSize(0.04);
tex->SetLineWidth(2);
tex->Draw();
tex = new TLatex(0.3,0.20,"Open box: other syst.");
tex->SetNDC();
tex->SetTextFont(42);
tex->SetTextSize(0.04);
tex->SetLineWidth(2);
tex->Draw();
}
cfg_vn->SaveAs(Form("Plots_vn/cfg_finalmorephibin_%s_%s_cent%dto%d_Bfeeddownsys_Alice%d_data%d_%s_effcorrected0.pdf", trigname.Data(), vnname.Data(), cent_low, cent_high, DrawsysBfeeddown_Alice, DrawsysBfeeddown_data, fitoption.Data()));
}
示例11: make1DLimit
//.........这里部分代码省略.........
error.Draw("A3");
error2S.Draw("3SAME");
error.Draw("3");
theo->SetTitle("");
theo->Draw("3C");
graph.SetLineStyle(kDashed);
graph.SetLineWidth(2.0);
graph.SetTitle("");
graph.Draw("C");
obser.SetLineStyle(1);
obser.SetLineWidth(2.0);
obser.SetTitle("");
if(!blind) obser.Draw("C");
TLegend leg(0.65,0.65,0.89,0.89);
leg.SetFillColor(0);
leg.SetBorderSize(0);
leg.AddEntry(&graph,"expected","l");
leg.AddEntry(&error,"expected #pm1#sigma","F");
leg.AddEntry(&error2S,"expected #pm2#sigma","F");
leg.AddEntry(theo,"theoretical","f");
if(!blind) leg.AddEntry(&obser,"observed","l");
leg.Draw("SAME");
TLatex latex;
latex.SetNDC();
latex.SetTextAngle(0);
latex.SetTextColor(kBlack);
float extraTextSize = extraOverCmsTextSize*cmsSize;
latex.SetTextFont(lumifont);
latex.SetTextAlign(31);
latex.SetTextSize(cmsSize);
latex.DrawLatex(lumix, lumiy,lumiText);
latex.SetTextFont(cmsTextFont);
latex.SetTextAlign(31);
latex.SetTextSize(cmsSize);
latex.DrawLatex(cmsx, cmsy, CMSText);
latex.SetTextFont(extraTextFont);
latex.SetTextAlign(31);
latex.SetTextSize(extraTextSize);
latex.DrawLatex(extrax, extray, extraText);
TString infix=(blind ? "" : "_OBS");
cv.SaveAs(combine_dir+"/expected_exclusion_"+type+"_1D"+infix+"_v2.png");
cv.SaveAs(combine_dir+"/expected_exclusion_"+type+"_1D"+infix+"_v2.pdf");
cv.SaveAs(combine_dir+"/expected_exclusion_"+type+"_1D"+infix+"_v2.C");
error_r.SetMaximum(1e2);
error_r.SetMinimum(1e-2);
error_r.SetTitle("");
error_r.GetYaxis()->SetLabelSize(0.04);
error_r.GetYaxis()->SetTitleSize(0.06);
error_r.GetYaxis()->SetTitleOffset(0.8);
error_r.GetXaxis()->SetLabelSize(0.04);
error_r.GetXaxis()->SetTitleSize(0.05);
error_r.GetXaxis()->SetTitleOffset(0.9);
error_r.GetYaxis()->SetTitle("#sigma_{95%}/#sigma_{NLO}");
if(type=="HH") error_r.GetXaxis()->SetTitle("m_{neutralino} (GeV)");
else error_r.GetXaxis()->SetTitle("m_{chargino} (GeV)");
示例12: Get_vn_pt_staterror_signalfraction
void Get_vn_pt_staterror_signalfraction( TH1D * h_vn_pt_staterror_signalfraction, TH1D * h_vn_toyMC_oneptbin[], TString MBorDtrig, TString EPorSP, TString vnname, int cent_low, int cent_high, int iptstart, int iptend, TString fitoption)
{
for( int ipt = iptstart; ipt < iptend; ipt++ )
{
TCanvas * cfg_fit_staterror_signalfraction = new TCanvas( Form("cfg_staterror_signalfraction_%s_%s_%d", MBorDtrig.Data(), vnname.Data(), ipt), Form("cfg_staterror_signalfraction_%s_%s_%d", MBorDtrig.Data(), vnname.Data(), ipt), 600, 600);
float vn_mean = h_vn_pt_staterror_signalfraction->GetBinContent( ipt+1 );
float v3_staterror = h_vn_pt_staterror_signalfraction->GetBinError( ipt+1 );
float fitrangelow;
float fitrangehigh;
if( vnname == "v2" )
{
fitrangelow = vn_mean - 0.4 * v3_staterror;
fitrangehigh = vn_mean + 0.4 * v3_staterror;
}
else
{
fitrangelow = vn_mean - 0.2 * v3_staterror;
fitrangehigh = vn_mean + 0.2 * v3_staterror;
}
cout << "ipt: " << ipt << " vn_mean: " << vn_mean << " v3_staterror: " << v3_staterror << endl;
TF1 * fit = new TF1( Form("f_staterror_signalfraction_%s_%s_%d", MBorDtrig.Data(), vnname.Data(), ipt), "gaus(0)", fitrangelow, fitrangehigh);
fit->SetParameter( 0, 30.);
fit->SetParameter( 1, vn_mean);
fit->SetParameter( 2, 0.05 * v3_staterror);
fit->SetLineColor(2);
h_vn_toyMC_oneptbin[ipt]->Fit( Form("f_staterror_signalfraction_%s_%s_%d", MBorDtrig.Data(), vnname.Data(), ipt), "q", "", fitrangelow, fitrangehigh);
h_vn_toyMC_oneptbin[ipt]->Fit( Form("f_staterror_signalfraction_%s_%s_%d", MBorDtrig.Data(), vnname.Data(), ipt), "L q", "", fitrangelow, fitrangehigh);
h_vn_toyMC_oneptbin[ipt]->Fit( Form("f_staterror_signalfraction_%s_%s_%d", MBorDtrig.Data(), vnname.Data(), ipt), "L q", "", fitrangelow, fitrangehigh);
h_vn_toyMC_oneptbin[ipt]->Fit( Form("f_staterror_signalfraction_%s_%s_%d", MBorDtrig.Data(), vnname.Data(), ipt), "L m", "", fitrangelow, fitrangehigh);
h_vn_toyMC_oneptbin[ipt]->GetXaxis()->SetRangeUser( fitrangelow, fitrangehigh);
h_vn_pt_staterror_signalfraction->SetBinContent( ipt+1, fit->GetParameter(1));
h_vn_pt_staterror_signalfraction->SetBinError( ipt+1, fit->GetParameter(2));
TLatex Tl;
Tl.SetNDC();
Tl.SetTextAlign(12);
Tl.SetTextSize(0.05);
Tl.SetTextFont(42);
Tl.DrawLatex(0.125,0.965, "#font[61]{CMS} #scale[0.8]{Preliminary}");
Tl.DrawLatex(0.57,0.965, "#scale[0.8]{PbPb #sqrt{s_{NN}} = 5.02 TeV}");
TLatex* tex;
tex = new TLatex(0.55,0.83,"|y| < 1.0");
tex->SetNDC();
tex->SetTextFont(42);
tex->SetTextSize(0.04);
tex->SetLineWidth(2);
tex->Draw();
tex = new TLatex(0.55,0.78,Form("Cent. %d-%d%%", cent_low, cent_high));
tex->SetNDC();
tex->SetTextFont(42);
tex->SetTextSize(0.04);
tex->SetLineWidth(2);
tex->Draw();
float ptmin = ptbins[ipt];
float ptmax = ptbins[ipt+1];
tex = new TLatex(0.55,0.73,Form("%.1f < p_{T} < %.1f GeV/c",ptmin,ptmax));
tex->SetNDC();
tex->SetTextFont(42);
tex->SetTextSize(0.04);
tex->SetLineWidth(2);
tex->Draw();
cfg_fit_staterror_signalfraction->SaveAs(Form("Plots_vn/plots_fit_staterror_signalfraction/cfg_staterror_signalfraction_%s_%s_%d_%s_cent%dto%d_%s.pdf", MBorDtrig.Data(), vnname.Data(), ipt, EPorSP.Data(), cent_low, cent_high, fitoption.Data()));
}
}
示例13: RAAweighting
int RAAweighting()
{
gStyle->SetOptTitle(0);
gStyle->SetOptStat(0);
gStyle->SetOptFit(0000);
gStyle->SetEndErrorSize(0);
gStyle->SetTextSize(0.05);
gStyle->SetTextFont(42);
gStyle->SetPadRightMargin(0.043);
gStyle->SetPadLeftMargin(0.18);
gStyle->SetPadTopMargin(0.1);
gStyle->SetPadBottomMargin(0.145);
gStyle->SetTitleX(.0f);
ifstream getdata("theoryRAA/Magdalena.dat");
if(!getdata.is_open())
{
cout<<" ERROR: Opening the file fails"<<endl;
return 1;
}
Int_t nbin=0;
while(!getdata.eof())
{
getdata>>fpt[nbin]>>fRAA[nbin];
cout<<fpt[nbin]<<" "<<fRAA[nbin]<<endl;
nbin++;
}
TGraph* gRAA = new TGraph(nbin,fpt,fRAA);
gRAA->SetMarkerSize(0.8);
gRAA->SetMarkerStyle(20);
gRAA->SetMarkerColor(kBlack);
TCanvas* cRAA = new TCanvas("cRAA","",600,600);
TH2F* hempty = new TH2F("hempty","",20,0.,55.,10.,0.3,0.8);
hempty->GetXaxis()->SetTitle("B^{+} p_{T} (GeV/c)");
hempty->GetYaxis()->SetTitle("R_{AA}");
hempty->GetXaxis()->CenterTitle();
hempty->GetYaxis()->CenterTitle();
hempty->GetXaxis()->SetTitleOffset(1.3);
hempty->GetYaxis()->SetTitleOffset(1.8);
hempty->GetXaxis()->SetTitleSize(0.045);
hempty->GetYaxis()->SetTitleSize(0.045);
hempty->GetXaxis()->SetTitleFont(42);
hempty->GetYaxis()->SetTitleFont(42);
hempty->GetXaxis()->SetLabelFont(42);
hempty->GetYaxis()->SetLabelFont(42);
hempty->GetXaxis()->SetLabelSize(0.04);
hempty->GetYaxis()->SetLabelSize(0.04);
hempty->Draw();
gRAA->Draw("samep");
TF1* fRAA = new TF1("fRAA","exp([0]+[1]*x+[2]*x*x+[3]*x*x*x)+[4]");
fRAA->SetLineWidth(2);
gRAA->Fit("fRAA","","",4.8,50.5);
gRAA->Fit("fRAA","","",4.8,50.5);
cout<<endl;
cout<<" exp("<<fRAA->GetParameter(0)<<"+"<<fRAA->GetParameter(1)<<"*x+"<<fRAA->GetParameter(2)<<"*x*x+"<<fRAA->GetParameter(3)<<"*x*x*x)+"<<fRAA->GetParameter(4)<<endl;
cout<<endl;
TLatex* texCms = new TLatex(0.18,0.93, "#scale[1.25]{CMS} #bf{#it{Preliminary}}");
texCms->SetNDC();
texCms->SetTextAlign(12);
texCms->SetTextSize(0.04);
texCms->SetTextFont(42);
texCms->Draw();
TLatex* texCol = new TLatex(0.96,0.93, Form("%s #sqrt{s_{NN}} = 5.02 TeV","PbPb"));
texCol->SetNDC();
texCol->SetTextAlign(32);
texCol->SetTextSize(0.04);
texCol->SetTextFont(42);
texCol->Draw();
TLatex* texTheory = new TLatex(0.55,0.80, "Theory");
texTheory->SetNDC();
texTheory->SetTextAlign(12);
texTheory->SetTextSize(0.04);
texTheory->SetTextFont(42);
texTheory->Draw();
TLatex* texArxiv = new TLatex(0.55,0.75, "arXiv:1601.07852");
texArxiv->SetNDC();
texArxiv->SetTextAlign(12);
texArxiv->SetTextSize(0.04);
texArxiv->SetTextFont(42);
texArxiv->Draw();
TString tper = "%";
TLatex* texCent = new TLatex(0.55,0.70, Form("Cent. 0-10%s",tper.Data()));
texCent->SetNDC();
texCent->SetTextAlign(12);
texCent->SetTextSize(0.04);
texCent->SetTextFont(42);
texCent->Draw();
cRAA->SaveAs("plots/RAAweighting.pdf");
return 0;
}
示例14: MCClosure
//.........这里部分代码省略.........
yError[i] = TMath::Sqrt(TMath::Power((1./yIntrinsic[i]),2)*TMath::Power(yFullError[i],2)+TMath::Power((yFull[i]/(TMath::Power(yIntrinsic[i],2))),2)*TMath::Power(yIntrinsicError[i],2));
//cout<<"y["<<i<<"] = "<<y[i]*100<<endl<<endl;
//cout<<"yError["<<i<<"] = "<<yError[i]*100<<endl<<endl;
xError[i] = 1./2.*TMath::Sqrt(TMath::Power(xFullError[i],2)+TMath::Power(xIntrinsicError[i],2));
}
fileName.Form("c2%i",j);
canvas2[j] = new TCanvas(fileName,fileName,0,0,500,500);
canvas2[j] ->SetBottomMargin(0.15);
canvas2[j] ->SetLeftMargin(0.17);
canvas2[j] ->cd();
Ratio = new TGraphErrors(numEntries,x,y,xError,yError);
char titleName[100] = {0};
sprintf(titleName,"MC Closure Test %s",file2);
Ratio->SetTitle(titleName);
Ratio->GetXaxis()->SetTitleSize(0.06);
Ratio->GetYaxis()->SetTitleSize(0.04);
Ratio-> GetXaxis()->SetTitle("p_{T}^{#gamma}");
Ratio -> GetXaxis()->SetLimits(0,600);
Ratio-> GetYaxis()->SetTitle("#frac{predic. intrinsic}{intrinsic} -1");
Ratio->GetYaxis()->SetTitleOffset(1.5);
Ratio->SetMarkerStyle(20);
Ratio->SetMarkerSize(1.1);
Ratio ->SetMaximum(0.3);
Ratio ->SetMinimum(-0.3);
Ratio->Draw("AP");
TF1* line = new TF1("line","0.",0,600);
line->SetLineColor(2);
line->Draw("same");
TLatex* info = new TLatex();
char legname[100] = {0};
info->SetTextFont(132);
info-> SetNDC();
info->SetTextSize(0.040);
info->DrawLatex(0.60,0.80,etaRegion);
fileName.Form("MCClosure_for_%i_eta_bin%s.pdf",j+1,file1);
canvas2[j]->SaveAs(fileName);
canvas3[j] = new TCanvas(fileName,fileName,0,0,500,500);
canvas3[j] ->cd();
for(int i=0; i<numEntries; i++) y[i] = std::abs(y[i]);
RatioAbs = new TGraphErrors(numEntries,x,y,xError,yError);
TF1* fit = new TF1("fit","pol0",0,600);
//TF1* fit = new TF1("fit","expo(0)",0,600);
sprintf(titleName,"MCClosure - %s absolute Values",file2);
RatioAbs -> SetTitle(titleName);
RatioAbs -> GetXaxis()->SetTitle("p_{T}^{#gamma}");
RatioAbs -> GetXaxis()->SetLimits(0,600);
RatioAbs -> GetYaxis()->SetTitle("JER/intrinsic -1");
RatioAbs -> GetYaxis()->SetTitleOffset(1.5);
RatioAbs -> SetMarkerStyle(20);
RatioAbs -> SetMarkerSize(1.1);
RatioAbs -> SetMaximum(0.25);
RatioAbs -> SetMinimum(-0.05);
RatioAbs -> Fit("fit","Q");
RatioAbs -> Draw("AP");
line ->Draw("same");
fit -> SetLineColor(3);
fit -> Draw("esame");
delete info;
info = new TLatex();
info->SetTextFont(132);
info-> SetNDC();
info->SetTextSize(0.040);
sprintf(legname,"%i. eta Bin",j+1);
info->DrawLatex(0.60,0.80,legname);
sprintf(legname,"fit = %4.3f #pm %4.3f",fit->GetParameter(0),fit->GetParError(0));
info -> DrawLatex(0.60,0.70,legname);
info -> Draw("same");
sprintf(legname,"Chi^2 = %4.3f",fit->GetChisquare());
info -> DrawLatex(0.60,0.63,legname);
info -> Draw("same");
sprintf(legname,"ndof = %i",fit->GetNDF());
info -> DrawLatex(0.60,0.56,legname);
info -> Draw("same");
fileName.Form("MCClosure_for_%i_eta_bin%s_absoluteValues.pdf",j+1,file1);
canvas2[j]->SaveAs(fileName);
}
return 0;
}
示例15: SUSY_bRPV_m0_vs_m12_all_withBand_cls
//.........这里部分代码省略.........
CombinationGlob::SetFrameStyle2D( frame, 1.0 ); // the size (scale) is 1.0
frame->SetXTitle( "m_{0} [GeV]" );
frame->SetYTitle( "m_{1/2} [GeV]" );
frame->GetYaxis()->SetTitleOffset(1.35);
//frame->SetTextFont( 42 );
frame->GetXaxis()->SetTitleFont( 42 );
frame->GetYaxis()->SetTitleFont( 42 );
frame->GetXaxis()->SetLabelFont( 42 );
frame->GetYaxis()->SetLabelFont( 42 );
frame->GetXaxis()->SetTitleSize( 0.04 );
frame->GetYaxis()->SetTitleSize( 0.04 );
frame->GetXaxis()->SetLabelSize( 0.04 );
frame->GetYaxis()->SetLabelSize( 0.04 );
frame->Draw();
const int nsig(3);
//TH2F *chist[3];
// draw contours
//!instead of printing sigma in 68% 95% 98% levels now printing +1 sigma deviations
//for (Int_t nsigma=1; nsigma<=nsig; nsigma++)
// DrawContourSameColor( contour, nsigma, "blue", kFALSE, (nsigma==1?inverse:0) ) ;
TString basecolor="yellow";
Int_t nsigma=2;
TLegend *leg = new TLegend(0.6,0.7,0.92,0.9);
leg->SetTextSize( CombinationGlob::DescriptionTextSize );
leg->SetTextSize( 0.03 );
leg->SetTextFont( 42 );
leg->SetFillColor( 0 );
leg->SetFillStyle(1001);
if (false && channel==1) { // electron
cout << "removing islands in electron channel ..." << endl;
// contour line is drawn for values at 1.64485
TAxis* ax = contour_obs->GetXaxis();
TAxis* ay = contour_obs->GetYaxis();
/*
contour_em1s
for (int xbin = 1; xbin <= contour_obs->GetNbinsX(); xbin++) {
for (int ybin = 1; ybin <= contour_obs->GetNbinsY(); ybin++) {
// island 2
if ( ax->GetBinCenter( xbin) > 420. && ax->GetBinCenter( xbin) < 480. &&
ay->GetBinCenter( ybin) > 140. && ay->GetBinCenter( ybin) < 160. ) {
cout << "Found spot here: " << xbin << " (" << ax->GetBinCenter( xbin) << "), "
<< ybin << " (" << ay->GetBinCenter( ybin) << "), "
<< " value: " << contour->GetBinContent(xbin,ybin) << endl;
cout << " HACK : Setting above point by hand to 1.50 (!)" << endl;
contour->SetBinContent(xbin, ybin, 1.50);
}
}
}
*/
}
if (false && channel==2) { // combined
cout << "removing islands in combined channel ..." << endl;
}