Example #1
0
void Draw_ALICEFor_JPsi_RaaVsNpart(TLegend *lgd)
{
  int nbinsALICE=9;
  Double_t NPartALICE[10]={357,262,187,128,86,53,30,16,8};
  Double_t ErrNPartALICE[10]={0};
  Double_t RaaALICE[10] = {0.47,0.48,0.51,0.51,0.52,0.61,0.70,0.74,0.94}; 
  Double_t SystErrALICE[10] = {0.03,0.02,0.02,0.02,0.03,0.05,0.06,0.09,0.1};
  
  TGraphErrors *grRaaALICE = new TGraphErrors(nbinsALICE, NPartALICE, RaaALICE, ErrNPartALICE, SystErrALICE);  
  grRaaALICE->SetMarkerStyle(20);
  grRaaALICE->SetMarkerColor(4);
  grRaaALICE->GetYaxis()->SetRangeUser(0,1.7);
  
  TAxis *Xaxis2 = grRaaALICE->GetXaxis();
  Xaxis2->SetLimits(0.,430.0);
  
  grRaaALICE->GetXaxis()->SetTitle("N_{Part}");
  grRaaALICE->GetYaxis()->SetTitle("R_{AA}");

  grRaaALICE->Draw("AP");
 
  TLine *lh3 = new TLine(0.0,1.0,420,1.0);
  lh3->SetLineColor(1);
  lh3->SetLineStyle(1);
  lh3->SetLineWidth(1.5);
  lh3->Draw("same");
 
  //TLatex *tb= new TLatex;
  //tb->SetNDC(); 
  //tb->SetTextAlign(12);
  //tb->SetTextColor(1);
  //tb->SetTextSize(0.040);
  //tb->DrawLatex(0.22,0.22,"PbPb #sqrt{s_{NN}} = 2.76 TeV");
  //tb->DrawLatex(0.22,0.16,"J/#psi #rightarrow #mu^{+} #mu^{-}, p_{T}^{J/#psi} > 0.0 GeV/c");  
   
  
  TBox *RaaJPsiALICESys[12];
  for(int j=0;j<9;j++){
    RaaJPsiALICESys[j] = new TBox(NPartALICE[j]-3,  RaaALICE[j]-SystErrALICE[j], NPartALICE[j]+3, RaaALICE[j]+SystErrALICE[j]);
  }
  
  for(int j=0;j<9;j++){
    RaaJPsiALICESys[j]->SetFillStyle(0000);
    RaaJPsiALICESys[j]->SetLineColor(4);
    RaaJPsiALICESys[j]->Draw("same"); 
  }
  
  TBox *ALICEGlobalSysJPsi;
  ALICEGlobalSysJPsi = new TBox(400-5, 1 - 0.14, 400+5, 1 + 0.14);
  ALICEGlobalSysJPsi->SetFillStyle(3001);
  ALICEGlobalSysJPsi->SetLineColor(4);
  ALICEGlobalSysJPsi->SetFillColor(4);
  ALICEGlobalSysJPsi->Draw("same"); 

  Draw_ALICEMid_JPsi_RaaVsNpart(lgd);

  lgd->AddEntry(grRaaALICE,"ALICE Data p_{T}^{J/#psi} > 0.0 GeV/c, 2.5 #leq y^{J/#psi} #leq 4.0","P");

}
Example #2
0
void Draw_ALICEMid_JPsi_RaaVsNpart(TLegend *lgd)
{
  //ALICE MID rapidity
  int nbinsALICEMid=3;
  Double_t NPartALICEMid[3]={357,193,46};
  Double_t ErrNPartALICEMid[3]={0};
  Double_t RaaALICEMid[3] = {0.82,0.65,0.73}; 
  Double_t SystErrALICEMid[3] = {0.15,0.10,0.16};
  
  TGraphErrors *grRaaALICEMid = new TGraphErrors(nbinsALICEMid, NPartALICEMid, RaaALICEMid, ErrNPartALICEMid, SystErrALICEMid);  
  grRaaALICEMid->SetMarkerStyle(20);
  grRaaALICEMid->SetMarkerColor(2);
  //grRaaALICEMid->SetLineColor(2);
  grRaaALICEMid->GetYaxis()->SetRangeUser(0,1.5);
  
  TAxis *Xaxis = grRaaALICEMid->GetXaxis();
  Xaxis->SetLimits(0.,430.0);
  grRaaALICEMid->GetXaxis()->SetTitle("N_{Part}");
  grRaaALICEMid->GetYaxis()->SetTitle("R_{AA}");
  
  grRaaALICEMid->Draw("Psame");
  
  //TLatex *tb= new TLatex;
  //tb->SetNDC(); 
  //tb->SetTextAlign(12);
  //tb->SetTextColor(1);
  //tb->SetTextSize(0.040);
  //tb->DrawLatex(0.55,0.90,"PbPb #sqrt{s_{NN}} = 2.76 TeV");
  //tb->DrawLatex(0.22,0.16,"J/#psi #rightarrow #mu^{+} #mu^{-}, p_{T}^{J/#psi} > 0.0 GeV/c");  
  //tb->DrawLatex(0.55,0.85,"p_{T}^{J/#psi} > 0.0 GeV/c");  
  
  TLine *lh3 = new TLine(0.0,1.0,420,1.0);
  lh3->SetLineColor(1);
  lh3->SetLineStyle(1);
  lh3->SetLineWidth(1.5);
  lh3->Draw("same");
    
  TBox *RaaJPsiALICEMidSys[12];
  for(int j=0;j<3;j++){
    RaaJPsiALICEMidSys[j] = new TBox(NPartALICEMid[j]-3,  RaaALICEMid[j]-SystErrALICEMid[j], NPartALICEMid[j]+3, RaaALICEMid[j]+SystErrALICEMid[j]);
  }
  
  for(int j=0;j<3;j++){
    RaaJPsiALICEMidSys[j]->SetFillStyle(0000);
    RaaJPsiALICEMidSys[j]->SetLineColor(2);
    RaaJPsiALICEMidSys[j]->Draw("same"); 
  }
  
  TBox *ALICEMidGlobalSysJPsi;
  ALICEMidGlobalSysJPsi = new TBox(385-5, 1 - 0.26, 385+5, 1 + 0.26);
  
  ALICEMidGlobalSysJPsi->SetFillStyle(3001);
  ALICEMidGlobalSysJPsi->SetLineColor(2);
  ALICEMidGlobalSysJPsi->SetFillColor(2);
  ALICEMidGlobalSysJPsi->Draw("same"); 

  lgd->AddEntry(grRaaALICEMid,"ALICE Data p_{T}^{J/#psi} > 0.0 GeV/c, |y^{J/#psi}| #leq 1.0","P");
  
}
void Draw_CMS_Y1S_RaaVsRap(TLegend *lgd)
{
  const int nbinsRap=6;

  Double_t RapCMS[nbinsRap]={0.2,0.6,1.0,1.4,1.8,2.2};
  Double_t ErrRapCMS[nbinsRap]={0};
  
  Double_t RaaRapCMS[nbinsRap] = {0.402,0.377,0.452,0.461,0.466,0.35}; 
  Double_t RaaRapStatErrCMS[nbinsRap] = {0.025,0.025,0.030,0.034,0.039,0.053};
  Double_t RaaRapSystErrCMS[nbinsRap] = {0.0404,0.038,0.046,0.0466,0.0484,0.0373};
  
  TGraphErrors *grRaaRapCMS = new TGraphErrors(nbinsRap, RapCMS, RaaRapCMS, ErrRapCMS, RaaRapStatErrCMS);  
  grRaaRapCMS->SetMarkerStyle(20);
  grRaaRapCMS->SetMarkerColor(4);
  grRaaRapCMS->GetYaxis()->SetRangeUser(0,3.0);
  grRaaRapCMS->GetXaxis()->SetTitle("p_{T}(GeV/c)");
  grRaaRapCMS->GetYaxis()->SetTitle("R_{AA}");
   
  TAxis *Xaxis2 = grRaaRapCMS->GetXaxis();
  Xaxis2->SetLimits(0.,2.4);
  
  grRaaRapCMS->Draw("AP");
  
  TLine *lh4 = new TLine(0.0,1.0,20.0,1.0);
  lh4->SetLineColor(1);
  lh4->SetLineStyle(1);
  lh4->SetLineWidth(2);
  lh4->Draw("same");


  TLatex *tb= new TLatex;
  tb->SetNDC(); 
  tb->SetTextAlign(12);
  tb->SetTextColor(1);
  tb->SetTextSize(0.040);
  //tb->DrawLatex(0.55,0.22,"PbPb #sqrt{s_{NN}} = 2.76 TeV");
  //tb->DrawLatex(0.55,0.16,"#varUpsilon #rightarrow #mu^{+} #mu^{-}, p_{T}^{#varUpsilon} > 0.0 GeV/c");  
  
  TBox *RaaRapCMSSys[nbinsRap];
  for(int j=0;j<nbinsRap;j++){
    RaaRapCMSSys[j] = new TBox(RapCMS[j]-0.1,  RaaRapCMS[j]-RaaRapSystErrCMS[j], RapCMS[j]+0.1,  RaaRapCMS[j]+RaaRapSystErrCMS[j]);
  }
  
  for(int j=0;j<nbinsRap;j++){
    RaaRapCMSSys[j]->SetFillStyle(0000);
    RaaRapCMSSys[j]->SetLineColor(4);
    RaaRapCMSSys[j]->Draw("same"); 
  }
    
  TBox *CMSGlobalSysRap;
  CMSGlobalSysRap = new TBox(18-0.2, 1 - 0.083, 18+0.2, 1 + 0.083);
  CMSGlobalSysRap->SetFillStyle(3001);
  CMSGlobalSysRap->SetLineColor(4);
  CMSGlobalSysRap->SetFillColor(4);
  //CMSGlobalSysRap->Draw("same"); 
    
  lgd->AddEntry(grRaaRapCMS,"CMS Data", "P");  

  }
Example #4
0
void Draw_CMS_JPsi_RaaVsRap(TLegend *lgd)
{
  //=============== CMS Raa Vs Rap Data ===============================================================//
  //AvpT 10.92,9.65,8.92
  int nbinsRapCMS=3;
  Double_t RapCMSD[3]={0.6,1.4,2.0};
  Double_t ErrRapCMS[3]={0.6,0.2,0.4};
  Double_t RaaRapCMS[3] = {0.31,0.33,0.36}; 
  Double_t RaaRapStatErrCMS[3] = {0.02,0.03,0.03};
  Double_t RaaRapSystErrCMS[3] = {0.03,0.04,0.04};

  TGraphErrors *grRaaRapCMS = new TGraphErrors(nbinsRapCMS, RapCMSD, RaaRapCMS, ErrRapCMS, RaaRapStatErrCMS);  
  grRaaRapCMS->SetMarkerStyle(20);
  grRaaRapCMS->SetMarkerColor(2);
  grRaaRapCMS->GetYaxis()->SetRangeUser(0,1.5);
  grRaaRapCMS->GetXaxis()->SetTitle("|y|");
  grRaaRapCMS->GetYaxis()->SetTitle("R_{AA}");
  
  TAxis *XaxisgrRaaRapCMS = grRaaRapCMS->GetXaxis();
  XaxisgrRaaRapCMS->SetLimits(0.0,2.4);
  
  grRaaRapCMS->Draw("AP"); 

  TLine *lh_grRaaRapCMS = new TLine(0.0,1.0,2.4,1.0);
  lh_grRaaRapCMS->SetLineColor(1);
  lh_grRaaRapCMS->SetLineStyle(1);
  lh_grRaaRapCMS->SetLineWidth(1.5);
  lh_grRaaRapCMS->Draw("same");

  TLatex *tb= new TLatex;
  tb->SetNDC(); 
  tb->SetTextAlign(12);
  tb->SetTextColor(1);
  tb->SetTextSize(0.040);
  tb->DrawLatex(0.20,0.20,"Pb+Pb #sqrt{s_{NN}} = 2.76 TeV");
  tb->DrawLatex(0.20,0.15,"J/#psi #rightarrow #mu^{+} #mu^{-}, p_{T}^{J/#psi} > 6.5 GeV/c");  
  
  TBox *RaaRapJPsiCMSSys[4];
  for(int j=0;j<3;j++){
    RaaRapJPsiCMSSys[j] = new TBox(RapCMSD[j]-0.05,  RaaRapCMS[j]-RaaRapSystErrCMS[j], RapCMSD[j]+0.05,  RaaRapCMS[j]+RaaRapSystErrCMS[j]);
  }
  
  for(int j=0;j<3;j++){
    RaaRapJPsiCMSSys[j]->SetFillStyle(0000);
    RaaRapJPsiCMSSys[j]->SetLineColor(2);
    RaaRapJPsiCMSSys[j]->Draw("same"); 
  }
  
  TBox *CMSGlobalSysJPsiRap;
  CMSGlobalSysJPsiRap = new TBox(0.2-0.05, 1 - 0.05, 0.2+0.05, 1 + 0.05);
  CMSGlobalSysJPsiRap->SetFillStyle(3001);
  CMSGlobalSysJPsiRap->SetLineColor(2);
  CMSGlobalSysJPsiRap->SetFillColor(2);
  CMSGlobalSysJPsiRap->Draw("same"); 


  lgd->AddEntry(grRaaRapCMS,"CMS Data", "P");
}
Example #5
0
void HiggsPlot::PlotBF(int iDecay, double tBmH_max, double BF_max){
  if(iDecay<0 || iDecay>2) {cout<<"iDecay must be 0, 1 or 2"<<endl; return;}
  styles style; style.setPadsStyle(-1); style.setDefaultStyle();
  int nBins = 1000;
  TString hName, epsName = "public_html/Higgs_BF_TEMP_BaBar.eps", label, Llabel, Rlabel;
  TString yTitle[] = {"BF(B#rightarrow#tau#nu) (10^{-5})", "R(D)", "R(D*)"};
  TString TagDecay[] = {"BF", "R(D)", "R(D*)"};
  TCanvas can;
  TH1F *hBF[2];
  for(int his=0; his<1; his++) {
    hName = "hBF"; hName += his;
    hBF[his] = new TH1F(hName,"",nBins,0,tBmH_max);
  }
  double tBmH, BF[2];
  for(int bin=1; bin<=nBins; bin++){
    tBmH = hBF[0]->GetBinCenter(bin);
    Compute(tBmH,BF,iDecay);
    hBF[0]->SetBinContent(bin, BF[0]);
    hBF[0]->SetBinError(bin, BF[1]);
  }
  hBF[0]->SetFillColor(2); hBF[0]->SetLineColor(2);
  hName += "1";
  hBF[1] = static_cast<TH1F*>(hBF[0]->Clone(hName));
  for(int bin=1; bin<=nBins; bin++)hBF[1]->SetBinError(bin,0);
  hBF[1]->SetFillColor(0);hBF[1]->SetLineColor(1); hBF[1]->SetLineWidth(2);

  TBox box; box.SetLineColor(4);box.SetFillColor(4);
  TLine line; line.SetLineStyle(1); line.SetLineColor(4); line.SetLineWidth(3);
  if(BF_max>0) hBF[0]->SetMaximum(BF_max);
  hBF[0]->Draw("e3");
  box.SetFillStyle(3002); 
  box.DrawBox(0,Measurement[iDecay][0]-Measurement[iDecay][1],
	      tBmH_max,Measurement[iDecay][0]+Measurement[iDecay][1]);
  line.DrawLine(0,Measurement[iDecay][0],tBmH_max,Measurement[iDecay][0]);
  hBF[0]->Draw("e3 same");
  hBF[1]->Draw("c same");

  Compute(0,BF,iDecay);
  label = "#splitline{"; label += TagDecay[iDecay]; label += "_{SM} = ";
  if(iDecay==0){
    label+="(";label+=RoundNumber(BF[0],1); label+=" #pm ";
    label+=RoundNumber(BF[1],1); label+=")#times10^{-5}}{BF_{exp} = (";
    label+=RoundNumber(Measurement[iDecay][0],1); label+=" #pm ";
    label+=RoundNumber(Measurement[iDecay][1],1); label+=")#times10^{-5}}";
    Llabel = ""; Rlabel = label;
  } else {
    label+=RoundNumber(BF[0],3); label+=" #pm ";
    label+=RoundNumber(BF[1],3); label+="}{"; label += TagDecay[iDecay]; label += "_{exp} = ";
    label+=RoundNumber(Measurement[iDecay][0],3); label+=" #pm ";
    label+=RoundNumber(Measurement[iDecay][1],3); label+="}";
    Rlabel = ""; Llabel = label;
  }
  style.setTitles(hBF[0],"tan#beta/m_{H^{+}} (GeV^{-1})",yTitle[iDecay],Llabel,Rlabel);
  epsName.ReplaceAll("TEMP",DecayName[iDecay]);
  can.SaveAs(epsName);
  for(int his=0; his<2; his++) hBF[his]->Delete();
}
Example #6
0
void Draw_CMS_JPsi_RaaVsNpart(TLegend *lgd)
{

int nbins = 12;
  Double_t RaaCMS[20]={0.23,0.24,0.29,0.33,0.38,0.40,0.45,0.41,0.52,0.52,0.64,0.64};
  Double_t StatErrCMS[20]={0.01,0.01,0.02,0.02,0.02,0.03,0.03,0.03,0.04,0.04,0.05,0.05};
  Double_t SystErrCMS[20]={0.02,0.03,0.03,0.03,0.04,0.04,0.05,0.04,0.05,0.05,0.07,0.13};
  Double_t NPartCMS[20]={Npart(0,2),Npart(2,4),Npart(4,6),Npart(6,8),Npart(8,10),Npart(10,12),
			 Npart(12,14),Npart(14,16),Npart(16,18),Npart(18,20),Npart(20,24),
			 Npart(24,40)};
  Double_t ErrNPartCMS[20]={0};
  
  TGraphErrors *grRaaCMS = new TGraphErrors(nbins, NPartCMS, RaaCMS, ErrNPartCMS, StatErrCMS);  
  grRaaCMS->SetMarkerStyle(21);
  grRaaCMS->SetMarkerColor(2);
  grRaaCMS->GetYaxis()->SetRangeUser(0,1.7);
  grRaaCMS->GetXaxis()->SetTitle("N_{Part}");
  grRaaCMS->GetYaxis()->SetTitle("R_{AA}");
  
  grRaaCMS->Draw("AP");
  TBox *RaaJPsiSys[12];
  for(int j=0;j<12;j++){
    RaaJPsiSys[j] = new TBox(NPartCMS[j]-3,  RaaCMS[j]-SystErrCMS[j], NPartCMS[j]+3, RaaCMS[j]+SystErrCMS[j]);
  }
  
  for(int j=0;j<12;j++){
    RaaJPsiSys[j]->SetFillStyle(0000);
    RaaJPsiSys[j]->SetLineColor(6);
    RaaJPsiSys[j]->Draw("same"); 
  }
  
  TLine *lh2 = new TLine(0.0,1.0,400,1.0);
  lh2->SetLineColor(1);
  lh2->SetLineStyle(1);
  lh2->SetLineWidth(2);
  lh2->Draw("same");
  
  TBox *GlobalSysJPsi;
  GlobalSysJPsi = new TBox(400-5, 1 - 0.06, 400+5, 1 + 0.06);
  GlobalSysJPsi->SetFillStyle(3001);
  GlobalSysJPsi->SetLineColor(6);
  GlobalSysJPsi->SetFillColor(6);
  GlobalSysJPsi->Draw("same"); 
  
  TLatex *tb= new TLatex;
  tb->SetNDC(); 
  tb->SetTextAlign(12);
  tb->SetTextColor(1);
  tb->SetTextSize(0.040);
  tb->DrawLatex(0.17,0.23,"PbPb #sqrt{s_{NN}} = 2.76 TeV");
  tb->DrawLatex(0.17,0.17,"p_{T}^{J/#psi} > 6.5 GeV/c");

  lgd->AddEntry(grRaaCMS,"CMS Data", "P");

}
Example #7
0
//--------------------------
// DrawTargetBoundaries
//--------------------------
void DrawTargetBoundaries(int color=target_color)
{
  double Zlo = 50.0;
  double Zhi = Zlo + 30.0;
  double Rlo = 0.0;
  double Rhi = Rlo + 1.5;
  if (full) { Rlo=-1.5; Rhi=Rlo+3; }

  TBox *box = new TBox(Zlo, Rlo, Zhi, Rhi);
  box->SetLineWidth(2.0);
  if (fill_detectors) { box->SetFillColor(color); box->SetFillStyle(1001); }
  else box->SetFillStyle(0);
  box->SetLineColor(color);
  box->Draw();

  TLatex *lab = new TLatex(Zlo-5, 0, "target");
  if (full) lab->SetTextAlign(32); else lab->SetTextAlign(31);
  lab->SetTextSize(0.02);
  lab->SetTextColor(color);
  lab->Draw();
}
Example #8
0
void drawTransition(){
  TBox *bTrans = new TBox(0., 0., 0.97, 0.97);
  if(iColor)bTrans->SetFillColor(kYellow-9);
  if (! iColor)bTrans->SetFillStyle(4017);
  bTrans->Draw();

  TEllipse *eTrans1 = new TEllipse(0., 0., 0.9, 0.7, 70., 90., 0.);
  eTrans1->SetNoEdges();
  eTrans1->SetFillColor(17);
  eTrans1->SetLineWidth(2);
  eTrans1->SetLineStyle(7);
  eTrans1->Draw();

  TEllipse *eTrans2 = new TEllipse(0., 0., 0.9, 0.7, 0., 70., 0.);
  eTrans2->SetNoEdges();
  eTrans2->SetFillColor(17);
  eTrans2->SetLineWidth(2);
  eTrans2->Draw();

  TMarker *mCrit = new TMarker(0.29, 0.6625, 20);
  mCrit->SetMarkerSize(1.4);
  mCrit->Draw();
}
Example #9
0
//------------------------------------------------------------------------------
//
// drawXS
//
//------------------------------------------------------------------------------
void drawXS(UInt_t theCharge = WInclusive)
{
  gStyle->SetEndErrorSize(5);


  // 7 TeV inclusive
  //----------------------------------------------------------------------------
  xs_value[WInclusive][EEE] = 23.00;
  xs_value[WInclusive][EEM] = 19.67;
  xs_value[WInclusive][MME] = 19.81;
  xs_value[WInclusive][MMM] = 21.02;
  xs_value[WInclusive][all] = 20.76;
  
  xs_stat[WInclusive][EEE] = 3.10;
  xs_stat[WInclusive][EEM] = 2.73;
  xs_stat[WInclusive][MME] = 2.60;
  xs_stat[WInclusive][MMM] = 2.30;
  xs_stat[WInclusive][all] = 1.32;
  
  xs_syst[WInclusive][EEE] = 1.39;
  xs_syst[WInclusive][EEM] = 1.50;
  xs_syst[WInclusive][MME] = 1.55;
  xs_syst[WInclusive][MMM] = 1.47;
  xs_syst[WInclusive][all] = 1.13;
  
  xs_lumi[WInclusive][EEE] = 0.51;
  xs_lumi[WInclusive][EEM] = 0.43;
  xs_lumi[WInclusive][MME] = 0.44;
  xs_lumi[WInclusive][MMM] = 0.46;
  xs_lumi[WInclusive][all] = 0.46;
  
  
  // 7 TeV W+
  //----------------------------------------------------------------------------
  xs_value[WPlus][EEE] = 13.39;
  xs_value[WPlus][EEM] = 13.18;
  xs_value[WPlus][MME] = 14.14;
  xs_value[WPlus][MMM] = 11.43;
  xs_value[WPlus][all] = 12.73;
  
  xs_stat[WPlus][EEE] = 2.39;
  xs_stat[WPlus][EEM] = 2.24;
  xs_stat[WPlus][MME] = 2.19;
  xs_stat[WPlus][MMM] = 1.71;
  xs_stat[WPlus][all] = 1.04;
  
  xs_syst[WPlus][EEE] = 0.75;
  xs_syst[WPlus][EEM] = 0.64;
  xs_syst[WPlus][MME] = 0.74;
  xs_syst[WPlus][MMM] = 0.53;
  xs_syst[WPlus][all] = 0.59;
  
  xs_lumi[WPlus][EEE] = 0.29;
  xs_lumi[WPlus][EEM] = 0.29;
  xs_lumi[WPlus][MME] = 0.31;
  xs_lumi[WPlus][MMM] = 0.25;
  xs_lumi[WPlus][all] = 0.28;
  
  
  // 7 TeV W-
  //----------------------------------------------------------------------------
  xs_value[WMinus][EEE] = 9.49;
  xs_value[WMinus][EEM] = 6.51;
  xs_value[WMinus][MME] = 5.73;
  xs_value[WMinus][MMM] = 9.48;
  xs_value[WMinus][all] = 7.46;
  
  xs_stat[WMinus][EEE] = 1.95;
  xs_stat[WMinus][EEM] = 1.58;
  xs_stat[WMinus][MME] = 1.40;
  xs_stat[WMinus][MMM] = 1.52;
  xs_stat[WMinus][all] = 0.79;
  
  xs_syst[WMinus][EEE] = 0.60;
  xs_syst[WMinus][EEM] = 0.37;
  xs_syst[WMinus][MME] = 0.37;
  xs_syst[WMinus][MMM] = 0.50;
  xs_syst[WMinus][all] = 0.40;
  
  xs_lumi[WMinus][EEE] = 0.21;
  xs_lumi[WMinus][EEM] = 0.14;
  xs_lumi[WMinus][MME] = 0.13;
  xs_lumi[WMinus][MMM] = 0.21;
  xs_lumi[WMinus][all] = 0.16;


  // Do the work
  //----------------------------------------------------------------------------
  TGraphErrors* gStat = new TGraphErrors(nChannel);
  TGraphErrors* gSyst = new TGraphErrors(nChannel);
  TGraphErrors* gLumi = new TGraphErrors(nChannel);

  for (UInt_t i=0; i<nChannel; i++)
    {
      Double_t errorSquared = (xs_stat[theCharge][i] * xs_stat[theCharge][i]);

      gStat->SetPointError(i, sqrt(errorSquared) / xs_nlo[theCharge], 0.0);
      
      errorSquared += (xs_syst[theCharge][i] * xs_syst[theCharge][i]);

      gSyst->SetPointError(i, sqrt(errorSquared) / xs_nlo[theCharge], 0.0);

      errorSquared += (xs_lumi[theCharge][i] * xs_lumi[theCharge][i]);

      gLumi->SetPointError(i, sqrt(errorSquared) / xs_nlo[theCharge], 0.0);

      gStat->SetPoint(i, xs_value[theCharge][i] / xs_nlo[theCharge], nChannel-i-1);
      gSyst->SetPoint(i, xs_value[theCharge][i] / xs_nlo[theCharge], nChannel-i-1);
      gLumi->SetPoint(i, xs_value[theCharge][i] / xs_nlo[theCharge], nChannel-i-1);
    }


  // Cosmetics
  //----------------------------------------------------------------------------
  gStat->SetLineWidth  (2);
  gStat->SetMarkerSize (1.3);
  gStat->SetMarkerStyle(kFullCircle);

  gSyst->SetLineColor  (kRed);
  gSyst->SetLineWidth  (2);
  gSyst->SetMarkerSize (1.3);
  gSyst->SetMarkerStyle(kFullCircle);

  gLumi->SetLineColor  (kBlue);
  gLumi->SetLineWidth  (2);
  gLumi->SetMarkerSize (1.3);
  gLumi->SetMarkerStyle(kFullCircle);


  // Draw
  //----------------------------------------------------------------------------
  TString suffix = "7TeV_" + sCharge[theCharge];

  TCanvas* canvas = new TCanvas("ratioNLO_" + suffix, "ratioNLO_" + suffix);

  canvas->SetLeftMargin(canvas->GetRightMargin());

  Double_t xmin    =  0.0;
  Double_t xmax    =  2.0;
  Double_t ylegend =  1.2;
  Double_t ymin    = -0.6;
  Double_t ymax    = nChannel + ymin + ylegend;
  
  TH2F* h2 = new TH2F("h2_" + suffix, "", 100, xmin, xmax, 100, ymin, ymax);

  h2->Draw();
  
  
  // NLO WZ cross-section
  //----------------------------------------------------------------------------
  TBox* nlo = new TBox(1. - xs_nlo_left [theCharge] / xs_nlo[theCharge], ymin,
		       1. + xs_nlo_right[theCharge] / xs_nlo[theCharge], ymax - ylegend);

  nlo->SetLineColor(0);
  nlo->SetFillColor(kGray);
  nlo->SetFillStyle(1001);

  nlo->Draw("e2,same");

  TLine* line = new TLine(1., ymin, 1., ymax - ylegend);

  line->SetLineColor(kGray+1);
  line->SetLineWidth(2);

  line->Draw("same");


  // Cross sections
  //----------------------------------------------------------------------------
  gLumi->Draw("p,same");
  gSyst->Draw("p,same");
  gStat->Draw("p,same");


  // Labels
  //----------------------------------------------------------------------------
  for (UInt_t i=0; i<nChannel; i++) {

    Double_t x = gStat->GetX()[i];
    Double_t y = gStat->GetY()[i];

    Double_t gStatError = gStat->GetErrorX(i);
    Double_t gSystError = gSyst->GetErrorX(i);
    Double_t gLumiError = gLumi->GetErrorX(i);

    DrawTLatex(42, xmin+0.06, y+0.15, 0.035, 12,
	       Form("%s %.2f #pm %.2f",
		    lChannel[i].Data(), x, gLumiError), 0);

    gLumiError = sqrt(gLumiError*gLumiError - gSystError*gSystError);
    gSystError = sqrt(gSystError*gSystError - gStatError*gStatError);

    DrawTLatex(42, xmin+0.06, y-0.15, 0.025, 12,
	       Form("%.2f #pm %.2f #pm %.2f #pm %.2f",
		    x, gStatError, gSystError, gLumiError), 0);
  }

  DrawTLatex(42, 0.050, 0.975, _bigLabelSize, 13, "CMS Preliminary");

  DrawTLatex(42, 0.940, 0.983, _bigLabelSize, 33, 
	     Form("#sqrt{s} = 7 TeV, L = %.1f fb^{-1}", luminosity/1e3));

  TString swz = "";

  if      (theCharge == WPlus)  swz = "W^{+}Z";
  else if (theCharge == WMinus) swz = "W^{-}Z";
  else                          swz = "W^{#pm}Z";
  
  h2->GetXaxis()->CenterTitle();
  h2->GetXaxis()->SetTitleOffset(1.4);
  h2->GetXaxis()->SetTitle(Form("#sigma_{%s}^{exp} / #sigma_{%s}^{theory}",
				   swz.Data(),
				   swz.Data()));

  h2->GetYaxis()->SetTitle("");


  // Remove y-axis labels
  //----------------------------------------------------------------------------
  TAxis* yaxis = h2->GetYaxis();
  
  for (Int_t j=1; j<yaxis->GetNbins(); j++) yaxis->SetBinLabel(j, "");


  // Additional legend
  //----------------------------------------------------------------------------
  DrawLegend(0.645, 0.840, gStat, " stat.",  "lp");
  DrawLegend(0.645, 0.795, nlo,   " theory", "f");
  DrawLegend(0.800, 0.840, gSyst, " syst.",  "l");
  DrawLegend(0.800, 0.795, gLumi, " lumi.",  "l");


  // Save
  //----------------------------------------------------------------------------
  canvas->Update();
  canvas->GetFrame()->DrawClone();
  canvas->RedrawAxis();

  canvas->SaveAs(Form("pdf/ratioNLO_%s.pdf", suffix.Data()));
  canvas->SaveAs(Form("png/ratioNLO_%s.png", suffix.Data()));
}
Example #10
0
void categories_sig() {

  gStyle->SetOptTitle(0);
  gStyle->SetOptStat(0);

  gStyle->SetCanvasColor(0);
  gStyle->SetFrameBorderMode(0);
  
  gStyle->SetPalette(1);

  TText *text = new TText();
  text->SetNDC();
  text->SetTextSize(0.05);

  TFile *file = TFile::Open("histograms_CMS-HGG_categories_sig.root");
  file->cd();

  TCanvas *c_bdtout = new TCanvas("c_bdtout","BDT output");

  bdtout_all_tot = (TH1*)bdtout_cat0_tot->Clone();
  bdtout_all_tot->Add(bdtout_cat1_tot);
  bdtout_all_tot->Add(bdtout_cat2_tot);
  bdtout_all_tot->Add(bdtout_cat3_tot);

  cout << bdtout_all_tot->Integral() << endl;
  cout << bdtout_all_tot->Integral(49,100)+bdtout_all_tot->GetBinContent(48)/2. << endl;
  cout << bdtout_all_tot->GetBinLowEdge(49) << endl;
  cout << bdtout_all_tot->GetBinLowEdge(48) << endl;
  cout << (bdtout_all_tot->Integral(49,100)+bdtout_all_tot->GetBinContent(48)/2.)/bdtout_all_tot->Integral() << endl;

  bdtout_passCiC_all_tot = (TH1*)bdtout_passCiC_cat0_tot->Clone();
  bdtout_passCiC_all_tot->Add(bdtout_passCiC_cat1_tot);
  bdtout_passCiC_all_tot->Add(bdtout_passCiC_cat2_tot);
  bdtout_passCiC_all_tot->Add(bdtout_passCiC_cat3_tot);

  bdtout_failpresel_cat0_tot->Rebin(2);
  bdtout_failpresel_cat1_tot->Rebin(2);
  bdtout_failpresel_cat2_tot->Rebin(2);
  bdtout_failpresel_cat3_tot->Rebin(2);

  bdtout_failpresel_all_tot = (TH1*)bdtout_failpresel_cat0_tot->Clone();
  bdtout_failpresel_all_tot->Add(bdtout_failpresel_cat1_tot);
  bdtout_failpresel_all_tot->Add(bdtout_failpresel_cat2_tot);
  bdtout_failpresel_all_tot->Add(bdtout_failpresel_cat3_tot);

  float nFail_m100180_bdtout005 = bdtout_all_tot->Integral(1,52) + bdtout_all_tot->GetBinContent(53)/2.;
  float nFail_m100180 = bdtout_all_tot->Integral(1,100);
  float frac_bdtout005 = nFail_m100180_bdtout005/nFail_m100180;
  float frac_bdtout005_err = frac_err(nFail_m100180_bdtout005,nFail_m100180);
  cout << bdtout_all_tot->Integral(1,52) << " " <<  bdtout_all_tot->GetBinContent(53)/2. << " " << bdtout_all_tot->Integral(1,100) << " " << bdtout_all_tot->GetBinLowEdge(53) << " " << frac_bdtout005 << " ± " << frac_bdtout005_err << endl;

  bdtout_all_tot->SetLineColor(1);
  bdtout_cat0_tot->SetLineColor(2);
  bdtout_cat1_tot->SetLineColor(3);
  bdtout_cat2_tot->SetLineColor(4);
  bdtout_cat3_tot->SetLineColor(6);

  bdtout_all_tot->SetLineWidth(2);
  bdtout_cat0_tot->SetLineWidth(2);
  bdtout_cat1_tot->SetLineWidth(2);
  bdtout_cat2_tot->SetLineWidth(2);
  bdtout_cat3_tot->SetLineWidth(2);

  bdtout_cat0_tot->SetMarkerColor(2);
  bdtout_cat1_tot->SetMarkerColor(3);
  bdtout_cat2_tot->SetMarkerColor(4);
  bdtout_cat3_tot->SetMarkerColor(6);

  bdtout_all_tot->SetMarkerStyle(20);
  bdtout_cat0_tot->SetMarkerStyle(20);
  bdtout_cat1_tot->SetMarkerStyle(20);
  bdtout_cat2_tot->SetMarkerStyle(20);
  bdtout_cat3_tot->SetMarkerStyle(20);

  bdtout_all_tot->SetMarkerSize(0.7);
  bdtout_cat0_tot->SetMarkerSize(0.7);
  bdtout_cat1_tot->SetMarkerSize(0.7);
  bdtout_cat2_tot->SetMarkerSize(0.7);
  bdtout_cat3_tot->SetMarkerSize(0.7);

  bdtout_passCiC_all_tot->SetLineColor(1);
  bdtout_passCiC_cat0_tot->SetLineColor(2);
  bdtout_passCiC_cat1_tot->SetLineColor(3);
  bdtout_passCiC_cat2_tot->SetLineColor(4);
  bdtout_passCiC_cat3_tot->SetLineColor(6);

  bdtout_passCiC_lowPt_cat0_tot->SetLineColor(2);
  bdtout_passCiC_lowPt_cat1_tot->SetLineColor(3);
  bdtout_passCiC_lowPt_cat2_tot->SetLineColor(4);
  bdtout_passCiC_lowPt_cat3_tot->SetLineColor(6);

  bdtout_passCiC_highPt_cat0_tot->SetLineColor(2);
  bdtout_passCiC_highPt_cat1_tot->SetLineColor(3);
  bdtout_passCiC_highPt_cat2_tot->SetLineColor(4);
  bdtout_passCiC_highPt_cat3_tot->SetLineColor(6);

  bdtout_failpresel_all_tot->SetLineColor(1);
  bdtout_failpresel_cat0_tot->SetLineColor(2);
  bdtout_failpresel_cat1_tot->SetLineColor(3);
  bdtout_failpresel_cat2_tot->SetLineColor(4);
  bdtout_failpresel_cat3_tot->SetLineColor(6);


  bdtout_all_tot->GetXaxis()->SetTitle("di-photon MVA output");

  float boundaries[4] = {-0.05,0.49,0.79,.91};
  float max = bdtout_all_tot->GetMaximum();

  TBox* box = new TBox(-1.,0.,boundaries[0],max*1.05);
  box->SetFillColor(38);
  box->SetFillStyle(3002);

  bdtout_all_tot->Draw("hist");
  box->Draw("hist,same");
  bdtout_all_tot->Draw("hist,same");
  bdtout_cat0_tot->Draw("hist,same");
  bdtout_cat1_tot->Draw("hist,same");
  bdtout_cat2_tot->Draw("hist,same");
  bdtout_cat3_tot->Draw("hist,same");

  TLegend *leg;
  leg = new TLegend(.14,.6,.46,.87);
  leg->SetBorderSize(0);
  leg->SetFillColor(10);
  leg->SetTextSize(.035);
  leg->AddEntry(bdtout_all_tot,"All");
  leg->AddEntry(bdtout_cat0_tot,"both EB, both R9>0.94");
  leg->AddEntry(bdtout_cat1_tot,"both EB, !both R9>0.94");
  leg->AddEntry(bdtout_cat2_tot,"!both EB, both R9>0.94");
  leg->AddEntry(bdtout_cat3_tot,"!both EB, !both R9>0.94");
  leg->Draw("hist");

  TLine* line[4];
  for (int i=0; i<4; i++) {
    line[i] = new TLine(boundaries[i],0.,boundaries[i],max*1.05);
    line[i]->SetLineColor(4);
    line[i]->SetLineWidth(2);
    line[i]->SetLineStyle(9);
    line[i]->Draw("hist");
  }

  gPad->RedrawAxis();

  c_bdtout->SaveAs("categories_sig.png");


  TCanvas *c_bdtout_passCiC = new TCanvas("c_bdtout_passCiC","BDT output, pass CiC");

  bdtout_passCiC_cat0_tot_clone = (TH1*)bdtout_passCiC_cat0_tot->Clone();
  bdtout_passCiC_cat1_tot_clone = (TH1*)bdtout_passCiC_cat1_tot->Clone();
  bdtout_passCiC_cat2_tot_clone = (TH1*)bdtout_passCiC_cat2_tot->Clone();
  bdtout_passCiC_cat3_tot_clone = (TH1*)bdtout_passCiC_cat3_tot->Clone();

  bdtout_passCiC_all_tot->SetLineWidth(2);
  bdtout_passCiC_cat0_tot_clone->SetLineWidth(2);
  bdtout_passCiC_cat1_tot_clone->SetLineWidth(2);
  bdtout_passCiC_cat2_tot_clone->SetLineWidth(2);
  bdtout_passCiC_cat3_tot_clone->SetLineWidth(2);

  bdtout_passCiC_all_tot->GetXaxis()->SetTitle("di-photon MVA output");

  max = bdtout_passCiC_all_tot->GetMaximum();
  TBox* box_passCiC = new TBox(-1.,0.,boundaries[0],max*1.05);
  box_passCiC->SetFillColor(38);
  box_passCiC->SetFillStyle(3002);

  bdtout_passCiC_all_tot->Draw("hist");
  box_passCiC->Draw("hist,same");
  bdtout_passCiC_all_tot->Draw("hist,same");
  bdtout_passCiC_cat0_tot_clone->Draw("hist,same");
  bdtout_passCiC_cat1_tot_clone->Draw("hist,same");
  bdtout_passCiC_cat2_tot_clone->Draw("hist,same");
  bdtout_passCiC_cat3_tot_clone->Draw("hist,same");

  leg->Draw("hist");

  TLine* line_passCiC[4];
  for (int i=0; i<4; i++) {
    line_passCiC[i] = new TLine(boundaries[i],0.,boundaries[i],max*1.05);
    line_passCiC[i]->SetLineColor(4);
    line_passCiC[i]->SetLineWidth(2);
    line_passCiC[i]->SetLineStyle(9);
    line_passCiC[i]->Draw("hist");
  }

  gPad->RedrawAxis();

  c_bdtout_passCiC->SaveAs("categories_passCiC_sig.png");

  /*
  TCanvas *c_bdtout_failpresel = new TCanvas("c_bdtout_failpresel","BDT output, pass CiC, fail presel");

  bdtout_failpresel_cat0_tot_clone = (TH1*)bdtout_failpresel_cat0_tot->Clone();
  bdtout_failpresel_cat1_tot_clone = (TH1*)bdtout_failpresel_cat1_tot->Clone();
  bdtout_failpresel_cat2_tot_clone = (TH1*)bdtout_failpresel_cat2_tot->Clone();
  bdtout_failpresel_cat3_tot_clone = (TH1*)bdtout_failpresel_cat3_tot->Clone();

  bdtout_failpresel_all_tot->SetLineWidth(2);
  bdtout_failpresel_cat0_tot_clone->SetLineWidth(2);
  bdtout_failpresel_cat1_tot_clone->SetLineWidth(2);
  bdtout_failpresel_cat2_tot_clone->SetLineWidth(2);
  bdtout_failpresel_cat3_tot_clone->SetLineWidth(2);

  bdtout_failpresel_all_tot->GetXaxis()->SetTitle("di-photon MVA output");

  max = bdtout_failpresel_all_tot->GetMaximum();
  TBox* box_failpresel = new TBox(-1.,0.,boundaries[0],max*1.05);
  box_failpresel->SetFillColor(38);
  box_failpresel->SetFillStyle(3002);

  bdtout_failpresel_all_tot->Draw("hist");
  box_failpresel->Draw("hist,same");
  bdtout_failpresel_all_tot->Draw("hist,same");
  bdtout_failpresel_cat0_tot_clone->Draw("hist,same");
  bdtout_failpresel_cat1_tot_clone->Draw("hist,same");
  bdtout_failpresel_cat2_tot_clone->Draw("hist,same");
  bdtout_failpresel_cat3_tot_clone->Draw("hist,same");

  leg->Draw("hist");

  TLine* line_failpresel[4];
  for (int i=0; i<4; i++) {
    line_failpresel[i] = new TLine(boundaries[i],0.,boundaries[i],max*1.05);
    line_failpresel[i]->SetLineColor(4);
    line_failpresel[i]->SetLineWidth(2);
    line_failpresel[i]->SetLineStyle(9);
    line_failpresel[i]->Draw("hist");
  }

  gPad->RedrawAxis();

  c_bdtout_failpresel->SaveAs("categories_failpresel_sig.png");
  */

  TCanvas *c_bdtout_compareCiC = new TCanvas("c_bdtout_compareCiC","BDT output: pass CiC supertight",1000,650);
  c_bdtout_compareCiC->Divide(2,2);

  bdtout_passCiC_cat0_tot->SetFillColor(2);
  bdtout_passCiC_cat1_tot->SetFillColor(3);
  bdtout_passCiC_cat2_tot->SetFillColor(4);
  bdtout_passCiC_cat3_tot->SetFillColor(6);

  bdtout_passCiC_cat0_tot->SetFillStyle(3002);
  bdtout_passCiC_cat1_tot->SetFillStyle(3002);
  bdtout_passCiC_cat2_tot->SetFillStyle(3002);
  bdtout_passCiC_cat3_tot->SetFillStyle(3002);

  bdtout_cat0_tot->GetXaxis()->SetTitle("di-photon MVA output");
  bdtout_cat1_tot->GetXaxis()->SetTitle("di-photon MVA output");
  bdtout_cat2_tot->GetXaxis()->SetTitle("di-photon MVA output");
  bdtout_cat3_tot->GetXaxis()->SetTitle("di-photon MVA output");
  bdtout_cat0_tot->GetXaxis()->SetTitleSize(0.05);
  bdtout_cat1_tot->GetXaxis()->SetTitleSize(0.05);
  bdtout_cat2_tot->GetXaxis()->SetTitleSize(0.05);
  bdtout_cat3_tot->GetXaxis()->SetTitleSize(0.05);

  c_bdtout_compareCiC->cd(1);

  box_passCiC_cat0 = (TBox*)box->Clone();
  box_passCiC_cat0->SetY2(bdtout_cat0_tot->GetMaximum()*1.05);

  bdtout_cat0_tot->Draw("hist");
  box_passCiC_cat0->Draw("hist,same");
  bdtout_cat0_tot->Draw("hist,same");
  bdtout_passCiC_cat0_tot->Draw("hist,same");

  TLine* line_passCiC_cat0[4];
  for (int i=0; i<4; i++) {
    line_passCiC_cat0[i] = (TLine*)line[i]->Clone();
    line_passCiC_cat0[i]->SetY2(bdtout_cat0_tot->GetMaximum()*1.05);
    line_passCiC_cat0[i]->Draw("hist");
  }
  text->DrawText(0.15,0.75,"both EB, both R9>0.94");
  gPad->RedrawAxis();

  c_bdtout_compareCiC->cd(2);

  box_passCiC_cat1 = (TBox*)box->Clone();
  box_passCiC_cat1->SetY2(bdtout_cat1_tot->GetMaximum()*1.05);

  bdtout_cat1_tot->Draw("hist");
  box_passCiC_cat1->Draw("hist,same");
  bdtout_cat1_tot->Draw("hist,same");
  bdtout_passCiC_cat1_tot->Draw("hist,same");

  TLine* line_passCiC_cat1[4];
  for (int i=0; i<4; i++) {
    line_passCiC_cat1[i] = (TLine*)line[i]->Clone();
    line_passCiC_cat1[i]->SetY2(bdtout_cat1_tot->GetMaximum()*1.05);
    line_passCiC_cat1[i]->Draw("hist");
  }
  text->DrawText(0.15,0.75,"both EB, !both R9>0.94");
  gPad->RedrawAxis();

  c_bdtout_compareCiC->cd(3);

  box_passCiC_cat2 = (TBox*)box->Clone();
  box_passCiC_cat2->SetY2(bdtout_cat2_tot->GetMaximum()*1.05);

  bdtout_cat2_tot->Draw("hist");
  box_passCiC_cat2->Draw("hist,same");
  bdtout_cat2_tot->Draw("hist,same");
  bdtout_passCiC_cat2_tot->Draw("hist,same");

  TLine* line_passCiC_cat2[4];
  for (int i=0; i<4; i++) {
    line_passCiC_cat2[i] = (TLine*)line[i]->Clone();
    line_passCiC_cat2[i]->SetY2(bdtout_cat2_tot->GetMaximum()*1.05);
    line_passCiC_cat2[i]->Draw("hist");
  }
  text->DrawText(0.15,0.75,"!both EB, both R9>0.94");
  gPad->RedrawAxis();

  c_bdtout_compareCiC->cd(4);

  box_passCiC_cat3 = (TBox*)box->Clone();
  box_passCiC_cat3->SetY2(bdtout_cat3_tot->GetMaximum()*1.05);

  bdtout_cat3_tot->Draw("hist");
  box_passCiC_cat3->Draw("hist,same");
  bdtout_cat3_tot->Draw("hist,same");
  bdtout_passCiC_cat3_tot->Draw("hist,same");

  TLine* line_passCiC_cat3[4];
  for (int i=0; i<4; i++) {
    line_passCiC_cat3[i] = (TLine*)line[i]->Clone();
    line_passCiC_cat3[i]->SetY2(bdtout_cat3_tot->GetMaximum()*1.05);
    line_passCiC_cat3[i]->Draw("hist");
  }
  text->DrawText(0.15,0.75,"!both EB, !both R9>0.94");
  gPad->RedrawAxis();

  c_bdtout_compareCiC->SaveAs("categories_compareCiC_sig.png");



  TCanvas *c_bdtout_lowPt = new TCanvas("c_bdtout_lowPt","BDT output: di-photon pT<40 GeV");

  bdtout_lowPt_all_tot = (TH1*)bdtout_lowPt_cat0_tot->Clone();
  bdtout_lowPt_all_tot->Add(bdtout_lowPt_cat1_tot);
  bdtout_lowPt_all_tot->Add(bdtout_lowPt_cat2_tot);
  bdtout_lowPt_all_tot->Add(bdtout_lowPt_cat3_tot);

  bdtout_lowPt_all_tot->SetLineColor(1);
  bdtout_lowPt_cat0_tot->SetLineColor(2);
  bdtout_lowPt_cat1_tot->SetLineColor(3);
  bdtout_lowPt_cat2_tot->SetLineColor(4);
  bdtout_lowPt_cat3_tot->SetLineColor(6);

  bdtout_lowPt_all_tot->SetLineWidth(2);
  bdtout_lowPt_cat0_tot->SetLineWidth(2);
  bdtout_lowPt_cat1_tot->SetLineWidth(2);
  bdtout_lowPt_cat2_tot->SetLineWidth(2);
  bdtout_lowPt_cat3_tot->SetLineWidth(2);

  bdtout_lowPt_all_tot->GetXaxis()->SetTitle("di-photon MVA output");
  bdtout_lowPt_all_tot->GetYaxis()->SetTitle("Events/0.02");
  bdtout_lowPt_all_tot->GetXaxis()->SetTitleSize(0.05);
  bdtout_lowPt_all_tot->GetXaxis()->SetLabelSize(0.05);
  bdtout_lowPt_all_tot->GetYaxis()->SetTitleSize(0.05);
  bdtout_lowPt_all_tot->GetYaxis()->SetLabelSize(0.05);

  max = bdtout_lowPt_all_tot->GetMaximum();
  TBox* box_lowPt = new TBox(-1.,0.,boundaries[0],max*1.05);
  box_lowPt->SetFillColor(38);
  box_lowPt->SetFillStyle(3002);

  bdtout_lowPt_all_tot->Draw("hist");
  box_lowPt->Draw("hist,same");
  bdtout_lowPt_all_tot->Draw("hist,same");
  bdtout_lowPt_cat0_tot->Draw("hist,same");
  bdtout_lowPt_cat1_tot->Draw("hist,same");
  bdtout_lowPt_cat2_tot->Draw("hist,same");
  bdtout_lowPt_cat3_tot->Draw("hist,same");

  TLegend *leg_lowPt = (TLegend*)leg->Clone();
  leg_lowPt->Clear();
  leg_lowPt->AddEntry(bdtout_all_tot,"All (p_{T}(#gamma#gamma) < 40 GeV)");
  leg_lowPt->AddEntry(bdtout_cat0_tot,"both EB, both R9>0.94");
  leg_lowPt->AddEntry(bdtout_cat1_tot,"both EB, !both R9>0.94");
  leg_lowPt->AddEntry(bdtout_cat2_tot,"!both EB, both R9>0.94");
  leg_lowPt->AddEntry(bdtout_cat3_tot,"!both EB, !both R9>0.94");
  leg_lowPt->Draw("hist");

  TLine* line_lowPt[4];
  for (int i=0; i<4; i++) {
    line_lowPt[i] = new TLine(boundaries[i],0.,boundaries[i],max*1.05);
    line_lowPt[i]->SetLineColor(4);
    line_lowPt[i]->SetLineWidth(2);
    line_lowPt[i]->SetLineStyle(9);
    line_lowPt[i]->Draw("hist");
  }

  gPad->RedrawAxis();

  c_bdtout_lowPt->SaveAs("categories_lowPt_sig.png");


  TCanvas *c_bdtout_compareCiC_lowPt = new TCanvas("c_bdtout_compareCiC_lowPt","BDT output: di-photon pT<40 GeV, pass CiC supertight",1000,650);
  c_bdtout_compareCiC_lowPt->Divide(2,2);

  bdtout_passCiC_lowPt_cat0_tot->SetFillColor(2);
  bdtout_passCiC_lowPt_cat1_tot->SetFillColor(3);
  bdtout_passCiC_lowPt_cat2_tot->SetFillColor(4);
  bdtout_passCiC_lowPt_cat3_tot->SetFillColor(6);

  bdtout_passCiC_lowPt_cat0_tot->SetFillStyle(3002);
  bdtout_passCiC_lowPt_cat1_tot->SetFillStyle(3002);
  bdtout_passCiC_lowPt_cat2_tot->SetFillStyle(3002);
  bdtout_passCiC_lowPt_cat3_tot->SetFillStyle(3002);

  bdtout_lowPt_cat0_tot->GetXaxis()->SetTitle("di-photon MVA output");
  bdtout_lowPt_cat1_tot->GetXaxis()->SetTitle("di-photon MVA output");
  bdtout_lowPt_cat2_tot->GetXaxis()->SetTitle("di-photon MVA output");
  bdtout_lowPt_cat3_tot->GetXaxis()->SetTitle("di-photon MVA output");
  bdtout_lowPt_cat0_tot->GetXaxis()->SetTitleSize(0.05);
  bdtout_lowPt_cat1_tot->GetXaxis()->SetTitleSize(0.05);
  bdtout_lowPt_cat2_tot->GetXaxis()->SetTitleSize(0.05);
  bdtout_lowPt_cat3_tot->GetXaxis()->SetTitleSize(0.05);

  c_bdtout_compareCiC_lowPt->cd(1);

  box_passCiC_lowPt_cat0 = (TBox*)box->Clone();
  box_passCiC_lowPt_cat0->SetY2(bdtout_lowPt_cat0_tot->GetMaximum()*1.05);

  bdtout_lowPt_cat0_tot->Draw("hist");
  box_passCiC_lowPt_cat0->Draw("hist,same");
  bdtout_lowPt_cat0_tot->Draw("hist,same");
  bdtout_passCiC_lowPt_cat0_tot->Draw("hist,same");

  TLine* line_passCiC_lowPt_cat0[4];
  for (int i=0; i<4; i++) {
    line_passCiC_lowPt_cat0[i] = (TLine*)line[i]->Clone();
    line_passCiC_lowPt_cat0[i]->SetY2(bdtout_lowPt_cat0_tot->GetMaximum()*1.05);
    line_passCiC_lowPt_cat0[i]->Draw("hist");
  }
  text->DrawText(0.15,0.75,"both EB, both R9>0.94");
  gPad->RedrawAxis();

  c_bdtout_compareCiC_lowPt->cd(2);

  box_passCiC_lowPt_cat1 = (TBox*)box->Clone();
  box_passCiC_lowPt_cat1->SetY2(bdtout_lowPt_cat1_tot->GetMaximum()*1.05);

  bdtout_lowPt_cat1_tot->Draw("hist");
  box_passCiC_lowPt_cat1->Draw("hist,same");
  bdtout_lowPt_cat1_tot->Draw("hist,same");
  bdtout_passCiC_lowPt_cat1_tot->Draw("hist,same");

  TLine* line_passCiC_lowPt_cat1[4];
  for (int i=0; i<4; i++) {
    line_passCiC_lowPt_cat1[i] = (TLine*)line[i]->Clone();
    line_passCiC_lowPt_cat1[i]->SetY2(bdtout_lowPt_cat1_tot->GetMaximum()*1.05);
    line_passCiC_lowPt_cat1[i]->Draw("hist");
  }
  text->DrawText(0.15,0.75,"both EB, !both R9>0.94");
  gPad->RedrawAxis();

  c_bdtout_compareCiC_lowPt->cd(3);

  box_passCiC_lowPt_cat2 = (TBox*)box->Clone();
  box_passCiC_lowPt_cat2->SetY2(bdtout_lowPt_cat2_tot->GetMaximum()*1.05);

  bdtout_lowPt_cat2_tot->Draw("hist");
  box_passCiC_lowPt_cat2->Draw("hist,same");
  bdtout_lowPt_cat2_tot->Draw("hist,same");
  bdtout_passCiC_lowPt_cat2_tot->Draw("hist,same");

  TLine* line_passCiC_lowPt_cat2[4];
  for (int i=0; i<4; i++) {
    line_passCiC_lowPt_cat2[i] = (TLine*)line[i]->Clone();
    line_passCiC_lowPt_cat2[i]->SetY2(bdtout_lowPt_cat2_tot->GetMaximum()*1.05);
    line_passCiC_lowPt_cat2[i]->Draw("hist");
  }
  text->DrawText(0.15,0.75,"!both EB, both R9>0.94");
  gPad->RedrawAxis();

  c_bdtout_compareCiC_lowPt->cd(4);

  box_passCiC_lowPt_cat3 = (TBox*)box->Clone();
  box_passCiC_lowPt_cat3->SetY2(bdtout_lowPt_cat3_tot->GetMaximum()*1.05);

  bdtout_lowPt_cat3_tot->Draw("hist");
  box_passCiC_lowPt_cat3->Draw("hist,same");
  bdtout_lowPt_cat3_tot->Draw("hist,same");
  bdtout_passCiC_lowPt_cat3_tot->Draw("hist,same");

  TLine* line_passCiC_lowPt_cat3[4];
  for (int i=0; i<4; i++) {
    line_passCiC_lowPt_cat3[i] = (TLine*)line[i]->Clone();
    line_passCiC_lowPt_cat3[i]->SetY2(bdtout_lowPt_cat3_tot->GetMaximum()*1.05);
    line_passCiC_lowPt_cat3[i]->Draw("hist");
  }
  text->DrawText(0.15,0.75,"!both EB, !both R9>0.94");
  gPad->RedrawAxis();

  c_bdtout_compareCiC_lowPt->SaveAs("categories_compareCiC_lowPt_sig.png");


  TCanvas *c_bdtout_highPt = new TCanvas("c_bdtout_highPt","BDT output: di-photon pT>40 GeV");

  bdtout_highPt_all_tot = (TH1*)bdtout_highPt_cat0_tot->Clone();
  bdtout_highPt_all_tot->Add(bdtout_highPt_cat1_tot);
  bdtout_highPt_all_tot->Add(bdtout_highPt_cat2_tot);
  bdtout_highPt_all_tot->Add(bdtout_highPt_cat3_tot);

  bdtout_highPt_all_tot->SetLineColor(1);
  bdtout_highPt_cat0_tot->SetLineColor(2);
  bdtout_highPt_cat1_tot->SetLineColor(3);
  bdtout_highPt_cat2_tot->SetLineColor(4);
  bdtout_highPt_cat3_tot->SetLineColor(6);

  bdtout_highPt_all_tot->SetLineWidth(2);
  bdtout_highPt_cat0_tot->SetLineWidth(2);
  bdtout_highPt_cat1_tot->SetLineWidth(2);
  bdtout_highPt_cat2_tot->SetLineWidth(2);
  bdtout_highPt_cat3_tot->SetLineWidth(2);

  bdtout_highPt_all_tot->GetXaxis()->SetTitle("di-photon MVA output");
  bdtout_highPt_all_tot->GetYaxis()->SetTitle("Events/0.02");
  bdtout_highPt_all_tot->GetXaxis()->SetTitleSize(0.05);
  bdtout_highPt_all_tot->GetXaxis()->SetLabelSize(0.05);
  bdtout_highPt_all_tot->GetYaxis()->SetTitleSize(0.05);
  bdtout_highPt_all_tot->GetYaxis()->SetLabelSize(0.05);

  max = 1.2*bdtout_highPt_all_tot->GetMaximum();
  bdtout_highPt_all_tot->SetMaximum(max);

  TBox* box_highPt = new TBox(-1.,0.,boundaries[0],max);
  box_highPt->SetFillColor(38);
  box_highPt->SetFillStyle(3002);

  bdtout_highPt_all_tot->Draw("hist");
  box_highPt->Draw("hist,same");
  bdtout_highPt_all_tot->Draw("hist,same");
  bdtout_highPt_cat0_tot->Draw("hist,same");
  bdtout_highPt_cat1_tot->Draw("hist,same");
  bdtout_highPt_cat2_tot->Draw("hist,same");
  bdtout_highPt_cat3_tot->Draw("hist,same");

  TLegend *leg_highPt = (TLegend*)leg->Clone();
  leg_highPt->Clear();
  leg_highPt->AddEntry(bdtout_all_tot,"All (p_{T}(#gamma#gamma) > 40 GeV)");
  leg_highPt->AddEntry(bdtout_cat0_tot,"both EB, both R9>0.94");
  leg_highPt->AddEntry(bdtout_cat1_tot,"both EB, !both R9>0.94");
  leg_highPt->AddEntry(bdtout_cat2_tot,"!both EB, both R9>0.94");
  leg_highPt->AddEntry(bdtout_cat3_tot,"!both EB, !both R9>0.94");
  leg_highPt->Draw("hist");

  TLine* line_highPt[4];
  for (int i=0; i<4; i++) {
    line_highPt[i] = new TLine(boundaries[i],0.,boundaries[i],max);
    line_highPt[i]->SetLineColor(4);
    line_highPt[i]->SetLineWidth(2);
    line_highPt[i]->SetLineStyle(9);
    line_highPt[i]->Draw("hist");
  }

  gPad->RedrawAxis();

  c_bdtout_highPt->SaveAs("categories_highPt_sig.png");



  TCanvas *c_bdtout_compareCiC_highPt = new TCanvas("c_bdtout_compareCiC_highPt","BDT output: di-photon pT>40 GeV, pass CiC supertight",1000,650);
  c_bdtout_compareCiC_highPt->Divide(2,2);

  bdtout_passCiC_highPt_cat0_tot->SetFillColor(2);
  bdtout_passCiC_highPt_cat1_tot->SetFillColor(3);
  bdtout_passCiC_highPt_cat2_tot->SetFillColor(4);
  bdtout_passCiC_highPt_cat3_tot->SetFillColor(6);

  bdtout_passCiC_highPt_cat0_tot->SetFillStyle(3002);
  bdtout_passCiC_highPt_cat1_tot->SetFillStyle(3002);
  bdtout_passCiC_highPt_cat2_tot->SetFillStyle(3002);
  bdtout_passCiC_highPt_cat3_tot->SetFillStyle(3002);

  bdtout_highPt_cat0_tot->GetXaxis()->SetTitle("di-photon MVA output");
  bdtout_highPt_cat1_tot->GetXaxis()->SetTitle("di-photon MVA output");
  bdtout_highPt_cat2_tot->GetXaxis()->SetTitle("di-photon MVA output");
  bdtout_highPt_cat3_tot->GetXaxis()->SetTitle("di-photon MVA output");
  bdtout_highPt_cat0_tot->GetXaxis()->SetTitleSize(0.05);
  bdtout_highPt_cat1_tot->GetXaxis()->SetTitleSize(0.05);
  bdtout_highPt_cat2_tot->GetXaxis()->SetTitleSize(0.05);
  bdtout_highPt_cat3_tot->GetXaxis()->SetTitleSize(0.05);

  c_bdtout_compareCiC_highPt->cd(1);

  box_passCiC_highPt_cat0 = (TBox*)box->Clone();
  box_passCiC_highPt_cat0->SetY2(bdtout_highPt_cat0_tot->GetMaximum()*1.05);

  bdtout_highPt_cat0_tot->Draw("hist");
  box_passCiC_highPt_cat0->Draw("hist,same");
  bdtout_highPt_cat0_tot->Draw("hist,same");
  bdtout_passCiC_highPt_cat0_tot->Draw("hist,same");

  TLine* line_passCiC_highPt_cat0[4];
  for (int i=0; i<4; i++) {
    line_passCiC_highPt_cat0[i] = (TLine*)line[i]->Clone();
    line_passCiC_highPt_cat0[i]->SetY2(bdtout_highPt_cat0_tot->GetMaximum()*1.05);
    line_passCiC_highPt_cat0[i]->Draw("hist");
  }
  text->DrawText(0.15,0.75,"both EB, both R9>0.94");
  gPad->RedrawAxis();

  c_bdtout_compareCiC_highPt->cd(2);

  box_passCiC_highPt_cat1 = (TBox*)box->Clone();
  box_passCiC_highPt_cat1->SetY2(bdtout_highPt_cat1_tot->GetMaximum()*1.05);

  bdtout_highPt_cat1_tot->Draw("hist");
  box_passCiC_highPt_cat1->Draw("hist,same");
  bdtout_highPt_cat1_tot->Draw("hist,same");
  bdtout_passCiC_highPt_cat1_tot->Draw("hist,same");

  TLine* line_passCiC_highPt_cat1[4];
  for (int i=0; i<4; i++) {
    line_passCiC_highPt_cat1[i] = (TLine*)line[i]->Clone();
    line_passCiC_highPt_cat1[i]->SetY2(bdtout_highPt_cat1_tot->GetMaximum()*1.05);
    line_passCiC_highPt_cat1[i]->Draw("hist");
  }
  text->DrawText(0.15,0.75,"both EB, !both R9>0.94");
  gPad->RedrawAxis();

  c_bdtout_compareCiC_highPt->cd(3);

  box_passCiC_highPt_cat2 = (TBox*)box->Clone();
  box_passCiC_highPt_cat2->SetY2(bdtout_highPt_cat2_tot->GetMaximum()*1.05);

  bdtout_highPt_cat2_tot->Draw("hist");
  box_passCiC_highPt_cat2->Draw("hist,same");
  bdtout_highPt_cat2_tot->Draw("hist,same");
  bdtout_passCiC_highPt_cat2_tot->Draw("hist,same");

  TLine* line_passCiC_highPt_cat2[4];
  for (int i=0; i<4; i++) {
    line_passCiC_highPt_cat2[i] = (TLine*)line[i]->Clone();
    line_passCiC_highPt_cat2[i]->SetY2(bdtout_highPt_cat2_tot->GetMaximum()*1.05);
    line_passCiC_highPt_cat2[i]->Draw("hist");
  }
  text->DrawText(0.15,0.75,"!both EB, both R9>0.94");
  gPad->RedrawAxis();

  c_bdtout_compareCiC_highPt->cd(4);

  box_passCiC_highPt_cat3 = (TBox*)box->Clone();
  box_passCiC_highPt_cat3->SetY2(bdtout_highPt_cat3_tot->GetMaximum()*1.05);

  bdtout_highPt_cat3_tot->Draw("hist");
  box_passCiC_highPt_cat3->Draw("hist,same");
  bdtout_highPt_cat3_tot->Draw("hist,same");
  bdtout_passCiC_highPt_cat3_tot->Draw("hist,same");

  TLine* line_passCiC_highPt_cat3[4];
  for (int i=0; i<4; i++) {
    line_passCiC_highPt_cat3[i] = (TLine*)line[i]->Clone();
    line_passCiC_highPt_cat3[i]->SetY2(bdtout_highPt_cat3_tot->GetMaximum()*1.05);
    line_passCiC_highPt_cat3[i]->Draw("hist");
  }
  text->DrawText(0.15,0.75,"!both EB, !both R9>0.94");
  gPad->RedrawAxis();

  c_bdtout_compareCiC_highPt->SaveAs("categories_compareCiC_highPt_sig.png");


  TCanvas *c_ptVsBdtout = new TCanvas("c_ptVsBdtout","pT(#gamma#gamma) vs MVA output",1000,650);
  c_ptVsBdtout->Divide(2,2);

  pt_vs_bdtout_cat0_all = (TH2*)pt_vs_bdtout_cat0_ggh_m125_8TeV->Clone();
  pt_vs_bdtout_cat1_all = (TH2*)pt_vs_bdtout_cat1_ggh_m125_8TeV->Clone();
  pt_vs_bdtout_cat2_all = (TH2*)pt_vs_bdtout_cat2_ggh_m125_8TeV->Clone();
  pt_vs_bdtout_cat3_all = (TH2*)pt_vs_bdtout_cat3_ggh_m125_8TeV->Clone();
  pt_vs_bdtout_cat4_all = (TH2*)pt_vs_bdtout_cat4_ggh_m125_8TeV->Clone();

  pt_vs_bdtout_cat0_all->Add(pt_vs_bdtout_cat0_vbf_m125_8TeV);
  pt_vs_bdtout_cat1_all->Add(pt_vs_bdtout_cat1_vbf_m125_8TeV);
  pt_vs_bdtout_cat2_all->Add(pt_vs_bdtout_cat2_vbf_m125_8TeV);
  pt_vs_bdtout_cat3_all->Add(pt_vs_bdtout_cat3_vbf_m125_8TeV);
  pt_vs_bdtout_cat4_all->Add(pt_vs_bdtout_cat4_vbf_m125_8TeV);

  pt_vs_bdtout_cat0_all->Add(pt_vs_bdtout_cat0_wzh_m125_8TeV);
  pt_vs_bdtout_cat1_all->Add(pt_vs_bdtout_cat1_wzh_m125_8TeV);
  pt_vs_bdtout_cat2_all->Add(pt_vs_bdtout_cat2_wzh_m125_8TeV);
  pt_vs_bdtout_cat3_all->Add(pt_vs_bdtout_cat3_wzh_m125_8TeV);
  pt_vs_bdtout_cat4_all->Add(pt_vs_bdtout_cat4_wzh_m125_8TeV);

  pt_vs_bdtout_cat0_all->Add(pt_vs_bdtout_cat0_tth_m125_8TeV);
  pt_vs_bdtout_cat1_all->Add(pt_vs_bdtout_cat1_tth_m125_8TeV);
  pt_vs_bdtout_cat2_all->Add(pt_vs_bdtout_cat2_tth_m125_8TeV);
  pt_vs_bdtout_cat3_all->Add(pt_vs_bdtout_cat3_tth_m125_8TeV);
  pt_vs_bdtout_cat4_all->Add(pt_vs_bdtout_cat4_tth_m125_8TeV);

  pt_vs_bdtout_cat0_all->GetXaxis()->SetTitle("di-photon MVA output");
  pt_vs_bdtout_cat1_all->GetXaxis()->SetTitle("di-photon MVA output");
  pt_vs_bdtout_cat2_all->GetXaxis()->SetTitle("di-photon MVA output");
  pt_vs_bdtout_cat3_all->GetXaxis()->SetTitle("di-photon MVA output");
  pt_vs_bdtout_cat0_all->GetXaxis()->SetTitleSize(0.05);
  pt_vs_bdtout_cat1_all->GetXaxis()->SetTitleSize(0.05);
  pt_vs_bdtout_cat2_all->GetXaxis()->SetTitleSize(0.05);
  pt_vs_bdtout_cat3_all->GetXaxis()->SetTitleSize(0.05);
  pt_vs_bdtout_cat0_all->GetYaxis()->SetTitle("di-photon p_{T} (GeV)");
  pt_vs_bdtout_cat1_all->GetYaxis()->SetTitle("di-photon p_{T} (GeV)");
  pt_vs_bdtout_cat2_all->GetYaxis()->SetTitle("di-photon p_{T} (GeV)");
  pt_vs_bdtout_cat3_all->GetYaxis()->SetTitle("di-photon p_{T} (GeV)");
  pt_vs_bdtout_cat0_all->GetYaxis()->SetTitleSize(0.05);
  pt_vs_bdtout_cat1_all->GetYaxis()->SetTitleSize(0.05);
  pt_vs_bdtout_cat2_all->GetYaxis()->SetTitleSize(0.05);
  pt_vs_bdtout_cat3_all->GetYaxis()->SetTitleSize(0.05);

  c_ptVsBdtout->cd(1);
  pt_vs_bdtout_cat0_all->Draw("colz");
  box_ptVsBdtout = (TBox*)box->Clone();
  box_ptVsBdtout->SetY2(200.);
  box_ptVsBdtout->Draw("hist");
  pt_vs_bdtout_cat0_all->Draw("colz,same");
  TLine* line_ptVsBdtout[4];
  for (int i=0; i<4; i++) {
    line_ptVsBdtout[i] = (TLine*)line[i]->Clone();
    line_ptVsBdtout[i]->SetY2(200.);
    line_ptVsBdtout[i]->Draw("hist");
  }
  text->DrawText(0.15,0.75,"both EB, both R9>0.94");
  gPad->RedrawAxis();
  c_ptVsBdtout->cd(2);
  pt_vs_bdtout_cat1_all->Draw("colz");
  box_ptVsBdtout->Draw("hist");
  pt_vs_bdtout_cat1_all->Draw("colz,same");
  for (int i=0; i<4; i++) line_ptVsBdtout[i]->Draw("hist");
  text->DrawText(0.15,0.75,"both EB, !both R9>0.94");
  gPad->RedrawAxis();
  c_ptVsBdtout->cd(3);
  pt_vs_bdtout_cat2_all->Draw("colz");
  box_ptVsBdtout->Draw("hist");
  pt_vs_bdtout_cat2_all->Draw("colz,same");
  for (int i=0; i<4; i++) line_ptVsBdtout[i]->Draw("hist");
  text->DrawText(0.15,0.75,"!both EB, both R9>0.94");
  gPad->RedrawAxis();
  c_ptVsBdtout->cd(4);
  pt_vs_bdtout_cat3_all->Draw("colz");
  box_ptVsBdtout->Draw("hist");
  pt_vs_bdtout_cat3_all->Draw("colz,same");
  for (int i=0; i<4; i++) line_ptVsBdtout[i]->Draw("hist");
  text->DrawText(0.15,0.75,"!both EB, !both R9>0.94");
  gPad->RedrawAxis();

  c_ptVsBdtout->SaveAs("ptVsBdtout_sig.png");


  TCanvas *c_2D = new TCanvas("c_2D","min(R9) vs max(eta), sublead eta vs lead eta",1250,500);
  c_2D->Divide(4,2);

  minR9_vs_maxEta_cat2_all = (TH2*)minR9_vs_maxEta_cat2_ggh_m125_8TeV->Clone();
  minR9_vs_maxEta_cat3_all = (TH2*)minR9_vs_maxEta_cat3_ggh_m125_8TeV->Clone();
  minR9_vs_maxEta_cat4_all = (TH2*)minR9_vs_maxEta_cat4_ggh_m125_8TeV->Clone();
  minR9_vs_maxEta_cat5_all = (TH2*)minR9_vs_maxEta_cat5_ggh_m125_8TeV->Clone();
  minR9_vs_maxEta_cat6_all = (TH2*)minR9_vs_maxEta_cat6_ggh_m125_8TeV->Clone();

  minR9_vs_maxEta_cat2_all->Add(minR9_vs_maxEta_cat2_vbf_m125_8TeV);
  minR9_vs_maxEta_cat3_all->Add(minR9_vs_maxEta_cat3_vbf_m125_8TeV);
  minR9_vs_maxEta_cat4_all->Add(minR9_vs_maxEta_cat4_vbf_m125_8TeV);
  minR9_vs_maxEta_cat5_all->Add(minR9_vs_maxEta_cat5_vbf_m125_8TeV);
  minR9_vs_maxEta_cat6_all->Add(minR9_vs_maxEta_cat6_vbf_m125_8TeV);

  minR9_vs_maxEta_cat2_all->Add(minR9_vs_maxEta_cat2_wzh_m125_8TeV);
  minR9_vs_maxEta_cat3_all->Add(minR9_vs_maxEta_cat3_wzh_m125_8TeV);
  minR9_vs_maxEta_cat4_all->Add(minR9_vs_maxEta_cat4_wzh_m125_8TeV);
  minR9_vs_maxEta_cat5_all->Add(minR9_vs_maxEta_cat5_wzh_m125_8TeV);
  minR9_vs_maxEta_cat6_all->Add(minR9_vs_maxEta_cat6_wzh_m125_8TeV);

  minR9_vs_maxEta_cat2_all->Add(minR9_vs_maxEta_cat2_tth_m125_8TeV);
  minR9_vs_maxEta_cat3_all->Add(minR9_vs_maxEta_cat3_tth_m125_8TeV);
  minR9_vs_maxEta_cat4_all->Add(minR9_vs_maxEta_cat4_tth_m125_8TeV);
  minR9_vs_maxEta_cat5_all->Add(minR9_vs_maxEta_cat5_tth_m125_8TeV);
  minR9_vs_maxEta_cat6_all->Add(minR9_vs_maxEta_cat6_tth_m125_8TeV);

  eta2_vs_eta1_cat2_all = (TH2*)eta2_vs_eta1_cat2_ggh_m125_8TeV->Clone();
  eta2_vs_eta1_cat3_all = (TH2*)eta2_vs_eta1_cat3_ggh_m125_8TeV->Clone();
  eta2_vs_eta1_cat4_all = (TH2*)eta2_vs_eta1_cat4_ggh_m125_8TeV->Clone();
  eta2_vs_eta1_cat5_all = (TH2*)eta2_vs_eta1_cat5_ggh_m125_8TeV->Clone();
  eta2_vs_eta1_cat6_all = (TH2*)eta2_vs_eta1_cat6_ggh_m125_8TeV->Clone();

  eta2_vs_eta1_cat2_all->Add(eta2_vs_eta1_cat2_vbf_m125_8TeV);
  eta2_vs_eta1_cat3_all->Add(eta2_vs_eta1_cat3_vbf_m125_8TeV);
  eta2_vs_eta1_cat4_all->Add(eta2_vs_eta1_cat4_vbf_m125_8TeV);
  eta2_vs_eta1_cat5_all->Add(eta2_vs_eta1_cat5_vbf_m125_8TeV);
  eta2_vs_eta1_cat6_all->Add(eta2_vs_eta1_cat6_vbf_m125_8TeV);

  eta2_vs_eta1_cat2_all->Add(eta2_vs_eta1_cat2_wzh_m125_8TeV);
  eta2_vs_eta1_cat3_all->Add(eta2_vs_eta1_cat3_wzh_m125_8TeV);
  eta2_vs_eta1_cat4_all->Add(eta2_vs_eta1_cat4_wzh_m125_8TeV);
  eta2_vs_eta1_cat5_all->Add(eta2_vs_eta1_cat5_wzh_m125_8TeV);
  eta2_vs_eta1_cat6_all->Add(eta2_vs_eta1_cat6_wzh_m125_8TeV);

  eta2_vs_eta1_cat2_all->Add(eta2_vs_eta1_cat2_tth_m125_8TeV);
  eta2_vs_eta1_cat3_all->Add(eta2_vs_eta1_cat3_tth_m125_8TeV);
  eta2_vs_eta1_cat4_all->Add(eta2_vs_eta1_cat4_tth_m125_8TeV);
  eta2_vs_eta1_cat5_all->Add(eta2_vs_eta1_cat5_tth_m125_8TeV);
  eta2_vs_eta1_cat6_all->Add(eta2_vs_eta1_cat6_tth_m125_8TeV);

  minR9_vs_maxEta_cat2_all->GetXaxis()->SetTitle("max(#eta)");
  minR9_vs_maxEta_cat3_all->GetXaxis()->SetTitle("max(#eta)");
  minR9_vs_maxEta_cat4_all->GetXaxis()->SetTitle("max(#eta)");
  minR9_vs_maxEta_cat5_all->GetXaxis()->SetTitle("max(#eta)");
  minR9_vs_maxEta_cat6_all->GetXaxis()->SetTitle("max(#eta)");
  minR9_vs_maxEta_cat2_all->GetYaxis()->SetTitle("min(R9)");
  minR9_vs_maxEta_cat3_all->GetYaxis()->SetTitle("min(R9)");
  minR9_vs_maxEta_cat4_all->GetYaxis()->SetTitle("min(R9)");
  minR9_vs_maxEta_cat5_all->GetYaxis()->SetTitle("min(R9)");
  minR9_vs_maxEta_cat6_all->GetYaxis()->SetTitle("min(R9)");

  minR9_vs_maxEta_cat2_all->GetXaxis()->SetTitleSize(0.05);
  minR9_vs_maxEta_cat3_all->GetXaxis()->SetTitleSize(0.05);
  minR9_vs_maxEta_cat4_all->GetXaxis()->SetTitleSize(0.05);
  minR9_vs_maxEta_cat5_all->GetXaxis()->SetTitleSize(0.05);
  minR9_vs_maxEta_cat6_all->GetXaxis()->SetTitleSize(0.05);
  minR9_vs_maxEta_cat2_all->GetYaxis()->SetTitleSize(0.05);
  minR9_vs_maxEta_cat3_all->GetYaxis()->SetTitleSize(0.05);
  minR9_vs_maxEta_cat4_all->GetYaxis()->SetTitleSize(0.05);
  minR9_vs_maxEta_cat5_all->GetYaxis()->SetTitleSize(0.05);
  minR9_vs_maxEta_cat6_all->GetYaxis()->SetTitleSize(0.05);

  line_minr9 = new TLine(0.,0.94,2.5,0.94);
  line_maxeta = new TLine(1.479,0.5,1.479,1.);
  //line_minr9->SetLineColor(4);
  line_minr9->SetLineWidth(2);
  line_minr9->SetLineStyle(9);
  //line_maxeta->SetLineColor(4);
  line_maxeta->SetLineWidth(2);
  line_maxeta->SetLineStyle(9);

  c_2D->cd(1);
  minR9_vs_maxEta_cat2_all->Draw("colz");
  line_minr9->Draw("hist");
  line_maxeta->Draw("hist");
  c_2D->cd(2);
  minR9_vs_maxEta_cat3_all->Draw("colz");
  line_minr9->Draw("hist");
  line_maxeta->Draw("hist");
  c_2D->cd(3);
  minR9_vs_maxEta_cat4_all->Draw("colz");
  line_minr9->Draw("hist");
  line_maxeta->Draw("hist");
  c_2D->cd(4);
  minR9_vs_maxEta_cat5_all->Draw("colz");
  line_minr9->Draw("hist");
  line_maxeta->Draw("hist");
  //c_2D->cd(5);
  //minR9_vs_maxEta_cat6_all->Draw("colz");
  //line_minr9->Draw("hist");
  //line_maxeta->Draw("hist");

  eta2_vs_eta1_cat2_all->GetYaxis()->SetTitle("sublead #eta");
  eta2_vs_eta1_cat3_all->GetYaxis()->SetTitle("sublead #eta");
  eta2_vs_eta1_cat4_all->GetYaxis()->SetTitle("sublead #eta");
  eta2_vs_eta1_cat5_all->GetYaxis()->SetTitle("sublead #eta");
  eta2_vs_eta1_cat6_all->GetYaxis()->SetTitle("sublead #eta");
  eta2_vs_eta1_cat2_all->GetXaxis()->SetTitle("lead #eta");
  eta2_vs_eta1_cat3_all->GetXaxis()->SetTitle("lead #eta");
  eta2_vs_eta1_cat4_all->GetXaxis()->SetTitle("lead #eta");
  eta2_vs_eta1_cat5_all->GetXaxis()->SetTitle("lead #eta");
  eta2_vs_eta1_cat6_all->GetXaxis()->SetTitle("lead #eta");

  eta2_vs_eta1_cat2_all->GetXaxis()->SetTitleSize(0.05);
  eta2_vs_eta1_cat3_all->GetXaxis()->SetTitleSize(0.05);
  eta2_vs_eta1_cat4_all->GetXaxis()->SetTitleSize(0.05);
  eta2_vs_eta1_cat5_all->GetXaxis()->SetTitleSize(0.05);
  eta2_vs_eta1_cat6_all->GetXaxis()->SetTitleSize(0.05);
  eta2_vs_eta1_cat2_all->GetYaxis()->SetTitleSize(0.05);
  eta2_vs_eta1_cat3_all->GetYaxis()->SetTitleSize(0.05);
  eta2_vs_eta1_cat4_all->GetYaxis()->SetTitleSize(0.05);
  eta2_vs_eta1_cat5_all->GetYaxis()->SetTitleSize(0.05);
  eta2_vs_eta1_cat6_all->GetYaxis()->SetTitleSize(0.05);

  c_2D->cd(5);
  eta2_vs_eta1_cat2_all->Draw("colz");
  c_2D->cd(6);
  eta2_vs_eta1_cat3_all->Draw("colz");
  c_2D->cd(7);
  eta2_vs_eta1_cat4_all->Draw("colz");
  c_2D->cd(8);
  eta2_vs_eta1_cat5_all->Draw("colz");
  //c_2D->cd(10);
  //eta2_vs_eta1_cat6_all->Draw("colz");

  c_2D->SaveAs("categories_2D_sig.png");

  /*
  TCanvas *c_2D_v2 = new TCanvas("c_2D_v2","min(R9) vs max(eta), |lead eta| vs |deltaEeta|",1500,500);
  c_2D_v2->Divide(5,2);

  minR9_vs_maxEta_cat2_tot->GetXaxis()->SetTitle("max(#eta)");
  minR9_vs_maxEta_cat3_tot->GetXaxis()->SetTitle("max(#eta)");
  minR9_vs_maxEta_cat4_tot->GetXaxis()->SetTitle("max(#eta)");
  minR9_vs_maxEta_cat5_tot->GetXaxis()->SetTitle("max(#eta)");
  minR9_vs_maxEta_cat6_tot->GetXaxis()->SetTitle("max(#eta)");
  minR9_vs_maxEta_cat2_tot->GetYaxis()->SetTitle("min(R9)");
  minR9_vs_maxEta_cat3_tot->GetYaxis()->SetTitle("min(R9)");
  minR9_vs_maxEta_cat4_tot->GetYaxis()->SetTitle("min(R9)");
  minR9_vs_maxEta_cat5_tot->GetYaxis()->SetTitle("min(R9)");
  minR9_vs_maxEta_cat6_tot->GetYaxis()->SetTitle("min(R9)");

  minR9_vs_maxEta_cat2_tot->GetXaxis()->SetTitleSize(0.05);
  minR9_vs_maxEta_cat3_tot->GetXaxis()->SetTitleSize(0.05);
  minR9_vs_maxEta_cat4_tot->GetXaxis()->SetTitleSize(0.05);
  minR9_vs_maxEta_cat5_tot->GetXaxis()->SetTitleSize(0.05);
  minR9_vs_maxEta_cat6_tot->GetXaxis()->SetTitleSize(0.05);
  minR9_vs_maxEta_cat2_tot->GetYaxis()->SetTitleSize(0.05);
  minR9_vs_maxEta_cat3_tot->GetYaxis()->SetTitleSize(0.05);
  minR9_vs_maxEta_cat4_tot->GetYaxis()->SetTitleSize(0.05);
  minR9_vs_maxEta_cat5_tot->GetYaxis()->SetTitleSize(0.05);
  minR9_vs_maxEta_cat6_tot->GetYaxis()->SetTitleSize(0.05);

  c_2D_v2->cd(1);
  minR9_vs_maxEta_cat2_tot->Draw("colz");
  line_minr9->Draw("hist");
  line_maxeta->Draw("hist");
  c_2D_v2->cd(2);
  minR9_vs_maxEta_cat3_tot->Draw("colz");
  line_minr9->Draw("hist");
  line_maxeta->Draw("hist");
  c_2D_v2->cd(3);
  minR9_vs_maxEta_cat4_tot->Draw("colz");
  line_minr9->Draw("hist");
  line_maxeta->Draw("hist");
  c_2D_v2->cd(4);
  minR9_vs_maxEta_cat5_tot->Draw("colz");
  line_minr9->Draw("hist");
  line_maxeta->Draw("hist");
  c_2D_v2->cd(5);
  minR9_vs_maxEta_cat6_tot->Draw("colz");
  line_minr9->Draw("hist");
  line_maxeta->Draw("hist");

  eta1_vs_deltaEta_cat2_tot->GetYaxis()->SetTitle("|lead #eta|");
  eta1_vs_deltaEta_cat3_tot->GetYaxis()->SetTitle("|lead #eta|");
  eta1_vs_deltaEta_cat4_tot->GetYaxis()->SetTitle("|lead #eta|");
  eta1_vs_deltaEta_cat5_tot->GetYaxis()->SetTitle("|lead #eta|");
  eta1_vs_deltaEta_cat6_tot->GetYaxis()->SetTitle("|lead #eta|");
  eta1_vs_deltaEta_cat2_tot->GetXaxis()->SetTitle("|#Delta#eta|");
  eta1_vs_deltaEta_cat3_tot->GetXaxis()->SetTitle("|#Delta#eta|");
  eta1_vs_deltaEta_cat4_tot->GetXaxis()->SetTitle("|#Delta#eta|");
  eta1_vs_deltaEta_cat5_tot->GetXaxis()->SetTitle("|#Delta#eta|");
  eta1_vs_deltaEta_cat6_tot->GetXaxis()->SetTitle("|#Delta#eta|");

  eta1_vs_deltaEta_cat2_tot->GetXaxis()->SetTitleSize(0.05);
  eta1_vs_deltaEta_cat3_tot->GetXaxis()->SetTitleSize(0.05);
  eta1_vs_deltaEta_cat4_tot->GetXaxis()->SetTitleSize(0.05);
  eta1_vs_deltaEta_cat5_tot->GetXaxis()->SetTitleSize(0.05);
  eta1_vs_deltaEta_cat6_tot->GetXaxis()->SetTitleSize(0.05);
  eta1_vs_deltaEta_cat2_tot->GetYaxis()->SetTitleSize(0.05);
  eta1_vs_deltaEta_cat3_tot->GetYaxis()->SetTitleSize(0.05);
  eta1_vs_deltaEta_cat4_tot->GetYaxis()->SetTitleSize(0.05);
  eta1_vs_deltaEta_cat5_tot->GetYaxis()->SetTitleSize(0.05);
  eta1_vs_deltaEta_cat6_tot->GetYaxis()->SetTitleSize(0.05);

  c_2D_v2->cd(6);
  eta1_vs_deltaEta_cat2_tot->Draw("colz");
  c_2D_v2->cd(7);
  eta1_vs_deltaEta_cat3_tot->Draw("colz");
  c_2D_v2->cd(8);
  eta1_vs_deltaEta_cat4_tot->Draw("colz");
  c_2D_v2->cd(9);
  eta1_vs_deltaEta_cat5_tot->Draw("colz");
  c_2D_v2->cd(10);
  eta1_vs_deltaEta_cat6_tot->Draw("colz");

  c_2D_v2->SaveAs("categories_2D_v2_sig.png");
  */
}
void FakePhotonSystematic(){
  
  TFile FMCRSSig("DsTolnu/SP1005Skim/DsReco/Final/HistosForFit.root");
  TFile FMCWSSig("DsTolnu/SP1005Skim/DsReco/FinalWS/HistosForFit.root");

  //TFile FMCRS("DsTolnu/MC/Final/HistosForFit.root");
  //TFile FMCWS("DsTolnu/MC/FinalWS/HistosForFit.root");
  TFile FMCRS("DsTolnu/SP1005Skim/DsReco/Final/HistosForFit.root");
  TFile FMCWS("DsTolnu/SP1005Skim/DsReco/FinalWS/HistosForFit.root");

  TFile FDataRS("DsTolnu/Data/Final/HistosForFit.root");
  TFile FDataWS("DsTolnu/Data/FinalWS/HistosForFit.root");

  

  TCanvas C;
  C.Clear();
  C.Print("FakePhotonSystematic.ps[");

  C.Clear();
  C.Divide(2,2);
  C.cd(1);  
//   TH1F* HMCRS=(TH1F*)FMCRS.Get("HEvtMultiplicity");
//   HMCRS->SetTitle(TString("MC RS =")+(long)HMCRS->GetMean()+"."+(long)(1000*(HMCRS->GetMean()-1.)));
//   HMCRS->Draw();
//   C.cd(2);
//   TH1F* HMCWS=(TH1F*)FMCWS.Get("HEvtMultiplicity");
//   HMCWS->SetTitle(TString("MC WS =")+(long)HMCWS->GetMean()+"."+(long)(1000*(HMCWS->GetMean()-1.)));
//   HMCWS->Draw();
  C.cd(3);  
  TH1F* HDataRS=(TH1F*)FDataRS.Get("HEvtMultiplicity");
  HDataRS->SetTitle(TString("Data RS =")+(long)HDataRS->GetMean()+"."+(long)(1000*(HDataRS->GetMean()-1.)));
  HDataRS->Draw();
  C.cd(4);
  TH1F* HDataWS=(TH1F*)FDataWS.Get("HEvtMultiplicity");
  HDataWS->SetTitle(TString("Data WS =")+(long)HDataWS->GetMean()+"."+(long)(1000*(HDataWS->GetMean()-1.)));
  HDataWS->Draw();
  C.Print("FakePhotonSystematic.ps");



  C.Clear();
  C.Divide(2,2);
  C.cd(1);  
  TH1F* HSigMCRS=(TH1F*)FMCRSSig.Get("HEvtMultiplicitySig");
  HSigMCRS->SetTitle(TString("MC Sig RS =")+(long)HSigMCRS->GetMean()+"."+(long)(1000*(HSigMCRS->GetMean()-1.)));
  HSigMCRS->Draw();
  C.cd(2);
  TH1F* HSigMCWS=(TH1F*)FMCWSSig.Get("HEvtMultiplicitySig");
  HSigMCWS->SetTitle(TString("MC Sig WS =")+(long)HSigMCWS->GetMean()+"."+(long)(1000*(HSigMCWS->GetMean()-1.)));
  HSigMCWS->Draw();
  C.cd(3);  
  TH1F* HBkgMCRS=(TH1F*)FMCRS.Get("HEvtMultiplicityBkg");
  HBkgMCRS->SetTitle(TString("MC Bkg RS =")+(long)HBkgMCRS->GetMean()+"."+(long)(1000*(HBkgMCRS->GetMean()-1.)));
  HBkgMCRS->Draw();
  C.cd(4);
  TH1F* HBkgMCWS=(TH1F*)FMCWS.Get("HEvtMultiplicityBkg");
  HBkgMCWS->SetTitle(TString("MC Bkg WS =")+(long)HBkgMCWS->GetMean()+"."+(long)(1000*(HBkgMCWS->GetMean()-1.)));
  HBkgMCWS->Draw();
  C.Print("FakePhotonSystematic.ps");
  
  C.Clear();
  THStack HMCStack("HMCStack","");
  HBkgMCRS->SetFillColor(1);HMCStack.Add(HBkgMCRS);
  HSigMCRS->SetFillColor(2);HSigMCRS->SetLineColor(2);HMCStack.Add(HSigMCRS);
  HMCStack.Draw();
  C.Print("FakePhotonSystematic.ps");

  //---------------------------------------------
  //subtract background from Data
  //---------------------------------------------
  TH1F*HDataRSBkg=(TH1F*)HDataWS->Clone("HDataRSBkg");
  TH1F*HBkgMCWSCl=(TH1F*)HBkgMCWS->Clone("HBkgMCWSCl");
  //need to fix the WS first by subtracting the signal component
  HSigMCWS->Scale(11350./HSigMCWS->Integral());//scale to number of WS signal events in Data
  HDataRSBkg->Add(HSigMCWS,-1);
  //construct correction ratio from MC to correct the WS distribution
  TH1F*HBkgMCRSCl=(TH1F*)HBkgMCRS->Clone("HBkgMCRSCl");
  HBkgMCWSCl->Scale(1./HBkgMCWSCl->Integral());
  HBkgMCRSCl->Scale(1./HBkgMCRSCl->Integral());
  TH1F*HBkgMCRatio=(TH1F*)HBkgMCRSCl->Clone("HBkgMCRatio");
  HBkgMCRatio->Divide(HBkgMCWSCl);
  C.Clear();
  delete HBkgMCRatio->FindObject("stats");
  HBkgMCRatio->SetFillColor(0);HBkgMCRatio->SetLineColor(1);
  HBkgMCRatio->SetStats(0);
  HBkgMCRatio->GetYaxis()->SetRangeUser(0,1.5);
  HBkgMCRatio->Draw("hist");
  C.Print("FakePhotonSystematic.ps");
  //correct the WS distribution
  HDataRSBkg->Multiply(HBkgMCRatio);
  C.Clear();
  HDataWS->Scale(1./HDataWS->Integral());
  HDataRSBkg->Scale(1./HDataRSBkg->Integral());
  delete HDataWS->FindObject("stats");
  HDataWS->SetTitle("");
  HDataWS->GetXaxis()->SetTitle("Reconstruction Multiplicity");
  HDataWS->Draw("p");
  HDataRSBkg->SetLineColor(0);
  HDataRSBkg->SetFillColor(4);
  HDataRSBkg->Draw("hist same");
  HDataWS->Draw("psame");
  C.Print("FakePhotonSystematic.ps");
  //scale Data WS up to Data RS bkg
  HDataRSBkg->Scale((6.9952e+05)/HDataRSBkg->Integral());//scale to number of Bkg events in data //+(106000*.06)modify bkg by initial guess on error of Signal .06 comes from a 10% increase in the fake photon yield
  C.Clear();
  HDataRS->GetYaxis()->SetRangeUser(0,HDataRS->GetMaximum()*1.3);
  HDataRS->GetXaxis()->SetTitle("Reconstruction Multiplicity");
  HDataRS->SetTitle("");
  HDataRS->Draw("pe");
  HDataRSBkg->SetFillColor(4);HDataRSBkg->SetLineColor(0);
  delete HDataRSBkg->FindObject("stats");
  HDataRSBkg->Draw("same");
  C.Print("FakePhotonSystematic.ps");

  //Perform subtraction
  TH1F*HDataRSCl=new TH1F("HDataRSCl","",HDataRS->GetXaxis()->GetNbins(),
			  HDataRS->GetXaxis()->GetXmin(),HDataRS->GetXaxis()->GetXmax());
  HDataRSCl->Add(HDataRS);
  Float_t Ntot=0,Nw=0;
  for(Int_t b=1;b<=HDataRSCl->GetXaxis()->GetNbins();b++){
    Nw+=HDataRSCl->GetBinContent(b)*HDataRSCl->GetBinCenter(b);
    Ntot+=HDataRSCl->GetBinContent(b);
  } 
  cout<<"before "<<HDataRSCl->GetMean()<<" "<<Nw/Ntot<<endl;
  delete HDataRSCl->FindObject("stats");
  HDataRSCl->Add(HDataRSBkg,-1);
  Ntot=0,Nw=0;
  for(Int_t b=1;b<=HDataRSCl->GetXaxis()->GetNbins();b++){
    Nw+=HDataRSCl->GetBinContent(b)*HDataRSCl->GetBinCenter(b);
    Ntot+=HDataRSCl->GetBinContent(b);
  } 
  cout<<"after "<<HDataRSCl->GetMean()<<" "<<Nw/Ntot<<endl;
  //compare Data signal to MC signal
  TH1F*HSigMCRSCl=(TH1F*)HSigMCRS->Clone("HSigMCRSCl");
  HSigMCRSCl->Scale(HDataRSCl->Integral()/HSigMCRSCl->Integral());
  HSigMCRSCl->SetFillColor(0);HSigMCRSCl->SetLineColor(1);
  C.Clear();  
  HDataRSCl->GetYaxis()->SetRangeUser(0,HDataRSCl->GetMaximum()*1.3);
  //HDataRSCl->SetTitle(TString("Data Sig =")+(long)(Nw/Ntot)+"."+(long)(1000*(Nw/Ntot-1.)));
  HDataRSCl->SetTitle("");
  HDataRSCl->GetXaxis()->SetTitle("Reconstruction Multiplicity");
  delete HDataRSCl->FindObject("stats");
  HDataRSCl->SetStats(0);
  HDataRSCl->Draw("pe");
  HSigMCRSCl->SetStats(0);
  HSigMCRSCl->Draw("same");
  C.Print("FakePhotonSystematic.ps");

  TH1F*HDataSigMCSigDiff=new TH1F("HDataSigMCSigDiff","",HDataRS->GetXaxis()->GetNbins(),
			  HDataRS->GetXaxis()->GetXmin(),HDataRS->GetXaxis()->GetXmax());
  HDataSigMCSigDiff->Add(HDataRSCl);
  HDataSigMCSigDiff->Add(HSigMCRSCl,-1);
  C.Clear();
  delete HDataSigMCSigDiff->FindObject("stats");
  HDataSigMCSigDiff->SetStats(0);
  HDataSigMCSigDiff->Draw("");
  C.Print("FakePhotonSystematic.ps");


  //Signal multiplicity for modified photon backgrounds
  C.Clear();
  HSigMCRSCl->SetFillColor(0);HSigMCRSCl->SetLineColor(1);
  HSigMCRSCl->GetYaxis()->SetRangeUser(0,HSigMCRSCl->GetMaximum()*1.1);
  HSigMCRSCl->GetXaxis()->SetRangeUser(.5,3.5);
  HSigMCRSCl->SetStats(0);
  HSigMCRSCl->Draw("l"); 
  TGraph GMult;
  Int_t npts=0;
  TH1F* HDiff[21];
  TH1F* HSigMCRSMod[21];
  for(Int_t m=0;m<11;m++){
    HSigMCRSMod[m]=(TH1F*)FMCRSSig.Get(TString("HEvtMultiplicitySigMod")+(long)m);    
    if(HSigMCRSMod[m]->Integral()>0){
      GMult.SetPoint(npts,1+(m-10)*.01,HSigMCRSMod[m]->GetMean()); 
      npts++;
      HSigMCRSMod[m]->Scale(HDataRSCl->Integral()/HSigMCRSMod[m]->Integral());
    }
    HSigMCRSMod[m]->SetLineColor(4);
    HSigMCRSMod[m]->SetStats(0);
    HSigMCRSMod[m]->Draw("lsame");
    HDiff[m]=(TH1F*)HSigMCRSMod[m]->Clone(TString("HEvtMultiplicitySigModCl")+(long)m);
    HDiff[m]->Add(HSigMCRSCl,-1);
  }
  HSigMCRSCl->Draw("lsame");
  HDataRSCl->SetLineColor(2);
  HDataRSCl->SetStats(0);
  HDataRSCl->Draw("lsame");
  C.Print("FakePhotonSystematic.ps");

  //fix the multiplicity on the plus side 
  GMult.SetPoint(npts,1.1,HSigMCRSMod[10]->GetMean()+(HSigMCRSMod[10]->GetMean()-HSigMCRSMod[0]->GetMean()));
    

  TH1F* HDataDiff=(TH1F*)HDataRSCl->Clone("HDataDiff");
  HDataDiff->Add(HSigMCRSCl,-1);
  TH1F* HMCDiff=(TH1F*)HSigMCRSCl->Clone("HMCDiff");
  HMCDiff->Add(HSigMCRSCl,-1);
  C.Clear();
  HMCDiff->GetYaxis()->SetRangeUser(-6000,3000);
  HMCDiff->Draw("l");
  for(Int_t m=0;m<11;m++) HDiff[m]->Draw("lsame");
  HMCDiff->Draw("lsame");
  HDataDiff->Draw("lsame");
  C.Print("FakePhotonSystematic.ps");
  
  GMult.GetXaxis()->SetTitle("Amount of Fake Photon Background");
  GMult.GetYaxis()->SetTitle("Avg. Reconstruction Multiplicity");

  C.Clear();  //just the map
  GMult.Draw("apl");
  C.Print("FakePhotonSystematic.ps");

  //no Data error
  C.Clear();
  GMult.Draw("apl");
  TLine line;
  line.SetLineColor(2);  line.SetLineWidth(2);
  line.DrawLine(.9,Nw/Ntot,1.1,Nw/Ntot);
  C.Print("FakePhotonSystematic.ps");

  //with Data error
  C.Clear();
  GMult.Draw("apl");
  TBox box;
  box.SetLineColor(0);
  box.SetFillColor(3);
  box.SetFillStyle(1001);
  box.DrawBox(.9,Nw/Ntot-(1.769-1.763),1.1,Nw/Ntot+(1.769-1.763));
  line.DrawLine(.9,Nw/Ntot,1.1,Nw/Ntot);
  GMult.Draw("plsame");
  C.Print("FakePhotonSystematic.ps");

  C.Print("FakePhotonSystematic.ps]");

}
Example #12
0
void Draw_Phenix_JPsi_RaaVspT(TLegend *legend_ratio)
{

  //================= Phenix Forward Rapidity Raa Vs Pt ===================================//
  //r_aa at forward rapidity (|y| in [1.2,2.2])
  //"J/psi Production vs Centrality, Transverse Momentum, and Rapidity in Au+Au Collisions at s(NN)**(1/2) = 200-GeV" 
  //Preprint:   nucl-ex/0611020   inSPIRE, Citations
  //Submitted:  2006-11-12
  //Published:   Phys. Rev. Lett. 98, 232301 (2007) ,   2007-06-07

  Double_t PtPhenix[7]={0.50,1.50,2.50,3.50,4.50};
  Double_t ErrPtPhenix[7]={0};
  
  // 0-20%
  //int nbinsPtPhenix=6;
  //Double_t RaaPtPhenix[7] = {0.18,0.18,0.19,0.17,0.60,0.26}; 
  //Double_t RaaPtStatErrPhenix[7] = {0.03,0.03,0.04,0.07,0.17,0.06};
  //Double_t RaaPtSystErrPhenix[7] = {0.03,0.02,0.03,0.02,0.08,0.05};

  // 0-93%
  int nbinsPtPhenix=5;
  Double_t RaaPtPhenix[7] = {0.152,0.207,0.352,0.323,0.499}; 
  Double_t RaaPtStatErrPhenix[7] = {0.016,0.016,0.024,0.036,0.071};
  Double_t RaaPtSystErrPhenix[7] = {0.015,0.020,0.035,0.032,0.049};
  
  TGraphErrors *grRaaPtPhenix = new TGraphErrors(nbinsPtPhenix, PtPhenix, RaaPtPhenix, ErrPtPhenix, RaaPtStatErrPhenix);  
  grRaaPtPhenix->SetMarkerStyle(34);
  grRaaPtPhenix->SetMarkerColor(kGreen+2);
  grRaaPtPhenix->SetMarkerSize(1.3);
  grRaaPtPhenix->SetLineColor(1);
   
  TLine *lh4 = new TLine(0.0,1.0,7.6,1.0);
  lh4->SetLineColor(1);
  lh4->SetLineStyle(1);
  lh4->SetLineWidth(1.5);
  //lh4->Draw("same");
  
  TLatex *tb= new TLatex;
  tb->SetNDC(); 
  tb->SetTextAlign(12);
  tb->SetTextColor(1);
  tb->SetTextSize(0.040);
  
  TBox *RaaPtJPsiPhenixSys[12];
  for(int j=0;j<nbinsPtPhenix;j++){
    RaaPtJPsiPhenixSys[j] = new TBox(PtPhenix[j]-0.4,  RaaPtPhenix[j]-RaaPtSystErrPhenix[j], PtPhenix[j]+0.4,  RaaPtPhenix[j]+RaaPtSystErrPhenix[j]);
  }
  
  for(int j=0;j<nbinsPtPhenix;j++){
    RaaPtJPsiPhenixSys[j]->SetFillStyle(1001);
    RaaPtJPsiPhenixSys[j]->SetFillColor(kGreen+6);
    RaaPtJPsiPhenixSys[j]->SetLineColor(1);
  }
  
  TBox *PhenixGlobalSysJPsiPtFor;
  PhenixGlobalSysJPsiPtFor = new TBox(28.42,0.88,29.0,1.16);
  PhenixGlobalSysJPsiPtFor->SetFillStyle(3001);
  PhenixGlobalSysJPsiPtFor->SetLineColor(1);
  PhenixGlobalSysJPsiPtFor->SetFillColor(1);
  
  grRaaPtPhenix->Draw("sameP");
  for(int j=0;j<nbinsPtPhenix;j++) RaaPtJPsiPhenixSys[j]->Draw("sameL"); 
  grRaaPtPhenix->Draw("Psame");
  //PhenixGlobalSysJPsiPtFor->Draw("sameL"); 
  //tb->DrawLatex(0.22,0.16,"J/#psi #rightarrow #mu^{+} #mu^{-}, p_{T}^{J/#psi} > 0.0 GeV/c"); 
  legend_ratio->SetTextColor(1);
  //legend_ratio->AddEntry(grRaaPtPhenix,"PHENIX: J/#psi #rightarrow #mu^{+} #mu^{-}, 1.2 < |y| < 2.2 & p_{T}^{J/#psi} > 0.0 GeV/c", "P"); 
  legend_ratio->AddEntry(grRaaPtPhenix,"Au+Au #sqrt{s_{NN}} = 200 GeV,  J/#psi PHENIX: 1.2 < |y| < 2.2", "P"); 
}
Example #13
0
void plotXY(char* fname){

  // input: root file from GBL

  gStyle->SetOptStat(0);
  Double_t w = 1.2; // number of RMS for gaussian fit
  TString filename = fname;
  TCanvas *cTop = new TCanvas("cTop","Residuals in lab frame, TOP", 800, 1000);
  TCanvas *cBot = new TCanvas("cBot","Residuals in lab frame, BOTTOM",800, 1000);
  cTop->SetFillColor(kBlue-10); cTop->SetFillStyle(3001);
  cBot->SetFillColor(kMagenta-10); cBot->SetFillStyle(3001);
  Double_t halfWid = 38.34/2.;
  Double_t halfLen = 98.33/2.;
  TBox *module = new TBox(-halfLen, -halfWid, halfLen, halfWid);
  module->SetLineColor(kMagenta);
  module->SetFillStyle(0);

  Int_t ic=0;
  TFile *f = new TFile(filename.Data());
  // extract string 
  Int_t idx2 = filename.Index("/");
  Int_t idx1 = filename.Index("_");
  TString outn = filename(idx1+1,idx2-(idx1+1));
  TString outname ="predXY_"; outname += outn.Data(); outname += ".txt";
  TString topName ="predXY_"; topName += outn.Data(); topName += "_topO.gif";
  TString botName ="predXY_"; botName += outn.Data(); botName += "_botO.gif";
  //  ofstream outf(outname.Data());
  // top
  Int_t nrow = 13;
  Double_t space = 0.007;
  Double_t space1 = 0.03;
  Double_t y2 = 1./13*nrow-space1;
  Double_t y1 = 1./13*(--nrow)-space1;
  TPad *tp1 = new TPad("tp1","tp1",0.33,y1,0.66,y2);
  y2 = y1; y1 = 1./13.*(--nrow)-space1;
  TPad *tp2 = new TPad("tp2","tp2",0.33,y1,0.66,y2);
  y2 = y1-space; y1 = 1./13.*(--nrow)-space1;
  TPad *tp3 = new TPad("tp3","tp3",0.33,y1,0.66,y2);
  y2 = y1; y1 = 1./13.*(--nrow)-space1;
  TPad *tp4 = new TPad("tp4","tp4",0.33,y1,0.66,y2);
  y2 = y1-space; y1 = 1./13.*(--nrow)-space1;
  TPad *tp5 = new TPad("tp5","tp5",0.33,y1,0.66,y2);
  y2 = y1; y1 = 1./13.*(--nrow)-space1;
  TPad *tp6 = new TPad("tp6","tp6",0.33,y1,0.66,y2);
  y2 = y1-space; y1 = 1./13.*(--nrow)-space1;
  Double_t off = 0.12;
  off = 0.165;
  y1 -= space1; y2 -= space1;
  space1 *= 2;
  TPad *tp7 = new TPad("tp7","tp7",0.+off,y1,0.33+off,y2);
  TPad *tp8 = new TPad("tp8","tp8",0.66-off,y1,1.-off,y2);
  y2 = y1; y1 = 1./13.*(--nrow)-space1;
  TPad *tp9 = new TPad("tp9","tp9",0.+off,y1,0.33+off,y2);
  TPad *tp10 = new TPad("tp10","tp10",0.66-off,y1,1.-off,y2);
  y2 = y1-space; y1 = 1./13.*(--nrow)-space1;
  TPad *tp11 = new TPad("tp11","tp11",0.+off,y1,0.33+off,y2);
  TPad *tp12 = new TPad("tp12","tp12",0.66-off,y1,1.-off,y2);
  y2 = y1; y1 = 1./13.*(--nrow)-space1;
  TPad *tp13 = new TPad("tp13","tp13",0.+off,y1,0.33+off,y2);
  TPad *tp14 = new TPad("tp14","tp14",0.66-off,y1,1.-off,y2);
  y2 = y1-space; y1 = 1./13.*(--nrow)-space1;
  TPad *tp15 = new TPad("tp15","tp15",0.+off,y1,0.33+off,y2);
  TPad *tp16 = new TPad("tp16","tp16",0.66-off,y1,1.-off,y2);
  y2 = y1; y1 = 1./13.*(--nrow)-space1;
  TPad *tp17 = new TPad("tp17","tp17",0.+off,y1,0.33+off,y2);
  TPad *tp18 = new TPad("tp18","tp18",0.66-off,y1,1.-off,y2);
  cout << " TOP " << endl;

  cTop->cd();
  tp1->Draw();
  tp2->Draw();
  tp3->Draw();
  tp4->Draw();
  tp5->Draw();
  tp6->Draw();
  tp7->Draw();
  tp8->Draw();
  tp9->Draw();
  tp10->Draw();
  tp11->Draw();
  tp12->Draw();
  tp13->Draw();
  tp14->Draw();
  tp15->Draw();
  tp16->Draw();
  tp17->Draw();
  tp18->Draw();

  ic = 2;
  Int_t ipad=0;
  for(Int_t i=1; i<4; i++){
    TString hisname = "h_xy_module_L"; hisname  += i;
    hisname += "t_halfmodule_axial_sensor0";
    TString layer = "L"; layer+=i; layer+= "TA"; 
    TH2D *his2 = (TH2D*) f->Get(hisname.Data());
    TH1D *his = (TH1D*)his2->ProjectionY();
    ipad++;
    TString pd = "tp"; pd+=ipad;
    TPad *pad = (TPad*) cTop->GetListOfPrimitives()->FindObject(pd.Data());
    pad->cd();
    Double_t low = his->GetMean()-w*his->GetRMS();
    Double_t up = his->GetMean()+w*his->GetRMS();    
    his->Fit("gaus","Q0","",low,up);
    his2->Draw("colz");
    module->Draw("same");
    TF1 *fit = his->GetFunction("gaus");
    // cout << "sensor " << i << " axial mean :  " << his->GetMean()*1000. << " - RMS : " << his->GetRMS()*1000. << " (um) " << " " << his->GetEntries() << endl;
    // cout << "sensor " << i << " axial mu :  " << fit->GetParameter(1)*1000. << " - sigma : " << fit->GetParameter(2)*1000. << " (um) " << endl;
    // outf << layer.Data() << " " << fit->GetParameter(1)*1000. << " " << fit->GetParameter(2)*1000. << " " << his->GetEntries() << endl;

    hisname = "h_xy_module_L"; hisname  += i;
    hisname += "t_halfmodule_stereo_sensor0";
    layer = "L"; layer+=i; layer+= "TS"; 
    his2 = (TH2D*) f->Get(hisname.Data());
    his = (TH1D*)his2->ProjectionY();
    ipad++;
    pd = "tp"; pd+=ipad;
    pad = (TPad*) cTop->GetListOfPrimitives()->FindObject(pd.Data());
    pad->cd();
    low = his->GetMean()-w*his->GetRMS();
    up = his->GetMean()+w*his->GetRMS();    
    his->Fit("gaus","Q","",low,up); his2->Draw("colz");
    module->Draw("same");
    fit = his->GetFunction("gaus");
  }
  //  ic = 19;
  for(Int_t i=4; i<7; i++){
    TString hisname = "h_xy_module_L"; hisname  += i;
    TString hisname2 = hisname;
    hisname += "t_halfmodule_axial_hole_sensor0";
    hisname2 += "t_halfmodule_axial_slot_sensor0";
    TH2D *hisOther = (TH2D*) f->Get(hisname2.Data());
    Double_t norma2 = hisOther->GetMaximum();
    TString layer = "L"; layer+=i; layer+= "TAHo"; 
    TH2D *his2 = (TH2D*) f->Get(hisname.Data());
    TH1D *his = (TH1D*)his2->ProjectionY();     
    Double_t norma1 = his2->GetMaximum();
    Double_t normamax = TMath::Max(norma1,norma2);
    his2->SetMaximum(normamax);
    ipad++;
    TString pd = "tp"; pd+=ipad;
    TPad *pad = (TPad*) cTop->GetListOfPrimitives()->FindObject(pd.Data());
    pad->cd();
    Double_t low = his->GetMean()-w*his->GetRMS();
    Double_t up = his->GetMean()+w*his->GetRMS();    
    his->Fit("gaus","Q0","",low,up); his2->Draw("colz");
    module->Draw("same");
    TF1 *fit = his->GetFunction("gaus");
    hisname = "h_xy_module_L"; hisname  += i;
    hisname2 = hisname;
    hisname += "t_halfmodule_stereo_hole_sensor0";
    hisname2 += "t_halfmodule_stereo_slot_sensor0";
    TH2D *hisOther = (TH2D*) f->Get(hisname2.Data());
    norma2 = hisOther->GetMaximum();
    TString layer = "L"; layer+=i; layer+= "TAHo"; 
    TH2D *his2 = (TH2D*) f->Get(hisname.Data());
    TH1D *his = (TH1D*)his2->ProjectionY();     
    norma1 = his2->GetMaximum();
    normamax2 = TMath::Max(norma1,norma2);
    his2->SetMaximum(normamax2);
    layer = "L"; layer+=i; layer+= "TSHo"; 
    his2 = (TH2D*) f->Get(hisname.Data());
    his = (TH1D*)his2->ProjectionY();
    ipad++; ipad++;
    pd = "tp"; pd+=ipad;
    pad = (TPad*) cTop->GetListOfPrimitives()->FindObject(pd.Data());
    pad->cd();
    low = his->GetMean()-w*his->GetRMS();
    up = his->GetMean()+w*his->GetRMS();    
    his->Fit("gaus","Q0","",low,up); his2->Draw("colz");
    module->Draw("same");
    fit = his->GetFunction("gaus");
    hisname = "h_xy_module_L"; hisname  += i;
    hisname += "t_halfmodule_axial_slot_sensor0";
    layer = "L"; layer+=i; layer+= "TASl";
    his2 = (TH2D*) f->Get(hisname.Data());
    his2->SetMaximum(normamax);
    his = (TH1D*)his2->ProjectionY();     
    ipad--;
    pd = "tp"; pd+=ipad;
    pad = (TPad*) cTop->GetListOfPrimitives()->FindObject(pd.Data());
    pad->cd();
    low = his->GetMean()-w*his->GetRMS();
    up = his->GetMean()+w*his->GetRMS();    
    his->Fit("gaus","Q0","",low,up); his2->Draw("colz");
    module->Draw("same");
    fit = his->GetFunction("gaus");
    hisname = "h_xy_module_L"; hisname  += i;
    hisname += "t_halfmodule_stereo_slot_sensor0";
    layer = "L"; layer+=i; layer+= "TSSl"; 
    his2 = (TH2D*) f->Get(hisname.Data());
    his2->SetMaximum(normamax2);
    his = (TH1D*)his2->ProjectionY();     
    ipad++; ipad++;
    pd = "tp"; pd+=ipad;
    pad = (TPad*) cTop->GetListOfPrimitives()->FindObject(pd.Data());
    pad->cd();
    low = his->GetMean()-w*his->GetRMS();
    up = his->GetMean()+w*his->GetRMS();    
    his->Fit("gaus","Q0","",low,up); his2->Draw("colz");
    module->Draw("same");
    fit = his->GetFunction("gaus");
  }
  cout << endl;
  cout << "------------------------" << endl;
  cout << endl;
  cout << " BOTTOM " << endl;
  nrow = 13;
  space = 0.007;
  space1 = 0.03;
  y2 = 1./13*nrow-space1;
  y1 = 1./13*(--nrow)-space1;
  TPad *bp1 = new TPad("bp1","bp1",0.33,y1,0.66,y2);
  y2 = y1; y1 = 1./13.*(--nrow)-space1;
  TPad *bp2 = new TPad("bp2","bp2",0.33,y1,0.66,y2);
  y2 = y1-space; y1 = 1./13.*(--nrow)-space1;
  TPad *bp3 = new TPad("bp3","bp3",0.33,y1,0.66,y2);
  y2 = y1; y1 = 1./13.*(--nrow)-space1;
  TPad *bp4 = new TPad("bp4","bp4",0.33,y1,0.66,y2);
  y2 = y1-space; y1 = 1./13.*(--nrow)-space1;
  TPad *bp5 = new TPad("bp5","bp5",0.33,y1,0.66,y2);
  y2 = y1; y1 = 1./13.*(--nrow)-space1;
  TPad *bp6 = new TPad("bp6","bp6",0.33,y1,0.66,y2);
  y2 = y1-space; y1 = 1./13.*(--nrow)-space1;
  off = 0.165;
  y1 -= space1; y2 -= space1;
  space1 *= 2;
  TPad *bp7 = new TPad("bp7","bp7",0.+off,y1,0.33+off,y2);
  TPad *bp8 = new TPad("bp8","bp8",0.66-off,y1,1.-off,y2);
  y2 = y1; y1 = 1./13.*(--nrow)-space1;
  TPad *bp9 = new TPad("bp9","bp9",0.+off,y1,0.33+off,y2);
  TPad *bp10 = new TPad("bp10","bp10",0.66-off,y1,1.-off,y2);
  y2 = y1-space; y1 = 1./13.*(--nrow)-space1;
  TPad *bp11 = new TPad("bp11","bp11",0.+off,y1,0.33+off,y2);
  TPad *bp12 = new TPad("bp12","bp12",0.66-off,y1,1.-off,y2);
  y2 = y1; y1 = 1./13.*(--nrow)-space1;
  TPad *bp13 = new TPad("bp13","bp13",0.+off,y1,0.33+off,y2);
  TPad *bp14 = new TPad("bp14","bp14",0.66-off,y1,1.-off,y2);
  y2 = y1-space; y1 = 1./13.*(--nrow)-space1;
  TPad *bp15 = new TPad("bp15","bp15",0.+off,y1,0.33+off,y2);
  TPad *bp16 = new TPad("bp16","bp16",0.66-off,y1,1.-off,y2);
  y2 = y1; y1 = 1./13.*(--nrow)-space1;
  TPad *bp17 = new TPad("bp17","bp17",0.+off,y1,0.33+off,y2);
  TPad *bp18 = new TPad("bp18","bp18",0.66-off,y1,1.-off,y2);

  cBot->cd();
  bp1->Draw();
  bp2->Draw();
  bp3->Draw();
  bp4->Draw();
  bp5->Draw();
  bp6->Draw();
  bp7->Draw();
  bp8->Draw();
  bp9->Draw();
  bp10->Draw();
  bp11->Draw();
  bp12->Draw();
  bp13->Draw();
  bp14->Draw();
  bp15->Draw();
  bp16->Draw();
  bp17->Draw();
  bp18->Draw();

  cBot->cd();
  bp1->Draw();
  bp2->Draw();
  bp3->Draw();
  bp4->Draw();
  bp5->Draw();
  bp6->Draw();
  bp7->Draw();
  bp8->Draw();
  bp9->Draw();
  bp10->Draw();
  bp11->Draw();
  bp12->Draw();
  bp13->Draw();
  bp14->Draw();
  bp15->Draw();
  bp16->Draw();
  bp17->Draw();
  bp18->Draw();

  ic=0;
  ipad = 0;
  for(Int_t i=1; i<4; i++){
    TString hisname = "h_xy_module_L"; hisname  += i;
    TString hisname2 = hisname;
    hisname += "b_halfmodule_stereo_sensor0";
    hisname2 += "b_halfmodule_axial_sensor0";
    TH2D *hisOther = (TH2D*) f->Get(hisname2.Data());
    Double_t norma2 = hisOther->GetMaximum();
    TString layer = "L"; layer+=i; layer+= "BS"; 
    TH2D *his2 = (TH2D*) f->Get(hisname.Data());
    Double_t norma1 = his2->GetMaximum();
    Double_t normamax = TMath::Max(norma1,norma2);
    //    his2->SetMaximum(normamax);
    TH1D *his = (TH1D*)his2->ProjectionY();     
    if(layer.Contains("1")){his->SetFillColor(kRed);}
    else if(layer.Contains("2")){his->SetFillColor(kOrange);}
    else if(layer.Contains("3")){his->SetFillColor(kYellow);}
    else if(layer.Contains("4")){his->SetFillColor(kGreen);}
    else if(layer.Contains("5")){his->SetFillColor(kCyan);}
    else if(layer.Contains("6")){his->SetFillColor(kBlue);}
    if(layer.Contains("A")){his->SetFillStyle(3007);}
    else if(layer.Contains("S")){his->SetFillStyle(3004);}
    //    cBot->cd(++ic);
    ipad++;
    TString pd = "bp"; pd+=ipad;
    TPad *pad = (TPad*) cBot->GetListOfPrimitives()->FindObject(pd.Data());
    pad->cd();
    Double_t low = his->GetMean()-w*his->GetRMS();
    Double_t up = his->GetMean()+w*his->GetRMS();    
    his->Fit("gaus","Q0","",low,up); his2->Draw("colz");
    module->Draw("same");
    TF1 *fit = his->GetFunction("gaus");
    hisname = "h_xy_module_L"; hisname  += i;
    hisname += "b_halfmodule_axial_sensor0";
    layer = "L"; layer+=i; layer+= "BA"; 
    his2 = (TH2D*) f->Get(hisname.Data());
    //   his2->SetMaximum(normamax);
    his = (TH1D*)his2->ProjectionY();     
    ipad++;
    pd = "bp"; pd+=ipad;
    pad = (TPad*) cBot->GetListOfPrimitives()->FindObject(pd.Data());
    pad->cd();
    low = his->GetMean()-w*his->GetRMS();
    up = his->GetMean()+w*his->GetRMS();    
    his->Fit("gaus","Q0","",low,up); his2->Draw("colz");
    module->Draw("same");
    fit = his->GetFunction("gaus");
  }
  for(Int_t i=4; i<7; i++){
    TString hisname = "h_xy_module_L"; hisname  += i;
    TString hisname2 = hisname;
    hisname += "b_halfmodule_stereo_hole_sensor0";
    hisname2 += "b_halfmodule_stereo_slot_sensor0";
    TH2D *hisOther = (TH2D*) f->Get(hisname2.Data());
    Double_t norma2 = hisOther->GetMaximum();
    TString layer = "L"; layer+=i; layer+= "BSHo"; 
    TH2D *his2 = (TH2D*) f->Get(hisname.Data());
    TH1D *his = (TH1D*)his2->ProjectionY();     
    Double_t norma1 = his2->GetMaximum();
    Double_t normamax1 = TMath::Max(norma1,norma2);
    his2->SetMaximum(normamax1);
    ipad++; 
    TString pd = "bp"; pd+=ipad;
    TPad *pad = (TPad*) cBot->GetListOfPrimitives()->FindObject(pd.Data());
    pad->cd();
    Double_t low = his->GetMean()-w*his->GetRMS();
    Double_t up = his->GetMean()+w*his->GetRMS();    
    his->Fit("gaus","Q0","",low,up); his2->Draw("colz");
    module->Draw("same");
    TF1 *fit = his->GetFunction("gaus");
    hisname = "h_xy_module_L"; hisname  += i;
    TString hisname2 = hisname;
    hisname += "b_halfmodule_axial_hole_sensor0";
    hisname2 += "b_halfmodule_axial_slot_sensor0";
    TH2D *hisOther = (TH2D*) f->Get(hisname2.Data());
    Double_t norma2 = hisOther->GetMaximum();
    TString layer = "L"; layer+=i; layer+= "BAHo"; 
    TH2D *his2 = (TH2D*) f->Get(hisname.Data());
    TH1D *his = (TH1D*)his2->ProjectionY();     
    Double_t norma1 = his2->GetMaximum();
    Double_t normamax2 = TMath::Max(norma1,norma2);
    his2->SetMaximum(normamax2);
    ipad++; ipad++;
    pd = "bp"; pd+=ipad;
    pad = (TPad*) cBot->GetListOfPrimitives()->FindObject(pd.Data());
    pad->cd();
    low = his->GetMean()-w*his->GetRMS();
    up = his->GetMean()+w*his->GetRMS();    
    his->Fit("gaus","Q0","",low,up); his2->Draw("colz");
    module->Draw("same");
    fit = his->GetFunction("gaus");
    hisname = "h_xy_module_L"; hisname  += i;
    hisname += "b_halfmodule_stereo_slot_sensor0";
    layer = "L"; layer+=i; layer+= "BSSl"; 
    his2 = (TH2D*) f->Get(hisname.Data());
    his2->SetMaximum(normamax1);
    his = (TH1D*)his2->ProjectionY();     
    ipad--;
    pd = "bp"; pd+=ipad;
    pad = (TPad*) cBot->GetListOfPrimitives()->FindObject(pd.Data());
    pad->cd();
    low = his->GetMean()-w*his->GetRMS();
    up = his->GetMean()+w*his->GetRMS();    
    his->Fit("gaus","Q0","",low,up); his2->Draw("colz");
    module->Draw("same");
    fit = his->GetFunction("gaus");
    hisname = "h_xy_module_L"; hisname  += i;
    hisname += "b_halfmodule_axial_slot_sensor0";
    layer = "L"; layer+=i; layer+= "BASl"; 
    his2 = (TH2D*) f->Get(hisname.Data());
    his2->SetMaximum(normamax2);
    his = (TH1D*)his2->ProjectionY();     
    ipad++; ipad++;
    pd = "bp"; pd+=ipad;
    pad = (TPad*) cBot->GetListOfPrimitives()->FindObject(pd.Data());
    pad->cd();
    low = his->GetMean()-w*his->GetRMS();
    up = his->GetMean()+w*his->GetRMS();    
    his->Fit("gaus","Q0","",low,up); his2->Draw("colz");
    module->Draw("same");
    fit = his->GetFunction("gaus");
  }

  //  outf.close();
  cTop->SaveAs(topName.Data());
  cBot->SaveAs(botName.Data());

}
Example #14
0
void HiggsPlot::PlotgSLTauNu(double b, double tBmH_max){
  styles style; style.setPadsStyle(-2); 
  style.PadBottomMargin = 2*b/(1+b);
  style.setDefaultStyle();
  int nBins = 1000;
  double PadLimit[2][2] = {{(1-b)/2.,1}, {0, (1+b)/2.}};
  double maxRD[] = {45, 45}, minRD[] = {0., 0.}, TopMargin[] = {0.01, 0};
  TString hName, epsName = "public_html/Higgs_TauNu_gSL.eps", label, padName;
  TString TagDecay[] = {"BF(B#rightarrow#tau#nu) (10^{-5})", "BF(B#rightarrow#tau#nu) (10^{-5})"};
  TBox box; box.SetLineColor(4);box.SetFillColor(4);
  TLine line; line.SetLineStyle(1); line.SetLineColor(4); line.SetLineWidth(3);
  TCanvas can("can","RD Vs Higgs");
  TPad *Pads[2];
  TH1F *hBF[4][2];
  for(int his=0; his<1; his++) {
    for(int isDs=0; isDs<4; isDs++){
      hName = "hBF"; hName += his; hName += isDs;
      hBF[isDs][his] = new TH1F(hName,"",nBins,0,tBmH_max);
    }
  }
  Vub[1] = 0.0003;
  double tBmH, BF[2], gSL;
  for(int isDs=0; isDs<2; isDs++){
    can.cd(0);
    if(isDs==0) Vub[0] = 0.00313; else Vub[0] = 0.00431;
    padName = "Pad"; padName += isDs;
    Pads[isDs] = new TPad(padName,"",0,PadLimit[isDs][0], 1, PadLimit[isDs][1]); 
    Pads[isDs]->SetTopMargin(TopMargin[isDs]);
    Pads[isDs]->Draw(); Pads[isDs]->cd();
    for(int bin=1; bin<=nBins; bin++){
      gSL = hBF[isDs][0]->GetBinCenter(bin);
      tBmH = sqrt(gSL/4.2);
      Compute(tBmH,BF,0);
      hBF[isDs][0]->SetBinContent(bin, BF[0]);
      hBF[isDs][0]->SetBinError(bin, BF[1]);
    }
    hBF[isDs][0]->SetFillColor(2); hBF[isDs][0]->SetLineColor(2);
    hName += isDs;
    hBF[isDs][1] = static_cast<TH1F*>(hBF[isDs][0]->Clone(hName));
    for(int bin=1; bin<=nBins; bin++)hBF[isDs][1]->SetBinError(bin,0);
    hBF[isDs][1]->SetFillColor(0);hBF[isDs][1]->SetLineColor(1); hBF[isDs][1]->SetLineWidth(2);

    hBF[isDs][0]->SetMinimum(minRD[isDs]);
    hBF[isDs][0]->SetMaximum(maxRD[isDs]);
    hBF[isDs][0]->Draw("e3");

    box.SetFillStyle(3002); 
    box.DrawBox(0,Measurement[0][0]-Measurement[0][1],
		tBmH_max,Measurement[0][0]+Measurement[0][1]);
    line.DrawLine(0,Measurement[0][0],tBmH_max,Measurement[0][0]);
    hBF[isDs][0]->Draw("e3 same");
    hBF[isDs][1]->Draw("c same");
      _isgS = -1;
      for(int bin=1; bin<=nBins; bin++){
	gSL = hBF[isDs+2][0]->GetBinCenter(bin);
	tBmH = sqrt(gSL/4.2);
	Compute(tBmH,BF,0);
	hBF[isDs+2][0]->SetBinContent(bin, BF[0]);
	hBF[isDs+2][0]->SetBinError(bin, BF[1]);
      }
      hBF[isDs+2][0]->SetFillColor(8); hBF[isDs][0]->SetLineColor(8);
      hName += isDs+2;
      hBF[isDs+2][1] = static_cast<TH1F*>(hBF[isDs+2][0]->Clone(hName));
      for(int bin=1; bin<=nBins; bin++)hBF[isDs+2][1]->SetBinError(bin,0);
      hBF[isDs+2][1]->SetFillColor(0);hBF[isDs+2][1]->SetLineColor(1); hBF[isDs+2][1]->SetLineWidth(2);

      hBF[isDs][0]->SetMinimum(minRD[isDs]);
      hBF[isDs][0]->SetMaximum(maxRD[isDs]);
      hBF[isDs+2][0]->Draw("e3 same");
      hBF[isDs+2][0]->Draw("e3 same");
      hBF[isDs+2][1]->Draw("c same");
      _isgS = 1;

    style.setTitles(hBF[isDs][0],"-g (GeV^{-1})",TagDecay[isDs]);
  }
  can.SaveAs(epsName);
  for(int isDs=0; isDs<4; isDs++){
    //Pads[isDs]->Delete();
    for(int his=0; his<2; his++) hBF[isDs][his]->Delete();
  }
}
void Draw_CMS_Y2S_RaaVspT(TLegend *lgd)
{

  //================= CMS Y2S Raa Vs Pt ===================================//
  const int nbinsPt=3;

  Double_t PtCMS[nbinsPt]={2.5,8.5,16.0};
  Double_t ErrPtCMS[nbinsPt]={0};
  
  Double_t RaaPtCMS[nbinsPt] = {0.0821,0.0656,0.141}; 
  Double_t RaaPtStatErrCMS[nbinsPt] = {0.0471,0.0457,0.0585};
  Double_t RaaPtSystErrCMS[nbinsPt] = {0.0182,0.0115,0.025};
  
  TGraphErrors *grRaaPtCMS = new TGraphErrors(nbinsPt, PtCMS, RaaPtCMS, ErrPtCMS, RaaPtStatErrCMS);  
  grRaaPtCMS->SetMarkerStyle(20);
  grRaaPtCMS->SetMarkerColor(4);
  grRaaPtCMS->GetYaxis()->SetRangeUser(-0.2,3.0);
  grRaaPtCMS->GetXaxis()->SetTitle("p_{T}(GeV/c)");
  grRaaPtCMS->GetYaxis()->SetTitle("R_{AA}");
   
  TAxis *Xaxis2 = grRaaPtCMS->GetXaxis();
  Xaxis2->SetLimits(0.,20.0);
  

  grRaaPtCMS->Draw("AP");
  
  TLine *lh4 = new TLine(0.0,1.0,20.0,1.0);
  lh4->SetLineColor(1);
  lh4->SetLineStyle(1);
  lh4->SetLineWidth(2);
  lh4->Draw("same");


  TLatex *tb= new TLatex;
  tb->SetNDC(); 
  tb->SetTextAlign(12);
  tb->SetTextColor(1);
  tb->SetTextSize(0.040);
  //tb->DrawLatex(0.55,0.22,"PbPb #sqrt{s_{NN}} = 2.76 TeV");
  //tb->DrawLatex(0.55,0.16,"#varUpsilon #rightarrow #mu^{+} #mu^{-}, p_{T}^{#varUpsilon} > 0.0 GeV/c");  
  
  TBox *RaaPtCMSSys[nbinsPt];
  for(int j=0;j<nbinsPt;j++){
    RaaPtCMSSys[j] = new TBox(PtCMS[j]-0.5,  RaaPtCMS[j]-RaaPtSystErrCMS[j], PtCMS[j]+0.5,  RaaPtCMS[j]+RaaPtSystErrCMS[j]);
  }
  
  for(int j=0;j<nbinsPt;j++){
    RaaPtCMSSys[j]->SetFillStyle(0000);
    RaaPtCMSSys[j]->SetLineColor(4);
    RaaPtCMSSys[j]->Draw("same"); 
  }
    
  TBox *CMSGlobalSysPt;
  CMSGlobalSysPt = new TBox(18-0.2, 1 - 0.083, 18+0.2, 1 + 0.083);
  CMSGlobalSysPt->SetFillStyle(3001);
  CMSGlobalSysPt->SetLineColor(4);
  CMSGlobalSysPt->SetFillColor(4);
  //CMSGlobalSysPt->Draw("same"); 
    
  lgd->AddEntry(grRaaPtCMS,"CMS Data", "P");  

  }
Example #16
0
void cmsRAA()
{
  
  bool bDo2PadZoo = false;
  
  //----------------------------------------- charged hadrons
  double ptBins_h[27]={0};
  double ptError_h[27]={0};
  
  double raa_h[27];
  double raaStat_h[27];
  double raaSyst_h[27];
 
  double ptSystXlow_h[27];
  double ptSystXhigh_h[27];

  // reading numbers
  ifstream inData_h; 
  TString inFile("raa_h05.dat");
  inData_h.open(inFile);
  if(inData_h.fail()) {
    cerr << "unable to open file raa_h05.dat for reading" << endl;
    exit(1);
  }
  Int_t j=0;
  Double_t xx_low, xx_high,raa,raa_syst, raa_stat;
  while(!inData_h.eof())
    { 
      inData_h >> xx_low >> xx_high >> raa >> raa_syst >> raa_stat;
      ptBins_h[j]   = xx_low+ (xx_high-xx_low)/2;
      raa_h[j]      = raa;
      raaStat_h[j]  = raa_syst;
      raaSyst_h[j]  = raa_stat;
      
      ptSystXlow_h[j] = (xx_high-xx_low)/2;
      ptSystXhigh_h[j]= (xx_high-xx_low)/2;
      // cout<<"pT"<<ptBins_h[j]<<"\t raa= "<<raa_h[j]<<"\t syst= "<<raaStat_h[j]<<"\t stat ="<<raaSyst_h[j]<<"\t x_low= "<<ptSystXlow_h[j]<<"\t high= "<<ptSystXhigh_h[j]<<endl;
      j++;
    }     
  inData_h.close();
  // done reading numebrs
  
  TGraphErrors *pgRaa_h          = new TGraphErrors(27, ptBins_h, raa_h, ptError_h, raaStat_h);
  TGraphAsymmErrors *pgRaaSyst_h = new TGraphAsymmErrors(27, ptBins_h, raa_h, ptSystXlow_h,ptSystXhigh_h,raaSyst_h,raaSyst_h);
  pgRaa_h->SetName("pgRaa_h");
  pgRaa_h->SetMarkerStyle(24);
  pgRaa_h->SetMarkerSize(1.);
  
  //systm error
  pgRaaSyst_h->SetName("pgRaaSyst_h");
  pgRaaSyst_h->SetFillColor(TColor::GetColor("#33ccff"));

  //----------------------------------------- jet RAA
  double ptBins_jet[]   = {105,115,125,135,145,155,165,175,190,220,270}; 
  double ptError_jet[]  = {0.0, 0.0, 0.0, 0.0, 0.0,0,0,0,0,0,0};
  
  double raa_jet[]      = {0.47,   0.47,   0.46,  0.44,   0.43,  0.47,  0.52,  0.51,  0.44,  0.42,  0.58}; 
  double raaStat_jet[]  = {0.0076, 0.0098, 0.013, 0.016,  0.021, 0.028, 0.038, 0.045, 0.035, 0.039, 0.098};
  double raaSyst_jet[]  = {0.07, 0.07, 0.08, 0.09, 0.08, 0.08, 0.08, 0.08, 0.07, 0.07, 0.10 };
 
  double ptSystXlow_jet[]      = {5, 5, 5, 5, 5,5,5,5,10,20,30};
  double ptSystXhigh_jet[]     = {5, 5, 5, 5, 5,5,5,5,10,20,30};
  
  TGraphErrors *pgRaa_jet          = new TGraphErrors(11, ptBins_jet, raa_jet, ptError_jet, raaStat_jet);
  TGraphAsymmErrors *pgRaaSyst_jet = new TGraphAsymmErrors(11, ptBins_jet, raa_jet, ptSystXlow_jet,ptSystXhigh_jet,raaSyst_jet,raaSyst_jet);
  pgRaa_jet->SetName("pgRaa_jet");
  pgRaa_jet->SetMarkerStyle(20);
  pgRaa_jet->SetMarkerSize(1.);
  
  //systm error
  pgRaaSyst_jet->SetName("pgRaaSyst_jet");
  pgRaaSyst_jet->SetFillColor(TColor::GetColor("#00FFFF"));

 //----------------------------------------- b-jet RAA
  double ptBins_bjet[]   = {108.3}; 
  double ptError_bjet[]  = {0.0};
  
  double raa_bjet[]      = {0.478}; 
  double raaStat_bjet[]  = {0.188};
  double raaSyst_bjet[]  = {0.413};
 
  double ptSystXlow_bjet[]      = {8.3};
  double ptSystXhigh_bjet[]     = {11.7};
  
  TGraphErrors *pgRaa_bjet          = new TGraphErrors(1, ptBins_bjet, raa_bjet, ptError_bjet, raaStat_bjet);
  TGraphAsymmErrors *pgRaaSyst_bjet = new TGraphAsymmErrors(1, ptBins_bjet, raa_bjet, ptSystXlow_bjet,ptSystXhigh_bjet,raaSyst_bjet,raaSyst_bjet);
  pgRaa_bjet->SetName("pgRaa_bjet");
  pgRaa_bjet->SetMarkerStyle(21);
  pgRaa_bjet->SetMarkerSize(1.);
  
  //systm error
  pgRaaSyst_bjet->SetName("pgRaaSyst_bjet");
  pgRaaSyst_bjet->SetFillColor(TColor::GetColor("#FFBF00"));


  //----------------------------------------- photon
  double ptBins_photon[]   = {22.26, 27.30, 34.35, 44.45, 61.72}; 
  double ptError_photon[]  = {0.0, 0.0, 0.0, 0.0, 0.0};
  
  double raa_photon[]      = {1.03, 0.84, 1.37, 0.98, 0.99}; 
  double raaStat_photon[]  = {0.12 ,0.14, 0.22, 0.24, 0.31 };
  double raaSyst_photon[]  = {0.29, 0.27,  0.25, 0.22, 0.21};
 
  double ptSystXlow_photon[]      = {2.5, 2.5, 5, 5, 15};
  double ptSystXhigh_photon[]     = {2.5, 2.5, 5, 5, 15};
  
  TGraphErrors *pgRaa_photon          = new TGraphErrors(5, ptBins_photon, raa_photon, ptError_photon, raaStat_photon);
  TGraphAsymmErrors *pgRaaSyst_photon = new TGraphAsymmErrors(5, ptBins_photon, raa_photon, ptSystXlow_photon,ptSystXhigh_photon,raaSyst_photon,raaSyst_photon);
  pgRaa_photon->SetName("pgRaa_photon");
  pgRaa_photon->SetMarkerStyle(20);
  pgRaa_photon->SetMarkerSize(1.);
  //systm error
  pgRaaSyst_photon->SetName("pgRaaSyst_photon");
  pgRaaSyst_photon->SetFillColor(TColor::GetColor("#ffff00"));
  
  //----------------------------------------- Z 
   double ptBins_z[]   = {91.19}; 
   double ptError_z[]  = {0.0};
   
   double raa_z[]      = {0.95}; 
   double raaStat_z[]  = {0.034};
   double raaSyst_z[]  = {0.13};
   double ptSystXlow_z[]      = {2.5};
   double ptSystXhigh_z[]     = {2.5};

   TGraphErrors *pgRaa_z          = new TGraphErrors(1, ptBins_z, raa_z, ptError_z, raaStat_z);
   TGraphAsymmErrors *pgRaaSyst_z = new TGraphAsymmErrors(1, ptBins_z, raa_z, ptSystXlow_z,ptSystXhigh_z,raaSyst_z,raaSyst_z);
   pgRaa_z->SetName("pgRaa_z");   pgRaa_z->SetMarkerStyle(21);
   pgRaa_z->SetMarkerSize(1.);
  
   //systm error
   pgRaaSyst_z->SetName("pgRaaSyst_z");
   pgRaaSyst_z->SetFillColor(TColor::GetColor("#ff8888"));

 
   // ----------------------------------------- W raa
   double ptBins_w[]   = {80.38}; 
   double ptError_w[]  = {0.0};
   
   double raa_w[]      = {1.04}; 
   double raaStat_w[]  = {0.07};
   double raaSyst_w[]  = {0.12};
   double ptSystXlow_w[]      = {2.5};
   double ptSystXhigh_w[]     = {2.5};
 
   TGraphErrors *pgRaa_w          = new TGraphErrors(1, ptBins_w, raa_w, ptError_w, raaStat_w);
   TGraphAsymmErrors *pgRaaSyst_w = new TGraphAsymmErrors(1, ptBins_w, raa_w, ptSystXlow_w,ptSystXhigh_w,raaSyst_w,raaSyst_w);
   pgRaa_w->SetName("pgRaa_w");
   pgRaa_w->SetMarkerStyle(29);
   pgRaa_w->SetMarkerSize(2.);
  
   //systm error
   pgRaaSyst_w->SetName("pgRaaSyst_w");
   pgRaaSyst_w->SetFillColor(TColor::GetColor("#ff88ff"));


    // ----------------------------------------- 2012 non-prompt Jpsi
   double ptBins_npjpsi[]   = {7.31,8.97,11.32,16.52}; 
   double ptError_npjpsi[]  = {0.0,0.0,0.0,0.0};
   
   double raa_npjpsi[]      = {0.52,0.43,0.43,0.34};  
   double raaStat_npjpsi[]  = {0.12,0.08,0.09,0.07};
   double raaSyst_npjpsi[]  = {0.06,0.05,0.05,0.04};

   double ptSystXlow_npjpsi[]      = {0.81, 0.97, 1.32, 3.52};
   double ptSystXhigh_npjpsi[]     = {0.69, 1.03, 1.68, 13.48};
 
   TGraphErrors *pgRaa_npjpsi          = new TGraphErrors(4, ptBins_npjpsi, raa_npjpsi, ptError_npjpsi, raaStat_npjpsi);
   TGraphAsymmErrors *pgRaaSyst_npjpsi = new TGraphAsymmErrors(4, ptBins_npjpsi, raa_npjpsi, ptSystXlow_npjpsi,ptSystXhigh_npjpsi,raaSyst_npjpsi,raaSyst_npjpsi);
   pgRaa_npjpsi->SetName("pgRaa_npjpsi");
   pgRaa_npjpsi->SetMarkerStyle(25);
   pgRaa_npjpsi->SetMarkerSize(1.);
   pgRaa_npjpsi->SetMarkerColor(1);
  
   //systm error
   pgRaaSyst_npjpsi->SetName("pgRaaSyst_npjpsi");
   pgRaaSyst_npjpsi->SetFillColor(TColor::GetColor("#ee7711"));
  
  
   //---------------------------------------------------------
   // lumi uncert.
   TBox *box = new TBox(0.9,0.9568966,2,1.043103);
   box->SetFillColor(kGray+1);
   box->SetFillStyle(1001);
   

   TBox *box_lin = new TBox(0.9,0.9568966,10,1.043103);
   box_lin->SetFillColor(kGray+1);
   box_lin->SetFillStyle(1001);
  
   //------------------------ single pannel:
  
  TCanvas *pc = new TCanvas("pc","pc");
  TH1 *phAxis = new TH1D("phAxis",";p_{T} [GeV];R_{AA}",1,0.9,300);
  phAxis->GetYaxis()->CenterTitle(true);
  phAxis->SetMinimum(0.);
  phAxis->SetMaximum(2.5);
  gPad->SetLogx();
  phAxis->Draw("");
  
// drawing order:
// A)  stat boxes:
   pgRaaSyst_photon->Draw("2");
   pgRaaSyst_npjpsi->Draw("2");
   pgRaaSyst_h->Draw("2");
   pgRaaSyst_z->Draw("2");
   pgRaaSyst_w->Draw("2");
   pgRaaSyst_jet->Draw("2");
   pgRaaSyst_bjet->Draw("2");
   //nominal+stat
   // photon
   pgRaa_photon->Draw("P z");
   pgRaa_z->Draw("P z");
   pgRaa_w->Draw("P z");
   pgRaa_h->Draw("P z");
   pgRaa_npjpsi->Draw("P z");
   pgRaa_jet->Draw("P z");
   pgRaa_bjet->Draw("P z");

   TLine *line = new TLine(0.9,1,300,1);
   line->SetLineStyle(7);
   line->Draw();
   box->Draw();
// // legends and writings:

   TLegend *leg = new TLegend(0.07,0.87,0.46,0.95,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextFont(62);
   leg->SetTextSize(0.028);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(19);
   leg->SetFillStyle(0);
  //  TLegendEntry *entry=leg->AddEntry("hEtSIEIECorrected","CMS PRELIMINARY","");
//    entry->SetLineWidth(1);
//    entry=leg->AddEntry("hEtSIEIECorrected","PbPb #sqrt{s_{NN}} = 2.76 TeV","");
//    entry=leg->AddEntry("hEtSIEIECorrected","","");
//    entry=leg->AddEntry("hEtSIEIECorrected","#int L dt = 7-150 #mub^{-1}","");

   TLegendEntry *entry=leg->AddEntry("hEtSIEIECorrected","CMS PRELIMINARY  PbPb #sqrt{s_{NN}} = 2.76 TeV  #int L dt = 7-150 #mub^{-1}","");
   entry->SetLineWidth(1);
  
  

   // TAA
  // TAA only
   TLegend *leg_taa = new TLegend(0.15,0.5,0.5,0.55,NULL,"brNDC");
   leg_taa->SetBorderSize(0);
   leg_taa->SetTextFont(62);
   leg_taa->SetTextSize(0.025);
   leg_taa->SetLineColor(1);
   leg_taa->SetLineStyle(1);
   leg_taa->SetLineWidth(1);
   leg_taa->SetFillColor(19);
   leg_taa->SetFillStyle(0);
   TLegendEntry *entry_taa= leg_taa->AddEntry("general","T_{AA} uncertainty","f");
   entry_taa->SetFillColor(kGray+1);
   entry_taa->SetFillStyle(1001);
   entry_taa->SetLineColor(0);
   entry_taa->SetLineWidth(1);
   entry_taa->SetMarkerStyle(21);
   entry_taa->SetMarkerSize(1);

   // EWQ legend
   TLegend *leg_ewq = new TLegend(0.35,0.75,0.8,0.85,NULL,"brNDC");
   leg_ewq->SetBorderSize(0);
   leg_ewq->SetTextFont(62);
   leg_ewq->SetTextSize(0.025);
   leg_ewq->SetLineColor(1);
   leg_ewq->SetLineStyle(1);
   leg_ewq->SetLineWidth(1);
   leg_ewq->SetFillColor(19);
   leg_ewq->SetFillStyle(0);
   TLegendEntry *entry_ewq=leg_ewq->AddEntry("raaz","Z  (0-100%) p_{T}^{#mu} > 20 GeV/c^{^{ }}    |y|<2","lpf");
   entry_ewq->SetFillColor(TColor::GetColor("#ff8888"));
   entry_ewq->SetFillStyle(1001);
   entry_ewq->SetLineColor(1);
   entry_ewq->SetLineWidth(1);
   entry_ewq->SetMarkerStyle(21);
   entry_ewq->SetMarkerSize(1.);
  
   entry_ewq=leg_ewq->AddEntry("raaw","W  (0-100%)  p_{T}^{#mu} > 25 GeV/c^{^{ }} |#eta^{#mu}|<2.1","lpf");
   entry_ewq->SetFillColor(TColor::GetColor("#ff88ff"));
   entry_ewq->SetFillStyle(1001);
   entry_ewq->SetLineColor(1);
   entry_ewq->SetLineWidth(1);
   entry_ewq->SetMarkerStyle(29);
   entry_ewq->SetMarkerSize(1.5);
  
   entry_ewq=leg_ewq->AddEntry("raaphoton","Isolated photon  (0-10%)      |#eta|<1.44","lpf");
   entry_ewq->SetFillColor(TColor::GetColor("#ffff00"));
   entry_ewq->SetFillStyle(1001);
   entry_ewq->SetLineColor(1);
   entry_ewq->SetLineWidth(1);
   entry_ewq->SetMarkerStyle(20);
   entry_ewq->SetMarkerSize(1);
   

   // b and h
   TLegend *leg_q = new TLegend(0.15,0.65,0.47,0.74,NULL,"brNDC");
   leg_q->SetBorderSize(0);
   leg_q->SetTextFont(62);
   leg_q->SetTextSize(0.025);
   leg_q->SetLineColor(1);
   leg_q->SetLineStyle(1);
   leg_q->SetLineWidth(1);
   leg_q->SetFillColor(19);
   leg_q->SetFillStyle(0);


   TLegendEntry *entry_q=leg_q->AddEntry("raah","Charged particles^{^{ }} (0-5%)   |#eta|<1","lpf");
   entry_q->SetFillColor(TColor::GetColor("#33ccff"));
   entry_q->SetFillStyle(1001);
   entry_q->SetLineColor(1);
   entry_q->SetLineStyle(1);
   entry_q->SetLineWidth(1);
   entry_q->SetMarkerStyle(24);
   entry_q->SetMarkerSize(1);

   entry_q=leg_q->AddEntry("raab","b-quarks (0-100%)^{ }             |#eta|<2.4","lpf");
   entry_q->SetFillColor(TColor::GetColor("#ee7711"));
   entry_q->SetFillStyle(1001);
   entry_q->SetLineColor(1);
   entry_q->SetLineStyle(1);
   entry_q->SetLineWidth(1);
   entry_q->SetMarkerStyle(25);
   entry_q->SetMarkerSize(1);
   entry_q=leg_q->AddEntry("raabjpsi", "(via secondary J/#psi) ","");
   
     // jet legend
   TLegend *leg_jet = new TLegend(0.57,0.69,0.95,0.74,NULL,"brNDC");
   leg_jet->SetBorderSize(0);
   leg_jet->SetTextFont(62);
   leg_jet->SetTextSize(0.025);
   leg_jet->SetLineColor(1);
   leg_jet->SetLineStyle(1);
   leg_jet->SetLineWidth(1);
   leg_jet->SetFillColor(19);
   leg_jet->SetFillStyle(0);

   TLegendEntry *entry_jet=leg_jet->AddEntry("raaq","q/g-jet^{^{ }} (0-5%)     |#eta|<2","lpf");
   entry_jet->SetFillColor(TColor::GetColor("#00FFFF"));
   entry_jet->SetFillStyle(1001);
   entry_jet->SetLineColor(1);
   entry_jet->SetLineStyle(1);
   entry_jet->SetLineWidth(1);
   entry_jet->SetMarkerStyle(20);
   entry_jet->SetMarkerSize(1);

   entry_jet=leg_jet->AddEntry("raaheavy","b-jet (0-100%)^{ }     |#eta|<2","lpf");
   entry_jet->SetFillColor(TColor::GetColor("#FFBF00"));
   entry_jet->SetFillStyle(1001);
   entry_jet->SetLineColor(1);
   entry_jet->SetLineStyle(1);
   entry_jet->SetLineWidth(1);
   entry_jet->SetMarkerStyle(21);
   entry_jet->SetMarkerSize(1);
  
   leg->Draw();
   leg_taa->Draw();
   leg_ewq->Draw();
   leg_q->Draw();
   leg_jet->Draw();
   gPad->RedrawAxis();
   
   // save the work
   pc->SaveAs("raaZoo_cms_log.pdf");
   pc->SaveAs("raaZoo_cms_log.png");




   //--------------------------------------------------------------------------------
   //-------------------------- 2TPad
   TH1 *phAxis_single = new TH1D("phAxis_single",";p_{T} [GeV/c];R_{AA}",1,0.9,100);
   phAxis_single->GetYaxis()->CenterTitle(true);
   phAxis_single->SetMinimum(0.);
   phAxis_single->SetMaximum(2.);
   TH1 *phAxis_jet = new TH1D("phAxis_jet",";p_{T} [GeV/c];",1,101,300);
   phAxis_jet->GetYaxis()->CenterTitle(true);
   phAxis_jet->SetMinimum(0.);
   phAxis_jet->SetMaximum(2.);

   // redefine legends:
   // TAA only
   TLegend *leg2_taa = new TLegend(0.15,0.85,0.5,0.9,NULL,"brNDC");
   leg2_taa->SetBorderSize(0);
   leg2_taa->SetTextFont(62);
   leg2_taa->SetTextSize(0.025);
   leg2_taa->SetLineColor(1);
   leg2_taa->SetLineStyle(1);
   leg2_taa->SetLineWidth(1);
   leg2_taa->SetFillColor(19);
   leg2_taa->SetFillStyle(0);
   TLegendEntry *entry2_taa= leg2_taa->AddEntry("general","T_{AA} uncertainty","f");
   entry2_taa->SetFillColor(kGray+1);
   entry2_taa->SetFillStyle(1001);
   entry2_taa->SetLineColor(0);
   entry2_taa->SetLineWidth(1);
   entry2_taa->SetMarkerStyle(21);
   entry2_taa->SetMarkerSize(1);

   TLegend *leg2 = new TLegend(0.03,0.7,0.46,0.93,NULL,"brNDC");
   leg2->SetBorderSize(0);
   leg2->SetTextFont(62);
   leg2->SetTextSize(0.04);
   leg2->SetLineColor(1);
   leg2->SetLineStyle(1);
   leg2->SetLineWidth(1);
   leg2->SetFillColor(19);
   leg2->SetFillStyle(0);
   TLegendEntry *entry2=leg2->AddEntry("general","CMS PRELIMINARY","");
   entry2->SetLineWidth(1);
   entry2=leg2->AddEntry("general","PbPb #sqrt{s_{NN}} = 2.76 TeV","");
   entry2=leg2->AddEntry("general","","");
   entry2=leg2->AddEntry("general","#int L dt = 7-150 #mub^{-1}","");
  
      // jet leg2end
   TLegend *leg2_jet = new TLegend(0.45,0.55,0.9,0.65,NULL,"brNDC");
   leg2_jet->SetBorderSize(0);
   leg2_jet->SetTextFont(62);
   leg2_jet->SetTextSize(0.03);
   leg2_jet->SetLineColor(1);
   leg2_jet->SetLineStyle(1);
   leg2_jet->SetLineWidth(1);
   leg2_jet->SetFillColor(19);
   leg2_jet->SetFillStyle(0);

   TLegendEntry *entry2_jet=leg2_jet->AddEntry("raaq","q/g-jet^{^{ }} (0-5%)     |#eta|<2","lpf");
   entry2_jet->SetFillColor(TColor::GetColor("#00FFFF"));
   entry2_jet->SetFillStyle(1001);
   entry2_jet->SetLineColor(1);
   entry2_jet->SetLineStyle(1);
   entry2_jet->SetLineWidth(1);
   entry2_jet->SetMarkerStyle(20);
   entry2_jet->SetMarkerSize(1);

   entry2_jet=leg2_jet->AddEntry("raaheavy","b-jet (0-100%)^{ }     |#eta|<2","lpf");
   entry2_jet->SetFillColor(TColor::GetColor("#FFBF00"));
   entry2_jet->SetFillStyle(1001);
   entry2_jet->SetLineColor(1);
   entry2_jet->SetLineStyle(1);
   entry2_jet->SetLineWidth(1);
   entry2_jet->SetMarkerStyle(21);
   entry2_jet->SetMarkerSize(1);


   // EWQ legend
   TLegend *leg2_ewq = new TLegend(0.47,0.8,0.9,0.95,NULL,"brNDC");
   leg2_ewq->SetBorderSize(0);
   leg2_ewq->SetTextFont(62);
   leg2_ewq->SetTextSize(0.027);
   leg2_ewq->SetLineColor(1);
   leg2_ewq->SetLineStyle(1);
   leg2_ewq->SetLineWidth(1);
   leg2_ewq->SetFillColor(19);
   leg2_ewq->SetFillStyle(0);
   TLegendEntry *entry2_ewq=leg2_ewq->AddEntry("raaz","Z  (0-100%) p_{T}^{#mu} > 20 GeV/c^{^{ }}    |y|<2","lpf");
   entry2_ewq->SetFillColor(TColor::GetColor("#ff8888"));
   entry2_ewq->SetFillStyle(1001);
   entry2_ewq->SetLineColor(1);
   entry2_ewq->SetLineWidth(1);
   entry2_ewq->SetMarkerStyle(21);
   entry2_ewq->SetMarkerSize(1.);
  
   entry2_ewq=leg2_ewq->AddEntry("raaw","W  (0-100%)  p_{T}^{#mu} > 25 GeV/c^{^{ }}  |#eta^{#mu}|<2.1","lpf");
   entry2_ewq->SetFillColor(TColor::GetColor("#ff88ff"));
   entry2_ewq->SetFillStyle(1001);
   entry2_ewq->SetLineColor(1);
   entry2_ewq->SetLineWidth(1);
   entry2_ewq->SetMarkerStyle(29);
   entry2_ewq->SetMarkerSize(1.5);
  
   entry2_ewq=leg2_ewq->AddEntry("raaphoton","Isolated photon  (0-10%)      |#eta|<1.44","lpf");
   entry2_ewq->SetFillColor(TColor::GetColor("#ffff00"));
   entry2_ewq->SetFillStyle(1001);
   entry2_ewq->SetLineColor(1);
   entry2_ewq->SetLineWidth(1);
   entry2_ewq->SetMarkerStyle(20);
   entry2_ewq->SetMarkerSize(1);
 
   // B and h
   TLegend *leg2_q = new TLegend(0.47,0.15,0.89,0.3,NULL,"brNDC");
   leg2_q->SetBorderSize(0);
   leg2_q->SetTextFont(62);
   leg2_q->SetTextSize(0.027);
   leg2_q->SetLineColor(1);
   leg2_q->SetLineStyle(1);
   leg2_q->SetLineWidth(1);
   leg2_q->SetFillColor(19);
   leg2_q->SetFillStyle(0);

   TLegendEntry *entry2_q=leg2_q->AddEntry("raah","Charged particles^{^{ }} (0-5%)     |#eta|<1","lpf");
   entry2_q->SetFillColor(TColor::GetColor("#33ccff"));
   entry2_q->SetFillStyle(1001);
   entry2_q->SetLineColor(1);
   entry2_q->SetLineStyle(1);
   entry2_q->SetLineWidth(1);
   entry2_q->SetMarkerStyle(24);
   entry2_q->SetMarkerSize(1);

   entry2_q=leg2_q->AddEntry("raab","b-quarks (0-100%)^{ }                |y|<2.4","lpf");
   entry2_q->SetFillColor(TColor::GetColor("#ee7711"));
   entry2_q->SetFillStyle(1001);
   entry2_q->SetLineColor(1);
   entry2_q->SetLineStyle(1);
   entry2_q->SetLineWidth(1);
   entry2_q->SetMarkerStyle(25);
   entry2_q->SetMarkerSize(1);
   entry2_q=leg2_q->AddEntry("raabjpsi", "(via secondary J/#psi) ","");

   if(bDo2PadZoo)
     {
       TCanvas *pc2 = new TCanvas("pc2","pc2",1200,600);
       TPad *p_0 = new TPad("p_0","p_0",0,0,0.50,1);
       p_0->Draw();
       p_0->cd();
       p_0->SetRightMargin(0);
       
       phAxis_single->Draw("");
       box_lin->Draw();
       
       pgRaaSyst_photon->Draw("2");
       pgRaaSyst_npjpsi->Draw("2");
       pgRaaSyst_h->Draw("2");
       pgRaaSyst_z->Draw("2");
       pgRaaSyst_w->Draw("2");
       
       pgRaa_photon->Draw("P z");
       pgRaa_z->Draw("P z");
       pgRaa_w->Draw("P z");
       pgRaa_h->Draw("P z");
       pgRaa_npjpsi->Draw("P z");
       
       TLine *line_single = new TLine(0.9,1,100,1);
       line_single->SetLineStyle(7);
       line_single->Draw();
       
       // legends 
       leg2_taa->Draw();
       leg2_q->Draw();
       leg2_ewq->Draw();
       
       pc2->cd();
       
       // jet pad
       TPad *p_1 = new TPad("p_1","p_1",0.50,0,1,1);
       p_1->Draw();
       p_1->cd();
       p_1->SetLeftMargin(0.);
       p_1->SetTickx(1);
       p_1->SetTicky(1);
       
       phAxis_jet->Draw("");
       
       pgRaaSyst_bjet->Draw("2");
       pgRaaSyst_jet->Draw("2");
       
       pgRaa_bjet->Draw("P z");
       pgRaa_jet->Draw("P z");
       
       
       TLine *line_jet = new TLine(100,1,300,1);
       line_jet->SetLineStyle(7);
       line_jet->Draw();
       
       leg2->Draw();
       leg2_jet->Draw();
       
       
       p_0->cd();
       gPad->RedrawAxis();
       
       pc2->SaveAs("raaZoo_cms_2pads.pdf");
       pc2->SaveAs("raaZoo_cms_2pads.png");

     }
}
Example #17
0
void gluinoMass(double lumi=-1., double maxInstLumi=-1.) {
	
  if (lumi<0)
    lumi=877.;
  if (maxInstLumi<0)
    maxInstLumi=1300.;
  LimitPlots plots(lumi);
  
  plots.calculateCrossSections(7,4,39,9);
	
  // expected limit (1 and 2 sigma bands)
  TGraph* g_exp = plots.getExpMassLimitGluino();
  TGraphAsymmErrors* g_exp1 = plots.getExpMassLimitGluino1Sig();
  TGraphAsymmErrors* g_exp2 = plots.getExpMassLimitGluino2Sig();
  
  // three points on counting expt curve
  TGraph* g_gluino = plots.getMassLimitGluino();
  TGraph* g_stop = plots.getMassLimitStop();
  
  // one point from lifetime fit
  TGraph* g_tp = plots.getMassLimitGluinoTP();
  
  // theory prediction
  TGraph* g_thGluino = plots.getGluinoTheory();
  TGraph* g_thStop = plots.getStopTheory();
  
  TCanvas* canvas = new TCanvas("canvas");
  
  //canvas->SetGrid();
  canvas->SetLogy();
  
  TH1 * h;
  h = canvas->DrawFrame(300., .02, 1000., 1e2);
  //h->SetTitle("Beamgap Expt;m_{#tilde{g}} [GeV/c^{2}]; Stopped HSCP Cross Section #times BR [pb]");
  h->SetTitle("Beamgap Expt;m_{#tilde{g}} [GeV/c^{2}]; #sigma(pp #rightarrow #tilde{g}#tilde{g}) #times BR(#tilde{g} #rightarrow g#tilde{#chi}^{0}) [pb]");
  
  // not covered region
  TBox* nc = new TBox(100., .1, 150., 5e2);
  nc->SetFillStyle(3354);
  nc->SetFillColor(kRed-4);
  //nc->Draw();
  
  // details
  TPaveText* blurb = new TPaveText(300., 2, 550., 1e2);
  blurb->AddText("CMS Preliminary 2012");

  std::stringstream label;
  label<<"#int L dt = "<<lumi<<" fb^{-1}";
  blurb->AddText(label.str().c_str());
  label.str("");
  double peakInstLumi=maxInstLumi;
  int exponent=30;
  while (peakInstLumi>10) {
    peakInstLumi/=10.;
    ++exponent;
  }
  label<<"L^{max}_{inst} = "<<peakInstLumi<<" x 10^{"<<exponent<<"} cm^{-2}s^{-1}";
  blurb->AddText(label.str().c_str());
  label.str("");
  label << "#sqrt{s} = " << ENERGY << " TeV";
  blurb->AddText(label.str().c_str());
  blurb->AddText("m_{#tilde{g}} - m_{#tilde{#chi}^{0}} = 100 GeV/c^{2}");
  //blurb->AddText("m_{#tilde{t}} - m_{#tilde{#chi}^{0}} = 200 GeV/c^{2}");	
  blurb->SetTextFont(42);
  blurb->SetBorderSize(0);
  blurb->SetFillColor(0);
  blurb->SetShadowColor(0);
  blurb->SetTextAlign(12);
  blurb->SetTextSize(0.032);

  
  // legend
  TBox *legbg = new TBox(600., 2., 900., 1e2);
  legbg->Draw();
  TLegend *leg = new TLegend(600., 2., 900., 1e2,"95% C.L. Limits","");
  leg->SetTextSize(0.028);
  leg->SetBorderSize(0);
  leg->SetTextFont(42);
  leg->SetFillColor(0);
  leg->AddEntry(g_exp, "Expected: 10 #mus - 1000 s Counting Exp. ", "l");
  leg->AddEntry(g_exp1, "Expected #pm1#sigma: 10 #mus - 1000 s Counting Exp. ", "f");
  leg->AddEntry(g_exp2, "Expected #pm2#sigma: 10 #mus - 1000 s Counting Exp. ", "f");
  //	  leg->AddEntry(graph3, "Obs.: 10^{6} s Counting Exp.", "l");
  leg->AddEntry(g_gluino, "Obs.: 10 #mus - 1000 s Counting Exp. ", "l");
  leg->AddEntry(g_tp, "Obs.: 10 #mus Timing Profile ", "l");
  //leg->AddEntry(g_stop, "Obs.: 10 #mus - 1000 s Counting Exp. (#tilde{t})", "l");
  //leg->AddEntry(graph_em, "Obs.: 10 #mus - 1000 s Counting Exp. (EM only)", "l");
  //  leg->AddEntry(graph1, "Obs.: 570 ns Counting Exp.", "l");
  leg->Draw();
  
  
  
  // 2 sigma expected band
  g_exp2->SetLineColor(0);
  g_exp2->SetLineStyle(0);
  g_exp2->SetLineWidth(0);
  g_exp2->SetFillColor(5);
  g_exp2->SetFillStyle(1001);
  g_exp2->Draw("3");
  
  // 1 sigma expected band
  g_exp1->SetLineColor(0);
  g_exp1->SetLineStyle(0);
  g_exp1->SetLineWidth(0);
  g_exp1->SetFillColor(3);
  g_exp1->SetFillStyle(1001);
  g_exp1->Draw("3");  
  
  // expected line
  g_exp->SetLineStyle(2);
  g_exp->SetLineWidth(1);
  g_exp->Draw("l");
  
 
  // plateau limit - 1 ms
  g_gluino->SetLineColor(1);
  g_gluino->SetLineStyle(1);
  g_gluino->SetLineWidth(2);
  g_gluino->Draw("l");
  
  // stop curve
  g_stop->SetLineColor(1);
  g_stop->SetLineStyle(5);
  g_stop->SetLineWidth(2);
  //g_stop->Draw("l");
 

  // 1 mus lifetime fit limit
  g_tp->SetLineColor(kRed);
  g_tp->SetLineStyle(1);
  g_tp->SetLineWidth(2);
  g_tp->Draw("l");
  
  // theory line
  g_thGluino->SetLineColor(kBlue);
  g_thGluino->SetLineStyle(1);
  g_thGluino->SetLineWidth(2);
  g_thGluino->SetFillStyle(3001);
  g_thGluino->SetFillColor(kBlue-4);
  g_thGluino->Draw("l3");
  
  g_thStop->SetLineColor(kRed);
  g_thStop->SetLineStyle(1);
  g_thStop->SetLineWidth(2);
  g_thStop->SetFillStyle(3001);
  g_thStop->SetFillColor(kRed-4);
  //g_thStop->Draw("l3");


  // theory line label
  TLatex* th = new TLatex(600., .3, "NLO+NLL #tilde{g}");
  th->SetTextColor(kBlue);
  th->SetTextFont(42);
  th->SetTextSize(0.035);
  th->Draw();

  TLatex* ths = new TLatex(330., 2., "NLO+NLL #tilde{t}");
  ths->SetTextColor(kRed);
  ths->SetTextFont(42);
  ths->SetTextSize(0.035);
  //ths->Draw();

  // not explored label
  TText* ne = new TText(125., .2, "Not Sensitive");
  ne->SetTextColor(kRed+1);
  ne->SetTextFont(42);
  ne->SetTextAngle(90);
  ne->SetTextSize(0.035);
  //ne->Draw();

  blurb->Draw();

  canvas->RedrawAxis();

  canvas->Print("gluinoMassLimit.pdf");
  canvas->Print("gluinoMassLimit.C");

  plots.calculateIntercepts();
  
}
Example #18
0
void CSVPlot()
{
    TFile *f_data = new TFile("../../../plots/Analysis/2015-11-21/histograms_data.root");
    TFile *f_correct = new TFile("../../../plots/Analysis/2015-11-21/correct_histograms_TTJets.root");
    TFile *f_incorrect = new TFile("../../../plots/Analysis/2015-11-21/incorrect_histograms_TTJets.root");
    TFile *f_qcd = new TFile("../../../plots/Analysis/2015-11-21/histograms_qcd_combined.root");

    TH1D *h_data, *h_correct, *h_incorrect, *h_qcd;
    TString name = "h_csv";
    f_data->GetObject(name, h_data);
    f_correct->GetObject(name, h_correct);
    f_incorrect->GetObject(name, h_incorrect);
    f_qcd->GetObject(name, h_qcd);

    double factor = h_data->Integral(1, 10000)/h_correct->Integral(1, 10000);
    h_correct->Scale(factor);

    h_data->SetLineColor(1);
    h_data->SetMarkerStyle(20);
    h_data->SetMarkerSize(0.5);
    h_data->GetXaxis()->SetRangeUser(0.0, 1.05);
    h_data->SetTitle();
    h_data->SetMaximum(7.0e6);
    h_data->GetXaxis()->SetTitleSize(0.045);
    h_data->GetYaxis()->SetTitleSize(0.045);

    h_correct->SetLineColor(3);
    h_incorrect->SetLineColor(2);
    //h_qcd->SetLineColor(4);

    TLine *cut = new TLine(0.95, 0.0, 0.95, 7.0e6);
    cut->SetLineColor(6);
    cut->SetLineStyle(2);
    cut->SetLineWidth(3);
    TBox *hash = new TBox(0.92, 0.0, 0.95, 7.0e6);
    hash->SetFillColor(6);
    hash->SetFillStyle(3004);

    gStyle->SetOptStat(0);

    TCanvas *c1 = new TCanvas("c1", "c1", 800, 600);
    c1->cd();
    c1->SetLogy();
    c1->SetTickx();
    c1->SetTicky();

    h_data->Draw();
    h_correct->Draw("hist same");
    //h_incorrect->Draw("hist same");
    //h_qcd->Draw("hist same");
    hash->Draw();
    cut->Draw();

    TLegend *leg = new TLegend(0.4, 0.25, 0.75, 0.4);
    leg->SetLineColor(0);
    leg->SetFillColor(0);
    leg->AddEntry(h_data, "data", "lp");
    leg->AddEntry(h_correct, "t#bar{t}, normalized to data area", "l");
    leg->Draw();

    h_data->Draw("sameaxis");

    CMS_lumi(c1, 4, 1);

    return;
}
Example #19
0
void plotAnaMult4(char *infname="ana.root")
{    
   TFile *inf = new TFile(infname);
   
   TTree *tData = (TTree*) inf->Get("Data_tree");
   TTree *tMC   = (TTree*) inf->Get("MC_tree");
   TTree *tPP   = (TTree*) inf->Get("PP_tree");

   TCanvas *c1 = new TCanvas("c","",1200,700);
//   c->Divide(4,1);
   TCut recoCut = "leadingJetPt>120&&subleadingJetPt>50&&dphi>5*3.14159265358979/6.&&abs(leadingJetEta)<1.6&&abs(subleadingJetEta)<1.6";
   TCut genCut = "genleadingJetPt>120&&gensubleadingJetPt>50&&genDphi>5*3.14159265358979/6.&&abs(genleadingJetEta)<1.6&&abs(gensubleadingJetEta)<1.6";

   
   const int nPtBin=5;
   Float_t PtBins[nPtBin+1] = {0.001,0.5,1,1.5,2,3.2};
   
   Int_t centBin[5] = {200,100,60,20,0};
   makeMultiPanelCanvas(c1,4,2,0.0,0.0,0.2,0.2,0.02);
   
   for (int i=0;i<4;i++) {
      c1->cd(i+1);
      TH1D * empty=new TH1D("empty","",100,0,3.19);
//      empty->Fill(0.5,1000); 
      empty->SetMaximum(39.99); 
      empty->SetMinimum(0.001); 
      empty->SetNdivisions(105,"X");
      empty->GetXaxis()->SetTitleSize(28);
      empty->GetXaxis()->SetTitleFont(43); 
      empty->GetXaxis()->SetTitleOffset(1.8);
      empty->GetXaxis()->SetLabelSize(22);
      empty->GetXaxis()->SetLabelFont(43);
      empty->GetYaxis()->SetTitleSize(28);
      empty->GetYaxis()->SetTitleFont(43); 
      empty->GetYaxis()->SetTitleOffset(1.8);
      empty->GetYaxis()->SetLabelSize(22);
      empty->GetYaxis()->SetLabelFont(43);
      empty->GetXaxis()->CenterTitle();
      empty->GetYaxis()->CenterTitle();

      empty->SetXTitle("#Delta#eta_{1,2}");
      empty->SetYTitle("Multiplicity Difference");
   
      TProfile *pData = new TProfile(Form("pData%d",i),"",nPtBin,PtBins);
      TProfile *pMC = new TProfile(Form("pMC%d",i),"",nPtBin,PtBins);
      TProfile *pPP = new TProfile(Form("pPP%d",i),"",nPtBin,PtBins);
      TProfile *pGen = new TProfile(Form("pGen%d",i),"",nPtBin,PtBins);
      TCut centCut = Form("hiBin>=%d&&hiBin<%d",centBin[i+1],centBin[i]);
      tData->Draw(Form("-multDiff:abs(leadingJetEta-subleadingJetEta)>>pData%d",i),recoCut&&centCut);
      tPP->Draw(Form("-multDiff:abs(leadingJetEta-subleadingJetEta)>>pPP%d",i),recoCut);
      tMC->Draw(Form("-multDiff:abs(leadingJetEta-subleadingJetEta)>>pMC%d",i),recoCut&&centCut);  
      tMC->Draw(Form("-genMultDiff:abs(genleadingJetEta-gensubleadingJetEta)>>pGen%d",i),genCut&&centCut);  

      pMC->SetLineColor(2);
      pMC->SetMarkerColor(2);
      pPP->SetLineColor(4);
      pPP->SetMarkerColor(4);
      
//      pData->SetAxisRange(0,50,"Y");
//      pData->SetAxisRange(0,0.49,"X");
      empty->Draw();

      double diff=0;
      if (i==0) diff=0.1;
      drawText(Form("%d-%d %%",(int)(0.5*centBin[i+1]),(int)(0.5*centBin[i])),0.22+diff,0.65);
      if (i==0) drawText("PbPb #sqrt{s_{NN}}=2.76 TeV 150/#mub",0.22+diff,0.85);
      if (i==0) drawText("pp      #sqrt{s_{NN}}=2.76 TeV 5.3/pb",0.22+diff,0.75);
      if (i==3) drawText("CMS Preliminary",0.3+diff,0.85);
            
      Float_t sys[4]={1,1,2.5,3};
      

      for (int j=1;j<=pData->GetNbinsX();j++)
      {
         TBox *b = new TBox(pData->GetBinLowEdge(j),pData->GetBinContent(j)-sys[i],pData->GetBinLowEdge(j+1),pData->GetBinContent(j)+sys[i]);
	 //b->SetFillColor(kGray);
	 b->SetFillStyle(0);
	 b->SetLineColor(1);
	 b->Draw();
         TBox *b2 = new TBox(pPP->GetBinLowEdge(j),pPP->GetBinContent(j)-1,pPP->GetBinLowEdge(j+1),pPP->GetBinContent(j)+1);
	 //b2->SetFillColor(65);
	 b2->SetFillStyle(0);
	 b2->SetLineColor(4);
	 b2->Draw();
      }
      pData->Draw("same");
      pMC->Draw("same");
      pPP->Draw("same");
      pGen->SetMarkerColor(4);
      pGen->SetMarkerStyle(24);
      pData->Draw("same");
      
//      pGen->Draw(" same");

      c1->cd(5+i);
      TH1D *empty2 = (TH1D*)empty->Clone("empty2");
      empty2->SetYTitle("PbPb - pp");
      empty2->SetMinimum(-5);
      empty2->SetMaximum(+29.99);
      empty2->Draw();
//      TProfile *pDiff = (TProfile*)pData->Clone("pDiff");
      TH1D *pDiff = new TH1D("pDiff","",nPtBin,PtBins);
      
      for (int j=1;j<=pData->GetNbinsX();j++)
      {
	 pDiff->SetBinContent(j,pData->GetBinContent(j)-pPP->GetBinContent(j));
  	 pDiff->SetBinError(j,sqrt(pData->GetBinError(j)*pData->GetBinError(j)+pPP->GetBinError(j)*pPP->GetBinError(j)));
         TBox *b = new TBox(pDiff->GetBinLowEdge(j),pDiff->GetBinContent(j)-sys[i],pDiff->GetBinLowEdge(j+1),pDiff->GetBinContent(j)+sys[i]);
         TBox *b2 = new TBox(pDiff->GetBinLowEdge(j),pDiff->GetBinContent(j)-sys[i],pDiff->GetBinLowEdge(j+1),pDiff->GetBinContent(j)+sys[i]);
         b->SetFillColor(TColor::GetColor("#FFEE00"));
	 b2->SetLineColor(1);
	 b2->SetFillStyle(0);
	 b->Draw();
	 b2->Draw();
      }
      
      pDiff->Draw("p same");


      TLegend *leg = new TLegend(0.3,0.6,0.9,0.9);
      leg->SetFillStyle(0);
      leg->SetBorderSize(0);
      leg->AddEntry(pData,"PbPb","pl");
      leg->AddEntry(pPP,"pp","pl");
      leg->AddEntry(pMC,"PYTHIA+HYDJET","pl");
      if (i==0) leg->Draw();

      if (i==1) drawText("p_{T,1} > 120 GeV/c",0.22+diff,0.85);
      if (i==1) drawText("p_{T,2} >  50 GeV/c",0.22+diff,0.75);
      if (i==1) drawText("#Delta#phi_{1,2} > 5#pi/6",0.22+diff,0.65);

   }
/*
   TCanvas *c1 = new TCanvas("c1","",(ncent+1)*300,700);
   makeMultiPanelCanvas(c1,ncent+1,2,0.0,0.0,0.2,0.2,0.02);
   TH1D * empty=new TH1D("empty",Form(";%s;<#slash{p}_{T}^{#parallel}> (GeV)",axistitle[index_var].Data()),nalpha/2+1,frac);
   TH1D * empty2=new TH1D("empty2",Form(";%s;<#slash{p}_{T}^{#parallel}> (GeV)",axistitle[index_var].Data()),nalpha/2+1,frac);
   empty->Fill(0.5,1000); 
   empty2->Fill(0.5,1000);   
   if(doIntegrate){
      if(index_var==0){
         empty->SetMaximum(30); 
         empty->SetMinimum(-70); 
      }else{
         empty->SetMaximum(35); 
         empty->SetMinimum(-45); 
      }
   }else{
      empty->SetMaximum(15); 
      empty->SetMinimum(-10); 
      empty2->SetMaximum(15); 
      empty2->SetMinimum(-10); 
   }
   empty->GetXaxis()->SetTitleSize(28);
   empty->GetXaxis()->SetTitleFont(43); 
   empty->GetXaxis()->SetTitleOffset(2.2);
   empty->GetXaxis()->SetLabelSize(22);
   empty->GetXaxis()->SetLabelFont(43);
   empty->GetYaxis()->SetTitleSize(28);
   empty->GetYaxis()->SetTitleFont(43); 
   empty->GetYaxis()->SetTitleOffset(2.2);
   empty->GetYaxis()->SetLabelSize(22);
   empty->GetYaxis()->SetLabelFont(43);
   empty2->GetXaxis()->SetTitleSize(28);
   empty2->GetXaxis()->SetTitleFont(43); 
   empty2->GetXaxis()->SetTitleOffset(2.2);
   empty2->GetXaxis()->SetLabelSize(22);
   empty2->GetXaxis()->SetLabelFont(43);
   empty2->GetYaxis()->SetTitleSize(28);
   empty2->GetYaxis()->SetTitleFont(43); 
   empty2->GetYaxis()->SetTitleOffset(2.2);
   empty2->GetYaxis()->SetLabelSize(22);
   empty2->GetYaxis()->SetLabelFont(43);
   
   
   c1->cd(ncent+2); 
*/

   c1->SaveAs("results/MultiplicityDifference-DeltaEta.C");
   c1->SaveAs("results/MultiplicityDifference-DeltaEta.gif");
   c1->SaveAs("results/MultiplicityDifference-DeltaEta.eps");
   c1->SaveAs("results/MultiplicityDifference-DeltaEta.pdf");


}
Example #20
0
void createDataVsMC(TString folderName,TString histoName,int rebin,double xMin,double xMax,TString xName, TString yName, vector<TString> MCFileNames, vector<TString> MCNames, vector<int> MCColors, vector<bool> AddToBkg,vector<TString> DataFileNames,vector<TString> dataNames,vector<int> dataColors,vector<TString> SystNames,vector<int> SystColors, TCanvas *cCanvas, int padNr, bool UseLog,GlobalParameterSet Parameters) {
					 
  // CREATE ALL HISTOGRAMS ========================================================

  TString lumi = "";
  lumi+=Parameters.intLumi;
  if(Parameters.GlobalLog) {
    UseLog = true;  
  }
       
  // SM background histo
  TH1D *hSM0=0; 
  // Create MC histos and add them SM0
  vector<TH1D*> MChistos;
  bool noneAdded = true;

  float eventsMC=0;
  if(Parameters.MuPred){
    for(unsigned int i =0;i<3;i++) {
      TFile* fhh = TFile::Open(MCFileNames[i],"READONLY");
      TH1D *hTemp = (TH1D*)fhh->Get(folderName+"/CounterCtrl_tot");
      eventsMC += hTemp->GetBinContent(1);
      cout << "eventsMC " <<eventsMC<< endl;
      //delete hTemp;
      // delete fhh;
    }
    
    TFile* fdata_test = TFile::Open(DataFileNames[0],"READONLY");
    TH1D *hTempddd = (TH1D*)fdata_test->Get(folderName+"/CounterCtrl_tot");
    cout << "eventsMC " << eventsMC<< " "<<hTempddd->GetBinContent(1) << endl;
    Parameters.intLumi =  100*hTempddd->GetBinContent(1)/eventsMC;
  }
  
  // delete fdata_test;
  // delete hTempddd;

  for(unsigned int i =0;i<MCFileNames.size();i++) {
    MChistos.push_back(plot1Dhisto(Parameters.intLumi,TFile::Open(MCFileNames[i],"READONLY"),folderName,histoName,MCColors[i],rebin,xMin,xMax,xName,yName,"MC",true));
    if(noneAdded&&AddToBkg[i]) {
      hSM0 = (TH1D *) MChistos[i]->Clone();
      noneAdded = false;
    }
    else {
      if(AddToBkg[i]) {
	hSM0->Add(MChistos[i],1);
      }	  
    }
  }
  hSM0->SetLineColor(2);
   
  // Create Histograms with the different systematics
  vector<TH1D*> SystHistos;
  if(Parameters.UseSystematics) {
    for(unsigned int i=0; i<SystNames.size(); i++) {
      noneAdded = true;
      for(unsigned int j=0; j<MCFileNames.size(); j++) {
	if(AddToBkg[j]) {
	  TString SystFileName = MCFileNames[j];
	  SystFileName.Insert(SystFileName.Last('/'),"_"+SystNames[i]);
	  TFile *SystMCFile = TFile::Open(SystFileName,"READONLY");
	  TH1D *SystHistoTemp = plot1Dhisto(Parameters.intLumi,SystMCFile,folderName,histoName,SystColors[i],rebin,xMin,xMax,xName,yName,"MC",true);
	  SystHistoTemp->SetLineStyle(2);
	  if(noneAdded) {
	    SystHistos.push_back((TH1D *) SystHistoTemp->Clone());
	    noneAdded = false;
	  }
	  else {
	    SystHistos.back()->Add(SystHistoTemp,1);
	  }
	}
      }
    }
  }

  // Create Histograms for error band
  TH1D* hSM0allErrors = (TH1D *) hSM0->Clone();
  TH1D* hSM0systErrors = (TH1D *) hSM0->Clone();
  if(Parameters.UseSystematics) {
    for(int j = hSM0->FindBin(xMin); j<=hSM0->FindBin(xMax); j++) {
      double downerror=0;
      double uperror=0;
      for(unsigned int i=0; i<SystHistos.size(); i++) {
	double diff = SystHistos[i]->GetBinContent(j) - hSM0->GetBinContent(j);
	if(diff>0)
	  uperror += diff*diff;
	else
	  downerror += diff*diff;
      }
      downerror = TMath::Sqrt(downerror);
      uperror = TMath::Sqrt(uperror);
      double maxerror = TMath::Max(downerror,uperror);
      double staterror = hSM0->GetBinError(j);
      hSM0systErrors->SetBinError(j,maxerror);
      hSM0allErrors->SetBinError(j,TMath::Sqrt(maxerror*maxerror+staterror*staterror));
      hSM0systErrors->SetFillColor(5);
      hSM0systErrors->SetLineColor(5);
      hSM0allErrors->SetLineColor(3);
      hSM0allErrors->SetFillColor(3);
    }
  }
  
  // Create Data Histograms
  vector<TH1D *> dataHistos; 
  for(unsigned int i=0; i<DataFileNames.size();i++) {
    dataHistos.push_back(plot1Dhisto(Parameters.intLumi,TFile::Open(DataFileNames[i],"READONLY"),folderName,histoName,dataColors[i],rebin,xMin,xMax,xName,yName,"Data",false));
    dataHistos[i]->SetMarkerSize(1.2); 
    dataHistos[i]->SetMarkerColor(dataColors[i]); 
    dataHistos[i]->SetMarkerStyle(20);
    // remove error manually  
    if(!Parameters.ShowStatErrorbars){
      NoError(dataHistos[i],xMin,xMax);
    }
    // y-axis range
    if (UseLog){ 
      dataHistos[i]->GetYaxis()->SetRangeUser(1.,3.5*(dataHistos[i]->GetBinContent(dataHistos[i]->GetMaximumBin()))); 
    }
    else{ 
      float maximum =  hSM0->GetMaximum();
      if(maximum<dataHistos[i]->GetMaximum())maximum=dataHistos[i]->GetMaximum();
      dataHistos[i]->GetYaxis()->SetRangeUser(0.,maximum*1.8);
    }

  }
  
  cCanvas->SetName(folderName+histoName);
  cCanvas->cd(2*padNr+1);  

  if(UseLog) {
    gPad->SetLogy(); 
  }
  dataHistos[0]->Draw("P E0");

  //DRAW ALL HISTOGRAMS =====================================================    
  
  if(Parameters.ShowMCComposition){
    for(unsigned int i=1; Parameters.StackMCComposition&&i<MChistos.size();i++) {
      MChistos[i]->Add(MChistos[i],MChistos[i-1]);
      MChistos[i]->SetFillColor(MCColors[i]);
      MChistos[i]->SetLineStyle(1);
      MChistos[i]->SetFillStyle(3004);
      MChistos[i-1]->SetFillStyle(3004);
      MChistos[i-1]->SetFillColor(MCColors[i-1]); 	  	  
      
    }  	
    for(int i=MChistos.size()-1;i>=0;i--) {
      if(Parameters.ShowMCStatErrorbars)
	MChistos[i]->Draw("HIST E0 same");
      else
	MChistos[i]->Draw("HIST same");
    }
  }
  
  hSM0->SetLineColor(kRed);

  if(Parameters.ShowErrorBand) {
    hSM0allErrors->Draw("E2 same");
    hSM0systErrors->Draw("E2 same");
  }

  if(!Parameters.ShowMCStatErrorbars&&!Parameters.StackMCComposition)
    hSM0->Draw("HIST same"); 
  	
  if(Parameters.ShowSystematicsDetails) {
    for(unsigned int i=0; i<SystHistos.size();i++) {
      SystHistos[i]->Draw("HIST same");
    }
  } 
  
  for(int i=dataHistos.size()-1;i>=0;i--) {
    dataHistos[i]->Draw("P E0 same");
  }
  if(Parameters.ShowMCStatErrorbars&&!Parameters.StackMCComposition) {
    hSM0->Draw("HIST same E0");
  }
  // Draw Legend
  TLegend *lSamples = legendRAW(0.77,0.58,0.95,0.89);
  if(!Parameters.StackMCComposition)
    lSamples->AddEntry(hSM0,"Total MC","FL");
  if(Parameters.ShowErrorBand) {
    lSamples->AddEntry(hSM0systErrors,"Systematic Error","FL");
    lSamples->AddEntry(hSM0allErrors,"MC Syst. #oplus Stat. Error","FL");
  }
  for(unsigned int i=0; i<dataHistos.size(); i++) { 
    lSamples->AddEntry(dataHistos[i],dataNames[i],"PL");
  }
  for(unsigned int i =0;i<MChistos.size()&&Parameters.ShowMCComposition;i++) {
    lSamples->AddEntry(MChistos[i],MCNames[i],"FL");
  }
  for(unsigned int i =0;i<SystHistos.size()&&Parameters.ShowSystematicsDetails;i++) {
    lSamples->AddEntry(SystHistos[i],SystNames[i],"FL");
  }
  
  lSamples->Draw("same");

  TLatex *lWhichLepton;
  if (Parameters.electrons) { lWhichLepton = new TLatex(0.73,0.9,"Electrons"); }
  else { lWhichLepton = new TLatex(0.73,0.9,"Muons"); }
  lWhichLepton->SetNDC();
  lWhichLepton->Draw("same");
  

  TLatex *lPreliminary = new TLatex(0.19,0.96,"CMS Preliminary 2011");

  //  TLatex *lIntLumi = new TLatex(0.15,0.89,"#scale[0.8]{#int L dt = "+lumi+" pb^{-1}, #sqrt{s} = 7 TeV}");
  TLatex *lIntLumi  = new TLatex(0.22,0.88,"#scale[1.]{4.7 fb^{-1}, #sqrt{s} = 7 TeV}");
  TLatex *lIntLumiB = new TLatex(0.22,0.79,"#scale[1.]{#sqrt{s} = 7 TeV}");
  lPreliminary->SetNDC();
  lIntLumi->SetNDC();
  lIntLumiB->SetNDC();
  lPreliminary->Draw("same");
  lIntLumi->Draw("same"); 
  gPad->SetFillColor(0);
  //  lIntLumiB->Draw("same"); 
  //  gPad->SetGridx(); 
  //  gPad->SetGridy();
  

  // --- create HT and STlep legends
  //"ANplots150_NOLPsecondD500" folderNames
  
  TString HT500 = "secondD500";
  TString HT750 = "secondD750";
  TString HT1000 = "secondD1000";
  
  TString ST150 = "plots150";
  TString ST250 = "plots250";
  TString ST350 = "plots350";
  TString ST450 = "plots450";

  TString tmpLegendHT, tmpLegendST;

  if (((folderName.SubString(HT500)).Length())>0)       { if (Parameters.htBins) { tmpLegendHT = "H_{T}#in[500,750]"; }  else { tmpLegendHT = "H_{T}>500";}  } 
  else if (((folderName.SubString(HT750)).Length())>0)  { if (Parameters.htBins) { tmpLegendHT = "H_{T}#in[750,1000]"; } else { tmpLegendHT = "H_{T}>750";}  } 
  else if (((folderName.SubString(HT1000)).Length())>0) { if (Parameters.htBins) { tmpLegendHT = "H_{T}>1000"; }         else { tmpLegendHT = "H_{T}>1000";} } 
  else { tmpLegendHT = "error"; }

  if (((folderName.SubString(ST150)).Length())>0)      { tmpLegendST = "S^{lep}_{T}#in[150,250]"; }
  else if (((folderName.SubString(ST250)).Length())>0) { tmpLegendST = "S^{lep}_{T}#in[250,350]"; }
  else if (((folderName.SubString(ST350)).Length())>0) { tmpLegendST = "S^{lep}_{T}#in[350,450]"; }
  else if (((folderName.SubString(ST450)).Length())>0) { tmpLegendST = "S^{lep}_{T}>450"; }
  else { tmpLegendST = "error"; }

  TString legendHTandST = tmpLegendHT+" , "+tmpLegendST; 
  TLatex *lHTandST = new TLatex(0.22,0.8,legendHTandST);
  lHTandST->SetNDC();
  //  lHTandST->Draw("same");
  
  TLatex *lHT = new TLatex(0.22,0.8,tmpLegendHT);
  lHT->SetNDC();
  lHT->Draw("same");

  TLatex *lST = new TLatex(0.22,0.7,tmpLegendST);
  lST->SetNDC();
  lST->Draw("same");



  // DRAW RATIO PLOTS ============================================================================
  if (Parameters.ratioplot)
    {
      vector<TH1D*> hRatio;
      for(unsigned int i=0; i<dataHistos.size()&&MChistos.size()>0; i++) {
	hRatio.push_back((TH1D*)dataHistos[i]->Clone(""));
	hRatio.back()->Divide(dataHistos[i],hSM0);
	hRatio.back()->GetYaxis()->SetTitle("Data / MC");
	hRatio.back()->GetYaxis()->SetTitleSize(0.16);
	hRatio.back()->GetXaxis()->SetTitle("");
	hRatio.back()->GetYaxis()->SetNdivisions(409);
	hRatio.back()->GetYaxis()->SetRangeUser(0.,2.);
	hRatio.back()->SetTitleSize(0.16, "XY");
	hRatio.back()->SetTitleOffset(0.5, "Y");
	hRatio.back()->SetLabelSize(0.165,"XY");
	
      }
      
      for(unsigned int i=0; Parameters.UseSystematics&&Parameters.ShowSystematicsDetails&&i<SystHistos.size(); i++) {
	hRatio.push_back((TH1D*)SystHistos[i]->Clone(""));
	hRatio.back()->Divide(SystHistos[i],hSM0);
	hRatio.back()->GetYaxis()->SetTitle("Data&Syst/MC");
	hRatio.back()->GetYaxis()->SetRangeUser(0.5,1.5);
	hRatio.back()->GetXaxis()->SetTitle("");
	hRatio.back()->SetTitleSize(0.06, "XY");
	hRatio.back()->SetTitleOffset(0.8, "Y");
	hRatio.back()->SetLabelSize(0.08,"XY");
	NoError(hRatio.back(),xMin,xMax);
      }
      
      cCanvas->cd(2*padNr+2);
      //  TBox *unity = new TBox(xMin-0.1,0.95,xMax+0.15, 1.05); // LP
      TBox *unity = new TBox(xMin-0.1,0.95,xMax+0.15, 1.05);
      
      unity->SetLineWidth(2);
      //unity.SetLineStyle(Root.kDashed);
      unity->SetLineColor(2);
      unity->SetFillColor(2);
      unity->SetFillStyle(3002);
      //  unity->Draw();
      //  gPad->SetGridx(); 
      //  gPad->SetGridy();
      for(unsigned int i=hRatio.size()-1; i<hRatio.size(); i--) {
	if(i==hRatio.size()-1) {
	  hRatio[i]->Draw();
	  //      unity->Draw("same");
	  hRatio[i]->Draw("same");
	}
	else
	  {
	    hRatio[i]->GetYaxis()->SetTitleSize(0.055);
	    hRatio[i]->Draw("same"); 
	  }
      }
    } // ratio stuff close

}
Example #21
0
void plot_ljpsi(const char* fdata, const char* fmc) {
   TFile *tfd = TFile::Open(fdata);
   TFile *tfm = TFile::Open(fmc);

   TCanvas *c1 = new TCanvas();
   c1->cd();
   TPad *p1 = new TPad("p1","",0,0,1,0.33);
   p1->SetBottomMargin(2.*gStyle->GetPadBottomMargin());
   p1->SetTopMargin(0);
   p1->SetFrameBorderMode(0);
   p1->SetBorderMode(0);
   p1->SetBorderSize(0);
   p1->SetGridy();
   if (datamc) p1->Draw();
   TPad *p2 = new TPad("p2","",0,0.33,1,1);
   // p2->SetTopMargin(gStyle->GetPadTopMargin()/(1.-0.2));
   p2->SetBottomMargin(0);
   p2->SetFrameBorderMode(0);
   p2->SetBorderMode(0);
   p2->SetBorderSize(0);
   // p2->SetLogy();
   if (datamc) p2->Draw();
   p1->cd();
   if (!datamc) c1->cd();

   TF1 *dg = new TF1("f1","[0]*([1]*TMath::Gaus(x,[2],[3])+(1-[1])*TMath::Gaus(x,[4],[3]*[5]))",-0.2,0.04);
   dg->SetParLimits(0,0,1e15);
   dg->SetParLimits(1,0.5,1);
   dg->SetParLimits(2,-0.05,0.05);
   dg->SetParLimits(3,0,0.1);
   dg->SetParLimits(4,-0.05,0.05);
   dg->SetParLimits(5,0,100);
   dg->SetParameters(1000,0.8,1e-3,0.03,1e-4,2.);

   TIter next(tfd->GetListOfKeys()); TObject *obj;
   while ((obj = next())) {
      obj = ((TKey*) obj)->ReadObj();
      if (TString(obj->ClassName()) == "TH1F") {
         TH1F *hdata = (TH1F*) tfd->Get(obj->GetName());
         TH1F *hmc = (TH1F*) tfm->Get(obj->GetName());
         // hdata->Rebin(6);
         // hmc->Rebin(6);

         if (!integrate) {
            double int_data = hdata->Integral(hdata->FindBin(-0.015), hdata->FindBin(0.015));
            double int_mc = hmc->Integral(hmc->FindBin(-0.015), hmc->FindBin(0.015));
            hmc->Scale(int_data/int_mc);
         } else {
            double int_mc_all = hmc->Integral(0, hmc->GetNbinsX()+1);
            double int_data_all = hdata->Integral(0, hdata->GetNbinsX()+1);
            hmc->Scale(1./int_mc_all);
            hdata->Scale(1./int_data_all);
            double int_data = hdata->Integral(0, hdata->FindBin(0.));
            double int_mc = hmc->Integral(0, hmc->FindBin(0.));
            hdata->Scale(int_mc/int_data); 
            integrateHist(hdata);
            integrateHist(hmc);
         }
         hdata->GetXaxis()->SetTitle("#font[12]{l}_{J/#psi} [mm]");
         hdata->GetYaxis()->SetTitle("Entries");
         if (integrate) hdata->GetYaxis()->SetTitle("c.d.f.");

         // read the bin from the name
         TString thname(hdata->GetName());
         bool isfwd = (thname.Index("fwd") != kNPOS);
         int pos1 = thname.Index("pt")+2;
         int pos2 = thname.Index("-")-pos1;
         TString tsubstr(thname(pos1,pos2));
         float ptmin = atof(tsubstr.Data());
         pos1 = thname.Index("-")+1;
         pos2 = thname.Length();
         tsubstr = TString(thname(pos1,pos2));
         float ptmax = atof(tsubstr.Data());

         if (datamc) p2->cd();
         hdata->Draw();
         hmc->SetLineColor(kRed);
         hmc->SetMarkerColor(kRed);
         hmc->Draw("same");
         gPad->Update();

         // display the position of the ctau cut
         double a=1,b=1;
         if (!isfwd){a=ctaucut_a_mid_pp; b=ctaucut_b_mid_pp;} 
         else {a=ctaucut_a_fwd_pp; b=ctaucut_b_fwd_pp;}
         double cutmin = a + b / ptmin;
         double cutmax = a + b / ptmax;
         double xmin, xmax, ymin, ymax;
         TBox *tb = new TBox(cutmin,gPad->GetUymin(),cutmax,gPad->GetUymax());
         tb->SetFillColor(kBlack);
         tb->SetFillStyle(3003);
         tb->Draw();

         if (integrate) {
            TLine *tl = new TLine(hdata->GetXaxis()->GetXmin(),0.9,hdata->GetXaxis()->GetXmax(),0.9);
            tl->SetLineStyle(3);
            tl->SetLineColor(kBlack);
            tl->SetLineWidth(5);
            tl->Draw();
         }

         if (datamc) {
            p1->cd();
            TH1F *hratio = (TH1F*) hdata->Clone("hratio");
            hratio->Divide(hmc);
            hratio->GetYaxis()->SetTitle("data/MC");
            hratio->GetYaxis()->SetRangeUser(0.5,1.5);
            hratio->GetXaxis()->SetLabelSize(2.*hratio->GetXaxis()->GetLabelSize());
            hratio->GetXaxis()->SetTitleSize(2.*hratio->GetXaxis()->GetTitleSize());
            hratio->GetYaxis()->SetLabelSize(2.*hratio->GetYaxis()->GetLabelSize());
            hratio->GetYaxis()->SetTitleSize(2.*hratio->GetYaxis()->GetTitleSize());
            hratio->Draw();

            p2->cd();
         }

         // dg->SetParameters(1000,0.8,1e-3,0.03,1e-4,2.);
         // dg->SetParameter(0,int_data);
         // dg->SetParLimits(0,0,int_data*100.);
         // hdata->Fit(dg, "LERQ");
         // double sigma_data = dg->GetParameter(3);
         // double dsigma_data = dg->GetParError(3);
         // dg->SetRange(-5.*sigma_data,1.5*sigma_data);
         // hdata->Fit(dg, "LERQ");
         // sigma_data = dg->GetParameter(3);
         // dsigma_data = dg->GetParError(3);
         // dg->SetRange(-5.*sigma_data,1.5*sigma_data);
         // hdata->Fit(dg, "LERQ");
         // sigma_data = dg->GetParameter(3);
         // dsigma_data = dg->GetParError(3);
         // hmc->Fit(dg, "LERQ");
         // double sigma_mc = dg->GetParameter(3);
         // double dsigma_mc = dg->GetParError(3);

         double lx1=0.61, lx2=0.9, ly1=0.6, ly2=0.88;
         if (integrate) {ly1-=0.4; ly2-=0.4;}
         TLegend *tleg = new TLegend(lx1,ly1,lx2,ly2);
         tleg->SetBorderSize(0);
         TString header("#splitline{");
         header += isfwd ? "1.6<|y|<2.4" : "|y|<1.6";
         header += Form("}{%.1f<pt<%.1f GeV/c}",ptmin,ptmax);
         tleg->SetHeader(header);
         // tleg->AddEntry(hdata,Form("pp data (#sigma = %.3f +/- %.3f)",sigma_data,dsigma_data),"lp");
         // tleg->AddEntry(hmc,Form("pp prompt J/#psi mc (#sigma = %.3f +/- %.3f)",sigma_mc,dsigma_mc),"lp");
         tleg->AddEntry(hdata,"data","lp");
         tleg->AddEntry(hmc,"prompt J/#psi mc","lp");
         tleg->Draw();
         c1->SaveAs(Form("%s.pdf",hdata->GetName()));
         c1->SaveAs(Form("%s.png",hdata->GetName()));
      }
   }
}
Example #22
0
void Plot(TString var,TCut cut,TString bins,Double_t xmax,TString cutpoint){
  setstyle(); 
 TH1::SetDefaultSumw2(true);
TCanvas *c2 = new TCanvas("canvas"+var+cutpoint,"canname"+var+cutpoint,800,800);
  TPad *mainPad = new TPad("","",0.01,0.25,0.99,0.99);
   mainPad->SetNumber(1);
   mainPad->Draw();
    TPad *ratioPad = new TPad("","",0.01,0.01,0.99,0.25);
   ratioPad->SetNumber(2);
   ratioPad->Draw();
c2->cd(1);
//   if (cutpoint == "noHT"){ TCut cut = numpj; TCut cutData = numpjData;}
//  else if (cutpoint == "HT200"){ TCut cut = HT200; TCut cutData = HT200Data; }//
//  else if (cutpoint == "anoHT"){ TCut cut = anumpj; TCut cutData = anumpjData;}
//  else if (cutpoint == "aHT200"){ TCut cut = aHT200; TCut cutData = aHT200Data; }
// else if (cutpoint == "HT300"){ TCut cut = HT300;  TCut cutData = HT300Data;}
// else if (cutpoint == "HT350"){ TCut cut = HT350; TCut cutData = HT350Data; }
//  else if (cutpoint == "aT"){ TCut cut = aT;  TCut cutData = aTData;}
//  else if (cutpoint == "early"){TCut cut = earlyaT; TCut cutData = earlyaTData;}

//else{cout << "ERRORRRR: BRaaaaaaaaaaaaaaaaaains" << endl; }
  TCut cutData = trig && hbhe && cut;
  TH1D* lm0 = GetHist("LM0",kRed,var,cut,bins,tLM0,cutpoint);
  ///  cout << "lm0" << endl;
  TH1D* lm1 = GetHist("LM1",kRed,var,cut,bins,tLM1,cutpoint);
  //  cout << "lm1" << endl;
  TH1D* qcd = GetHist("QCD_AllPtBins_7TeV_Pythia",kOrange+4,var,cut && mu_pt_hi,bins,tQCD,cutpoint);
  // cout << "qcd" << endl;
  TH1D* data = GetHist("Data",1,var,cutData,bins,tData,cutpoint);
  // cout << "data" << endl;
  TH1D* W = GetHist("Wjets_vols",kBlue,var,cut,bins,tW,cutpoint);
  //cout << "W" << endl;
  TH1D* tt = GetHist("ttbarTauola",kGreen,var,cut,bins,tTT,cutpoint);
  // cout << "tt" << endl;
  TH1D* Z = GetHist("ZJets_madgraph",kYellow,var,cut,bins,tZ,cutpoint);
  // cout << "Z" << endl;


  //TH1D* qcd_lo = GetHist("QCD_AllPtBins_7TeV_Pythia",kOrange+4,var,cut && mu_pt_lo,bins,tQCD,cutpoint);
 

  //   qcd_lo->Scale(1.94);
  // qcd->Add(qcd_lo);
 // TH1D* SM = GetHist("SM",kGray+2,var,cut,binstLM0,cutpoint);
 lm1->SetLineStyle(2);
 W->Scale(1.29557302);
 tt->Scale(1.65789474);
 Z->Scale(3048./2400.);

 TH1::SetDefaultSumw2(true);

 TH1D *SM   = (TH1D*)qcd->Clone();
 SM->Add(Z);
 SM->Add(tt);
 SM->Add(W);
 //SM->SetLineColor(kGray+2);
 // SM->SetFillStyle(3001);
 // SM->SetFillColor(kGray+2);
 // SM->SetMarkerSize(0.);
 //for(int bnum = 1; bnum <9; bnum++){
 //  if(data->GetBinContent(bnum)>0){
 // cout << "Bin Number " << bnum << " has qcd " << qcd->GetBinContent(bnum) << " and data " << data->GetBinContent(bnum) <<  " and SM " << SM->GetBinContent(bnum) <<  " and scale factor to QCD " << data->GetBinContent(bnum)/qcd->GetBinContent(bnum) << " and scale factor to SM " << data->GetBinContent(bnum)/SM->GetBinContent(bnum) << endl; 
 // }
 //  }
 c2->cd(1)->SetLogy();
 //  data->Draw("PE0");
 SM->Draw("E");
   THStack bkg("bkg","test stacked histograms");
   bkg.Add(Z);
   bkg.Add(tt);
   bkg.Add(W);
   bkg.Add(qcd);

   bkg.Draw("HIST0SAME");
   //  data->Draw("PE0SAME");
   
   
   //qcd->Draw("HIST0same");
   /*  
      W->Draw("HIST0same");
         Z->Draw("HIST0same");
       tt->Draw("HIST0same");
   */
    lm0->Draw("HIST0same"); lm0->SetLineColor(1); lm0->SetFillColor(0);
    lm1->Draw("HIST0same"); lm1->SetLineColor(1); lm1->SetFillColor(0); lm1->SetLineStyle(2);
	//  data->Draw("EPSAME");  
  if(xmax == 1337){
      double ymax=SM->GetMaximum()*12.6;}
  else{
    double ymax=SM->GetMaximum()*10.6;}
	SM->GetYaxis()->SetRangeUser(0.05,ymax);
	if (var=="AlphaT_Lep") { data->GetXaxis()->SetRangeUser(0.,xmax);}
	SM->GetXaxis()->SetTitle(var);
	SM->SetTitle();
  TLegend *leg = new TLegend(0.73803,0.591026,0.88137,0.880819);
  // leg->SetShadowColor(0);
  //leg->SetBorderSize(0);
  //leg->SetFillStyle(4100);
  leg->SetTextSize(0.04);
  leg->SetFillColor(0);
  leg->SetLineColor(0);
  
  // leg->AddEntry(data,"DATA","PL");
   leg->AddEntry(qcd,"QCD","FL");
  leg->AddEntry(W,"W","FL");
  leg->AddEntry(Z,"Z","FL");
  leg->AddEntry(tt,"TTbar","FL");
  leg->AddEntry(lm0,"LM0","FL");
  leg->AddEntry(lm1,"LM1","FL");
  
  //leg->AddEntry(SM,"SM BKGD","FL");
  leg->Draw("same");
  
   TLatex  *prelim = new TLatex(0.1152,0.81981,"CMS preliminary 2010");



  TLatex *lumi = new TLatex(0.1015,.9403,"#scale[0.8]{#int L dt = " +luminum+ "pb^{-1}, #sqrt{s} = 7 TeV}");
    prelim->SetNDC();
    lumi->SetNDC();
    //   prelim->Draw("same");
   lumi->Draw("same");

   TH1D *RatioBottom = (TH1D*)SM->Clone("Ratiob");
   TH1D *RatioTop = (TH1D*)data->Clone("Ratiot");
   RatioTop->GetYaxis()->SetTitle("data / sim");
 RatioTop->GetXaxis()->SetTitle();
      RatioTop->Divide(RatioBottom);

      c2->cd(2);
      gPad->SetGridx(); gPad->SetGridy();
   RatioTop->SetTitleSize(0.1, "XYZ");
    RatioTop->SetTitleOffset(0.55, "X");
    RatioTop->SetTitleOffset(0.3, "Y");
    RatioTop->SetLabelSize(0.06,"XY");
    RatioTop->GetYaxis()->SetRangeUser(-2.,4.0);
    RatioTop->Draw();
    RatioTop->GetYaxis()->SetLabelSize(0.05);
    TBox *unity = new TBox(RatioTop->GetXaxis()->GetBinLowEdge(RatioTop->GetXaxis()->GetFirst()), 0.89,RatioTop->GetXaxis()->GetBinLowEdge(RatioTop->GetXaxis()->GetLast()), 1.11);
    unity->SetLineWidth(2);
unity->SetLineColor(2);
    unity->SetFillColor(2);
    unity->SetFillStyle(3002);
    unity->Draw();

    c2->Update();
    if(cutpoint == "early"){
      c2->SaveAs(plots+erlee+"Muon_ND"+selec+var+"_"+cutpoint+".png");
    }
    else if (xmax == 90003){
      c2->SaveAs(plots+"Muon_ND"+selec+"_zooomed_"+var+"_"+cutpoint+".png");}
    else{
      c2->SaveAs(plots+"Muon_ND"+ptsec++selec+var+"_"+cutpoint+".png");}



 
       c2->Close();
}
Example #23
0
void massPlot(double lumi=-1., double maxInstLumi=-1.) {

  setTDRStyle();
  //tdrGrid(false, tdrStyle);

  writeExtraText = true;
  //extraText  = "Preliminary Simulation"; 
  //lumi_8TeV = ""; 
  int iPeriod = 2; // 1=7TeV, 2=8TeV, 3=7+8TeV, 7=7+8+13TeV 
  //int iPos=0;
  int iPos=11;
  //int iPos=22;
	
  if (lumi<0)
    lumi=LUMI;
  if (maxInstLumi<0)
    maxInstLumi=MAXINSTLUMI;
  DifferentXSLimitPlots plots(lumi);

  //mchamp index 0 is used, corresponds to 0th mass point = 100 GeV
  plots.calculateCrossSections(0,0,0,39,9);
    
  // three points on counting expt curve
  //TGraph* g_obs_gluino = plots.getMassLimitGluino();
  TGraph* g_gluino = plots.getExpMassLimitGluino();

  //TGraph* g_obs_stop = plots.getMassLimitStop();
  TGraph* g_stop = plots.getExpMassLimitStop();

  TGraph* g_obs_mchamp = plots.getMassLimitMchamp();
  TGraph* g_mchamp = plots.getExpMassLimitMchamp();

  //TGraphAsymmErrors* g_expGluino_1sig = plots.getExpMassLimitGluino1Sig();  
  //TGraphAsymmErrors* g_expGluino_2sig = plots.getExpMassLimitGluino2Sig();  

  //TGraphAsymmErrors* g_expStop_1sig = plots.getExpMassLimitStop1Sig();  
  //TGraphAsymmErrors* g_expStop_2sig = plots.getExpMassLimitStop2Sig();  

  TGraphAsymmErrors* g_exp_1sig = plots.getExpMassLimitMchamp1Sig();  
  TGraphAsymmErrors* g_exp_2sig = plots.getExpMassLimitMchamp2Sig();  

  // one point from lifetime fit
  TGraph* g_tpg = plots.getMassLimitGluinoTP();
  TGraph* g_tps = plots.getMassLimitStopTP();
  
  // theory prediction
  TGraph* g_thGluino = plots.getGluinoTheory();
  TGraph* g_thStop = plots.getStopTheory();
  TGraph* g_thMchamp = plots.getMchampTheory();
  
  TCanvas* canvas = new TCanvas("canvas","",10,10,575,500);

  Double_t x[10], yMinus[10], x2[10], y[10], yPlus[10], z[10];
  cout<<"MCHAMP LIMITS ARE: "<<endl;
  for(Int_t i=0; i<g_mchamp->GetN(); i++){
    g_mchamp->GetPoint(i, x[i], y[i]);
    yPlus[i] = g_exp_1sig->GetErrorYhigh(i);
    yMinus[i] = g_exp_1sig->GetErrorYlow(i);
    g_obs_mchamp->GetPoint(i, x2[i], z[i]);
    cout<<" mass is: "<<x[i]<<", expected limit is: "<<y[i]<<", expected +1 sigma is: "<<yPlus[i]<<", expected -1 sigma is: "<<yMinus[i]<<", observed limit is: "<<z[i]<<endl;
  }

  //canvas->SetGrid();
  canvas->SetLogy();
  
  TH1 * h;
  //h = canvas->DrawFrame(100., 1e-5, 1500., 1e6); //2DSA gluios and stops
  h = canvas->DrawFrame(100., 1e-5, 1000., 1e3); //2DSA
  //h = canvas->DrawFrame(100., 1e-5, 1000., 1e4); //1DSA
  //h->SetTitle(";m [GeV];#sigma [pb]");
  h->SetTitle(";m_{mchamp} [GeV];#sigma(pp #rightarrow mchamp mchamp) [pb]");
  //h->SetTitle(";m_{mchamp} [GeV];#sigma(pp #rightarrow mch mch) #times BF(mch #rightarrow #mu#mu)  [pb]");
  //h->SetTitle("Beamgap Expt;m_{#tilde{g}} [GeV/c^{2}]; #sigma(pp #rightarrow #tilde{g}#tilde{g}) #times BR(#tilde{g} #rightarrow g#tilde{#chi}^{0}) [pb]");
  
  // not covered region
  TBox* nc = new TBox(100., .1, 150., 5e2);
  nc->SetFillStyle(3354);
  nc->SetFillColor(kRed-4);
  //nc->Draw();
  
  /*
  // details
  //TPaveText* blurb = new TPaveText(305., 1.e1, 550., 4.5e2);
  TPaveText* blurb = new TPaveText(0.25, 0.70, 0.50, 0.92, "NDC");
  blurb->AddText("CMS Preliminary 2012");
  
  std::stringstream label;
  label<<"#int L dt = 19.7 fb^{-1}";
  blurb->AddText(label.str().c_str());
  label.str("");
  double peakInstLumi=maxInstLumi;
  int exponent=30;
  while (peakInstLumi>10) {
    peakInstLumi/=10.;
    ++exponent;
  }
  //label<<"L^{max}_{inst} = "<<peakInstLumi<<" x 10^{"<<exponent<<"} cm^{-2}s^{-1}";
  //blurb->AddText(label.str().c_str());
  //label.str("");
  label << "#sqrt{s} = " << ENERGY << " TeV";
  blurb->AddText(label.str().c_str());
  //blurb->AddText("m_{#tilde{g}} - m_{#tilde{#chi}^{0}} = 100 GeV/c^{2}");
  //blurb->AddText("m_{#tilde{t}} - m_{#tilde{#chi}^{0}} = 180 GeV/c^{2}");	
  blurb->SetTextFont(42);
  blurb->SetBorderSize(0);
  blurb->SetFillColor(0);
  blurb->SetShadowColor(0);
  blurb->SetTextAlign(12);
  blurb->SetTextSize(0.033);
  */
  
  // legend
  TBox *legbg = new TBox(600., 1.e1, 900., 4e2);
  //legbg->Draw();
  //TLegend *leg = new TLegend(600., 1.e1, 900., 4e2,"95% C.L. Limits","");
  //TLegend* leg = new TLegend(0.67, 0.70, 0.82, 0.92,"95% CL Limits:","NDC");
  /////////TLegend* leg = new TLegend(0.52, 0.70, 0.77, 0.92,"95% CL Limits:","NDC");
  TLegend* leg = new TLegend(0.45, 0.70, 0.70, 0.92,"95% CL Limits:","NDC");
  leg->SetTextSize(0.033);
  leg->SetBorderSize(0);
  leg->SetTextFont(42);
  leg->SetFillColor(0);

  leg->AddEntry(g_obs_mchamp, "Observed, 10 #mus - 1000 s", "lp");
  leg->AddEntry(g_mchamp, "Expected, 10 #mus - 1000 s", "l");
  leg->AddEntry(g_exp_1sig, "Expected #pm1#sigma, 10 #mus - 1000 s", "lf");
  leg->AddEntry(g_exp_2sig, "Expected #pm2#sigma, 10 #mus - 1000 s", "lf");
  leg->AddEntry(g_thMchamp, "LO Prediction", "l");
  /*
  leg->AddEntry(g_gluino, "Expected Gluino Limit, 10 #mus - 1000 s", "l");
  leg->AddEntry(g_thGluino, "Gluino LO Prediction", "l");
  leg->AddEntry(g_stop, "Expected Stop Limit, 10 #mus - 1000 s", "l");
  leg->AddEntry(g_thStop, "Stop LO Prediction", "l");
  */
  //leg->AddEntry(g_thGluino, "NLO+NLL #tilde{g}", "l");
  //leg->AddEntry(g_gluino, "Obs.: 10 #mus - 1000 s Counting Exp. (#tilde{g})", "l");
  //leg->AddEntry(g_tpg, "Obs.: 10 #mus Timing Profile (#tilde{g})", "l");
  //leg->AddEntry(g_thStop, "NLO+NLL #tilde{t}", "l");
  //leg->AddEntry(g_stop, "Obs.: 10 #mus - 1000 s Counting Exp. (#tilde{t})", "l");
  //leg->AddEntry(g_tps, "Obs.: 10 #mus Timing Profile (#tilde{t})", "l");
  //leg->AddEntry(graph_em, "Obs.: 10 #mus - 1000 s Counting Exp. (EM only)", "l");
  //  leg->AddEntry(graph1, "Obs.: 570 ns Counting Exp.", "l");
  leg->Draw();
  
  
  
  /*
  // gluino curves
  g_gluino->SetLineColor(kBlue);
  g_gluino->SetLineStyle(2);
  g_gluino->SetLineWidth(3);
  g_gluino->Draw("l");

  g_tpg->SetLineColor(kBlue);
  g_tpg->SetLineStyle(3);
  g_tpg->SetLineWidth(3);
  //g_tpg->Draw("l");

  // theory line
  g_thGluino->SetLineColor(kGreen);
  g_thGluino->SetLineStyle(1);
  g_thGluino->SetLineWidth(2);
  g_thGluino->SetFillStyle(3001);
  g_thGluino->SetFillColor(kGreen-4);
  g_thGluino->Draw("l3");


  
   // stop curves
  g_stop->SetLineColor(kRed);
  g_stop->SetLineStyle(2);
  g_stop->SetLineWidth(2);
  g_stop->Draw("l");

  g_tps->SetLineColor(kRed);
  g_tps->SetLineStyle(3);
  g_tps->SetLineWidth(3);
  //g_tps->Draw("l");
   
  g_thStop->SetLineColor(kOrange);
  g_thStop->SetLineStyle(1);
  g_thStop->SetLineWidth(2);
  g_thStop->SetFillStyle(3001);
  g_thStop->SetFillColor(kOrange-4);
  g_thStop->Draw("l3");
  */

  // mchamp curves
  // 2 sigma band
  g_exp_2sig->SetLineColor(0);
  g_exp_2sig->SetLineStyle(0);
  g_exp_2sig->SetLineWidth(0);
  g_exp_2sig->SetFillColor(kYellow);
  g_exp_2sig->SetFillStyle(1001);
  g_exp_2sig->Draw("3");

  // 1 sigma band 
  // g_exp_1sig->SetLineColor(8);                                                                                                                                                           
  g_exp_1sig->SetLineColor(0);
  g_exp_1sig->SetLineStyle(0);
  g_exp_1sig->SetLineWidth(0);
  // g_exp_1sig->SetFillColor(8);                                                                                                                                                           
  g_exp_1sig->SetFillColor(kGreen);
  g_exp_1sig->SetFillStyle(1001);
  // g_exp_1sig->SetFillStyle(3005);                                                                                                                                                        
  g_exp_1sig->Draw("3");
  // g_exp_1sig->Draw("lX");                                                                                                                                                                

  g_obs_mchamp->SetLineStyle(1);
  g_obs_mchamp->SetLineWidth(2);
  g_obs_mchamp->SetMarkerStyle(20);
  g_obs_mchamp->SetMarkerSize(1);
  g_obs_mchamp->Draw("pl");

  //g_mchamp->SetLineColor(kBlue);
  g_mchamp->SetLineStyle(2);
  //g_mchamp->SetLineStyle(1);
  g_mchamp->SetLineWidth(3);
  g_mchamp->SetMarkerStyle(20);
  g_mchamp->SetMarkerSize(1);
  g_mchamp->Draw("l");

  // theory line
  g_thMchamp->SetLineColor(kRed);
  g_thMchamp->SetLineStyle(1);
  g_thMchamp->SetLineWidth(2);
  g_thMchamp->SetFillStyle(3001);
  g_thMchamp->SetFillColor(kRed-4);
  g_thMchamp->Draw("l3");

  // theory line label
  TLatex* th = new TLatex(480., 4., "NLO+NLL #tilde{g}");
  th->SetTextColor(kBlue);
  th->SetTextFont(42);
  th->SetTextSize(0.035);
  //th->Draw();

  TLatex* ths = new TLatex(330., 2., "NLO+NLL #tilde{t}");
  ths->SetTextColor(kRed);
  ths->SetTextFont(42);
  ths->SetTextSize(0.035);
  //ths->Draw();

  TLatex* thm = new TLatex(480., 4., "NLO+NLL mchamp");
  //thm->SetTextColor(kBlue);
  thm->SetTextFont(42);
  thm->SetTextSize(0.035);
  //thm->Draw();

  // not explored label
  TText* ne = new TText(125., .2, "Not Sensitive");
  ne->SetTextColor(kRed+1);
  ne->SetTextFont(42);
  ne->SetTextAngle(90);
  ne->SetTextSize(0.035);
  //ne->Draw();

  //blurb->Draw();

  canvas->RedrawAxis();

  CMS_lumi(canvas, iPeriod, iPos);

  canvas->Print("massLimit.pdf");
  canvas->Print("massLimit.png");
  canvas->Print("massLimit.C");

  plots.calculateIntercepts();

  TFile* fnew = new TFile("histos.root", "recreate");
  fnew->cd();
  g_obs_mchamp->Write();
  g_mchamp->Write();
  g_thMchamp->Write();

}
Example #24
0
void Draw_CMS_JPsi_RaaVspT(TLegend *legend_ratio)
{
  
  int nbinsPtCMS=4;
  Double_t PtCMSD[4]={7.31,8.97,11.32,16.52};
  Double_t ErrPtCMS[4]={0};
  Double_t RaaPtCMS[4] = {0.35,0.34,0.34,0.29}; 
  Double_t RaaPtStatErrCMS[4] = {0.09,0.03,0.03,0.04};
  Double_t RaaPtSystErrCMS[4] = {0.04,0.04,0.03,0.03};
  
  TGraphErrors *grRaaPtCMS = new TGraphErrors(nbinsPtCMS, PtCMSD, RaaPtCMS, ErrPtCMS, RaaPtStatErrCMS);  
  grRaaPtCMS->SetMarkerStyle(21);
  grRaaPtCMS->SetMarkerColor(kRed+1);
  grRaaPtCMS->SetMarkerSize(1.3);
  //grRaaPtCMS->SetFillColor(kRed);
  grRaaPtCMS->SetLineColor(1);
  grRaaPtCMS->GetYaxis()->SetRangeUser(0,1.5);
  grRaaPtCMS->GetXaxis()->SetTitle("p_{T}(GeV/c)");
  grRaaPtCMS->GetYaxis()->SetTitle("R_{AA}");
  
  TLine *lh5 = new TLine(0.0,1.0,20.0,1.0);
  lh5->SetLineColor(1);
  lh5->SetLineStyle(1);
  lh5->SetLineWidth(1.5);
  
  TLatex *tb= new TLatex;
  tb->SetNDC(); 
  tb->SetTextAlign(12);
  tb->SetTextColor(1);
  tb->SetTextSize(0.040);
  
  TBox *RaaPtJPsiCMSSys[4];
  for(int j=0;j<4;j++){
    RaaPtJPsiCMSSys[j] = new TBox(PtCMSD[j]-0.4,  RaaPtCMS[j]-RaaPtSystErrCMS[j], PtCMSD[j]+0.4,  RaaPtCMS[j]+RaaPtSystErrCMS[j]);
  }
  
  for(int j=0;j<4;j++){
    RaaPtJPsiCMSSys[j]->SetFillStyle(1001);
    RaaPtJPsiCMSSys[j]->SetFillColor(kPink+1);
    RaaPtJPsiCMSSys[j]->SetLineColor(1);
  }
  
  TBox *CMSGlobalSysJPsiPt;
  //CMSGlobalSysJPsiPt = new TBox(27.0-1.0, 1 - 0.075, 27.0+1.0, 1 + 0.075);
  CMSGlobalSysJPsiPt = new TBox(19.165,0.923,19.948,1.067);
  CMSGlobalSysJPsiPt->SetFillStyle(3001);
  CMSGlobalSysJPsiPt->SetLineColor(2);
  CMSGlobalSysJPsiPt->SetFillColor(2);
  
  TAxis *XaxisgrRaaPtCMS = grRaaPtCMS->GetXaxis();
  XaxisgrRaaPtCMS->SetLimits(0.0,20.0);
  grRaaPtCMS->Draw("AP");
  for(int j=0;j<4;j++) RaaPtJPsiCMSSys[j]->Draw("same"); 
  grRaaPtCMS->Draw("Psame");
  CMSGlobalSysJPsiPt->Draw("same"); 
  tb->SetTextSize(0.030);
  //tb->DrawLatex(0.20,0.20,"PbPb #sqrt{s_{NN}} = 2.76 TeV");
  tb->DrawLatex(0.71476,0.91289,"J/#psi #rightarrow #mu^{+} #mu^{-}");  
  lh5->Draw("same");
  //legend_ratio->AddEntry(grRaaPtCMS,"PbPb #sqrt{s_{NN}} = 2.76 TeV and Au-Au #sqrt{s_{NN}} = 0.2 TeV", "");
  legend_ratio->AddEntry(grRaaPtCMS,"Pb+Pb #sqrt{s_{NN}} = 2.76 TeV", "");
  legend_ratio->AddEntry(grRaaPtCMS,"Prompt J/#psi CMS: |y| < 2.4", "P");

  //legend_ratio->AddEntry(grRaaPtCMS,"PbPb #sqrt{s_{NN}} = 2.76 TeV and Au-Au #sqrt{s_{NN}} = 0.2 TeV", "");
  //legend_ratio->AddEntry(grRaaPtCMS,"CMS: J/#psi #rightarrow #mu^{+} #mu^{-}, |y| < 2.4 & p_{T}^{J/#psi} > 6.5 GeV/c", "P");
  //legend_ratio->AddEntry(grRaaPtCMS,"CMS: J/#psi #rightarrow #mu^{+} #mu^{-}, |y| < 2.4 & p_{T}^{J/#psi} > 6.5 GeV/c", "P");
}
Example #25
0
void cmsRAA(int version = 6)
{
  double mymarkersize = 1.;
  bool bDo2PadZoo = true;
  
  //----------------------------------------- charged hadrons
  double ptBins_h[27]={0};
  double ptError_h[27]={0};
  
  double raa_h[27];
  double raaStat_h[27];
  double raaSyst_h[27];

  double ptSystXlow_h[27];
  double ptSystXhigh_h[27];

  // reading numbers
  ifstream inData_h; 
  TString inFile("raa_h05.dat");
  inData_h.open(inFile);
  if(inData_h.fail()) {
    cerr << "unable to open file raa_h05.dat for reading" << endl;
    exit(1);
  }
  Int_t j=0;
  Double_t xx_low, xx_high,raa,raa_syst, raa_stat;
  while(!inData_h.eof())
  { 
    inData_h >> xx_low >> xx_high >> raa >> raa_syst >> raa_stat;
    ptBins_h[j]   = xx_low+ (xx_high-xx_low)/2;
    raa_h[j]      = raa;
    raaStat_h[j]  = raa_syst;
    raaSyst_h[j]  = raa_stat;
    
    ptSystXlow_h[j] = (xx_high-xx_low)/2;
    ptSystXhigh_h[j]= (xx_high-xx_low)/2;
    // cout<<"pT"<<ptBins_h[j]<<"\t raa= "<<raa_h[j]<<"\t syst= "<<raaStat_h[j]<<"\t stat ="<<raaSyst_h[j]<<"\t x_low= "<<ptSystXlow_h[j]<<"\t high= "<<ptSystXhigh_h[j]<<endl;
    j++;
  }     
  inData_h.close();
  // done reading numebrs
  
  TGraphErrors *pgRaa_h          = new TGraphErrors(27, ptBins_h, raa_h, ptError_h, raaStat_h);
  TGraphAsymmErrors *pgRaaSyst_h = new TGraphAsymmErrors(27, ptBins_h, raa_h, ptSystXlow_h,ptSystXhigh_h,raaSyst_h,raaSyst_h);
  pgRaa_h->SetName("pgRaa_h");
  pgRaa_h->SetMarkerStyle(kFullCircle);
  pgRaa_h->SetMarkerSize(1.);
  
  //systm error
  pgRaaSyst_h->SetName("pgRaaSyst_h");
  pgRaaSyst_h->SetFillColor(TColor::GetColor("#33ccff"));

  //----------------------------------------- jet RAA
  double ptBins_jet[]   = {105,115,125,135,145,155,165,175,190,220,270}; 
  double ptError_jet[]  = {0.0, 0.0, 0.0, 0.0, 0.0,0,0,0,0,0,0};
  
  double raa_jet[]      = {0.47,   0.47,   0.46,  0.44,   0.43,  0.47,  0.52,  0.51,  0.44,  0.42,  0.58}; 
  double raaStat_jet[]  = {0.0076, 0.0098, 0.013, 0.016,  0.021, 0.028, 0.038, 0.045, 0.035, 0.039, 0.098};
  double raaSyst_jet[]  = {0.07, 0.07, 0.08, 0.09, 0.08, 0.08, 0.08, 0.08, 0.07, 0.07, 0.10 };

  double ptSystXlow_jet[]      = {5, 5, 5, 5, 5,5,5,5,10,20,30};
  double ptSystXhigh_jet[]     = {5, 5, 5, 5, 5,5,5,5,10,20,30};
  
  TGraphErrors *pgRaa_jet          = new TGraphErrors(11, ptBins_jet, raa_jet, ptError_jet, raaStat_jet);
  TGraphAsymmErrors *pgRaaSyst_jet = new TGraphAsymmErrors(11, ptBins_jet, raa_jet, ptSystXlow_jet,ptSystXhigh_jet,raaSyst_jet,raaSyst_jet);
  pgRaa_jet->SetName("pgRaa_jet");
  pgRaa_jet->SetMarkerStyle(22);
  pgRaa_jet->SetMarkerSize(1.);
  
  //systm error
  pgRaaSyst_jet->SetName("pgRaaSyst_jet");
  pgRaaSyst_jet->SetFillColor(TColor::GetColor("#00FF60"));

  //----------------------------------------- b-jet RAA
  double ptBins_bjet[5]   = {85,100,120,150,210}; 
  double ptError_bjet[5]  = {0,0,0,0,0};
  
  double raa_bjet[5]      = {0.3927,0.3277,0.4598,0.4034,0.4214}; 
  double raaStat_bjet[5]  = {0.0179,0.0178,0.0374,0.0625,0.1589};
  double raaSyst_bjet[5]  = {0.0917,0.0923,0.1272,0.1529,0.2771};

  double ptSystXlow_bjet[5]      = {5,10,10,20,40};
  double ptSystXhigh_bjet[5]     = {5,10,10,20,40};
  
  TGraphErrors *pgRaa_bjet          = new TGraphErrors(5, ptBins_bjet, raa_bjet, ptError_bjet, raaStat_bjet);
  TGraphAsymmErrors *pgRaaSyst_bjet = new TGraphAsymmErrors(5, ptBins_bjet, raa_bjet, ptSystXlow_bjet,ptSystXhigh_bjet,raaSyst_bjet,raaSyst_bjet);
  pgRaa_bjet->SetName("pgRaa_bjet");
  pgRaa_bjet->SetMarkerStyle(21);
  pgRaa_bjet->SetMarkerColor(kRed);
  pgRaa_bjet->SetMarkerSize(1.);
  
  //systm error
  pgRaaSyst_bjet->SetName("pgRaaSyst_bjet");
  pgRaaSyst_bjet->SetFillColor(TColor::GetColor("#FFBF00"));


  //----------------------------------------- photon
  double ptBins_photon[]   = {22.26, 27.30, 34.35, 44.45, 61.72}; 
  double ptError_photon[]  = {0.0, 0.0, 0.0, 0.0, 0.0};
  
  double raa_photon[]      = {1.03, 0.84, 1.37, 0.98, 0.99}; 
  double raaStat_photon[]  = {0.12 ,0.14, 0.22, 0.24, 0.31 };
  double raaSyst_photon[]  = {0.29, 0.27,  0.25, 0.22, 0.21};

  double ptSystXlow_photon[]      = {2.5, 2.5, 5, 5, 15};
  double ptSystXhigh_photon[]     = {2.5, 2.5, 5, 5, 15};
  
  TGraphErrors *pgRaa_photon          = new TGraphErrors(5, ptBins_photon, raa_photon, ptError_photon, raaStat_photon);
  TGraphAsymmErrors *pgRaaSyst_photon = new TGraphAsymmErrors(5, ptBins_photon, raa_photon, ptSystXlow_photon,ptSystXhigh_photon,raaSyst_photon,raaSyst_photon);
  pgRaa_photon->SetName("pgRaa_photon");
  pgRaa_photon->SetMarkerStyle(23);
  pgRaa_photon->SetMarkerSize(1.);
  //systm error
  pgRaaSyst_photon->SetName("pgRaaSyst_photon");
  pgRaaSyst_photon->SetFillColor(TColor::GetColor("#ffff00"));
  
  //----------------------------------------- Z 
  double ptBins_z[]   = {91.19};
  //double ptBins_z[7]   = {2.5,7.5,15,25,35,45,75};
  double ptError_z[]  = {0.0};
  //double ptError_z[7]  = {0.0};
  
  double raa_z[]      = {1.06}; 
  double raaStat_z[]  = {0.05};
  double raaSyst_z[]  = {0.08};
  double ptSystXlow_z[]      = {4};
  double ptSystXhigh_z[]     = {4};
  //double raa_z[7]        = {0.88,1.20,1.00,1.35,1.11,1.35,0.78}; 
  //double raaStat_z[7]    = {0.09,0.13,0.11,0.22,0.27,0.42,0.20};
  //double raaSyst_z[7]    = {0.06,0.08,0.07,0.09,0.08,0.09,0.05};
  //double ptSystXlow_z[7] = {2.5,2.5,5,5,5,5,25};
  //double ptSystXhigh_z[7] = {2.5,2.5,5,5,5,5,25};

  TGraphErrors *pgRaa_z          = new TGraphErrors(1, ptBins_z, raa_z, ptError_z, raaStat_z);
  TGraphAsymmErrors *pgRaaSyst_z = new TGraphAsymmErrors(1, ptBins_z, raa_z, ptSystXlow_z,ptSystXhigh_z,raaSyst_z,raaSyst_z);
  pgRaa_z->SetName("pgRaa_z");   pgRaa_z->SetMarkerStyle(kFullCircle);
  pgRaa_z->SetMarkerSize(1.);
  pgRaa_z->SetMarkerStyle(22);  

  //systm error
  pgRaaSyst_z->SetName("pgRaaSyst_z");
  pgRaaSyst_z->SetFillColor(TColor::GetColor("#ff8888"));


  // ----------------------------------------- W raa
  double ptBins_w[]   = {80.38}; 
  double ptError_w[]  = {0.0};
  
  double raa_w[]      = {1.04}; 
  double raaStat_w[]  = {0.07};
  double raaSyst_w[]  = {0.12};
  double ptSystXlow_w[]      = {4};
  double ptSystXhigh_w[]     = {4};

  TGraphErrors *pgRaa_w          = new TGraphErrors(1, ptBins_w, raa_w, ptError_w, raaStat_w);
  TGraphAsymmErrors *pgRaaSyst_w = new TGraphAsymmErrors(1, ptBins_w, raa_w, ptSystXlow_w,ptSystXhigh_w,raaSyst_w,raaSyst_w);
  pgRaa_w->SetName("pgRaa_w");
  pgRaa_w->SetMarkerStyle(kFullCircle);
  pgRaa_w->SetMarkerSize(1.);
  pgRaa_w->SetMarkerStyle(21);
  
  //systm error
  pgRaaSyst_w->SetName("pgRaaSyst_w");
  pgRaaSyst_w->SetFillColor(TColor::GetColor("#ff88ff"));


  // ----------------------------------------- 2012 non-prompt Jpsi
  double ptBins_npjpsi[]   = {7.31,8.97,11.32,16.52}; 
  double ptError_npjpsi[]  = {0.0,0.0,0.0,0.0};
  
  double raa_npjpsi[]      = {0.52,0.43,0.43,0.34};  
  double raaStat_npjpsi[]  = {0.12,0.08,0.09,0.07};
  double raaSyst_npjpsi[]  = {0.06,0.05,0.05,0.04};

  double ptSystXlow_npjpsi[]      = {0.81, 0.97, 1.32, 3.52};
  double ptSystXhigh_npjpsi[]     = {0.69, 1.03, 1.68, 13.48};

  TGraphErrors *pgRaa_npjpsi          = new TGraphErrors(4, ptBins_npjpsi, raa_npjpsi, ptError_npjpsi, raaStat_npjpsi);
  TGraphAsymmErrors *pgRaaSyst_npjpsi = new TGraphAsymmErrors(4, ptBins_npjpsi, raa_npjpsi, ptSystXlow_npjpsi,ptSystXhigh_npjpsi,raaSyst_npjpsi,raaSyst_npjpsi);
  pgRaa_npjpsi->SetName("pgRaa_npjpsi");
  pgRaa_npjpsi->SetMarkerStyle(29);
  pgRaa_npjpsi->SetMarkerSize(1.2);
  pgRaa_npjpsi->SetMarkerColor(kRed);
  
  //systm error
  pgRaaSyst_npjpsi->SetName("pgRaaSyst_npjpsi");
  // pgRaaSyst_npjpsi->SetFillColor(TColor::GetColor("#ee7711"));
  pgRaaSyst_npjpsi->SetFillColor(TColor::GetColor("#ba8a98"));
  
  
  //---------------------------------------------------------
  // lumi uncert.
  TBox *box = new TBox(0.9,0.9568966,2,1.043103);
  box->SetFillColor(kGray+1);
  box->SetFillStyle(1001);
  

  TBox *box_lin = new TBox(0.9,0.9568966,10,1.043103);
  box_lin->SetFillColor(kGray+1);
  box_lin->SetFillStyle(1001);
  
  //------------------------ single pannel:
  
  TCanvas *pc = new TCanvas("pc","pc");
  TH1 *phAxis = new TH1D("phAxis",";p_{T} (m_{T}) [GeV];R_{AA}",1,0.9,300);
  phAxis->GetYaxis()->CenterTitle(true);
  phAxis->SetMinimum(0.);
  phAxis->SetMaximum(2.5);
  gPad->SetLogx();
  phAxis->Draw("");
  
  // drawing order:
  // A)  stat boxes:
  pgRaaSyst_photon->Draw("2");
  pgRaaSyst_npjpsi->Draw("2");
  pgRaaSyst_h->Draw("2");
  pgRaaSyst_z->Draw("2");
  pgRaaSyst_w->Draw("2");
  pgRaaSyst_bjet->Draw("2");
  pgRaaSyst_jet->Draw("2");
  //nominal+stat
  // photon
  pgRaa_photon->Draw("P z");
  pgRaa_z->Draw("P z");
  pgRaa_w->Draw("P z");
  pgRaa_h->Draw("P z");
  pgRaa_npjpsi->Draw("P z");
  pgRaa_bjet->Draw("P z");
  pgRaa_jet->Draw("P z");

  TLine *line = new TLine(0.9,1,300,1);
  line->SetLineStyle(7);
  line->Draw();
  //box->Draw();
  // // legends and writings:

  TLegend *leg = new TLegend(0.05,0.87,0.39,0.95,NULL,"brNDC");
  leg->SetBorderSize(0);
  leg->SetTextFont(62);
  leg->SetTextSize(0.029);
  leg->SetLineColor(1);
  leg->SetLineStyle(1);
  leg->SetLineWidth(1);
  leg->SetFillColor(19);
  leg->SetFillStyle(0);
  //  TLegendEntry *entry=leg->AddEntry("hEtSIEIECorrected","CMS PRELIMINARY","");
  //    entry->SetLineWidth(1);
  //    entry=leg->AddEntry("hEtSIEIECorrected","PbPb #sqrt{s_{NN}} = 2.76 TeV","");
  //    entry=leg->AddEntry("hEtSIEIECorrected","","");
  //    entry=leg->AddEntry("hEtSIEIECorrected","#int L dt = 7-150 #mub^{-1}","");

  TLegendEntry *entry=leg->AddEntry("hEtSIEIECorrected","CMS  *PRELIMINARY  PbPb #sqrt{s_{NN}} = 2.76 TeV  #int L dt = 7-150 #mub^{-1}","");
  entry->SetLineWidth(1);
  
  

  // TAA
  // TAA only
  TLegend *leg_taa = new TLegend(0.15,0.5,0.5,0.55,NULL,"brNDC");
  leg_taa->SetBorderSize(0);
  leg_taa->SetTextFont(62);
  leg_taa->SetTextSize(0.028);
  leg_taa->SetLineColor(1);
  leg_taa->SetLineStyle(1);
  leg_taa->SetLineWidth(1);
  leg_taa->SetFillColor(19);
  leg_taa->SetFillStyle(0);
  TLegendEntry *entry_taa= leg_taa->AddEntry("general","T_{AA} uncertainty","f");
  entry_taa->SetFillColor(kGray+1);
  entry_taa->SetFillStyle(1001);
  entry_taa->SetLineColor(0);
  entry_taa->SetLineWidth(1);
  entry_taa->SetMarkerStyle(21);
  entry_taa->SetMarkerSize(1);

  // EWQ legend
  TLegend *leg_ewq = new TLegend(0.14,0.79,0.6,0.89,NULL,"brNDC");
  leg_ewq->SetBorderSize(0);
  leg_ewq->SetTextFont(62);
  leg_ewq->SetTextSize(0.028);
  leg_ewq->SetLineColor(1);
  leg_ewq->SetLineStyle(1);
  leg_ewq->SetLineWidth(1);
  leg_ewq->SetFillColor(19);
  leg_ewq->SetFillStyle(0);
  TLegendEntry *entry_ewq=leg_ewq->AddEntry("raaz","*Z  (0-100%) |y| < 2","lpf");
  entry_ewq->SetFillColor(TColor::GetColor("#ff8888"));
  entry_ewq->SetFillStyle(1001);
  entry_ewq->SetLineColor(1);
  entry_ewq->SetLineWidth(1);
  entry_ewq->SetMarkerStyle(22);
  entry_ewq->SetMarkerSize(1.);
  
  entry_ewq=leg_ewq->AddEntry("raaw","W  (0-100%) p_{T}^{#mu} > 25 GeV/c^{^{ }}, |#eta^{#mu}| < 2.1","lpf");
  entry_ewq->SetFillColor(TColor::GetColor("#ff88ff"));
  entry_ewq->SetFillStyle(1001);
  entry_ewq->SetLineColor(1);
  entry_ewq->SetLineWidth(1);
  entry_ewq->SetMarkerStyle(21);
  entry_ewq->SetMarkerSize(1.);
  
  entry_ewq=leg_ewq->AddEntry("raaphoton","Isolated photon  (0-10%)  |#eta| < 1.44","lpf");
  entry_ewq->SetFillColor(TColor::GetColor("#ffff00"));
  entry_ewq->SetFillStyle(1001);
  entry_ewq->SetLineColor(1);
  entry_ewq->SetLineWidth(1);
  entry_ewq->SetMarkerStyle(23);
  entry_ewq->SetMarkerSize(1);
  

  // b and h
  TLegend *leg_q = new TLegend(0.14,0.72,0.6,0.79,NULL,"brNDC");
  leg_q->SetBorderSize(0);
  leg_q->SetTextFont(62);
  leg_q->SetTextSize(0.028);
  leg_q->SetLineColor(1);
  leg_q->SetLineStyle(1);
  leg_q->SetLineWidth(1);
  leg_q->SetFillColor(19);
  leg_q->SetFillStyle(0);


  TLegendEntry *entry_q=leg_q->AddEntry("raah","Charged particles  (0-5%)  |#eta| < 1","lpf");
  entry_q->SetFillColor(TColor::GetColor("#33ccff"));
  entry_q->SetFillStyle(1001);
  entry_q->SetLineColor(1);
  entry_q->SetLineStyle(1);
  entry_q->SetLineWidth(1);
  entry_q->SetMarkerStyle(kFullCircle);
  entry_q->SetMarkerSize(1);

  entry_q=leg_q->AddEntry("raab","*B #rightarrow J/#psi  (0-100%)  |#eta| < 2.4","lpf");
  entry_q->SetFillColor(TColor::GetColor("#ba8a98"));
  entry_q->SetFillStyle(1001);
  entry_q->SetLineColor(1);
  entry_q->SetLineStyle(1);
  entry_q->SetLineWidth(1);
  entry_q->SetMarkerStyle(29);
  entry_q->SetMarkerColor(kRed);
  entry_q->SetMarkerSize(1.2);
  //entry_q=leg_q->AddEntry("raabjpsi", "(via secondary J/#psi)","");
  
  // jet legend
  TLegend *leg_jet = new TLegend(0.14,0.65,0.6,0.72,NULL,"brNDC");
  leg_jet->SetBorderSize(0);
  leg_jet->SetTextFont(62);
  leg_jet->SetTextSize(0.028);
  leg_jet->SetLineColor(1);
  leg_jet->SetLineStyle(1);
  leg_jet->SetLineWidth(1);
  leg_jet->SetFillColor(19);
  leg_jet->SetFillStyle(0);

  TLegendEntry *entry_jet=leg_jet->AddEntry("raaq","*q/g-jet  (0-5%)  |#eta| < 2","lpf");
  entry_jet->SetFillColor(TColor::GetColor("#00FF60"));
  entry_jet->SetFillStyle(1001);
  entry_jet->SetLineColor(1);
  entry_jet->SetLineStyle(1);
  entry_jet->SetLineWidth(1);
  entry_jet->SetMarkerStyle(22);
  entry_jet->SetMarkerSize(1);

  entry_jet=leg_jet->AddEntry("raaheavy","*b-jet  (0-10%)  |#eta| < 2","lpf");
  entry_jet->SetFillColor(TColor::GetColor("#FFBF00"));
  entry_jet->SetFillStyle(1001);
  entry_jet->SetLineColor(1);
  entry_jet->SetLineStyle(1);
  entry_jet->SetLineWidth(1);
  entry_jet->SetMarkerStyle(21);
  entry_jet->SetMarkerColor(kRed);
  entry_jet->SetMarkerSize(1);
  
  leg->Draw();
  //leg_taa->Draw();
  leg_ewq->Draw();
  leg_q->Draw();
  leg_jet->Draw();
  gPad->RedrawAxis();
  
  // save the work
  // pc->SaveAs("raaZoo_cms_log.pdf");
  // pc->SaveAs("raaZoo_cms_log.png");




  //--------------------------------------------------------------------------------
  //-------------------------- 2TPad
  //double sizeincrease = 1.2;
  
  TH1 *phAxis_single = new TH1D("phAxis_single",";p_{T} (m_{T}) [GeV];R_{AA}",1,0,105);
  phAxis_single->GetYaxis()->CenterTitle(true);
  //phAxis_single->GetXaxis()->CenterTitle(true);

  //double defaxissize = phAxis_single->GetYaxis()->GetTitleSize();
  //double defaxislabel = phAxis_single->GetYaxis()->GetLabelSize();

  //phAxis_single->GetYaxis()->SetTitleSize(defaxissize*sizeincrease);
  //phAxis_single->GetXaxis()->SetTitleSize(defaxissize*sizeincrease);
  //phAxis_single->GetYaxis()->SetLabelSize(defaxislabel*sizeincrease);
  //phAxis_single->GetXaxis()->SetLabelSize(defaxislabel*sizeincrease);
  
  //phAxis_single->GetYaxis()->SetNdivisions(310);
  //phAxis_single->GetXaxis()->SetNdivisions(310);
  //phAxis_single->GetYaxis()->SetTitleOffset(0.85);
  //phAxis_single->GetXaxis()->SetTitleOffset(0.85);
  
  phAxis_single->SetMinimum(0.);
  phAxis_single->SetMaximum(2.5);
  TH1 *phAxis_jet = new TH1D("phAxis_jet",";p_{T} [GeV];",1,75,300);
  //phAxis_jet->GetYaxis()->CenterTitle(true);
  //phAxis_jet->GetXaxis()->CenterTitle(true);
  //phAxis_jet->GetYaxis()->SetTitleSize(defaxissize*sizeincrease);
  //phAxis_jet->GetXaxis()->SetTitleSize(defaxissize*sizeincrease);
  //phAxis_jet->GetYaxis()->SetLabelSize(defaxislabel*sizeincrease);
  phAxis_jet->GetYaxis()->SetLabelColor(0);
  //phAxis_jet->GetXaxis()->SetLabelSize(defaxislabel*sizeincrease);
  //phAxis_jet->GetYaxis()->SetNdivisions(310);
  //phAxis_jet->GetXaxis()->SetNdivisions(310);
  //phAxis_jet->GetYaxis()->SetTitleOffset(0.85);
  //phAxis_jet->GetXaxis()->SetTitleOffset(0.85);
  
  phAxis_jet->SetMinimum(0.);
  phAxis_jet->SetMaximum(2.5);

  // redefine legends:
  // TAA only
  /*TLegend *leg2_taa = new TLegend(0.15,0.85,0.5,0.9,NULL,"brNDC");
  leg2_taa->SetBorderSize(0);
  leg2_taa->SetTextFont(62);
  leg2_taa->SetTextSize(0.028);
  leg2_taa->SetLineColor(1);
  leg2_taa->SetLineStyle(1);
  leg2_taa->SetLineWidth(1);
  leg2_taa->SetFillColor(19);
  leg2_taa->SetFillStyle(0);
  TLegendEntry *entry2_taa= leg2_taa->AddEntry("general","T_{AA} uncertainty (0-5%)","f");
  entry2_taa->SetFillColor(kGray+1);
  entry2_taa->SetFillStyle(1001);
  entry2_taa->SetLineColor(0);
  entry2_taa->SetLineWidth(1);
  entry2_taa->SetMarkerStyle(21);
  entry2_taa->SetMarkerSize(1);*/

  TLegend *leg2 = new TLegend(0.04,0.81,0.34,0.93,NULL,"brNDC");
  leg2->SetBorderSize(0);
  leg2->SetTextFont(62);
  leg2->SetTextSize(0.03);
  //leg2->SetLineColor(1);
  //leg2->SetLineStyle(1);
  //leg2->SetLineWidth(1);
  //leg2->SetFillColor(19);
  leg2->SetFillStyle(0);
  TLegendEntry *entry2=leg2->AddEntry("general","CMS  *PRELIMINARY  PbPb #sqrt{s_{NN}} = 2.76 TeV","");
  entry2=leg2->AddEntry("general","#int L dt = 7-150 #mub^{-1}","");
  
  // jet leg2end
  TLegend *leg2_jet = new TLegend(0.08,0.73,0.64,0.81,NULL,"brNDC");
  leg2_jet->SetBorderSize(0);
  leg2_jet->SetTextFont(62);
  leg2_jet->SetTextSize(0.028);
  leg2_jet->SetLineColor(1);
  leg2_jet->SetLineStyle(1);
  leg2_jet->SetLineWidth(1);
  leg2_jet->SetFillColor(19);
  leg2_jet->SetFillStyle(0);

  TLegendEntry *entry2_jet=leg2_jet->AddEntry("raaq","*q/g-jet  (0-5%)  |#eta| < 2","lpf");
  entry2_jet->SetFillColor(TColor::GetColor("#00FF60"));
  entry2_jet->SetFillStyle(1001);
  entry2_jet->SetLineColor(1);
  entry2_jet->SetLineStyle(1);
  entry2_jet->SetLineWidth(1);
  entry2_jet->SetMarkerStyle(22);
  entry2_jet->SetMarkerSize(mymarkersize);

  if(version > 5)
  {
    entry2_jet=leg2_jet->AddEntry("raaheavy","*b-jet  (0-10%)  |#eta| < 2","lpf");
    entry2_jet->SetFillColor(TColor::GetColor("#FFBF00"));
    entry2_jet->SetFillStyle(1001);
    entry2_jet->SetLineColor(1);
    entry2_jet->SetLineStyle(1);
    entry2_jet->SetLineWidth(1);
    entry2_jet->SetMarkerStyle(21);
    entry2_jet->SetMarkerColor(kRed);
    entry2_jet->SetMarkerSize(mymarkersize);
  }
  else  entry2_jet=leg2_jet->AddEntry("raaheavy","","");
  

  // EWQ legend
  TLegend *leg2_ewq = new TLegend(0.14,0.81,0.7,0.93,NULL,"brNDC");
  leg2_ewq->SetBorderSize(0);
  leg2_ewq->SetTextFont(62);
  leg2_ewq->SetTextSize(0.028);
  leg2_ewq->SetLineColor(1);
  leg2_ewq->SetLineStyle(1);
  leg2_ewq->SetLineWidth(1);
  leg2_ewq->SetFillColor(19);
  leg2_ewq->SetFillStyle(0);
  TLegendEntry *entry2_ewq;
  if(version > 1)
  {
    entry2_ewq=leg2_ewq->AddEntry("raaz","*Z  (0-100%) |y| < 2","lpf");
    entry2_ewq->SetFillColor(TColor::GetColor("#ff8888"));
    entry2_ewq->SetFillStyle(1001);
    entry2_ewq->SetLineColor(1);
    entry2_ewq->SetLineWidth(1);
    entry2_ewq->SetMarkerStyle(22);
    entry2_ewq->SetMarkerSize(mymarkersize);
  }
  else entry2_ewq=leg2_ewq->AddEntry("raaz","",""); 
  
  if(version > 2)
  {  
    entry2_ewq=leg2_ewq->AddEntry("raaw","W  (0-100%) p_{T}^{#mu} > 25 GeV/c^{^{ }}, |#eta^{#mu}| < 2.1","lpf");
    entry2_ewq->SetFillColor(TColor::GetColor("#ff88ff"));
    entry2_ewq->SetFillStyle(1001);
    entry2_ewq->SetLineColor(1);
    entry2_ewq->SetLineWidth(1);
    entry2_ewq->SetMarkerStyle(21);
    entry2_ewq->SetMarkerSize(mymarkersize);
  } 
  else  entry2_ewq=leg2_ewq->AddEntry("raaw","","");
  
  if(version > 0)
  {
    entry2_ewq=leg2_ewq->AddEntry("raaphoton","Isolated photon  (0-10%)  |#eta| < 1.44","lpf");
    entry2_ewq->SetFillColor(TColor::GetColor("#ffff00"));
    entry2_ewq->SetFillStyle(1001);
    entry2_ewq->SetLineColor(1);
    entry2_ewq->SetLineWidth(1);
    entry2_ewq->SetMarkerStyle(23);
    entry2_ewq->SetMarkerSize(mymarkersize);
  }
  else  entry2_ewq=leg2_ewq->AddEntry("raaphoton","","");
    
  // B and h
  TLegend *leg2_q = new TLegend(0.14,0.74,0.7,0.81,NULL,"brNDC");
  leg2_q->SetBorderSize(0);
  leg2_q->SetTextFont(62);
  leg2_q->SetTextSize(0.028);
  leg2_q->SetLineColor(1);
  leg2_q->SetLineStyle(1);
  leg2_q->SetLineWidth(1);
  leg2_q->SetFillColor(19);
  leg2_q->SetFillStyle(0);
  TLegendEntry *entry2_q;
  if(version > 3)
  {
    entry2_q=leg2_q->AddEntry("raah","Charged particles  (0-5%)  |#eta| < 1","lpf");
    entry2_q->SetFillColor(TColor::GetColor("#33ccff"));
    entry2_q->SetFillStyle(1001);
    entry2_q->SetLineColor(1);
    entry2_q->SetLineStyle(1);
    entry2_q->SetLineWidth(1);
    entry2_q->SetMarkerStyle(kFullCircle);
    entry2_q->SetMarkerSize(mymarkersize);
  }
  else  entry2_q=leg2_q->AddEntry("raah","","");
  
  if(version > 5)
  {
    entry2_q=leg2_q->AddEntry("raab","*B #rightarrow J/#psi  (0-100%)  |y| < 2.4","lpf");
    // entry2_q->SetFillColor(TColor::GetColor("#ee7711"));
    entry2_q->SetFillColor(TColor::GetColor("#ba8a98"));
    entry2_q->SetFillStyle(1001);
    entry2_q->SetLineColor(1);
    entry2_q->SetLineStyle(1);
    entry2_q->SetLineWidth(1);
    entry2_q->SetMarkerStyle(29);
    entry2_q->SetMarkerColor(kRed);
    entry2_q->SetMarkerSize(mymarkersize);
    //entry2_q=leg2_q->AddEntry("raabjpsi", "(via secondary J/#psi)","");
  }
  else
  {
    entry2_q=leg2_q->AddEntry("raab","","");
    entry2_q=leg2_q->AddEntry("raab","","");
  }
  
  if(bDo2PadZoo)
  {
    TCanvas *pc2 = new TCanvas("pc2","pc2",1200,600);
    TPad *p_0 = new TPad("p_0","p_0",0,0,0.50,1);
    p_0->Draw();
    p_0->cd();
    p_0->SetRightMargin(0.03);
    
    phAxis_single->Draw("");
    //box_lin->Draw();
    
    pgRaa_photon->SetMarkerSize(mymarkersize);
    pgRaa_z->SetMarkerSize(mymarkersize);
    pgRaa_h->SetMarkerSize(mymarkersize);
    pgRaa_w->SetMarkerSize(mymarkersize);
    pgRaa_npjpsi->SetMarkerSize(mymarkersize);
    pgRaa_bjet->SetMarkerSize(mymarkersize);
    pgRaa_jet->SetMarkerSize(mymarkersize);
    
    if(version > 0) pgRaaSyst_photon->Draw("2");
    if(version > 1) pgRaaSyst_z->Draw("2");
    if(version > 3) pgRaaSyst_h->Draw("2");
    if(version > 2) pgRaaSyst_w->Draw("2");
    if(version > 5) pgRaaSyst_npjpsi->Draw("2");
    
    if(version > 0) pgRaa_photon->Draw("P z");
    if(version > 1) pgRaa_z->Draw("P z");
    if(version > 3) pgRaa_h->Draw("P z");
    if(version > 2) pgRaa_w->Draw("P z");
    if(version > 5) pgRaa_npjpsi->Draw("P z");
    
    TLine *line_single = new TLine(0,1,105,1);
    line_single->SetLineStyle(7);
    line_single->Draw();
    
    // legends 
    //leg2_taa->Draw();
    leg2_q->Draw();
    leg2_ewq->Draw();
    TLine * midborder = new TLine(99.9,0,99.9,2);
    midborder->SetLineStyle(1);
    
    //if(version < 5) midborder->Draw();
    
    pc2->cd();
    // midborder->Draw();
    if(version > 4)
    {
      // jet pad
      TPad *p_1 = new TPad("p_1","p_1",0.50,0,1,1);
      p_1->Draw();
      p_1->cd();
      p_1->SetLeftMargin(0.06);
      p_1->SetTickx(1);
      p_1->SetTicky(1);
      
      if(version > 4) phAxis_jet->Draw("");
      
      if(version > 5) pgRaaSyst_bjet->Draw("2");
      if(version > 4) pgRaaSyst_jet->Draw("2");
      
      if(version > 5) pgRaa_bjet->Draw("P z");
      if(version > 4) pgRaa_jet->Draw("P z");
      
      
      TLine *line_jet = new TLine(75,1,300,1);
      line_jet->SetLineStyle(7);
      line_jet->Draw();
      
      leg2->Draw();
      leg2_jet->Draw();
    }
    
    p_0->cd();
    gPad->RedrawAxis();
    
    //! adds the latex "100" joining the two pads
    //pc2->cd();
    //TPad * blankpad = new TPad("b", "b",0.48,0.07,0.52,0.11);
    //blankpad->SetBorderMode(0);
    //blankpad->Draw();
    //blankpad->cd();
    //TLatex * test = new TLatex( 0.102843, 0.122822, Form("100"));
    //test->SetTextSize(test->GetTextSize()*26.0*sizeincrease);
    //test->Draw("same");
    //blankpad->Update();
    
    // pc2->SaveAs(Form("raaZoo_cms_2pads_%d.pdf",version));
    //pc2->SaveAs(Form("raaZoo_cms_2pads_%d.png",version));

  }
}
Example #26
0
void Draw_ALICEFor_JPsi_RaaVspT(TLegend *legend_ratio)
{
  // Centrality, rapidity and transverse momentum dependence of
  // J/psi suppression in Pb-Pb collisions at sqrt{s} = 2.76 TeV ALICE
  // arxiv.1311.0214v1
  
  //================= ALICE Forward Rapidity Raa Vs Pt ===================================//
  int nbinsPtALICEFor=7;
  Double_t PtALICEFor[7]={0.50,1.50,2.50,3.50,4.50,5.50,7.0};
  Double_t ErrPtALICEFor[7]={0};

  //Double_t RaaPtALICEFor[7] = {0.61,0.53,0.45,0.38,0.37,0.34,0.35}; 
  //Double_t RaaPtStatErrALICEFor[7] = {0.06,0.04,0.03,0.04,0.05,0.06,0.07};
  //Double_t RaaPtSystErrALICEFor[7] = {0.08,0.07,0.06,0.05,0.05,0.05,0.04};


  Double_t RaaPtALICEFor[7] = {0.78,0.68,0.52,0.43,0.41,0.32,0.36}; 
  Double_t RaaPtStatErrALICEFor[7] = {0.08,0.05,0.04,0.04,0.05,0.05,0.08};
  Double_t RaaPtSystErrALICEFor[7] = {0.11,0.08,0.06,0.05,0.05,0.04,0.04};
  


  TGraphErrors *grRaaPtALICEFor = new TGraphErrors(nbinsPtALICEFor, PtALICEFor, RaaPtALICEFor, ErrPtALICEFor, RaaPtStatErrALICEFor);  
  grRaaPtALICEFor->SetMarkerStyle(20);
  grRaaPtALICEFor->SetMarkerColor(4);
  grRaaPtALICEFor->SetMarkerSize(1.3);
  grRaaPtALICEFor->SetLineColor(1);
  grRaaPtALICEFor->GetYaxis()->SetRangeUser(0,1.5);
  grRaaPtALICEFor->GetXaxis()->SetTitle("p_{T}(GeV/c)");
  grRaaPtALICEFor->GetYaxis()->SetTitle("R_{AA}");

  TLine *lh4 = new TLine(0.0,1.0,7.6,1.0);
  lh4->SetLineColor(1);
  lh4->SetLineStyle(1);
  lh4->SetLineWidth(1.5);
  //lh4->Draw("same");
  
  TLatex *tb= new TLatex;
  tb->SetNDC(); 
  tb->SetTextAlign(12);
  tb->SetTextColor(1);
  tb->SetTextSize(0.040);
  
  TBox *RaaPtJPsiALICEForSys[12];
  for(int j=0;j<7;j++){
    RaaPtJPsiALICEForSys[j] = new TBox(PtALICEFor[j]-0.4,  RaaPtALICEFor[j]-RaaPtSystErrALICEFor[j], PtALICEFor[j]+0.4,  RaaPtALICEFor[j]+RaaPtSystErrALICEFor[j]);
  }
  
  for(int j=0;j<7;j++){
    RaaPtJPsiALICEForSys[j]->SetFillStyle(1001);
    RaaPtJPsiALICEForSys[j]->SetFillColor(kAzure-4);
    RaaPtJPsiALICEForSys[j]->SetLineColor(1);
  }
  
  TBox *ALICEGlobalSysJPsiPtFor;
  //ALICEGlobalSysJPsiPtFor = new TBox(7.2-0.2, 1 - 0.14, 7.2+0.2, 1 + 0.14);
  //ALICEGlobalSysJPsiPtFor = new TBox(18.424,0.858,19.165,1.137); // By Abd
  ALICEGlobalSysJPsiPtFor = new TBox(18.424,1.0-0.08,19.165,1.0+0.08); // By Abd
  ALICEGlobalSysJPsiPtFor->SetFillStyle(3001);
  ALICEGlobalSysJPsiPtFor->SetLineColor(4);
  ALICEGlobalSysJPsiPtFor->SetFillColor(4);
  
  grRaaPtALICEFor->Draw("sameP");
  for(int j=0;j<7;j++) RaaPtJPsiALICEForSys[j]->Draw("sameL"); 
  grRaaPtALICEFor->Draw("Psame");
  ALICEGlobalSysJPsiPtFor->Draw("sameL"); 
  legend_ratio->SetTextColor(4);
  //tb->DrawLatex(0.22,0.16,"J/#psi #rightarrow #mu^{+} #mu^{-}, p_{T}^{J/#psi} > 0.0 GeV/c");  
  //legend_ratio->AddEntry(grRaaPtALICEFor,"ALICE: J/#psi #rightarrow #mu^{+} #mu^{-}, 2.5 < |y| < 2.4 & p_{T}^{J/#psi} > 0.0 GeV/c", "P");  
  legend_ratio->AddEntry(grRaaPtALICEFor,"J/#psi ALICE: 2.5 < |y| < 2.4", "P");  
}
//////---------- channel: 0==muon dijet, 1== electron dijet
/////                     2==muon  boosted,   3== electron boosted
void makeATGCLimitDataCards(int channel) {

//   const Int_t bins = 8; 
//   const Float_t dm_min = 200.; 
//   const Float_t dm_max = 600.;

  Int_t bins = 7; 
  Float_t dm_min = 100.; 
  Float_t dm_max = 275.;
  if(channel>1) { bins = 15; dm_min = 200.; dm_max = 800; }

  Int_t binsmc = (int)(10*(dm_max - dm_min)); // units of 0.1GeV, set up for smearing post-binning!

  domu = true;
  if(channel==1 || channel==3) domu = false;

 
  TString outfile = (domu?TString("mu"):TString("el"))+ 
    (channel<2?TString("dijet"):TString("boosted"));
  TFile* outputForLimit = TFile::Open(outfile+".root", "recreate");


  TString cutsDijet("(W_pt<200.) && (dijetPt>70.) && (abs(JetPFCor_Eta[0])<2.4) && (abs(JetPFCor_Eta[1])<2.4) && (abs(JetPFCor_Eta[0]-JetPFCor_Eta[1])<1.5) &&(abs(JetPFCor_dphiMET[0])>0.4) &&(W_mt>30.) &&(JetPFCor_Pt[0]>40.) &&(JetPFCor_Pt[1]>35.) &&(JetPFCor_Pt[2]<30.) &&(JetPFCor_bDiscriminatorCSV[0]<0.244) &&(JetPFCor_bDiscriminatorCSV[1]<0.244) && (Mass2j_PFCor>70. && Mass2j_PFCor<100.)");



  // Do not put jet pt in the cut string here, since it is going to be smeared
  TString cutsMerged("(vbf_event==0) && (W_pt>200.) &&(abs(GroomedJet_CA8_eta[0])<2.4)&&(ggdboostedWevt==1) && (GroomedJet_CA8_deltaphi_METca8jet[0]>2.0) && (GroomedJet_CA8_deltaR_lca8jet[0]>1.57) && (numPFCorJetBTags<1) && (GroomedJet_CA8_tau2tau1[0]<0.55) && (GroomedJet_CA8_mass_pr[0]>70. && GroomedJet_CA8_mass_pr[0]<100.)");

  // && (GroomedJet_CA8_deltaR_lca8jet[1]<-900 || GroomedJet_CA8_deltaR_lca8jet[1]>7.0)

  TString        lepton_cut = "(event_met_pfmet >30) && (W_electron_pt>35.)";
  if(channel==0) lepton_cut = "(event_met_pfmet >25) &&(abs(W_muon_eta)<2.1) && (W_muon_pt>25.)";
  if(channel==1) lepton_cut = "(event_met_pfmet >30) && (W_electron_pt>30.)";
  if(channel==2) lepton_cut = "(event_met_pfmet >50) &&(abs(W_muon_eta)<2.1) && (W_muon_pt>30.)";
  if(channel==3) lepton_cut = "(event_met_pfmet >70) && (W_electron_pt>35.)";

  TString And = " && ";

  TString jet_cut = cutsDijet;
  TString jetptcut,mcjetptcut;

  if(channel>1) jet_cut = cutsMerged;

  char* observable = "dijetPt";
  char* mcobservable = "dijetPt";
  char* xtitle = "p_{T}^{jj} [GeV]"; 
  double jetptcutval;
  if(channel>1) {
    double jetthresh = 80;

    /*observable = 
      "(GroomedJet_CA8_pt[0]>jetthresh)+\
      (GroomedJet_CA8_pt[1]>jetthresh)+\
      (GroomedJet_CA8_pt[2]>jetthresh)+\
      (GroomedJet_CA8_pt[3]>jetthresh)+\
      (GroomedJet_CA8_pt[4]>jetthresh)+\
      (GroomedJet_CA8_pt[5]>jetthresh)";*/

    mcobservable = "GroomedJet_CA8_pt_smeared[0]";
    //mcobservable = "GroomedJet_CA8_pt[0]";
    observable = "GroomedJet_CA8_pt[0]";
    jetptcutval = 200.;
    jetptcut   = Form("(%s > %f)",  observable,jetptcutval);
    mcjetptcut = Form("(%s > %f)",mcobservable,jetptcutval);
    xtitle = "p_{T}^{j} [GeV]";
  }


  TCut mccut( TString("(effwt*puwt)*(")+ lepton_cut+And+jet_cut+And+mcjetptcut + TString(")") );
  TCut datacut( TString("(") + lepton_cut+And+jet_cut+And+jetptcut + TString(")") );
  //TCut the_cut( TString("(effwt*puwt)*(")+ lepton_cut+And+jet_cut+And+jetptcut + TString(")") );

  // for combining ttbar files
  TString mttstr
    ("sqrt((W_top_E+W_atop_E)^2 -(W_top_px+W_atop_px)^2 -(W_top_py+W_atop_py)^2 -(W_top_pz+W_atop_pz)^2)");

  // weight default sample by 1 for mtt<700, by half above for adding the high mtt samples
  TCut mttwt(TString("(")+mttstr+TString("<700)?1.0:0.5"));

  InstantiateTrees();


  //th1data  = new TH1D("th1data",  "th1data",  bins, ptbins_boosted); // bins, dm_min, dm_max);
  th1data  = new TH1D("th1data",  "th1data",  bins, dm_min, dm_max);
  th1data->Sumw2();
  th1data->SetMarkerStyle(20);
  th1data->SetMarkerSize(1.25);
  th1data->SetLineWidth(2);
  th1data->SetMinimum(0.0);

  TString drawstr = TString(observable)+TString(">>th1data");

  cout <<
    TString("treedata->Draw(\"")+drawstr+TString("\", \"")+
    TString((const char*)datacut)+TString("\", \"goff\")") << endl;

  treedata->Draw(drawstr, datacut, "goff");

  // ------- Get WW/WZ ------- 
  th1wwlo = new TH1D("th1wwlo", "th1wwlo", bins, dm_min, dm_max);
  th1wwhi = new TH1D("th1wwhi", "th1wwhi", bins, dm_min, dm_max);
  th1ww   = new TH1D("th1ww", "th1ww", bins, dm_min, dm_max);
  th1wzlo = new TH1D("th1wzlo", "th1wzlo", bins, dm_min, dm_max);
  th1wzhi = new TH1D("th1wzhi", "th1wzhi", bins, dm_min, dm_max);
  th1wz   = new TH1D("th1wz", "th1wz", bins, dm_min, dm_max);
  //th1wz = new TH1D("th1wz", "th1wz", bins, ptbins_boosted);
  th1wwlo->Sumw2();
  th1wwhi->Sumw2();
  th1wzlo->Sumw2();
  th1wzhi->Sumw2();
  th1wz->Sumw2();

  fillMChisto(th1wwlo,treewwlo,mcobservable,mccut);
  fillMChisto(th1wwhi,treewwhi,mcobservable,mccut);
  fillMChisto(th1wzlo,treewzlo,mcobservable,mccut);
  fillMChisto(th1wzhi,treewzhi,mcobservable,mccut);

  // ------- Get ttbar ------- 
  th1Top   = new TH1D("th1Top", "th1Top", bins, dm_min, dm_max);
  th1toplo = new TH1D("th1toplo", "th1toplo", bins, dm_min, dm_max);
  th1topmd = new TH1D("th1topmd", "th1topmd", bins, dm_min, dm_max);
  th1tophi = new TH1D("th1tophi", "th1tophi", bins, dm_min, dm_max);

  //th1Top = new TH1D("th1Top", "th1Top", bins, ptbins_boosted);
  th1Top->Sumw2();
  th1toplo->Sumw2();
  th1topmd->Sumw2();
  th1tophi->Sumw2();

  fillMChisto(th1toplo,treettblo,mcobservable,mttwt*mccut);
  fillMChisto(th1topmd,treettbmd,mcobservable,mccut);
  fillMChisto(th1tophi,treettbhi,mcobservable,mccut);

    // ------- Get WJets ------- 
  th1wjlo  = new TH1D("th1wjlo",  "th1wjlo",  bins, dm_min, dm_max);
  th1wjhi  = new TH1D("th1wjhi",  "th1wjhi",  bins, dm_min, dm_max);
  th1wjets = new TH1D("th1wjets", "th1wjets", bins, dm_min, dm_max);
  th1wjlo->Sumw2();
  th1wjhi->Sumw2();

  fillMChisto(th1wjlo,treewjlo,mcobservable,mccut);
  fillMChisto(th1wjhi,treewjhi,mcobservable,mccut);

  //th1wjets  = new TH1D("th1wjets",  "th1wjets", bins, ptbins_boosted);

  // ------- Get QCD ------- 
  //th1qcd = new TH1D("th1qcd", "th1qcd", bins, dm_min, dm_max);
  //th1qcd = new TH1D("th1qcd", "th1qcd", bins, ptbins_boosted);
  //th1qcd->Sumw2();
  //treeqcd->Draw(TString(observable)+TString(">>th1qcd"), mccut, "goff");

  // ------- Get Z+Jets ------- 
  //th1zjets = new TH1D("th1zjets", "th1zjets", bins, dm_min, dm_max);
  //th1zjets->Sumw2();
  //treezj->Draw(TString(observable)+TString(">>th1zjets"), mccut, "goff");


  // ------- Get Single top ------- 
  th1stops = new TH1D("th1stops", "th1stops", bins, dm_min, dm_max);
  th1stopt = new TH1D("th1stopt", "th1stopt", bins, dm_min, dm_max);
  th1stoptw = new TH1D("th1stoptw", "th1stoptw", bins, dm_min, dm_max);
  //th1stops = new TH1D("th1stops", "th1stops", bins, ptbins_boosted);
  //th1stopt = new TH1D("th1stopt", "th1stopt", bins, ptbins_boosted);
  //th1stoptw = new TH1D("th1stoptw", "th1stoptw", bins, ptbins_boosted);
  th1stops->Sumw2();
  th1stopt->Sumw2();
  th1stoptw->Sumw2();
  
  fillMChisto(th1stops,treests,mcobservable,mccut);
  fillMChisto(th1stopt,treestt,mcobservable,mccut);
  fillMChisto(th1stoptw,treestw,mcobservable,mccut);
 
  th1stopps = new TH1D("th1stopps", "th1stopps", bins, dm_min, dm_max);
  th1stoppt = new TH1D("th1stoppt", "th1stoppt", bins, dm_min, dm_max);
  th1stopptw = new TH1D("th1stopptw", "th1stopptw", bins, dm_min, dm_max);
  //th1stopps = new TH1D("th1stopps", "th1stopps", bins, ptbins_boosted);
  //th1stoppt = new TH1D("th1stoppt", "th1stoppt", bins, ptbins_boosted);
  //th1stopptw = new TH1D("th1stopptw", "th1stopptw", bins, ptbins_boosted);
  th1stopps->Sumw2();
  th1stoppt->Sumw2();
  th1stopptw->Sumw2();

  fillMChisto(th1stopps,tree64,mcobservable,mccut);
  fillMChisto(th1stoppt,tree65,mcobservable,mccut);
  fillMChisto(th1stopptw,tree66,mcobservable,mccut);

  // ---- Scale the histos ---- 
  ScaleHistos(channel);

#if 0    
  // ---- Make smooth diboson shape ----------
  TH1D* th1wvclone = (TH1D *)th1wv->Clone("th1wvclone");
  float tmin = 200.0;
  if(channel>1) tmin = 300.0;
  gaus2 = new TF1("gaus2","gaus", tmin, 1000000000.);
  th1wvclone->Fit(gaus2,"I0","");
#endif
    
  // ---- Empty histograms for display/plotting ---- 
  SetupEmptyHistogram(bins, dm_min, dm_max, xtitle);
  //SetupEmptyHistogram(bins, ptbins_boosted, xtitle);
  
  // ---- Sum all backgrounds ----------
  TH1D* th1wv_no_overflow = (TH1D *)th1wv->Clone("th1wv_no_overflow");
  SumAllBackgrounds();

#if 1
  // ---- Get signal histogram ----------
  TCut wwsigratio= GetSigRatioFunction(mcobservable);
  TCut wzsigratio= GetSigRatioFunction(mcobservable,"wz");
  
  TCut wwsigcut = mccut*wwsigratio;
  TCut wzsigcut = mccut*wzsigratio;
  
  wwatgc4Display = new TH1D("wwatgc4Display","wwatgc4Display",bins,dm_min,dm_max);
  wzatgc4Display = new TH1D("wzatgc4Display","wzatgc4Display",bins,dm_min,dm_max);
  //wwatgc4Display = new TH1D("wwatgc4Display","wwatgc4Display",bins,ptbins_boosted);
  
  drawstr = TString(mcobservable)+TString(">>wwatgc4Display");

  cout <<
    TString("wwtree->Draw(\"")+drawstr+TString("\", \"")+
    TString((const char*)wwsigcut)+TString("\", \"goff\")") << endl;

  TH1D *th1wwlosc = new TH1D("sigwwlo","sigwwlo",bins,dm_min,dm_max);
  TH1D *th1wwhisc = new TH1D("sigwwhi","sigwwhi",bins,dm_min,dm_max);
  TH1D *th1wzlosc = new TH1D("sigwzlo","sigwzlo",bins,dm_min,dm_max);
  TH1D *th1wzhisc = new TH1D("sigwzhi","sigwzhi",bins,dm_min,dm_max);

  fillMChisto(th1wwlosc,treewwlo,mcobservable,wwsigcut,false);
  fillMChisto(th1wwhisc,treewwhi,mcobservable,wwsigcut,false);
  fillMChisto(th1wzlosc,treewzlo,mcobservable,wzsigcut,false);
  fillMChisto(th1wzhisc,treewzhi,mcobservable,wzsigcut,false);

  th1wwlosc->Scale(WW_scale_lo);
  th1wwhisc->Scale(WW_scale_hi);

  th1wzlosc->Scale(WZ_scale_lo);
  th1wzhisc->Scale(WZ_scale_hi);

  // stitch the two histograms together into one, post-smearing.
  for (int ibin=1;ibin<=wwatgc4Display->GetNbinsX();ibin++) {
    if (wwatgc4Display->GetBinLowEdge(ibin)<stitchwwgev) {
      wwatgc4Display->SetBinContent(ibin,th1wwlosc->GetBinContent(ibin));
      wwatgc4Display->SetBinError  (ibin,th1wwlosc->GetBinError  (ibin));
    } else {
      wwatgc4Display->SetBinContent(ibin,th1wwhisc->GetBinContent(ibin));
      wwatgc4Display->SetBinError  (ibin,th1wwhisc->GetBinError  (ibin));
    }
  }

  wwatgc4Display->Scale(WW_scale_NLO * (domu ? intLUMIinvpb_mu : intLUMIinvpb_el));

  // stitch the two WZ histograms together into one, post-smearing.
  for (int ibin=0;ibin<=wzatgc4Display->GetNbinsX()+1;ibin++) {
    if (wzatgc4Display->GetBinLowEdge(ibin)<stitchwzgev) {
      wzatgc4Display->SetBinContent(ibin,th1wzlosc->GetBinContent(ibin));
      wzatgc4Display->SetBinError  (ibin,th1wzlosc->GetBinError  (ibin));
    } else {
      wzatgc4Display->SetBinContent(ibin,th1wzhisc->GetBinContent(ibin));
      wzatgc4Display->SetBinError  (ibin,th1wzhisc->GetBinError  (ibin));
    }
  }

  wzatgc4Display->Scale(WZ_scale_NLO * (domu ? intLUMIinvpb_mu : intLUMIinvpb_el));

  cout << "wwatgc4Display nentries = " << wwatgc4Display->GetEntries() << endl;

  // ----- need to subtract the diboson contribution 
  wwatgc4Display->SetLineWidth(2);
  wwatgc4Display->SetLineColor(1);
  wwatgc4Display->SetFillColor(0);

  // ----- need to subtract the diboson contribution 
  wzatgc4Display->SetLineWidth(2);
  wzatgc4Display->SetLineColor(1);
  wzatgc4Display->SetFillColor(0);
  wzatgc4Display->SetLineStyle(2);

  //-------- Add overflow bin ----------------
  AddOverflowBin(wwatgc4Display);
  AddOverflowBin(wzatgc4Display);
  
#endif

  // ---- Compose the stack ----------
  THStack* hs = new THStack("hs","MC contribution");
  //hs->Add(th1zjets); 
 //hs->Add(th1qcd);
  hs->Add(th1Top);
  hs->Add(th1wjets);
  hs->Add(th1wv);  // add WW in with backgrounds for display only
  hs->Add(wwatgc4Display);
  hs->Add(wzatgc4Display);



  // ---- Stack for shape systematics Up ----------
  double bkgd_norm_fracerror = domu ? mu_bkgd_norm_error : el_bkgd_norm_error;
  double sig_norm_fracerror = domu ? mu_sig_norm_error : el_sig_norm_error;

  cout << "Background normalization fractional systematic = " << bkgd_norm_fracerror << endl;
  cout << "Signal     normalization fractional systematic = " << sig_norm_fracerror << endl;

  //TF1* formScaleUp = new TF1("formScaleUp", "1.0+0.4*log(x/5)", dm_min, dm_max);
  //TF1* formScaleDn = new TF1("formScaleDn", "1.0-0.2*log(x/5)", dm_min, dm_max);
  TF1* formScaleUp = new TF1("formScaleUp", Form("1.0+%f",bkgd_norm_fracerror), dm_min, dm_max);
  TF1* formScaleDn = new TF1("formScaleDn", Form("1.0-%f",bkgd_norm_fracerror), dm_min, dm_max);

  systUp = (TH1D*) th1wjets->Clone("systUp");
  systUp->Multiply(formScaleUp);
  //systUp->Add(th1zjets);
  //systUp->Add(th1qcd);
  systUp->Add(th1Top);
  systUp->SetFillColor(0);
  systUp->SetLineStyle(2);
  systUp->SetLineColor(2);
  systUp->SetLineWidth(3);

  // ---- Stack for shape systematics Down ----------
  systDown = (TH1D*) th1wjets->Clone("systDown");
  systDown->Multiply(formScaleDn);
  //systDown->Add(th1zjets);
  //systDown->Add(th1qcd);
  systDown->Add(th1Top);
  systDown->SetFillColor(0);
  systDown->SetLineWidth(3);
  systDown->SetLineStyle(2);
  systDown->SetLineColor(2);

  /////////////////////////////////////////
  ///////////////////////////////////////////////////////////
  ///////////////////////////////////////////////////////////
  ///////////////////////////////////////////////////////////
  

  // ------- Setup the canvas ------- 
  gStyle->SetOptStat(0);
  gStyle->SetOptTitle(0);
  // gStyle->SetPadTopMargin(0.1);
  gStyle->SetPadLeftMargin(0.15);
  // gStyle->SetPadRightMargin(0.2);
  gStyle->SetPadBottomMargin(0.3);
  // gStyle->SetErrorX(0.5);

  TCanvas* c1 = new TCanvas("dijetPt", "", 10,10, 500, 500);

  TPad *d1, *d2;
  c1->Divide(1,2,0,0);
  d1 = (TPad*)c1->GetPad(1);
  d1->SetPad(0.01,0.30,0.95,0.99);
  d2 = (TPad*)c1->GetPad(2);
  d2->SetPad(0.01,0.02,0.95,0.30);
  d1->cd();

  gPad->SetBottomMargin(0.005);

  gPad->SetTopMargin(0.1);
  gPad->SetRightMargin(0.04);
  // gPad->SetLeftMargin(0.14);


  // Draw it all
  double ymax= 5000000.;
  double ymin= 7.0;
  if(channel>1) { 
    ymax= 3000.;
    ymin= 0.10;
  }

  th1totempty->GetYaxis()->SetRangeUser(ymin, ymax);
  th1data->GetYaxis()->SetRangeUser(ymin, ymax);
  th1totempty->Draw();
  hs->Draw("samehist");
  for (int i=1;i<=th1tot->GetNbinsX();i++)
    {
      double val = th1tot->GetBinContent(i); // / (ptbins_boosted[i]-ptbins_boosted[i-1]);
      double err = fabs(th1tot->GetBinError(i)); // / (ptbins_boosted[i]-ptbins_boosted[i-1]);
      TBox *b = new TBox(th1tot->GetBinLowEdge(i),
			 val-err,th1tot->GetBinLowEdge(i+1),val+err);
      b->SetLineColor(1);
      b->SetFillColor(1);
      b->SetFillStyle(3001);
      b->SetLineStyle(3001);	 
      b->Draw();
    }
  //data2draw->Draw("esame");

#ifndef BLINDED
  th1data->Draw("esame");
#endif

  cmspre(); 
  // Set up the legend
  TLegend* Leg = GetLegend(channel);   
  Leg->Draw();  
  gPad->SetLogy();
  gPad->RedrawAxis();

  d2->cd();
  gPad->SetTopMargin(0.02);
  gPad->SetRightMargin(0.04);
  gPad->SetFrameBorderSize(0);
  gPad->SetBottomMargin(0.45);
  gPad->SetTickx();

  th1emptyclone->Draw();
#ifndef BLINDED
  hhratio->Draw("esame");
  //hhratioUp->Draw("hist lsame");
  //hhratioDown->Draw("hist lsame");
#endif
  TLine *line; line = new TLine(dm_min,1.0,dm_max,1.0);
  line->SetLineStyle(1);
  line->SetLineWidth(1);
  line->SetLineColor(1);
  line->Draw();

  //gPad->WaitPrimitive();
  c1->Modified();
  c1->Update();

  c1->Print(TString("OutDir/")+outfile
#ifdef BLINDED
	    +TString("_fatjetPt_blinded.png")
#else
	    +TString("_fatjetPt_unblinded.png")
#endif
	    );

  c1->SaveAs(TString("OutDir/") + outfile
#ifdef BLINDED
	     +TString("_fatjetPt_blinded.pdf")
#else
	     +TString("_fatjetPt_unblinded.pdf")
#endif
	     );
  c1->SaveAs(TString("OutDir/") + outfile
#ifdef BLINDED
	     +TString("_fatjetPt_blinded.root")
#else
	     +TString("_fatjetPt_unblinded.root")
#endif
	     );
   

  ///// -------------------------------//////

  if(saveDataCards_) {
    outputForLimit->cd();
    th1data->SetName("data_obs");     th1data->Write("data_obs");
    th1tot->SetName("background");    th1tot->Write("background");
    th1ww->SetName("ww");             th1ww->Write("ww");
    th1ww->SetName("wz");             th1wz->Write("wz");
    th1wv->SetName("diboson");        th1wv->Write("diboson");

    th1wv_no_overflow->Write("th1wv_no_overflow");
    char* tempname = "background_backshapeUp";
    if(channel==0) tempname = "background_mudijet_backshapeUp";
    if(channel==1) tempname = "background_eldijet_backshapeUp";
    if(channel==2) tempname = "background_muboosted_backshapeUp";
    if(channel==3) tempname = "background_elboosted_backshapeUp";
    systUp->SetName(tempname);
    systUp->Write(tempname);
    tempname = "background_backshapeDown";
    if(channel==0) tempname = "background_mudijet_backshapeDown";
    if(channel==1) tempname = "background_eldijet_backshapeDown";
    if(channel==2) tempname = "background_muboosted_backshapeDown";
    if(channel==3) tempname = "background_elboosted_backshapeDown";
    systDown->SetName(tempname);
    systDown->Write(tempname);

    outputForLimit->Close();

  } ///// close if saveDataCards_

    //delete th1wvclone;
}
Example #28
0
void CorrPtCut(char *prodname = "LHC10d4 PYTHIA D6T 7 TeV p+p", char *shortprodname = "LHC10d4", char *filename="Et.ESD.new.sim.LHC10d4.pp.merged.root"){

  gStyle->SetOptTitle(0);
  gStyle->SetOptStat(0);
  gStyle->SetOptFit(0);
  TCanvas *c = new TCanvas("c","c",500,400);
  c->SetTopMargin(0.04);
  c->SetRightMargin(0.04);
  c->SetLeftMargin(0.181452);
  c->SetBottomMargin(0.134409);
  c->SetBorderSize(0);
  c->SetFillColor(0);
  c->SetFillColor(0);
  c->SetBorderMode(0);
  c->SetFrameFillColor(0);
  c->SetFrameBorderMode(0);
  float etacut = 0.7;
  cout<<"Pt cut = 150 MeV/c"<<endl;
  TH1D *High = GetHisto(0.15-.001,"High",filename,etacut);
  float tpcHigh=highbound;
  float tpcLow=lowbound;
  float tpcsyserr = syserr;
  float tpcmean = mean;
  float x1 = High->GetXaxis()->GetBinLowEdge(1);
  //TBox *tpcBox = new TBox(-x1*.99,1.0-tpcLow,x1*.99,1.0-tpcHigh);
  TBox *tpcBox = new TBox(-x1*.99,1.0-(mean-syserr),x1*.99,1.0-(mean+syserr));
  tpcBox->SetFillColor(5);
  tpcBox->SetLineColor(0);
  tpcBox->SetFillStyle(1001);
  cout<<"Pt cut = 100 MeV/c"<<endl;
  TH1D *Low = GetHisto(0.1-.001,"Low",filename,etacut);
  float itsHigh=highbound;
  float itsLow=lowbound;
  float itssyserr = syserr;
  float itsmean = mean;

  cout<<Form("dataset & %2.4f \\pm %2.4f &  %2.4f \\pm %2.4f \\",itsmean,itssyserr,tpcmean,tpcsyserr)<<endl;
  float x = Low->GetXaxis()->GetBinLowEdge(1);
  //TBox *itsBox = new TBox(-x*.99,1.0-itsLow,x*.99,1.0-itsHigh);
  TBox *itsBox = new TBox(-x1*.99,1.0-(mean-syserr),x1*.99,1.0-(mean+syserr));
  itsBox->SetFillColor(5);
  itsBox->SetLineColor(0);
  itsBox->SetFillStyle(1001);
  cout<<"Pt cut = 50 MeV/c"<<endl;
  TH1D *Lowest = GetHisto(0.05-.001,"Lowest",filename,etacut);
  TF1 *funcLow = new TF1("funcLow","[0]",-.7,.7);
  funcLow->SetParameter(0,0.01);
  Low->Fit(funcLow);
  TF1 *funcHigh = new TF1("funcHigh","[0]",-.7,.7);
  funcHigh->SetParameter(0,0.02);
  High->Fit(funcLow);
  High->SetMaximum(0.06);
  High->SetMinimum(0.0);
  High->SetMarkerColor(2);
  Low->SetMarkerColor(4);
  High->SetLineColor(2);
  Low->SetLineColor(4);
  High->SetMinimum(0.0);
  High->SetMarkerStyle(20);
  Low->SetMarkerStyle(21);
  Lowest->SetMarkerStyle(22);
  High->Draw();
  tpcBox->Draw("f");
  High->Draw("same");
  itsBox->Draw("f");
  //return;
  Low->Draw("same");
  //Lowest->Draw("same");
  TLatex *tex = new TLatex(-0.723444,0.0373593+0.019,prodname);
  tex->SetTextSize(0.0537634);
  tex->Draw();
  TLegend *leg = new TLegend(0.217742,0.696237,0.477823,0.873656);
  leg->AddEntry(High,"p_{T} cut-off = 0.15 GeV/c");
  leg->AddEntry(Low,"p_{T} cut-off = 0.1 GeV/c");
  //leg->AddEntry(Lowest,"p_{T} cut-off = 0.05 GeV/c");
  leg->SetFillStyle(0);
  leg->SetFillColor(0);
  leg->SetBorderSize(0);
  leg->SetTextSize(0.0537634);
  leg->Draw();
  c->SaveAs(Form("pics/%s/fptcut.eps",shortprodname));
  c->SaveAs(Form("pics/%s/fptcut.png",shortprodname));
  c->SaveAs(Form("pics/%s/fptcut.pdf",shortprodname));
}
void raaTheoryOpen_pt(const char* inputDir = "../macro_raa/outRoot", // the place where the input root files, with the histograms are
                     bool bSavePlots      = true,
                     bool bDoBRaa  = true
                     )
{
   // set the style
  gSystem->mkdir(Form("./figs/png"), kTRUE);
  gSystem->mkdir(Form("./figs/pdf"), kTRUE);
  setTDRStyle();
  
  // read CMS graphs
  TFile *pgRaaCms_pt   = new TFile(Form("%s/makeRaa_pt.root",inputDir));
  // ##################### HIGH PT ############################
  TGraphErrors *pgCms     = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsi");
  TGraphErrors *pgCmsP    = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsiP");
  TGraphErrors *pgCmsSyst = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsiSyst");
  pgCmsSyst->SetFillColorAlpha(kOrange-9,0.5);
  pgCms->SetName("gNonPrJpsi");

  TBox *lumi = (TBox*)pgRaaCms_pt->Get("lumi");
  lumi->SetFillColor(kGray+1);
  lumi->SetFillStyle(1001);
  lumi->SetX1(28.5); lumi->SetX2(30);

  // ##################### LOW PT ############################
  TGraphErrors *pgCms_lowpt     = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsi_pt365y1624");
  TGraphErrors *pgCmsP_lowpt    = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsiP_pt365y1624");
  TGraphErrors *pgCmsSyst_lowpt = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsiSyst_pt365y1624");
  pgCmsSyst_lowpt->SetFillColorAlpha(kViolet-9,0.5);
  pgCms_lowpt->SetName("gNonPrJpsi_pt365y1624");

   
  //-------------------------------------------------------------------- 
  // *********** Theory curves with filled area
  TGraph *pgRaaB_rapp       = new TGraph(2*raaB_rapp_vspt_numpoints);
  pgRaaB_rapp->SetName("pgRaaB_rapp");
  for (int i=0; i<raaB_rapp_vspt_numpoints; i++) {
    pgRaaB_rapp->SetPoint(i,raaB_rapp_pt[i],raaB_rapp_vspt_yhigh[i]);
    pgRaaB_rapp->SetPoint(raaB_rapp_vspt_numpoints+i,
        raaB_rapp_pt[raaB_rapp_vspt_numpoints-i-1],raaB_rapp_vspt_ylow[raaB_rapp_vspt_numpoints-i-1]);
  }

  TGraph *pgRaaB_whdg       = new TGraph(2*raaB_whdg_vspt_numpoints);
  pgRaaB_whdg->SetName("pgRaaB_whdg");
  for (int i=0; i<raaB_whdg_vspt_numpoints; i++) {
    pgRaaB_whdg->SetPoint(i,raaB_whdg_pt[i],raaB_whdg_vspt_yhigh[i]);
    pgRaaB_whdg->SetPoint(raaB_whdg_vspt_numpoints+i,
        raaB_whdg_pt[raaB_whdg_vspt_numpoints-i-1],raaB_whdg_vspt_ylow[raaB_whdg_vspt_numpoints-i-1]);
  }

  TGraph *pgRaaNPJpsi_vitev       = new TGraph(2*raaNPJpsi_vitev_vspt_numpoints);
  pgRaaNPJpsi_vitev->SetName("pgRaaNPJpsi_vitev");
  for (int i=0; i<raaNPJpsi_vitev_vspt_numpoints; i++) {
    pgRaaNPJpsi_vitev->SetPoint(i,raaNPJpsi_vitev_pt[i],raaNPJpsi_vitev_vspt_yhigh[i]);
    pgRaaNPJpsi_vitev->SetPoint(raaNPJpsi_vitev_vspt_numpoints+i,
        raaNPJpsi_vitev_pt[raaNPJpsi_vitev_vspt_numpoints-i-1],raaNPJpsi_vitev_vspt_ylow[raaNPJpsi_vitev_vspt_numpoints-i-1]);
  }

  TGraph *pgRaaNPJpsi_vitev_noDissoc = new TGraph(2*raaNPJpsi_vitev_vspt_noDissoc_numpoints);
  pgRaaNPJpsi_vitev_noDissoc->SetName("pgRaaNPJpsi_vitev_noDissoc");
  for (int i=0; i<raaNPJpsi_vitev_vspt_noDissoc_numpoints; i++) {
    pgRaaNPJpsi_vitev_noDissoc->SetPoint(i,raaNPJpsi_vitev_noDissoc_pt[i],raaNPJpsi_vitev_vspt_noDissoc_yhigh[i]);
    pgRaaNPJpsi_vitev_noDissoc->SetPoint(raaNPJpsi_vitev_vspt_noDissoc_numpoints+i,
        raaNPJpsi_vitev_noDissoc_pt[raaNPJpsi_vitev_vspt_noDissoc_numpoints-i-1],raaNPJpsi_vitev_vspt_noDissoc_ylow[raaNPJpsi_vitev_vspt_noDissoc_numpoints-i-1]);
  }

  // *********** Theory curves with line
  TGraph *pgRaaNPJpsi_mcatshq     = new TGraph(raaNPJpsi_mcatshq_vspt_numpoints,raaNPJpsi_mcatshq_pt,raaNPJpsi_mcatshq_vspt);
  pgRaaNPJpsi_mcatshq->SetName("pgRaaNPJpsi_mcatshq");
  TGraph *pgRaaNPJpsi_mcatshq_rad = new TGraph(raaNPJpsi_mcatshq_rad_vspt_numpoints,raaNPJpsi_mcatshq_rad_pt,raaNPJpsi_mcatshq_rad_vspt);
  pgRaaNPJpsi_mcatshq_rad->SetName("pgRaaNPJpsi_mcatshq_rad");
  TGraph *pgRaaNPJpsi_bamps       = new TGraph(raaNPJpsi_bamps_vspt_numpoints,raaNPJpsi_bamps_pt,raaNPJpsi_bamps_vspt_yval);
  pgRaaNPJpsi_bamps->SetName("pgRaaNPJpsi_bamps");

  // Style for filled graphs
  pgRaaB_rapp->SetFillColor(kRed-7);
  pgRaaB_rapp->SetFillStyle(1001);
  pgRaaB_whdg->SetFillColor(kOrange);
  pgRaaB_whdg->SetFillStyle(1001);

  pgRaaNPJpsi_vitev->SetFillColor(kAzure+1);
  pgRaaNPJpsi_vitev->SetFillStyle(1001);
  pgRaaNPJpsi_vitev_noDissoc->SetFillColor(kAzure-9);
  pgRaaNPJpsi_vitev_noDissoc->SetFillStyle(1001);

  // Style for line graphs
  pgRaaNPJpsi_mcatshq->SetLineColor(kTeal+4);
  pgRaaNPJpsi_mcatshq_rad->SetLineColor(kTeal+3);
  pgRaaNPJpsi_bamps->SetLineColor(kRed+1);
  
//  pgRaaNPJpsi_mcatshq->SetLineStyle(3);
//  pgRaaNPJpsi_mcatshq_rad->SetLineStyle(3);
//  pgRaaNPJpsi_bamps->SetLineStyle(3);
  
  pgRaaNPJpsi_mcatshq->SetLineWidth(4);
  pgRaaNPJpsi_mcatshq_rad->SetLineWidth(4);
  pgRaaNPJpsi_bamps->SetLineWidth(3);


  //---------------------------------------------------------
  TLine *line = new TLine(0.,1,30,1);
  line->SetLineStyle(1);
  line->SetLineWidth(1);

  TCanvas *pc = new TCanvas("pc","pc");

  TF1 *f4 = new TF1("f4","1",0,30);
  f4->SetLineWidth(1);
  f4->GetXaxis()->SetTitle("p_{T} (GeV/c)");
  f4->GetYaxis()->SetTitle("R_{AA}");
  f4->GetYaxis()->SetRangeUser(0.0,1.5);
  f4->GetXaxis()->CenterTitle(kTRUE);
 
  f4->Draw();
  lumi->Draw();
  pc->Update();
  
  pgCmsSyst->Draw("2"); // for drawing x-axis
  if(bDoBRaa)
  {
    pgRaaB_whdg->Draw("f");
  }
  pgRaaNPJpsi_vitev->Draw("f");
  pgRaaNPJpsi_vitev_noDissoc->Draw("f");
  if(bDoBRaa)
  {
    pgRaaB_rapp->Draw("f");
  }
  pgRaaNPJpsi_mcatshq->Draw("l");
  pgRaaNPJpsi_mcatshq_rad->Draw("l");
  pgRaaNPJpsi_bamps->Draw("l");

  pgCmsSyst->Draw("2");
  pgCmsP->Draw("P");
  pgCms->Draw("P");
  pgCmsSyst_lowpt->Draw("2");
  pgCmsP_lowpt->Draw("P");
  pgCms_lowpt->Draw("P");

  // additional info
  CMS_lumi(pc,12003000,0);

  TLegend *leg_cent = new TLegend(0.59,0.50,0.89,0.64,NULL,"brNDC");
//  TLegend *leg_cent = new TLegend(0.29,0.81,0.83,0.89,NULL,"brNDC"); // at top center
  leg_cent->SetMargin(0.17);
  leg_cent->SetBorderSize(0);
  leg_cent->SetTextFont(132);
  leg_cent->SetTextSize(0.03);
  leg_cent->SetLineColor(1);
  leg_cent->SetLineStyle(1);
  leg_cent->SetLineWidth(1);
  leg_cent->SetFillColor(19);
  leg_cent->SetFillStyle(0);

  TLegendEntry *entry_cent;
  entry_cent=leg_cent->AddEntry("raab","Nonprompt J/#psi","");
  entry_cent->SetTextFont(132);
  entry_cent->SetTextSize(ltxSetTextSize3);
  entry_cent=leg_cent->AddEntry("gNonPrJpsi_pt365y1624", "1.6 < |y| < 2.4","p");
//  entry_cent->SetTextColor(kViolet+2);
  entry_cent->SetTextFont(42);
  entry_cent->SetTextSize(entrySize);
  entry_cent=leg_cent->AddEntry("gNonPrJpsi", "|y| < 2.4","p");
//  entry_cent->SetTextColor(kOrange+2);
  entry_cent->SetTextFont(42);
  entry_cent->SetTextSize(entrySize);

  TLegend *leg_theory_cent = new TLegend(0.285,0.681,0.83,0.881,NULL,"brNDC");
//  TLegend *leg_theory_cent = new TLegend(0.29,0.61,0.83,0.81,NULL,"brNDC");
  leg_theory_cent->SetMargin(0.1);
  leg_theory_cent->SetBorderSize(0);
  leg_theory_cent->SetTextFont(62);
  leg_theory_cent->SetTextSize(0.027);
  leg_theory_cent->SetLineColor(1);
  leg_theory_cent->SetLineStyle(1);
  leg_theory_cent->SetLineWidth(1);
  leg_theory_cent->SetFillColor(10);
  leg_theory_cent->SetFillStyle(1001);
  
  TLegendEntry *entry_theory_cent;
  entry_theory_cent=leg_theory_cent->AddEntry("pgRaaNPJpsi_mcatshq_rad","MC@sHQ+EPOS+rad+LPM: standard (0-100%, |y| < 1)","l");
  entry_theory_cent->SetTextFont(42);
  entry_theory_cent=leg_theory_cent->AddEntry("pgRaaNPJpsi_mcatshq","MC@sHQ+EPOS: standard (0-100%, |y| < 1)","l");
  entry_theory_cent->SetTextFont(42);
  entry_theory_cent=leg_theory_cent->AddEntry("pgRaaNPJpsi_bamps","BAMPS: b=5 fm (|y| < 2.4)","l");
  entry_theory_cent->SetTextFont(42);
  entry_theory_cent=leg_theory_cent->AddEntry("pgRaaNPJpsi_vitev","Vitev: Rad E loss+CNM+Dissoc (0-10%, y~0)","f");
  entry_theory_cent->SetTextFont(42);
  entry_theory_cent=leg_theory_cent->AddEntry("pgRaaNPJpsi_vitev_noDissoc","Vitev: Rad E loss+CNM (0-10%, y~0)","f");
  entry_theory_cent->SetTextFont(42);
  if(bDoBRaa)
  {
    entry_theory_cent=leg_theory_cent->AddEntry("pgRaaB_rapp","He,Fries,Rapp: HF transport (0-90%, y~0)","f");
    entry_theory_cent->SetTextFont(42);
    entry_theory_cent=leg_theory_cent->AddEntry("pgRaaB_whdg","WHDG: Rad+Coll E loss (0-80%, y~0)","f");
    entry_theory_cent->SetTextFont(42);
  }

  TLatex *lat = new TLatex();
  lat->SetNDC();
  lat->SetTextFont(42);
  lat->SetTextSize(ltxSetTextSize2);
  lat->DrawLatex(0.2,0.17,"Cent. 0-100%");

  line->Draw();
  leg_cent->Draw();
  leg_theory_cent->Draw();
  gPad->RedrawAxis();
  if(bSavePlots)
  {
    pc->SaveAs(Form("figs/pdf/raaTheoryOpen_pt_withB%d.pdf",bDoBRaa));
    pc->SaveAs(Form("figs/png/raaTheoryOpen_pt_withB%d.png",bDoBRaa));
  }
}
Example #30
0
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;
}