本文整理汇总了C++中TLine::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ TLine::Draw方法的具体用法?C++ TLine::Draw怎么用?C++ TLine::Draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLine
的用法示例。
在下文中一共展示了TLine::Draw方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Fit
//______________________________________________________________________________
void Fit(TH1* h, Double_t* outPos, Double_t* outFWHM)
{
// Perform fit.
Char_t tmp[256];
// delete old function
TF1* func = new TF1(tmp, "pol1+gaus(2)");
func->SetLineColor(2);
// estimate peak position
Double_t fPi0Pos = h->GetBinCenter(h->GetMaximumBin());
// configure fitting function
func->SetRange(fPi0Pos - 0.8, fPi0Pos + 0.8);
func->SetLineColor(2);
func->SetParameters( 0.1, 0.1, h->GetMaximum(), 0, 0.1);
Int_t fitres = h->Fit(func, "RB0Q");
// get position and FWHM
fPi0Pos = func->GetParameter(3);
*outPos = fPi0Pos;
*outFWHM = 2.35*func->GetParameter(4);
// indicator line
TLine* line = new TLine();
line->SetX1(fPi0Pos);
line->SetX2(fPi0Pos);
line->SetY1(0);
line->SetY2(h->GetMaximum());
// draw
h->GetXaxis()->SetRangeUser(-3, 3);
h->Draw();
func->Draw("same");
line->Draw("same");
}
示例2: quickPlotCtauVsVrrs
void quickPlotCtauVsVrrs () {
setTDRStyle();
c1 = new TCanvas("c1","c1",200,10,700,500);
const Int_t n = 10;
Double_t x[n] = {0.375, 1.125, 2, 3.15, 4.65, 6.65, 9.5, 13.95, 22.6, 34.25};
Double_t y[n] = {1.466, 1.549, 1.545, 1.543, 1.541, 1.542, 1.547, 1.544, 1.539, 1.540};
Double_t exl[n] = {0.375, 0.375, 0.5, 0.65, 0.85, 1.15, 1.7, 2.75, 5.9, 5.75};
Double_t exh[n] = {0.375, 0.375, 0.5, 0.65, 0.85, 1.15, 1.7, 2.75, 5.9, 5.75};
Double_t eyl[n] = {.003,.003,.003,.003,.003,.003,.003,.003,.003,.003};
Double_t eyh[n] = {.003,.003,.003,.003,.003,.003,.003,.003,.003,.003};
gr = new TGraphAsymmErrors(n,x,y,exl,exh,eyl,eyh);
gr->SetTitle("");
gr->SetMarkerColor(4);
gr->SetMarkerStyle(21);
gr->Draw("ALP");
gr->GetXaxis()->SetTitle("r(V^{0}) [cm]");
gr->GetYaxis()->SetTitle("#tau_{truth} [ps]");
TLine *l = new TLine(0,1.537,42,1.537);
l->Draw();
l->SetLineColor(2);
c1->SaveAs("Lb_vrrs_bins.pdf");
}
示例3: raaTheoryOpen_pt
//.........这里部分代码省略.........
pgRaaNPJpsi_vitev->SetFillColor(kAzure+1);
pgRaaNPJpsi_vitev->SetFillStyle(1001);
pgRaaNPJpsi_vitev_noDissoc->SetFillColor(kAzure-9);
pgRaaNPJpsi_vitev_noDissoc->SetFillStyle(1001);
// Style for line graphs
pgRaaNPJpsi_mcatshq->SetLineColor(kTeal+4);
pgRaaNPJpsi_mcatshq_rad->SetLineColor(kTeal+3);
pgRaaNPJpsi_bamps->SetLineColor(kRed+1);
// pgRaaNPJpsi_mcatshq->SetLineStyle(3);
// pgRaaNPJpsi_mcatshq_rad->SetLineStyle(3);
// pgRaaNPJpsi_bamps->SetLineStyle(3);
pgRaaNPJpsi_mcatshq->SetLineWidth(4);
pgRaaNPJpsi_mcatshq_rad->SetLineWidth(4);
pgRaaNPJpsi_bamps->SetLineWidth(3);
//---------------------------------------------------------
TLine *line = new TLine(0.,1,30,1);
line->SetLineStyle(1);
line->SetLineWidth(1);
TCanvas *pc = new TCanvas("pc","pc");
TF1 *f4 = new TF1("f4","1",0,30);
f4->SetLineWidth(1);
f4->GetXaxis()->SetTitle("p_{T} (GeV/c)");
f4->GetYaxis()->SetTitle("R_{AA}");
f4->GetYaxis()->SetRangeUser(0.0,1.5);
f4->GetXaxis()->CenterTitle(kTRUE);
f4->Draw();
lumi->Draw();
pc->Update();
pgCmsSyst->Draw("2"); // for drawing x-axis
if(bDoBRaa)
{
pgRaaB_whdg->Draw("f");
}
pgRaaNPJpsi_vitev->Draw("f");
pgRaaNPJpsi_vitev_noDissoc->Draw("f");
if(bDoBRaa)
{
pgRaaB_rapp->Draw("f");
}
pgRaaNPJpsi_mcatshq->Draw("l");
pgRaaNPJpsi_mcatshq_rad->Draw("l");
pgRaaNPJpsi_bamps->Draw("l");
pgCmsSyst->Draw("2");
pgCmsP->Draw("P");
pgCms->Draw("P");
pgCmsSyst_lowpt->Draw("2");
pgCmsP_lowpt->Draw("P");
pgCms_lowpt->Draw("P");
// additional info
CMS_lumi(pc,12003000,0);
TLegend *leg_cent = new TLegend(0.59,0.50,0.89,0.64,NULL,"brNDC");
// TLegend *leg_cent = new TLegend(0.29,0.81,0.83,0.89,NULL,"brNDC"); // at top center
leg_cent->SetMargin(0.17);
leg_cent->SetBorderSize(0);
示例4: draw_MA
//.........这里部分代码省略.........
// Calculate integrals and print differences
cout << "Integral histoPmu: " << histoPmu->Integral() << endl;
cout << "Integral histoPmu_MA: " << histoPmu_MA->Integral() << endl;
cout << "Difference w.r.t. histoPmu (%):" << endl;
cout << "histoPmu_MA: " << (histoPmu_MA->Integral()-histoPmu->Integral())/(histoPmu->Integral())*100. << endl;
cout << endl << endl << "Difference w.r.t. histoPmu (%) -- bin by bin -- MA" << endl;
for (int i = 0; i < histoPmu->GetNbinsX(); i++) {
cout << "Bin: " << i << " " << (histoPmu_MA->GetBinContent(i)-histoPmu->GetBinContent(i))/(histoPmu->GetBinContent(i))*100. << endl;
}
// Define the Canvas
TCanvas *c;
if (!poster) c = new TCanvas("c", "canvas", 800, 800);
if (poster && choice == 0) c = new TCanvas("c", "canvas", 0,45,1164,907);
if (poster && choice == 1) c = new TCanvas("c", "canvas", 0,45,800,907);
//c->SetFillStyle(4000); // Transparent
//c->SetFrameFillStyle(4000); // Transparent
// Upper plot will be in pad1
TPad *pad1 = new TPad("pad1", "pad1", 0, 0.25, 1, 1.0);
//pad1->SetFillStyle(4000); // Transparent
//pad1->SetFrameFillStyle(4000); // Transparent
pad1->SetBottomMargin(0); // Upper and lower plot are joined
pad1->SetRightMargin(0.05);
pad1->SetGridx(); // Vertical grid
pad1->Draw(); // Draw the upper pad: pad1
pad1->cd(); // pad1 becomes the current pad
histoPmu_MA->SetMinimum(0.0001); // Otherwise 0 label overlaps
histoPmu->SetMinimum(0.0001); // Otherwise 0 label overlaps
histoPmu_MA->SetStats(0); // No statistics on upper plot
histoPmu->SetStats(0); // No statistics on upper plot
// Define plots range based on the quantity plotted
if (choice == 0) histoPmu_MA->GetXaxis()->SetRangeUser(0., 700.);
if (choice == 1 && selection == 1) histoPmu_MA->GetXaxis()->SetRangeUser(0., 1.);
if (choice == 1 && selection == 2) histoPmu_MA->GetXaxis()->SetRangeUser(0., 1.);
if (choice == 2 && selection == 1) histoPmu_MA->GetXaxis()->SetRangeUser(-TMath::Pi(), TMath::Pi());
if (choice == 2 && selection == 2) histoPmu_MA->GetXaxis()->SetRangeUser(-3., 3.);
if (choice == 1 && selection == 1) histoPmu_MA->GetYaxis()->SetRangeUser(0.0001, 4500.);
if (choice == 1 && selection == 2) histoPmu_MA->GetYaxis()->SetRangeUser(0.0001, 5000.);
if (choice == 2 && selection == 1) histoPmu_MA->GetYaxis()->SetRangeUser(240, 650.);
if (choice == 2 && selection == 2) histoPmu_MA->GetYaxis()->SetRangeUser(300, 1500.);
// Draw!
histoPmu_MA->Draw("E2"); // Draw error bars only
TH1F * test2 = (TH1F*)histoPmu_MA->Clone("test2");
test2->SetLineColor(kGreen+2);
test2->Draw("same histo"); // Draw the histo line now
histoPmu->Draw("same E2"); // Draw error bars only
TH1F * test = (TH1F*)histoPmu->Clone("test");
test->Draw("same histo");
test->SetLineColor(kTotalMCColor); // Draw the histo line now
// Change titles
示例5: tree
void tree() {
//
// This macro displays the Tree data structures
//Author: Rene Brun
TCanvas* c1 = new TCanvas("c1","Tree Data Structure",200,10,750,940);
c1->Range(0,-0.1,1,1.15);
gBenchmark->Start("tree");
Int_t branchcolor = 26;
Int_t leafcolor = 30;
Int_t basketcolor = 42;
Int_t offsetcolor = 43;
TPaveLabel* title = new TPaveLabel(.3,1.05,.8,1.13,c1->GetTitle());
title->SetFillColor(16);
title->Draw();
TPaveText* treePave = new TPaveText(.01,.75,.15,1.00);
treePave->SetFillColor(18);
treePave->SetTextAlign(12);
TText *tnt = treePave->AddText("Tree");
tnt->SetTextAlign(22);
tnt->SetTextSize(0.030);
treePave->AddText("fScanField");
treePave->AddText("fMaxEventLoop");
treePave->AddText("fMaxVirtualSize");
treePave->AddText("fEntries");
treePave->AddText("fDimension");
treePave->AddText("fSelectedRows");
treePave->Draw();
TPavesText* farm = new TPavesText(.01,1.02,.15,1.1,9,"tr");
TText *tfarm = farm->AddText("CHAIN");
tfarm->SetTextSize(0.024);
farm->AddText("Collection");
farm->AddText("of Trees");
farm->Draw();
TLine* llink = new TLine(.15,.92,.80,.92);
llink->SetLineWidth(2);
llink->SetLineColor(1);
llink->Draw();
llink->DrawLine(.21,.87,.21,.275);
llink->DrawLine(.23,.87,.23,.375);
llink->DrawLine(.25,.87,.25,.775);
llink->DrawLine(.41,.25,.41,-.025);
llink->DrawLine(.43,.25,.43,.075);
llink->DrawLine(.45,.25,.45,.175);
TPaveLabel* branch0 = new TPaveLabel(.20,.87,.35,.97,"Branch 0");
branch0->SetTextSize(0.35);
branch0->SetFillColor(branchcolor);
branch0->Draw();
TPaveLabel* branch1 = new TPaveLabel(.40,.87,.55,.97,"Branch 1");
branch1->SetTextSize(0.35);
branch1->SetFillColor(branchcolor);
branch1->Draw();
TPaveLabel* branch2 = new TPaveLabel(.60,.87,.75,.97,"Branch 2");
branch2->SetTextSize(0.35);
branch2->SetFillColor(branchcolor);
branch2->Draw();
TPaveLabel* branch3 = new TPaveLabel(.80,.87,.95,.97,"Branch 3");
branch3->SetTextSize(0.35);
branch3->SetFillColor(branchcolor);
branch3->Draw();
TPaveLabel* leaf0 = new TPaveLabel(.4,.75,.5,.8,"Leaf 0");
leaf0->SetFillColor(leafcolor);
leaf0->Draw();
TPaveLabel* leaf1 = new TPaveLabel(.6,.75,.7,.8,"Leaf 1");
leaf1->SetFillColor(leafcolor);
leaf1->Draw();
TPaveLabel* leaf2 = new TPaveLabel(.8,.75,.9,.8,"Leaf 2");
leaf2->SetFillColor(leafcolor);
leaf2->Draw();
TPaveText* firstevent = new TPaveText(.4,.35,.9,.4);
firstevent->AddText("First event of each basket");
firstevent->AddText("Array of fMaxBaskets Integers");
firstevent->SetFillColor(basketcolor);
firstevent->Draw();
TPaveLabel* basket0 = new TPaveLabel(.4,.25,.5,.3,"Basket 0");
basket0->SetFillColor(basketcolor);
basket0->Draw();
TPaveLabel* basket1 = new TPaveLabel(.6,.25,.7,.3,"Basket 1");
basket1->SetFillColor(basketcolor);
basket1->Draw();
TPaveLabel* basket2 = new TPaveLabel(.8,.25,.9,.3,"Basket 2");
basket2->SetFillColor(basketcolor);
basket2->Draw();
TPaveText* offset = new TPaveText(.55,.15,.9,.2);
offset->AddText("Offset of events in fBuffer");
offset->AddText("Array of fEventOffsetLen Integers");
offset->AddText("(if variable length structure)");
offset->SetFillColor(offsetcolor);
offset->Draw();
TPaveText* buffer = new TPaveText(.55,.05,.9,.1);
buffer->AddText("Basket buffer");
buffer->AddText("Array of fBasketSize chars");
buffer->SetFillColor(offsetcolor);
buffer->Draw();
TPaveText* zipbuffer = new TPaveText(.55,-.05,.75,.0);
zipbuffer->AddText("Basket compressed buffer");
zipbuffer->AddText("(if compression)");
zipbuffer->SetFillColor(offsetcolor);
//.........这里部分代码省略.........
示例6: chicent_sys_ratio
//.........这里部分代码省略.........
TCanvas *can=new TCanvas("can","can",10,10,1050*0.8*1.3,800*0.3*1.3 * 1.5);
can->Divide(5,2,0,0); //sticks the pads with no space inbetween
TH1D *h1[nw];
for (int iw=0;iw<nw;iw++)
{
can->cd(iw+1);
if(iw==4) gPad->SetRightMargin(0.02);
//gPad->SetLogy();
char ch1[8];
sprintf(ch1,"h1_%d",iw);
h1[iw] = new TH1D(ch1,"",500,hxmin[iw],hxmax[iw]);
h1[iw]->SetMinimum(hymin[iw]); h1[iw]->SetMaximum(hymax[iw]);
h1[iw]->SetXTitle(atit[iw][0]); h1[iw]->SetYTitle(atit[iw][1]);
h1[iw]->GetXaxis()->CenterTitle(1);
h1[iw]->GetYaxis()->CenterTitle(1);
// futz with the axes
h1[iw]->GetYaxis()->SetNdivisions(606);
h1[iw]->GetXaxis()->SetNdivisions(606);
h1[iw]->GetYaxis()->SetTitleSize(textsize);
h1[iw]->GetYaxis()->SetTitleOffset(1.8);
h1[iw]->GetYaxis()->SetLabelSize(textsize);
h1[iw]->GetXaxis()->SetTitleSize(textsize);
h1[iw]->GetXaxis()->SetTitleOffset(1.3);
h1[iw]->GetXaxis()->SetLabelSize(textsize);
// h1[iw]->GetXaxis()->SetLabelOffset(1.2);
h1[iw]->Draw();
}
//
// Draw!
//
cout << "Now Draw!" << endl;
TGraphErrors *ge, *geB, *ge2;
for (int iw=0;iw<nw;iw++)
{
can->cd(iw+1);
//
if (iw==3)
{
tex=new TLatex(11,0.0100,"CMS Preliminary");
tex->SetTextSize(textsize*1.0);
//tex->Draw();
}
if (iw==0)
{
tex=new TLatex(5,0.00015,"Hydro. at #sqrt{s_{NN}}=2.76TeV");
tex->SetTextSize(textsize*0.85);
//tex->Draw();
tex=new TLatex(7,0.00033,"|#eta|<2.4");
tex->SetTextSize(textsize*1.0);
//tex->Draw();
tex=new TLatex(7,0.00012,"0.3<p_{T}<3.0 GeV/c");
tex->SetTextSize(textsize*1.0);
//tex->Draw();
}
//if (iw < 4) tex=new TLatex(ptit[iw][0]+2,0.27,htit[iw]);
tex=new TLatex(ptit[iw][0],ptit[iw][1],htit[iw]);
if ( iw == 0) tex->SetTextSize(textsize);
示例7: if
TCanvas *drawRatioPlot(TH1D *prediction, TH1D *sr, TH1D *data, TString xTitle, TString filename, double ecaloCut){
gStyle -> SetPadLeftMargin(0.20);
data->SetMarkerStyle(20);
data->SetMarkerColor(kGreen);
data->SetLineColor(kGreen);
TCanvas *c = new TCanvas("c"+filename,"c",0,0,500,500);
float y = 0.3;
TPad *pad1 = new TPad("pad1", "Control Plots 1", 0.01, y, 0.99, 0.99);
TPad *padRatio = new TPad("rp1", "Ratio1", 0.01, 0.01, 0.99, y-0.01);
pad1->SetNumber(100);
pad1->SetTicks(0,1);
cout<<"number pad1 = "<<pad1->GetNumber()<<endl;
cout<<"number padRatio = "<<padRatio->GetNumber()<<endl;
TH1D *ratio = 0;
//ratio = (TH1D*) sr->Clone();
//ratio->Divide(prediction);
ratio = (TH1D*) prediction->Clone();
ratio->Divide(data);
for(int i=1; i<=ratio->GetNbinsX();i++){
if(ratio->GetBinContent(i) != 0){
cout<<"N in CR in "<<i<<". bin ="<<prediction->GetBinContent(i)<<endl;
cout<<"N in SR in "<<i<<". bin ="<<sr->GetBinContent(i)<<endl;
cout<<"Rel. difference in "<<i<<". bin ="<<(1./ratio->GetBinContent(i)-1.)*100<<"%"<<endl;
}
else if(sr->GetBinContent(i) == 0 && prediction->GetBinContent(i) !=0) cout<<"Scaling Factor in "<<i<<". bin <"<<prediction->GetBinContent(i)/1.15<<" +/- "<<ratio->GetBinError(i)<<endl;
else if(sr->GetBinContent(i) != 0 && prediction->GetBinContent(i) ==0) cout<<"Scaling Factor in "<<i<<". bin <"<<(sr->GetEntries()/prediction->GetEntries())/sr->GetBinContent(i)<<" +/- "<<ratio->GetBinError(i)<<endl;
}
ratio->GetYaxis()->SetTitle("#frac{CR (MC)}{CR (data)}");
ratio->SetTitle("");
ratio->SetLabelSize(0.1,"X");
ratio->SetLabelSize(0.1,"Y");
ratio->SetTitleOffset(0.5,"Y");
ratio->SetTitleSize(0.15,"Y");
padRatio->cd();
//ratio->GetYaxis()->SetRangeUser(0,2);
ratio->Draw("e");
// Draw line at one!
float xmin = ratio->GetXaxis()->GetXmin();
float xmax = ratio->GetXaxis()->GetXmax();
TLine *line = new TLine(xmin,1,xmax,1);
line->SetLineWidth(2);
line->Draw("same");
padRatio->Modified();
TLegend *leg = new TLegend(0.5,0.7,0.9,0.9);
leg->AddEntry(sr,"SR (MC)","l");
leg->AddEntry(prediction,"lepton CR (MC)","pel");
pad1->cd();
pad1->SetLogy();
// pad1->SetLogx();
sr->SetLineColor(kRed);
sr->SetMarkerColor(kRed);
sr->SetMarkerStyle(20);
sr->SetTitle("");
prediction->SetMarkerStyle(20);
prediction->SetTitle("");
prediction->GetXaxis()->SetTitle(xTitle);
sr->GetXaxis()->SetTitle(xTitle);
prediction->SetTitleSize(0.07,"X");
prediction->GetXaxis()->SetTitleOffset(0.7);
sr->SetTitleSize(0.07,"X");
sr->GetXaxis()->SetTitleOffset(0.7);
double maximum = 0;
double minimum = 1000000;
if(sr->GetMinimum()!=0 && sr->GetMinimum()<minimum){
minimum=sr->GetMinimum()*0.5;
}
if(prediction->GetMinimum()!=0 && prediction->GetMinimum()<minimum){
minimum=prediction->GetMinimum()*0.5;
}
if(data->GetMinimum()!=0 && data->GetMinimum()<minimum){
minimum=data->GetMinimum()*0.5;
}
//.........这里部分代码省略.........
示例8: scan_contours
void scan_contours(TString infile = "test.root") {
gROOT->LoadMacro("CMS_lumi.C");
cmsText = "CMS Phase II Simulation";
writeExtraText = false; // if extra text
// extraText = "Preliminary"; // default extra text is "Preliminary"
lumi_14TeV = "";
// lumi_14TeV = "300 fb^{-1}, PU = 50"; // default is "3000 fb^{-1}"
lumi_14TeV = "3000 fb^{-1}, PU = 140"; // default is "3000 fb^{-1}"
TCanvas* c1 = new TCanvas("c1","c1",800,600);
TFile* f = new TFile(infile);
// TH2F* h_base = new TH2F("h_base","", 11, -50, 1050, 11, -50, 1050);
TH2F* h_base = new TH2F("h_base",";m_{#tilde{#chi}_{1}^{#pm}} = m_{#tilde{#chi}_{2}^{0}} (GeV); m_{#tilde{#chi}_{1}^{0}} (GeV)", 90, 100, 1000, 100, 0, 1000);
h_base->GetXaxis()->SetNdivisions(8,5,0);
h_base->GetYaxis()->SetNdivisions(8,5,0);
h_base->Draw();
// double contours[1] = {1.0};
// TH2F * contour_12p5 = (TH2F*) h_disc12p5->Clone("contour_12p5");
// contour_12p5->SetContour(1,contours);
// contour_12p5->SetLineWidth(3);
// contour_12p5->SetLineColor(kBlue);
// contour_12p5->Smooth(1,"k3a");
// TH2F * contour_25 = (TH2F*) h_disc25->Clone("contour_25");
// contour_25->SetContour(1,contours);
// contour_25->SetLineWidth(3);
// contour_25->SetLineColor(kRed);
// contour_25->Smooth(1,"k3a");
double contours_disc[1] = {5.0};
// double contours_exc[1] = {2.0};
double contours_exc[1] = {1.0};
TH2F * disc_contour_12p5 = (TH2F*) h_signif12p5_all->Clone("disc_contour_12p5");
disc_contour_12p5->SetContour(1,contours_disc);
disc_contour_12p5->SetLineWidth(3);
disc_contour_12p5->SetLineStyle(3);
disc_contour_12p5->SetLineColor(kBlue);
disc_contour_12p5->Smooth(1,"k3a");
// disc_contour_12p5->Smooth(1,"k5a");
trim_diagonal(disc_contour_12p5);
TH2F * disc_contour_25 = (TH2F*) h_signif25_all->Clone("disc_contour_25");
disc_contour_25->SetContour(1,contours_disc);
disc_contour_25->SetLineWidth(3);
disc_contour_25->SetLineColor(kBlue);
disc_contour_25->Smooth(1,"k3a");
//disc_contour_25->Smooth(1,"k5a");
trim_diagonal(disc_contour_25);
TH2F * exc_contour_12p5 = (TH2F*) h_rinv12p5_all->Clone("exc_contour_12p5");
//TH2F * exc_contour_12p5 = (TH2F*) h_signif12p5_all->Clone("exc_contour_12p5");
exc_contour_12p5->SetContour(1,contours_exc);
exc_contour_12p5->SetLineWidth(3);
exc_contour_12p5->SetLineStyle(3);
exc_contour_12p5->SetLineColor(kRed);
exc_contour_12p5->Smooth(1,"k3a");
//exc_contour_12p5->Smooth(1,"k5a");
trim_diagonal(exc_contour_12p5);
TH2F * exc_contour_25 = (TH2F*) h_rinv25_all->Clone("exc_contour_25");
// TH2F * exc_contour_25 = (TH2F*) h_signif25_all->Clone("exc_contour_25");
exc_contour_25->SetContour(1,contours_exc);
exc_contour_25->SetLineWidth(3);
exc_contour_25->SetLineColor(kRed);
exc_contour_25->Smooth(1,"k3a");
//exc_contour_25->Smooth(1,"k5a");
trim_diagonal(exc_contour_25);
TLine* diag = new TLine(125.,0.,675.,550.);
// TLine* diag = new TLine(125.,0.,1000.,875.);
diag->SetLineWidth(3);
diag->SetLineStyle(2);
diag->SetLineColor(kBlack);
disc_contour_12p5->Draw("cont3 same");
disc_contour_25->Draw("cont3 same");
exc_contour_12p5->Draw("cont3 same");
exc_contour_25->Draw("cont3 same");
TFile* fold = new TFile("limits_wh.root");
observed->SetLineColor(kGreen+2);
observed->Draw("same");
diag->Draw("same");
// TLegend* leg = new TLegend(0.19,0.68,0.54,0.92);
//TLegend* leg = new TLegend(0.19,0.68,0.54,0.85);
TLegend* leg = new TLegend(0.19,0.61,0.54,0.85);
leg->SetFillColor(0);
leg->SetTextSize(0.035);
leg->AddEntry(observed,"2012 Observed 95% CL Exclusion ","l");
leg->AddEntry(exc_contour_12p5,"3000fb^{-1} 95% CL Exclusion, 12.5% syst","l");
leg->AddEntry(exc_contour_25,"3000fb^{-1} 95% CL Exclusion, 25% syst","l");
//.........这里部分代码省略.........
示例9: CalibMwpcNaI
//___________________________________________________________________________________
void CalibMwpcNaI(const Int_t ii, const Int_t opt, TH1D &*h1, TH2D &*h2, TGraphErrors &*grMean, TGraphErrors &*grSigma)
{
// General style
// gROOT->ProcessLine(".x Style_Default_2.C");
// gROOT->SetStyle("Default_2");
// gROOT->ForceStyle();
//
TGraphErrors *grMean, *grSigma;
TCanvas *cnv;
TH1D *h1;
TH2D *h2;
TLine *lZ = new TLine(-300.,0.,300.,0.);
lZ->SetLineColor(kBlue);
lZ->SetLineWidth(2.);
TLine *lTheta = new TLine(0.,0.,180.,0.);
lTheta->SetLineColor(kBlue);
lTheta->SetLineWidth(2.);
TLine *lPhi = new TLine(0.,0.,360.,0.);
lPhi->SetLineColor(kBlue);
lPhi->SetLineWidth(2.);
//
TString i;
stringstream ss;
ss << ii;
ss >> i;
//
switch (opt)
{
case 1:
// dPhi Mwpc-NaI
cnv = new TCanvas("dPhi"+i);
h1 = (TH1D*)gDirectory->Get("GeomCalib_DphiMwpc"+i+"NaI");
h1->Draw();
h1->Fit("gaus","","",-1.8,1.8);
// hDphi->Fit("gaus");
// dPhi(Z)
cnv = new TCanvas("dPhi_VS_Z"+i);
h2 = (TH2D*)gDirectory->Get("GeomCalib_DphiMwpc"+i+"NaI_v_Z0Mwpc"+i+"NaI");
h2->Draw("color");
lZ->Draw("same");
//
SliceH2(h2,"y",20,-10.,10.,TMath::Sqrt(2.),grMean,grSigma);
// Sigma
cnv = new TCanvas("dPhi_Sigma_vs_Z"+i);
h1 = (TH1D*)cnv->DrawFrame(-300.,0.,300.,20.);
cnv->GetFrame()->SetFillColor(0);
cnv->GetFrame()->SetBorderSize(0);
h1->SetXTitle("z, mm");
h1->SetYTitle("#sigma_{#Delta#varphi}, degrees");
h1->SetTitle("dPhi(Z), MWPC-"+i);
grSigma->SetMarkerStyle(20);
grSigma->Draw("P");
// Mean
cnv = new TCanvas("dPhi_Mean_vs_Z"+i);
h1 = (TH1D*)cnv->DrawFrame(-300.,-30.,300.,30.);
cnv->GetFrame()->SetFillColor(0);
cnv->GetFrame()->SetBorderSize(0);
h1->SetXTitle("z, mm");
h1->SetYTitle("Mean, degrees");
h1->SetTitle("dPhi(Z), MWPC-"+i);
grMean->SetMarkerStyle(20);
grMean->Fit("pol1");
grMean->Draw("P");
break;
case 2:
// dX
cnv = new TCanvas("dX"+i);
h1 = (TH1D*)gDirectory->Get("GeomCalib_DxMwpc"+i+"NaI");
h1->Draw();
h1->Fit("gaus","","",-20.,20.);
// dX(Z)
cnv = new TCanvas("dX_VS_Z"+i);
h2 = (TH2D*)gDirectory->Get("GeomCalib_DxMwpc"+i+"NaI_v_Z0Mwpc"+i+"NaI");
h2->Draw("color");
lZ->Draw("same");
//
SliceH2(h2,"y",20,-50.,50.,TMath::Sqrt(2.),grMean,grSigma);
// Sigma
cnv = new TCanvas("dX_Sigma_vs_Z"+i);
h1 = (TH1D*)cnv->DrawFrame(-300.,0.,300.,20.);
cnv->GetFrame()->SetFillColor(0);
cnv->GetFrame()->SetBorderSize(0);
h1->SetXTitle("z, mm");
h1->SetYTitle("#sigma_{#DeltaX}, mm");
h1->SetTitle("dX(Z), MWPC-"+i);
grSigma->SetMarkerStyle(20);
grSigma->Draw("P");
// Mean
cnv = new TCanvas("dX_Mean_vs_Z"+i);
h1 = (TH1D*)cnv->DrawFrame(-300.,-30.,300.,30.);
cnv->GetFrame()->SetFillColor(0);
cnv->GetFrame()->SetBorderSize(0);
h1->SetXTitle("z, mm");
h1->SetYTitle("Mean, mm");
h1->SetTitle("dX(Z), MWPC-"+i);
//.........这里部分代码省略.........
示例10: CalibEI
//___________________________________________________________________________________
void CalibEI(const Int_t ii, const Int_t opt)
{
// i - # of the MWPC
// opt - option to plot
TGraphErrors *grMean, *grSigma;
TCanvas *cnv;
TH1D *h1;
TH2D *h2;
TH3D *h3;
TLine *lZ = new TLine(-300.,0.,300.,0.);
lZ->SetLineColor(kBlue);
lZ->SetLineWidth(2.);
TLine *lPhi = new TLine(0.,0.,360.,0.);
lPhi->SetLineColor(kBlue);
lPhi->SetLineWidth(2.);
//
TString i;
stringstream ss;
ss << ii;
ss >> i;
//
switch (opt)
{
case 1:
// dPhiEI
cnv = new TCanvas("cEI"+i);
h1 = (TH1D*)gDirectory->Get("GeomCalib_DphiEI"+i);
h1->Draw();
h1->Fit("gaus","","",-.6,.6);
// hEI->Fit("gaus");
break;
case 2:
// dPhiEI(Z)
cnv = new TCanvas("cEIZ"+i);
h2 = (TH2D*)gDirectory->Get("GeomCalib_DphiEI"+i+"_v_ZInters"+i);
h2->Draw("color");
lZ->Draw("same");
//
SliceH2(h2,"y",20,-1.,1.,1.,grMean,grSigma);
// Sigma
cnv = new TCanvas("cEIZ_Sigma"+i);
h1 = (TH1D*)cnv->DrawFrame(-300.,0.,300.,20.);
cnv->GetFrame()->SetFillColor(0);
cnv->GetFrame()->SetBorderSize(0);
h1->SetXTitle("z, mm");
h1->SetYTitle("#sigma, degrees");
h1->SetTitle("dPhiEI(Z)");
grSigma->SetMarkerStyle(20);
grSigma->Draw("P");
// Mean
cnv = new TCanvas("cEIZ_Mean"+i);
h1 = (TH1D*)cnv->DrawFrame(-300.,-30.,300.,30.);
cnv->GetFrame()->SetFillColor(0);
cnv->GetFrame()->SetBorderSize(0);
h1->SetXTitle("z, mm");
h1->SetYTitle("Mean, degrees");
h1->SetTitle("dPhiEI(Z)");
grMean->SetMarkerStyle(20);
grMean->Fit("pol1");
grMean->Draw("P");
break;
case 3:
// dPhiEI(Phi)
cnv = new TCanvas("cEIPhi"+i);
h2 = (TH2D*)gDirectory->Get("GeomCalib_DphiEI"+i+"_v_PhiEI"+i);
h2->Draw("color");
lPhi->Draw("same");
//
SliceH2(h2,"y",20,-1.,1.,1.,grMean,grSigma);
// Sigma
cnv = new TCanvas("cEIPhi_Sigma"+i);
h1 = (TH1D*)cnv->DrawFrame(0.,0.,360.,10.);
cnv->GetFrame()->SetFillColor(0);
cnv->GetFrame()->SetBorderSize(0);
h1->SetXTitle("#varphi, degrees");
h1->SetYTitle("#sigma, degrees");
h1->SetTitle("dPhiEI(Phi)");
grSigma->SetMarkerStyle(20);
grSigma->Draw("P");
// Mean
cnv = new TCanvas("cEIPhi_Mean"+i);
h1 = (TH1D*)cnv->DrawFrame(0.,-10.,360.,10.);
cnv->GetFrame()->SetFillColor(0);
cnv->GetFrame()->SetBorderSize(0);
h1->SetXTitle("#varphi, degrees");
h1->SetYTitle("Mean, degrees");
h1->SetTitle("dPhiEI(Phi)");
grMean->SetMarkerStyle(20);
grMean->Fit("pol1");
grMean->Draw("P");
break;
case 23:
//.........这里部分代码省略.........
示例11: CalibMwpc
//___________________________________________________________________________________
void CalibMwpc(const Int_t opt, TH1D &*h1, TH2D &*h2, TGraphErrors &*grMean, TGraphErrors &*grSigma)
{
// General style
// gROOT->ProcessLine(".x Style_Default_2.C");
// gROOT->SetStyle("Default_2");
// gROOT->ForceStyle();
//
TCanvas *cnv;
TLine *lZ = new TLine(-300.,0.,300.,0.);
lZ->SetLineColor(kBlue);
lZ->SetLineWidth(2.);
TLine *lTheta = new TLine(0.,0.,180.,0.);
lTheta->SetLineColor(kBlue);
lTheta->SetLineWidth(2.);
TLine *lPhi = new TLine(0.,0.,360.,0.);
lPhi->SetLineColor(kBlue);
lPhi->SetLineWidth(2.);
//
switch (opt)
{
case 1:
// dPhi MWPC1 - MWPC0
cnv = new TCanvas("dPhi");
h1 = (TH1D*)gDirectory->Get("GeomCalib_DphiMwpc21");
h1->Draw();
h1->Fit("gaus","","",-1.,1.);
// dPhi(Z)
cnv = new TCanvas("dPhi_VS_Z");
h2 = (TH2D*)gDirectory->Get("GeomCalib_DphiMwpc21_v_Z0Mwpc21");
h2->Draw("color");
lZ->Draw("same");
break;
case 2:
// dX
cnv = new TCanvas("dX");
h1 = (TH1D*)gDirectory->Get("GeomCalib_DxMwpc21");
h1->Draw();
h1->Fit("gaus","","",-2.,2.);
// dX(Z)
cnv = new TCanvas("dX_VS_Z");
h2 = (TH2D*)gDirectory->Get("GeomCalib_DxMwpc21_v_Z0Mwpc21");
h2->Draw("color");
lZ->Draw("same");
//
SliceH2(h2,"y",20,-5.,5.,TMath::Sqrt(2.),grMean,grSigma);
// Sigma
cnv = new TCanvas("SigmaDx_vs_Z");
h1 = (TH1D*)cnv->DrawFrame(-300.,0.,300.,5.);
cnv->GetFrame()->SetFillColor(0);
cnv->GetFrame()->SetBorderSize(0);
h1->SetXTitle("z, mm");
h1->SetYTitle("#sigma, mm");
h1->SetTitle("dX(Z)");
grSigma->SetMarkerStyle(20);
grSigma->Draw("P");
// Mean
cnv = new TCanvas("MeanDx_vs_Z");
h1 = (TH1D*)cnv->DrawFrame(-300.,-3.,300.,3.);
cnv->GetFrame()->SetFillColor(0);
cnv->GetFrame()->SetBorderSize(0);
h1->SetXTitle("z, mm");
h1->SetYTitle("Mean, mm");
h1->SetTitle("dX(Z)");
grMean->SetMarkerStyle(20);
grMean->Fit("pol0");
grMean->Draw("P");
break;
case 3:
// dY
cnv = new TCanvas("dY");
h1 = (TH1D*)gDirectory->Get("GeomCalib_DyMwpc21");
h1->Draw();
h1->Fit("gaus","","",-10.,10.);
// dY(Z)
cnv = new TCanvas("dY_VS_Z");
h2 = (TH2D*)gDirectory->Get("GeomCalib_DyMwpc21_v_Z0Mwpc21");
h2->Draw("color");
lZ->Draw("same");
//
SliceH2(h2,"y",20,-10.,10.,TMath::Sqrt(2.),grMean,grSigma);
// Sigma
cnv = new TCanvas("SigmaDy_vs_Z");
h1 = (TH1D*)cnv->DrawFrame(-300.,0.,300.,15.);
cnv->GetFrame()->SetFillColor(0);
cnv->GetFrame()->SetBorderSize(0);
h1->SetXTitle("z, mm");
h1->SetYTitle("#sigma, mm");
h1->SetTitle("dY(Z)");
grSigma->SetMarkerStyle(20);
grSigma->Draw("P");
// Mean
cnv = new TCanvas("MeanDy_vs_Z");
h1 = (TH1D*)cnv->DrawFrame(-300.,-5.,300.,5.);
cnv->GetFrame()->SetFillColor(0);
cnv->GetFrame()->SetBorderSize(0);
//.........这里部分代码省略.........
示例12: plotRBDphi
//.........这里部分代码省略.........
Float_t bin=0;
Float_t et1=0;
nt->SetBranchAddress("bin",&bin);
nt->SetBranchAddress("pt1",&et1);
for (int i=0;i<nt->GetEntries();i++)
{
nt->GetEntry(i);
if (et1<threshold1) continue;
if (et1>threshold2) {
hNpartSum2->Fill(bin,npartValue[(int)bin]);
hStat2->Fill(bin);
if (et1>threshold1) {
hNpartSum->Fill(bin,npartValue[(int)bin]);
hStat->Fill(bin);
}
}
}
hNpartSum->Divide(hStat);
hNpartSum2->Divide(hStat2);
for (int i=1;i<nBin;i++)
{
cout <<hNpartSum->GetBinContent(i+1)<<endl;
npart[i]=hNpartSum->GetBinContent(i+1);
cout <<hNpartSum2->GetBinContent(i+1)<<endl;
npart2[i]=hNpartSum2->GetBinContent(i+1);
}
nt->Draw("bin>>h",Form("abs(dphi)>%f&&%s",dphiCut,cut1.Data()));
nt->Draw("bin>>hCut",Form("%s",cut1.Data()));
TGraphAsymmErrors *g = calcEff(hCut,h,npart);
g->SetMarkerSize(1.25);
cout <<cut2.Data()<<endl;
nt->Draw("bin>>h2",Form("abs(dphi)>%f&&%s",dphiCut2,cut2.Data()));
nt->Draw("bin>>h2Cut",Form("%s",cut2.Data()));
TGraphAsymmErrors *g2 = calcEff(h2Cut,h2,npart2);
g2->SetMarkerSize(1.25);
ntPythia->Draw("bin>>h",Form("abs(dphi)>%f&&%s",dphiCut2,cut2.Data()));
ntPythia->Draw("bin>>hCut",Form("%s",cut2.Data()));
TGraphAsymmErrors *gPythia = calcEffpythia(hCut,h,npart);
gPythia->SetMarkerSize(1.7);
if(useWeight){
ntMix->Draw("bin>>h",Form("weight*(abs(dphi)>%f&&%s)",dphiCut2,cut2.Data()));
ntMix->Draw("bin>>hCut",Form("weight*(%s)",cut2.Data()));
}else{
ntMix->Draw("bin>>h",Form("(abs(dphi)>%f&&%s)",dphiCut2,cut2.Data()));
ntMix->Draw("bin>>hCut",Form("(%s)",cut2.Data()));
}
TGraphAsymmErrors *gMix = calcEff(hCut,h,npart);
gMix->SetMarkerSize(1.25);
TCanvas *c = new TCanvas("c","",500,500);
// hTmp->SetMaximum(g->GetY()[0]*2.2);
hTmp->SetMaximum(0.85);
hTmp->SetMinimum(0.);
hTmp->SetXTitle("N_{part}");
示例13: AnalyzeData
void AnalyzeData(char *DataFile = "drs4_peds_5buffers.dat", Int_t nevt,
Int_t startEv = 1, char *PedFile, Int_t DrawExtraGraphs = 0) {
// Redefine DOMINO Depth in ADC counts
const Float_t DominoDepthADC = pow(2, DOMINO_DEPTH);
// open file
FILE *fdata = OpenDataFile(DataFile);
struct channel_struct *p;
struct channel_struct *dep;
// create histograms
// create list of histograms for channels and distribution
TList *DistChList = new TList();
TH1F *distch; // histo with distribution of cell-charge, for each channel
TList *DistChSubList = new TList();
TH1F *distchsub; // histo with distribution of cell-charge, pedestals subtracted, for each channel
TList *DistCh0SubList = new TList();
TH1F *distch0sub; // histo with distribution of cell-charge, pedestals subtracted,
// channel 0 subtracted for each channel
TList *grPedList = new TList();
TGraphErrors *grPed; // for each channel, pedestal value and RMS for each cell is plotted
TList *hCellList = new TList();
TH1F *hCell; // charge distribution for each cell (DOMINO_NCELL x DOMINO_NCH histos)
TList *hCellSubList = new TList();
TH1F *hCellSub; // charge distribution for each cell (DOMINO_NCELL x DOMINO_NCH histos), pedestal subtracted
TList *hRMSList = new TList();
TH1F *hRMSdist; // histo with RMS distribution (statistical RMS of distribution)
TList *hRMSFitList = new TList();
TH1F *hRMSFitdist; // histo with RMS distribution (RMS of Gaussian fit)
TList *grDataList = new TList();
TGraphErrors *grData; // charge-cell and RMS for each cell is plotted
TList *grDataSubList = new TList();
TGraphErrors *grDataSub; // pedestal subtracted charge-cell and RMS for each cell is plotted
for (int h = 0; h < DOMINO_NCH; h++) {
//
TString title = "Data Dist channel";
title += h;
distch = new TH1F(title, title, DominoDepthADC, 0., DominoDepthADC);
DistChList->Add(distch);
//
TString title = "Data Dist Ped Sub channel";
title += h;
distchsub = new TH1F(title, title, DominoDepthADC, -DominoDepthADC/2, DominoDepthADC/2);
DistChSubList->Add(distchsub);
//
TString title = "Data Dist Ped Ch0 Sub channel";
title += h;
distch0sub = new TH1F(title, title, DominoDepthADC, -DominoDepthADC/2, DominoDepthADC/2);
DistCh0SubList->Add(distch0sub);
//
TString title = "Pedestal ch";
title += h;
grPed = new TGraphErrors(DOMINO_NCELL);
grPed->SetTitle(title);
grPedList->Add(grPed);
//
TString title = "Data ch";
title += h;
grData = new TGraphErrors(DOMINO_NCELL);
grData->SetTitle(title);
grDataList->Add(grData);
//
// Mean data and RMS for each channel and cell
TString title = "Data PedSubtracted ch";
title += h;
grDataSub = new TGraphErrors(DOMINO_NCELL);
grDataSub->SetTitle(title);
grDataSubList->Add(grDataSub);
//
for (int ch = 0; ch < DOMINO_NCELL; ch++) {
// data distribution histos
TString title = "Data ch";
title += h;
title += " cell";
title += ch;
hCell = new TH1F(title, title, DominoDepthADC, 0., DominoDepthADC);
hCellList->Add(hCell);
// data (ped subtracted) distribution histos
TString title = "Data PedSub ch";
title += h;
title += " cell ";
title += ch;
hCellSub = new TH1F(title, title, 2 * DominoDepthADC, -1
* DominoDepthADC, DominoDepthADC);
hCellSubList->Add(hCellSub);
}
// Data-RMS distribution histos
//.........这里部分代码省略.........
示例14: DrawbbcWidthCutEff
void DrawbbcWidthCutEff(){
gStyle->SetOptStat(kFALSE);
const int nwidth = 10;
const int nfrac = 28;
const int nwidth_coa=4;
const int nw = 4;
const int color[10]={5,1,2,4,7,3,4,2,1};
const int marker[10]={20,33,21,29,24,27,25,30,20,33};
const float bbct_width[nwidth] = {0.1,0.2,0.3,0.4,0.5,0.7,0.8,0.9,1.0,1.2};
const float bbct_width_coa[nwidth_coa] = {0.1,0.3,0.5,1.0};
const int widthbin[nwidth_coa] = {0,2,4,8};
const float bbct_frac[nfrac] = {0.,0.01,0.02,0.03,0.04,0.05,0.06,0.07,0.08,0.09,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.82,0.84,0.86,0.88,0.9,0.92,0.94,0.96,0.98,1.0};
const TString weight[nw] = {"no weight, center = mean","weighted, center= mean","weighted centre = max","Darren module(Used in analysis)"};
TFile *f = TFile::Open("output_testfull.root");
vector<vector<TH2F*> > hcentbbct0sigmasouth;
vector<vector<TH2F*> > hcentbbct0sigmanorth;
vector<vector<TH2F*> > hcentbbcmixt0sigmasouth;
vector<vector<TH2F*> > hcentbbcmixt0sigmanorth;
TH1D* hbbct0sigmasouth[nw][nwidth];
TH1D* hbbct0sigmanorth[nw][nwidth];
TH1D* hbbcmixt0sigmasouth[nw][nwidth];
TH1D* hbbcmixt0sigmanorth[nw][nwidth];
float cuteffsouth[nw][nwidth][nfrac];
float mixcuteffsouth[nw][nwidth][nfrac];
float cuteffnorth[nw][nwidth][nfrac];
float mixcuteffnorth[nw][nwidth][nfrac];
hcentbbct0sigmasouth.resize(nw, std::vector<TH2F*>(nwidth));
hcentbbct0sigmanorth.resize(nw, std::vector<TH2F*>(nwidth));
hcentbbcmixt0sigmasouth.resize(nw, std::vector<TH2F*>(nwidth));
hcentbbcmixt0sigmanorth.resize(nw, std::vector<TH2F*>(nwidth));
int centmin = 48; //bbcs > 24, 0-5%
int centmax = -1;
for(int iw=0; iw<nw; iw++){
for(int iwidth = 0;iwidth<nwidth; iwidth++){
hcentbbct0sigmasouth[iw][iwidth] = (TH2F*)f->Get(Form("hcentbbct0fracsouth_%d_%d",iwidth,iw));
hcentbbct0sigmanorth[iw][iwidth] = (TH2F*)f->Get(Form("hcentbbct0fracnorth_%d_%d",iwidth,iw));
hcentbbcmixt0sigmasouth[iw][iwidth] = (TH2F*)f->Get(Form("hcentbbcmixt0fracsouth_%d_%d",iwidth,iw));
hcentbbcmixt0sigmanorth[iw][iwidth] = (TH2F*)f->Get(Form("hcentbbcmixt0fracnorth_%d_%d",iwidth,iw));
hbbct0sigmasouth[iw][iwidth] = (hcentbbct0sigmasouth[iw][iwidth]->ProjectionY(Form("hbbct0fracsouth_%d_%d",iwidth,iw),centmin,centmax));
hbbcmixt0sigmasouth[iw][iwidth] = (hcentbbcmixt0sigmasouth[iw][iwidth]->ProjectionY(Form("hbbcmixt0fracsouth_%d_%d",iwidth,iw),centmin,centmax));
hbbct0sigmasouth[iw][iwidth]->Scale(1./hbbct0sigmasouth[iw][iwidth]->Integral());
hbbcmixt0sigmasouth[iw][iwidth]->Scale(1./hbbcmixt0sigmasouth[iw][iwidth]->Integral());
}
for(int iwidth = 0;iwidth<nwidth; iwidth++){
for(int ifrac = 0;ifrac<nfrac; ifrac++){
int xbinmin = hcentbbct0sigmasouth[iw][iwidth]->GetYaxis()->FindBin(bbct_frac[ifrac]+0.005);
int xbinmax = hcentbbct0sigmasouth[iw][iwidth]->GetYaxis()->FindBin(-1);
cuteffsouth[iw][iwidth][ifrac] = 1.0*hcentbbct0sigmasouth[iw][iwidth]->Integral(centmin,centmax,xbinmin,xbinmax)/hcentbbct0sigmasouth[iw][iwidth]->Integral(centmin,centmax,0,-1);
cuteffnorth[iw][iwidth][ifrac] = 1.0*hcentbbct0sigmanorth[iw][iwidth]->Integral(centmin,centmax,xbinmin,xbinmax)/hcentbbct0sigmanorth[iw][iwidth]->Integral(centmin,centmax,0,-1);
mixcuteffsouth[iw][iwidth][ifrac] = 1.0*hcentbbcmixt0sigmasouth[iw][iwidth]->Integral(centmin,centmax,xbinmin,xbinmax)/hcentbbcmixt0sigmasouth[iw][iwidth]->Integral(centmin,centmax,0,-1);
mixcuteffnorth[iw][iwidth][ifrac] = 1.0*hcentbbcmixt0sigmanorth[iw][iwidth]->Integral(centmin,centmax,xbinmin,xbinmax)/hcentbbcmixt0sigmanorth[iw][iwidth]->Integral(centmin,centmax,0,-1);
}
}
}
TGraph *grsouth[nw][nwidth];
TGraph *grsouthmix[nw][nwidth];
for(int iw=1; iw<nw; iw++){
for(int iwidth = 0;iwidth<nwidth; iwidth++){
grsouth[iw][iwidth] = new TGraph(nfrac,bbct_frac,cuteffsouth[iw][iwidth]);
grsouthmix[iw][iwidth] = new TGraph(nfrac,bbct_frac,mixcuteffsouth[iw][iwidth]);
}
}
TCanvas *c1 = new TCanvas();
c1->SetLogy();
TLegend *leg = new TLegend(0.15,0.35,0.25,0.65);
leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->SetTextSize(0.04);
int xw = 2;
SetTitle(*grsouth[xw][0],"fraction threshold for cut","Cut/No Cut","");
SetYRange(*grsouth[xw][0],1e-7,1.6);
SetXRange(*grsouth[xw][0],-0.2,1.);
grsouth[xw][0]->Draw("AP");
leg->AddEntry(grsouth[xw][widthbin[0]],Form("pAl Run432420, bbcS > 24"),"");
for(int iwidth = 0;iwidth<nwidth_coa; iwidth++){
leg->AddEntry(grsouth[xw][widthbin[iwidth]],Form("width = %.1f",bbct_width_coa[iwidth]),"p");
leg->AddEntry(grsouthmix[xw][widthbin[iwidth]],Form("mixed, width = %.1f",bbct_width_coa[iwidth]),"p");
SetStyle(*grsouth[xw][widthbin[iwidth]],1.2,color[iwidth],marker[iwidth],0,0);
SetStyle(*grsouthmix[xw][widthbin[iwidth]],1.2,color[iwidth],marker[iwidth+nwidth_coa],0,0);
grsouth[xw][widthbin[iwidth]]->Draw("Psame");
grsouthmix[xw][widthbin[iwidth]]->Draw("Psame");
}
leg->Draw("same");
//c1->Print("bbctRMSCutEff_north.png");
c1->Print(Form("bbctWidthCutEff_iw%d_log.png",xw));
TCanvas *c2 = new TCanvas();
// c2->SetLogy();
TLegend *leg = new TLegend(0.15,0.65,0.25,0.88);
leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->SetTextSize(0.04);
int xw = 2;
SetTitle(*grsouth[xw][0],"fraction threshold for cut","Cut/No Cut","");
SetYRange(*grsouth[xw][0],1e-7,1.6);
//.........这里部分代码省略.........
示例15: trigTurnOnVsPt
//.........这里部分代码省略.........
hbot_RunN->Divide(h_RunNumber_Lumi);
hsel_RunN->Divide(h_RunNumber_Lumi);
htop_RunN->SetName("BaseSel_Div_LumiperRun");
hbot_RunN->SetName("Base_Div_LumiperRun");
hsel_RunN->SetName("Sel_Div_LumiperRun");
htop_RunN->Write();
hbot_RunN->Write();
hsel_RunN->Write();
for(int i=0; i<(plotlistBase.size()); i++){
//TH1F* htop_datat =(TH1F*) myEffNfile_Data->Get(plotlistBaseSel[i].c_str());
//TH1F* hbot_datat = (TH1F*) myEffNfile_Data->Get(plotlistBase[i].c_str());
TH1F* htop_data =(TH1F*) filelist[file]->Get(plotlistBaseSel[i].c_str())->Clone();
TH1F* hbot_data = (TH1F*) filelist[file]->Get(plotlistBase[i].c_str())->Clone();
//TH1F* htop_data =htop_datat->Clone();
//TH1F* hbot_data =hbot_datat->Clone();
// TH1D* htop_data = htop_2ddata->ProjectionY();
// TH1D* hbot_data = hbot_2ddata->ProjectionY();
//myEffNfile_Data->Close();
std::cout << "Boom" << std::endl;
if(i<2){
htop_data->GetXaxis()->SetRangeUser(50,800);
hbot_data->GetXaxis()->SetRangeUser(50,800);}
if(i>=2){
htop_data->GetXaxis()->SetRangeUser(50,200);
hbot_data->GetXaxis()->SetRangeUser(50,200);}
// htop_data->Rebin(2);
// hbot_data->Rebin(2);
htop_data->Draw();
hbot_data->Draw("same");
TH1F* ratio = (TH1F*) filelist[file]->Get(plotlistBaseSel[i].c_str())->Clone();
ratio->Sumw2();
ratio->Divide(hbot_data);
//erf((m-m0)/sigma)+1)/2
/* TF1 * f1 = new TF1("f1","(TMath::Erf((x*[0] -[1])/[2])+1.)/2.",20.,100.);
f1->SetParameter(2,1.);
//ratio->Fit(f1,"R");*/
TCanvas *c1 = new TCanvas("c1","Canvas1",0,0,800,600);
c1->SetLineColor(0);
c1->SetFrameFillColor(0);
c1->SetFillStyle(4000);
c1->SetFillColor(0);
c1->SetBorderMode(0);
//gStyle->SetOptStat(0);
c1->SetFillColor(0);
c1->SetBorderSize(0);
c1->SetBorderMode(0);
c1->SetLeftMargin(0.15);
c1->SetRightMargin(0.12);
c1->SetTopMargin(0.12);
c1->SetBottomMargin(0.15);
/* gROOT->SetStyle("Plain");
gStyle->SetOptStat(0000); //This puts in stats box
gStyle->SetTitleBorderSize(0);
gStyle->SetTitleX(0.5); // X position of the title box from left
gStyle->SetTitleAlign(23);
gStyle->SetTitleY(.975); // Y position of the title box from bottom
gStyle->SetLabelSize(0.03,"y");
gStyle->SetStatX(.9);