void displayHisto(int show, TH1D* h, TString tag, TString drawOpt) { bool isBatch= gROOT->IsBatch(); if (!show && !saveCollection) return; if (!show && saveCollection) gROOT->SetBatch(true); TString canvName="c_" + tag; TCanvas *c=new TCanvas(canvName,canvName,600,600); h->Draw(drawOpt); c->Update(); TPaveStats *stats= (TPaveStats*)c->GetPrimitive("stats"); if (stats) { stats->SetY1NDC(0.7); stats->SetY2NDC(0.85); c->Update(); } if (show) { double effSigma= calc_effSigma(h); std::cout << "histogram " << h->GetName()<<", effSigma="<<effSigma<<"\n"; } #ifdef helper_HH TString figName="fig-" + tag; SaveCanvas(c,figName,plotOutDir); #endif if (saveCollection) collector.Add(h,c); if (!show && saveCollection) gROOT->SetBatch(isBatch); }
void displayHisto(int show, TH2D* h, TString tag, TString drawOpt, int drawXeqY) { bool isBatch= gROOT->IsBatch(); if (!show && !saveCollection) return; if (!show && saveCollection) gROOT->SetBatch(true); TString canvName="c_" + tag; TCanvas *c=new TCanvas(canvName,canvName,600,600); #ifdef ColorPalettes_HH AdjustFor2DplotWithHeight(c,0.18); SetSideSpaces(c,0.05,0.0,0.0,0.0); h->GetYaxis()->SetTitleOffset(1.8); #endif h->Draw(drawOpt); if (drawXeqY) { c->Update(); Double_t xmin= c->GetUxmin(); Double_t xmax= c->GetUxmax(); Double_t ymin= c->GetUymin(); Double_t ymax= c->GetUymax(); if (xmin>ymin) ymin=xmin; else xmin=ymin; if (xmax<ymax) xmax=ymax; else ymax=xmax; if (xmin<xmax) { TLine *line= new TLine(xmin,ymin,xmax,ymax); line->Draw(); } else { std::cout << "\tcould not draw x=y line\n"; } } c->Update(); TPaveStats *stats= (TPaveStats*)c->GetPrimitive("stats"); if (stats) { stats->SetY1NDC(0.7); stats->SetY2NDC(0.85); c->Update(); } #ifdef helper_HH TString figName="fig-" + tag; SaveCanvas(c,figName,plotOutDir); #endif if (saveCollection) collector.Add(h,c); if (!show && saveCollection) gROOT->SetBatch(isBatch); }
void poiss() { TF1* func = new TF1("func","TMath::Poisson(x,0.06)",0,10); TH1D* h = new TH1D("h",";# of collisions",11,-0.5,10.5); for(int i=1;i<=11;i++) h->SetBinContent(i,func->Eval(h->GetBinCenter(i))); TCanvas* c = new TCanvas("c","c",550,500); c->SetLogy(); h->GetXaxis()->CenterTitle(); h->Draw("hist"); TLatex* latex = new TLatex(); latex->SetNDC(); latex->SetTextSize(latex->GetTextSize()*0.75); latex->DrawLatex(0.43,0.87,"Poisson distribution, <#mu>=6%"); SaveCanvas(c,"pPb/corr","Poisson_mu6"); }
//--------------------------------------------------------------------------- void __fastcall TFMain_11011981::lbUnitsDrawItem( TWinControl *Control, int Index, TRect &Rect, TOwnerDrawState State) { char *s, *pos; int flags, len; TColor _color; TListBox *lb; TCanvas *canvas; String text, str1, str2; lb = (TListBox*)Control; canvas = lb->Canvas; SaveCanvas(canvas); if (Index < lb->Count) { flags = Control->DrawTextBiDiModeFlags(DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX); if (!Control->UseRightToLeftAlignment()) Rect.Left += 2; else Rect.Right -= 2; text = lb->Items->Strings[Index]; //lb->ItemHeight = canvas->TextHeight(text); canvas->FillRect(Rect); s = text.c_str(); //*XXXXXXXX #XXX XX NAME pos = strrchr(s, ' '); len = pos - s; str1 = text.SubString(2, len - 1); str2 = text.SubString(len + 1, text.Length() - len); if (!State.Contains(odSelected)) _color = TColor(0); //Black else _color = TColor(0xBBBBBB); //LightGray Rect.Right = Rect.Left; DrawOneItem(str1, canvas, Rect, _color, flags); //Unit name //Trivial unit - red if (text[1] & TRIV_UNIT) { if (!State.Contains(odSelected)) _color = TColor(0x0000B0); //Red else _color = TColor(0xBBBBBB); //LightGray } else { //User unit - green if (text[1] & USER_UNIT) { if (!State.Contains(odSelected)) { if (text[1] & UNEXP_UNIT) _color = TColor(0xC0C0FF); //Light Red else _color = TColor(0x00B000); //Green } else _color = TColor(0xBBBBBB); //LightGray } //From knowledge base - blue else { if (!State.Contains(odSelected)) _color = TColor(0xC08000); //Blue else _color = TColor(0xBBBBBB); //LightGray } } DrawOneItem(str2, canvas, Rect, _color, flags); } RestoreCanvas(canvas); }
void eff() { TFile* f[10]; f[0] = new TFile("/net/hisrv0001/home/davidlw/scratch1/v0validation_match075_v4.root"); f[1] = new TFile("/net/hisrv0001/home/davidlw/scratch1/v0validation_match06_v4.root"); f[2] = new TFile("/net/hisrv0001/home/davidlw/scratch1/v0validation_match05_v4.root"); TH1D* kspt_num[10]; TH1D* kspt_denom[10]; TH1D* lapt_num[10]; TH1D* lapt_denom[10]; TH2D* ksetapt_num[10]; TH2D* ksetapt_denom[10]; TH2D* laetapt_num[10]; TH2D* laetapt_denom[10]; for(int i=0;i<3;i++) { kspt_num[i] = (TH1D*)f[i]->Get("v0Validator/K0sEffVsPt_num"); kspt_denom[i] = (TH1D*)f[i]->Get("v0Validator/K0sEffVsPt_denom"); kspt_num[i]->SetMarkerColor(i+1); kspt_denom[i]->SetMarkerColor(i+1); lapt_num[i] = (TH1D*)f[i]->Get("v0Validator/LamEffVsPt_num"); lapt_denom[i] = (TH1D*)f[i]->Get("v0Validator/LamEffVsPt_denom"); lapt_num[i]->SetMarkerColor(i+1); lapt_denom[i]->SetMarkerColor(i+1); kspt_num[i]->Divide(kspt_denom[i]); lapt_num[i]->Divide(lapt_denom[i]); ksetapt_num[i] = (TH2D*)f[i]->Get("v0Validator/K0sEffVsEtaPt_num"); ksetapt_denom[i] = (TH2D*)f[i]->Get("v0Validator/K0sEffVsEtaPt_denom"); ksetapt_num[i]->SetMarkerColor(i+1); ksetapt_denom[i]->SetMarkerColor(i+1); laetapt_num[i] = (TH2D*)f[i]->Get("v0Validator/LamEffVsEtaPt_num"); laetapt_denom[i] = (TH2D*)f[i]->Get("v0Validator/LamEffVsEtaPt_denom"); laetapt_num[i]->SetMarkerColor(i+1); laetapt_denom[i]->SetMarkerColor(i+1); ksetapt_num[i]->Divide(ksetapt_denom[i]); laetapt_num[i]->Divide(laetapt_denom[i]); } TCanvas* c = new TCanvas("c","c",600,500); kspt_num[0]->SetAxisRange(0.,12,"X"); kspt_num[0]->Draw("PE"); kspt_num[1]->Draw("PESAME"); kspt_num[2]->Draw("PESAME"); TCanvas* c1 = new TCanvas("c1","c1",600,500); lapt_num[0]->SetAxisRange(0.,12,"X"); lapt_num[0]->Draw("PE"); lapt_num[1]->Draw("PESAME"); lapt_num[2]->Draw("PESAME"); TCanvas* c2 = new TCanvas("c2","c2",600,500); ksetapt_num[2]->Draw("lego2"); TCanvas* c3 = new TCanvas("c3","c3",600,500); laetapt_num[2]->Draw("lego2"); SaveCanvas(c,"HI/V0","KsEffvsPt"); SaveCanvas(c1,"HI/V0","LamEffvsPt"); SaveCanvas(c2,"HI/V0","KsEffvsEtaPt"); SaveCanvas(c3,"HI/V0","LamEffvsEtaPt"); TFile* fout = new TFile("V0Eff_matching.root","recreate"); kspt_num[2]->Write(); lapt_num[2]->Write(); ksetapt_num[2]->Write(); laetapt_num[2]->Write(); fout->Close(); }
void vn_spectra_trackHF() { TString filename = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/HIData_Minbias_2760GeV_UCC2011_INCLv1HF_nmin-1_nmax-1_etatrg-5.0--3.0_etaass3.0-5.0_centmin110_centmax1000.root"); TFile* fdiff = new TFile(filename.Data()); TH1D* hpt_ref; TH2D* hsignal_ref; TH2D* hbackground_ref; TH1D* hsignal_ref_1D; TH1D* hbackground_ref_1D; TH1D* hcorr_ref_1D; TH1D* hpt[20]; TH2D* hsignal[20]; TH2D* hbackground[20]; TH1D* hsignal_1D[20]; TH1D* hbackground_1D[20]; TH1D* hcorr_1D[20]; TGraphErrors* gr[20]; TGraphErrors* gr_corr[20]; for(int i=0;i<20;i++) { if(i>=5) { gr[i] = new TGraphErrors(11); gr_corr[i] = new TGraphErrors(11); } else { gr[i] = new TGraphErrors(13); gr_corr[i] = new TGraphErrors(13); } gr[i]->SetName(Form("vnpt_%d",i)); gr_corr[i]->SetName(Form("vnpt_corr_%d",i)); } double factor[20]={1.,1.3,1.0,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8}; double factor_err[20]={0.,0.1,0.4,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6}; double VnArray[20][20],Vn0[20],vn0[20],vn0err[20],vn01[20],vn01err[20],vn0_corr[20],vn0_corr_up[20],vn0_corr_down[20],vn0_corr_sys[28],vn0err_corr[20],vn0_ratio[20],vn0err_ratio[20]; hsignal_ref = (TH2D*)fdiff->Get("signalcosn_trg0_ass0"); hbackground_ref = (TH2D*)fdiff->Get("backgroundcosn_trg0_ass0"); hsignal_ref_1D = (TH1D*)hsignal_ref->ProfileY("signal_1D_trg0_ass0_ref",1,-1,"e"); hbackground_ref_1D = (TH1D*)hbackground_ref->ProfileY("background_1D_trg0_ass0_ref",1,-1,"e"); hcorr_ref_1D = new TH1D("Vn_1D_trg0_ass0_ref",";n;V_{n#Delta}",15,0.5,15.5); for(int n=1;n<=hcorr_ref_1D->GetNbinsX();n++) { double Vn=hsignal_ref_1D->GetBinContent(n)-hbackground_ref_1D->GetBinContent(n); double VnError=sqrt(hsignal_ref_1D->GetBinError(n)*hsignal_ref_1D->GetBinError(n)+hbackground_ref_1D->GetBinError(n)*hbackground_ref_1D->GetBinError(n)); hcorr_ref_1D->SetBinContent(n,Vn); hcorr_ref_1D->SetBinError(n,VnError); Vn0[n] = Vn; vn0[n] = sqrt(fabs(Vn)); vn0err[n] = fabs(VnError/Vn)*vn0[n]; } TFile* fpt = new TFile(Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/HIData_Minbias_2760GeV_UCC2011_INCLv1TrackHF_nmin-1_nmax-1_etatrg-2.4-0.0_etaass3.0-5.0_centmin110_centmax1000.root")); TH1D* hptcorr = (TH1D*)fpt->Get("ptcorrall_trg"); double merit[20]={0}; double merit_err[20]={0}; double total[20]={0}; double merit_corr[20]={0}; double merit_corr_up[20]={0}; double merit_corr_down[20]={0}; double merit_corr_err[20]={0}; double total_corr[20]={0}; for(int i=13;i>=0;i--) { hpt[i] = (TH1D*)fdiff1->Get(Form("ptcorr_trg_%d",i+1)); if(i>2) { hsignal[i] = (TH2D*)fdiff->Get(Form("signalcosn_trg%d_ass0",i+1)); hbackground[i] = (TH2D*)fdiff->Get(Form("backgroundcosn_trg%d_ass0",i+1)); } else { hsignal[i] = (TH2D*)fdiff1->Get(Form("signalcosn_trg%d_ass0",i+1)); hbackground[i] = (TH2D*)fdiff1->Get(Form("backgroundcosn_trg%d_ass0",i+1)); } hsignal_1D[i] = (TH1D*)hsignal[i]->ProfileY(Form("signal_1D_trg%d_ass0",i+1),1,-1,"e"); hbackground_1D[i] = (TH1D*)hbackground[i]->ProfileY(Form("background_1D_trg%d_ass0",i+1),1,-1,"e"); hcorr_1D[i] = new TH1D(Form("Vn_1D_trg%d_ass0",i+1),";n;V_{n#Delta}",15,0.5,15.5); for(int n=1;n<=hcorr_1D[i]->GetNbinsX();n++) { if(n>=6 && hpt[i]->GetMean()>5.0) continue; if(n==5 && hpt[i]->GetMean()>8.0) continue; if(n==4 && hpt[i]->GetMean()>10.0) continue; double Vn=hsignal_1D[i]->GetBinContent(n)-hbackground_1D[i]->GetBinContent(n); double VnError=sqrt(hsignal_1D[i]->GetBinError(n)*hsignal_1D[i]->GetBinError(n)+hbackground_1D[i]->GetBinError(n)*hbackground_1D[i]->GetBinError(n)); VnArray[n][i] = Vn; hcorr_1D[i]->SetBinContent(n,Vn); hcorr_1D[i]->SetBinError(n,VnError); double vn=Vn/vn0[n]; if(i<=2) vn=Vn/vn01[n]; double vnerr=vn*sqrt((VnError/Vn)*(VnError/Vn)+vn0err[n]*vn0err[n]); if(i<=2) vnerr=vn*sqrt((VnError/Vn)*(VnError/Vn)+vn01err[n]*vn01err[n]); gr[n-1]->SetPoint(i,hpt[i]->GetMean(),vn); gr[n-1]->SetPointError(i,0,vnerr); /* double integral = hpt[i]->Integral(); if(i==0) integral = hpt[1]->Integral(); if(hpt[i]->GetMean()>3.0) continue; merit[n-1] = merit[n-1] + integral/1000.*vn; merit_err[n-1] = merit_err[n-1] + integral/1000.*vnerr; total[n-1] = total[n-1] + integral/1000.; gr_merit[n-1]->SetPoint(i,hpt[i]->GetMean(),merit[n-1]/sqrt(total[n-1])); if(n==2) cout<<"n="<<n<<" i="<<i<<" "<<merit[n-1]/sqrt(total[n-1])<<endl; */ double integral = hptcorr->GetBinContent(hptcorr->FindBin(hpt[i]->GetMean()))*hptcorr->GetBinWidth(hptcorr->FindBin(hpt[i]->GetMean())); if(hpt[i]->GetMean()>3.0) continue; merit[n-1] = merit[n-1] + integral/1000.*vn; merit_err[n-1] = merit_err[n-1] + integral/1000.*vnerr; total[n-1] = total[n-1] + integral/1000.; gr_merit[n-1]->SetPoint(i,hpt[i]->GetMean(),merit[n-1]/sqrt(total[n-1])); if(n==2) cout<<"n="<<n<<" i="<<i<<" "<<merit[n-1]/sqrt(total[n-1])<<endl; } } TH1D* h1corr = (TH1D*)Get1DCFdPhiv3(filename.Data(),0,0,1.9,4.0); TH1D* h2corr = (TH1D*)Get1DCFdPhiv3(filename.Data(),11,0,1.9,4.0); TCanvas* ccorr = new TCanvas("ccorr","ccorr",900,400); ccorr->Divide(2,1); ccorr->cd(1); ccorr->GetPad(1)->SetLeftMargin(0.23); h1corr->SetAxisRange(50.9,52.,"Y"); h1corr->GetYaxis()->SetTitleOffset(1.2); h1corr->GetXaxis()->SetLabelSize(h1corr->GetXaxis()->GetLabelSize()*0.98); h1corr->GetYaxis()->SetLabelSize(h1corr->GetXaxis()->GetLabelSize()*0.98); h1corr->GetXaxis()->SetTitleSize(h1corr->GetXaxis()->GetTitleSize()*0.98); h1corr->GetYaxis()->SetTitleSize(h1corr->GetXaxis()->GetTitleSize()*0.98); h1corr->GetYaxis()->SetTitleOffset(h1corr->GetYaxis()->GetTitleOffset()*1.4); h1corr->GetXaxis()->CenterTitle(); h1corr->GetYaxis()->CenterTitle(); h1corr->Draw("PE"); ccorr->cd(2); ccorr->GetPad(2)->SetLeftMargin(0.23); h2corr->SetAxisRange(50.8,52.4,"Y"); h2corr->GetYaxis()->SetTitleOffset(1.2); h2corr->GetXaxis()->SetLabelSize(h2corr->GetXaxis()->GetLabelSize()*0.98); h2corr->GetYaxis()->SetLabelSize(h2corr->GetXaxis()->GetLabelSize()*0.98); h2corr->GetXaxis()->SetTitleSize(h2corr->GetXaxis()->GetTitleSize()*0.98); h2corr->GetYaxis()->SetTitleSize(h2corr->GetXaxis()->GetTitleSize()*0.98); h2corr->GetYaxis()->SetTitleOffset(h2corr->GetYaxis()->GetTitleOffset()*1.4); h2corr->GetXaxis()->CenterTitle(); h2corr->GetYaxis()->CenterTitle(); h2corr->Draw("PE"); TF1* fitfunc1 = FitVnFunc(h1corr); TF1* fitfunc2 = FitVnFunc(h2corr); fitfunc1->SetLineStyle(4); fitfunc2->SetLineStyle(4); fitfunc1->SetParameters(fitfunc1->GetParameter(0),Vn0[1],Vn0[2],Vn0[3],Vn0[4],Vn0[5],Vn0[6],Vn0[7],Vn0[8],Vn0[9],Vn0[10]); fitfunc2->SetParameters(fitfunc2->GetParameter(0),VnArray[1][10],VnArray[2][10],VnArray[3][10],VnArray[4][10],VnArray[5][10],VnArray[6][10],VnArray[7][10],VnArray[8][10],VnArray[9][10],VnArray[10][10]); ccorr->cd(1); fitfunc1->Draw("Lsame"); ccorr->cd(2); fitfunc2->Draw("Lsame"); TF1* fitfuns1[6]; TF1* fitfuns2[6]; for(int i=0;i<6;i++) { fitfuns1[i] = (TF1*)fitfunc1->Clone(Form("fitfuncs1_%d",i)); fitfuns2[i] = (TF1*)fitfunc2->Clone(Form("fitfuncs2_%d",i)); fitfuns1[i]->SetLineColor(i+1); fitfuns2[i]->SetLineColor(i+1); fitfuns1[i]->SetLineWidth(1); fitfuns2[i]->SetLineWidth(1); fitfuns1[i]->SetLineStyle(1); fitfuns2[i]->SetLineStyle(1); } fitfuns1[0]->SetLineColor(1); fitfuns1[1]->SetLineColor(2); fitfuns1[2]->SetLineColor(9); fitfuns1[3]->SetLineColor(4); fitfuns1[4]->SetLineColor(8); fitfuns1[5]->SetLineColor(6); fitfuns2[0]->SetLineColor(1); fitfuns2[1]->SetLineColor(2); fitfuns2[2]->SetLineColor(9); fitfuns2[3]->SetLineColor(4); fitfuns2[4]->SetLineColor(8); fitfuns2[5]->SetLineColor(6); fitfuns1[0]->SetParameters(fitfuns1[0]->GetParameter(0),fitfuns1[0]->GetParameter(1),0,0,0,0,0,0,0,0,0); fitfuns1[1]->SetParameters(fitfuns1[1]->GetParameter(0),0,fitfuns1[1]->GetParameter(2),0,0,0,0,0,0,0,0); fitfuns1[2]->SetParameters(fitfuns1[2]->GetParameter(0),0,0,fitfuns1[2]->GetParameter(3),0,0,0,0,0,0,0); fitfuns1[3]->SetParameters(fitfuns1[3]->GetParameter(0),0,0,0,fitfuns1[3]->GetParameter(4),0,0,0,0,0,0); fitfuns1[4]->SetParameters(fitfuns1[4]->GetParameter(0),0,0,0,0,fitfuns1[4]->GetParameter(5),0,0,0,0,0); fitfuns1[5]->SetParameters(fitfuns1[5]->GetParameter(0),0,0,0,0,0,fitfuns1[5]->GetParameter(6),0,0,0,0); fitfuns2[0]->SetParameters(fitfuns2[0]->GetParameter(0),fitfuns2[0]->GetParameter(1),0,0,0,0,0,0,0,0,0); fitfuns2[1]->SetParameters(fitfuns2[1]->GetParameter(0),0,fitfuns2[1]->GetParameter(2),0,0,0,0,0,0,0,0); fitfuns2[2]->SetParameters(fitfuns2[2]->GetParameter(0),0,0,fitfuns2[2]->GetParameter(3),0,0,0,0,0,0,0); fitfuns2[3]->SetParameters(fitfuns2[3]->GetParameter(0),0,0,0,fitfuns2[3]->GetParameter(4),0,0,0,0,0,0); fitfuns2[4]->SetParameters(fitfuns2[4]->GetParameter(0),0,0,0,0,fitfuns2[4]->GetParameter(5),0,0,0,0,0); fitfuns2[5]->SetParameters(fitfuns2[5]->GetParameter(0),0,0,0,0,0,fitfuns2[5]->GetParameter(6),0,0,0,0); ccorr->cd(1); fitfuns1[0]->Draw("Lsame"); fitfuns1[1]->Draw("Lsame"); fitfuns1[2]->Draw("Lsame"); fitfuns1[3]->Draw("Lsame"); fitfuns1[4]->Draw("Lsame"); fitfuns1[5]->Draw("Lsame"); ccorr->cd(2); fitfuns2[0]->Draw("Lsame"); fitfuns2[1]->Draw("Lsame"); fitfuns2[2]->Draw("Lsame"); fitfuns2[3]->Draw("Lsame"); fitfuns2[4]->Draw("Lsame"); fitfuns2[5]->Draw("Lsame"); TLegend* legend_corr = new TLegend(0.28,0.63,0.7,0.92); legend_corr->SetFillStyle(0); legend_corr->SetTextFont(42); legend_corr->AddEntry(fitfunc1,"Sum","L"); legend_corr->AddEntry(fitfuns1[0],"n = 1","L"); legend_corr->AddEntry(fitfuns1[1],"n = 2","L"); legend_corr->AddEntry(fitfuns1[2],"n = 3","L"); legend_corr->AddEntry(fitfuns1[3],"n = 4","L"); legend_corr->AddEntry(fitfuns1[4],"n = 5","L"); legend_corr->AddEntry(fitfuns1[5],"n = 6","L"); ccorr->cd(1); legend_corr->Draw("same"); ccorr->cd(2); legend_corr->Draw("same"); ccorr->cd(1); TLatex* latex_corr = new TLatex(); latex_corr->SetNDC(1); latex_corr->SetTextSize(latex_corr->GetTextSize()*0.8); latex_corr->DrawLatex(0.47,0.88,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); latex_corr->DrawLatex(0.63,0.82,centtag.Data()); latex_corr->DrawLatex(0.76,0.76,"|#Delta#eta| > 2"); ccorr->cd(2); TLatex* latex1_corr = new TLatex(); latex1_corr->SetNDC(1); latex1_corr->SetTextSize(latex1_corr->GetTextSize()*0.8); latex1_corr->DrawLatex(0.47,0.88,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); latex1_corr->DrawLatex(0.63,0.82,centtag.Data()); latex1_corr->DrawLatex(0.76,0.76,"|#Delta#eta| > 2"); ccorr->cd(1); TLatex* latex_trg1 = new TLatex(); latex_trg1->SetNDC(1); latex_trg1->SetTextSize(latex_trg1->GetTextSize()*0.8); latex_trg1->DrawLatex(0.59,0.635,"1 < p_{T}^{trig} < 3 GeV/c"); latex_trg1->DrawLatex(0.59,0.57,"1 < p_{T}^{assoc} < 3 GeV/c"); ccorr->cd(2); TLatex* latex_trg2 = new TLatex(); latex_trg2->SetNDC(1); latex_trg2->SetTextSize(latex_trg2->GetTextSize()*0.8); latex_trg2->DrawLatex(0.59,0.635,"4 < p_{T}^{trig} < 5 GeV/c"); latex_trg2->DrawLatex(0.59,0.57,"1 < p_{T}^{assoc} < 3 GeV/c"); SaveCanvas(ccorr,"HI/UCC",Form("corr1Dfit_%s_centmin%d_centmax%d",tag.Data(),centmin,centmax)); /* TCanvas* ccc = new TCanvas("ccc","ccc",900,400); ccc->Divide(2,1); ccc->cd(1); ccc->GetPad(1)->SetLeftMargin(0.3); hsignal_ref_1D->GetYaxis()->SetTitleOffset(2.0); hsignal_ref_1D->GetYaxis()->CenterTitle(); hsignal_ref_1D->SetAxisRange(1.5,10.5,"X"); hsignal_ref_1D->SetAxisRange(-0.00025,0.0019,"Y"); hsignal_ref_1D->SetYTitle("<cos(n#Delta#phi)>"); hsignal_ref_1D->Draw("PE"); hbackground_ref_1D->SetMarkerStyle(24); hbackground_ref_1D->Draw("PESAME"); TLegend* legend = new TLegend(0.5,0.75,0.9,0.9); legend->SetFillStyle(0); legend->SetTextFont(42); legend->AddEntry(hsignal_ref_1D,"Signal","P"); legend->AddEntry(hbackground_ref_1D,"Background","P"); legend->Draw("same"); ccc->cd(2); ccc->GetPad(2)->SetLeftMargin(0.3); hcorr_ref_1D->GetYaxis()->SetTitleOffset(2.0); hcorr_ref_1D->GetYaxis()->CenterTitle(); hcorr_ref_1D->SetAxisRange(1.5,10.5,"X"); hcorr_ref_1D->Draw("PE"); SaveCanvas(ccc,"HI/UCC",Form("sigbak_%s_centmin%d_centmax%d",tag.Data(),centmin,centmax)); */ for(int n=1;n<=hcorr_ref_1D->GetNbinsX();n++) { vn0[n] = merit[n-1]/total[n-1]; vn0err[n] = merit_err[n-1]/total[n-1]; } TFile* ffake = new TFile("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/efficiency/fake_hiGoodTightMerged_ucc_new.root"); TH1D* hfake = (TH1D*)ffake->Get("hFake"); // TFile* ffake1 = new TFile("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/efficiency/fake_hiGoodTight_ucc_new.root"); // TH1D* hfake1 = (TH1D*)ffake1->Get("hFake"); TFile* ffake1 = new TFile("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/efficiency/fake_hiGoodTightMerged_ucc_new.root"); TH1D* hfake1 = (TH1D*)ffake1->Get("hFake"); for(int n=1;n<=hcorr_ref_1D->GetNbinsX();n++) { cout<<"n="<<n<<endl; for(i=0;i<13;i++) { double x,y,xerr,yerr; gr[n-1]->GetPoint(i,x,y); xerr=gr[n-1]->GetErrorX(i); yerr=gr[n-1]->GetErrorY(i); if(n>=6 && i>10) continue; double fake = 0; if(x>1.0) fake = hfake1->GetBinContent(hfake1->FindBin(x)); if(x<1.0) fake = hfake->GetBinContent(hfake->FindBin(x)); double vn_corr = (y-fake*factor[n-1]*vn0[n])/(1-fake); gr_corr[n-1]->SetPoint(i,x,vn_corr); gr_corr[n-1]->SetPointError(i,0,yerr); cout<<x<<" "<<vn_corr<<" "<<yerr<<endl; double vn_corr_up = (y-fake*(factor[n-1]-factor_err[n-1])*vn0[n])/(1-fake)+y*0.02; double vn_corr_down = (y-fake*(factor[n-1]+factor_err[n-1])*vn0[n])/(1-fake)-y*0.02; // temporarily add additional systematics due to EP comparison /* if(n==2 && i==8) { vn_corr_up = (y-fake*(factor[n-1]-factor_err[n-1])*vn0[n])/(1-fake)+y*0.08; vn_corr_down = (y-fake*(factor[n-1]+factor_err[n-1])*vn0[n])/(1-fake)-y*0.08; } if(n==2 && i==9) { vn_corr_up = (y-fake*(factor[n-1]-factor_err[n-1])*vn0[n])/(1-fake)+y*0.10; vn_corr_down = (y-fake*(factor[n-1]+factor_err[n-1])*vn0[n])/(1-fake)-y*0.10; } if(n==2 && i==10) { vn_corr_up = (y-fake*(factor[n-1]-factor_err[n-1])*vn0[n])/(1-fake)+y*0.17; vn_corr_down = (y-fake*(factor[n-1]+factor_err[n-1])*vn0[n])/(1-fake)-y*0.17; } if(n==2 && i>10) { vn_corr_up = (y-fake*(factor[n-1]-factor_err[n-1])*vn0[n])/(1-fake)+y*0.17; vn_corr_down = (y-fake*(factor[n-1]+factor_err[n-1])*vn0[n])/(1-fake)-y*0.17; } if(n==3 && i>=8) { vn_corr_up = (y-fake*(factor[n-1]-factor_err[n-1])*vn0[n])/(1-fake)+y*0.04; vn_corr_down = (y-fake*(factor[n-1]+factor_err[n-1])*vn0[n])/(1-fake)-y*0.04; } if(n==5) { vn_corr_up = (y-fake*(factor[n-1]-factor_err[n-1])*vn0[n])/(1-fake)+y*0.04; vn_corr_down = (y-fake*(factor[n-1]+factor_err[n-1])*vn0[n])/(1-fake)-y*0.04; } if(n>5) { vn_corr_up = (y-fake*(factor[n-1]-factor_err[n-1])*vn0[n])/(1-fake)+y*0.08; vn_corr_down = (y-fake*(factor[n-1]+factor_err[n-1])*vn0[n])/(1-fake)-y*0.08; } */ if(n>=6) { gr_syst[n-1]->SetPoint(i,x,vn_corr_up); gr_syst[n-1]->SetPoint(21-i,x,vn_corr_down); } else { gr_syst[n-1]->SetPoint(i,x,vn_corr_up); gr_syst[n-1]->SetPoint(25-i,x,vn_corr_down); } gr_ratio[n-1]->SetPoint(i,x,vn_corr/y); gr_ratio[n-1]->SetPointError(i,0,0); // double integral = hpt[i]->Integral(); // if(i==0) integral = hpt[1]->Integral(); double integral = hptcorr->GetBinContent(hptcorr->FindBin(hpt[i]->GetMean()))*hptcorr->GetBinWidth(hptcorr->FindBin(hpt[i]->GetMean())); merit_corr[n-1] = merit_corr[n-1] + integral/1000.*vn_corr; merit_corr_up[n-1] = merit_corr_up[n-1] + integral/1000.*vn_corr_up; merit_corr_down[n-1] = merit_corr_down[n-1] + integral/1000.*vn_corr_down; merit_corr_err[n-1] = merit_corr_err[n-1] + integral/1000.*yerr; total_corr[n-1] = total_corr[n-1] + integral/1000.; } } for(int n=2;n<=15;n++) { vn0_corr[n] = merit_corr[n-1]/total_corr[n-1]; cout<<n<<" "<<vn0_corr[n]<<endl; vn0_corr_up[n] = merit_corr_up[n-1]/total_corr[n-1]; vn0_corr_down[n] = merit_corr_down[n-1]/total_corr[n-1]; vn0_corr_sys[n-2] = vn0_corr_up[n]; vn0_corr_sys[29-n] = vn0_corr_down[n]; if(n>=5) { vn0_corr_sys[n-2] = vn0_corr[n]+0.0004; vn0_corr_sys[29-n] = vn0_corr[n]-0.0004; } vn0err_corr[n] = merit_corr_err[n-1]/total_corr[n-1]; vn0_ratio[n] = vn0_corr[n]/vn0[n]; vn0err_ratio[n] = 0; } double vn_hydro_ideal[4] = {0.21,0.1875,0.1,0.0375}; double vn_hydro_004[4] = {0.195,0.167,0.08,0.025}; double vn_hydro_008[4] = {0.18,0.15,0.0625,0.0167}; double vn_hydro_012[4] = {0.167,0.14,0.05,0.0084}; double vn_hydro_016[4] = {0.15,0.128,0.04,0.001}; double etas[4] = {2,3,4,5}; for(int i=3;i>=0;i--) { vn_hydro_ideal[i] = vn_hydro_ideal[i]/vn_hydro_ideal[0]*vn0[2]; vn_hydro_004[i] = vn_hydro_004[i]/vn_hydro_004[0]*vn0[2]; vn_hydro_008[i] = vn_hydro_008[i]/vn_hydro_008[0]*vn0[2]; vn_hydro_012[i] = vn_hydro_012[i]/vn_hydro_012[0]*vn0[2]; vn_hydro_016[i] = vn_hydro_016[i]/vn_hydro_016[0]*vn0[2]; } TGraph* gr_ideal = new TGraph(4,etas,vn_hydro_ideal); TGraph* gr_004 = new TGraph(4,etas,vn_hydro_004); TGraph* gr_008 = new TGraph(4,etas,vn_hydro_008); TGraph* gr_012 = new TGraph(4,etas,vn_hydro_012); TGraph* gr_016 = new TGraph(4,etas,vn_hydro_016); gr_004->SetLineColor(kRed); gr_008->SetLineColor(kBlue); gr_012->SetLineColor(kGreen); gr_016->SetLineColor(6); gr_ideal->SetLineStyle(9); gr_ideal->SetLineWidth(2); gr_004->SetLineWidth(2); gr_008->SetLineWidth(2); gr_012->SetLineWidth(2); gr_016->SetLineWidth(2); double narray[15] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14}; double narray2[28] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15,15,14,13,12,11,10,9,8,7,6,5,4,3,2}; double narrayerr[15] = {0}; TGraphErrors* gr_vn0 = new TGraphErrors(15,narray,vn0,narrayerr,vn0err); gr_vn0->SetName("vnn"); TCanvas* c1 = new TCanvas("c1","",580,500); c1->SetLeftMargin(0.16); TH2D* htmp1 = new TH2D("htmp1",";n;v_{n}",100,0.5,7.9+5,100,0.00003-0.01,0.04); htmp1->GetXaxis()->CenterTitle(); htmp1->GetYaxis()->CenterTitle(); htmp1->GetXaxis()->SetLabelSize(0.8*htmp1->GetXaxis()->GetLabelSize()); htmp1->GetYaxis()->SetLabelSize(0.8*htmp1->GetYaxis()->GetLabelSize()); htmp1->GetYaxis()->SetTitleOffset(0.96*htmp1->GetYaxis()->GetTitleOffset()); htmp1->GetXaxis()->SetTitleOffset(1.02*htmp1->GetXaxis()->GetTitleOffset()); htmp1->GetYaxis()->SetTitleSize(1.1*htmp1->GetYaxis()->GetTitleSize()); htmp1->GetXaxis()->SetTitleSize(0.9*htmp1->GetXaxis()->GetTitleSize()); // c1->SetLogy(); htmp1->Draw(""); gr_vn0->Draw("PESAME"); gr_ideal->Draw("LSAME"); gr_004->Draw("LSAME"); gr_008->Draw("LSAME"); gr_012->Draw("LSAME"); gr_016->Draw("LSAME"); TLine* line1 = new TLine(0.5,0.0,7.9+5,0.0); line1->SetLineStyle(9); line1->Draw("lsame"); TLatex* latex1 = new TLatex(); latex1->SetNDC(1); latex1->SetTextSize(latex1->GetTextSize()*1.0); latex1->DrawLatex(0.65,0.87,"CMS Preliminary"); latex1->DrawLatex(0.65,0.80,"PbPb #sqrt{s_{NN}} = 2.76 TeV"); latex1->DrawLatex(0.65,0.74,centtag.Data()); latex1->DrawLatex(0.25,0.34,"0.3<p_{T}<3 GeV/c"); TLegend* legend = new TLegend(0.2,0.45,0.45,0.7); legend->SetFillStyle(0); legend->SetTextFont(42); legend->AddEntry(gr_ideal,"Ideal Hydro","L"); legend->AddEntry(gr_004,"#eta/s=0.04","L"); legend->AddEntry(gr_008,"#eta/s=0.08","L"); legend->AddEntry(gr_012,"#eta/s=0.12","L"); legend->AddEntry(gr_016,"#eta/s=0.16","L"); // legend->Draw("same"); SaveCanvas(c1,"HI/UCC",Form("vnn_%s_centmin%d_centmax%d",tag.Data(),centmin,centmax)); TGraphErrors* gr_corr_vn0 = new TGraphErrors(15,narray,vn0_corr,narrayerr,vn0err_corr); gr_corr_vn0->SetName("vnn_corr"); TGraph* gr_corr_vn0_sys = new TGraph(28,narray2,vn0_corr_sys); gr_corr_vn0_sys->SetName("vnn_corr_sys"); TCanvas* c1_corr = new TCanvas("c1_corr","",580,500); c1_corr->SetLeftMargin(0.16); htmp1->Draw(""); gr_corr_vn0_sys->SetFillColor(17); gr_corr_vn0_sys->Draw("Fsame"); gr_corr_vn0->Draw("PESAME"); gr_ideal->Draw("LSAME"); gr_004->Draw("LSAME"); gr_008->Draw("LSAME"); gr_012->Draw("LSAME"); gr_016->Draw("LSAME"); line1->Draw("lsame"); latex1->Draw("same"); // legend->Draw("same"); SaveCanvas(c1_corr,"HI/UCC",Form("vnn_%s_centmin%d_centmax%d_corr",tag.Data(),centmin,centmax)); TGraphErrors* gr_ratio_vn0 = new TGraphErrors(15,narray,vn0_ratio,narrayerr,vn0err_ratio); gr_ratio_vn0->SetName("vnn_ratio"); TCanvas* c1_ratio = new TCanvas("c1_ratio","",580,500); c1_ratio->SetLeftMargin(0.16); TH2D* htmp1_ratio = new TH2D("htmp1_ratio",";n;v_{n}",100,0.5,7.9+5,100,0.5,1.5); htmp1_ratio->GetXaxis()->CenterTitle(); htmp1_ratio->GetYaxis()->CenterTitle(); htmp1_ratio->GetXaxis()->SetLabelSize(0.8*htmp1_ratio->GetXaxis()->GetLabelSize()); htmp1_ratio->GetYaxis()->SetLabelSize(0.8*htmp1_ratio->GetYaxis()->GetLabelSize()); htmp1_ratio->GetYaxis()->SetTitleOffset(0.96*htmp1_ratio->GetYaxis()->GetTitleOffset()); htmp1_ratio->GetXaxis()->SetTitleOffset(1.02*htmp1_ratio->GetXaxis()->GetTitleOffset()); htmp1_ratio->GetYaxis()->SetTitleSize(1.1*htmp1_ratio->GetYaxis()->GetTitleSize()); htmp1_ratio->GetXaxis()->SetTitleSize(0.9*htmp1_ratio->GetXaxis()->GetTitleSize()); // c1->SetLogy(); htmp1_ratio->Draw(""); gr_ratio_vn0->Draw("PESAME"); latex1->Draw("same"); TLine* line1_ratio = new TLine(0.5,1.0,7.9+5,1.0); line1_ratio->SetLineStyle(9); line1_ratio->Draw("lsame"); SaveCanvas(c1_ratio,"HI/UCC",Form("vnn_%s_centmin%d_centmax%d_ratio",tag.Data(),centmin,centmax)); TCanvas* c2 = new TCanvas("c2","",580,500); c2->SetLeftMargin(0.18); TH2D* htmp = new TH2D("htmp",";p_{T}(GeV/c);v_{n}{2part, |#Delta#eta| > 2}",100,-0.001,7.3,100,-0.005,0.099); htmp->GetXaxis()->CenterTitle(); htmp->GetYaxis()->CenterTitle(); htmp->GetXaxis()->SetLabelSize(htmp->GetXaxis()->GetLabelSize()); htmp->GetYaxis()->SetLabelSize(htmp->GetYaxis()->GetLabelSize()); htmp->GetYaxis()->SetTitleOffset(0.8*htmp->GetYaxis()->GetTitleOffset()); htmp->GetXaxis()->SetTitleOffset(0.7*htmp->GetXaxis()->GetTitleOffset()); htmp->GetYaxis()->SetTitleSize(1.5*htmp->GetYaxis()->GetTitleSize()); htmp->GetXaxis()->SetTitleSize(1.4*htmp->GetXaxis()->GetTitleSize()); htmp->Draw(); TLine* line = new TLine(0.001,0,7.3,0.0); line->SetLineStyle(9); line->Draw("lsame"); // gr[0]->SetMarkerColor(6); gr[1]->SetMarkerColor(1); gr[2]->SetMarkerColor(2); gr[3]->SetMarkerColor(3); gr[4]->SetMarkerColor(4); gr[5]->SetMarkerColor(6); gr[1]->SetMarkerStyle(20); gr[2]->SetMarkerStyle(22); gr[3]->SetMarkerStyle(21); gr[4]->SetMarkerStyle(29); gr[5]->SetMarkerStyle(3); gr[2]->SetMarkerSize(1.1*gr[2]->GetMarkerSize()); gr[3]->SetMarkerSize(0.8*gr[3]->GetMarkerSize()); gr[4]->SetMarkerSize(1.3*gr[4]->GetMarkerSize()); gr[5]->SetMarkerSize(1.3*gr[5]->GetMarkerSize()); gr[1]->Draw("PESAME"); gr[2]->Draw("PESAME"); gr[3]->Draw("PESAME"); gr[4]->Draw("PESAME"); gr[5]->Draw("PESAME"); TLegend* legend = new TLegend(0.18,0.6,0.47,0.9); legend->SetFillStyle(0); legend->SetTextFont(42); legend->AddEntry(gr[1],"n = 2","P"); legend->AddEntry(gr[2],"n = 3","P"); legend->AddEntry(gr[3],"n = 4","P"); legend->AddEntry(gr[4],"n = 5","P"); legend->AddEntry(gr[5],"n = 6","P"); legend->Draw("same"); TLatex* latex = new TLatex(); latex->SetNDC(1); latex->SetTextSize(latex->GetTextSize()*1.0); latex->DrawLatex(0.66,0.86,"CMS Preliminary"); latex->DrawLatex(0.64,0.80,"PbPb #sqrt{s_{NN}} = 2.76 TeV"); latex->DrawLatex(0.66,0.74,centtag.Data()); SaveCanvas(c2,"HI/UCC",Form("vn_pt_%s_centmin%d_centmax%d",tag.Data(),centmin,centmax)); TCanvas* c2_corr = new TCanvas("c2corr","",600,500); c2_corr->SetBottomMargin(0.12); c2_corr->SetLeftMargin(0.15); htmp->Draw(); line->Draw("lsame"); gr_corr[1]->SetMarkerColor(1); gr_corr[2]->SetMarkerColor(2); gr_corr[3]->SetMarkerColor(3); gr_corr[4]->SetMarkerColor(4); gr_corr[5]->SetMarkerColor(6); gr_corr[1]->SetMarkerStyle(20); gr_corr[2]->SetMarkerStyle(22); gr_corr[3]->SetMarkerStyle(21); gr_corr[4]->SetMarkerStyle(29); gr_corr[5]->SetMarkerStyle(3); gr_corr[2]->SetMarkerSize(1.3*gr_corr[2]->GetMarkerSize()); gr_corr[3]->SetMarkerSize(1.0*gr_corr[3]->GetMarkerSize()); gr_corr[4]->SetMarkerSize(1.5*gr_corr[4]->GetMarkerSize()); gr_corr[5]->SetMarkerSize(1.3*gr_corr[5]->GetMarkerSize()); gr_syst[1]->Draw("FSAME"); gr_syst[2]->Draw("FSAME"); gr_syst[3]->Draw("FSAME"); gr_syst[4]->Draw("FSAME"); gr_syst[5]->Draw("FSAME"); gr_corr[1]->Draw("PESAME"); gr_corr[2]->Draw("PESAME"); gr_corr[3]->Draw("PESAME"); gr_corr[4]->Draw("PESAME"); gr_corr[5]->Draw("PESAME"); legend->Draw("same"); TLatex* latex_corr = new TLatex(); latex_corr->SetNDC(1); latex_corr->SetTextSize(latex_corr->GetTextSize()*0.8); // latex_corr->DrawLatex(0.63,0.88,"CMS Preliminary"); latex_corr->DrawLatex(0.54,0.875,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); latex_corr->DrawLatex(0.68,0.815,centtag.Data()); latex_corr->DrawLatex(0.68,0.755,"1 < p_{T}^{ref} < 3 GeV/c"); SaveCanvas(c2_corr,"HI/UCC",Form("vn_pt_%s_centmin%d_centmax%d_corr",tag.Data(),centmin,centmax)); TCanvas* c2_ratio = new TCanvas("c2_ratio","",580,500); c2_ratio->SetLeftMargin(0.16); TH2D* htmp_ratio = new TH2D("htmp_ratio",";p_{T}(GeV/c);v^{corr}_{n}/v^{raw}_{n}",100,0.001,7.3,100,0.5,1.5); htmp_ratio->GetXaxis()->CenterTitle(); htmp_ratio->GetYaxis()->CenterTitle(); htmp_ratio->GetXaxis()->SetLabelSize(0.8*htmp_ratio->GetXaxis()->GetLabelSize()); htmp_ratio->GetYaxis()->SetLabelSize(0.8*htmp_ratio->GetYaxis()->GetLabelSize()); htmp_ratio->GetYaxis()->SetTitleOffset(0.98*htmp_ratio->GetYaxis()->GetTitleOffset()); htmp_ratio->GetXaxis()->SetTitleOffset(1.02*htmp_ratio->GetXaxis()->GetTitleOffset()); htmp_ratio->GetYaxis()->SetTitleSize(1.1*htmp_ratio->GetYaxis()->GetTitleSize()); htmp_ratio->GetXaxis()->SetTitleSize(0.9*htmp_ratio->GetXaxis()->GetTitleSize()); htmp_ratio->Draw(); TLine* line_ratio = new TLine(0.001,1.0,7.3,1.0); line_ratio->SetLineStyle(9); line_ratio->Draw("lsame"); gr_ratio[1]->SetMarkerColor(1); gr_ratio[2]->SetMarkerColor(2); gr_ratio[3]->SetMarkerColor(3); gr_ratio[4]->SetMarkerColor(4); gr_ratio[5]->SetMarkerColor(6); gr_ratio[1]->SetMarkerStyle(20); gr_ratio[2]->SetMarkerStyle(22); gr_ratio[3]->SetMarkerStyle(21); gr_ratio[4]->SetMarkerStyle(29); gr_ratio[5]->SetMarkerStyle(3); gr_ratio[2]->SetMarkerSize(1.1*gr_ratio[2]->GetMarkerSize()); gr_ratio[3]->SetMarkerSize(0.8*gr_ratio[3]->GetMarkerSize()); gr_ratio[4]->SetMarkerSize(1.3*gr_ratio[4]->GetMarkerSize()); gr_ratio[5]->SetMarkerSize(1.3*gr_ratio[5]->GetMarkerSize()); gr_ratio[1]->Draw("PESAME"); gr_ratio[2]->Draw("PESAME"); gr_ratio[3]->Draw("PESAME"); gr_ratio[4]->Draw("PESAME"); gr_ratio[5]->Draw("PESAME"); legend->Draw("same"); TLatex* latex_ratio = new TLatex(); latex_ratio->SetNDC(1); latex_ratio->SetTextSize(latex_ratio->GetTextSize()*1.0); latex_ratio->DrawLatex(0.65,0.87,"CMS Preliminary"); latex_ratio->DrawLatex(0.65,0.80,"PbPb #sqrt{s_{NN}} = 2.76 TeV"); latex_ratio->DrawLatex(0.65,0.74,centtag.Data()); SaveCanvas(c2_ratio,"HI/UCC",Form("vn_pt_%s_centmin%d_centmax%d_ratio",tag.Data(),centmin,centmax)); // gr[0]->Draw("PESAME"); /* c2->Print("/net/hisrv0001/home/davidlw/scratch1/UCCPileUp/pics/vnpt_data_UCC020.gif"); c2->Print("/net/hisrv0001/home/davidlw/scratch1/UCCPileUp/pics/vnpt_data_UCC020.pdf"); c2->Print("/net/hisrv0001/home/davidlw/scratch1/UCCPileUp/pics/vnpt_data_UCC020.eps"); c2->Print("/net/hisrv0001/home/davidlw/scratch1/UCCPileUp/pics/vnpt_data_UCC020.C"); */ /* TCanvas* c0 = new TCanvas("c0","",500,500); hsignal_1D[3]->Draw("PE"); hbackground_1D[3]->SetMarkerStyle(24); hbackground_1D[3]->Draw("PESAME"); TCanvas* c = new TCanvas("c","",500,500); hcorr_1D[3]->SetAxisRange(-0.001,0.006,"Y"); hcorr_1D[3]->SetMarkerColor(1); hcorr_1D[3]->Draw("PE"); */ return; TFile* fout = new TFile(Form("gr_%s_centmin%d_centmax%d.root",tag.Data(),centmin,centmax),"recreate"); gr_vn0->SetName("vnn"); gr_vn0->Write(); gr_corr_vn0->SetName("vnn_corr"); gr_corr_vn0->Write(); gr_corr_vn0_sys->SetName("vnn_corr_sys"); gr_corr_vn0_sys->Write(); gr_ratio_vn0->SetName("vnn_ratio"); gr_ratio_vn0->Write(); for(int i=0;i<6;i++) { gr[i]->SetName(Form("v%dpt",i+1)); gr[i]->Write(); gr_corr[i]->SetName(Form("v%dpt_corr",i+1)); gr_corr[i]->Write(); gr_ratio[i]->SetName(Form("v%dpt_ratio",i+1)); gr_ratio[i]->Write(); gr_syst[i]->SetName(Form("v%dpt_syst",i+1)); gr_syst[i]->Write(); } }
// ______________________________________________________________________________________ void plotEnergyKaon(const Char_t* name = "ratioNetKaonVsEnergy") { Int_t idxNames = kNetK; gROOT->LoadMacro("include/toolsEnergyNice.C++"); gROOT->LoadMacro("include/getPublished.C++"); SetupStyle(); SetGlobals(); getPublished(); // ----------------------------------------------------- TFile *inFiles[nEnergies][nMoments]; TFile *inFilesUrqmd[nEnergies]; TGraphErrors *inGraphsStat[nEnergies][nMoments+1]; TGraphErrors *inGraphsPoisson[nEnergies][nMoments]; TGraphErrors *inGraphsUrqmd[nEnergies][nMoments]; for (int idxEnergy = 0; idxEnergy < nEnergies; ++idxEnergy) { if (idxEnergy != 2) inFilesUrqmd[idxEnergy]= TFile::Open(Form("URQMD/urqmd_kaon/AuAu%sGeV_Vz30_kpi1.root", exactEnergies[idxEnergy])); for (int idxMoment = 0; idxMoment < nMoments; ++idxMoment) { // -- value and stat errors inFiles[idxEnergy][idxMoment] = TFile::Open(Form("%s/%sGeV/moments_ana/Moments_%s.root", aNames[idxNames], exactEnergies[idxEnergy], aMoments[idxMoment])); inGraphsStat[idxEnergy][idxMoment] = (idxMoment != 5) ? static_cast<TGraphErrors*>((inFiles[idxEnergy][idxMoment]->Get(aMoments[idxMoment]))->Clone()) : static_cast<TGraphErrors*>((inFiles[idxEnergy][idxMoment]->Get(Form("%s_Poisson_ratio", aMoments[idxMoment])))->Clone()); if (idxMoment == 5) // get SK also inGraphsStat[idxEnergy][nMoments] = static_cast<TGraphErrors*>((inFiles[idxEnergy][idxMoment]->Get(aMoments[idxMoment]))->Clone()); // -- poisson inGraphsPoisson[idxEnergy][idxMoment] = static_cast<TGraphErrors*>((inFiles[idxEnergy][idxMoment]->Get(Form("%s_Poisson_base", aMoments[idxMoment])))->Clone()); if (inFiles[idxEnergy][idxMoment]) inFiles[idxEnergy][idxMoment]->Close(); // -- urqmd if (idxEnergy != 2) { if (idxMoment == 4) inGraphsUrqmd[idxEnergy][idxMoment] = static_cast<TGraphErrors*>((inFilesUrqmd[idxEnergy]->Get(Form("R21")))->Clone()); else if (idxMoment == 5) inGraphsUrqmd[idxEnergy][idxMoment] = static_cast<TGraphErrors*>((inFilesUrqmd[idxEnergy]->Get(Form("%s_Pos_ratio", aMoments[idxMoment])))->Clone()); else if (idxMoment == 6) inGraphsUrqmd[idxEnergy][idxMoment] = static_cast<TGraphErrors*>((inFilesUrqmd[idxEnergy]->Get(aMoments[idxMoment]))->Clone()); } } } // ----------------------------------------------------- // -- Make graphs for (int idxEnergy = 0; idxEnergy < nEnergies; ++idxEnergy) { for (int idxMoment = 4; idxMoment < nMoments+1; ++idxMoment) { for (int idxCent = 0; idxCent < nCent; ++idxCent) { if (idxCent != 0 && idxCent != 8) continue; Double_t xIn, yIn; inGraphsStat[idxEnergy][idxMoment]->GetPoint(idxCent, xIn, yIn); Double_t yErrorStatIn = inGraphsStat[idxEnergy][idxMoment]->GetErrorY(idxCent); Int_t accessCent = (idxCent == 0) ? 0 : 1; Int_t accessMoment = idxMoment - 4; Double_t yErrorSysIn = sysErrors[accessMoment][accessCent][idxEnergy]; for (Int_t idx = 0; idx < 2; ++idx) { Double_t xBin = (idx == 0) ? snn[idxEnergy] : mub[idxEnergy]; graphStat[idx][idxMoment][idxCent]->SetPoint(idxEnergy, xBin, yIn); graphStat[idx][idxMoment][idxCent]->SetPointError(idxEnergy, 0, yErrorStatIn); graphSys[idx][idxMoment][idxCent]->SetPoint(idxEnergy, xBin, yIn); graphSys[idx][idxMoment][idxCent]->SetPointError(idxEnergy, 0, yErrorSysIn); } if (idxMoment == nMoments) continue; inGraphsPoisson[idxEnergy][idxMoment]->GetPoint(idxCent, xIn, yIn); for (Int_t idx = 0; idx < 2; ++idx) { Double_t xBin = (idx == 0) ? snn[idxEnergy] : mub[idxEnergy]; graphPoisson[idx][idxMoment][idxCent]->SetPoint(idxEnergy, xBin, yIn); } if (idxCent == 0 && idxEnergy != 2) { Double_t yErrorUrqmdIn = inGraphsUrqmd[idxEnergy][idxMoment]->GetErrorY(idxCent); inGraphsUrqmd[idxEnergy][idxMoment]->GetPoint(idxCent, xIn, yIn); for (Int_t idx = 0; idx < 2; ++idx) { Double_t xBin = (idx == 0) ? snn[idxEnergy] : mub[idxEnergy]; Int_t energyArrayAccess = (idxEnergy >= 2) ? idxEnergy-1 : idxEnergy; graphUrqmd[idx][idxMoment][idxCent]->SetPoint(energyArrayAccess, xBin, yIn); graphUrqmd[idx][idxMoment][idxCent]->SetPointError(energyArrayAccess, 0, yErrorUrqmdIn); } } } // for (int idxCent = 0; idxCent < nCent; ++idxCent) { } // for (int idxMoment = 0 ; idxMoment < nMoments; ++idxMoment) { } // for (int idxEnergy = 0 ; idxEnergy < nEnergies; ++idxEnergy) { // ----------------------------------------------------- SetupCanvas(name, Form("%s Ratio energy dependence", aNames[idxNames])); CreateLegends(2, 3, 0.4, 0.09); // ----------------------------------------------------- for (int idxMoment = 4; idxMoment < nMoments; ++idxMoment) { pad->cd(idxMoment-3); gPad->SetLogx(); for (int idxCent = 0; idxCent < nCent; ++idxCent) { if (idxCent != 0 && idxCent != 8) continue; DrawSet(graphStat[0][idxMoment][idxCent], graphSys[0][idxMoment][idxCent], graphUrqmd[0][idxMoment][idxCent], graphPoisson[0][idxMoment][idxCent], idxMoment, idxCent); } // for (int idxCent = 0; idxCent < nCent; ++idxCent) { graphStat[0][idxMoment][0]->Draw("ZP,SAME"); graphSys[0][idxMoment][0]->Draw("[],SAME"); } // for (int idxMoment = 4; idxMoment < nMoments; ++idxMoment) { legTheo->AddEntry(graphUrqmd[0][4][0], Form("%s UrQMD", cent1[0]), "f"); // ----------------------------------------------------- LabelCanvas(aNames[idxNames], aNamesPt[idxNames]); SaveCanvas(name); // ----------------------------------------------------- TFile *fOut = TFile::Open("STAR_QM2015_Preliminary.root", "UPDATE"); fOut->cd(); TList* list = new TList; for (int idxMoment = 4; idxMoment < nMoments+1; ++idxMoment) { for (int idxCent = 0; idxCent < nCent; ++idxCent) { if (idxCent != 0) continue; graphStat[0][idxMoment][idxCent]->SetName(Form("%s_%s_sNN_%s_stat", aNames[idxNames], aMoments2[idxMoment], cent[idxCent])); graphSys[0][idxMoment][idxCent]->SetName(Form("%s_%s_sNN_%s_sys", aNames[idxNames], aMoments2[idxMoment], cent[idxCent])); list->Add(graphStat[0][idxMoment][idxCent]); list->Add(graphSys[0][idxMoment][idxCent]); } } list->Write(aNames[idxNames], TObject::kSingleKey); fOut->Close(); // ----------------------------------------------------- TFile *fOutAll = TFile::Open("STAR_Preliminary.root", "UPDATE"); fOutAll->cd(); TList* listAll = new TList; for (int idxMoment = 4; idxMoment < nMoments+1; ++idxMoment) { for (int idxCent = 0; idxCent < nCent; ++idxCent) { if (graphStat[0][idxMoment][idxCent] && graphStat[0][idxMoment][idxCent]->GetN() > 0) { graphStat[0][idxMoment][idxCent]->SetName(Form("%s_%s_sNN_%s_stat", aNames[idxNames], aMoments2[idxMoment], cent[idxCent])); listAll->Add(graphStat[0][idxMoment][idxCent]); } if (graphSys[0][idxMoment][idxCent] && graphSys[0][idxMoment][idxCent]->GetN() > 0) { graphSys[0][idxMoment][idxCent]->SetName(Form("%s_%s_sNN_%s_sys", aNames[idxNames], aMoments2[idxMoment], cent[idxCent])); listAll->Add(graphSys[0][idxMoment][idxCent]); } if (idxMoment == nMoments) continue; if (graphUrqmd[0][idxMoment][idxCent] && graphUrqmd[0][idxMoment][idxCent]->GetN() > 0) { graphUrqmd[0][idxMoment][idxCent]->SetName(Form("%s_%s_sNN_%s_urqmd", aNames[idxNames], aMoments2[idxMoment], cent[idxCent])); listAll->Add(graphUrqmd[0][idxMoment][idxCent]); } if (graphPoisson[0][idxMoment][idxCent] && graphPoisson[0][idxMoment][idxCent]->GetN() > 0) { graphPoisson[0][idxMoment][idxCent]->SetName(Form("%s_%s_sNN_%s_poisson", aNames[idxNames], aMoments2[idxMoment], cent[idxCent])); listAll->Add(graphPoisson[0][idxMoment][idxCent]); } } } listAll->Write(aNames[idxNames], TObject::kSingleKey); fOutAll->Close(); }
void getXsecExtended(const TString mc_input, int debugMode=0, bool useFEWZ=true, int fineGrid=0) { // check whether it is a calculation if (mc_input.Contains("_DebugRun_")) { std::cout << "getXsec: _DebugRun_ detected. Terminating the script\n"; return; } if (debugMode==1) std::cout << "\n\n\tDEBUG MODE is ON\n\n"; if (debugMode==-1) std::cout << "\n\n\tPLOT ONLY MODE is ON\n\n"; std::cout << "DYTools::analysisTag=" << DYTools::analysisTag << "\n"; if (DYTools::study2D && fineGrid) { std::cout << "fineGrid=1 is allowed only for study2D=0\n"; return; } // normal calculation gBenchmark->Start("getXsec"); //-------------------------------------------------------------------------------------------------------------- // Settings //============================================================================================================== //Bool_t doSave = false; // save plots? TString format = "png"; // output file format MCInputFileMgr_t inpMgr; TString fineGridStr; if (fineGrid==1) fineGridStr="fineGrid_"; else if (fineGrid==2) fineGridStr="summer2011Grid_"; else if (fineGrid==3) fineGridStr="summer2011specGrid_"; Double_t massLow = DYTools::massBinLimits[0]; Double_t massHigh = DYTools::massBinLimits[DYTools::nMassBins]; // fine grid: 0, 1, 2, ..., (fineGrid_1GeVstop-1), fineGrid_1GeVstop, fineGrid_1GeVstop+fineGridLargerStep, fineGrid_1GeVstop+2*fineGridLargerStep, ..., 1500 // double fineGrid_1GeVstop=200.; double fineGrid_LargerStep=20.; int locMassBinCount=DYTools::nMassBins; double *massRangeEdges=NULL; if (!fineGrid) { massRangeEdges=new double[locMassBinCount+1]; for (int i=0; i<=DYTools::nMassBins; ++i) { massRangeEdges[i]=DYTools::massBinLimits[i]; } } else if (fineGrid==1) { // 1GeV grid locMassBinCount=int(fineGrid_1GeVstop-massLow+1e-3); std::cout << "1GeV grid size=" << locMassBinCount << "\n"; // fineGrid_LargerStep double upperRange= (massHigh-fineGrid_1GeVstop); double upperCount= upperRange/fineGrid_LargerStep + 1e-3; if (upperCount - trunc(upperCount) > 1e-3) { std::cout << "(upperCount -1e-3)=" << (upperCount -1e-3) << "\n"; std::cout << "should be integer value\n"; return; } locMassBinCount += int(upperCount); std::cout << "mass grid[" << locMassBinCount << "]\n"; massRangeEdges=new double[locMassBinCount+1]; double m=massLow, dm=1; int count=0; while (m<=massHigh) { massRangeEdges[count]=m; if (1) { if (m<massHigh) std::cout << "count=" << count << ", massRange=" << m << " .. " << (m+dm) << "\n"; else std::cout << "last edge=" << m << "\n"; } count++; m+=dm; if (m==fineGrid_1GeVstop) dm=fineGrid_LargerStep; } } else if (fineGrid==2) { const int nMassBinTh=518; Double_t mxl = 14.0; locMassBinCount=nMassBinTh; massRangeEdges=new double[nMassBinTh+1]; for(int iTh=0; iTh<=nMassBinTh; iTh++){ // mass limits if ( iTh >= 0 && iTh < 11 ) {mxl += 1.0;} else if( iTh >= 11 && iTh < 18 ) {mxl += 5.0;} else if( iTh >= 18 && iTh < 118 ) {mxl += 1.0;} else if( iTh >= 118 && iTh < 340 ) {mxl += 2.0;} else if( iTh >= 340 && iTh < nMassBinTh) {mxl += 5.0; } else if( iTh == nMassBinTh) {mxl = 1500; } massRangeEdges[iTh]=mxl; } } else if (fineGrid==3) { const int nMassBinTh=518; Double_t mxl = 14.0; locMassBinCount=nMassBinTh; massRangeEdges=new double[nMassBinTh+1]; int iTh_new=0, tmpCounter=0; for(int iTh=0; iTh<=nMassBinTh; iTh++, iTh_new++){ // mass limits if ( iTh >= 0 && iTh < 11 ) {mxl += 1.0;} else if( iTh >= 11 && iTh < 18 ) {mxl += 5.0;} else if( iTh >= 18 && iTh < 118 ) {mxl += 1.0;} else if( iTh >= 118 && iTh < 340 ) { if (iTh>=139) { std::cout << "iTh=" << iTh << ", current mxl=" << mxl << " +2\n"; if (iTh==139) tmpCounter=10; tmpCounter--; if (tmpCounter>0) iTh_new--; else if (tmpCounter==0) { tmpCounter=10; std::cout << "iTh=" << iTh << ", iTh_new=" << iTh_new << ", current mxl=" << mxl << " +10\n"; } } mxl += 2.0; } else if( iTh >= 340 && iTh < nMassBinTh) { std::cout << "iTh=" << iTh << ", current mxl=" << mxl << " +5\n"; if (iTh<342) iTh_new--; else { if ((iTh-342)%4>0) iTh_new--; else std::cout << "iTh=" << iTh << ", iTh_new=" << iTh_new << ", current mxl=" << mxl << " +10\n"; } mxl += 5.0; } else if( iTh == nMassBinTh) {mxl = 1500; } massRangeEdges[iTh_new]=mxl; } massRangeEdges[iTh_new-2]=1500.; std::cout << "iTh_new=" << iTh_new << "\n"; locMassBinCount=iTh_new-2; } TVectorD massGrid(locMassBinCount+1); for (int i=0; i<=locMassBinCount; ++i) massGrid[i]=massRangeEdges[i]; TH1F hMassIdx("h_massIdx","h_massIdx",locMassBinCount-1,massRangeEdges); //delete massRangeEdges; if (0) { printHisto(&hMassIdx); if (0) { for (int i=0; i<int(massHigh); ++i) { double m=i+0.5; std::cout << "i=" << i << ", m=" << m << ", idx=" << (hMassIdx.FindBin(m)-1) << "\n"; } } return; } //std::cout << "massHigh=" << massHigh << "\n"; //std::cout << "locMassBinCount=" << locMassBinCount << "\n"; if (!inpMgr.Load(mc_input)) { return; } //-------------------------------------------------------------------------------------------------------------- // Main code //============================================================================================================== // // Set up histograms // //vector<TH1D*> hZMassv; Double_t nZv = 0; TMatrixD nEvents (locMassBinCount,DYTools::nYBinsMax); // number of weigthed events TMatrixD nEventsDET (locMassBinCount,DYTools::nYBinsMax); // number of weighted events in the detector acceptance TMatrixD nEventsDETrecoPostIdx (locMassBinCount,DYTools::nYBinsMax); // number of weigthed events TMatrixD w2Events (locMassBinCount,DYTools::nYBinsMax); TMatrixD w2EventsDET (locMassBinCount,DYTools::nYBinsMax); TMatrixD w2EventsDETrecoPostIdx (locMassBinCount,DYTools::nYBinsMax); Double_t nZpeak=0, w2Zpeak=0; double nZpeakDET=0, w2ZpeakDET=0; double nZpeakDETrecoPostIdx=0, w2ZpeakDETrecoPostIdx=0; nEvents = 0; w2Events = 0; nEventsDET = 0; w2EventsDET = 0; nEventsDETrecoPostIdx = 0; w2EventsDETrecoPostIdx = 0; //char hname[100]; //for(UInt_t ifile = 0; ifile<fnamev.size(); ifile++) { // sprintf(hname,"hZMass_%i",ifile); hZMassv.push_back(new TH1F(hname,"",500,0,500)); hZMassv[ifile]->Sumw2(); //} // // Read weights from a file // const bool useFewzWeights = useFEWZ; const bool cutZPT100 = true; FEWZ_t fewz(useFewzWeights,cutZPT100); if (useFewzWeights && !fewz.isInitialized()) { std::cout << "failed to prepare FEWZ correction\n"; throw 2; } // // Access samples and fill histograms // TFile *infile=0; TTree *eventTree=0; // Data structures to store info from TTrees mithep::TGenInfo *gen = new mithep::TGenInfo(); // loop over samples double lumi0=0; if (debugMode!=-1) { for(UInt_t ifile=0; ifile<inpMgr.fileNames().size(); ifile++) { // Read input file cout << "Processing " << inpMgr.fileName(ifile) << "..." << endl; infile = new TFile(inpMgr.fileName(ifile)); assert(infile); // Get the TTrees eventTree = (TTree*)infile->Get("Events"); assert(eventTree); // Find weight for events for this file // The first file in the list comes with weight 1, // all subsequent ones are normalized to xsection and luminosity double lumi = eventTree->GetEntries()/inpMgr.xsec(ifile); if (ifile==0) lumi0=lumi; double scale = lumi0/lumi; std::cout << " -> sample weight is " << scale << endl; // Set branch address to structures that will store the info eventTree->SetBranchAddress("Gen",&gen); TBranch *genBr = eventTree->GetBranch("Gen"); // loop over events nZv += scale * eventTree->GetEntries(); for(UInt_t ientry=0; ientry<eventTree->GetEntries(); ientry++) { if (debugMode && (ientry>100000)) break; genBr->GetEntry(ientry); if (ientry%1000000==0) printProgress("ientry=",ientry,eventTree->GetEntriesFast()); double massPreFsr = gen->vmass; // pre-FSR double yPreFsr = gen->vy; // pre-FSR double massPostFsr = gen->mass; // post-FSR double yPostFsr = gen->y; // post-FSR if ((massPreFsr < massLow) || (massPreFsr > massHigh)) continue; if ((fabs(yPreFsr) < DYTools::yRangeMin) || (fabs(yPreFsr) > DYTools::yRangeMax)) continue; int ibinMassPreFsr=-1, ibinYPreFsr=-1; int ibinMassPostFsr=-1, ibinYPostFsr=-1; if (!fineGrid) { ibinMassPreFsr = DYTools::findMassBin(massPreFsr); ibinMassPostFsr= DYTools::findMassBin(massPostFsr); ibinYPreFsr = DYTools::findAbsYBin(ibinMassPreFsr, yPreFsr); ibinYPostFsr= DYTools::findAbsYBin(ibinMassPostFsr, yPostFsr); } else { ibinMassPreFsr=hMassIdx.FindBin(massPreFsr)-1; ibinMassPostFsr=hMassIdx.FindBin(massPostFsr)-1; ibinYPreFsr=0; ibinYPostFsr=0; //printf("massPreFsr=%8.4lf, idx=%3d; massPostFsr=%8.4lf, idx=%3d\n", massPreFsr,ibinMassPreFsr, massPostFsr,ibinMassPostFsr); } // We are only interested in the events, reconstructed with // good mass and rapidity if (ibinMassPreFsr==-1 || ibinMassPreFsr>=locMassBinCount || ibinYPreFsr==-1) { printf(".. skipping mass=%6.4lf, y=%6.4lf. ibinMass=%d, ibinY=%d\n",massPreFsr,yPreFsr,ibinMassPreFsr,ibinYPreFsr); continue; } // Find FEWZ-powheg reweighting factor // that depends on pre-FSR Z/gamma* rapidity, pt, and mass double fewz_weight = 1.0; if(useFewzWeights) { fewz_weight=fewz.getWeight(gen->vmass,gen->vpt,gen->vy); } //std::cout << "weight=scale*gen->weight*fewz: " << scale << " * " << gen->weight << " * " << fewz_weight << "\n"; double fullWeight = scale * gen->weight * fewz_weight; nEvents(ibinMassPreFsr,ibinYPreFsr) += fullWeight; w2Events(ibinMassPreFsr,ibinYPreFsr) += fullWeight*fullWeight; // Pre-FSR cross section if( DYTools::goodEtPair(gen->vpt_1, gen->vpt_2) && DYTools::goodEtaPair(gen->veta_1, gen->veta_2) ) { nEventsDET(ibinMassPreFsr,ibinYPreFsr) += fullWeight; w2EventsDET(ibinMassPreFsr,ibinYPreFsr) += fullWeight*fullWeight; } // Post-FSR cross section if( (ibinMassPostFsr!=-1) && (ibinYPostFsr!=-1) && DYTools::goodEtPair(gen->pt_1, gen->pt_2) && DYTools::goodEtaPair(gen->eta_1, gen->eta_2) ) { nEventsDETrecoPostIdx(ibinMassPostFsr,ibinYPostFsr) += fullWeight; w2EventsDETrecoPostIdx(ibinMassPostFsr,ibinYPostFsr) += fullWeight*fullWeight; } } delete infile; infile=0, eventTree=0; } delete gen; // Determine Z-peak event count for (int i=0; i<locMassBinCount; i++) { int isZpeak=0; // bin idx is (i+1) if ((hMassIdx.GetBinLowEdge(i+1)>=60-1e-3) && (hMassIdx.GetBinLowEdge(i+1+1)<=120+1e-3)) isZpeak=1; if (isZpeak) { int yiMax=(fineGrid) ? 1:DYTools::nYBins[i]; for (int yi=0; yi<yiMax; ++yi) { nZpeak += nEvents(i,yi); w2Zpeak += w2Events(i,yi); nZpeakDET += nEventsDET(i,yi); w2ZpeakDET += w2EventsDET(i,yi); nZpeakDETrecoPostIdx += nEventsDETrecoPostIdx(i,yi); w2ZpeakDETrecoPostIdx += w2EventsDETrecoPostIdx(i,yi); } } } std::cout << "\n"; std::cout << "nZpeak=" << nZpeak << ", w2Zpeak=" << w2Zpeak << "\n"; std::cout << "nZpeakDET=" << nZpeakDET << ", w2ZpeakDET=" << w2ZpeakDET << "\n"; std::cout << "nZpeakDETrecoPostIdx=" << nZpeakDETrecoPostIdx << ", w2ZpeakDETrecoPostIdx=" << w2ZpeakDETrecoPostIdx << "\n"; std::cout << "\n"; if (nZpeak==0) { std::cout << "no events in the Z-peak region\n"; return ; } } // if (debugMode!=-1) // Containers of the normalized event counts TMatrixD nEventsNorm (locMassBinCount,DYTools::nYBinsMax); // number of weigthed events, normalized to Z-peak TMatrixD nEventsDETNorm (locMassBinCount,DYTools::nYBinsMax); // number of weighted events in the detector acceptance, normalized to Z-peak TMatrixD nEventsDETrecoPostIdxNorm (locMassBinCount,DYTools::nYBinsMax); // number of weighted events in the detector acceptance, normalized to Z-peak TMatrixD nEventsNormErr (locMassBinCount,DYTools::nYBinsMax); TMatrixD nEventsDETNormErr (locMassBinCount,DYTools::nYBinsMax); TMatrixD nEventsDETrecoPostIdxNormErr (locMassBinCount,DYTools::nYBinsMax); TMatrixD nEventsErr (locMassBinCount,DYTools::nYBinsMax); TMatrixD nEventsDETErr (locMassBinCount,DYTools::nYBinsMax); TMatrixD nEventsDETrecoPostIdxErr (locMassBinCount,DYTools::nYBinsMax); nEventsNorm=0; nEventsDETNorm=0; nEventsDETrecoPostIdxNorm=0; nEventsNormErr=0; nEventsDETNormErr=0; nEventsDETrecoPostIdxNormErr=0; nEventsErr=0; nEventsDETErr=0; if (debugMode!=-1) { for(int i=0; i<locMassBinCount; i++) { int yiMax=(fineGrid) ? 1:DYTools::nYBins[i]; for (int j=0; j<yiMax; j++) { nEventsErr(i,j)=sqrt(w2Events(i,j)); nEventsDETErr(i,j)=sqrt(w2EventsDET(i,j)); nEventsDETrecoPostIdxErr(i,j)=sqrt(w2EventsDETrecoPostIdx(i,j)); nEventsNorm(i,j) = nEvents(i,j)/nZpeak; nEventsNormErr(i,j) = getErrorOnRatio(nEvents(i,j),nEventsErr(i,j), nZpeak, sqrt(w2Zpeak)); nEventsDETNorm(i,j) = nEventsDET(i,j)/nZpeakDET; nEventsDETNormErr(i,j) = getErrorOnRatio(nEventsDET(i,j),nEventsDETErr(i,j), nZpeakDET, sqrt(w2ZpeakDET)); nEventsDETrecoPostIdxNorm(i,j) = nEventsDETrecoPostIdx(i,j)/nZpeakDETrecoPostIdx; nEventsDETrecoPostIdxNormErr(i,j) = getErrorOnRatio(nEventsDETrecoPostIdx(i,j),nEventsDETrecoPostIdxErr(i,j), nZpeakDETrecoPostIdx, sqrt(w2ZpeakDETrecoPostIdx)); } } } TString outFile= TString("../root_files/xSecThExt_"); //outFile.Append("2MCfiles_"); if (!useFewzWeights) outFile.Append("noFEWZ_"); if (fineGridStr.Length()) outFile.Append(fineGridStr); if (debugMode==1) outFile.Append("debug_"); outFile.Append( DYTools::analysisTag + TString("_tmp.root") ); TVectorD rapidityGrid(massGrid.GetNoElements()-1); rapidityGrid=1; if (debugMode!=-1) { TFile thFile(outFile,"recreate"); massGrid.Write("massBinEdges"); if (fineGrid) rapidityGrid.Write("rapidityBinCount"); nEvents.Write("nGenEvents"); nEventsErr.Write("nGenEventsErr"); nEventsDET.Write("nGenEventsDET"); nEventsDETErr.Write("nGenEventsDETErr"); nEventsDETrecoPostIdx.Write("nGenEventsDETrecoPostIdx"); nEventsDETrecoPostIdxErr.Write("nGenEventsDETRecoPostIdxErr"); nEventsNorm.Write("nGenEventsNorm"); nEventsNormErr.Write("nGenEventsNormErr"); nEventsDETNorm.Write("nGenEventsDETNorm"); nEventsDETNormErr.Write("nGenEventsDETNormErr"); nEventsDETrecoPostIdxNorm.Write("nGenEventsDETrecoPostIdxNorm"); nEventsDETrecoPostIdxNormErr.Write("nGenEventsDETrecoPostIdxNormErr"); TVectorD zPeakInfo(6); zPeakInfo(0)=nZpeak; zPeakInfo(1)=sqrt(w2Zpeak); zPeakInfo(2)=nZpeakDET; zPeakInfo(3)=sqrt(w2ZpeakDET); zPeakInfo(4)=nZpeakDETrecoPostIdx; zPeakInfo(5)=sqrt(w2ZpeakDETrecoPostIdx); zPeakInfo.Write("zPeakCountAndErr"); thFile.Close(); std::cout << "file <" << outFile << "> created\n"; } else { TFile thFile(outFile); nEvents.Read("nGenEvents"); nEventsErr.Read("nGenEventsErr"); nEventsDET.Read("nGenEventsDET"); nEventsDETErr.Read("nGenEventsDETErr"); nEventsDETrecoPostIdx.Read("nGenEventsDETrecoPostIdx"); nEventsDETrecoPostIdxErr.Read("nGenEventsDETRecoPostIdxErr"); nEventsNorm.Read("nGenEventsNorm"); nEventsNormErr.Read("nGenEventsNormErr"); nEventsDETNorm.Read("nGenEventsDETNorm"); nEventsDETNormErr.Read("nGenEventsDETNormErr"); nEventsDETrecoPostIdxNorm.Read("nGenEventsDETrecoPostIdxNorm"); nEventsDETrecoPostIdxNormErr.Read("nGenEventsDETrecoPostIdxNormErr"); TVectorD zPeakInfo(6); zPeakInfo.Read("zPeakCountAndErr"); thFile.Close(); nZpeak=zPeakInfo[0]; w2Zpeak=SQR(zPeakInfo[1]); nZpeakDET=zPeakInfo[2]; w2ZpeakDET=SQR(zPeakInfo[3]); nZpeakDETrecoPostIdx=zPeakInfo[4]; w2ZpeakDETrecoPostIdx=SQR(zPeakInfo[5]); std::cout << "file <" << outFile << "> loaded\n"; } //-------------------------------------------------------------------------------------------------------------- // Make plots //============================================================================================================== CPlot::sOutDir="plots" + DYTools::analysisTag; TString fileNamePlots=outFile; fileNamePlots.ReplaceAll("_tmp.root","_plots_tmp.root"); TFile *filePlots=new TFile(fileNamePlots,"recreate"); if (!filePlots) { std::cout << "failed to create file <" << fileNamePlots << ">\n"; throw 2; } // string buffers //char ylabel[50]; // y-axis label if (DYTools::study2D) { TString c2Dname="canvXsectTh_2D"; if (useFewzWeights) c2Dname.Append("_FEWZ"); TCanvas *c2D = MakeCanvas(c2Dname,c2Dname,600,600+300*DYTools::study2D); std::vector<TH1F*> hXsecV; std::vector<CPlot*> cpV; hXsecV.reserve(DYTools::nMassBins); cpV.reserve(DYTools::nMassBins); for (int iM=0; iM<DYTools::nMassBins; ++iM) { double massMin=DYTools::massBinLimits[iM]; double massMax=DYTools::massBinLimits[iM+1]; CPlot *cp=new CPlot(Form("cpMass%2.0lf_%2.0lf",massMin,massMax), "","|Y|","counts"); cpV.push_back(cp); hXsecV.push_back( plotXsec2D("xsec",iM,nEvents,nEventsErr,cp,kBlack,1) ); } c2D->Divide(2,3); for (int ipad=1; ipad<=6; ++ipad) { cpV[ipad]->Draw(c2D,false,"png",ipad); } c2D->Update(); SaveCanvas(c2D,c2Dname); } { TString canvName=TString("canvXsectTh_") + fineGridStr + TString("1D"); if (useFewzWeights) canvName.Append("_FEWZ"); TCanvas *c1D = MakeCanvas(canvName,canvName,600,600); CPlot *cp=new CPlot("cplot_1D","","M_{ee} (GeV)","counts"); TH1F *hXsec= plotXsec1D("xsec1D",nEvents,nEventsErr,cp,kBlue, fineGrid); hXsec->SetDirectory(0); cp->SetLogx(); cp->Draw(c1D,false,"png"); c1D->Update(); SaveCanvas(c1D,canvName); } { TString canvName=TString("canvXsectThNorm_") + fineGridStr + TString("1D"); if (useFewzWeights) canvName.Append("_FEWZ"); TCanvas *c1D = MakeCanvas(canvName,canvName,600,600); CPlot *cp=new CPlot("cplotNorm_1D","","M_{ee} (GeV)","normalized counts"); TH1F *hXsec= plotXsec1D("xsec1D",nEventsNorm,nEventsNormErr,cp,kBlue, fineGrid); hXsec->SetDirectory(0); cp->SetLogx(); cp->Draw(c1D,false,"png"); c1D->Update(); SaveCanvas(c1D,canvName); } /* // Z mass sprintf(ylabel,"a.u. / %.1f GeV/c^{2}",hZMassv[0]->GetBinWidth(1)); CPlot plotZMass1("zmass1","","m(Z) [GeV/c^{2}]",ylabel); for(UInt_t i=0; i<fnamev.size(); i++) { plotZMass1.AddHist1D(hZMassv[i],labelv[i],"hist",colorv[i],linev[i]); } plotZMass1.SetLogy(); plotZMass1.Draw(c); SaveCanvas(c, "zmass1"); PlotMatrixVariousBinning(accv, "acceptance", "LEGO2",filePlots); filePlots->Close(); if (DYTools::study2D==0) Plot1D(accv,accErrv,"acceptance1D","acceptance"); //delete filePlots; */ //-------------------------------------------------------------------------------------------------------------- // Summary print out //============================================================================================================== if (!fineGrid) { const int printSystErr=0; TMatrixD zeroErr=nEventsErr; zeroErr=0; printYields("nGenEvents", nEvents,nEventsErr,zeroErr, printSystErr); printYields("nGenEventsDET", nEventsDET,nEventsDETErr,zeroErr, printSystErr); printYields("nGenEventsDETrecoPostIdx",nEventsDETrecoPostIdx,nEventsDETrecoPostIdxErr, zeroErr,printSystErr); } gBenchmark->Show("getXsec"); }
void Factorization_eta_mc() { const int nfiles = 24; TString filename[nfiles]; filename[0] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent020_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[1] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent2040_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[2] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent4060_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[3] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent020_pttrg033_ptassallweight_etaass34_pixel_eff0_v42.root"); filename[4] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent2040_pttrg033_ptassallweight_etaass34_pixel_eff0_v42.root"); filename[5] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent4060_pttrg033_ptassallweight_etaass34_pixel_eff0_v42.root"); filename[6] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent5060_pttrg053_ptassallweight_etaass45_eff0_v42.root"); filename[7] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent5060_pttrg053_ptassallweight_etaass45_eff0_v42.root"); // filename[8] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent020_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[8] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/epetadeco_gen_n2500_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[9] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/epetadeco_gen_n5001200_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[10] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/epetadeco_gen_n0160_pttrg033_ptassallweight_etaass445_eff0_v42.root"); /* filename[9] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent2040_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[10] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent4060_pttrg033_ptassallweight_etaass445_eff0_v42.root"); */ filename[11] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/epetadeco_gen_n2500_pttrg033_ptassallweight_etaass34_eff0_v42.root"); filename[12] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/epetadeco_gen_n5001200_pttrg033_ptassallweight_etaass34_eff0_v42.root"); filename[13] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/epetadeco_gen_n0160_pttrg033_ptassallweight_etaass34_eff0_v42.root"); /* filename[11] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent020_pttrg033_ptassallweight_etaass34_eff0_v42.root"); filename[12] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent2040_pttrg033_ptassallweight_etaass34_eff0_v42.root"); filename[13] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent4060_pttrg033_ptassallweight_etaass34_eff0_v42.root"); */ filename[14] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent5060_pttrg053_ptassallweight_etaass34_eff0_v42.root"); filename[15] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent5060_pttrg053_ptassallweight_etaass34_eff0_v42.root"); filename[16] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent020_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[17] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2040_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[18] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4060_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[19] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent020_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[20] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2040_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[21] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4060_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[22] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg033_ptassallweight_etaass34_eff0_v42.root"); filename[23] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg033_ptassallweight_etaass34_eff0_v42.root"); /* filename[8] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[9] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[10] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[11] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[12] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[13] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[14] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[15] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg053_ptassallweight_etaass45_eff0_v18.root"); */ const int ntrgbins = 16; const int ntrgbins1 = ntrgbins; const int ntrgbins2 = ntrgbins/2; TGraphErrors* gr[nfiles][6]; TGraphErrors* gr0[nfiles][6]; TGraphErrors* gr1[nfiles][6]; TGraphErrors* gr_ratio[nfiles][6]; TGraphErrors* gr_total[nfiles][6]; TGraph* gr_band[nfiles][6]; TGraph* gr1_band[nfiles][6]; TF1* fit[nfiles][6]; TF1* fit_aver[nfiles][6]; TF1* fit1_aver[nfiles][6]; double slope[6][nfiles]; double slope_err[6][nfiles]; double slope1[6][nfiles]; double slope1_err[6][nfiles]; // double eta[ntrgbins2] = {0.12,0.36,0.6,0.84,1.08,1.32,1.56,1.8,2.04,2.28}; // double eta[ntrgbins2] = {0.1,0.3,0.5,0.7,0.9,1.1,1.3,1.5,1.7,1.9,2.1,2.3}; double eta[ntrgbins2] = {0.15,0.45,0.75,1.05,1.35,1.65,1.95,2.25}; // double eta[ntrgbins2] = {0.2,0.6,1.0,1.4,1.8,2.2}; double eta_err[ntrgbins2] = {0.0}; Color_t color[6] = {1,kBlue, kBlue, kBlue,1,1}; TFile* fdiff[nfiles]; for(int jj=0;jj<nfiles;jj++) { fdiff[jj] = new TFile(filename[jj].Data()); TH2D* hsignal[ntrgbins]; TH2D* hbackground[ntrgbins]; TH2D* hsignal0[ntrgbins]; TH2D* hbackground0[ntrgbins]; TH2D* hsignal1[ntrgbins]; TH2D* hbackground1[ntrgbins]; TH1D* hsignal_1D[ntrgbins][6]; TH1D* hbackground_1D[ntrgbins][6]; TH1D* hsignal0_1D[ntrgbins][6]; TH1D* hbackground0_1D[ntrgbins][6]; TH1D* hsignal1_1D[ntrgbins][6]; TH1D* hbackground1_1D[ntrgbins][6]; double Vn[ntrgbins1][6]; double VnError[ntrgbins1][6]; double rn[ntrgbins2]; double rn_err[ntrgbins2]; double Vn0[ntrgbins1][6]; double Vn0Error[ntrgbins1][6]; double rn0[ntrgbins2]; double rn0_err[ntrgbins2]; double Vn1[ntrgbins1][6]; double Vn1Error[ntrgbins1][6]; double rn1[ntrgbins2]; double rn1_err[ntrgbins2]; double rn_ratio[ntrgbins2]; double rn_ratio_err[ntrgbins2]; double rn_total[ntrgbins2]; double rn_total_err[ntrgbins2]; for(int i=0;i<ntrgbins;i++) { hsignal0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfp/signalcosn_trg%d",i)); hbackground0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfp/backgroundcosn_trg%d",i)); hsignal1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfm/signalcosn_trg%d",i)); hbackground1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfm/backgroundcosn_trg%d",i)); hsignal[i] = (TH2D*)hsignal0[i]->Clone(Form("signalcosn_trg%d",i)); hbackground[i] = (TH2D*)hbackground0[i]->Clone(Form("backgroundcosn_trg%d",i)); hsignal[i]->Add(hsignal1[i]); hbackground[i]->Add(hbackground1[i]); for(int nbin=1;nbin<4;nbin++) { hsignal_1D[i][nbin] = (TH1D*)hsignal[i]->ProjectionX(Form("signal_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hsignal0_1D[i][nbin] = (TH1D*)hsignal0[i]->ProjectionX(Form("signal0_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hsignal1_1D[i][nbin] = (TH1D*)hsignal1[i]->ProjectionX(Form("signal1_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground_1D[i][nbin] = (TH1D*)hbackground[i]->ProjectionX(Form("background_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground0_1D[i][nbin] = (TH1D*)hbackground0[i]->ProjectionX(Form("background0_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground1_1D[i][nbin] = (TH1D*)hbackground1[i]->ProjectionX(Form("background1_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); Vn[i][nbin]=hsignal_1D[i][nbin]->GetMean()-hbackground_1D[i][nbin]->GetMean(); VnError[i][nbin]=sqrt(hsignal_1D[i][nbin]->GetMeanError()*hsignal_1D[i][nbin]->GetMeanError()+hbackground_1D[i][nbin]->GetMeanError()*hbackground_1D[i][nbin]->GetMeanError()); Vn0[i][nbin]=hsignal0_1D[i][nbin]->GetMean()-hbackground0_1D[i][nbin]->GetMean(); Vn0Error[i][nbin]=sqrt(hsignal0_1D[i][nbin]->GetMeanError()*hsignal0_1D[i][nbin]->GetMeanError()+hbackground0_1D[i][nbin]->GetMeanError()*hbackground0_1D[i][nbin]->GetMeanError()); Vn1[i][nbin]=hsignal1_1D[i][nbin]->GetMean()-hbackground1_1D[i][nbin]->GetMean(); Vn1Error[i][nbin]=sqrt(hsignal1_1D[i][nbin]->GetMeanError()*hsignal1_1D[i][nbin]->GetMeanError()+hbackground1_1D[i][nbin]->GetMeanError()*hbackground1_1D[i][nbin]->GetMeanError()); if(jj==7 && nbin==1) cout<<"pos nbin="<<nbin<<" i="<<i<<" "<<hsignal0_1D[i][nbin]->GetMean()<<" "<<hbackground0_1D[i][nbin]->GetMean()<<" "<<Vn0[i][nbin]<<endl; if(jj==7 && nbin==1) cout<<"neg nbin="<<nbin<<" i="<<i<<" "<<hsignal1_1D[i][nbin]->GetMean()<<" "<<hbackground1_1D[i][nbin]->GetMean()<<" "<<Vn1[i][nbin]<<endl; delete hsignal_1D[i][nbin]; delete hsignal0_1D[i][nbin]; delete hsignal1_1D[i][nbin]; delete hbackground_1D[i][nbin]; delete hbackground0_1D[i][nbin]; delete hbackground1_1D[i][nbin]; } delete hsignal0[i]; delete hsignal1[i]; delete hsignal[i]; delete hbackground0[i]; delete hbackground1[i]; delete hbackground[i]; } for(int nbin=1;nbin<4;nbin++) { for(int i=0;i<ntrgbins2;i++) { rn[ntrgbins2-i-1]=Vn[i][nbin]/Vn[ntrgbins1-i-1][nbin]; rn_err[ntrgbins2-i-1]=sqrt((VnError[ntrgbins1-i-1][nbin]/Vn[ntrgbins1-i-1][nbin])**2+(VnError[i][nbin]/Vn[i][nbin])**2); rn0[ntrgbins2-i-1]=Vn0[i][nbin]/Vn0[ntrgbins1-i-1][nbin]; rn0_err[ntrgbins2-i-1]=sqrt((Vn0Error[ntrgbins1-i-1][nbin]/Vn0[ntrgbins1-i-1][nbin])**2+(Vn0Error[i][nbin]/Vn0[i][nbin])**2); rn1[ntrgbins2-i-1]=Vn1[i][nbin]/Vn1[ntrgbins1-i-1][nbin]; rn1_err[ntrgbins2-i-1]=sqrt((Vn1Error[ntrgbins1-i-1][nbin]/Vn1[ntrgbins1-i-1][nbin])**2+(Vn1Error[i][nbin]/Vn1[i][nbin])**2); rn_ratio[ntrgbins2-i-1] = rn0[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]; rn_ratio_err[ntrgbins2-i-1] = sqrt(rn0_err[ntrgbins2-i-1]*rn0_err[ntrgbins2-i-1]+rn1_err[ntrgbins2-i-1]*rn1_err[ntrgbins2-i-1]); rn_total[ntrgbins2-i-1] = sqrt(rn0[ntrgbins2-i-1]*rn1[ntrgbins2-i-1]); rn_total_err[ntrgbins2-i-1] = sqrt(rn0_err[ntrgbins2-i-1]*rn0_err[ntrgbins2-i-1]/rn0[ntrgbins2-i-1]/rn0[ntrgbins2-i-1]+rn1_err[ntrgbins2-i-1]*rn1_err[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]/rn1[ntrgbins2-i-1])*0.5*rn_total[ntrgbins2-i-1]; if(jj==7 && nbin==1) cout<<"pos nbin="<<nbin<<" i="<<i<<" "<<Vn0[i][nbin]<<" "<<Vn0[ntrgbins1-i-1][nbin]<<" "<<rn0[ntrgbins2-i-1]<<endl; if(jj==7 && nbin==1) cout<<"neg nbin="<<nbin<<" i="<<i<<" "<<Vn1[i][nbin]<<" "<<Vn1[ntrgbins1-i-1][nbin]<<" "<<rn1[ntrgbins2-i-1]<<endl; } gr[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn,eta_err,rn_err); gr[jj][nbin]->SetMarkerColor(color[nbin]); gr0[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn0,eta_err,rn0_err); gr0[jj][nbin]->SetMarkerColor(color[nbin]); gr1[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn1,eta_err,rn1_err); gr1[jj][nbin]->SetMarkerColor(color[nbin]); gr_ratio[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn_ratio,eta_err,rn_ratio_err); gr_ratio[jj][nbin]->SetMarkerColor(color[nbin]); gr_total[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn_total,eta_err,rn_total_err); gr_total[jj][nbin]->SetMarkerColor(color[nbin]); /* gr[jj][nbin]->SetMarkerSize(gr[jj][1]->GetMarkerSize()*0.8); gr0[jj][nbin]->SetMarkerSize(gr0[jj][1]->GetMarkerSize()*0.8); gr1[jj][nbin]->SetMarkerSize(gr1[jj][1]->GetMarkerSize()*0.8); gr_ratio[jj][nbin]->SetMarkerSize(gr_ratio[jj][1]->GetMarkerSize()*0.8); */ // fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1+[0]*(-x-4.5)*(-x-4.5))/(1+[0]*(x-4.5)*(x-4.5))",0,3.0); // fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1+[0]*(-x-4.5))/(1+[0]*(x-4.5))",0,3.0); if(jj<8) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp([0]*(-x-4.6))/exp([0]*(x-4.6))",0.0,2.5); else fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp([0]*(-x-3.5))/exp([0]*(x-3.5))",0.0,1.1); fit[jj][nbin]->SetParameter(0,0.01); gr[jj][nbin]->Fit(Form("fit_%d_%d",nbin,jj),"RNO"); fit[jj][nbin]->SetLineColor(color[nbin]); fit[jj][nbin]->SetLineStyle(9); fit[jj][nbin]->SetLineWidth(1); if(jj<8) { slope[nbin][jj] = fit[jj][nbin]->GetParameter(0); slope_err[nbin][jj] = fit[jj][nbin]->GetParError(0); } else { slope1[nbin][jj-8] = fit[jj][nbin]->GetParameter(0); slope1_err[nbin][jj-8] = fit[jj][nbin]->GetParError(0); } // fit1_aver[jj][nbin] = new TF1(Form("fit1_aver_%d_%d",nbin,jj),"(1+[0]*(-x-4.5))/(1-4.5*[0])",0,4.5); fit1_aver[jj][nbin] = new TF1(Form("fit1_aver_%d_%d",nbin,jj),"exp(-[0]*x)",0,5); fit1_aver[jj][nbin]->SetParameter(0,fit[jj][nbin]->GetParameter(0)); fit1_aver[jj][nbin]->SetParError(0,fit[jj][nbin]->GetParError(0)); fit1_aver[jj][nbin]->SetLineStyle(1); fit1_aver[jj][nbin]->SetLineColor(color[nbin]); gr1_band[jj][nbin] = new TGraph(53); for(int mm=0;mm<26;mm++) { gr1_band[jj][nbin]->SetPoint(mm,0.2*mm,exp(-0.2*mm*(fit1_aver[jj][nbin]->GetParameter(0)+fit1_aver[jj][nbin]->GetParError(0)))); gr1_band[jj][nbin]->SetPoint(51-mm,0.2*mm,exp(-0.2*mm*(fit1_aver[jj][nbin]->GetParameter(0)-fit1_aver[jj][nbin]->GetParError(0)))); } gr1_band[jj][nbin]->SetPoint(52,0,1); gr1_band[jj][nbin]->SetFillColor(color[nbin]-10); } } ofstream ff("r2r3_eta_mc.txt"); double cent[8]={0.01,0.025,0.075,0.15,0.25,0.35,0.45,0.55}; double cent_err[8]={0}; TGraphErrors* gr_slope[6]; TGraphErrors* gr1_slope[6]; for(int nbin=1;nbin<4;nbin++) { gr_slope[nbin] = new TGraphErrors(8,cent,slope[nbin],cent_err,slope_err[nbin]); gr_slope[nbin]->SetName(Form("gr_slope_%d",nbin)); cout<<"i="<<nbin+1<<endl; ff<<"i="<<nbin+1<<endl; for(int j=0;j<8;j++) { cout<<slope[nbin][j]<<" "; ff<<slope[nbin][j]<<", ";} cout<<endl; ff<<endl; for(int j=0;j<8;j++) { cout<<slope_err[nbin][j]<<" "; ff<<slope_err[nbin][j]<<", ";} cout<<endl; ff<<endl; } for(int nbin=1;nbin<4;nbin++) { gr1_slope[nbin] = new TGraphErrors(8,cent,slope1[nbin],cent_err,slope1_err[nbin]); gr1_slope[nbin]->SetName(Form("gr1_slope_%d",nbin)); } ff.close(); TString histtitle[8] = {"0-0.2%","0-5%","5-10%","10-20%","20-30%","30-40%","40-50%","50-60%"}; TLine* ll = new TLine(0,1.,5.0,1.); TCanvas* c = new TCanvas("c","c",850,500); makeMultiPanelCanvas(c,3,2,0.01,0.0,0.2,0.2,0.02); // TH2D* htmp = new TH2D("htmp",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.1,2.5,100,0.905,1.019); TH2D* htmp = new TH2D("htmp",";#eta^{a};#sqrt{r_{2}(#eta^{a},#eta^{b}) #times r_{2}(-#eta^{a},-#eta^{b})}",100,-0.1,2.5,100,0.905-0.8,1.019+0.5); fixedFontHist(htmp,1.8,2.2); htmp->GetXaxis()->CenterTitle(); htmp->GetYaxis()->CenterTitle(); htmp->GetYaxis()->SetTitleSize(htmp->GetYaxis()->GetTitleSize()*1.2); htmp->GetXaxis()->SetTitleSize(htmp->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<6;jj++) { c->cd(jj+1); htmp->Draw(); ll->Draw("Lsame"); /* gr_total[jj][1]->SetMarkerStyle(34); gr_total[jj][1]->SetMarkerColor(1); gr_total[jj][1]->Draw("Psame"); gr[jj][1]->SetMarkerStyle(28); gr[jj][1]->SetMarkerColor(1); gr[jj][1]->Draw("Psame"); */ gr_total[jj+8][1]->SetMarkerStyle(21); gr_total[jj+8][1]->SetMarkerColor(4); gr_total[jj+8][1]->Draw("Psame"); } TLatex* latex2 = new TLatex(); latex2->SetNDC(); latex2->SetTextSize(1.5*latex2->GetTextSize()); c->cd(1); latex2->DrawLatex(0.26,0.05,"0-20%"); latex2->DrawLatex(0.24,0.865,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); latex2->DrawLatex(0.6,0.1,"4.4 < #eta^{b} < 5"); c->cd(2); latex2->DrawLatex(0.08,0.05,"20-40%"); latex2->DrawLatex(0.07,0.3,"0.3 < p_{T}^{a} < 3 GeV/c"); latex2->DrawLatex(0.07,0.18,"p_{T}^{b} > 0 GeV/c"); c->cd(3); latex2->DrawLatex(0.08,0.05,"40-60%"); c->cd(6); latex2->SetTextSize(0.92*latex2->GetTextSize()); latex2->DrawLatex(0.08,0.24,"40-60%"); c->cd(5); latex2->SetTextSize(0.95*latex2->GetTextSize()); latex2->DrawLatex(0.08,0.24,"20-40%"); c->cd(4); latex2->SetTextSize(latex2->GetTextSize()); latex2->DrawLatex(0.26,0.24,"0-20%"); latex2->DrawLatex(0.6,0.3,"3 < #eta^{b} < 4"); TLegend* legend2 = new TLegend(0.2,0.24,0.7,0.54); legend2->SetFillStyle(0); legend2->AddEntry(gr_total[16][1],"Data","P"); legend2->AddEntry(gr_total[8][1],"Hydjet, gen-level","P"); legend2->AddEntry(gr_total[0][1],"Hydjet, reco-level","P"); c->cd(1); legend2->Draw("same"); // SaveCanvas(c,"HI/FactBreak","epetadeco_HI_MCcompareTotal_r2"); return; TCanvas* ccaa = new TCanvas("ccaa","ccaa",900,500); makeMultiPanelCanvas(ccaa,4,2,0.01,0.0,0.2,0.2,0.02); for(int jj=0;jj<8;jj++) { ccaa->cd(jj+1); htmp->Draw(); ll->Draw("Lsame"); gr0[jj][1]->SetMarkerStyle(21); gr0[jj][1]->Draw("Psame"); gr1[jj][1]->SetMarkerStyle(25); gr1[jj][1]->Draw("Psame"); } TCanvas* ccbb = new TCanvas("ccbb","ccbb",900,500); makeMultiPanelCanvas(ccbb,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmpaa = new TH2D("htmpaa",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.1,2.23,100,0.97,1.03); for(int jj=0;jj<8;jj++) { ccbb->cd(jj+1); htmpaa->Draw(); ll->Draw("Lsame"); gr_ratio[jj][1]->SetMarkerStyle(21); gr_ratio[jj][1]->Draw("Psame"); } TCanvas* cc = new TCanvas("cc","cc",900,500); makeMultiPanelCanvas(cc,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmp1 = new TH2D("htmp1",";#eta^{a};r_{3}(#eta^{a},#eta^{b})",100,-0.1,2.5,100,0.831,1.06); fixedFontHist(htmp1,1.8,2.2); htmp1->GetXaxis()->CenterTitle(); htmp1->GetYaxis()->CenterTitle(); htmp1->GetYaxis()->SetTitleSize(htmp1->GetYaxis()->GetTitleSize()*1.2); htmp1->GetXaxis()->SetTitleSize(htmp1->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<8;jj++) { cc->cd(jj+1); htmp1->Draw(); ll->Draw("Lsame"); gr[jj][2]->SetMarkerStyle(21); gr[jj][2]->Draw("Psame"); fit[jj][2]->Draw("Lsame"); gr[jj+8][2]->SetMarkerStyle(25); // fit[jj+8][2]->SetLineStyle(5); gr[jj+8][2]->Draw("Psame"); // fit[jj+8][2]->Draw("Lsame"); } TLatex* latex3 = new TLatex(); latex3->SetNDC(); latex3->SetTextSize(1.5*latex3->GetTextSize()); cc->cd(1); latex3->DrawLatex(0.26,0.05,histtitle[0]); latex3->DrawLatex(0.24,0.865,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); cc->cd(2); latex3->DrawLatex(0.08,0.05,histtitle[1]); latex3->DrawLatex(0.07,0.28,"0.3 < p_{T}^{a} < 3 GeV/c"); latex3->DrawLatex(0.07,0.18,"p_{T}^{b} > 0 GeV/c"); cc->cd(4); latex3->DrawLatex(0.08,0.05,histtitle[3]); cc->cd(3); latex3->DrawLatex(0.08,0.05,histtitle[2]); cc->cd(8); latex3->DrawLatex(0.08,0.24,histtitle[7]); cc->cd(7); latex3->DrawLatex(0.08,0.24,histtitle[6]); cc->cd(6); latex3->SetTextSize(0.96*latex3->GetTextSize()); latex3->DrawLatex(0.08,0.24,histtitle[5]); cc->cd(5); latex3->SetTextSize(0.85*latex3->GetTextSize()); latex3->DrawLatex(0.26,0.24,histtitle[4]); TLegend* legend3 = new TLegend(0.24,0.14,0.51,0.38); legend3->SetFillStyle(0); legend3->AddEntry(gr[0][1],"4.4<#eta^{b}<5","P"); legend3->AddEntry(gr[8][1],"3<#eta^{b}<4","P"); cc->cd(1); legend3->Draw("same"); /* TCanvas* ccc = new TCanvas("ccc","ccc",900,500); makeMultiPanelCanvas(ccc,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmp2 = new TH2D("htmp2",";#eta^{a};r_{4}(#eta^{a},#eta^{b})",100,-0.1,2.23,100,0.801,1.06); fixedFontHist(htmp2,1.8,2.2); htmp2->GetXaxis()->CenterTitle(); htmp2->GetYaxis()->CenterTitle(); htmp2->GetYaxis()->SetTitleSize(htmp2->GetYaxis()->GetTitleSize()*1.2); htmp2->GetXaxis()->SetTitleSize(htmp2->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<8;jj++) { ccc->cd(jj+1); htmp2->Draw(); ll->Draw("Lsame"); gr[jj][3]->Draw("Psame"); fit[jj][3]->Draw("Lsame"); gr[jj+8][3]->Set_arkerStyle(25); fit[jj+8][3]->SetLineStyle(5); gr[jj+8][3]->Draw("Psame"); fit[jj+8][3]->Draw("Lsame"); } */ TCanvas* c1 = new TCanvas("c1","c1",500,500); TH2D* htmp2 = new TH2D("htmp2",";Centrality;C",100,0,1.0,100,0.0,0.06); htmp2->Draw(); htmp2->GetXaxis()->CenterTitle(); htmp2->GetYaxis()->CenterTitle(); gr_slope[1]->SetMarkerColor(1); gr_slope[2]->SetMarkerColor(1); gr_slope[1]->SetMarkerStyle(21); gr_slope[2]->SetMarkerStyle(22); gr_slope[1]->Draw("PESAME"); gr_slope[2]->Draw("PESAME"); gr1_slope[1]->SetMarkerColor(1); gr1_slope[2]->SetMarkerColor(1); gr1_slope[1]->SetMarkerStyle(25); gr1_slope[2]->SetMarkerStyle(26); gr1_slope[1]->Draw("PESAME"); gr1_slope[2]->Draw("PESAME"); return; TFile* f_slope_out = new TFile("gr_slope_v2v3.root","recreate"); gr_slope[1]->Write(); gr_slope[2]->Write(); gr1_slope[1]->Write(); gr1_slope[2]->Write(); f_slope_out->Close(); return; SaveCanvas(c,"HI/FactBreak","epetadeco_HI_r2"); SaveCanvas(cc,"HI/FactBreak","epetadeco_HI_r3"); SaveCanvas(ccaa,"HI/FactBreak","epetadeco_HI_r2ratio"); // SaveCanvas(c1,"HI/FactBreak","epetadeco_HI_C"); // SaveCanvas(cc2,"HI/FactBreak","epetadeco_HI_cos"); }
void fitscatterplot() { //example illustrating how to fit a 2-d histogram of type y=f(x) //Author: Rene Brun // generate a 2-d histogram using a TCutG TFile *f; f = new TFile("../../../rootfiles/closure/pPb/185_220/Merged.root"); TH2D *h2 = new TH2D("h2","h2",1000,-0.3,0.3,1000,-0.3,0.3); TCanvas *c1 = new TCanvas("c1","show profile",1,1,600,600); //c1->Divide(2,1,0.01,0.01); h2 = (TH2D*)f->Get("demo/genrecoach"); double r; r = h2->GetCorrelationFactor(); /* h2->Rebin2D(5,1); r = h2->GetCorrelationFactor(); c1->cd(2); //use a TProfile to convert the 2-d to 1-d problem TProfile *prof = h2->ProfileX(); //prof->Fit("pol1"); prof->GetYaxis()->SetRangeUser(-0.08,0.08); prof->GetXaxis()->SetRangeUser(-0.08,0.08); prof->SetYTitle("A_{ch}"); prof -> GetXaxis() -> CenterTitle(); prof -> GetYaxis() -> CenterTitle(); prof->SetLabelOffset(0.006,"Y"); prof->SetTitleOffset(1.800,"Y"); prof->SetMarkerStyle(20); prof->SetMarkerColor(kBlack); prof->SetMarkerSize (0.3); prof->SetMarkerStyle(1); prof->SetLineStyle(1); prof->SetLineWidth(1); prof->Fit("pol1"); TF1 *fit1 = prof->GetListOfFunctions()->FindObject("pol1"); TLatex* text2 = makeLatex(Form("slope : %.3f #pm %.3f",fit1->GetParameter(1),fit1->GetParError(1)),0.55,0.25) ; if(fit1) { fit1->SetLineColor(kRed); fit1->SetLineWidth(3); fit1->SetLineStyle(1); } // text_a->Draw("Same"); text2->Draw("Same"); TF1 *fa1 = new TF1("fa1","0",-10,10); fa1->SetLineColor(kBlack); fa1->SetLineWidth(1); fa1->DrawClone("Same"); prof->DrawClone("Same"); */ c1->cd(1); c1->cd(1)->SetRightMargin(0.12); h2 -> GetXaxis()->CenterTitle(); h2 -> GetYaxis()->CenterTitle(); h2 ->GetXaxis()->SetRangeUser(-0.4, 0.4); h2 ->GetYaxis()->SetRangeUser(-0.4, 0.4); h2->Rebin2D(8,8); h2->Draw("colz"); // prof->SetLineColor(kRed); // prof->SetLineWidth(5); // prof->Draw("Same"); TLatex* text3 = makeLatex(Form("correlationfactor : %f",r),0.40,0.17) ; text3->Draw("same"); // text_a->Draw("Same"); /* TH1D* ChargeAsym; f = new TFile("../../../rootfiles/closure/Merged.root"); ChargeAsym = (TH1D*)f->Get("demo/ChargeAsym"); ChargeAsym->GetXaxis()->SetRangeUser(-0.25,0.25); ChargeAsym->GetXaxis()->SetTitle("Observed A_{ch}"); ChargeAsym->GetYaxis()->SetTitle(" Counts "); ChargeAsym->GetXaxis()->CenterTitle(); ChargeAsym->GetYaxis()->CenterTitle(); ChargeAsym->SetTitleOffset(1.8,"Y"); c1->cd(1); ChargeAsym->Draw(); //prof->Draw(); */ SaveCanvas(c1,"pics",Form("fitscatterplot_clsouretest_pPb_185_220")); }
void Factorization_eta_pPb() { const int nfiles = 15; TString filename[nfiles]; filename[1] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n150185_pttrg033_ptassallweight_etaass445_eff1_all_v42.root"); filename[2] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n185220_pttrg033_ptassallweight_etaass445_eff1_all_v42.root"); filename[3] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n220260_pttrg033_ptassallweight_etaass445_eff1_all_v42.root"); filename[4] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n260_pttrg033_ptassallweight_etaass445_eff1_all_v42.root"); filename[0] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n120150_pttrg033_ptassallweight_etaass445_eff1_all_v42.root"); filename[6] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n150185_pttrg033_ptassallweight_etaass34_eff1_all_v42.root"); filename[7] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n185220_pttrg033_ptassallweight_etaass34_eff1_all_v42.root"); filename[8] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n220260_pttrg033_ptassallweight_etaass34_eff1_all_v42.root"); filename[9] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n260_pttrg033_ptassallweight_etaass34_eff1_all_v42.root"); filename[5] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n120150_pttrg033_ptassallweight_etaass34_eff1_all_v42.root"); filename[11] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n150185_pttrg033_ptassallweight_etaass45_eff1_all_v42.root"); filename[12] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n185220_pttrg033_ptassallweight_etaass45_eff1_all_v42.root"); filename[13] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n220260_pttrg033_ptassallweight_etaass45_eff1_all_v42.root"); filename[14] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n260_pttrg033_ptassallweight_etaass45_eff1_all_v42.root"); filename[10] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n120150_pttrg033_ptassallweight_etaass45_eff1_all_v42.root"); const int ntrgbins = 16; const int ntrgbins1 = ntrgbins; const int ntrgbins2 = ntrgbins/2; TGraphErrors* gr[nfiles][6]; TGraphErrors* gr1[nfiles][6]; TGraphErrors* gr_tot[nfiles][6]; TGraphErrors* gr_ratio[nfiles][6]; TGraph* gr_band[nfiles][6]; TGraph* gr1_band[nfiles][6]; TF1* fit[nfiles][6]; TF1* fit_aver[nfiles][6]; TF1* fit1_aver[nfiles][6]; double slope[6][nfiles]; double slope_err[6][nfiles]; double slope1[6][nfiles]; double slope1_err[6][nfiles]; // double eta[ntrgbins2] = {0.12,0.36,0.6,0.84,1.08,1.32,1.56,1.8,2.04,2.28}; // double eta[ntrgbins2] = {0.1,0.3,0.5,0.7,0.9,1.1,1.3,1.5,1.7,1.9,2.1,2.3}; double eta[ntrgbins2] = {0.15,0.45,0.75,1.05,1.35,1.65,1.95,2.25}; // double eta[ntrgbins2] = {0.2,0.6,1.0,1.4,1.8,2.2}; double eta_err[ntrgbins2] = {0.0}; Color_t color[6] = {1,kRed, kBlue, kGreen+2,1,1}; TFile* fdiff[nfiles]; for(int jj=0;jj<nfiles;jj++) { fdiff[jj] = new TFile(filename[jj].Data()); TH2D* hsignal[ntrgbins]; TH2D* hbackground[ntrgbins]; TH2D* hsignal1[ntrgbins]; TH2D* hbackground1[ntrgbins]; TH1D* hsignal_1D[ntrgbins][6]; TH1D* hbackground_1D[ntrgbins][6]; TH1D* hsignal1_1D[ntrgbins][6]; TH1D* hbackground1_1D[ntrgbins][6]; for(int i=0;i<ntrgbins;i++) { hsignal[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfp/signalcosn_trg%d",i)); hbackground[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfp/backgroundcosn_trg%d",i)); hsignal1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfm/signalcosn_trg%d",i)); hbackground1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfm/backgroundcosn_trg%d",i)); /* hsignal_1D[i] = (TH1D*)hsignal[i]->ProfileY(Form("signal_1D_trg%d",i),-1,-1,"e"); hsignal1_1D[i] = (TH1D*)hsignal1[i]->ProfileY(Form("signal1_1D_trg%d",i),-1,-1,"e"); hbackground_1D[i] = (TH1D*)hbackground[i]->ProfileY(Form("background_1D_trg%d",i),-1,-1,"e"); hbackground1_1D[i] = (TH1D*)hbackground1[i]->ProfileY(Form("background1_1D_trg%d",i),-1,-1,"e"); */ for(int nbin=1;nbin<2;nbin++) { hsignal_1D[i][nbin] = (TH1D*)hsignal[i]->ProjectionX(Form("signal_1D_trg%d_%d",i,nbin),nbin,nbin,"i"); hbackground_1D[i][nbin] = (TH1D*)hbackground[i]->ProjectionX(Form("background_1D_trg%d_%d",i,nbin),nbin,nbin,"i"); hsignal1_1D[i][nbin] = (TH1D*)hsignal1[i]->ProjectionX(Form("signal1_1D_trg%d_%d",i,nbin),nbin,nbin,"i"); hbackground1_1D[i][nbin] = (TH1D*)hbackground1[i]->ProjectionX(Form("background1_1D_trg%d_%d",i,nbin),nbin,nbin,"i"); } } for(int nbin=1;nbin<2;nbin++) { double Vn[ntrgbins1]; double VnError[ntrgbins1]; double rn[ntrgbins2]; double rn_err[ntrgbins2]; double Vn1[ntrgbins1]; double VnError1[ntrgbins1]; double rn1[ntrgbins2]; double rn1_err[ntrgbins2]; double rn_tot[ntrgbins2]; double rn_tot_err[ntrgbins2]; double rn_ratio[ntrgbins2]; double rn_ratio_err[ntrgbins2]; for(int i=0;i<ntrgbins1;i++) { if(nbin==1 && jj==3 ) cout<<nbin<<" "<<i<<" "<<hsignal1_1D[i][nbin]->GetMean()<<" "<<hsignal1_1D[i][nbin]->GetMeanError()<<" "<<hbackground1_1D[i][nbin]->GetMean()<<" "<<hbackground1_1D[i][nbin]->GetMeanError()<<endl; /* Vn[i]=hsignal_1D[i]->GetBinContent(nbin)-hbackground_1D[i]->GetBinContent(nbin); VnError[i]=sqrt(hsignal_1D[i]->GetBinError(nbin)*hsignal_1D[i]->GetBinError(nbin)+hbackground_1D[i]->GetBinError(nbin)*hbackground_1D[i]->GetBinError(nbin)); Vn1[i]=hsignal1_1D[i]->GetBinContent(nbin)-hbackground1_1D[i]->GetBinContent(nbin); VnError1[i]=sqrt(hsignal1_1D[i]->GetBinError(nbin)*hsignal1_1D[i]->GetBinError(nbin)+hbackground1_1D[i]->GetBinError(nbin)*hbackground1_1D[i]->GetBinError(nbin)); */ Vn[i]=hsignal_1D[i][nbin]->GetMean()-hbackground_1D[i][nbin]->GetMean(); VnError[i]=sqrt(hsignal_1D[i][nbin]->GetMeanError()*hsignal_1D[i][nbin]->GetMeanError()+hbackground_1D[i][nbin]->GetMeanError()*hbackground_1D[i][nbin]->GetMeanError()); Vn1[i]=hsignal1_1D[i][nbin]->GetMean()-hbackground1_1D[i][nbin]->GetMean(); VnError1[i]=sqrt(hsignal1_1D[i][nbin]->GetMeanError()*hsignal1_1D[i][nbin]->GetMeanError()+hbackground1_1D[i][nbin]->GetMeanError()*hbackground1_1D[i][nbin]->GetMeanError()); } for(int i=0;i<ntrgbins2;i++) { rn[ntrgbins2-i-1]=Vn[i]/Vn[ntrgbins1-i-1]; rn_err[ntrgbins2-i-1]=sqrt((VnError[ntrgbins1-i-1]/Vn[ntrgbins1-i-1])**2+(VnError[i]/Vn[i])**2); rn1[ntrgbins2-i-1]=Vn1[i]/Vn1[ntrgbins1-i-1]; rn1_err[ntrgbins2-i-1]=sqrt((VnError1[ntrgbins1-i-1]/Vn1[ntrgbins1-i-1])**2+(VnError1[i]/Vn1[i])**2); if(nbin==1 && jj==3 ) cout<<rn1[ntrgbins2-i-1]<<" "<<rn1_err[ntrgbins2-i-1]<<endl; rn_tot[ntrgbins2-i-1] = sqrt(rn[ntrgbins2-i-1]*rn1[ntrgbins2-i-1]); rn_tot_err[ntrgbins2-i-1] = rn_tot[ntrgbins2-i-1]*0.5*sqrt(rn_err[ntrgbins2-i-1]/rn[ntrgbins2-i-1]*rn_err[ntrgbins2-i-1]/rn[ntrgbins2-i-1]+rn1_err[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]*rn1_err[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]); rn_ratio[ntrgbins2-i-1] = sqrt(rn[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]); rn_ratio_err[ntrgbins2-i-1] = rn_ratio[ntrgbins2-i-1]*sqrt(rn_err[ntrgbins2-i-1]/rn[ntrgbins2-i-1]*rn_err[ntrgbins2-i-1]/rn[ntrgbins2-i-1]+rn1_err[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]*rn1_err[ntrgbins2-i-1]/rn1[ntrgbins2-i-1])*0.5; } gr[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn,eta_err,rn_err); gr[jj][nbin]->SetMarkerColor(color[nbin]); gr1[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn1,eta_err,rn1_err); gr1[jj][nbin]->SetMarkerColor(color[nbin]); gr_tot[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn_tot,eta_err,rn_tot_err); gr_tot[jj][nbin]->SetMarkerColor(color[nbin]); // gr_tot[jj][nbin]->SetMarkerSize(0.9*gr_tot[jj][nbin]->GetMarkerSize()); gr_ratio[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn_ratio,eta_err,rn_ratio_err); gr_ratio[jj][nbin]->SetMarkerColor(color[nbin]); if(jj<5) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp(2*[0]*(-x-4.6))/exp(2*[0]*(x-4.6))",0.0,2.5); else if(jj>=5 && jj<10) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp(2*[0]*(-x-3.5))/exp(2*[0]*(x-3.5))",0.0,1.1); else if(jj>=10) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp(2*[0]*(-x-4.6))/exp(2*[0]*(x-4.6))",0.0,2.06); /* if(jj<4) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1-[1]+[1]*exp([0]*(-x-4.5)))/(1-[1]+[1]*exp([0]*(x-4.5)))",0.0,2.5); else if(jj>=4 && jj<8) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1-[1]+[1]*exp([0]*(-x-3.5)))/(1-[1]+[1]*exp([0]*(x-3.5)))",0.0,1.4); else if(jj>=8) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1-[1]+[1]*exp([0]*(-x-4.7)))/(1-[1]+[1]*exp([0]*(x-4.7)))",0.0,2.5); */ fit[jj][nbin]->SetParameter(0,0.01); fit[jj][nbin]->SetParameter(1,0.1); fit[jj][nbin]->SetParLimits(1,0,0.2); gr_tot[jj][nbin]->Fit(Form("fit_%d_%d",nbin,jj),"RNO"); fit[jj][nbin]->SetLineColor(color[nbin]); fit[jj][nbin]->SetLineStyle(9); fit[jj][nbin]->SetLineWidth(1); if(jj<5) { slope[nbin][jj] = fit[jj][nbin]->GetParameter(0); slope_err[nbin][jj] = fit[jj][nbin]->GetParError(0); } else { slope1[nbin][jj-10] = fit[jj][nbin]->GetParameter(0); slope1_err[nbin][jj-10] = fit[jj][nbin]->GetParError(0); } // fit1_aver[jj][nbin] = new TF1(Form("fit1_aver_%d_%d",nbin,jj),"[1]*exp(-[0]*x)+1-[1]",0,5.0); fit1_aver[jj][nbin] = new TF1(Form("fit1_aver_%d_%d",nbin,jj),"exp(-[0]*x)",0,5.0); fit1_aver[jj][nbin]->SetParameter(0,fit[jj][nbin]->GetParameter(0)); fit1_aver[jj][nbin]->SetParError(0,fit[jj][nbin]->GetParError(0)); // fit1_aver[jj][nbin]->SetParameter(1,fit[jj][nbin]->GetParameter(1)); // fit1_aver[jj][nbin]->SetParError(1,fit[jj][nbin]->GetParError(1)); fit1_aver[jj][nbin]->SetLineStyle(1); fit1_aver[jj][nbin]->SetLineColor(color[nbin]); gr1_band[jj][nbin] = new TGraph(53); for(int mm=0;mm<26;mm++) { gr1_band[jj][nbin]->SetPoint(mm,0.2*mm,exp(-0.2*mm*(fit1_aver[jj][nbin]->GetParameter(0)+fit1_aver[jj][nbin]->GetParError(0)))); gr1_band[jj][nbin]->SetPoint(51-mm,0.2*mm,exp(-0.2*mm*(fit1_aver[jj][nbin]->GetParameter(0)-fit1_aver[jj][nbin]->GetParError(0)))); } gr1_band[jj][nbin]->SetPoint(52,0,1); gr1_band[jj][nbin]->SetFillColor(color[nbin]-10); } } ofstream ff("r2_eta_pPb.txt"); for(int nbin=1;nbin<2;nbin++) { cout<<"i="<<nbin+1<<endl; ff<<"i="<<nbin+1<<endl; for(int j=0;j<5;j++) { cout<<slope[nbin][j]<<" "; ff<<slope[nbin][j]<<", ";} cout<<endl; ff<<endl; for(int j=0;j<5;j++) { cout<<slope_err[nbin][j]<<" "; ff<<slope_err[nbin][j]<<", ";} cout<<endl; ff<<endl; } TString histtitle[5] = {"120 #leq N_{trk}^{offline} < 150", "150 #leq N_{trk}^{offline} < 185", "185 #leq N_{trk}^{offline} < 220", "220 #leq N_{trk}^{offline} < 260", "N_{trk}^{offline} #geq 260"}; TLine* ll = new TLine(0,1.,2.65,1.); TCanvas* c = new TCanvas("c","c",530,500); makeMultiPanelCanvas(c,2,2,0.01,0.0,0.2,0.18,0.02); TH2D* htmp = new TH2D("htmp",";#eta^{a};#sqrt{r_{2}(-#eta^{a},-#eta^{b}) #times r_{2}(#eta^{a},#eta^{b})}",100,-0.1,2.5,100,0.601,1.06); fixedFontHist(htmp,1.8,2.1); htmp->GetXaxis()->CenterTitle(); htmp->GetYaxis()->CenterTitle(); htmp->GetYaxis()->SetTitleSize(htmp->GetYaxis()->GetTitleSize()*1.2); htmp->GetXaxis()->SetTitleSize(htmp->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<4;jj++) { c->cd(jj+1); htmp->Draw(); ll->Draw("Lsame"); gr_tot[jj][1]->SetMarkerStyle(25); gr_tot[jj][1]->Draw("Psame"); fit[jj][1]->Draw("Lsame"); gr_tot[jj+5][1]->SetMarkerStyle(24); gr_tot[jj+5][1]->Draw("Psame"); gr_tot[jj+10][1]->SetMarkerStyle(28); gr_tot[jj+10][1]->SetMarkerColor(1); gr_tot[jj+10][1]->Draw("Psame"); /* gr_tot[jj+8][1]->SetMarkerStyle(28); fit[jj+8][1]->SetLineStyle(9); gr_tot[jj+8][1]->Draw("Psame"); fit[jj+8][1]->Draw("Lsame"); */ } TLatex* latex = new TLatex(); latex->SetNDC(); latex->SetTextSize(1.3*latex->GetTextSize()); c->cd(1); latex->DrawLatex(0.27,0.05,histtitle[0]); // latex->DrawLatex(0.58,0.74,"0.3 < p_{T}^{a} < 3 GeV/c"); // latex->DrawLatex(0.58,0.65,"p_{T}^{b} > 0 GeV/c"); latex->DrawLatex(0.24,0.885,"CMS pPb #sqrt{s_{NN}} = 5.02 TeV"); latex->DrawLatex(0.68,0.7,"L_{int} = 35 nb^{-1}"); c->cd(2); latex->DrawLatex(0.12,0.27,"0.3 < p_{T}^{a} < 3 GeV/c"); latex->DrawLatex(0.12,0.18,"p_{T}^{b} > 0 GeV/c"); latex->DrawLatex(0.09,0.05,histtitle[1]); c->cd(4); latex->SetTextSize(0.9*latex->GetTextSize()); latex->DrawLatex(0.09,0.22,histtitle[3]); latex->SetTextSize(latex->GetTextSize()/0.9); c->cd(3); latex->SetTextSize(0.85*latex->GetTextSize()); latex->DrawLatex(0.27,0.22,histtitle[2]); TLegend* legend = new TLegend(0.25,0.18,0.62,0.39); legend->SetFillStyle(0); // legend->AddEntry(gr_tot[8][1],"4.4<#eta^{b}<5","P"); legend->AddEntry(gr_tot[0][1],"4.4<#eta^{b}<5","P"); // legend->AddEntry(fit[0][1],"Exponential fit","L"); legend->AddEntry(gr_tot[10][1],"4<#eta^{b}<5","P"); legend->AddEntry(gr_tot[5][1],"3<#eta^{b}<4","P"); // legend->AddEntry(fit[4][1],"Exponential fit","L"); c->cd(1); legend->Draw(); TLine* ll = new TLine(0,1.,5.0,1.); TCanvas* ca = new TCanvas("ca","ca",560,500); makeMultiPanelCanvas(ca,2,2,0.02,0.0,0.27,0.18,0.02); TH2D* htmpa = new TH2D("htmpa",";#eta^{a};#frac{v_{2}(#eta^{a})}{v_{2}(-#eta^{a})} = #sqrt{#frac{r_{2}(#eta^{a},#eta^{b})}{r_{2}(-#eta^{a},-#eta^{b})}}",100,-0.1,2.5,100,0.91,1.045); fixedFontHist(htmpa,1.8,2.7); htmpa->GetXaxis()->CenterTitle(); htmpa->GetYaxis()->CenterTitle(); htmpa->GetYaxis()->SetTitleSize(htmpa->GetYaxis()->GetTitleSize()*1.15); htmpa->GetXaxis()->SetTitleSize(htmpa->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<4;jj++) { ca->cd(jj+1); htmpa->Draw(); ll->Draw("Lsame"); gr_ratio[jj][1]->Draw("Psame"); gr_ratio[jj+5][1]->SetMarkerStyle(24); gr_ratio[jj+5][1]->Draw("Psame"); } TLatex* latex1 = new TLatex(); latex1->SetNDC(); latex1->SetTextSize(1.3*latex1->GetTextSize()); ca->cd(1); latex1->DrawLatex(0.33,0.05,histtitle[0]); latex1->DrawLatex(0.31,0.88,"CMS pPb #sqrt{s_{NN}} = 5.02 TeV"); latex1->DrawLatex(0.31,0.77,"L_{int} = 35 nb^{-1}"); ca->cd(2); latex1->DrawLatex(0.075,0.05,histtitle[1]); latex1->DrawLatex(0.08,0.29,"0.3 < p_{T}^{a} < 3 GeV/c"); latex1->DrawLatex(0.08,0.19,"p_{T}^{b} > 0 GeV/c"); ca->cd(4); latex1->SetTextSize(0.9*latex1->GetTextSize()); latex1->DrawLatex(0.075,0.22,histtitle[3]); latex1->SetTextSize(latex1->GetTextSize()/0.9); ca->cd(3); latex1->SetTextSize(0.85*latex1->GetTextSize()); latex1->DrawLatex(0.33,0.22,histtitle[2]); TLegend* legend1 = new TLegend(0.34,0.15,0.57,0.35); legend1->SetFillStyle(0); legend1->AddEntry(gr_ratio[0][1],"4.4<#eta^{b}<5","P"); legend1->AddEntry(gr_ratio[5][1],"3<#eta^{b}<4","P"); ca->cd(1); legend1->Draw(); TCanvas* c2 = new TCanvas("c2","c2",810,400); makeMultiPanelCanvas(c2,4,2,0.016,0.0,0.24,0.2,0.02); TH2D* htmp2 = new TH2D("htmp2",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.1,2.5,100,0.61,1.06); fixedFontHist(htmp2,1.6,1.8); htmp2->GetXaxis()->CenterTitle(); htmp2->GetYaxis()->CenterTitle(); htmp2->GetYaxis()->SetTitleSize(htmp2->GetYaxis()->GetTitleSize()*1.3); htmp2->GetXaxis()->SetTitleSize(htmp2->GetXaxis()->GetTitleSize()*1.); TH2D* htmp2a = (TH2D*)htmp2->Clone("tmp2a"); htmp2a->SetTitle(";#eta^{a};r_{2}(-#eta^{a},-#eta^{b})"); for(int jj=0;jj<4;jj++) { c2->cd(jj+1); htmp2->Draw(); ll->Draw("Lsame"); gr[jj][1]->Draw("Psame"); gr[jj+5][1]->SetMarkerStyle(24); gr[jj+5][1]->Draw("Psame"); c2->cd(jj+5); htmp2a->Draw(); ll->Draw("Lsame"); gr1[jj][1]->Draw("Psame"); gr1[jj+5][1]->SetMarkerStyle(24); gr1[jj+5][1]->Draw("Psame"); } TLatex* latex2 = new TLatex(); latex2->SetNDC(); latex2->SetTextSize(1.5*latex2->GetTextSize()); c2->cd(1); latex2->DrawLatex(0.30,0.05,histtitle[0]); latex2->DrawLatex(0.28,0.865,"CMS pPb #sqrt{s_{NN}} = 5.02 TeV"); c2->cd(2); latex2->DrawLatex(0.08,0.05,histtitle[1]); latex2->DrawLatex(0.07,0.3,"0.3 < p_{T}^{a} < 3 GeV/c"); latex2->DrawLatex(0.07,0.18,"p_{T}^{b} > 0 GeV/c"); c2->cd(4); latex2->DrawLatex(0.08,0.05,histtitle[3]); c2->cd(3); latex2->DrawLatex(0.08,0.05,histtitle[2]); c2->cd(6); latex2->SetTextSize(0.96*latex2->GetTextSize()); latex2->DrawLatex(0.08,0.24,histtitle[1]); c2->cd(8); latex2->DrawLatex(0.08,0.24,histtitle[3]); c2->cd(7); latex2->DrawLatex(0.08,0.24,histtitle[2]); c2->cd(5); latex2->SetTextSize(0.9*latex2->GetTextSize()); latex2->DrawLatex(0.3,0.24,histtitle[0]); TLegend* legend2 = new TLegend(0.3,0.18,0.6,0.44); legend2->SetFillStyle(0); legend2->AddEntry(gr_ratio[0][1],"4.4<#eta^{b}<5","P"); legend2->AddEntry(gr_ratio[5][1],"3<#eta^{b}<4","P"); c2->cd(1); legend2->Draw(); /* TCanvas* cc2 = new TCanvas("cc2","cc2",530,500); makeMultiPanelCanvas(cc2,2,2,0.01,0.0,0.2,0.18,0.02); TH2D* htmp22 = new TH2D("htmp22",";|#eta^{a}-#eta^{b}|;cos[n(#Psi_{n}(#eta^{a})-#Psi_{n}(#eta^{b}))]",100,0,5,100,0.731,1.06); fixedFontHist(htmp22,1.8,2.2); htmp22->GetXaxis()->CenterTitle(); htmp22->GetYaxis()->CenterTitle(); htmp22->GetYaxis()->SetTitleSize(htmp22->GetYaxis()->GetTitleSize()*1.1); htmp22->GetXaxis()->SetTitleSize(htmp22->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<4;jj++) { cc2->cd(jj+1); htmp22->Draw(); ll->Draw("Lsame"); gr1_band[jj][1]->Draw("Fsame"); fit1_aver[jj][1]->Draw("Lsame"); } TLatex* latex3 = new TLatex(); latex3->SetNDC(); latex3->SetTextSize(1.4*latex3->GetTextSize()); cc2->cd(1); latex3->DrawLatex(0.26,0.05,histtitle[0]); latex3->DrawLatex(0.24,0.865,"CMS pPb #sqrt{s_{NN}} = 5.02 TeV"); cc2->cd(2); latex3->DrawLatex(0.075,0.05,histtitle[1]); cc2->cd(4); latex3->DrawLatex(0.075,0.22,histtitle[3]); cc2->cd(3); latex3->SetTextSize(0.85*latex3->GetTextSize()); latex3->DrawLatex(0.24,0.22,histtitle[2]); */ SaveCanvas(c,"HI/FactBreak","epetadeco_pPb_alletab_r2tot"); SaveCanvas(c2,"HI/FactBreak","epetadeco_pPb_alletab_r2sep"); SaveCanvas(ca,"HI/FactBreak","epetadeco_pPb_alletab_r2ratio"); // SaveCanvas(cc2,"HI/FactBreak","epetadeco_pPb_cos"); }
void plotXsec(const TString xsecConfFile, const TString xSecKindString, const TString crossSectionSet="_fsrUnfGood"){ // -------------------------------------------------------------- // Process input // -------------------------------------------------------------- XSecInputFileMgr_t inpMgr; if (!inpMgr.Load(xsecConfFile)) { std::cout << "failed to load file <" << xsecConfFile << ">\n"; return; } DYTools::TCrossSectionKind_t csKind=DYTools::_cs_None; if (xSecKindString.Contains("auto") || xSecKindString.Contains("default")) { if (DYTools::study2D==1) csKind=DYTools::_cs_preFsrDetNorm; else csKind=DYTools::_cs_preFsrNorm; } else { csKind=DetermineCrossSectionKind(xSecKindString); // auto-stop on failure } // -------------------------------------------------------------- // Prepare variables // -------------------------------------------------------------- TGaxis::SetMaxDigits(3); CPlot::sOutDir = TString("plots_") + DYTools::analysisTag + TString("_") + inpMgr.evtEffScaleTag(); TriggerSelection triggers(inpMgr.triggerSetName(),true,0); ComparisonPlot_t::TRatioType_t ratio= ComparisonPlot_t::_ratioPlain; // #1/#2 //ComparisonPlot_t::_ratioRel; // (#1-#2)/#1 TString ratioYLabel=(ratio==ComparisonPlot_t::_ratioPlain) ? "data/theory" : "(th-dt)/th"; if (DYTools::study2D) { ratioYLabel=(ratio==ComparisonPlot_t::_ratioPlain) ? "theory/data" : "(dt-th)/dt"; } ComparisonPlot_t compPlot(ratio, "check","", (DYTools::study2D) ? "rapidity |y|" : "m_{ee} [GeV]", CrossSectionKindLongName(csKind), ratioYLabel); //compPlot.SetRatioNdivisions(805); //compPlot.SetPrintValues(1); //compPlot.SetPrintRatios(1); compPlot.SetPrintRatioNames(1); int cWidth=600, cHeight=700; if (DYTools::study2D) { //double rdy=0.15; compPlot.SetRatioYRange(1-rdy,1+rdy); cWidth=400*(2+landscape); cHeight=400*(3-landscape); } else { compPlot.SetLogx(1); compPlot.SetLogy(1); //double rdy=0.15; compPlot.SetRatioYRange(1-rdy,1+rdy); cWidth=600; cHeight=700; } TString dataFName=TString("../root_files/") + inpMgr.evtEffScaleTag() + crossSectionSet + TString("/xSec"); if (!csPreFsr(csKind)) dataFName.Append("PostFsr"); if (csInDET(csKind)) dataFName.Append("DET"); dataFName.Append("_results_"); dataFName.Append(DYTools::analysisTag); if (!csPreFsr(csKind)) dataFName.Append(triggers.triggerConditionsName()); dataFName.Append(".root"); // -------------------------------------------------------------- // Prepare plots // -------------------------------------------------------------- TString canvasName=TString("cXsec_") + CrossSectionKindName(csKind) + TString("_") + DYTools::analysisTag; TCanvas *canvas=MakeCanvas(canvasName,canvasName,cWidth,cHeight); std::vector<ComparisonPlot_t*> compPlotsV; //std::vector<TH1F*> dataHistos; std::vector<TH1F*> histos; if (DYTools::study2D) { // 2D compPlot.Prepare6Pads(canvas,landscape); vector<TLatex*> massLabels; prepareMassRanges(massLabels,0.55,0.17, kBlue+2); // // data for (int i=0; i<6; ++i) { const int iM=i+1; // skip 1st mass bin ComparisonPlot_t *cp=new ComparisonPlot_t(compPlot,Form("compPlot_%d",i+1),""); compPlotsV.push_back(cp); std::vector<TH1F*> localHV; if ((csKind==DYTools::_cs_preFsrDet) || (csKind==DYTools::_cs_preFsrDetNorm)) { if (plot_theoryCT10) { TH1F* hTh=readTh2D_CT10(csKind, iM); hTh->SetMarkerStyle(27); hTh->SetMarkerSize(0.8); cp->AddHist1D(hTh,"CTEQ10W","L",kGreen+1,1,0,1); histos.push_back(hTh); localHV.push_back(hTh); } if (plot_theoryMSTW2008) { TH1F* hTh=readTh2D_MSTW2008(csKind, iM); hTh->SetMarkerStyle(24); hTh->SetMarkerSize(0.8); cp->AddHist1D(hTh,"MSTW2008","L",kBlue,1,0,1); histos.push_back(hTh); localHV.push_back(hTh); } } // data TH1F* hData=readData(triggers,csKind,iM,dataFName); histos.push_back(hData); localHV.push_back(hData); cp->AddHist1D(hData,"data","P",kBlack,1,0,1); cp->SetRefIdx(hData); for (unsigned int ii=0; ii<localHV.size(); ++ii) { localHV[ii]->GetYaxis()->SetTitleOffset(1.2); } // Plotting and beautifying int subpad=-1; cp->Draw6(canvas,landscape,i+1,false,"png",&subpad); canvas->cd(subpad); massLabels[iM]->Draw(); if (i==2) { cp->AddTextCMSPreliminary(); cp->AddTextLumi(0.55,0.27); } } } else { // 1D canvas->Divide(1,2); compPlot.PreparePads(canvas); // theory if ((csKind==DYTools::_cs_preFsr) || (csKind==DYTools::_cs_preFsrNorm)) { TH1F* hTh=readTh1D_MSTW2008(csKind); removeError(hTh); compPlot.AddHist1D(hTh,"NNLO, FEWZ+MSTW08","L",kBlue,1,0,0); compPlot.SkipInRatioPlots(hTh); // do not consider for ratios histos.push_back(hTh); } // theory: special set to calculate ratios if (csKind==DYTools::_cs_preFsrNorm) { int showLabel=-1; TString draw_opt=(showPoints) ? "P" : "P skip"; TH1F* hTh=readTh1D_MSTW2008(csKind,"_NNLO","default",_th2011_nnlo); hTh->SetMarkerSize(0.8); compPlot.AddHist1D(hTh,"NNLO, FEWZ+MSTW08 (40bins)",draw_opt,kBlue,1,0,showLabel); compPlot.SetRefIdx(hTh); // use to calculate ratios histos.push_back(hTh); } // data 1D TH1F* hData=readData(triggers,csKind,-1, dataFName); histos.push_back(hData); compPlot.AddHist1D(hData,"data","P",kBlack,1,0,1); } for (unsigned int i=0; i<histos.size(); i++) { histos[i]->SetDirectory(0); } // -------------------------------------------------------------- // Plot // -------------------------------------------------------------- if (DYTools::study2D) { } else { // 1D compPlot.Draw(canvas,false,"png"); canvas->cd(1); compPlot.AddTextCMSPreliminary(); compPlot.AddTextLumi(0.55,0.27); } canvas->Update(); canvas->cd(); SaveCanvas(canvas,canvas->GetName()); return; }
void Factorization_eta_v2v3_paper() { const int nfiles = 24; TString filename[nfiles]; filename[0] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[1] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[2] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[3] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[4] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[5] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[6] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[7] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg033_ptassallweight_etaass445_eff1_v42.root"); /* filename[0] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[1] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[2] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[3] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[4] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[5] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[6] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[7] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); */ filename[8] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[9] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[10] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[11] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[12] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[13] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[14] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[15] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[16] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[17] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[18] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[19] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[20] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[21] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[22] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[23] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg033_ptassallweight_etaass45_eff1_v42.root"); const int ntrgbins = 16; const int ntrgbins1 = ntrgbins; const int ntrgbins2 = ntrgbins/2; TGraphErrors* gr[nfiles][6]; TGraphErrors* gr0[nfiles][6]; TGraphErrors* gr1[nfiles][6]; TGraphErrors* gr_ratio[nfiles][6]; TGraph* gr_band[nfiles][6]; TGraph* gr1_band[nfiles][6]; TF1* fit[nfiles][6]; TF1* fit_aver[nfiles][6]; TF1* fit1_aver[nfiles][6]; double slope[6][nfiles]; double slope_err[6][nfiles]; double slope1[6][nfiles]; double slope1_err[6][nfiles]; // double eta[ntrgbins2] = {0.12,0.36,0.6,0.84,1.08,1.32,1.56,1.8,2.04,2.28}; // double eta[ntrgbins2] = {0.1,0.3,0.5,0.7,0.9,1.1,1.3,1.5,1.7,1.9,2.1,2.3}; double eta[ntrgbins2] = {0.15,0.45,0.75,1.05,1.35,1.65,1.95,2.25}; // double eta[ntrgbins2] = {0.2,0.6,1.0,1.4,1.8,2.2}; double eta_err[ntrgbins2] = {0.0}; Color_t color[6] = {1,kBlue, kBlue, kBlue,1,1}; TFile* fdiff[nfiles]; for(int jj=0;jj<nfiles;jj++) { fdiff[jj] = new TFile(filename[jj].Data()); TH2D* hsignal[ntrgbins]; TH2D* hbackground[ntrgbins]; TH2D* hsignal0[ntrgbins]; TH2D* hbackground0[ntrgbins]; TH2D* hsignal1[ntrgbins]; TH2D* hbackground1[ntrgbins]; TH1D* hsignal_1D[ntrgbins][6]; TH1D* hbackground_1D[ntrgbins][6]; TH1D* hsignal0_1D[ntrgbins][6]; TH1D* hbackground0_1D[ntrgbins][6]; TH1D* hsignal1_1D[ntrgbins][6]; TH1D* hbackground1_1D[ntrgbins][6]; double Vn[ntrgbins1][6]; double VnError[ntrgbins1][6]; double rn[ntrgbins2]; double rn_err[ntrgbins2]; double Vn0[ntrgbins1][6]; double Vn0Error[ntrgbins1][6]; double rn0[ntrgbins2]; double rn0_err[ntrgbins2]; double Vn1[ntrgbins1][6]; double Vn1Error[ntrgbins1][6]; double rn1[ntrgbins2]; double rn1_err[ntrgbins2]; double rn_ratio[ntrgbins2]; double rn_ratio_err[ntrgbins2]; for(int i=0;i<ntrgbins;i++) { hsignal0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfp/signalcosn_trg%d",i)); hbackground0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfp/backgroundcosn_trg%d",i)); hsignal1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfm/signalcosn_trg%d",i)); hbackground1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfm/backgroundcosn_trg%d",i)); /* if(jj==6 || jj==7) { hsignal0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfp/signalcosn_trg%d",i)); hbackground0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfp/backgroundcosn_trg%d",i)); hsignal1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfm/signalcosn_trg%d",i)); hbackground1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfm/backgroundcosn_trg%d",i)); } */ hsignal[i] = (TH2D*)hsignal0[i]->Clone(Form("signalcosn_trg%d",i)); hbackground[i] = (TH2D*)hbackground0[i]->Clone(Form("backgroundcosn_trg%d",i)); hsignal[i]->Add(hsignal1[i]); hbackground[i]->Add(hbackground1[i]); for(int nbin=1;nbin<4;nbin++) { hsignal_1D[i][nbin] = (TH1D*)hsignal[i]->ProjectionX(Form("signal_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hsignal0_1D[i][nbin] = (TH1D*)hsignal0[i]->ProjectionX(Form("signal0_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hsignal1_1D[i][nbin] = (TH1D*)hsignal1[i]->ProjectionX(Form("signal1_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground_1D[i][nbin] = (TH1D*)hbackground[i]->ProjectionX(Form("background_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground0_1D[i][nbin] = (TH1D*)hbackground0[i]->ProjectionX(Form("background0_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground1_1D[i][nbin] = (TH1D*)hbackground1[i]->ProjectionX(Form("background1_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); Vn[i][nbin]=hsignal_1D[i][nbin]->GetMean()-hbackground_1D[i][nbin]->GetMean(); VnError[i][nbin]=sqrt(hsignal_1D[i][nbin]->GetMeanError()*hsignal_1D[i][nbin]->GetMeanError()+hbackground_1D[i][nbin]->GetMeanError()*hbackground_1D[i][nbin]->GetMeanError()); Vn0[i][nbin]=hsignal0_1D[i][nbin]->GetMean()-hbackground0_1D[i][nbin]->GetMean(); Vn0Error[i][nbin]=sqrt(hsignal0_1D[i][nbin]->GetMeanError()*hsignal0_1D[i][nbin]->GetMeanError()+hbackground0_1D[i][nbin]->GetMeanError()*hbackground0_1D[i][nbin]->GetMeanError()); Vn1[i][nbin]=hsignal1_1D[i][nbin]->GetMean()-hbackground1_1D[i][nbin]->GetMean(); Vn1Error[i][nbin]=sqrt(hsignal1_1D[i][nbin]->GetMeanError()*hsignal1_1D[i][nbin]->GetMeanError()+hbackground1_1D[i][nbin]->GetMeanError()*hbackground1_1D[i][nbin]->GetMeanError()); if(jj==7 && nbin==1) cout<<"pos nbin="<<nbin<<" i="<<i<<" "<<hsignal0_1D[i][nbin]->GetMean()<<" "<<hbackground0_1D[i][nbin]->GetMean()<<" "<<Vn0[i][nbin]<<endl; if(jj==7 && nbin==1) cout<<"neg nbin="<<nbin<<" i="<<i<<" "<<hsignal1_1D[i][nbin]->GetMean()<<" "<<hbackground1_1D[i][nbin]->GetMean()<<" "<<Vn1[i][nbin]<<endl; delete hsignal_1D[i][nbin]; delete hsignal0_1D[i][nbin]; delete hsignal1_1D[i][nbin]; delete hbackground_1D[i][nbin]; delete hbackground0_1D[i][nbin]; delete hbackground1_1D[i][nbin]; } delete hsignal0[i]; delete hsignal1[i]; delete hsignal[i]; delete hbackground0[i]; delete hbackground1[i]; delete hbackground[i]; } for(int nbin=1;nbin<4;nbin++) { for(int i=0;i<ntrgbins2;i++) { rn[ntrgbins2-i-1]=Vn[i][nbin]/Vn[ntrgbins1-i-1][nbin]; rn_err[ntrgbins2-i-1]=sqrt((VnError[ntrgbins1-i-1][nbin]/Vn[ntrgbins1-i-1][nbin])**2+(VnError[i][nbin]/Vn[i][nbin])**2); rn0[ntrgbins2-i-1]=Vn0[i][nbin]/Vn0[ntrgbins1-i-1][nbin]; rn0_err[ntrgbins2-i-1]=sqrt((Vn0Error[ntrgbins1-i-1][nbin]/Vn0[ntrgbins1-i-1][nbin])**2+(Vn0Error[i][nbin]/Vn0[i][nbin])**2); rn1[ntrgbins2-i-1]=Vn1[i][nbin]/Vn1[ntrgbins1-i-1][nbin]; rn1_err[ntrgbins2-i-1]=sqrt((Vn1Error[ntrgbins1-i-1][nbin]/Vn1[ntrgbins1-i-1][nbin])**2+(Vn1Error[i][nbin]/Vn1[i][nbin])**2); rn_ratio[ntrgbins2-i-1] = rn0[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]; rn_ratio_err[ntrgbins2-i-1] = sqrt(rn0_err[ntrgbins2-i-1]*rn0_err[ntrgbins2-i-1]+rn1_err[ntrgbins2-i-1]*rn1_err[ntrgbins2-i-1]); if(jj==7 && nbin==1) cout<<"pos nbin="<<nbin<<" i="<<i<<" "<<Vn0[i][nbin]<<" "<<Vn0[ntrgbins1-i-1][nbin]<<" "<<rn0[ntrgbins2-i-1]<<endl; if(jj==7 && nbin==1) cout<<"neg nbin="<<nbin<<" i="<<i<<" "<<Vn1[i][nbin]<<" "<<Vn1[ntrgbins1-i-1][nbin]<<" "<<rn1[ntrgbins2-i-1]<<endl; } gr[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn,eta_err,rn_err); gr[jj][nbin]->SetMarkerColor(color[nbin]); gr0[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn0,eta_err,rn0_err); gr0[jj][nbin]->SetMarkerColor(color[nbin]); gr1[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn1,eta_err,rn1_err); gr1[jj][nbin]->SetMarkerColor(color[nbin]); gr_ratio[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn_ratio,eta_err,rn_ratio_err); gr_ratio[jj][nbin]->SetMarkerColor(color[nbin]); /* gr[jj][nbin]->SetMarkerSize(gr[jj][1]->GetMarkerSize()*0.8); gr0[jj][nbin]->SetMarkerSize(gr0[jj][1]->GetMarkerSize()*0.8); gr1[jj][nbin]->SetMarkerSize(gr1[jj][1]->GetMarkerSize()*0.8); gr_ratio[jj][nbin]->SetMarkerSize(gr_ratio[jj][1]->GetMarkerSize()*0.8); */ // fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1+[0]*(-x-4.5)*(-x-4.5))/(1+[0]*(x-4.5)*(x-4.5))",0,3.0); // fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1+[0]*(-x-4.5))/(1+[0]*(x-4.5))",0,3.0); if(jj<8) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp([0]*(-x-4.6))/exp([0]*(x-4.6))",0.0,2.4); else fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp([0]*(-x-3.5))/exp([0]*(x-3.5))",0.0,1.1); fit[jj][nbin]->SetParameter(0,0.01); gr[jj][nbin]->Fit(Form("fit_%d_%d",nbin,jj),"RNO"); fit[jj][nbin]->SetLineColor(color[nbin]); fit[jj][nbin]->SetLineStyle(7); fit[jj][nbin]->SetLineWidth(1); if(jj<8) { slope[nbin][jj] = fit[jj][nbin]->GetParameter(0); slope_err[nbin][jj] = fit[jj][nbin]->GetParError(0); } else { slope1[nbin][jj-8] = fit[jj][nbin]->GetParameter(0); slope1_err[nbin][jj-8] = fit[jj][nbin]->GetParError(0); } // fit1_aver[jj][nbin] = new TF1(Form("fit1_aver_%d_%d",nbin,jj),"(1+[0]*(-x-4.5))/(1-4.5*[0])",0,4.5); fit1_aver[jj][nbin] = new TF1(Form("fit1_aver_%d_%d",nbin,jj),"exp(-[0]*x)",0,5); fit1_aver[jj][nbin]->SetParameter(0,fit[jj][nbin]->GetParameter(0)); fit1_aver[jj][nbin]->SetParError(0,fit[jj][nbin]->GetParError(0)); fit1_aver[jj][nbin]->SetLineStyle(1); fit1_aver[jj][nbin]->SetLineColor(color[nbin]); gr1_band[jj][nbin] = new TGraph(53); for(int mm=0;mm<26;mm++) { gr1_band[jj][nbin]->SetPoint(mm,0.2*mm,exp(-0.2*mm*(fit1_aver[jj][nbin]->GetParameter(0)+fit1_aver[jj][nbin]->GetParError(0)))); gr1_band[jj][nbin]->SetPoint(51-mm,0.2*mm,exp(-0.2*mm*(fit1_aver[jj][nbin]->GetParameter(0)-fit1_aver[jj][nbin]->GetParError(0)))); } gr1_band[jj][nbin]->SetPoint(52,0,1); gr1_band[jj][nbin]->SetFillColor(color[nbin]-10); } } ofstream ff("r2r3_eta.txt"); double cent[8]={0.01,0.025,0.075,0.15,0.25,0.35,0.45,0.55}; double cent_err[8]={0}; TGraphErrors* gr_slope[6]; TGraphErrors* gr1_slope[6]; for(int nbin=1;nbin<4;nbin++) { gr_slope[nbin] = new TGraphErrors(8,cent,slope[nbin],cent_err,slope_err[nbin]); gr_slope[nbin]->SetName(Form("gr_slope_%d",nbin)); cout<<"i="<<nbin+1<<endl; ff<<"i="<<nbin+1<<endl; for(int j=0;j<8;j++) { cout<<slope[nbin][j]<<" "; ff<<slope[nbin][j]<<", ";} cout<<endl; ff<<endl; for(int j=0;j<8;j++) { cout<<slope_err[nbin][j]<<" "; ff<<slope_err[nbin][j]<<", ";} cout<<endl; ff<<endl; } for(int nbin=1;nbin<4;nbin++) { gr1_slope[nbin] = new TGraphErrors(8,cent,slope1[nbin],cent_err,slope1_err[nbin]); gr1_slope[nbin]->SetName(Form("gr1_slope_%d",nbin)); } ff.close(); TString histtitle[8] = {"0-0.2% centrality","0-5%","5-10%","10-20%","20-30%","30-40%","40-50%","50-60%"}; TLine* ll = new TLine(-0.12,1.,2.49,1.); TCanvas* c = new TCanvas("c","c",920,500); makeMultiPanelCanvas(c,4,2,0.01,0.0,0.25,0.2,0.02); TH2D* htmp = new TH2D("htmp",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.12,2.49,100,0.831-0.02,1.06-0.02); fixedFontHist(htmp,1.8,2.8); htmp->GetXaxis()->CenterTitle(); htmp->GetYaxis()->CenterTitle(); htmp->GetYaxis()->SetTitleSize(htmp->GetYaxis()->GetTitleSize()*1.2); htmp->GetXaxis()->SetTitleSize(htmp->GetXaxis()->GetTitleSize()*1.); htmp->GetXaxis()->SetLabelSize(htmp->GetXaxis()->GetLabelSize()*0.95); htmp->GetXaxis()->SetNdivisions(510); for(int jj=0;jj<8;jj++) { c->cd(jj+1); htmp->Draw(); ll->Draw("Lsame"); gr[jj][1]->SetMarkerStyle(21); gr[jj][1]->Draw("Psame"); fit[jj][1]->Draw("Lsame"); cout<<fit[jj][1]->GetChisquare()/fit[jj][1]->GetNDF()<<endl; gr[jj+8][1]->SetMarkerStyle(25); // fit[jj+8][1]->SetLineStyle(5); gr[jj+8][1]->Draw("Psame"); // fit[jj+8][1]->Draw("Lsame"); /* gr[jj+16][1]->SetMarkerStyle(28); gr[jj+16][1]->SetMarkerColor(1); gr[jj+16][1]->Draw("Psame"); */ } TLatex* latex2 = new TLatex(); latex2->SetNDC(); latex2->SetTextSize(1.5*latex2->GetTextSize()); c->cd(1); latex2->DrawLatex(0.31,0.05,histtitle[0]); latex2->DrawLatex(0.29,0.865,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); c->cd(2); latex2->DrawLatex(0.08,0.05,histtitle[1]); latex2->SetTextSize(0.98*latex2->GetTextSize()); latex2->DrawLatex(0.1,0.285,"0.3 < p_{T}^{a} < 3.0 GeV/c"); latex2->DrawLatex(0.1,0.18,"p_{T}^{b} > 0 GeV/c"); latex2->SetTextSize(latex2->GetTextSize()/0.98); c->cd(4); latex2->DrawLatex(0.08,0.05,histtitle[3]); c->cd(3); latex2->DrawLatex(0.08,0.05,histtitle[2]); c->cd(8); latex2->DrawLatex(0.08,0.24,histtitle[7]); c->cd(7); latex2->DrawLatex(0.08,0.24,histtitle[6]); c->cd(6); latex2->SetTextSize(0.96*latex2->GetTextSize()); latex2->DrawLatex(0.08,0.24,histtitle[5]); c->cd(5); latex2->SetTextSize(0.85*latex2->GetTextSize()); latex2->DrawLatex(0.31,0.24,histtitle[4]); TLegend* legend2 = new TLegend(0.26,0.16,0.78,0.46); legend2->SetFillStyle(0); legend2->AddEntry(gr[0][1],"4.4 < #eta^{b} < 5.0","P"); legend2->AddEntry(gr[8][1],"3.0 < #eta^{b} < 4.0","P"); legend2->AddEntry(fit[0][1],"Exponential fits","L"); c->cd(1); legend2->Draw("same"); TCanvas* ccaa = new TCanvas("ccaa","ccaa",900,500); makeMultiPanelCanvas(ccaa,4,2,0.01,0.0,0.2,0.2,0.02); for(int jj=0;jj<8;jj++) { ccaa->cd(jj+1); htmp->Draw(); ll->Draw("Lsame"); gr0[jj][1]->SetMarkerStyle(21); gr0[jj][1]->Draw("Psame"); gr1[jj][1]->SetMarkerStyle(25); gr1[jj][1]->Draw("Psame"); } TCanvas* ccbb = new TCanvas("ccbb","ccbb",900,500); makeMultiPanelCanvas(ccbb,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmpaa = new TH2D("htmpaa",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.1,2.5,100,0.97,1.03); for(int jj=0;jj<8;jj++) { ccbb->cd(jj+1); htmpaa->Draw(); ll->Draw("Lsame"); gr_ratio[jj][1]->SetMarkerStyle(21); gr_ratio[jj][1]->Draw("Psame"); } TCanvas* cc = new TCanvas("cc","cc",920,500); makeMultiPanelCanvas(cc,4,2,0.01,0.0,0.25,0.2,0.02); TH2D* htmp1 = new TH2D("htmp1",";#eta^{a};r_{3}(#eta^{a},#eta^{b})",100,-0.12,2.49,100,0.831-0.02,1.06-0.02); fixedFontHist(htmp1,1.8,2.8); htmp1->GetXaxis()->CenterTitle(); htmp1->GetYaxis()->CenterTitle(); htmp1->GetYaxis()->SetTitleSize(htmp1->GetYaxis()->GetTitleSize()*1.2); htmp1->GetXaxis()->SetTitleSize(htmp1->GetXaxis()->GetTitleSize()*1.); htmp1->GetXaxis()->SetLabelSize(htmp1->GetXaxis()->GetLabelSize()*0.95); htmp1->GetXaxis()->SetNdivisions(510); for(int jj=0;jj<8;jj++) { cc->cd(jj+1); htmp1->Draw(); ll->Draw("Lsame"); gr[jj][2]->SetMarkerStyle(21); gr[jj][2]->Draw("Psame"); fit[jj][2]->Draw("Lsame"); cout<<fit[jj][2]->GetChisquare()/fit[jj][2]->GetNDF()<<endl; gr[jj+8][2]->SetMarkerStyle(25); // fit[jj+8][2]->SetLineStyle(5); gr[jj+8][2]->Draw("Psame"); // fit[jj+8][2]->Draw("Lsame"); /* gr[jj+16][2]->SetMarkerStyle(28); gr[jj+16][2]->SetMarkerColor(1); gr[jj+16][2]->Draw("Psame"); fit[jj+16][2]->Draw("Lsame"); */ } TLatex* latex3 = new TLatex(); latex3->SetNDC(); latex3->SetTextSize(1.5*latex3->GetTextSize()); cc->cd(1); latex3->DrawLatex(0.31,0.05,histtitle[0]); latex3->DrawLatex(0.29,0.865,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); cc->cd(2); latex3->DrawLatex(0.08,0.05,histtitle[1]); latex3->SetTextSize(0.98*latex3->GetTextSize()); latex3->DrawLatex(0.1,0.285,"0.3 < p_{T}^{a} < 3.0 GeV/c"); latex3->DrawLatex(0.1,0.18,"p_{T}^{b} > 0 GeV/c"); latex3->SetTextSize(latex3->GetTextSize()/0.98); cc->cd(4); latex3->DrawLatex(0.08,0.05,histtitle[3]); cc->cd(3); latex3->DrawLatex(0.08,0.05,histtitle[2]); cc->cd(8); latex3->DrawLatex(0.08,0.24,histtitle[7]); cc->cd(7); latex3->DrawLatex(0.08,0.24,histtitle[6]); cc->cd(6); latex3->SetTextSize(0.96*latex3->GetTextSize()); latex3->DrawLatex(0.08,0.24,histtitle[5]); cc->cd(5); latex3->SetTextSize(0.85*latex3->GetTextSize()); latex3->DrawLatex(0.31,0.24,histtitle[4]); TLegend* legend3 = new TLegend(0.26,0.16,0.78,0.46); legend3->SetFillStyle(0); legend3->AddEntry(gr[0][1],"4.4 < #eta^{b} < 5.0","P"); // legend3->AddEntry(gr[16][1],"4<#eta^{b}<5","P"); legend3->AddEntry(gr[8][1],"3.0 < #eta^{b} < 4.0","P"); legend3->AddEntry(fit[0][1],"Exponential fits","L"); cc->cd(1); legend3->Draw("same"); /* TCanvas* ccc = new TCanvas("ccc","ccc",900,500); makeMultiPanelCanvas(ccc,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmp2 = new TH2D("htmp2",";#eta^{a};r_{4}(#eta^{a},#eta^{b})",100,-0.1,2.23,100,0.801,1.06); fixedFontHist(htmp2,1.8,2.2); htmp2->GetXaxis()->CenterTitle(); htmp2->GetYaxis()->CenterTitle(); htmp2->GetYaxis()->SetTitleSize(htmp2->GetYaxis()->GetTitleSize()*1.2); htmp2->GetXaxis()->SetTitleSize(htmp2->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<8;jj++) { ccc->cd(jj+1); htmp2->Draw(); ll->Draw("Lsame"); gr[jj][3]->Draw("Psame"); fit[jj][3]->Draw("Lsame"); gr[jj+8][3]->Set_arkerStyle(25); fit[jj+8][3]->SetLineStyle(5); gr[jj+8][3]->Draw("Psame"); fit[jj+8][3]->Draw("Lsame"); } */ SaveCanvas(c,"HI/FactBreak","epetadeco_HI_r2"); SaveCanvas(cc,"HI/FactBreak","epetadeco_HI_r3"); return; TCanvas* c1 = new TCanvas("c1","c1",500,500); TH2D* htmp2 = new TH2D("htmp2",";Centrality;C",100,0,1.0,100,0.0,0.06); htmp2->Draw(); htmp2->GetXaxis()->CenterTitle(); htmp2->GetYaxis()->CenterTitle(); gr_slope[1]->SetMarkerColor(1); gr_slope[2]->SetMarkerColor(1); gr_slope[1]->SetMarkerStyle(21); gr_slope[2]->SetMarkerStyle(22); gr_slope[1]->Draw("PESAME"); gr_slope[2]->Draw("PESAME"); gr1_slope[1]->SetMarkerColor(1); gr1_slope[2]->SetMarkerColor(1); gr1_slope[1]->SetMarkerStyle(25); gr1_slope[2]->SetMarkerStyle(26); gr1_slope[1]->Draw("PESAME"); gr1_slope[2]->Draw("PESAME"); TFile* f_slope_out = new TFile("gr_slope_v2v3.root","recreate"); gr_slope[1]->Write(); gr_slope[2]->Write(); gr1_slope[1]->Write(); gr1_slope[2]->Write(); f_slope_out->Close(); double c2th_05[4] = {1,0.961347696746,0.880663601763,0.754486161464}; double c2th_05_err[4] = {0,0.000356333410703,0.000338330912667,0.000274987058522}; double c2th_510[4] = {1,0.972713667246,0.915076778092,0.833525975859}; double c2th_510_err[4] = {0,0.000405999641418,0.000387338629763,0.000306789774481}; double c2th_2025[4] = {1,0.984223594381,0.952359517332,0.902163004038}; double c2th_2025_err[4] = {0,0.00034410202865,0.000327502849547,0.000264412975357}; double c3th_05[4] = {1,0.969266017011,0.906673110779,0.811457263278}; double c3th_05_err[4] = {0,0.000169783126377,0.000162733412441,0.000127976935994}; double c3th_510[4] = {1,0.967235903665,0.902375220756,0.794138304113}; double c3th_510_err[4] = {0,0.000140808705408,0.000136143144565,0.000110350606241}; double c3th_2025[4] = {1,0.969550353187,0.904351369862,0.80580447205}; double c3th_2025_err[4] = {0,9.57789409787e-05,9.14453396096e-05,7.07914090744e-05}; double etath[4] = {0,0.5,1,2}; double etath_err[4] = {0}; TGraphErrors* gr_c2th_05 = new TGraphErrors(4,etath,c2th_05,etath_err,c2th_05_err); TGraphErrors* gr_c2th_510 = new TGraphErrors(4,etath,c2th_510,etath_err,c2th_510_err); TGraphErrors* gr_c2th_2025 = new TGraphErrors(4,etath,c2th_2025,etath_err,c2th_2025_err); TGraphErrors* gr_c3th_05 = new TGraphErrors(4,etath,c3th_05,etath_err,c3th_05_err); TGraphErrors* gr_c3th_510 = new TGraphErrors(4,etath,c3th_510,etath_err,c3th_510_err); TGraphErrors* gr_c3th_2025 = new TGraphErrors(4,etath,c3th_2025,etath_err,c3th_2025_err); gr_c2th_05->SetMarkerStyle(31); gr_c2th_510->SetMarkerStyle(31); gr_c2th_2025->SetMarkerStyle(31); gr_c3th_05->SetMarkerStyle(31); gr_c3th_510->SetMarkerStyle(31); gr_c3th_2025->SetMarkerStyle(31); TCanvas* cth = new TCanvas("cth","",900,330); makeMultiPanelCanvas(cth,3,1,0.01,0.0,0.2,0.17,0.02); TH2D* htmp8 = new TH2D("htmp8",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.1,2.5,100,0.67,1.06); fixedFontHist(htmp8,0.9,1.3); htmp8->GetXaxis()->CenterTitle(); htmp8->GetYaxis()->CenterTitle(); htmp8->GetYaxis()->SetTitleSize(htmp8->GetYaxis()->GetTitleSize()*1.4); htmp8->GetXaxis()->SetTitleSize(htmp8->GetXaxis()->GetTitleSize()*1.2); cth->cd(1); htmp8->Draw(); ll->Draw("Lsame"); gr[1][1]->SetMarkerStyle(20); gr[1][1]->Draw("Psame"); gr_c2th_05->Draw("LPsame"); cth->cd(2); htmp8->Draw(); ll->Draw("Lsame"); gr[2][1]->SetMarkerStyle(20); gr[2][1]->Draw("Psame"); gr_c2th_510->Draw("LPsame"); cth->cd(3); htmp8->Draw(); ll->Draw("Lsame"); gr[4][1]->SetMarkerStyle(20); gr[4][1]->Draw("Psame"); gr_c2th_2025->Draw("LPsame"); TLegend* legend_cth = new TLegend(0.25,0.24,0.75,0.4); legend_cth->SetFillStyle(0); legend_cth->AddEntry(gr[1][1],"Data","P"); legend_cth->AddEntry(gr_c2th_05,"3D hydro. model","PL"); cth->cd(1); legend_cth->Draw("same"); TLatex* latex8 = new TLatex(); latex8->SetNDC(); latex8->SetTextSize(latex3->GetTextSize()); cth->cd(1); latex8->DrawLatex(0.8,0.25,histtitle[1]); latex8->DrawLatex(0.285,0.88,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); cth->cd(2); latex8->DrawLatex(0.68,0.25,histtitle[2]); latex8->DrawLatex(0.07,0.45,"4.4 < #eta^{b} < 5"); latex8->DrawLatex(0.07,0.35,"0.3 < p_{T}^{a} < 3 GeV/c"); latex8->DrawLatex(0.07,0.25,"p_{T}^{b} > 0 GeV/c"); cth->cd(3); latex8->DrawLatex(0.68,0.25,histtitle[4]); TCanvas* cth3 = new TCanvas("cth3","",900,330); makeMultiPanelCanvas(cth3,3,1,0.01,0.0,0.2,0.17,0.02); TH2D* htmp9 = new TH2D("htmp9",";#eta^{a};r_{3}(#eta^{a},#eta^{b})",100,-0.12,2.49,100,0.7,1.06); fixedFontHist(htmp9,0.9,1.3); htmp9->GetXaxis()->CenterTitle(); htmp9->GetYaxis()->CenterTitle(); htmp9->GetYaxis()->SetTitleSize(htmp9->GetYaxis()->GetTitleSize()*1.4); htmp9->GetXaxis()->SetTitleSize(htmp9->GetXaxis()->GetTitleSize()*1.2); cth3->cd(1); htmp9->Draw(); ll->Draw("Lsame"); gr[1][2]->SetMarkerStyle(20); gr[1][2]->Draw("Psame"); gr_c3th_05->Draw("LPsame"); cth3->cd(2); htmp9->Draw(); ll->Draw("Lsame"); gr[2][2]->SetMarkerStyle(20); gr[2][2]->Draw("Psame"); gr_c3th_510->Draw("LPsame"); cth3->cd(3); htmp9->Draw(); ll->Draw("Lsame"); gr[4][2]->SetMarkerStyle(20); gr[4][2]->Draw("Psame"); gr_c3th_2025->Draw("LPsame"); cth3->cd(1); legend_cth->Draw("same"); cth3->cd(1); latex8->DrawLatex(0.8,0.25,histtitle[1]); latex8->DrawLatex(0.285,0.88,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); cth3->cd(2); latex8->DrawLatex(0.68,0.25,histtitle[2]); latex8->DrawLatex(0.07,0.45,"4.4 < #eta^{b} < 5"); latex8->DrawLatex(0.07,0.35,"0.3 < p_{T}^{a} < 3 GeV/c"); latex8->DrawLatex(0.07,0.25,"p_{T}^{b} > 0 GeV/c"); cth3->cd(3); latex8->DrawLatex(0.68,0.25,histtitle[4]); /* SaveCanvas(cth,"HI/FactBreak","epetadeco_HI_theory_r2"); SaveCanvas(cth3,"HI/FactBreak","epetadeco_HI_theory_r3"); */ SaveCanvas(c,"HI/FactBreak","epetadeco_HI_r2"); SaveCanvas(cc,"HI/FactBreak","epetadeco_HI_r3"); // SaveCanvas(ccaa,"HI/FactBreak","epetadeco_HI_r2ratio"); // SaveCanvas(c1,"HI/FactBreak","epetadeco_HI_C"); // SaveCanvas(cc2,"HI/FactBreak","epetadeco_HI_cos"); }
void GainPlot() { gROOT->Reset(); setTDRStyle(); gStyle->SetPadTopMargin (0.05); gStyle->SetPadBottomMargin(0.10); gStyle->SetPadRightMargin (0.18); gStyle->SetPadLeftMargin (0.13); gStyle->SetTitleSize(0.04, "XYZ"); gStyle->SetTitleXOffset(1.1); gStyle->SetTitleYOffset(1.35); gStyle->SetPalette(1); gStyle->SetCanvasColor(0); gStyle->SetBarOffset(0); unsigned int tree_Index; unsigned int tree_DetId; unsigned char tree_APVId; unsigned char tree_SubDet; float tree_x; float tree_y; float tree_z; float tree_Eta; float tree_R; float tree_Phi; float tree_Thickness; float tree_FitMPV; float tree_FitMPVErr; float tree_FitWidth; float tree_FitWidthErr; float tree_FitChi2NDF; double tree_Gain; double tree_PrevGain; double tree_NEntries; TFile* f1 = new TFile("file:../Gains_Tree.root"); TTree *t1 = (TTree*)GetObjectFromPath(f1,"SiStripCalib/APVGain"); t1->SetBranchAddress("Index" ,&tree_Index ); t1->SetBranchAddress("DetId" ,&tree_DetId ); t1->SetBranchAddress("APVId" ,&tree_APVId ); t1->SetBranchAddress("SubDet" ,&tree_SubDet ); t1->SetBranchAddress("x" ,&tree_x ); t1->SetBranchAddress("y" ,&tree_y ); t1->SetBranchAddress("z" ,&tree_z ); t1->SetBranchAddress("Eta" ,&tree_Eta ); t1->SetBranchAddress("R" ,&tree_R ); t1->SetBranchAddress("Phi" ,&tree_Phi ); t1->SetBranchAddress("Thickness" ,&tree_Thickness ); t1->SetBranchAddress("FitMPV" ,&tree_FitMPV ); t1->SetBranchAddress("FitMPVErr" ,&tree_FitMPVErr ); t1->SetBranchAddress("FitWidth" ,&tree_FitWidth ); t1->SetBranchAddress("FitWidthErr" ,&tree_FitWidthErr); t1->SetBranchAddress("FitChi2NDF" ,&tree_FitChi2NDF ); t1->SetBranchAddress("Gain" ,&tree_Gain ); t1->SetBranchAddress("PrevGain" ,&tree_PrevGain ); t1->SetBranchAddress("NEntries" ,&tree_NEntries ); TH2D* ChargeDistrib = (TH2D*)GetObjectFromPath(f1,"SiStripCalib/Charge_Vs_Index"); TH2D* ChargeDistribA = (TH2D*)GetObjectFromPath(f1,"SiStripCalib/Charge_Vs_Index_Absolute"); TH2D* Charge_Vs_PathlengthTIB = (TH2D*)GetObjectFromPath(f1,"SiStripCalib/Charge_Vs_PathlengthTIB"); TH2D* Charge_Vs_PathlengthTOB = (TH2D*)GetObjectFromPath(f1,"SiStripCalib/Charge_Vs_PathlengthTOB"); TH2D* Charge_Vs_PathlengthTIDP = (TH2D*)GetObjectFromPath(f1,"SiStripCalib/Charge_Vs_PathlengthTIDP"); TH2D* Charge_Vs_PathlengthTIDM = (TH2D*)GetObjectFromPath(f1,"SiStripCalib/Charge_Vs_PathlengthTIDM"); TH2D* Charge_Vs_PathlengthTID = (TH2D*)Charge_Vs_PathlengthTIDP->Clone("Charge_Vs_PathlengthTID"); Charge_Vs_PathlengthTID ->Add(Charge_Vs_PathlengthTIDM); TH2D* Charge_Vs_PathlengthTECP1 = (TH2D*)GetObjectFromPath(f1,"SiStripCalib/Charge_Vs_PathlengthTECP1"); TH2D* Charge_Vs_PathlengthTECP2 = (TH2D*)GetObjectFromPath(f1,"SiStripCalib/Charge_Vs_PathlengthTECP2"); TH2D* Charge_Vs_PathlengthTECM1 = (TH2D*)GetObjectFromPath(f1,"SiStripCalib/Charge_Vs_PathlengthTECM1"); TH2D* Charge_Vs_PathlengthTECM2 = (TH2D*)GetObjectFromPath(f1,"SiStripCalib/Charge_Vs_PathlengthTECM2"); TH2D* Charge_Vs_PathlengthTECP = (TH2D*)Charge_Vs_PathlengthTECP1->Clone("Charge_Vs_PathlengthTECP"); Charge_Vs_PathlengthTECP ->Add(Charge_Vs_PathlengthTECP2); TH2D* Charge_Vs_PathlengthTECM = (TH2D*)Charge_Vs_PathlengthTECM1->Clone("Charge_Vs_PathlengthTECM"); Charge_Vs_PathlengthTECM ->Add(Charge_Vs_PathlengthTECM2); TH2D* Charge_Vs_PathlengthTEC1 = (TH2D*)Charge_Vs_PathlengthTECP1->Clone("Charge_Vs_PathlengthTEC1"); Charge_Vs_PathlengthTEC1 ->Add(Charge_Vs_PathlengthTECM1); TH2D* Charge_Vs_PathlengthTEC2 = (TH2D*)Charge_Vs_PathlengthTECP2->Clone("Charge_Vs_PathlengthTEC2"); Charge_Vs_PathlengthTEC2 ->Add(Charge_Vs_PathlengthTECM2); TH2D* Charge_Vs_PathlengthTEC = (TH2D*)Charge_Vs_PathlengthTECP ->Clone("Charge_Vs_PathlengthTEC"); Charge_Vs_PathlengthTEC ->Add(Charge_Vs_PathlengthTECM ); TH2D* Charge_Vs_PathlengthThin = (TH2D*)Charge_Vs_PathlengthTEC1->Clone("Charge_Vs_PathlengthThin"); Charge_Vs_PathlengthThin ->Add(Charge_Vs_PathlengthTIB ); Charge_Vs_PathlengthThin ->Add(Charge_Vs_PathlengthTID ); TH2D* Charge_Vs_PathlengthThick = (TH2D*)Charge_Vs_PathlengthTEC2->Clone("Charge_Vs_PathlengthThin"); Charge_Vs_PathlengthThick ->Add(Charge_Vs_PathlengthTOB ); TH1D* MPV_Vs_PathlengthTIB = ChargeToMPV(Charge_Vs_PathlengthTIB ,"MPV_Vs_PathlengthTIB" , true); TH1D* MPV_Vs_PathlengthTID = ChargeToMPV(Charge_Vs_PathlengthTID ,"MPV_Vs_PathlengthTID" , true); // TH1D* MPV_Vs_PathlengthTIDP = ChargeToMPV(Charge_Vs_PathlengthTIDP ,"MPV_Vs_PathlengthTIDP" , true); // TH1D* MPV_Vs_PathlengthTIDM = ChargeToMPV(Charge_Vs_PathlengthTIDM ,"MPV_Vs_PathlengthTIDM" , true); TH1D* MPV_Vs_PathlengthTOB = ChargeToMPV(Charge_Vs_PathlengthTOB ,"MPV_Vs_PathlengthTOB" , true); // TH1D* MPV_Vs_PathlengthTEC = ChargeToMPV(Charge_Vs_PathlengthTEC ,"MPV_Vs_PathlengthTEC" , true); // TH1D* MPV_Vs_PathlengthTECP = ChargeToMPV(Charge_Vs_PathlengthTECP ,"MPV_Vs_PathlengthTECP" , true); // TH1D* MPV_Vs_PathlengthTECM = ChargeToMPV(Charge_Vs_PathlengthTECM ,"MPV_Vs_PathlengthTECM" , true); TH1D* MPV_Vs_PathlengthTEC1 = ChargeToMPV(Charge_Vs_PathlengthTEC1 ,"MPV_Vs_PathlengthTEC1" , true); TH1D* MPV_Vs_PathlengthTEC2 = ChargeToMPV(Charge_Vs_PathlengthTEC2 ,"MPV_Vs_PathlengthTEC2" , true); // TH1D* MPV_Vs_PathlengthTECP1 = ChargeToMPV(Charge_Vs_PathlengthTECP1,"MPV_Vs_PathlengthTECP1", true); // TH1D* MPV_Vs_PathlengthTECP2 = ChargeToMPV(Charge_Vs_PathlengthTECP2,"MPV_Vs_PathlengthTECP2", true); // TH1D* MPV_Vs_PathlengthTECM1 = ChargeToMPV(Charge_Vs_PathlengthTECM1,"MPV_Vs_PathlengthTECM1", true); // TH1D* MPV_Vs_PathlengthTECM2 = ChargeToMPV(Charge_Vs_PathlengthTECM2,"MPV_Vs_PathlengthTECM2", true); TH1D* MPV_Vs_PathlengthThin = ChargeToMPV(Charge_Vs_PathlengthThin ,"MPV_Vs_PathlengthThin" , true); TH1D* MPV_Vs_PathlengthThick = ChargeToMPV(Charge_Vs_PathlengthThick,"MPV_Vs_PathlengthThick", true); TH2D* MPV_Vs_EtaTIB = new TH2D("MPV_Vs_EtaTIB" ,"MPV_Vs_EtaTIB" , 50, -3.0, 3.0, 300, 0, 600); TH2D* MPV_Vs_EtaTID = new TH2D("MPV_Vs_EtaTID" ,"MPV_Vs_EtaTID" , 50, -3.0, 3.0, 300, 0, 600); TH2D* MPV_Vs_EtaTOB = new TH2D("MPV_Vs_EtaTOB" ,"MPV_Vs_EtaTOB" , 50, -3.0, 3.0, 300, 0, 600); TH2D* MPV_Vs_EtaTEC = new TH2D("MPV_Vs_EtaTEC" ,"MPV_Vs_EtaTEC" , 50, -3.0, 3.0, 300, 0, 600); TH2D* MPV_Vs_EtaTEC1 = new TH2D("MPV_Vs_EtaTEC1","MPV_Vs_EtaTEC1", 50, -3.0, 3.0, 300, 0, 600); TH2D* MPV_Vs_EtaTEC2 = new TH2D("MPV_Vs_EtaTEC2","MPV_Vs_EtaTEC2", 50, -3.0, 3.0, 300, 0, 600); TH2D* MPV_Vs_PhiTIB = new TH2D("MPV_Vs_PhiTIB" ,"MPV_Vs_PhiTIB" , 50, -3.4, 3.4, 300, 0, 600); TH2D* MPV_Vs_PhiTID = new TH2D("MPV_Vs_PhiTID" ,"MPV_Vs_PhiTID" , 50, -3.4, 3.4, 300, 0, 600); TH2D* MPV_Vs_PhiTOB = new TH2D("MPV_Vs_PhiTOB" ,"MPV_Vs_PhiTOB" , 50, -3.4, 3.4, 300, 0, 600); TH2D* MPV_Vs_PhiTEC = new TH2D("MPV_Vs_PhiTEC" ,"MPV_Vs_PhiTEC" , 50, -3.4, 3.4, 300, 0, 600); TH2D* MPV_Vs_PhiTEC1 = new TH2D("MPV_Vs_PhiTEC1","MPV_Vs_PhiTEC1", 50, -3.4, 3.4, 300, 0, 600); TH2D* MPV_Vs_PhiTEC2 = new TH2D("MPV_Vs_PhiTEC2","MPV_Vs_PhiTEC2", 50, -3.4, 3.4, 300, 0, 600); TH2D* NoMPV = new TH2D("NoMPV" ,"NoMPV" ,350, -350, 350, 240, 0, 120); TH1D* MPVs = new TH1D("MPVs" ,"MPVs" , 300, 0, 600); TH1D* MPVs320 = new TH1D("MPVs320" ,"MPVs320" , 300, 0, 600); TH1D* MPVs500 = new TH1D("MPVs500" ,"MPVs500" , 300, 0, 600); TH1D* MPVError = new TH1D("MPVError" ,"MPVError" , 150, 0, 150); TH2D* MPVErrorVsMPV = new TH2D("MPVErrorVsMPV" ,"MPVErrorVsMPV" ,300, 0, 600, 150, 0, 150); TH2D* MPVErrorVsEta = new TH2D("MPVErrorVsEta" ,"MPVErrorVsEta" , 50, -3.0, 3.0, 150, 0, 150); TH2D* MPVErrorVsPhi = new TH2D("MPVErrorVsPhi" ,"MPVErrorVsPhi" , 50, -3.4, 3.4, 150, 0, 150); TH2D* MPVErrorVsN = new TH2D("MPVErrorVsN" ,"MPVErrorVsN" ,500, 0,1000, 150, 0, 150); TH1D* ChargeTIB = new TH1D("ChargeTIB" ,"ChargeTIB" , 1000, 0,2000); TH1D* ChargeTID = new TH1D("ChargeTID" ,"ChargeTID" , 1000, 0,2000); TH1D* ChargeTIDP = new TH1D("ChargeTIDP" ,"ChargeTIDP" , 1000, 0,2000); TH1D* ChargeTIDM = new TH1D("ChargeTIDM" ,"ChargeTIDM" , 1000, 0,2000); TH1D* ChargeTOB = new TH1D("ChargeTOB" ,"ChargeTOB" , 1000, 0,2000); TH1D* ChargeTEC = new TH1D("ChargeTEC" ,"ChargeTEC" , 1000, 0,2000); TH1D* ChargeTECP = new TH1D("ChargeTECP" ,"ChargeTECP" , 1000, 0,2000); TH1D* ChargeTECM = new TH1D("ChargeTECM" ,"ChargeTECM" , 1000, 0,2000); TH1D* ChargeTEC1 = new TH1D("ChargeTEC1" ,"ChargeTEC1" , 1000, 0,2000); TH1D* ChargeTEC2 = new TH1D("ChargeTEC2" ,"ChargeTEC2" , 1000, 0,2000); TH1D* ChargeTECP1 = new TH1D("ChargeTECP1" ,"ChargeTECP1" , 1000, 0,2000); TH1D* ChargeTECP2 = new TH1D("ChargeTECP2" ,"ChargeTECP2" , 1000, 0,2000); TH1D* ChargeTECM1 = new TH1D("ChargeTECM1" ,"ChargeTECM1" , 1000, 0,2000); TH1D* ChargeTECM2 = new TH1D("ChargeTECM2" ,"ChargeTECM2" , 1000, 0,2000); TH1D* ChargeAbsTIB = new TH1D("ChargeAbsTIB" ,"ChargeAbsTIB" , 500, 0,2000); TH1D* ChargeAbsTID = new TH1D("ChargeAbsTID" ,"ChargeAbsTID" , 500, 0,2000); TH1D* ChargeAbsTIDP = new TH1D("ChargeAbsTIDP" ,"ChargeAbsTIDP" , 500, 0,2000); TH1D* ChargeAbsTIDM = new TH1D("ChargeAbsTIDM" ,"ChargeAbsTIDM" , 500, 0,2000); TH1D* ChargeAbsTOB = new TH1D("ChargeAbsTOB" ,"ChargeAbsTOB" , 500, 0,2000); TH1D* ChargeAbsTEC = new TH1D("ChargeAbsTEC" ,"ChargeAbsTEC" , 500, 0,2000); TH1D* ChargeAbsTECP = new TH1D("ChargeAbsTECP" ,"ChargeAbsTECP" , 500, 0,2000); TH1D* ChargeAbsTECM = new TH1D("ChargeAbsTECM" ,"ChargeAbsTECM" , 500, 0,2000); TH1D* ChargeAbsTEC1 = new TH1D("ChargeAbsTEC1" ,"ChargeAbsTEC1" , 500, 0,2000); TH1D* ChargeAbsTEC2 = new TH1D("ChargeAbsTEC2" ,"ChargeAbsTEC2" , 500, 0,2000); TH1D* ChargeAbsTECP1 = new TH1D("ChargeAbsTECP1","ChargeAbsTECP1", 500, 0,2000); TH1D* ChargeAbsTECP2 = new TH1D("ChargeAbsTECP2","ChargeAbsTECP2", 500, 0,2000); TH1D* ChargeAbsTECM1 = new TH1D("ChargeAbsTECM1","ChargeAbsTECM1", 500, 0,2000); TH1D* ChargeAbsTECM2 = new TH1D("ChargeAbsTECM2","ChargeAbsTECM2", 500, 0,2000); printf("Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n"); printf("Looping on the Tree :"); int TreeStep = t1->GetEntries()/50;if(TreeStep==0)TreeStep=1; for (unsigned int ientry = 0; ientry < t1->GetEntries(); ientry++) { if(ientry%TreeStep==0){printf(".");fflush(stdout);} t1->GetEntry(ientry); TH1D* Proj = ChargeDistrib ->ProjectionY("proj" ,tree_Index, tree_Index); TH1D* ProjAbsolute = ChargeDistribA->ProjectionY("projA",tree_Index, tree_Index); if(tree_SubDet==3 ) MPV_Vs_EtaTIB ->Fill(tree_Eta,tree_FitMPV); if(tree_SubDet==4 ) MPV_Vs_EtaTID ->Fill(tree_Eta,tree_FitMPV); if(tree_SubDet==5 ) MPV_Vs_EtaTOB ->Fill(tree_Eta,tree_FitMPV); if(tree_SubDet==6 ) MPV_Vs_EtaTEC ->Fill(tree_Eta,tree_FitMPV); if(tree_SubDet==6 && tree_Thickness<0.04) MPV_Vs_EtaTEC1->Fill(tree_Eta,tree_FitMPV); if(tree_SubDet==6 && tree_Thickness>0.04) MPV_Vs_EtaTEC2->Fill(tree_Eta,tree_FitMPV); if(tree_SubDet==3 ) MPV_Vs_PhiTIB ->Fill(tree_Phi,tree_FitMPV); if(tree_SubDet==4 ) MPV_Vs_PhiTID ->Fill(tree_Phi,tree_FitMPV); if(tree_SubDet==5 ) MPV_Vs_PhiTOB ->Fill(tree_Phi,tree_FitMPV); if(tree_SubDet==6 ) MPV_Vs_PhiTEC ->Fill(tree_Phi,tree_FitMPV); if(tree_SubDet==6 && tree_Thickness<0.04) MPV_Vs_PhiTEC1->Fill(tree_Phi,tree_FitMPV); if(tree_SubDet==6 && tree_Thickness>0.04) MPV_Vs_PhiTEC2->Fill(tree_Phi,tree_FitMPV); MPVs ->Fill( tree_FitMPV); if( tree_Thickness<0.04) MPVs320 ->Fill( tree_FitMPV); if( tree_Thickness>0.04) MPVs500 ->Fill( tree_FitMPV); if(tree_FitMPV<0 ) NoMPV ->Fill(tree_z ,tree_R); MPVError ->Fill( tree_FitMPVErr); MPVErrorVsMPV ->Fill(tree_FitMPV,tree_FitMPVErr); MPVErrorVsEta ->Fill(tree_Eta,tree_FitMPVErr); MPVErrorVsPhi ->Fill(tree_Phi,tree_FitMPVErr); MPVErrorVsN ->Fill(tree_NEntries,tree_FitMPVErr); if(tree_SubDet==3 ) ChargeTIB ->Add(Proj,1); if(tree_SubDet==4 ) ChargeTID ->Add(Proj,1); if(tree_SubDet==4 && tree_Eta<0 ) ChargeTIDM ->Add(Proj,1); if(tree_SubDet==4 && tree_Eta>0 ) ChargeTIDP ->Add(Proj,1); if(tree_SubDet==5 ) ChargeTOB ->Add(Proj,1); if(tree_SubDet==6 ) ChargeTEC ->Add(Proj,1); if(tree_SubDet==6 && tree_Thickness<0.04) ChargeTEC1 ->Add(Proj,1); if(tree_SubDet==6 && tree_Thickness>0.04) ChargeTEC2 ->Add(Proj,1); if(tree_SubDet==6 && tree_Eta<0 ) ChargeTECP ->Add(Proj,1); if(tree_SubDet==6 && tree_Eta>0 ) ChargeTECM ->Add(Proj,1); if(tree_SubDet==6 && tree_Eta<0 && tree_Thickness<0.04) ChargeTECM1 ->Add(Proj,1); if(tree_SubDet==6 && tree_Eta<0 && tree_Thickness>0.04) ChargeTECM2 ->Add(Proj,1); if(tree_SubDet==6 && tree_Eta>0 && tree_Thickness<0.04) ChargeTECP1 ->Add(Proj,1); if(tree_SubDet==6 && tree_Eta>0 && tree_Thickness>0.04) ChargeTECP2 ->Add(Proj,1); if(tree_SubDet==3 ) ChargeAbsTIB ->Add(ProjAbsolute,1); if(tree_SubDet==4 ) ChargeAbsTID ->Add(ProjAbsolute,1); if(tree_SubDet==4 && tree_Eta<0 ) ChargeAbsTIDM ->Add(ProjAbsolute,1); if(tree_SubDet==4 && tree_Eta>0 ) ChargeAbsTIDP ->Add(ProjAbsolute,1); if(tree_SubDet==5 ) ChargeAbsTOB ->Add(ProjAbsolute,1); if(tree_SubDet==6 ) ChargeAbsTEC ->Add(ProjAbsolute,1); if(tree_SubDet==6 && tree_Thickness<0.04) ChargeAbsTEC1 ->Add(ProjAbsolute,1); if(tree_SubDet==6 && tree_Thickness>0.04) ChargeAbsTEC2 ->Add(ProjAbsolute,1); if(tree_SubDet==6 && tree_Eta<0 ) ChargeAbsTECP ->Add(ProjAbsolute,1); if(tree_SubDet==6 && tree_Eta>0 ) ChargeAbsTECM ->Add(ProjAbsolute,1); if(tree_SubDet==6 && tree_Eta<0 && tree_Thickness<0.04) ChargeAbsTECM1 ->Add(ProjAbsolute,1); if(tree_SubDet==6 && tree_Eta<0 && tree_Thickness>0.04) ChargeAbsTECM2 ->Add(ProjAbsolute,1); if(tree_SubDet==6 && tree_Eta>0 && tree_Thickness<0.04) ChargeAbsTECP1 ->Add(ProjAbsolute,1); if(tree_SubDet==6 && tree_Eta>0 && tree_Thickness>0.04) ChargeAbsTECP2 ->Add(ProjAbsolute,1); delete Proj; delete ProjAbsolute; }printf("\n"); TCanvas* c1; TObject** Histos = new TObject*[10]; std::vector<char*> legend; c1 = new TCanvas("c1","c1,",600,600); legend.clear(); Histos[0] = MPV_Vs_EtaTEC; legend.push_back("TEC"); Histos[1] = MPV_Vs_EtaTIB; legend.push_back("TIB"); Histos[2] = MPV_Vs_EtaTID; legend.push_back("TID"); Histos[3] = MPV_Vs_EtaTOB; legend.push_back("TOB"); DrawTH2D((TH2D**)Histos,legend, "", "module #eta", "MPV (ADC/mm)", -3.0,3.0, 0,500); DrawLegend (Histos,legend,"","P"); DrawStatBox(Histos,legend,false); SaveCanvas(c1,"Pictures/MPV_Vs_EtaSubDet"); delete c1; c1 = new TCanvas("c1","c1,",600,600); legend.clear(); Histos[0] = MPV_Vs_PhiTEC; legend.push_back("TEC"); Histos[1] = MPV_Vs_PhiTIB; legend.push_back("TIB"); Histos[2] = MPV_Vs_PhiTID; legend.push_back("TID"); Histos[3] = MPV_Vs_PhiTOB; legend.push_back("TOB"); DrawTH2D((TH2D**)Histos,legend, "", "module #phi", "MPV (ADC/mm)", -3.4,3.4, 0,500); DrawLegend(Histos,legend,"","P"); DrawStatBox(Histos,legend,false); SaveCanvas(c1,"Pictures/MPV_Vs_PhiSubDet"); delete c1; c1 = new TCanvas("c1","c1,",600,600); legend.clear(); Histos[0] = NoMPV; legend.push_back("NoMPV"); DrawTH2D((TH2D**)Histos,legend, "", "z (cm)", "R (cms)", 0,0, 0,0); SaveCanvas(c1,"Pictures/NoMPV", true); delete c1; c1 = new TCanvas("c1","c1,",600,600); legend.clear(); ChargeDistrib->GetXaxis()->SetNdivisions(5+500); Histos[0] = ChargeDistrib; legend.push_back("Charge Vs Index"); //DrawTH2D((TH2D**)Histos,legend, "COLZ", "APV Index", "Charge (ADC/mm)", 0,0, 0,0); //c1->SetLogz(true); //SaveCanvas(c1,"Pictures/Charge", true); delete c1; c1 = new TCanvas("c1","c1,",600,600); legend.clear(); Histos[0] = MPVs320; legend.push_back("320 #mum"); Histos[1] = MPVs500; legend.push_back("500 #mum"); Histos[2] = MPVs; legend.push_back("320 + 500 #mum"); DrawSuperposedHistos((TH1D**)Histos, legend, "", "MPV (ADC/mm)", "#APVs", 0,500, 0,0); DrawLegend(Histos,legend,"","L"); DrawStatBox(Histos,legend,true); SaveCanvas(c1,"Pictures/MPVs"); delete c1; c1 = new TCanvas("c1","c1,",600,600); legend.clear(); Histos[0] = MPVError; legend.push_back("MPV Error"); DrawSuperposedHistos((TH1D**)Histos, legend, "", "Error on MPV (ADC/mm)", "#APVs", 0,500, 0,0); DrawStatBox(Histos,legend,true); c1->SetLogy(true); SaveCanvas(c1,"Pictures/Error"); delete c1; c1 = new TCanvas("c1","c1,",600,600); legend.clear(); Histos[0] = MPVErrorVsMPV; legend.push_back("Error Vs MPV"); DrawTH2D((TH2D**)Histos,legend, "COLZ", "MPV (ADC/mm)", "Error on MPV (ADC/mm)", 0,0, 0,0); c1->SetLogz(true); SaveCanvas(c1,"Pictures/Error_Vs_MPV", true); delete c1; c1 = new TCanvas("c1","c1,",600,600); legend.clear(); Histos[0] = MPVErrorVsEta; legend.push_back("Error Vs Eta"); DrawTH2D((TH2D**)Histos,legend, "COLZ", "module #eta", "Error on MPV (ADC/mm)", 0,0, 0,0); c1->SetLogz(true); SaveCanvas(c1,"Pictures/Error_Vs_Eta", true); delete c1; c1 = new TCanvas("c1","c1,",600,600); legend.clear(); Histos[0] = MPVErrorVsPhi; legend.push_back("Error Vs Phi"); DrawTH2D((TH2D**)Histos,legend, "COLZ", "module #phi", "Error on MPV (ADC/mm)", 0,0, 0,0); c1->SetLogz(true); SaveCanvas(c1,"Pictures/Error_Vs_Phi", true); delete c1; c1 = new TCanvas("c1","c1,",600,600); legend.clear(); Histos[0] = MPVErrorVsN; legend.push_back("Error Vs Entries"); DrawTH2D((TH2D**)Histos,legend, "COLZ", "Number of Entries", "Error on MPV (ADC/mm)", 0,0, 0,0); c1->SetLogz(true); SaveCanvas(c1,"Pictures/Error_Vs_N", true); delete c1; c1 = new TCanvas("c1","c1,",600,600); legend.clear(); Histos[0] = ChargeTEC; legend.push_back("TEC"); Histos[1] = ChargeTIB; legend.push_back("TIB"); Histos[2] = ChargeTID; legend.push_back("TID"); Histos[3] = ChargeTOB; legend.push_back("TOB"); DrawSuperposedHistos((TH1D**)Histos, legend, "", "Charge (ADC/mm)", "#clusters", 0,800 , 0,0); DrawLegend(Histos,legend,"","L"); DrawStatBox(Histos,legend,true, 0.6, 0.7); SaveCanvas(c1,"Pictures/Charge"); delete c1; c1 = new TCanvas("c1","c1,",600,600); legend.clear(); Histos[0] = ChargeTECP; legend.push_back("TEC+"); Histos[1] = ChargeTECM; legend.push_back("TEC-"); DrawSuperposedHistos((TH1D**)Histos, legend, "", "Charge (ADC/mm)", "#clusters", 0,800 , 0,0); DrawLegend(Histos,legend,"","L"); DrawStatBox(Histos,legend,true, 0.6, 0.7); SaveCanvas(c1,"Pictures/ChargeTECSide"); delete c1; c1 = new TCanvas("c1","c1,",600,600); legend.clear(); Histos[0] = ChargeTEC1; legend.push_back("TEC Thin"); Histos[1] = ChargeTEC2; legend.push_back("TEC Thick"); DrawSuperposedHistos((TH1D**)Histos, legend, "", "Charge (ADC/mm)", "#clusters", 0,800 , 0,0); DrawLegend(Histos,legend,"","L"); DrawStatBox(Histos,legend,true, 0.6, 0.7); SaveCanvas(c1,"Pictures/ChargeTECThickness"); delete c1; c1 = new TCanvas("c1","c1,",600,600); legend.clear(); Histos[0] = ChargeTIDP; legend.push_back("TID+"); Histos[1] = ChargeTIDM; legend.push_back("TID-"); DrawSuperposedHistos((TH1D**)Histos, legend, "", "Charge (ADC/mm)", "#clusters", 0,800 , 0,0); DrawLegend(Histos,legend,"","L"); DrawStatBox(Histos,legend,true, 0.6, 0.7); SaveCanvas(c1,"Pictures/ChargeTIDSide"); delete c1; c1 = new TCanvas("c1","c1,",600,600); legend.clear(); Histos[0] = ChargeAbsTEC; legend.push_back("TEC"); Histos[1] = ChargeAbsTIB; legend.push_back("TIB"); Histos[2] = ChargeAbsTID; legend.push_back("TID"); Histos[3] = ChargeAbsTOB; legend.push_back("TOB"); DrawSuperposedHistos((TH1D**)Histos, legend, "", "Charge (ADC)", "#clusters", 0,800 , 0,0); DrawLegend(Histos,legend,"","L"); DrawStatBox(Histos,legend,true, 0.6, 0.7); SaveCanvas(c1,"Pictures/ChargeAbs"); delete c1; c1 = new TCanvas("c1","c1,",600,600); legend.clear(); Histos[0] = ChargeAbsTECP; legend.push_back("TEC+"); Histos[1] = ChargeAbsTECM; legend.push_back("TEC-"); DrawSuperposedHistos((TH1D**)Histos, legend, "", "Charge (ADC)", "#clusters", 0,800 , 0,0); DrawLegend(Histos,legend,"","L"); DrawStatBox(Histos,legend,true, 0.6, 0.7); SaveCanvas(c1,"Pictures/ChargeAbsTECSide"); delete c1; c1 = new TCanvas("c1","c1,",600,600); legend.clear(); Histos[0] = ChargeAbsTEC1; legend.push_back("TEC Thin"); Histos[1] = ChargeAbsTEC2; legend.push_back("TEC Thick"); DrawSuperposedHistos((TH1D**)Histos, legend, "", "Charge (ADC)", "#clusters", 0,800 , 0,0); DrawLegend(Histos,legend,"","L"); DrawStatBox(Histos,legend,true, 0.6, 0.7); SaveCanvas(c1,"Pictures/ChargeAbsTECThickness"); delete c1; c1 = new TCanvas("c1","c1,",600,600); legend.clear(); Histos[0] = ChargeAbsTIDP; legend.push_back("TID+"); Histos[1] = ChargeAbsTIDM; legend.push_back("TID-"); DrawSuperposedHistos((TH1D**)Histos, legend, "", "Charge (ADC)", "#clusters", 0,800 , 0,0); DrawLegend(Histos,legend,"","L"); DrawStatBox(Histos,legend,true, 0.6, 0.7); SaveCanvas(c1,"Pictures/ChargeAbsTIDSide"); delete c1; c1 = new TCanvas("c1","c1,",600,600); legend.clear(); Histos[0] = MPV_Vs_PathlengthThin; legend.push_back("320 #mum"); Histos[1] = MPV_Vs_PathlengthThick; legend.push_back("500 #mum"); DrawSuperposedHistos((TH1D**)Histos, legend, "HIST", "pathlength (mm)", "MPV (ADC/mm)", 0,0 , 230,380); DrawLegend(Histos,legend,"","L"); SaveCanvas(c1,"Pictures/MPV_Vs_Path"); delete c1; c1 = new TCanvas("c1","c1,",600,600); legend.clear(); Histos[0] = MPV_Vs_PathlengthTIB; legend.push_back("TIB (320 #mum)"); Histos[1] = MPV_Vs_PathlengthTID; legend.push_back("TID (320 #mum)"); Histos[2] = MPV_Vs_PathlengthTOB; legend.push_back("TOB (500 #mum)"); Histos[3] = MPV_Vs_PathlengthTEC1; legend.push_back("TEC (320 #mum)"); Histos[4] = MPV_Vs_PathlengthTEC2; legend.push_back("TEC (500 #mum)"); DrawSuperposedHistos((TH1D**)Histos, legend, "HIST", "pathlength (mm)", "MPV (ADC/mm)", 0,0 , 230,380); DrawLegend(Histos,legend,"","L"); SaveCanvas(c1,"Pictures/MPV_Vs_PathSubDet"); delete c1; }
// ______________________________________________________________________________________ void plotVsEta_nice(const Char_t* name = "ratioVsEta") { gROOT->LoadMacro("include/toolsEtaNice.C++"); SetupStyle(); SetGlobals(); // ----------------------------------------------------- TFile *inFiles[nEtaSets][nDataSets][nMoments]; TGraphErrors *graphs[nEtaSets][nDataSets][nMoments]; for (int idxEta = 0 ; idxEta < nEtaSets; ++idxEta) for (int idxDataSet = 0 ; idxDataSet < nDataSets; ++idxDataSet) for (int idxMoment = 0 ; idxMoment < nMoments; ++idxMoment) { inFiles[idxEta][idxDataSet][idxMoment] = TFile::Open(Form("output/%s/%s/Moments_%s.root", aEtaSets[idxEta], aDataSets[idxDataSet], aMoments[idxMoment])); graphs[idxEta][idxDataSet][idxMoment] = static_cast<TGraphErrors*>((inFiles[idxEta][idxDataSet][idxMoment]->Get(aMoments[idxMoment]))->Clone()); if (inFiles[idxEta][idxDataSet][idxMoment]) (inFiles[idxEta][idxDataSet][idxMoment])->Close(); } // ----------------------------------------------------- TLegend *legRat[nDataSets]; for (int idxDataSet = 0 ; idxDataSet < nDataSets; ++idxDataSet) { legRat[idxDataSet] = new TLegend(0.14, 0.12, 0.78, 0.27); legRat[idxDataSet]->SetTextAlign(12); legRat[idxDataSet]->SetTextSize(0.06); legRat[idxDataSet]->SetFillColor(1182); legRat[idxDataSet]->SetLineColor(0); legRat[idxDataSet]->SetBorderSize(0); legRat[idxDataSet]->SetNColumns(3); } // ----------------------------------------------------- TGraphErrors *etaGraphs[9][nEtaSuperSets][nDataSets][nMoments]; for (int idxCent = 0; idxCent < nCent; idxCent++) { for (int idxDataSet = 0 ; idxDataSet < nDataSets; ++idxDataSet) { for (int idxMoment = 4 ; idxMoment < nMoments; ++idxMoment) { int idxEta = -1; for (int idxEtaSuper = 0 ; idxEtaSuper < nEtaSuperSets; ++idxEtaSuper) { float x[aEtaSuperSets[idxEtaSuper]]; float y[aEtaSuperSets[idxEtaSuper]]; float ex[aEtaSuperSets[idxEtaSuper]]; float ey[aEtaSuperSets[idxEtaSuper]]; for (int idxEtaSub = 0 ; idxEtaSub < aEtaSuperSets[idxEtaSuper]; ++idxEtaSub) { ++idxEta; x[idxEtaSub] = aEtaSetBinCenter[idxEta]; ex[idxEtaSub] = aEtaSetBinWidth[idxEta]/2.; y[idxEtaSub] = graphs[idxEta][idxDataSet][idxMoment]->GetY()[idxCent]; ey[idxEtaSub] = graphs[idxEta][idxDataSet][idxMoment]->GetEY()[idxCent]; } // for (int idxEtaSub = 0 ; idxEtaSub < aEtaSuperSets[idxEtaSuper]; ++idxEtaSub) { etaGraphs[idxCent][idxEtaSuper][idxDataSet][idxMoment] = new TGraphErrors(aEtaSuperSets[idxEtaSuper], x, y, ex, ey); PrepareGraph(etaGraphs[idxCent][idxEtaSuper][idxDataSet][idxMoment]); } // for (int idxEtaSuper = 0 ; idxEtaSuper < nEtaSuperSets; ++idxEtaSuper) { } // for (int idxMoment = 0 ; idxMoment < nMoments; ++idxMoment) { } // for (int idxDataSet = 0 ; idxDataSet < nDataSets; ++idxDataSet) { } // for (int idxCent = 0; idxCent < 9; idxCent++) { // ----------------------------------------------------- for (int idxCent = 0; idxCent < 1; idxCent++) { for (int idxDataSet = 0 ; idxDataSet < nDataSets; ++idxDataSet) { TPad *pad = SetupCanvas(Form("canEta_Ratio_%s_%s", aDataSets[idxDataSet], cent[idxCent]), aDataSetsTitle[idxDataSet], "#eta", 0.45); for (int idxEtaSuper = 0 ; idxEtaSuper < nEtaSuperSets; ++idxEtaSuper) { if (idxEtaSuper == 1 || idxEtaSuper == 3 || idxEtaSuper == 5 || idxEtaSuper == 7 || idxEtaSuper == 8 ) continue; for (int idxMoment = 4 ; idxMoment < nMoments; ++idxMoment) { pad->cd(idxMoment-3); TGraphErrors *g = etaGraphs[idxCent][idxEtaSuper][idxDataSet][idxMoment]; // if (idxCent == 0) // ShiftGraphX(g, -0.015); // else if (idxCent == 1) // ShiftGraphX(g, -0.005); // else if (idxCent == 4) // ShiftGraphX(g, 0.005); // else if (idxCent == 8) // ShiftGraphX(g, 0.015); ConfigGraph(g, idxMoment, idxEtaSuper); if (idxEtaSuper == 0) { g->Draw("AP"); TLine *line05 = new TLine( 0.5, aMinY[idxMoment], 0.5, aMaxY[idxMoment]); line05->SetLineColor(kGray+1); line05->SetLineStyle(3); line05->Draw(); TLine *line50 = new TLine(-0.5, aMinY[idxMoment], -0.5, aMaxY[idxMoment]); line50->SetLineColor(kGray+1); line50->SetLineStyle(3); line50->Draw(); TLine *line00 = new TLine(0., aMinY[idxMoment],0, aMaxY[idxMoment]); line00->SetLineColor(kGray+1); line00->SetLineStyle(3); line00->Draw(); if (idxMoment == 5) { // TLine *line0 = new TLine(aMinX, 0, aMaxX, 0); // line0->SetLineColor(kGray+1); // line0->SetLineStyle(2); // line0->SetLineWidth(2); // line0->Draw(); } else if (idxMoment == 6) { TLine *line1 = new TLine(aMinX, 1, aMaxX, 1); line1->SetLineColor(kGray+1); line1->SetLineStyle(2); line1->SetLineWidth(2); line1->Draw(); } } g->Draw("PSAME"); } // for (int idxMoment = 0 ; idxMoment < nMoments; ++idxMoment) { if (idxCent == 0) { legRat[idxDataSet]->AddEntry(etaGraphs[0][idxEtaSuper][idxDataSet][4], Form("#Delta#eta = %.1f", aEtaSuperSetsBinWidth[idxEtaSuper]), "pl"); } } // for (int idxEta = 0 ; idxEta < nEta; ++idxEta) { TLine *linex = new TLine(-0.55, 1, 0.55, 1); linex->SetLineColor(kGray+1); linex->SetLineStyle(2); linex->SetLineWidth(2); legRat[idxDataSet]->AddEntry(linex, "Poisson", "l"); pad->cd(1); TLatex *texb_3 = new TLatex(-0.49, 9.3, "Au+Au collisions #sqrt{#it{s}_{NN}} = 14.5 GeV"); texb_3->SetTextSize(0.07); texb_3->Draw("same"); TLatex *texb_3a = new TLatex(-0.49,8.9, "Net-Charge, 0.2 < #it{p}_{T} (GeV/#it{c}) < 2.0, 0-5%"); texb_3a->SetTextSize(0.07); texb_3a->Draw("same"); pad->cd(2); TLatex *texb_3b = new TLatex(0.49,0.42, "statistical errors only"); texb_3b->SetTextSize(0.06); texb_3b->SetTextAlign(31); texb_3b->Draw("same"); TLatex *texb_3c = new TLatex(0.49,0.38, "horizontal error: #Delta#eta width"); texb_3c->SetTextSize(0.06); texb_3c->SetTextAlign(31); texb_3c->Draw("same"); TLatex *texb_4 = new TLatex(-0.49, 0.42, "STAR Preliminary"); texb_4->SetTextSize(0.07); texb_4->Draw("same"); pad->cd(3); legRat[idxDataSet]->Draw("lt"); pad->Modified(); } // for (int idxDataSet = 0 ; idxDataSet < nDataSets; ++idxDataSet) { } // for (int idxCent = 0; idxCent < 9; idxCent++) { // ----------------------------------------------------- SaveCanvas(name); }
//--------------------------------------------------------------------------- void __fastcall TFMain_11011981::lbUnitItemsDrawItem(TWinControl *Control, int Index, TRect &Rect, TOwnerDrawState State) { int flags; TColor _color; TListBox *lb; TCanvas *canvas; String text, str; lb = (TListBox*)Control; canvas = lb->Canvas; SaveCanvas(canvas); if (Index < lb->Count) { flags = Control->DrawTextBiDiModeFlags(DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX); if (!Control->UseRightToLeftAlignment()) Rect.Left += 2; else Rect.Right -= 2; canvas->FillRect(Rect); text = lb->Items->Strings[Index]; //lb->ItemHeight = canvas->TextHeight(text); str = text.SubString(2, text.Length() - 1); //Procs with Xrefs if (text[1] & 6) { //Xrefs from user units if (text[1] & 4) { if (!State.Contains(odSelected)) _color = TColor(0x00B000); //Green else _color = TColor(0xBBBBBB); //LightGray } //No Xrefs from user units, only from KB units else { if (!State.Contains(odSelected)) _color = TColor(0xC08000); //Blue else _color = TColor(0xBBBBBB); //LightGray } } //Unresolved items else if (text[1] & 1) { if (!State.Contains(odSelected)) _color = TColor(0x8080FF); //Red else _color = TColor(0xBBBBBB); //LightGray } //Other else { if (!State.Contains(odSelected)) _color = TColor(0); //Black else _color = TColor(0xBBBBBB); //LightGray } Rect.Right = Rect.Left; DrawOneItem(str, canvas, Rect, _color, flags); } RestoreCanvas(canvas); }
void compareRndYields(int analysisIs2D=1, TString conf="defaultAdHoc", int iBr=0, int doSave=0, TString *figName=NULL, TString *dirName=NULL) { if (!DYTools::setup(analysisIs2D)) { std::cout << "failed to initialize the analysis\n"; return; } //-------------------------------------------------------------------------------------------------------------- // Settings //============================================================================================================== int totalErr=1; int loadSyst=1; int the_set=0; std::vector<TString> pathV; std::vector<TString> fnameV; std::vector<TString> fieldV; std::vector<TString> labelV; TString canvasSaveName, canvasSaveDir; std::vector<HistoPair2D_t*> csV; double set_ratio_y[2]; double transLegendX=(DYTools::study2D==1) ? -0.42 : -0.2; double transLegendY=0.; set_ratio_y[0]=1.00; set_ratio_y[1]=1.00; InputFileMgr_t inpMgr; if (!inpMgr.Load(conf)) return; DYTools::TRunMode_t runMode= DYTools::NORMAL_RUN; DYTools::TSystematicsStudy_t systModeRef, systMode1, systMode2, systModeV; systModeRef=DYTools::APPLY_ESCALE; systMode1 =DYTools::SYST_MODE_FAILURE; systMode2 =DYTools::SYST_MODE_FAILURE; systModeV =DYTools::SYST_MODE_FAILURE; int seedMin=inpMgr.userKeyValueAsInt("SEEDMIN"); int seedMax=inpMgr.userKeyValueAsInt("SEEDMAX"); int dSeed=1; unsigned int idxRndVec=(unsigned int)(-1); //-------------------------------------------------------------------------------------------------------------- // Define branches //============================================================================================================== TString extraTag; TString plotExtraTag; if ((iBr==0) || (iBr==1)) { // added on 2014.04.12 if (iBr==1) { seedMin=-111; seedMax= 111; dSeed= 222; } loadSyst=0; prepare(2,pathV,fnameV,fieldV,labelV); // Construct eventSelector, update mgr and plot directory systModeRef=DYTools::APPLY_ESCALE; EventSelector_t evtSelector1(inpMgr,runMode,systModeRef, extraTag, plotExtraTag, EventSelector::_selectDefault); pathV [0]=""; fnameV[0]=inpMgr.yieldFullFileName(-1,systModeRef,0); fieldV[0]="yields/hYield_data"; labelV[0]="Data with peak corr."; systMode1=DYTools::ESCALE_DIFF_0000; EventSelector_t evtSelector2(inpMgr,runMode,systMode1, extraTag, plotExtraTag, EventSelector::_selectDefault); pathV [1]=""; fnameV[1]=inpMgr.yieldFullFileName(-1,systMode1,0); fieldV[1]="yields/hYield_data"; labelV[1]="Data (regressed)"; prepare(int((seedMax-seedMin)/dSeed),pathV,fnameV,fieldV,labelV,0,0); systModeV=DYTools::ESCALE_STUDY_RND; idxRndVec=pathV.size(); for (int iseed=seedMin; iseed<=seedMax; iseed+=dSeed) { //if ((1 || (dSeed==1)) && (iseed-seedMin>79)) break; //if (iseed-seedMin>2) break; InputFileMgr_t inpMgrRnd(inpMgr); inpMgrRnd.editEnergyScaleTag().Append(Form("_RANDOMIZED%d",iseed)); EventSelector_t evtSelector3(inpMgrRnd,runMode,systModeV, extraTag, plotExtraTag, EventSelector::_selectDefault); pathV.push_back(""); fnameV.push_back(inpMgrRnd.yieldFullFileName(-1,systModeV,0)); fieldV.push_back("yields/hYield_data"); labelV.push_back(Form("Data rnd%d",iseed)); } transLegendX=(DYTools::study2D==1) ? -0.42 : -0.1; } //-------------------------------------------------------------------------------------------------------------- // Main analysis code //============================================================================================================== /* { canvasSaveName="fig-puStudy-"; canvasSaveDir="plots-puStudy"; transLegendX=(DYTools::study2D==1) ? -0.35 : -0.1; transLegendY=(DYTools::study2D==1) ? -0.55 : -0.0; set_ratio_y[0]=(DYTools::study2D==1) ? 0.9 : 0.96; set_ratio_y[1]=(DYTools::study2D==1) ? 1.1 : 1.04; } */ if (DYTools::study2D) { for (unsigned int i=0; i<fnameV.size(); ++i) { fnameV[i].ReplaceAll("preFsr_1D","preFsrDet_2D"); } } if (!loadHistoPairV(pathV,fnameV,fieldV,labelV, csV, loadSyst)) { std::cout << "failed to load data\n"; return; } std::vector<TH2D*> histoV; if (!convertHistoPairVec2HistoVec(csV, histoV, totalErr)) { std::cout << "failed to prepare histos\n"; return; } std::vector<ComparisonPlot_t*> cpV; std::vector<std::vector<TH1D*>*> hProfV; int delayDraw=1; TCanvas *cx=plotProfiles("cx",histoV,labelV,NULL,0,"observed yield counts", &hProfV, &cpV,delayDraw); if (!cx) { std::cout << "failed to create canvas with profiles\n"; return; } if (iBr==1) { // shift the notation HERE("shift the notation\n"); for (unsigned int ic=0; ic<cpV.size(); ++ic) { if (DYTools::study2D==0) cpV[ic]->SetLogy(1); TH1D* h1=cpV[ic]->GetHisto(0); h1->SetMarkerStyle(24); h1->SetMarkerColor(kBlue); h1->SetLineColor(kBlue); h1->SetLineStyle(2); TH1D* h2=cpV[ic]->GetHisto(1); h2->SetMarkerStyle(5); h2->SetMarkerColor(kGreen+1); h2->SetMarkerSize(1.5); h2->SetLineStyle(1); h2->SetLineColor(kGreen+1); TH1D* h3=cpV[ic]->GetHisto(2); h3->SetMarkerStyle(3); h3->SetMarkerColor(kOrange+1); h3->SetMarkerSize(1.5); h3->SetLineStyle(3); h3->SetLineColor(kOrange+1); TH1D* h4=cpV[ic]->GetHisto(3); h4->SetMarkerStyle(2); h4->SetMarkerColor(kRed); h4->SetLineStyle(2); h4->SetLineColor(kRed); } } for (unsigned int ic=0; ic<cpV.size(); ++ic) { ComparisonPlot_t *cp=cpV[ic]; cp->TransLegend(transLegendX,transLegendY); cp->SetRatioYRange(set_ratio_y[0], set_ratio_y[1]); if (DYTools::study2D) cp->Draw6(cx,1,ic+1); else cp->Draw(cx); } cx->Update(); // plot count dirstributions of a mass bin if (0 && (DYTools::study2D==0)) { std::cout << "hProfV.size()=" << hProfV.size() << "\n"; std::vector<TH1D*> hMassV; std::vector<TString> massStrV; massStrV.reserve(DYTools::nMassBins); for (int im=0; im<DYTools::nMassBins; ++im) { massStrV.push_back(Form("M_%1.0lf_%1.0lf", DYTools::massBinLimits[im],DYTools::massBinLimits[im+1])); } if (!createAnyH1Vec(hMassV,"hMassProf_",massStrV,200,-1e6,1e6, "yield count","count",1)) return; std::vector<TH1D*> *histos=hProfV[0]; for (int im=14; im<20; im++) { double avg=0.; int count=0; for (unsigned int ii=0; ii<histos->size(); ++ii) { avg+=(*histos)[ii]->GetBinContent(im); count++; } avg/=double(count); for (unsigned int ii=0; ii<histos->size(); ++ii) { hMassV[im]->Fill((*histos)[ii]->GetBinContent(im) - avg); } TString canvName=TString("canvProfAt_") + massStrV[im]; TCanvas *cm=new TCanvas(canvName,canvName,600,600); hMassV[im]->Draw(); cm->Update(); } } TString outName=canvasSaveName + DYTools::analysisTag; if (doSave) { SaveCanvas(cx,outName,canvasSaveDir); } else { std::cout << "would save to <" << outName << "> in <" << canvasSaveDir << ">\n"; } if (figName) *figName= outName; if (dirName) *dirName= canvasSaveDir; // Covariance study if (0) { std::vector<TH2D*> hRndVec; hRndVec.reserve(histoV.size()); for (unsigned int i=idxRndVec; i<histoV.size(); ++i) { hRndVec.push_back(histoV[i]); } int unbiasedEstimate=1; TH2D* avgDistr=createBaseH2("hYieldAvgDistr"); TMatrixD* cov= deriveCovMFromRndStudies(hRndVec,unbiasedEstimate,avgDistr); TMatrixD* corr=corrFromCov(*cov); TCanvas *canvCov= new TCanvas("ccov","ccov",900,900); AdjustFor2DplotWithHeight(canvCov); cov->Draw("COLZ"); canvCov->Update(); TCanvas *canvCorr= new TCanvas("ccorr","ccorr",900,900); AdjustFor2DplotWithHeight(canvCorr); corr->Draw("COLZ"); canvCorr->Update(); } return; }
void Factorization_eta_vn() { const int nfiles = 16; TString filename[nfiles]; double v2HF = 7.26962328031520721e-02; filename[0] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg033_ptassallweight_etaass45_eff0_v24.root"); filename[1] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg033_ptassallweight_etaass45_eff0_v24.root"); filename[2] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg033_ptassallweight_etaass45_eff0_v24.root"); filename[3] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg033_ptassallweight_etaass45_eff0_v24.root"); filename[4] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[5] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg033_ptassallweight_etaass45_eff0_v24.root"); filename[6] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg033_ptassallweight_etaass45_eff0_v24.root"); filename[7] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg033_ptassallweight_etaass45_eff1_v24.root"); filename[8] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg033_ptassallweight_etaass34_eff0_v24.root"); filename[9] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg033_ptassallweight_etaass34_eff0_v24.root"); filename[10] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg033_ptassallweight_etaass34_eff0_v24.root"); filename[11] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg033_ptassallweight_etaass34_eff0_v24.root"); filename[12] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg033_ptassallweight_etaass34_eff0_v24.root"); filename[13] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg033_ptassallweight_etaass34_eff0_v24.root"); filename[14] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg033_ptassallweight_etaass34_eff0_v24.root"); filename[15] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg033_ptassallweight_etaass34_eff0_v24.root"); /* filename[8] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[9] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[10] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[11] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[12] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[13] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[14] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[15] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg053_ptassallweight_etaass45_eff0_v18.root"); */ const int ntrgbins = 20; const int ntrgbins1 = ntrgbins; const int ntrgbins2 = ntrgbins/2; TGraphErrors* gr_v2[nfiles][6]; TGraphErrors* gr[nfiles][6]; TGraphErrors* gr0[nfiles][6]; TGraphErrors* gr1[nfiles][6]; TGraphErrors* gr_ratio[nfiles][6]; TGraph* gr_band[nfiles][6]; TGraph* gr1_band[nfiles][6]; TF1* fit[nfiles][6]; TF1* fit_aver[nfiles][6]; TF1* fit1_aver[nfiles][6]; double slope[6][nfiles]; double slope_err[6][nfiles]; double slope1[6][nfiles]; double slope1_err[6][nfiles]; double eta[ntrgbins2] = {0.12,0.36,0.6,0.84,1.08,1.32,1.56,1.8,2.04,2.28}; // double eta[ntrgbins2] = {0.1,0.3,0.5,0.7,0.9,1.1,1.3,1.5,1.7,1.9,2.1,2.3}; // double eta[ntrgbins2] = {0.15,0.45,0.75,1.05,1.35,1.65,1.95,2.25}; // double eta[ntrgbins2] = {0.2,0.6,1.0,1.4,1.8,2.2}; double eta_err[ntrgbins2] = {0.0}; Color_t color[6] = {1,kBlue, kBlue, kBlue,1,1}; TFile* fdiff[nfiles]; for(int jj=0;jj<nfiles;jj++) { fdiff[jj] = new TFile(filename[jj].Data()); TH2D* hsignal[ntrgbins]; TH2D* hbackground[ntrgbins]; TH2D* hsignal0[ntrgbins]; TH2D* hbackground0[ntrgbins]; TH2D* hsignal1[ntrgbins]; TH2D* hbackground1[ntrgbins]; TH1D* hsignal_1D[ntrgbins][6]; TH1D* hbackground_1D[ntrgbins][6]; TH1D* hsignal0_1D[ntrgbins][6]; TH1D* hbackground0_1D[ntrgbins][6]; TH1D* hsignal1_1D[ntrgbins][6]; TH1D* hbackground1_1D[ntrgbins][6]; double Vn[ntrgbins1][6]; double VnError[ntrgbins1][6]; double rn[ntrgbins1]; double rn_err[ntrgbins1]; double Vn0[ntrgbins1][6]; double Vn0Error[ntrgbins1][6]; double rn0[ntrgbins2]; double rn0_err[ntrgbins2]; double Vn1[ntrgbins1][6]; double Vn1Error[ntrgbins1][6]; double rn1[ntrgbins2]; double rn1_err[ntrgbins2]; double rn_ratio[ntrgbins2]; double rn_ratio_err[ntrgbins2]; for(int i=0;i<ntrgbins;i++) { hsignal0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfp/signalcosn_trg%d",i)); hbackground0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfp/backgroundcosn_trg%d",i)); hsignal1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfm/signalcosn_trg%d",i)); hbackground1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfm/backgroundcosn_trg%d",i)); hsignal[i] = (TH2D*)hsignal0[i]->Clone(Form("signalcosn_trg%d",i)); hbackground[i] = (TH2D*)hbackground0[i]->Clone(Form("backgroundcosn_trg%d",i)); hsignal[i]->Add(hsignal1[i]); hbackground[i]->Add(hbackground1[i]); for(int nbin=1;nbin<4;nbin++) { hsignal_1D[i][nbin] = (TH1D*)hsignal[i]->ProjectionX(Form("signal_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hsignal0_1D[i][nbin] = (TH1D*)hsignal0[i]->ProjectionX(Form("signal0_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hsignal1_1D[i][nbin] = (TH1D*)hsignal1[i]->ProjectionX(Form("signal1_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground_1D[i][nbin] = (TH1D*)hbackground[i]->ProjectionX(Form("background_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground0_1D[i][nbin] = (TH1D*)hbackground0[i]->ProjectionX(Form("background0_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground1_1D[i][nbin] = (TH1D*)hbackground1[i]->ProjectionX(Form("background1_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); Vn[i][nbin]=hsignal_1D[i][nbin]->GetMean()-hbackground_1D[i][nbin]->GetMean(); VnError[i][nbin]=sqrt(hsignal_1D[i][nbin]->GetMeanError()*hsignal_1D[i][nbin]->GetMeanError()+hbackground_1D[i][nbin]->GetMeanError()*hbackground_1D[i][nbin]->GetMeanError()); Vn0[i][nbin]=hsignal0_1D[i][nbin]->GetMean()-hbackground0_1D[i][nbin]->GetMean(); Vn0Error[i][nbin]=sqrt(hsignal0_1D[i][nbin]->GetMeanError()*hsignal0_1D[i][nbin]->GetMeanError()+hbackground0_1D[i][nbin]->GetMeanError()*hbackground0_1D[i][nbin]->GetMeanError()); Vn1[i][nbin]=hsignal1_1D[i][nbin]->GetMean()-hbackground1_1D[i][nbin]->GetMean(); Vn1Error[i][nbin]=sqrt(hsignal1_1D[i][nbin]->GetMeanError()*hsignal1_1D[i][nbin]->GetMeanError()+hbackground1_1D[i][nbin]->GetMeanError()*hbackground1_1D[i][nbin]->GetMeanError()); Vn[i][nbin]=Vn[i][nbin]/v2HF; VnError[i][nbin]=VnError[i][nbin]/v2HF; if(jj==7 && nbin==1) cout<<"pos nbin="<<nbin<<" i="<<i<<" "<<hsignal0_1D[i][nbin]->GetMean()<<" "<<hbackground0_1D[i][nbin]->GetMean()<<" "<<Vn0[i][nbin]<<endl; if(jj==7 && nbin==1) cout<<"neg nbin="<<nbin<<" i="<<i<<" "<<hsignal1_1D[i][nbin]->GetMean()<<" "<<hbackground1_1D[i][nbin]->GetMean()<<" "<<Vn1[i][nbin]<<endl; delete hsignal_1D[i][nbin]; delete hsignal0_1D[i][nbin]; delete hsignal1_1D[i][nbin]; delete hbackground_1D[i][nbin]; delete hbackground0_1D[i][nbin]; delete hbackground1_1D[i][nbin]; } delete hsignal0[i]; delete hsignal1[i]; delete hsignal[i]; delete hbackground0[i]; delete hbackground1[i]; delete hbackground[i]; } for(int nbin=1;nbin<4;nbin++) { for(int i=0;i<ntrgbins1;i++) { rn[i]=Vn[i][nbin]; rn_err[i]=VnError[i][nbin]; } gr_v2[jj][nbin] = new TGraphErrors(ntrgbins1,eta,rn,eta_err,rn_err); gr_v2[jj][nbin]->SetMarkerColor(color[nbin]); } } TCanvas* c = new TCanvas("c","c",900,500); makeMultiPanelCanvas(c,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmp = new TH2D("htmp",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-2.4,2.4,100,0.0,0.2); fixedFontHist(htmp,1.8,2.2); htmp->GetXaxis()->CenterTitle(); htmp->GetYaxis()->CenterTitle(); htmp->GetYaxis()->SetTitleSize(htmp->GetYaxis()->GetTitleSize()*1.2); htmp->GetXaxis()->SetTitleSize(htmp->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<8;jj++) { c->cd(jj+1); htmp->Draw(); gr_v2[jj][1]->SetMarkerStyle(21); gr_v2[jj][1]->Draw("Psame"); } return; TString histtitle[8] = {"0-0.2%","0-5%","5-10%","10-20%","20-30%","30-40%","40-50%","50-60%"}; TLine* ll = new TLine(0,1.,5.0,1.); TCanvas* c = new TCanvas("c","c",900,500); makeMultiPanelCanvas(c,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmp = new TH2D("htmp",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.1,2.23,100,0.801,1.06); fixedFontHist(htmp,1.8,2.2); htmp->GetXaxis()->CenterTitle(); htmp->GetYaxis()->CenterTitle(); htmp->GetYaxis()->SetTitleSize(htmp->GetYaxis()->GetTitleSize()*1.2); htmp->GetXaxis()->SetTitleSize(htmp->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<8;jj++) { c->cd(jj+1); htmp->Draw(); ll->Draw("Lsame"); gr[jj][1]->SetMarkerStyle(21); gr[jj][1]->Draw("Psame"); fit[jj][1]->Draw("Lsame"); gr[jj+8][1]->SetMarkerStyle(25); // fit[jj+8][1]->SetLineStyle(5); gr[jj+8][1]->Draw("Psame"); // fit[jj+8][1]->Draw("Lsame"); } TLatex* latex2 = new TLatex(); latex2->SetNDC(); latex2->SetTextSize(1.5*latex2->GetTextSize()); c->cd(1); latex2->DrawLatex(0.26,0.05,histtitle[0]); latex2->DrawLatex(0.24,0.865,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); c->cd(2); latex2->DrawLatex(0.08,0.05,histtitle[1]); latex2->DrawLatex(0.07,0.3,"0.3 < p_{T}^{a} < 3 GeV/c"); latex2->DrawLatex(0.07,0.18,"p_{T}^{b} > 0 GeV/c"); c->cd(4); latex2->DrawLatex(0.08,0.05,histtitle[3]); c->cd(3); latex2->DrawLatex(0.08,0.05,histtitle[2]); c->cd(8); latex2->DrawLatex(0.08,0.24,histtitle[7]); c->cd(7); latex2->DrawLatex(0.08,0.24,histtitle[6]); c->cd(6); latex2->SetTextSize(0.96*latex2->GetTextSize()); latex2->DrawLatex(0.08,0.24,histtitle[5]); c->cd(5); latex2->SetTextSize(0.85*latex2->GetTextSize()); latex2->DrawLatex(0.26,0.24,histtitle[4]); TLegend* legend2 = new TLegend(0.24,0.14,0.51,0.38); legend2->SetFillStyle(0); legend2->AddEntry(gr[0][1],"4<#eta^{b}<5","P"); legend2->AddEntry(gr[8][1],"3<#eta^{b}<4","P"); c->cd(1); legend2->Draw("same"); TCanvas* ccaa = new TCanvas("ccaa","ccaa",900,500); makeMultiPanelCanvas(ccaa,4,2,0.01,0.0,0.2,0.2,0.02); for(int jj=0;jj<8;jj++) { ccaa->cd(jj+1); htmp->Draw(); ll->Draw("Lsame"); gr0[jj][1]->SetMarkerStyle(21); gr0[jj][1]->Draw("Psame"); gr1[jj][1]->SetMarkerStyle(25); gr1[jj][1]->Draw("Psame"); } TCanvas* ccbb = new TCanvas("ccbb","ccbb",900,500); makeMultiPanelCanvas(ccbb,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmpaa = new TH2D("htmpaa",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.1,2.23,100,0.97,1.03); for(int jj=0;jj<8;jj++) { ccbb->cd(jj+1); htmpaa->Draw(); ll->Draw("Lsame"); gr_ratio[jj][1]->SetMarkerStyle(21); gr_ratio[jj][1]->Draw("Psame"); } TCanvas* cc = new TCanvas("cc","cc",900,500); makeMultiPanelCanvas(cc,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmp1 = new TH2D("htmp1",";#eta^{a};r_{3}(#eta^{a},#eta^{b})",100,-0.1,2.23,100,0.801,1.06); fixedFontHist(htmp1,1.8,2.2); htmp1->GetXaxis()->CenterTitle(); htmp1->GetYaxis()->CenterTitle(); htmp1->GetYaxis()->SetTitleSize(htmp1->GetYaxis()->GetTitleSize()*1.2); htmp1->GetXaxis()->SetTitleSize(htmp1->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<8;jj++) { cc->cd(jj+1); htmp1->Draw(); ll->Draw("Lsame"); gr[jj][2]->SetMarkerStyle(21); gr[jj][2]->Draw("Psame"); fit[jj][2]->Draw("Lsame"); gr[jj+8][2]->SetMarkerStyle(25); // fit[jj+8][2]->SetLineStyle(5); gr[jj+8][2]->Draw("Psame"); // fit[jj+8][2]->Draw("Lsame"); } TLatex* latex3 = new TLatex(); latex3->SetNDC(); latex3->SetTextSize(1.5*latex3->GetTextSize()); cc->cd(1); latex3->DrawLatex(0.26,0.05,histtitle[0]); latex3->DrawLatex(0.24,0.865,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); cc->cd(2); latex3->DrawLatex(0.08,0.05,histtitle[1]); latex3->DrawLatex(0.07,0.28,"0.3 < p_{T}^{a} < 3 GeV/c"); latex3->DrawLatex(0.07,0.18,"p_{T}^{b} > 0 GeV/c"); cc->cd(4); latex3->DrawLatex(0.08,0.05,histtitle[3]); cc->cd(3); latex3->DrawLatex(0.08,0.05,histtitle[2]); cc->cd(8); latex3->DrawLatex(0.08,0.24,histtitle[7]); cc->cd(7); latex3->DrawLatex(0.08,0.24,histtitle[6]); cc->cd(6); latex3->SetTextSize(0.96*latex3->GetTextSize()); latex3->DrawLatex(0.08,0.24,histtitle[5]); cc->cd(5); latex3->SetTextSize(0.85*latex3->GetTextSize()); latex3->DrawLatex(0.26,0.24,histtitle[4]); TLegend* legend3 = new TLegend(0.24,0.14,0.51,0.38); legend3->SetFillStyle(0); legend3->AddEntry(gr[0][1],"4<#eta^{b}<5","P"); legend3->AddEntry(gr[8][1],"3<#eta^{b}<4","P"); cc->cd(1); legend3->Draw("same"); /* TCanvas* ccc = new TCanvas("ccc","ccc",900,500); makeMultiPanelCanvas(ccc,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmp2 = new TH2D("htmp2",";#eta^{a};r_{4}(#eta^{a},#eta^{b})",100,-0.1,2.23,100,0.801,1.06); fixedFontHist(htmp2,1.8,2.2); htmp2->GetXaxis()->CenterTitle(); htmp2->GetYaxis()->CenterTitle(); htmp2->GetYaxis()->SetTitleSize(htmp2->GetYaxis()->GetTitleSize()*1.2); htmp2->GetXaxis()->SetTitleSize(htmp2->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<8;jj++) { ccc->cd(jj+1); htmp2->Draw(); ll->Draw("Lsame"); gr[jj][3]->Draw("Psame"); fit[jj][3]->Draw("Lsame"); gr[jj+8][3]->Set_arkerStyle(25); fit[jj+8][3]->SetLineStyle(5); gr[jj+8][3]->Draw("Psame"); fit[jj+8][3]->Draw("Lsame"); } */ TCanvas* c1 = new TCanvas("c1","c1",500,500); TH2D* htmp2 = new TH2D("htmp2",";Centrality;C",100,0,1.0,100,0.0,0.06); htmp2->Draw(); htmp2->GetXaxis()->CenterTitle(); htmp2->GetYaxis()->CenterTitle(); gr_slope[1]->SetMarkerColor(1); gr_slope[2]->SetMarkerColor(1); gr_slope[1]->SetMarkerStyle(21); gr_slope[2]->SetMarkerStyle(22); gr_slope[1]->Draw("PESAME"); gr_slope[2]->Draw("PESAME"); gr1_slope[1]->SetMarkerColor(1); gr1_slope[2]->SetMarkerColor(1); gr1_slope[1]->SetMarkerStyle(25); gr1_slope[2]->SetMarkerStyle(26); gr1_slope[1]->Draw("PESAME"); gr1_slope[2]->Draw("PESAME"); TFile* f_slope_out = new TFile("gr_slope_v2v3.root","recreate"); gr_slope[1]->Write(); gr_slope[2]->Write(); gr1_slope[1]->Write(); gr1_slope[2]->Write(); f_slope_out->Close(); return; SaveCanvas(c,"HI/FactBreak","epetadeco_HI_r2"); SaveCanvas(cc,"HI/FactBreak","epetadeco_HI_r3"); SaveCanvas(ccaa,"HI/FactBreak","epetadeco_HI_r2ratio"); // SaveCanvas(c1,"HI/FactBreak","epetadeco_HI_C"); // SaveCanvas(cc2,"HI/FactBreak","epetadeco_HI_cos"); }
void compareEff_EGM(int iBr=0, int iBin=0, int vsEt=1, int doSave=0, double transLegendY_user=0., double ratioTitleOffset=0.58, TString *outFileName_ptr=NULL, TString *outDir_ptr=NULL) { TString path1, path2; TString effKindLongStr1,effKindLongStr2; TString fnameBase="efficiency_TnP_1D_Full2012_"; TString label1; TString label2; TString fnameTag; TString path3=""; TString effKindLongStr3=""; TString label3=""; double transLegendX=-0.2; double transLegendY=-0.6; if (1) { // 2014.05.07 path1="../root_files_reg/tag_and_probe/DY_j22_19712pb_egamma_Unregressed_energy/"; path2= path1; effKindLongStr1="dataRECO_fit-fitEtBins6EtaBins5egamma_PU"; effKindLongStr2="mcRECO_count-countEtBins6EtaBins5egamma_PU"; label1="data"; label2="simulation"; fnameTag="-reco"; transLegendX=0.1; } // ------------------------------- // processing // ------------------------------- if (transLegendY_user!=0.) transLegendY=transLegendY_user; if ((iBr==0) || (iBr==2)) { if (iBr==2) fnameTag.Append("extraSyst"); } else if ((iBr==1) || (iBr==3)) { effKindLongStr1.ReplaceAll("RECO","ID"); effKindLongStr2.ReplaceAll("RECO","ID"); fnameTag="-id"; if (iBr==3) fnameTag.Append("extraSyst"); } else { std::cout << "unknown branch = " << iBr << "\n"; return; } TString fname1=path1 + fnameBase + effKindLongStr1 + TString(".root"); TString fname2=path2 + fnameBase + effKindLongStr2 + TString(".root"); DYTools::TEtBinSet_t etBinSet1=DetermineEtBinSet(effKindLongStr1); DYTools::TEtaBinSet_t etaBinSet1=DetermineEtaBinSet(effKindLongStr1); DYTools::TEtBinSet_t etBinSet2=DetermineEtBinSet(effKindLongStr2); DYTools::TEtaBinSet_t etaBinSet2=DetermineEtaBinSet(effKindLongStr2); std::cout << "sets: "<< EtBinSetName(etBinSet1) << "," << EtaBinSetName(etaBinSet1) << " " << EtBinSetName(etBinSet2) << "," << EtaBinSetName(etaBinSet2) << "\n"; TString effKind =effDataKindString(effKindLongStr1); TString effKind2=effDataKindString(effKindLongStr2); if (effKind == effKind2) { if ( !efficiencyIsHLT(DetermineEfficiencyKind(effKind )) || !efficiencyIsHLT(DetermineEfficiencyKind(effKind2)) ) { std::cout << "effKind1=<" << effKind << ">\n"; std::cout << "effKind2=<" << effDataKindString(effKindLongStr2) << ">\n"; return; } } TString dataKind=effKind + TString(" "); int weighted1=(effKindLongStr1.Index("count-count")!=-1) ? 1 : 0; int weighted2=(effKindLongStr2.Index("count-count")!=-1) ? 1 : 0; //int iEta=0; TMatrixD *eff1=NULL, *eff1ErrLo=NULL, *eff1ErrHi=NULL; TMatrixD *eff2=NULL, *eff2ErrLo=NULL, *eff2ErrHi=NULL; TH1D *histo1=NULL, *histo2=NULL; const char *histo1Name="histo1"; const char *histo2Name="histo2"; if (!loadEff(fname1,weighted1,&eff1,&eff1ErrLo,&eff1ErrHi)) { std::cout << "failed to get fields from <" << fname1 << "> (1)\n"; return ; } if (!loadEff(fname2,weighted2,&eff2,&eff2ErrLo,&eff2ErrHi)) { std::cout << "failed to get fields from <" << fname2 << "> (2)\n"; return ; } if (etaBinSet1==DYTools::ETABINS5egamma) etaBinSet1=DYTools::ETABINS5_max25; if (etaBinSet2==DYTools::ETABINS5egamma) etaBinSet2=DYTools::ETABINS5_max25; if (etBinSet1==DYTools::ETBINS6) etBinSet1=DYTools::ETBINS6short; if (etBinSet2==DYTools::ETBINS6) etBinSet2=DYTools::ETBINS6short; TGraphAsymmErrors* gr1=getAsymGraph(vsEt,etBinSet1,etaBinSet1,iBin,*eff1,*eff1ErrLo,*eff1ErrHi,&histo1,histo1Name); //std::cout << gr1->GetTitle() << ": "; gr1->Print("range"); TGraphAsymmErrors* gr2=getAsymGraph(vsEt,etBinSet2,etaBinSet2,iBin,*eff2,*eff2ErrLo,*eff2ErrHi,&histo2,histo2Name); //std::cout << gr2->GetTitle() << ": "; gr2->Print("range"); if (1) { gr1->Print("range"); gr2->Print("range"); } TGraphAsymmErrors* div=(TGraphAsymmErrors*)gr1->Clone("div"); //TH1D *div=(TH1D*)histo1->Clone("div"); //div->Divide(histo1,histo2,1.,1.,"b"); div->Divide(histo1,histo2,"pois"); div->Print("range"); TMatrixD *sfSystErrEgamma=loadMatrix(fname1,"sf_syst_rel_error_egamma", 6,5,1); TMatrixD *sfSystErr25=loadMatrix(fname1,"sf_syst_rel_error_maxEta25", 6,5,1); sfSystErrEgamma->Print(); sfSystErr25->Print(); TVectorD egmSystErr(6), ourSystErr(6); for (int ic=0; ic<6; ++ic) { egmSystErr(ic) = (*sfSystErrEgamma)(ic,iBin); ourSystErr(ic) = (*sfSystErr25)(ic,iBin); } TGraphAsymmErrors* sfEG=addErrors(div,egmSystErr,"sfEG",1); TGraphAsymmErrors* sfOur=addErrors(sfEG,ourSystErr,"sfOur",1); sfEG->Print(); double *loc_etBinLimits=DYTools::getEtBinLimits(etBinSet1); double *loc_etaBinLimits=DYTools::getEtaBinLimits(etaBinSet1); int signedEta=DYTools::signedEtaBinning(etaBinSet1); TString cpTitle; if (vsEt) cpTitle= dataKind+ TString(Form(" %5.3lf #leq %s #leq %5.3lf",loc_etaBinLimits[iBin],(signedEta)?"#eta":"abs(#eta)",loc_etaBinLimits[iBin+1])); else cpTitle= dataKind+ TString(Form(" %2.0lf #leq #it{E}_{T} #leq %2.0lf GeV",loc_etBinLimits[iBin],loc_etBinLimits[iBin+1])); TString xaxisTitle=(vsEt) ? "#it{E}_{T}" : ((signedEta) ? "#eta" : "|#eta|"); ComparisonPlot_t cp(ComparisonPlot_t::_ratioPlain,"comp",cpTitle, xaxisTitle,"efficiency","ratio"); cp.SetRefIdx(-111); // do not plot lower panel //if (vsEt) cp.SetLogx(); cp.SetLogx(0); cp.SetGridx(1); cp.SetGridy(1); cp.SetYRange(0.0, 1.1); cp.SetXRange(0,100); // Square canvas if ratio is not plotted TCanvas *cx=new TCanvas("cx","cx",700,700); if (0) { cp.Prepare2Pads(cx); } else { cx->Divide(2,1); cp.PreparePads(cx,1,2,"comp",0.29,0.001); } SetSideSpaces(cx,0,-0.1, 0.12, 0.0,1); SetSideSpaces(cx,0,-0.1,-0.08,-0.18,2); gr1->GetYaxis()->SetTitleOffset(1.4); gr1->GetXaxis()->SetNdivisions(506); gr2->SetFillStyle(3001); gr2->SetFillColor(38); gr1->SetMarkerSize(0.8); gr2->SetMarkerSize(0.8); cp.AddGraph(gr1,label1,"LPE1",kBlack,20, 1,1,1.); cp.AddGraph(gr2,label2,"LPE2",38,22, 1,1,1.); cp.Draw(cx,0,"png",1); cp.TransLegend(transLegendX, transLegendY); //cp.WidenLegend(0.2,0.); ComparisonPlot_t cpSF(ComparisonPlot_t::_ratioPlain,"compSF","", xaxisTitle,"scale factor","ratio"); cpSF.SetRefIdx(-111); cpSF.NoLegend(1); cpSF.SetGridx(1); cpSF.SetGridy(1); //cpSF.SetXAxisTextSizes(0.08,1.1,0.08); //cpSF.SetYAxisTextSizes(0.08,1.0,0.08); cpSF.SetXAxisTextSizes(0.11,1.10,0.11); cpSF.SetYAxisTextSizes(0.14,0.57,0.11); cpSF.SetYRange(0.8,1.2); if ((iBr==1) || (iBr==3)) cpSF.SetYRange(0.7,1.3); cpSF.SetXRange(0,100); int color=38; sfEG->SetLineColor(color); sfEG->SetMarkerColor(color); sfEG->SetMarkerSize(0.8); sfEG->SetFillColor(color); sfEG->SetFillStyle(3001); sfOur->SetFillStyle(3002); if ((iBr==2) || (iBr==3)) { cpSF.AddGraph(sfOur,"","LPE2",kRed,1, 1,1,1.); TGraphAsymmErrors *sfEG3=(TGraphAsymmErrors*)sfEG->Clone("sfEG_clone3"); sfEG3->SetFillStyle(3002); cpSF.AddGraph(sfEG3,"","LPE2", 9,1, 1,1,1.); } cpSF.AddGraph(sfEG,"","LPE2",color,20, 1,1,1.); TGraphAsymmErrors *sfEG2=(TGraphAsymmErrors*)sfEG->Clone("sfEG_clone"); cpSF.AddGraph(sfEG2,"","LPE1", 9,20, 1,1,1.); cpSF.Draw(cx,0,"png",2); // ---------- line at 1 if (0) { double one= 1.; TLine *lineAtOne = new TLine(0,one, 100,one); lineAtOne->SetLineStyle(kDashed); lineAtOne->SetLineWidth(1); lineAtOne->SetLineColor(kBlack); lineAtOne->Draw(); } cx->Update(); if (fnameTag.Length()) { TString fname=TString("fig-eff-") + fnameTag + cpTitle; fname.ReplaceAll(" #leq "," "); fname.ReplaceAll(" ","_"); fname.ReplaceAll("(#eta)","Eta"); fname.ReplaceAll("#eta","eta"); fname.ReplaceAll(".","_"); fname.ReplaceAll("#it{E}_{T}","Et"); //fname.Append(".png"); TString locOutDir=TString("plots") + fnameTag; locOutDir.ReplaceAll("--",""); std::cout << "fnameBase=<" << fname << "> in <" << locOutDir << ">\n"; if (outFileName_ptr) *outFileName_ptr=fname; if (outDir_ptr) *outDir_ptr=locOutDir; if (doSave) { SaveCanvas(cx,fname,locOutDir); } else { std::cout << " ... not saved (as requested)\n"; } } return ; }
void achDistwithVerticalLines() { TH1D* achdist[6]; TH1D* achdisttemp[6][7]; int ntrklist[7] = {90,120,150,185,220,260,300}; // TH1D* achdist[6]; // int centralitylist[7] = {30,40,50,60,70,80,90} gStyle->SetLegendFont(42); TCanvas* c1 = new TCanvas("c1","c1",1,1,600,600); //f = new TFile("~/Summer2016/rootfiles/FinalResult_0106/Main_PbPb_Merged.root"); f = new TFile("~/Summer2016/rootfiles/FinalResult_0106/Main_pPb_Merged.root"); achdist[3] = (TH1D*)f->Get("demo_n3/ChargeAsym"); // achdist[3]->Rebin(5); achdist[3]->GetXaxis()->SetRangeUser(-0.25, 0.25); // achdist[3]->GetYaxis()->SetRangeUser(0, 500000); //achdist[3]->SetMarkerColor(kBlue); /* TLine *l1 = new TLine(-0.07,0,-0.07,300000); TLine *l2 = new TLine(-0.03,0,-0.03,400000); TLine *l3 = new TLine(-0.01,0,-0.01,450000); TLine *l4 = new TLine(0.01,0,0.01,450000); TLine *l5 = new TLine(0.03,0,0.03,400000); TLine *l6 = new TLine(0.07,0,0.07,300000); */ TLine *l1 = new TLine(-0.085,0,-0.085,300000); TLine *l2 = new TLine(-0.05,0,-0.05,400000); TLine *l3 = new TLine(-0.025,0,-0.025,450000); TLine *l4 = new TLine(0.025,0,0.025,450000); TLine *l5 = new TLine(0.05,0,0.05,400000); TLine *l6 = new TLine(0.085,0,0.085,300000); l1->SetLineColor(kBlue); l1->SetLineStyle(2); l1->SetLineWidth(3); l2->SetLineColor(kBlue); l2->SetLineStyle(2); l2->SetLineWidth(3); l3->SetLineColor(kBlue); l3->SetLineStyle(2); l3->SetLineWidth(3); l4->SetLineColor(kBlue); l4->SetLineStyle(2); l4->SetLineWidth(3); l5->SetLineColor(kBlue); l5->SetLineStyle(2); l5->SetLineWidth(3); l6->SetLineColor(kBlue); l6->SetLineStyle(2); l6->SetLineWidth(3); achdist[3]->Draw(); achdist[3]->GetXaxis()->SetTitle("Observed A_{ch}"); achdist[3]->GetYaxis()->SetTitle("Count"); achdist[3]->GetXaxis()->CenterTitle(); achdist[3]->GetYaxis()->CenterTitle(); achdist[3]->SetTitleSize (0.040,"X"); achdist[3]->SetTitleOffset(1.4,"X"); achdist[3]->SetTitleFont (42,"X"); achdist[3]->SetLabelOffset(0.006,"X"); achdist[3]->SetLabelSize (0.040,"X"); achdist[3]->SetLabelFont (42 ,"X"); achdist[3]->SetTitleSize (0.040,"Y"); achdist[3]->SetTitleOffset(2.2,"Y"); achdist[3]->SetTitleFont (42,"Y"); achdist[3]->SetLabelOffset(0.006,"Y"); achdist[3]->SetLabelSize (0.040,"Y"); achdist[3]->SetLabelFont (42 ,"Y"); achdist[3]->SetLineWidth(0); TLatex* text_a = makeLatex("CMS PbPb #sqrt{s_{NN}}=5.02TeV",0.23,0.87) ; TLatex* text_b = makeLatex("30-40%",0.23,0.82) ; TLatex* text_c = makeLatex("0.3 < p_{T} < 3.0 GeV/c",0.23,0.75) ; text_a->SetTextFont(42); text_b->SetTextFont(42); text_c->SetTextFont(42); text_a->DrawClone("Same"); text_b->DrawClone("Same"); //text_c->DrawClone("Same"); l1->Draw("same"); l2->Draw("same"); l3->Draw("same"); l4->Draw("same"); l5->Draw("same"); l6->Draw("same"); SaveCanvas(c1,"pics","achwithverticallines"); }
// ______________________________________________________________________________________ void plotVsDeltaEta_nice(const Char_t* name = "ratioVsDeltaEta") { gROOT->LoadMacro("include/toolsEtaNice.C++"); SetupStyle(); SetGlobals(); // ----------------------------------------------------- TFile *inFiles[nEtaSets][nDataSets][nMoments]; TGraphErrors *graphs[nEtaSets][nDataSets][nMoments]; for (int idxEta = 0 ; idxEta < nEtaSets; ++idxEta) for (int idxDataSet = 0 ; idxDataSet < nDataSets; ++idxDataSet) for (int idxMoment = 0 ; idxMoment < nMoments; ++idxMoment) { inFiles[idxEta][idxDataSet][idxMoment] = TFile::Open(Form("output/%s/%s/Moments_%s.root", aEtaSets[idxEta], aDataSets[idxDataSet], aMoments[idxMoment])); graphs[idxEta][idxDataSet][idxMoment] = static_cast<TGraphErrors*>((inFiles[idxEta][idxDataSet][idxMoment]->Get(aMoments[idxMoment]))->Clone()); if (inFiles[idxEta][idxDataSet][idxMoment]) (inFiles[idxEta][idxDataSet][idxMoment])->Close(); } // ----------------------------------------------------- TLegend *legRat[nDataSets]; for (int idxDataSet = 0 ; idxDataSet < nDataSets; ++idxDataSet) { legRat[idxDataSet] = new TLegend(0.12, 0.12, 0.70, 0.495); legRat[idxDataSet]->SetTextAlign(12); legRat[idxDataSet]->SetTextSize(0.06); legRat[idxDataSet]->SetFillColor(1182); legRat[idxDataSet]->SetLineColor(0); legRat[idxDataSet]->SetBorderSize(0); } // ----------------------------------------------------- TGraphErrors *etaGraphs[9][nDataSets][nMoments]; for (int idxCent = 0; idxCent < nCent; idxCent++) { for (int idxDataSet = 0 ; idxDataSet < nDataSets; ++idxDataSet) { for (int idxMoment = 4 ; idxMoment < nMoments; ++idxMoment) { float y[nEtaSets]; float ey[nEtaSets]; for (int idxEta = 0 ; idxEta < nEtaSets; ++idxEta) { y[idxEta] = graphs[idxEta][idxDataSet][idxMoment]->GetY()[idxCent]; ey[idxEta] = graphs[idxEta][idxDataSet][idxMoment]->GetEY()[idxCent]; } etaGraphs[idxCent][idxDataSet][idxMoment] = new TGraphErrors(nEtaSets, aEtaSetBinWidth, y, 0, ey); PrepareGraph(etaGraphs[idxCent][idxDataSet][idxMoment]); } // for (int idxMoment = 0 ; idxMoment < nMoments; ++idxMoment) { } // for (int idxDataSet = 0 ; idxDataSet < nDataSets; ++idxDataSet) { } // for (int idxCent = 0; idxCent < 9; idxCent++) { // ----------------------------------------------------- for (int idxDataSet = 0 ; idxDataSet < nDataSets; ++idxDataSet) { TPad *pad = SetupCanvas(Form("canDeltaEta_Ratio_%s", aDataSets[idxDataSet]), aDataSetsTitle[idxDataSet], "#Delta#eta", 0.48); for (int idxMoment = 4 ; idxMoment < nMoments; ++idxMoment) { pad->cd(idxMoment-3); for (int idxCent = 0; idxCent < 9; idxCent++) { if (idxCent != 0 && idxCent != 1 && idxCent != 8 && idxCent != 4 ) continue; TGraphErrors *g = etaGraphs[idxCent][idxDataSet][idxMoment]; if (idxCent == 0) ShiftGraphX(g, -0.015); else if (idxCent == 1) ShiftGraphX(g, -0.005); else if (idxCent == 4) ShiftGraphX(g, 0.005); else if (idxCent == 8) ShiftGraphX(g, 0.015); ConfigGraph(g, idxMoment, idxCent); if (idxCent == 0) { g->Draw("AP"); if (idxMoment == 5) { // TLine *line0 = new TLine(aMinX, 0, aMaxX, 0); // line0->SetLineColor(kGray+1); // line0->SetLineStyle(2); // line0->SetLineWidth(2); // line0->Draw(); } else if (idxMoment == 6) { TLine *line1 = new TLine(aMinX, 1, aMaxX, 1); line1->SetLineColor(kGray+1); line1->SetLineStyle(2); line1->SetLineWidth(2); line1->Draw(); legRat[idxDataSet]->AddEntry(line1, "Poisson", "l"); } } g->Draw("PSAME"); if (idxMoment == 4) legRat[idxDataSet]->AddEntry(etaGraphs[idxCent][idxDataSet][4], Form("%s", cent1[idxCent]), "pl"); } // for (int idxCent = 0; idxCent < 9; idxCent++) { } // for (int idxMoment = 0 ; idxMoment < nMoments; ++idxMoment) { pad->cd(2); TLatex *texb_3 = new TLatex(0.05, 0.55, "Au+Au collisions #sqrt{#it{s}_{NN}} = 14.5 GeV"); texb_3->SetTextSize(0.07); texb_3->Draw("same"); TLatex *texb_3a = new TLatex(0.05, 0.49, "Net-Charge, 0.2 < #it{p}_{T} (GeV/#it{c}) < 2.0, 0-5%"); texb_3a->SetTextSize(0.07); texb_3a->Draw("same"); TLatex *texb_3b = new TLatex(0.05,0.44, "statistical errors only"); texb_3b->SetTextSize(0.06); texb_3b->Draw("same"); pad->cd(1); TLatex *texb_4 = new TLatex(0.7, 19, "STAR Preliminary"); texb_4->SetTextSize(0.07); texb_4->Draw("same"); pad->cd(3); legRat[idxDataSet]->Draw(); pad->Modified(); } // for (int idxDataSet = 0 ; idxDataSet < nDataSets; ++idxDataSet) { // ----------------------------------------------------- SaveCanvas(name); // ----------------------------------------------------- TFile *fOut = TFile::Open("STAR_QM2015_Preliminary.root", "UPDATE"); fOut->cd(); TList* list = new TList; for (int idxMoment = 4; idxMoment < nMoments; ++idxMoment) { for (int idxCent = 0; idxCent < nCent; ++idxCent) { if (idxCent > 1) continue; if (idxCent == 0) ShiftGraphX(etaGraphs[idxCent][0][idxMoment], 0.015); else if (idxCent == 1) ShiftGraphX(etaGraphs[idxCent][0][idxMoment], 0.005); else if (idxCent == 4) ShiftGraphX(etaGraphs[idxCent][0][idxMoment], -0.005); else if (idxCent == 8) ShiftGraphX(etaGraphs[idxCent][0][idxMoment], -0.015); etaGraphs[idxCent][0][idxMoment]->SetName(Form("Net-Charge_%s_DeltaEta_14.5GeV_%s_stat", aMoments[idxMoment], cent[idxCent])); list->Add(etaGraphs[idxCent][0][idxMoment]); } } list->Write("Net-Charge_VsDeltaEta", TObject::kSingleKey); fOut->Close(); }
// ______________________________________________________________________________________ void plotEnergyProtonOverview(const Char_t* name = "ratioNetProtonVsEnergyOverview") { Int_t idxNames = kNetP; gROOT->LoadMacro("include/toolsEnergyNice.C++"); gROOT->LoadMacro("include/getPublished.C++"); SetupStyle(); SetGlobals(); getPublished(); // ----------------------------------------------------- TFile *inFiles[nEnergies]; TFile *inFilesUrqmd[nEnergies]; TGraphErrors *inGraphsStat[nEnergies][nMoments]; TGraphErrors *inGraphsSys[nEnergies][nMoments]; TGraphErrors *inGraphsPoisson[nEnergies][nMoments]; TGraphErrors *inGraphsUrqmd[nEnergies][nMoments]; for (int idxEnergy = 0 ; idxEnergy < nEnergies; ++idxEnergy) { inFiles[idxEnergy] = TFile::Open(Form("Net-Proton/moments_%sGeV_preli.root", energies[idxEnergy])); if (idxEnergy != 2) inFilesUrqmd[idxEnergy]= TFile::Open(Form("URQMD/urqmd_proton/AuAu%sGeV_netp_refmult3_y0.5.root", exactEnergies[idxEnergy])); for (int idxMoment = 4 ; idxMoment < nMoments; ++idxMoment) { // -- value and stat errors inGraphsStat[idxEnergy][idxMoment] = (idxMoment != 5) ? static_cast<TGraphErrors*>((inFiles[idxEnergy]->Get(Form("%s_stat", aMoments[idxMoment])))->Clone()) : static_cast<TGraphErrors*>((inFiles[idxEnergy]->Get(Form("%s_pos_ratio_stat", aMoments[idxMoment])))->Clone()); // -- sysErrors inGraphsSys[idxEnergy][idxMoment] = (idxMoment != 5) ? static_cast<TGraphErrors*>((inFiles[idxEnergy]->Get(Form("%s_sys", aMoments[idxMoment])))->Clone()) : static_cast<TGraphErrors*>((inFiles[idxEnergy]->Get(Form("%s_pos_ratio_sys", aMoments[idxMoment])))->Clone()); // -- poisson if (idxMoment == 4) inGraphsPoisson[idxEnergy][idxMoment] = static_cast<TGraphErrors*>((inFiles[idxEnergy]->Get(Form("%s_base_pos_stat", aMoments[idxMoment])))->Clone()); // -- urqmd if (idxEnergy !=2) { if (idxMoment == 4) inGraphsUrqmd[idxEnergy][idxMoment] = static_cast<TGraphErrors*>((inFilesUrqmd[idxEnergy]->Get(Form("R21")))->Clone()); else if (idxMoment == 5) inGraphsUrqmd[idxEnergy][idxMoment] = static_cast<TGraphErrors*>((inFilesUrqmd[idxEnergy]->Get(Form("%s_Pos_ratio", aMoments[idxMoment])))->Clone()); else if (idxMoment == 6) inGraphsUrqmd[idxEnergy][idxMoment] = static_cast<TGraphErrors*>((inFilesUrqmd[idxEnergy]->Get(aMoments[idxMoment]))->Clone()); } } if (inFiles[idxEnergy]) inFiles[idxEnergy]->Close(); } // ----------------------------------------------------- // -- Make graphs for (int idxEnergy = 0; idxEnergy < nEnergies; ++idxEnergy) { for (int idxMoment = 4; idxMoment < nMoments; ++idxMoment) { for (int idxCent = 0; idxCent < nCent; ++idxCent) { if (idxCent != 0 && idxCent != 1 && idxCent != 8) continue; Double_t xIn, yIn; inGraphsStat[idxEnergy][idxMoment]->GetPoint(idxCent, xIn, yIn); Double_t yErrorStatIn = inGraphsStat[idxEnergy][idxMoment]->GetErrorY(idxCent); Double_t yErrorSysIn = inGraphsSys[idxEnergy][idxMoment]->GetErrorY(idxCent); for (Int_t idx = 0; idx < 2; ++idx) { Double_t xBin = (idx == 0) ? snn[idxEnergy] : mub[idxEnergy]; graphStat[idx][idxMoment][idxCent]->SetPoint(idxEnergy, xBin, yIn); graphStat[idx][idxMoment][idxCent]->SetPointError(idxEnergy, 0, yErrorStatIn); graphSys[idx][idxMoment][idxCent]->SetPoint(idxEnergy, xBin, yIn); graphSys[idx][idxMoment][idxCent]->SetPointError(idxEnergy, 0, yErrorSysIn); } if (idxMoment == 4) { inGraphsPoisson[idxEnergy][idxMoment]->GetPoint(idxCent, xIn, yIn); for (Int_t idx = 0; idx < 2; ++idx) { Double_t xBin = (idx == 0) ? snn[idxEnergy] : mub[idxEnergy]; graphPoisson[idx][idxMoment][idxCent]->SetPoint(idxEnergy, xBin, yIn); } } if (idxCent == 0 && idxEnergy != 2) { Double_t yErrorUrqmdIn = inGraphsUrqmd[idxEnergy][idxMoment]->GetErrorY(idxCent); inGraphsUrqmd[idxEnergy][idxMoment]->GetPoint(idxCent, xIn, yIn); for (Int_t idx = 0; idx < 2; ++idx) { Double_t xBin = (idx == 0) ? snn[idxEnergy] : mub[idxEnergy]; Int_t energyArrayAccess = (idxEnergy >= 2) ? idxEnergy-1 : idxEnergy; graphUrqmd[idx][idxMoment][idxCent]->SetPoint(energyArrayAccess, xBin, yIn); graphUrqmd[idx][idxMoment][idxCent]->SetPointError(energyArrayAccess, 0, yErrorUrqmdIn); } } } // for (int idxCent = 0; idxCent < nCent; ++idxCent) { } // for (int idxMoment = 0 ; idxMoment < nMoments; ++idxMoment) { } // for (int idxEnergy = 0 ; idxEnergy < nEnergies; ++idxEnergy) { // ----------------------------------------------------- SetupCanvas(name, Form("%s Ratio energy dependence", aNames[idxNames])); CreateLegends(2, 3, 0.4, 0.28); // ----------------------------------------------------- for (int idxMoment = 4; idxMoment < nMoments; ++idxMoment) { pad->cd(idxMoment-3); gPad->SetLogx(); for (int idxCent = 0; idxCent < nCent; ++idxCent) { if (idxCent != 0 && idxCent != 8) continue; DrawSet(graphStat[0][idxMoment][idxCent], graphSys[0][idxMoment][idxCent], graphUrqmd[0][idxMoment][idxCent], graphPoisson[0][idxMoment][idxCent], idxMoment, idxCent); } // for (int idxCent = 0; idxCent < nCent; ++idxCent) { graphStat[0][idxMoment][0]->Draw("ZP,SAME"); graphSys[0][idxMoment][0]->Draw("[],SAME"); } // for (int idxMoment = 4; idxMoment < nMoments; ++idxMoment) { legTheo->AddEntry(graphUrqmd[0][4][0], Form("%s UrQMD", cent1[0]), "f"); // ----------------------------------------------------- LabelCanvas(aNames[idxNames], aNamesPt[idxNames]); SaveCanvas(name); }
//main function void DoPlotSingle1Canvas(TString TrackpTthr ="0.3to1.0",TString system = "pPb"){ gStyle->SetOptStat(0); Int_t CanvasSizeX, CanvasSizeY; if(system=="pp")CanvasSizeX =1030, CanvasSizeY = 1000; else if(system=="pPb")CanvasSizeX =1200, CanvasSizeY = 600; else cout << "Check System input !! " <<endl; CanvasCorrelation=new TCanvas("CanvasCorrelation","CanvasCorrelation",CanvasSizeX,CanvasSizeY); CanvasCorrelation->SetLeftMargin(0.18409396); //CanvasCorrelation->SetRightMargin(0.05872483); //CanvasCorrelation->SetTopMargin(0.07678883); //CanvasCorrelation->SetBottomMargin(0.1239092); if(system=="pp")CanvasCorrelation->Divide(3,3); else if(system=="pPb")CanvasCorrelation->Divide(2,1); else cout << "Check System input !! " <<endl; //cout->Draw(); //cout->SetLeftMargin(Canvas[0]->GetLeftMargin()-0.08); //cout->SetRightMargin(Canvas[0]->GetRightMargin()+0.08); //cout->SetFrameBorderMode(0); TString CanvasName = ""; LoadFileNamesToCompare(TrackpTthr,system); cout << " " << endl << "Adding file.." << endl; for(Int_t k = 0; k<nhistos; k++)cout << k+1 <<" ---------> # " << filenames[k].Data()<<endl; Int_t entries; Canvas = new TCanvas *[nhistos]; Int_t kTemp = 0; for(Int_t k=0; k<nhistos; k++){ gPad->SetLeftMargin(0.15009396); gPad->SetRightMargin(-0.12409396); if(k<3)kTemp=1; else if(3<=k<6)kTemp=2; else if(6<=k)kTemp=3; Canvas[k] = GetCanvas(k,"cDraw"); // get p-Pb Canvas[k]->SetName(Form("canvaInput%d",k)); TList *lc=Canvas[k]->GetListOfPrimitives(); entries=lc->GetEntries(); for(Int_t jl=0;jl<entries;jl++){ TObject *obj=lc->At(jl); TString strName=obj->ClassName(); if(strName.Contains("TFrame"))continue; if(strName.Contains("TPad"))continue; if(strName.Contains("TH1")){ TH1D *hcur=(TH1D*)obj; if(system=="pp")hcur->SetMarkerSize(0.7); else if(system=="pPb")hcur->SetMarkerSize(0.9); else Printf("Check your system name"); } if(strName.Contains("TLatex")){ TLatex *tl=(TLatex*)obj; TString str=tl->GetTitle(); if(str.Contains("D^{0}")){ hcur->SetMarkerColor(kRed); hcur->SetMarkerStyle(20); }else if(str.Contains("D^{+}")){ hcur->SetMarkerColor(kGreen+3); hcur->SetMarkerStyle(21); }else if(str.Contains("D^{*+}")){ // hcur->SetMarkerColor(5); hcur->SetMarkerColor(kAzure-2); hcur->SetMarkerStyle(22); } } if(strName.Contains("TGraph")){ //Printf("There is a TGraph"); TGraphAsymmErrors *gr=(TGraphAsymmErrors*)obj; // gr->SetMarkerStyle(); // gr->SetMarkerColor(0); if(system=="pp")gr->SetMarkerSize(0.7); else if(system=="pPb")gr->SetMarkerSize(0.9); gr->SetLineWidth(2); gr->Draw("E2"); TGraphAsymmErrors *gr2=(TGraphAsymmErrors*)gr->Clone("grHelp"); //gr2->SetMarkerColor(kBlack); //gr2->SetLineColor(kBlack); //gr2->SetMarkerSize(0.3); //gr2->Draw("p"); } else obj->Draw("same"); } CanvasCorrelation->cd(kTemp); if(k==0 || k==3 || k==6){ hcur->GetYaxis()->SetRangeUser(0,12); hcur->GetYaxis()->SetTitle("#frac{1}{#it{N}_{D^{}}}#frac{d#it{N}^{assoc}}{d#Delta#varphi} (rad^{-1})"); hcur->Draw("ep"); //dot3 to 1 = 0.15, 0.21, 027 TLatex *tlTitleDplus=new TLatex(0.48,0.15,"#bf{D^{+}#cbar{}^{+20%}_{-18%} scale uncertainty}"); tlTitleDplus->SetNDC(); tlTitleDplus->SetTextColor(kGreen+3); tlTitleDplus->SetTextSize(0.033); tlTitleDplus->Draw(); TLatex *tlTitleDStar=new TLatex(0.48,0.21,"#bf{D^{*+}#cbar{}^{+16%}_{-13%} scale uncertainty}"); tlTitleDStar->SetNDC(); tlTitleDStar->SetTextColor(kAzure-2); tlTitleDStar->SetTextSize(0.033); tlTitleDStar->Draw(); TLatex *tlTitleDZero=new TLatex(0.48,0.27,"#bf{D^{0}#cbar{}^{+16%}_{-13%} scale uncertainty}"); tlTitleDZero->SetNDC(); tlTitleDZero->SetTextColor(kRed); tlTitleDZero->SetTextSize(0.033); tlTitleDZero->Draw(); if(kTemp==1)TLatex *tlTitle00=new TLatex(0.18,0.75,"#bf{5 < #it{p}_{T}^{D^{0}} < 8 GeV/c}, #bf{-0.96 < #it{y}^{D}_{cms} < 0.04}"); if(kTemp==2)TLatex *tlTitle00=new TLatex(0.18,0.75,"#bf{8 < #it{p}_{T}^{D^{0}} < 16 GeV/c}, #bf{-0.96 < #it{y}^{D}_{cms} < 0.04}"); tlTitle00->SetNDC(); //tlTitle0->SetTextColor(kRed); tlTitle00->SetTextSize(0.033); tlTitle00->Draw(); for(Int_t jl=0;jl<entries;jl++){ TObject *obj=lc->At(jl); TString strName=obj->ClassName(); TString str=obj->GetTitle(); if(strName.Contains("TLatex")){ TLatex *tl=(TLatex*)obj; if(str.Contains("-charged")){ TString strTitle=tl->GetTitle(); Printf("\n%s <-- Default txt(1)",strTitle.Data()); strTitle.ReplaceAll("D^{0}","D^{} "); Printf("%s <-- Replaced with txt(1)",strTitle.Data()); tl->SetTitle(strTitle.Data()); } if(str.Contains("ALICE")){ TString strTitle2=tl->GetTitle(); Printf("\n%s <-- Default txt(2)",strTitle2.Data()); strTitle2.ReplaceAll("ALICE Preliminary",""); Printf("%s <-- Replaced with txt(2)",strTitle2.Data()); tl->SetTitle(strTitle2.Data()); } if(str.Contains("pp")){ TString strTitle3=tl->GetTitle(); Printf("\n%s <-- Default txt(3)",strTitle3.Data()); strTitle3.ReplaceAll("pp, #sqrt{s}=7 TeV, L_{int} = 5 nb^{-1}","p-Pb, #sqrt{s}=5.02 TeV, L_{int} = 50 #mub^{-1}"); Printf("%s <-- Replaced with txt(3)",strTitle3.Data()); tl->SetTitle(strTitle3.Data()); } if(str.Contains("assoc")){ TString strTitle5=tl->GetTitle(); Printf("\n%s <-- Default txt(4)",strTitle5.Data()); if(kTemp==1)strTitle5.ReplaceAll(strTitle5.Data(),"#bf{0.3 < #it{p}_{T}^{assoc} < 1 GeV/#it{c}}, #bf{|#Delta#eta| < 1.0}"); if(kTemp==2)strTitle5.ReplaceAll(strTitle5.Data(),"#bf{0.3 < #it{p}_{T}^{assoc} < 1 GeV/#it{c}}, #bf{|#Delta#eta| < 1.0}"); Printf("%s <-- Replaced with txt(4)",strTitle5.Data()); tl->SetTitle(strTitle5.Data()); } // SCALE Uncertainity if(str.Contains("scale uncertainty")){ TString strTitle4=tl->GetTitle(); strTitle4.ReplaceAll("{}^{+16%}_{-13%} scale uncertainty","D^{0}, D^{+}, D^{*+} Comparison"); tl->SetTitle(strTitle4.Data()); tl->SetX(tl->GetX()+0.10); // +0.10 for dot3to1 tl->SetY(tl->GetY()+0.01); tl->SetTextSize(0.023); TString strTitle41=tl->GetTitle(); cout << "============> "<<tl->GetTextSize() << ", " << tl->GetY()<< endl; if(system=="pp"){ tl->SetX(tl->GetX()+0.23); tl->SetTextSize(0.033); } else if(system=="pPb"){ tl->SetX(tl->GetX()+0.25); tl->SetY(tl->GetY()+0.04); tl->SetTextSize(0.037); } cout << "----------> " << strTitle41.Data() << endl; } tl->Draw(); } if(strName.Contains("TGraph")){ //Printf("There is a TGraph"); TGraphAsymmErrors *gr=(TGraphAsymmErrors*)obj; // gr->SetMarkerStyle(); // gr->SetMarkerColor(0); if(system=="pp")gr->SetMarkerSize(0.7); else if(system=="pPb")gr->SetMarkerSize(0.9); gr->SetLineWidth(2); gr->Draw("E2"); TGraphAsymmErrors *gr2=(TGraphAsymmErrors*)gr->Clone("grHelp"); //gr2->SetMarkerColor(kBlack); //gr2->SetLineColor(kBlack); //gr2->SetMarkerSize(0.3); //gr2->Draw("p"); } //else obj->Draw("same"); } } if(k!=0 || k!=3 || k!=6){ hcur->Draw("sameep"); for(Int_t jl=0;jl<entries;jl++){ TObject *obj=lc->At(jl); TString strName=obj->ClassName(); if(strName.Contains("TGraph")){ //Printf("There is a TGraph"); TGraphAsymmErrors *gr=(TGraphAsymmErrors*)obj; // gr->SetMarkerStyle(); // gr->SetMarkerColor(0); if(system=="pp")gr->SetMarkerSize(0.7); else if(system=="pPb")gr->SetMarkerSize(0.9); gr->SetLineWidth(2); gr->Draw("E2"); TGraphAsymmErrors *gr2=(TGraphAsymmErrors*)gr->Clone("grHelp"); //gr2->SetMarkerColor(kBlack); //gr2->SetLineColor(kBlack); //gr2->SetMarkerSize(0.3); //gr2->Draw("p"); } //else obj->Draw("same"); } } CanvasCorrelation->Update(); } // saving the canvases in .root and .png TString ptoutput="", direcname=""; direcname += "Output_SngCav_Comparison"; ptoutput += "Comparison_DHCorrelations_assopT"; ptoutput += TrackpTthr.Data(); if(system == "pp") ptoutput += "_pp"; if(system == "pPb") ptoutput += "_pPb"; SaveCanvas(CanvasCorrelation, direcname, ptoutput); Printf("... .. .. Done !"); return; }
void pileup() { // TH3D* h = (TH3D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/HIData_Minbias_2760GeV_PPRereco_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","multmaxvssecvszvtxsep"); TH3D* h = (TH3D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/HydjetReco_Minbias_2760GeV_PeripheralNew_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","multmaxvssecvszvtxsep"); // TH3D* h = (TH3D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/PAData_Minbias_5TeV_HM_PromptReco_INCLMULTAllPURej3Vtx_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","multmaxvssecvszvtxsep"); TF1* func[40]; TGraph* xx_yy[40]; double par0_arr[40]; double par1_arr[40]; double par2_arr[40]; double dz_arr[40]; // double binwidth=0.2; double binedges[16]={0.0,0.2,0.3,0.4,0.5,0.6,0.8,1.0,1.4,1.8,2.4,3.0,4.2,5.0,7.0,10.0}; TCanvas* c16 = new TCanvas("c16","c16",800,600); c16->Divide(4,4); for(int i=0;i<15;i++) { // h->GetZaxis()->SetRange(h->GetZaxis()->FindBin(binwidth*i),h->GetZaxis()->FindBin(binwidth*i+binwidth)); h->GetZaxis()->SetRange(h->GetZaxis()->FindBin(binedges[i]),h->GetZaxis()->FindBin(binedges[i+1])); h->GetYaxis()->SetRange(h->GetYaxis()->FindBin(2),h->GetYaxis()->FindBin(50)); TH2D* h2D = (TH2D*)h->Project3DProfile(Form("yx%d",i)); h2D->Rebin2D(10,1); TProfile* hprof_x = (TProfile*)h2D->ProfileX("hprof_x",-1,-1,"s"); double xx[500]; double yy[500]; for(int ibin=1;ibin<=hprof_x->GetNbinsX();ibin++) { yy[ibin-1] = hprof_x->GetBinContent(ibin)+2*hprof_x->GetBinError(ibin); xx[ibin-1] = hprof_x->GetBinCenter(ibin); } // Hydjet // TF1* func = new TF1("func","[0]+[1]*(x-[2])*(x-[2])",0,500); // func->SetParameters(20,-0.1,150); func[i] = new TF1(Form("func_%d",i),"[0]*x**[1]",0,500); func[i]->SetParameters(1,0.5); func[i]->SetParLimits(0,0,10000); func[i]->SetParLimits(1,0,10000); if(i==0) func[i]->FixParameter(0,8); //pPb // else if(i>11) func[i]->FixParameter(0,20); //pPb else func[i]->FixParameter(0,2.); //pPb // func->FixParameter(0,5); //PbPb // TF1* func = new TF1("func","[0]+[1]*x",40,500); // double par1 = (hprof_x->GetBinContent(6)+hprof_x->GetBinError(6)-hprof_x->GetBinContent(1)-hprof_x->GetBinError(1))/(hprof_x->GetBinCenter(6)-hprof_x->GetBinCenter(1)); // double par0 = hprof_x->GetBinContent(6)+hprof_x->GetBinError(6)-par1*hprof_x->GetBinCenter(6); // func->SetParameters(par0,par1); xx_yy[i] = new TGraph(hprof_x->GetNbinsX(),xx,yy); xx_yy[i]->Fit(Form("func_%d",i),"NO","",0,300); c16->cd(i+1); xx_yy[i]->Draw("AP"); func[i]->SetLineColor(kRed); func[i]->Draw("Lsame"); par2_arr[i] = func[i]->GetParameter(2); par1_arr[i] = func[i]->GetParameter(1); par0_arr[i] = func[i]->GetParameter(0); dz_arr[i] = (binedges[i]+binedges[i+1])/2; } TGraph* gr_par0 = new TGraph(15,dz_arr,par0_arr); TGraph* gr_par1 = new TGraph(15,dz_arr,par1_arr); TGraph* gr_par2 = new TGraph(15,dz_arr,par2_arr); TCanvas* cc = new TCanvas("cc","",950,400); cc->Divide(3,1); cc->cd(1); gr_par0->Draw("AP"); TF1* func_par0 = new TF1("func_par0","[2]*exp(-x**2/[0])*x**[3]+[1]",0.0,10.0); func_par0->SetParameters(0.2,0,5,-1); func_par0->FixParameter(2,0); gr_par0->Fit("func_par0","NO","",0.3,4.0); func_par0->Draw("Lsame"); cc->cd(2); gr_par1->Draw("AP"); // TF1* func_par1 = new TF1("func_par1","[2]*exp(-x**2/[0])*x**[3]+[1]",0.,10.0); // func_par1->SetParameters(0.2,0,-0.0005,0); // TF1* func_par1 = new TF1("func_par1","[2]*exp(-x/[0])*x**[3]+[1]",0.,10.0); TF1* func_par1 = new TF1("func_par1","[1]*exp(-x**[2]/[0])*x**[3]",0.,10.0); func_par1->SetParameters(0.1,0.6,2,1); // func_par1->FixParameter(2,1); // func_par1->FixParameter(3,1); gr_par1->Fit("func_par1","NO","",0.3,4.0); func_par1->Draw("Lsame"); cc->cd(3); gr_par2->Draw("AP"); TF1* func_par2 = new TF1("func_par2","[2]*exp(-x**2/[0])*x**[3]+[1]",0.,10.0); func_par2->SetParameters(1.2,170,120,1); gr_par2->Fit("func_par2","NO","",0.2,2.0); func_par2->Draw("Lsame"); cout<<Form("par0=%.2f*exp(-x**2/%.2f)*(x**%.2f)+%.2f",func_par0->GetParameter(2),func_par0->GetParameter(0),func_par0->GetParameter(3),func_par0->GetParameter(1))<<endl; cout<<Form("par1=%.6f*exp(-x/%.6f)*(x**%.6f)+%.2f",func_par1->GetParameter(2),func_par1->GetParameter(0),func_par1->GetParameter(3),func_par1->GetParameter(1))<<endl; cout<<Form("par2=%.2f*exp(-x**2/%.2f)*(x**%.2f)+%.2f",func_par2->GetParameter(2),func_par2->GetParameter(0),func_par2->GetParameter(3),func_par2->GetParameter(1))<<endl; // TF2* func2D = new TF2("func2D","[2]*exp(-x**2/[0])*x**[3]+[1]+([6]*exp(-x**2/[7])*x**[3]+[5])*y",0,1.0,0,500); // TF2* func2D = new TF2("func2D","[2]*exp(-x**2/[0])*x**[3]+[1]+([6]*exp(-x/[4])*x**[7]+[5])*(y-[10]*exp(-x**2/[8])*x**[11]-[9])*(y-[10]*exp(-x**2/[8])*x**[11]-[9])",0,5.0,0,500); // TF2* func2D = new TF2("func2D","([2]*exp(-x**2/[0])*x**[3]+[1])*y**[4]",0,10.0,0,500); TF2* func2D = new TF2("func2D","[0]*y**([2]*exp(-x**[3]/[1])*x**[4])",0,10.0,0,500); func2D->SetParameter(0,func_par0->GetParameter(1)); func2D->SetParameter(1,func_par1->GetParameter(0)); func2D->SetParameter(2,func_par1->GetParameter(1)); func2D->SetParameter(3,func_par1->GetParameter(2)); func2D->SetParameter(4,func_par1->GetParameter(3)); /* func2D->SetParameter(0,func_par0->GetParameter(0)); func2D->SetParameter(1,func_par0->GetParameter(1)); func2D->SetParameter(2,func_par0->GetParameter(2)); func2D->SetParameter(3,func_par0->GetParameter(3)); func2D->SetParameter(4,func_par1->GetParameter(0)); func2D->SetParameter(5,func_par1->GetParameter(1)); func2D->SetParameter(6,func_par1->GetParameter(2)); func2D->SetParameter(7,func_par1->GetParameter(3)); func2D->SetParameter(8,func_par2->GetParameter(0)); func2D->SetParameter(9,func_par2->GetParameter(1)); func2D->SetParameter(10,func_par2->GetParameter(2)); func2D->SetParameter(11,func_par2->GetParameter(3)); */ /* cout<<Form("%.6f, %.6f, %.6f, %.6f,",func_par0->GetParameter(0),func_par0->GetParameter(1),func_par0->GetParameter(2),func_par0->GetParameter(3))<<endl; cout<<Form("%.6f, %.6f, %.6f, %.6f,",func_par1->GetParameter(0),func_par1->GetParameter(1),func_par1->GetParameter(2),func_par1->GetParameter(3))<<endl; cout<<Form("%.6f, %.6f, %.6f, %.6f,",func_par2->GetParameter(0),func_par2->GetParameter(1),func_par2->GetParameter(2),func_par2->GetParameter(3))<<endl; */ cout<<Form("%.6f, %.6f, %.6f, %.6f, %.6f,",func2D->GetParameter(0),func2D->GetParameter(1),func2D->GetParameter(2),func2D->GetParameter(3),func2D->GetParameter(4))<<endl; cout<<Form("%.6f, %.6f",func[0]->GetParameter(0),func[0]->GetParameter(1))<<endl; TH2D* h_pileup = new TH2D("distfunc",";d (cm);N_{trk}^{primary};N_{trk}^{secondary}",500,0,50.0,50,0,500); for(int i=1;i<=h_pileup->GetNbinsX();i++) for(int j=1;j<=h_pileup->GetNbinsY();j++) { // if(h_pileup->GetYaxis()->GetBinCenter(j)<func2D->Eval(h_pileup->GetXaxis()->GetBinCenter(i),h_pileup->GetYaxis()->GetBinCenter(j))) h_pileup->SetBinContent(i,j,h_pileup->GetYaxis()->GetBinCenter(j)); // else if(h_pileup->GetXaxis()->GetBinCenter(i)<0.2) h_pileup->SetBinContent(i,j,func2D->Eval(0.2,h_pileup->GetYaxis()->GetBinCenter(j))); // else h_pileup->SetBinContent(i,j,func2D->Eval(h_pileup->GetXaxis()->GetBinCenter(i),h_pileup->GetYaxis()->GetBinCenter(j))); if(h_pileup->GetXaxis()->GetBinCenter(i)<0.2) h_pileup->SetBinContent(i,j,func[0]->Eval(h_pileup->GetYaxis()->GetBinCenter(j))); else h_pileup->SetBinContent(i,j,func2D->Eval(h_pileup->GetXaxis()->GetBinCenter(i),h_pileup->GetYaxis()->GetBinCenter(j))); } /* for(int i=1;i<=h_pileup->GetNbinsX();i++) for(int j=1;j<=h_pileup->GetNbinsY();j++) { for(int k=0;k<15;k++) { if(h_pileup->GetXaxis()->GetBinCenter(i)>binedges[k] && h_pileup->GetXaxis()->GetBinCenter(i)<binedges[k+1]) h_pileup->SetBinContent(i,j,func[k]->Eval(h_pileup->GetYaxis()->GetBinCenter(j))); } } */ TCanvas* c2D = new TCanvas("c2D","",550,500); c2D->SetPhi(-60); c2D->SetTheta(50); h_pileup->SetAxisRange(0,3.0,"X"); h_pileup->GetXaxis()->CenterTitle(); h_pileup->GetYaxis()->CenterTitle(); h_pileup->GetZaxis()->CenterTitle(); h_pileup->Draw("surf1"); SaveCanvas(c2D,"pPb/corr","pileup_distfunc_hydjet"); return; TFile* fout = new TFile("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/efficiency/pileup_distfunc_pPb_1sigma_mode1.root","recreate"); h_pileup->Write(); fout->Close(); }
void plotSFspec(int iBr=0, int iBin=0, int doSave=0, double transLegendY_user=0., int vsEt=1) { TString fname; TString label1,label2,label3; TString sfKindLongStr; //TString sfKind; double transLegendX=-0.2; double transLegendY=-0.4; TString saveFileTag; label1="stat.error"; label2="stat.+syst.err."; label3="stat.+syst.err.+add.syst.err"; if (iBr==0) { fname="./egammaRECO.root"; sfKindLongStr="sf_RECO_ETBINS6ETABINS5"; saveFileTag="-cmpEgammaRECO"; transLegendX=-0.23; //transLegendY=-0.2; } if (iBr==1) { fname="./mediumID.root"; sfKindLongStr="sf_mediumID_ETBINS6ETABINS5"; saveFileTag="-cmpEgammaMediumID"; transLegendX=-0.23; //transLegendY=-0.2; } //if (!vsEt) saveFileTag.Append("-vsEta"); if (transLegendY_user!=0.) transLegendY=transLegendY_user; /* if (iBr==0) sfKind="ID"; else if (iBr==1) sfKind="RECO"; else if (iBr==2) sfKind="HLT"; else { std::cout << "iBr error\n"; return; } */ DYTools::TEtBinSet_t etBinSet=DetermineEtBinSet(sfKindLongStr); DYTools::TEtaBinSet_t etaBinSet=DetermineEtaBinSet(sfKindLongStr); int nEtBins=DYTools::getNEtBins(etBinSet); int nEtaBins=DYTools::getNEtaBins(etaBinSet); std::cout << "sets: "<< EtBinSetName(etBinSet) << "," << EtaBinSetName(etaBinSet) << "\n"; TString effKind =effDataKindString(sfKindLongStr); TString dataKind=effKind; TMatrixD *sf=NULL, *sf1ErrLo=NULL, *sf1ErrHi=NULL; TMatrixD *systRelErr=NULL, sf2ErrLo(nEtBins,nEtaBins), sf2ErrHi(nEtBins,nEtaBins); TMatrixD *systRelErrTot=NULL, sf3ErrLo(nEtBins,nEtaBins), sf3ErrHi(nEtBins,nEtaBins); // load the scale factors if (!loadEGammaEff(fname,"sf",&sf,&sf1ErrLo,&sf1ErrHi)) { std::cout << "failed to load EGammaSf\n"; return; } HERE("load egamma ok"); systRelErr=loadMatrix(fname,"sf_syst_rel_error_egamma",nEtBins,nEtaBins,1); if (!systRelErr) return; systRelErrTot=loadMatrix(fname,"sf_syst_rel_error",nEtBins,nEtaBins,1); if (!systRelErrTot) return; HERE("add errors"); addInQuadrature(*sf,*sf1ErrLo, *systRelErr, sf2ErrLo); addInQuadrature(*sf,*sf1ErrHi, *systRelErr, sf2ErrHi); addInQuadrature(*sf,*sf1ErrLo, *systRelErrTot, sf3ErrLo); addInQuadrature(*sf,*sf1ErrHi, *systRelErrTot, sf3ErrHi); HERE("create graphs"); TGraphAsymmErrors* gr1=getAsymGraph(vsEt, etBinSet,etaBinSet,iBin,*sf,*sf1ErrLo,*sf1ErrHi); gr1->GetXaxis()->SetMoreLogLabels(); gr1->GetXaxis()->SetNoExponent(); gr1->Print("range"); TGraphAsymmErrors* gr2=getAsymGraph(vsEt, etBinSet,etaBinSet,iBin,*sf,sf2ErrLo,sf2ErrHi); gr2->GetXaxis()->SetMoreLogLabels(); gr2->GetXaxis()->SetNoExponent(); gr2->Print("range"); TGraphAsymmErrors* gr3=getAsymGraph(vsEt, etBinSet,etaBinSet,iBin,*sf,sf3ErrLo,sf3ErrHi); gr3->GetXaxis()->SetMoreLogLabels(); gr3->GetXaxis()->SetNoExponent(); gr3->Print("range"); double *loc_etBinLimits=DYTools::getEtBinLimits(etBinSet); double *loc_etaBinLimits=DYTools::getEtaBinLimits(etaBinSet); int signedEta=DYTools::signedEtaBinning(etaBinSet); TString binStrForTitle=(vsEt) ? TString(Form(" %5.3lf #leq %s #leq %5.3lf",loc_etaBinLimits[iBin],(signedEta)?"#eta":"abs(#eta)",loc_etaBinLimits[iBin+1])) : TString(Form(" %2.0lf #leq #it{E}_{T} #leq %2.0lf GeV",loc_etBinLimits[iBin],loc_etBinLimits[iBin+1])); TString cpTitle=dataKind+ binStrForTitle; TString xAxisTitle="#it{E}_{T} [GeV]"; if (!vsEt) xAxisTitle=(signedEta) ? "#eta" : "|#eta|"; ComparisonPlot_t cp(ComparisonPlot_t::_ratioPlain,"comp",cpTitle, xAxisTitle,effKind + TString(" scale factor"),"ratio"); cp.SetRefIdx(-111); // no ratio plot if (vsEt) cp.SetLogx(); cp.AddLine(10.,1.,500.,1.,kBlack,2); TCanvas *cx=new TCanvas("cx","cx",600,600); SetSideSpaces(cx,0.05,0.,0.,0.02); gr1->GetYaxis()->SetTitleOffset(1.4); //cp.AddGraph(gr3,label3,"LPE",43); //kRed+3); cp.AddGraph(gr3,label3,"LPE",kRed); //kRed+3); cp.AddGraph(gr2,label2,"LPE",38); //kBlue+2); cp.AddGraph(gr1,label1," PE",kBlack,20); //24 cp.Draw(cx,0,"png",0); cp.TransLegend(transLegendX, transLegendY); cp.WidenLegend(0.25,0.); cx->Update(); // Save file if (saveFileTag.Length()) { TString outfname=TString("fig-sf-egamma-") + cpTitle; outfname.ReplaceAll(" #leq "," "); outfname.ReplaceAll(" ","_"); outfname.ReplaceAll("(#eta)","Eta"); outfname.ReplaceAll("#eta","eta"); outfname.ReplaceAll(".","_"); outfname.ReplaceAll("#it{E}_{T}","Et"); //fname.Append(".png"); std::cout << "outfname=" << outfname << "\n"; TString locOutDir=TString("plots") + saveFileTag; if (doSave) { locOutDir.ReplaceAll("--",""); SaveCanvas(cx,outfname,locOutDir); } else { std::cout << "... canvas not saved, as requested\n"; std::cout << " locOutDir=" << locOutDir << "\n"; } } return ; }
void pileup1(double dzmin, double dzmax) { TH1D* hdz = (TH1D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/PAData_Minbias_5TeV_MBNEW_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","xyzvtxsepmin"); TH3D* h1 = (TH3D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/PAData_Minbias_5TeV_MBNEW_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","multmaxvssecvszvtxsep"); TH2D* h21 = (TH2D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/PAData_Minbias_5TeV_MBNEW_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","multmaxvssec"); TH2D* hNvtxVsMult = (TH2D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/PAData_Minbias_5TeV_MBNEW_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","nvtxvsnmult"); TH1D* htrk_max1 = h1->ProjectionX(); h1->GetZaxis()->SetRange(h1->GetZaxis()->FindBin(dzmin),h1->GetZaxis()->FindBin(dzmax)); h1->GetYaxis()->SetRange(h1->GetYaxis()->FindBin(2),h1->GetYaxis()->FindBin(50)); TH2D* h2D1 = (TH2D*)h1->Project3DProfile("yx100"); h2D1->Rebin2D(5,1); TProfile* hprof1_x = (TProfile*)h2D1->ProfileX("hprof1_x",-1,-1,"s"); TH1D* h1D1 = (TH1D*)h2D1->ProjectionY("h1D1",13,15,"e"); /* TH1D* hdz = (TH1D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/HIData_Minbias_2760GeV_PPRereco_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","xyzvtxsepmin"); TH3D* h = (TH3D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/HIData_Minbias_2760GeV_PPRereco_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","multmaxvssecvszvtxsep"); TH2D* h2 = (TH2D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/HIData_Minbias_2760GeV_PPRereco_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","multmaxvssec"); TH2D* hNvtxVsMult = (TH2D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/HIData_Minbias_2760GeV_PPRereco_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","nvtxvsnmult"); */ TH1D* hdz = (TH1D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/HydjetReco_Minbias_2760GeV_PeripheralNew_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","xyzvtxsepmin"); TH3D* h = (TH3D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/HydjetReco_Minbias_2760GeV_PeripheralNew_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","multmaxvssecvszvtxsep"); TH2D* h2 = (TH2D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/HydjetReco_Minbias_2760GeV_PeripheralNew_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","multmaxvssec"); TH2D* hNvtxVsMult = (TH2D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/HydjetReco_Minbias_2760GeV_PeripheralNew_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","nvtxvsnmult"); /* TH1D* hdz = (TH1D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/HijingReco_Minbias_2760GeV_53x_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","xyzvtxsepmin"); TH3D* h = (TH3D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/HijingReco_Minbias_2760GeV_53x_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","multmaxvssecvszvtxsep"); TH2D* hNvtxVsMult = (TH2D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/HijingReco_Minbias_2760GeV_53x_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","nvtxvsnmult"); */ /* TH1D* hdz = (TH1D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/PAData_Minbias_5TeV_MBNEW_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","xyzvtxsepmin"); TH3D* h = (TH3D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/PAData_Minbias_5TeV_MBNEW_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","multmaxvssecvszvtxsep"); TH2D* h2 = (TH2D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/PAData_Minbias_5TeV_MBNEW_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","multmaxvssec"); TH2D* hNvtxVsMult = (TH2D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/PAData_Minbias_5TeV_MBNEW_INCLMULT_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","nvtxvsnmult"); */ /* TH1D* hdz = (TH1D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/PAData_Minbias_5TeV_HM_PromptSkim_INCLMULT220_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","xyzvtxsepmin"); TH3D* h = (TH3D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/PAData_Minbias_5TeV_HM_PromptSkim_INCLMULT220_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","multmaxvssecvszvtxsep"); TH2D* h2 = (TH2D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/PAData_Minbias_5TeV_HM_PromptSkim_INCLMULT220_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","multmaxvssec"); TH2D* hNvtxVsMult = (TH2D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/PAData_Minbias_5TeV_HM_PromptSkim_INCLMULT220_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","nvtxvsnmult"); */ /* TH1D* hdz = (TH1D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/PAData_Minbias_5TeV_HM_PromptRecoNew_INCLMULT220PURej2sigmaMode1_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","xyzvtxsepmin"); TH3D* h = (TH3D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/PAData_Minbias_5TeV_HM_PromptRecoNew_INCLMULT220PURej2sigmaMode1_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","multmaxvssecvszvtxsep"); TH2D* h2 = (TH2D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/PAData_Minbias_5TeV_HM_PromptRecoNew_INCLMULT220PURej2sigmaMode1_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","multmaxvssec"); TH2D* hNvtxVsMult = (TH2D*)GetHist("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/PAData_Minbias_5TeV_HM_PromptRecoNew_INCLMULT220PURej2sigmaMode1_nmin-1_nmax-1_etatrg-2.4-2.4_etaass-2.4-2.4_centmin-1_centmax-1.root","nvtxvsnmult"); */ TH1D* htrk_max = h->ProjectionX(); h->GetZaxis()->SetRange(h->GetZaxis()->FindBin(dzmin),h->GetZaxis()->FindBin(dzmax)); h->GetYaxis()->SetRange(h->GetYaxis()->FindBin(2),h->GetYaxis()->FindBin(241)); // h->Rebin3D(10,1); TH2D* h2D = (TH2D*)h->Project3DProfile("yx"); h2D->Rebin2D(5,1); TProfile* hprof_x = (TProfile*)h2D->ProfileX("hprof_x",-1,-1,"s"); // TH1D* h1D = (TH1D*)h2D->ProjectionY("h1D",h2D->GetXaxis()->FindBin(200),h2D->GetXaxis()->FindBin(220),"e"); TH1D* h1D = (TH1D*)h2->ProjectionY("h1D",h2->GetXaxis()->FindBin(200),h2->GetXaxis()->FindBin(220),"e"); double xx[1000]; double yy[1000]; for(int i=1;i<=hprof_x->GetNbinsX();i++) { yy[i-1] = hprof_x->GetBinContent(i)+2*hprof_x->GetBinError(i); xx[i-1] = hprof_x->GetBinCenter(i); } TGraph* xx_yy = new TGraph(hprof_x->GetNbinsX(),xx,yy); int ibin = hprof_x->GetXaxis()->FindBin(200); /* TF1* func = new TF1("func","[0]+[1]*x",0,500); double par1 = (hprof_x->GetBinContent(ibin)+hprof_x->GetBinError(ibin)-hprof_x->GetBinContent(1)-hprof_x->GetBinError(1))/(hprof_x->GetBinCenter(ibin)-hprof_x->GetBinCenter(1)); double par0 = hprof_x->GetBinContent(ibin)+hprof_x->GetBinError(ibin)-par1*hprof_x->GetBinCenter(ibin); func->SetParameters(par0,par1); */ // TF1* func = new TF1("func","[0]+[1]*(x-[2])*(x-[2])",0,500); // func->SetParameters(30,-0.1,150); TF1* func = new TF1("func","[0]*x**[1]",0,500); func->SetParameters(0.1,0.5); func->SetParLimits(0,0,10000); func->SetParLimits(1,0,10000); // func->FixParameter(0,5); small dz func->FixParameter(0,2); xx_yy->Fit("func","NO","",10,400); TCanvas* cc6 = new TCanvas("cc6","cc6",550,500); TH2D* htmp = new TH2D("htmp",";N_{trk}^{primary};N_{trk}^{secondary}",500,0,500,50,0,50); htmp->Draw(""); xx_yy->Draw("Psame"); func->SetLineColor(2); func->Draw("Lsame"); TLatex* latex = new TLatex(); latex->SetNDC(); latex->SetTextSize(latex->GetTextSize()*0.75); latex->DrawLatex(0.23,0.87,"PbPb HYDJET, 1<|dz|<2 cm"); // SaveCanvas(cc6,"pPb/corr","NpriVsNsecProfile_2Sigma_hydjet_dz1020_ForAN"); TCanvas* cc4 = new TCanvas("cc4","cc4",550,500); cc4->SetLogz(); hNvtxVsMult->Rebin2D(10,1); // hNvtxVsMult->Scale(1.0/hNvtxVsMult->GetBinContent(0,0)); hNvtxVsMult->SetAxisRange(1,5.9,"Y"); hNvtxVsMult->SetAxisRange(0,280,"X"); hNvtxVsMult->SetTitle(";N_{trk}^{offline};# of vertices"); TProfile* hNvtxVsMult_prof = (TProfile*)hNvtxVsMult->ProfileX("hNvtxVsMult_prof",-1,-1,"s"); hNvtxVsMult->Draw("colz"); // hNvtxVsMult_prof->Draw("PEsame"); // SaveCanvas(cc4,"pPb/corr","NvtxVsMult_PbPb2011_ForAN"); TCanvas* cc5 = new TCanvas("cc5","cc5",550,500); TH1D* hNvtxVsMult_1D = hNvtxVsMult->ProjectionY("hNvtxVsMult_1D",23,23,"e"); hNvtxVsMult_1D->Draw("PE"); // TCanvas* cc3 = new TCanvas("cc3","cc3",550,500); // htrk_max->SetAxisRange(-1.5,1.5,"X"); // htrk_max->Draw("PE"); TCanvas* cc1 = new TCanvas("cc1","cc1",550,500); hdz->SetAxisRange(-1.5,1.5,"X"); hdz->Draw("PE"); // SaveCanvas(cc1,"pPb/corr","dz_pPbPURej3"); TCanvas* c = new TCanvas("c","",580,500); c->SetLogz(); c->SetRightMargin(0.14); h2D->SetTitle(";N_{trk}^{primary};N_{trk}^{secondary}"); h2D->GetXaxis()->CenterTitle(); h2D->GetYaxis()->CenterTitle(); h2D->Draw("colz"); /* h2->SetAxisRange(2,241,"Y"); h2->SetTitle(";N_{trk}^{primary};N_{trk}^{secondary}"); h2->GetXaxis()->CenterTitle(); h2->GetYaxis()->CenterTitle(); h2->Draw("colz"); */ //hprof_x->Draw("PESAME"); // func->Draw("Lsame"); TLatex* latex = new TLatex(); latex->SetNDC(); latex->SetTextSize(latex->GetTextSize()*0.75); // latex->DrawLatex(0.23,0.87,"PbPb data 2011"); // latex->DrawLatex(0.23,0.87,"PbPb HYDJET, 1<|dz|<2 cm"); latex->DrawLatex(0.23,0.87,"HLT_PAPixelTracks_Multiplicity220"); latex->DrawLatex(0.23,0.8,"1<|dz|<2 cm, pileup rejected"); // latex->DrawLatex(0.23,0.87,"pPb pilot"); // SaveCanvas(c,"pPb/corr","NpriVsNsec_NoPURej_pPbTrigger220_ForAN"); // SaveCanvas(c,"pPb/corr","NpriVsNsec_NoPURej_PbPb2011_ForAN"); // SaveCanvas(c,"pPb/corr","NpriVsNsec_NoPURej_hydjet_ForAN_dz1020"); // SaveCanvas(c,"pPb/corr","NpriVsNsec_PURej_pPbTrigger220_dz1020_ForAN"); TCanvas* cc = new TCanvas("cc","",550,500); cc->SetLogy(); h1D->SetTitle(""); h1D->SetXTitle("N_{trk}^{secondary}"); h1D->GetXaxis()->CenterTitle(); h1D->Scale(1.0/h1D->Integral()); htrk_max1->Scale(1.0/htrk_max1->Integral()); htrk_max1->SetMarkerStyle(24); h1D->SetAxisRange(0,50,"X"); h1D->Draw("PE"); htrk_max1->Draw("PESAME"); TLine* l_2sigma = new TLine(h1D->GetMean()+h1D->GetRMS()*2,0,h1D->GetMean()+h1D->GetRMS()*2,0.04); l_2sigma->SetLineWidth(3); l_2sigma->SetLineColor(2); l_2sigma->Draw("Lsame"); TLatex* latex = new TLatex(); latex->SetTextColor(2); latex->SetTextSize(latex->GetTextSize()*0.75); latex->DrawLatex(h1D->GetMean()+h1D->GetRMS()*2*0.7,0.053,"Mean+2#timesRMS"); TLine* l_1sigma = new TLine(h1D->GetMean()+h1D->GetRMS()*1,0,h1D->GetMean()+h1D->GetRMS()*1,0.1); l_1sigma->SetLineWidth(3); l_1sigma->SetLineStyle(9); l_1sigma->SetLineColor(4); l_1sigma->Draw("Lsame"); TLatex* latex = new TLatex(); latex->SetTextColor(4); latex->SetTextSize(latex->GetTextSize()*0.75); latex->DrawLatex(h1D->GetMean()+h1D->GetRMS()*0.4,0.123,"Mean+1#timesRMS"); TLatex* latex = new TLatex(); latex->SetTextColor(1); latex->SetNDC(); latex->SetTextSize(latex->GetTextSize()*0.75); latex->DrawLatex(0.65,0.85,"200<N_{trk}^{primary}<220"); SaveCanvas(cc,"pPb/corr","NsecDist_PUestimate"); TLegend* legend = new TLegend(0.4,0.58,0.9,0.68); legend->SetFillColor(0); legend->SetFillStyle(0); legend->AddEntry(h1D,"N_{trk}^{secondary} from PbPb Hydjet","P"); legend->AddEntry(htrk_max1,"N_{trk}^{primary} from pPb pilot","P"); legend->Draw(); TH1D* hhh = new TH1D("hhh",";N_{trk}^{primary};Residual pileup (%)",25,0,500); for(int i=1;i<=hhh->GetNbinsX();i++) { TH1D* h1Dtmp = (TH1D*)h2->ProjectionY("h1Dtmp",h2->GetXaxis()->FindBin((i-1)*20),h2->GetXaxis()->FindBin(i*20),"e"); double frac = htrk_max1->Integral(1,htrk_max1->FindBin(h1Dtmp->GetMean()+h1Dtmp->GetRMS()*2))*3.0; hhh->SetBinContent(i,frac); } TCanvas* cc4 = new TCanvas("cc4","",550,500); hhh->GetXaxis()->CenterTitle(); hhh->GetYaxis()->CenterTitle(); hhh->GetYaxis()->SetTitleOffset(hhh->GetYaxis()->GetTitleOffset()*1.3); hhh->Draw("hist"); TLatex* latex = new TLatex(); latex->SetTextColor(1); latex->SetNDC(); latex->SetTextSize(latex->GetTextSize()*0.75); latex->DrawLatex(0.25,0.85,"Mean+2#timesRMS cut"); SaveCanvas(cc4,"pPb/corr","ResidualPUvsNtrkpri"); }