本文整理汇总了C++中TLatex类的典型用法代码示例。如果您正苦于以下问题:C++ TLatex类的具体用法?C++ TLatex怎么用?C++ TLatex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TLatex类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: fitcorr
void fitcorr(){
setTDRStyle();
TFile *f = new TFile("rootfiles/fitresults_2D_data.root");
TTree *t = (TTree*)f->Get("FitResults");
double mt=0, jsf=0, mcmass=0;
t->SetBranchAddress("mt", &mt);
t->SetBranchAddress("jesfactor", &jsf);
t->SetBranchAddress("mcmass", &mcmass);
TH2D *h2D = new TH2D("h2D",";M_{t} [GeV];JSF", 20, 170, 173, 20, 0.99, 1.04 );
TGraph *g = new TGraph();
for( int i=0; i < t->GetEntries(); i++ ){
t->GetEntry(i);
//if( mcmass != 172.5 ) continue;
h2D->Fill(mt, jsf);
g->SetPoint(g->GetN(), mt, jsf);
}
// uncertainty contour
double mean_mt = g->GetMean(1);
double mean_jsf = g->GetMean(2);
double sigma_mt = g->GetRMS(1);
double sigma_jsf = g->GetRMS(2);
double rho = g->GetCorrelationFactor();
std::cout << "Mean Mt = " << mean_mt << " +- " << sigma_mt << std::endl;
std::cout << "Mean JSF = " << mean_jsf << " +- " << sigma_jsf << std::endl;
std::cout << "Correlation = " << rho << std::endl;
TMatrixDSym m(2);
m(0,0) = sigma_mt*sigma_mt;
m(1,1) = sigma_jsf*sigma_jsf;
m(0,1) = rho*sigma_mt*sigma_jsf;
m(1,0) = rho*sigma_mt*sigma_jsf;
TMatrixDSymEigen eigen(m);
TVectorD eigenval = eigen.GetEigenValues();
std::cout << eigenval[0] << " " << eigenval[1] << endl;
// convert to ellipse tilt and radius
//double phi = 0.5*TMath::ATan( (3/0.03)*(2*rho*sigma_mt*sigma_jsf)/(sigma_mt*sigma_mt-sigma_jsf*sigma_jsf) );
double phi = (180.0/TMath::Pi())*0.5*TMath::ATan( (2*rho*sigma_mt*sigma_jsf)/(sigma_mt*sigma_mt-sigma_jsf*sigma_jsf) );
std::cout << "phi = " << phi << std::endl;
TEllipse *el = new TEllipse(mean_mt, mean_jsf, sqrt(eigenval[0]), sqrt(eigenval[1]), 0, 360, phi);
TEllipse *el2 = new TEllipse(mean_mt, mean_jsf, 2*sqrt(eigenval[0]), 2*sqrt(eigenval[1]), 0, 360, phi);
/*
TF2* fell = new TF2("fell","pow((x-[1])*cos([0])+(y-[2])*sin([0]),2)/[3] + pow((x-[1])*sin([0])-(y-[2])*cos([0]),2)/[4]",171,174,0.985,1.015);
fell->SetParameter(0,phi);
fell->SetParameter(1,mean_mt);
fell->SetParameter(2,mean_jsf);
fell->SetParameter(3,eigenval[0]);
fell->SetParameter(4,eigenval[1]);
double cont[1] = {1};
fell->SetContour(1, cont);
*/
const Int_t Number = 2;
Double_t Red[Number] = { 0.90, 0.10};
Double_t Green[Number] = { 0.90, 0.10};
Double_t Blue[Number] = { 0.90, 0.10};
Double_t Stops [Number] = {0, 1};
Double_t Length [Number] = {0, 1};
Int_t nb=50;
TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb);
gStyle->SetPadRightMargin(0.16);
gStyle->SetPadTopMargin(0.08);
TCanvas *c = new TCanvas("c","c",800,600);
h2D->Draw("colzC");
el->SetFillStyle(0);
el->SetLineColor(2);
el->SetLineWidth(3);
el->Draw();
el2->SetFillStyle(0);
el2->SetLineColor(2);
el2->SetLineWidth(3);
el2->Draw();
int iPeriod = 2;
int iPos = 33;
lumi_sqrtS = "8 TeV";
writeExtraText = false;
CMS_lumi( c, iPeriod, iPos );
c->Update();
c->RedrawAxis();
c->GetFrame()->Draw();
TLatex latex;
latex.SetNDC();
latex.SetTextSize(0.06);
latex.SetTextFont(42);
latex.DrawLatex(0.2, 0.84, "2D fit");
//.........这里部分代码省略.........
开发者ID:nmirman,项目名称:topmass_plotting,代码行数:101,代码来源:fitcorr.C
示例2: compareDataMC
//.........这里部分代码省略.........
if( TString( labels.at(imc) ).Contains("LM") || TString( labels.at(imc) ).Contains("T2tt") ){
mchist[imc]->SetFillColor( 0 );
mchist[imc]->SetLineStyle(2);
}else{
mchist[imc]->SetFillColor( colors[imc] );
}
// if( strcmp(labels[imc],"ttfake") == 0 || strcmp(labels[imc],"wjets") == 0 ){
// cout << "Scaling " << labels[imc] << " by 3.8" << endl;
// mchist[imc]->Scale(3.8);
// }
mcstack->Add( mchist[imc] );
if( imc == 0 ) mctothist = (TH1F*) mchist[imc]->Clone();
else mctothist->Add(mchist[imc]);
cout << "MC yield " << labels[imc] << " " << Form("%.2f",mchist[imc]->Integral()) << endl;
}
chdata->Draw(Form("TMath::Min(%s,%f)>>%s_datahist_%s",var,xmax-0.01,myvar,flavor),sel);
if( overlayData ){
float max = datahist->GetMaximum() + datahist->GetBinError(datahist->GetMaximumBin());
if( mctothist->GetMaximum() > max ) max = mctothist->GetMaximum();
if( log ) datahist->SetMaximum( 15 * max );
else datahist->SetMaximum( 1.4 * max );
datahist->GetXaxis()->SetTitle(xtitle);
datahist->Draw("E1");
mcstack->Draw("samehist");
datahist->Draw("sameE1");
datahist->Draw("sameaxis");
if(!log) datahist->GetYaxis()->SetRangeUser(0.,1.4*max);
cout << "data yield " << datahist->Integral() << endl;
}
else{
mctothist->GetXaxis()->SetTitle(xtitle);
mctothist->Draw();
mcstack->Draw("same");
mctothist->Draw("sameaxis");
}
if( drawLegend ){
TLegend* myleg = getLegend( chmc , labels , overlayData );
myleg->Draw();
}
TLatex *text = new TLatex();
text->SetNDC();
text->SetTextSize(0.05);
text->DrawLatex(0.2,0.88,"CMS Preliminary");
//text->DrawLatex(0.2,0.83,"0.98 fb^{-1} at #sqrt{s} = 7 TeV");
text->DrawLatex(0.2,0.83,"#sqrt{s} = 7 TeV, #scale[0.6]{#int}Ldt = 4.3 fb^{-1}");
if ( TString(flavor).Contains("ee") ) text->DrawLatex(0.2,0.78,"Events with ee");
else if( TString(flavor).Contains("mm") ) text->DrawLatex(0.2,0.78,"Events with #mu#mu");
else if( TString(flavor).Contains("em") ) text->DrawLatex(0.2,0.78,"Events with e#mu");
else if( TString(flavor).Contains("all") ) text->DrawLatex(0.2,0.78,"Events with ee/#mu#mu/e#mu");
if( residual ){
fullpad->cd();
respad = new TPad("respad","respad",0,0.8,1,1);
respad->Draw();
respad->cd();
gPad->SetGridy();
TH1F* ratio = (TH1F*) datahist->Clone(Form("%s_ratio",datahist->GetName()));
ratio->Divide(mctothist);
ratio->GetYaxis()->SetTitleOffset(0.3);
ratio->GetYaxis()->SetTitleSize(0.2);
ratio->GetYaxis()->SetNdivisions(5);
ratio->GetYaxis()->SetLabelSize(0.2);
//ratio->GetYaxis()->SetRangeUser(0.5,1.5);
ratio->GetYaxis()->SetRangeUser(0.,2.);
ratio->GetYaxis()->SetTitle("data/MC ");
ratio->GetXaxis()->SetLabelSize(0);
ratio->GetXaxis()->SetTitleSize(0);
ratio->SetMarkerSize(0.7);
ratio->Draw();
TLine line;
line.SetLineWidth(1);
line.DrawLine(datahist->GetXaxis()->GetXmin(),1,datahist->GetXaxis()->GetXmax(),1);
}
}
开发者ID:hooberman,项目名称:UserCode,代码行数:101,代码来源:Hootilities.C
示例3: PlotNsjMedian
void PlotNsjMedian()
{
gROOT->LoadMacro("$LOCAL/include/TUntilsOpHisto.h");
gROOT->LoadMacro("$LOCAL/include/TUntilsAliFigs.h");
gROOT->LoadMacro("$LOCAL/include/TUntilsPlotStd.h"); SetStyle();
//=============================================================================
TFile *file = TFile::Open("data/AnalysisOutputs_Nsj.root", "READ");
TList *listPy8R4S1 = (TList*)file->Get("list_py8_JetR04_SjeR01");
TList *listPy8R4S2 = (TList*)file->Get("list_py8_JetR04_SjeR02");
TList *listPy8R4S3 = (TList*)file->Get("list_py8_JetR04_SjeR03");
TList *listPy8R5S1 = (TList*)file->Get("list_py8_JetR05_SjeR01");
TList *listPy8R5S2 = (TList*)file->Get("list_py8_JetR05_SjeR02");
TList *listPy8R5S3 = (TList*)file->Get("list_py8_JetR05_SjeR03");
TList *listPy8R5S4 = (TList*)file->Get("list_py8_JetR05_SjeR04");
TList *listVacR4S1 = (TList*)file->Get("list_vac_JetR04_SjeR01");
TList *listVacR4S2 = (TList*)file->Get("list_vac_JetR04_SjeR02");
TList *listVacR4S3 = (TList*)file->Get("list_vac_JetR04_SjeR03");
TList *listVacR5S1 = (TList*)file->Get("list_vac_JetR05_SjeR01");
TList *listVacR5S2 = (TList*)file->Get("list_vac_JetR05_SjeR02");
TList *listVacR5S3 = (TList*)file->Get("list_vac_JetR05_SjeR03");
TList *listVacR5S4 = (TList*)file->Get("list_vac_JetR05_SjeR04");
TList *listMedR4S1 = (TList*)file->Get("list_med_JetR04_SjeR01");
TList *listMedR4S2 = (TList*)file->Get("list_med_JetR04_SjeR02");
TList *listMedR4S3 = (TList*)file->Get("list_med_JetR04_SjeR03");
TList *listMedR5S1 = (TList*)file->Get("list_med_JetR05_SjeR01");
TList *listMedR5S2 = (TList*)file->Get("list_med_JetR05_SjeR02");
TList *listMedR5S3 = (TList*)file->Get("list_med_JetR05_SjeR03");
TList *listMedR5S4 = (TList*)file->Get("list_med_JetR05_SjeR04");
file->Close();
TH1D *hPy8R4S1 = (TH1D*)listPy8R4S1->FindObject("hJetNsj_Median"); hPy8R4S1->SetName("hPy8R4S1");
TH1D *hPy8R4S2 = (TH1D*)listPy8R4S2->FindObject("hJetNsj_Median"); hPy8R4S2->SetName("hPy8R4S2");
TH1D *hPy8R4S3 = (TH1D*)listPy8R4S3->FindObject("hJetNsj_Median"); hPy8R4S3->SetName("hPy8R4S3");
TH1D *hPy8R5S1 = (TH1D*)listPy8R5S1->FindObject("hJetNsj_Median"); hPy8R5S1->SetName("hPy8R5S1");
TH1D *hPy8R5S2 = (TH1D*)listPy8R5S2->FindObject("hJetNsj_Median"); hPy8R5S2->SetName("hPy8R5S2");
TH1D *hPy8R5S3 = (TH1D*)listPy8R5S3->FindObject("hJetNsj_Median"); hPy8R5S3->SetName("hPy8R5S3");
TH1D *hPy8R5S4 = (TH1D*)listPy8R5S4->FindObject("hJetNsj_Median"); hPy8R5S4->SetName("hPy8R5S4");
TH1D *hVacR4S1 = (TH1D*)listVacR4S1->FindObject("hJetNsj_Median"); hVacR4S1->SetName("hVacR4S1");
TH1D *hVacR4S2 = (TH1D*)listVacR4S2->FindObject("hJetNsj_Median"); hVacR4S2->SetName("hVacR4S2");
TH1D *hVacR4S3 = (TH1D*)listVacR4S3->FindObject("hJetNsj_Median"); hVacR4S3->SetName("hVacR4S3");
TH1D *hVacR5S1 = (TH1D*)listVacR5S1->FindObject("hJetNsj_Median"); hVacR5S1->SetName("hVacR5S1");
TH1D *hVacR5S2 = (TH1D*)listVacR5S2->FindObject("hJetNsj_Median"); hVacR5S2->SetName("hVacR5S2");
TH1D *hVacR5S3 = (TH1D*)listVacR5S3->FindObject("hJetNsj_Median"); hVacR5S3->SetName("hVacR5S3");
TH1D *hVacR5S4 = (TH1D*)listVacR5S4->FindObject("hJetNsj_Median"); hVacR5S4->SetName("hVacR5S4");
TH1D *hMedR4S1 = (TH1D*)listMedR4S1->FindObject("hJetNsj_Median"); hMedR4S1->SetName("hMedR4S1");
TH1D *hMedR4S2 = (TH1D*)listMedR4S2->FindObject("hJetNsj_Median"); hMedR4S2->SetName("hMedR4S2");
TH1D *hMedR4S3 = (TH1D*)listMedR4S3->FindObject("hJetNsj_Median"); hMedR4S3->SetName("hMedR4S3");
TH1D *hMedR5S1 = (TH1D*)listMedR5S1->FindObject("hJetNsj_Median"); hMedR5S1->SetName("hMedR5S1");
TH1D *hMedR5S2 = (TH1D*)listMedR5S2->FindObject("hJetNsj_Median"); hMedR5S2->SetName("hMedR5S2");
TH1D *hMedR5S3 = (TH1D*)listMedR5S3->FindObject("hJetNsj_Median"); hMedR5S3->SetName("hMedR5S3");
TH1D *hMedR5S4 = (TH1D*)listMedR5S4->FindObject("hJetNsj_Median"); hMedR5S4->SetName("hMedR5S4");
//=============================================================================
TH1F *hfm = 0;
TCanvas *can = 0;
TLegend *leg = 0;
TLatex *tex = 0;
TLine *line = 0;
const Float_t dflx = 0., dfux = 500.;
const Float_t dfly = 0., dfuy = 15.;
const Float_t dlsx = 0.05, dlsy = 0.05;
const Float_t dtsx = 0.06, dtsy = 0.06;
const Float_t dtox = 1.10, dtoy = 1.00;
const TString stnx = "#it{p}_{T,jet} (GeV/#it{c})";
const TString stny = "Number of sub-jets: median";
TH1D *hSE = new TH1D("hSE", "", 10., 0., 10.);
hSE->SetLineWidth(2);
hSE->SetLineColor(wcl[0]);
hSE->SetMarkerStyle(wmk[0]);
hSE->SetMarkerColor(wcl[0]);
TH1D *hME = new TH1D("hME", "", 10., 0., 10.);
hME->SetLineWidth(2);
hME->SetLineColor(wcl[0]);
hME->SetMarkerStyle(wmk[2]);
hME->SetMarkerColor(wcl[0]);
//=============================================================================
can = MakeCanvas("NsjPy8R04_Median"); can->SetGridx(); can->SetGridy(); //can->SetLogy();
hfm = can->DrawFrame(dflx,dfly,dfux,dfuy); SetupFrame(hfm,dlsx,dlsy,dtsx,dtsy,dtox,dtoy, stnx, stny);
hfm->GetXaxis()->SetNdivisions(510);
hfm->GetYaxis()->SetNdivisions(510);
DrawHisto(hPy8R4S1, wcl[1], wmk[0], "SAME");
DrawHisto(hPy8R4S2, wcl[3], wmk[0], "SAME");
DrawHisto(hPy8R4S3, wcl[4], wmk[0], "SAME");
leg = new TLegend(0.68, 0.66, 0.98, 0.90); SetupLegend(leg);
leg->AddEntry(hPy8R4S1, "#it{R}_{sub}=0.1", "LP")->SetTextSizePixels(24);
leg->AddEntry(hPy8R4S2, "#it{R}_{sub}=0.2", "LP")->SetTextSizePixels(24);
leg->AddEntry(hPy8R4S3, "#it{R}_{sub}=0.3", "LP")->SetTextSizePixels(24);
//.........这里部分代码省略.........
开发者ID:xcheung,项目名称:AnaSubjetsMC,代码行数:101,代码来源:PlotNsjMedian.C
示例4: eff_pathor_pt
void eff_pathor_pt(){
gROOT->SetStyle("Plain");
gStyle -> SetErrorX(0);
// TFile *fdataeff= new TFile("output_data_iso025.root");
TFile *fdataeff= new TFile("output_mc_dimu_pt.root");
TCanvas *c = new TCanvas("c","The Ntuple canvas",200,10,700,780);
c->SetFillColor(10);
c->Divide(2,2);
gStyle->SetStatW(0.30);
gStyle->SetStatH(0.20);
gStyle->SetStatColor(42);
gStyle->SetOptStat(""); //em
gStyle->SetLabelSize(0.048,"xy");
gStyle->SetLabelOffset(0.013,"x");
gStyle->SetLabelOffset(0.013,"y");
gStyle->SetPadBorderMode(0);
gStyle->SetFillColor(0);
gStyle->SetPadTickX(1);
gStyle->SetPadTickY(1);
TLatex *t = new TLatex();
t->SetNDC();
t->SetTextFont(62);
t->SetTextColor(36);
t->SetTextSize(0.08);
t->SetTextAlign(12);
///////////////////////////////////////////
c_1 -> cd();
c->cd(1);
gPad->SetTopMargin(0.08);
gPad->SetLeftMargin(0.163);
gPad->SetBottomMargin(0.16);
gPad->SetRightMargin(0.143);
fdataeff -> cd();
TGraphAsymmErrors *histo1Da = (TGraphAsymmErrors*) fdataeff->Get("Mu17_IsoTrkVVL_pt_eta_pt_PLOT_Tight2012_pass_&_tag_Mu17_IsoTrkVVL_pass_&_tag_Tight2012_pass");
histo1Da->SetMinimum(0.);
histo1Da->SetMaximum(1.);
histo1Da ->Draw("ap");
Double_t *yg = histo1Da->GetY();
Double_t *erryg = histo1Da->GetEYhigh() ;
//float Bins[5]={0, 0.9, 1.2, 2.1, 2.4};
float Bins[7]= {12, 17, 20, 24, 30, 60, 100};
TH1D *hr1DTot = new TH1D("hr1DTot", "", 6, Bins);
for (int i = 0; i<6; i++) {
printf("yg[%d] = %g\n", i,yg[i]);
printf("erryg[%d] = %g\n", i,erryg[i]);
hr1DTot -> SetBinContent(i+1, yg[i]) ;
hr1DTot -> SetBinError(i+1, erryg[i]) ;
}
////////////////////////
c_2 -> cd();
c->cd(2);
c_2 ->SetLogy();
c_2 ->SetLogx();
gPad->SetTopMargin(0.08);
gPad->SetLeftMargin(0.163);
gPad->SetBottomMargin(0.16);
gPad->SetRightMargin(0.143);
// f -> cd();
//TH1F *hr2DRefRormula = (TH1F*)hr1DTot -> Clone();
//double etabin[5] = {0, 0.9, 1.2, 2.1, 2.4};
double ptbin[7]= {12., 17., 20., 24., 30., 60., 100.};
TH2F *hr2DRefRormula = new TH2F("heta1eta2","", 6, ptbin, 6, ptbin);
hr2DRefRormula -> Sumw2();
int nBinsX = hr2DRefRormula->GetNbinsX();
int nBinsY = hr2DRefRormula->GetNbinsY();
double content, error, sigmaA, sigmaB, contA, contB, errorA, errorB;
for (int i(1); i <= nBinsY ; i++) {
for (int j(1); j <= nBinsX; j++) {
content = 1. - (1. - (hr1DTot -> GetBinContent(i)))*(1. - (hr1DTot -> GetBinContent(j)));
//.........这里部分代码省略.........
开发者ID:AnastasiaGrebenyuk,项目名称:DiMu-efficiencies,代码行数:101,代码来源:eff_pathor_pt.C
示例5: cmsFinal
void cmsFinal(double intLumi=-1, bool wide = false) {
TLatex *latex = new TLatex();
latex->SetNDC();
latex->SetTextSize(0.045);
latex->SetTextAlign(31); // align right
latex->DrawLatex(wide ? 0.98 : 0.95, 0.96, "#sqrt{s} = 8 TeV");
if (intLumi > 0.) {
latex->SetTextAlign(11); // align left
latex->DrawLatex(wide ? 0.06 : 0.15, 0.96,
Form("CMS, L = %.2g fb^{-1}",intLumi*0.001));
}
else if (intLumi==0) { // simulation
latex->SetTextAlign(21); // align left
latex->DrawLatex(wide ? 0.06 : 0.15, 0.96, "CMS simulation (Pythia Z2*)");
}
else {
latex->SetTextAlign(11); // align left
latex->DrawLatex(0.06,0.96,"CMS 2012");
}
} // cmsPrel
开发者ID:errai-,项目名称:jetscripts,代码行数:22,代码来源:tdrstyle_mod1.C
示例6: DrawPerformCompFVTX
void DrawPerformCompFVTX(){
gStyle->SetErrorX(0);
gStyle->SetOptStat(0);
TFile *fmb = new TFile("merged_AnaMWGppmb.root","ReadOnly");
TFile *fhmand = new TFile("merged_AnaMWGppfvtxand.root","ReadOnly");
TFile *fhmor = new TFile("merged_AnaMWGppfvtxor.root","ReadOnly");
// TFile *fhmsouth = new TFile("merged_AnaMWGppfvtxsouth.root","ReadOnly");
// TFile *fhmnorth = new TFile("merged_AnaMWGppfvtxnorth.root","ReadOnly");
const int ncav = 2;
TCanvas *c1[ncav];
for(int i=0;i<ncav;i++){
c1[i] = new TCanvas();
}
TString histoname = "hnfvtxtrkbbc";//"hntracknmpc";
TString varname = "nfvtxtrack";
TString var = "# of fvtx tracks";//"# of central tracks";
bool xory = 1;
TH2F* hbbcsbbcn_mb = (TH2F*)fmb->Get(Form("%s",histoname.Data()));
TH2F* hbbcsbbcn_hmand = (TH2F*)fhmand->Get(Form("%s",histoname.Data()));
TH2F* hbbcsbbcn_hmor = (TH2F*)fhmor->Get(Form("%s",histoname.Data()));
// TH2F* hbbcsbbcn_hmsouth = (TH2F*)fhmsouth->Get(Form("%s",histoname.Data()));
// TH2F* hbbcsbbcn_hmnorth = (TH2F*)fhmnorth->Get(Form("%s",histoname.Data()));
if(xory){
TH1F* hbbc_mb = (TH1F*)hbbcsbbcn_mb->ProjectionX("hbbc_mb",0,-1);
TH1F* hbbc_hmand = (TH1F*)hbbcsbbcn_hmand->ProjectionX("hbbc_hmand",0,-1);
TH1F* hbbc_hmor = (TH1F*)hbbcsbbcn_hmor->ProjectionX("hbbc_hmor",0,-1);
// TH1F* hbbc_hmsouth = (TH1F*)hbbcsbbcn_hmsouth->ProjectionX("hbbc_hmsouth",0,-1);
// TH1F* hbbc_hmnorth = (TH1F*)hbbcsbbcn_hmnorth->ProjectionX("hbbc_hmnorth",0,-1);
}
else{
TH1F* hbbc_mb = (TH1F*)hbbcsbbcn_mb->ProjectionY("hbbc_mb",0,-1);
TH1F* hbbc_hmand = (TH1F*)hbbcsbbcn_hmand->ProjectionY("hbbc_hmand",0,-1);
TH1F* hbbc_hmor = (TH1F*)hbbcsbbcn_hmor->ProjectionY("hbbc_hmor",0,-1);
// TH1F* hbbc_hmsouth = (TH1F*)hbbcsbbcn_hmsouth->ProjectionY("hbbc_hmsouth",0,-1);
// TH1F* hbbc_hmnorth = (TH1F*)hbbcsbbcn_hmnorth->ProjectionY("hbbc_hmnorth",0,-1);
}
//hbbc_mb->GetXaxis()->SetLimits(0,200);
//hbbc_mb->Rebin(3);
//hbbc_mbcen->Rebin(10);
//hbbc_hmand->Rebin(3);
//hbbc_hmor->Rebin(3);
//hbbc_hmsouth->Rebin(3);
//hbbc_hmnorth->Rebin(3);
TH1F *hbbc_hmorScale = (TH1F*)hbbc_hmor->Clone("hbbc_hmorScale");
hbbc_hmorScale->Scale(0.06);
//hbbc_hm->Scale(1./hbbc_hm->Integral());
c1[0]->cd();
c1[0]->SetLogy();
hbbc_mb->Draw();
SetTitle(*hbbc_mb,Form("%s",var.Data()),"# of events","");
//SetTitle(*hbbc_mb,"nvtx layer 1","# of events","");
SetXRange(*hbbc_mb,0,30);
SetYRange(*hbbc_mb,1,5e9);
SetXRange(*hbbc_hmand,0,30);
SetXRange(*hbbc_hmor,0,30);
// SetXRange(*hbbc_hmsouth,0,300);
// SetXRange(*hbbc_hmnorth,0,300);
SetStyle(*hbbc_mb,1.0,1,20,0,0);
SetStyle(*hbbc_hmand,1.0,2,20,0,0);
SetStyle(*hbbc_hmor,1.0,4,34,0,0);
SetStyle(*hbbc_hmorScale,1.0,2,34,0,0);
// SetStyle(*hbbc_hmsouth,0.6,6,29,0,0);
// SetStyle(*hbbc_hmnorth,0.6,7,32,0,0);
TLegend *leg = new TLegend(0.6,0.75,0.8,0.90);
leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->SetTextSize(0.045);
leg->AddEntry(hbbc_mb,"p+p minbias","pl");
// leg->AddEntry(hbbc_mb_scale,"p+p minbias * 50","pl");
leg->AddEntry(hbbc_hmor,"p+p FVTX OR","pl");
leg->AddEntry(hbbc_hmand,"p+p FVTX AND","pl");
// leg->AddEntry(hbbc_hmorScale,"p+p FVTX OR Scaled * 0.06","pl");
// leg->AddEntry(hbbc_hmand,"MWGpp high-mult AND","pl");
// leg->AddEntry(hbbc_hmor,"MWGpp high-mult OR","pl");
// leg->AddEntry(hbbc_hmsouth,"MWGpp high-mult south","pl");
// leg->AddEntry(hbbc_hmnorth,"MWGpp high-mult north","pl");
leg->Draw("same");
hbbc_hmor->Draw("same");
hbbc_hmand->Draw("same");
// hbbc_hmorScale->Draw("same");
double top5 = 7;
TLine *l = new TLine(top5,0,top5,4e8);
l->SetLineStyle(2);
l->Draw();
// hbbc_hmand->Draw("same");
// hbbc_hmor->Draw("same");
// hbbc_hmsouth->Draw("same");
// hbbc_hmnorth->Draw("same");
TLatex t;
t.SetTextSize(0.04);
t.SetNDC();
// hbbc_mb->GetXaxis()->SetRange()
t.DrawLatex(0.13,0.2,Form("MB mean:%.2f",hbbc_mb->GetMean(1)));
t.DrawLatex(0.13,0.25,Form("FVTX OR mean:%.2f",hbbc_hmor->GetMean(1)));
t.DrawLatex(0.13,0.30,Form("FVTX AND mean:%.2f",hbbc_hmand->GetMean(1)));
t.SetNDC(0);
t.DrawLatex(top5-8,5e8,Form("Top 0-5%, fvtx track >= %.1f",top5));
//t.DrawLatex(0.13,0.7,Form("mb mean:%.2f, # of events: %.1fM",hbbc_mb->GetMean(1),hbbcsbbcn_mb->Integral()/1e6));
//t.DrawLatex(0.13,0.75,Form("central mean:%.2f, # of events: %.1fM",hbbc_mbcen->GetMean(1),hbbcsbbcn_mbcen->Integral()/1e6));
//t.DrawLatex(0.13,0.80,Form("hm AND mean:%.2f, # of events: %.1fM",hbbc_hmand->GetMean(1),hbbcsbbcn_hmand->Integral()/1e6));
//.........这里部分代码省略.........
开发者ID:XuQiao,项目名称:phenix,代码行数:101,代码来源:DrawPerformCompFVTX.C
示例7: VHPlotter
//.........这里部分代码省略.........
if (title=="ZHmass") { hs->GetXaxis()->SetRangeUser(0, 3000); }
h_mc8->Draw("same hist");
h_data->Draw("EPX0SAMES");
h_data->SetMarkerColor(kBlack);
h_data->SetMarkerStyle(20);
h_data->SetMarkerSize (1.0);
h_data->SetStats(0);
TLegend *leg;
if (title=="FATjetTau2dvTau1") { leg = new TLegend(0.15, 0.547, 0.41, 0.88); }
else { leg = new TLegend(0.65, 0.547, 0.91, 0.88);}
//leg = new TLegend(0.65, 0.547, 0.91, 0.88);
leg->SetBorderSize(0);
leg->SetEntrySeparation(0.01);
leg->SetFillColor(0);
leg->SetFillStyle(0);
leg->AddEntry(h_data,"Data","p");
leg->AddEntry(h_mcDY,"DY","f");
leg->AddEntry(h_mc2,"t#bar{t}","f");
//leg->AddEntry(h_mc3,"ZZ","f");
//leg->AddEntry(h_mc4,"WZ","f");
//leg->AddEntry(h_mc6,"WW","f");
leg->AddEntry(h_mcDiboson,"Diboson","f");
leg->AddEntry(h_mc7,"ZH madgraph","f");
leg->AddEntry(h_mc8,"ZH powheg (not in stack)","f");
leg->Draw();
TLatex *lar = new TLatex();
lar->SetNDC(kTRUE);
lar->SetTextSize(0.04);
lar->SetLineWidth(5);
lar->DrawLatex(0.14, 0.94, "CMS #it{#bf{2016}}");
lar->DrawLatex(0.60, 0.94, "L = 12.8 fb^{-1} at #sqrt{s} = 13 TeV");
pad1->Update();
c1->Update();
c1->cd();
TH1F *h_ratio = (TH1F*)h_data->Clone("h_ratio");
TPad *pad2 = new TPad("pad2","pad2",0,0,1,0.3);// 0.3
pad2->SetTopMargin(0);
pad2->SetBottomMargin(0.3);
pad2->Draw();
pad2->cd();
h_ratio->SetTitle("");
h_ratio->SetStats(0);
if (title=="Zpt") {
h_ratio->GetXaxis ()->SetTitle("p_{T}(Z) [GeV/c]");
} else if (title=="Zmass") {
h_ratio->GetXaxis ()->SetTitle("M(Z) [GeV/c^{2}]");//
} else if (title=="ZRapidity") {
h_ratio->GetXaxis ()->SetTitle("y(Z)");
} else if (title=="Zeta") {
h_ratio->GetXaxis ()->SetTitle("#eta(Z)");
} else if (title=="nVtx") {
h_ratio->GetXaxis ()->SetTitle("Number of Vertices");
}
开发者ID:yuchanggit,项目名称:new_git,代码行数:67,代码来源:VHPlotter.C
示例8: CMS_lumi
CMS_lumi( TPad* pad, int iPeriod, int iPosX )
{
bool outOfFrame = false;
if( iPosX/10==0 )
{
outOfFrame = true;
}
int alignY_=3;
int 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 align_ = 10*alignX_ + alignY_;
float H = pad->GetWh();
float W = pad->GetWw();
float l = pad->GetLeftMargin();
float t = pad->GetTopMargin();
float r = pad->GetRightMargin();
float b = pad->GetBottomMargin();
float e = 0.025;
pad->cd();
TString lumiText;
if( iPeriod==1 )
{
lumiText += lumi_7TeV;
lumiText += " (7 TeV)";
}
else if ( iPeriod==2 )
{
lumiText += " (8 TeV)";
}
else if( iPeriod==3 )
{
lumiText = lumi_8TeV;
lumiText += " (8 TeV)";
lumiText += " + ";
lumiText += lumi_7TeV;
lumiText += " (7 TeV)";
}
else if ( iPeriod==4 )
{
lumiText += lumi_13TeV;
lumiText += " (13 TeV)";
}
else if ( iPeriod==7 )
{
if( outOfFrame ) lumiText += "#scale[0.85]{";
lumiText += lumi_13TeV;
lumiText += " (13 TeV)";
lumiText += " + ";
lumiText += lumi_8TeV;
lumiText += " (8 TeV)";
lumiText += " + ";
lumiText += lumi_7TeV;
lumiText += " (7 TeV)";
if( outOfFrame) lumiText += "}";
}
else if ( iPeriod==12 )
{
lumiText += "8 TeV";
}
cout << lumiText << endl;
TLatex latex;
latex.SetNDC();
latex.SetTextAngle(0);
latex.SetTextColor(kBlack);
float extraTextSize = extraOverCmsTextSize*cmsTextSize;
latex.SetTextFont(42);
latex.SetTextAlign(31);
latex.SetTextSize(lumiTextSize*t);
latex.DrawLatex(1-r,1-t+lumiTextOffset*t,lumiText);
if( outOfFrame )
{
latex.SetTextFont(cmsTextFont);
latex.SetTextAlign(11);
latex.SetTextSize(cmsTextSize*t);
latex.DrawLatex(l,1-t+lumiTextOffset*t,cmsText);
}
pad->cd();
float posX_;
if( iPosX%10<=1 )
{
posX_ = l + relPosX*(1-l-r);
}
else if( iPosX%10==2 )
{
posX_ = l + 0.5*(1-l-r);
}
//.........这里部分代码省略.........
开发者ID:gbyu,项目名称:LQanalyzer,代码行数:101,代码来源:MCclosurePlots.C
示例9: mergeEff
void mergeEff(int iCat_ = 0) {
TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
dir.ReplaceAll("mergeEff.C","");
dir.ReplaceAll("/./","/");
ifstream in;
const int nBinC = 13; // Cent(13), pT(7), y(6)
const int nBinP = 7; // Cent(13), pT(7), y(6)
const int nBinY = 6; // Cent(13), pT(7), y(6)
double eff[100][100] = {0.0};
for(int idir = 1; idir < 101; idir++){
if(iCat_ == 0) in.open(Form("%s../Eff_00%d/eff_HighPt_Cents_default_Bit1_y_0.0_2.4_pT_6.5_30.0_pr.tex",dir.Data(),idir));
if(iCat_ == 1) in.open(Form("%s../Eff_00%d/eff_HighPt_Pts_default_Bit1_y_0.0_2.4_pT_6.5_30.0_pr.tex",dir.Data(),idir));
if(iCat_ == 2) in.open(Form("%s../Eff_00%d/eff_HighPt_Raps_default_Bit1_y_0.0_2.4_pT_6.5_30.0_pr.tex",dir.Data(),idir));
Float_t x[300];
Int_t nlines = 0;
int nl = 0;
while (1) {
in >> x[0] ;
eff[nl][idir-1] = x[0];
//cout<<"eff : "<<eff[nl][idir-1]<<endl;
if (!in.good()) break;
nlines++;
nl++;
}
in.close();
}
int nBins = 0;
if(iCat_ == 0) nBins = nBinC;
if(iCat_ == 1) nBins = nBinP;
if(iCat_ == 2) nBins = nBinY;
cout<<"nBins : "<<nBins<<endl;
TH1F *hDis[13];
string eff_tot[100];
for(int in = 0; in < nBins; in++){
if(iCat_ == 2) hDis[in] = new TH1F(Form("hDis_%d",in),"",150,0.25,0.65); // cent
if(iCat_ != 2) hDis[in] = new TH1F(Form("hDis_%d",in),"",120,0.25,0.85); // pT
hDis[in]->Sumw2();
hDis[in]->SetMarkerStyle(20);
hDis[in]->SetMarkerSize(1.2);
puts("");
for(int id = 0; id < 100; id++){
printf("%0.4f ", eff[in][id]);
hDis[in]->Fill(eff[in][id]);
}
}
puts("");
const int nCentBins = 13;
const int nRapBins = 6;
const int nPtBins = 7;
double ct_bound[nCentBins+1] = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 40};
double pt_bound[nPtBins+1] = {6.5, 7.5, 8.5, 9.5, 11.0, 13.0, 16.0, 30.0};
double rap_bound[nRapBins+1] = {0.0, 0.4, 0.8, 1.2, 1.6, 2.0, 2.4};
char OutTextFile[100];
if(iCat_ == 0) sprintf(OutTextFile,"pbpb_prompt_cent.tex");
if(iCat_ == 1) sprintf(OutTextFile,"pbpb_prompt_pt.tex");
if(iCat_ == 2) sprintf(OutTextFile,"pbpb_prompt_rap.tex");
ofstream dataFile(OutTextFile);
TLatex *lt = new TLatex();
lt->SetNDC();
TCanvas *c1 = new TCanvas("c1","",1400,900);
c1->Divide(5,3);
TCanvas *c2 = new TCanvas("c2","",1400,600);
c2->Divide(5,2);
for(int ic = 1; ic < nBins+1; ic++){
if(iCat_==0) c1->cd(ic);
if(iCat_!=0) c2->cd(ic);
hDis[ic-1]->Draw("E");
cout<<"Mean : "<<hDis[ic-1]->GetMean()<<endl;
cout<<"RMS : "<<hDis[ic-1]->GetRMS()<<endl;
if(iCat_ == 0) dataFile<<"Cent : "<<ct_bound[ic-1]*2.5<<"-"<<ct_bound[ic]*2.5<<endl;
if(iCat_ == 1) dataFile<<"pT : "<<pt_bound[ic-1]<<"-"<<pt_bound[ic]<<endl;
if(iCat_ == 2) dataFile<<"rap : "<<rap_bound[ic-1]<<"-"<<rap_bound[ic]<<endl;
dataFile<<hDis[ic-1]->GetMean()<<" "<<hDis[ic-1]->GetRMS()<<endl;
cout<<hDis[ic-1]->GetMean()<<" "<<hDis[ic-1]->GetRMS()<<endl;
if(iCat_==0) lt->DrawLatex(0.15,0.95,"PbPb, p_{T} [6.5,30], y [0.0,2.4]");
if(iCat_==0) lt->DrawLatex(0.15,0.85,Form("Cent [%0.0f,%0.0f]",ct_bound[ic-1]*2.5,ct_bound[ic]*2.5));
if(iCat_==1) lt->DrawLatex(0.15,0.95,Form("PbPb, p_{T} [%0.1f,%0.1f], y [0.0,2.4]",pt_bound[ic-1],pt_bound[ic]));
if(iCat_==1) lt->DrawLatex(0.15,0.85,"Cent 0-100");
if(iCat_==2) lt->DrawLatex(0.15,0.95,Form("PbPb, p_{T} [6.5,30], y [%0.1f,%0.1f]",rap_bound[ic-1],rap_bound[ic]));
if(iCat_==2) lt->DrawLatex(0.15,0.85,"Cent 0-100");
}
if(iCat_ == 0) c1->SaveAs("plot_pbpb_eff_STA_pr_dis_cent.png");c1->SaveAs("plot_pbpb_eff_STA_pr_dis_cent.pdf");
if(iCat_ == 1) c2->SaveAs("plot_pbpb_eff_STA_pr_dis_pt.png");c2->SaveAs("plot_pbpb_eff_STA_pr_dis_pt.pdf");
if(iCat_ == 2) c2->SaveAs("plot_pbpb_eff_STA_pr_dis_rap.png");c2->SaveAs("plot_pbpb_eff_STA_pr_dis_rap.pdf");
return;
}
开发者ID:CMS-HIN-dilepton,项目名称:DimuonCADIs,代码行数:98,代码来源:mergeEff.C
示例10: plotV2vstheta
void plotV2vstheta(){
TFile *f;
int isSum=0;
const int ntotbin=5;
const int trkpointmin[ntotbin] = {120,150,185,220,260};
const int trkpointmax[ntotbin] = {150,185,220,260,300};
int trkbin=1;
int xbin=0;
c1 = new TCanvas("c1"," ",1200,700);
makeMultiPanelCanvas(c1,3,2,0,0,0.25,0.2,0.03);
gStyle->SetOptFit(1);
gStyle->SetOptStat(0);
gStyle->SetOptTitle(0);
gStyle->SetErrorX(0);
TH1D *hFrame = new TH1D("","",100,0,2);
hFrame->SetTitle("");
hFrame->GetXaxis()->SetTitle("#theta");
hFrame->GetYaxis()->SetTitle("reference V_{2}");
hFrame->GetYaxis()->SetTitleOffset(1.1);
hFrame->GetXaxis()->SetTitleSize(0.04);
hFrame->GetYaxis()->SetTitleSize(0.04);
hFrame->GetXaxis()->SetRangeUser(0,1.5);
hFrame->SetMinimum(0.030);
hFrame->SetMaximum(0.065);
for(int trkbin=0;trkbin<ntotbin; trkbin++){
if(isSum==0){
f = TFile::Open(Form("M%d%d/mergedV_Prod.root",trkpointmax[trkbin],trkpointmin[trkbin]));
}
else{
f = TFile::Open(Form("M%d%d/mergedV_Sum.root",trkpointmax[trkbin],trkpointmin[trkbin]));
}
TVectorD* vecVmean = (TVectorD*)f->Get(Form("D_%d/Vmean",xbin));
TVectorD* vecV = (TVectorD*)f->Get(Form("D_%d/D_0/V",xbin));
double Vmean = (*vecVmean)[0];
double *V = vecV->GetMatrixArray();
double theta[ntheta];
for(int itheta=0;itheta<ntheta;itheta++){
theta[itheta]=itheta*TMath::Pi()/ntheta/nn;
}
int maxper10 = findmaxper(V,ntheta,Vmean);
double maxper = (double)(maxper10+1)/10;
c1->cd(trkbin+1);
hFrame->Draw();
TGraph *gV2theta = new TGraph(ntheta,theta,V);
gV2theta->SetMarkerStyle(20);
gV2theta->SetMarkerSize(1.3);
gV2theta->SetMarkerColor(1);
gV2theta->SetLineColor(1);
gV2theta->Draw("Psame");
TLine *lup = new TLine(gV2theta->GetXaxis()->GetXmin(),Vmean*(1+maxper), gV2theta->GetXaxis()->GetXmax(),Vmean*(1+maxper));
TLine *ldown = new TLine(gV2theta->GetXaxis()->GetXmin(),Vmean*(1-maxper), gV2theta->GetXaxis()->GetXmax(),Vmean*(1-maxper));
TLine *l = new TLine(hFrame->GetXaxis()->GetXmin(),Vmean, hFrame->GetXaxis()->GetXmax(),Vmean);
l->SetLineStyle(2);
lup->SetLineStyle(2);
ldown->SetLineStyle(2);
l->SetLineWidth(1.2);
lup->SetLineWidth(1.2);
ldown->SetLineWidth(1.2);
TLatex *tl = new TLatex();
// tl->SetNDC();
tl->SetTextFont(42);
tl->SetTextSize(0.04);
// tl->SetBorderStyle(0);
tl->DrawLatex(0,Vmean*(1+maxper),Form("mean up %.f%%",maxper*100));
tl->DrawLatex(0,Vmean*(1-maxper),Form("mean down %.f%%",maxper*100));
tl->SetNDC();
tl->DrawLatex(0.7,0.85,Form("Multiplicity %d to %d",trkpointmin[trkbin],trkpointmax[trkbin]));
l->Draw("same");
lup->Draw("same");
ldown->Draw("same");
}
c1->cd(ntotbin+1);
TLatex *tlx0 = new TLatex(0.12,0.3,Form("PF candi, use p_{T} weight"));
TLatex *tlx1 = new TLatex(0.12,0.25,Form("%.1f<p_{T}<%.1f (GeV/c)",0.3,6.0));
tlx0->SetNDC();
tlx1->SetNDC();
tlx0->SetTextSize(0.045);
tlx1->SetTextSize(0.045);
hFrame->Draw();
tlx0->Draw("same");
tlx1->Draw("same");
if(isSum==0)c1->SaveAs("hV2theta_Prod.png");
else c1->SaveAs("hV2theta_Sum.png");
}
开发者ID:XuQiao,项目名称:HI,代码行数:85,代码来源:plotV2vstheta.C
示例11: fitX
void fitX(TString infname="/data/twang/BfinderRun2/DoubleMu/BfinderData_pp_20151202_bPt0jpsiPt0tkPt0p5/finder_pp_merged.root")
{
TFile *inf = new TFile(infname.Data());
TTree *ntmix = (TTree*) inf->Get("Bfinder/ntmix");
TH1D *h = new TH1D("h","",40,3.6,4);
TCut cutTrk = "1"; //original YJ
//TCut cutTrk = "Btrk1PixelHit>=2&&Btrk1StripHit>=7&&Btrk1Chi2ndf<5&&Btrk2PixelHit>=2&&Btrk2StripHit>=7&&Btrk2Chi2ndf<5";
TCut cutTotal="Btype==7&&Bpt>10&&abs(Beta)<10&&sqrt((Bmumueta-Btrk1Eta)*(Bmumueta-Btrk1Eta)+(Bmumuphi-Btrk1Phi)*(Bmumuphi-Btrk1Phi))<9999"&&cutTrk;
TCanvas *c = new TCanvas("c","",750,600);
ntmix->Draw("Bmass>>h",cutTotal);
TFile*output=new TFile("histoX.root","recreate");
output->cd();
h->Write();
output->Close();
h->Sumw2();
TF1 *f = new TF1("f","[0]+[1]*x+[2]*x*x+[8]*x*x*x+[9]*x*x*x*x+[3]*Gaus(x,[4],[5])+[6]*Gaus(x,[7],[5])");
f->SetLineColor(4);
f->SetParameters(-2.2597e4,1.326e4,-1.727e3,50,3.686,0.00357,1,3.8725,0.0054);
f->FixParameter(4,3.686);
f->FixParameter(5,0.00357);
f->FixParameter(7,3.8725);
h->Fit("f","LL");
h->Fit("f","");
h->Fit("f","LL");
h->Fit("f","LL","",3.65,3.94);
h->Fit("f","LL","",3.65,3.94);
f->ReleaseParameter(4);
f->ReleaseParameter(5);
f->ReleaseParameter(7);
h->Fit("f","LL","",3.65,3.94);
h->SetXTitle("m(J/#psi#pi^{+}#pi^{-}) [GeV]");
h->SetYTitle("Entries");
h->SetStats(0);
h->SetAxisRange(0,h->GetMaximum()*1.3 ,"Y");
TF1 *f2 = new TF1("f2","[0]+[1]*x+[2]*x*x+0*Gaus(x,[4],[5])+0*Gaus(x,[7],[5])");
f2->SetParameter(0,f->GetParameter(0));
f2->SetParameter(1,f->GetParameter(1));
f2->SetParameter(2,f->GetParameter(2));
TF1 *f3 = new TF1("f3","[3]*Gaus(x,[4],[5])+[6]*Gaus(x,[7],[5])");
f3->SetParameter(3,f->GetParameter(3));
f3->SetParameter(4,f->GetParameter(4));
f3->SetParameter(5,f->GetParameter(5));
f3->SetParameter(6,f->GetParameter(6));
f3->SetParameter(7,f->GetParameter(7));
f3->SetParameter(8,f->GetParameter(8));
f->SetLineColor(4);
f2->SetLineColor(4);
f3->SetRange(3.65,3.94);
f2->SetRange(3.65,3.94);
f2->SetLineStyle(2);
f3->SetLineStyle(2);
f2->Draw("same");
f3->SetLineColor(2);
f3->SetFillStyle(3004);
f3->SetFillColor(2);
f3->Draw("same");
TLatex *l = new TLatex(3.7,70./80*h->GetMaximum(),"#psi(2S)");
l->Draw();
TLatex *l2 = new TLatex(3.875,50./80*h->GetMaximum(),"X(3872)");
l2->Draw();
TLatex *l3 = new TLatex(3.812,70./80*h->GetMaximum(),"CMS Preliminary");
l3->Draw();
TLatex *l4 = new TLatex(3.78,60./80*h->GetMaximum(),"pp #sqrt{s_{NN}}=5.02 TeV");
l4->Draw();
cout<<ntmix->GetEntries()<<endl;
TH1D *hProj = (TH1D*)h->Clone("hProj");
hProj->Clear();
f->SetRange(3.6,4);
for (int i=0;i<h->GetEntries()*11;i++)
{
hProj->Fill(f->GetRandom());
}
TCanvas *c2 = new TCanvas("c2","",750,600);
hProj->SetTitle("Estimated Projection");
hProj->Draw("e");
}
开发者ID:HyunchulKim,项目名称:BntupleRunII,代码行数:84,代码来源:fitX.C
示例12: compare
//.........这里部分代码省略.........
my_corr->Rebin(nReb);
// if(!isjf){
double my_R = my_corr->Integral("width")/PI;
cout<<"my_R = "<<my_R<<endl;
my_corr->Scale(1./my_R);
double R = corr->Integral("width")/PI;
cout<<"R = "<<R<<endl;
//corr->Sumw2();
cout<<"my_R/R = "<<my_R/R<<endl;
corr->Scale(1./R);
// }
corr->SetMarkerStyle(20);
corr->SetMarkerSize(0.8);
my_corr->SetMarkerColor(1);
my_corr->SetLineColor(1);
if(isjf){
double ymin = corr->GetMinimum();
double ymax = corr->GetMaximum();
if(my_corr->GetMaximum() > ymax) ymax = my_corr->GetMaximum();
if(my_corr->GetMinimum() < ymin) ymin = my_corr->GetMinimum();
corr->SetAxisRange(ymin-0.01, 1.2*ymax,"Y");
}
corr->GetYaxis()->SetTitleOffset(1.9);
corr->Draw();
my_corr->Draw("same");
TLegend *l1 = new TLegend(0.7,0.7,0.9,0.9,"","brNDC");
l1->AddEntry(my_corr,"Run11","lpf");
l1->AddEntry(corr,"Run10","lpf");
if(hadron_bin==0) l1->Draw("same");
TLatex *la = new TLatex(0.3, 0.75, latex_name.str().c_str());
la->SetNDC();
la->Draw("same");
string pbin_string = cfname.str().substr(7,1);
string hbin_string = cfname.str().substr(10,1);
if(pbin_string.compare("0") == 0){
if(hbin_string.compare("0") == 0) can_ratio[0]->cd(1);
if(hbin_string.compare("1") == 0) can_ratio[0]->cd(2);
if(hbin_string.compare("2") == 0) can_ratio[0]->cd(3);
if(hbin_string.compare("3") == 0) can_ratio[0]->cd(4);
if(hbin_string.compare("4") == 0) can_ratio[0]->cd(5);
}
if(pbin_string.compare("1") == 0){
if(hbin_string.compare("0") == 0) can_ratio[1]->cd(1);
if(hbin_string.compare("1") == 0) can_ratio[1]->cd(2);
if(hbin_string.compare("2") == 0) can_ratio[1]->cd(3);
if(hbin_string.compare("3") == 0) can_ratio[1]->cd(4);
if(hbin_string.compare("4") == 0) can_ratio[1]->cd(5);
}
if(pbin_string.compare("2") == 0){
if(hbin_string.compare("0") == 0) can_ratio[2]->cd(1);
if(hbin_string.compare("1") == 0) can_ratio[2]->cd(2);
if(hbin_string.compare("2") == 0) can_ratio[2]->cd(3);
if(hbin_string.compare("3") == 0) can_ratio[2]->cd(4);
if(hbin_string.compare("4") == 0) can_ratio[2]->cd(5);
}
if(pbin_string.compare("3") == 0){
if(hbin_string.compare("0") == 0) can_ratio[3]->cd(1);
if(hbin_string.compare("1") == 0) can_ratio[3]->cd(2);
if(hbin_string.compare("2") == 0) can_ratio[3]->cd(3);
if(hbin_string.compare("3") == 0) can_ratio[3]->cd(4);
if(hbin_string.compare("4") == 0) can_ratio[3]->cd(5);
开发者ID:alihanks,项目名称:phenix,代码行数:67,代码来源:compare.C
示例13: do1dfit
//.........这里部分代码省略.........
drconehist_axis1->add(*dset_rcone_axis1);
if(debug){
drconehist_axis1->Print("V");
}
dsidebhist_axis1 = new RooDataHist("dsidebhist_axis1","dsidebhist_axis1",var);
dsidebhist_axis1->add(*dset_sideb_axis1);
if(debug){
dsidebhist_axis1->Print("V");
}
drconepdf_axis1 = new RooHistPdf("drconepdf_axis1","drconepdf_axis1",var,*drconehist_axis1);
dsidebpdf_axis1 = new RooHistPdf("dsidebpdf_axis1","dsidebpdf_axis1",var,*dsidebhist_axis1);
//normalizes histograms over all observables
// RooAddPdf is an efficient implementation of a sum of PDFs of the form c_1*PDF_1 + c_2*PDF_2 + ... (1-sum(c_1...c_n-1))*PDF_n
//the sum of the coefficients is enforced to be one,and the coefficient of the last PDF is calculated from that condition.
//ArgList of coefficients -1 of roohistpdf
RooAddPdf *model_axis1=NULL;
model_axis1 = new RooAddPdf("model_axis1","model_axis1",RooArgList(*drconepdf_axis1,*dsidebpdf_axis1),RooArgList(*fsig1),kFALSE);
//if does not converge take NumCPU strategy 2
RooFitResult *firstpass1;
//hesse run by default
//SumW2Error takes statistics of MC (weights) into account
//firstpass1 = model_axis1->fitTo(*dset_data_axis1, NumCPU(8), Extended(false),SumW2Error(kTRUE),Save(kTRUE));
firstpass1 = model_axis1->fitTo(*dset_data_axis1, NumCPU(8), Extended(false),SumW2Error(kFALSE),Save(kTRUE));
TFile resFile(Form("../plots/fitresult_%s_%s_%u_range_%u_%u.root",(truthfit)? "truth": "rcone_sideb",(EBEB) ? "EBEB": "notEBEB",im,startbin_q,endbin_q),"RECREATE");
firstpass1->Write();
if(massbinned) {
pu[im]=fsig1->getVal();
puerr[im]=fsig1->getPropagatedError(*firstpass1);
// masserror[im]=0.;
}
resFile.Write();
resFile.Close();
firstpass1->Print();
TLatex b;b.SetNDC();b.SetTextSize(0.06);b.SetTextColor(kRed);
TCanvas *c1 = new TCanvas("c1","c1",1200,800);
TLegend *leg = new TLegend(0.15,0.8,0.35,0.9);
c1->cd(1);
TString title;
if(dohggv){
title= Form("1d fit for hgg vertex no SumW2Error, %s, reweighted,%u rangebins: %u - %u",(EBEB)? "EBEB": "notEBEB" ,im, startbin_q, endbin_q);
}
el
|
请发表评论