void plot_mc(string name="g", double q2=1.9, Int_t n=0) { // SetAtlasStyle(); TGraphErrors *p; TString nn; nn.Form("ave_%s_vs_x_for_Q2=%g",name.c_str(),q2); gDirectory->GetObject(nn,p); // p->Print(); Double_t ratsize = 0.0; TCanvas *c = new TCanvas("PDF","pdf",600,600); TPad *pad1 = new TPad("pad1","pad1",0.,ratsize,1.,1.); pad1->SetLogx(); pad1->Draw(); pad1->cd(); p->GetXaxis()->Set(101,0.0001,1.); p->SetFillColor(kRed-2); p->SetFillStyle(3001); p->SetLineWidth(1); p->SetLineColor(kRed); p->GetYaxis()->SetTitle(name.c_str()); p->GetYaxis()->SetTitleSize(0.06); p->GetYaxis()->SetTitleOffset(1.); p->GetXaxis()->Set(101,0.0001,1.); p->Draw("ALE3"); Double_t av = 0; Double_t av2 = 0; for (Int_t i = 1; i<n+1 ; i++) { nn.Form("%s_vs_x_for_Q^{2}=%g_%i",name.c_str(),q2,i); TGraph *pp = NULL; gDirectory->GetObject(nn,pp); if (pp != NULL) { pp->SetLineColor(kGreen); pp->Draw("L"); av += pp->GetY()[0]; av2 += pp->GetY()[0]*pp->GetY()[0]; cout << i << " "<<pp->GetY()[0] << endl; } } av /= n; av2 = sqrt(av2/n - av*av); // cout << n << " "<<av << " "<< av2<<endl; p->Draw("E3C"); }
void plotter(Int_t octant=1){ gROOT->Reset(); gROOT->SetStyle("Plain"); TString runNums[5] = {"14296","15736","16654","17635","18875"}; TCanvas *c1 = new TCanvas(); TGraphErrors *gPos = new TGraphErrors(Form("md%dpos.dat",octant),"%lg %lg %lg"); TGraphErrors *gNeg = new TGraphErrors(Form("md%dneg.dat",octant),"%lg %lg %lg"); gPos->SetMarkerColor(kBlue); gNeg->SetMarkerColor(kRed); gPos->SetLineColor(kBlue); gNeg->SetLineColor(kRed); gPos->SetFillStyle(0); gNeg->SetFillStyle(0); gPos->SetTitle(Form("MD%dPOS",octant)); gNeg->SetTitle(Form("MD%dNEG",octant)); TMultiGraph *gm = new TMultiGraph("gm",Form("1/Yield for MD%d",octant)); gm->Add(gPos); gm->Add(gNeg); gm->Draw("ap"); gm->GetYaxis()->SetTitle("1/Yield (uA/V)"); gm->GetXaxis()->SetTitle("Run Number"); gm->GetXaxis()->SetNdivisions(505,kTRUE); for(Int_t i=0; i<5; i++){ gm->GetXaxis()->SetBinLabel(gm->GetXaxis()->FindBin(150000+i*10000),runNums[i].Data()); } gm->GetXaxis()->SetTitleOffset(1.4); c1->BuildLegend(); }
/// /// Plot the discrepancy between the observable and the predicted /// observable when making predictions about observables by scanning /// them. This checks if the chi2 term of the observable is tight enough. /// This only works for 1D scans for now. /// void ParameterEvolutionPlotter::plotObsScanCheck() { vector<RooSlimFitResult*> results = curveResults; cout << "ParameterEvolutionPlotter::plotObsScanCheck() : plotting ..." << endl; TCanvas *c2 = newNoWarnTCanvas("plotObsScanCheck"+getUniqueRootName(), title, 800,600); c2->SetLeftMargin(0.2); // get observable TGraphErrors *g = new TGraphErrors(results.size()); int iGraph = 0; for ( int i=0; i<results.size(); i++ ){ assert(results[i]); // get value of observable float obsValue = results[i]->getParVal(scanVar1); float obsError = w->var(scanVar1)->getError(); // get value of theory prediction setParameters(w,parsName,results[i]); TString thName = scanVar1; thName.ReplaceAll("_obs","_th"); if ( !w->function(thName) ){ cout << "ParameterEvolutionPlotter::plotObsScanCheck() : ERROR : theory value not found: " << thName << endl; continue; } float thValue = w->function(thName)->getVal(); g->SetPoint(iGraph, iGraph, obsValue-thValue); g->SetPointError(iGraph, 0., obsError); iGraph++; } g->SetTitle(scanVar1); g->GetXaxis()->SetTitle("scan step"); g->GetYaxis()->SetTitleSize(0.06); g->GetYaxis()->SetLabelSize(0.04); g->GetYaxis()->SetTitleOffset(1.5); g->GetYaxis()->SetTitle(scanVar1); Int_t ci = 927; TColor *col = new TColor(ci, 0, 0, 1, " ", 0.5); g->SetFillColor(ci); g->SetFillStyle(1001); g->Draw("a3"); g->Draw("lxsame"); c2->Update(); savePlot(c2, "parEvolutionObsSanCheck_"+name+"_"+scanVar1); }
void drawDifference(TH1* iH0,TH1 *iH1,TH1* iH2, TGraphErrors* iH3, int chnl,TGraphErrors* iH4,TGraphAsymmErrors* iH5,TH1* StatErrBand,TGraphErrors* iH6){ std::string lName = std::string(iH0->GetName()); TH1F *lHDiff = new TH1F((lName+"Diff").c_str(),(lName+"Diff").c_str(),nBins-1,WptLogBins);// lHDiff->Sumw2(); TH1F *lXHDiff1 = new TH1F((lName+"XDiff1").c_str(),(lName+"XDiff1").c_str(),iH0->GetNbinsX(),iH0->GetXaxis()->GetXmin(),iH0->GetXaxis()->GetXmax()); int i1 = 0; lXHDiff1->SetLineWidth(2); lXHDiff1->SetLineColor(kBlack); //lXHDiff1->SetLineStyle(2); StatErrBand->SetMarkerStyle(kFullCircle); StatErrBand->SetMarkerColor(kBlack);StatErrBand->SetMarkerSize(0.6); StatErrBand->SetLineWidth(2); StatErrBand->SetLineColor(kBlack); //lHDiff->GetYaxis()->SetRangeUser(0.2,1.8); lHDiff->GetYaxis()->SetRangeUser(0.6,1.5); if (chnl == 2) lHDiff->GetYaxis()->SetRangeUser(0.4,1.4); if (chnl == 3) lHDiff->GetYaxis()->SetRangeUser(0.3,1.3); lHDiff->GetYaxis()->SetTitleOffset(0.4); lHDiff->GetYaxis()->SetTitleSize(0.12); lHDiff->GetYaxis()->SetLabelSize(0.12); lHDiff->GetYaxis()->CenterTitle(); lHDiff->GetXaxis()->SetTitleOffset(1.); lHDiff->GetXaxis()->SetTitleSize(0.12); lHDiff->GetXaxis()->SetLabelSize(0); if(chnl==3) lHDiff->GetXaxis()->SetLabelSize(0.12); lHDiff->GetYaxis()->SetNdivisions(405); if (chnl == 3) lHDiff->GetXaxis()->SetTitle(" W p_{T} "); lHDiff->GetYaxis()->SetTitle("Theory/Data"); //lHDiff->GetYaxis()->SetTitle("Data/ResBos"); gStyle->SetOptStat(0); for(int i0 = 0; i0 < lHDiff->GetNbinsX()+1; i0++) { double lXCenter = lHDiff->GetBinCenter(i0); double lXVal = iH0 ->GetBinContent(i0); lXHDiff1->SetBinContent(i0, 1.0); while(iH1->GetBinCenter(i1) < lXCenter) {i1++;} if(iH1->GetBinContent(i0) > 0) lHDiff->SetBinContent(i0,lXVal/(iH1->GetBinContent(i0))); //if(iH1->GetBinContent(i0) > 0) lHDiff->SetBinError(i0,iH0->GetBinError(i0)/(iH1->GetBinContent(i0))); if(iH1->GetBinContent(i0) > 0) lHDiff->SetBinError(i0,0.00001); } TGraphErrors* ErrBand = new TGraphErrors(iH2); ErrBand->SetFillColor(kBlack); ErrBand->SetFillStyle(3354); ErrBand->SetLineWidth(1); if (chnl == 1) { lHDiff->SetMarkerStyle(kOpenCircle); lHDiff->SetMarkerColor(kBlue); lHDiff->SetLineColor(kBlue); } if (chnl == 2) { lHDiff->SetMarkerStyle(kOpenTriangleUp); lHDiff->SetMarkerColor(kRed); lHDiff->SetLineColor(kRed); } if (chnl == 3) { lHDiff->SetMarkerStyle(kOpenSquare); lHDiff->SetMarkerColor(kGreen+3); lHDiff->SetLineColor(kGreen+3); } lHDiff->SetMarkerSize(0.8); //lHDiff->SetLineColor(kBlack); lHDiff->SetMarkerColor(kBlack); lHDiff->SetTitle(""); lHDiff->Draw("E"); if (chnl == 1) iH5->Draw("2same"); if (chnl == 2 || chnl == 3) iH4->Draw("2same"); if (chnl == 2 || chnl == 3) iH3->Draw("2same"); if (chnl == 3) iH6->Draw("2"); lXHDiff1->Draw("histsame"); ErrBand->Draw("2same"); lHDiff->Draw("Esame"); StatErrBand->Draw("E1same"); }
int theoryStudy_separate(const TString BaseName) { TString tmpTStr; char tmpName[30],tmpName_org[30]; int Numb; TFile *f_theory; TFile *f_Data; double fScale[14]={0}; double fScale_WtoMu[14]={0}; double fScale_WtoEle[14]={0}; double fScale_WptoMu[14] = {0, 64.48, 1.105, 8.274, 9.716, 7.226, 8.534, 5.76, 6.4783, 4.5879, 1.3952, 0.52169, 0.2662, 0.09476}; double fScale_WmtoMu[14] = {0, 45.388, 1.601, 4.628, 6.315, 4.866, 5.935, 4.1334, 4.6873, 3.4607, 1.0583, 0.36488, 0.18399, 0.063812}; double fScale_WptoEle[14] = {0, 74.18, 2.079, 8.808, 10.496, 7.646, 8.934, 5.998, 6.6528, 4.7955, 1.4991, 0.4733, 0.28867, 0.09178}; double fScale_WmtoEle[14] = {0, 48.427, 1.315, 5.692, 6.855, 5.33, 6.332, 4.3037, 4.9102, 3.7312, 1.1115, 0.38448, 0.19356, 0.062427}; for(int i(0);i<14;i++) { fScale_WtoMu[i] = sqrt((fScale_WptoMu[i]*fScale_WptoMu[i])+(fScale_WmtoMu[i]*fScale_WmtoMu[i])); fScale_WtoEle[i] = sqrt((fScale_WptoEle[i]*fScale_WptoEle[i])+(fScale_WmtoEle[i]*fScale_WmtoEle[i])); } if(BaseName=="WInclToMuNu") { for(int i(0);i<14;i++) { fScale[i] = fScale_WtoMu[i]; cout << "fScale : " << fScale[i] << "\t fScale_WtoMu : " << fScale_WtoMu[i] << endl; } f_theory = new TFile("Theory_Muon.root"); f_Data = new TFile("Result_WinclMu.root"); } if(BaseName=="WInclToEleNu") { for(int i(0);i<14;i++) { fScale[i] = fScale_WtoEle[i]; cout << "fScale : " << fScale[i] << "\t fScale_WtoEle : " << fScale_WtoEle[i] << endl; } f_theory = new TFile("Theory_Ele.root"); f_Data = new TFile("Result_WinclEle.root"); } TH1D *hResbosLog30 = new TH1D("hResbosLog30","hResbosLog30",13,WptLogBins);hResbosLog30->Sumw2(); TH1D *hResbosLog31 = new TH1D("hResbosLog31","hResbosLog31",13,WptLogBins);hResbosLog31->Sumw2(); TH1D *hResbosLog34 = new TH1D("hResbosLog34","hResbosLog34",13,WptLogBins);hResbosLog34->Sumw2(); TH1D *hFewzLog = new TH1D("hFewzLog","hFewzLog",13,WptLogBins);hFewzLog->Sumw2(); TH1D *hPowhegLog = new TH1D("hPowhegLog","hPowhegLog",13,WptLogBins);hPowhegLog->Sumw2(); TH1D *hDataLog = new TH1D("hDataLog","hDataLog",13,WptLogBins);hDataLog->Sumw2(); TH1D *hDataNoLog = new TH1D("hDataNoLog","hDataNoLog",13,WptBins);hDataNoLog->Sumw2(); TH1D *hDataErrBand = new TH1D("hDataErrBand","hDataErrBand",13,WptLogBins);hDataErrBand->Sumw2(); TH1D *hPowhegErrBand = new TH1D("hPowhegErrBand","hPowhegErrBand",13,WptLogBins);hPowhegErrBand->Sumw2(); TH1D *hPowhegErrBandPDF = new TH1D("hPowhegErrBandPDF","hPowhegErrBandPDF",13,WptLogBins);hPowhegErrBandPDF->Sumw2(); TH1D *hFewzErrBand = new TH1D("hFewzErrBand","hFewzErrBand",13,WptLogBins);hFewzErrBand->Sumw2(); TH1D *hFewzTheoryErrBand = new TH1D("hFewzTheoryErrBand","hFewzTheoryErrBand",13,WptLogBins);hFewzTheoryErrBand->Sumw2(); //FEWZ Scale Syst TH1D *hFewzScale = new TH1D("hFewzScale","hFewzScale",13,WptLogBins);hFewzScale->Sumw2(); TH1D *hFewzScaleErrBand = new TH1D("hFewzScaleErrBand","hFewzScaleErrBand",13,WptLogBins);hFewzScaleErrBand->Sumw2(); TH1D *hStatErr = new TH1D("hStatErr","hStatErr",13,WptLogBins);hStatErr->Sumw2(); TH1D* lResbos[7]; TH1D* lResbos30; TH1D* lResbos31; TH1D* lResbos34; TH1D* lFEWZ; TH1D* lPowheg; TH1D* lData; TH1D* hRD; for( int i(0);i<7;i++) { Numb = 29+i; sprintf(tmpName_org,"hResbos%d",Numb); sprintf(tmpName,"lResbos_%d",i); lResbos[i] = (TH1D*)f_theory->Get(tmpName_org)->Clone(tmpName); } lResbos30 = (TH1D*)f_theory->Get("hResbos30")->Clone(); lResbos31 = (TH1D*)f_theory->Get("hResbos31")->Clone(); lResbos34 = (TH1D*)f_theory->Get("hResbos34")->Clone(); lFEWZ = (TH1D*)f_theory->Get("hxsec")->Clone(); lPowheg = (TH1D*)f_Data->Get("SVD_BornGen")->Clone(); orgPowheg = (TH1D*)f_Data->Get("SVD_BornGen")->Clone(); lData = (TH1D*)f_Data->Get("BornEffCorr")->Clone(); hRD = (TH1D*)f_Data->Get("data_Rec")->Clone(); for( int ipt(1);ipt<nBins;ipt++) { double tmp = sqrt(hRD->GetBinContent(ipt)); hRD->SetBinError(ipt,tmp); cout<<ipt<<"\t"<<hRD->GetBinContent(ipt)<<"\t"<<hRD->GetBinError(ipt)<<endl; } lPowheg->Scale(1./18.429); lData->Scale(1./18.429); hRD->Scale(1./18.429); for( int ipt(1);ipt<nBins;ipt++) { cout<<ipt<<"\t"<<hRD->GetBinError(ipt)<<"\t"<<lData->GetBinError(ipt)<<endl; } cout << "Resbos Total Xsec: " << lResbos30->Integral() << endl; cout << "Data Total Xsec: " << lData->Integral() << endl; Double_t resb30[nBins-1]; Double_t errMax[nBins-1]; Double_t errMin[nBins-1]; double tmpVal,tmpDiff; for( int ipt(0);ipt<nBins-1;ipt++) { resb30[ipt] = lResbos30->GetBinContent(ipt+1)/hDataNoLog->GetXaxis()->GetBinWidth(ipt+1); double norVal = lResbos[1]->GetBinContent(ipt+1); errMax[ipt] = -99999; errMin[ipt] = 990009; for (int i(0);i<7;i++) { tmpVal = lResbos[i]->GetBinContent(ipt+1); tmpDiff = tmpVal - norVal; if( tmpDiff > errMax[ipt] ) errMax[ipt] = tmpDiff; if( tmpDiff < errMin[ipt] ) errMin[ipt] = tmpDiff; } if (errMax[ipt] < 0) errMax[ipt] = 0.; if (errMin[ipt] > 0) errMin[ipt] = 0.; if (errMin[ipt] < 0) errMin[ipt] = -errMin[ipt]; errMax[ipt] = errMax[ipt]/hDataNoLog->GetXaxis()->GetBinWidth(ipt+1); errMin[ipt] = errMin[ipt]/hDataNoLog->GetXaxis()->GetBinWidth(ipt+1); } Double_t errFewz[nBins-1]; Double_t vPowheg[nBins-1]; Double_t vFewz[nBins-1]; Double_t resbVal[nBins-1],errResbosDataLo[nBins-1],errResbosDataHi[nBins-1]; for( int ipt(1);ipt<=nBins-1;ipt++) { hResbosLog30->SetBinContent(ipt,lResbos30->GetBinContent(ipt)/hDataNoLog->GetXaxis()->GetBinWidth(ipt) ); hResbosLog31->SetBinContent(ipt,lResbos31->GetBinContent(ipt)); hResbosLog34->SetBinContent(ipt,lResbos34->GetBinContent(ipt)); hFewzLog->SetBinContent(ipt,lFEWZ->GetBinContent(ipt)/hDataNoLog->GetXaxis()->GetBinWidth(ipt)); //hFewzLog->SetBinError(ipt,lFEWZ->GetBinError(ipt)/hDataNoLog->GetXaxis()->GetBinWidth(ipt)); hFewzLog->SetBinError(ipt,sqrt((lFEWZ->GetBinError(ipt)/hDataNoLog->GetXaxis()->GetBinWidth(ipt))*(lFEWZ->GetBinError(ipt)/hDataNoLog->GetXaxis()->GetBinWidth(ipt))+(fScale[ipt]/hDataNoLog->GetXaxis()->GetBinWidth(ipt))*(fScale[ipt]/hDataNoLog->GetXaxis()->GetBinWidth(ipt)))); hPowhegLog->SetBinContent(ipt,lPowheg->GetBinContent(ipt)/hDataNoLog->GetXaxis()->GetBinWidth(ipt)); hPowhegLog->SetBinError(ipt,sqrt(lPowheg->GetBinContent(ipt))/hDataNoLog->GetXaxis()->GetBinWidth(ipt)); hDataLog->SetBinContent(ipt,lData->GetBinContent(ipt)/hDataNoLog->GetXaxis()->GetBinWidth(ipt)); hDataLog->SetBinError(ipt,lData->GetBinError(ipt)/hDataNoLog->GetXaxis()->GetBinWidth(ipt)); hDataErrBand->SetBinContent(ipt,1.); hDataErrBand->SetBinError(ipt,lData->GetBinError(ipt)/lData->GetBinContent(ipt)); hStatErr->SetBinContent(ipt,1.); hStatErr->SetBinError(ipt,hRD->GetBinError(ipt)/lData->GetBinContent(ipt)); hPowhegErrBand->SetBinContent(ipt,hPowhegLog->GetBinContent(ipt)/hDataLog->GetBinContent(ipt)); hPowhegErrBand->SetBinError(ipt,sqrt(orgPowheg->GetBinContent(ipt))/orgPowheg->GetBinContent(ipt)); hPowhegErrBandPDF->SetBinContent(ipt,hPowhegLog->GetBinContent(ipt)/hDataLog->GetBinContent(ipt)); //hPowhegErrBandPDF->SetBinError(ipt,lPowheg->GetBinError(ipt)/hDataLog->GetBinContent(ipt)/hDataNoLog->GetXaxis()->GetBinWidth(ipt)); hPowhegErrBandPDF->SetBinError(ipt,sqrt(orgPowheg->GetBinContent(ipt))/orgPowheg->GetBinContent(ipt)+lPowheg->GetBinError(ipt)/hDataLog->GetBinContent(ipt)/hDataNoLog->GetXaxis()->GetBinWidth(ipt)); hFewzErrBand->SetBinContent(ipt,hFewzLog->GetBinContent(ipt)/hDataLog->GetBinContent(ipt)); hFewzErrBand->SetBinError(ipt,0.01); hFewzScale->SetBinContent(ipt,hFewzLog->GetBinContent(ipt)/hDataLog->GetBinContent(ipt)); hFewzScale->SetBinError(ipt,fScale[ipt]/hDataNoLog->GetXaxis()->GetBinWidth(ipt)); hFewzTheoryErrBand->SetBinContent(ipt,hFewzLog->GetBinContent(ipt)/hDataLog->GetBinContent(ipt)); //hFewzTheoryErrBand->SetBinError(ipt,hFewzLog->GetBinError(ipt)/hDataLog->GetBinContent(ipt)); //hFewzTheoryErrBand->SetBinError(ipt,0.01+hFewzLog->GetBinError(ipt)/hDataLog->GetBinContent(ipt)); hFewzTheoryErrBand->SetBinError(ipt,0.01+(hFewzLog->GetBinError(ipt)+hFewzScale->GetBinError(ipt))/hDataLog->GetBinContent(ipt)); hFewzScaleErrBand->SetBinContent(ipt,hFewzLog->GetBinContent(ipt)/hDataLog->GetBinContent(ipt)); hFewzScaleErrBand->SetBinError(ipt,0.01+hFewzScale->GetBinError(ipt)/hDataLog->GetBinContent(ipt)); resbVal[ipt-1]=hResbosLog30->GetBinContent(ipt)/hDataLog->GetBinContent(ipt); errResbosDataLo[ipt-1]=errMin[ipt-1]/hDataLog->GetBinContent(ipt); errResbosDataHi[ipt-1]=errMax[ipt-1]/hDataLog->GetBinContent(ipt); cout<<ipt<<"\t"<<errMin[ipt-1]<<"\t"<<errMax[ipt-1]<<"\t"<<hDataLog->GetBinContent(ipt)<<"\t"<<errResbosDataLo[ipt-1]<<"\t"<<errResbosDataHi[ipt-1]<<endl; //cout<<ipt<<"\t"<<hResbosLog30->GetBinContent(ipt)<<"\t"<<hDataLog->GetBinContent(ipt)<<"\t"<<hPowhegLog->GetBinError(ipt)<<endl; } hDataLog->SetMarkerStyle(kFullCircle); hDataLog->SetMarkerColor(kBlack); hDataLog->SetMarkerSize(1); hStatErr->SetMarkerStyle(kFullCircle); hStatErr->SetMarkerColor(kBlack); hStatErr->SetMarkerSize(0.6); TGraphErrors *hData = new TGraphErrors(hDataLog); TGraphErrors *hPowheg = new TGraphErrors(hPowhegLog); TGraphErrors *hFewz = new TGraphErrors(hFewzLog); TGraphAsymmErrors* hResbos = new TGraphAsymmErrors(nBins-1, ax, resb30, aex, aex, errMin, errMax); TGraphAsymmErrors* ResbosErrBand = new TGraphAsymmErrors(nBins-1, ax, resbVal, aex, aex, errResbosDataLo, errResbosDataHi); TGraphErrors* pRatio = new TGraphErrors(hPowhegErrBand); TGraphErrors* pRatioPDF = new TGraphErrors(hPowhegErrBandPDF); TGraphErrors* fRatio = new TGraphErrors(hFewzErrBand); TGraphErrors* fTheoryRatio = new TGraphErrors(hFewzTheoryErrBand); TGraphErrors* fScaleRatio = new TGraphErrors(hFewzScaleErrBand); TGraphErrors* dataErrBand = new TGraphErrors(hDataErrBand); dataErrBand->SetFillColor(kBlack); dataErrBand->SetFillStyle(3354); ResbosErrBand->SetFillColor(kBlue-7); ResbosErrBand->SetFillStyle(3001); //pRatio->SetFillColor(kRed-7); pRatio->SetFillColor(kRed-10); pRatio->SetFillStyle(3001); pRatioPDF->SetFillColor(kRed+2); pRatioPDF->SetFillStyle(3001); fRatio->SetFillColor(kGreen); fRatio->SetFillStyle(3001); //fTheoryRatio->SetFillColor(kGreen-9); fTheoryRatio->SetFillColor(kGreen+3); fTheoryRatio->SetFillStyle(3001); fScaleRatio->SetFillColor(kGreen+7); fScaleRatio->SetFillStyle(3001); hFewz->SetFillColor(kGreen); hFewz->SetFillStyle(3305); hPowheg->SetFillColor(kRed); hPowheg->SetFillStyle(3345); hResbos->SetFillColor(kBlue); hResbos->SetFillStyle(3354); TLegend *lL =new TLegend(0.2,0.2,0.52,0.38); lL->SetFillColor(0); lL->SetBorderSize(0); lL->AddEntry(hData,"Unfolded","PL"); lL->AddEntry(hPowheg,"Powheg CT10 NLO","f"); lL->AddEntry(hFewz,"FEWZ CT10 NNLO","f"); lL->AddEntry(hResbos,"ResBos CT10 NNLO","f"); TPaveText *tb = new TPaveText(0.2,0.39,0.52,0.5,"NDC"); tb->SetBorderSize(0); tb->SetFillStyle(0); tb->AddText("18.43 pb^{-1} at #sqrt{s} = 8 TeV"); if (BaseName=="WpToMuNu") tb->AddText("W^{+} #rightarrow #mu^{+} #nu"); if (BaseName=="WmToMuNu") tb->AddText("W^{-} #rightarrow #mu^{-} #bar{#nu}"); if (BaseName=="WInclToMuNu") tb->AddText("W #rightarrow #mu #nu"); if (BaseName=="WpToEleNu") tb->AddText("W^{+} #rightarrow e^{+} #nu"); if (BaseName=="WmToEleNu") tb->AddText("W^{-} #rightarrow e^{-} #bar{#nu}"); if (BaseName=="WInclToEleNu") tb->AddText("W #rightarrow e #nu"); TCanvas *lC1 = new TCanvas("Can","Can",800,840); lC1->cd(); lC1->SetLogy(); lC1->cd(1)->SetPad(0,0.05,0.95,1.0); lC1->cd(1)->SetTopMargin(0.05); lC1->cd(1)->SetBottomMargin(0.1); lC1->cd(1)->SetLeftMargin(0.15); lC1->cd(1)->SetRightMargin(0.07); lC1->cd(1)->SetTickx(1); lC1->cd(1)->SetTicky(1); gStyle->SetLineWidth(2.); gStyle->SetOptStat(0); gStyle->SetHatchesSpacing(0.75); gStyle->SetHatchesLineWidth(2); gPad->SetLogx(1); gPad->SetLogy(1); hPowheg->GetYaxis()->SetRangeUser(1e-4,5*resb30[0]); hPowheg->SetTitle(""); hPowheg->GetYaxis()->SetTitle("Cross-section [pb (GeV/c)^{-1}]"); hPowheg->GetXaxis()->SetTitle("W p_{T}"); hPowheg->GetXaxis()->SetTitleOffset(1.); hPowheg->GetYaxis()->SetTitleOffset(1.5); hPowheg->GetYaxis()->SetTitleSize(0.03); hPowheg->GetYaxis()->SetLabelSize(0.03); hPowheg->GetXaxis()->SetTitleSize(0.03); hPowheg->GetXaxis()->SetLabelSize(0.03); hPowheg->Draw("A2"); hFewz->Draw("2"); hResbos->Draw("2"); hData->Draw("p"); lL->Draw(); tb->Draw(); if(BaseName=="WInclToMuNu") sprintf(tmpName,"winclmnCrossSec.png"); if (BaseName=="WInclToEleNu") sprintf(tmpName,"winclenCrossSec.png"); lC1->SaveAs(tmpName); TCanvas *lC2 = new TCanvas("Can","Can",800,800); lC2->cd(); lC2->SetLogy(); lC2->Divide(1,3,0,0); lC2->cd(1)->SetPad(0,0.67,0.95,0.95); lC2->cd(1)->SetTopMargin(0.05); lC2->cd(1)->SetBottomMargin(0.01); lC2->cd(1)->SetLeftMargin(0.15); lC2->cd(1)->SetRightMargin(0.07); lC2->cd(1)->SetTickx(1); lC2->cd(1)->SetTicky(1); lC2->cd(1)->SetLogx(1); TPaveText *tb1 = new TPaveText(0.15,0.82,0.35,0.92,"NDC"); tb1->SetBorderSize(0); tb1->SetFillStyle(0); tb1->SetTextSize(0.12); tb1->AddText("ResBos"); TLegend *rL1 =new TLegend(0.2,0.05,0.86,0.15); rL1->SetFillColor(0); rL1->SetBorderSize(0); rL1-> SetNColumns(3); rL1->AddEntry(ResbosErrBand,"Theory unc. (gen)","F"); rL1->AddEntry(hStatErr,"Statistic error (data)","PLE1"); rL1->AddEntry(dataErrBand,"Stat. + Syst. (data)","F"); rL1->SetTextSize(0.07); drawDifference(hResbosLog30,hDataLog,hDataErrBand,pRatio,1,pRatio,ResbosErrBand,hStatErr,fScaleRatio); rL1->Draw(); tb1->Draw(); lC2->cd(2)->SetPad(0,0.37,0.95,0.65); lC2->cd(2)->SetTopMargin(0.01); lC2->cd(2)->SetBottomMargin(0.01); lC2->cd(2)->SetLeftMargin(0.15); lC2->cd(2)->SetRightMargin(0.07); lC2->cd(2)->SetTickx(1); lC2->cd(2)->SetTicky(1); lC2->cd(2)->SetLogx(1); TPaveText *tb2 = new TPaveText(0.15,0.82,0.35,0.92,"NDC"); tb2->SetBorderSize(0); tb2->SetFillStyle(0); tb2->SetTextSize(0.12); tb2->AddText("Powheg"); TLegend *rL2 =new TLegend(0.2,0.05,0.68,0.30); rL2->SetFillColor(0); rL2->SetBorderSize(0); rL2-> SetNColumns(2); rL2->AddEntry(pRatioPDF,"PDF unc. (gen)","F"); rL2->AddEntry(hStatErr,"Statistic error (data)","PLE1"); rL2->AddEntry(pRatio,"Statistical unc. (gen)","F"); rL2->AddEntry(dataErrBand,"Stat. + Syst. (data)","F"); rL2->SetTextSize(0.07); drawDifference(hPowhegLog,hDataLog,hDataErrBand,pRatio,2,pRatioPDF,ResbosErrBand,hStatErr,fScaleRatio); rL2->Draw(); tb2->Draw(); lC2->cd(3)->SetPad(0,0.07,0.95,0.35); lC2->cd(3)->SetTopMargin(0.01); lC2->cd(3)->SetBottomMargin(0.05); lC2->cd(3)->SetLeftMargin(0.15); lC2->cd(3)->SetRightMargin(0.07); lC2->cd(3)->SetTickx(1); lC2->cd(3)->SetTicky(1); lC2->cd(3)->SetLogx(1); TPaveText *tb3 = new TPaveText(0.15,0.82,0.35,0.92,"NDC"); tb3->SetBorderSize(0); tb3->SetFillStyle(0); tb3->SetTextSize(0.12); tb3->AddText("Fewz"); TLegend *rL3 =new TLegend(0.2,0.1,0.68,0.30); rL3->SetFillColor(0); rL3->SetBorderSize(0); rL3-> SetNColumns(2); rL3->AddEntry(fTheoryRatio,"PDF unc. (gen)","F"); rL3->AddEntry(fScaleRatio,"Scale unc. (gen)","F"); rL3->AddEntry(hStatErr,"Statistic error (data)","PLE1"); rL3->AddEntry(fRatio,"Statistical unc. (gen)","F"); rL3->AddEntry(dataErrBand,"Stat. + Syst. (data)","F"); rL3->SetTextSize(0.07); drawDifference(hFewzLog,hDataLog,hDataErrBand,fRatio,3,fTheoryRatio,ResbosErrBand,hStatErr,fScaleRatio); rL3->Draw(); tb3->Draw(); if(BaseName=="WInclToMuNu") sprintf(tmpName,"winclmnRatioTheoData.png"); if (BaseName=="WInclToEleNu") sprintf(tmpName,"winclenRatioTheoData.png"); lC2->SaveAs(tmpName); return 0; }
void plot_cent_allQQ(bool isPaper=false) { gStyle->SetOptFit(0); gStyle->SetOptStat(0); // incl. and prompt J/psi // 0-100, 0-10, 10-20, 20-30, 30-40, 40-50, 50-100 double promptTAA[] = {5.6625, 23.1857, 14.4777, 8.7830, 5.0892, 2.7484, 0.4682}; double promptTAAError[] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; double promptNpart[] = {113.0518, 355.3528, 261.4178, 187.1470, 129.9835, 86.2622, 22.0709}; double promptNpartError[] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; double promptNcoll[] = {362.4007, 1483.8875, 926.5725, 562.1105, 325.7105, 175.8948, 29.9663}; double promptNcollError[] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; double promptrelCentBinWidth[] = {10.0, 1.0, 1.0, 1.0, 1.0, 1.0, 5.0}; // Upsilon // 0-100, 0-10, 10-20, 20-100 double upsTAA[] = {5.6625, 23.1857, 14.4777, 2.3702}; double upsTAAError[] = {0.0, 0.0, 0.0, 0.0}; double upsNpart[] = {113.0518, 355.3528, 261.4178, 64.2184}; double upsNpartError[] = {0.0, 0.0, 0.0, 0.0}; double upsNcoll[] = {362.4007, 1483.8875, 926.5725, 151.6934}; double upsNcollError[] = {0.0, 0.0, 0.0, 0.0}; double upsrelCentBinWidth[] = {10.0, 1.0, 1.0, 8.0}; // non-prompt J/psi // 0-100, 0-20, 20-100 double nonPromptTAA[] = {5.6625, 18.8317, 2.3702}; double nonPromptTAAError[] = {0.0, 0.0, 0.0}; double nonPromptNpart[] = {113.0518, 308.3853, 64.2184}; double nonPromptNpartError[] = {0.0, 0.0, 0.0}; double nonPromptNcoll[] = {362.4007, 1205.2300, 151.6934}; double nonPromptNcollError[] = {0.0, 0.0, 0.0}; double nonPromptrelCentBinWidth[] = {10.0, 2.0, 8.0}; double promptSystX[] = {10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0}; double nonPromptSystX[] = {10.0, 10.0, 10.0, 10.0, 10.0}; double upsSystX[] = {10.0, 10.0, 10.0, 10.0, 10.0}; double inclJpsiCent[] = {2.41, 1.78, 1.93, 2.37, 3.73, 5.23, 4.67}; double inclJpsiCentError[] = {0.15, 0.20, 0.24, 0.33, 0.53, 0.81, 0.80}; double inclJpsiCentSyst[] = {0.37, 0.28, 0.30, 0.37, 0.62, 0.93, 0.97}; double promptJpsiCent[] = {1.79, 1.18, 1.29, 2.18, 2.97, 3.88, 3.58}; double promptJpsiCentError[] = {0.13, 0.17, 0.21, 0.33, 0.49, 0.75, 0.70}; double promptJpsiCentSyst[] = {0.28, 0.18, 0.20, 0.34, 0.50, 0.69, 0.74}; double inclJpsiCent2[] = {2.41, 1.84, 3.46}; double inclJpsiCent2Error[] = {0.15, 0.15, 0.26}; double inclJpsiCent2Syst[] = {0.37, 0.28, 0.57}; double promptJpsiCent2[] = {1.79, 1.23, 2.85}; double promptJpsiCent2Error[] = {0.13, 0.14, 0.25}; double promptJpsiCent2Syst[] = {0.28, 0.18, 0.47}; double nonPromptJpsiCent[] = {0.60, 0.59, 0.60}; double nonPromptJpsiCentError[] = {0.09, 0.12, 0.14}; double nonPromptJpsiCentSyst[] = {0.09, 0.10, 0.10}; double upsCent[] = {0.485, 0.347, 0.643, 0.517}; double upsCentError[] = {0.066, 0.096, 0.144, 0.101}; double upsCentSyst[] = {0.089, 0.069, 0.118, 0.101}; double upsCent2[] = {0.485, 0.468, 0.517}; double upsCent2Error[] = {0.066, 0.081, 0.101}; double upsCent2Syst[] = {0.089, 0.094, 0.101}; TGraphErrors *gInclJpsiCent = new TGraphErrors(7, promptNpart, inclJpsiCent, promptNpartError, inclJpsiCentError); TGraphErrors *gPromptJpsiCent = new TGraphErrors(7, promptNpart, promptJpsiCent, promptNpartError, promptJpsiCentError); TGraphErrors *gNonPromptJpsiCent = new TGraphErrors(3, nonPromptNpart, nonPromptJpsiCent, nonPromptNpartError, nonPromptJpsiCentError); TGraphErrors *gUpsCent = new TGraphErrors(4, upsNpart, upsCent, upsNpartError, upsCentError); TGraphErrors *gInclJpsiCentSyst = new TGraphErrors(7, promptNpart, inclJpsiCent, promptSystX, inclJpsiCentSyst); TGraphErrors *gPromptJpsiCentSyst = new TGraphErrors(7, promptNpart, promptJpsiCent, promptSystX, promptJpsiCentSyst); TGraphErrors *gNonPromptJpsiCentSyst = new TGraphErrors(3, nonPromptNpart, nonPromptJpsiCent, nonPromptSystX, nonPromptJpsiCentSyst); TGraphErrors *gUpsCentSyst = new TGraphErrors(4, upsNpart, upsCent, upsSystX, upsCentSyst); TGraphErrors *gInclJpsiCentP = new TGraphErrors(7, promptNpart, inclJpsiCent, promptNpartError, promptNpartError); TGraphErrors *gPromptJpsiCentP = new TGraphErrors(7, promptNpart, promptJpsiCent, promptNpartError, promptNpartError); TGraphErrors *gNonPromptJpsiCentP = new TGraphErrors(3, nonPromptNpart, nonPromptJpsiCent, nonPromptNpartError, nonPromptNpartError); TGraphErrors *gUpsCentP = new TGraphErrors(4, upsNpart, upsCent, upsNpartError, upsNpartError); TGraphErrors *gInclJpsiMB = new TGraphErrors(1, promptNpart, inclJpsiCent, promptNpartError, inclJpsiCentError); TGraphErrors *gPromptJpsiMB = new TGraphErrors(1, promptNpart, promptJpsiCent, promptNpartError, promptJpsiCentError); TGraphErrors *gNonPromptJpsiMB = new TGraphErrors(1, nonPromptNpart, nonPromptJpsiCent, nonPromptNpartError, nonPromptJpsiCentError); TGraphErrors *gUpsMB = new TGraphErrors(1, upsNpart, upsCent, upsNpartError, upsCentError); TGraphErrors *gInclJpsiMBSyst = new TGraphErrors(1, promptNpart, inclJpsiCent, promptSystX, inclJpsiCentSyst); TGraphErrors *gPromptJpsiMBSyst = new TGraphErrors(1, promptNpart, promptJpsiCent, promptSystX, promptJpsiCentSyst); TGraphErrors *gNonPromptJpsiMBSyst = new TGraphErrors(1, nonPromptNpart, nonPromptJpsiCent, nonPromptSystX, nonPromptJpsiCentSyst); TGraphErrors *gUpsMBSyst = new TGraphErrors(1, upsNpart, upsCent, upsSystX, upsCentSyst); TGraphErrors *gInclJpsiCent2 = new TGraphErrors(3, nonPromptNpart, inclJpsiCent2, nonPromptNpartError, inclJpsiCent2Error); TGraphErrors *gPromptJpsiCent2 = new TGraphErrors(3, nonPromptNpart, promptJpsiCent2, nonPromptNpartError, promptJpsiCent2Error); TGraphErrors *gInclJpsiCent2Syst = new TGraphErrors(3, nonPromptNpart, inclJpsiCent2, nonPromptSystX, inclJpsiCent2Syst); TGraphErrors *gPromptJpsiCent2Syst = new TGraphErrors(3, nonPromptNpart, promptJpsiCent2, nonPromptSystX, promptJpsiCent2Syst); // Remove MB point gInclJpsiCent->RemovePoint(0); gPromptJpsiCent->RemovePoint(0); gNonPromptJpsiCent->RemovePoint(0); gUpsCent->RemovePoint(0); gInclJpsiCentP->RemovePoint(0); gPromptJpsiCentP->RemovePoint(0); gNonPromptJpsiCentP->RemovePoint(0); gUpsCentP->RemovePoint(0); gInclJpsiCentSyst->RemovePoint(0); gPromptJpsiCentSyst->RemovePoint(0); gNonPromptJpsiCentSyst->RemovePoint(0); gUpsCentSyst->RemovePoint(0); gInclJpsiCent2->RemovePoint(0); gPromptJpsiCent2->RemovePoint(0); gInclJpsiCent2Syst->RemovePoint(0); gPromptJpsiCent2Syst->RemovePoint(0); gInclJpsiCent->SetName("gInclJpsiCent"); gPromptJpsiCent->SetName("gPromptJpsiCent"); gNonPromptJpsiCent->SetName("gNonPromptJpsiCent"); gInclJpsiMB->SetName("gInclJpsiMB"); gPromptJpsiMB->SetName("gPromptJpsiMB"); gNonPromptJpsiMB->SetName("gNonPromptJpsiMB"); gUpsCent->SetName("gUpsCent"); gUpsMB->SetName("gUpsMB"); gInclJpsiCent2->SetName("gInclJpsiCent2"); gPromptJpsiCent2->SetName("gPromptJpsiCent2"); gInclJpsiCentP->SetName("gInclJpsiCentP"); gPromptJpsiCentP->SetName("gPromptJpsiCentP"); gNonPromptJpsiCentP->SetName("gNonPromptJpsiCentP"); gUpsCentP->SetName("gUpsCentP"); gInclJpsiCentSyst->SetName("gInclJpsiCentSyst"); gPromptJpsiCentSyst->SetName("gPromptJpsiCentSyst"); gNonPromptJpsiCentSyst->SetName("gNonPromptJpsiCentSyst"); gInclJpsiMBSyst->SetName("gInclJpsiMBSyst"); gPromptJpsiMBSyst->SetName("gPromptJpsiMBSyst"); gNonPromptJpsiMBSyst->SetName("gNonPromptJpsiMBSyst"); gUpsCentSyst->SetName("gUpsCentSyst"); gUpsMBSyst->SetName("gUpsMBSyst"); gInclJpsiCent2Syst->SetName("gInclJpsiCent2Syst"); gPromptJpsiCent2Syst->SetName("gPromptJpsiCent2Syst"); // gInclJpsiCentSyst->SetFillColor(kGray+1); // gPromptJpsiCentSyst->SetFillColor(kAzure-9); // gNonPromptJpsiCentSyst->SetFillColor(kRed-10); // gUpsCentSyst->SetFillColor(kGreen-10); // gInclJpsiMBSyst->SetFillColor(kGray+1); // gPromptJpsiMBSyst->SetFillColor(kAzure-9); // gNonPromptJpsiMBSyst->SetFillColor(kRed-10); // gUpsMBSyst->SetFillColor(kGreen-10); // gInclJpsiCent->SetMarkerColor(kBlack); // gPromptJpsiCent->SetMarkerColor(kBlue); // gNonPromptJpsiCent->SetMarkerColor(kRed); // gUpsCent->SetMarkerColor(kGreen+2); gInclJpsiCentSyst->SetFillColor(kAzure-9); gPromptJpsiCentSyst->SetFillColor(kRed-9); gNonPromptJpsiCentSyst->SetFillColor(kOrange-9); gUpsCentSyst->SetFillColor(kGreen-9); gInclJpsiMBSyst->SetFillStyle(0); gPromptJpsiMBSyst->SetFillStyle(0); gNonPromptJpsiMBSyst->SetFillStyle(0); gUpsMBSyst->SetFillStyle(0); gInclJpsiMBSyst->SetLineWidth(3); gPromptJpsiMBSyst->SetLineWidth(3); gNonPromptJpsiMBSyst->SetLineWidth(3); gUpsMBSyst->SetLineWidth(3); gInclJpsiMBSyst->SetLineColor(kAzure-9); gPromptJpsiMBSyst->SetLineColor(kRed-9); gNonPromptJpsiMBSyst->SetLineColor(kOrange-9); gUpsMBSyst->SetLineColor(kGreen-9); if (isPaper) { gInclJpsiCent->SetMarkerColor(kBlue+1); gPromptJpsiCent->SetMarkerColor(kRed+2); } else { gInclJpsiCent->SetMarkerColor(kBlue); gPromptJpsiCent->SetMarkerColor(kRed); } gNonPromptJpsiCent->SetMarkerColor(kOrange+2); gUpsCent->SetMarkerColor(kGreen+2); gInclJpsiCent->SetMarkerStyle(20); gPromptJpsiCent->SetMarkerStyle(21); gNonPromptJpsiCent->SetMarkerStyle(29); gUpsCent->SetMarkerStyle(33); if (isPaper) { gInclJpsiMB->SetMarkerColor(kBlue+1); gPromptJpsiMB->SetMarkerColor(kRed+2); } else { gInclJpsiMB->SetMarkerColor(kBlue); gPromptJpsiMB->SetMarkerColor(kRed); } gNonPromptJpsiMB->SetMarkerColor(kOrange+2); gUpsMB->SetMarkerColor(kGreen+2); gInclJpsiMB->SetMarkerStyle(24); gPromptJpsiMB->SetMarkerStyle(25); gNonPromptJpsiMB->SetMarkerStyle(30); gUpsMB->SetMarkerStyle(27); gInclJpsiCent->SetMarkerSize(1.2); gInclJpsiMB->SetMarkerSize(1.2); gPromptJpsiCent->SetMarkerSize(1.2); gPromptJpsiMB->SetMarkerSize(1.2); gNonPromptJpsiCent->SetMarkerSize(2.0); gNonPromptJpsiMB->SetMarkerSize(2.0); gUpsCent->SetMarkerSize(2.0); gUpsMB->SetMarkerSize(2.0); gInclJpsiCentP->SetMarkerStyle(24); gPromptJpsiCentP->SetMarkerStyle(25); gNonPromptJpsiCentP->SetMarkerStyle(30); gUpsCentP->SetMarkerStyle(27); gInclJpsiCentP->SetMarkerColor(kBlack); gPromptJpsiCentP->SetMarkerColor(kBlack); gNonPromptJpsiCentP->SetMarkerColor(kBlack); gUpsCentP->SetMarkerColor(kBlack); gInclJpsiCentP->SetMarkerSize(1.2); gPromptJpsiCentP->SetMarkerSize(1.2); gNonPromptJpsiCentP->SetMarkerSize(2.0); gUpsCentP->SetMarkerSize(2.0); TH1F *f1 = new TH1F("f1","f1",1,0,400); TH1F *f1l = new TH1F("f1l","f1l",1,0,400); f1->SetBinContent(1,9.2); f1l->SetBinContent(1,3.8); f1->SetBinError(1,0.0); f1l->SetBinError(1,0.0); f1->SetLineWidth(1); f1->SetLineStyle(1); f1->SetFillColor(kGray); f1->SetFillStyle(1001); f1l->SetLineWidth(1); f1l->SetLineStyle(1); f1l->SetFillColor(10); f1l->SetFillStyle(1001); f1->GetXaxis()->SetTitle("N_{part}"); f1->GetYaxis()->SetTitle("1/T_{AA} dN/dy (nb)"); f1->GetXaxis()->CenterTitle(kTRUE); f1->GetYaxis()->SetRangeUser(0.0, 12.0); TCanvas *c1 = new TCanvas("c1","c1"); f1->Draw("HIST2"); f1l->Draw("HIST2same"); gInclJpsiCentSyst->Draw("2"); gPromptJpsiCentSyst->Draw("2"); gInclJpsiCent->Draw("P"); gPromptJpsiCent->Draw("P"); gInclJpsiCentP->Draw("P"); gPromptJpsiCentP->Draw("P"); TLegend *leg1 = new TLegend(0.22,0.56,0.90,0.76); leg1->SetFillStyle(1001); leg1->SetFillColor(10); leg1->SetBorderSize(0); leg1->SetMargin(0.2); leg1->SetTextSize(0.04); leg1->AddEntry(gInclJpsiCent,"Inclusive J/#psi","P"); leg1->AddEntry(gPromptJpsiCent,"Prompt J/#psi","P"); leg1->AddEntry(f1,"pp interpolation (arXiv:1103.2394)","F"); leg1->Draw(); TLatex *pre = new TLatex(125,11.0,"CMS Preliminary"); pre->SetTextFont(42); pre->SetTextSize(0.05); pre->Draw(); TLatex *l1 = new TLatex(125,10.0,"PbPb #sqrt{s_{NN}} = 2.76 TeV"); l1->SetTextFont(42); l1->SetTextSize(0.05); l1->Draw(); // TLatex *ly = new TLatex(200.0,5.25,"0.0 < |y| < 2.4"); // ly->Draw(); // TLatex *lpt = new TLatex(200.0,4.5,"6.5 < p_{T} < 30.0 GeV/c"); // lpt->Draw(); TLatex *ly = new TLatex(20.0,1.35,"0.0 < |y| < 2.4"); ly->Draw(); TLatex *lpt = new TLatex(20.0,0.6,"6.5 < p_{T} < 30.0 GeV/c"); lpt->Draw(); gPad->RedrawAxis(); TCanvas *c1a = new TCanvas("c1a","c1a"); TH1F *f1a = new TH1F("f1a","f1a",1,0,400); TH1F *f1al = new TH1F("f1al","f1al",1,0,400); f1a->SetBinContent(1,9.2*0.23); // MB high pT b-fraction f1al->SetBinContent(1,3.8*0.23); // MB high pT b-fraction f1a->SetBinError(1,0.0); f1al->SetBinError(1,0.0); f1a->SetLineWidth(1); f1a->SetLineStyle(1); f1a->SetFillColor(kGray); f1a->SetFillStyle(1001); f1al->SetLineWidth(1); f1al->SetLineStyle(1); f1al->SetFillColor(10); f1al->SetFillStyle(1001); f1a->GetXaxis()->SetTitle("N_{part}"); f1a->GetYaxis()->SetTitle("1/T_{AA} dN/dy (nb)"); f1a->GetXaxis()->CenterTitle(kTRUE); f1a->GetYaxis()->SetRangeUser(0.0,2.76); f1a->Draw("HIST2"); f1al->Draw("HIST2same"); gNonPromptJpsiCentSyst->Draw("2"); gNonPromptJpsiCent->Draw("P"); gNonPromptJpsiCentP->Draw("P"); gNonPromptJpsiMBSyst->Draw("2"); gNonPromptJpsiMB->Draw("P"); TLegend *leg1a = new TLegend(0.22,0.56,0.90,0.69); leg1a->SetFillStyle(1001); leg1a->SetFillColor(kWhite); leg1a->SetBorderSize(0); leg1a->SetMargin(0.2); leg1a->SetTextSize(0.04); leg1a->SetNColumns(2); leg1a->SetColumnSeparation(-0.78); // leg1a->AddEntry(gNonPromptJpsiCent,"Non-prompt J/#psi (0-20%, 20-100%)","P"); leg1a->AddEntry(gNonPromptJpsiCent,"Non-prompt J/#psi","P"); leg1a->AddEntry(gNonPromptJpsiMB,"(0-100%)","P"); // leg1a->AddEntry(gNonPromptJpsiMB,"Non-prompt J/#psi (0-100%)","P"); leg1a->AddEntry(f1a,"pp interpolation (arXiv:1103.2394)","F"); leg1a->Draw(); TLatex *prea = new TLatex(125,2.53,"CMS Preliminary"); prea->SetTextFont(42); prea->SetTextSize(0.05); prea->Draw(); TLatex *l1a = new TLatex(125,2.30,"PbPb #sqrt{s_{NN}} = 2.76 TeV"); l1a->SetTextSize(0.05); l1a->Draw(); // TLatex *l1a = new TLatex(125,2.30,"L_{int} = 7.28"); // l1a->SetTextSize(0.05); // l1a->Draw(); // TLatex *lya = new TLatex(200.0,1.2075,"0.0 < |y| < 2.4"); // lya->Draw(); // TLatex *lpta = new TLatex(200.0,1.035,"6.5 < p_{T} < 30.0 GeV/c"); // lpta->Draw(); TLatex *lya = new TLatex(20.0,0.3105,"0.0 < |y| < 2.4"); lya->Draw(); TLatex *lpta = new TLatex(20.0,0.138,"6.5 < p_{T} < 30.0 GeV/c"); lpta->Draw(); gPad->RedrawAxis(); TCanvas *c1b = new TCanvas("c1b","c1b"); c1b->SetLogy(); // TF1 *f1b = new TF1("f1b","0.753",0,400); // f1b->SetLineWidth(1); // f1b->SetLineStyle(2); // f1b->GetXaxis()->SetTitle("N_{part}"); // f1b->GetYaxis()->SetTitle("1/T_{AA} dN/dy (pb)"); // f1b->GetXaxis()->CenterTitle(kTRUE); // f1b->Draw(); // f1b->GetYaxis()->SetRangeUser(0.0,1.6); TH1F *f1b = new TH1F("f1b","f1b",1,0,400); TH1F *f1bl = new TH1F("f1bl","f1bl",1,0,400); f1b->SetBinContent(1,0.753+sqrt(0.029*0.029+0.072*0.072)); f1bl->SetBinContent(1,0.753-sqrt(0.029*0.029+0.072*0.072)); f1b->SetBinError(1,0.0); f1bl->SetBinError(1,0.0); f1b->SetLineWidth(1); f1b->SetLineStyle(1); f1b->SetFillColor(kGray); f1b->SetFillStyle(1001); f1bl->SetLineWidth(2); f1bl->SetLineStyle(3); f1bl->SetFillColor(10); f1bl->SetFillStyle(1001); f1b->GetXaxis()->SetTitle("N_{part}"); f1b->GetYaxis()->SetTitle("1/T_{AA} dN/dy (pb)"); f1b->GetXaxis()->CenterTitle(kTRUE); f1b->GetYaxis()->SetRangeUser(0.0,1.8); TH1F *f2b = new TH1F("f2b","f2b",1,0,400); TH1F *f2bl = new TH1F("f2bl","f2bl",1,0,400); f2b->SetBinContent(1,7.37 + (0.13*0.13 + 0.61*0.61)); f2bl->SetBinContent(1,7.37 - sqrt(0.13*0.13 + 0.42*0.42)); f2b->SetBinError(1,0.0); f2bl->SetBinError(1,0.0); f2b->SetLineWidth(2); f2b->SetLineStyle(2); f2b->SetFillColor(kGray); f2b->SetFillStyle(1001); f2bl->SetLineWidth(1); f2bl->SetLineStyle(1); f2bl->SetFillColor(10); f2bl->SetFillStyle(1001); f2b->GetXaxis()->SetTitle("N_{part}"); f2b->GetYaxis()->SetTitle("1/T_{AA} dN/dy (pb)"); f2b->GetXaxis()->CenterTitle(kTRUE); f2b->GetYaxis()->SetRangeUser(0.1,20); f2b->Draw("HIST2"); // f2bl->Draw("HIST2same"); // f1b->Draw("HIST2"); f1bl->Draw("HIST2same"); gUpsCentSyst->Draw("2"); gUpsCent->Draw("P"); gUpsCentP->Draw("P"); gUpsMBSyst->Draw("2"); gUpsMB->Draw("P"); TLegend *leg1b = new TLegend(0.22,0.51,0.90,0.76); leg1b->SetFillStyle(1001); leg1b->SetFillColor(kWhite); leg1b->SetBorderSize(0); leg1b->SetMargin(0.2); leg1b->SetTextSize(0.04); leg1b->SetNColumns(2); leg1b->SetColumnSeparation(-1.25); leg1b->AddEntry(gUpsCent,"#Upsilon(1S)","P"); leg1b->AddEntry(gUpsMB,"(0-100%)","P"); leg1b->AddEntry(f1b,"CDF p#bar{p} #sqrt{s} = 1.8 TeV","L"); leg1b->AddEntry(f1b," ",""); leg1b->AddEntry(f1b,"(PRL 75, 4358 (1995))",""); leg1b->AddEntry(f2b," ",""); leg1b->AddEntry(f2b,"CMS pp #sqrt{s} = 7 TeV","L"); leg1b->AddEntry(f2b," ",""); leg1b->AddEntry(f2b,"(arXiv:1012.5545)",""); leg1b->Draw(); // TLatex *preb = new TLatex(125,9.1667,"CMS Preliminary"); TLatex *preb = new TLatex(125,12.816,"CMS Preliminary"); preb->SetTextFont(42); preb->SetTextSize(0.05); preb->Draw(); // TLatex *l1b = new TLatex(125,8.889,"PbPb #sqrt{s_{NN}} = 2.76 TeV"); TLatex *l1b = new TLatex(125,8.752,"PbPb #sqrt{s_{NN}} = 2.76 TeV"); l1b->SetTextSize(0.05); l1b->Draw(); TLatex *lyb = new TLatex(20.0,0.185,"0.0 < |y| < 2.4"); // TLatex *lyb = new TLatex(20.0,0.2025,"0.0 < |y| < 2.4"); lyb->Draw(); TLatex *lptb = new TLatex(20.0,0.130,"0.0 < p_{T} < 20.0 GeV/c"); // TLatex *lptb = new TLatex(20.0,0.09,"0.0 < p_{T} < 20.0 GeV/c"); lptb->Draw(); gPad->RedrawAxis(); c1->SaveAs("inclJpsi_cent.pdf"); c1a->SaveAs("nonpromptJpsi_cent.pdf"); c1b->SaveAs("upsilon_cent.pdf"); c1->SaveAs("inclJpsi_cent.png"); c1a->SaveAs("nonpromptJpsi_cent.png"); c1b->SaveAs("upsilon_cent.png"); double bfractionCent[] = {0.2550, 0.3337, 0.3268, 0.0786, 0.2003, 0.2550, 0.2317}; double bfractionCentError[] = {0.0351, 0.0723, 0.0833, 0.0541, 0.0738, 0.0966, 0.0885}; double bfractionCentSyst[] = {0.0510, 0.0667, 0.0654, 0.0157, 0.0401, 0.0510, 0.0463}; // fixme: update syst. uncertainties double bfractionCoarseCent[] = {0.2550, 0.3289, 0.1757}; double bfractionCoarseCentError[] = {0.0351, 0.0583, 0.0401}; double bfractionCoarseCentSyst[] = {0.0510, 0.0658, 0.0351}; // fixme: update syst. uncertainties TGraphErrors *gBfractionCent = new TGraphErrors(7, promptNpart, bfractionCent, promptNpartError, bfractionCentError); TGraphErrors *gBfractionCentSyst = new TGraphErrors(7, promptNpart, bfractionCent, promptSystX, bfractionCentSyst); TGraphErrors *gBfractionCoarseCent = new TGraphErrors(3, nonPromptNpart, bfractionCoarseCent, nonPromptNpartError, bfractionCoarseCentError); TGraphErrors *gBfractionCoarseCentSyst = new TGraphErrors(3, nonPromptNpart, bfractionCoarseCent, nonPromptSystX, bfractionCoarseCentSyst); TGraphErrors *gBfractionCoarseCentP = new TGraphErrors(3, nonPromptNpart, bfractionCoarseCent, nonPromptNpartError, nonPromptNpartError); TGraphErrors *gBfractionMB = new TGraphErrors(1, promptNpart, bfractionCent, promptNpartError, bfractionCentError); TGraphErrors *gBfractionMBSyst = new TGraphErrors(1, promptNpart, bfractionCent, promptSystX, bfractionCentSyst); gBfractionCent->RemovePoint(0); gBfractionCoarseCent->RemovePoint(0); gBfractionCoarseCentP->RemovePoint(0); gBfractionCentSyst->RemovePoint(0); gBfractionCoarseCentSyst->RemovePoint(0); gBfractionCent->SetName("gBfractionCent"); gBfractionMB->SetName("gBfractionMB"); gBfractionCoarseCent->SetName("gBfractionCoarseCent"); gBfractionCoarseCentP->SetName("gBfractionCoarseCentP"); gBfractionCentSyst->SetName("gBfractionCentSyst"); gBfractionMBSyst->SetName("gBfractionMBSyst"); gBfractionCoarseCentSyst->SetName("gBfractionCoarseCentSyst"); gBfractionCentSyst->SetFillColor(kAzure-9); gBfractionMBSyst->SetFillColor(kAzure-9); gBfractionCoarseCentSyst->SetFillColor(kAzure-9); gBfractionCentSyst->SetFillColor(kRed-9); gBfractionMBSyst->SetFillColor(kRed-9); gBfractionCoarseCentSyst->SetFillColor(kRed-9); if (isPaper) { gBfractionCent->SetMarkerColor(kRed+2); gBfractionMB->SetMarkerColor(kRed+2); gBfractionCoarseCent->SetMarkerColor(kRed+2); } else { gBfractionCent->SetMarkerColor(kRed); gBfractionMB->SetMarkerColor(kRed); gBfractionCoarseCent->SetMarkerColor(kRed); } gBfractionCent->SetMarkerStyle(20); gBfractionMB->SetMarkerStyle(24); gBfractionCoarseCent->SetMarkerStyle(20); gBfractionCent->SetMarkerSize(1.2); gBfractionMB->SetMarkerSize(1.2); gBfractionCoarseCent->SetMarkerSize(1.2); gBfractionCoarseCentP->SetMarkerStyle(24); gBfractionCoarseCentP->SetMarkerSize(1.2); TF1 *f2 = new TF1("f2","1",0,400); f2->SetLineWidth(1); f2->GetXaxis()->SetTitle("N_{part}"); f2->GetYaxis()->SetTitle("B-fraction"); f2->GetYaxis()->SetRangeUser(0.0,0.8); f2->GetXaxis()->CenterTitle(kTRUE); TCanvas *c2 = new TCanvas("c2","c2"); f2->Draw(); gBfractionCoarseCentSyst->Draw("2"); gBfractionCoarseCent->Draw("P"); gBfractionCoarseCentP->Draw("P"); TLegend *leg2 = new TLegend(0.22,0.62,0.90,0.69); leg2->SetFillStyle(0); leg2->SetFillColor(kWhite); leg2->SetBorderSize(0); leg2->SetMargin(0.2); leg2->SetTextSize(0.04); leg2->AddEntry(gBfractionCoarseCent,"B-fraction","P"); leg2->Draw(); TLatex *pre2 = new TLatex(125,0.733336,"CMS Preliminary"); pre2->SetTextFont(42); pre2->SetTextSize(0.05); pre2->Draw(); TLatex *l2 = new TLatex(125,0.66664,"PbPb #sqrt{s_{NN}} = 2.76 TeV"); l2->SetTextSize(0.05); l2->Draw(); TLatex *ly2 = new TLatex(20.0,0.090,"0.0 < |y| < 2.4"); ly2->Draw(); TLatex *lpt2 = new TLatex(20.0,0.04,"0.0 < p_{T} < 20.0 GeV/c"); lpt2->Draw(); gPad->RedrawAxis(); c2->SaveAs("bFraction_cent.pdf"); c2->SaveAs("bFraction_cent.png"); return; TF1 *f3 = new TF1("f3","220",0,400); f3->GetXaxis()->SetTitle("N_{part}"); f3->GetYaxis()->SetTitle("1/T_{AA} dN/dy (nb)"); f3->GetYaxis()->SetRangeUser(0.0,1.0); f3->GetXaxis()->CenterTitle(kTRUE); double ppNpart[] = {2.0}; double ppNpartError[] = {0.0}; double ppNpartError2[] = {1.0}; double ppCDF[] = {2.325}; // double ppCDF[] = {0.753}; double ppCDFError[] = {0.029}; double ppCDFSyst[] = {0.072}; TGraphErrors *gUpsCDF = new TGraphErrors(1, ppNpart, ppCDF, ppNpartError, ppCDFError); TGraphErrors *gUpsCDFsyst = new TGraphErrors(1, ppNpart, ppCDF, ppNpartError2, ppCDFSyst); gUpsCDF->SetName("gUpsCDF"); gUpsCDFsyst->SetName("gUpsCDFsyst"); gUpsCDF->SetMarkerStyle(20); gUpsCDFsyst->SetFillColor(kGray); TCanvas *c3 = new TCanvas("c3","c3"); // c3->SetRightMargin(rmargin); // c3->SetTopMargin(tmargin); f3->Draw(); gUpsCent->Draw("P"); gUpsMB->Draw("P"); gUpsCDFsyst->Draw("2"); gUpsCDF->Draw("P"); // RAA double ppPromptJpsi = 226.0; double ppPromptJpsiError = 20; double inclJpsiRAA[5]; double promptJpsiRAA[5]; double nonPromptJpsiRAA[3]; double upsRAA[4]; double inclJpsiRAAError[5]; double promptJpsiRAAError[5]; double nonPromptJpsiRAAError[3]; double upsRAAError[4]; double inclJpsiRAASyst[5]; double promptJpsiRAASyst[5]; double nonPromptJpsiRAASyst[3]; double upsRAASyst[4]; for (int i=0; i<5; ++i) { inclJpsiRAA[i] = inclJpsiCent[i]/ppPromptJpsi; promptJpsiRAA[i] = promptJpsiCent[i]/ppPromptJpsi; inclJpsiRAAError[i] = inclJpsiRAA[i]*inclJpsiCentError[i]/inclJpsiCent[i]; promptJpsiRAAError[i] = promptJpsiRAA[i]*promptJpsiCentError[i]/promptJpsiCent[i]; inclJpsiRAASyst[i] = inclJpsiRAA[i]*inclJpsiCentSyst[i]/inclJpsiCent[i]; promptJpsiRAASyst[i] = promptJpsiRAA[i]*promptJpsiCentSyst[i]/promptJpsiCent[i]; } for (int i=0; i<3; ++i) { nonPromptJpsiRAA[i] = nonPromptJpsiCent[i]/(bfractionCent[i]*ppPromptJpsi); nonPromptJpsiRAAError[i] = nonPromptJpsiRAA[i]*nonPromptJpsiCentError[i]/nonPromptJpsiCent[i]; nonPromptJpsiRAASyst[i] = nonPromptJpsiRAA[i]*nonPromptJpsiCentSyst[i]/nonPromptJpsiCent[i]; } for (int i=0; i<4; ++i) { upsRAA[i] = upsCent[i]/ppCDF[0]; upsRAAError[i] = upsRAA[i]*upsCentError[i]/upsCent[i]; upsRAASyst[i] = upsRAA[i]*upsCentSyst[i]/upsCent[i]; } TGraphErrors *gInclJpsiRAA = new TGraphErrors(5, promptNpart, inclJpsiRAA, promptNpartError, inclJpsiRAAError); TGraphErrors *gPromptJpsiRAA = new TGraphErrors(5, promptNpart, promptJpsiRAA, promptNpartError, promptJpsiRAAError); TGraphErrors *gNonPromptJpsiRAA = new TGraphErrors(3, nonPromptNpart, nonPromptJpsiRAA, nonPromptNpartError, nonPromptJpsiRAAError); TGraphErrors *gUpsRAA = new TGraphErrors(4, upsNpart, upsRAA, upsNpartError, upsRAAError); TGraphErrors *gInclJpsiRAAMB = new TGraphErrors(1, promptNpart, inclJpsiRAA, promptNpartError, inclJpsiRAAError); TGraphErrors *gPromptJpsiRAAMB = new TGraphErrors(1, promptNpart, promptJpsiRAA, promptNpartError, promptJpsiRAAError); TGraphErrors *gNonPromptJpsiRAAMB = new TGraphErrors(1, nonPromptNpart, nonPromptJpsiRAA, nonPromptNpartError, nonPromptJpsiRAAError); TGraphErrors *gUpsRAAMB = new TGraphErrors(1, upsNpart, upsRAA, upsNpartError, upsRAAError); TGraphErrors *gInclJpsiRAASyst = new TGraphErrors(5, promptNpart, inclJpsiRAA, promptSystX, inclJpsiRAASyst); TGraphErrors *gPromptJpsiRAASyst = new TGraphErrors(5, promptNpart, promptJpsiRAA, promptSystX, promptJpsiRAASyst); TGraphErrors *gNonPromptJpsiRAASyst = new TGraphErrors(3, nonPromptNpart, nonPromptJpsiRAA, nonPromptSystX, nonPromptJpsiRAASyst); TGraphErrors *gUpsRAASyst = new TGraphErrors(4, upsNpart, upsRAA, upsSystX, upsRAASyst); TGraphErrors *gInclJpsiRAAMBSyst = new TGraphErrors(1, promptNpart, inclJpsiRAA, promptSystX, inclJpsiRAASyst); TGraphErrors *gPromptJpsiRAAMBSyst = new TGraphErrors(1, promptNpart, promptJpsiRAA, promptSystX, promptJpsiRAASyst); TGraphErrors *gNonPromptJpsiRAAMBSyst = new TGraphErrors(1, nonPromptNpart, nonPromptJpsiRAA, nonPromptSystX, nonPromptJpsiRAASyst); TGraphErrors *gUpsRAAMBSyst = new TGraphErrors(1, upsNpart, upsRAA, upsSystX, upsRAASyst); gInclJpsiRAA->RemovePoint(0); gPromptJpsiRAA->RemovePoint(0); gNonPromptJpsiRAA->RemovePoint(0); gUpsRAA->RemovePoint(0); gInclJpsiRAASyst->RemovePoint(0); gPromptJpsiRAASyst->RemovePoint(0); gNonPromptJpsiRAASyst->RemovePoint(0); gUpsRAASyst->RemovePoint(0); gInclJpsiRAA->SetName("gInclJpsiRAA"); gPromptJpsiRAA->SetName("gPromptJpsiRAA"); gNonPromptJpsiRAA->SetName("gNonPromptJpsiRAA"); gInclJpsiRAAMB->SetName("gInclJpsiRAAMB"); gPromptJpsiRAAMB->SetName("gPromptJpsiRAAMB"); gNonPromptJpsiRAAMB->SetName("gNonPromptJpsiRAAMB"); gUpsRAA->SetName("gUpsRAASyst"); gUpsRAAMB->SetName("gUpsRAAMBSyst"); gInclJpsiRAASyst->SetName("gInclJpsiRAASyst"); gPromptJpsiRAASyst->SetName("gPromptJpsiRAASyst"); gNonPromptJpsiRAASyst->SetName("gNonPromptJpsiRAASyst"); gInclJpsiRAAMBSyst->SetName("gInclJpsiRAAMBSyst"); gPromptJpsiRAAMBSyst->SetName("gPromptJpsiRAAMBSyst"); gNonPromptJpsiRAAMBSyst->SetName("gNonPromptJpsiRAAMBSyst"); gUpsRAASyst->SetName("gUpsRAASyst"); gUpsRAAMBSyst->SetName("gUpsRAAMBSyst"); gInclJpsiRAASyst->SetFillColor(kGray+1); gPromptJpsiRAASyst->SetFillColor(kAzure-9); gNonPromptJpsiRAASyst->SetFillColor(kRed-10); gUpsRAASyst->SetFillColor(kGreen-10); gInclJpsiRAAMBSyst->SetFillColor(kGray+1); gPromptJpsiRAAMBSyst->SetFillColor(kAzure-9); gNonPromptJpsiRAAMBSyst->SetFillColor(kRed-10); gUpsRAAMBSyst->SetFillColor(kGreen-10); gInclJpsiRAA->SetMarkerColor(kBlack); gPromptJpsiRAA->SetMarkerColor(kBlue); gNonPromptJpsiRAA->SetMarkerColor(kRed); gUpsRAA->SetMarkerColor(kGreen+2); gInclJpsiRAAMB->SetMarkerColor(kBlack); gPromptJpsiRAAMB->SetMarkerColor(kBlue); gNonPromptJpsiRAAMB->SetMarkerColor(kRed); gUpsRAAMB->SetMarkerColor(kGreen+2); gInclJpsiRAA->SetMarkerStyle(20); gPromptJpsiRAA->SetMarkerStyle(21); gNonPromptJpsiRAA->SetMarkerStyle(22); gUpsRAA->SetMarkerStyle(23); gInclJpsiRAAMB->SetMarkerStyle(24); gPromptJpsiRAAMB->SetMarkerStyle(25); gNonPromptJpsiRAAMB->SetMarkerStyle(26); gUpsRAAMB->SetMarkerStyle(27); TF1 *f4 = new TF1("f4","1",0,400); f4->SetLineWidth(1); f4->GetXaxis()->SetTitle("N_{part}"); f4->GetYaxis()->SetTitle("R_{AA}"); f4->GetYaxis()->SetRangeUser(0.0,1.0); f4->GetXaxis()->CenterTitle(kTRUE); TCanvas *c4 = new TCanvas("c4","c4"); // c4->SetRightMargin(rmargin); // c4->SetTopMargin(tmargin); c4->SetTickx(); c4->SetTicky(); f4->Draw(); gInclJpsiRAASyst->Draw("2"); gPromptJpsiRAASyst->Draw("2"); gNonPromptJpsiRAASyst->Draw("2"); gUpsRAASyst->Draw("2"); gInclJpsiRAA->Draw("P"); gPromptJpsiRAA->Draw("P"); gNonPromptJpsiRAA->Draw("P"); gUpsRAA->Draw("P"); gInclJpsiRAAMBSyst->Draw("2"); gPromptJpsiRAAMBSyst->Draw("2"); gNonPromptJpsiRAAMBSyst->Draw("2"); gUpsRAAMBSyst->Draw("2"); gInclJpsiRAAMB->Draw("P"); gPromptJpsiRAAMB->Draw("P"); gNonPromptJpsiRAAMB->Draw("P"); gUpsRAAMB->Draw("P"); double ppg068RAA_mid[] = {0.37, 0.57, 0.66, 0.74}; double ppg068RAA_midError[] = {0.04, 0.06, 0.07, 0.12}; double ppg068RAA_midSyst[] = {0.06, 0.08, 0.10, 0.11}; double ppg068Npart_mid[] = {279.9, 140.0, 60.0, 14.5}; double ppg068Npart_midError[] = {4.0, 5.0, 4.0, 2.5}; double ppg068SystX[] = {10.0, 10.0, 10.0, 10.0}; TGraphErrors *gPPG068RAA_mid = new TGraphErrors(4, ppg068Npart_mid, ppg068RAA_mid, ppg068Npart_midError, ppg068RAA_midError); TGraphErrors *gPPG068RAA_midSyst = new TGraphErrors(4, ppg068Npart_mid, ppg068RAA_mid, ppg068SystX, ppg068RAA_midSyst); gPPG068RAA_midSyst->SetFillColor(kGray); gPPG068RAA_mid->SetMarkerStyle(24); gPPG068RAA_mid->SetMarkerColor(kBlack); double ppg068RAA_fwd[] = {0.16, 0.27, 0.3, 0.38, 0.6, 0.75}; double ppg068RAA_fwdError[] = {0.05, 0.035, 0.035, 0.038, 0.032, 0.049}; double ppg068RAA_fwdSyst[] = {0.035, 0.022, 0.02, 0.023, 0.017, 0.032}; double ppg068Npart_fwd[] = {325.2, 234.6, 166.6, 114.2, 60.0, 14.5}; double ppg068Npart_fwdError[] = {3.3, 4.7, 5.4, 4.4, 4.0, 2.5}; double ppg068SystX_fwd[] = {10.0, 10.0, 10.0, 10.0, 10.0, 10.0}; TGraphErrors *gPPG068RAA_fwd = new TGraphErrors(6, ppg068Npart_fwd, ppg068RAA_fwd, ppg068Npart_fwdError, ppg068RAA_fwdError); TGraphErrors *gPPG068RAA_fwdSyst = new TGraphErrors(6, ppg068Npart_fwd, ppg068RAA_fwd, ppg068SystX, ppg068RAA_fwdSyst); gPPG068RAA_fwdSyst->SetFillColor(kOrange-9); gPPG068RAA_fwd->SetMarkerStyle(20); gPPG068RAA_fwd->SetMarkerColor(kOrange+10); gPPG068RAA_midSyst->Draw("2"); gPPG068RAA_mid->Draw("P"); gPPG068RAA_fwdSyst->Draw("2"); gPPG068RAA_fwd->Draw("P"); return; }
void result_JES_akPu4PF_(refpt> 75 && refpt < 120)&&(abs(refeta)<2)_Centrality() { //=========Macro generated from canvas: Can_result_0/ //========= (Mon Apr 18 02:39:41 2016) by ROOT version6.02/13 TCanvas *Can_result_0 = new TCanvas("Can_result_0", "",18,40,700,500); gStyle->SetOptFit(1); Can_result_0->Range(-18.75,0.9236134,118.75,1.043845); Can_result_0->SetFillColor(0); Can_result_0->SetBorderMode(0); Can_result_0->SetBorderSize(2); Can_result_0->SetFrameBorderMode(0); Can_result_0->SetFrameBorderMode(0); TMultiGraph *multigraph = new TMultiGraph(); multigraph->SetName("name"); multigraph->SetTitle("JES_akPu4PF"); Double_t Graph_fx1001[4] = { 5, 20, 40, 75}; Double_t Graph_fy1001[4] = { 1.025461, 0.982262, 0.9644553, 0.970611}; Double_t Graph_fex1001[4] = { 5, 10, 10, 25}; Double_t Graph_fey1001[4] = { 0.001598024, 0.0009318739, 0.0008002418, 0.0004502591}; TGraphErrors *gre = new TGraphErrors(4,Graph_fx1001,Graph_fy1001,Graph_fex1001,Graph_fey1001); gre->SetName("Graph"); gre->SetTitle("some title_0"); gre->SetFillColor(1); gre->SetFillStyle(0); TH1F *Graph_Graph1001 = new TH1F("Graph_Graph1001","some title_0",100,0,110); Graph_Graph1001->SetMinimum(0.9573146); Graph_Graph1001->SetMaximum(1.0334); Graph_Graph1001->SetDirectory(0); Graph_Graph1001->SetStats(0); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#000099"); Graph_Graph1001->SetLineColor(ci); Graph_Graph1001->GetXaxis()->SetLabelFont(42); Graph_Graph1001->GetXaxis()->SetLabelSize(0.035); Graph_Graph1001->GetXaxis()->SetTitleSize(0.035); Graph_Graph1001->GetXaxis()->SetTitleFont(42); Graph_Graph1001->GetYaxis()->SetLabelFont(42); Graph_Graph1001->GetYaxis()->SetLabelSize(0.035); Graph_Graph1001->GetYaxis()->SetTitleSize(0.035); Graph_Graph1001->GetYaxis()->SetTitleFont(42); Graph_Graph1001->GetZaxis()->SetLabelFont(42); Graph_Graph1001->GetZaxis()->SetLabelSize(0.035); Graph_Graph1001->GetZaxis()->SetTitleSize(0.035); Graph_Graph1001->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1001); multigraph->Add(gre,""); Double_t Graph_fx1002[4] = { 5, 20, 40, 75}; Double_t Graph_fy1002[4] = { 1.025808, 0.9823451, 0.964104, 0.9707841}; Double_t Graph_fex1002[4] = { 5, 10, 10, 25}; Double_t Graph_fey1002[4] = { 0.001641175, 0.0009556419, 0.0008206184, 0.000461058}; gre = new TGraphErrors(4,Graph_fx1002,Graph_fy1002,Graph_fex1002,Graph_fey1002); gre->SetName("Graph"); gre->SetTitle("some title_1"); gre->SetFillColor(1); gre->SetFillStyle(0); gre->SetLineColor(2); gre->SetMarkerColor(2); TH1F *Graph_Graph1002 = new TH1F("Graph_Graph1002","some title_1",100,0,110); Graph_Graph1002->SetMinimum(0.9568668); Graph_Graph1002->SetMaximum(1.033866); Graph_Graph1002->SetDirectory(0); Graph_Graph1002->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1002->SetLineColor(ci); Graph_Graph1002->GetXaxis()->SetLabelFont(42); Graph_Graph1002->GetXaxis()->SetLabelSize(0.035); Graph_Graph1002->GetXaxis()->SetTitleSize(0.035); Graph_Graph1002->GetXaxis()->SetTitleFont(42); Graph_Graph1002->GetYaxis()->SetLabelFont(42); Graph_Graph1002->GetYaxis()->SetLabelSize(0.035); Graph_Graph1002->GetYaxis()->SetTitleSize(0.035); Graph_Graph1002->GetYaxis()->SetTitleFont(42); Graph_Graph1002->GetZaxis()->SetLabelFont(42); Graph_Graph1002->GetZaxis()->SetLabelSize(0.035); Graph_Graph1002->GetZaxis()->SetTitleSize(0.035); Graph_Graph1002->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1002); multigraph->Add(gre,""); Double_t Graph_fx1003[4] = { 5, 20, 40, 75}; Double_t Graph_fy1003[4] = { 0.9944711, 0.9453074, 0.9619222, 0.9556338}; Double_t Graph_fex1003[4] = { 5, 10, 10, 25}; Double_t Graph_fey1003[4] = { 0.01053149, 0.005298861, 0.004412705, 0.002663901}; gre = new TGraphErrors(4,Graph_fx1003,Graph_fy1003,Graph_fex1003,Graph_fey1003); gre->SetName("Graph"); gre->SetTitle("some title_2"); gre->SetFillColor(1); gre->SetFillStyle(0); gre->SetLineColor(3); gre->SetMarkerColor(3); TH1F *Graph_Graph1003 = new TH1F("Graph_Graph1003","some title_2",100,0,110); Graph_Graph1003->SetMinimum(0.9335092); Graph_Graph1003->SetMaximum(1.011502); Graph_Graph1003->SetDirectory(0); Graph_Graph1003->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1003->SetLineColor(ci); Graph_Graph1003->GetXaxis()->SetLabelFont(42); Graph_Graph1003->GetXaxis()->SetLabelSize(0.035); Graph_Graph1003->GetXaxis()->SetTitleSize(0.035); Graph_Graph1003->GetXaxis()->SetTitleFont(42); Graph_Graph1003->GetYaxis()->SetLabelFont(42); Graph_Graph1003->GetYaxis()->SetLabelSize(0.035); Graph_Graph1003->GetYaxis()->SetTitleSize(0.035); Graph_Graph1003->GetYaxis()->SetTitleFont(42); Graph_Graph1003->GetZaxis()->SetLabelFont(42); Graph_Graph1003->GetZaxis()->SetLabelSize(0.035); Graph_Graph1003->GetZaxis()->SetTitleSize(0.035); Graph_Graph1003->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1003); multigraph->Add(gre,""); multigraph->Draw("AP"); multigraph->GetXaxis()->SetTitle("Centrality"); multigraph->GetXaxis()->SetLabelFont(42); multigraph->GetXaxis()->SetLabelSize(0.035); multigraph->GetXaxis()->SetTitleSize(0.035); multigraph->GetXaxis()->SetTitleFont(42); multigraph->GetYaxis()->SetTitle("#mu_{Reco./Gen.}"); multigraph->GetYaxis()->SetLabelFont(42); multigraph->GetYaxis()->SetLabelSize(0.035); multigraph->GetYaxis()->SetTitleSize(0.035); multigraph->GetYaxis()->SetTitleFont(42); TLegend *leg = new TLegend(0.68,0.7,0.88,0.85,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); TLegendEntry *entry=leg->AddEntry("Graph","allJets","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("Graph","lightJets","l"); entry->SetLineColor(2); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("Graph","bJets","l"); entry->SetLineColor(3); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); leg->Draw(); TLatex * tex = new TLatex(0.25,0.7,"#bf{#color[2]{|#eta_{jet}|<2.0 &75<refpt<120}}"); tex->SetNDC(); tex->SetTextFont(43); tex->SetTextSize(24); tex->SetLineWidth(2); tex->Draw(); TPaveText *pt = new TPaveText(0.3750575,0.9365254,0.6249425,0.995,"blNDC"); pt->SetName("title"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetFillStyle(0); pt->SetTextFont(42); AText = pt->AddText("JES_akPu4PF"); pt->Draw(); Can_result_0->Modified(); Can_result_0->cd(); Can_result_0->SetSelected(Can_result_0); }
void v2ExpOpen_pt(bool bSavePlots = true, float rangeYAxis = 0.6, float rangeXAxis = 30, bool bDrawCh = true, const char* inputDir= "../macro_v2/outRoot", // the place where the input root files, with the histograms are const char* figNamePrefix="v2ExpOpen_pt") { gSystem->mkdir(Form("./figs/png"), kTRUE); gSystem->mkdir(Form("./figs/pdf"), kTRUE); setTDRStyle(); // gStyle->SetCanvasPreferGL(1); // read CMS graphs TFile *pfV2Cms_cent = new TFile(Form("%s/NPrp_v2_pt_plotter.root",inputDir)); TGraphAsymmErrors *pgV2Low = (TGraphAsymmErrors *)pfV2Cms_cent->Get("pgV2_low"); TGraphErrors *pgV2LowSyst = (TGraphErrors *)pfV2Cms_cent->Get("pgV2_low_sys"); TGraphErrors *pgV2LowP = (TGraphErrors *)pfV2Cms_cent->Get("pgV2_low_cont"); TGraphAsymmErrors *pgV2High = (TGraphAsymmErrors *)pfV2Cms_cent->Get("pgV2"); TGraphErrors *pgV2HighSyst = (TGraphErrors *)pfV2Cms_cent->Get("pgV2_sys"); TGraphErrors *pgV2HighP = (TGraphErrors *)pfV2Cms_cent->Get("pgV2_cont"); pgV2Low->SetName("pgV2Low"); pgV2LowSyst->SetFillColorAlpha(kViolet-9,0.5); pgV2High->SetName("pgV2High"); pgV2HighSyst->SetFillColorAlpha(kOrange-9,0.5); // ----------------------------------------------------------------------------------------- // ----- charged hadrons TGraphErrors *gChar = new TGraphErrors(19, pTChar, v2Char, chxerr, v2CharSt); TGraphErrors *gChar2 = new TGraphErrors(19, pTChar, v2Char, chxerr, v2CharSt2); TGraphErrors *gCharSys = new TGraphErrors(19, pTChar, v2Char, chxerr2, v2CharSys); gChar->SetName("gChar"); gChar->SetMarkerStyle(20); gChar->SetMarkerColor(kTeal+3); gChar->SetLineColor(kTeal+3); gChar->SetMarkerSize(1.3); gChar2->SetMarkerStyle(24); gChar2->SetMarkerColor(kTeal+4); gChar2->SetLineColor(kTeal+4); gChar2->SetMarkerSize(1.3); gCharSys->SetFillColor(kTeal-9); //----------- D from ALICE TGraphErrors *pgAlice = new TGraphErrors(6, v2AliceX_pt, v2Alice_pt, v2AliceXl, v2AliceStat_pt); TGraphErrors *pgAliceSys = new TGraphErrors(6, v2AliceX_pt, v2Alice_pt, v2AliceXl, v2AliceSyst_pt); TGraphAsymmErrors *pgAliceSysB = new TGraphAsymmErrors(6, v2AliceX_pt, v2Alice_pt, v2AliceXl2, v2AliceXl2, v2AliceSystBLow_pt, v2AliceSystBHigh_pt); pgAlice->SetName("pgAlice"); pgAlice->SetMarkerStyle(kOpenSquare); pgAlice->SetMarkerColor(kGray+2); pgAlice->SetLineColor(kGray+2); pgAlice->SetMarkerSize(1.0); pgAliceSys->SetFillStyle(0); pgAliceSys->SetMarkerStyle(27); pgAliceSys->SetMarkerColor(kGray+2); pgAliceSys->SetLineColor(kGray+2); pgAliceSys->SetMarkerSize(1.7); pgAliceSysB->SetFillColor(kGray); // drawing //------------------------------------------------------------------------ // put everything on one plot TH1D *phAxis_v2 = new TH1D("phAxis_v2",";p_{T} (GeV/c);v_{2}",1,0,rangeXAxis); phAxis_v2->SetDirectory(0); phAxis_v2->GetXaxis()->CenterTitle(true); phAxis_v2->GetXaxis()->LabelsOption("h"); phAxis_v2->GetYaxis()->SetRangeUser(-0.01,rangeYAxis); phAxis_v2->GetYaxis()->SetTitleOffset(1.25); TCanvas *pcCombi = new TCanvas("pcCombi","pcCombi"); phAxis_v2->Draw(); CMS_lumi(pcCombi,12001000,0); pgAliceSysB->Draw("2"); pgAliceSys->Draw("2"); pgAlice->Draw("pz"); if (bDrawCh) { gCharSys->Draw("2"); gChar->Draw("pz"); gChar2->Draw("p"); } pgV2LowSyst->Draw("2"); pgV2Low->Draw("PZ"); pgV2LowP->Draw("P"); pgV2HighSyst->Draw("2"); pgV2High->Draw("PZ"); pgV2HighP->Draw("P"); // --------- legends ---- TLegend *leg = new TLegend(0.2,0.77,0.7,0.89,NULL,"brNDC"); // at top center leg->SetBorderSize(0); leg->SetTextFont(132); leg->SetTextSize(ltxSetTextSize3); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(19); leg->SetFillStyle(0); TLegendEntry *entry, *entry11; entry=leg->AddEntry("cmspr","Open beauty: nonprompt J/#psi",""); entry->SetTextSize(ltxSetTextSize3); entry=leg->AddEntry("pgV2Low", "1.6 < |y| < 2.4","p"); entry->SetTextFont(42); entry->SetTextSize(entrySize); entry=leg->AddEntry("pgV2High", "|y| < 2.4","P"); entry->SetTextFont(42); entry->SetTextSize(entrySize); //--------------------------- TLegend *leg1 = new TLegend(0.2,0.685,0.7,0.765,NULL,"brNDC"); leg1->SetBorderSize(0); leg1->SetTextFont(132); leg1->SetTextSize(ltxSetTextSize3); if (bDrawCh) { TLegendEntry *entry1; entry1=leg1->AddEntry("hpm","Charged hadron",""); entry1->SetTextFont(132); entry1->SetTextSize(ltxSetTextSize3); entry1=leg1->AddEntry("gChar","|#eta| < 0.8","P"); entry1->SetTextFont(42); entry1->SetTextSize(entrySize); } TLegend *leg_alice; if (bDrawCh) { leg_alice = new TLegend(0.2,0.60,0.7,0.68,NULL,"brNDC"); } else { leg_alice = new TLegend(0.2,0.685,0.7,0.765,NULL,"brNDC"); } leg_alice->SetBorderSize(0); leg_alice->SetTextFont(132); leg_alice->SetTextSize(ltxSetTextSize3); leg_alice->SetLineColor(1); leg_alice->SetLineStyle(1); leg_alice->SetLineWidth(1); leg_alice->SetFillColor(19); leg_alice->SetFillStyle(0); TLegendEntry *entry_alice=leg_alice->AddEntry("pgAlice","Open charm: prompt D (ALICE)",""); entry_alice=leg_alice->AddEntry("pgAlice","|y| < 0.8, Cent. 30-50\%","P"); entry_alice->SetTextFont(42); entry_alice->SetTextSize(entrySize); TLatex *lat = new TLatex(); lat->SetNDC(); lat->SetTextFont(42); lat->SetTextSize(ltxSetTextSize2); if (bDrawCh) lat->DrawLatex(0.63,0.52,"Cent. 10-60%"); else lat->DrawLatex(0.63,0.58,"Cent. 10-60%"); leg->Draw(); if (bDrawCh) leg1->Draw(); leg_alice->Draw(); gPad->RedrawAxis(); pcCombi->Update(); if(bSavePlots) { pcCombi->SaveAs(Form("figs/pdf/%s_RaaCh%d.pdf",figNamePrefix,bDrawCh)); pcCombi->SaveAs(Form("figs/png/%s_RaaCh%d.png",figNamePrefix,bDrawCh)); } return; }
void Plots(TString plots="4Jets", TString sys="", bool EvtNorm=false){ /**************** Style ****************/ gROOT->SetStyle("Plain"); gStyle->SetOptFit(1000); gStyle->SetOptStat("emruo"); gStyle->SetOptStat(kFALSE); gStyle->SetPadTickY(1); gStyle->SetPadTickX(1); gROOT->ProcessLine(".L /home/brochero/ttbar/TopCodeljets/tdrStyle.C"); setTDRStyle(); Int_t chatch = 1756; TColor *color = new TColor(chatch, 0.3, 0.5, 0.5, "", 0.45); // alpha = 0.5 TString files = dirnameIn + fl; /**************** Channel ****************/ TString channel[3]; channel[0] = "mujets"; channel[1] = "ejets"; channel[2] = "lepjet"; /**************** Data ****************/ std::vector<histos> DataMu; DataMu = loadhistograms(plots, files + "_DataSingleMu"); std::vector<histos> DataEG; DataEG = loadhistograms(plots, files + "_DataSingleEG"); std::vector<histos> Data; Data = addhistograms(DataMu, DataEG); setuphistograms(Data, kBlack); /**************** ttbar Signal ****************/ std::vector<histos> ttbar_0; ttbar_0 = loadhistograms(plots, files + "_ttbar-PowhegPythia"); setuphistograms(ttbar_0, kRed+1); std::vector<histos> ttbar_1; ttbar_1 = loadhistograms(plots, files + "_ttbar-MCatNLO"); setuphistograms(ttbar_1, kRed+2); std::vector<histos> ttbar_2; ttbar_2 = loadhistograms(plots, files + "_ttbar-Madgraph"); setuphistograms(ttbar_2, kRed+3); /**************** Z+Jets ****************/ std::vector<histos> ZJets; ZJets = loadhistograms(plots, files + "_ZJets"); setuphistograms(ZJets, kAzure-2); /**************** VV ****************/ std::vector<histos> WW; WW = loadhistograms(plots, files + "_WW"); std::vector<histos> WZ; WZ = loadhistograms(plots, files + "_WZ"); std::vector<histos> ZZ; ZZ = loadhistograms(plots, files + "_ZZ"); std::vector<histos> VV; VV = addhistograms(WW, WZ); VV = addhistograms(VV, ZZ); setuphistograms(VV, kYellow-3); /**************** Single Top ****************/ std::vector<histos> tW; tW = loadhistograms(plots, files + "_tW"); std::vector<histos> tbarW; tbarW = loadhistograms(plots, files + "_tbarW"); std::vector<histos> t_tch; t_tch = loadhistograms(plots, files + "_t-tchannel"); std::vector<histos> tbar_tch; tbar_tch = loadhistograms(plots, files + "_tbar-tchannel"); std::vector<histos> Single_top; Single_top = addhistograms(tW, tbarW); Single_top = addhistograms(Single_top, t_tch); Single_top = addhistograms(Single_top, tbar_tch); setuphistograms(Single_top, kPink-3); /**************** W+Jets ****************/ std::vector<histos> WJets; WJets = loadhistograms(plots, files + "_WJets"); setuphistograms(WJets, kGreen-3); /**************** ttbar Bkg ****************/ std::vector<histos> ttbar_bkg; ttbar_bkg = loadhistograms(plots, files + "_ttbar-PowhegPythiaBkg"); setuphistograms(ttbar_bkg, kViolet-3); /**************** QCD ****************/ std::vector<histos> QCD; QCD = loadhistograms(plots, files + "_QCD-MuEnr"); setuphistograms(QCD, kOrange-3); /**************** Stacks ****************/ std::vector<histos> Stack_bkg; std::vector<histos> Stack; histos st_bkg; histos st; for(unsigned int h=0; h<WJets.size(); h++){ TString variable; for(int ch=0; ch<3; ch++){ st.mc[ch] = new THStack(variable, ""); st_bkg.mc[ch] = new THStack(variable, ""); st.mc[ch]->SetHistogram( (TH1F*)WJets[h].hist[ch]->Clone()); st_bkg.mc[ch]->SetHistogram( (TH1F*)WJets[h].hist[ch]->Clone()); } Stack.push_back(st); Stack_bkg.push_back(st_bkg); } //------------------------------------------------------- // Background Stack Stack_bkg = addstack(Stack_bkg, WJets); Stack_bkg = addstack(Stack_bkg, QCD); Stack_bkg = addstack(Stack_bkg, Single_top); Stack_bkg = addstack(Stack_bkg, VV); Stack_bkg = addstack(Stack_bkg, ttbar_bkg); Stack_bkg = addstack(Stack_bkg, ZJets); //------------------------------------------------------- // Stack Stack = addstack(Stack, WJets); Stack = addstack(Stack, QCD); Stack = addstack(Stack, Single_top); Stack = addstack(Stack, VV); Stack = addstack(Stack, ttbar_bkg); Stack = addstack(Stack, ZJets); Stack = addstack(Stack, ttbar_0); //------------------------------------------------------- // other ttbar Generators ttbar_1 = addhistograms(ttbar_1, Stack_bkg); ttbar_2 = addhistograms(ttbar_2, Stack_bkg); /**************** Draw Histos ****************/ TCanvas *histocanvas; histocanvas = new TCanvas("plots", "Plots"); for(unsigned int h=0; h<WJets.size(); h++){ for(int ch=0; ch<3; ch++){ histocanvas->Divide(1,2); TPad *pad[2]; //Plot Pad pad[0] = (TPad*)histocanvas->GetPad(1); pad[0]->SetPad(0.01, 0.23, 0.99, 0.99); pad[0]->SetTopMargin(0.1); pad[0]->SetRightMargin(0.04); //Ratio Pad pad[1] = (TPad*)histocanvas->GetPad(2); pad[1]->SetPad(0.01, 0.02, 0.99, 0.3); gStyle->SetGridWidth(0.5); gStyle->SetGridColor(14); pad[1]->SetGridx(); pad[1]->SetGridy(); pad[1]->SetTopMargin(0.05); pad[1]->SetBottomMargin(0.4); pad[1]->SetRightMargin(0.04); //------------------------------------------------------- // Stack pad[0]->cd(); Stack[h].mc[ch]->Draw("hist"); Stack[h].mc[ch]->GetYaxis()->SetTitle("Events"); Stack[h].mc[ch]->GetYaxis()->SetTitleOffset(1.2); Stack[h].mc[ch]->GetYaxis()->SetTitleSize(0.07); Stack[h].mc[ch]->GetYaxis()->SetLabelSize(0.055); Stack[h].mc[ch]->GetYaxis()->SetNdivisions(607); //Stack[h].mc[ch]->GetYaxis()->SetLabelSize(0.05); TGaxis *hYaxis = (TGaxis*)Stack[h].mc[ch]->GetYaxis(); //hYaxis->SetMaxDigits(3); Stack[h].mc[ch]->GetXaxis()->SetLabelSize(0.0); Stack[h].mc[ch]->GetXaxis()->SetTitle(""); float maxh = Data[h].hist[ch]->GetMaximum(); if(maxh < Stack[h].mc[ch]->GetMaximum()) maxh = Stack[h].mc[ch]->GetMaximum(); Stack[h].mc[ch]->SetMaximum(1.7*maxh); //------------------------------------------------------- // Band error TGraphErrors *thegraph = new TGraphErrors(Stack[h].hist[ch]); thegraph->SetName("thegraph"); thegraph->SetFillStyle(1001); thegraph->SetFillColor(chatch); thegraph->SetLineColor(chatch); thegraph->Draw("e2SAME"); //------------------------------------------------------- // Other ttbar generators ttbar_1[h].hist[ch]->SetLineColor(6); ttbar_1[h].hist[ch]->SetLineStyle(2); ttbar_1[h].hist[ch]->SetFillColor(0); ttbar_1[h].hist[ch]->Draw("histoSAME"); ttbar_2[h].hist[ch]->SetLineColor(8); ttbar_2[h].hist[ch]->SetLineStyle(4); ttbar_2[h].hist[ch]->SetFillColor(0); ttbar_2[h].hist[ch]->Draw("histoSAME"); //------------------------------------------------------- // Data Histogram Data[h].hist[ch]->SetMarkerStyle(20); Data[h].hist[ch]->SetMarkerSize(0.7); Data[h].hist[ch]->Draw("SAME"); /*********************** Legends ***********************/ TLegend *leg; float legx1=0.76; float legy1=0.54; float legx2=0.90; float legy2=0.87; leg = new TLegend(legx1,legy1,legx2,legy2); leg->SetFillColor(0); leg->SetLineColor(1); leg->SetTextFont(62); leg->SetTextSize(0.03); leg->AddEntry(Data[h].hist[ch],"Data","PL"); leg->AddEntry(ttbar_0[h].hist[ch],"t#bar{t} Signal","F"); leg->AddEntry(ZJets[h].hist[ch],"Z+Jets","F"); leg->AddEntry(ttbar_bkg[h].hist[ch],"t#bar{t} Bkg","F"); leg->AddEntry(VV[h].hist[ch],"VV","F"); leg->AddEntry(Single_top[h].hist[ch],"Single t","F"); leg->AddEntry(QCD[h].hist[ch],"QCD","F"); leg->AddEntry(WJets[h].hist[ch],"W+Jets","F"); leg->AddEntry("thegraph","Uncertainty","F"); leg->AddEntry((TObject*)0,"",""); leg->AddEntry(ttbar_1[h].hist[ch],"MC@NLO","L"); leg->AddEntry(ttbar_2[h].hist[ch],"Madgraph","L"); leg->Draw("SAME"); //------------------------------------------------------- // CMS TString htitleCMSChannel[3]; htitleCMSChannel[0] = "#mu^{#pm}+jets channel"; htitleCMSChannel[1] = "e^{#pm}+jets channel"; htitleCMSChannel[2] = "l^{#pm}+jets channel"; titlePr = new TLatex(-20.,50.,"Preliminary"); titlePr->SetNDC(); titlePr->SetTextAlign(12); titlePr->SetX(0.25); titlePr->SetY(0.93); titlePr->SetTextColor(2); titlePr->SetTextFont(42); titlePr->SetTextSize(0.05); titlePr->SetTextSizePixels(24); titlePr->Draw("SAME"); title = new TLatex(-20.,50.,"CMS #sqrt{s} = 13TeV, L = 42 pb^{-1}(50ns)"); title->SetNDC(); title->SetTextAlign(12); title->SetX(0.20); title->SetY(0.83); title->SetTextFont(42); title->SetTextSize(0.05); title->SetTextSizePixels(24); title->Draw("SAME"); chtitle = new TLatex(-20.,50.,htitleCMSChannel[ch]); chtitle->SetNDC(); chtitle->SetTextAlign(12); chtitle->SetX(0.20); chtitle->SetY(0.75); chtitle->SetTextFont(42); chtitle->SetTextSize(0.05); chtitle->SetTextSizePixels(24); chtitle->Draw("SAME"); /*********************** Ratio ***********************/ pad[1]->cd(); //------------------------------------------------------- //Graph Ratio Clone TH1F *Ratio; Ratio = (TH1F*)Data[h].hist[ch]->Clone(); Ratio->Divide(Stack[h].hist[ch]); TH1F *RatioSyst; RatioSyst = (TH1F*)Data[h].hist[ch]->Clone(); RatioSyst->Divide(Stack[h].hist[ch]); // Should be the histogram with the Total Syst. Unc. std::vector<double> ratioContent; for(unsigned int b_r = 1; b_r <= RatioSyst->GetNbinsX(); b_r++){ RatioSyst->SetBinContent(b_r,1.0); //RatioSyst->SetBinError(b_r,0.15); // Tempotal!!! } Ratio->SetMarkerStyle(20); Ratio->SetMarkerSize(0.5); Ratio->SetMarkerColor(1); Ratio->SetLineColor(1); Ratio->SetLineWidth(1); Ratio->SetMaximum(2); Ratio->SetMinimum(0); Ratio->SetTitle(""); Ratio->GetYaxis()->SetTitle("Obs/Exp"); Ratio->GetYaxis()->CenterTitle(); Ratio->GetYaxis()->SetTitleOffset(0.45); Ratio->GetYaxis()->SetTitleSize(0.16); Ratio->GetYaxis()->SetLabelSize(0.15); Ratio->GetYaxis()->SetNdivisions(402); Ratio->GetXaxis()->SetNdivisions(509); Ratio->GetXaxis()->SetTitleOffset(1.1); Ratio->GetXaxis()->SetLabelSize(0.20); Ratio->GetXaxis()->SetTitleSize(0.16); Ratio->SetMinimum(0.6); Ratio->SetMaximum(1.4); TGraphErrors *thegraphRatioSyst = new TGraphErrors(RatioSyst); thegraphRatioSyst->SetFillStyle(1001); thegraphRatioSyst->SetFillColor(chatch); thegraphRatioSyst->SetName("thegraphRatioSyst"); //------------------------------------------------------- //Graph Ratio other ttbar generators TH1F *Ratio_1; Ratio_1 = (TH1F*)Data[h].hist[ch]->Clone(); Ratio_1->Divide(ttbar_1[h].hist[ch]); Ratio_1->SetLineColor(6); Ratio_1->SetLineStyle(2); Ratio_1->SetLineWidth(2); Ratio_1->SetFillColor(0); TH1F *Ratio_2; Ratio_2 = (TH1F*)Data[h].hist[ch]->Clone(); Ratio_2->Divide(ttbar_2[h].hist[ch]); Ratio_2->SetLineColor(8); Ratio_2->SetLineStyle(4); Ratio_2->SetLineWidth(2); Ratio_2->SetFillColor(0); //------------------------------------------------------- // Draw Ratios Ratio->Draw(); thegraphRatioSyst->Draw("e2"); Ratio->Draw("histpSAME"); Ratio_1->Draw("histSAME"); Ratio_2->Draw("histSAME"); /*********************** Save Histos ***********************/ TString dirfigname_pdf=dirnameIn + "figures_" + fl + "/pdf/"; // make a dir if it does not exist!! gSystem->mkdir(dirfigname_pdf, kTRUE); histocanvas->SaveAs(dirfigname_pdf + WJets[h].hist[ch]->GetName() + ".pdf"); // clear Canvas histocanvas->Clear(); } } } //end Plots.C
void gyieldsp() { //=========Macro generated from canvas: c1/c1 //========= (Fri Jul 31 19:31:43 2015) by ROOT version6.05/01 TCanvas *c1 = new TCanvas("c1", "c1",0,23,600,600); gStyle->SetOptFit(1); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); c1->Range(0,0,1,1); c1->SetFillColor(0); c1->SetBorderMode(0); c1->SetBorderSize(2); c1->SetTickx(1); c1->SetTicky(1); c1->SetLeftMargin(0.16); c1->SetRightMargin(0.04); c1->SetTopMargin(0.08); c1->SetBottomMargin(0.12); c1->SetFrameFillStyle(0); c1->SetFrameBorderMode(0); // ------------>Primitives in pad: pad1 TPad *pad1 = new TPad("pad1", "pad1",0,0.26,1,1); pad1->Draw(); pad1->cd(); pad1->Range(-3.5,-6.621622,2.75,158.9189); pad1->SetFillColor(0); pad1->SetBorderMode(0); pad1->SetBorderSize(2); pad1->SetTickx(1); pad1->SetTicky(1); pad1->SetLeftMargin(0.16); pad1->SetRightMargin(0.04); pad1->SetTopMargin(0.1142857); pad1->SetBottomMargin(0.04); pad1->SetFrameFillStyle(0); pad1->SetFrameBorderMode(0); pad1->SetFrameFillStyle(0); pad1->SetFrameBorderMode(0); Double_t Graph0_fx3021[10] = { 2.2, 1.75, 1.25, 0.75, 0.25, -0.25, -0.75, -1.25, -1.75, -2.2}; Double_t Graph0_fy3021[10] = { 103.56, 105.744, 103.4081, 100.0093, 97.03688, 94.36609, 90.5471, 82.43278, 65.82142, 43.43165}; Double_t Graph0_felx3021[10] = { 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.2}; Double_t Graph0_fely3021[10] = { 7.299733, 7.206486, 6.824632, 6.594841, 6.406375, 6.079494, 5.746822, 5.225105, 4.165823, 2.787035}; Double_t Graph0_fehx3021[10] = { 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.2}; Double_t Graph0_fehy3021[10] = { 5.988963, 6.218694, 6.307709, 6.368316, 5.847823, 5.655323, 5.083818, 4.561256, 3.722445, 2.542957}; TGraphAsymmErrors *grae = new TGraphAsymmErrors(10,Graph0_fx3021,Graph0_fy3021,Graph0_felx3021,Graph0_fehx3021,Graph0_fely3021,Graph0_fehy3021); grae->SetName("Graph0"); grae->SetTitle("Graph"); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#ffff00"); grae->SetFillColor(ci); ci = TColor::GetColor("#ff0000"); grae->SetLineColor(ci); grae->SetLineWidth(4); grae->SetMarkerStyle(20); grae->SetMarkerSize(0); TH1F *Graph_Graph3021 = new TH1F("Graph_Graph3021","Graph",100,-2.5,2.5); Graph_Graph3021->SetMinimum(0); Graph_Graph3021->SetMaximum(140); Graph_Graph3021->SetDirectory(0); Graph_Graph3021->SetStats(0); Graph_Graph3021->SetLineStyle(0); Graph_Graph3021->SetMarkerStyle(20); Graph_Graph3021->GetXaxis()->SetNdivisions(505); Graph_Graph3021->GetXaxis()->SetLabelFont(42); Graph_Graph3021->GetXaxis()->SetLabelOffset(0.007); Graph_Graph3021->GetXaxis()->SetLabelSize(0); Graph_Graph3021->GetXaxis()->SetTitleSize(0.07142857); Graph_Graph3021->GetXaxis()->SetTitleOffset(1.1); Graph_Graph3021->GetXaxis()->SetTitleFont(42); Graph_Graph3021->GetYaxis()->SetTitle("d#sigma (W^{+}#rightarrow#font[12]{l}^{+}#nu) / d#eta_{lab} [nb]"); Graph_Graph3021->GetYaxis()->SetLabelFont(42); Graph_Graph3021->GetYaxis()->SetLabelOffset(0.007); Graph_Graph3021->GetYaxis()->SetLabelSize(0.07142857); Graph_Graph3021->GetYaxis()->SetTitleSize(0.07142857); Graph_Graph3021->GetYaxis()->SetTitleOffset(1.05); Graph_Graph3021->GetYaxis()->SetTitleFont(42); Graph_Graph3021->GetZaxis()->SetLabelFont(42); Graph_Graph3021->GetZaxis()->SetLabelOffset(0.007); Graph_Graph3021->GetZaxis()->SetLabelSize(0.05); Graph_Graph3021->GetZaxis()->SetTitleSize(0.06); Graph_Graph3021->GetZaxis()->SetTitleFont(42); grae->SetHistogram(Graph_Graph3021); grae->Draw("a2"); Double_t Graph1_fx3022[10] = { 2.2, 1.75, 1.25, 0.75, 0.25, -0.25, -0.75, -1.25, -1.75, -2.2}; Double_t Graph1_fy3022[10] = { 103.56, 105.744, 103.4081, 100.0093, 97.03688, 94.36609, 90.5471, 82.43278, 65.82142, 43.43165}; Double_t Graph1_felx3022[10] = { 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.2}; Double_t Graph1_fely3022[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Double_t Graph1_fehx3022[10] = { 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.2}; Double_t Graph1_fehy3022[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; grae = new TGraphAsymmErrors(10,Graph1_fx3022,Graph1_fy3022,Graph1_felx3022,Graph1_fehx3022,Graph1_fely3022,Graph1_fehy3022); grae->SetName("Graph1"); grae->SetTitle("Graph"); ci = TColor::GetColor("#ffff00"); grae->SetFillColor(ci); ci = TColor::GetColor("#ff0000"); grae->SetLineColor(ci); grae->SetLineWidth(4); grae->SetMarkerStyle(20); grae->SetMarkerSize(0); grae->Draw("z"); Double_t Graph2_fx3023[10] = { 2.2, 1.75, 1.25, 0.75, 0.25, -0.25, -0.75, -1.25, -1.75, -2.2}; Double_t Graph2_fy3023[10] = { 91.59545, 95.26883, 95.65156, 95.47892, 95.94693, 96.02597, 93.3635, 84.56484, 65.95871, 42.11706}; Double_t Graph2_felx3023[10] = { 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.2}; Double_t Graph2_fely3023[10] = { 8.336985, 8.261181, 7.634488, 6.438496, 6.661149, 6.164321, 6.1019, 4.954787, 4.773841, 2.599375}; Double_t Graph2_fehx3023[10] = { 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.2}; Double_t Graph2_fehy3023[10] = { 8.262572, 7.14746, 6.62492, 6.725295, 5.946212, 5.838684, 5.077774, 5.257491, 3.443198, 2.602454}; grae = new TGraphAsymmErrors(10,Graph2_fx3023,Graph2_fy3023,Graph2_felx3023,Graph2_fehx3023,Graph2_fely3023,Graph2_fehy3023); grae->SetName("Graph2"); grae->SetTitle("Graph"); ci = TColor::GetColor("#009900"); grae->SetFillColor(ci); grae->SetFillStyle(3375); ci = TColor::GetColor("#009900"); grae->SetLineColor(ci); grae->SetLineStyle(7); grae->SetLineWidth(4); grae->SetMarkerStyle(20); TH1F *Graph_Graph3023 = new TH1F("Graph_Graph3023","Graph",100,-2.88,2.88); Graph_Graph3023->SetMinimum(33.22782); Graph_Graph3023->SetMaximum(108.7062); Graph_Graph3023->SetDirectory(0); Graph_Graph3023->SetStats(0); Graph_Graph3023->SetLineStyle(0); Graph_Graph3023->SetMarkerStyle(20); Graph_Graph3023->GetXaxis()->SetLabelFont(42); Graph_Graph3023->GetXaxis()->SetLabelOffset(0.007); Graph_Graph3023->GetXaxis()->SetLabelSize(0.05); Graph_Graph3023->GetXaxis()->SetTitleSize(0.06); Graph_Graph3023->GetXaxis()->SetTitleOffset(1.1); Graph_Graph3023->GetXaxis()->SetTitleFont(42); Graph_Graph3023->GetYaxis()->SetLabelFont(42); Graph_Graph3023->GetYaxis()->SetLabelOffset(0.007); Graph_Graph3023->GetYaxis()->SetLabelSize(0.05); Graph_Graph3023->GetYaxis()->SetTitleSize(0.06); Graph_Graph3023->GetYaxis()->SetTitleOffset(1.5); Graph_Graph3023->GetYaxis()->SetTitleFont(42); Graph_Graph3023->GetZaxis()->SetLabelFont(42); Graph_Graph3023->GetZaxis()->SetLabelOffset(0.007); Graph_Graph3023->GetZaxis()->SetLabelSize(0.05); Graph_Graph3023->GetZaxis()->SetTitleSize(0.06); Graph_Graph3023->GetZaxis()->SetTitleFont(42); grae->SetHistogram(Graph_Graph3023); grae->Draw("2"); Double_t Graph3_fx3024[10] = { 2.2, 1.75, 1.25, 0.75, 0.25, -0.25, -0.75, -1.25, -1.75, -2.2}; Double_t Graph3_fy3024[10] = { 91.59545, 95.26883, 95.65156, 95.47892, 95.94693, 96.02597, 93.3635, 84.56484, 65.95871, 42.11706}; Double_t Graph3_felx3024[10] = { 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.2}; Double_t Graph3_fely3024[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Double_t Graph3_fehx3024[10] = { 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.2}; Double_t Graph3_fehy3024[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; grae = new TGraphAsymmErrors(10,Graph3_fx3024,Graph3_fy3024,Graph3_felx3024,Graph3_fehx3024,Graph3_fely3024,Graph3_fehy3024); grae->SetName("Graph3"); grae->SetTitle("Graph"); ci = TColor::GetColor("#009900"); grae->SetFillColor(ci); grae->SetFillStyle(3375); ci = TColor::GetColor("#009900"); grae->SetLineColor(ci); grae->SetLineStyle(7); grae->SetLineWidth(4); grae->SetMarkerStyle(20); grae->Draw("z"); Double_t Graph4_fx1011[10] = { 2.2, 1.75, 1.25, 0.75, 0.25, -0.25, -0.75, -1.25, -1.75, -2.2}; Double_t Graph4_fy1011[10] = { 108.0732, 102.2597, 100.2246, 101.796, 105.3416, 99.73788, 98.62062, 85.94448, 62.90271, 44.47931}; Double_t Graph4_fex1011[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Double_t Graph4_fey1011[10] = { 6.667786, 4.792637, 3.765295, 3.224798, 3.479167, 3.377478, 3.07273, 3.40604, 2.800731, 2.87761}; TGraphErrors *gre = new TGraphErrors(10,Graph4_fx1011,Graph4_fy1011,Graph4_fex1011,Graph4_fey1011); gre->SetName("Graph4"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetFillStyle(0); gre->SetLineWidth(2); gre->SetMarkerStyle(20); gre->Draw("||"); Double_t gyieldsp_exp_statonly_1_fx1012[10] = { 2.2, 1.75, 1.25, 0.75, 0.25, -0.25, -0.75, -1.25, -1.75, -2.2}; Double_t gyieldsp_exp_statonly_1_fy1012[10] = { 108.0732, 102.2597, 100.2246, 101.796, 105.3416, 99.73788, 98.62062, 85.94448, 62.90271, 44.47931}; Double_t gyieldsp_exp_statonly_1_fex1012[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Double_t gyieldsp_exp_statonly_1_fey1012[10] = { 2.814265, 2.293805, 2.181326, 2.056934, 2.054972, 2.059018, 2.050204, 2.01317, 1.754638, 1.667829}; gre = new TGraphErrors(10,gyieldsp_exp_statonly_1_fx1012,gyieldsp_exp_statonly_1_fy1012,gyieldsp_exp_statonly_1_fex1012,gyieldsp_exp_statonly_1_fey1012); gre->SetName("gyieldsp_exp_statonly_1"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineWidth(2); gre->SetMarkerStyle(20); gre->SetMarkerSize(1.2); TH1F *Graph_gyieldsp_exp_statonly_11012 = new TH1F("Graph_gyieldsp_exp_statonly_11012","Graph",100,-2.64,2.64); Graph_gyieldsp_exp_statonly_11012->SetMinimum(36.00388); Graph_gyieldsp_exp_statonly_11012->SetMaximum(117.6951); Graph_gyieldsp_exp_statonly_11012->SetDirectory(0); Graph_gyieldsp_exp_statonly_11012->SetStats(0); Graph_gyieldsp_exp_statonly_11012->SetLineStyle(0); Graph_gyieldsp_exp_statonly_11012->SetMarkerStyle(20); Graph_gyieldsp_exp_statonly_11012->GetXaxis()->SetLabelFont(42); Graph_gyieldsp_exp_statonly_11012->GetXaxis()->SetLabelOffset(0.007); Graph_gyieldsp_exp_statonly_11012->GetXaxis()->SetLabelSize(0.05); Graph_gyieldsp_exp_statonly_11012->GetXaxis()->SetTitleSize(0.06); Graph_gyieldsp_exp_statonly_11012->GetXaxis()->SetTitleOffset(1.1); Graph_gyieldsp_exp_statonly_11012->GetXaxis()->SetTitleFont(42); Graph_gyieldsp_exp_statonly_11012->GetYaxis()->SetLabelFont(42); Graph_gyieldsp_exp_statonly_11012->GetYaxis()->SetLabelOffset(0.007); Graph_gyieldsp_exp_statonly_11012->GetYaxis()->SetLabelSize(0.05); Graph_gyieldsp_exp_statonly_11012->GetYaxis()->SetTitleSize(0.06); Graph_gyieldsp_exp_statonly_11012->GetYaxis()->SetTitleOffset(1.5); Graph_gyieldsp_exp_statonly_11012->GetYaxis()->SetTitleFont(42); Graph_gyieldsp_exp_statonly_11012->GetZaxis()->SetLabelFont(42); Graph_gyieldsp_exp_statonly_11012->GetZaxis()->SetLabelOffset(0.007); Graph_gyieldsp_exp_statonly_11012->GetZaxis()->SetLabelSize(0.05); Graph_gyieldsp_exp_statonly_11012->GetZaxis()->SetTitleSize(0.06); Graph_gyieldsp_exp_statonly_11012->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_gyieldsp_exp_statonly_11012); gre->Draw("pz"); TLegend *leg = new TLegend(0.6,0.1,0.9,0.3142857,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetTextSize(0.05714286); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); TLegendEntry *entry=leg->AddEntry("Graph4","Data","p"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(20); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("Graph0","CT10","lf"); ci = TColor::GetColor("#ffff00"); entry->SetFillColor(ci); entry->SetFillStyle(1001); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(4); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("Graph2","CT10+EPS09","lf"); ci = TColor::GetColor("#009900"); entry->SetFillColor(ci); entry->SetFillStyle(3375); ci = TColor::GetColor("#009900"); entry->SetLineColor(ci); entry->SetLineStyle(7); entry->SetLineWidth(4); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); leg->Draw(); TPaveText *pt = new TPaveText(-2.35,125,-0.35,140,"br"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetFillStyle(0); pt->SetTextAlign(13); pt->SetTextFont(42); pt->SetTextSize(0.05714286); TText *AText = pt->AddText("Luminosity uncertainty: 3.5%"); pt->Draw(); pt = new TPaveText(0.27,0.2,0.5,0.3428571,"brNDC"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetFillStyle(0); pt->SetTextAlign(13); pt->SetTextFont(42); pt->SetTextSize(0.05714286); AText = pt->AddText("W^{+} #rightarrow #font[12]{l}^{+} + #nu"); AText = pt->AddText("p_{T}^{#font[12]{l}} > 25 GeV/c"); pt->Draw(); tex = new TLatex(0.96,0.9177143," #sqrt{s_{NN}} = 5.02 TeV"); tex->SetNDC(); tex->SetTextAlign(31); tex->SetTextFont(42); tex->SetTextSize(0.05714286); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.16,0.9177143,"pPb 34.6 nb^{-1}"); tex->SetNDC(); tex->SetTextFont(42); tex->SetTextSize(0.05714286); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.924,0.8476571,"CMS"); tex->SetNDC(); tex->SetTextAlign(33); tex->SetTextFont(61); tex->SetTextSize(0.06857143); tex->SetLineWidth(2); tex->Draw(); TH1F *Graph_copy = new TH1F("Graph_copy","Graph",100,-2.5,2.5); Graph_copy->SetMinimum(0); Graph_copy->SetMaximum(140); Graph_copy->SetDirectory(0); Graph_copy->SetStats(0); Graph_copy->SetLineStyle(0); Graph_copy->SetMarkerStyle(20); Graph_copy->GetXaxis()->SetNdivisions(505); Graph_copy->GetXaxis()->SetLabelFont(42); Graph_copy->GetXaxis()->SetLabelOffset(0.007); Graph_copy->GetXaxis()->SetLabelSize(0); Graph_copy->GetXaxis()->SetTitleSize(0.07142857); Graph_copy->GetXaxis()->SetTitleOffset(1.1); Graph_copy->GetXaxis()->SetTitleFont(42); Graph_copy->GetYaxis()->SetTitle("d#sigma (W^{+}#rightarrow#font[12]{l}^{+}#nu) / d#eta_{lab} [nb]"); Graph_copy->GetYaxis()->SetLabelFont(42); Graph_copy->GetYaxis()->SetLabelOffset(0.007); Graph_copy->GetYaxis()->SetLabelSize(0.07142857); Graph_copy->GetYaxis()->SetTitleSize(0.07142857); Graph_copy->GetYaxis()->SetTitleOffset(1.05); Graph_copy->GetYaxis()->SetTitleFont(42); Graph_copy->GetZaxis()->SetLabelFont(42); Graph_copy->GetZaxis()->SetLabelOffset(0.007); Graph_copy->GetZaxis()->SetLabelSize(0.05); Graph_copy->GetZaxis()->SetTitleSize(0.06); Graph_copy->GetZaxis()->SetTitleFont(42); Graph_copy->Draw("sameaxis"); pad1->Modified(); c1->cd(); // ------------>Primitives in pad: pad2 TPad *pad2 = new TPad("pad2", "pad2",0,0,1,0.288); pad2->Draw(); pad2->cd(); pad2->Range(-3.5,0.35,2.75,1.35); pad2->SetFillColor(0); pad2->SetFillStyle(4000); pad2->SetBorderMode(0); pad2->SetBorderSize(2); pad2->SetTickx(1); pad2->SetTicky(1); pad2->SetLeftMargin(0.16); pad2->SetRightMargin(0.04); pad2->SetTopMargin(0); pad2->SetBottomMargin(0.4); pad2->SetFrameFillStyle(4000); pad2->SetFrameBorderMode(0); pad2->SetFrameFillStyle(4000); pad2->SetFrameBorderMode(0); TH1F *Graph = new TH1F("Graph","Graph",100,-2.5,2.5); Graph->SetMinimum(0.75); Graph->SetMaximum(1.35); Graph->SetDirectory(0); Graph->SetStats(0); Graph->SetLineStyle(0); Graph->SetMarkerStyle(20); Graph->GetXaxis()->SetTitle("#eta_{lab}"); Graph->GetXaxis()->SetNdivisions(505); Graph->GetXaxis()->SetLabelFont(42); Graph->GetXaxis()->SetLabelOffset(0.007); Graph->GetXaxis()->SetLabelSize(0.1666667); Graph->GetXaxis()->SetTitleSize(0.1666667); Graph->GetXaxis()->SetTitleOffset(1.1); Graph->GetXaxis()->SetTitleFont(42); Graph->GetYaxis()->SetTitle("Ratio "); Graph->GetYaxis()->SetNdivisions(503); Graph->GetYaxis()->SetLabelFont(42); Graph->GetYaxis()->SetLabelOffset(0.007); Graph->GetYaxis()->SetLabelSize(0.1666667); Graph->GetYaxis()->SetTitleSize(0.1666667); Graph->GetYaxis()->SetTitleOffset(0.45); Graph->GetYaxis()->SetTitleFont(42); Graph->GetZaxis()->SetLabelFont(42); Graph->GetZaxis()->SetLabelOffset(0.007); Graph->GetZaxis()->SetLabelSize(0.05); Graph->GetZaxis()->SetTitleSize(0.06); Graph->GetZaxis()->SetTitleFont(42); Graph->Draw(""); Double_t Graph0_fx1013[10] = { 2.2, 1.75, 1.25, 0.75, 0.25, -0.25, -0.75, -1.25, -1.75, -2.2}; Double_t Graph0_fy1013[10] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; Double_t Graph0_fex1013[10] = { 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.2}; Double_t Graph0_fey1013[10] = { 0.0644708, 0.06365122, 0.06354681, 0.06481966, 0.06320752, 0.0622177, 0.05991862, 0.05949606, 0.06001632, 0.06142499}; gre = new TGraphErrors(10,Graph0_fx1013,Graph0_fy1013,Graph0_fex1013,Graph0_fey1013); gre->SetName("Graph0"); gre->SetTitle("Graph"); ci = TColor::GetColor("#ffff00"); gre->SetFillColor(ci); ci = TColor::GetColor("#ff0000"); gre->SetLineColor(ci); gre->SetLineWidth(4); gre->SetMarkerStyle(20); gre->SetMarkerSize(0); TH1F *Graph_Graph1013 = new TH1F("Graph_Graph1013","Graph",100,-2.88,2.88); Graph_Graph1013->SetMinimum(0.9222164); Graph_Graph1013->SetMaximum(1.077784); Graph_Graph1013->SetDirectory(0); Graph_Graph1013->SetStats(0); Graph_Graph1013->SetLineStyle(0); Graph_Graph1013->SetMarkerStyle(20); Graph_Graph1013->GetXaxis()->SetLabelFont(42); Graph_Graph1013->GetXaxis()->SetLabelOffset(0.007); Graph_Graph1013->GetXaxis()->SetLabelSize(0.05); Graph_Graph1013->GetXaxis()->SetTitleSize(0.06); Graph_Graph1013->GetXaxis()->SetTitleOffset(1.1); Graph_Graph1013->GetXaxis()->SetTitleFont(42); Graph_Graph1013->GetYaxis()->SetLabelFont(42); Graph_Graph1013->GetYaxis()->SetLabelOffset(0.007); Graph_Graph1013->GetYaxis()->SetLabelSize(0.05); Graph_Graph1013->GetYaxis()->SetTitleSize(0.06); Graph_Graph1013->GetYaxis()->SetTitleOffset(1.5); Graph_Graph1013->GetYaxis()->SetTitleFont(42); Graph_Graph1013->GetZaxis()->SetLabelFont(42); Graph_Graph1013->GetZaxis()->SetLabelOffset(0.007); Graph_Graph1013->GetZaxis()->SetLabelSize(0.05); Graph_Graph1013->GetZaxis()->SetTitleSize(0.06); Graph_Graph1013->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1013); gre->Draw("2"); Double_t Graph1_fx1014[10] = { 2.2, 1.75, 1.25, 0.75, 0.25, -0.25, -0.75, -1.25, -1.75, -2.2}; Double_t Graph1_fy1014[10] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; Double_t Graph1_fex1014[10] = { 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.2}; Double_t Graph1_fey1014[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; gre = new TGraphErrors(10,Graph1_fx1014,Graph1_fy1014,Graph1_fex1014,Graph1_fey1014); gre->SetName("Graph1"); gre->SetTitle("Graph"); ci = TColor::GetColor("#ffff00"); gre->SetFillColor(ci); ci = TColor::GetColor("#ff0000"); gre->SetLineColor(ci); gre->SetLineWidth(4); gre->SetMarkerStyle(20); gre->SetMarkerSize(0); gre->Draw("z"); Double_t Graph2_fx1015[10] = { 2.2, 1.75, 1.25, 0.75, 0.25, -0.25, -0.75, -1.25, -1.75, -2.2}; Double_t Graph2_fy1015[10] = { 0.8844678, 0.9009383, 0.9249909, 0.9547005, 0.9887677, 1.01759, 1.031104, 1.025864, 1.002086, 0.9697318}; Double_t Graph2_fex1015[10] = { 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.2}; Double_t Graph2_fey1015[10] = { 0.05296218, 0.042007, 0.03326947, 0.02116912, 0.0170915, 0.01890429, 0.01672622, 0.01681633, 0.01541551, 0.01597539}; gre = new TGraphErrors(10,Graph2_fx1015,Graph2_fy1015,Graph2_fex1015,Graph2_fey1015); gre->SetName("Graph2"); gre->SetTitle("Graph"); ci = TColor::GetColor("#009900"); gre->SetFillColor(ci); gre->SetFillStyle(3375); ci = TColor::GetColor("#009900"); gre->SetLineColor(ci); gre->SetLineStyle(7); gre->SetLineWidth(4); gre->SetMarkerStyle(20); TH1F *Graph_Graph1015 = new TH1F("Graph_Graph1015","Graph",100,-2.88,2.88); Graph_Graph1015->SetMinimum(0.8098732); Graph_Graph1015->SetMaximum(1.069463); Graph_Graph1015->SetDirectory(0); Graph_Graph1015->SetStats(0); Graph_Graph1015->SetLineStyle(0); Graph_Graph1015->SetMarkerStyle(20); Graph_Graph1015->GetXaxis()->SetLabelFont(42); Graph_Graph1015->GetXaxis()->SetLabelOffset(0.007); Graph_Graph1015->GetXaxis()->SetLabelSize(0.05); Graph_Graph1015->GetXaxis()->SetTitleSize(0.06); Graph_Graph1015->GetXaxis()->SetTitleOffset(1.1); Graph_Graph1015->GetXaxis()->SetTitleFont(42); Graph_Graph1015->GetYaxis()->SetLabelFont(42); Graph_Graph1015->GetYaxis()->SetLabelOffset(0.007); Graph_Graph1015->GetYaxis()->SetLabelSize(0.05); Graph_Graph1015->GetYaxis()->SetTitleSize(0.06); Graph_Graph1015->GetYaxis()->SetTitleOffset(1.5); Graph_Graph1015->GetYaxis()->SetTitleFont(42); Graph_Graph1015->GetZaxis()->SetLabelFont(42); Graph_Graph1015->GetZaxis()->SetLabelOffset(0.007); Graph_Graph1015->GetZaxis()->SetLabelSize(0.05); Graph_Graph1015->GetZaxis()->SetTitleSize(0.06); Graph_Graph1015->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1015); gre->Draw("2"); Double_t Graph3_fx1016[10] = { 2.2, 1.75, 1.25, 0.75, 0.25, -0.25, -0.75, -1.25, -1.75, -2.2}; Double_t Graph3_fy1016[10] = { 0.8844678, 0.9009383, 0.9249909, 0.9547005, 0.9887677, 1.01759, 1.031104, 1.025864, 1.002086, 0.9697318}; Double_t Graph3_fex1016[10] = { 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.2}; Double_t Graph3_fey1016[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; gre = new TGraphErrors(10,Graph3_fx1016,Graph3_fy1016,Graph3_fex1016,Graph3_fey1016); gre->SetName("Graph3"); gre->SetTitle("Graph"); ci = TColor::GetColor("#009900"); gre->SetFillColor(ci); gre->SetFillStyle(3375); ci = TColor::GetColor("#009900"); gre->SetLineColor(ci); gre->SetLineStyle(7); gre->SetLineWidth(4); gre->SetMarkerStyle(20); gre->Draw("z"); Double_t Graph4_fx1017[10] = { 2.2, 1.75, 1.25, 0.75, 0.25, -0.25, -0.75, -1.25, -1.75, -2.2}; Double_t Graph4_fy1017[10] = { 1.043581, 0.9670498, 0.9692137, 1.017865, 1.085583, 1.056925, 1.089164, 1.042601, 0.9556571, 1.024122}; Double_t Graph4_fex1017[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Double_t Graph4_fey1017[10] = { 0.06438575, 0.04532301, 0.03641199, 0.03224499, 0.03585407, 0.03579123, 0.03393516, 0.041319, 0.04255045, 0.06625605}; gre = new TGraphErrors(10,Graph4_fx1017,Graph4_fy1017,Graph4_fex1017,Graph4_fey1017); gre->SetName("Graph4"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetFillStyle(0); gre->SetLineWidth(2); gre->SetMarkerStyle(20); gre->Draw("||"); Double_t Graph5_fx1018[10] = { 2.2, 1.75, 1.25, 0.75, 0.25, -0.25, -0.75, -1.25, -1.75, -2.2}; Double_t Graph5_fy1018[10] = { 1.043581, 0.9670498, 0.9692137, 1.017865, 1.085583, 1.056925, 1.089164, 1.042601, 0.9556571, 1.024122}; Double_t Graph5_fex1018[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Double_t Graph5_fey1018[10] = { 0.02717523, 0.02169205, 0.02109434, 0.02056743, 0.02117723, 0.02181947, 0.02264241, 0.02442196, 0.02665755, 0.03840124}; gre = new TGraphErrors(10,Graph5_fx1018,Graph5_fy1018,Graph5_fex1018,Graph5_fey1018); gre->SetName("Graph5"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineWidth(2); gre->SetMarkerStyle(20); TH1F *Graph_Graph1018 = new TH1F("Graph_Graph1018","Graph",100,-2.64,2.64); Graph_Graph1018->SetMinimum(0.9107189); Graph_Graph1018->SetMaximum(1.130087); Graph_Graph1018->SetDirectory(0); Graph_Graph1018->SetStats(0); Graph_Graph1018->SetLineStyle(0); Graph_Graph1018->SetMarkerStyle(20); Graph_Graph1018->GetXaxis()->SetLabelFont(42); Graph_Graph1018->GetXaxis()->SetLabelOffset(0.007); Graph_Graph1018->GetXaxis()->SetLabelSize(0.05); Graph_Graph1018->GetXaxis()->SetTitleSize(0.06); Graph_Graph1018->GetXaxis()->SetTitleOffset(1.1); Graph_Graph1018->GetXaxis()->SetTitleFont(42); Graph_Graph1018->GetYaxis()->SetLabelFont(42); Graph_Graph1018->GetYaxis()->SetLabelOffset(0.007); Graph_Graph1018->GetYaxis()->SetLabelSize(0.05); Graph_Graph1018->GetYaxis()->SetTitleSize(0.06); Graph_Graph1018->GetYaxis()->SetTitleOffset(1.5); Graph_Graph1018->GetYaxis()->SetTitleFont(42); Graph_Graph1018->GetZaxis()->SetLabelFont(42); Graph_Graph1018->GetZaxis()->SetLabelOffset(0.007); Graph_Graph1018->GetZaxis()->SetLabelSize(0.05); Graph_Graph1018->GetZaxis()->SetTitleSize(0.06); Graph_Graph1018->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1018); gre->Draw("pz"); TH1F *Graph_copy = new TH1F("Graph_copy","Graph",100,-2.5,2.5); Graph_copy->SetMinimum(0.75); Graph_copy->SetMaximum(1.35); Graph_copy->SetDirectory(0); Graph_copy->SetStats(0); Graph_copy->SetLineStyle(0); Graph_copy->SetMarkerStyle(20); Graph_copy->GetXaxis()->SetTitle("#eta_{lab}"); Graph_copy->GetXaxis()->SetNdivisions(505); Graph_copy->GetXaxis()->SetLabelFont(42); Graph_copy->GetXaxis()->SetLabelOffset(0.007); Graph_copy->GetXaxis()->SetLabelSize(0.1666667); Graph_copy->GetXaxis()->SetTitleSize(0.1666667); Graph_copy->GetXaxis()->SetTitleOffset(1.1); Graph_copy->GetXaxis()->SetTitleFont(42); Graph_copy->GetYaxis()->SetTitle("Ratio "); Graph_copy->GetYaxis()->SetNdivisions(503); Graph_copy->GetYaxis()->SetLabelFont(42); Graph_copy->GetYaxis()->SetLabelOffset(0.007); Graph_copy->GetYaxis()->SetLabelSize(0.1666667); Graph_copy->GetYaxis()->SetTitleSize(0.1666667); Graph_copy->GetYaxis()->SetTitleOffset(0.45); Graph_copy->GetYaxis()->SetTitleFont(42); Graph_copy->GetZaxis()->SetLabelFont(42); Graph_copy->GetZaxis()->SetLabelOffset(0.007); Graph_copy->GetZaxis()->SetLabelSize(0.05); Graph_copy->GetZaxis()->SetTitleSize(0.06); Graph_copy->GetZaxis()->SetTitleFont(42); Graph_copy->Draw("sameaxis"); pad2->Modified(); c1->cd(); c1->Modified(); c1->cd(); c1->SetSelected(c1); }
void PostFitCombine(TString Plots = "fit_s", TString InpDir = "FitResults_DataCardFixbtagSysVisPhSp_hSF-PreApp-v0_Tree_LepJets_NewJEC-OldKinFit_v8-0-6_Spring16-80X_36814pb-1_2btag", TString FitDir = "OBSERVED"){ TString PlotsFileName; if(FitDir == "OBSERVED") PlotsFileName = "obs"; if(FitDir == "EXPECTED") PlotsFileName = "exp"; TString inputfile = "CombineResults/" + InpDir + "/" + FitDir + "/fitDiagnostics" + PlotsFileName + "MLF.root"; setTDRStyle(); gROOT->SetStyle("Plain"); gStyle->SetOptFit(1000); gStyle->SetOptStat("emruo"); gStyle->SetOptStat(kFALSE); gStyle->SetPadTickY(1); gStyle->SetPadTickX(1); int col_ttbb = TColor::GetColor("#660000"); int col_ttb = TColor::GetColor("#ffcc00"); int col_ttcc = TColor::GetColor("#cc6600"); int col_ttc = TColor::GetColor("#cc6600"); int col_ttLF = TColor::GetColor("#ff0000"); int col_tt = TColor::GetColor("#FF7F7F"); int col_ttbarBkg = TColor::GetColor("#ff6565"); int col_SingleTop = TColor::GetColor("#ff00ff"); int col_WJets = TColor::GetColor("#33cc33"); int col_ZJets = TColor::GetColor("#3366ff"); int col_QCD = TColor::GetColor("#ffff00"); int col_ttbarV = TColor::GetColor("#e75c8d"); int col_ttbarH = TColor::GetColor("#e5c4f4"); int col_VV = TColor::GetColor("#ffffff"); TFile *hfile = NULL; hfile = TFile::Open(inputfile); cout << "file loaded: " << inputfile << endl; std::vector<TString> hNamefile; std::vector<int> hColor; hNamefile.push_back("ttbar_LepJetsPowhegPythiattbb"); // 0 hColor.push_back(TColor::GetColor("#660000")); hNamefile.push_back("ttbar_LepJetsPowhegPythiattbj"); // 1 hColor.push_back(TColor::GetColor("#ffcc00")); hNamefile.push_back("ttbar_LepJetsPowhegPythiattcc"); // 2 hColor.push_back(TColor::GetColor("#cc6600")); hNamefile.push_back("ttbar_LepJetsPowhegPythiattLF"); // 3 hColor.push_back(TColor::GetColor("#ff0000")); hNamefile.push_back("ttbar_PowhegPythiaBkgtt"); hColor.push_back(TColor::GetColor("#FF7F7F")); hNamefile.push_back("ttHbb_PowhegPythia"); hColor.push_back(TColor::GetColor("#e5c4f4")); hNamefile.push_back("ttV_Madgraph"); hColor.push_back(TColor::GetColor("#e75c8d")); hNamefile.push_back("WJets_aMCatNLO"); hColor.push_back(TColor::GetColor("#33cc33")); hNamefile.push_back("QCD"); hColor.push_back(TColor::GetColor("#ffff00")); hNamefile.push_back("SingleTop"); hColor.push_back(TColor::GetColor("#ff00ff")); hNamefile.push_back("VV"); hColor.push_back(TColor::GetColor("#ffffff")); hNamefile.push_back("ZJets_aMCatNLO"); hColor.push_back(TColor::GetColor("#3366ff")); hNamefile.push_back("total"); hColor.push_back(1); hNamefile.push_back("total_signal"); hColor.push_back(1); hNamefile.push_back("total_background"); hColor.push_back(1); //TString dirname[2] = {"Name1","Name2"}; //{mu,e} TString dirname[2] = {"ch1","ch2"}; //{mu,e} TString titlechname[2] = {"#mu+Jets","e+Jets"}; TString chname[2] = {"mujets","ejets"}; std::vector<TH1D*> hInput[2]; TH1D *hData[2], *hData_reg[2][20]; THStack *AllMC[2], *AllMC_reg[2][20]; THStack *AllMC_CSV1[2], *AllMC_CSV2[2]; // THStack Initialization for(int ich=0;ich<2;ich++){ AllMC[ich] = new THStack("PostFit_"+chname[ich], "CSV Distribution Post-Fit ("+titlechname[ich]+")"); for(int ireg=0;ireg<20;ireg++){ TString RegNum; RegNum.Form("%i",ireg); AllMC_reg[ich][ireg] = new THStack("PostFit_"+chname[ich]+RegNum, "CSV Distribution Post-Fit ("+titlechname[ich]+") for "+RegNum); } // for(ireg) } // for(ich) cout << "Loading histograms... " << endl; // MC Profiles for(int ich=0;ich<2;ich++){ for(int ih=0;ih<hNamefile.size();ih++){ cout << "shapes_"+Plots+"/"+dirname[ich]+"/" + hNamefile.at(ih) << endl; TH1D *htemp = (TH1D*) hfile->Get("shapes_"+Plots+"/"+dirname[ich]+"/" + hNamefile.at(ih))->Clone("c" + hNamefile.at(ih)); htemp->SetFillColor(hColor.at(ih)); htemp->SetLineColor(1); hInput[ich].push_back(htemp); cout << hNamefile.at(ih) << " = " << htemp->Integral() << endl; if(ih==0) AllMC[ich]->SetHistogram((TH1D*)htemp->Clone("FirstStack")); if (!hNamefile.at(ih).Contains("total")) AllMC[ich] -> Add(htemp); // Data // Clone Histo Structure only once if(ih==0){ hData[ich] = (TH1D *) htemp->Clone("data_"+dirname[ich]); hData[ich]->Reset(); } } // for(ih) // Data TGraph TGraphAsymmErrors *DataFull = (TGraphAsymmErrors *) hfile->Get("shapes_"+Plots+"/"+dirname[ich]+"/data")->Clone("data_"+dirname[ich]); for(int ibin=1;ibin<=hData[ich]->GetNbinsX();ibin++){ double igb, EvtBinData, EvtErrBinData; DataFull->GetPoint((ibin-1),igb,EvtBinData); hData[ich]->SetBinContent(ibin,EvtBinData); EvtErrBinData = DataFull->GetErrorY((ibin-1)); hData[ich]->SetBinError(ibin,EvtErrBinData); } // Histograms for each region for(int ih=0;ih<hNamefile.size();ih++){ TH1D *htemp = (TH1D*) hfile->Get("shapes_"+Plots+"/"+dirname[ich]+"/" + hNamefile.at(ih))->Clone("c_reg" + hNamefile.at(ih)); for(int ireg=0;ireg<20;ireg++){ TH1D *htempreg = new TH1D ("","",20,0,20); for(int ibin=1;ibin<=20;ibin++){ //if ( (ibin+20*ireg) == 181) cout << hNamefile.at(ih) << " " << ibin+20*ireg << " : " << htemp->GetBinContent(ibin+20*ireg) << " ; " << htemp->GetBinError(ibin+20*ireg) << endl; htempreg->SetBinContent(ibin,htemp->GetBinContent(ibin+20*ireg)); htempreg->SetBinError(ibin,htemp->GetBinError(ibin+20*ireg)); htempreg->SetFillColor(hColor.at(ih)); } // for(ibin) if(ih==0) AllMC_reg[ich][ireg]->SetHistogram((TH1D*)htempreg->Clone("FirstStack")); if (!hNamefile.at(ih).Contains("total")) AllMC_reg[ich][ireg] -> Add(htempreg); } // for(ireg) } // for(ih) // Data for(int ireg=0;ireg<20;ireg++){ TString RegNum; RegNum.Form("%i",ireg); hData_reg[ich][ireg] = new TH1D ("hData_"+chname[ich]+RegNum,"Data Histogram "+titlechname[ich]+" for "+RegNum,20,0,20); // Data for(int ibin=1;ibin<=20;ibin++){ double igb, EvtBinData, EvtErrBinData; DataFull->GetPoint(((ibin-1)+(20*ireg)),igb,EvtBinData); hData_reg[ich][ireg]->SetBinContent(ibin,EvtBinData); EvtErrBinData = DataFull->GetErrorY((ibin-1)); hData_reg[ich][ireg]->SetBinError(ibin,EvtErrBinData); hData_reg[ich][ireg]->SetMarkerStyle(20); hData_reg[ich][ireg]->SetMarkerSize(0.5); } // for(ibin) } // for(ireg) // Recover basic CSV plots // -- MC TH1D *GlobalCSVJet[12][2]; // 12 components AllMC_CSV1[ich] = new THStack("CSV1_"+chname[ich], "CSV-AddJet1 Distribution Post-Fit ("+titlechname[ich]+")"); AllMC_CSV2[ich] = new THStack("CSV2_"+chname[ich], "CSV-AddJet2 Distribution Post-Fit ("+titlechname[ich]+")"); for(int ih=0;ih<12;ih++){ GlobalCSVJet[ih][0] = new TH1D("GlobalCSVJet1_" + hNamefile.at(ih), "CSV distribution for AddJet-1", 20, 0.0, 1.0); GlobalCSVJet[ih][1] = new TH1D("GlobalCSVJet2_" + hNamefile.at(ih), "CSV distribution for AddJet-2", 20, 0.0, 1.0); RecoverCSVHisto (hInput[ich].at(ih), GlobalCSVJet[ih][0], GlobalCSVJet[ih][1]); GlobalCSVJet[ih][0]->SetFillColor(hColor.at(ih)); GlobalCSVJet[ih][1]->SetFillColor(hColor.at(ih)); if(ih==0) AllMC_CSV1[ich]->SetHistogram((TH1D*)GlobalCSVJet[ih][0]->Clone("FirstStack")); if(ih==0) AllMC_CSV2[ich]->SetHistogram((TH1D*)GlobalCSVJet[ih][1]->Clone("FirstStack")); AllMC_CSV1[ich] -> Add(GlobalCSVJet[ih][0]); AllMC_CSV2[ich] -> Add(GlobalCSVJet[ih][1]); } // -- Data TH1D *GlobalCSVJet_Data[2]; // 12 components GlobalCSVJet_Data[0] = new TH1D("GlobalCSVJet1_Data", "CSV distribution for AddJet-1", 20, 0.0, 1.0); GlobalCSVJet_Data[1] = new TH1D("GlobalCSVJet2_Data", "CSV distribution for AddJet-2", 20, 0.0, 1.0); RecoverCSVHisto (hData[ich], GlobalCSVJet_Data[0], GlobalCSVJet_Data[1]); // ----------- // Plotting // ----------- TH1D *hstyle = new TH1D ("","", hData[ich]->GetNbinsX(), hData[ich]->GetBinLowEdge (1), hData[ich]->GetBinLowEdge (hData[ich]->GetNbinsX()+1)); hstyle -> SetMaximum(1.1*hInput[ich].at(12)->GetMaximum()); hstyle -> GetYaxis()->SetTitleFont(42); hstyle -> GetYaxis()->SetTitleOffset(0.7); hstyle -> GetYaxis()->SetTitleSize(0.05); hstyle -> GetYaxis()->SetLabelFont(42); hstyle -> GetYaxis()->SetLabelSize(0.045); hstyle -> GetYaxis()->SetNdivisions(607); hstyle -> GetYaxis()->SetTitle("Events / unit"); hData[ich] -> SetMarkerStyle(20); hData[ich] -> SetMarkerSize(0.4); hData[ich] -> SetLineWidth(1); hData[ich] -> SetTitle(""); TCanvas *cPlots;//histos cPlots = new TCanvas("cPlots"+dirname[ich] ,"Plots"); cPlots->Divide(1,2); TPad *pad[4], *glpad[2]; // Global Pad glpad[0] = (TPad*)cPlots->GetPad(1); glpad[0]->Divide(1,2); glpad[1] = (TPad*)cPlots->GetPad(2); glpad[1]->Divide(1,2); //Plot Pad pad[0] = (TPad*)glpad[0]->GetPad(1); pad[0]->SetPad(0.01, 0.23, 0.99, 0.99); pad[0]->SetTopMargin(0.1); pad[0]->SetRightMargin(0.04); //Ratio Pad pad[1] = (TPad*)glpad[0]->GetPad(2); pad[1]->SetPad(0.01, 0.02, 0.99, 0.3); gStyle->SetGridWidth(1); gStyle->SetGridColor(14); pad[1]->SetGridx(); pad[1]->SetGridy(); pad[1]->SetTopMargin(0.05); pad[1]->SetBottomMargin(0.4); pad[1]->SetRightMargin(0.04); //Plot Pad pad[2] = (TPad*)glpad[1]->GetPad(1); pad[2]->SetPad(0.01, 0.23, 0.99, 0.99); pad[2]->SetTopMargin(0.1); pad[2]->SetRightMargin(0.04); //Ratio Pad pad[3] = (TPad*)glpad[1]->GetPad(2); pad[3]->SetPad(0.01, 0.02, 0.99, 0.3); gStyle->SetGridWidth(1); gStyle->SetGridColor(14); pad[3]->SetGridx(); pad[3]->SetGridy(); pad[3]->SetTopMargin(0.05); pad[3]->SetBottomMargin(0.4); pad[3]->SetRightMargin(0.04); pad[0]->cd(); hstyle->Draw(); AllMC[ich] -> Draw("HISTSAME"); hData[ich] -> Draw("PSAME"); TH1D *RatioFull = HistoRatio (hData[ich] , (TH1D*) AllMC[ich]->GetStack()->Last()); TGraphErrors *gRatioFull = new TGraphErrors(RatioFull); gRatioFull->SetFillStyle(1001); gRatioFull->SetFillColor(chatch); gRatioFull->SetName("gRatioFull"); TLegend *leg; float legPos[4] = {0.70, // x_o 0.40, // y_o 0.94, // x_f 0.87}; // y_f leg = new TLegend(legPos[0],legPos[1],legPos[2],legPos[3]); leg->SetFillColor(0); leg->SetLineColor(0); leg->SetLineWidth(0.0); leg->SetTextFont(62); leg->SetTextSize(0.03); leg->SetNColumns(2); leg->AddEntry(hData[ich], "Data","PL"); leg->AddEntry(hInput[ich].at(11), "Z+Jets","F"); leg->AddEntry(hInput[ich].at(10), "VV","F"); leg->AddEntry(hInput[ich].at(9), "Single t","F"); leg->AddEntry(hInput[ich].at(8), "QCD","F"); leg->AddEntry(hInput[ich].at(7), "W+Jets","F"); leg->AddEntry(hInput[ich].at(6), "t#bar{t}+V","F"); leg->AddEntry(hInput[ich].at(5), "t#bar{t}+H","F"); leg->AddEntry(hInput[ich].at(4), "t#bar{t}+other","F"); leg->AddEntry(hInput[ich].at(3), "t#bar{t}+LF","F"); leg->AddEntry(hInput[ich].at(2), "t#bar{t}+cc","F"); leg->AddEntry(hInput[ich].at(1), "t#bar{t}+bj","F"); leg->AddEntry(hInput[ich].at(0), "t#bar{t}+bb","F"); leg->AddEntry(gRatioFull, "Stat. Unc.","F"); leg->Draw("SAME"); TLatex *titlePr; titlePr = new TLatex(-20.,50.,"35.9 fb^{-1} (13TeV)"); titlePr->SetNDC(); titlePr->SetTextAlign(12); titlePr->SetX(0.78); titlePr->SetY(0.935); titlePr->SetTextFont(42); titlePr->SetTextSize(0.05); titlePr->SetTextSizePixels(24); titlePr->Draw("SAME"); TLatex *title; //title = new TLatex(-20.,50.,"CMS(2016) #sqrt{s} = 13TeV, L = 35.9 fb^{-1}"); title = new TLatex(-20.,50.,"CMS"); title->SetNDC(); title->SetTextAlign(12); title->SetX(0.13); title->SetY(0.84); title->SetTextFont(61); title->SetTextSize(0.06); title->SetTextSizePixels(24); title->Draw("SAME"); TLatex *chtitle; chtitle = new TLatex(-20.,50.,titlechname[ich]+""); chtitle->SetNDC(); chtitle->SetTextAlign(12); chtitle->SetX(0.14); chtitle->SetY(0.74); chtitle->SetTextFont(42); chtitle->SetTextSize(0.05); chtitle->SetTextSizePixels(24); chtitle->Draw("SAME"); pad[2]->cd(); pad[2]->cd()->SetLogy(); TH1D *hstyleLog = (TH1D *)hstyle->Clone(); hstyleLog -> SetMaximum(10.0*hInput[ich].at(12)->GetMaximum()); hstyleLog -> SetMinimum(0.8); hstyleLog -> Draw(); AllMC[ich] -> Draw("HISTSAME"); hData[ich] -> Draw("PSAME"); titlePr->Draw("SAME"); title->Draw("SAME"); chtitle->Draw("SAME"); pad[1]->cd(); RatioFull ->Draw("HIST"); gRatioFull->Draw("e2"); RatioFull ->Draw("HISTSAME"); pad[3]->cd(); RatioFull ->Draw("HIST"); gRatioFull->Draw("e2"); RatioFull ->Draw("HISTSAME"); TString dirfigname_pdf = "CombineResults/Figures_" + InpDir + Plots + FitDir + "/"; // make a dir if it does not exist!! gSystem->mkdir(dirfigname_pdf, kTRUE); cPlots->SaveAs(dirfigname_pdf + "FullHisto_" + dirname[ich] + "_NormLog.pdf"); // ----------------------------------------------------------------------------- // Only Log Plots // ----------------------------------------------------------------------------- TCanvas *cPlotsLog;//histos cPlotsLog = new TCanvas("cPlotsLog"+dirname[ich] ,"Plots"); cPlotsLog->Divide(1,2); TPad *padLog[2]; //Plot Pad padLog[0] = (TPad*)cPlotsLog->GetPad(1); padLog[0]->SetPad(0.01, 0.23, 0.99, 0.99); padLog[0]->SetTopMargin(0.1); padLog[0]->SetRightMargin(0.04); //Ratio Pad padLog[1] = (TPad*)cPlotsLog->GetPad(2);; padLog[1]->SetPad(0.01, 0.02, 0.99, 0.3); gStyle->SetGridWidth(1); gStyle->SetGridColor(14); padLog[1]->SetGridx(); padLog[1]->SetGridy(); padLog[1]->SetTopMargin(0.05); padLog[1]->SetBottomMargin(0.4); padLog[1]->SetRightMargin(0.04); padLog[0]->cd(); padLog[0]->cd()->SetLogy(); hstyleLog -> Draw(); AllMC[ich] -> Draw("HISTSAME"); hData[ich] -> Draw("PSAME"); titlePr->Draw("SAME"); title->Draw("SAME"); chtitle->Draw("SAME"); TLegend *legLog; legLog = new TLegend(0.70,0.60,0.94,0.87); legLog->SetFillColor(0); legLog->SetLineColor(0); legLog->SetLineWidth(0.0); legLog->SetTextFont(62); legLog->SetTextSize(0.03); legLog->SetNColumns(2); legLog->AddEntry(hData[ich], "Data","PL"); legLog->AddEntry(hInput[ich].at(11), "Z+Jets","F"); legLog->AddEntry(hInput[ich].at(10), "VV","F"); legLog->AddEntry(hInput[ich].at(9), "Single t","F"); legLog->AddEntry(hInput[ich].at(8), "QCD","F"); legLog->AddEntry(hInput[ich].at(7), "W+Jets","F"); legLog->AddEntry(hInput[ich].at(6), "t#bar{t}+V","F"); legLog->AddEntry(hInput[ich].at(5), "t#bar{t}+H","F"); legLog->AddEntry(hInput[ich].at(4), "t#bar{t}+other","F"); legLog->AddEntry(hInput[ich].at(3), "t#bar{t}+LF","F"); legLog->AddEntry(hInput[ich].at(2), "t#bar{t}+cc","F"); legLog->AddEntry(hInput[ich].at(1), "t#bar{t}+bj","F"); legLog->AddEntry(hInput[ich].at(0), "t#bar{t}+bb","F"); legLog->AddEntry(gRatioFull, "Stat. Unc.","F"); legLog->Draw("SAME"); padLog[1]->cd(); RatioFull ->Draw("HIST"); gRatioFull->Draw("e2"); RatioFull ->Draw("HISTSAME"); cPlotsLog->SaveAs(dirfigname_pdf + "FullHisto_" + dirname[ich] + "_OnlyLog.pdf"); // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- // Plots by Regions // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- int ireg = 0; for(int ican=0;ican<5;ican++){ TString CanNum; CanNum.Form("%i",ican); TCanvas *cPlots_reg;//histos cPlots_reg = new TCanvas("cPlots_reg" + CanNum + dirname[ich] ,"Plots By regions"); cPlots_reg->Divide(2,2); for(int icr=1;icr<=4;icr++){ //cPlots_reg->cd(icr); TPad *glpad_reg = (TPad*)cPlots_reg->cd(icr); glpad_reg->Divide(2,1); TPad *pad_reg[2]; //Plot Pad pad_reg[0] = (TPad*)glpad_reg->GetPad(1); pad_reg[0]->SetPad(0.01, 0.23, 0.99, 0.99); pad_reg[0]->SetTopMargin(0.1); pad_reg[0]->SetRightMargin(0.04); //Ratio Pad pad_reg[1] = (TPad*)glpad_reg->GetPad(2); pad_reg[1]->SetPad(0.01, 0.02, 0.99, 0.3); gStyle->SetGridWidth(1); gStyle->SetGridColor(14); pad_reg[1]->SetGridx(); pad_reg[1]->SetGridy(); pad_reg[1]->SetTopMargin(0.05); pad_reg[1]->SetBottomMargin(0.4); pad_reg[1]->SetRightMargin(0.04); pad_reg[0]->cd(); pad_reg[0]->SetLogy(); TH1D *hstyle_reg = (TH1D*)AllMC_reg[ich][ireg]->GetHistogram(); hstyle_reg -> Reset(); hstyle_reg -> SetMaximum(10.0*hData_reg[ich][ireg]->GetMaximum()); hstyle_reg -> SetMinimum(0.7); hstyle_reg -> GetYaxis()->SetTitleOffset(0.9); hstyle_reg -> GetYaxis()->SetTitleSize(0.05); hstyle_reg -> GetYaxis()->SetLabelSize(0.05); hstyle_reg -> GetYaxis()->SetTitle("Events"); pad_reg[0]->cd(); hstyle_reg->Draw(); AllMC_reg[ich][ireg] -> Draw("HISTSAME"); hData_reg[ich][ireg] -> Draw("E1SAME"); titlePr->Draw("SAME"); title->Draw("SAME"); chtitle->Draw("SAME"); TH1D *RatioFull_reg = HistoRatio (hData_reg[ich][ireg] , (TH1D*) AllMC_reg[ich][ireg]->GetStack()->Last()); TGraphErrors *gRatioFull_reg = new TGraphErrors(RatioFull_reg); gRatioFull_reg->SetFillStyle(1001); gRatioFull_reg->SetFillColor(chatch); gRatioFull_reg->SetName("gRatioFull"); pad_reg[1]->cd(); RatioFull_reg->GetYaxis()->SetTitleOffset(0.25); RatioFull_reg->Draw("HIST"); gRatioFull_reg->Draw("e2"); RatioFull_reg->Draw("HISTSAME"); ireg++; } // for(ireg) cPlots_reg->SaveAs(dirfigname_pdf + "RegionHisto_" + CanNum + "_" + dirname[ich] + "_NormLog.pdf"); } // for(ican) TCanvas *cPlotsI; cPlotsI = new TCanvas("cPlotsI"+dirname[ich] ,"Plots"); cPlotsI->Divide(1,2); TPad *padI[4]; //Plot Pad padI[0] = (TPad*)cPlotsI->GetPad(1); padI[0]->SetPad(0.01, 0.23, 0.99, 0.99); padI[0]->SetTopMargin(0.1); padI[0]->SetRightMargin(0.04); //Ratio Pad padI[1] = (TPad*)cPlotsI->GetPad(2); padI[1]->SetPad(0.01, 0.02, 0.99, 0.3); gStyle->SetGridWidth(1); gStyle->SetGridColor(14); padI[1]->SetGridx(); padI[1]->SetGridy(); padI[1]->SetTopMargin(0.05); padI[1]->SetBottomMargin(0.4); padI[1]->SetRightMargin(0.04); TCanvas *cPlotsII; cPlotsII = new TCanvas("cPlotsII"+dirname[ich] ,"Plots"); cPlotsII->Divide(1,2); //Plot Pad padI[2] = (TPad*)cPlotsII->GetPad(1); padI[2]->SetPad(0.01, 0.23, 0.99, 0.99); padI[2]->SetTopMargin(0.1); padI[2]->SetRightMargin(0.04); //Ratio Pad padI[3] = (TPad*)cPlotsII->GetPad(2); padI[3]->SetPad(0.01, 0.02, 0.99, 0.3); gStyle->SetGridWidth(1); gStyle->SetGridColor(14); padI[3]->SetGridx(); padI[3]->SetGridy(); padI[3]->SetTopMargin(0.05); padI[3]->SetBottomMargin(0.4); padI[3]->SetRightMargin(0.04); TH1D *hstyleI = new TH1D ("hstyleI","", GlobalCSVJet_Data[1]->GetNbinsX(), GlobalCSVJet_Data[1]->GetBinLowEdge (1), GlobalCSVJet_Data[1]->GetBinLowEdge (GlobalCSVJet_Data[1]->GetNbinsX()+1)); hstyleI -> SetMaximum(1.1*GlobalCSVJet_Data[1]->GetMaximum()); hstyleI -> GetYaxis()->SetTitleOffset(0.8); hstyleI -> GetYaxis()->SetTitleSize(0.05); hstyleI -> GetYaxis()->SetLabelSize(0.05); hstyleI -> GetYaxis()->SetTitle("Events"); GlobalCSVJet_Data[0] -> SetMarkerStyle(20); GlobalCSVJet_Data[0] -> SetMarkerSize(0.4); GlobalCSVJet_Data[0] -> SetLineWidth(1); GlobalCSVJet_Data[0] -> SetTitle(""); padI[0]->cd(); padI[0]->cd()->SetLogy(); hstyleI -> SetMaximum(100.0*GlobalCSVJet_Data[0]->GetMaximum()); hstyleI -> SetMinimum(0.7); hstyleI -> Draw(); AllMC_CSV1[ich] -> Draw("HISTSAME"); GlobalCSVJet_Data[0] -> SetMarkerStyle(20); GlobalCSVJet_Data[0] -> SetMarkerSize(0.6); GlobalCSVJet_Data[0] -> SetLineWidth(1); GlobalCSVJet_Data[0] -> SetTitle(""); GlobalCSVJet_Data[0] -> Draw("SAME"); titlePr->Draw("SAME"); title->Draw("SAME"); chtitle->Draw("SAME"); TLegend *legI; legI = new TLegend(0.70,0.64,0.93,0.87); legI->SetFillColor(0); legI->SetLineColor(0); legI->SetLineWidth(0.0); legI->SetTextFont(62); legI->SetTextSize(0.03); legI->SetNColumns(2); legI->AddEntry(hData[ich], "Data","PL"); legI->AddEntry(hInput[ich].at(11), "Z+Jets","F"); legI->AddEntry(hInput[ich].at(10), "VV","F"); legI->AddEntry(hInput[ich].at(9), "Single t","F"); legI->AddEntry(hInput[ich].at(8), "QCD","F"); legI->AddEntry(hInput[ich].at(7), "W+Jets","F"); legI->AddEntry(hInput[ich].at(6), "t#bar{t}+V","F"); legI->AddEntry(hInput[ich].at(5), "t#bar{t}+H","F"); legI->AddEntry(hInput[ich].at(4), "t#bar{t}+other","F"); legI->AddEntry(hInput[ich].at(3), "t#bar{t}+LF","F"); legI->AddEntry(hInput[ich].at(2), "t#bar{t}+cc","F"); legI->AddEntry(hInput[ich].at(1), "t#bar{t}+bj","F"); legI->AddEntry(hInput[ich].at(0), "t#bar{t}+bb","F"); legI->AddEntry(gRatioFull, "Stat. Unc.","F"); legI->Draw("SAME"); TH1D *RatioFullJet1 = HistoRatio (GlobalCSVJet_Data[0] , (TH1D*) AllMC_CSV1[ich]->GetStack()->Last()); TGraphErrors *gRatioFullJet1 = new TGraphErrors(RatioFullJet1); gRatioFullJet1->SetFillStyle(1001); gRatioFullJet1->SetFillColor(chatch); gRatioFullJet1->SetName("gRatioFullJet2"); padI[1]->cd(); RatioFullJet1 ->GetYaxis()->SetTitleOffset(0.25); RatioFullJet1 ->GetXaxis()->SetTitle("CSVv2"); RatioFullJet1 ->Draw("HIST"); gRatioFullJet1->Draw("e2"); RatioFullJet1 ->Draw("HISTSAME"); padI[2]->cd(); padI[2]->cd()->SetLogy(); // No Log TH1D *hstyleII = (TH1D *)hstyleI -> Clone("StyleII"); hstyleII -> SetMaximum(100.0*GlobalCSVJet_Data[1]->GetMaximum()); hstyleII -> SetMinimum(0.7); hstyleII -> Draw(); AllMC_CSV2[ich] -> Draw("HISTSAME"); GlobalCSVJet_Data[1] -> SetMarkerStyle(20); GlobalCSVJet_Data[1] -> SetMarkerSize(0.5); GlobalCSVJet_Data[1] -> SetLineWidth(1); GlobalCSVJet_Data[1] -> SetTitle(""); GlobalCSVJet_Data[1] -> Draw("SAME"); titlePr->Draw("SAME"); title->Draw("SAME"); chtitle->Draw("SAME"); legI->Draw("SAME"); TH1D *RatioFullJet2 = HistoRatio (GlobalCSVJet_Data[1] , (TH1D*) AllMC_CSV2[ich]->GetStack()->Last()); TGraphErrors *gRatioFullJet2 = new TGraphErrors(RatioFullJet2); gRatioFullJet2->SetFillStyle(1001); gRatioFullJet2->SetFillColor(chatch); gRatioFullJet2->SetName("gRatioFullJet2"); padI[3]->cd(); RatioFullJet2 ->GetYaxis()->SetTitleOffset(0.25); RatioFullJet2 ->GetXaxis()->SetTitle("CSVv2"); RatioFullJet2 ->Draw("HIST"); gRatioFullJet2->Draw("e2"); RatioFullJet2 ->Draw("HISTSAME"); cPlotsI ->SaveAs(dirfigname_pdf + "CSVHistosJet1_" + dirname[ich] + "_Log.pdf"); cPlotsII->SaveAs(dirfigname_pdf + "CSVHistosJet2_" + dirname[ich] + "_Log.pdf"); // ttbb Shape }// for(ich) }
void draw(){ TGraphErrors *gll = new TGraphErrors(); TGraphErrors *gjj = new TGraphErrors(); for (int i = 0 ; i < 15 ; ++i){ float content = h_lep_m_signal->GetBinContent(i) + h_lep_m_background->GetBinContent(i) + h_lep_m_wjets->GetBinContent(i); gll -> SetPoint(i,i*100-50.,content); float errorb = h_lep_m_background->GetBinContent(i)*0.08*h_lep_m_background->GetBinContent(i); float errors = h_lep_m_signal->GetBinContent(i)*0.08*h_lep_m_signal->GetBinContent(i); float errorw = 0.40 * h_lep_m_wjets->GetBinContent(i)*h_lep_m_wjets->GetBinContent(i); float pesi = h_lep_m_background->GetBinContent(i) + h_lep_m_signal->GetBinContent(i) + h_lep_m_wjets->GetBinContent(i); float error = sqrt(errorb*errorb + errorw*errorw + errors*errors) / pesi; gll -> SetPointError(i,100/2.,error); } for (int i = 0 ; i < 10 ; ++i){ float content = h_jet_m_signal->GetBinContent(i) + h_jet_m_background->GetBinContent(i) + h_jet_m_wjets->GetBinContent(i); gjj -> SetPoint(i,i*500-250.,content); float errorb = h_jet_m_background->GetBinContent(i)*0.08*h_jet_m_background->GetBinContent(i); float errors = h_jet_m_signal->GetBinContent(i)*0.08*h_jet_m_signal->GetBinContent(i); float errorw = 0.40 * h_jet_m_wjets->GetBinContent(i)*h_jet_m_wjets->GetBinContent(i); float pesi = h_jet_m_background->GetBinContent(i) + h_jet_m_signal->GetBinContent(i) + h_jet_m_wjets->GetBinContent(i); float error = sqrt(errorb*errorb + errorw*errorw + errors*errors) / pesi; gjj -> SetPointError(i,500/2.,error); } gll->SetFillStyle(3002); gjj->SetFillStyle(3002); gll -> SetFillColor(kBlack); gjj -> SetFillColor(kBlack); cout<<"signal tot = "<<scontTot<<endl; cout<<"signal mjj = "<<scontMjj<<endl; cout<<"signal deta = "<<scontDeta<<endl; cout<<"signal mll = "<<scontMll<<endl; cout<<"signal dy = "<<scontDY<<endl; cout<<"signal met = "<<scontMET<<"\n"<<endl; cout<<"background tot = "<<contTot<<endl; cout<<"background mjj = "<<contMjj<<endl; cout<<"background deta = "<<contDeta<<endl; cout<<"background mll = "<<contMll<<endl; cout<<"background dy = "<<contDY<<endl; cout<<"background met = "<<contMET<<"\n"<<endl; cout<<"wjets tot = "<<wcontTot<<endl; cout<<"wjets mjj = "<<wcontMjj<<endl; cout<<"wjets deta = "<<wcontDeta<<endl; cout<<"wjets mll = "<<wcontMll<<endl; cout<<"wjets dy = "<<wcontDY<<endl; cout<<"wjets met = "<<wcontMET<<"\n"<<endl; TH1F *axis = new TH1F ("mll Signal & Backgrounds","mll Signal & Backgrounds",15,0.,1500.); axis -> GetXaxis() -> SetRangeUser(0.,1500.); axis -> GetYaxis() -> SetRangeUser(0.,120.); axis -> GetXaxis () -> SetTitle("Leptons Invariant Mass [GeV]"); axis -> GetYaxis () -> SetTitle("Counts per Bin"); axis -> GetYaxis () -> SetTitleOffset(1.3); axis -> SetStats(0); TH1F *axis2 = new TH1F ("mjj Signal & Backgrounds","mjj Signal & Backgrounds",10,0.,5000.); axis2 -> GetXaxis() -> SetRangeUser(0.,5000.); axis2 -> GetYaxis() -> SetRangeUser(0.,105.); axis2 -> GetXaxis () -> SetTitle("Tag Jets Invariant Mass [GeV]"); axis2 -> GetYaxis () -> SetTitle("Counts per Bin"); axis2 -> GetYaxis () -> SetTitleOffset(1.3); axis2 -> SetStats(0); THStack* hs = new THStack("hs","mll Signal & Background"); h_lep_m_signal -> SetFillColor(kGreen+1); h_lep_m_background -> SetFillColor(kRed+1); h_lep_m_wjets -> SetFillColor(kBlue+1); hs -> Add ( h_lep_m_background ); hs -> Add ( h_lep_m_wjets ); hs -> Add ( h_lep_m_signal ); TCanvas *c1 = new TCanvas("c1","c1",600.,600.); c1 -> cd(); axis -> Draw(); //c1 -> DrawFrame(0.,0.,1500.,40.); hs -> Draw("same"); hs -> GetXaxis () -> SetTitle("Leptons Invariant Mass [GeV]"); hs -> GetYaxis () -> SetRangeUser(0.,40.); TLegend *leg = new TLegend(0.54,0.3,0.89,0.5); leg->SetHeader("Luminosity = 300fb^{-1} @ 13TeV"); leg->AddEntry(h_lep_m_signal,"Signal","f"); leg->AddEntry(h_lep_m_background,"QCD Background","f"); leg->AddEntry(h_lep_m_wjets,"W + Jets Background","f"); leg->SetFillColor(kWhite); leg->SetLineColor(kWhite); leg->Draw(); gll->Draw("same,2"); c1 -> Print("stack.C"); c1 -> Print("stack.pdf","pdf"); c1 -> Print("stack.png","png"); TCanvas *c2 = new TCanvas("c2","c2",600.,600.); c2 -> cd(); hs -> Draw("nostack"); hs -> GetXaxis () -> SetTitle("Leptons Invariant Mass [GeV]"); hs -> GetYaxis () -> SetRangeUser(0.,20.); c2 -> Print("nostack.C"); c2 -> Print("nostack.pdf","pdf"); THStack* hs2 = new THStack("hs2","mjj Signal & Background"); h_jet_m_signal -> SetFillColor(kGreen+1); h_jet_m_background -> SetFillColor(kRed+1); h_jet_m_wjets -> SetFillColor(kBlue+1); hs2 -> Add ( h_jet_m_background ); hs2 -> Add ( h_jet_m_wjets ); hs2 -> Add ( h_jet_m_signal ); TCanvas *c12 = new TCanvas("c12","c12",600.,600.); c12 -> cd(); axis2 -> Draw(); //c12 -> DrawFrame(0.,0.,5000.,35.); hs2 -> Draw("same"); hs2 -> GetXaxis () -> SetTitle("Tag Jets Invariant Mass [GeV]"); hs2 -> GetYaxis () -> SetRangeUser(0.,35.); TLegend *leg2 = new TLegend(0.54,0.3,0.89,0.5); leg2->SetHeader("Luminosity = 300fb^{-1} @ 13TeV"); leg2->AddEntry(h_jet_m_signal,"Signal","f"); leg2->AddEntry(h_jet_m_background,"QCD Background","f"); leg2->AddEntry(h_jet_m_wjets,"W + Jets Background","f"); leg2->SetFillColor(kWhite); leg2->SetLineColor(kWhite); leg2->Draw(); gjj->Draw("same,2"); c12 -> Print("stack_mjj.C"); c12 -> Print("stack_mjj.pdf","pdf"); c12 -> Print("stack_mjj.png","png"); TCanvas *c22 = new TCanvas("c22","c22",600.,600.); c22 -> cd(); hs2 -> Draw("nostack"); hs2 -> GetXaxis () -> SetTitle("Tag Jet Invariant Mass [GeV]"); hs2 -> GetYaxis () -> SetRangeUser(0.,20.); c22 -> Print("nostack_mjj.C"); c22 -> Print("nostack_mjj.pdf","pdf"); THStack* hs3 = new THStack("hs3","BDT Signal & Background"); h_BDT_signal -> SetFillColor(kGreen+1); h_BDT_background -> SetFillColor(kRed+1); h_BDT_wjets -> SetFillColor(kBlue+1); hs3 -> Add ( h_BDT_background ); hs3 -> Add ( h_BDT_wjets ); hs3 -> Add ( h_BDT_signal ); TCanvas *c13 = new TCanvas("c13","c13",600.,600.); c13 -> cd(); hs3 -> Draw(); hs3 -> GetXaxis () -> SetTitle("BDT discriminant"); hs3 -> GetYaxis () -> SetRangeUser(0.,60.); TLegend *leg3 = new TLegend(0.54,0.3,0.89,0.5); leg3->SetHeader("Luminosity = 300fb^{-1} @ 13TeV"); leg3->AddEntry(h_BDT_signal,"Signal","f"); leg3->AddEntry(h_BDT_background,"QCD Background","f"); leg3->AddEntry(h_BDT_wjets,"W + Jets Background","f"); leg3->SetFillColor(kWhite); leg3->SetLineColor(kWhite); leg3->Draw(); c13 -> Print("stack_BDT.C"); c13 -> Print("stack_BDT.pdf","pdf"); TCanvas *c23 = new TCanvas("c23","c23",600.,600.); c23 -> cd(); hs3 -> Draw("nostack"); hs3 -> GetXaxis () -> SetTitle("BDT discriminant"); hs3 -> GetYaxis () -> SetRangeUser(0.,20.); c23 -> Print("nostack_BDT.C"); c23 -> Print("nostack_BDT.pdf","pdf"); THStack* hs4 = new THStack("hs4","BDT Signal & Backgrounds Before Cuts"); h_BDT_signalNoCuts -> SetFillColor(kGreen+1); h_BDT_backgroundNoCuts -> SetFillColor(kRed+1); h_BDT_wjetsNoCuts -> SetFillColor(kBlue+1); hs4 -> Add ( h_BDT_backgroundNoCuts ); hs4 -> Add ( h_BDT_wjetsNoCuts ); hs4 -> Add ( h_BDT_signalNoCuts ); TCanvas *c14 = new TCanvas("c14","c14",600.,600.); c14 -> cd(); hs4 -> Draw(); hs4 -> GetXaxis () -> SetTitle("BDT discriminant"); hs4 -> GetYaxis () -> SetRangeUser(0.,60.); TLegend *leg4 = new TLegend(0.54,0.3,0.89,0.5); leg4->SetHeader("Luminosity = 300fb^{-1} @ 13TeV"); leg4->AddEntry(h_BDT_signal,"Signal","f"); leg4->AddEntry(h_BDT_background,"QCD Background","f"); leg4->AddEntry(h_BDT_wjets,"W + Jets Background","f"); leg4->SetFillColor(kWhite); leg4->SetLineColor(kWhite); leg4->Draw(); c14 -> Print("stack_BDT_nocuts.C"); c14 -> Print("stack_BDT_nocuts.pdf","pdf"); TCanvas *c24 = new TCanvas("c24","c24",600.,600.); c24 -> cd(); hs4 -> Draw("nostack"); hs4 -> GetXaxis () -> SetTitle("BDT discriminant"); hs4 -> GetYaxis () -> SetRangeUser(0.,20.); c24 -> Print("nostack_BDT_nocuts.C"); c24 -> Print("nostack_BDT_nocuts.pdf","pdf"); //TFile *outMVA = new TFile("outMVA_EWK_BDT_norm.root","RECREATE"); //TFile *outMVA = new TFile("outMVA_EWK_Fisher.root","RECREATE"); //TFile *outMVA = new TFile("outMVA_QCD_Fisher.root","RECREATE"); }
void Pythia8_Dijet30_result_JER_akPu4PF_((abs(refeta)<2)&&(hiBin>60))&&(refpt>30)_refeta() { //=========Macro generated from canvas: Can_result_3/ //========= (Mon Apr 18 04:08:04 2016) by ROOT version6.02/13 TCanvas *Can_result_3 = new TCanvas("Can_result_3", "",18,40,700,500); gStyle->SetOptFit(1); Can_result_3->Range(-2.75,0.1715425,2.75,0.2926317); Can_result_3->SetFillColor(0); Can_result_3->SetBorderMode(0); Can_result_3->SetBorderSize(2); Can_result_3->SetFrameBorderMode(0); Can_result_3->SetFrameBorderMode(0); TMultiGraph *multigraph = new TMultiGraph(); multigraph->SetName("name"); multigraph->SetTitle("JER_akPu4PF"); Double_t Graph_fx1007[9] = { -1.8, -1.4, -1, -0.6, -0.2, 0.2, 0.6, 1, 1.6}; Double_t Graph_fy1007[9] = { 0.2213775, 0.2313726, 0.212349, 0.1992318, 0.2015521, 0.2047929, 0.2065286, 0.2141753, 0.2298097}; Double_t Graph_fex1007[9] = { 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.4}; Double_t Graph_fey1007[9] = { 0.001529502, 0.001378741, 0.001274153, 0.001286487, 0.00132694, 0.001354738, 0.001397823, 0.001305814, 0.001034891}; TGraphErrors *gre = new TGraphErrors(9,Graph_fx1007,Graph_fy1007,Graph_fex1007,Graph_fey1007); gre->SetName("Graph"); gre->SetTitle("some title_0"); gre->SetFillColor(1); gre->SetFillStyle(0); TH1F *Graph_Graph1007 = new TH1F("Graph_Graph1007","some title_0",100,-2.4,2.4); Graph_Graph1007->SetMinimum(0.1944648); Graph_Graph1007->SetMaximum(0.236232); Graph_Graph1007->SetDirectory(0); Graph_Graph1007->SetStats(0); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#000099"); Graph_Graph1007->SetLineColor(ci); Graph_Graph1007->GetXaxis()->SetLabelFont(42); Graph_Graph1007->GetXaxis()->SetLabelSize(0.035); Graph_Graph1007->GetXaxis()->SetTitleSize(0.035); Graph_Graph1007->GetXaxis()->SetTitleFont(42); Graph_Graph1007->GetYaxis()->SetLabelFont(42); Graph_Graph1007->GetYaxis()->SetLabelSize(0.035); Graph_Graph1007->GetYaxis()->SetTitleSize(0.035); Graph_Graph1007->GetYaxis()->SetTitleFont(42); Graph_Graph1007->GetZaxis()->SetLabelFont(42); Graph_Graph1007->GetZaxis()->SetLabelSize(0.035); Graph_Graph1007->GetZaxis()->SetTitleSize(0.035); Graph_Graph1007->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1007); multigraph->Add(gre,""); Double_t Graph_fx1008[20] = { -1.9, -1.7, -1.5, -1.2, -0.9, -0.7, -0.5, -0.3, -0.1, 0.1, 0.3, 0.5, 0.7, 0.9, 1.1, 1.3, 1.5, 1.7, 1.9, 1}; Double_t Graph_fy1008[20] = { 0.2311591, 0.2477474, 0.2655955, 0.2576075, 0.2220231, 0.206768, 0.2064983, 0.2020811, 0.19917, 0.2115871, 0.1952014, 0.1965805, 0.2158946, 0.2003286, 0.213619, 0.213695, 0.2466632, 0.2597152, 0.2553281, 0.2344014}; Double_t Graph_fex1008[20] = { 0.1, 0.1, 0.1, 0.2, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, -1}; Double_t Graph_fey1008[20] = { 0.009894431, 0.01000488, 0.01052403, 0.009913006, 0.008527985, 0.007570562, 0.007309829, 0.007320613, 0.00699798, 0.00776784, 0.007146697, 0.00713059, 0.007530691, 0.007364154, 0.007896077, 0.007855752, 0.009496669, 0.01034782, 0.01046585, 0.009252961}; gre = new TGraphErrors(20,Graph_fx1008,Graph_fy1008,Graph_fex1008,Graph_fey1008); gre->SetName("Graph"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetFillStyle(0); gre->SetLineColor(2); gre->SetMarkerColor(2); TH1F *Graph_Graph1008 = new TH1F("Graph_Graph1008","Graph",100,-2.4,2.4); Graph_Graph1008->SetMinimum(0.1792482); Graph_Graph1008->SetMaximum(0.284926); Graph_Graph1008->SetDirectory(0); Graph_Graph1008->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1008->SetLineColor(ci); Graph_Graph1008->GetXaxis()->SetLabelFont(42); Graph_Graph1008->GetXaxis()->SetLabelSize(0.035); Graph_Graph1008->GetXaxis()->SetTitleSize(0.035); Graph_Graph1008->GetXaxis()->SetTitleFont(42); Graph_Graph1008->GetYaxis()->SetLabelFont(42); Graph_Graph1008->GetYaxis()->SetLabelSize(0.035); Graph_Graph1008->GetYaxis()->SetTitleSize(0.035); Graph_Graph1008->GetYaxis()->SetTitleFont(42); Graph_Graph1008->GetZaxis()->SetLabelFont(42); Graph_Graph1008->GetZaxis()->SetLabelSize(0.035); Graph_Graph1008->GetZaxis()->SetTitleSize(0.035); Graph_Graph1008->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1008); multigraph->Add(gre,""); multigraph->Draw("AP"); multigraph->GetXaxis()->SetTitle("refeta"); multigraph->GetXaxis()->SetLabelFont(42); multigraph->GetXaxis()->SetLabelSize(0.035); multigraph->GetXaxis()->SetTitleSize(0.035); multigraph->GetXaxis()->SetTitleFont(42); multigraph->GetYaxis()->SetTitle("#sigma_{Reco./Gen.}"); multigraph->GetYaxis()->SetLabelFont(42); multigraph->GetYaxis()->SetLabelSize(0.035); multigraph->GetYaxis()->SetTitleSize(0.035); multigraph->GetYaxis()->SetTitleFont(42); TLegend *leg = new TLegend(0.68,0.7,0.88,0.85,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); TLegendEntry *entry=leg->AddEntry("Graph","allJets","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("Graph","from chris","l"); entry->SetLineColor(2); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); leg->Draw(); TLatex * tex = new TLatex(0.35,0.8,"#bf{#color[2]{|#eta_{jet}|<2.0 & refpt>30}}"); tex->SetNDC(); tex->SetTextFont(43); tex->SetTextSize(24); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.17,0.17,"Centrality:30-100%"); tex->SetNDC(); tex->SetTextFont(43); tex->SetTextSize(24); tex->SetLineWidth(2); tex->Draw(); TPaveText *pt = new TPaveText(0.3743391,0.9365254,0.6256609,0.995,"blNDC"); pt->SetName("title"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetFillStyle(0); pt->SetTextFont(42); AText = pt->AddText("JER_akPu4PF"); pt->Draw(); Can_result_3->Modified(); Can_result_3->cd(); Can_result_3->SetSelected(Can_result_3); }
void vnpt_5panels_ratio() { gROOT->Reset(); gROOT->SetStyle("MyStyle"); // gROOT->LoadMacro("v2pt_12cen_MyDef.C"); // gROOT->LoadMacro("MyDef.C"); gStyle->SetTextFont(43); gStyle->SetLabelFont(43,"x"); gStyle->SetLabelFont(43,"y"); gStyle->SetLabelFont(43,"z"); gStyle->SetTitleFont(43,"x"); gStyle->SetTitleFont(43,"y"); gStyle->SetTitleFont(43,"z"); gStyle->SetEndErrorSize(0); double textsize = 19; //int mcol[8]={kRed,kMagenta,kBlue,kCyan,kGreen,kYellow,kOrange,kGray}; int mcol[8]={kRed,kOrange+1,kBlue,kGreen+1,kCyan,kYellow,kOrange,kGray}; int mcol2[4]={6,2,4,8}; //int msty[8][2]={{20,20},{25,24},{22,22},{28,26},{29,30},{33,27},{34,28},{20,24}}; int msty[8][2]={{20,20},{21,24},{22,29},{23,30},{24,30},{25,27},{28,28},{30,24}}; //float msiz[8]={1.11,0.9,1.2,1.24,1.5,1,1,1}; float msiz[8]={1.11,1.0,1.5,1.2,1.2,1.2,1.2,1.6}; float msiz2[4]={1.5,1.5,1.5,1.5}; // // arrays // const int Mfiles=50; int ndp[Mfiles]; char *cfn[Mfiles]; char *cft[Mfiles]; const int Mpoints=40; double xa[Mfiles][Mpoints],xe[Mfiles][Mpoints],xesys[Mfiles][Mpoints]; double ya[Mfiles][Mpoints],ye[Mfiles][Mpoints],yesys[Mfiles][Mpoints]; double nAxa[Mfiles][Mpoints],nAxe[Mfiles][Mpoints]; double nAya[Mfiles][Mpoints],nAye[Mfiles][Mpoints]; double nBxa[Mfiles][Mpoints],nBxe[Mfiles][Mpoints]; double nBya[Mfiles][Mpoints],nBye[Mfiles][Mpoints]; double nARxa[Mfiles][Mpoints],nARxe[Mfiles][Mpoints]; double nARya[Mfiles][Mpoints],nARye[Mfiles][Mpoints]; double nBRxa[Mfiles][Mpoints],nBRxe[Mfiles][Mpoints]; double nBRya[Mfiles][Mpoints],nBRye[Mfiles][Mpoints]; double xa60[Mfiles][Mpoints],xe60[Mfiles][Mpoints],xesys60[Mfiles][Mpoints]; double ya60[Mfiles][Mpoints],ye60[Mfiles][Mpoints],yesys60[Mfiles][Mpoints]; double nAxa60[Mfiles][Mpoints],nAxe60[Mfiles][Mpoints]; double nAya60[Mfiles][Mpoints],nAye60[Mfiles][Mpoints]; double nBxa60[Mfiles][Mpoints],nBxe60[Mfiles][Mpoints]; double nBya60[Mfiles][Mpoints],nBye60[Mfiles][Mpoints]; double nARxa60[Mfiles][Mpoints],nARxe60[Mfiles][Mpoints]; double nARya60[Mfiles][Mpoints],nARye60[Mfiles][Mpoints]; double nBRxa60[Mfiles][Mpoints],nBRxe60[Mfiles][Mpoints]; double nBRya60[Mfiles][Mpoints],nBRye60[Mfiles][Mpoints]; const int Mpads=14; char *htit[Mpads]; char *htitc2[Mpads]; char *atit[Mpads][3]; double ptit[Mpads][2]; double hxmin[Mpads],hxmax[Mpads]; double hymin[Mpads],hymax[Mpads]; double lxmin[Mpads],lxmax[Mpads]; double lymin[Mpads],lymax[Mpads]; // // Data input // char *cjob="v2pt_12cen_4x3"; int i=-1; // histogram parameter htit[0]="(a) v_{4}{#Psi_{22}}"; htit[1]="(b) v_{5}{#Psi_{23}}"; htit[2]="(c) v_{6}{#Psi_{222}}"; htit[3]="(d) v_{6}{#Psi_{33}}"; htit[4]="(e) v_{7}{#Psi_{223}}"; htit[5]="25-30%"; htit[6]="30-35%"; htit[7]="35-40%"; htit[8]="40-50%"; htit[9]="50-60%"; htit[10]="60-70%"; htit[11]="70-80%"; htitc2[0]="(f) v_{4}{#Psi_{22}}"; htitc2[1]="(g) v_{5}{#Psi_{23}}"; htitc2[2]="(h) v_{6}{#Psi_{222}}"; htitc2[3]="(i) v_{6}{#Psi_{33}}"; htitc2[4]="(j) v_{7}{#Psi_{223}}"; for (int ip=0;ip<Mpads;ip++) { // hxmin[ip]=0.0; hxmax[ip]=11.9; hxmin[ip]=0.0001; hxmax[ip]=4.1; hymin[ip]=-0.003; hymax[ip]=0.0655; lxmin[ip]=0.24; lxmax[ip]=0.88; lymin[ip]=0.65; lymax[ip]=0.94; ptit[ip][0]=0.45; ptit[ip][1]=0.036;// position legends atit[ip][0]="p_{T} (GeV/c)"; atit[ip][1]="v_{n}"; } // // Read data and create vector files // double sysXYZ[5]={6,7,8,8,9}; //double sysXYZ[5]={8,9,12,12,15}; //double sysXYZ[5]={8,9,20,20,20}; double sysEach[5]={0.0002, 0.0002, 0.0002, 0.0003, 0.0002}; double tmp; const int nw=5; const int npt=20; ifstream inEP; inEP.open("./data_vnptcent020_5020gev.txt"); for(int i=0; i<nw; i++){ for(int j=0; j<npt; j++){ inEP>>tmp; inEP>>tmp; inEP>>xa[i][j]; inEP>>tmp; inEP>>ya[i][j]; inEP>>ye[i][j]; if(ye[i][j]<0) ye[i][j]=-ye[i][j]; xe[i][j]=0.0; } } inEP.close(); ifstream inEP; inEP.open("./data_vnptcent020_5020gev_vzA.txt"); for(int i=0; i<nw; i++){ for(int j=0; j<npt; j++){ inEP>>tmp; inEP>>tmp; inEP>>nAxa[i][j]; inEP>>tmp; inEP>>nAya[i][j]; inEP>>nAye[i][j]; if(nAye[i][j]<0) nAye[i][j]=-nAye[i][j]; nAxe[i][j]=0.0; nARxa[i][j]=nAxa[i][j]; nARxe[i][j]=nAxe[i][j]; nARye[i][j]=nAya[i][j]/ya[i][j]*sqrt(ye[i][j]*ye[i][j]/ya[i][j]/ya[i][j] + nAye[i][j]*nAye[i][j]/nAya[i][j]/nAya[i][j] - 2.5*ye[i][j]*ye[i][j]/ya[i][j]/nAya[i][j] ); nARya[i][j]=nAya[i][j]/ya[i][j]; } } inEP.close(); ifstream inEP; inEP.open("./data_vnptcent020_5020gev_vzB.txt"); for(int i=0; i<nw; i++){ for(int j=0; j<npt; j++){ inEP>>tmp; inEP>>tmp; inEP>>nBxa[i][j]; inEP>>tmp; inEP>>nBya[i][j]; inEP>>nBye[i][j]; if(nBye[i][j]<0) nBye[i][j]=-nBye[i][j]; nBxe[i][j]=0.0; nBRxa[i][j]=nBxa[i][j]; nBRxe[i][j]=nBxe[i][j]; nBRye[i][j]=nBya[i][j]/ya[i][j]*sqrt(ye[i][j]*ye[i][j]/ya[i][j]/ya[i][j] + nBye[i][j]*nBye[i][j]/nBya[i][j]/nBya[i][j] - 2.5*ye[i][j]*ye[i][j]/ya[i][j]/nBya[i][j] ); nBRya[i][j]=nBya[i][j]/ya[i][j]; } } inEP.close(); //20-60% ifstream inEP; inEP.open("./data_vnptcent2060_5020gev.txt"); for(int i=0; i<nw; i++){ for(int j=0; j<npt; j++){ inEP>>tmp; inEP>>tmp; inEP>>xa60[i][j]; inEP>>tmp; inEP>>ya60[i][j]; inEP>>ye60[i][j]; if(ye60[i][j]<0) ye60[i][j]=-ye60[i][j]; xe60[i][j]=0.0; } } inEP.close(); ifstream inEP; inEP.open("./data_vnptcent2060_5020gev_vzA.txt"); for(int i=0; i<nw; i++){ for(int j=0; j<npt; j++){ inEP>>tmp; inEP>>tmp; inEP>>nAxa60[i][j]; inEP>>tmp; inEP>>nAya60[i][j]; inEP>>nAye60[i][j]; if(nAye60[i][j]<0) nAye60[i][j]=-nAye60[i][j]; nAxe60[i][j]=0.0; nARxa60[i][j]=nAxa60[i][j]; nARxe60[i][j]=nAxe60[i][j]; nARye60[i][j]=nAya60[i][j]/ya60[i][j]*sqrt(ye60[i][j]*ye60[i][j]/ya60[i][j]/ya60[i][j] + nAye60[i][j]*nAye60[i][j]/nAya60[i][j]/nAya60[i][j] - 2.5*ye60[i][j]*ye60[i][j]/ya60[i][j]/nAya60[i][j] ); nARya60[i][j]=nAya60[i][j]/ya60[i][j]; } } inEP.close(); ifstream inEP; inEP.open("./data_vnptcent2060_5020gev_vzB.txt"); for(int i=0; i<nw; i++){ for(int j=0; j<npt; j++){ inEP>>tmp; inEP>>tmp; inEP>>nBxa60[i][j]; inEP>>tmp; inEP>>nBya60[i][j]; inEP>>nBye60[i][j]; if(nBye60[i][j]<0) nBye60[i][j]=-nBye60[i][j]; nBxe60[i][j]=0.0; nBRxa60[i][j]=nBxa60[i][j]; nBRxe60[i][j]=nBxe60[i][j]; nBRye60[i][j]=nBya60[i][j]/ya60[i][j]*sqrt(ye60[i][j]*ye60[i][j]/ya60[i][j]/ya60[i][j] + nBye60[i][j]*nBye60[i][j]/nBya60[i][j]/nBya60[i][j] - 2.5*ye60[i][j]*ye60[i][j]/ya60[i][j]/nBya60[i][j] ); nBRya60[i][j]=nBya60[i][j]/ya60[i][j]; } } inEP.close(); nBRya60[1][2]=1.06; TCanvas *can=new TCanvas("can","can",10,10,1050*0.8*1.3,800*0.3*1.3*1.8); can->Divide(5,2,0,0); //sticks the pads with no space inbetween TH1D *h1[nw]; for (int iw=0;iw<nw;iw++) { can->cd(iw+1); if(iw==4) gPad->SetRightMargin(0.02); //gPad->SetLogy(); char ch1[8]; sprintf(ch1,"h1_%d",iw); h1[iw] = new TH1D(ch1,"",500,hxmin[iw],hxmax[iw]); h1[iw]->SetMinimum(0.5); h1[iw]->SetMaximum(1.5); h1[iw]->SetXTitle(atit[iw][0]); h1[iw]->SetYTitle("v_{n} ratio"); h1[iw]->GetXaxis()->CenterTitle(1); h1[iw]->GetYaxis()->CenterTitle(1); // futz with the axes h1[iw]->GetYaxis()->SetNdivisions(606); h1[iw]->GetXaxis()->SetNdivisions(606); h1[iw]->GetYaxis()->SetTitleSize(textsize*1.4); h1[iw]->GetYaxis()->SetTitleOffset(2.3); h1[iw]->GetYaxis()->SetLabelSize(textsize); h1[iw]->GetXaxis()->SetTitleSize(textsize*1.4); h1[iw]->GetXaxis()->SetTitleOffset(1.3); h1[iw]->GetXaxis()->SetLabelSize(textsize); // h1[iw]->GetXaxis()->SetLabelOffset(1.2); h1[iw]->Draw(); } TH1D *h2[nw]; for (int iw=0;iw<nw;iw++) { can->cd(iw+1+5); if(iw==4) gPad->SetRightMargin(0.02); //gPad->SetLogy(); char ch2[8]; sprintf(ch2,"h2_%d",iw); h2[iw] = new TH1D(ch2,"",500,hxmin[iw],hxmax[iw]); h2[iw]->SetMinimum(0.5); h2[iw]->SetMaximum(1.5); h2[iw]->SetXTitle(atit[iw][0]); h2[iw]->SetYTitle("v_{n} ratio"); h2[iw]->GetXaxis()->CenterTitle(1); h2[iw]->GetYaxis()->CenterTitle(1); // futz with the axes h2[iw]->GetYaxis()->SetNdivisions(606); h2[iw]->GetXaxis()->SetNdivisions(606); h2[iw]->GetYaxis()->SetTitleSize(textsize*1.4); h2[iw]->GetYaxis()->SetTitleOffset(2.3); h2[iw]->GetYaxis()->SetLabelSize(textsize*1.2); h2[iw]->GetXaxis()->SetTitleSize(textsize*1.4); h2[iw]->GetXaxis()->SetTitleOffset(1.9); h2[iw]->GetXaxis()->SetLabelSize(textsize*1.2); // h2[iw]->GetXaxis()->SetLabelOffset(1.2); h2[iw]->Draw(); } // // Draw! // const int nPlotBin = 40; double ptPlot[nPlotBin]; double vnPlot[nPlotBin]; double errPlot[nPlotBin]; cout << "Now Draw!" << endl; TGraphErrors *ge, *ge2, *ge3, *ge4; for (int iw=0;iw<nw;iw++) { can->cd(iw+1); // if (iw==0) { tex=new TLatex(0.6,0.0235*0.88*1.275*1.47*1.6,"CMS"); tex->SetTextSize(textsize*1.0); //tex->Draw(); tex=new TLatex(2.8,0.0235*0.88*1.275*1.47*1.6,"Preliminary"); tex->SetTextSize(textsize*1.0); //tex->Draw(); } if (iw==0) { tex=new TLatex(1.5,1.18,"0-20%"); tex->SetTextSize(textsize*1.0); tex->Draw(); tex=new TLatex(2.,0.021,"|#eta|<0.8"); tex->SetTextSize(textsize*1.0); //tex->Draw(); tex=new TLatex(0.5,0.02,"0.3<p_{T}<3.0 GeV/c"); tex->SetTextSize(textsize*1.0); //tex->Draw(); } //if (iw < 4) tex=new TLatex(ptit[iw][0]+2,0.27,htit[iw]); tex=new TLatex(2.1,1.4,htit[iw]); if ( iw == 0) tex->SetTextSize(textsize); else if (iw == 8) tex->SetTextSize(textsize); else tex->SetTextSize(textsize); tex->Draw(); // // Legend // TLegend *leg = new TLegend(lxmin[iw]*1.2,lymin[iw]*1.*0.75*0.1,lxmax[iw]*0.8,lymax[iw]*1.02*0.4*0.92); leg->SetFillColor(0); leg->SetTextSize(textsize); TLegend *leg2 = new TLegend(lxmin[iw]*1.2,lymin[iw]*1.*0.75*0.52,lxmax[iw]*0.8,lymax[iw]*1.02*0.56*0.92); leg2->SetFillColor(0); leg2->SetTextSize(textsize); // // Read data // for (int im=0;im<1;im++) { int j=im*5+iw; int col=2; //if (ndp[j]==0) continue; ge=new TGraphErrors(19,&nARxa[j][0],&nARya[j][0],&nARxe[j][0],&nARye[j][0]); ge->SetTitle(""); ge->SetMarkerStyle(24); // ge->SetMarkerStyle(msty[im]); ge->SetMarkerSize(msiz[im]); ge->SetMarkerColor(col); ge->SetLineWidth(1.2); ge->SetLineColor(col); //ge->Draw("pe"); leg->AddEntry(ge,"HF(3,4)/HF(3,5)","pl"); } for (int im=0;im<1;im++) { int j=im*5+iw; int col=4; //if (ndp[j]==0) continue; ge2=new TGraphErrors(19,&nBRxa[j][0],&nBRya[j][0],&nBRxe[j][0],&nBRye[j][0]); ge2->SetTitle(""); ge2->SetMarkerStyle(25); // ge2->SetMarkerStyle(msty[im]); ge2->SetMarkerSize(msiz[im]); ge2->SetMarkerColor(col); ge2->SetLineWidth(1.2); ge2->SetLineColor(col); //ge2->Draw("pe"); leg->AddEntry(ge2,"HF(4,5)/HF(3,5)","pl"); //drawSysBox(ge2,16,0.2, sysXYZ[j]); } ge2->Draw("pe"); ge->Draw("pe"); if (iw==0) leg->Draw(); TLine *lines = new TLine(0,1,4.0,1); lines->SetLineStyle(2); lines->SetLineWidth(1); lines->Draw(); if(iw==0||iw<6){ TF1 *fitFun = new TF1("fitFun","pol1", 0, 4); fitFun->SetLineColor(2); ge->Fit("fitFun","R+"); fitFun->Draw("same"); cout<<fitFun->Eval(0.4)<<", "<<fitFun->Eval(0.9)<<", "<<fitFun->Eval(1.9)<<", "<<fitFun->Eval(3.5)<<endl; double p0 = fitFun->GetParameter(0); double p0Err = fitFun->GetParError(0); double p1 = fitFun->GetParameter(1); double p1Err = fitFun->GetParError(1); //double p2 = fitFun->GetParameter(2); //double p2Err = fitFun->GetParError(2); //TF1 *fitFunE = new TF1("fitFunE","[0]+[1]*x+[2]*x*x", 0, 4); TF1 *fitFunE = new TF1("fitFunE","[0]+[1]*x", 0, 4); //fitFunE->SetParameters(p0+p0Err, p1+p1Err, p2+p2Err); fitFunE->SetParameters(p0+p0Err, p1); for(int ipt=0; ipt<nPlotBin; ipt++){ ptPlot[ipt] = ipt*0.1+0.05; vnPlot[ipt] = fitFun->Eval(ptPlot[ipt]); errPlot[ipt] = fitFunE->Eval(ptPlot[ipt]) - fitFun->Eval(ptPlot[ipt]); } TGraphErrors *graph = new TGraphErrors(nPlotBin,ptPlot,vnPlot,0,errPlot); graph->SetTitle(""); graph->SetMarkerStyle(20); graph->SetMarkerSize(1.0); graph->SetMarkerColor(1); graph->SetLineWidth(2); graph->SetLineColor(2); MyStyle->SetFillColor(kRed+1); graph->SetFillColor(kRed+1); graph->SetFillStyle(3002); graph->Draw("e3same"); } else { TF1 *fitFun = new TF1("fitFun","pol1", 0, 4); fitFun->SetLineColor(4); ge->Fit("fitFun","R+"); fitFun->Draw("same"); cout<<fitFun->Eval(0.4)<<", "<<fitFun->Eval(0.9)<<", "<<fitFun->Eval(1.9)<<", "<<fitFun->Eval(3.5)<<endl; } double chi2 = fitFun->GetChisquare(); double ndf = fitFun->GetNDF(); TLatex *tex = new TLatex(0.6,0.53,Form("#chi^{2}/ndf = %2.1f", chi2/ndf)); tex->SetTextColor(2); tex->SetTextSize(16); tex->Draw("same"); can->cd(iw+1+5); tex=new TLatex(2.1,1.4,htitc2[iw]); if ( iw == 0) tex->SetTextSize(textsize); else if (iw == 8) tex->SetTextSize(textsize); else tex->SetTextSize(textsize); tex->Draw(); for (int im=0;im<1;im++) { int j=im*5+iw; int col=2; //if (ndp[j]==0) continue; ge3=new TGraphErrors(19,&nARxa60[j][0],&nARya60[j][0],&nARxe60[j][0],&nARye60[j][0]); ge3->SetTitle(""); ge3->SetMarkerStyle(24); // ge3->SetMarkerStyle(msty[im]); ge3->SetMarkerSize(msiz[im]); ge3->SetMarkerColor(col); ge3->SetLineWidth(1.2); ge3->SetLineColor(col); //ge3->Draw("pe"); leg2->AddEntry(ge3,"HF(3,4)/HF(3,5)","pl"); } for (int im=0;im<1;im++) { int j=im*5+iw; int col=4; //if (ndp[j]==0) continue; ge4=new TGraphErrors(19,&nBRxa60[j][0],&nBRya60[j][0],&nBRxe60[j][0],&nBRye60[j][0]); ge4->SetTitle(""); ge4->SetMarkerStyle(25); // ge4->SetMarkerStyle(msty[im]); ge4->SetMarkerSize(msiz[im]); ge4->SetMarkerColor(col); ge4->SetLineWidth(1.2); ge4->SetLineColor(col); //ge4->Draw("pe"); leg2->AddEntry(ge4,"HF(4,5)/HF(3,5)","pl"); } ge4->Draw("pe"); ge3->Draw("pe"); TLine *lines = new TLine(0,1,4.0,1); lines->SetLineStyle(2); lines->SetLineWidth(1); lines->Draw(); if(iw==0) leg2->Draw(); if(iw==0||iw<6){ TF1 *fitFun = new TF1("fitFun","pol1", 0, 4); fitFun->SetLineColor(2); ge3->Fit("fitFun","R+"); fitFun->Draw("same"); cout<<fitFun->Eval(2.5)<<", "<<fitFun->Eval(7.5)<<", "<<fitFun->Eval(45)<<", "<<fitFun->Eval(55)<<endl; double p0 = fitFun->GetParameter(0); double p0Err = fitFun->GetParError(0); double p1 = fitFun->GetParameter(1); double p1Err = fitFun->GetParError(1); //double p2 = fitFun->GetParameter(2); //double p2Err = fitFun->GetParError(2); //TF1 *fitFunE = new TF1("fitFunE","[0]+[1]*x+[2]*x*x", 0, 4); TF1 *fitFunE = new TF1("fitFunE","[0]+[1]*x", 0, 4); //fitFunE->SetParameters(p0+p0Err, p1+p1Err, p2+p2Err); fitFunE->SetParameters(p0+p0Err, p1); for(int ipt=0; ipt<nPlotBin; ipt++){ ptPlot[ipt] = ipt*0.1+0.05; vnPlot[ipt] = fitFun->Eval(ptPlot[ipt]); errPlot[ipt] = fitFunE->Eval(ptPlot[ipt]) - fitFun->Eval(ptPlot[ipt]); } TGraphErrors *graph = new TGraphErrors(nPlotBin,ptPlot,vnPlot,0,errPlot); graph->SetTitle(""); graph->SetMarkerStyle(20); graph->SetMarkerSize(1.0); graph->SetMarkerColor(1); graph->SetLineWidth(2); graph->SetLineColor(2); MyStyle->SetFillColor(kRed+1); graph->SetFillColor(kRed+1); graph->SetFillStyle(3002); graph->Draw("e3same"); } else { TF1 *fitFun = new TF1("fitFun","pol1", 0, 4); fitFun->SetLineColor(4); ge3->Fit("fitFun","R+"); fitFun->Draw("same"); cout<<fitFun->Eval(2.5)<<", "<<fitFun->Eval(7.5)<<", "<<fitFun->Eval(45)<<", "<<fitFun->Eval(55)<<endl; } double chi2 = fitFun->GetChisquare(); double ndf = fitFun->GetNDF(); TLatex *tex = new TLatex(0.6,0.53,Form("#chi^{2}/ndf = %2.1f", chi2/ndf)); tex->SetTextColor(2); tex->SetTextSize(16); tex->Draw("same"); if(iw==0){ can->cd(iw+5+1); TLatex *tex=new TLatex(1.5,1.18,"20-60%"); tex->SetTextSize(textsize*1.0); tex->Draw(); } } can->cd(); TLatex * tex = new TLatex(0.06,0.96,"CMS"); tex->SetNDC(); tex->SetTextFont(62); tex->SetTextSize(0.038); tex->SetLineWidth(2); tex->Draw(); TLatex * tex = new TLatex(0.108,0.96,"Preliminary"); tex->SetNDC(); tex->SetTextFont(52); tex->SetTextSize(0.038); tex->SetLineWidth(2); //tex->Draw(); TLatex * tex = new TLatex(0.24,0.963,"|#eta|<0.8"); tex->SetNDC(); tex->SetTextFont(42); tex->SetTextSize(0.038); tex->SetLineWidth(2); tex->Draw(); cout << "end of process" << endl; can->cd(); can->Print("./figures/plot_vnpt_5panels_hfSys_ratio.png"); can->Print("./figures/plot_vnpt_5panels_hfSys_ratio.pdf"); //can->Print("./figures/plot_vnpt_5panels.gif"); }
void DrawNCLUSTER() { //=========Macro generated from canvas: r1/Energy //========= (Fri Apr 6 17:14:48 2012) by ROOT version5.28/00g TCanvas *r1 = new TCanvas("r1", "Ncluster",12,24,550,741); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); gStyle->SetFrameLineWidth(1); r1->Range(0,0,1,1); r1->SetFillColor(0); r1->SetBorderMode(0); r1->SetBorderSize(0); r1->SetTickx(1); r1->SetTicky(1); r1->SetLeftMargin(0.16); r1->SetRightMargin(0.01); r1->SetTopMargin(0.0256917); r1->SetBottomMargin(0.07692308); r1->SetFrameBorderMode(); // ------------>Primitives in pad: r1_1 TPad *r1_1 = new TPad("r1_1", "Energy_1",0.02,0.37,0.95,0.99); r1_1->Draw(); r1_1->cd(); r1_1->Range(-19,0.01,95,95); r1_1->SetFillColor(0); r1_1->SetBorderMode(0); r1_1->SetBorderSize(2); r1_1->SetTickx(1); r1_1->SetTicky(1); r1_1->SetLeftMargin(0.16); r1_1->SetRightMargin(0.01); r1_1->SetTopMargin(0.02); r1_1->SetBottomMargin(0); r1_1->SetFrameBorderMode(0); r1_1->SetFrameBorderMode(0); TH1D *he = new TH1D("he"," ",55,0,55); he->SetMinimum(0.01); he->SetMaximum(70); he->SetStats(0); he->GetXaxis()->SetTitle("E_{beam} [GeV]"); he->GetXaxis()->SetLabelFont(43); he->GetXaxis()->SetLabelSize(0); he->GetXaxis()->SetTitleFont(43); he->GetXaxis()->SetTitleSize(0); he->GetYaxis()->SetTitle("<N_{cluster}>"); he->GetYaxis()->SetLabelFont(43); he->GetYaxis()->SetTitleSize(30); he->GetYaxis()->SetLabelSize(20); he->GetYaxis()->SetTitleFont(43); he->GetYaxis()->SetTitleOffset(1.7); he->GetZaxis()->SetLabelFont(42); he->GetZaxis()->SetTitleSize(0.05); he->GetZaxis()->SetTitleFont(42); he->Draw(""); std::vector<result> resultData=readTXT(std::string("ncluster_augsep2012_electron.txt")); TGraphErrors *gre = new TGraphErrors(resultData.size()); gre->SetName("Graph"); gre->SetTitle("Graph"); gre->SetLineColor(1); gre->SetFillStyle(1); gre->SetFillColor(1); gre->SetLineWidth(2); gre->SetMarkerColor(1); gre->SetMarkerStyle(34); gre->SetMarkerSize(1.2); for(unsigned int i=0; i<resultData.size(); i++){ gre->SetPoint(i,resultData.at(i).ebeam,resultData.at(i).ncluster); gre->SetPointError(i,0,resultData.at(i).nclusterError); } TH1F *Graph_Graph3 = new TH1F("Graph_Graph3","Graph",100,0,87.5); Graph_Graph3->SetMinimum(0); Graph_Graph3->SetMaximum(1193.483); Graph_Graph3->SetDirectory(0); Graph_Graph3->SetStats(0); Graph_Graph3->GetXaxis()->SetLabelFont(42); Graph_Graph3->GetXaxis()->SetTitleSize(0.05); Graph_Graph3->GetXaxis()->SetTitleFont(42); Graph_Graph3->GetYaxis()->SetLabelFont(42); Graph_Graph3->GetYaxis()->SetTitleSize(0.05); Graph_Graph3->GetYaxis()->SetTitleFont(42); Graph_Graph3->GetZaxis()->SetLabelFont(42); Graph_Graph3->GetZaxis()->SetTitleSize(0.05); Graph_Graph3->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph3); gre->Draw("p"); std::vector<result> resultFTFP=readTXT(std::string("ncluster_ftfp_bert_hp_electron.txt")); gre = new TGraphErrors(resultFTFP.size()); gre->SetName("Graph"); gre->SetTitle("Graph"); gre->SetFillColor(kRed-3); gre->SetMarkerColor(kRed-3); gre->SetLineWidth(2); gre->SetMarkerStyle(20); for(unsigned int i=0; i<resultFTFP.size(); i++){ gre->SetPoint(i,resultFTFP.at(i).ebeam,resultFTFP.at(i).ncluster); gre->SetPointError(i,0,resultFTFP.at(i).nclusterError); } TH1F *Graph1 = new TH1F("Graph1","Graph",100,0,87.17072); Graph1->SetMinimum(2.655724); Graph1->SetMaximum(88.56778); Graph1->SetDirectory(0); Graph1->SetStats(0); Graph1->GetXaxis()->SetLabelFont(42); Graph1->GetXaxis()->SetTitleSize(0.05); Graph1->GetXaxis()->SetTitleFont(42); Graph1->GetYaxis()->SetLabelFont(42); Graph1->GetYaxis()->SetTitleSize(0.05); Graph1->GetYaxis()->SetTitleFont(42); Graph1->GetZaxis()->SetLabelFont(42); Graph1->GetZaxis()->SetTitleSize(0.05); Graph1->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph1); gre->Draw("p"); std::vector<result> resultQGSP=readTXT(std::string("ncluster_qgsp_bert_hp_electron.txt")); gre = new TGraphErrors(resultQGSP.size()); gre->SetName("Graph"); gre->SetTitle("Graph"); gre->SetFillColor(kBlue-6); gre->SetMarkerColor(kBlue-6); gre->SetLineWidth(2); gre->SetMarkerStyle(25); for(unsigned int i=0; i<resultQGSP.size(); i++){ gre->SetPoint(i,resultQGSP.at(i).ebeam,resultQGSP.at(i).ncluster); gre->SetPointError(i,0,resultQGSP.at(i).nclusterError); } TH1F *Graph_Graph2 = new TH1F("Graph_Graph2","Graph",100,0,87.5); Graph_Graph2->SetMinimum(0); Graph_Graph2->SetMaximum(1193.483); Graph_Graph2->SetDirectory(0); Graph_Graph2->SetStats(0); Graph_Graph2->GetXaxis()->SetLabelFont(42); Graph_Graph2->GetXaxis()->SetTitleSize(0.05); Graph_Graph2->GetXaxis()->SetTitleFont(42); Graph_Graph2->GetYaxis()->SetLabelFont(42); Graph_Graph2->GetYaxis()->SetTitleSize(0.05); Graph_Graph2->GetYaxis()->SetTitleFont(42); Graph_Graph2->GetZaxis()->SetLabelFont(42); Graph_Graph2->GetZaxis()->SetTitleSize(0.05); Graph_Graph2->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph2); gre->Draw("p"); TLegend *leg = new TLegend(0.15,0.7,0.75,0.9,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetTextFont(62); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(0); TLegendEntry *entry=leg->AddEntry("Graph_Graph3","SDHCAL DATA (H6 Cern SPS)","p"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(34); entry->SetMarkerSize(1.2); entry=leg->AddEntry("Graph1","FTFP_BERT_HP","p"); entry->SetLineColor(kRed-3); entry->SetLineStyle(kRed-3); entry->SetLineWidth(kRed-3); entry->SetMarkerColor(kRed-3); entry->SetMarkerStyle(20); entry->SetMarkerSize(1.0); entry=leg->AddEntry("Graph_Graph2","QGSP_BERT_HP","p"); entry->SetLineColor(kBlue-6); entry->SetLineStyle(kBlue-6); entry->SetLineWidth(kBlue-6); entry->SetMarkerColor(kBlue-6); entry->SetMarkerStyle(25); entry->SetMarkerSize(0.9); leg->Draw(); TText *tex=new TText(); tex->SetTextSize(0.05); tex->SetTextColor(kGray+2); //tex->DrawTextNDC(0.5,0.05,"SDHCAL Preliminary"); tex->DrawTextNDC(0.3,0.05,"CALICE Fe-SDHCAL Preliminary"); r1_1->Modified(); r1->cd(); // ------------>Primitives in pad: r1_2 TPad *r1_2 = new TPad("r1_2", "Energy_2",0.02,0.0,0.95,0.38); r1_2->Draw(); r1_2->cd(); r1_2->Range(-19,-0.06545455,95,0.048); r1_2->SetFillColor(0); r1_2->SetBorderMode(0); r1_2->SetBorderSize(2); r1_2->SetTickx(1); r1_2->SetTicky(1); r1_2->SetLeftMargin(0.16); r1_2->SetRightMargin(0.01); r1_2->SetTopMargin(0.0); r1_2->SetBottomMargin(0.23); r1_2->SetFrameBorderMode(0); r1_2->SetFrameBorderMode(0); TH1D *hd = new TH1D("hd"," ",55,0,55); hd->SetMinimum(-0.20); hd->SetMaximum(0.20); hd->SetStats(0); hd->GetXaxis()->SetTitle("E_{beam} [GeV]"); hd->GetXaxis()->SetLabelFont(43); hd->GetXaxis()->SetLabelSize(20); hd->GetXaxis()->SetTitleFont(43); hd->GetXaxis()->SetTitleSize(30); hd->GetXaxis()->SetTitleOffset(2.); hd->GetYaxis()->SetTitle("(#DeltaN_{cluster})/N_{data}"); hd->GetYaxis()->SetLabelFont(43); hd->GetYaxis()->SetLabelSize(20); hd->GetYaxis()->SetTitleSize(30); hd->GetYaxis()->SetTitleOffset(1.7); hd->GetYaxis()->SetTitleFont(43); hd->GetYaxis()->SetNdivisions(505); hd->GetZaxis()->SetLabelFont(42); hd->GetZaxis()->SetTitleSize(0.05); hd->GetZaxis()->SetTitleFont(42); hd->Draw(""); float deltaError; float delta; gre = new TGraphErrors(resultQGSP.size()); gre->SetName("Graph"); gre->SetTitle("Graph"); for(unsigned int i=0; i<resultQGSP.size(); i++){ delta=(resultQGSP.at(i).ncluster-resultData.at(i).ncluster)/resultData.at(i).ncluster; deltaError=1/resultData.at(i).ncluster* sqrt(pow(resultQGSP.at(i).nclusterError,2) + pow(resultQGSP.at(i).ncluster/resultData.at(i).ncluster*resultData.at(i).nclusterError,2)); gre->SetPoint(i,resultQGSP.at(i).ebeam,delta); gre->SetPointError(i,0,deltaError); } gre->SetLineWidth(2); gre->SetLineColor(kBlue-6); gre->SetMarkerColor(kBlue-6); gre->SetMarkerSize(1.0); gre->SetMarkerStyle(25); gre->Draw("p"); gre = new TGraphErrors(resultFTFP.size()); gre->SetName("Graph"); gre->SetTitle("Graph"); for(unsigned int i=0; i<resultFTFP.size(); i++){ delta=(resultFTFP.at(i).ncluster-resultData.at(i).ncluster)/resultData.at(i).ncluster; deltaError=1/resultData.at(i).ncluster* sqrt(pow(resultFTFP.at(i).nclusterError,2) + pow(resultFTFP.at(i).ncluster/resultData.at(i).ncluster*resultData.at(i).nclusterError,2)); gre->SetPoint(i,resultFTFP.at(i).ebeam,delta); gre->SetPointError(i,0,deltaError); } gre->SetLineWidth(2); gre->SetLineColor(kRed-3); gre->SetMarkerColor(kRed-3); gre->SetMarkerSize(1.0); gre->SetMarkerStyle(20); gre->Draw("p"); TF1 *lin1 = new TF1("lin1","0",-0.01,95); lin1->SetFillColor(19); lin1->SetFillStyle(0); lin1->SetLineWidth(1); lin1->SetLineStyle(1); lin1->SetLineColor(1); lin1->GetXaxis()->SetLabelFont(42); lin1->GetXaxis()->SetTitleSize(0.05); lin1->GetXaxis()->SetTitleFont(42); lin1->GetYaxis()->SetLabelFont(42); lin1->GetYaxis()->SetTitleSize(0.05); lin1->GetYaxis()->SetTitleFont(42); lin1->Draw("same"); lin1 = new TF1("lin1","0.1",0.01,95); lin1->SetFillColor(1); lin1->SetFillStyle(0); lin1->SetLineWidth(1); lin1->SetLineStyle(2); lin1->SetLineColor(17); lin1->GetXaxis()->SetLabelFont(42); lin1->GetXaxis()->SetTitleSize(0.05); lin1->GetXaxis()->SetTitleFont(42); lin1->GetYaxis()->SetLabelFont(42); lin1->GetYaxis()->SetTitleSize(0.05); lin1->GetYaxis()->SetTitleFont(42); lin1->Draw("same"); lin1 = new TF1("lin1","-0.1",0.01,95); lin1->SetFillColor(1); lin1->SetFillStyle(0); lin1->SetLineWidth(1); lin1->SetLineStyle(2); lin1->SetLineColor(17); lin1->GetXaxis()->SetLabelFont(42); lin1->GetXaxis()->SetTitleSize(0.05); lin1->GetXaxis()->SetTitleFont(42); lin1->GetYaxis()->SetLabelFont(42); lin1->GetYaxis()->SetTitleSize(0.05); lin1->GetYaxis()->SetTitleFont(42); lin1->Draw("same"); r1_2->Modified(); r1->cd(); r1->Modified(); r1->cd(); r1->SetSelected(r1); r1->SaveAs("../plots/NCLUSTERELECTRON.pdf"); }
void ProcessingTime(const char *inputFile) { TChain *chain = new TChain("Delphes"); chain->Add(inputFile); TH1F hist("time", "time", 50, 0, 0.01); Int_t i; TDirectory *currentDirectory = gDirectory; // Graphics style parameters to avoid grey background on figures gStyle->SetCanvasColor(kExRootBackgroundColor); gStyle->SetStatColor(kExRootBackgroundColor); // gStyle->SetTitleColor(kExRootBackgroundColor); gStyle->SetPadColor(kExRootBackgroundColor); gStyle->SetPadTopMargin(0.10); gStyle->SetPadRightMargin(0.10); gStyle->SetPadBottomMargin(0.15); gStyle->SetPadLeftMargin(0.15); gStyle->SetStatFont(kExRootFont); gStyle->SetStatFontSize(kExRootFontSize); gStyle->SetTitleFont(kExRootFont, ""); gStyle->SetTitleFont(kExRootFont, "X"); gStyle->SetTitleFont(kExRootFont, "Y"); gStyle->SetTitleFont(kExRootFont, "Z"); gStyle->SetTitleSize(kExRootFontSize, ""); gStyle->SetTitleSize(kExRootFontSize, "X"); gStyle->SetTitleSize(kExRootFontSize, "Y"); gStyle->SetTitleSize(kExRootFontSize, "Z"); gStyle->SetLabelFont(kExRootFont, "X"); gStyle->SetLabelFont(kExRootFont, "Y"); gStyle->SetLabelFont(kExRootFont, "Z"); gStyle->SetLabelSize(kExRootFontSize, "X"); gStyle->SetLabelSize(kExRootFontSize, "Y"); gStyle->SetLabelSize(kExRootFontSize, "Z"); gStyle->SetPadTickX(1); gStyle->SetPadTickY(1); gStyle->SetTextFont(kExRootFont); gStyle->SetTextSize(kExRootFontSize); gStyle->SetOptStat(111110); // gStyle->SetOptFit(101); canvas = static_cast<TCanvas*>(gROOT->FindObject("c1")); if(canvas) { canvas->Clear(); canvas->UseCurrentStyle(); canvas->SetWindowSize(800, 650); } else { canvas = new TCanvas("c1", "c1", 800, 650); } canvas->SetGrid(); canvas->SetHighLightColor(kExRootBackgroundColor); currentDirectory->cd(); for(i = 0; i < 9; ++i) { chain->Draw("Event.ProcTime >> time", TString::Format("Jet_size == %d", i+2)); gr.SetPoint(i, i+2, hist.GetMean()*1000); grerr.SetPoint(i, i+2, hist.GetMean()*1000); grerr.SetPointError(i, 0, hist.GetRMS()*1000); } grerr.GetXaxis()->SetLimits(1.0, 11.0); grerr.GetXaxis()->SetTitleOffset(1.5); grerr.GetYaxis()->SetTitleOffset(1.75); grerr.GetXaxis()->SetTitle("jet multiplicity"); grerr.GetYaxis()->SetTitle("processing time per event, ms"); gr.SetMarkerStyle(kFullCircle); gr.SetMarkerColor(kBlack); gr.SetMarkerSize(1); gr.SetLineColor(kBlack); gr.SetLineWidth(2); grerr.SetFillStyle(1001); grerr.SetFillColor(17); grerr.Draw("A3"); gr.Draw("P"); comment.SetTextSize(kExRootFontSize); comment.SetTextFont(kExRootFont); comment.SetTextAlign(22); comment.SetFillColor(kExRootBackgroundColor); comment.SetBorderSize(0); comment.AddText("ttbar + jets events"); comment.Draw(); }
int main(int argc, char** argv){ ///================================================== ///==== Draw Distribution with and without scale ==== ///================================================== ///=============================================================================== gROOT->Reset(); gROOT->SetStyle("Plain"); gStyle->SetPalette(1); gStyle->SetOptStat(0); gStyle->SetOptFit(0); const Int_t __NRGBs = 5; const Int_t __NCont = 76; Double_t __stops[__NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; Double_t __red[__NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 }; Double_t __green[__NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 }; Double_t __blue[__NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 }; TColor::CreateGradientColorTable(__NRGBs, __stops, __red, __green, __blue, __NCont); gStyle->SetNumberContours(__NCont); ///=============================================================================== if(argc != 2) { std::cerr << ">>>>> analysis.cpp::usage: " << argv[0] << " configFileName" << std::endl ; return 1; } // Parse the config file parseConfigFile (argv[1]) ; std::string treeNameDATA = gConfigParser -> readStringOption("InputDATA::treeName"); std::string inputFileDATA = gConfigParser -> readStringOption("InputDATA::inputFile"); double luminosity = gConfigParser -> readDoubleOption("InputDATA::luminosity"); std::cout << ">>>>> InputDATA::treeName " << treeNameDATA << std::endl; std::cout << ">>>>> InputDATA::inputFile " << inputFileDATA << std::endl; std::cout << ">>>>> InputDATA::luminosity " << luminosity << std::endl; std::string treeNameMC = gConfigParser -> readStringOption("InputMC::treeName"); std::vector< std::string > inputFileMC = gConfigParser -> readStringListOption("InputMC::inputFile"); std::vector< std::string > inputSampleMC = gConfigParser -> readStringListOption("InputMC::nameSample"); std::vector< double > xSecAndEfficiency = gConfigParser -> readDoubleListOption("InputMC::xsecEff"); std::cout << ">>>>> InputMC::treeName " << treeNameMC << std::endl; std::cout << ">>>>> InputMC::inputFile size " << inputFileMC.size() << std::endl; if (inputFileMC.size() != xSecAndEfficiency.size() || inputFileMC.size() != inputSampleMC.size()) { std::cerr << " >>>> Error: different number of samples and cross sections" << std::endl; return 0; } int nMC = inputFileMC.size(); for (int iMC = 0; iMC < nMC; iMC++) { std::cout << ">>>>> InputMC::inputFile[" << iMC << "] = " << inputSampleMC.at(iMC) << " => " << inputFileMC.at(iMC) << " : " << xSecAndEfficiency.at(iMC) << " : " << luminosity * xSecAndEfficiency.at(iMC) << std::endl; } int binX = gConfigParser -> readIntOption("Options::binX"); double minX = gConfigParser -> readDoubleOption("Options::minX"); double maxX = gConfigParser -> readDoubleOption("Options::maxX"); std::string variableX = gConfigParser -> readStringOption("Options::variableX"); std::cout << ">>>>> Options::binX " << binX << std::endl; std::cout << ">>>>> Options::minX " << minX << std::endl; std::cout << ">>>>> Options::maxX " << maxX << std::endl; std::cout << ">>>>> Options::variableX " << variableX.c_str() << std::endl; int binY = gConfigParser -> readIntOption("Options::binY"); double minY = gConfigParser -> readDoubleOption("Options::minY"); double maxY = gConfigParser -> readDoubleOption("Options::maxY"); std::string variableY = gConfigParser -> readStringOption("Options::variableY"); std::cout << ">>>>> Options::binY " << binY << std::endl; std::cout << ">>>>> Options::minY " << minY << std::endl; std::cout << ">>>>> Options::maxY " << maxY << std::endl; std::cout << ">>>>> Options::variableY " << variableY.c_str() << std::endl; int binRatio = gConfigParser -> readIntOption("Options::binRatio"); double minRatio = gConfigParser -> readDoubleOption("Options::minRatio"); double maxRatio = gConfigParser -> readDoubleOption("Options::maxRatio"); std::cout << ">>>>> Options::minRatio " << minRatio << std::endl; std::cout << ">>>>> Options::maxRatio " << maxRatio << std::endl; std::string outputFile = gConfigParser -> readStringOption("Output::outputFile"); std::cout << ">>>>> Output::outputFile " << outputFile << std::endl; // TString AdditionalCut = Form("eta > 1.5");// || eta < -1.5)");// && eleFBrem<0.5"); TString AdditionalCut = Form("eta < -1.5");// || eta < -1.5)");// && eleFBrem<0.5"); // TString AdditionalCut = Form("(eta > 1.5 || eta < -1.5)");// && abs(eleFBrem)<1"); EColor vColor[100] = { kBlue,(EColor)(kBlue+1),(EColor) (kBlue+2), kRed,(EColor) (kRed+1),(EColor) (kRed+2), kGreen,(EColor) (kGreen+1),(EColor) (kGreen+2), kTeal,(EColor) (kTeal+1), kOrange,(EColor) (kOrange+1), kMagenta,(EColor) (kMagenta+1),(EColor) (kViolet),(EColor) (kYellow),(EColor) (kGray)}; ///==== DATA ==== TFile* fileInDATA = new TFile(inputFileDATA.c_str(),"READ"); ///==== W ==== TFile* fileInMC[nMC]; for (int iMC = 0; iMC < nMC; iMC++) { fileInMC[iMC] = new TFile(inputFileMC.at(iMC).c_str(),"READ"); } ///==== output ==== TFile* outFile = new TFile(outputFile.c_str(),"RECREATE"); outFile->cd(); ///==== Prepare input trees ==== TLegend* leg = new TLegend(0.55,0.7,0.95,0.95); leg->SetFillColor(0); TLegend* legDown = new TLegend(0.55,0.1,0.95,0.35); legDown->SetFillColor(0); TTree* MyTreeDATA = (TTree*) fileInDATA->Get(treeNameDATA.c_str()); int initialNumber; TH2F* HistoDATA = new TH2F("DATA","DATA",binX,minX,maxX,binY,minY,maxY); TH1F* HistoRatioDATA = new TH1F("RatioDATA","RatioDATA",binRatio,minRatio,maxRatio); TString DrawDATA = Form("%s:%s >> DATA",variableY.c_str(),variableX.c_str()); MyTreeDATA->Draw(DrawDATA.Data(),AdditionalCut.Data()); HistoDATA->SetMarkerSize(1); HistoDATA->SetMarkerStyle(20); HistoDATA->GetXaxis()->SetTitle(variableX.c_str()); HistoDATA->GetYaxis()->SetTitle(variableY.c_str()); leg->AddEntry(HistoDATA,HistoDATA->GetTitle(),"p"); legDown->AddEntry(HistoDATA,HistoDATA->GetTitle(),"p"); DrawDATA = Form("(%s) / (%s) >> RatioDATA",variableY.c_str(),variableX.c_str()); MyTreeDATA->Draw(DrawDATA.Data(),AdditionalCut.Data()); HistoRatioDATA->SetMarkerSize(1); HistoRatioDATA->SetMarkerStyle(20); HistoRatioDATA->GetXaxis()->SetTitle(Form("(%s)/(%s)",variableY.c_str(),variableX.c_str())); TH2F* HistoMC[nMC]; TH1F* HistoRatioMC[nMC]; TH2F* HistoMC_SUM = new TH2F("HistoMC_SUM","HistoMC_SUM",binX,minX,maxX,binY,minY,maxY); TH1F* HistoRatioMC_SUM = new TH1F("HistoRatioMC_SUM","HistoRatioMC_SUM",binRatio,minRatio,maxRatio); SetColorAndStyleHisto(*(HistoRatioMC_SUM),kBlue); TTree* MyTreeMC[nMC]; THStack* hsMC = new THStack("hsMC","hsMC"); double MC_Expected = 0; for (int iMC = 0; iMC < nMC; iMC++) { // for (int iMC = nMC-1; iMC >= 0; iMC--) { MyTreeMC[iMC] = (TTree*) fileInMC[iMC]->Get(treeNameMC.c_str()); MyTreeMC[iMC]->SetBranchAddress("initialNumber",&initialNumber); MyTreeMC[iMC]->GetEntry(0); xSecAndEfficiency.at(iMC) = xSecAndEfficiency.at(iMC) / initialNumber; ///==== normalize to initial number of events HistoMC[iMC] = new TH2F(inputSampleMC.at(iMC).c_str(),inputSampleMC.at(iMC).c_str(),binX,minX,maxX,binY,minY,maxY); HistoRatioMC[iMC] = new TH1F(Form("%s_Ratio",inputSampleMC.at(iMC).c_str()),Form("%s_Ratio",inputSampleMC.at(iMC).c_str()),binRatio,minRatio,maxRatio); TString Draw = Form("%s:%s >> %s",variableY.c_str(),variableX.c_str(),inputSampleMC.at(iMC).c_str()); MyTreeMC[iMC]->Draw(Draw.Data(),AdditionalCut.Data()); Draw = Form("(%s) / (%s) >> %s",variableY.c_str(),variableX.c_str(),Form("%s_Ratio",inputSampleMC.at(iMC).c_str())); MyTreeMC[iMC]->Draw(Draw.Data(),AdditionalCut.Data()); HistoRatioMC[iMC]->GetXaxis()->SetTitle(Form("(%s)/(%s)",variableY.c_str(),variableX.c_str())); std::cout << ">>>>>> " << inputSampleMC.at(iMC) << " : " << xSecAndEfficiency.at(iMC) << " : " << luminosity << " : " << HistoMC[iMC]->GetEntries() << " = " << luminosity * xSecAndEfficiency.at(iMC) * HistoMC[iMC]->GetEntries() << std::endl; std::cout << " >> " << Draw.Data() << std::endl; std::cout << " >> " << HistoMC[iMC]->GetEntries() << " Entries" << std::endl; MC_Expected += luminosity * xSecAndEfficiency.at(iMC) * HistoMC[iMC]->GetEntries(); HistoMC[iMC]->Scale(luminosity * xSecAndEfficiency.at(iMC)); // / HistoMC[iMC]->GetEntries()); HistoRatioMC[iMC]->Scale(luminosity * xSecAndEfficiency.at(iMC)); // / HistoMC[iMC]->GetEntries()); SetColorAndStyleHisto(*(HistoMC[iMC]),vColor[iMC]); SetColorAndStyleHisto(*(HistoRatioMC[iMC]),vColor[iMC]); HistoMC[iMC]->GetXaxis()->SetTitle(variableX.c_str()); HistoMC[iMC]->GetYaxis()->SetTitle(variableY.c_str()); HistoMC_SUM->Add(HistoMC[iMC]); HistoMC_SUM->GetXaxis()->SetTitle(variableX.c_str()); HistoMC_SUM->GetYaxis()->SetTitle(variableY.c_str()); HistoRatioMC_SUM->Add(HistoRatioMC[iMC]); HistoRatioMC_SUM->GetXaxis()->SetTitle(Form("(%s)/(%s)",variableY.c_str(),variableX.c_str())); hsMC->Add(HistoMC[iMC]); if (iMC == 0) hsMC->Add(HistoMC[iMC]); leg->AddEntry(HistoMC[iMC],HistoMC[iMC]->GetTitle(),"f"); legDown->AddEntry(HistoMC[iMC],HistoMC[iMC]->GetTitle(),"f"); } ///==== make fit ==== TH1D* htemp_prof = smartGausProfileXSQRTN(HistoDATA,2); TGraphErrors grH = buildGEfromH_Personalized(*htemp_prof); grH.SetMarkerStyle(22); grH.SetMarkerSize(0.7); grH.SetMarkerColor(kBlue); grH.SetFillColor(kBlue); grH.SetFillStyle(3335); grH.SetLineWidth(1); grH.SetLineColor(kBlue); grH.GetXaxis()->SetTitle(variableX.c_str()); grH.GetYaxis()->SetTitle(variableY.c_str()); ///---------------------- ///---- Plot results ---- ///---------------------- std::cerr << " MC expected : DATA = " << MC_Expected << " : " << HistoDATA->GetEntries() << std::endl; std::cerr << " HistoDATA->GetMaximum() = " << HistoDATA->GetMaximum() << std::endl; std::cerr << " HistoDATA->GetEntries() = " << HistoDATA->GetEntries() << std::endl; outFile->cd(); TCanvas cResultDistro("cResultDistro","cResultDistro",900,900); cResultDistro.Divide(2,2); cResultDistro.cd(1); HistoDATA->DrawClone("colz"); gPad->SetGrid(); TString tLumiName = Form("#int L = %.4f pb^{-1}",luminosity); TLatex tLumi(1.5 * HistoDATA->GetMean(1),0.2 * HistoDATA->GetMaximum(),tLumiName.Data()); tLumi.DrawClone(); cResultDistro.cd(2); HistoRatioMC_SUM->Draw(); HistoRatioDATA->Draw("E1same"); TString tEleName = Form("%d electrons",(int) HistoDATA->GetEntries()); TLatex tEle(2.0 * HistoRatioDATA->GetMean(1),0.3 * HistoRatioDATA->GetMaximum(),tEleName.Data()); tEle.DrawClone(); gPad->SetGrid(); cResultDistro.cd(3); grH.Draw("APL"); double minFit = gConfigParser -> readDoubleOption("Options::minFit"); double maxFit = gConfigParser -> readDoubleOption("Options::maxFit"); std::cout << ">>>>> Options::minFit " << minFit << std::endl; std::cout << ">>>>> Options::maxFit " << maxFit << std::endl; TF1* funz = new TF1 ("funz","pol1",minFit,maxFit); // funz->FixParameter(0,0); funz->SetParameter(0,0); funz->SetParameter(1,1); grH.Fit("funz","RMQ"); std::cerr << " Y = [0] + [1] * X " << std::endl; std::cerr << " [0] = " << funz->GetParameter(0) << " +/- " << funz->GetParError(0) << std::endl; std::cerr << " [1] = " << funz->GetParameter(1) << " +/- " << funz->GetParError(1) << std::endl; double coeffDATA = funz->GetParameter(1); double errCoeffDATA = funz->GetParError(1); gPad->SetGrid(); cResultDistro.cd(4); HistoRatioMC_SUM->Draw(); HistoRatioDATA->Draw("E1same"); tEle.DrawClone(); gPad->SetGrid(); gPad->SetLogy(); TString nameImage = Form("%s_%s_%d.png",variableY.c_str(),variableX.c_str(),1); cResultDistro.SaveAs(nameImage.Data()); TString nameImageRoot = Form("%s_%s_%d.root",variableY.c_str(),variableX.c_str(),1); cResultDistro.SaveAs(nameImageRoot.Data()); TCanvas cResultDistroMC("cResultDistroMC","cResultDistroMC",800,800); cResultDistroMC.Divide(2,2); // cResultDistroMC.Divide(2,nMC); // for (int iMC = 0; iMC < nMC; iMC++) { // cResultDistroMC.cd(2*iMC+1); // HistoMC[iMC]->DrawClone("colz"); // HistoDATA->DrawClone("BOXsame"); // cResultDistroMC.cd(2*iMC+2); // HistoRatioMC[iMC]->DrawNormalized(""); // HistoRatioDATA->DrawNormalized("E1same"); // } cResultDistroMC.cd(1); HistoMC_SUM->DrawClone("colz"); HistoDATA->DrawClone("BOXsame"); gPad->SetGrid(); ///==== make fit ==== cResultDistroMC.cd(3); TH1D* MChtemp_prof = smartGausProfileXSQRTN(HistoMC_SUM,2); TGraphErrors MCgrH = buildGEfromH_Personalized(*MChtemp_prof); MCgrH.SetMarkerStyle(22); MCgrH.SetMarkerSize(0.7); MCgrH.SetMarkerColor(kRed); MCgrH.SetFillColor(kRed); MCgrH.SetFillStyle(3335); MCgrH.SetLineWidth(1); MCgrH.SetLineColor(kRed); MCgrH.GetXaxis()->SetTitle(variableX.c_str()); MCgrH.GetYaxis()->SetTitle(variableY.c_str()); funz->SetParameter(0,0); funz->SetParameter(1,1); MCgrH.Fit("funz","RMQ"); std::cerr << " ================= " << std::endl; std::cerr << " ======= MC ====== " << std::endl; std::cerr << " Y = [0] + [1] * X " << std::endl; std::cerr << " [0] = " << funz->GetParameter(0) << " +/- " << funz->GetParError(0) << std::endl; std::cerr << " [1] = " << funz->GetParameter(1) << " +/- " << funz->GetParError(1) << std::endl; double coeffMC = funz->GetParameter(1); double errCoeffMC = funz->GetParError(1); MCgrH.Draw("APL"); gPad->SetGrid(); cResultDistroMC.cd(4); MCgrH.Draw("APL"); grH.Draw("PLSAME"); gPad->SetGrid(); TString nameImageLog = Form("%s_%s_%d_MC.png",variableY.c_str(),variableX.c_str(),1); cResultDistroMC.SaveAs(nameImageLog.Data()); std::cerr << " 1 - alpha = " << coeffDATA / coeffMC << " +/- " << sqrt( (errCoeffDATA/coeffMC)*(errCoeffDATA/coeffMC) + (errCoeffMC*coeffDATA/coeffMC/coeffMC)*(errCoeffMC*coeffDATA/coeffMC/coeffMC) ) << std::endl; std::cerr << " alpha = " << 1-coeffDATA / coeffMC << " +/- " << sqrt( (errCoeffDATA/coeffMC)*(errCoeffDATA/coeffMC) + (errCoeffMC*coeffDATA/coeffMC/coeffMC)*(errCoeffMC*coeffDATA/coeffMC/coeffMC) ) << std::endl; // TCanvas cResultDistro_1("cResultDistro_1","cResultDistro_1",800,800); // HistoRatioMC_SUM->Draw(); // HistoRatioDATA->Draw("E1same"); // tEle.DrawClone(); // gPad->SetGrid(); // gPad->SetLogy(); }
TCanvas * makegraph() { TCanvas *c1 = new TCanvas(); // OUR DATA Double_t qsq[5]={0.125,0.375,0.625,0.875,1.125};//X-axis! Double_t crosssection[5]={3.32,1.78,0.998,0.601,0.383}; Double_t xer[5]={0.125,0.125,0.125,0.125,0.125}; Double_t pfluxerr[5]={4.2,4.8,5.1,4.5,6.3}; Double_t pmaerr[5]={4.9,11.3,16.2,21.0,20.0}; Double_t pstaterr[5]={0.02,0.02,0.02,0.03,0.05}; Double_t fluxerr[5]; Double_t maerr[5]; Double_t staterr[5]; for(int i=0; i<5; i++) fluxerr[i]=pfluxerr[i]*crosssection[i]*0.01; for(int i=0; i<5; i++) maerr[i]=pmaerr[i]*crosssection[i]*0.01; for(int i=0; i<5; i++) staterr[i]=pstaterr[i]*crosssection[i]; //sum error in quadrature Double_t toterr[5]; for(int i=0; i<5; i++) toterr[i]=sqrt( fluxerr[i]*fluxerr[i] /*+ staterr[i]*staterr[i]*/ + maerr[i]*maerr[i] ); TGraphErrors *gr = new TGraphErrors(5,qsq,crosssection,xer,toterr); //SCIBOONE /* double sciqsq[6] = {0.24,0.294,0.347,0.401,0.454,0.508}; double scicsc[6] = {1.26,0.59,0.35,0.17,0.13,0.05}; double scixerh[6] = {0.0268,0.0268,0.0268,0.0268,0.0268,0.0268}; double scixerl[6] = {0.0268,0.0268,0.0268,0.0268,0.0268,0.0268}; double sciyerh[6] = {0.42,0.14,0.08,0.04,0.04,0.01}; double sciyerl[6] = {0.56,0.19,0.1,0.05,0.08,0.03}; TGraphAsymmErrors *scigr = new TGraphAsymmErrors(6,sciqsq,scicsc,scixerl,scixerh,sciyerl,sciyerh);*/ //MINIBOONE double minqsq[17] = {0.133,0.201,0.268,0.336,0.404,0.472,0.539,0.607,0.674,0.741,0.809,0.877,0.944,1.012,1.079,1.147,1.214}; double mincsc[17] = {3.35,2.95,2.5,2.09,1.75,1.42,1.18,0.92,0.77,0.6,0.49,0.39,0.31,0.28,0.22,0.2,0.14}; double minxer[17] = {0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338}; double minyer[17] = {0.35,0.4,0.42,0.35,0.25,0.23,0.24,0.22,0.22,0.21,0.21,0.22,0.22,0.21,0.14,0.12,0.1}; TGraphErrors *mingr = new TGraphErrors(17,minqsq,mincsc,minxer,minyer); //BNL double bnlqsq[7] = {0.425,0.525,0.625,0.725,0.825,0.925,1.025}; double bnlcsc[7] = {1.65,1.09,0.8,0.65,0.42,0.29,0.2}; double bnlxer[7] = {0.05,0.05,0.05,0.05,0.05,0.05,0.05}; double bnlyer[7] = {0.12,0.09,0.09,0.08,0.08,0.08,0.08}; TGraphErrors *bnlgr = new TGraphErrors(7,bnlqsq,bnlcsc,bnlxer,bnlyer); //Multigraph? maybE? TMultiGraph *mg = new TMultiGraph(); //Draw our data //Systematix // gr->Draw("AP"); gr->SetFillColor(2); gr->SetFillStyle(3001); gr->GetXaxis()->SetTitle("Q^{2} / GeV^{2} "); gr->GetYaxis()->SetTitle("#frac{d#sigma}{dQ^{2}} 10^{-39} cm^{2}GeV^{-2} "); // gr->Draw("a2"); // gr->Draw("p"); //statistical errs too! TGraphErrors *gstaterr = new TGraphErrors(5,qsq,crosssection,xer,staterr); // gstaterr->SetFillColor(4); // gstaterr->SetFillStyle(3001); // gstaterr->Draw("p"); //overlay minib0One mingr->SetFillColor(kBlue); mingr->SetMarkerStyle(20); mingr->SetFillStyle(3004); // mingr->Draw("samea3"); // mingr->Draw("same"); //dont forget about good ol' BNL bnlgr->SetFillColor(kGreen); bnlgr->SetMarkerColor(50); bnlgr->SetFillStyle(3002); //MULTIGRAPH, ASSEMBLE! mg->Add(gr,"a2"); mg->Add(gstaterr,"p"); mg->Add(mingr,"3"); mg->Add(bnlgr,"3"); mg->Draw(); TLegend *leg = new TLegend(0.7,0.9,0.9,0.7); leg->AddEntry(gr, "Systematic Errors","f"); leg->AddEntry(gstaterr, "Statistical Errors","lep"); leg->AddEntry(mingr, "Miniboone","f"); leg->AddEntry(bnlgr, "BNL","f"); leg->Draw(); // bnlgr->SetMarkerColor(kRed); // bnlgr->SetMarkerStyle(20); // bnlgr->Draw("sameP"); // TGraphErrors *gr1 = new TGraphErrors(5,qsq,crosssection,xer,staterr); // gr1->SetMarkerStyle(1); // TGraphErrors *gr2 = new TGraphErrors(5,qsq,crosssection,xer,fluxerr); // gr2->SetMarkerStyle(1); // TGraphErrors *gr3 = new TGraphErrors(5,qsq,crosssection,xer,maerr); // gr3->SetMarkerStyle(1); // // TMultiGraph *g = new TMultiGraph(); // g->Add(gr1); // g->Add(gr2); // g->Draw("AP"); // g->SetTitle("Cross-Section Errors"); // g->GetXaxis()->SetTitle("Q^{2}"); // g->GetYaxis()->SetTitle("#frac{d#sigma}{dQ^{2}}"); // // g->Draw("AP"); return c1; }
void slopevscentrality(){ TFile *f; TH1D* c2_pos[5][2]; TH1D* c2_neg[5][2]; TH1D* ach_hist[5]; TH1D* cbinHist; TGraphErrors* gr_diff; TF1* fit1; double x_centrality[6] = {35, 45, 55, 65, 75, 85}; double y_slope[6]; double statErr[6]; double variance_pos = 0.0; double variance_neg = 0.0; double variance_diff = 0.0; double err_neg[5]; double err_pos[5]; double err_diff[5]; double cmean; double errmean; double sum; for (int n = 0; n <6; ++n) { f = new TFile(Form("../../../rootfiles/slope_vs_centrality/PbPb502_%d.root",n+1)); for (Int_t i = 0; i < 5; i++){ ach_hist[i] = (TH1D*)f->Get(Form("demo/ach_%d",i+1)); c2_pos[i][0] = (TH1D*)f->Get(Form("demo/c2pos_%d_cos",i)); c2_pos[i][1] = (TH1D*)f->Get(Form("demo/c2pos_%d_sin",i)); c2_neg[i][0] = (TH1D*)f->Get(Form("demo/c2neg_%d_cos",i)); c2_neg[i][1] = (TH1D*)f->Get(Form("demo/c2neg_%d_sin",i)); } cbinHist = (TH1D*)f->Get("demo/cbinHist"); double x[5]; double v2_pos[5]; double v2_neg[5]; double v2_diff[5]; double r; for(Int_t i=0; i<5; i++){ x[i]=ach_hist[i]->GetMean(); cmean = c2_pos[i][0] -> GetMean(); v2_pos[i] = sqrt(cmean); errmean = c2_pos[i][0] -> GetMeanError(); variance_pos = (errmean*errmean)/(4*cmean); cmean = c2_neg[i][0] -> GetMean(); v2_neg[i] = sqrt(cmean); errmean = c2_neg[i][0] -> GetMeanError(); variance_neg = (errmean*errmean)/(4*cmean); v2_diff[i] = (v2_neg[i] - v2_pos[i]); sum = v2_pos[i] + v2_neg[i]; variance_diff = variance_pos+variance_neg; //error calculation err_pos[i] = sqrt(variance_pos); err_neg[i] = sqrt(variance_neg); err_diff[i] = sqrt(variance_diff); } gr_diff = new TGraphErrors(5,x,v2_diff,NULL, err_diff); fit1 = new TF1("Linear fitting case 1", "[0]+x*[1]", -0.09, 0.09); gr_diff->Fit(fit1); r = fit1->GetParameter(1); statErr[n] = fit1->GetParError(1); cout << "slope is: " << r << endl; y_slope[n] = r; } double x_alice[] = {5,15,25,35,45,55,65,75}; double y_alice[] = { 0.0188127, 0.0252774, 0.0290478, 0.0315681, 0.0313678, 0.0334533, 0.0326948, 0.027709 }; double alice_statErrors[] = { 0.00276672, 0.00491256, 0.00542907, 0.00499819, 0.00427076, 0.00421142, 0.00436631, 0.00480683 }; double alice_sysminus[] = { 0.003345731066792428, 0.005524736668946313, 0.006157316616294797, 0.00591162859559022, 0.0052989413797474684, 0.0053784097301432885, 0.0054547376184835876, 0.005548288155719744 }; double alice_sysplus[] = { 0.003345731066792428, 0.005524736668946313, 0.006157316616294797, 0.00591162859559022, 0.0052989413797474684, 0.0053784097301432885, 0.0054547376184835876, 0.005548288155719744 }; double xsysalice[] = {1,1,1,1,1,1,1,1}; double x_star[] = {2.5,7.5,15.0,25.0,35.0,45.0,55.0,65.0,75.0}; double y_star[] = {-0.033529,0.001979,0.015917,0.028232,0.031986,0.026516,0.028016,0.012459,-0.02195}; double star_statErrors[] = { 0.0010554, 0.00701, 0.003874, 0.003091, 0.002903, 0.002921, 0.003657, 0.005119, 0.009593 }; double star_sysminus[] = { 2.156594920238847, 1.1474282374074642, 0.41413973487218053, 0.40721102637330436, 0.46464817873311415, 0.48750025641018896, 1.2743975557101481, 0.6065696744810114, 0.9645708786812922 }; double star_sysplus[] = { 3.152323796820371, 1.1348034014753392, 0.6881948851887814, 0.3091, 0.3775553601791398, 0.6362180836788593, 0.39244649316817704, 1.060086081410373, 4.931994052105091 }; double xsysstar[] = {1,1,1,1,1,1,1,1,1}; for(i=0;i<9;i++){ star_sysminus[i]/=100; star_sysplus[i]/=100; } gStyle->SetLegendFont(42); TGraphErrors* slopevscent = new TGraphErrors(6,x_centrality,y_slope,NULL,statErr); TGraphErrors* ALICE = new TGraphErrors(8,x_alice,y_alice,NULL,alice_statErrors); TGraphErrors* STAR = new TGraphErrors(9,x_star,y_star,NULL,star_statErrors); TGraphAsymmErrors* ALICE_sys = new TGraphAsymmErrors(8, x_alice, y_alice, xsysalice, xsysalice, alice_sysminus, alice_sysplus); TGraphAsymmErrors* STAR_sys = new TGraphAsymmErrors(9, x_star, y_star, xsysstar, xsysstar, star_sysminus, star_sysplus); slopevscent -> SetMarkerStyle(20); slopevscent -> SetMarkerColor(kBlack); ALICE -> SetMarkerStyle(25); ALICE -> SetMarkerColor(kRed); ALICE -> SetLineColor(kRed); STAR -> SetMarkerStyle(kOpenStar); STAR -> SetMarkerColor(kBlue); STAR -> SetLineColor(kBlue); TH1D* base = new TH1D("base","base",1,0,100); base->GetYaxis()->SetRangeUser(0.00,0.06); base->GetXaxis()->SetTitle("Centrality(%)"); base->GetYaxis()->SetTitle("Slope parameter(v_{2})"); base->GetXaxis()->CenterTitle(); base->GetYaxis()->CenterTitle(); base->SetTitleSize (0.040,"X"); base->SetTitleOffset(1.4,"X"); base->SetTitleFont (42,"X"); base->SetLabelOffset(0.006,"X"); base->SetLabelSize (0.040,"X"); base->SetLabelFont (42 ,"X"); base->SetTitleSize (0.040,"Y"); base->SetTitleOffset(2.2,"Y"); base->SetTitleFont (42,"Y"); base->SetLabelOffset(0.006,"Y"); base->SetLabelSize (0.040,"Y"); base->SetLabelFont (42 ,"Y"); base->SetLineWidth(0); TCanvas* c3 = MakeCanvas("c3","c3"); TLatex* text_a = makeLatex("CMS pPb #sqrt{s_{NN}}=5.02TeV",0.25,0.85) ; TLatex* text_b = makeLatex("185 #leq N_{trk}^{offline} < 260",0.25,0.80) ; TLatex* text_c = makeLatex("0.3 < p_{T} < 3 GeV/c",0.25,0.85) ; TLatex* text_d = makeLatex("|#Delta#eta| > 2",0.25,0.80) ; text_a->SetTextFont(42); text_b->SetTextFont(42); text_c->SetTextFont(42); text_d->SetTextFont(42); slopevscent->SetFillStyle(0); slopevscent->SetFillColor(0); slopevscent->SetFillStyle(0); slopevscent->SetFillColor(0); gStyle->SetOptTitle(0); TLegend* leg = new TLegend(.58,.70,.93,.90); leg->SetLineColor(kWhite); leg->SetFillColor(0); leg->SetFillStyle(0); leg->AddEntry(slopevscent, "CMS, Pb-Pb 5.02TeV","p"); leg->AddEntry(ALICE, "ALICE, Pb-Pb 2.76TeV","p"); leg->AddEntry(STAR, "STAR, Au-Au 200GeV","p"); //leg->AddEntry(gr_neg, "neg","p"); c3->cd(); base->Draw(""); ALICE->Draw("PSame"); STAR->Draw("PSame"); slopevscent->Draw("PSame"); // STAR_sys->Draw("2Same"); leg->DrawClone("PSame"); // text_c->DrawClone("Same"); // text_d->DrawClone("Same"); //Define a linear function //SaveCanvas(c3,"pics","slopevscent_comparison"); }
void gptoy(){ int n = 100; TRandom3 rand(0); // sampling points double x [n]; for(int i=0; i < n; i++) x[i] = 1.0*i/n; // construct covariance matrix TMatrixD C(n,n); for(int i=0; i < n; i++) for(int j=0; j < n; j++) C[i][j] = kern(x[i],x[j],1); // add small number to diagonal (positive definite) for(int i=0; i < n; i++) C[i][i] += 0.00001; // use Cholesky decomposition to obtain vector distributed as multivariate gaussian TDecompChol D(C); TMatrixD L(n,n); L = D.GetU(); // random rumbers TVectorD u(n); for(int i=0; i < n; i++) u[i] = rand.Gaus(0,1); // result -- random vector TVectorD y(n); y = L*u; // plot /* TGraph *grand = new TGraph(); for(int i=0; i < n; i++){ grand->SetPoint(i, x[i], y[i]); } grand->SetLineWidth(2); grand->Draw("ACP"); */ // // prediction w/ noise-free observables // int m = 6; double t [m]; t[0] = 0.05; t[1] = 0.29; t[2] = 0.31; t[3] = 0.50; t[4] = 0.75; t[5] = 0.95; TVectorD ft(m); ft[0] = 1.0; ft[1] = 1.0; ft[2] = 2.0; ft[3] = 1.0; ft[4] = 1.0; ft[5] = 1.0; TMatrixD K11(m,m); TMatrixD K12(m,n); TMatrixD K21(n,m); TMatrixD K22(n,n); for(int i=0; i < n; i++){ for(int j=0; j < n; j++){ if( i < m and j < m ){ K11[i][j] = kern(t[i],t[j],1); if( i==j ) K11[i][j] += 0.00001; } if( i < m and j < n ){ K12[i][j] = kern(t[i],x[j],1); if( i==j ) K12[i][j] += 0.00001; } if( i < n and j < m ){ K21[i][j] = kern(x[i],t[j],1); if( i==j ) K21[i][j] += 0.00001; } if( i < n and j < n ){ K22[i][j] = kern(x[i],x[j],1); if( i==j ) K22[i][j] += 0.00001; } } } K11[2][2] += 0.1; // use Cholesky decomposition to obtain vector distributed as multivariate gaussian // compute covariance matrix TMatrixD fC(n,n); TMatrixD K11inv(m,m); K11inv = K11; K11inv.Invert(); fC = K22 - K21*K11inv*K12; TDecompChol fD(fC); TMatrixD fL(n,n); fL = fD.GetU(); // // result // TVectorD v(n); TVectorD fy(n); TVectorD fy_err(n); // mean value and error band for(int i=0; i < n; i++) v[i] = 1.0; fy = K21*K11inv*ft; fy_err = fL*v; TGraphErrors *gtest = new TGraphErrors(); for(int i=0; i < n; i++){ gtest->SetPoint(i, x[i], fy[i]); gtest->SetPointError(i, 0.0, fy_err[i]); } TCanvas * canvas = new TCanvas("canvas","canvas",800,800); canvas->cd(); TGraph *gtrain = new TGraph(); for(int i=0; i < m; i++) gtrain->SetPoint(i, t[i], ft[i]); gtest->SetFillStyle(3002); gtest->SetMinimum(-3.5); gtest->SetMaximum(4.5); gtest->Draw("AC3"); gtrain->SetMarkerStyle(20); gtrain->SetMarkerColor(2); gtrain->Draw("P"); canvas->Draw(); return; }
TGraphErrors *ReadMWGraph(const char *name, Int_t flag) { Double_t xreject = 0.49; TGraphErrors *g = new TGraphErrors(name); if (g->IsZombie()) return 0; while (g->GetX()[0] < xreject) g->RemovePoint(0); TGraphErrors *g2 = new TGraphErrors(name); if (g2->IsZombie()) return 0; while (g2->GetX()[0] < xreject) g2->RemovePoint(0); g2->SetMarkerStyle(4); g2->SetMarkerSize(1.00); g2->SetMarkerColor(kBlack); g2->SetLineColor(kBlack); TGraphErrors *gsys = new TGraphErrors(name, "%lg %lg %lg %*lg %lg"); if (gsys->IsZombie()) return 0; while (gsys->GetX()[0] < xreject) gsys->RemovePoint(0); for (Int_t i = 0; i < gsys->GetN(); i++) gsys->SetPointError(i, gsys->GetErrorX(i)*0.75, gsys->GetErrorY(i)); gsys->SetFillColor(kGray+2); gsys->SetLineColor(kGray+2); gsys->SetFillStyle(3000); if (flag == 1 || flag == 3) { TGraphErrors *gt = new TGraphErrors(Form("%s_%s", name, "trues")); if (gt->IsZombie()) return 0; while (gt->GetX()[0] < xreject) gt->RemovePoint(0); gt->SetMarkerStyle(20); gt->SetMarkerSize(0.75); gt->SetMarkerColor(kGreen+1); gt->SetLineColor(kGreen+1); TGraphErrors *gbw = new TGraphErrors(Form("%s_%s", name, "gen")); if (gbw->IsZombie()) return 0; while (gbw->GetX()[0] < xreject) gbw->RemovePoint(0); gbw->SetMarkerStyle(20); gbw->SetMarkerSize(0.75); gbw->SetMarkerColor(kBlue+1); gbw->SetLineColor(kBlue+1); for (Int_t i = 0; i < g->GetN(); i++) { g->SetPointError(i, g->GetEX()[i], 0.); gt->SetPointError(i, gt->GetEX()[i], 0.); gbw->SetPointError(i, gbw->GetEX()[i], 0.); } for (Int_t i = 0; i < g2->GetN(); i++) { g2->SetPoint(i, g2->GetX()[i], g2->GetY()[i] - gt->GetY()[i] + gbw->GetY()[i]); g2->SetPointError(i, g2->GetEX()[i], TMath::Sqrt(g2->GetEY()[i]*g2->GetEY()[i] + gt->GetEY()[i]*gt->GetEY()[i] + gbw->GetEY()[i]*gbw->GetEY()[i])); // g2->SetPoint(i, g2->GetX()[i], g2->GetY()[i] - gt->GetY()[i] + 1.01947); // g2->SetPointError(i, g2->GetEX()[i], TMath::Sqrt(g2->GetEY()[i]*g2->GetEY()[i] + gt->GetEY()[i]*gt->GetEY()[i] + // 7.78680e-06*7.78680e-06)); gsys->SetPoint(i, gsys->GetX()[i], g2->GetY()[i]); } } g->SetTitle(); g->SetName(name); g->GetXaxis()->SetTitle("p_{T}, GeV/c"); g->SetMarkerStyle(20); g->SetMarkerSize(0.95); g->SetMarkerColor(kRed+1); g->SetLineColor(kRed+1); const Double_t mass = 1.019455; const Double_t mass_delta = 0.000020; const Double_t width = 0.00426; const Double_t width_delta = 0.00004; if (flag == 1) { // mass g->GetYaxis()->SetTitleOffset(1.50); g->GetYaxis()->SetTitle("mass, GeV/c^{2}"); g->SetMaximum(mass+0.0015); g->SetMinimum(mass-0.0015); TBox *box = new TBox(g->GetXaxis()->GetXmin(), mass - mass_delta, g->GetXaxis()->GetXmax(), mass + mass_delta); box->SetFillColor(kGray+1); box->SetFillStyle(3001); g->GetListOfFunctions()->Add(box); g->GetListOfFunctions()->Add(g2, "CP"); g->GetListOfFunctions()->Add(gt, "CP"); g->GetListOfFunctions()->Add(gbw, "CP"); } else if (flag == 3) { // mass simple g2->SetTitle(); g2->SetName(Form("%s_only", name)); g2->GetXaxis()->SetTitle("p_{T}, GeV/c"); g2->SetMarkerStyle(20); g2->SetMarkerSize(0.75); g2->SetMarkerColor(kBlack); g2->SetLineColor(kBlack); g2->GetYaxis()->SetTitleOffset(1.50); g2->GetYaxis()->SetTitle("mass, GeV/c^{2}"); g2->SetMaximum(mass+0.0015); g2->SetMinimum(mass-0.0015); TBox *box = new TBox(g->GetXaxis()->GetXmin(), mass - mass_delta, g2->GetXaxis()->GetXmax(), mass + mass_delta); box->SetFillColor(kGray+1); box->SetFillStyle(3001); g2->GetListOfFunctions()->Add(box); g2->GetListOfFunctions()->Add(gsys, "E5"); return g2; } else if (flag == 2) { // width g->SetTitle(); g->SetName(name); g->GetXaxis()->SetTitle("p_{T}, GeV/c"); g->SetMarkerStyle(20); g->SetMarkerSize(0.75); g->SetMarkerColor(kBlack); g->SetLineColor(kBlack); g->GetYaxis()->SetTitleOffset(1.50); g->GetYaxis()->SetTitle("width, GeV/c^{2}"); g->SetMaximum(0.01); g->SetMinimum(0.0); TBox *box = new TBox(g->GetXaxis()->GetXmin(), width - width_delta, g->GetXaxis()->GetXmax(), width + width_delta); box->SetFillColor(kGray+1); box->SetFillStyle(3001); g->GetListOfFunctions()->Add(box); g->GetListOfFunctions()->Add(gsys, "E5"); } return g; }
void gch() { //=========Macro generated from canvas: c1/c1 //========= (Fri Jul 31 19:31:42 2015) by ROOT version6.05/01 TCanvas *c1 = new TCanvas("c1", "c1",0,23,600,600); gStyle->SetOptFit(1); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); c1->Range(-3.5,-0.52,2.75,0.48); c1->SetFillColor(0); c1->SetBorderMode(0); c1->SetBorderSize(2); c1->SetTickx(1); c1->SetTicky(1); c1->SetLeftMargin(0.16); c1->SetRightMargin(0.04); c1->SetTopMargin(0.08); c1->SetBottomMargin(0.12); c1->SetFrameFillStyle(0); c1->SetFrameBorderMode(0); c1->SetFrameFillStyle(0); c1->SetFrameBorderMode(0); Double_t Graph0_fx3005[10] = { 2.2, 1.75, 1.25, 0.75, 0.25, -0.25, -0.75, -1.25, -1.75, -2.2}; Double_t Graph0_fy3005[10] = { 0.271569, 0.242472, 0.199083, 0.16019, 0.13243, 0.113847, 0.0953951, 0.0586208, -0.0317606, -0.192653}; Double_t Graph0_felx3005[10] = { 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.2}; Double_t Graph0_fely3005[10] = { 0.01715884, 0.01580552, 0.01320277, 0.01146985, 0.01194889, 0.007802394, 0.006606392, 0.008837154, 0.01163919, 0.01254774}; Double_t Graph0_fehx3005[10] = { 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.2}; Double_t Graph0_fehy3005[10] = { 0.01245998, 0.01281843, 0.01611579, 0.0123205, 0.009866819, 0.007816985, 0.006595391, 0.007312196, 0.009927339, 0.01381436}; TGraphAsymmErrors *grae = new TGraphAsymmErrors(10,Graph0_fx3005,Graph0_fy3005,Graph0_felx3005,Graph0_fehx3005,Graph0_fely3005,Graph0_fehy3005); grae->SetName("Graph0"); grae->SetTitle("Graph"); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#ffff00"); grae->SetFillColor(ci); ci = TColor::GetColor("#ff0000"); grae->SetLineColor(ci); grae->SetLineWidth(4); grae->SetMarkerStyle(20); grae->SetMarkerSize(0); TH1F *Graph_Graph3005 = new TH1F("Graph_Graph3005","Graph",100,-2.5,2.5); Graph_Graph3005->SetMinimum(-0.4); Graph_Graph3005->SetMaximum(0.4); Graph_Graph3005->SetDirectory(0); Graph_Graph3005->SetStats(0); Graph_Graph3005->SetLineStyle(0); Graph_Graph3005->SetMarkerStyle(20); Graph_Graph3005->GetXaxis()->SetTitle("#eta_{lab}"); Graph_Graph3005->GetXaxis()->SetNdivisions(505); Graph_Graph3005->GetXaxis()->SetLabelFont(42); Graph_Graph3005->GetXaxis()->SetLabelOffset(0.007); Graph_Graph3005->GetXaxis()->SetLabelSize(0.05); Graph_Graph3005->GetXaxis()->SetTitleSize(0.05); Graph_Graph3005->GetXaxis()->SetTitleOffset(1.1); Graph_Graph3005->GetXaxis()->SetTitleFont(42); Graph_Graph3005->GetYaxis()->SetTitle("(N_{#font[12]{l}}^{+}#font[122]{-}N_{#font[12]{l}}^{#font[122]{-}})/(N_{#font[12]{l}}^{+}+N_{#font[12]{l}}^{#font[122]{-}})"); Graph_Graph3005->GetYaxis()->SetLabelFont(42); Graph_Graph3005->GetYaxis()->SetLabelOffset(0.007); Graph_Graph3005->GetYaxis()->SetLabelSize(0.05); Graph_Graph3005->GetYaxis()->SetTitleSize(0.05); Graph_Graph3005->GetYaxis()->SetTitleOffset(1.5); Graph_Graph3005->GetYaxis()->SetTitleFont(42); Graph_Graph3005->GetZaxis()->SetLabelFont(42); Graph_Graph3005->GetZaxis()->SetLabelOffset(0.007); Graph_Graph3005->GetZaxis()->SetLabelSize(0.05); Graph_Graph3005->GetZaxis()->SetTitleSize(0.06); Graph_Graph3005->GetZaxis()->SetTitleFont(42); grae->SetHistogram(Graph_Graph3005); grae->Draw("a2"); Double_t Graph1_fx3006[10] = { 2.2, 1.75, 1.25, 0.75, 0.25, -0.25, -0.75, -1.25, -1.75, -2.2}; Double_t Graph1_fy3006[10] = { 0.271569, 0.242472, 0.199083, 0.16019, 0.13243, 0.113847, 0.0953951, 0.0586208, -0.0317606, -0.192653}; Double_t Graph1_felx3006[10] = { 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.2}; Double_t Graph1_fely3006[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Double_t Graph1_fehx3006[10] = { 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.2}; Double_t Graph1_fehy3006[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; grae = new TGraphAsymmErrors(10,Graph1_fx3006,Graph1_fy3006,Graph1_felx3006,Graph1_fehx3006,Graph1_fely3006,Graph1_fehy3006); grae->SetName("Graph1"); grae->SetTitle("Graph"); ci = TColor::GetColor("#ffff00"); grae->SetFillColor(ci); ci = TColor::GetColor("#ff0000"); grae->SetLineColor(ci); grae->SetLineWidth(4); grae->SetMarkerStyle(20); grae->SetMarkerSize(0); grae->Draw("z"); Double_t Graph2_fx3007[10] = { 2.2, 1.75, 1.25, 0.75, 0.25, -0.25, -0.75, -1.25, -1.75, -2.2}; Double_t Graph2_fy3007[10] = { 0.263377, 0.234428, 0.19231, 0.156091, 0.13209, 0.115851, 0.0964275, 0.0539073, -0.0465022, -0.215376}; Double_t Graph2_felx3007[10] = { 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.2}; Double_t Graph2_fely3007[10] = { 0.01234885, 0.01640988, 0.0211319, 0.009310187, 0.01446852, 0.00468004, 0.01648233, 0.005510343, 0.01817494, 0.0125977}; Double_t Graph2_fehx3007[10] = { 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.2}; Double_t Graph2_fehy3007[10] = { 0.02248654, 0.01201416, 0.008815135, 0.01600505, 0.008127195, 0.01693463, 0.00469466, 0.01880119, 0.008619524, 0.01691905}; grae = new TGraphAsymmErrors(10,Graph2_fx3007,Graph2_fy3007,Graph2_felx3007,Graph2_fehx3007,Graph2_fely3007,Graph2_fehy3007); grae->SetName("Graph2"); grae->SetTitle("Graph"); ci = TColor::GetColor("#009900"); grae->SetFillColor(ci); grae->SetFillStyle(3375); ci = TColor::GetColor("#009900"); grae->SetLineColor(ci); grae->SetLineStyle(7); grae->SetLineWidth(4); grae->SetMarkerStyle(20); TH1F *Graph_Graph3007 = new TH1F("Graph_Graph3007","Graph",100,-2.88,2.88); Graph_Graph3007->SetMinimum(-0.2793574); Graph_Graph3007->SetMaximum(0.3372473); Graph_Graph3007->SetDirectory(0); Graph_Graph3007->SetStats(0); Graph_Graph3007->SetLineStyle(0); Graph_Graph3007->SetMarkerStyle(20); Graph_Graph3007->GetXaxis()->SetLabelFont(42); Graph_Graph3007->GetXaxis()->SetLabelOffset(0.007); Graph_Graph3007->GetXaxis()->SetLabelSize(0.05); Graph_Graph3007->GetXaxis()->SetTitleSize(0.06); Graph_Graph3007->GetXaxis()->SetTitleOffset(1.1); Graph_Graph3007->GetXaxis()->SetTitleFont(42); Graph_Graph3007->GetYaxis()->SetLabelFont(42); Graph_Graph3007->GetYaxis()->SetLabelOffset(0.007); Graph_Graph3007->GetYaxis()->SetLabelSize(0.05); Graph_Graph3007->GetYaxis()->SetTitleSize(0.06); Graph_Graph3007->GetYaxis()->SetTitleOffset(1.5); Graph_Graph3007->GetYaxis()->SetTitleFont(42); Graph_Graph3007->GetZaxis()->SetLabelFont(42); Graph_Graph3007->GetZaxis()->SetLabelOffset(0.007); Graph_Graph3007->GetZaxis()->SetLabelSize(0.05); Graph_Graph3007->GetZaxis()->SetTitleSize(0.06); Graph_Graph3007->GetZaxis()->SetTitleFont(42); grae->SetHistogram(Graph_Graph3007); grae->Draw("2"); Double_t Graph3_fx3008[10] = { 2.2, 1.75, 1.25, 0.75, 0.25, -0.25, -0.75, -1.25, -1.75, -2.2}; Double_t Graph3_fy3008[10] = { 0.263377, 0.234428, 0.19231, 0.156091, 0.13209, 0.115851, 0.0964275, 0.0539073, -0.0465022, -0.215376}; Double_t Graph3_felx3008[10] = { 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.2}; Double_t Graph3_fely3008[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Double_t Graph3_fehx3008[10] = { 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.2}; Double_t Graph3_fehy3008[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; grae = new TGraphAsymmErrors(10,Graph3_fx3008,Graph3_fy3008,Graph3_felx3008,Graph3_fehx3008,Graph3_fely3008,Graph3_fehy3008); grae->SetName("Graph3"); grae->SetTitle("Graph"); ci = TColor::GetColor("#009900"); grae->SetFillColor(ci); grae->SetFillStyle(3375); ci = TColor::GetColor("#009900"); grae->SetLineColor(ci); grae->SetLineStyle(7); grae->SetLineWidth(4); grae->SetMarkerStyle(20); grae->Draw("z"); Double_t Graph4_fx1003[10] = { 2.2, 1.75, 1.25, 0.75, 0.25, -0.25, -0.75, -1.25, -1.75, -2.2}; Double_t Graph4_fy1003[10] = { 0.257652, 0.265253, 0.1771034, 0.1405682, 0.1581285, 0.1047664, 0.09752007, 0.0006272976, -0.1246472, -0.2374407}; Double_t Graph4_fex1003[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Double_t Graph4_fey1003[10] = { 0.04329624, 0.03217318, 0.02801475, 0.02449562, 0.0241582, 0.02436489, 0.02298849, 0.02790282, 0.03243437, 0.04142841}; TGraphErrors *gre = new TGraphErrors(10,Graph4_fx1003,Graph4_fy1003,Graph4_fex1003,Graph4_fey1003); gre->SetName("Graph4"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetFillStyle(0); gre->SetLineWidth(2); gre->SetMarkerStyle(20); gre->Draw("||"); Double_t gch_exp_statonly_1_fx1004[10] = { 2.2, 1.75, 1.25, 0.75, 0.25, -0.25, -0.75, -1.25, -1.75, -2.2}; Double_t gch_exp_statonly_1_fy1004[10] = { 0.257652, 0.265253, 0.1771034, 0.1405682, 0.1581285, 0.1047664, 0.09752007, 0.0006272976, -0.1246472, -0.2374407}; Double_t gch_exp_statonly_1_fex1004[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Double_t gch_exp_statonly_1_fey1004[10] = { 0.01963104, 0.01666601, 0.0164871, 0.01492413, 0.01459851, 0.01543096, 0.01519633, 0.01658993, 0.01884317, 0.02283962}; gre = new TGraphErrors(10,gch_exp_statonly_1_fx1004,gch_exp_statonly_1_fy1004,gch_exp_statonly_1_fex1004,gch_exp_statonly_1_fey1004); gre->SetName("gch_exp_statonly_1"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineWidth(2); gre->SetMarkerStyle(20); gre->SetMarkerSize(1.2); TH1F *Graph_gch_exp_statonly_11004 = new TH1F("Graph_gch_exp_statonly_11004","Graph",100,-2.64,2.64); Graph_gch_exp_statonly_11004->SetMinimum(-0.3145003); Graph_gch_exp_statonly_11004->SetMaximum(0.3361389); Graph_gch_exp_statonly_11004->SetDirectory(0); Graph_gch_exp_statonly_11004->SetStats(0); Graph_gch_exp_statonly_11004->SetLineStyle(0); Graph_gch_exp_statonly_11004->SetMarkerStyle(20); Graph_gch_exp_statonly_11004->GetXaxis()->SetLabelFont(42); Graph_gch_exp_statonly_11004->GetXaxis()->SetLabelOffset(0.007); Graph_gch_exp_statonly_11004->GetXaxis()->SetLabelSize(0.05); Graph_gch_exp_statonly_11004->GetXaxis()->SetTitleSize(0.06); Graph_gch_exp_statonly_11004->GetXaxis()->SetTitleOffset(1.1); Graph_gch_exp_statonly_11004->GetXaxis()->SetTitleFont(42); Graph_gch_exp_statonly_11004->GetYaxis()->SetLabelFont(42); Graph_gch_exp_statonly_11004->GetYaxis()->SetLabelOffset(0.007); Graph_gch_exp_statonly_11004->GetYaxis()->SetLabelSize(0.05); Graph_gch_exp_statonly_11004->GetYaxis()->SetTitleSize(0.06); Graph_gch_exp_statonly_11004->GetYaxis()->SetTitleOffset(1.5); Graph_gch_exp_statonly_11004->GetYaxis()->SetTitleFont(42); Graph_gch_exp_statonly_11004->GetZaxis()->SetLabelFont(42); Graph_gch_exp_statonly_11004->GetZaxis()->SetLabelOffset(0.007); Graph_gch_exp_statonly_11004->GetZaxis()->SetLabelSize(0.05); Graph_gch_exp_statonly_11004->GetZaxis()->SetTitleSize(0.06); Graph_gch_exp_statonly_11004->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_gch_exp_statonly_11004); gre->Draw("pz"); TLegend *leg = new TLegend(0.6,0.15,0.9,0.3,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetTextSize(0.04); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); TLegendEntry *entry=leg->AddEntry("Graph4","Data","p"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(20); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("Graph0","CT10","lf"); ci = TColor::GetColor("#ffff00"); entry->SetFillColor(ci); entry->SetFillStyle(1001); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(4); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("Graph2","CT10+EPS09","lf"); ci = TColor::GetColor("#009900"); entry->SetFillColor(ci); entry->SetFillStyle(3375); ci = TColor::GetColor("#009900"); entry->SetLineColor(ci); entry->SetLineStyle(7); entry->SetLineWidth(4); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); leg->Draw(); TPaveText *pt = new TPaveText(0.6,0.4,0.9,0.5,"brNDC"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetFillStyle(0); pt->SetTextAlign(13); pt->SetTextFont(42); pt->SetTextSize(0.04); TText *AText = pt->AddText("W #rightarrow #font[12]{l} + #nu"); AText = pt->AddText("p_{T}^{#font[12]{l}} > 25 GeV/c"); pt->Draw(); tex = new TLatex(0.96,0.9424," #sqrt{s_{NN}} = 5.02 TeV"); tex->SetNDC(); tex->SetTextAlign(31); tex->SetTextFont(42); tex->SetTextSize(0.04); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.16,0.9424,"pPb 34.6 nb^{-1}"); tex->SetNDC(); tex->SetTextFont(42); tex->SetTextSize(0.04); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.196,0.884,"CMS"); tex->SetNDC(); tex->SetTextAlign(13); tex->SetTextFont(61); tex->SetTextSize(0.048); tex->SetLineWidth(2); tex->Draw(); TH1F *Graph_copy = new TH1F("Graph_copy","Graph",100,-2.5,2.5); Graph_copy->SetMinimum(-0.4); Graph_copy->SetMaximum(0.4); Graph_copy->SetDirectory(0); Graph_copy->SetStats(0); Graph_copy->SetLineStyle(0); Graph_copy->SetMarkerStyle(20); Graph_copy->GetXaxis()->SetTitle("#eta_{lab}"); Graph_copy->GetXaxis()->SetNdivisions(505); Graph_copy->GetXaxis()->SetLabelFont(42); Graph_copy->GetXaxis()->SetLabelOffset(0.007); Graph_copy->GetXaxis()->SetLabelSize(0.05); Graph_copy->GetXaxis()->SetTitleSize(0.05); Graph_copy->GetXaxis()->SetTitleOffset(1.1); Graph_copy->GetXaxis()->SetTitleFont(42); Graph_copy->GetYaxis()->SetTitle("(N_{#font[12]{l}}^{+}#font[122]{-}N_{#font[12]{l}}^{#font[122]{-}})/(N_{#font[12]{l}}^{+}+N_{#font[12]{l}}^{#font[122]{-}})"); Graph_copy->GetYaxis()->SetLabelFont(42); Graph_copy->GetYaxis()->SetLabelOffset(0.007); Graph_copy->GetYaxis()->SetLabelSize(0.05); Graph_copy->GetYaxis()->SetTitleSize(0.05); Graph_copy->GetYaxis()->SetTitleOffset(1.5); Graph_copy->GetYaxis()->SetTitleFont(42); Graph_copy->GetZaxis()->SetLabelFont(42); Graph_copy->GetZaxis()->SetLabelOffset(0.007); Graph_copy->GetZaxis()->SetLabelSize(0.05); Graph_copy->GetZaxis()->SetTitleSize(0.06); Graph_copy->GetZaxis()->SetTitleFont(42); Graph_copy->Draw("sameaxis"); c1->Modified(); c1->cd(); c1->SetSelected(c1); }
/** @ingroup FMD_xsec_script @param scale @param filename @param var @param medName @param thick @param pdgName */ void DrawXsection(Bool_t scale=kFALSE, const char* filename="xsec.root", const char* var="LOSS", const char* medName="FMD_Si$", Double_t thick=.03, const char* pdgName="pi+") { TFile* file = TFile::Open(filename, "READ"); TTree* tree = static_cast<TTree*>(file->Get(Form("%s_%s",medName, pdgName))); TLeaf* tb = tree->GetLeaf("T"); TLeaf* vb = tree->GetLeaf(var); if (!vb) { std::cerr << "Leaf " << var << " not found" << std::endl; return; } Float_t tkine, value; tb->SetAddress(&tkine); vb->SetAddress(&value); Int_t n = tree->GetEntries(); Float_t xscale = 1; Float_t yscale = 1; if (scale) { TDatabasePDG* pdgDb = TDatabasePDG::Instance(); TParticlePDG* pdgP = pdgDb->GetParticle(pdgName); if (!pdgP) { std::cerr << "Couldn't find particle " << pdgName << std::endl; return; } Double_t m = pdgP->Mass(); Double_t q = pdgP->Charge() / 3; if (m == 0 || q == 0) { std::cerr << "Mass is 0" << std::endl; return; } xscale = 1 / m; yscale = 1 / (q * q); } TGraphErrors* graph = new TGraphErrors(n); for (Int_t i = 0; i < n; i++) { tree->GetEntry(i); Double_t x = tkine*xscale; Double_t y = value*yscale; graph->SetPoint(i, x, y); // 5 sigma graph->SetPointError(i, 0, 5 * .1 * y); } TCanvas* c = new TCanvas("c","c"); c->SetLogx(); c->SetLogy(); graph->SetLineWidth(2); graph->SetFillStyle(3001); graph->SetFillColor(6); graph->Draw("L"); graph->DrawClone("AL3"); c->Modified(); c->Update(); c->cd(); c->SaveAs("xsec.C"); }
//void Plot(string observable = string ("NjetsNBjets_0_1.70"), string outname = string("TCHEL")){ void Plot2_main(string observable, string outname){ /* gStyle->SetPadRightMargin(0.13); gStyle->SetPadLeftMargin(0.13); gStyle->SetPadBottomMargin(0.13); */ float SF_trigger_error = 0.015; float SF_Lepton_error = 0.010; float SF_MET_error = 0.016; float SF_bag1_error = 0.01; float SF_bag2_error = 0.02; float systeError_VV = 0.33; float systeError_stop = 0.31; float systeError_ttbar = 0.04; double frac_ee = 0; double frac_mumu = 0; double frac_emu = 0; float lumi_error=0.022; // For the canvas: gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(0); // must be kWhite but I dunno how to do that in PyROOT gStyle->SetCanvasDefH(600); //Height of canvas gStyle->SetCanvasDefW(600); //Width of canvas gStyle->SetCanvasDefX(0); //POsition on screen gStyle->SetCanvasDefY(0); // For the Pad: gStyle->SetPadBorderMode(0); // ROOT . gStyle . SetPadBorderSize(Width_t size = 1); gStyle->SetPadColor(0); // kWhite gStyle->SetPadGridX(0); //false gStyle->SetPadGridY(0); //false gStyle->SetGridColor(0); gStyle->SetGridStyle(3); gStyle->SetGridWidth(1); // For the frame: gStyle->SetFrameBorderMode(0); gStyle->SetFrameBorderSize(1); gStyle->SetFrameFillColor(0); gStyle->SetFrameFillStyle(0); gStyle->SetFrameLineColor(1); gStyle->SetFrameLineStyle(1); gStyle->SetFrameLineWidth(1); // For the histo: // ROOT . gStyle . SetHistFillColor(1); // ROOT . gStyle . SetHistFillStyle(0); gStyle->SetHistLineColor(1); gStyle->SetHistLineStyle(0); gStyle->SetHistLineWidth(1); // ROOT . gStyle . SetLegoInnerR(Float_t rad = 0.5); // ROOT . gStyle . SetNumberContours(Int_t number = 20); gStyle->SetEndErrorSize(2); //ROOT . gStyle . SetErrorMarker(20); /// I COMMENTED THIS OUT //ROOT . gStyle . SetErrorX(0.); //ROOT . gStyle . SetMarkerStyle(20); //For the fit/function: gStyle->SetOptFit(1011); gStyle->SetFitFormat("5.4g"); gStyle->SetFuncColor(2); gStyle->SetFuncStyle(1); gStyle->SetFuncWidth(1); //For the date: gStyle->SetOptDate(0); // ROOT . gStyle . SetDateX(Float_t x = 0.01); // ROOT . gStyle . SetDateY(Float_t y = 0.01); // For the statistics box: gStyle->SetOptFile(0); gStyle->SetOptStat(0); // To display the mean and RMS: SetOptStat("mr"); gStyle->SetStatColor(0); // kWhite gStyle->SetStatFont(42); //ROOT . gStyle . SetStatFontSize(0.025); gStyle->SetStatFontSize(0.04); gStyle->SetStatTextColor(1); gStyle->SetStatFormat("6.4g"); gStyle->SetStatBorderSize(1); gStyle->SetStatH(0.1); gStyle->SetStatW(0.15); // ROOT . gStyle . SetStatStyle(Style_t style = 1001); // ROOT . gStyle . SetStatX(Float_t x = 0); // ROOT . gStyle . SetStatY(Float_t y = 0); // Margins: gStyle->SetPadTopMargin(0.07); gStyle->SetPadBottomMargin(0.13); gStyle->SetPadLeftMargin(0.16); //ROOT . gStyle . SetPadRightMargin(0.12); gStyle->SetPadRightMargin(0.03); // For the Global title: gStyle->SetOptTitle(0); gStyle->SetTitleFont(42); gStyle->SetTitleColor(1); gStyle->SetTitleTextColor(1); gStyle->SetTitleFillColor(10); gStyle->SetTitleFontSize(0.05); // ROOT . gStyle . SetTitleH(0); // Set the height of the title box // ROOT . gStyle . SetTitleW(0); // Set the width of the title box // ROOT . gStyle . SetTitleX(0); // Set the position of the title box // ROOT . gStyle . SetTitleY(0.985); // Set the position of the title box // ROOT . gStyle . SetTitleStyle(Style_t style = 1001); // ROOT . gStyle . SetTitleBorderSize(2); // For the axis titles: gStyle->SetTitleColor(1, "XYZ"); gStyle->SetTitleFont(42, "XYZ"); gStyle->SetTitleSize(0.06, "XYZ"); // ROOT . gStyle . SetTitleXSize(Float_t size = 0.02); // Another way to set the size? // ROOT . gStyle . SetTitleYSize(Float_t size = 0.02); gStyle->SetTitleXOffset(0.9); gStyle->SetTitleYOffset(1.25); // ROOT . gStyle . SetTitleOffset(1.1, "Y"); // Another way to set the Offset // For the axis labels: gStyle->SetLabelColor(1, "XYZ"); gStyle->SetLabelFont(42, "XYZ"); gStyle->SetLabelOffset(0.007, "XYZ"); gStyle->SetLabelSize(0.05, "XYZ"); // For the axis: gStyle->SetAxisColor(1, "XYZ"); gStyle->SetStripDecimals(1); // kTRUE gStyle->SetTickLength(0.03, "XYZ"); gStyle->SetNdivisions(510, "XYZ"); gStyle->SetPadTickX(1); // To get tick marks on the opposite side of the frame gStyle->SetPadTickY(1); // Change for log plots: gStyle->SetOptLogx(0); gStyle->SetOptLogy(0); gStyle->SetOptLogz(0); // Postscript options: gStyle->SetPaperSize(20.,20.); // ROOT . gStyle . SetLineScalePS(Float_t scale = 3); // ROOT . gStyle . SetLineStyleString(Int_t i, const char* text); // ROOT . gStyle . SetHeaderPS(const char* header); // ROOT . gStyle . SetTitlePS(const char* pstitle); // ROOT . gStyle . SetBarOffset(Float_t baroff = 0.5); // ROOT . gStyle . SetBarWidth(Float_t barwidth = 0.5); // ROOT . gStyle . SetPaintTextFormat(const char* format = "g"); // ROOT . gStyle . SetPalette(Int_t ncolors = 0, Int_t* colors = 0); // ROOT . gStyle . SetTimeOffset(Double_t toffset); // ROOT . gStyle . SetHistMinimumZero(kTRUE); //TFile * file = new TFile("templates_proof_with_Wjets.root","OPEN"); TFile * file = new TFile("outfile_Template.root","OPEN"); cout<<"toto"<<endl; vector<pair<string,int> > process; process.push_back(pair<string,int>(string("TTbarSig"),kRed+1)); process.push_back(pair<string,int>(string("TTbarBkg"),kRed-7)); process.push_back(pair<string,int>(string("Wjets"),kGreen-3)); process.push_back(pair<string,int>(string("VV"),13)); process.push_back(pair<string,int>(string("StW"),kMagenta)); process.push_back(pair<string,int>(string("Zjets"),kAzure-2)); process.push_back(pair<string,int>(string("Data"),1)); cout<<"toto"<<endl; vector<string> channels; channels.push_back(string("ee")); channels.push_back(string("emu")); channels.push_back(string("mumu")); cout<<"toto"<<endl; //string observable ("NjetsNBjets_0_1.70"); cout<<"toto"<<endl; /* TH2F* histoEmpty = new TH2F("emtpy","",10,0,10,0,500); histoEmpty->GetXaxis()->SetTitle("(N_{jets},N_{b-tagged jets})"); histoEmpty->GetYaxis()->SetTitle("Events"); histoEmpty->Draw(""); */ TCanvas *c1 = new TCanvas("c1","c1", 1000, 800); c1->SetBottomMargin(0.3); c1->cd(); TH1D* histo1D_ttSig = new TH1D("histo_ttSig","",11, 0, 11); TH1D* histo1D_ttBkg = new TH1D("histo_ttBkg","",11, 0, 11); TH1D* histo1D_VV = new TH1D("histo_VV", "",11, 0, 11); TH1D* histo1D_tW = new TH1D("histo_tW", "",11, 0, 11); TH1D* histo1D_DY = new TH1D("histo_DY", "",11, 0, 11); TH1D* histo1D_Data = new TH1D("histo_Data", "",11, 0, 11); //****************************** //get histograms //****************************** string name = "ee_NjetsNBjets_6_0.244_TTbarSig"; TH2D* histo2D_ee_ttSig = (TH2D*) file->Get(name.c_str()); name = "ee_NjetsNBjets_6_0.244_TTbarBkg"; TH2D* histo2D_ee_ttBkg = (TH2D*) file->Get(name.c_str()); name = "ee_NjetsNBjets_6_0.244_VV"; TH2D* histo2D_ee_VV = (TH2D*) file->Get(name.c_str()); name = "ee_NjetsNBjets_6_0.244_StW"; TH2D* histo2D_ee_tW = (TH2D*) file->Get(name.c_str()); name = "ee_NjetsNBjets_6_0.244_Zjets"; TH2D* histo2D_ee_Zjets = (TH2D*) file->Get(name.c_str()); name = "ee_NjetsNBjets_6_0.244_Data"; TH2D* histo2D_ee_Data = (TH2D*) file->Get(name.c_str()); name = "mumu_NjetsNBjets_6_0.244_TTbarSig"; TH2D* histo2D_mumu_ttSig = (TH2D*) file->Get(name.c_str()); name = "mumu_NjetsNBjets_6_0.244_TTbarBkg"; TH2D* histo2D_mumu_ttBkg = (TH2D*) file->Get(name.c_str()); name = "mumu_NjetsNBjets_6_0.244_VV"; TH2D* histo2D_mumu_VV = (TH2D*) file->Get(name.c_str()); name = "mumu_NjetsNBjets_6_0.244_StW"; TH2D* histo2D_mumu_tW = (TH2D*) file->Get(name.c_str()); name = "mumu_NjetsNBjets_6_0.244_Zjets"; TH2D* histo2D_mumu_Zjets = (TH2D*) file->Get(name.c_str()); name = "mumu_NjetsNBjets_6_0.244_Data"; TH2D* histo2D_mumu_Data = (TH2D*) file->Get(name.c_str()); name = "emu_NjetsNBjets_6_0.244_TTbarSig"; TH2D* histo2D_emu_ttSig = (TH2D*) file->Get(name.c_str()); name = "emu_NjetsNBjets_6_0.244_TTbarBkg"; TH2D* histo2D_emu_ttBkg = (TH2D*) file->Get(name.c_str()); name = "emu_NjetsNBjets_6_0.244_VV"; TH2D* histo2D_emu_VV = (TH2D*) file->Get(name.c_str()); name = "emu_NjetsNBjets_6_0.244_StW"; TH2D* histo2D_emu_tW = (TH2D*) file->Get(name.c_str()); name = "emu_NjetsNBjets_6_0.244_Zjets"; TH2D* histo2D_emu_Zjets = (TH2D*) file->Get(name.c_str()); name = "emu_NjetsNBjets_6_0.244_Data"; TH2D* histo2D_emu_Data = (TH2D*) file->Get(name.c_str()); histo2D_ee_Zjets->Scale(220./histo2D_ee_Zjets->Integral()); histo2D_emu_Zjets->Scale(136./histo2D_emu_Zjets->Integral()); histo2D_mumu_Zjets->Scale(217./histo2D_mumu_Zjets->Integral()); histo2D_ee_ttBkg->Scale(9./histo2D_ee_ttBkg->Integral()); histo2D_emu_ttBkg->Scale(86./histo2D_emu_ttBkg->Integral()); histo2D_mumu_ttBkg->Scale(15./histo2D_mumu_ttBkg->Integral()); histo2D_ee_ttSig->Scale(1.44); histo2D_ee_VV->Scale(1.044); histo2D_ee_tW->Scale(1.044); histo2D_emu_ttSig->Scale(1.044); histo2D_emu_VV->Scale(1.044); histo2D_emu_tW->Scale(1.044); histo2D_mumu_ttSig->Scale(1.044); histo2D_mumu_VV->Scale(1.044); histo2D_mumu_tW->Scale(1.044); frac_ee += histo2D_ee_Zjets->Integral(); frac_mumu+= histo2D_emu_Zjets->Integral(); frac_emu += histo2D_mumu_Zjets->Integral(); frac_ee = frac_ee/( frac_ee+frac_mumu+frac_emu); frac_mumu = frac_mumu/(frac_ee+frac_mumu+frac_emu); frac_emu = frac_emu/( frac_ee+frac_mumu+frac_emu); histo2D_ee_ttSig->Add( histo2D_ee_ttSig, histo2D_mumu_ttSig, 1, 1); histo2D_ee_ttSig->Add( histo2D_ee_ttSig, histo2D_emu_ttSig, 1, 1); histo2D_ee_ttBkg->Add( histo2D_ee_ttBkg, histo2D_mumu_ttBkg, 1, 1); histo2D_ee_ttBkg->Add( histo2D_ee_ttBkg, histo2D_emu_ttBkg , 1, 1); histo2D_ee_Zjets->Add( histo2D_ee_Zjets, histo2D_mumu_Zjets, 1, 1); histo2D_ee_Zjets->Add( histo2D_ee_Zjets, histo2D_emu_Zjets , 1, 1); histo2D_ee_VV->Add( histo2D_ee_VV, histo2D_mumu_VV, 1, 1); histo2D_ee_VV->Add( histo2D_ee_VV, histo2D_emu_VV , 1, 1); histo2D_ee_tW->Add( histo2D_ee_tW, histo2D_mumu_tW, 1, 1); histo2D_ee_tW->Add( histo2D_ee_tW, histo2D_emu_tW , 1, 1); histo2D_ee_Data->Add( histo2D_ee_Data, histo2D_mumu_Data, 1, 1); histo2D_ee_Data->Add( histo2D_ee_Data, histo2D_emu_Data , 1, 1); //****************************** //create 1D histograms //****************************** TH1D* histo1D = new TH1D("histo","",11,0,11); histo1D->GetXaxis()->SetBinLabel(1,string("(2,0)").c_str()); histo1D->GetXaxis()->SetBinLabel(2,string("(2,1)").c_str()); histo1D->GetXaxis()->SetBinLabel(3,string("(2,2)").c_str()); histo1D->GetXaxis()->SetBinLabel(4,string("(3,0)").c_str()); histo1D->GetXaxis()->SetBinLabel(5,string("(3,1)").c_str()); histo1D->GetXaxis()->SetBinLabel(6,string("(3,2)").c_str()); histo1D->GetXaxis()->SetBinLabel(7,string("(3,3)").c_str()); histo1D->GetXaxis()->SetBinLabel(8,string("(#geq4,0)").c_str()); histo1D->GetXaxis()->SetBinLabel(9,string("(#geq4,1)").c_str()); histo1D->GetXaxis()->SetBinLabel(10,string("(#geq4,2)").c_str()); histo1D->GetXaxis()->SetBinLabel(11,string("(#geq4,#geq3)").c_str()); //histo1D->SetLineColor(0); histo1D->GetXaxis()->SetTitle("(N_{jets},N_{btagjets})"); histo1D->GetYaxis()->SetTitle("Number of Events"); histo1D->GetYaxis()->SetRangeUser(0.,2500.); histo1D_Data->GetXaxis()->SetBinLabel(1,string("(2,0)").c_str()); histo1D_Data->GetXaxis()->SetBinLabel(2,string("(2,1)").c_str()); histo1D_Data->GetXaxis()->SetBinLabel(3,string("(2,2)").c_str()); histo1D_Data->GetXaxis()->SetBinLabel(4,string("(3,0)").c_str()); histo1D_Data->GetXaxis()->SetBinLabel(5,string("(3,1)").c_str()); histo1D_Data->GetXaxis()->SetBinLabel(6,string("(3,2)").c_str()); histo1D_Data->GetXaxis()->SetBinLabel(7,string("(3,3)").c_str()); histo1D_Data->GetXaxis()->SetBinLabel(8,string("(#geq4,0)").c_str()); histo1D_Data->GetXaxis()->SetBinLabel(9,string("(#geq4,1)").c_str()); histo1D_Data->GetXaxis()->SetBinLabel(10,string("(#geq4,2)").c_str()); histo1D_Data->GetXaxis()->SetBinLabel(11,string("(#geq4,#geq3)").c_str()); //histo1D->SetLineColor(0); histo1D_Data->GetXaxis()->SetTitle("(N_{jets},N_{btagjets})"); histo1D_Data->GetYaxis()->SetTitle("Number of Events"); histo1D_Data->GetYaxis()->SetRangeUser(0.,2500.); for(int ibin = 3; ibin <6; ibin++){ int max = 4; if(ibin>3) max = 5; for(int jbin = 1; jbin<max;jbin++){ double bin1D = (ibin-3)*3+jbin; histo1D_ttSig->SetBinContent(bin1D, histo2D_ee_ttSig->GetBinContent(ibin,jbin)); histo1D_ttBkg->SetBinContent( bin1D, histo2D_ee_ttBkg->GetBinContent(ibin,jbin) ); histo1D_VV->SetBinContent( bin1D, histo2D_ee_VV->GetBinContent(ibin,jbin) ); histo1D_tW->SetBinContent( bin1D, histo2D_ee_tW->GetBinContent(ibin,jbin) ); histo1D_DY->SetBinContent( bin1D, histo2D_ee_Zjets->GetBinContent(ibin,jbin) ); histo1D_Data->SetBinContent( bin1D, histo2D_ee_Data->GetBinContent(ibin,jbin) ); } } //****************************** //add histograms //****************************** /* histo1D_ee_TTbarSig->Add(histo1D_ee_TTbarSig, histo1D_mumu_TTbarSig, 1, 1); histo1D_ee_TTbarSig->Add(histo1D_ee_TTbarSig, histo1D_emu_TTbarSig, 1, 1); histo1D_ee_ttBk->Add(histo1D_ee_ttBkg, histo1D_mumu_ttBkg, 1, 1); histo1D_ee_ttBk->Add(histo1D_ee_ttBkg, histo1D_emu_ttBkg, 1, 1); histo1D_ee_VV->Add(histo1D_ee_VV, histo1D_mumu_VV, 1, 1); histo1D_ee_VV->Add(histo1D_ee_VV, histo1D_emu_VV, 1, 1); histo1D_ee_tW->Add(histo1D_ee_tW, histo1D_mumu_tW, 1, 1); histo1D_ee_tW->Add(histo1D_ee_tW, histo1D_emu_tW, 1, 1); histo1D_ee_DY->Add(histo1D_ee_DY, histo1D_mumu_DY, 1, 1); histo1D_ee_DY->Add(histo1D_ee_DY, histo1D_emu_DY, 1, 1); histo1D_ee_Data->Add(histo1D_ee_Data, histo1D_mumu_Data, 1, 1); histo1D_ee_Data->Add(histo1D_ee_Data, histo1D_emu_Data, 1, 1); */ TH1D* histo1D_mc = (TH1D*) histo1D_ttSig->Clone(); histo1D_mc->Add(histo1D_mc, histo1D_ttBkg ,1, 1); histo1D_mc->Add(histo1D_mc, histo1D_VV ,1, 1); histo1D_mc->Add(histo1D_mc, histo1D_tW ,1, 1); histo1D_mc->Add(histo1D_mc, histo1D_DY ,1, 1); TH1F * lumiband = (TH1F*) histo1D_mc->Clone(); for (int ilum=0; ilum<lumiband->GetNbinsX(); ilum++) { double error_all = pow( histo1D_ttSig->GetBinContent(ilum+1)*lumi_error, 2)+ //************************* //uncertinty on trigger eff pow(histo1D_ttSig->GetBinContent(ilum+1)*SF_trigger_error, 2)+ //************************* //uncertinty on lepton sel pow(histo1D_ttSig->GetBinContent(ilum+1)*SF_Lepton_error, 2)+ //************************* //uncertinty on met sel pow( histo1D_ttSig->GetBinContent(ilum+1)*SF_MET_error, 2); error_all += pow(histo1D_ttSig->GetBinContent(ilum+1)*systeError_ttbar, 2); if(ilum > 2) error_all += pow(histo1D_ttSig->GetBinContent(ilum+1)*0.01, 2); if(ilum > 6) error_all += pow(histo1D_ttSig->GetBinContent(ilum+1)*0.02, 2); error_all += pow(histo1D_VV->GetBinContent(ilum+1)*systeError_VV, 2); error_all += pow(histo1D_tW->GetBinContent(ilum+1)*systeError_stop, 2); //************************* //uncertinty on met sel if(ilum < 5) pow( histo1D_ttSig->GetBinContent(ilum+1)*0.02, 2); if(ilum >= 5 && ilum < 8) pow( histo1D_ttSig->GetBinContent(ilum+1)*0.03, 2); if(ilum >= 8) pow( histo1D_ttSig->GetBinContent(ilum+1)*0.04, 2); //frac_ee = frac_ee/ (frac_ee+frac_mumu+frac_emu); //frac_mumu = frac_mumu/(frac_ee+frac_mumu+frac_emu); //frac_emu = frac_emu/ (frac_ee+frac_mumu+frac_emu); //cout << "frac_ee " << frac_ee << endl; //cout << "frac_mumu " << frac_mumu << endl; //cout << "frac_emu " << frac_emu << endl; error_all += pow(histo1D_DY->GetBinContent(ilum+1)*((0.40/1.9281)*frac_ee + (0.37/1.82219)*frac_mumu+ (0.30/1.38872)*frac_emu), 2); lumiband->SetBinError(ilum+1,sqrt(error_all)); //modifications histo1D_mc->SetBinError(ilum+1,sqrt(error_all)); } TGraphErrors *thegraph = new TGraphErrors(lumiband); thegraph->SetFillStyle(3005); thegraph->SetFillColor(1); histo1D_ttSig->SetFillStyle(1001); histo1D_ttBkg->SetFillStyle(1001); histo1D_DY->SetFillStyle(1001); histo1D_VV->SetFillStyle(1001); histo1D_tW->SetFillStyle(1001); histo1D_ttSig->SetFillColor(kRed+1); histo1D_ttBkg->SetFillColor(kRed-7); histo1D_DY->SetFillColor(kAzure-2); histo1D_VV->SetFillColor(13); histo1D_tW->SetFillColor(kMagenta); histo1D_ttSig->GetYaxis()->CenterTitle(); histo1D_ttSig->GetYaxis()->SetTitle(""); histo1D_ttSig->GetXaxis()->SetLabelSize(0); histo1D_ttSig->GetXaxis()->SetTitleSize(0); histo1D_ttBkg->GetYaxis()->CenterTitle(); histo1D_ttBkg->GetYaxis()->SetTitle(""); histo1D_ttBkg->GetXaxis()->SetLabelSize(0); histo1D_ttBkg->GetXaxis()->SetTitleSize(0); histo1D_VV->GetYaxis()->CenterTitle(); histo1D_VV->GetYaxis()->SetTitle(""); histo1D_VV->GetXaxis()->SetLabelSize(0); histo1D_VV->GetXaxis()->SetTitleSize(0); histo1D_tW->GetYaxis()->CenterTitle(); histo1D_tW->GetYaxis()->SetTitle(""); histo1D_tW->GetXaxis()->SetLabelSize(0); histo1D_tW->GetXaxis()->SetTitleSize(0); histo1D_DY->GetYaxis()->CenterTitle(); histo1D_DY->GetYaxis()->SetTitle(""); histo1D_DY->GetXaxis()->SetLabelSize(0); histo1D_DY->GetXaxis()->SetTitleSize(0); THStack* hs= new THStack(); hs->Add(histo1D_ttSig); hs->Add(histo1D_ttBkg); //hs->Add(histo_Wjets); hs->Add(histo1D_VV); hs->Add(histo1D_tW); hs->Add(histo1D_DY); for (int ibin=0; ibin<lumiband->GetNbinsX(); ibin++) { //hs->GetXaxis()->SetBinLabel(ibin+1, ""); } //hs->GetXaxis()->SetLabelSize(0.); histo1D_Data->GetXaxis()->SetTitle(""); histo1D_Data->GetYaxis()->SetTitle(""); histo1D_Data->GetYaxis()->CenterTitle(); histo1D_Data->GetYaxis()->SetTitle(""); histo1D_Data->GetXaxis()->SetLabelSize(0); histo1D_Data->GetXaxis()->SetTitleSize(0); histo1D_Data->SetMarkerStyle(20); histo1D->SetMaximum(2000); histo1D->SetMinimum(0); hs->SetMaximum(2000); TH1D* histo_ratio = (TH1D*) histo1D_Data->Clone(); histo1D_Data->GetYaxis()->CenterTitle(); histo1D_Data->GetYaxis()->SetTitle(""); histo1D_Data->GetXaxis()->SetLabelSize(0); histo1D_Data->GetXaxis()->SetTitleSize(0); /*histo1D_mc- >GetYaxis()->CenterTitle(); histo1D_mc->GetYaxis()->SetTitle(""); histo1D_mc->GetXaxis()->SetLabelSize(0); histo1D_mc->GetXaxis()->SetTitleSize(0); */ histo1D->GetYaxis()->CenterTitle(); histo1D->GetYaxis()->SetTitle(""); histo1D->GetXaxis()->SetLabelSize(0); histo1D->GetXaxis()->SetTitleSize(0); histo_ratio->GetYaxis()->SetLabelSize(0.1);histo_ratio->GetYaxis()->SetLabelSize(0.1); histo1D->Draw(); hs->Draw(); for (int ibin=0; ibin<lumiband->GetNbinsX(); ibin++) { hs->GetXaxis()->SetBinLabel(ibin+1, ""); } hs->GetXaxis()->SetLabelSize(0.0); hs->GetYaxis()->SetLabelSize(0.04); histo_ratio->GetYaxis()->SetLabelSize(0.1); histo1D->Draw("epsame"); histo1D_Data->SetMarkerSize(1.2); histo1D_Data->Draw("epsame"); //histo1D_Data->Draw(""); thegraph->Draw("e2same"); histo1D->Draw("same"); TLatex *latex = new TLatex(); latex->SetNDC(); latex->SetTextSize(0.04); latex->SetTextAlign(31); latex->DrawLatex(0.45, 0.95, " "); TLatex *latex2 = new TLatex(); latex2->SetNDC(); latex2->SetTextSize(0.04); latex2->SetTextAlign(31); latex2->DrawLatex(0.87, 0.95, "CMS 2.3 fb^{-1} at #sqrt{s} = 7 TeV"); TString info_data = "ee, #mu#mu, e#mu channels"; TLatex* text2 = new TLatex(0.45,0.98, info_data); text2->SetNDC(); text2->SetTextAlign(13); text2->SetX(0.18); text2->SetY(0.92); //text2->SetLineWidth(2); text2->SetTextFont(42); text2->SetTextSize(0.0610687); // text2->SetTextSizePixels(24);// dflt=28 text2->Draw(); TLegend* qw = new TLegend(.80,.60,.95,.90); qw->SetShadowColor(0); qw->SetFillColor(0); qw->SetLineColor(0); // qw->SetHeader("CMS Preliminary, 881.8 pb^{-1}"); // qw->AddEntry(histo_Data, info_data, "p"); qw->AddEntry(histo1D_Data, "Data" , "ep"); qw->AddEntry(histo1D_DY, "DY " ,"f"); qw->AddEntry(histo1D_tW, "tW " ,"f"); qw->AddEntry(histo1D_VV, "VV " ,"f"); //qw->AddEntry(histo_Wjets, "W " ,"f"); //qw->AddEntry(histo_TTbarBkg, "t#bar{t} other " ,"f"); qw->AddEntry(histo1D_ttBkg, "non-prompt lepton " ,"f"); qw->AddEntry(histo1D_ttSig, "t#bar{t} signal " ,"f"); qw->SetFillColor(0); qw->SetTextFont(42); qw->Draw(); TPad *canvas_2 = new TPad("canvas_2", "canvas_2", 0.0, 0.0, 1.0, 1.0); canvas_2->SetTopMargin(0.7); canvas_2->SetFillColor(0); canvas_2->SetFillStyle(0); canvas_2->SetGridy(1); canvas_2->Draw(); canvas_2->cd(0); //gPad->SetBottomMargin(0.375); //gPad->SetGridy(); //cout << " 721 histo_ratio->GetTitle() " << histo_ratio->GetXaxis()->GetTitle() << endl;; //TH1D* histo_ratio = (TH1D*) histo1D_Data->Clone(); histo_ratio->SetTitle(""); histo_ratio->SetMarkerStyle(20); histo_ratio->SetMarkerSize(1.2); histo_ratio->SetMaximum( 1.5 ); histo_ratio->SetMinimum(0.5); histo_ratio->GetYaxis()->SetTitle(""); histo_ratio->GetXaxis()->SetLabelSize(0.04); histo_ratio->GetYaxis()->SetLabelSize(0.03); histo_ratio->GetYaxis()->SetNdivisions(6); histo_ratio->GetYaxis()->SetTitleSize(0.03); histo_ratio->SetMarkerSize(1.2); //histo_ratio->GetYaxis()->SetNdivisions(5); //ratio.Draw("e") histo_ratio->Divide(histo1D_mc); histo_ratio->SetMinimum(0.5); histo_ratio->SetMaximum(1.5); histo_ratio->Draw("E1X0"); c1->cd(); }
void plotOFVZsub(TString var, int nb, float min, float max, bool norm, TString mycut, int njets, TString fs) { gROOT->Reset(); gStyle->SetOptStat(0); TString dir = "/smurf/cerati/skims/Run2012_Summer12_SmurfV9_53X/test/skim_dy/"; TChain *ph = new TChain("tree"); ph->Add(dir+"./dyll.root"); TFile *_da = TFile::Open(dir+"./data.root"); TTree* da = (TTree*) _da->Get("tree"); TFile *_zz = TFile::Open(dir+"./zz.root"); TTree* zz = (TTree*) _zz->Get("tree"); TFile *_wz = TFile::Open(dir+"./wz.root"); TTree* wz = (TTree*) _wz->Get("tree"); TFile *_hw = TFile::Open(dir+"./hww125.root"); TTree* hw = (TTree*) _hw->Get("tree"); TH1F* h_zz = new TH1F("h_zz","h_zz",nb,min,max); TH1F* h_wz = new TH1F("h_wz","h_wz",nb,min,max); TH1F* h_dy = new TH1F("h_dy","h_dy",nb,min,max); TH1F* h_da = new TH1F("h_da","h_da",nb,min,max); TH1F* h_of = new TH1F("h_of","h_of",nb,min,max); TH1F* h_hw = new TH1F("h_hw","h_hw",nb,min,max); h_dy->SetFillColor(kGreen); h_of->SetFillColor(kRed); h_zz->SetFillColor(kBlue); h_wz->SetFillColor(kBlue); h_da->SetMarkerStyle(20); h_da->SetLineWidth(2); h_hw->SetLineColor(kCyan); h_hw->SetLineWidth(2); float lumi = 11.9; float lumicorr = 1.04; float dysf = 1.0; float dyer = 1.0; if (njets==0) dysf = 10.75; if (njets==1) dysf = 7.68; if (njets==0) dyer = 0.11; if (njets==1) dyer = 0.11; TString Met20 = Form("((cuts & 4719111)==4719111)&&njets==%i&&lep1.pt()>20.&&lep2.pt()>10.&&(dstype!=0 || (cuts & 1073741824)==1073741824) && met>20 && dilep.mass()>12. && min(pmet,pTrackMet)>20. && mt>80. && dilep.pt()>45.",njets); TString cut = Met20; TString minmet = " && min(pmet,pTrackMet)>45. && (jet1.pt()<15 || dPhiDiLepJet1<165.*TMath::Pi()/180. )"; TString dymva = " && ((njets==0 && dymva>0.88) || (njets==1 && dymva>0.84))"; if (mycut.Contains("Zp")) cut+="&& abs(dilep.mass()-91)<7.5"; if (mycut.Contains("oZ")) cut+="&& abs(dilep.mass()-91)>15"; if (mycut.Contains("ptll45")) { cut+="&& dilep.pt()>45."; Met20+="&& dilep.pt()>45."; } if (mycut.Contains("DyMva")) cut+=dymva; if (mycut.Contains("MetGt45")) cut+=minmet; if (mycut.Contains("MetLt45")) cut+="&& min(pmet,pTrackMet)<45."; if (mycut.Contains("mll70")) cut+="&& dilep.mass()<70."; if (mycut.Contains("metsig25")) cut+="&& met/sqrt(sumet)<2.5"; if (mycut.Contains("Mva05")) cut+="&& dymva>0.5"; if (mycut.Contains("Mva02")) cut+="&& dymva>0.2"; if (mycut.Contains("HiPU")) cut+="&& nvtx>=10"; if (mycut.Contains("LoPU")) cut+="&& nvtx<10"; if (mycut.Contains("HWW125")) { cut+="&& lep1.pt()>23 && lep2.pt()>10 && dPhi<100.*TMath::Pi()/180. && mt>80 && mt<123"+dymva; if (njets==0) dysf = 8.40; if (njets==1) dysf = 1.0; if (njets==0) dyer = 2.87/8.40; if (njets==1) dyer = 1.0; } if (mycut.Contains("HWW145")) { cut+="&& lep1.pt()>25 && lep2.pt()>15 && dPhi<90.*TMath::Pi()/180. && mt>80 && mt<130"+dymva; if (njets==0) dysf = 7.42; if (njets==1) dysf = 3.1; if (njets==0) dyer = 1.71/7.42; if (njets==1) dyer = 0.5; } if (mycut.Contains("HWW150")) { cut+="&& lep1.pt()>27 && lep2.pt()>25 && dPhi<90.*TMath::Pi()/180. && mt>80 && mt<150"+dymva; if (njets==0) dysf = 15.78; if (njets==1) dysf = 2.8; if (njets==0) dyer = 4.20/15.78; if (njets==1) dyer = 0.5; } if (mycut.Contains("HWW160")) { cut+="&& lep1.pt()>30 && lep2.pt()>25 && dPhi<60.*TMath::Pi()/180. && mt>90 && mt<160"+dymva; if (njets==0) dysf = 11.85; if (njets==1) dysf = 3.3; if (njets==0) dyer = 4.65/11.85; if (njets==1) dyer = 0.4; } if (mycut.Contains("HWW170")) { cut+="&& lep1.pt()>34 && lep2.pt()>25 && dPhi<60.*TMath::Pi()/180. && mt>110 && mt<170"+dymva; if (njets==0) dysf = 5.50; if (njets==1) dysf = 3.8; if (njets==0) dyer = 3.62/5.50; if (njets==1) dyer = 0.4; } if (mycut.Contains("HWW180")) { cut+="&& lep1.pt()>36 && lep2.pt()>25 && dPhi<70.*TMath::Pi()/180. && mt>120 && mt<180"+dymva; if (njets==0) dysf = 1.0; if (njets==1) dysf = 5.0; if (njets==0) dyer = 1.0; if (njets==1) dyer = 0.4; } if (mycut.Contains("HWW190")) { cut+="&& lep1.pt()>38 && lep2.pt()>25 && dPhi<90.*TMath::Pi()/180. && mt>120 && mt<190"+dymva; if (njets==0) dysf = 11.78; if (njets==1) dysf = 5.2; if (njets==0) dyer = 4.12/11.78; if (njets==1) dyer = 0.4; } if (mycut.Contains("HWW200")) { cut+="&& lep1.pt()>40 && lep2.pt()>25 && dPhi<100.*TMath::Pi()/180. && mt>120 && mt<200"+dymva; if (njets==0) dysf = 10.18; if (njets==1) dysf = 4.9; if (njets==0) dyer = 3.10/10.18; if (njets==1) dyer = 0.4; } TString sf = "(type==0 || type==3)"; TString of = "(type==1 || type==2)"; if (fs=="mm") { sf = "type==0"; of = "type==1"; } else if (fs=="ee") { sf = "type==3"; of = "type==2"; } TString cutsf = "("+cut+"&&"+sf+")"; TString cutof = "("+cut+"&&"+of+")"; TString cutmc = "scale1fb*sfWeightPU*sfWeightTrig*sfWeightEff*"+cutsf; cout << cutmc << endl; TCanvas c1; //c1.SetLogy(); zz->Draw(var+">>h_zz",cutmc); wz->Draw(var+">>h_wz",cutmc); ph->Draw(var+">>h_dy",cutmc); da->Draw(var+">>h_da",cutsf); da->Draw(var+">>h_of",cutof); hw->Draw(var+">>h_hw","scale1fb*sfWeightPU*sfWeightTrig*sfWeightEff*("+Met20+"&&"+sf+")"); cout << h_dy->GetEntries() << endl; //add h_wz->Scale(lumi); h_zz->Scale(lumi); h_dy->Scale(lumi*dysf); h_of->Scale(lumicorr); h_hw->Scale(lumi); THStack hs("hs","stack"); hs.Add(h_of); hs.Add(h_zz); hs.Add(h_wz); hs.Add(h_dy); TH1F* herr = new TH1F("herr","herr",nb,min,max); for (int bin=1;bin<max+1;bin++) { herr->SetBinContent(bin, ((TH1*)(hs.GetStack()->Last()))->GetBinContent(bin) ); herr->SetBinError(bin,sqrt( pow(0.15*h_wz->GetBinContent(bin),2) + pow(0.15*h_wz->GetBinContent(bin),2) + h_of->GetBinContent(bin) + dyer*h_dy->GetBinContent(bin) ) ); } TGraphErrors* gerr = new TGraphErrors(herr); gerr->SetFillColor(kBlack); gerr->SetFillStyle(3244); var.ReplaceAll(".",""); var.ReplaceAll("(",""); var.ReplaceAll(")",""); h_da->GetYaxis()->SetRangeUser(0.05,1.2*TMath::Max(h_da->GetBinContent(h_da->GetMaximumBin()), ((TH1*)(hs.GetStack()->Last()))->GetBinContent(((TH1*)(hs.GetStack()->Last()))->GetMaximumBin()) ));//3* h_da->GetXaxis()->SetTitle(var); h_da->SetTitle(""); if (!norm) { h_da->Draw("PE"); hs.Draw("same"); h_da->Draw("PE,same"); //h_hw->Draw("same"); gerr->Draw("2"); } else { h_da->Sumw2(); h_da->DrawNormalized("PE"); hs.DrawNormalized("same"); //h_hw->DrawNormalized("same"); } TLegend* leg = new TLegend(0.1,0.91,0.9,0.96); /*if (var.Contains("dPhi")) { delete leg; leg = new TLegend(0.55,0.11,0.88,0.31); }*/ leg->SetFillColor(kWhite); leg->SetNColumns(5); leg->SetLineWidth(0); leg->SetLineColor(kWhite); leg->SetShadowColor(kWhite); leg->AddEntry(h_da,"SF data","p"); leg->AddEntry(h_dy,Form("%2.1f x DY MC",dysf),"f"); leg->AddEntry(h_of,"OF data","f"); leg->AddEntry(h_wz,"VZ MC","f"); //leg->AddEntry(h_hw,"HWW120","l"); leg->Draw(); c1.RedrawAxis(); if (var.Contains("/")) var.ReplaceAll("/",""); var = var+Form("_%ij",njets); gSystem->Exec("mkdir -p "+mycut+Form("_%ij_",njets)+fs); if (!norm) c1.SaveAs(mycut+Form("_%ij_",njets)+fs+"/"+var+".png"); else c1.SaveAs(mycut+Form("_%ij_",njets)+fs+"/"+var+"_norm.png"); }
void MidRapAnalysis() { //Set up Canvas Area TCanvas* can2 = new TCanvas("can2", "Centrality"); double xAverage[] = {3.42, 2.62, 1.96, 1.45, 1.12, .87, .67, .49, .39, .28, .23}; double yAverage[] = {5.22, 3.33, 2.21, 1.40, 1.06, .72, .49, .22, .16, .06, .03}; double yError[] = {.36, .25, .12, .06, .01, .12, .04, .03, .01, .01, 0}; double xError[] = {0,0,0,0,0,0,0,0,0,0}; TGraphErrors* Emodel = new TGraphErrors(10, xAverage, yAverage, xError, yError); Emodel->SetFillStyle(3001); Emodel->SetFillColor(kBlue); double xAverageE[] = {4.19, 2.92, 2.03, 1.40, 1.04, .77, .57, .42, .32, .24}; double yAverageE[] = {5.39, 3.36, 2.14, 1.33, .90, .56, .37, .16, .14, .01}; double yErrorE[] = {.31, .24, .08, .07, .01, .01, .02, .06, .07, .01}; double xErrorE[] = {0,0,0,0,0,0,0,0,0,0}; TGraphErrors* EmodelE = new TGraphErrors(10, xAverageE, yAverageE, xErrorE, yErrorE); EmodelE->SetFillStyle(3001); EmodelE->SetFillColor(kGreen); can2->cd(); TH1F* frame = can2->DrawFrame(0, 0, 3.5, 7.2); TF1* line = new TF1("line", "x", 0, 4.3); TF1* line2 = new TF1("line2", "1.6*x", 0, 4.3); line2->SetLineColor(kWhite); line->SetLineColor(1); line2->GetYaxis()->SetTitle("#varUpsilon(1S)/<#varUpsilon(1S)>"); // line2->GetXaxis()->SetTitle("N_{Ch}^{|#eta|<2.4}/<N_{Ch}^{|#eta|<2.4}>"); line2->SetTitle("#varUpsilon(1S) Cross Section vs Event Activity"); line2->Draw(); Emodel->Draw("P3"); EmodelE->Draw("3"); //line2->Draw("same"); line->SetLineStyle(3); line->SetLineColor(kBlack); line->Draw("same"); TH1D* mod = new TH1D("mod", "Pythia Model", 400, 0, 4); mod->SetLineColor(kBlue); TH1D* modEnergy = new TH1D("modEnergy", "Pythia Energy Model", 400, 0, 4); modEnergy->SetLineColor(kGreen); TH1D* data = new TH1D("data", "CMS Data", 4000, 0, 4); data->SetMarkerStyle(20); data->SetMarkerColor(kRed); //Manually Entering CMS Data Points with Error data->SetBinContent(3262, 6.67); data->SetBinError(3262, .26); data->SetBinContent(2010, 3.12); data->SetBinError(2010, .15); data->SetBinContent(1240, 1.4); data->SetBinError(1240, .06); data->SetBinContent(630, .240); data->SetBinError(630, .01); //data->SetMarkerColor(kBlue); data->SetMarkerSize(1); data->SetLineColor(kRed); data->Draw("sameE"); TLegend* leg = new TLegend(.1,.7,.38,.9); leg->SetHeader("For |#eta| < 2.4"); leg->AddEntry(modEnergy->DrawCopy("same"), "Pythia 8 - #Sigma E_{T}/<#Sigma E_{T}>", "l"); leg->AddEntry(mod->DrawCopy("same"), "Pythia 8 - N_{Ch}/<N_{Ch}>", "l"); leg->AddEntry(data->DrawCopy("sameE"), "CMS data - N_{Ch}/<N_{Ch}>", "l"); leg->Draw("same"); mod->SetLineColor(kBlack); mod->Draw("same"); return; }
void profileDistributions(TString dist) { gStyle->SetOptStat(0); gStyle->SetOptTitle(0); gStyle->SetPalette(1); TFile *inF=TFile::Open("~/work/top_539/plotter.root"); TFile *inSystF=TFile::Open("~/work/top_539/plotter_syst.root"); bool isPhi(dist.Contains("phi")); TString profs[]={dist, dist+"toward", dist+"transverse", dist+"away"}; const size_t nprofs= isPhi ? 1 : sizeof(profs)/sizeof(TString); Int_t colors[]={1,kBlue,kRed,kGreen-3}; TString cats[]={"inclusive","away","transverse","toward"}; /* TFile *inNomF=inF; TString nomTTbar="t#bar{t}"; TString nomTTbarTitle="MG+PY"; //TString systList[]={"t#bar{t}systmcatnlo"}; //TString systLabels[]={"MC@NLO+HW"}; //TString systList[]={"t#bar{t}systq2down","t#bar{t}systq2up"}; //TString systLabels[]={"-Q^{2}","+Q^{2}"}; //TString systList[]={"t#bar{t}systmepsdown","t#bar{t}systmepsup"}; // TString systLabels[]={"-ME-PS","+ME-PS"}; */ TFile *inNomF=inSystF; TString nomTTbar="t#bar{t}systtunep11"; TString nomTTbarTitle="P11"; TString systList[]={"t#bar{t}systtunep11nocr","t#bar{t}systtunep11tev"}; TString systLabels[]={"P11-noCR","P11TeV"}; Int_t systColors[]={1,kAzure,kRed-6,kGreen+3}; const size_t nSysts=sizeof(systList)/sizeof(TString); TString ch[]={"emu"}; const size_t nch=sizeof(ch)/sizeof(TString); for(size_t ich=0; ich<nch; ich++) { TCanvas *c=new TCanvas("c"+ch[ich]+dist,"c"+ch[ich]+dist,800,800); c->SetTopMargin(0); c->SetBottomMargin(0); c->Divide(1,nprofs); TCanvas *cratios=new TCanvas("cratios"+ch[ich]+dist,"cratios"+ch[ich]+dist,800,800); cratios->SetTopMargin(0); cratios->SetBottomMargin(0); cratios->Divide(1,nprofs); TCanvas *cproj=new TCanvas("cproj"+ch[ich]+dist,"cproj"+ch[ich]+dist,600,600); TLegend *dataprojLeg=new TLegend(0.5,0.9,0.6,0.7,"Data","brNDC"); TLegend *mcprojLeg=new TLegend(0.7,0.9,0.92,0.7,"MC","brNDC"); for(size_t i=0; i<nprofs; i++) { TH2 *bckgMC = (TH2 *) inF->Get("Z#rightarrow ll/"+ch[ich]+"_"+profs[i]); bckgMC->Add( (TH2 *) inF->Get("VV/"+ch[ich]+"_"+profs[i]) ); bckgMC->Add( (TH2 *) inF->Get("Single top/"+ch[ich]+"_"+profs[i]) ); bckgMC->Add( (TH2 *) inF->Get("W+jets-multijets/"+ch[ich]+"_"+profs[i]) ); //build the total MC with signal alternatives TH2 *MC = (TH2 *) inNomF->Get(nomTTbar+"/"+ch[ich]+"_"+profs[i]) ; Double_t totalTTbar(MC->Integral()); MC->Add(bckgMC); MC->SetDirectory(0); MC->Sumw2(); std::vector<TH2 *> systMC; for(size_t isyst=0; isyst<nSysts; isyst++) { TH2F *h=(TH2F *)inSystF->Get(systList[isyst]+"/"+ch[ich]+"_"+profs[i]) ; h->Scale(totalTTbar/h->Integral()); h->Add(bckgMC); h->Sumw2(); h->SetDirectory(0); systMC.push_back(h); } //get the data TH2 *Data = (TH2 *) inF->Get("data/"+ch[ich]+"_"+profs[i]); Data->SetDirectory(0); Data->Sumw2(); TGraphErrors *MCProf = new TGraphErrors(MC->ProfileX()); MCProf->SetMarkerStyle(24); MCProf->SetFillStyle(0); MCProf->SetName(ch[ich]+profs[i]+"mc"); TGraphErrors *DataProf = new TGraphErrors(Data->ProfileX()); DataProf->SetMarkerStyle(20); DataProf->SetFillStyle(0); DataProf->SetName(ch[ich]+profs[i]+"data"); //build data/MC scale factors std::vector<TGraphErrors *> data2mcProfs; for(size_t isyst=0; isyst<=systMC.size(); isyst++) { TGraphErrors *prof= (isyst==0 ? MCProf : new TGraphErrors(systMC[isyst-1]->ProfileX())); TString baseName(ch[ich]+profs[i]); if(isyst) baseName += systList[isyst]; prof = (TGraphErrors *) prof->Clone(baseName+"data2mc"); for(int ip=0; ip<DataProf->GetN(); ip++) { Double_t x,y,ydata,y_err,ydata_err; prof->GetPoint(ip,x,y); y_err=prof->GetErrorY(ip); DataProf->GetPoint(ip,x,ydata); ydata_err=DataProf->GetErrorY(ip); if(y<=0) continue; prof->SetPoint(ip,x,ydata/y); prof->SetPointError(ip,0,sqrt(pow(ydata*y_err,2)+pow(ydata_err*y,2))/pow(y,2)); } prof->SetFillColor(systColors[isyst]); prof->SetFillStyle(3001+isyst%2); prof->SetTitle( isyst==0 ? nomTTbarTitle : systLabels[isyst-1] ); //prof->SetMarkerStyle(24); prof->SetFillStyle(3001); prof->SetMarkerColor(1+isyst); prof->SetMarkerColor(1+isyst); prof->SetLineColor(1+isyst); data2mcProfs.push_back(prof); } TH1D *MCProjY=MC->ProjectionY(); MCProjY->Scale(1./MCProjY->Integral()); TGraphErrors *MCProj = new TGraphErrors(MCProjY); MCProj->SetMarkerStyle(24); MCProj->SetFillStyle(0); MCProj->SetName(ch[ich]+profs[i]+"projmc"); TH1D *DataProjY=Data->ProjectionY(); DataProjY->Scale(1./DataProjY->Integral()); TGraphErrors *DataProj = new TGraphErrors(DataProjY); DataProj->SetMarkerStyle(20); DataProj->SetFillStyle(0); DataProj->SetName(ch[ich]+profs[i]+"projdata"); MCProj->SetLineColor(colors[i]); MCProj->SetMarkerColor(colors[i]); MCProj->SetFillColor(colors[i]); MCProj->SetFillStyle(1001); DataProj->SetLineColor(colors[i]); DataProj->SetMarkerColor(colors[i]); DataProj->SetFillColor(colors[i]); TPad *p=(TPad *)cproj->cd(); p->SetLeftMargin(0.15); p->SetRightMargin(0.02); p->SetTopMargin(0.05); p->SetLogy(); MCProj->SetFillStyle(0); MCProj->Draw(i==0 ? "al3" : "l3"); MCProj->GetYaxis()->SetRangeUser(1e-5,1.0); MCProj->GetXaxis()->SetTitle( MC->GetYaxis()->GetTitle() ); MCProj->GetYaxis()->SetTitle( "1/N dN/dx" ); MCProj->GetYaxis()->SetTitleOffset(1.8); DataProj->Draw("p"); std::pair<float,int> chi2=computeChiSquareFor(DataProj,MCProj); char buf[200]; sprintf(buf,"#scale[0.7]{#chi^{2}/ndof=%3.1f}", chi2.first/chi2.second ); dataprojLeg->AddEntry(DataProj,buf,"p"); mcprojLeg->AddEntry(MCProj,cats[i],"l"); if(i==0) drawCMSHeader(ch[ich]); p=(TPad *)c->cd(i+1); if(i<nprofs-1) p->SetBottomMargin(0.01); if(i>0) p->SetTopMargin(0); if(i==0)p->SetTopMargin(0.1); if(i==nprofs-1) p->SetBottomMargin(0.15); TGraphErrors *frame=DataProf; frame->Draw("ap"); //frame->GetYaxis()->SetRangeUser(0.54,1.46); frame->GetXaxis()->SetTitle(MC->GetXaxis()->GetTitle()); //frame->GetXaxis()->SetRangeUser(0,4.75); TString yTit("<"); yTit+=MC->GetYaxis()->GetTitle(); yTit +=">"; frame->GetYaxis()->SetTitle(yTit); frame->GetYaxis()->SetLabelSize(0.07); frame->GetYaxis()->SetTitleSize(0.09); frame->GetYaxis()->SetTitleOffset(0.5); frame->GetXaxis()->SetLabelSize(0.07); frame->GetXaxis()->SetTitleSize(0.09); frame->GetXaxis()->SetTitleOffset(0.7); //p->SetGridy(); //DataProf->Draw("p"); MCProf->Draw("p"); if(i==0) { drawCMSHeader(ch[ich],0.08); TLegend *leg=new TLegend(0.6,0.95,1.0,0.99); leg->SetBorderSize(0); leg->SetFillStyle(0); leg->SetTextFont(42); leg->SetTextSize(0.09); leg->AddEntry(DataProf,"data","p"); leg->AddEntry(MCProf,"simulation","p"); leg->SetNColumns(2); leg->Draw(); } TPaveText *pt=new TPaveText(0.15,0.5,0.8,0.85,"brNDC"); pt->SetBorderSize(0); pt->SetFillStyle(0); pt->SetTextAlign(13); pt->SetTextFont(42); pt->SetTextColor(kBlue); pt->SetTextSize(0.08); pt->AddText("[ "+cats[i]+" ]"); if(i==0) { pt->AddText("p_{T}>0.5 GeV"); pt->AddText("|#eta|<2.1"); } pt->Draw(); p=(TPad *) cratios->cd(i+1); if(i<nprofs-1) p->SetBottomMargin(0.01); if(i>0) p->SetTopMargin(0); if(i==0)p->SetTopMargin(0.1); if(i==nprofs-1) p->SetBottomMargin(0.15); frame=data2mcProfs[0]; frame->Draw("a3"); TLine *l=new TLine(frame->GetXaxis()->GetXmin(),1,frame->GetXaxis()->GetXmax(),1); l->Draw(); frame->GetYaxis()->SetRangeUser(0.54,1.46); frame->GetXaxis()->SetTitle(MC->GetXaxis()->GetTitle()); frame->GetYaxis()->SetTitle("Data/Simulation"); frame->GetYaxis()->SetLabelSize(0.07); frame->GetYaxis()->SetTitleSize(0.09); frame->GetYaxis()->SetTitleOffset(0.5); frame->GetXaxis()->SetLabelSize(0.07); frame->GetXaxis()->SetTitleSize(0.09); frame->GetXaxis()->SetTitleOffset(0.7); //p->SetGridy(); for(size_t ip=1; ip<data2mcProfs.size(); ip++) data2mcProfs[ip]->Draw("3"); if(i==0) { drawCMSHeader(ch[ich],0.08); TLegend *leg=new TLegend(0.6,0.94,1.0,0.98); leg->SetBorderSize(0); leg->SetFillStyle(0); leg->SetTextFont(42); leg->SetTextSize(0.09); leg->SetNColumns(data2mcProfs.size()); for(size_t ip=0; ip<data2mcProfs.size(); ip++) leg->AddEntry(data2mcProfs[ip],data2mcProfs[ip]->GetTitle(),"f"); leg->Draw(); } pt=new TPaveText(0.12,0.65,0.8,0.9,"brNDC"); pt->SetBorderSize(0); pt->SetFillStyle(0); pt->SetTextAlign(13); pt->SetTextFont(42); pt->SetTextColor(kBlue); pt->SetTextSize(0.08); pt->AddText("[ "+cats[i]+" ]"); if(i==0) { pt->AddText("p_{T}>0.5 GeV"); pt->AddText("|#eta|<2.1"); } pt->Draw(); } cproj->cd(); dataprojLeg->SetFillStyle(0); dataprojLeg->SetBorderSize(0); dataprojLeg->SetTextFont(42); dataprojLeg->SetTextSize(0.03); dataprojLeg->Draw(); mcprojLeg->SetFillStyle(0); mcprojLeg->SetBorderSize(0); mcprojLeg->SetTextFont(42); mcprojLeg->SetTextSize(0.03); mcprojLeg->Draw(); TString pf(".png"); c->SaveAs(outDir+c->GetName()+pf); cproj->SaveAs(outDir+cproj->GetName()+pf); cratios->SaveAs(outDir+cratios->GetName()+pf); } inF->Close(); inSystF->Close(); }
void Pythia8_Dijet30_result_JER_akPu4PF_(abs(refeta)<2)&&(hiBin>60)_refpt() { //=========Macro generated from canvas: Can_result_3/ //========= (Mon Apr 18 03:09:33 2016) by ROOT version6.02/13 TCanvas *Can_result_3 = new TCanvas("Can_result_3", "",18,40,700,500); gStyle->SetOptFit(1); Can_result_3->Range(-2.301397,-0.01150186,237.5545,0.3828568); Can_result_3->SetFillColor(0); Can_result_3->SetBorderMode(0); Can_result_3->SetBorderSize(2); Can_result_3->SetFrameBorderMode(0); Can_result_3->SetFrameBorderMode(0); TMultiGraph *multigraph = new TMultiGraph(); multigraph->SetName("name"); multigraph->SetTitle("JER_akPu4PF"); Double_t Graph_fx1007[11] = { 45, 55, 65, 75, 85, 95, 105, 115, 130, 150, 180}; Double_t Graph_fy1007[11] = { 0.1976721, 0.1639212, 0.1562002, 0.1480066, 0.1479035, 0.1333827, 0.1160421, 0.1205967, 0.1105508, 0.08141581, 0.09210746}; Double_t Graph_fex1007[11] = { 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 20}; Double_t Graph_fey1007[11] = { 0.001003849, 0.001317066, 0.001658995, 0.002251738, 0.003095601, 0.004152981, 0.005688263, 0.008277583, 0.006320737, 0.01258781, 0.01599127}; TGraphErrors *gre = new TGraphErrors(11,Graph_fx1007,Graph_fy1007,Graph_fex1007,Graph_fey1007); gre->SetName("Graph"); gre->SetTitle("some title_0"); gre->SetFillColor(1); gre->SetFillStyle(0); TH1F *Graph_Graph1007 = new TH1F("Graph_Graph1007","some title_0",100,24,216); Graph_Graph1007->SetMinimum(0.0558432); Graph_Graph1007->SetMaximum(0.2116608); Graph_Graph1007->SetDirectory(0); Graph_Graph1007->SetStats(0); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#000099"); Graph_Graph1007->SetLineColor(ci); Graph_Graph1007->GetXaxis()->SetLabelFont(42); Graph_Graph1007->GetXaxis()->SetLabelSize(0.035); Graph_Graph1007->GetXaxis()->SetTitleSize(0.035); Graph_Graph1007->GetXaxis()->SetTitleFont(42); Graph_Graph1007->GetYaxis()->SetLabelFont(42); Graph_Graph1007->GetYaxis()->SetLabelSize(0.035); Graph_Graph1007->GetYaxis()->SetTitleSize(0.035); Graph_Graph1007->GetYaxis()->SetTitleFont(42); Graph_Graph1007->GetZaxis()->SetLabelFont(42); Graph_Graph1007->GetZaxis()->SetLabelSize(0.035); Graph_Graph1007->GetZaxis()->SetTitleSize(0.035); Graph_Graph1007->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1007); multigraph->Add(gre,""); Double_t Graph_fx1008[10] = { 33.60148, 40.66353, 49.20982, 59.5523, 72.06846, 87.21514, 105.5452, 127.7278, 154.5724, 187.059}; Double_t Graph_fy1008[10] = { 0.3165438, 0.2200061, 0.1916064, 0.1736762, 0.1550799, 0.1417295, 0.1352239, 0.1191096, 0.1233824, 0.06176231}; Double_t Graph_fex1008[10] = { 3.19525, 3.8668, 4.67949, 5.66299, 6.85317, 8.29351, 10.03657, 12.14595, 14.6987, 17.7879}; Double_t Graph_fey1008[10] = { 0.01253682, 0.005719637, 0.004019816, 0.005043033, 0.006710735, 0.008656837, 0.01379847, 0.02334296, 0.03556038, 0.01948799}; gre = new TGraphErrors(10,Graph_fx1008,Graph_fy1008,Graph_fex1008,Graph_fey1008); gre->SetName("Graph"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetFillStyle(0); gre->SetLineColor(2); gre->SetMarkerColor(2); TH1F *Graph_Graph1008 = new TH1F("Graph_Graph1008","Graph",100,12.96216,222.291); Graph_Graph1008->SetMinimum(0.01359369); Graph_Graph1008->SetMaximum(0.3577612); Graph_Graph1008->SetDirectory(0); Graph_Graph1008->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1008->SetLineColor(ci); Graph_Graph1008->GetXaxis()->SetLabelFont(42); Graph_Graph1008->GetXaxis()->SetLabelSize(0.035); Graph_Graph1008->GetXaxis()->SetTitleSize(0.035); Graph_Graph1008->GetXaxis()->SetTitleFont(42); Graph_Graph1008->GetYaxis()->SetLabelFont(42); Graph_Graph1008->GetYaxis()->SetLabelSize(0.035); Graph_Graph1008->GetYaxis()->SetTitleSize(0.035); Graph_Graph1008->GetYaxis()->SetTitleFont(42); Graph_Graph1008->GetZaxis()->SetLabelFont(42); Graph_Graph1008->GetZaxis()->SetLabelSize(0.035); Graph_Graph1008->GetZaxis()->SetTitleSize(0.035); Graph_Graph1008->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1008); multigraph->Add(gre,""); multigraph->Draw("AP"); multigraph->GetXaxis()->SetTitle("refpt"); multigraph->GetXaxis()->SetLabelFont(42); multigraph->GetXaxis()->SetLabelSize(0.035); multigraph->GetXaxis()->SetTitleSize(0.035); multigraph->GetXaxis()->SetTitleFont(42); multigraph->GetYaxis()->SetTitle("#sigma_{Reco./Gen.}"); multigraph->GetYaxis()->SetLabelFont(42); multigraph->GetYaxis()->SetLabelSize(0.035); multigraph->GetYaxis()->SetTitleSize(0.035); multigraph->GetYaxis()->SetTitleFont(42); TLegend *leg = new TLegend(0.65,0.7,0.85,0.85,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); TLegendEntry *entry=leg->AddEntry("Graph","allJets","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("Graph","from chris","l"); entry->SetLineColor(2); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); leg->Draw(); TLatex * tex = new TLatex(0.35,0.8,"#bf{#color[2]{|#eta_{jet}|<2.0}}"); tex->SetNDC(); tex->SetTextFont(43); tex->SetTextSize(26); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.17,0.25,"Centrality:30-100%"); tex->SetNDC(); tex->SetTextFont(43); tex->SetTextSize(26); tex->SetLineWidth(2); tex->Draw(); TPaveText *pt = new TPaveText(0.3743391,0.9365254,0.6256609,0.995,"blNDC"); pt->SetName("title"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetFillStyle(0); pt->SetTextFont(42); AText = pt->AddText("JER_akPu4PF"); pt->Draw(); Can_result_3->Modified(); Can_result_3->cd(); Can_result_3->SetSelected(Can_result_3); }
MatrixMethod_Results_PullTest_EMu(string selection, string eventType){ float NjetsMin = -0.5; float NjetsMax = 5.5; gROOT->SetStyle("Plain"); gStyle->SetOptStat(0); TFile * file_Expected = new TFile("MatrixMethod_OutPut_EMuCase_MC_Fast_PullTest.root"); TFile * file_Estimated = new TFile("MatrixMethod_OutPut_EMuCase_MC_Fast_PullTest.root"); file_Expected->cd(); TH1F* tt_TTDilept = (TH1F*)gROOT->FindObject("MMExpected_TTEMu_TTbarSignal"); TH1F* tl_TTDilept = (TH1F*)gROOT->FindObject("MMExpected_TLEMu_TTbarSignal"); TH1F* lt_TTDilept = (TH1F*)gROOT->FindObject("MMExpected_LTEMu_TTbarSignal"); TH1F* ll_TTDilept = (TH1F*)gROOT->FindObject("MMExpected_LLEMu_TTbarSignal"); tt_TTDilept->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); tl_TTDilept->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); lt_TTDilept->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); ll_TTDilept->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); TH1F* tt_TTSemi_TF = (TH1F*)gROOT->FindObject("MMExpected_TTEMu_TTbarSemileptonic_TF"); TH1F* tl_TTSemi_TF = (TH1F*)gROOT->FindObject("MMExpected_TLEMu_TTbarSemileptonic_TF"); TH1F* lt_TTSemi_TF = (TH1F*)gROOT->FindObject("MMExpected_LTEMu_TTbarSemileptonic_TF"); TH1F* ll_TTSemi_TF = (TH1F*)gROOT->FindObject("MMExpected_LLEMu_TTbarSemileptonic_TF"); tt_TTSemi_TF->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); tl_TTSemi_TF->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); lt_TTSemi_TF->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); ll_TTSemi_TF->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); TH1F* tt_TTSemi_FT = (TH1F*)gROOT->FindObject("MMExpected_TTEMu_TTbarSemileptonic_FT"); TH1F* tl_TTSemi_FT = (TH1F*)gROOT->FindObject("MMExpected_TLEMu_TTbarSemileptonic_FT"); TH1F* lt_TTSemi_FT = (TH1F*)gROOT->FindObject("MMExpected_LTEMu_TTbarSemileptonic_FT"); TH1F* ll_TTSemi_FT = (TH1F*)gROOT->FindObject("MMExpected_LLEMu_TTbarSemileptonic_FT"); tt_TTSemi_FT->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); tl_TTSemi_FT->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); lt_TTSemi_FT->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); ll_TTSemi_FT->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); TH1F* tt_TTBckg = (TH1F*)gROOT->FindObject("MMExpected_TTEMu_TTbar"); TH1F* tl_TTBckg = (TH1F*)gROOT->FindObject("MMExpected_TLEMu_TTbar"); TH1F* lt_TTBckg = (TH1F*)gROOT->FindObject("MMExpected_LTEMu_TTbar"); TH1F* ll_TTBckg = (TH1F*)gROOT->FindObject("MMExpected_LLEMu_TTbar"); tt_TTBckg->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); tl_TTBckg->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); lt_TTBckg->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); ll_TTBckg->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); tt_TTDilept->SetFillColor(kRed+1); tl_TTDilept->SetFillColor(kRed+1); lt_TTDilept->SetFillColor(kRed+1); ll_TTDilept->SetFillColor(kRed+1); tt_TTSemi_TF->SetFillColor(kRed-7); tl_TTSemi_TF->SetFillColor(kRed-7); lt_TTSemi_TF->SetFillColor(kRed-7); ll_TTSemi_TF->SetFillColor(kRed-7); tt_TTSemi_FT->SetFillColor(kRed-4); tl_TTSemi_FT->SetFillColor(kRed-4); lt_TTSemi_FT->SetFillColor(kRed-4); ll_TTSemi_FT->SetFillColor(kRed-4); tt_TTBckg->SetFillColor(kRed-7); tl_TTBckg->SetFillColor(kRed-7); lt_TTBckg->SetFillColor(kRed-7); ll_TTBckg->SetFillColor(kRed-7); THStack* ttSignalLike = new THStack("ttSignalLike","tt signal like"); ttSignalLike->Add(tt_TTDilept); THStack* tlSignalLike = new THStack("tlSignalLike","tl signal like"); tlSignalLike->Add(tl_TTDilept); THStack* ltSignalLike = new THStack("ltSignalLike","lt signal like"); ltSignalLike->Add(lt_TTDilept); THStack* llSignalLike = new THStack( "llSignalLike", "ll signal like"); llSignalLike->Add(ll_TTDilept); THStack* ttWLike = new THStack( "ttWLike"," tt W-like" ); ttWLike->Add(tt_TTSemi_TF); ttWLike->Add(tt_TTSemi_FT); THStack* tlWLike = new THStack("tlWLike","tl W-like"); tlWLike->Add(tl_TTSemi_TF); tlWLike->Add(lt_TTSemi_FT); THStack* ltWLike = new THStack( "ltWLike", "lt W-like" ); ltWLike->Add(lt_TTSemi_TF); ltWLike->Add(tl_TTSemi_FT); THStack* llWLike = new THStack( "llWLike", "ll W-like" ); llWLike->Add(ll_TTSemi_TF); llWLike->Add(ll_TTSemi_FT); THStack* ttQCDLike = new THStack("ttQCDLike", "tt QCD-like" ); ttQCDLike->Add(tt_TTBckg); THStack* tlQCDLike = new THStack("tlQCDLike","tl QCD-like"); tlQCDLike->Add(tl_TTBckg); THStack* ltQCDLike = new THStack("ltQCDLike","lt QCD-like"); ltQCDLike->Add(lt_TTBckg); THStack* llQCDLike = new THStack("llQCDLike", "ll QCD-like" ); llQCDLike->Add(ll_TTBckg); file_Estimated->cd(); TH1F* estimate_LL_QCD = (TH1F*)gROOT->FindObject("MMEstimated_LLEMu_FF" ); TH1F* estimate_TT_QCD = (TH1F*)gROOT->FindObject("MMEstimated_TTEMu_FF" ); TH1F* estimate_TL_QCD = (TH1F*)gROOT->FindObject("MMEstimated_TLEMu_FF"); TH1F* estimate_LT_QCD = (TH1F*)gROOT->FindObject("MMEstimated_LTEMu_FF"); estimate_LL_QCD->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); estimate_TT_QCD->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); estimate_TL_QCD->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); estimate_LT_QCD->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); // Be careful, here TF and FT estimates are added together to give WJets-like estimate TH1F* estimate_LL_TF = (TH1F*)gROOT->FindObject("MMEstimated_LLEMu_TF" ); TH1F* estimate_TT_TF = (TH1F*)gROOT->FindObject("MMEstimated_TTEMu_TF" ); TH1F* estimate_LT_TF = (TH1F*)gROOT->FindObject("MMEstimated_LTEMu_TF"); TH1F* estimate_TL_TF = (TH1F*)gROOT->FindObject("MMEstimated_TLEMu_TF"); TH1F* estimate_LL_WJets = (TH1F*)gROOT->FindObject("MMEstimated_LLEMu_FT" ); TH1F* estimate_TT_WJets = (TH1F*)gROOT->FindObject("MMEstimated_TTEMu_FT" ); TH1F* estimate_LT_WJets = (TH1F*)gROOT->FindObject("MMEstimated_LTEMu_FT"); TH1F* estimate_TL_WJets = (TH1F*)gROOT->FindObject("MMEstimated_TLEMu_FT"); estimate_LL_WJets->Add(estimate_LL_TF, estimate_LL_WJets, 1, 1); estimate_TT_WJets->Add(estimate_TT_TF, estimate_TT_WJets, 1, 1); estimate_LT_WJets->Add(estimate_LT_TF, estimate_LT_WJets, 1, 1); estimate_TL_WJets->Add(estimate_TL_TF, estimate_TL_WJets, 1, 1); /////// estimate_LL_WJets->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); estimate_TT_WJets->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); estimate_LT_WJets->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); estimate_TL_WJets->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); TH1F* estimate_LL_Signal = (TH1F*)gROOT->FindObject("MMEstimated_LLEMu_TT" ); TH1F* estimate_TT_Signal = (TH1F*)gROOT->FindObject("MMEstimated_TTEMu_TT" ); TH1F* estimate_TL_Signal = (TH1F*)gROOT->FindObject("MMEstimated_TLEMu_TT"); TH1F* estimate_LT_Signal = (TH1F*)gROOT->FindObject("MMEstimated_LTEMu_TT"); estimate_LL_Signal->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); estimate_TT_Signal->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); estimate_TL_Signal->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); estimate_LT_Signal->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); title = new TLatex(10.,10.,"CMS preliminary"); title->SetNDC(); title->SetTextAlign(12); title->SetX(0.60); title->SetY(0.70); title->SetTextFont(42); title->SetTextSize(0.04); title->SetTextSizePixels(24); TLegend* qw = 0; qw = new TLegend(0.70,0.75,0.95,0.95); qw->SetFillColor(kWhite); if( selection == "TT"){ if(eventType == "Signal"){ TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800); estimate_TT_Signal->SetMarkerStyle(20); estimate_TT_Signal->GetXaxis()->SetTitle("Jet multiplicity"); estimate_TT_Signal->GetYaxis()->SetTitle("Number of events"); estimate_TT_Signal->GetYaxis()->SetLabelSize(0.025); estimate_TT_Signal->SetTitle("Signal-like e#mu (tight-tight)"); estimate_TT_Signal->Draw(); ttSignalLike->Draw("hesame"); estimate_TT_Signal->Draw("same"); TH1F * tmp = new TH1F("tmp", "tmp", 11, -0.5, 10.5); tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); tmp->Add(tmp, tt_TTDilept); TGraphErrors *thegraph = new TGraphErrors(tmp); thegraph->SetFillStyle(3005); thegraph->SetFillColor(1); thegraph->Draw("e2same"); qw->AddEntry(tt_TTDilept, " t#bar{t} signal ","f"); qw->AddEntry(estimate_TT_Signal, " Matrix Method ","p"); qw->Draw("same"); title->Draw("same"); canv->SaveAs("TTSignalEMu_PullTest.pdf"); } if(eventType == "Wlike"){ TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800); estimate_TT_WJets->SetMarkerStyle(20); estimate_TT_WJets->GetXaxis()->SetTitle("Jet multiplicity"); estimate_TT_WJets->GetYaxis()->SetTitle("Number of events"); estimate_TT_WJets->GetYaxis()->SetLabelSize(0.025); estimate_TT_WJets->SetTitle("W+jets-like e#mu (tight-tight)"); estimate_TT_WJets->Draw(); ttWLike->Draw("hesame"); estimate_TT_WJets->Draw("same"); TH1F * tmp = new TH1F("tmp", "tmp", 11, -0.5, 10.5); tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); tmp->Add(tmp, tt_TTSemi_TF); tmp->Add(tmp, tt_TTSemi_FT); TGraphErrors *thegraph = new TGraphErrors(tmp); thegraph->SetFillStyle(3005); thegraph->SetFillColor(1); thegraph->Draw("e2same"); qw->AddEntry(tt_TTSemi_TF, " t#bar{t} semileptonic TF","f"); qw->AddEntry(tt_TTSemi_FT, " t#bar{t} semileptonic FT","f"); qw->AddEntry(estimate_TT_WJets, " Matrix Method ","p"); qw->Draw("same"); title->Draw("same"); canv->SaveAs("TTWlikeEMu_PullTest.pdf"); } if(eventType == "QCDlike"){ TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800); estimate_TT_QCD->SetMarkerStyle(20); estimate_TT_QCD->GetXaxis()->SetTitle("Jet multiplicity"); estimate_TT_QCD->GetYaxis()->SetTitle("Number of events"); estimate_TT_QCD->GetYaxis()->SetLabelSize(0.025); estimate_TT_QCD->SetTitle("QCD-like e#mu (tight-tight)"); estimate_TT_QCD->GetXaxis()->SetTitle("Jet multiplicity"); estimate_TT_QCD->Draw(); ttQCDLike->Draw("hesame"); estimate_TT_QCD->Draw("same"); TH1F * tmp = new TH1F("tmp", "tmp", 11, -0.5, 10.5); tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); tmp->Add(tmp, tt_TTBckg); TGraphErrors *thegraph = new TGraphErrors(tmp); thegraph->SetFillStyle(3005); thegraph->SetFillColor(1); estimate_TT_QCD->Draw("same"); thegraph->Draw("e2same"); qw->AddEntry(tt_TTBckg, " t#bar{t} hadronic ","f"); qw->AddEntry(estimate_TT_QCD, " Matrix Method ","p"); qw->Draw("same"); title->Draw("same"); canv->SaveAs("TTQCDEMu_PullTest.pdf"); } } if( selection == "LT"){ if(eventType == "Signal"){ TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800); estimate_LT_Signal->SetMarkerStyle(20); estimate_LT_Signal->GetXaxis()->SetTitle("Jet multiplicity"); estimate_LT_Signal->GetYaxis()->SetTitle("Number of events"); estimate_LT_Signal->GetYaxis()->SetLabelSize(0.025); estimate_LT_Signal->SetTitle("Signal-like e#mu (loose-tight)"); estimate_LT_Signal->Draw(); ltSignalLike->Draw("hesame"); estimate_LT_Signal->Draw("same"); TH1F * tmp = new TH1F("tmp", "tmp", 11, -0.5, 10.5); tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); tmp->Add(tmp, lt_TTDilept); TGraphErrors *thegraph = new TGraphErrors(tmp); thegraph->SetFillStyle(3005); thegraph->SetFillColor(1); thegraph->Draw("e2same"); qw->AddEntry(lt_TTDilept, " t#bar{t} signal ","f"); qw->AddEntry(estimate_LT_Signal, " Matrix Method ","p"); qw->Draw("same"); title->Draw("same"); canv->SaveAs("LTSignalEMu_PullTest.pdf"); } if(eventType == "Wlike"){ TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800); estimate_LT_WJets->SetMarkerStyle(20); estimate_LT_WJets->GetXaxis()->SetTitle("Jet multiplicity"); estimate_LT_WJets->GetYaxis()->SetTitle("Number of events"); estimate_LT_WJets->GetYaxis()->SetLabelSize(0.025); estimate_LT_WJets->SetTitle("W+jets-like e#mu (loose-tight)"); estimate_LT_WJets->Draw(); ltWLike->Draw("hesame"); estimate_LT_WJets->Draw("same"); TH1F * tmp = new TH1F("tmp", "tmp", 11, -0.5, 10.5); tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); tmp->Add(tmp, tl_TTSemi_TF); tmp->Add(tmp, lt_TTSemi_FT); TGraphErrors *thegraph = new TGraphErrors(tmp); thegraph->SetFillStyle(3005); thegraph->SetFillColor(1); thegraph->Draw("e2same"); qw->AddEntry(tl_TTSemi_TF, " t#bar{t} semileptonic TF","f"); qw->AddEntry(lt_TTSemi_FT, " t#bar{t} semileptonic FT","f"); qw->AddEntry(estimate_LT_WJets, " Matrix Method ","p"); qw->Draw("same"); title->Draw("same"); canv->SaveAs("LTWlikeEMu_PullTest.pdf"); } if(eventType == "QCDlike"){ TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800); estimate_LT_QCD->SetMarkerStyle(20); estimate_LT_QCD->GetXaxis()->SetTitle("Jet multiplicity"); estimate_LT_QCD->GetYaxis()->SetTitle("Number of events"); estimate_LT_QCD->GetYaxis()->SetLabelSize(0.025); estimate_LT_QCD->SetTitle("QCD-like e#mu (loose-tight)"); estimate_LT_QCD->Draw(); ltQCDLike->Draw("hesame"); estimate_LT_QCD->Draw("same"); TH1F * tmp = new TH1F("tmp", "tmp", 11, -0.5, 10.5); tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); tmp->Add(tmp, lt_TTBckg); TGraphErrors *thegraph = new TGraphErrors(tmp); thegraph->SetFillStyle(3005); thegraph->SetFillColor(1); thegraph->Draw("e2same"); qw->AddEntry(lt_TTBckg, " t#bar{t} hadronic ","f"); qw->AddEntry(estimate_LT_QCD, " Matrix Method ","p"); qw->Draw("same"); title->Draw("same"); canv->SaveAs("LTQCDEMu_PullTest.pdf"); } } if( selection == "TL"){ if(eventType == "Signal"){ TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800); estimate_TL_Signal->SetMarkerStyle(20); estimate_TL_Signal->GetXaxis()->SetTitle("Jet multiplicity"); estimate_TL_Signal->GetYaxis()->SetTitle("Number of events"); estimate_TL_Signal->GetYaxis()->SetLabelSize(0.025); estimate_TL_Signal->SetTitle("Signal-like e#mu (tight-loose)"); estimate_TL_Signal->Draw(); estimate_TL_Signal->Draw(); tlSignalLike->Draw("hesame"); estimate_TL_Signal->Draw("same"); TH1F * tmp = new TH1F("tmp", "tmp", 11, -0.5, 10.5); tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); tmp->Add(tmp, tl_TTDilept); TGraphErrors *thegraph = new TGraphErrors(tmp); thegraph->SetFillStyle(3005); thegraph->SetFillColor(1); thegraph->Draw("e2same"); qw->AddEntry(tl_TTDilept, " t#bar{t} signal ","f"); qw->AddEntry(estimate_TL_Signal, " Matrix Method ","p"); qw->Draw("same"); title->Draw("same"); canv->SaveAs("TLSignalEMu_PullTest.pdf"); } if(eventType == "Wlike"){ TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800); estimate_TL_WJets->SetMarkerStyle(20); estimate_TL_WJets->GetXaxis()->SetTitle("Jet multiplicity"); estimate_TL_WJets->GetYaxis()->SetTitle("Number of events"); estimate_TL_WJets->GetYaxis()->SetLabelSize(0.025); estimate_TL_WJets->SetTitle("W+jets-like e#mu (tight-loose)"); estimate_TL_WJets->Draw(); tlWLike->Draw("hesame"); estimate_TL_WJets->Draw("same"); TH1F * tmp = new TH1F("tmp", "tmp", 11, -0.5, 10.5); tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); tmp->Add(tmp, tl_TTSemi_TF); tmp->Add(tmp, lt_TTSemi_FT); TGraphErrors *thegraph = new TGraphErrors(tmp); thegraph->SetFillStyle(3005); thegraph->SetFillColor(1); thegraph->Draw("e2same"); qw->AddEntry(tl_TTSemi_TF, " t#bar{t} semileptonic TF","f"); qw->AddEntry(lt_TTSemi_FT, " t#bar{t} semileptonic FT","f"); qw->Draw("same"); title->Draw("same"); canv->SaveAs("TLWlikeEMu_PullTest.pdf"); } if(eventType == "QCDlike"){ TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800); estimate_TL_QCD->SetMarkerStyle(20); estimate_TL_QCD->GetXaxis()->SetTitle("Jet multiplicity"); estimate_TL_QCD->GetYaxis()->SetTitle("Number of events"); estimate_TL_QCD->GetYaxis()->SetLabelSize(0.025); estimate_TL_QCD->SetTitle("QCD-like e#mu (tight-loose)"); estimate_TL_QCD->Draw(); tlQCDLike->Draw("hesame"); estimate_TL_QCD->Draw("same"); TH1F * tmp = new TH1F("tmp", "tmp", 11, -0.5, 10.5); tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); tmp->Add(tmp, tl_TTBckg); TGraphErrors *thegraph = new TGraphErrors(tmp); thegraph->SetFillStyle(3005); thegraph->SetFillColor(1); thegraph->Draw("e2same"); qw->AddEntry(tl_TTBckg, " t#bar{t} hadronic ","f"); qw->AddEntry(estimate_TL_QCD, " Matrix Method ","p"); qw->Draw("same"); title->Draw("same"); canv->SaveAs("TLQCDEMu_PullTest.pdf"); } } if( selection == "LL"){ if(eventType == "Signal"){ TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800); estimate_LL_Signal->SetMarkerStyle(20); estimate_LL_Signal->GetXaxis()->SetTitle("Jet multiplicity"); estimate_LL_Signal->GetYaxis()->SetTitle("Number of events"); estimate_LL_Signal->GetYaxis()->SetLabelSize(0.025); estimate_LL_Signal->SetTitle("Signal-like e#mu (loose-loose)"); estimate_LL_Signal->Draw(); llSignalLike->Draw("hesame"); estimate_LL_Signal->Draw("same"); TH1F * tmp = new TH1F("tmp", "tmp", 11, -0.5, 10.5); tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); tmp->Add(tmp, ll_TTDilept); TGraphErrors *thegraph = new TGraphErrors(tmp); thegraph->SetFillStyle(3005); thegraph->SetFillColor(1); thegraph->Draw("e2same"); qw->AddEntry(ll_TTDilept, " t#bar{t} signal ","f"); qw->AddEntry(estimate_LL_Signal, " Matrix Method ","p"); qw->Draw("same"); title->Draw("same"); canv->SaveAs("LLSignalEMu_PullTest.pdf"); } if(eventType == "Wlike"){ TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800); estimate_LL_WJets->SetMarkerStyle(20); estimate_LL_WJets->GetXaxis()->SetTitle("Jet multiplicity"); estimate_LL_WJets->GetYaxis()->SetTitle("Number of events"); estimate_LL_WJets->GetYaxis()->SetLabelSize(0.025); estimate_LL_WJets->SetTitle("W+jets-like e#mu (loose-loose)"); estimate_LL_WJets->Draw(); llWLike->Draw("hesame"); estimate_LL_WJets->Draw("same"); TH1F * tmp = new TH1F("tmp", "tmp", 11, -0.5, 10.5); tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); tmp->Add(tmp, ll_TTSemi_TF); tmp->Add(tmp, ll_TTSemi_FT); TGraphErrors *thegraph = new TGraphErrors(tmp); thegraph->SetFillStyle(3005); thegraph->SetFillColor(1); thegraph->Draw("e2same"); qw->AddEntry(ll_TTSemi_TF, " t#bar{t} semileptonic TF","f"); qw->AddEntry(ll_TTSemi_FT, " t#bar{t} semileptonic FT","f"); qw->AddEntry(estimate_LL_WJets, " Matrix Method ","p"); qw->Draw("same"); title->Draw("same"); canv->SaveAs("LLWlikeEMu_PullTest.pdf"); } if(eventType == "QCDlike"){ TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800); estimate_LL_QCD->SetMarkerStyle(20); estimate_LL_QCD->GetXaxis()->SetTitle("Jet multiplicity"); estimate_LL_QCD->GetYaxis()->SetTitle("Number of events"); estimate_LL_QCD->GetYaxis()->SetLabelSize(0.025); estimate_LL_QCD->SetTitle("QCD-like e#mu (loose-loose)"); estimate_LL_QCD->Draw(); llQCDLike->Draw("hesame"); estimate_LL_QCD->Draw("same"); TH1F * tmp = new TH1F("tmp", "tmp", 11, -0.5, 10.5); tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax); tmp->Add(tmp, ll_TTBckg); TGraphErrors *thegraph = new TGraphErrors(tmp); thegraph->SetFillStyle(3005); thegraph->SetFillColor(1); thegraph->Draw("e2same"); qw->AddEntry(ll_TTBckg, " t#bar{t} hadronic ","f"); qw->AddEntry(estimate_LL_QCD, " Matrix Method ","p"); qw->Draw("same"); title->Draw("same"); canv->SaveAs("LLQCDEMu_PullTest.pdf"); } } }
int theoryStudy_separate(const TString BaseName) { TString tmpTStr; char tmpName[30],tmpName_org[30]; int Numb; TFile *f_Resbos; TFile *f_Fewz; TFile *f_Data; TFile *f_Data_PowhegErr; f_Resbos = new TFile("../../RstResbos/Resbos_"+BaseName+".root"); f_Data = new TFile("../Result"+BaseName+"/Result_"+BaseName+".root"); f_Data_PowhegErr = new TFile("../../Systematics/WptXsecErrors/"+BaseName+"Errors.root"); if (BaseName=="WpToMuNu") { f_Fewz = new TFile("../../RstFEWZ/Wp_Mu_NNLO.root"); } if (BaseName=="WmToMuNu") { f_Fewz = new TFile("../../RstFEWZ/Wm_Mu_NNLO.root"); } if (BaseName=="WpToEleNu") { f_Fewz = new TFile("../../RstFEWZ/Wp_Ele_NNLO.root"); } if (BaseName=="WmToEleNu") { f_Fewz = new TFile("../../RstFEWZ/Wm_Ele_NNLO.root"); } TH1D *hWptBins_LinScale = new TH1D("hWptBins_LinScale","hWptBins_LinScale",nBins-1,WptBins);hWptBins_LinScale->Sumw2(); TH1D *hWptBins_LogScale = new TH1D("hWptBins_LogScale","hWptBins_LogScale",nBins-1,WptLogBins);hWptBins_LogScale->Sumw2(); ///=============Reading related stat, syst errors starts here============== // TH1D* hData_StatErr = (TH1D*)f_Data_PowhegErr->Get("h_Stat")->Clone("hData_StatErr"); TH1D* hData_MetResolSystErr = (TH1D*)f_Data_PowhegErr->Get("h_met")->Clone("hData_MetResolSystErr"); TH1D* hData_EnMomScaleSystErr = (TH1D*)f_Data_PowhegErr->Get("h_scale")->Clone("hData_EnMomScaleSystErr"); TH1D* hData_EnMomSmearSystErr = (TH1D*)f_Data_PowhegErr->Get("h_smear")->Clone("hData_EnMomSmearSystErr"); TH1D* hData_QcdBckgrSystErr = (TH1D*)f_Data_PowhegErr->Get("h_qcdbckgr")->Clone("hData_QcdBckgrSystErr"); TH1D* hData_QcdShapeSystErr = (TH1D*)f_Data_PowhegErr->Get("h_qcdshape")->Clone("hData_QcdShapeSystErr"); TH1D* hData_EwkSystErr = (TH1D*)f_Data_PowhegErr->Get("h_ewk")->Clone("hData_EwkSystErr"); TH1D* hData_FsrSystErr = (TH1D*)f_Data_PowhegErr->Get("h_fsr")->Clone("hData_FsrSystErr"); TH1D* hData_SvdUnfSystErr = (TH1D*)f_Data_PowhegErr->Get("h_SvdUnf")->Clone("hData_SvdUnfSystErr"); TH1D* hData_UnfoldBiasSystErr = (TH1D*)f_Data_PowhegErr->Get("h_UnfoldBias")->Clone("hData_UnfoldBiasSystErr"); TH1D* hData_LumiSystErr = (TH1D*)f_Data_PowhegErr->Get("h_LumiSyst")->Clone("hData_LumiSystErr"); ///Lepton Reconstruction related systematic errors // TH1D* hData_EffiToySystErr = (TH1D*)f_Data_PowhegErr->Get("h_toy")->Clone("hData_EffiToySystErr"); TH1D* hData_IDIsoSigShapeSystErr = (TH1D*)f_Data_PowhegErr->Get("h_idisosig")->Clone("hData_IDIsoSigShapeSystErr"); TH1D* hData_IDIsoBkgrShapeSystErr = (TH1D*)f_Data_PowhegErr->Get("h_idisobck")->Clone("hData_IDIsoBkgrShapeSystErr"); TH1D *hData_TotalSystErr = new TH1D("hData_TotalSystErr","hData_TotalSystErr",nBins-1,WptBins);hData_TotalSystErr->Sumw2(); if(BaseName== "WpToMuNu" || BaseName== "WmToMuNu") { TH1D* hData_TrackSigShapeSystErr = (TH1D*)f_Data_PowhegErr->Get("h_tracksig")->Clone("hData_TrackSigShapeSystErr"); TH1D* hData_TrackBkgrShapeSystErr = (TH1D*)f_Data_PowhegErr->Get("h_trackbck")->Clone("hData_TrackBkgrShapeSystErr"); TH1D* hData_MuonPOGSystErr = (TH1D*)f_Data_PowhegErr->Get("h_POG")->Clone("hData_MuonPOGSystErr"); //// Calculate total syst for muon for( int ipt(1);ipt<=nBins-1;ipt++) { hData_TotalSystErr->SetBinContent(ipt, sqrt( TMath::Power(hData_TrackSigShapeSystErr->GetBinContent(ipt),2) + TMath::Power( hData_TrackBkgrShapeSystErr->GetBinContent(ipt),2) + TMath::Power( hData_MuonPOGSystErr->GetBinContent(ipt),2) + TMath::Power( hData_EffiToySystErr->GetBinContent(ipt),2)+ TMath::Power( hData_IDIsoSigShapeSystErr->GetBinContent(ipt),2)+ TMath::Power( hData_IDIsoBkgrShapeSystErr->GetBinContent(ipt),2) + TMath::Power( hData_MetResolSystErr->GetBinContent(ipt),2) + TMath::Power( hData_EnMomScaleSystErr->GetBinContent(ipt),2) + TMath::Power(hData_EnMomSmearSystErr->GetBinContent(ipt),2) + TMath::Power( hData_QcdBckgrSystErr->GetBinContent(ipt),2) + TMath::Power( hData_QcdShapeSystErr->GetBinContent(ipt),2) + TMath::Power( hData_EwkSystErr->GetBinContent(ipt),2) + TMath::Power( hData_FsrSystErr->GetBinContent(ipt),2) + TMath::Power( hData_SvdUnfSystErr->GetBinContent(ipt),2) + TMath::Power( hData_UnfoldBiasSystErr->GetBinContent(ipt),2) + TMath::Power( hData_LumiSystErr->GetBinContent(ipt),2) )); } } else if(BaseName== "WpToEleNu" || BaseName== "WmToEleNu") { TH1D* hData_BinningSystErr = (TH1D*)f_Data_PowhegErr->Get("h_bin")->Clone("hData_BinningSystErr"); //// Calculate total syst for electron for( int ipt(1);ipt<=nBins-1;ipt++) { hData_TotalSystErr->SetBinContent(ipt, sqrt( TMath::Power(hData_BinningSystErr->GetBinContent(ipt),2) + TMath::Power( hData_EffiToySystErr->GetBinContent(ipt),2) + TMath::Power( hData_IDIsoSigShapeSystErr->GetBinContent(ipt),2) + TMath::Power( hData_IDIsoBkgrShapeSystErr->GetBinContent(ipt),2) + TMath::Power( hData_MetResolSystErr->GetBinContent(ipt),2) + TMath::Power( hData_EnMomScaleSystErr->GetBinContent(ipt),2) + TMath::Power(hData_EnMomSmearSystErr->GetBinContent(ipt),2) + TMath::Power( hData_QcdBckgrSystErr->GetBinContent(ipt),2) + TMath::Power( hData_QcdShapeSystErr->GetBinContent(ipt),2) + TMath::Power( hData_EwkSystErr->GetBinContent(ipt),2) + TMath::Power( hData_FsrSystErr->GetBinContent(ipt),2) + TMath::Power( hData_SvdUnfSystErr->GetBinContent(ipt),2) + TMath::Power( hData_UnfoldBiasSystErr->GetBinContent(ipt),2) + TMath::Power( hData_LumiSystErr->GetBinContent(ipt),2) )); } } TH1D *hData_TotalUncer = new TH1D("hData_TotalUncer","hData_TotalUncer",nBins-1,WptBins);hData_TotalUncer->Sumw2(); for( int ipt(1);ipt<nBins;ipt++) { hData_TotalUncer->SetBinContent(ipt, sqrt(TMath::Power(hData_StatErr->GetBinContent(ipt),2)+ TMath::Power(hData_TotalSystErr->GetBinContent(ipt),2))); cout<<"hData_TotalUncer: "<<ipt<<"\t"<<hData_TotalUncer->GetBinContent(ipt)<<endl; } for( int ipt(1);ipt<nBins;ipt++) { //cout<<"hData_TrackSigShapeSystErr: "<<ipt<<"\t"<<hData_TrackSigShapeSystErr->GetBinContent(ipt)<<endl; //cout<<"hData_TrackBkgrShapeSystErr: "<<ipt<<"\t"<<hData_TrackBkgrShapeSystErr->GetBinContent(ipt)<<endl; //cout<<"hData_IDIsoSigShapeSystErr: "<<ipt<<"\t"<<hData_IDIsoSigShapeSystErr->GetBinContent(ipt)<<endl; //cout<<"hData_IDIsoBkgrShapeSystErr: "<<ipt<<"\t"<<hData_IDIsoBkgrShapeSystErr->GetBinContent(ipt)<<endl; //cout<<"hData_MuonPOGSystErr: "<<ipt<<"\t"<<hData_MuonPOGSystErr->GetBinContent(ipt)<<endl; //cout<<"hData_EffiToySystErr: "<<ipt<<"\t"<<hData_EffiToySystErr->GetBinContent(ipt)<<endl; //cout<<"hData_MetResolSystErr: "<<ipt<<"\t"<<hData_MetResolSystErr->GetBinContent(ipt)<<endl; //cout<<"hData_EnMomScaleSystErr: "<<ipt<<"\t"<<hData_EnMomScaleSystErr->GetBinContent(ipt)<<endl; //cout<<"hData_EnMomSmearSystErr: "<<ipt<<"\t"<<hData_EnMomSmearSystErr->GetBinContent(ipt)<<endl; //cout<<"hData_QcdBckgrSystErr: "<<ipt<<"\t"<<hData_QcdBckgrSystErr->GetBinContent(ipt)<<endl; //cout<<"hData_QcdShapeSystErr: "<<ipt<<"\t"<<hData_QcdShapeSystErr->GetBinContent(ipt)<<endl; //cout<<"hData_EwkSystErr: "<<ipt<<"\t"<<hData_EwkSystErr->GetBinContent(ipt)<<endl; //cout<<"hData_FsrSystErr: "<<ipt<<"\t"<<hData_FsrSystErr->GetBinContent(ipt)<<endl; //cout<<"hData_SvdUnfSystErr: "<<ipt<<"\t"<<hData_SvdUnfSystErr->GetBinContent(ipt)<<endl; //cout<<"hData_UnfoldBiasSystErr: "<<ipt<<"\t"<<hData_UnfoldBiasSystErr->GetBinContent(ipt)<<endl; } TH1D* hPowheg_PDFErr = (TH1D*)f_Data_PowhegErr->Get("h_PowhegPDF")->Clone("hPowheg_PDFErr"); //TH1D* hData_TotalUncer = (TH1D*)f_Data_PowhegErr->Get("h_TotalUncer")->Clone("hData_TotalUncer"); ///=============Reading related stat, syst errors Finished here============== /////==========Real Data Starts here========================================= // // Born Level RD Yield and Errors, and Converting to X sec yield and errors, making TGraph . TH1D* hData_Xsec_BornLinScale; hData_Xsec_BornLinScale = (TH1D*)f_Data->Get("BornEffCorr")->Clone("hData_Xsec_BornLinScale"); for( int ipt(1);ipt<nBins;ipt++) { hData_Xsec_BornLinScale->SetBinError(ipt, 0.01*hData_TotalUncer->GetBinContent(ipt)*hData_Xsec_BornLinScale->GetBinContent(ipt) ); } hData_Xsec_BornLinScale->Scale(1./18.429); TH1D* hData_Yield_ReconLinScale; hData_Yield_ReconLinScale = (TH1D*)f_Data->Get("data_Rec")->Clone("hData_Yield_ReconLinScale"); for( int ipt(1);ipt<nBins;ipt++) { double tmp = sqrt(hData_Yield_ReconLinScale->GetBinContent(ipt)); hData_Yield_ReconLinScale->SetBinError(ipt,tmp); } //Errors double Data_Xsec_BornStatErr[14]; double Data_Xsec_BornTotalErr[14]; for( int ipt(1);ipt<=nBins-1;ipt++) { Data_Xsec_BornStatErr[ipt] = hData_Xsec_BornLinScale->GetBinContent(ipt) * ( hData_Yield_ReconLinScale->GetBinError(ipt)/hData_Yield_ReconLinScale->GetBinContent(ipt) ); Data_Xsec_BornTotalErr[ipt] = hData_Xsec_BornLinScale->GetBinError(ipt); } // X-sex and error Log scale TH1D *hData_Xsec_BornLogScale = new TH1D("hData_Xsec_BornLogScale","hData_Xsec_BornLogScale",nBins-1,WptLogBins);hData_Xsec_BornLogScale->Sumw2(); for( int ipt(1);ipt<=nBins-1;ipt++) { hData_Xsec_BornLogScale->SetBinContent(ipt,hData_Xsec_BornLinScale->GetBinContent(ipt)/hWptBins_LinScale->GetXaxis()->GetBinWidth(ipt )); hData_Xsec_BornLogScale->SetBinError(ipt,Data_Xsec_BornTotalErr[ipt]/hWptBins_LinScale->GetXaxis()->GetBinWidth(ipt)); } /// Theory/Data ratio plot errors related to Real Data TH1D *hRatioDataErrBand = new TH1D("hRatioDataErrBand","hRatioDataErrBand",nBins-1,WptLogBins);hRatioDataErrBand->Sumw2(); TH1D *hRatioDataStatErr = new TH1D("hRatioDataStatErr","hRatioDataStatErr",nBins-1,WptLogBins);hRatioDataStatErr->Sumw2(); for( int ipt(1);ipt<=nBins-1;ipt++) { hRatioDataErrBand->SetBinContent(ipt,1.); hRatioDataErrBand->SetBinError(ipt,hData_Xsec_BornLinScale->GetBinError(ipt)/hData_Xsec_BornLinScale->GetBinContent(ipt)); hRatioDataStatErr->SetBinContent(ipt,1.); hRatioDataStatErr->SetBinError(ipt,Data_Xsec_BornStatErr[ipt]/hData_Xsec_BornLinScale->GetBinContent(ipt)); } hData_Xsec_BornLogScale->SetMarkerStyle(kFullCircle); hData_Xsec_BornLogScale->SetMarkerColor(kBlack); hData_Xsec_BornLogScale->SetMarkerSize(1); hRatioDataStatErr->SetMarkerStyle(kFullCircle); hRatioDataStatErr->SetMarkerColor(kBlack); hRatioDataStatErr->SetMarkerSize(0.6); /// TGraph TGraphErrors *Data_Xsec_Born = new TGraphErrors(hData_Xsec_BornLogScale); TGraphErrors *RatioDataErrBand = new TGraphErrors(hRatioDataErrBand); /////==========Real Data related stuff Finished here========================================= /////==========Powheg Starts here============================================== // // Born Level Powheg Yield and Errors, and Converting to X sec yield and errors, making TGraph . TH1D* hPowheg_Xsec_BornLinScale; hPowheg_Xsec_BornLinScale = (TH1D*)f_Data->Get("SVD_Born.Gen")->Clone("hPowheg_Xsec_BornLinScale"); for( int ipt(1);ipt<nBins;ipt++) { hPowheg_Xsec_BornLinScale->SetBinError(ipt, 0.01*hPowheg_PDFErr->GetBinContent(ipt)*hPowheg_Xsec_BornLinScale->GetBinContent(ipt) ); } hPowheg_Xsec_BornLinScale->Scale(1./18.429); TH1D* hPowheg_Yield_BornAfterFidCut; hPowheg_Yield_BornAfterFidCut = (TH1D*)f_Data->Get("SVD_Born.Gen")->Clone("hPowheg_Yield_BornAfterFidCut"); if(BaseName== "WpToMuNu") { hPowheg_Yield_BornAfterFidCut->Scale(1./LumiWeight_Muon_WpToMuNu_S8); } if(BaseName== "WmToMuNu") { hPowheg_Yield_BornAfterFidCut->Scale(1./LumiWeight_Muon_WmToMuNu_S8); } if(BaseName== "WpToEleNu") { hPowheg_Yield_BornAfterFidCut->Scale(1./LumiWeight_Ele_WpToEleNu_S8); } if(BaseName== "WmToEleNu") { hPowheg_Yield_BornAfterFidCut->Scale(1./LumiWeight_Ele_WmToEleNu_S8); } //Errors double Powheg_Xsec_BornStatErr[14]; double Powheg_Xsec_BornTotalErr[14]; for( int ipt(1);ipt<=nBins-1;ipt++) { Powheg_Xsec_BornStatErr[ipt] = hPowheg_Xsec_BornLinScale->GetBinContent(ipt)*sqrt(hPowheg_Yield_BornAfterFidCut->GetBinContent(ipt))/hPowheg_Yield_BornAfterFidCut->GetBinContent(ipt); Powheg_Xsec_BornTotalErr[ipt] = sqrt(Powheg_Xsec_BornStatErr[ipt]*Powheg_Xsec_BornStatErr[ipt] + hPowheg_Xsec_BornLinScale->GetBinError(ipt)*hPowheg_Xsec_BornLinScale->GetBinError(ipt)); } // X-sex and error Log scale TH1D *hPowheg_Xsec_BornLogScale = new TH1D("hPowheg_Xsec_BornLogScale","hPowheg_Xsec_BornLogScale",nBins-1,WptLogBins);hPowheg_Xsec_BornLogScale->Sumw2(); for( int ipt(1);ipt<=nBins-1;ipt++) { hPowheg_Xsec_BornLogScale->SetBinContent(ipt,hPowheg_Xsec_BornLinScale->GetBinContent(ipt)/hWptBins_LinScale->GetXaxis()->GetBinWidth(ipt)); hPowheg_Xsec_BornLogScale->SetBinError(ipt,Powheg_Xsec_BornTotalErr[ipt]/hWptBins_LinScale->GetXaxis()->GetBinWidth(ipt)); } /// Theory/Data ratio plot errors related to Real Data TH1D *hRatioPowhegStatErrBand = new TH1D("hRatioPowhegStatErrBand","hRatioPowhegStatErrBand",nBins-1,WptLogBins);hRatioPowhegStatErrBand->Sumw2(); TH1D *hRatioPowhegPDFErrBand = new TH1D("hRatioPowhegPDFErrBand","hRatioPowhegPDFErrBand",nBins-1,WptLogBins);hRatioPowhegPDFErrBand->Sumw2(); for( int ipt(1);ipt<=nBins-1;ipt++) { hRatioPowhegStatErrBand->SetBinContent(ipt,hPowheg_Xsec_BornLogScale->GetBinContent(ipt)/hData_Xsec_BornLogScale->GetBinContent(ipt)); hRatioPowhegStatErrBand->SetBinError(ipt,Powheg_Xsec_BornStatErr[ipt]/hData_Xsec_BornLinScale->GetBinContent(ipt)); hRatioPowhegPDFErrBand->SetBinContent(ipt,hPowheg_Xsec_BornLogScale->GetBinContent(ipt)/hData_Xsec_BornLogScale->GetBinContent(ipt)); hRatioPowhegPDFErrBand->SetBinError(ipt,(Powheg_Xsec_BornStatErr[ipt]/hData_Xsec_BornLinScale->GetBinContent(ipt))+(hPowheg_Xsec_BornLinScale->GetBinError(ipt)/hData_Xsec_BornLinScale->GetBinContent(ipt))); } /// TGraph TGraphErrors *Powheg_Xsec_Born = new TGraphErrors(hPowheg_Xsec_BornLogScale); TGraphErrors *RatioPowhegStatErrBand = new TGraphErrors(hRatioPowhegStatErrBand); TGraphErrors *RatioPowhegPDFErrBand = new TGraphErrors(hRatioPowhegPDFErrBand); /////==========Powheg related stuff Finished here========================================= /////==========FEWZ Starts here============================================== // // FEWZ X sec value and errors, making TGraph . TH1D* hFEWZ_Xsec_LinScale; hFEWZ_Xsec_LinScale = (TH1D*)f_Fewz->Get("hxsec")->Clone("hFEWZ_Xsec_LinScale"); //Errors TH1D* hFEWZ_Xsec_ScaleError; hFEWZ_Xsec_ScaleError = (TH1D*)f_Fewz->Get("ScaleErr")->Clone("hFEWZ_Xsec_ScaleError"); TH1D* hFEWZ_Xsec_PDFError; hFEWZ_Xsec_PDFError = (TH1D*)f_Fewz->Get("PDFErr")->Clone("hFEWZ_Xsec_PDFError"); double FEWZ_Xsec_ScaleErr[14]; double FEWZ_Xsec_PDFErr[14]; double FEWZ_Xsec_TotalErr[14]; for( int ipt(1);ipt<=nBins-1;ipt++) { FEWZ_Xsec_ScaleErr[ipt] = 0.01*hFEWZ_Xsec_ScaleError->GetBinError(ipt)*hFEWZ_Xsec_LinScale->GetBinContent(ipt); FEWZ_Xsec_PDFErr[ipt] = 0.01*hFEWZ_Xsec_PDFError->GetBinError(ipt)*hFEWZ_Xsec_LinScale->GetBinContent(ipt); FEWZ_Xsec_TotalErr[ipt] = sqrt( FEWZ_Xsec_ScaleErr[ipt]*FEWZ_Xsec_ScaleErr[ipt] + FEWZ_Xsec_PDFErr[ipt]*FEWZ_Xsec_PDFErr[ipt] ); } // X-sex and error Log scale TH1D *hFEWZ_Xsec_LogScale = new TH1D("hFEWZ_Xsec_LogScale","hFEWZ_Xsec_LogScale",nBins-1,WptLogBins);hFEWZ_Xsec_LogScale->Sumw2(); for( int ipt(1);ipt<=nBins-1;ipt++) { hFEWZ_Xsec_LogScale->SetBinContent(ipt,hFEWZ_Xsec_LinScale->GetBinContent(ipt)/hWptBins_LinScale->GetXaxis()->GetBinWidth(ipt)); hFEWZ_Xsec_LogScale->SetBinError(ipt,FEWZ_Xsec_TotalErr[ipt]/hWptBins_LinScale->GetXaxis()->GetBinWidth(ipt)); } /// Theory/Data ratio plot errors related to Real Data TH1D *hRatioFEWZStatErrBand = new TH1D("hRatioFEWZStatErrBand","hRatioFEWZStatErrBand",nBins-1,WptLogBins);hRatioFEWZStatErrBand->Sumw2(); TH1D *hRatioFEWZScaleErr = new TH1D("hRatioFEWZScaleErr","hRatioFEWZScaleErr",nBins-1,WptLogBins);hRatioFEWZScaleErr->Sumw2(); TH1D *hRatioFEWZQCDScaleErrBand = new TH1D("hRatioFEWZQCDScalePDFErrBand","hRatioFEWZQCDScalePDFErrBand",nBins-1,WptLogBins);hRatioFEWZQCDScalePDFErrBand->Sumw2(); TH1D *hRatioFEWZScalePDFErrBand = new TH1D("hRatioFEWZScalePDFErrBand","hRatioFEWZScalePDFErrBand",nBins-1,WptLogBins);hRatioFEWZScalePDFErrBand->Sumw2(); for( int ipt(1);ipt<=nBins-1;ipt++) { hRatioFEWZStatErrBand->SetBinContent(ipt,hFEWZ_Xsec_LogScale->GetBinContent(ipt)/hData_Xsec_BornLogScale->GetBinContent(ipt)); hRatioFEWZStatErrBand->SetBinError(ipt,0.01); hRatioFEWZScaleErr->SetBinContent(ipt,hFEWZ_Xsec_LogScale->GetBinContent(ipt)/hData_Xsec_BornLogScale->GetBinContent(ipt)); hRatioFEWZScaleErr->SetBinError(ipt,FEWZ_Xsec_ScaleErr[ipt]/hWptBins_LinScale->GetXaxis()->GetBinWidth(ipt)); hRatioFEWZQCDScaleErrBand->SetBinContent(ipt,hFEWZ_Xsec_LogScale->GetBinContent(ipt)/hData_Xsec_BornLogScale->GetBinContent(ipt)); hRatioFEWZQCDScaleErrBand->SetBinError(ipt,0.01 + hRatioFEWZScaleErr->GetBinError(ipt)/hData_Xsec_BornLogScale->GetBinContent(ipt)); hRatioFEWZScalePDFErrBand->SetBinContent(ipt,hFEWZ_Xsec_LogScale->GetBinContent(ipt)/hData_Xsec_BornLogScale->GetBinContent(ipt)); hRatioFEWZScalePDFErrBand->SetBinError(ipt,0.01+(hFEWZ_Xsec_LogScale->GetBinError(ipt)+hRatioFEWZScaleErr->GetBinError(ipt))/hData_Xsec_BornLogScale->GetBinContent(ipt)); } /// TGraph TGraphErrors *FEWZ_Xsec = new TGraphErrors(hFEWZ_Xsec_LogScale); TGraphErrors* RatioFEWZStatErrBand = new TGraphErrors(hRatioFEWZStatErrBand); TGraphErrors* RatioFEWZQCDScaleErrBand = new TGraphErrors(hRatioFEWZQCDScaleErrBand); TGraphErrors* RatioFEWZScalePDFErrBand = new TGraphErrors(hRatioFEWZScalePDFErrBand); /////==========FEWZ related stuff Finished here========================================= /////==========ResBos Starts here============================================== // // ResBos X sec value and errors, making TGraph . TH1D* hResBos30_CentralYield_LinScale; hResBos30_CentralYield_LinScale = (TH1D*)f_Resbos->Get("hResbos30")->Clone("hResBos30_CentralYield_LinScale"); TH1D* AllResbos[7]; for( int i(0);i<7;i++) { Numb = 29+i; sprintf(tmpName_org,"hResbos%d",Numb); sprintf(tmpName,"AllResbos_%d",i); AllResbos[i] = (TH1D*)f_Resbos->Get(tmpName_org)->Clone(tmpName); } //Errors Double_t Resb_errMax[nBins-1]; Double_t Resb_errMin[nBins-1]; double tmpVal,tmpDiff; for( int ipt(0);ipt<nBins-1;ipt++) { double nomVal = AllResbos[1]->GetBinContent(ipt+1); Resb_errMax[ipt] = -99999; Resb_errMin[ipt] = 990009; for (int i(0);i<7;i++) { tmpVal = AllResbos[i]->GetBinContent(ipt+1); tmpDiff = tmpVal - nomVal; if( tmpDiff > Resb_errMax[ipt] ) Resb_errMax[ipt] = tmpDiff; if( tmpDiff < Resb_errMin[ipt] ) Resb_errMin[ipt] = tmpDiff; } if (Resb_errMax[ipt] < 0) Resb_errMax[ipt] = 0.; if (Resb_errMin[ipt] > 0) Resb_errMin[ipt] = 0.; if (Resb_errMin[ipt] < 0) Resb_errMin[ipt] = -Resb_errMin[ipt]; Resb_errMax[ipt] = Resb_errMax[ipt]/hWptBins_LinScale->GetXaxis()->GetBinWidth(ipt+1); Resb_errMin[ipt] = Resb_errMin[ipt]/hWptBins_LinScale->GetXaxis()->GetBinWidth(ipt+1); } // X-sex and error Log scale TH1D *hResBos30_CentralYield_LogScale = new TH1D("hResBos30_CentralYield_LogScale","hResBos30_CentralYield_LogScale",nBins-1,WptLogBins);hResBos30_CentralYield_LogScale->Sumw2(); Double_t hResb30_CentralXsec[nBins-1]; Double_t RatioResbVal[nBins-1],errResbosDataLo[nBins-1],errResbosDataHi[nBins-1]; for( int ipt(0);ipt<nBins-1;ipt++) { hResBos30_CentralYield_LogScale->SetBinContent(ipt+1,hResBos30_CentralYield_LinScale->GetBinContent(ipt+1)/hWptBins_LinScale->GetXaxis()->GetBinWidth(ipt+1) ); hResb30_CentralXsec[ipt] = hResBos30_CentralYield_LinScale->GetBinContent(ipt+1)/hWptBins_LinScale->GetXaxis()->GetBinWidth(ipt+1); RatioResbVal[ipt]=hResBos30_CentralYield_LogScale->GetBinContent(ipt+1)/hData_Xsec_BornLogScale->GetBinContent(ipt+1); errResbosDataLo[ipt]=Resb_errMin[ipt]/hData_Xsec_BornLogScale->GetBinContent(ipt+1); errResbosDataHi[ipt]=Resb_errMax[ipt]/hData_Xsec_BornLogScale->GetBinContent(ipt+1); } /// Theory/Data ratio plot errors related to Real Data TGraphAsymmErrors *Resb30_CentralXsec = new TGraphAsymmErrors(nBins-1, ax, hResb30_CentralXsec, aex, aex, Resb_errMin, Resb_errMax); TGraphAsymmErrors *RatioResbosErrBand = new TGraphAsymmErrors(nBins-1, ax, RatioResbVal, aex, aex, errResbosDataLo, errResbosDataHi); /////==========ResBos related stuff Finished here========================================= //// Now design and Draw //Data RatioDataErrBand->SetFillColor(kBlack); RatioDataErrBand->SetFillStyle(3354); //Powheg Powheg_Xsec_Born->SetFillColor(kRed); Powheg_Xsec_Born->SetFillStyle(3345); RatioPowhegStatErrBand->SetFillColor(kRed-10); RatioPowhegStatErrBand->SetFillStyle(3001); RatioPowhegPDFErrBand->SetFillColor(kRed+2); RatioPowhegPDFErrBand->SetFillStyle(3001); //FEWZ FEWZ_Xsec->SetFillColor(kGreen); FEWZ_Xsec->SetFillStyle(3444); RatioFEWZStatErrBand->SetFillColor(kGreen); RatioFEWZStatErrBand->SetFillStyle(3001); RatioFEWZQCDScaleErrBand->SetFillColor(kGreen+7); RatioFEWZQCDScaleErrBand->SetFillStyle(3001); RatioFEWZScalePDFErrBand->SetFillColor(kGreen+3); RatioFEWZScalePDFErrBand->SetFillStyle(3001); //ResBos Resb30_CentralXsec->SetFillColor(kBlue); Resb30_CentralXsec->SetFillStyle(3354); RatioResbosErrBand->SetFillColor(kBlue-7); RatioResbosErrBand->SetFillStyle(3001); TLegend *lL =new TLegend(0.2,0.2,0.52,0.38); lL->SetFillColor(0); lL->SetBorderSize(0); lL->AddEntry(Data_Xsec_Born,"data","PL"); lL->AddEntry(Powheg_Xsec_Born,"POWHEG CT10 NLO","f"); lL->AddEntry(FEWZ_Xsec,"FEWZ CT10 NNLO","f"); lL->AddEntry(Resb30_CentralXsec,"ResBos CT10 NNLL","f"); TPaveText *tb = new TPaveText(0.2,0.39,0.52,0.5,"NDC"); tb->SetBorderSize(0); tb->SetFillStyle(0); tb->AddText("18.4 pb^{-1} at #sqrt{s} = 8 TeV"); if (BaseName=="WpToMuNu") tb->AddText("W^{+} #rightarrow #mu^{+} #nu"); if (BaseName=="WmToMuNu") tb->AddText("W^{-} #rightarrow #mu^{-} #bar{#nu}"); if (BaseName=="WpToEleNu") tb->AddText("W^{+} #rightarrow e^{+} #nu"); if (BaseName=="WmToEleNu") tb->AddText("W^{-} #rightarrow e^{-} #bar{#nu}"); TCanvas *lC1 = new TCanvas("Can","Can",800,840); lC1->cd(); lC1->SetLogy(); lC1->cd(1)->SetPad(0,0.05,0.95,1.0); lC1->cd(1)->SetTopMargin(0.05); lC1->cd(1)->SetBottomMargin(0.1); lC1->cd(1)->SetLeftMargin(0.15); lC1->cd(1)->SetRightMargin(0.07); lC1->cd(1)->SetTickx(1); lC1->cd(1)->SetTicky(1); gStyle->SetLineWidth(2.); gStyle->SetOptStat(0); gStyle->SetHatchesSpacing(0.75); gStyle->SetHatchesLineWidth(2); gPad->SetLogx(1); gPad->SetLogy(1); Powheg_Xsec_Born->GetYaxis()->SetRangeUser(1e-3,5*hResb30_CentralXsec[0]); Powheg_Xsec_Born->SetTitle(""); Powheg_Xsec_Born->GetYaxis()->SetTitle("d#sigma/dp_{T}^{W} [pb/GeV]"); Powheg_Xsec_Born->GetYaxis()->SetTitleOffset(1.8); Powheg_Xsec_Born->GetXaxis()->SetTitle("p_{T}^{W} [GeV]"); TPaveText *cmspre = new TPaveText(0.63,0.95,0.95,0.99,"NDC"); cmspre->SetBorderSize(0); cmspre->SetFillStyle(0); cmspre->AddText("CMS Preliminary"); Powheg_Xsec_Born->Draw("A2"); FEWZ_Xsec->Draw("2"); Resb30_CentralXsec->Draw("2"); Data_Xsec_Born->Draw("p"); lL->Draw(); tb->Draw(); cmspre->Draw(); if(BaseName=="WpToMuNu") sprintf(tmpName,"wpmnCrossSec.png"); if(BaseName=="WmToMuNu") sprintf(tmpName,"wmmnCrossSec.png"); if(BaseName=="WpToEleNu") sprintf(tmpName,"wpenCrossSec.png"); if(BaseName=="WmToEleNu") sprintf(tmpName,"wmenCrossSec.png"); lC1->SaveAs(tmpName); TCanvas *lC2 = new TCanvas("Can","Can",800,800); lC2->cd(); lC2->SetLogy(); lC2->Divide(1,3,0,0); lC2->cd(1)->SetPad(0,0.67,0.95,0.95); lC2->cd(1)->SetTopMargin(0.15); lC2->cd(1)->SetBottomMargin(0.01); lC2->cd(1)->SetLeftMargin(0.15); lC2->cd(1)->SetRightMargin(0.07); lC2->cd(1)->SetTickx(1); lC2->cd(1)->SetTicky(1); lC2->cd(1)->SetLogx(1); TPaveText *tb1 = new TPaveText(0.15,0.72,0.35,0.82,"NDC"); tb1->SetBorderSize(0); tb1->SetFillStyle(0); tb1->SetTextSize(0.12); tb1->AddText("ResBos"); TLegend *rL1 =new TLegend(0.2,0.1,0.58,0.30); rL1->SetFillColor(0); rL1->SetBorderSize(0); rL1-> SetNColumns(2); rL1->AddEntry(RatioResbosErrBand,"Theory syst","F"); rL1->AddEntry(hRatioDataStatErr,"Data stat","PLE1"); hRatioDataStatErr->SetTitle(""); rL1->AddEntry(hRatioDataStatErr,"",""); rL1->AddEntry(RatioDataErrBand,"Data stat+syst","F"); rL1->SetTextSize(0.07); TLegend *tL1 =new TLegend(0.17,0.72,0.37,0.82); tL1->SetFillColor(0); tL1->SetBorderSize(0); tL1->AddEntry(RatioResbosErrBand,"ResBos","F"); tL1->SetTextSize(0.12); tL1->SetTextFont(2); TPaveText *cmspre2 = new TPaveText(0.05,0.92,0.85,0.99,"NDC"); cmspre2->SetBorderSize(0); cmspre2->SetFillStyle(0); cmspre2->SetTextSize(0.10); cmspre2->AddText("CMS Preliminary, 18.4 pb^{-1} at #sqrt{s} = 8 TeV"); TPaveText *tb4 = new TPaveText(0.35,0.72,0.67,0.83,"NDC"); tb4->SetBorderSize(0); tb4->SetFillStyle(0); if (BaseName=="WpToMuNu") tb4->AddText("W^{+} #rightarrow #mu^{+} #nu"); if (BaseName=="WmToMuNu") tb4->AddText("W^{-} #rightarrow #mu^{-} #bar{#nu}"); if (BaseName=="WpToEleNu") tb4->AddText("W^{+} #rightarrow e^{+} #nu"); if (BaseName=="WmToEleNu") tb4->AddText("W^{-} #rightarrow e^{-} #bar{#nu}"); drawDifference(hResBos30_CentralYield_LogScale, hData_Xsec_BornLogScale, hRatioDataErrBand, RatioPowhegStatErrBand,1,RatioPowhegStatErrBand,RatioResbosErrBand,hRatioDataStatErr,RatioFEWZQCDScaleErrBand); rL1->Draw(); //tb1->Draw(); tL1->Draw(); tb4->Draw(); cmspre2->Draw(); lC2->cd(2)->SetPad(0,0.37,0.95,0.65); lC2->cd(2)->SetTopMargin(0.01); lC2->cd(2)->SetBottomMargin(0.01); lC2->cd(2)->SetLeftMargin(0.15); lC2->cd(2)->SetRightMargin(0.07); lC2->cd(2)->SetTickx(1); lC2->cd(2)->SetTicky(1); lC2->cd(2)->SetLogx(1); TPaveText *tb2 = new TPaveText(0.15,0.82,0.35,0.92,"NDC"); tb2->SetBorderSize(0); tb2->SetFillStyle(0); tb2->SetTextSize(0.12); tb2->AddText("Powheg"); TLegend *rL2 =new TLegend(0.2,0.05,0.68,0.30); rL2->SetFillColor(0); rL2->SetBorderSize(0); rL2-> SetNColumns(2); rL2->AddEntry(RatioPowhegPDFErrBand,"PDF ","F"); rL2->AddEntry(hRatioDataStatErr,"Data stat","PLE1"); rL2->AddEntry(RatioPowhegStatErrBand,"stat","F"); rL2->AddEntry(RatioDataErrBand,"Data stat+syst","F"); rL2->SetTextSize(0.07); TLegend *tL2 =new TLegend(0.17,0.85,0.37,0.95); tL2->SetFillColor(0); tL2->SetBorderSize(0); tL2->AddEntry(RatioPowhegPDFErrBand,"POWHEG","F"); tL2->SetTextSize(0.12); tL2->SetTextFont(2); //drawDifference(hPowhegLog,hDataLog,hDataErrBand,pRatio,2,pRatioPDF,ResbosErrBand,hStatErr,fScaleRatio); //drawDifference(Powheg_Xsec_Born,hData_Xsec_BornLogScale,hRatioDataErrBand,RatioPowhegStatErrBand,2,RatioPowhegPDFErrBand,RatioResbosErrBand,hRatioDataStatErr,RatioFEWZQCDScaleErrBand); drawDifference(hPowheg_Xsec_BornLogScale,hData_Xsec_BornLogScale,hRatioDataErrBand,RatioPowhegStatErrBand,2,RatioPowhegPDFErrBand,RatioResbosErrBand,hRatioDataStatErr,RatioFEWZQCDScaleErrBand); rL2->Draw(); tL2->Draw(); lC2->cd(3)->SetPad(0,0.07,0.95,0.35); lC2->cd(3)->SetTopMargin(0.01); lC2->cd(3)->SetBottomMargin(0.05); lC2->cd(3)->SetLeftMargin(0.15); lC2->cd(3)->SetRightMargin(0.07); lC2->cd(3)->SetTickx(1); lC2->cd(3)->SetTicky(1); lC2->cd(3)->SetLogx(1); TPaveText *tb3 = new TPaveText(0.15,0.82,0.35,0.92,"NDC"); tb3->SetBorderSize(0); tb3->SetFillStyle(0); tb3->SetTextSize(0.12); tb3->AddText("Fewz"); TLegend *rL3 =new TLegend(0.2,0.1,0.58,0.30); rL3->SetFillColor(0); rL3->SetBorderSize(0); rL3-> SetNColumns(2); rL3->AddEntry(RatioFEWZScalePDFErrBand,"PDF","F"); rL3->AddEntry(hRatioDataStatErr,"Data stat","PLE1"); rL3->AddEntry(RatioFEWZQCDScaleErrBand,"QCD scales","F"); rL3->AddEntry(RatioDataErrBand,"Data stat+syst","F"); rL3->AddEntry(RatioFEWZStatErrBand,"stat","F"); rL3->SetTextSize(0.07); TLegend *tL3 =new TLegend(0.17,0.85,0.37,0.95); tL3->SetFillColor(0); tL3->SetBorderSize(0); tL3->AddEntry(RatioFEWZScalePDFErrBand,"FEWZ","F"); tL3->SetTextSize(0.12); tL3->SetTextFont(2); drawDifference(hFEWZ_Xsec_LogScale,hData_Xsec_BornLogScale,hRatioDataErrBand,RatioFEWZStatErrBand,3,RatioFEWZScalePDFErrBand,RatioResbosErrBand,hRatioDataStatErr,RatioFEWZQCDScaleErrBand); rL3->Draw(); tL3->Draw(); if(BaseName=="WpToMuNu") sprintf(tmpName,"wpmnRatioTheoData.png"); if(BaseName=="WmToMuNu") sprintf(tmpName,"wmmnRatioTheoData.png"); if(BaseName=="WpToEleNu") sprintf(tmpName,"wpenRatioTheoData.png"); if(BaseName=="WmToEleNu") sprintf(tmpName,"wmenRatioTheoData.png"); lC2->SaveAs(tmpName); return 0; }