Ejemplo n.º 1
0
void myPlot(vector< TH1D*> h_Z,
           vector< TH1D*> v_data,
	    TH1D* h_data, TH1D* h_bkg,int option=0){

  h_data->Reset();
  for(unsigned int i=0;i<v_data.size();i++)h_data->Add(v_data[i]);
  
  TLegend *leg = new TLegend(0.84, 0.68, 0.92, 0.87);
  
  leg->SetBorderSize(0);
  leg->SetFillColor(0);
  leg->SetFillStyle(0);
  leg->SetTextSize(0.04);

   h_bkg->Reset();
    THStack *h_stack = new THStack("h_stack", "");
  for(unsigned int i=0;i<h_Z.size();i++){
	  h_Z[i]->SetFillColor(97-4*i);
	  h_Z[i]->SetLineColor(kBlack);
	  h_bkg->Add(h_Z[i]);
	   h_stack->Add(h_Z[i]);
	  
  }
   
   
   if(option==1){
	   leg->Clear();
	   leg->AddEntry(h_Z[3], "udsg", "f");
	leg->AddEntry(h_Z[2], "cc,c", "f");
	leg->AddEntry(h_Z[1], "b", "f");
	leg->AddEntry(h_Z[0], "bb", "f");
	}
	else{
		leg->AddEntry(h_Z[0], "QCD700", "f");
   leg->AddEntry(h_Z[1], "QCD1000", "f");
   leg->AddEntry(h_Z[2], "QCD1500", "f");
   leg->AddEntry(h_Z[3], "QCD2000", "f");
	}
  /*
leg->AddEntry(h_Zjets, "Z+Jets", "f");
  leg->AddEntry(h_TT, "t#bar{t}", "f");
  leg->AddEntry(h_WW, "WW", "f");
  leg->AddEntry(h_WZ, "WZ", "f");
  leg->AddEntry(h_ZZ, "ZZ", "f");
  leg->AddEntry(h_ZH, "ZH", "f");
*/

  h_data->SetLineColor(kBlack);
  h_data->SetMarkerStyle(8);
  h_data->SetMarkerSize(1.5);
  h_data->GetYaxis()->SetTitleOffset(1.3);
  h_data->GetXaxis()->SetTitle("");
  h_data->GetXaxis()->SetLabelOffset(999);
  h_data->GetXaxis()->SetLabelSize(0);
  
  int bmin=0,bmax=0;

		for (int k=1;k<25001;k++){
			bmin=k;
			if (h_data->GetBinContent(k)/h_data->GetMaximum()>0.02) break;
	}

		for (int k=25000;k>0;k--){
			bmax=k;
			if (h_data->GetBinContent(k)/h_data->GetMaximum()>0.02) break;
	}
	double width=h_data->GetBinWidth(1);
	rangeUserUp=(bmax-0.5)*width+h_data->GetBinCenter(1);
	rangeUserDown=(bmin-0.5)*width+h_data->GetBinCenter(1);
	if(isSetRange)h_data->GetXaxis()->SetRangeUser(rangeUserDown,rangeUserUp);
	//if(isSetRange)h_stack->GetXaxis()->SetRangeUser(rangeUserDown,rangeUserUp);
	//h_stack->GetXaxis()->SetRangeUser((bmin-0.5)*width+h_data->GetBinCenter(1),(bmax-0.5)*width+h_data->GetBinCenter(1));

  if( h_data->GetMaximum() < h_stack->GetMaximum() && isSetRange==0 ){
	  h_stack->SetTitle(h_data->GetTitle());
	h_stack->SetMaximum(h_data->GetMaximum()*1.3);
    h_stack->Draw("histe");
   // h_stack->GetHistogram()->GetYaxis()->SetTitle("Event Numbers");
    h_stack->GetHistogram()->GetYaxis()->SetTitle("");
    h_stack->GetHistogram()->GetYaxis()->SetTitleSize(h_data->GetYaxis()->GetTitleSize());
    h_stack->GetHistogram()->GetYaxis()->SetLabelSize(h_data->GetYaxis()->GetLabelSize());
    h_stack->GetHistogram()->GetYaxis()->SetTitleOffset(1.3);
    h_stack->GetHistogram()->GetXaxis()->SetTickLength(0);
    h_stack->GetHistogram()->GetXaxis()->SetLabelOffset(999);
    h_data->Draw("elsame");
  
  }
    
  else{

   // h_data->GetYaxis()->SetTitle("Event Numbers");
    h_data->GetYaxis()->SetTitle("");
    h_data->Draw("el");
    h_stack->Draw("histesame");
    h_data->Draw("elsame");

  }

    
  
  leg->AddEntry(h_data, "Data", "lp");
  leg->Draw();

  TLatex *lar = new TLatex();

  lar->SetNDC(kTRUE);
  lar->SetTextSize(0.04);
  lar->SetLineWidth(5);
  //lar->DrawLatex(0.14, 0.94, "CMS #it{#bf{2015}}");
  lar->DrawLatex(0.60, 0.94, "L = 12.9 fb^{-1} at #sqrt{s} = 13 TeV");
  
  

		lar->SetNDC(kTRUE);
		lar->SetTextSize(0.07);
		lar->SetLineWidth(5);
		lar->SetTextAlign(14);
		//lar->DrawLatex(0.14, 0.94, "CMS #it{#bf{2015}}");
		
		
		TLatex *lar2 = new TLatex();

		lar2->SetNDC(kTRUE);
		lar2->SetTextSize(0.04);
		lar2->SetLineWidth(5);
		lar2->SetTextAlign(12);
		lar->DrawLatex(0.14, 0.94, "CMS");
		lar2->DrawLatex(0.25, 0.94, "#it{#bf{Preliminary}} ");

}
Ejemplo n.º 2
0
void IdealFitMacroPlot()
{
    TF1 *pTF1_EvenSet9 = (TF1*)(GetFunction(0.0875, 2.41, 5.1, 12.79)->Clone());
    TF1 *pTF1_EvenSet10 = (TF1*)(GetFunction(0.0769, 2.58, 7.5, 8.02)->Clone());
    TF1 *pTF1_EvenSet12 = (TF1*)(GetFunction(0.0725, 2.87, 12.1, 7.86)->Clone());
    TF1 *pTF1_EvenSet13 = (TF1*)(GetFunction(0.0708, 2.69, 16.2, 6.65)->Clone());
    TF1 *pTF1_EvenSet14 = (TF1*)(GetFunction(0.0748, 2.57, 16, 9.89)->Clone());
    TF1 *pTF1_EvenSet15 = (TF1*)(GetFunction(0.0856, 2.34, 5.1, 12.51)->Clone());
    TF1 *pTF1_EvenSet16 = (TF1*)(GetFunction(0.0746, 2.32, 13.7, 6.65)->Clone());

    TF1 *pTF1_OddSet9 = (TF1*)(GetFunction(0.0834, 1.72, 61.0, 0.25)->Clone());
    TF1 *pTF1_OddSet10 = (TF1*)(GetFunction(0.0759, 1.63, 43.2, 0.10)->Clone());
    TF1 *pTF1_OddSet12 = (TF1*)(GetFunction(0.0731, 1.92, 51.5, 0.36)->Clone());
    TF1 *pTF1_OddSet13 = (TF1*)(GetFunction(0.0713, 1.72, 52.5, 0.18)->Clone());
    TF1 *pTF1_OddSet14 = (TF1*)(GetFunction(0.0754, 1.68, 57.3, 0.16)->Clone());
    TF1 *pTF1_OddSet15 = (TF1*)(GetFunction(0.0836, 1.52, 52.7, 0.42)->Clone());
    TF1 *pTF1_OddSet16 = (TF1*)(GetFunction(0.0727, 1.49, 50.7, 0.10)->Clone());

    pTF1_EvenSet9->SetLineColor(kGreen+2);
    pTF1_EvenSet10->SetLineColor(kRed);
    pTF1_EvenSet12->SetLineColor(kMagenta);
    pTF1_EvenSet13->SetLineColor(kBlue);
//    pTF1_EvenSet14->SetLineColor();
    pTF1_EvenSet15->SetLineColor(kCyan);
    pTF1_EvenSet16->SetLineColor(kBlack);

    pTF1_OddSet9->SetLineColor(kGreen+2);
    pTF1_OddSet9->SetLineStyle(2);
    pTF1_OddSet10->SetLineColor(kRed);
    pTF1_OddSet10->SetLineStyle(2);
    pTF1_OddSet12->SetLineColor(kMagenta);
    pTF1_OddSet12->SetLineStyle(2);
    pTF1_OddSet13->SetLineColor(kBlue);
    pTF1_OddSet13->SetLineStyle(2);
//    pTF1_OddSet14->SetLineColor(6);
//    pTF1_OddSet14->SetLineStyle(2);
    pTF1_OddSet15->SetLineColor(kCyan);
    pTF1_OddSet15->SetLineStyle(2);
    pTF1_OddSet16->SetLineColor(kBlack);
    pTF1_OddSet16->SetLineStyle(2);

    TCanvas *pTCanvas = new TCanvas("Name", "",0,0,3000,2500);
    pTCanvas->SetRightMargin(0.35);
    pTCanvas->SetBottomMargin(0.15);
    pTCanvas->Draw();

    TLegend *pTLegend = new TLegend(0.7,0.1,0.95,0.9); 
    pTLegend->SetTextSize(0.05);
    pTLegend->AddEntry(pTF1_EvenSet9, "Set 9, Centred", "l");
    pTLegend->AddEntry(pTF1_EvenSet10, "Set 10, 1/4 Offset", "l");
    pTLegend->AddEntry(pTF1_EvenSet12, "Set 12, Centred", "l");
    pTLegend->AddEntry(pTF1_EvenSet13, "Set 13, Centred", "l");
//    pTLegend->AddEntry(pTF1_EvenSet14, "Set 14, 1/2 Offset", "l");
    pTLegend->AddEntry(pTF1_EvenSet15, "Set 15, Centred", "l");
    pTLegend->AddEntry(pTF1_EvenSet16, "Set 16, 1/2 Offset", "l");

    TLegend *pTLegend2 = new TLegend(0.15,0.65,0.4,0.85); 
    pTLegend2->SetTextSize(0.05);
    pTLegend2->AddEntry(pTF1_EvenSet16, "Even Columns", "l");
    pTLegend2->AddEntry(pTF1_OddSet16, "Odd Columns", "l");

    TH2F *pAxes = new TH2F("Axes","",180,0,180,200,0,20);
    pAxes->Draw();
    pAxes->GetXaxis()->SetRangeUser(0,200);
    pAxes->GetXaxis()->SetTitle("Pulse Height [mV]");
    pAxes->GetXaxis()->SetLabelSize(0.05);
    pAxes->GetXaxis()->SetTitleSize(0.05);
    pAxes->GetYaxis()->SetRangeUser(0,20);
    pAxes->GetYaxis()->SetTitle("ToT");
    pAxes->GetYaxis()->SetTitleSize(0.05);
    pAxes->GetYaxis()->SetLabelSize(0.05);
    pTF1_EvenSet9->Draw("same");
    pTF1_EvenSet10->Draw("same");
    pTF1_EvenSet12->Draw("same");
    pTF1_EvenSet13->Draw("same");
//    pTF1_EvenSet14->Draw("same");
    pTF1_EvenSet15->Draw("same");
    pTF1_EvenSet16->Draw("same");
    pTF1_OddSet9->Draw("same");
    pTF1_OddSet10->Draw("same");
    pTF1_OddSet12->Draw("same");
    pTF1_OddSet13->Draw("same");
//    pTF1_OddSet14->Draw("same");
    pTF1_OddSet15->Draw("same");
    pTF1_OddSet16->Draw("same");
    pTLegend->Draw();
    pTLegend2->Draw();
    pTCanvas->SaveAs("AverageToT_vs_InjectedPulseHeight.pdf");
    pTCanvas->SaveAs("AverageToT_vs_InjectedPulseHeight.C");
}
Ejemplo n.º 3
0
// option = 1 (muon-pt), option = 2 (transverse mass)
void doPlots(int option)
{
  //gStyle->SetFillColor(1);

  // interested in plot made after all cuts have been applied
  string final_histo_desc;
  if(analysis_channel == 1)
    final_histo_desc = mumet_cuts_desc_short[Num_mumet_cuts-1];
  else if(analysis_channel == 2)
    final_histo_desc = elmet_cuts_desc_short[Num_elmet_cuts-1];

  string prefix = "";
  if(option == 1 && analysis_channel == 1)
    prefix = "hPT";
  if(option == 1 && analysis_channel == 2)
    prefix = "hET";
  else if(option == 2)
    prefix = "hTM";
 
  TH1F ** bgdSamples = 0;
  const string * bgdNames = 0;
  unsigned NbgdSamples = 0;

  if(analysis_channel == 1)
    {
      bgdSamples = &bgdMuMET[0];
      bgdNames = &bgdNamesMuMET[0];
      NbgdSamples = NbgdSamplesMuMET;
    }
  else if(analysis_channel == 2)
    {
      bgdSamples = &bgdElMET[0];
      bgdNames = &bgdNamesElMET[0];
      NbgdSamples = NbgdSamplesElMET;
    }

  string histo = prefix + algo + "_" + final_histo_desc;  
  for(unsigned i = 0; i != NbgdSamples; ++i)
    {
      string histo_i = bgdNames[i] + "/" + histo;
      bgdSamples[i] = (TH1F* ) _file0->Get(histo_i.c_str());
      if(badHisto(bgdSamples[i], histo_i))
	return;
    }

  string mass = "1.5";//W' mass

  string histo_wp = "wprime" + mass + "/" + histo;
  TH1F * wp = (TH1F* )_file0->Get(histo_wp.c_str());
  if(badHisto(wp, "wprime" + mass))
    return;

  string histo_wp_noint = "wprime" + mass + "_noint/" + histo;
  TH1F * wp_noint = (TH1F* )_file0->Get(histo_wp_noint.c_str());
  if(badHisto(wp_noint, "wprime" + mass + "_noint"))
    return;

  string histo_wp_oppsign = "wprime" + mass + "_oppsign/" + histo;
  TH1F * wp_oppsign = (TH1F* )_file0->Get(histo_wp_oppsign.c_str());
  if(badHisto(wp_oppsign, "wprime" + mass + "_oppsign"))
    return;

  string histo_wp_samesign = "wprime" + mass + "_samesign/" + histo;
  TH1F * wp_samesign = (TH1F* )_file0->Get(histo_wp_samesign.c_str());
  if(badHisto(wp_samesign, "wprime" + mass + "_samesign"))
    return;

  string hname = "tot_bgd";
  double xmin = -1; double xmax = -1; 
  double xmax_ratio = -1; double xmax_cumu = -1;
  string title = "INVALID";
  string var_plotted = "INVALID2";
  char data_ipb[1024]; sprintf(data_ipb, " data (%4.1f pb^{-1})", Lumi_ipb);
  char lumi_value[1024]; sprintf(lumi_value, "%4.1fipb", Lumi_ipb);
  char lumi_value2[1024]; sprintf(lumi_value2, "%4.1f pb^{-1}", Lumi_ipb);
  string cms_prelim = "CMS Preliminary 2011"; 
  char lumi_sqrts_[1024]; 
  sprintf(lumi_sqrts_, "L_{int} = %4.1f pb^{-1}, #sqrt{s} = 7 TeV", Lumi_ipb);
  string lumi_sqrts = lumi_sqrts_;
  float x_offset = 0;

  int Nbins = bgdSamples[0]->GetNbinsX();

  if(option == 1)
    {
      hname += "_mupt";
      desc = " p_{T} distribution";
      xmin = 150; xmax = 1200; 
      title = "Muon p_{T} (GeV/c)";
      var_plotted = "MuPt";
      x_offset = -100;
    }
  else if(option == 2)
    {
      hname += "_TM";
      string desc0 = "";
      if(analysis_channel == 1)
	desc0 = "#mu";
      else if(analysis_channel == 2)
	desc0 = "e";
      desc = desc0 + "&ME_{T} transverse mass: 2011 data (" 
	+ string(lumi_value2) + ")";
      xmin = 200; xmax = 2000; 
      title = "M_{T} (GeV/c^{2})";
      var_plotted = "TM";
    }
  string file = var_plotted + "_" + lumi_value + ".gif";

  // ============== CREATE DISTRIBUTIONS HERE ======================
  // this is the total background distribution (W + QCD + top + Z/DY)
  TH1F * bgd = new TH1F(hname.c_str(), desc.c_str(), 
			Nbins, bgdSamples[0]->GetXaxis()->GetXmin(), 
			bgdSamples[0]->GetXaxis()->GetXmax());
  TH1F * bgd_output = new TH1F("MT_bgd","MT_bgd",nbins_output,xmin_output,xmax_output);
  THStack *hsbgd =new THStack(hname.c_str(),desc.c_str());//+++++++++
  for(unsigned i = 0; i != NbgdSamples; ++i){
    //for(int i = NbgdSamples - 1; i != -1; i--){
    if(analysis_channel == 2){
      //  1, 2-4, 5-7, 8-10,11-12,13-15,16-
      if(i<1){bgdClr=bgdColorElMET[0];}
      else if(i>1 && i<5){bgdClr=bgdColorElMET[1];}
      else if(4<i && i<8){bgdClr=bgdColorElMET[2];}
      else if(7<i && i<11){bgdClr=bgdColorElMET[3];}
      else if(10<i && i<13){bgdClr=bgdColorElMET[4];}
      else if(12<i && i<16){bgdClr=bgdColorElMET[5];}
      else if(i>15){bgdClr=bgdColorElMET[6];}

      bgdSamples[i]->SetLineColor(bgdClr);bgdSamples[i]->SetFillColor(bgdClr);
      hsbgd->Add(bgdSamples[i]);//+++++++++
    }
    bgd->Add(bgdSamples[i]);
    bgd_output->Add(bgdSamples[i]);
  }
  
  const int fill_style_sig = 3001;
  const int fill_style_bgd = 3001;

  bgd->SetLineColor(kAzure+1);
  bgd->SetFillColor(kAzure+1);
  bgd->SetFillStyle(fill_style_bgd);

  // =============== PLOT DISTRIBUTIONS HERE ========================
  
  TCanvas * c1 = new TCanvas();
  c1->SetLogy();

  if(wClr && analysis_channel == 2)hsbgd->Draw("e");
  else bgd->Draw("e");

  wp->SetLineColor(kRed);
  wp_noint->SetLineColor(kRed+1);
  wp_oppsign->SetLineColor(kRed+2);
  wp_samesign->SetLineColor(kRed+3);
  wp->SetFillColor(kRed);
  wp_noint->SetFillColor(kRed+1);
  wp_oppsign->SetFillColor(kRed+2);
  wp_samesign->SetFillColor(kRed+3);
  wp->SetFillStyle(fill_style_sig);
  wp_noint->SetFillStyle(fill_style_sig);
  wp_oppsign->SetFillStyle(fill_style_sig);   
  wp_samesign->SetFillStyle(fill_style_sig);
  wp->Draw("same");
  wp_noint->Draw("same");
  wp_oppsign->Draw("same");
  wp_samesign->Draw("same");
  
  TLegend * lg = new TLegend(0.52, 0.67, 0.82, 0.89);
  lg->SetTextSize(0.03);
  lg->SetBorderSize(0);
  lg->SetFillColor(0);
  lg->AddEntry(bgd, "Total bgd", "F");
  string histo_entry_title = "W ' (" + mass + " TeV)";
  lg->AddEntry(wp, histo_entry_title.c_str(), "F");
  histo_entry_title = "W ' (" + mass + " TeV), no interference";
  lg->AddEntry(wp_noint, histo_entry_title.c_str(), "F");
  histo_entry_title = "W ' (" + mass + " TeV), negative interference";
  lg->AddEntry(wp_oppsign, histo_entry_title.c_str(), "F");
  histo_entry_title = "W ' (" + mass + " TeV), positive interference";
  lg->AddEntry(wp_samesign, histo_entry_title.c_str(), "F");
  lg->Draw();
  
  c1->SaveAs(file.c_str());

  TFile *bgd_output_file = new TFile("Wprime_bgd_mu.root","recreate");
  bgd_output->Write();
  bgd_output_file->Close();  
}
void DarkSusy_mH_125_mGammaD_2000_cT_0_LHE_n1_Phi()
{
//=========Macro generated from canvas: cnv/cnv
//=========  (Sun May 24 15:19:41 2015) by ROOT version6.02/05
   TCanvas *cnv = new TCanvas("cnv", "cnv",1,1,904,904);
   gStyle->SetOptFit(1);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   cnv->SetHighLightColor(2);
   cnv->Range(-5.7,-0.00502375,4.3,0.03362048);
   cnv->SetFillColor(0);
   cnv->SetBorderMode(0);
   cnv->SetBorderSize(2);
   cnv->SetTickx(1);
   cnv->SetTicky(1);
   cnv->SetLeftMargin(0.17);
   cnv->SetRightMargin(0.03);
   cnv->SetTopMargin(0.07);
   cnv->SetBottomMargin(0.13);
   cnv->SetFrameFillStyle(0);
   cnv->SetFrameBorderMode(0);
   cnv->SetFrameFillStyle(0);
   cnv->SetFrameBorderMode(0);
   
   TH1F *h_n1_1_Phi_dummy26 = new TH1F("h_n1_1_Phi_dummy26","h_n1_1_Phi_dummy",80,-4,4);
   h_n1_1_Phi_dummy26->SetMaximum(0.03091539);
   h_n1_1_Phi_dummy26->SetLineStyle(0);
   h_n1_1_Phi_dummy26->SetMarkerStyle(20);
   h_n1_1_Phi_dummy26->GetXaxis()->SetTitle("#phi of n_{1} [rad]");
   h_n1_1_Phi_dummy26->GetXaxis()->SetLabelFont(42);
   h_n1_1_Phi_dummy26->GetXaxis()->SetLabelOffset(0.007);
   h_n1_1_Phi_dummy26->GetXaxis()->SetTitleSize(0.06);
   h_n1_1_Phi_dummy26->GetXaxis()->SetTitleOffset(0.95);
   h_n1_1_Phi_dummy26->GetXaxis()->SetTitleFont(42);
   h_n1_1_Phi_dummy26->GetYaxis()->SetTitle("Fraction of events / 0.1 rad");
   h_n1_1_Phi_dummy26->GetYaxis()->SetLabelFont(42);
   h_n1_1_Phi_dummy26->GetYaxis()->SetLabelOffset(0.007);
   h_n1_1_Phi_dummy26->GetYaxis()->SetTitleSize(0.06);
   h_n1_1_Phi_dummy26->GetYaxis()->SetTitleOffset(1.35);
   h_n1_1_Phi_dummy26->GetYaxis()->SetTitleFont(42);
   h_n1_1_Phi_dummy26->GetZaxis()->SetLabelFont(42);
   h_n1_1_Phi_dummy26->GetZaxis()->SetLabelOffset(0.007);
   h_n1_1_Phi_dummy26->GetZaxis()->SetTitleSize(0.06);
   h_n1_1_Phi_dummy26->GetZaxis()->SetTitleFont(42);
   h_n1_1_Phi_dummy26->Draw("");
   
   TH1F *h_n1_1_Phi27 = new TH1F("h_n1_1_Phi27","h_n1_1_Phi",80,-4,4);
   h_n1_1_Phi27->SetBinContent(9,0.00635008);
   h_n1_1_Phi27->SetBinContent(10,0.0157877);
   h_n1_1_Phi27->SetBinContent(11,0.0158002);
   h_n1_1_Phi27->SetBinContent(12,0.01542519);
   h_n1_1_Phi27->SetBinContent(13,0.01491269);
   h_n1_1_Phi27->SetBinContent(14,0.0157252);
   h_n1_1_Phi27->SetBinContent(15,0.01550019);
   h_n1_1_Phi27->SetBinContent(16,0.0163252);
   h_n1_1_Phi27->SetBinContent(17,0.01641271);
   h_n1_1_Phi27->SetBinContent(18,0.01676271);
   h_n1_1_Phi27->SetBinContent(19,0.01541269);
   h_n1_1_Phi27->SetBinContent(20,0.0159877);
   h_n1_1_Phi27->SetBinContent(21,0.01552519);
   h_n1_1_Phi27->SetBinContent(22,0.0158627);
   h_n1_1_Phi27->SetBinContent(23,0.0162752);
   h_n1_1_Phi27->SetBinContent(24,0.0163377);
   h_n1_1_Phi27->SetBinContent(25,0.01641271);
   h_n1_1_Phi27->SetBinContent(26,0.01538769);
   h_n1_1_Phi27->SetBinContent(27,0.0159252);
   h_n1_1_Phi27->SetBinContent(28,0.0163002);
   h_n1_1_Phi27->SetBinContent(29,0.01555019);
   h_n1_1_Phi27->SetBinContent(30,0.01675021);
   h_n1_1_Phi27->SetBinContent(31,0.0156877);
   h_n1_1_Phi27->SetBinContent(32,0.0162752);
   h_n1_1_Phi27->SetBinContent(33,0.0157877);
   h_n1_1_Phi27->SetBinContent(34,0.01647521);
   h_n1_1_Phi27->SetBinContent(35,0.01511269);
   h_n1_1_Phi27->SetBinContent(36,0.0161752);
   h_n1_1_Phi27->SetBinContent(37,0.01692521);
   h_n1_1_Phi27->SetBinContent(38,0.0161877);
   h_n1_1_Phi27->SetBinContent(39,0.01551269);
   h_n1_1_Phi27->SetBinContent(40,0.0160127);
   h_n1_1_Phi27->SetBinContent(41,0.01680021);
   h_n1_1_Phi27->SetBinContent(42,0.0159252);
   h_n1_1_Phi27->SetBinContent(43,0.0161252);
   h_n1_1_Phi27->SetBinContent(44,0.0161002);
   h_n1_1_Phi27->SetBinContent(45,0.01526269);
   h_n1_1_Phi27->SetBinContent(46,0.0156627);
   h_n1_1_Phi27->SetBinContent(47,0.0158627);
   h_n1_1_Phi27->SetBinContent(48,0.01546269);
   h_n1_1_Phi27->SetBinContent(49,0.01537519);
   h_n1_1_Phi27->SetBinContent(50,0.01663771);
   h_n1_1_Phi27->SetBinContent(51,0.01558769);
   h_n1_1_Phi27->SetBinContent(52,0.0161877);
   h_n1_1_Phi27->SetBinContent(53,0.0161752);
   h_n1_1_Phi27->SetBinContent(54,0.01502519);
   h_n1_1_Phi27->SetBinContent(55,0.01557519);
   h_n1_1_Phi27->SetBinContent(56,0.01558769);
   h_n1_1_Phi27->SetBinContent(57,0.01543769);
   h_n1_1_Phi27->SetBinContent(58,0.0163252);
   h_n1_1_Phi27->SetBinContent(59,0.01657521);
   h_n1_1_Phi27->SetBinContent(60,0.0160002);
   h_n1_1_Phi27->SetBinContent(61,0.01558769);
   h_n1_1_Phi27->SetBinContent(62,0.0157252);
   h_n1_1_Phi27->SetBinContent(63,0.01557519);
   h_n1_1_Phi27->SetBinContent(64,0.01717521);
   h_n1_1_Phi27->SetBinContent(65,0.01540019);
   h_n1_1_Phi27->SetBinContent(66,0.01666271);
   h_n1_1_Phi27->SetBinContent(67,0.0158252);
   h_n1_1_Phi27->SetBinContent(68,0.0156002);
   h_n1_1_Phi27->SetBinContent(69,0.0157127);
   h_n1_1_Phi27->SetBinContent(70,0.01481269);
   h_n1_1_Phi27->SetBinContent(71,0.0163627);
   h_n1_1_Phi27->SetBinContent(72,0.006987588);
   h_n1_1_Phi27->SetBinError(9,0.0002817392);
   h_n1_1_Phi27->SetBinError(10,0.0004442394);
   h_n1_1_Phi27->SetBinError(11,0.0004444153);
   h_n1_1_Phi27->SetBinError(12,0.0004391097);
   h_n1_1_Phi27->SetBinError(13,0.0004317533);
   h_n1_1_Phi27->SetBinError(14,0.0004433592);
   h_n1_1_Phi27->SetBinError(15,0.0004401759);
   h_n1_1_Phi27->SetBinError(16,0.0004517384);
   h_n1_1_Phi27->SetBinError(17,0.0004529474);
   h_n1_1_Phi27->SetBinError(18,0.0004577516);
   h_n1_1_Phi27->SetBinError(19,0.0004389317);
   h_n1_1_Phi27->SetBinError(20,0.0004470445);
   h_n1_1_Phi27->SetBinError(21,0.0004405308);
   h_n1_1_Phi27->SetBinError(22,0.0004452934);
   h_n1_1_Phi27->SetBinError(23,0.0004510461);
   h_n1_1_Phi27->SetBinError(24,0.0004519113);
   h_n1_1_Phi27->SetBinError(25,0.0004529474);
   h_n1_1_Phi27->SetBinError(26,0.0004385756);
   h_n1_1_Phi27->SetBinError(27,0.0004461698);
   h_n1_1_Phi27->SetBinError(28,0.0004513924);
   h_n1_1_Phi27->SetBinError(29,0.0004408853);
   h_n1_1_Phi27->SetBinError(30,0.0004575809);
   h_n1_1_Phi27->SetBinError(31,0.0004428303);
   h_n1_1_Phi27->SetBinError(32,0.0004510461);
   h_n1_1_Phi27->SetBinError(33,0.0004442394);
   h_n1_1_Phi27->SetBinError(34,0.000453809);
   h_n1_1_Phi27->SetBinError(35,0.0004346389);
   h_n1_1_Phi27->SetBinError(36,0.0004496583);
   h_n1_1_Phi27->SetBinError(37,0.000459965);
   h_n1_1_Phi27->SetBinError(38,0.000449832);
   h_n1_1_Phi27->SetBinError(39,0.0004403534);
   h_n1_1_Phi27->SetBinError(40,0.0004473938);
   h_n1_1_Phi27->SetBinError(41,0.0004582633);
   h_n1_1_Phi27->SetBinError(42,0.0004461698);
   h_n1_1_Phi27->SetBinError(43,0.0004489627);
   h_n1_1_Phi27->SetBinError(44,0.0004486146);
   h_n1_1_Phi27->SetBinError(45,0.0004367906);
   h_n1_1_Phi27->SetBinError(46,0.0004424773);
   h_n1_1_Phi27->SetBinError(47,0.0004452934);
   h_n1_1_Phi27->SetBinError(48,0.0004396431);
   h_n1_1_Phi27->SetBinError(49,0.0004383974);
   h_n1_1_Phi27->SetBinError(50,0.0004560416);
   h_n1_1_Phi27->SetBinError(51,0.0004414166);
   h_n1_1_Phi27->SetBinError(52,0.000449832);
   h_n1_1_Phi27->SetBinError(53,0.0004496583);
   h_n1_1_Phi27->SetBinError(54,0.0004333788);
   h_n1_1_Phi27->SetBinError(55,0.0004412396);
   h_n1_1_Phi27->SetBinError(56,0.0004414166);
   h_n1_1_Phi27->SetBinError(57,0.0004392876);
   h_n1_1_Phi27->SetBinError(58,0.0004517384);
   h_n1_1_Phi27->SetBinError(59,0.0004551842);
   h_n1_1_Phi27->SetBinError(60,0.0004472192);
   h_n1_1_Phi27->SetBinError(61,0.0004414166);
   h_n1_1_Phi27->SetBinError(62,0.0004433592);
   h_n1_1_Phi27->SetBinError(63,0.0004412396);
   h_n1_1_Phi27->SetBinError(64,0.0004633496);
   h_n1_1_Phi27->SetBinError(65,0.0004387537);
   h_n1_1_Phi27->SetBinError(66,0.0004563841);
   h_n1_1_Phi27->SetBinError(67,0.0004447667);
   h_n1_1_Phi27->SetBinError(68,0.0004415936);
   h_n1_1_Phi27->SetBinError(69,0.000443183);
   h_n1_1_Phi27->SetBinError(70,0.0004303032);
   h_n1_1_Phi27->SetBinError(71,0.000452257);
   h_n1_1_Phi27->SetBinError(72,0.0002955435);
   h_n1_1_Phi27->SetEntries(79999);
   h_n1_1_Phi27->SetDirectory(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#0000ff");
   h_n1_1_Phi27->SetLineColor(ci);
   h_n1_1_Phi27->SetLineWidth(2);
   h_n1_1_Phi27->SetMarkerStyle(20);
   h_n1_1_Phi27->GetXaxis()->SetLabelFont(42);
   h_n1_1_Phi27->GetXaxis()->SetLabelOffset(0.007);
   h_n1_1_Phi27->GetXaxis()->SetTitleSize(0.06);
   h_n1_1_Phi27->GetXaxis()->SetTitleOffset(0.95);
   h_n1_1_Phi27->GetXaxis()->SetTitleFont(42);
   h_n1_1_Phi27->GetYaxis()->SetLabelFont(42);
   h_n1_1_Phi27->GetYaxis()->SetLabelOffset(0.007);
   h_n1_1_Phi27->GetYaxis()->SetTitleSize(0.06);
   h_n1_1_Phi27->GetYaxis()->SetTitleOffset(1.3);
   h_n1_1_Phi27->GetYaxis()->SetTitleFont(42);
   h_n1_1_Phi27->GetZaxis()->SetLabelFont(42);
   h_n1_1_Phi27->GetZaxis()->SetLabelOffset(0.007);
   h_n1_1_Phi27->GetZaxis()->SetTitleSize(0.06);
   h_n1_1_Phi27->GetZaxis()->SetTitleFont(42);
   h_n1_1_Phi27->Draw("SAMEHIST");
   
   TH1F *h_n1_2_Phi28 = new TH1F("h_n1_2_Phi28","h_n1_2_Phi",80,-4,4);
   h_n1_2_Phi28->SetBinContent(9,0.00718759);
   h_n1_2_Phi28->SetBinContent(10,0.0159627);
   h_n1_2_Phi28->SetBinContent(11,0.01655021);
   h_n1_2_Phi28->SetBinContent(12,0.0159002);
   h_n1_2_Phi28->SetBinContent(13,0.0159877);
   h_n1_2_Phi28->SetBinContent(14,0.01481269);
   h_n1_2_Phi28->SetBinContent(15,0.0160252);
   h_n1_2_Phi28->SetBinContent(16,0.0158377);
   h_n1_2_Phi28->SetBinContent(17,0.01513769);
   h_n1_2_Phi28->SetBinContent(18,0.0158252);
   h_n1_2_Phi28->SetBinContent(19,0.0157877);
   h_n1_2_Phi28->SetBinContent(20,0.01648771);
   h_n1_2_Phi28->SetBinContent(21,0.0162502);
   h_n1_2_Phi28->SetBinContent(22,0.01548769);
   h_n1_2_Phi28->SetBinContent(23,0.01542519);
   h_n1_2_Phi28->SetBinContent(24,0.0156752);
   h_n1_2_Phi28->SetBinContent(25,0.01551269);
   h_n1_2_Phi28->SetBinContent(26,0.0159627);
   h_n1_2_Phi28->SetBinContent(27,0.0160127);
   h_n1_2_Phi28->SetBinContent(28,0.01643771);
   h_n1_2_Phi28->SetBinContent(29,0.0162127);
   h_n1_2_Phi28->SetBinContent(30,0.01537519);
   h_n1_2_Phi28->SetBinContent(31,0.0158377);
   h_n1_2_Phi28->SetBinContent(32,0.0162877);
   h_n1_2_Phi28->SetBinContent(33,0.0160627);
   h_n1_2_Phi28->SetBinContent(34,0.0157252);
   h_n1_2_Phi28->SetBinContent(35,0.01682521);
   h_n1_2_Phi28->SetBinContent(36,0.01512519);
   h_n1_2_Phi28->SetBinContent(37,0.0161127);
   h_n1_2_Phi28->SetBinContent(38,0.01541269);
   h_n1_2_Phi28->SetBinContent(39,0.01547519);
   h_n1_2_Phi28->SetBinContent(40,0.0164002);
   h_n1_2_Phi28->SetBinContent(41,0.0157877);
   h_n1_2_Phi28->SetBinContent(42,0.01547519);
   h_n1_2_Phi28->SetBinContent(43,0.0156127);
   h_n1_2_Phi28->SetBinContent(44,0.01522519);
   h_n1_2_Phi28->SetBinContent(45,0.01532519);
   h_n1_2_Phi28->SetBinContent(46,0.0157752);
   h_n1_2_Phi28->SetBinContent(47,0.0160502);
   h_n1_2_Phi28->SetBinContent(48,0.01655021);
   h_n1_2_Phi28->SetBinContent(49,0.0160752);
   h_n1_2_Phi28->SetBinContent(50,0.01661271);
   h_n1_2_Phi28->SetBinContent(51,0.01521269);
   h_n1_2_Phi28->SetBinContent(52,0.0158627);
   h_n1_2_Phi28->SetBinContent(53,0.01550019);
   h_n1_2_Phi28->SetBinContent(54,0.0161127);
   h_n1_2_Phi28->SetBinContent(55,0.01646271);
   h_n1_2_Phi28->SetBinContent(56,0.0159627);
   h_n1_2_Phi28->SetBinContent(57,0.0161502);
   h_n1_2_Phi28->SetBinContent(58,0.01550019);
   h_n1_2_Phi28->SetBinContent(59,0.0162627);
   h_n1_2_Phi28->SetBinContent(60,0.0163002);
   h_n1_2_Phi28->SetBinContent(61,0.0158377);
   h_n1_2_Phi28->SetBinContent(62,0.0162127);
   h_n1_2_Phi28->SetBinContent(63,0.0156877);
   h_n1_2_Phi28->SetBinContent(64,0.01645021);
   h_n1_2_Phi28->SetBinContent(65,0.0162252);
   h_n1_2_Phi28->SetBinContent(66,0.01513769);
   h_n1_2_Phi28->SetBinContent(67,0.0158127);
   h_n1_2_Phi28->SetBinContent(68,0.01720021);
   h_n1_2_Phi28->SetBinContent(69,0.0161252);
   h_n1_2_Phi28->SetBinContent(70,0.0157127);
   h_n1_2_Phi28->SetBinContent(71,0.0160127);
   h_n1_2_Phi28->SetBinContent(72,0.006650083);
   h_n1_2_Phi28->SetBinError(9,0.0002997432);
   h_n1_2_Phi28->SetBinError(10,0.0004466948);
   h_n1_2_Phi28->SetBinError(11,0.0004548408);
   h_n1_2_Phi28->SetBinError(12,0.0004458194);
   h_n1_2_Phi28->SetBinError(13,0.0004470445);
   h_n1_2_Phi28->SetBinError(14,0.0004303032);
   h_n1_2_Phi28->SetBinError(15,0.0004475684);
   h_n1_2_Phi28->SetBinError(16,0.0004449424);
   h_n1_2_Phi28->SetBinError(17,0.0004349983);
   h_n1_2_Phi28->SetBinError(18,0.0004447667);
   h_n1_2_Phi28->SetBinError(19,0.0004442394);
   h_n1_2_Phi28->SetBinError(20,0.0004539812);
   h_n1_2_Phi28->SetBinError(21,0.0004506995);
   h_n1_2_Phi28->SetBinError(22,0.0004399984);
   h_n1_2_Phi28->SetBinError(23,0.0004391097);
   h_n1_2_Phi28->SetBinError(24,0.0004426538);
   h_n1_2_Phi28->SetBinError(25,0.0004403534);
   h_n1_2_Phi28->SetBinError(26,0.0004466948);
   h_n1_2_Phi28->SetBinError(27,0.0004473938);
   h_n1_2_Phi28->SetBinError(28,0.0004532923);
   h_n1_2_Phi28->SetBinError(29,0.0004501792);
   h_n1_2_Phi28->SetBinError(30,0.0004383974);
   h_n1_2_Phi28->SetBinError(31,0.0004449424);
   h_n1_2_Phi28->SetBinError(32,0.0004512193);
   h_n1_2_Phi28->SetBinError(33,0.0004480918);
   h_n1_2_Phi28->SetBinError(34,0.0004433592);
   h_n1_2_Phi28->SetBinError(35,0.0004586041);
   h_n1_2_Phi28->SetBinError(36,0.0004348186);
   h_n1_2_Phi28->SetBinError(37,0.0004487887);
   h_n1_2_Phi28->SetBinError(38,0.0004389317);
   h_n1_2_Phi28->SetBinError(39,0.0004398208);
   h_n1_2_Phi28->SetBinError(40,0.0004527749);
   h_n1_2_Phi28->SetBinError(41,0.0004442394);
   h_n1_2_Phi28->SetBinError(42,0.0004398208);
   h_n1_2_Phi28->SetBinError(43,0.0004417704);
   h_n1_2_Phi28->SetBinError(44,0.0004362537);
   h_n1_2_Phi28->SetBinError(45,0.000437684);
   h_n1_2_Phi28->SetBinError(46,0.0004440635);
   h_n1_2_Phi28->SetBinError(47,0.0004479174);
   h_n1_2_Phi28->SetBinError(48,0.0004548408);
   h_n1_2_Phi28->SetBinError(49,0.0004482661);
   h_n1_2_Phi28->SetBinError(50,0.0004556988);
   h_n1_2_Phi28->SetBinError(51,0.0004360745);
   h_n1_2_Phi28->SetBinError(52,0.0004452934);
   h_n1_2_Phi28->SetBinError(53,0.0004401759);
   h_n1_2_Phi28->SetBinError(54,0.0004487887);
   h_n1_2_Phi28->SetBinError(55,0.0004536369);
   h_n1_2_Phi28->SetBinError(56,0.0004466948);
   h_n1_2_Phi28->SetBinError(57,0.0004493106);
   h_n1_2_Phi28->SetBinError(58,0.0004401759);
   h_n1_2_Phi28->SetBinError(59,0.0004508729);
   h_n1_2_Phi28->SetBinError(60,0.0004513924);
   h_n1_2_Phi28->SetBinError(61,0.0004449424);
   h_n1_2_Phi28->SetBinError(62,0.0004501792);
   h_n1_2_Phi28->SetBinError(63,0.0004428303);
   h_n1_2_Phi28->SetBinError(64,0.0004534646);
   h_n1_2_Phi28->SetBinError(65,0.0004503527);
   h_n1_2_Phi28->SetBinError(66,0.0004349983);
   h_n1_2_Phi28->SetBinError(67,0.000444591);
   h_n1_2_Phi28->SetBinError(68,0.0004636867);
   h_n1_2_Phi28->SetBinError(69,0.0004489627);
   h_n1_2_Phi28->SetBinError(70,0.000443183);
   h_n1_2_Phi28->SetBinError(71,0.0004473938);
   h_n1_2_Phi28->SetBinError(72,0.0002883177);
   h_n1_2_Phi28->SetEntries(79999);
   h_n1_2_Phi28->SetDirectory(0);

   ci = TColor::GetColor("#ff0000");
   h_n1_2_Phi28->SetLineColor(ci);
   h_n1_2_Phi28->SetLineWidth(2);
   h_n1_2_Phi28->SetMarkerStyle(20);
   h_n1_2_Phi28->GetXaxis()->SetLabelFont(42);
   h_n1_2_Phi28->GetXaxis()->SetLabelOffset(0.007);
   h_n1_2_Phi28->GetXaxis()->SetTitleSize(0.06);
   h_n1_2_Phi28->GetXaxis()->SetTitleOffset(0.95);
   h_n1_2_Phi28->GetXaxis()->SetTitleFont(42);
   h_n1_2_Phi28->GetYaxis()->SetLabelFont(42);
   h_n1_2_Phi28->GetYaxis()->SetLabelOffset(0.007);
   h_n1_2_Phi28->GetYaxis()->SetTitleSize(0.06);
   h_n1_2_Phi28->GetYaxis()->SetTitleOffset(1.3);
   h_n1_2_Phi28->GetYaxis()->SetTitleFont(42);
   h_n1_2_Phi28->GetZaxis()->SetLabelFont(42);
   h_n1_2_Phi28->GetZaxis()->SetLabelOffset(0.007);
   h_n1_2_Phi28->GetZaxis()->SetTitleSize(0.06);
   h_n1_2_Phi28->GetZaxis()->SetTitleFont(42);
   h_n1_2_Phi28->Draw("SAMEHIST");
   
   TLegend *leg = new TLegend(0.46,0.6744444,0.6955556,0.7644444,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.02777778);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   TLegendEntry *entry=leg->AddEntry("h_n1_1_Phi","1st neutralino","L");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("h_n1_2_Phi","2nd neutralino","L");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   
   leg = new TLegend(0.4566667,0.82,0.7822222,0.9066667,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.02777778);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   entry=leg->AddEntry("NULL","#splitline{pp #rightarrow h #rightarrow 2n_{1} #rightarrow 2n_{D} + 2 #gamma_{D} #rightarrow 2n_{D} + 4#mu}{#splitline{m_{h} = 125 GeV, m_{n_{1}} = 50 GeV, m_{n_{D}} = 1 GeV}{m_{#gamma_{D}} = 20 GeV, c#tau_{#gamma_{D}} = 0 mm}}","h");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   
   leg = new TLegend(0.17,0.935,0.97,1,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextAlign(22);
   leg->SetTextSize(0.045);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   entry=leg->AddEntry("NULL","CMS Simulation (LHE) 14 TeV","h");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   cnv->Modified();
   cnv->cd();
   cnv->SetSelected(cnv);
}
Ejemplo n.º 5
0
void ComputeHiggsPtKFactor( ) {
  TFile *EffFile = new TFile("JetVetoEfficiencySystematics.root", "UPDATE");

  TH1D* MCAtNLOHiggsPt = (TH1D*)EffFile->Get("bosonSystemPt_ggHww160_MCAtNLO_default");
  TH1D* PowhegHiggsPt = (TH1D*)EffFile->Get("bosonSystemPt_ggHww160_default");
  PowhegHiggsPt->SetLineColor(kRed);
  TH1D* NNLLHiggsPt = (TH1D*)EffFile->Get("bosonSystemPt_ggHww160_NNLL_default");
  NNLLHiggsPt->SetLineColor(kBlue);

  TH1D* MCAtNLOHiggsPtFineBinning = (TH1D*)EffFile->Get("bosonSystemPtFineBinning_ggHww160_MCAtNLO_default");
  TH1D* PowhegHiggsPtFineBinning = (TH1D*)EffFile->Get("bosonSystemPtFineBinning_ggHww160_default");
  TH1D* NNLLHiggsPtFineBinning = (TH1D*)EffFile->Get("bosonSystemPtFineBinning_ggHww160_NNLL_default");

  assert(MCAtNLOHiggsPt);
  assert(PowhegHiggsPt);
  assert(NNLLHiggsPt);
  assert(MCAtNLOHiggsPtFineBinning);
  assert(PowhegHiggsPtFineBinning);
  assert(NNLLHiggsPtFineBinning);


  Double_t norm = 0 ;

  for(int i=0; i<PowhegHiggsPt->GetXaxis()->GetNbins()+2 ; ++i) {
    norm += PowhegHiggsPt->GetBinContent(i);
  }
  for(int i=0; i<PowhegHiggsPt->GetXaxis()->GetNbins()+2 ; ++i) {
    PowhegHiggsPt->SetBinContent(i, PowhegHiggsPt->GetBinContent(i) / norm);
//     cout << i << " " << PowhegHiggsPt->GetBinContent(i) << endl;
  }

  norm = 0;
  for(int i=0; i<MCAtNLOHiggsPt->GetXaxis()->GetNbins()+2 ; ++i) {
    norm += MCAtNLOHiggsPt->GetBinContent(i);
  }
  for(int i=0; i<MCAtNLOHiggsPt->GetXaxis()->GetNbins()+2 ; ++i) {
    MCAtNLOHiggsPt->SetBinContent(i, MCAtNLOHiggsPt->GetBinContent(i) / norm);
    // cout << i << " " << MCAtNLOHiggsPt->GetBinContent(i) << endl;
  }
  
  norm = 0 ;
  for(int i=0; i<PowhegHiggsPtFineBinning->GetXaxis()->GetNbins()+2 ; ++i) {
    norm += PowhegHiggsPtFineBinning->GetBinContent(i);
  }
  for(int i=0; i<PowhegHiggsPtFineBinning->GetXaxis()->GetNbins()+2 ; ++i) {
    PowhegHiggsPtFineBinning->SetBinContent(i, PowhegHiggsPtFineBinning->GetBinContent(i) / norm);
  }

  norm = 0;
  for(int i=0; i<MCAtNLOHiggsPtFineBinning->GetXaxis()->GetNbins()+2 ; ++i) {
    norm += MCAtNLOHiggsPtFineBinning->GetBinContent(i);
  }
  for(int i=0; i<MCAtNLOHiggsPtFineBinning->GetXaxis()->GetNbins()+2 ; ++i) {
    MCAtNLOHiggsPtFineBinning->SetBinContent(i, MCAtNLOHiggsPtFineBinning->GetBinContent(i) / norm);
    // cout << i << " " << MCAtNLOHiggsPtFineBinning->GetBinContent(i) << endl;
  }


  TCanvas *cv = new TCanvas("cv","cv", 800,600);

  TLegend *tmpLegend = new TLegend(0.73,0.55,0.93,0.70);   
  tmpLegend->SetTextSize(0.03);
  tmpLegend->SetBorderSize(1);
  tmpLegend->AddEntry(MCAtNLOHiggsPt, "MC@NLO", "LP");   
  tmpLegend->AddEntry(PowhegHiggsPt, "Powheg", "LP");   
  tmpLegend->AddEntry(NNLLHiggsPt, "NNLO+NNLL", "LP");   

  MCAtNLOHiggsPt->SetMaximum(0.07);
  MCAtNLOHiggsPt->Draw("hist");
  MCAtNLOHiggsPt->GetYaxis()->SetTitleOffset(1.2);
  MCAtNLOHiggsPt->GetYaxis()->SetTitle("Fraction of Events");
  MCAtNLOHiggsPt->GetXaxis()->SetTitleOffset(1.05);
  PowhegHiggsPt->Draw("hist,same");
  NNLLHiggsPt->Draw("hist,same");
  tmpLegend->Draw();
  cv->SaveAs("HiggsPtComparison.gif");

  cv->SetLogy();
  cv->SaveAs("HiggsPtComparison_logY.gif");




  TH1D* kFactorHiggsPt_PowhegToNNLL = (TH1D*)MCAtNLOHiggsPt->Clone("kFactorHiggsPt_ggHww160_PowhegToNNLL");
  for(int i=0; i<kFactorHiggsPt_PowhegToNNLL->GetXaxis()->GetNbins()+2 ; ++i) {
    if (i==0) {
      kFactorHiggsPt_PowhegToNNLL->SetBinContent(i,1.0);
    } else if (i == kFactorHiggsPt_PowhegToNNLL->GetXaxis()->GetNbins()+1) {
      kFactorHiggsPt_PowhegToNNLL->SetBinContent(i,0.6);
    } else {
      kFactorHiggsPt_PowhegToNNLL->SetBinContent(i,NNLLHiggsPt->GetBinContent(i) / PowhegHiggsPt->GetBinContent(i));    
    }
//     cout << i << " " << NNLLHiggsPt->GetBinContent(i) << " / " << PowhegHiggsPt->GetBinContent(i) << " " << kFactorHiggsPt_PowhegToNNLL->GetBinContent(i) << endl;
  }
  TH1D* kFactorHiggsPt_MCAtNLOToNNLL = (TH1D*)MCAtNLOHiggsPt->Clone("kFactorHiggsPt_ggHww160_MCAtNLOToNNLL");
  for(int i=0; i<kFactorHiggsPt_MCAtNLOToNNLL->GetXaxis()->GetNbins()+2 ; ++i) {
    if (i==0) {
      kFactorHiggsPt_MCAtNLOToNNLL->SetBinContent(i,1.0);
    } else if (i == kFactorHiggsPt_PowhegToNNLL->GetXaxis()->GetNbins()+1) {
      kFactorHiggsPt_MCAtNLOToNNLL->SetBinContent(i,1.5);
    } else {
      kFactorHiggsPt_MCAtNLOToNNLL->SetBinContent(i,NNLLHiggsPt->GetBinContent(i) / MCAtNLOHiggsPt->GetBinContent(i));
    }
  }

  TH1D* kFactorHiggsPtFineBinning_PowhegToNNLL = (TH1D*)MCAtNLOHiggsPtFineBinning->Clone("kFactorHiggsPtFineBinning_ggHww160_PowhegToNNLL");
  for(int i=0; i<kFactorHiggsPtFineBinning_PowhegToNNLL->GetXaxis()->GetNbins()+2 ; ++i) {
    if (i==0) {
    kFactorHiggsPtFineBinning_PowhegToNNLL->SetBinContent(i,1.0);
    } else if (i == kFactorHiggsPt_PowhegToNNLL->GetXaxis()->GetNbins()+1) {
    kFactorHiggsPtFineBinning_PowhegToNNLL->SetBinContent(i,0.6);
    } else {
    kFactorHiggsPtFineBinning_PowhegToNNLL->SetBinContent(i,NNLLHiggsPtFineBinning->GetBinContent(i) / PowhegHiggsPtFineBinning->GetBinContent(i));
    }
//     cout << i << " " << NNLLHiggsPtFineBinning->GetBinContent(i) << " / " << PowhegHiggsPtFineBinning->GetBinContent(i) << " " << kFactorHiggsPtFineBinning_PowhegToNNLL->GetBinContent(i) << endl;
  }
  TH1D* kFactorHiggsPtFineBinning_MCAtNLOToNNLL = (TH1D*)MCAtNLOHiggsPtFineBinning->Clone("kFactorHiggsPtFineBinning_ggHww160_MCAtNLOToNNLL");
  for(int i=0; i<kFactorHiggsPtFineBinning_MCAtNLOToNNLL->GetXaxis()->GetNbins()+2 ; ++i) {
    if (i==0) {
      kFactorHiggsPtFineBinning_MCAtNLOToNNLL->SetBinContent(i,1.0);
    } else if (i == kFactorHiggsPt_PowhegToNNLL->GetXaxis()->GetNbins()+1) {
      kFactorHiggsPtFineBinning_MCAtNLOToNNLL->SetBinContent(i,1.5);
    } else {
      kFactorHiggsPtFineBinning_MCAtNLOToNNLL->SetBinContent(i,NNLLHiggsPtFineBinning->GetBinContent(i) / MCAtNLOHiggsPtFineBinning->GetBinContent(i));
    }
//    cout << i << " " << NNLLHiggsPtFineBinning->GetBinContent(i) << " / " << MCAtNLOHiggsPtFineBinning->GetBinContent(i) << " " << kFactorHiggsPtFineBinning_MCAtNLOToNNLL->GetBinContent(i) << endl;
  }

  cv->SetLogy(0);
  tmpLegend = new TLegend(0.20,0.75,0.55,0.90);   
  tmpLegend->SetTextSize(0.03);
  tmpLegend->SetBorderSize(1);
  tmpLegend->AddEntry(kFactorHiggsPt_PowhegToNNLL, "NNLO+NNLL/Powheg", "LP");   
   tmpLegend->AddEntry(kFactorHiggsPt_MCAtNLOToNNLL, "NNLO+NNLL/MC@NLO", "LP");   
//   kFactorHiggsPt_MCAtNLOToNNLL->GetYaxis()->SetTitle("Ratio");
//    kFactorHiggsPt_MCAtNLOToNNLL->Draw("hist");
//   kFactorHiggsPt_MCAtNLOToNNLL->SetMinimum(0.3);
//   kFactorHiggsPt_MCAtNLOToNNLL->SetMaximum(3.2);
  kFactorHiggsPt_PowhegToNNLL->SetLineColor(kRed);
  kFactorHiggsPt_PowhegToNNLL->Draw("hist");
  kFactorHiggsPt_PowhegToNNLL->SetMinimum(0.0);
  kFactorHiggsPt_PowhegToNNLL->SetMaximum(3.2);
  kFactorHiggsPt_MCAtNLOToNNLL->Draw("hist,same");  
  tmpLegend->Draw(); 
//   cv->SetLogy(0);
  cv->SaveAs("HiggsPtKFactors.gif");



  //*****************************************************************************************
  //Print KFactors
  //*****************************************************************************************
//   //To Produce Tex
//   for(int i=0; i<kFactorHiggsPt_PowhegToNNLL->GetXaxis()->GetNbins()+2 ; ++i) {
//     char kfactor[10];
//     sprintf(kfactor,"%.4f ",kFactorHiggsPt_PowhegToNNLL->GetBinContent(i));

//     cout << kFactorHiggsPt_PowhegToNNLL->GetXaxis()->GetBinLowEdge(i) << " - " << kFactorHiggsPt_PowhegToNNLL->GetXaxis()->GetBinUpEdge(i) << " &  " << kfactor <<  " \\\\" << endl;
//   }

//   for(int i=0; i<kFactorHiggsPt_MCAtNLOToNNLL->GetXaxis()->GetNbins()+2 ; ++i) {
//     char kfactor[10];
//     sprintf(kfactor,"%.4f ",kFactorHiggsPt_MCAtNLOToNNLL->GetBinContent(i));

//     cout << kFactorHiggsPt_MCAtNLOToNNLL->GetXaxis()->GetBinLowEdge(i) << " - " << kFactorHiggsPt_MCAtNLOToNNLL->GetXaxis()->GetBinUpEdge(i) << " &  " << kfactor <<  " \\\\" << endl;
//   }


//   //To Produce twiki table
//   for(int i=0; i<kFactorHiggsPt_PowhegToNNLL->GetXaxis()->GetNbins()+2 ; ++i) {
//     char kfactor[10];
//     sprintf(kfactor,"%.4f ",kFactorHiggsPt_PowhegToNNLL->GetBinContent(i));

//     cout << "| " << kFactorHiggsPt_PowhegToNNLL->GetXaxis()->GetBinLowEdge(i) << " - " << kFactorHiggsPt_PowhegToNNLL->GetXaxis()->GetBinUpEdge(i) << " | " << kfactor <<  " | " << endl;
//   }

//   for(int i=0; i<kFactorHiggsPt_MCAtNLOToNNLL->GetXaxis()->GetNbins()+2 ; ++i) {
//     char kfactor[10];
//     sprintf(kfactor,"%.4f ",kFactorHiggsPt_MCAtNLOToNNLL->GetBinContent(i));

//     cout << "| " << kFactorHiggsPt_MCAtNLOToNNLL->GetXaxis()->GetBinLowEdge(i) << " - " << kFactorHiggsPt_MCAtNLOToNNLL->GetXaxis()->GetBinUpEdge(i) << " | " << kfactor <<  " |" << endl;
//   }


  //To produce the KFactor file
  for(int i=0; i<kFactorHiggsPt_PowhegToNNLL->GetXaxis()->GetNbins()+2 ; ++i) {
    char kfactor[10];
    sprintf(kfactor,"%.4f ",kFactorHiggsPt_PowhegToNNLL->GetBinContent(i));    
    cout << i << " " << kfactor <<  endl;
  }

  for(int i=0; i<kFactorHiggsPt_MCAtNLOToNNLL->GetXaxis()->GetNbins()+2 ; ++i) {
    char kfactor[10];
    sprintf(kfactor,"%.4f ",kFactorHiggsPt_MCAtNLOToNNLL->GetBinContent(i));
    cout << i << " " << kfactor <<  endl;
  }




  EffFile->WriteTObject(kFactorHiggsPt_PowhegToNNLL, kFactorHiggsPt_PowhegToNNLL->GetName(), "WriteDelete");
  EffFile->WriteTObject(kFactorHiggsPt_MCAtNLOToNNLL, kFactorHiggsPt_MCAtNLOToNNLL->GetName(), "WriteDelete");
  EffFile->WriteTObject(kFactorHiggsPtFineBinning_PowhegToNNLL, kFactorHiggsPtFineBinning_PowhegToNNLL->GetName(), "WriteDelete");
  EffFile->WriteTObject(kFactorHiggsPtFineBinning_MCAtNLOToNNLL, kFactorHiggsPtFineBinning_MCAtNLOToNNLL->GetName(), "WriteDelete");
  EffFile->Close();

}
Ejemplo n.º 6
0
void makeMETPlots( bool printplot = false ){

  gStyle->SetOptFit(0);

  TChain *ch = new TChain("T1");
  ch->Add("../../output/V00-02-21/wz_summer11_madgraph_gen_baby.root");

  vector<TCut> metcuts;
  vector<float> metcutvals;

  metcuts.push_back(TCut("pfmet>100")); metcutvals.push_back(100);
  metcuts.push_back(TCut("pfmet>200")); metcutvals.push_back(200);
  metcuts.push_back(TCut("pfmet>300")); metcutvals.push_back(300);

  TCut sel("dilmass>81&&dilmass<101&&njets>=2");

  const unsigned int n = metcuts.size();

  TH1F* hpass[n];
  TH1F* hall[n];

  for( unsigned int i = 0 ; i < metcuts.size() ; ++i){

    hpass[i]   = new TH1F(Form("hpass_%i",i),Form("hpass_%i",i),30,0,600);
    hall[i]    = new TH1F(Form("hall_%i",i), Form("hall_%i",i) ,30,0,600);

    ch->Draw(Form("genmet>>hpass_%i",i),sel+metcuts.at(i));
    ch->Draw(Form("genmet>>hall_%i",i)  ,sel);

  }

  TCanvas *can = new TCanvas();
  can->cd();
  gPad->SetGridx();
  gPad->SetGridy();
  gPad->SetTopMargin(0.08);

  TGraphAsymmErrors* gr[n];  
  TLegend *leg = new TLegend(0.6,0.2,0.95,0.4);
  leg->SetFillColor(0);
  leg->SetBorderSize(1);
  leg->SetTextSize(0.035);

  TF1* erf[n];

  for( unsigned int i = 0 ; i < metcuts.size() ; ++i){

    //can[i] = new TCanvas(Form("can_%i",i),Form("can_%i",i),600,600);
    //can[i]->cd();
    
    TF1* efunc = new TF1("efitf", fitf, 0, 600, 3);
    efunc->SetParameters(1, 100, 10);
    efunc->SetParNames("norm", "offset", "width");

    erf[i] = new TF1("efitf", fitf, 0, 600, 3);
    erf[i]->SetParameters(1, 100, 10);
    erf[i]->SetParNames("norm", "offset", "width");
    erf[i]->SetLineWidth(2);
    //erf[i]->FixParameter(0,1);

    //erf[i] = new TF1(Form("erf_%i",i),mfitf,0,400);

    //erf[i]->SetParameter(0,100*(i+1));
    //erf[i]->SetParameter(1,10);

    gr[i] = new TGraphAsymmErrors();
    if( i==0 ){
      erf[i]->SetLineColor(1);
    }

    if( i==1 ){
      gr[i]->SetLineColor(2);
      gr[i]->SetMarkerColor(2);
      gr[i]->SetMarkerStyle(21);
      erf[i]->SetLineColor(2);
    }
    if( i==2 ){
      gr[i]->SetLineColor(4);
      gr[i]->SetMarkerColor(4);
      gr[i]->SetMarkerStyle(25);
      erf[i]->SetLineColor(4);
    }

    leg->AddEntry(gr[i],Form("E_{T}^{miss}>%.0f GeV",metcutvals.at(i)),"p");

    gr[i]->GetXaxis()->SetTitle("generator-level E_{T}^{miss} (GeV)");
    gr[i]->GetYaxis()->SetTitle("efficiency");
    gr[i]->SetMaximum(1.05);
    gr[i]->BayesDivide(hpass[i],hall[i]);

    //gr[i]->Fit(efunc,"R");
    gr[i]->Fit(erf[i],"R");


    if( i==0 ) gr[i]->Draw("AP");
    else       gr[i]->Draw("sameP");

    gr[i]->GetXaxis()->SetTitle("generator E_{T}^{miss} [GeV]");
    gr[i]->GetYaxis()->SetTitle("efficiency");

    //erf[i]->Draw("same");
  }

  leg->Draw();

  TLatex *t = new TLatex();
  t->SetNDC();
  t->SetTextSize(0.04);
  t->DrawLatex(0.28,0.95,"CMS Simulation,  #sqrt{s} = 7 TeV");


  if (printplot) can->Print("../plots/met_turnon_LM4.pdf");





}
Ejemplo n.º 7
0
void ppb_merge(){
	
	TStopwatch timer;
	timer.Start();
	
	
	//Float_t N_mb = Lumi_ppb*sigma_inelastic*1000;
	//Float_t Lumi_ppb = 30.9;// inverse micro barns
	//Float_t sigma_inelastic = 70.0;//milli barns

	TH1::SetDefaultSumw2();
	
	
	
	TString inname1 = "root://eoscms//eos/cms/store/group/phys_heavyions/yjlee/pPb2013/promptReco/PA2013_HiForest_PromptReco_JSonPPb_forestv77.root";
	TString inname2 = "root://eoscms//eos/cms/store/group/phys_heavyions/krajczar/inbound/mnt/hadoop/cms/store/user/krajczar/pPb_Jet40Jet60_Full_v1/mergedJet40Jet60_KK.root";
	
	TFile *f1 = TFile::Open(inname1);
	TFile *f2 = TFile::Open(inname2);
	
	cout<<" File for HLT_100 HLT_80 = "<<inname1<<endl;
	cout<<" File for HLT_60 HLT_40 = "<<inname2<<endl;
	
	TFile *outfile = new TFile("pPbmerged_output.root","RECREATE");
	
	TTree* jet_80 = (TTree*)f1->Get("akPu3PFJetAnalyzer/t");
	TTree* jet_80_hlt = (TTree*)f1->Get("hltanalysis/HltTree");
	TTree* jet_80_skim = (TTree*)f1->Get("skimanalysis/HltTree");
	TTree* jet_80_evt = (TTree*)f1->Get("hiEvtAnalyzer/HiTree");
	jet_80->AddFriend(jet_80_hlt);
	jet_80->AddFriend(jet_80_skim);
	jet_80->AddFriend(jet_80_evt);
	
	TTree* jet_60 = (TTree*)f2->Get("akPu3PFJetAnalyzer/t");
	TTree* jet_60_hlt = (TTree*)f2->Get("hltanalysis/HltTree");
	TTree* jet_60_skim = (TTree*)f2->Get("skimanalysis/HltTree");
	TTree* jet_60_evt = (TTree*)f2->Get("hiEvtAnalyzer/HiTree");
	jet_60->AddFriend(jet_60_hlt);
	jet_60->AddFriend(jet_60_skim);
	jet_60->AddFriend(jet_60_evt);
	
	TCut Sel = "abs(vz)<15&&pHBHENoiseFilter&&pPAcollisionEventSelectionPA";
	TCut Trig_100 = "HLT_PAJet100_NoJetID_v1";
	TCut Trig_80 = "HLT_PAJet80_NoJetID_v1";
	TCut Trig_60 = "HLT_PAJet60_NoJetID_v1";
	TCut eta = "abs(jteta)<1";

	Float_t N_mb = 7.71e13;
	
	Float_t prescl3 = (Float_t)jet_80->GetEntries()/jet_80->GetEntries(Trig_60);
	Float_t prescl3_test = (Float_t)jet_80->GetEntries(Sel&&eta&&Trig_100)/jet_80->GetEntries(Sel&&eta&&Trig_60);

	
	const Int_t nbins = 16;
	const Double_t bound[nbins+1] = {30., 40., 50., 60., 70., 80., 90., 100., 110., 120., 140., 150., 160., 200., 220., 260., 300.};
	
	TH1F *hMeas_100 = new TH1F("hMeas_100","PPb HLT_100 Measured histo",nbins,bound);
	TH1F *hMeas_80 = new TH1F("hMeas_80","PPb HLT_80 Measured histo",nbins,bound);
	TH1F *hMeas_60 = new TH1F("hMeas_60","PPb HLT_60 Measured histo",nbins,bound);
	TH1F *hCombined = new TH1F("hCombined","PPb Combined spectra",nbins,bound);
	
	hMeas_100->Sumw2();
	hMeas_60->Sumw2();
	hMeas_80->Sumw2();
	
	jet_80->Draw("jtpt>>hMeas_100",Sel&&Trig_100&&eta);
	jet_80->Draw("jtpt>>hMeas_80",Sel&&!Trig_100&&Trig_80&&eta);
	jet_60->Draw("jtpt>>hMeas_60","1.58606"*Sel&&eta&&Trig_60&&!Trig_80&&!Trig_100);
	
	
	divideBinWidth(hMeas_100);
	divideBinWidth(hMeas_80);
	divideBinWidth(hMeas_60);
	
	hMeas_100->Scale(1./2); //scaling by d eta  - from -1 to +1 is 2. 
	hMeas_80->Scale(1./2);
	hMeas_60->Scale(1./2);
	
	hCombined->Add(hMeas_100,1);
	hCombined->Add(hMeas_80,1);
	hCombined->Add(hMeas_60,1);
	
	hCombined->Scale(1./N_mb);
	hMeas_100->Scale(1./N_mb);
	hMeas_80->Scale(1./N_mb);
	hMeas_60->Scale(1./N_mb);
	
	TCanvas *cMerged = new TCanvas("cMerged","Merged PPb spectra",800,600);
	cMerged->SetLogy();

	hCombined->SetXTitle("Jet p_{T} [GeV/c]");
	hCombined->SetYTitle("1/N_mb d^2N/dp_t d eta");
	hCombined->SetMarkerColor(kBlack);
	hCombined->SetMarkerStyle(20);
	hCombined->SetAxisRange(30,300,"X");
	hCombined->Draw();
	hMeas_100->SetMarkerColor(kRed);
	hMeas_100->SetMarkerStyle(21);
	hMeas_100->Draw("same");
	hMeas_80->SetMarkerColor(kBlue);
	hMeas_80->SetMarkerStyle(22);
	hMeas_80->Draw("same");
	hMeas_60->SetMarkerColor(kGreen);
	hMeas_60->SetMarkerStyle(23);
	hMeas_60->Draw("same");
	
	TLegend *leg_PPb = myLegend(0.6,0.65,0.95,0.9);
	leg_PPb->SetTextSize(0.05);
	leg_PPb->AddEntry(hCombined,"Merged PPb spectra ","pl");
	leg_PPb->AddEntry(hMeas_100,"HLT_100 spectra","pl");
	leg_PPb->AddEntry(hMeas_80,"HLT_80 spectra","pl");
	leg_PPb->AddEntry(hMeas_60,"HLT_60 spectra","pl");
	leg_PPb->Draw();
	
	putCMSPrel(0.2,0.83,0.06);
	drawText("PPb AKPu3PF |eta|<1 |vz|<15",0.2,0.23,20);
	
	cMerged->SaveAs("pPb_merged.pdf","RECREATE");
	
	hMeas_100->Write();
	hCombined->Write();
	hMeas_80->Write();
	hMeas_60->Write();
	

	TFile *fYaxian = TFile::Open("AkPu3PFJetRpA.root");
	TH1F *Yaxian = (TH1F*)fYaxian->Get("DataJetWideBin;3");
	TH1F *test = (TH1F*)Yaxian->Clone("test");

	cout<<"hi"<<endl;
	//outfile->cd();
	Yaxian->Print("base");
	test->Print("base");
	Yaxian->Divide(hCombined);
	TCanvas *yaxian = new TCanvas("yaxian","",800,600);
	yaxian->Divide(2,1);
	yaxian->cd(1);
	Yaxian->SetTitle("ratio of Yaxian's measured pPb spectra to Mine");
	Yaxian->SetXTitle("Jet p_{T} [GeV/c]");
	Yaxian->SetMarkerColor(kBlack);
	Yaxian->SetMarkerStyle(23);
	Yaxian->Draw();
	
	yaxian->cd(2);
	yaxian->cd(2)->SetLogy();
	test->SetMarkerStyle(22);
	test->SetMarkerColor(kBlack);
	test->SetXTitle("Jet p_{T} [GeV/c]");
	test->SetYTitle("1/N_mb d^2N/dp_t d eta");
	test->Draw();
	hCombined->Draw("same");
	
	TLegend *leg = myLegend(0.6,0.65,0.95,0.9);
	leg->SetTextSize(0.05);
	leg->AddEntry(hCombined,"Merged PPb spectra ","pl");
	leg->AddEntry(test,"Yaxian's spectra","pl");
	leg->Draw();
	
	putCMSPrel(0.2,0.83,0.06);
	drawText("PPb AKPu3PF |eta|<1 |vz|<15",0.2,0.23,20);
	
	yaxian->SaveAs("Yaxian_Comparison_pPb_pt_spectra.root","RECREATE");
	
	outfile->cd();
	Yaxian->Write();
	test->Write();
	
	outfile->Write();
	outfile->Close();
	
	timer.Stop();
    float rtime  = timer.RealTime();
    float ctime  = timer.CpuTime();
    
    std::cout<<"\t"<<std::endl;
    std::cout<<Form("RealTime=%f seconds, CpuTime=%f seconds",rtime,ctime)<<std::endl;
    std::cout<<"\t"<<std::endl;
    std::cout<<"Good bye : " <<"\t"<<std::endl;
    
	//define the required histograms
	//static const Int_t nbins = 22;
	//static const Double_t bound[nbins+1] = {30.,40.,50.,60.,70.,80.,90.,100.,110.,120.,130.,140.,150.,160.,180.,200.,220.,260.,300.,350.,400.,450.,500.};
	
}
Ejemplo n.º 8
0
void makeCorr3(){
	setNCUStyle(true);
	c1 = new TCanvas("c1","",1360,768);
	
	TFile *f;
	f=TFile::Open("corr2/corr.root");
	
	TFile *f2;
	f2=TFile::Open("pdgToReco2.root");
	
	TFile* tf1[nMasspoint];
	int masspoint[nMasspoint]={1000,1200,1400,1600,1800,2000,2500,3000};
	for(int i=0;i<nMasspoint;i++){
		tf1[i]=TFile::Open(Form("corr2/B%d.root",masspoint[i]));
		//f[i+11]=TFile::Open(Form("R%s.root",masspoint[i].data()));
	}
	double xsec[nMasspoint]={1.90,0.763,0.33,0.155,7.65e-2,1.58e-2,3.73e-3,2.08e-4,4.91e-5};
		
	double ptBins[14]={300,400,500,600,700,800,900,1000,1250,1500,1750,2000,2500};
	double ptBinsCenter[14]={350,450,550,650,750,850,950,1125,1375,1625,1875,2250,2750};
	double ptBinsCenterE[14]={350,450,550,650,750,850,950,1125,1375,1625,1875,2250,2750};
	double ptBinsError[14]={0};
	double ptBinsErrorE[14]={0};
	
	double mean[6][15];
	double sigma[6][15];
	
	
	TLegend *leg = new TLegend(0.68, 0.45, 0.94, 0.90);
  
  leg->SetBorderSize(0);
  leg->SetFillColor(0);
  leg->SetFillStyle(0);
  leg->SetTextSize(0.04);
	
	
	TGraphErrors* tg1[nMasspoint];
	
	for(int k=0;k<nMasspoint;k++){
		for(int i=0;i<13;i++){
		TH1D* th1=(TH1D	*)tf1[k]->Get(Form("ptBarel%.0f",ptBins[i]));
		ptBinsCenter[i]=th1->GetMean();
		ptBinsError[i]=th1->GetRMS();
		cout<<i<<","<<ptBinsCenter[i]<<","<<ptBinsError[i]<<endl;
	}
	
	
		
		for(int i=0;i<13;i++){
		TH1D* th1=(TH1D*)tf1[k]->Get(Form("recoBarelMass%.0f",ptBins[i]));
		TF1 *tf1[4];
	if(i<3){
			tf1[0]=new TF1("fa1","gaus(25000)",th1->GetMaximumBin()-30,th1->GetMaximumBin()+30);
		th1->Fit(tf1[0],"","",th1->GetMaximumBin()-30,th1->GetMaximumBin()+30);
		}
		else {
			tf1[0]=new TF1("fa1","gaus(25000)",th1->GetMaximumBin()-20,th1->GetMaximumBin()+20);
		th1->Fit(tf1[0],"","",th1->GetMaximumBin()-20,th1->GetMaximumBin()+20);
		}
		mean[4][i]=125/tf1[0]->GetParameter(1);
		sigma[4][i]=tf1[0]->GetParError(1)*(125/tf1[0]->GetParameter(1))/tf1[0]->GetParameter(1);
		double temp=tf1[0]->GetParError(1)/tf1[0]->GetParameter(1);
		//mean[4][i]=125/th1->GetMean();
		//sigma[4][i]=th1->GetMeanError()/th1->GetMean();
		
		//cout<<i<<"="<<mean[4][i]<<endl;
		//sigma[4][i]=0;
		th1->SetTitle(Form("%.0f",ptBins[i]));
		if(i==0)c1->Print(Form("plots/recoBarel%d.pdf(",masspoint[k]));
		else if(i==12)c1->Print(Form("plots/recoBarel%d.pdf)",masspoint[k]));
		else  c1->Print(Form("plots/recoBarel%d.pdf",masspoint[k]));
		if(th1->GetEntries()<50|| mean[4][i]<0 || mean[4][i]>2.5||temp>0.3){
			mean[4][i]=0;
			sigma[4][i]=0;
		}
	}
	
	
	
	tg1[k]=new TGraphErrors(12,ptBinsCenter,mean[4],ptBinsError,sigma[4]);
	
	
	
	tg1[k]->GetXaxis()->SetTitle("jet Pt");
	tg1[k]->GetXaxis()->SetRangeUser(0,1800);
	tg1[k]->GetYaxis()->SetTitle("M_{PDG}/M_{Reco}");
	tg1[k]->SetTitle("Gen Correction");
	tg1[k]->SetMinimum(0.9);
	tg1[k]->SetMaximum(2.2);
	tg1[k]->SetFillColor(0);
	tg1[k]->SetLineColor(97-5*k);
	tg1[k]->SetMarkerColor(97-5*k);
	tg1[k]->SetMarkerStyle(20+k);
	tg1[k]->SetMarkerSize(2);
	tg1[k]->SetLineWidth(3);
		
		
		leg->AddEntry(tg1[k],Form("M=%d",masspoint[k]));
	
	}
	for(int k=0;k<nMasspoint;k++){
		tg1[k]->GetXaxis()->SetRangeUser(200,2500);
		if(k==0)tg1[k]->Draw("APL");
		else tg1[k]->Draw("samePL");
	
	for(int j=0;j<12;j++){
		double x,y;
		tg1[k]->GetPoint(j,x,y);
		cout<<"k="<<k<<",j="<<j<<","<<x<<","<<y<<endl;
		if(y<0.1){
			tg1[k]->RemovePoint (j);
			//j--;
		}
		tg1[k]->GetPoint(j,x,y);
		cout<<"k="<<k<<",j="<<j<<","<<x<<","<<y<<endl;
	}
	
	for(int j=0;j<12;j++){
		double x,y;
		tg1[k]->GetPoint(j,x,y);
		
		if(y<0.1){
			tg1[k]->RemovePoint (j);
			//j--;
		}
	}
	for(int j=0;j<12;j++){
		double x,y;
		tg1[k]->GetPoint(j,x,y);
		
		if(y<0.1){
			tg1[k]->RemovePoint (j);
			//j--;
		}
	}
	}
	
	
	TGraphErrors* te1=(TGraphErrors*)f2->Get("barel");
	//leg->AddEntry(te1,"avg");
	//te1->Draw("samePL");
	// te1->SetLineColor(1);
	// te1->SetLineWidth(3);
	// te1->SetMarkerColor(1);
	// te1->SetMarkerSize(1.5);
	// te1->SetMarkerStyle(20);
	leg->Draw("same");
	c1->Print("plots/recoOneBarrel.pdf");
	
	
	leg->Clear();
	
		for(int k=0;k<nMasspoint;k++){

	
	for(int i=0;i<11;i++){
		TH1D* th1=(TH1D*)tf1[k]->Get(Form("ptEndcap%.0f",ptBins[i]));
		ptBinsCenterE[i]=th1->GetMean();
		ptBinsErrorE[i]=th1->GetRMS();
		cout<<i<<","<<ptBinsCenterE[i]<<","<<ptBinsErrorE[i]<<endl;
	}
		
		
		for(int i=0;i<13;i++){
		TH1D* th1=(TH1D*)tf1[k]->Get(Form("recoEndcapMass%.0f",ptBins[i]));
		TF1 *tf1[4];
	if(i<3){
			tf1[0]=new TF1("fa1","gaus(25000)",th1->GetMaximumBin()-40,th1->GetMaximumBin()+40);
		th1->Fit(tf1[0],"","",th1->GetMaximumBin()-40,th1->GetMaximumBin()+40);
		}
		else {
			tf1[0]=new TF1("fa1","gaus(25000)",th1->GetMaximumBin()-30,th1->GetMaximumBin()+30);
			tf1[0]->SetParameter(1,100);
		th1->Fit(tf1[0],"","",th1->GetMaximumBin()-30,th1->GetMaximumBin()+30);
		
		}
		mean[4][i]=125/tf1[0]->GetParameter(1);
		sigma[4][i]=tf1[0]->GetParError(1)*(125/tf1[0]->GetParameter(1))/tf1[0]->GetParameter(1);
		double temp=tf1[0]->GetParError(1)/tf1[0]->GetParameter(1);
		//mean[4][i]=125/th1->GetMean();
		//sigma[4][i]=th1->GetMeanError()/th1->GetMean();
		
		//cout<<i<<"="<<mean[4][i]<<endl;
		//sigma[4][i]=0;
		th1->SetTitle(Form("%.0f",ptBins[i]));
		if(i==0)c1->Print(Form("plots/recoEndcap%d.pdf(",masspoint[k]));
		else if(i==12)c1->Print(Form("plots/recoEndcap%d.pdf)",masspoint[k]));
		else  c1->Print(Form("plots/recoEndcap%d.pdf",masspoint[k]));
		if(th1->GetEntries()<50|| mean[4][i]<1 || mean[4][i]>2.5||temp>0.3){
			mean[4][i]=0;
			sigma[4][i]=0;
		}
	}
	
	
	
	tg1[k]=new TGraphErrors(9,ptBinsCenter,mean[4],ptBinsError,sigma[4]);
	
	
	
	tg1[k]->GetXaxis()->SetTitle("jet Pt");
	tg1[k]->GetXaxis()->SetRangeUser(0,1800);
	tg1[k]->GetYaxis()->SetTitle("M_{PDG}/M_{Reco}");
	tg1[k]->SetTitle("Gen Correction");
	tg1[k]->SetMinimum(1);
	tg1[k]->SetMaximum(1.7);
	tg1[k]->SetFillColor(0);
	tg1[k]->SetLineColor(97-5*k);
	tg1[k]->SetMarkerColor(97-5*k);
	tg1[k]->SetMarkerStyle(20+k);
	tg1[k]->SetMarkerSize(2);
	tg1[k]->SetLineWidth(3);
		
		
		leg->AddEntry(tg1[k],Form("M=%d",masspoint[k]));
	
	}
	for(int k=0;k<nMasspoint;k++){
		tg1[k]->GetXaxis()->SetRangeUser(200,2500);
		if(k==0)tg1[k]->Draw("APL");
	else tg1[k]->Draw("samePL");
	
	for(int j=0;j<12;j++){
		double x,y;
		tg1[k]->GetPoint(j,x,y);
		cout<<"k="<<k<<",j="<<j<<","<<x<<","<<y<<endl;
		if(y<0.1){
			tg1[k]->RemovePoint (j);
			//j--;
		}
		tg1[k]->GetPoint(j,x,y);
		cout<<"k="<<k<<",j="<<j<<","<<x<<","<<y<<endl;
	}
	
	for(int j=0;j<12;j++){
		double x,y;
		tg1[k]->GetPoint(j,x,y);
		
		if(y<0.1){
			tg1[k]->RemovePoint (j);
			//j--;
		}
	}
	for(int j=0;j<12;j++){
		double x,y;
		tg1[k]->GetPoint(j,x,y);
		
		if(y<0.1){
			tg1[k]->RemovePoint (j);
			//j--;
		}
	}
	}
	 te1=(TGraphErrors*)f2->Get("endcap");
	//leg->AddEntry(te1,"avg");
	//te1->Draw("samePL");
	// te1->SetLineColor(1);
	// te1->SetLineWidth(3);
	// te1->SetMarkerColor(1);
	// te1->SetMarkerSize(1.5);
	// te1->SetMarkerStyle(20);
	leg->Draw("same");
	c1->Print("plots/recoOneEndcap.pdf");
	
	/*
	
	
	for(int i=0;i<13;i++){
		TH1D* th1=(TH1D*)f->Get(Form("recoEndcapMass%.0f",ptBins[i]));
		TF1 *tf1[4];
		if(i<2){
			tf1[0]=new TF1("fa1","gaus(25000)",th1->GetMaximumBin()-30,th1->GetMaximumBin()+30);
		th1->Fit(tf1[0],"","",th1->GetMaximumBin()-30,th1->GetMaximumBin()+30);
		}
		else {
			tf1[0]=new TF1("fa1","gaus(25000)",th1->GetMaximumBin()-20,th1->GetMaximumBin()+20);
		th1->Fit(tf1[0],"","",th1->GetMaximumBin()-20,th1->GetMaximumBin()+20);
		}
	
		mean[5][i]=125/tf1[0]->GetParameter(1);
		sigma[5][i]=tf1[0]->GetParError(1)*(125/tf1[0]->GetParameter(1)	)/tf1[0]->GetParameter(1);
		//mean[5][i]=125/th1->GetMean();
		//sigma[5][i]=th1->GetMeanError()/th1->GetMean();
			th1->Draw();
			th1->SetTitle(Form("%.0f",ptBins[i]));
		tf1[0]->Draw("same");
	//cout<<i<<"="<<mean[5][i]<<endl;
	
  
	}
	
	
	
	
	TGraphErrors* tg1[6];
	
	tg1[4]=new TGraphErrors(12,ptBinsCenter,mean[4],ptBinsError,sigma[4]);
	tg1[5]=new TGraphErrors(9,ptBinsCenter,mean[5],ptBinsError,sigma[5]);
	
	for(int i=0;i<14;i++)cout<<i<<"="<<mean[4][i]<<endl;
	for(int i=0;i<14;i++)cout<<i<<"="<<mean[5][i]<<endl;
	

	
	
  

	tg1[4]->Draw("APL");
	tg1[4]->SetFillColor(0);
	tg1[5]->SetFillColor(0);
	tg1[5]->SetLineColor(2);
	tg1[5]->SetMarkerColor(2);
	tg1[5]->Draw("PLsame");
	

leg->Clear();


  
  leg->AddEntry(tg1[5],"reco endcap");
  leg->AddEntry(puppisd_corrRECO_cen,"Thea barel");
  leg->AddEntry(puppisd_corrRECO_for,"Thea endcap");

	leg->Draw("same");
	genBarel->Draw("same");
	genEndcap->Draw("same");
	puppisd_corrRECO_cen->SetLineColor(3);
	puppisd_corrRECO_for->SetLineColor(4);
	//tg1[2]->Draw("APL");
	puppisd_corrRECO_cen->Draw("same");
	puppisd_corrRECO_for->Draw("same");
	
	c1->Print("plots/recoOne.pdf");
	*/
}
Ejemplo n.º 9
0
void flagNoiseMatrixGraphs(TString myFileName){  
gSystem->cd("images/NoiseMatrix");
gSystem->cd(myFileName);

TCanvas *flagNoiseMatrixCanv = new TCanvas("flagNoiseMatrixCanv", "flagNoiseMatrixCanv", 200,10,800,800);
flagNoiseMatrixCanv->SetCanvasSize(1200,800);
flagNoiseMatrixCanv->cd();
flagNoiseMatrixGraph_1D = new TH1F("flagNoiseMatrixGraph_1D", "flagNoiseMatrixGraph_1D", 5, 0, 5);
flagNoiseMatrixGraph_1D->GetYaxis()->SetTitle("Number of flag of each type");
flagNoiseMatrixGraph_1D->GetYaxis()->SetLabelSize(0.035);

TLegend *LegNoiseMatrix = new TLegend(0.7,0.5,0.89,0.7);
LegNoiseMatrix->SetHeader("Noise Matrix Flags Definitions");
LegNoiseMatrix->SetFillColor(0);
LegNoiseMatrix->SetTextSize(0);

Calibration->UseCurrentStyle(); 
Calibration->Draw("flagMatrix>>flagNoiseMatrixGraph_1D"); 

LegNoiseMatrix->AddEntry("", "1: Good");
LegNoiseMatrix->AddEntry("", "2: High Noise");
LegNoiseMatrix->AddEntry("", "3: Low Noise" );
LegNoiseMatrix->Draw("same");

flagNoiseMatrixCanv->Update();

PrintAsGif(flagNoiseMatrixCanv, "flagNoiseMatrixGraph_1D");

///////// CHAMBER flag Graph ///////////////////////
gStyle->SetOptStat(0);
TCanvas *flagNoiseMatrixChamberCanv = new TCanvas("flagNoiseMatrixChamberCanv", "flagNoiseMatrixChamberCanv", 200,10,800,800);
flagNoiseMatrixChamberCanv->SetCanvasSize(1200,800);

//create legend 
TLegend *LegNoiseMatrixChamber = new TLegend(0.85,0.8,0.98,0.98);
LegNoiseMatrixChamber->SetHeader("Noise Matrix Flags Definitions");
LegNoiseMatrixChamber->SetFillColor(0);
LegNoiseMatrixChamber->SetTextSize(0);

//final histogram for display
flagNoiseMatrixGraph_2D_Chamber = new TH2F("flagNoiseMatrixGraph_2D_Chamber", "flagNoiseMatrixGraph_2D_Chamber", 9, 0, 9, 4, 0, 4);
///dummy histo to get bin maximum
flagNoiseMatrixGraph_2D_Chamber0 = new TH2F("flagNoiseMatrixGraph_2D_Chamber0", "flagNoiseMatrixGraph_2D_Chamber0", 9, 0, 9, 4, 0, 4);
//one histo for each flag value. 
flagNoiseMatrixGraph_2D_Chamber1 = new TH2F("flagNoiseMatrixGraph_2D_Chamber1", "flagNoiseMatrixGraph_2D_Chamber1", 9, 0, 9, 4, 0, 4);
flagNoiseMatrixGraph_2D_Chamber2 = new TH2F("flagNoiseMatrixGraph_2D_Chamber2", "flagNoiseMatrixGraph_2D_Chamber2", 9, 0, 9, 4, 0, 4);
flagNoiseMatrixGraph_2D_Chamber3 = new TH2F("flagNoiseMatrixGraph_2D_Chamber3", "flagNoiseMatrixGraph_2D_Chamber3", 9, 0, 9, 4, 0, 4);
flagNoiseMatrixGraph_2D_Chamber4 = new TH2F("flagNoiseMatrixGraph_2D_Chamber4", "flagNoiseMatrixGraph_2D_Chamber4", 9, 0, 9, 4, 0, 4);

//fill completley, get bin maximum, set it for overall graph
Calibration->Project("flagNoiseMatrixGraph_2D_Chamber0", "flagMatrix:cham"); 
Double_t binMaxValCham = flagNoiseMatrixGraph_2D_Chamber0->GetMaximum();
//normalize each box appropriately, with respect to the most filled box
flagNoiseMatrixGraph_2D_Chamber->SetMaximum(binMaxValCham);

//fill each "bin"
Calibration->Project("flagNoiseMatrixGraph_2D_Chamber1","flagMatrix:cham", "flagMatrix==1", "box"); 
Calibration->Project("flagNoiseMatrixGraph_2D_Chamber2","flagMatrix:cham", "flagMatrix==2", "box"); 
Calibration->Project("flagNoiseMatrixGraph_2D_Chamber3","flagMatrix:cham", "flagMatrix==3", "box"); 

//set appropriate colors
flagNoiseMatrixGraph_2D_Chamber1->SetFillColor(1);//Black for eveything is OK
flagNoiseMatrixGraph_2D_Chamber2->SetFillColor(2);//red for VERY BAD
flagNoiseMatrixGraph_2D_Chamber3->SetFillColor(3);//Green for pretty good

int idArray[9];
GetChamberIDs(idArray);
for (int chamNum = 0; chamNum<9; ++chamNum){
int chamNumPlus = chamNum + 1; //for bin access

Int_t chamber_id_int = idArray[chamNum]; //set individual id as int
std::stringstream chamber_id_stream;     //define variable in intermediate format
chamber_id_stream << chamber_id_int;     //convert from int to intermediate "stringstream" format
TString chamber_id_str = chamber_id_stream.str();  //convert from stream into string
 if (chamber_id_str.BeginsWith("220")==0 ){  //binary check, i.e. if the string doesn't begin with 220
   chamber_id_str=0;                         //clean out; set to 0.
 }else{
   chamber_id_str.Remove(8,8);               //remove 0 at end
   chamber_id_str.Remove(0,3);               //remove 220 at beginning 
 }
flagNoiseMatrixGraph_2D_Chamber->GetXaxis()->SetBinLabel(chamNumPlus,chamber_id_str); //set bins to have chamber names
}

flagNoiseMatrixGraph_2D_Chamber->GetYaxis()->SetTitle("Flag");
flagNoiseMatrixGraph_2D_Chamber->GetXaxis()->SetTitle("Chamber");

flagNoiseMatrixChamberCanv->cd();  
//draw original histogram, empty
flagNoiseMatrixGraph_2D_Chamber->Draw("box");
//overlay the individual "bin" graphs
flagNoiseMatrixGraph_2D_Chamber1->Draw("samebox");
flagNoiseMatrixGraph_2D_Chamber2->Draw("samebox");
flagNoiseMatrixGraph_2D_Chamber3->Draw("samebox");
flagNoiseMatrixGraph_2D_Chamber4->Draw("samebox");

//set legend entries appropriately
LegNoiseMatrixChamber->AddEntry(flagNoiseMatrixGraph_2D_Chamber1, "Good", "f");
LegNoiseMatrixChamber->AddEntry(flagNoiseMatrixGraph_2D_Chamber2, "High Noise", "f");
LegNoiseMatrixChamber->AddEntry(flagNoiseMatrixGraph_2D_Chamber3, "Low noise", "f");
LegNoiseMatrixChamber->Draw("same");

//print as gif
PrintAsGif(flagNoiseMatrixChamberCanv, "flagNoiseMatrixChamber");
gStyle->SetOptStat(0);gSystem->cd("../../../");
directoryCheck();
}
Ejemplo n.º 10
0
void TrigEffvJEt(
               //TString infname="/d100/velicanu/tmp/hiexp-hirun2011-r181611-reco-v1-collisionEvents_lowerSC_autohlt.root"
                 //TString infname="/d100/velicanu/tmp/hiexp-hirun2011-r181685-reco-v1-collisionEvents_lowerSC_autohlt.root"
                 //TString infname="../../../trees/hiexp-hirun2011-b9b9-181611.root"
                 //TString infname="../../../trees/hiexp-hirun2011-b170b170_181683to181695.root"
                 TString infname="../../../trees/hiexp-hirun2011-b358b358.root",
                 TString tag = "Bunch358x358_Hbhe",
                 TCut sel = "HLT_HIMinBiasHfOrBSC_v1&&skim.pcollisionEventSelection"
               )
{
   TH1::SetDefaultSumw2();
   TFile * inf = new TFile(infname);
   cout << inf->GetName() << endl;
   
   TTree * t = (TTree*)inf->Get("hltanalysis/HltTree");
   t->AddFriend("skim=skimanalysis/HltTree");
   t->AddFriend("icPu5JetAnalyzer/t");

   TString jetvar = "Max$(jtpt*(abs(jteta)<5))";
   const int nptbins = 13;
   float ptbins[nptbins+1] = {30,35,40,45,50,55,60,65,70,80,90,100,120,150};

   // L1
   Efficiency l1eff1(t,"l1eff1",jetvar,sel,"L1_SingleJet36_BptxAND",50,0,150);
   Efficiency l1eff2(t,"l1eff2",jetvar,sel,"L1_SingleJet52_BptxAND",50,0,150);
   Efficiency l1eff3(t,"l1eff3",jetvar,sel,"L1_SingleJet68_BptxAND",50,0,150);
   Efficiency l1eff4(t,"l1eff4",jetvar,sel,"L1_SingleJet92_BptxAND",50,0,150);
   Efficiency l1eff5(t,"l1eff5",jetvar,sel,"L1_SingleJet128_BptxAND",50,0,150);
   
   TCanvas * c2 = new TCanvas(tag+"c2",tag+"c2",500,500);
   TH1D * hFrame = (TH1D*)l1eff1.hEff->Clone("hFrame");
   hFrame->SetAxisRange(0,1.6,"Y");
   hFrame->SetTitle(";Leading RecoJet p_{T} (GeV/c);Trigger #epsilon");
   hFrame->Draw();

   l1eff1.Draw();
   l1eff2.Draw(kBlue,kOpenCircle);
   l1eff3.Draw(kGreen+3,kOpenSquare);
   l1eff4.Draw(kOrange+3,kOpenTriangleUp);
   l1eff5.Draw(kViolet+3,kOpenDiamond);

   TLine * l = new TLine(0,1,150,1);
   l->SetLineStyle(2);
   l->Draw();
	
   TLegend *leg = new TLegend(0.4,0.71,0.88,0.93);
   leg->SetFillStyle(0);
   leg->SetBorderSize(0);
   leg->SetTextSize(0.035);
   leg->AddEntry(l1eff1.hEff,tag,"");
   leg->AddEntry(l1eff1.hEff,"ICPu5","");
   leg->AddEntry(l1eff1.hEff,"L1_SingleJet36","p");
   leg->AddEntry(l1eff2.hEff,"L1_SingleJet52","p");
   leg->AddEntry(l1eff3.hEff,"L1_SingleJet68","p");
   leg->AddEntry(l1eff4.hEff,"L1_SingleJet92","p");
   leg->AddEntry(l1eff5.hEff,"L1_SingleJet128","p");
   leg->Draw();   
   c2->Print(Form("out/trigVal/L1JetEffvJEt_%s.gif",tag.Data()));
   
   // HLT
   Efficiency hlteff1(t,"hlteff1",jetvar,sel,"HLT_HIJet55_v1",nptbins,ptbins);
   Efficiency hlteff2(t,"hlteff2",jetvar,"HLT_HIJet55_v1&&skim.pcollisionEventSelection","HLT_HIJet65_v1",nptbins,ptbins);
   Efficiency hlteff3(t,"hlteff3",jetvar,"HLT_HIJet65_v1&&skim.pcollisionEventSelection","HLT_HIJet80_v1",nptbins,ptbins);
   //Efficiency hlteff4(t,"hlteff4",jetvar,sel,"HLT_HIJet95_v1",50,0,200);
   //Efficiency hlteff5(t,"hlteff5",jetvar,sel&&"jtpt[1]>55","HLT_HIDiJet55_v1"&&jetcut,50,0,200);
   TCanvas * c3 = new TCanvas(tag+"c3",tag+"c3",500,500);
   TH1D * hFrame3 = (TH1D*)hlteff1.hEff->Clone("hFrame3");
   hFrame3->SetAxisRange(0,150,"X");
   hFrame3->SetAxisRange(0,1.6,"Y");
   hFrame3->SetTitle(";Leading RecoJet p_{T} (GeV/c);Trigger #epsilon");
   hFrame3->Draw();
   
   hlteff1.Draw();
   hlteff2.Draw(kBlue,kOpenCircle);
   hlteff3.Draw(kGreen+2,kOpenSquare);
   //hlteff4.Draw(kOrange+2,kOpenTriangleUp);
   
   TLine * l2 = new TLine(30,1,150,1);
   l2->SetLineStyle(2);
   l2->Draw();
	
   TLegend *leg3 = new TLegend(0.4,0.71,0.88,0.93);
   leg3->SetFillStyle(0);
   leg3->SetBorderSize(0);
   leg3->SetTextSize(0.035);
   leg3->AddEntry(hlteff1.hEff,tag,"");
   leg3->AddEntry(hlteff1.hEff,"ICPu5","");
   leg3->AddEntry(hlteff1.hEff,"HLT_HIJet55_v1","p");
   leg3->AddEntry(hlteff2.hEff,"HLT_HIJet65_v1","p");
   leg3->AddEntry(hlteff3.hEff,"HLT_HIJet80_v1","p");
   //leg3->AddEntry(hlteff5.hEff,"HLT_HIDiJet55_v1","p");
   leg3->Draw();
   c3->Print(Form("out/trigVal/HLTJetEffvJEt_%s.gif",tag.Data()));
}
Ejemplo n.º 11
0
void myPlot(TH1D* h_DY100,
            TH1D* h_DY200,
            TH1D* h_DY400,
            TH1D* h_DY600,
            TH1D* h_TTbar,
            TH1D* h_WW,
            TH1D* h_WZ,
            TH1D* h_ZZ,
            TH1D* h_data0,
	    TH1D* h_data1,
            Double_t scaleDY100,
            Double_t scaleDY200,
            Double_t scaleDY400,
            Double_t scaleDY600,
            Double_t scaleTTbar,
            Double_t scaleWW,
            Double_t scaleWZ,
            Double_t scaleZZ){

  TH1D* h_data = (TH1D*)h_data0->Clone("h_data");

  h_data->Reset();
  h_data->Add(h_data0);
  h_data->Add(h_data1);

  TH1D* h_DY = (TH1D*)h_DY100->Clone("h_DY");

  h_DY->Reset();
  h_DY->Add(h_DY100, scaleDY100);
  h_DY->Add(h_DY200, scaleDY200);
  h_DY->Add(h_DY400, scaleDY400);
  h_DY->Add(h_DY600, scaleDY600);
  h_DY->SetFillColor(kOrange-3);
  h_DY->SetLineColor(kBlack);

  h_TTbar->Scale(scaleTTbar);
  h_TTbar->SetFillColor(kGreen);
  h_TTbar->SetLineColor(kBlack);

  h_WW->Scale(scaleWW);
  h_WW->SetFillColor(kYellow);
  h_WW->SetLineColor(kBlack);

  h_WZ->Scale(scaleWZ);
  h_WZ->SetFillColor(kCyan);
  h_WZ->SetLineColor(kBlack);

  h_ZZ->Scale(scaleZZ);
  h_ZZ->SetFillColor(kPink);
  h_ZZ->SetLineColor(kBlack);

  THStack *h_stack = new THStack("h_stack", "");

  h_stack->Add(h_DY);
  h_stack->Add(h_TTbar);
  h_stack->Add(h_WW);
  h_stack->Add(h_WZ);
  h_stack->Add(h_ZZ);

  h_data->SetLineColor(kBlack);
  h_data->GetXaxis()->SetTitle("");
  h_data->GetXaxis()->SetLabelOffset(999);
  h_data->GetXaxis()->SetLabelSize(0);

  if( h_data->GetMaximum() < h_stack->GetMaximum() ){
  
    h_stack->Draw("histe");
    h_stack->GetHistogram()->GetYaxis()->SetTitle("Event Numbers");
    h_stack->GetHistogram()->GetYaxis()->SetTitleSize(h_data->GetYaxis()->GetTitleSize());
    h_stack->GetHistogram()->GetYaxis()->SetLabelSize(h_data->GetYaxis()->GetLabelSize());
    h_stack->GetHistogram()->GetXaxis()->SetTickLength(0);
    h_stack->GetHistogram()->GetXaxis()->SetLabelOffset(999);
    h_data->Draw("elsame");
  
  }
    
  else{

    h_data->GetYaxis()->SetTitle("Event Numbers");
    h_data->Draw("el");
    h_stack->Draw("histesame");
    h_data->Draw("elsame");

  }
  
  TLegend *leg = new TLegend(0.73, 0.60, 0.90, 0.87);
  
  leg->SetBorderSize(0);
  leg->SetFillColor(0);
  leg->SetFillStyle(0);
  leg->SetTextSize(0.04);
    
  leg->AddEntry(h_DY, "DY+Jets", "f");
  leg->AddEntry(h_TTbar, "t#bar{t}", "f");
  leg->AddEntry(h_WW, "WW", "f");
  leg->AddEntry(h_WZ, "WZ", "f");
  leg->AddEntry(h_ZZ, "ZZ", "f");
  leg->AddEntry(h_data, "Data", "lp");
  leg->Draw();

  TLatex *lar = new TLatex();

  lar->SetNDC(kTRUE);
  lar->SetTextSize(0.04);
  lar->SetLineWidth(5);
  lar->DrawLatex(0.15, 0.94, "CMS preliminary 2015");
  lar->DrawLatex(0.65, 0.94, "L = 831.7 pb^{-1} at #sqrt{s} = 13 TeV");

}
Ejemplo n.º 12
0
void InclusiveJets_2010(){

//general root settings
gROOT->SetStyle("Plain");
gStyle->SetOptStat(0); //get rid of statistics box

TH1::SetDefaultSumw2() ;

//Ranges for plots
Float_t xmin=17.5 , ymin = 0.00001, xmax = 1684.0, ymax = 10000000000000000.;

//for the linecolor and linestyle
Int_t icol[8]={8,kViolet,7,4,12,46,6,7};
Int_t isty[8]={1,1,1,1,1,1,1,1};
Int_t imark[5] = {21,22,25,26,3};

//get the root files
TFile *f[3]; // POWHEG + Pythia
TFile *g[1]; //Herwig
TFile *p[1]; //Pythia
f[0] = new TFile("out_aida_40times900kevents_errorcut50/Z2MPIHADONbornkt5ktsupp250_errorcut.root");
f[1] = new TFile("out_aida_40times900kevents_errorcut50/Z2MPIHADOFFbornkt5ktsupp250_errorcut.root");
f[2] = new TFile("out_aida_40times900kevents_errorcut50/NOTUNEbornkt5ktsupp250_errorcut.root");

g[0] = new TFile("out_aida_40times900kevents_errorcut50/HERWIGMPIHADONbornkt5ktsupp250_1.root"); // from POWHEG and HERWIG

//files from Paolo ---- only Pythia Z2
p[0] = new TFile("FromPaolo/2010PYTHIA.root");


//get the Tgraph and convert into histo
TH1F _histotmp[6][3];
TH1F _histotmp_pyth[6][1];
TH1F _histotmp_herw[6][1];

_histotmp_herw[0][0] = Gr2Hi((TGraph*) g[0]->Get("d01_x01_y01;1")); // |y| < 0.5
_histotmp_herw[1][0] = Gr2Hi((TGraph*) g[0]->Get("d02_x01_y01;1")); // 0.5 < |y| < 1.0
_histotmp_herw[2][0] = Gr2Hi((TGraph*) g[0]->Get("d03_x01_y01;1")); // 1.0 < |y| < 1.5
_histotmp_herw[3][0] = Gr2Hi((TGraph*) g[0]->Get("d04_x01_y01;1")); // 1.5 < |y| < 2.0
_histotmp_herw[4][0] = Gr2Hi((TGraph*) g[0]->Get("d05_x01_y01;1")); // 2.0 < |y| < 2.5
_histotmp_herw[5][0] = Gr2Hi((TGraph*) g[0]->Get("d06_x01_y01;1")); //  2.5 < |y| < 3.0

_histotmp_pyth[0][0] = Gr2Hi((TGraph*) p[0]->Get("d01_x01_y01;1")); // |y| < 0.5
_histotmp_pyth[1][0] = Gr2Hi((TGraph*) p[0]->Get("d02_x01_y01;1")); // 0.5 < |y| < 1.0
_histotmp_pyth[2][0] = Gr2Hi((TGraph*) p[0]->Get("d03_x01_y01;1")); // 1.0 < |y| < 1.5
_histotmp_pyth[3][0] = Gr2Hi((TGraph*) p[0]->Get("d04_x01_y01;1")); // 1.5 < |y| < 2.0
_histotmp_pyth[4][0] = Gr2Hi((TGraph*) p[0]->Get("d05_x01_y01;1")); // 2.0 < |y| < 2.5
_histotmp_pyth[5][0] = Gr2Hi((TGraph*) p[0]->Get("d06_x01_y01;1")); //  2.5 < |y| < 3.0

Int_t n = 3; //number of files
Int_t nh = 6; // number of histograms = number of y bins

for(const int ifile = 0; ifile < n; ifile++){

  _histotmp[0][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d01_x01_y01;1")); // |y| <0.5
  _histotmp[1][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d02_x01_y01;2")); // 0.5 < |y| < 1.0
  _histotmp[2][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d03_x01_y01;2")); // 1.0 < |y| < 1.5
  _histotmp[3][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d04_x01_y01;2")); // 1.5 < |y| < 2.0
  _histotmp[4][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d05_x01_y01;1")); // 2.0 < |y| < 2.5
  _histotmp[5][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d06_x01_y01;1")); // 2.5 < |y| < 3.0
/*
  _histotmp[0][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d01_x01_y01;1")); // |y| <0.5
  _histotmp[1][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d02_x01_y01;1")); // 0.5 < |y| < 1.0
  _histotmp[2][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d03_x01_y01;1")); // 1.0 < |y| < 1.5
  _histotmp[3][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d04_x01_y01;1")); // 1.5 < |y| < 2.0
  _histotmp[4][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d05_x01_y01;1")); // 2.0 < |y| < 2.5
  _histotmp[5][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d06_x01_y01;1")); // 2.5 < |y| < 3.0
*/
  for(const int ihisto = 0; ihisto < nh; ihisto++){
    _histotmp_herw[ihisto][0].SetName("");
    _histotmp_pyth[ihisto][0].SetName("");
    _histotmp[ihisto][ifile].SetName("");
  }
}

//change the histo so that I can plot it and do the ratio
 TH1F *_histo[6][3];

 TH1F *_histo_herw[6][1];
 TH1F *_histo_pyth[6][1];

for(const int ifile = 0; ifile < n; ifile++){
  for(const int ihisto = 0; ihisto < nh; ihisto++){

    TH1F *_histo[ihisto][ifile]= (TH1F*)_histotmp[ihisto][ifile].Clone("");
/*
  _histo[ihisto][ifile]->Divide((TH1*)_histo[ihisto][1]);  //histo 0 / hsito 1
  TH1F *_ratio1[ihisto]= (TH1F*)_ratiotmp1[ihisto]->Clone("");
  _ratiotmp2[ihisto]->Divide((TH1*)_histo[ihisto][2]);  //histo 0 / hsito 2
  TH1F *_ratio2[ihisto]= (TH1F*)_ratiotmp2[ihisto]->Clone("");
*/
    _histo[ihisto][ifile]->SetLineWidth(2);
    _histo[ihisto][ifile]->SetLineColor(icol[ihisto]);
    _histo[ihisto][ifile]->SetMarkerStyle(2);
    _histo[ihisto][ifile]->SetMarkerColor(icol[ihisto]);

 TH1F *_histo_herw[ihisto][0] = (TH1F*) _histotmp_herw[ihisto][0].Clone("");
 _histo_herw[ihisto][0]->SetLineWidth(2);
 _histo_herw[ihisto][0]->SetLineColor(1);
 _histo_herw[ihisto][0]->SetMarkerStyle(2);
 _histo_herw[ihisto][0]->SetMarkerColor(1);

 TH1F *_histo_pyth[ihisto][0] = (TH1F*) _histotmp_pyth[ihisto][0].Clone("");
 _histo_pyth[ihisto][0]->SetLineWidth(2);
 _histo_pyth[ihisto][0]->SetLineStyle(3);
 _histo_pyth[ihisto][0]->SetLineColor(icol[ihisto]);
 _histo_pyth[ihisto][0]->SetMarkerStyle(2);
 _histo_pyth[ihisto][0]->SetMarkerColor(icol[ihisto]);
  }

//scale the histos that it fits in one histogram
_histo[0][ifile]->Scale(10000);
_histo[1][ifile]->Scale(1000);
_histo[2][ifile]->Scale(100);
_histo[3][ifile]->Scale(10);
_histo[4][ifile]->Scale(1);

}

_histo_herw[0][0]->Scale(10000);
_histo_herw[1][0]->Scale(1000);
_histo_herw[2][0]->Scale(100);
_histo_herw[3][0]->Scale(10);
_histo_herw[4][0]->Scale(1);

_histo_pyth[0][0]->Scale(10000);
_histo_pyth[1][0]->Scale(1000);
_histo_pyth[2][0]->Scale(100);
_histo_pyth[3][0]->Scale(10);
_histo_pyth[4][0]->Scale(1);

//get the data 2010
//data =  new TFile("out_aida/CMS_2011_S9086218.root");

//TH1F _histodata1 = Gr2Hi((TGraph*)data->Get("d01_x01_y01;1")); // |y| <0.5
//TH1F _histodata2 = Gr2Hi((TGraph*)data->Get("d02_x01_y01;1")); // 0.5 < |y| < 1.0
//TH1F _histodata3 = Gr2Hi((TGraph*)data->Get("d03_x01_y01;1")); // 1.0 < |y| < 1.5
//TH1F _histodata4 = Gr2Hi((TGraph*)data->Get("d04_x01_y01;1")); // 1.5 < |y| < 2.0
//TH1F _histodata5 = Gr2Hi((TGraph*)data->Get("d05_x01_y01;1")); // 2.0 < |y| < 2.5
//TH1F _histodata6 = Gr2Hi((TGraph*)data->Get("d06_x01_y01;1")); // 2.5 < |y| < 3.0


   Double_t xAxis1[35] = {18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 468, 507, 548, 592, 638, 686, 737, 846, 1684}; 

   TH1F *d01_x01_y01_histo = new TH1F("d01_x01_y01_histo","d01_x01_y01_histo",34, xAxis1);
   d01_x01_y01_histo->SetBinContent(1,1.97e+11);
   d01_x01_y01_histo->SetBinContent(2,1.02e+11);
   d01_x01_y01_histo->SetBinContent(3,5.14e+10);
   d01_x01_y01_histo->SetBinContent(4,2.66e+10);
   d01_x01_y01_histo->SetBinContent(5,1.38e+10);
   d01_x01_y01_histo->SetBinContent(6,6.53e+09);
   d01_x01_y01_histo->SetBinContent(7,3.35e+09);
   d01_x01_y01_histo->SetBinContent(8,1.8e+09);
   d01_x01_y01_histo->SetBinContent(9,9.2e+08);
   d01_x01_y01_histo->SetBinContent(10,4.66e+08);
   d01_x01_y01_histo->SetBinContent(11,2.37e+08);
   d01_x01_y01_histo->SetBinContent(12,1.18e+08);
   d01_x01_y01_histo->SetBinContent(13,5.43e+07);
   d01_x01_y01_histo->SetBinContent(14,2.39e+07);
   d01_x01_y01_histo->SetBinContent(15,1.08e+07);
   d01_x01_y01_histo->SetBinContent(16,5240000);
   d01_x01_y01_histo->SetBinContent(17,2610000);
   d01_x01_y01_histo->SetBinContent(18,1360000);
   d01_x01_y01_histo->SetBinContent(19,716000);
   d01_x01_y01_histo->SetBinContent(20,381000);
   d01_x01_y01_histo->SetBinContent(21,207000);
   d01_x01_y01_histo->SetBinContent(22,117000);
   d01_x01_y01_histo->SetBinContent(23,66800);
   d01_x01_y01_histo->SetBinContent(24,37900);
   d01_x01_y01_histo->SetBinContent(25,22000);
   d01_x01_y01_histo->SetBinContent(26,12900);
   d01_x01_y01_histo->SetBinContent(27,7540);
   d01_x01_y01_histo->SetBinContent(28,4410);
   d01_x01_y01_histo->SetBinContent(29,2770);
   d01_x01_y01_histo->SetBinContent(30,1450);
   d01_x01_y01_histo->SetBinContent(31,846);

   d01_x01_y01_histo->SetBinContent(32,499);
   d01_x01_y01_histo->SetBinContent(33,205);

   d01_x01_y01_histo->SetBinContent(34,20.2);

   d01_x01_y01_histo->SetBinError(1,2.547782e+10);
   d01_x01_y01_histo->SetBinError(2,1.24325e+10);
   d01_x01_y01_histo->SetBinError(3,6.016764e+09);
   d01_x01_y01_histo->SetBinError(4,3.005329e+09);
   d01_x01_y01_histo->SetBinError(5,1.530463e+09);
   d01_x01_y01_histo->SetBinError(6,7.056178e+08);
   d01_x01_y01_histo->SetBinError(7,3.617535e+08);
   d01_x01_y01_histo->SetBinError(8,1.96072e+08);
   d01_x01_y01_histo->SetBinError(9,9.919588e+07);
   d01_x01_y01_histo->SetBinError(10,5.102008e+07);
   d01_x01_y01_histo->SetBinError(11,2.639067e+07);
   d01_x01_y01_histo->SetBinError(12,1.335539e+07);
   d01_x01_y01_histo->SetBinError(13,6258885);
   d01_x01_y01_histo->SetBinError(14,2836105);
   d01_x01_y01_histo->SetBinError(15,1319900);
   d01_x01_y01_histo->SetBinError(16,663920.6);
   d01_x01_y01_histo->SetBinError(17,342646.4);
   d01_x01_y01_histo->SetBinError(18,184642.2);
   d01_x01_y01_histo->SetBinError(19,100845.5);
   d01_x01_y01_histo->SetBinError(20,55764.14);
   d01_x01_y01_histo->SetBinError(21,31565.29);
   d01_x01_y01_histo->SetBinError(22,18614.95);
   d01_x01_y01_histo->SetBinError(23,11075.51);
   d01_x01_y01_histo->SetBinError(24,6579.499);
   d01_x01_y01_histo->SetBinError(25,4015.708);
   d01_x01_y01_histo->SetBinError(26,2479.083);
   d01_x01_y01_histo->SetBinError(27,1527.99);
   d01_x01_y01_histo->SetBinError(28,943.6936);
   d01_x01_y01_histo->SetBinError(29,627.92);
   d01_x01_y01_histo->SetBinError(30,350.3168);
   d01_x01_y01_histo->SetBinError(31,219.1467);
   d01_x01_y01_histo->SetBinError(32,139.7467);
   d01_x01_y01_histo->SetBinError(33,62.02427);
   d01_x01_y01_histo->SetBinError(34,7.233998);
   d01_x01_y01_histo->SetEntries(34);
   d01_x01_y01_histo->SetStats(0);

   //d01_x01_y01_histo->Scale(10000);
   d01_x01_y01_histo->SetLineWidth(2);
   d01_x01_y01_histo->SetMarkerStyle(21);
   d01_x01_y01_histo->SetMarkerSize(0.7);
   d01_x01_y01_histo->SetFillColor(kGray);

   Double_t xAxis2[34] = {18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 468, 507, 548, 592, 638, 686, 790, 1684}; 

   TH1F *d02_x01_y01_histo = new TH1F("d02_x01_y01_histo","d02_x01_y01_histo",33, xAxis2);
   d02_x01_y01_histo->SetBinContent(1,1.89e+10);
   d02_x01_y01_histo->SetBinContent(2,9.74e+09);
   d02_x01_y01_histo->SetBinContent(3,4.99e+09);
   d02_x01_y01_histo->SetBinContent(4,2.49e+09);
   d02_x01_y01_histo->SetBinContent(5,1.31e+09);
   d02_x01_y01_histo->SetBinContent(6,6.28e+08);
   d02_x01_y01_histo->SetBinContent(7,3.23e+08);
   d02_x01_y01_histo->SetBinContent(8,1.71e+08);
   d02_x01_y01_histo->SetBinContent(9,8.84e+07);
   d02_x01_y01_histo->SetBinContent(10,4.42e+07);
   d02_x01_y01_histo->SetBinContent(11,2.22e+07);
   d02_x01_y01_histo->SetBinContent(12,1.13e+07);
   d02_x01_y01_histo->SetBinContent(13,5130000);
   d02_x01_y01_histo->SetBinContent(14,2230000);
   d02_x01_y01_histo->SetBinContent(15,1010000);
   d02_x01_y01_histo->SetBinContent(16,482000);
   d02_x01_y01_histo->SetBinContent(17,238000);
   d02_x01_y01_histo->SetBinContent(18,122000);
   d02_x01_y01_histo->SetBinContent(19,64200);
   d02_x01_y01_histo->SetBinContent(20,34100);
   d02_x01_y01_histo->SetBinContent(21,18700);
   d02_x01_y01_histo->SetBinContent(22,10100);
   d02_x01_y01_histo->SetBinContent(23,5720);
   d02_x01_y01_histo->SetBinContent(24,3420);
   d02_x01_y01_histo->SetBinContent(25,1890);
   d02_x01_y01_histo->SetBinContent(26,1130);
   d02_x01_y01_histo->SetBinContent(27,590);
   d02_x01_y01_histo->SetBinContent(28,376);
   d02_x01_y01_histo->SetBinContent(29,196);
   d02_x01_y01_histo->SetBinContent(30,130);

   d02_x01_y01_histo->SetBinContent(31,62.4);
   d02_x01_y01_histo->SetBinContent(32,30.1);
   d02_x01_y01_histo->SetBinContent(33,2.14);

   d02_x01_y01_histo->SetBinError(1,2.47211e+09);
   d02_x01_y01_histo->SetBinError(2,1.196891e+09);
   d02_x01_y01_histo->SetBinError(3,5.890842e+08);
   d02_x01_y01_histo->SetBinError(4,2.837945e+08);
   d02_x01_y01_histo->SetBinError(5,1.465766e+08);
   d02_x01_y01_histo->SetBinError(6,6.848512e+07);
   d02_x01_y01_histo->SetBinError(7,3.536592e+07);
   d02_x01_y01_histo->SetBinError(8,1.879562e+07);
   d02_x01_y01_histo->SetBinError(9,9619569);
   d02_x01_y01_histo->SetBinError(10,4860292);
   d02_x01_y01_histo->SetBinError(11,2483524);
   d02_x01_y01_histo->SetBinError(12,1278948);
   d02_x01_y01_histo->SetBinError(13,596427.3);
   d02_x01_y01_histo->SetBinError(14,266851);
   d02_x01_y01_histo->SetBinError(15,124973);
   d02_x01_y01_histo->SetBinError(16,61551.8);
   d02_x01_y01_histo->SetBinError(17,31482.64);
   d02_x01_y01_histo->SetBinError(18,16749.58);
   d02_x01_y01_histo->SetBinError(19,9172.852);
   d02_x01_y01_histo->SetBinError(20,5077.065);
   d02_x01_y01_histo->SetBinError(21,2898.771);
   d02_x01_y01_histo->SetBinError(22,1633.017);
   d02_x01_y01_histo->SetBinError(23,965.8504);
   d02_x01_y01_histo->SetBinError(24,606.0352);
   d02_x01_y01_histo->SetBinError(25,351.8168);
   d02_x01_y01_histo->SetBinError(26,221.2594);
   d02_x01_y01_histo->SetBinError(27,122.0002);
   d02_x01_y01_histo->SetBinError(28,82.34314);
   d02_x01_y01_histo->SetBinError(29,45.69701);
   d02_x01_y01_histo->SetBinError(30,32.27314);
   d02_x01_y01_histo->SetBinError(31,16.82748);
   d02_x01_y01_histo->SetBinError(32,8.687436);
   d02_x01_y01_histo->SetBinError(33,0.745178);
   d02_x01_y01_histo->SetEntries(33);
   d02_x01_y01_histo->SetStats(0);

   d02_x01_y01_histo->SetLineStyle(0);
   d02_x01_y01_histo->SetLineWidth(2);
   d02_x01_y01_histo->SetMarkerStyle(22);
   d02_x01_y01_histo->SetMarkerSize(0.7);
   d02_x01_y01_histo->SetFillColor(kGray);


   Double_t xAxis3[33] = {18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 468, 507, 548, 592, 638, 686, 1410}; 

   TH1F *d03_x01_y01_histo = new TH1F("d03_x01_y01_histo","d03_x01_y01_histo",32, xAxis3);
   d03_x01_y01_histo->SetBinContent(1,1.84e+09);
   d03_x01_y01_histo->SetBinContent(2,9.24e+08);
   d03_x01_y01_histo->SetBinContent(3,4.64e+08);
   d03_x01_y01_histo->SetBinContent(4,2.34e+08);
   d03_x01_y01_histo->SetBinContent(5,1.19e+08);
   d03_x01_y01_histo->SetBinContent(6,5.88e+07);
   d03_x01_y01_histo->SetBinContent(7,2.92e+07);
   d03_x01_y01_histo->SetBinContent(8,1.57e+07);
   d03_x01_y01_histo->SetBinContent(9,8090000);
   d03_x01_y01_histo->SetBinContent(10,4090000);
   d03_x01_y01_histo->SetBinContent(11,2050000);
   d03_x01_y01_histo->SetBinContent(12,994000);
   d03_x01_y01_histo->SetBinContent(13,452000);
   d03_x01_y01_histo->SetBinContent(14,192000);
   d03_x01_y01_histo->SetBinContent(15,86200);
   d03_x01_y01_histo->SetBinContent(16,40500);
   d03_x01_y01_histo->SetBinContent(17,20100);
   d03_x01_y01_histo->SetBinContent(18,10000);
   d03_x01_y01_histo->SetBinContent(19,5210);
   d03_x01_y01_histo->SetBinContent(20,2720);
   d03_x01_y01_histo->SetBinContent(21,1470);
   d03_x01_y01_histo->SetBinContent(22,803);
   d03_x01_y01_histo->SetBinContent(23,435);
   d03_x01_y01_histo->SetBinContent(24,252);
   d03_x01_y01_histo->SetBinContent(25,138);
   d03_x01_y01_histo->SetBinContent(26,75.7);
   d03_x01_y01_histo->SetBinContent(27,43.1);
   d03_x01_y01_histo->SetBinContent(28,23.5);
   d03_x01_y01_histo->SetBinContent(29,13.1);

   d03_x01_y01_histo->SetBinContent(30,6.96);
   d03_x01_y01_histo->SetBinContent(31,3.31);
   d03_x01_y01_histo->SetBinContent(32,0.263);

   d03_x01_y01_histo->SetBinError(1,3.267438e+08);
   d03_x01_y01_histo->SetBinError(2,1.460402e+08);
   d03_x01_y01_histo->SetBinError(3,6.756898e+07);
   d03_x01_y01_histo->SetBinError(4,3.169167e+07);
   d03_x01_y01_histo->SetBinError(5,1.534246e+07);
   d03_x01_y01_histo->SetBinError(6,7206299);
   d03_x01_y01_histo->SetBinError(7,3487964);
   d03_x01_y01_histo->SetBinError(8,1852766);
   d03_x01_y01_histo->SetBinError(9,937690);
   d03_x01_y01_histo->SetBinError(10,474695.6);
   d03_x01_y01_histo->SetBinError(11,239744.8);
   d03_x01_y01_histo->SetBinError(12,117028.5);
   d03_x01_y01_histo->SetBinError(13,54375.43);
   d03_x01_y01_histo->SetBinError(14,23751.81);
   d03_x01_y01_histo->SetBinError(15,11010.17);
   d03_x01_y01_histo->SetBinError(16,5355.962);
   d03_x01_y01_histo->SetBinError(17,2760.221);
   d03_x01_y01_histo->SetBinError(18,1428.408);
   d03_x01_y01_histo->SetBinError(19,775.8965);
   d03_x01_y01_histo->SetBinError(20,422.7916);
   d03_x01_y01_histo->SetBinError(21,238.9779);
   d03_x01_y01_histo->SetBinError(22,137.1344);
   d03_x01_y01_histo->SetBinError(23,78.10703);
   d03_x01_y01_histo->SetBinError(24,47.62767);
   d03_x01_y01_histo->SetBinError(25,27.54976);
   d03_x01_y01_histo->SetBinError(26,16.01829);
   d03_x01_y01_histo->SetBinError(27,9.722084);
   d03_x01_y01_histo->SetBinError(28,5.653863);
   d03_x01_y01_histo->SetBinError(29,3.37332);
   d03_x01_y01_histo->SetBinError(30,1.948179);
   d03_x01_y01_histo->SetBinError(31,1.026618);
   d03_x01_y01_histo->SetBinError(32,0.09205037);
   d03_x01_y01_histo->SetEntries(32);
   d03_x01_y01_histo->SetStats(0);

   d03_x01_y01_histo->SetLineStyle(0);
   d03_x01_y01_histo->SetLineWidth(2);
   d03_x01_y01_histo->SetMarkerStyle(25);
   d03_x01_y01_histo->SetMarkerSize(0.7);
   d03_x01_y01_histo->SetFillColor(kGray);

   Double_t xAxis4[30] = {18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 468, 507, 548, 1032}; 

   TH1F *d04_x01_y01_histo = new TH1F("d04_x01_y01_histo","d04_x01_y01_histo",29, xAxis4);
   d04_x01_y01_histo->SetBinContent(1,1.44e+08);
   d04_x01_y01_histo->SetBinContent(2,7.35e+07);
   d04_x01_y01_histo->SetBinContent(3,3.8e+07);
   d04_x01_y01_histo->SetBinContent(4,1.89e+07);
   d04_x01_y01_histo->SetBinContent(5,9700000);
   d04_x01_y01_histo->SetBinContent(6,4670000);
   d04_x01_y01_histo->SetBinContent(7,2280000);
   d04_x01_y01_histo->SetBinContent(8,1220000);
   d04_x01_y01_histo->SetBinContent(9,629000);
   d04_x01_y01_histo->SetBinContent(10,305000);
   d04_x01_y01_histo->SetBinContent(11,151000);
   d04_x01_y01_histo->SetBinContent(12,73400);
   d04_x01_y01_histo->SetBinContent(13,32900);
   d04_x01_y01_histo->SetBinContent(14,13900);
   d04_x01_y01_histo->SetBinContent(15,6160);
   d04_x01_y01_histo->SetBinContent(16,2860);
   d04_x01_y01_histo->SetBinContent(17,1400);
   d04_x01_y01_histo->SetBinContent(18,711);
   d04_x01_y01_histo->SetBinContent(19,356);
   d04_x01_y01_histo->SetBinContent(20,186);
   d04_x01_y01_histo->SetBinContent(21,94.5);
   d04_x01_y01_histo->SetBinContent(22,50.9);
   d04_x01_y01_histo->SetBinContent(23,25.6);
   d04_x01_y01_histo->SetBinContent(24,13.3);
   d04_x01_y01_histo->SetBinContent(25,7);
   d04_x01_y01_histo->SetBinContent(26,3.45);
   d04_x01_y01_histo->SetBinContent(27,1.73);

   d04_x01_y01_histo->SetBinContent(28,0.796);
   d04_x01_y01_histo->SetBinContent(29,0.066);

   d04_x01_y01_histo->SetBinError(1,3.637846e+07);
   d04_x01_y01_histo->SetBinError(2,1.67099e+07);
   d04_x01_y01_histo->SetBinError(3,7851714);
   d04_x01_y01_histo->SetBinError(4,3568673);
   d04_x01_y01_histo->SetBinError(5,1703586);
   d04_x01_y01_histo->SetBinError(6,750723.4);
   d04_x01_y01_histo->SetBinError(7,343490.2);
   d04_x01_y01_histo->SetBinError(8,173448.2);
   d04_x01_y01_histo->SetBinError(9,84294.21);
   d04_x01_y01_histo->SetBinError(10,39082.27);
   d04_x01_y01_histo->SetBinError(11,18979.5);
   d04_x01_y01_histo->SetBinError(12,9119.636);
   d04_x01_y01_histo->SetBinError(13,4140.893);
   d04_x01_y01_histo->SetBinError(14,1810.098);
   d04_x01_y01_histo->SetBinError(15,830.3785);
   d04_x01_y01_histo->SetBinError(16,399.9657);
   d04_x01_y01_histo->SetBinError(17,204.9602);
   d04_x01_y01_histo->SetBinError(18,109.8075);
   d04_x01_y01_histo->SetBinError(19,59.1287);
   d04_x01_y01_histo->SetBinError(20,33.42105);
   d04_x01_y01_histo->SetBinError(21,18.47046);
   d04_x01_y01_histo->SetBinError(22,10.88183);
   d04_x01_y01_histo->SetBinError(23,6.000047);
   d04_x01_y01_histo->SetBinError(24,3.41489);
   d04_x01_y01_histo->SetBinError(25,1.994767);
   d04_x01_y01_histo->SetBinError(26,1.086542);
   d04_x01_y01_histo->SetBinError(27,0.610451);
   d04_x01_y01_histo->SetBinError(28,0.3130872);
   d04_x01_y01_histo->SetBinError(29,0.03211142);
   d04_x01_y01_histo->SetEntries(29);
   d04_x01_y01_histo->SetStats(0);

   d04_x01_y01_histo->SetLineStyle(0);
   d04_x01_y01_histo->SetLineWidth(2);
   d04_x01_y01_histo->SetMarkerStyle(26);
   d04_x01_y01_histo->SetMarkerSize(0.7);
   d04_x01_y01_histo->SetFillColor(kGray);

   Double_t xAxis5[27] = {18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 737};

   TH1F *d05_x01_y01_histo = new TH1F("d05_x01_y01_histo","d05_x01_y01_histo",26, xAxis5);
   d05_x01_y01_histo->SetBinContent(1,1.05e+07);
   d05_x01_y01_histo->SetBinContent(2,5520000);
   d05_x01_y01_histo->SetBinContent(3,2720000);
   d05_x01_y01_histo->SetBinContent(4,1440000);
   d05_x01_y01_histo->SetBinContent(5,738000);
   d05_x01_y01_histo->SetBinContent(6,348000);
   d05_x01_y01_histo->SetBinContent(7,168000);
   d05_x01_y01_histo->SetBinContent(8,89800);
   d05_x01_y01_histo->SetBinContent(9,43800);
   d05_x01_y01_histo->SetBinContent(10,21800);
   d05_x01_y01_histo->SetBinContent(11,10300);
   d05_x01_y01_histo->SetBinContent(12,5030);
   d05_x01_y01_histo->SetBinContent(13,2180);
   d05_x01_y01_histo->SetBinContent(14,896);
   d05_x01_y01_histo->SetBinContent(15,384);
   d05_x01_y01_histo->SetBinContent(16,170);
   d05_x01_y01_histo->SetBinContent(17,78.5);
   d05_x01_y01_histo->SetBinContent(18,35.8);
   d05_x01_y01_histo->SetBinContent(19,16.5);
   d05_x01_y01_histo->SetBinContent(20,7.25);
   d05_x01_y01_histo->SetBinContent(21,3.27);
   d05_x01_y01_histo->SetBinContent(22,1.38);
   d05_x01_y01_histo->SetBinContent(23,0.579);
   d05_x01_y01_histo->SetBinContent(24,0.22);

   d05_x01_y01_histo->SetBinContent(25,0.0808);
   d05_x01_y01_histo->SetBinContent(26,0.00548);

   d05_x01_y01_histo->SetBinError(1,1978672);
   d05_x01_y01_histo->SetBinError(2,935188);
   d05_x01_y01_histo->SetBinError(3,421635.1);
   d05_x01_y01_histo->SetBinError(4,206618.7);
   d05_x01_y01_histo->SetBinError(5,100557.7);
   d05_x01_y01_histo->SetBinError(6,44514.08);
   d05_x01_y01_histo->SetBinError(7,20942.13);
   d05_x01_y01_histo->SetBinError(8,11048.87);
   d05_x01_y01_histo->SetBinError(9,5260.105);
   d05_x01_y01_histo->SetBinError(10,2634.555);
   d05_x01_y01_histo->SetBinError(11,1278.591);
   d05_x01_y01_histo->SetBinError(12,627.8137);
   d05_x01_y01_histo->SetBinError(13,282.1732);
   d05_x01_y01_histo->SetBinError(14,121.6466);
   d05_x01_y01_histo->SetBinError(15,55.24865);
   d05_x01_y01_histo->SetBinError(16,25.82574);
   d05_x01_y01_histo->SetBinError(17,12.76174);
   d05_x01_y01_histo->SetBinError(18,6.253124);
   d05_x01_y01_histo->SetBinError(19,3.142438);
   d05_x01_y01_histo->SetBinError(20,1.508923);
   d05_x01_y01_histo->SetBinError(21,0.7510828);
   d05_x01_y01_histo->SetBinError(22,0.3514478);
   d05_x01_y01_histo->SetBinError(23,0.1646418);
   d05_x01_y01_histo->SetBinError(24,0.071108);
   d05_x01_y01_histo->SetBinError(25,0.02988224);
   d05_x01_y01_histo->SetBinError(26,0.002567773);
   d05_x01_y01_histo->SetEntries(26);
   d05_x01_y01_histo->SetStats(0);

   d05_x01_y01_histo->SetLineStyle(0);
   d05_x01_y01_histo->SetLineWidth(2);
   d05_x01_y01_histo->SetMarkerStyle(3);
   d05_x01_y01_histo->SetMarkerSize(0.7);
   d05_x01_y01_histo->SetFillColor(kGray);

// MC / Data
TH1F *_ratio[6][3];
TH1F *_ratio_pyth[6][1];

for(const int ifile = 0; ifile < n; ifile++){
  for(const int ihisto = 0; ihisto < nh; ihisto++){

    TH1F *_ratio[ihisto][ifile]= (TH1F*)_histo[ihisto][ifile]->Clone("");
    TH1F *_ratio_pyth[ihisto][0]= (TH1F*)_histo_pyth[ihisto][0]->Clone("");

    _ratio[ihisto][ifile]->SetLineWidth(1);
    _ratio[ihisto][ifile]->SetLineColor(icol[ihisto]);
    _ratio[ihisto][ifile]->SetMarkerStyle(imark[ihisto]);
    _ratio[ihisto][ifile]->SetMarkerSize(0.5);
    _ratio[ihisto][ifile]->SetMarkerColor(icol[ihisto]);

    _ratio_pyth[ihisto][0]->SetLineWidth(1);
    _ratio_pyth[ihisto][0]->SetLineColor(icol[ihisto]);
    _ratio_pyth[ihisto][0]->SetLineStyle(3);
    _ratio_pyth[ihisto][0]->SetMarkerStyle(imark[ihisto]);
    _ratio_pyth[ihisto][0]->SetMarkerSize(0.5);
    _ratio_pyth[ihisto][0]->SetMarkerColor(icol[ihisto]);
 }

  _ratio[0][ifile]->Divide((TH1*)d01_x01_y01_histo);  
  _ratio[1][ifile]->Divide((TH1*)d02_x01_y01_histo);  
  _ratio[2][ifile]->Divide((TH1*)d03_x01_y01_histo);  
  _ratio[3][ifile]->Divide((TH1*)d04_x01_y01_histo);  
  _ratio[4][ifile]->Divide((TH1*)d05_x01_y01_histo);  


//  TH1F *_ratio[ihisto]= (TH1F*)_ratiotmp1[ihisto]->Clone("");
// _ratiotmp2[ihisto]->Divide((TH1*)_histo[ihisto][2]);  //histo 0 / hsito 2
//  TH1F *_ratio2[ihisto]= (TH1F*)_ratiotmp2[ihisto]->Clone("");

}

  _ratio_pyth[0][0]->Divide((TH1*)d01_x01_y01_histo);  
  _ratio_pyth[1][0]->Divide((TH1*)d02_x01_y01_histo);  
  _ratio_pyth[2][0]->Divide((TH1*)d03_x01_y01_histo);  
  _ratio_pyth[3][0]->Divide((TH1*)d04_x01_y01_histo);  
  _ratio_pyth[4][0]->Divide((TH1*)d05_x01_y01_histo);  

// Data / MC
TH1F *_ratio_datamc[6][3];
TH1F *_ratio_pyth_datamc[6][1];

    TH1F *_ratio_pyth_datamc[0][0]= (TH1F*)d01_x01_y01_histo->Clone("");
    TH1F *_ratio_pyth_datamc[1][0]= (TH1F*)d02_x01_y01_histo->Clone("");
    TH1F *_ratio_pyth_datamc[2][0]= (TH1F*)d03_x01_y01_histo->Clone("");
    TH1F *_ratio_pyth_datamc[3][0]= (TH1F*)d04_x01_y01_histo->Clone("");
    TH1F *_ratio_pyth_datamc[4][0]= (TH1F*)d05_x01_y01_histo->Clone("");


for(const int ifile = 0; ifile < n; ifile++){

    TH1F *_ratio_datamc[0][ifile]= (TH1F*)d01_x01_y01_histo->Clone("");
    TH1F *_ratio_datamc[1][ifile]= (TH1F*)d02_x01_y01_histo->Clone("");
    TH1F *_ratio_datamc[2][ifile]= (TH1F*)d03_x01_y01_histo->Clone("");
    TH1F *_ratio_datamc[3][ifile]= (TH1F*)d04_x01_y01_histo->Clone("");
    TH1F *_ratio_datamc[4][ifile]= (TH1F*)d05_x01_y01_histo->Clone("");


  for(const int ihisto = 0; ihisto < 5; ihisto++){ 
    _ratio_datamc[ihisto][ifile]->Divide((TH1F*)_histo[ihisto][ifile]); 
	
    _ratio_datamc[ihisto][ifile]->SetLineWidth(1);
    _ratio_datamc[ihisto][ifile]->SetLineColor(icol[ihisto]);
    _ratio_datamc[ihisto][ifile]->SetMarkerStyle(imark[ihisto]);
    _ratio_datamc[ihisto][ifile]->SetMarkerSize(0.5);
    _ratio_datamc[ihisto][ifile]->SetMarkerColor(icol[ihisto]);
    _ratio_datamc[ihisto][ifile]->SetFillColor(0);

    _ratio_pyth_datamc[ihisto][0]->Divide((TH1F*)_histo_pyth[ihisto][0]); 
	
    _ratio_pyth_datamc[ihisto][0]->SetLineWidth(1);
    _ratio_pyth_datamc[ihisto][0]->SetLineColor(icol[ihisto]);
    _ratio_pyth_datamc[ihisto][0]->SetLineStyle(3);
    _ratio_pyth_datamc[ihisto][0]->SetMarkerStyle(imark[ihisto]);
    _ratio_pyth_datamc[ihisto][0]->SetMarkerSize(0.5);
    _ratio_pyth_datamc[ihisto][0]->SetMarkerColor(icol[ihisto]);
    _ratio_pyth_datamc[ihisto][0]->SetFillColor(0);
  }
}

//create a canvas to draw TGraph and TH1F

TCanvas *c1 = new TCanvas("c1", "c1",369,0,680,550);

    //pads (inclusive jet cross section, MC / data )
   Pad_inclJet = new TPad("Pad_inclJet","xs",0.01,0.01,1.0,1.0);
   Pad_inclJet->Draw();

// first pad style
   Pad_inclJet->cd();
   gStyle->SetOptStat(0);
   gPad->SetFillColor(0);
   gPad->SetBorderMode(0);
   gPad->SetBorderSize(2);
   gPad->SetLogy();
   gPad->SetLeftMargin(0.14);
   gPad->SetRightMargin(0.03);
   gPad->SetTopMargin(0.03);
   gPad->SetFrameBorderMode(0);
   gPad->SetFrameBorderMode(0);

//empty histo for border and style

   TH1F *shape = new TH1F("","",1, xmin, xmax);
   shape->SetMinimum(ymin);
   shape->SetMaximum(ymax); 
   shape->GetXaxis()->SetTitle("Jet p_{T} (GeV/c)");
   shape->GetXaxis()->SetLabelSize(0.03);
   shape->GetXaxis()->SetTitleSize(0.03);
   shape->GetXaxis()->SetNdivisions(508);
   shape->GetXaxis()->SetTitleOffset(1.3);
   shape->GetXaxis()->SetMoreLogLabels();
   shape->GetYaxis()->SetTitle("#frac{d^{2}#sigma}{dp_{T}d|y|} (pb/GeV)");
   shape->GetYaxis()->SetLabelSize(0.03);
   shape->GetYaxis()->SetTitleSize(0.03);
   shape->GetYaxis()->SetTitleOffset(1.6);
   shape->Draw("e");

  gPad->SetLogy();
  gPad->SetLogx();

  //data
  d01_x01_y01_histo->Draw("E2same");
  d02_x01_y01_histo->Draw("E2same");
  d03_x01_y01_histo->Draw("E2same");
  d04_x01_y01_histo->Draw("E2same");
  d05_x01_y01_histo->Draw("E2same");

	_histo[0][0]->Draw("E1same");
	_histo[1][0]->Draw("E1same");
	_histo[2][0]->Draw("E1same");
	_histo[3][0]->Draw("E1same");
	_histo[4][0]->Draw("E1same");

//	_histo_herw[0][0]->Draw("E1same");
//	_histo_herw[1][0]->Draw("E1same");
//	_histo_herw[2][0]->Draw("E1same");
//	_histo_herw[3][0]->Draw("E1same");
//	_histo_herw[4][0]->Draw("E1same");


	_histo_pyth[0][0]->Draw("E1same");
	_histo_pyth[1][0]->Draw("E1same");
	_histo_pyth[2][0]->Draw("E1same");
	_histo_pyth[3][0]->Draw("E1same");
	_histo_pyth[4][0]->Draw("E1same");



   TLine *line = new TLine(xmin,1,xmax,1);
   line->SetLineStyle(2);
   line->Draw();

   TPaveText *pt = new TPaveText(0.17,0.79,0.37,0.95,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetTextAlign(12);
   pt->SetTextSize(0.03);
   text = pt->AddText("CMS 2010");
   text = pt->AddText("#sqrt{s} = 7 TeV");
   text = pt->AddText("anti-k_{T} R = 0.5");
   pt->Draw();

TLegend *leg = new TLegend(0.68,0.70,0.83,0.928);
   leg->SetBorderSize(1);
   leg->SetTextSize(0.025);
   leg->SetLineColor(0);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);

   leg->AddEntry((TH1F*)_histo[0][0],"POWHEG & Pythia6 Z2","pfl");
   leg->AddEntry((TH1F*)_histo_pyth[0][0]," Pythia6 Z2","pfl");
   leg->AddEntry((TH1F*)  d01_x01_y01_histo, "|y| <0.5 (x 10^{4})","pfl");
   leg->AddEntry((TH1F*)  d02_x01_y01_histo, "0.5 < |y| < 1.0 (x 10^{3})","pfl");
   leg->AddEntry((TH1F*)  d03_x01_y01_histo, "1.0 < |y| < 1.5 (x 10^{2})","pfl");
   leg->AddEntry((TH1F*)  d04_x01_y01_histo, "1.5 < |y| < 2.0 (x 10^{1})","pfl");
   leg->AddEntry((TH1F*)  d05_x01_y01_histo, "2.0 < |y| < 2.5 (x 10^{0})","pfl");

   leg->Draw();

//write in png file
mysubpad1 =(TPad*)c1->GetPad(0);
mysubpad1->Print("pics/InclusiveJets_xs_10.png");
mysubpad1->Print("~/DESY/ANALYSIS_NOTES/JetCrossSectionsWithPOWHEG/notes/AN-12-236/trunk/plots/InclusiveJets_xs_10.pdf");


// MC / Data 

//create a canvas to draw TGraph and TH1F

TCanvas *c2 = new TCanvas("c2", "c2",369,0,680,550);

   Pad_MCdata1 = new TPad("Pad_MCdata1","ratio",0.01,0.78,1.0,0.95);
   Pad_MCdata1->Draw();
   Pad_MCdata2 = new TPad("Pad_MCdata2","ratio",0.01,0.60,1.0,0.76);
   Pad_MCdata2->Draw();
   Pad_MCdata3 = new TPad("Pad_MCdata3","ratio",0.01,0.42,1.0,0.58);
   Pad_MCdata3->Draw();
   Pad_MCdata4 = new TPad("Pad_MCdata4","ratio",0.01,0.24,1.0,0.40);
   Pad_MCdata4->Draw();
   Pad_MCdata5 = new TPad("Pad_MCdata5","ratio",0.01,0.06,1.0,0.22);
   Pad_MCdata5->Draw();

   Pad_MCdata1->cd();

   gPad->SetFillColor(0);
   gPad->SetBorderMode(0);
   gPad->SetBorderSize(2);
   gPad->SetLeftMargin(0.14);
   gPad->SetRightMargin(0.03);
   gPad->SetTopMargin(0.0);
   gPad->SetFrameBorderMode(0);
   gPad->SetFrameBorderMode(0);

  gPad->SetLogx();

   //AK Empty histo for style and borders
   TH1F *shape_MCdata = new TH1F("","",1, xmin, xmax);
   shape_MCdata->SetMinimum(0.5);
   shape_MCdata->SetMaximum(2.0);
   shape_MCdata->GetXaxis()->SetTitle("Jet p_{T} (GeV/c)");
   shape_MCdata->GetXaxis()->SetLabelSize(0.1);
   shape_MCdata->GetXaxis()->SetTitleSize(0.1);
   shape_MCdata->GetXaxis()->SetTitleOffset(0.6);
   shape_MCdata->GetXaxis()->SetMoreLogLabels();
   shape_MCdata->GetYaxis()->SetTitle("MC/Data");
   shape_MCdata->GetYaxis()->SetLabelSize(0.1);
   shape_MCdata->GetYaxis()->SetTitleSize(0.15);
   shape_MCdata->GetYaxis()->SetTitleOffset(0.2);
   shape_MCdata->GetYaxis()->SetNdivisions(108, kTRUE);   
   shape_MCdata->Draw("e");   

// horizontal line at y = 1
   TLine *line = new TLine(xmin,1,xmax,1);
   line->SetLineStyle(2);
   line->Draw();

   TPaveText *pt = new TPaveText(0.89,0.7,0.94,0.8,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetTextAlign(12);
   pt->SetTextSize(0.15);
   text = pt->AddText("|y| <0.5");
   pt->Draw();

	_ratio[0][0]->Draw("EhistSame");
	_ratio_pyth[0][0]->Draw("EhistSame");

   Pad_MCdata2->cd();

   gPad->SetFillColor(0);
   gPad->SetBorderMode(0);
   gPad->SetBorderSize(2);
   gPad->SetLeftMargin(0.14);
   gPad->SetRightMargin(0.03);
   gPad->SetTopMargin(0.0);
   gPad->SetFrameBorderMode(0);
   gPad->SetFrameBorderMode(0);

  gPad->SetLogx();

   shape_MCdata->Draw("e");   



// horizontal line at y = 1
   TLine *line = new TLine(xmin,1,xmax,1);
   line->SetLineStyle(2);
   line->Draw();

   TPaveText *pt = new TPaveText(0.84,0.7,0.89,0.8,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetTextAlign(12);
   pt->SetTextSize(0.15);
   text = pt->AddText("0.5 < |y| < 1.0");
   pt->Draw();

	_ratio[1][0]->Draw("EhistSame");
	_ratio_pyth[1][0]->Draw("EhistSame");

   Pad_MCdata3->cd();

   gPad->SetFillColor(0);
   gPad->SetBorderMode(0);
   gPad->SetBorderSize(2);
   gPad->SetLeftMargin(0.14);
   gPad->SetRightMargin(0.03);
   gPad->SetTopMargin(0.0);
   gPad->SetFrameBorderMode(0);
   gPad->SetFrameBorderMode(0);

  gPad->SetLogx();

   shape_MCdata->Draw("e");   
// horizontal line at y = 1
   TLine *line = new TLine(xmin,1,xmax,1);
   line->SetLineStyle(2);
   line->Draw();

   TPaveText *pt = new TPaveText(0.84,0.7,0.89,0.8,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetTextAlign(12);
   pt->SetTextSize(0.15);
   text = pt->AddText("1.0 < |y| < 1.5");
   pt->Draw();
	_ratio[2][0]->Draw("EhistSame");
	_ratio_pyth[2][0]->Draw("EhistSame");

   Pad_MCdata4->cd();

   gPad->SetFillColor(0);
   gPad->SetBorderMode(0);
   gPad->SetBorderSize(2);
   gPad->SetLeftMargin(0.14);
   gPad->SetRightMargin(0.03);
   gPad->SetTopMargin(0.0);
   gPad->SetFrameBorderMode(0);
   gPad->SetFrameBorderMode(0);

  gPad->SetLogx();

   shape_MCdata->Draw("e");   
// horizontal line at y = 1
   TLine *line = new TLine(xmin,1,xmax,1);
   line->SetLineStyle(2);
   line->Draw();

   TPaveText *pt = new TPaveText(0.84,0.7,0.89,0.8,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetTextAlign(12);
   pt->SetTextSize(0.15);
   text = pt->AddText("1.5 < |y| < 2.0");
   pt->Draw();
	_ratio[3][0]->Draw("EhistSame");
	_ratio_pyth[3][0]->Draw("EhistSame");

   Pad_MCdata5->cd();

   gPad->SetFillColor(0);
   gPad->SetBorderMode(0);
   gPad->SetBorderSize(2);
   gPad->SetLeftMargin(0.14);
   gPad->SetRightMargin(0.03);
   gPad->SetTopMargin(0.0);
   gPad->SetFrameBorderMode(0);
   gPad->SetFrameBorderMode(0);

  gPad->SetLogx();

   shape_MCdata->Draw("e");   
// horizontal line at y = 1
   TLine *line = new TLine(xmin,1,xmax,1);
   line->SetLineStyle(2);
   line->Draw();

   TPaveText *pt = new TPaveText(0.84,0.7,0.89,0.8,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetTextAlign(12);
   pt->SetTextSize(0.15);
   text = pt->AddText("2.0 < |y| < 2.5");
   pt->Draw();
	_ratio[4][0]->Draw("EhistSame");
	_ratio_pyth[4][0]->Draw("EhistSame");

//write in png file
mysubpad2 =(TPad*)c2->GetPad(0);
mysubpad2->Print("pics/InclusiveJets_mcdataRatio_10.png");
mysubpad2->Print("~/DESY/ANALYSIS_NOTES/JetCrossSectionsWithPOWHEG/notes/AN-12-236/trunk/plots/InclusiveJets_mcdataRatio_10.pdf");

// Data / MC 

//create a canvas to draw TGraph and TH1F

TCanvas *c3 = new TCanvas("c3", "c3",369,0,680,550);

   Pad_DataMC1 = new TPad("Pad_DataMC1","ratio",0.01,0.78,1.0,0.95);
   Pad_DataMC1->Draw();
   Pad_DataMC2 = new TPad("Pad_DataMC2","ratio",0.01,0.60,1.0,0.76);
   Pad_DataMC2->Draw();
   Pad_DataMC3 = new TPad("Pad_DataMC3","ratio",0.01,0.42,1.0,0.58);
   Pad_DataMC3->Draw();
   Pad_DataMC4 = new TPad("Pad_DataMC4","ratio",0.01,0.24,1.0,0.40);
   Pad_DataMC4->Draw();
   Pad_DataMC5 = new TPad("Pad_DataMC5","ratio",0.01,0.06,1.0,0.22);
   Pad_DataMC5->Draw();

   Pad_DataMC1->cd();

   gPad->SetFillColor(0);
   gPad->SetBorderMode(0);
   gPad->SetBorderSize(2);
   gPad->SetLeftMargin(0.14);
   gPad->SetRightMargin(0.03);
   gPad->SetTopMargin(0.0);
   gPad->SetFrameBorderMode(0);
   gPad->SetFrameBorderMode(0);

  gPad->SetLogx();

   //AK Empty histo for style and borders
   TH1F *shape_DataMC = new TH1F("","",1, xmin, xmax);
   shape_DataMC->SetMinimum(0.5);
   shape_DataMC->SetMaximum(2.0);
   shape_DataMC->GetXaxis()->SetTitle("Jet p_{T} (GeV/c)");
   shape_DataMC->GetXaxis()->SetLabelSize(0.1);
   shape_DataMC->GetXaxis()->SetTitleSize(0.1);
   shape_DataMC->GetXaxis()->SetTitleOffset(0.6);
   shape_DataMC->GetXaxis()->SetMoreLogLabels();
   shape_DataMC->GetYaxis()->SetTitle("Data/MC");
   shape_DataMC->GetYaxis()->SetLabelSize(0.1);
   shape_DataMC->GetYaxis()->SetTitleSize(0.15);
   shape_DataMC->GetYaxis()->SetTitleOffset(0.2);
   shape_DataMC->GetYaxis()->SetNdivisions(108, kTRUE);   
   shape_DataMC->Draw("e");   

// horizontal line at y = 1
   TLine *line = new TLine(xmin,1,xmax,1);
   line->SetLineStyle(2);
   line->Draw();

   TPaveText *pt = new TPaveText(0.89,0.7,0.94,0.8,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetTextAlign(12);
   pt->SetTextSize(0.15);
   text = pt->AddText("|y| <0.5");
   pt->Draw();

	_ratio_datamc[0][0]->Draw("EhistSame");
	_ratio_pyth_datamc[0][0]->Draw("EhistSame");

   Pad_DataMC2->cd();

   gPad->SetFillColor(0);
   gPad->SetBorderMode(0);
   gPad->SetBorderSize(2);
   gPad->SetLeftMargin(0.14);
   gPad->SetRightMargin(0.03);
   gPad->SetTopMargin(0.0);
   gPad->SetFrameBorderMode(0);
   gPad->SetFrameBorderMode(0);

  gPad->SetLogx();

   shape_DataMC->Draw("e");   



// horizontal line at y = 1
   TLine *line = new TLine(xmin,1,xmax,1);
   line->SetLineStyle(2);
   line->Draw();

   TPaveText *pt = new TPaveText(0.84,0.7,0.89,0.8,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetTextAlign(12);
   pt->SetTextSize(0.15);
   text = pt->AddText("0.5 < |y| < 1.0");
   pt->Draw();

	_ratio_datamc[1][0]->Draw("EhistSame");
	_ratio_pyth_datamc[1][0]->Draw("EhistSame");

   Pad_DataMC3->cd();

   gPad->SetFillColor(0);
   gPad->SetBorderMode(0);
   gPad->SetBorderSize(2);
   gPad->SetLeftMargin(0.14);
   gPad->SetRightMargin(0.03);
   gPad->SetTopMargin(0.0);
   gPad->SetFrameBorderMode(0);
   gPad->SetFrameBorderMode(0);

  gPad->SetLogx();

   shape_DataMC->Draw("e");   
// horizontal line at y = 1
   TLine *line = new TLine(xmin,1,xmax,1);
   line->SetLineStyle(2);
   line->Draw();

   TPaveText *pt = new TPaveText(0.84,0.7,0.89,0.8,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetTextAlign(12);
   pt->SetTextSize(0.15);
   text = pt->AddText("1.0 < |y| < 1.5");
   pt->Draw();
	_ratio_datamc[2][0]->Draw("EhistSame");
	_ratio_pyth_datamc[2][0]->Draw("EhistSame");

   Pad_DataMC4->cd();

   gPad->SetFillColor(0);
   gPad->SetBorderMode(0);
   gPad->SetBorderSize(2);
   gPad->SetLeftMargin(0.14);
   gPad->SetRightMargin(0.03);
   gPad->SetTopMargin(0.0);
   gPad->SetFrameBorderMode(0);
   gPad->SetFrameBorderMode(0);

  gPad->SetLogx();

   shape_DataMC->Draw("e");   
// horizontal line at y = 1
   TLine *line = new TLine(xmin,1,xmax,1);
   line->SetLineStyle(2);
   line->Draw();

   TPaveText *pt = new TPaveText(0.84,0.7,0.89,0.8,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetTextAlign(12);
   pt->SetTextSize(0.15);
   text = pt->AddText("1.5 < |y| < 2.0");
   pt->Draw();
	_ratio_datamc[3][0]->Draw("EhistSame");
	_ratio_pyth_datamc[3][0]->Draw("EhistSame");

   Pad_DataMC5->cd();

   gPad->SetFillColor(0);
   gPad->SetBorderMode(0);
   gPad->SetBorderSize(2);
   gPad->SetLeftMargin(0.14);
   gPad->SetRightMargin(0.03);
   gPad->SetTopMargin(0.0);
   gPad->SetFrameBorderMode(0);
   gPad->SetFrameBorderMode(0);

  gPad->SetLogx();

   shape_DataMC->Draw("e");   
// horizontal line at y = 1
   TLine *line = new TLine(xmin,1,xmax,1);
   line->SetLineStyle(2);
   line->Draw();

   TPaveText *pt = new TPaveText(0.84,0.7,0.89,0.8,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetTextAlign(12);
   pt->SetTextSize(0.15);
   text = pt->AddText("2.0 < |y| < 2.5");
   pt->Draw();
	_ratio_datamc[4][0]->Draw("EhistSame");
	_ratio_pyth_datamc[4][0]->Draw("EhistSame");

//write in png file
mysubpad3 =(TPad*)c3->GetPad(0);
mysubpad3->Print("pics/InclusiveJets_DataMCRatio_10.png");
mysubpad3->Print("~/DESY/ANALYSIS_NOTES/JetCrossSectionsWithPOWHEG/notes/AN-12-236/trunk/plots/InclusiveJets_DataMCRatio_10.pdf");

c1->Print("InclusiveJets_2010.pdf(");
c2->Print("InclusiveJets_2010.pdf");
c3->Print("InclusiveJets_2010.pdf)");
} 
Ejemplo n.º 13
0
void diphomva_inputs(bool passMVAcut=false, bool equalArea=true) {

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

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

  TString preselNorm_str = "";
  if (!equalArea) preselNorm_str = "_preselNorm";

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

  txt = new TLatex();
  txt->SetNDC();
  txt->SetTextSize(0.08);

  bdtout_cat0_DYJetsToLL->Rebin(2);
  bdtout_cat1_DYJetsToLL->Rebin(2);
  bdtout_cat2_DYJetsToLL->Rebin(2);
  bdtout_cat3_DYJetsToLL->Rebin(2);
  bdtout_cat4_DYJetsToLL->Rebin(2);
  bdtoutEB_cat0_DYJetsToLL->Rebin(2);
  bdtoutEBEE_cat0_DYJetsToLL->Rebin(2);
  bdtoutEE_cat0_DYJetsToLL->Rebin(2);
  bdtout_cat0_Data->Rebin(2);
  bdtout_cat1_Data->Rebin(2);
  bdtout_cat2_Data->Rebin(2);
  bdtout_cat3_Data->Rebin(2);
  bdtout_cat4_Data->Rebin(2);
  bdtoutEB_cat0_Data->Rebin(2);
  bdtoutEBEE_cat0_Data->Rebin(2);
  bdtoutEE_cat0_Data->Rebin(2);

  bdtout_cat0_Data->GetXaxis()->SetTitle("di-photon BDT output");
  bdtout_cat1_Data->GetXaxis()->SetTitle("di-photon BDT output, CiC cat0");
  bdtout_cat2_Data->GetXaxis()->SetTitle("di-photon BDT output, CiC cat1");
  bdtout_cat3_Data->GetXaxis()->SetTitle("di-photon BDT output, CiC cat2");
  bdtout_cat4_Data->GetXaxis()->SetTitle("di-photon BDT output, CiC cat3");
  bdtoutEB_cat0_Data->GetXaxis()->SetTitle("di-photon BDT output (both EB)");
  bdtoutEBEE_cat0_Data->GetXaxis()->SetTitle("di-photon BDT output (one EB, one EE)");
  bdtoutEE_cat0_Data->GetXaxis()->SetTitle("di-photon BDT output (both EE)");
  pho1_phoidMva_cat0_Data->GetXaxis()->SetTitle("lead photon ID MVA output");
  pho2_phoidMva_cat0_Data->GetXaxis()->SetTitle("sublead photon ID MVA output");
  sigmaMOverM_cat0_Data->GetXaxis()->SetTitle("#sigma_{M}/M_{#gamma#gamma} (right vertex)");
  sigmaMOverM_wrongVtx_cat0_Data->GetXaxis()->SetTitle("#sigma_{M}/M_{#gamma#gamma} (wrong vertex)");
  sigmaMOverM_EB_cat0_Data->GetXaxis()->SetTitle("#sigma_{M}/M_{#gamma#gamma} (right vertex, both EB)");
  sigmaMOverM_wrongVtx_EB_cat0_Data->GetXaxis()->SetTitle("#sigma_{M}/M_{#gamma#gamma} (wrong vertex, both EB)");
  sigmaMOverM_EE_cat0_Data->GetXaxis()->SetTitle("#sigma_{M}/M_{#gamma#gamma} (right vertex, both EE)");
  sigmaMOverM_wrongVtx_EE_cat0_Data->GetXaxis()->SetTitle("#sigma_{M}/M_{#gamma#gamma} (wrong vertex, both EE)");
  vtxProb_cat0_Data->GetXaxis()->SetTitle("Vertex probabilty");
  pho1_ptOverM_cat0_Data->GetXaxis()->SetTitle("lead p_{T}/M_{#gamma#gamma}");
  pho2_ptOverM_cat0_Data->GetXaxis()->SetTitle("sublead p_{T}/M_{#gamma#gamma}");
  pho1_eta_cat0_Data->GetXaxis()->SetTitle("lead #eta");
  pho2_eta_cat0_Data->GetXaxis()->SetTitle("sublead #eta");
  cosDeltaPhi_cat0_Data->GetXaxis()->SetTitle("cos(#Delta#phi)");

  bdtout_cat0_Data->GetYaxis()->SetTitle("");
  bdtout_cat1_Data->GetYaxis()->SetTitle("");
  bdtout_cat2_Data->GetYaxis()->SetTitle("");
  bdtout_cat3_Data->GetYaxis()->SetTitle("");
  bdtout_cat4_Data->GetYaxis()->SetTitle("");
  bdtoutEB_cat0_Data->GetYaxis()->SetTitle("");
  bdtoutEBEE_cat0_Data->GetYaxis()->SetTitle("");
  bdtoutEE_cat0_Data->GetYaxis()->SetTitle("");
  pho1_phoidMva_cat0_Data->GetYaxis()->SetTitle("");
  pho2_phoidMva_cat0_Data->GetYaxis()->SetTitle("");
  sigmaMOverM_cat0_Data->GetYaxis()->SetTitle("");
  sigmaMOverM_wrongVtx_cat0_Data->GetYaxis()->SetTitle("");
  sigmaMOverM_EB_cat0_Data->GetYaxis()->SetTitle("");
  sigmaMOverM_wrongVtx_EB_cat0_Data->GetYaxis()->SetTitle("");
  sigmaMOverM_EE_cat0_Data->GetYaxis()->SetTitle("");
  sigmaMOverM_wrongVtx_EE_cat0_Data->GetYaxis()->SetTitle("");
  vtxProb_cat0_Data->GetYaxis()->SetTitle("");
  pho1_ptOverM_cat0_Data->GetYaxis()->SetTitle("");
  pho2_ptOverM_cat0_Data->GetYaxis()->SetTitle("");
  pho1_eta_cat0_Data->GetYaxis()->SetTitle("");
  pho2_eta_cat0_Data->GetYaxis()->SetTitle("");
  cosDeltaPhi_cat0_Data->GetYaxis()->SetTitle("");

  bdtout_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  bdtout_cat1_Data->GetXaxis()->SetTitleSize(0.05);
  bdtout_cat2_Data->GetXaxis()->SetTitleSize(0.05);
  bdtout_cat3_Data->GetXaxis()->SetTitleSize(0.05);
  bdtout_cat4_Data->GetXaxis()->SetTitleSize(0.05);
  bdtoutEB_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  bdtoutEBEE_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  bdtoutEE_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  pho1_phoidMva_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  pho2_phoidMva_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  sigmaMOverM_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  sigmaMOverM_wrongVtx_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  sigmaMOverM_EB_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  sigmaMOverM_wrongVtx_EB_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  sigmaMOverM_EE_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  sigmaMOverM_wrongVtx_EE_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  vtxProb_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  pho1_ptOverM_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  pho2_ptOverM_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  pho1_eta_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  pho2_eta_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  cosDeltaPhi_cat0_Data->GetXaxis()->SetTitleSize(0.05);

  bdtout_cat0_DYJetsToLL->SetFillColor(38);
  bdtout_cat1_DYJetsToLL->SetFillColor(38);
  bdtout_cat2_DYJetsToLL->SetFillColor(38);
  bdtout_cat3_DYJetsToLL->SetFillColor(38);
  bdtout_cat4_DYJetsToLL->SetFillColor(38);
  bdtoutEB_cat0_DYJetsToLL->SetFillColor(38);
  bdtoutEBEE_cat0_DYJetsToLL->SetFillColor(38);
  bdtoutEE_cat0_DYJetsToLL->SetFillColor(38);
  pho1_phoidMva_cat0_DYJetsToLL->SetFillColor(38);
  pho2_phoidMva_cat0_DYJetsToLL->SetFillColor(38);
  sigmaMOverM_cat0_DYJetsToLL->SetFillColor(38);
  sigmaMOverM_wrongVtx_cat0_DYJetsToLL->SetFillColor(38);
  sigmaMOverM_EB_cat0_DYJetsToLL->SetFillColor(38);
  sigmaMOverM_wrongVtx_EB_cat0_DYJetsToLL->SetFillColor(38);
  sigmaMOverM_EE_cat0_DYJetsToLL->SetFillColor(38);
  sigmaMOverM_wrongVtx_EE_cat0_DYJetsToLL->SetFillColor(38);
  vtxProb_cat0_DYJetsToLL->SetFillColor(38);
  pho1_ptOverM_cat0_DYJetsToLL->SetFillColor(38);
  pho2_ptOverM_cat0_DYJetsToLL->SetFillColor(38);
  pho1_eta_cat0_DYJetsToLL->SetFillColor(38);
  pho2_eta_cat0_DYJetsToLL->SetFillColor(38);
  cosDeltaPhi_cat0_DYJetsToLL->SetFillColor(38);

  bdtout_cat0_DYJetsToLL->SetLineColor(1);
  bdtoutEB_cat0_DYJetsToLL->SetLineColor(1);
  bdtoutEBEE_cat0_DYJetsToLL->SetLineColor(1);
  bdtoutEE_cat0_DYJetsToLL->SetLineColor(1);
  pho1_phoidMva_cat0_DYJetsToLL->SetLineColor(1);
  pho2_phoidMva_cat0_DYJetsToLL->SetLineColor(1);
  sigmaMOverM_cat0_DYJetsToLL->SetLineColor(1);
  sigmaMOverM_wrongVtx_cat0_DYJetsToLL->SetLineColor(1);
  sigmaMOverM_EB_cat0_DYJetsToLL->SetLineColor(1);
  sigmaMOverM_wrongVtx_EB_cat0_DYJetsToLL->SetLineColor(1);
  sigmaMOverM_EE_cat0_DYJetsToLL->SetLineColor(1);
  sigmaMOverM_wrongVtx_EE_cat0_DYJetsToLL->SetLineColor(1);
  vtxProb_cat0_DYJetsToLL->SetLineColor(1);
  pho1_ptOverM_cat0_DYJetsToLL->SetLineColor(1);
  pho2_ptOverM_cat0_DYJetsToLL->SetLineColor(1);
  pho1_eta_cat0_DYJetsToLL->SetLineColor(1);
  pho2_eta_cat0_DYJetsToLL->SetLineColor(1);
  cosDeltaPhi_cat0_DYJetsToLL->SetLineColor(1);

  bdtout_cat0_Data->SetMarkerStyle(20);
  bdtout_cat1_Data->SetMarkerStyle(20);
  bdtout_cat2_Data->SetMarkerStyle(20);
  bdtout_cat3_Data->SetMarkerStyle(20);
  bdtout_cat4_Data->SetMarkerStyle(20);
  bdtoutEB_cat0_Data->SetMarkerStyle(20);
  bdtoutEBEE_cat0_Data->SetMarkerStyle(20);
  bdtoutEE_cat0_Data->SetMarkerStyle(20);
  pho1_phoidMva_cat0_Data->SetMarkerStyle(20);
  pho2_phoidMva_cat0_Data->SetMarkerStyle(20);
  sigmaMOverM_cat0_Data->SetMarkerStyle(20);
  sigmaMOverM_wrongVtx_cat0_Data->SetMarkerStyle(20);
  sigmaMOverM_EB_cat0_Data->SetMarkerStyle(20);
  sigmaMOverM_wrongVtx_EB_cat0_Data->SetMarkerStyle(20);
  sigmaMOverM_EE_cat0_Data->SetMarkerStyle(20);
  sigmaMOverM_wrongVtx_EE_cat0_Data->SetMarkerStyle(20);
  vtxProb_cat0_Data->SetMarkerStyle(20);
  pho1_ptOverM_cat0_Data->SetMarkerStyle(20);
  pho2_ptOverM_cat0_Data->SetMarkerStyle(20);
  pho1_eta_cat0_Data->SetMarkerStyle(20);
  pho2_eta_cat0_Data->SetMarkerStyle(20);
  cosDeltaPhi_cat0_Data->SetMarkerStyle(20);

  bdtout_cat0_Data->SetMarkerSize(0.4);
  bdtout_cat1_Data->SetMarkerSize(0.4);
  bdtout_cat2_Data->SetMarkerSize(0.4);
  bdtout_cat3_Data->SetMarkerSize(0.4);
  bdtout_cat4_Data->SetMarkerSize(0.4);
  bdtoutEB_cat0_Data->SetMarkerSize(0.4);
  bdtoutEBEE_cat0_Data->SetMarkerSize(0.4);
  bdtoutEE_cat0_Data->SetMarkerSize(0.4);
  pho1_phoidMva_cat0_Data->SetMarkerSize(0.4);
  pho2_phoidMva_cat0_Data->SetMarkerSize(0.4);
  sigmaMOverM_cat0_Data->SetMarkerSize(0.4);
  sigmaMOverM_wrongVtx_cat0_Data->SetMarkerSize(0.4);
  sigmaMOverM_EB_cat0_Data->SetMarkerSize(0.4);
  sigmaMOverM_wrongVtx_EB_cat0_Data->SetMarkerSize(0.4);
  sigmaMOverM_EE_cat0_Data->SetMarkerSize(0.4);
  sigmaMOverM_wrongVtx_EE_cat0_Data->SetMarkerSize(0.4);
  vtxProb_cat0_Data->SetMarkerSize(0.4);
  pho1_ptOverM_cat0_Data->SetMarkerSize(0.4);
  pho2_ptOverM_cat0_Data->SetMarkerSize(0.4);
  pho1_eta_cat0_Data->SetMarkerSize(0.4);
  pho2_eta_cat0_Data->SetMarkerSize(0.4);
  cosDeltaPhi_cat0_Data->SetMarkerSize(0.4);

  bdtout_cat0_Data->SetLineColor(1);
  bdtout_cat1_Data->SetLineColor(1);
  bdtout_cat2_Data->SetLineColor(1);
  bdtout_cat3_Data->SetLineColor(1);
  bdtout_cat4_Data->SetLineColor(1);
  bdtoutEB_cat0_Data->SetLineColor(1);
  bdtoutEBEE_cat0_Data->SetLineColor(1);
  bdtoutEE_cat0_Data->SetLineColor(1);
  pho1_phoidMva_cat0_Data->SetLineColor(1);
  pho2_phoidMva_cat0_Data->SetLineColor(1);
  sigmaMOverM_cat0_Data->SetLineColor(1);
  sigmaMOverM_wrongVtx_cat0_Data->SetLineColor(1);
  sigmaMOverM_EB_cat0_Data->SetLineColor(1);
  sigmaMOverM_wrongVtx_EB_cat0_Data->SetLineColor(1);
  sigmaMOverM_EE_cat0_Data->SetLineColor(1);
  sigmaMOverM_wrongVtx_EE_cat0_Data->SetLineColor(1);
  vtxProb_cat0_Data->SetLineColor(1);
  pho1_ptOverM_cat0_Data->SetLineColor(1);
  pho2_ptOverM_cat0_Data->SetLineColor(1);
  pho1_eta_cat0_Data->SetLineColor(1);
  pho2_eta_cat0_Data->SetLineColor(1);
  cosDeltaPhi_cat0_Data->SetLineColor(1);

  if (passMVAcut) {
    bdtout_cat0_Data->GetXaxis()->SetRangeUser(-0.05,1.);
    bdtout_cat1_Data->GetXaxis()->SetRangeUser(-0.05,1.);
    bdtout_cat2_Data->GetXaxis()->SetRangeUser(-0.05,1.);
    bdtout_cat3_Data->GetXaxis()->SetRangeUser(-0.05,1.);
    bdtout_cat4_Data->GetXaxis()->SetRangeUser(-0.05,1.);
    bdtoutEB_cat0_Data->GetXaxis()->SetRangeUser(-0.05,1.);
    bdtoutEBEE_cat0_Data->GetXaxis()->SetRangeUser(-0.05,1.);
    bdtoutEE_cat0_Data->GetXaxis()->SetRangeUser(-0.05,1.);
  }

  TLegend *leg;
  leg = new TLegend(.6,.65,.87,.87);
  leg->SetBorderSize(0);
  leg->SetFillColor(10);
  leg->SetTextSize(.035);
  leg->AddEntry(vtxProb_cat0_Data,"Data (19.6fb^{-1})");
  leg->AddEntry(vtxProb_cat0_DYJetsToLL,"DYJetsToLL MC","F");

  TLegend *leg2;
  leg2 = new TLegend(.2,.65,.52,.87);
  leg2->SetBorderSize(0);
  leg2->SetFillColor(10);
  leg2->SetTextSize(.035);
  leg2->AddEntry(vtxProb_cat0_Data,"Data (19.6fb^{-1})");
  leg2->AddEntry(vtxProb_cat0_DYJetsToLL,"DYJetsToLL MC","F");

  float sf_presel = bdtout_cat0_Data->Integral()/bdtout_cat0_DYJetsToLL->Integral();
  cout << "sf_presel " << sf_presel << endl;

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

  TCanvas *c_bdtout = new TCanvas("c_bdtout","BDT output",2200,800);
  c_bdtout->Divide(4,2);

  c_bdtout->cd(1);
  float sf;
  if (passMVAcut) {
    sf = bdtout_cat0_Data->Integral(48,100)/bdtout_cat0_DYJetsToLL->Integral(48,100);
  } else {
    sf = bdtout_cat0_Data->Integral()/bdtout_cat0_DYJetsToLL->Integral();
  }
  bdtout_cat0_DYJetsToLL->Scale(sf);
  bdtout_cat0_Data->Draw("e");
  leg2->Draw();
  bdtout_cat0_DYJetsToLL->Draw("hist,same");
  bdtout_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_bdtout->cd(2);
  if (passMVAcut) {
    sf = bdtoutEB_cat0_Data->Integral(48,100)/bdtoutEB_cat0_DYJetsToLL->Integral(48,100);
  } else {
    sf = bdtoutEB_cat0_Data->Integral()/bdtoutEB_cat0_DYJetsToLL->Integral();
    if (!equalArea) sf = sf_presel;
  }
  bdtoutEB_cat0_DYJetsToLL->Scale(sf);
  bdtoutEB_cat0_Data->Draw("e");
  leg2->Draw();
  bdtoutEB_cat0_DYJetsToLL->Draw("hist,same");
  bdtoutEB_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_bdtout->cd(3);
  if (passMVAcut) {
    sf = bdtoutEBEE_cat0_Data->Integral(48,100)/bdtoutEBEE_cat0_DYJetsToLL->Integral(48,100);
  } else {
    sf = bdtoutEBEE_cat0_Data->Integral()/bdtoutEBEE_cat0_DYJetsToLL->Integral();
    if (!equalArea) sf = sf_presel;
  }
  bdtoutEBEE_cat0_DYJetsToLL->Scale(sf);
  bdtoutEBEE_cat0_Data->Draw("e");
  leg->Draw();
  bdtoutEBEE_cat0_DYJetsToLL->Draw("hist,same");
  bdtoutEBEE_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_bdtout->cd(4);
  if (passMVAcut) {
    sf = bdtoutEE_cat0_Data->Integral(48,100)/bdtoutEE_cat0_DYJetsToLL->Integral(48,100);
  } else {
    sf = bdtoutEE_cat0_Data->Integral()/bdtoutEE_cat0_DYJetsToLL->Integral();
    if (!equalArea) sf = sf_presel;
  }
  bdtoutEE_cat0_DYJetsToLL->Scale(sf);
  bdtoutEE_cat0_Data->Draw("e");
  leg->Draw();
  bdtoutEE_cat0_DYJetsToLL->Draw("hist,same");
  bdtoutEE_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();

  TLine *line;
  if (passMVAcut) {
    line = new TLine(-0.06,1.,1.,1.);
  } else {
    line = new TLine(-1.,1.,1.,1.);
  }
  line->SetLineColor(4);
  line->SetLineWidth(2);

  c_bdtout->cd(5);
  plotRatio(bdtout_cat0_Data,bdtout_cat0_DYJetsToLL);
  line->Draw();

  c_bdtout->cd(6);
  plotRatio(bdtoutEB_cat0_Data,bdtoutEB_cat0_DYJetsToLL);
  line->Draw();

  c_bdtout->cd(7);
  plotRatio(bdtoutEBEE_cat0_Data,bdtoutEBEE_cat0_DYJetsToLL);
  line->Draw();

  c_bdtout->cd(8);
  plotRatio(bdtoutEE_cat0_Data,bdtoutEE_cat0_DYJetsToLL);
  line->Draw();

  c_bdtout->SaveAs("bdtout"+preselNorm_str+".png");

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

  TCanvas *c_bdtout_basecat = new TCanvas("c_bdtout_basecat","BDT output in CiC categories",2200,800);
  c_bdtout_basecat->Divide(4,2);

  c_bdtout_basecat->cd(1);
  if (passMVAcut) {
    sf = bdtout_cat1_Data->Integral(48,100)/bdtout_cat1_DYJetsToLL->Integral(48,100);
  } else {
    sf = bdtout_cat1_Data->Integral()/bdtout_cat1_DYJetsToLL->Integral();
    if (!equalArea) sf = sf_presel;
  }
  bdtout_cat1_DYJetsToLL->Scale(sf);
  bdtout_cat1_Data->Draw("e");
  leg2->Draw();
  bdtout_cat1_DYJetsToLL->Draw("hist,same");
  bdtout_cat1_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_bdtout_basecat->cd(2);
  if (passMVAcut) {
    sf = bdtout_cat2_Data->Integral(48,100)/bdtout_cat2_DYJetsToLL->Integral(48,100);
  } else {
    sf = bdtout_cat2_Data->Integral()/bdtout_cat2_DYJetsToLL->Integral();
    if (!equalArea) sf = sf_presel;
  }
  bdtout_cat2_DYJetsToLL->Scale(sf);
  bdtout_cat2_Data->Draw("e");
  leg2->Draw();
  bdtout_cat2_DYJetsToLL->Draw("hist,same");
  bdtout_cat2_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_bdtout_basecat->cd(3);
  if (passMVAcut) {
    sf = bdtout_cat3_Data->Integral(48,100)/bdtout_cat3_DYJetsToLL->Integral(48,100);
  } else {
    sf = bdtout_cat3_Data->Integral()/bdtout_cat3_DYJetsToLL->Integral();
    if (!equalArea) sf = sf_presel;
  }
  bdtout_cat3_DYJetsToLL->Scale(sf);
  bdtout_cat3_Data->Draw("e");
  leg->Draw();
  bdtout_cat3_DYJetsToLL->Draw("hist,same");
  bdtout_cat3_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_bdtout_basecat->cd(4);
  if (passMVAcut) {
    sf = bdtout_cat4_Data->Integral(48,100)/bdtout_cat4_DYJetsToLL->Integral(48,100);
  } else {
    sf = bdtout_cat4_Data->Integral()/bdtout_cat4_DYJetsToLL->Integral();
    if (!equalArea) sf = sf_presel;
  }
  bdtout_cat4_DYJetsToLL->Scale(sf);
  bdtout_cat4_Data->Draw("e");
  leg->Draw();
  bdtout_cat4_DYJetsToLL->Draw("hist,same");
  bdtout_cat4_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_bdtout_basecat->cd(5);
  plotRatio(bdtout_cat1_Data,bdtout_cat1_DYJetsToLL);
  line->Draw();

  c_bdtout_basecat->cd(6);
  plotRatio(bdtout_cat2_Data,bdtout_cat2_DYJetsToLL);
  line->Draw();

  c_bdtout_basecat->cd(7);
  plotRatio(bdtout_cat3_Data,bdtout_cat3_DYJetsToLL);
  line->Draw();

  c_bdtout_basecat->cd(8);
  plotRatio(bdtout_cat4_Data,bdtout_cat4_DYJetsToLL);
  line->Draw();

  c_bdtout_basecat->SaveAs("bdtout_basecat"+preselNorm_str+".png");

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

  TCanvas *c_bdtin_1 = new TCanvas("c_bdtin_1","BDT input variables",1600,800);
  c_bdtin_1->Divide(4,2);

  c_bdtin_1->cd(1);
  sf = pho1_phoidMva_cat0_Data->Integral()/pho1_phoidMva_cat0_DYJetsToLL->Integral();
  pho1_phoidMva_cat0_DYJetsToLL->Scale(sf);
  pho1_phoidMva_cat0_Data->GetXaxis()->SetRangeUser(-0.3,0.6);
  pho1_phoidMva_cat0_Data->Draw("e");
  pho1_phoidMva_cat0_DYJetsToLL->Draw("hist,same");
  pho1_phoidMva_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_bdtin_1->cd(2);
  sf = pho2_phoidMva_cat0_Data->Integral()/pho2_phoidMva_cat0_DYJetsToLL->Integral();
  pho2_phoidMva_cat0_DYJetsToLL->Scale(sf);
  pho2_phoidMva_cat0_Data->GetXaxis()->SetRangeUser(-0.3,0.6);
  pho2_phoidMva_cat0_Data->Draw("e");
  pho2_phoidMva_cat0_DYJetsToLL->Draw("hist,same");
  pho2_phoidMva_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_bdtin_1->cd(3);
  gPad->SetLogy();
  sf = vtxProb_cat0_Data->Integral()/vtxProb_cat0_DYJetsToLL->Integral();
  vtxProb_cat0_DYJetsToLL->Scale(sf);
  //vtxProb_cat0_Data->GetXaxis()->SetRangeUser(0.2,1.);
  vtxProb_cat0_Data->Draw("e");
  vtxProb_cat0_DYJetsToLL->Draw("hist,same");
  vtxProb_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg2->Draw();

  c_bdtin_1->cd(4);
  gPad->SetLogy();
  sf = cosDeltaPhi_cat0_Data->Integral()/cosDeltaPhi_cat0_DYJetsToLL->Integral();
  cosDeltaPhi_cat0_DYJetsToLL->Scale(sf);
  cosDeltaPhi_cat0_Data->Draw("e");
  cosDeltaPhi_cat0_DYJetsToLL->Draw("hist,same");
  cosDeltaPhi_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_bdtin_1->cd(5);
  plotRatio(pho1_phoidMva_cat0_Data,pho1_phoidMva_cat0_DYJetsToLL);
  line1 = (TLine*)line->Clone();
  line1->SetX1(-0.3);
  line1->SetX2(0.6);
  line1->Draw();

  c_bdtin_1->cd(6);
  plotRatio(pho2_phoidMva_cat0_Data,pho2_phoidMva_cat0_DYJetsToLL);
  line1->Draw();

  c_bdtin_1->cd(7);
  plotRatio(vtxProb_cat0_Data,vtxProb_cat0_DYJetsToLL);
  line->Draw();

  c_bdtin_1->cd(8);
  plotRatio(cosDeltaPhi_cat0_Data,cosDeltaPhi_cat0_DYJetsToLL);
  line->Draw();

  c_bdtin_1->SaveAs("bdtin_1.png");

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

  TCanvas *c_bdtin_2 = new TCanvas("c_bdtin_2","BDT input variables",1500,900);
  c_bdtin_2->Divide(4,3);
  c_bdtin_2->cd(1);

  sf = sigmaMOverM_cat0_Data->Integral()/sigmaMOverM_cat0_DYJetsToLL->Integral();
  sigmaMOverM_cat0_DYJetsToLL->Scale(sf);
  sigmaMOverM_cat0_Data->Draw("e");
  sigmaMOverM_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_bdtin_2->cd(2);
  sf = sigmaMOverM_wrongVtx_cat0_Data->Integral()/sigmaMOverM_wrongVtx_cat0_DYJetsToLL->Integral();
  sigmaMOverM_wrongVtx_cat0_DYJetsToLL->Scale(sf);
  sigmaMOverM_wrongVtx_cat0_Data->Draw("e");
  sigmaMOverM_wrongVtx_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_wrongVtx_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg2->Draw();

  c_bdtin_2->cd(3);
  sf = pho1_ptOverM_cat0_Data->Integral()/pho1_ptOverM_cat0_DYJetsToLL->Integral();
  pho1_ptOverM_cat0_DYJetsToLL->Scale(sf);
  pho1_ptOverM_cat0_Data->GetXaxis()->SetRangeUser(0.2,1.2);
  pho1_ptOverM_cat0_Data->Draw("e");
  pho1_ptOverM_cat0_DYJetsToLL->Draw("hist,same");
  pho1_ptOverM_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_bdtin_2->cd(4);
  sf = pho2_ptOverM_cat0_Data->Integral()/pho2_ptOverM_cat0_DYJetsToLL->Integral();
  pho2_ptOverM_cat0_DYJetsToLL->Scale(sf);
  pho2_ptOverM_cat0_Data->GetXaxis()->SetRangeUser(0.2,.9);
  pho2_ptOverM_cat0_Data->Draw("e");
  pho2_ptOverM_cat0_DYJetsToLL->Draw("hist,same");
  pho2_ptOverM_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_bdtin_2->cd(5);
  gPad->SetLogy();
  sigmaMOverM_cat0_Data->Draw("e");
  sigmaMOverM_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_bdtin_2->cd(6);
  gPad->SetLogy();
  sigmaMOverM_wrongVtx_cat0_Data->Draw("e");
  sigmaMOverM_wrongVtx_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_wrongVtx_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_bdtin_2->cd(7);
  gPad->SetLogy();
  pho1_ptOverM_cat0_Data->Draw("e");
  pho1_ptOverM_cat0_DYJetsToLL->Draw("hist,same");
  pho1_ptOverM_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_bdtin_2->cd(8);
  gPad->SetLogy();
  pho2_ptOverM_cat0_Data->Draw("e");
  pho2_ptOverM_cat0_DYJetsToLL->Draw("hist,same");
  pho2_ptOverM_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_bdtin_2->cd(9);
  plotRatio(sigmaMOverM_cat0_Data,sigmaMOverM_cat0_DYJetsToLL);
  line3 = (TLine*)line->Clone();
  line3->SetX1(0.);
  line3->SetX2(0.06);
  line3->Draw();

  c_bdtin_2->cd(10);
  plotRatio(sigmaMOverM_wrongVtx_cat0_Data,sigmaMOverM_wrongVtx_cat0_DYJetsToLL);
  line3->Draw();

  c_bdtin_2->cd(11);
  plotRatio(pho1_ptOverM_cat0_Data,pho1_ptOverM_cat0_DYJetsToLL);
  line4 = (TLine*)line->Clone();
  line4->SetX1(0.2);
  line4->SetX2(1.2);
  line4->Draw();

  c_bdtin_2->cd(12);
  plotRatio(pho2_ptOverM_cat0_Data,pho2_ptOverM_cat0_DYJetsToLL);
  line5 = (TLine*)line->Clone();
  line5->SetX1(0.2);
  line5->SetX2(0.9);
  line5->Draw();

  c_bdtin_2->SaveAs("bdtin_2.png");

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

  TCanvas *c_bdtin_3 = new TCanvas("c_bdtin_3","BDT input variables",1200,800);
  c_bdtin_3->Divide(2,2);
  c_bdtin_3->cd(1);

  c_bdtin_3->cd(1);
  sf = pho1_eta_cat0_Data->Integral()/pho1_eta_cat0_DYJetsToLL->Integral();
  pho1_eta_cat0_DYJetsToLL->Scale(sf);
  pho1_eta_cat0_Data->Draw("e");
  pho1_eta_cat0_DYJetsToLL->Draw("hist,same");
  pho1_eta_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_bdtin_3->cd(2);
  sf = pho2_eta_cat0_Data->Integral()/pho2_eta_cat0_DYJetsToLL->Integral();
  pho2_eta_cat0_DYJetsToLL->Scale(sf);
  pho2_eta_cat0_Data->Draw("e");
  pho2_eta_cat0_DYJetsToLL->Draw("hist,same");
  pho2_eta_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_bdtin_3->cd(3);
  plotRatio(pho1_eta_cat0_Data,pho1_eta_cat0_DYJetsToLL);
  line6 = (TLine*)line->Clone();
  line6->SetX1(-2.5);
  line6->SetX2(2.5);
  line6->Draw();

  c_bdtin_3->cd(4);
  plotRatio(pho2_eta_cat0_Data,pho2_eta_cat0_DYJetsToLL);
  line6->Draw();

  c_bdtin_3->SaveAs("bdtin_3.png");

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

  TCanvas *c_sigmam_ebee = new TCanvas("c_sigmam_ebee","BDT input variables",1500,900);
  c_sigmam_ebee->Divide(4,3);
  c_sigmam_ebee->cd(1);

  sf = sigmaMOverM_EB_cat0_Data->Integral()/sigmaMOverM_EB_cat0_DYJetsToLL->Integral();
  sigmaMOverM_EB_cat0_DYJetsToLL->Scale(sf);
  sigmaMOverM_EB_cat0_Data->Draw("e");
  sigmaMOverM_EB_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_EB_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_sigmam_ebee->cd(2);
  sf = sigmaMOverM_wrongVtx_EB_cat0_Data->Integral()/sigmaMOverM_wrongVtx_EB_cat0_DYJetsToLL->Integral();
  sigmaMOverM_wrongVtx_EB_cat0_DYJetsToLL->Scale(sf);
  sigmaMOverM_wrongVtx_EB_cat0_Data->Draw("e");
  sigmaMOverM_wrongVtx_EB_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_wrongVtx_EB_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_sigmam_ebee->cd(3);
  sf = sigmaMOverM_EE_cat0_Data->Integral()/sigmaMOverM_EE_cat0_DYJetsToLL->Integral();
  sigmaMOverM_EE_cat0_DYJetsToLL->Scale(sf);
  sigmaMOverM_EE_cat0_Data->Draw("e");
  sigmaMOverM_EE_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_EE_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_sigmam_ebee->cd(4);
  sf = sigmaMOverM_wrongVtx_EE_cat0_Data->Integral()/sigmaMOverM_wrongVtx_EE_cat0_DYJetsToLL->Integral();
  sigmaMOverM_wrongVtx_EE_cat0_DYJetsToLL->Scale(sf);
  sigmaMOverM_wrongVtx_EE_cat0_Data->Draw("e");
  sigmaMOverM_wrongVtx_EE_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_wrongVtx_EE_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg2->Draw();

  c_sigmam_ebee->cd(5);
  gPad->SetLogy();
  sigmaMOverM_EB_cat0_Data->Draw("e");
  sigmaMOverM_EB_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_EB_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_sigmam_ebee->cd(6);
  gPad->SetLogy();
  sigmaMOverM_wrongVtx_EB_cat0_Data->Draw("e");
  sigmaMOverM_wrongVtx_EB_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_wrongVtx_EB_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_sigmam_ebee->cd(7);
  gPad->SetLogy();
  sigmaMOverM_EE_cat0_Data->Draw("e");
  sigmaMOverM_EE_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_EE_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_sigmam_ebee->cd(8);
  gPad->SetLogy();
  sigmaMOverM_wrongVtx_EE_cat0_Data->Draw("e");
  sigmaMOverM_wrongVtx_EE_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_wrongVtx_EE_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_sigmam_ebee->cd(9);
  plotRatio(sigmaMOverM_EB_cat0_Data,
	    sigmaMOverM_EB_cat0_DYJetsToLL);
  line3->Draw();

  c_sigmam_ebee->cd(10);
  plotRatio(sigmaMOverM_wrongVtx_EB_cat0_Data,
	    sigmaMOverM_wrongVtx_EB_cat0_DYJetsToLL);
  line3->Draw();

  c_sigmam_ebee->cd(11);
  plotRatio(sigmaMOverM_EE_cat0_Data,
	    sigmaMOverM_EE_cat0_DYJetsToLL);
  line3->Draw();

  c_sigmam_ebee->cd(12);
  plotRatio(sigmaMOverM_wrongVtx_EE_cat0_Data,
	    sigmaMOverM_wrongVtx_EE_cat0_DYJetsToLL);
  line3->Draw();

  c_sigmam_ebee->SaveAs("sigmam_ebee.png");


}
Ejemplo n.º 14
0
void dataMCplots_v2(){

  setNCUStyle(true);
 
  Float_t up_height     = 0.8;
  Float_t dw_correction = 1.455;
  Float_t dw_height     = (1-up_height)*dw_correction;

  TCanvas c("c","",0,0,800,1600);
  c.Divide(1,2);

  TPad* c_up = (TPad*) c.GetListOfPrimitives()->FindObject("c_1");
  TPad* c_dw = (TPad*) c.GetListOfPrimitives()->FindObject("c_2"); 

  c_up->SetPad(0,1-up_height,1,1);
  c_dw->SetPad(0,0,1,dw_height);
  c_dw->SetBottomMargin(0.25);

  // To get the name of histograms
  
  TFile* tf1[10];
  tf1[0]=TFile::Open("sf2/QCD700.root");
  tf1[1]=TFile::Open("sf2/QCD1000.root");
  tf1[2]=TFile::Open("sf2/QCD1500.root");
  tf1[3]=TFile::Open("sf2/QCD2000.root");
  tf1[4]=TFile::Open("sf2/data.root");
  tf1[5]=TFile::Open("sf2/bGen700.root");
  tf1[6]=TFile::Open("sf2/bGen1000.root");
  tf1[7]=TFile::Open("sf2/bGen1500.root");
  tf1[8]=TFile::Open("sf2/bGen2000.root");
  
  TFile* tf2[10];
   tf2[0]=TFile::Open("sf2/B1400.root");
   tf2[1]=TFile::Open("sf2/B1800.root");
   tf2[2]=TFile::Open("sf2/B2500.root");
   tf2[3]=TFile::Open("sf2/R1800.root");
   
  vector<std::string> h_name;
  h_name.push_back("h_nvtx");  
  for(int i=0;i<2;i++){
		for(int j=0;j<2;j++){
			for(int k=0;k<5;k++){
				h_name.push_back(Form("Pt_j%d_sj%d_%db",i,j,k));  
				h_name.push_back(Form("Eta_j%d_sj%d_%db",i,j,k));  
				h_name.push_back(Form("subCSV_j%d_sj%d_%db",i,j,k));  
				h_name.push_back(Form("subCSVCut_j%d_sj%d_%db",i,j,k));  
			}
		}
		for(int k=0;k<5;k++){
			h_name.push_back(Form("deltaR_j%d_%db",i,k));  
			h_name.push_back(Form("Pt_j%d_%db",i,k));  
			h_name.push_back(Form("Eta_j%d_%db",i,k));  
			h_name.push_back(Form("prMassL2L3_j%d_%db",i,k));  
			h_name.push_back(Form("tau21_j%d_%db",i,k));  
			h_name.push_back(Form("PuppiSDMassL2L3_j%d_%db",i,k));  
			h_name.push_back(Form("puppiTau21_j%d_%db",i,k));  
		h_name.push_back(Form("prMass_j%d_%db",i,k));  
		h_name.push_back(Form("PuppiSDMass_j%d_%db",i,k));  
		h_name.push_back(Form("doubleSV_j%d_%db",i,k));  
		h_name.push_back(Form("FatSV_j%d_%db",i,k));  
		}
	}
	for(int k=0;k<5;k++){
		h_name.push_back(Form("totalMass_%db",k));  
		h_name.push_back(Form("totalMassRed_%db",k));  
		h_name.push_back(Form("deltaEta_%db",k));  
		//h_name.push_back(Form("HT_%db",k));  
	}
  
 // h_name.push_back("cutflow");  
 
 
 string prMass_no[4]={"prMass","prMassL2L3","PuppiSDMass","PuppiSDMassL2L3"};
	string tau21_no[2]={"tau21","puppiTau21"};
	for (int i=0;i<4;i++){
		h_name.push_back(Form("%s_j0_noPr_noTau21",prMass_no[i].data()));  
		h_name.push_back(Form("%s_j1_noPr_noTau21",prMass_no[i].data()));  
		h_name.push_back(Form("%s_j0_noPr",prMass_no[i].data()));  
		h_name.push_back(Form("%s_j1_noPr",prMass_no[i].data()));  
		h_name.push_back(Form("%s_j0_noTau21",prMass_no[i].data()));  
		h_name.push_back(Form("%s_j1_noTau21",prMass_no[i].data()));  
		
	
	}
	for (int i=0;i<2;i++){
		h_name.push_back(Form("%s_j0_noPr_noTau21",tau21_no[i].data()));  
		h_name.push_back(Form("%s_j1_noPr_noTau21",tau21_no[i].data()));  
		h_name.push_back(Form("%s_j0_noPr",tau21_no[i].data()));  
		h_name.push_back(Form("%s_j1_noPr",tau21_no[i].data()));  
		h_name.push_back(Form("%s_j0_noTau21",tau21_no[i].data()));  
		h_name.push_back(Form("%s_j1_noTau21",tau21_no[i].data()));  
	
	}
 
 
 
 h_name.push_back("h_nvtx_cut");  
h_name.push_back("Nbtagjet");  

  for(unsigned int i = 0; i < h_name.size(); i++){
//	 for(unsigned int i = 0; i < 1; i++){
	  
	//cout<<h_name[i]<<endl;
	TH1D *th1[10];
	for(int k=0;k<5;k++){
		
			th1[k]=(TH1D* )tf1[k]->FindObjectAny(Form("%s",h_name[i].data()));
		
	}
	if(h_name[i].find("3b")!= std::string::npos)continue;	
	if(h_name[i].find("2b")!= std::string::npos)continue;	
	if(h_name[i].find("1b")!= std::string::npos)continue;	
	if(h_name[i].find("0b")!= std::string::npos)continue;	
	//if(h_name[i].find("4b")!= std::string::npos)continue;	
	bool drawSignal=1;
	
	//---------
	 TH1D* thh[5][4];
  double fixNumber=22295/30584.3;//7306/11857.3;
double Xsec[4]={6831,1207,119.9,25.24};
  //string categories[4]={"0b","1b","2b","DSV"};
  string hadflv[4]={"bb","b","cc","udcsg"};
  
  
  
  TString endfix;
	endfix=gSystem->GetFromPipe(Form("file=%s; test=${file%%*_}; echo \"${test}\"",h_name[i].data()));
	
  
  
  for(int k=0;k<4;k++){
	  for(int j=0;j<4;j++){
		  
		  TH1D *th2=(TH1D* )tf1[k]->FindObjectAny("cutflow");
		  
	
		  thh[k][j]=(TH1D*)tf1[k]->FindObjectAny(Form("%s_%s",h_name[i].data(),hadflv[j].data()));
		   TString endfix;
		  if(h_name[i].find("4b")!= std::string::npos){
			  endfix=gSystem->GetFromPipe(Form("file=%s; test=${file%%*_4b}; echo \"${test}\"",h_name[i].data()));
			  TH1D *th2;
			  //cout<<endfix<<endl;
			  th2=(TH1D* )tf1[k]->FindObjectAny(Form("%s_0b_%s",endfix.Data(),hadflv[j].data()));
 			  thh[k][j]->Add(th2);
			  th2=(TH1D* )tf1[k]->FindObjectAny(Form("%s_1b_%s",endfix.Data(),hadflv[j].data()));
 			  thh[k][j]->Add(th2);
			  th2=(TH1D* )tf1[k]->FindObjectAny(Form("%s_2b_%s",endfix.Data(),hadflv[j].data()));
 			  thh[k][j]->Add(th2);
			  th2=(TH1D* )tf1[k]->FindObjectAny(Form("%s_3b_%s",endfix.Data(),hadflv[j].data()));
 			  thh[k][j]->Add(th2);
		  }
		  thh[k][j]->Scale(fixNumber* 12883.846147301*Xsec[k]/th2->GetBinContent(1));
		 // cout<<k<<","<<j<<","<<Form("%s_%s",h_name[i].data(),hadflv[j].data())<<","<<thh[k][j]->Integral()<<endl;
	  }
	  
	  if(k==3){
		  for(int j=0;j<4;j++)thh[k][j]->Add(thh[0][j]);
		  for(int j=0;j<4;j++)thh[k][j]->Add(thh[1][j]);
		  for(int j=0;j<4;j++)thh[k][j]->Add(thh[2][j]);
	  }
  }
vector<TH1D* > v2;
	vector<TH1D* > vd;
	
	thh[4][0]=(TH1D*)tf1[4]->FindObjectAny(Form("%s_udcsg",h_name[i].data()));
	 if(h_name[i].find("4b")!= std::string::npos){
			  endfix=gSystem->GetFromPipe(Form("file=%s; test=${file%%*_4b}; echo \"${test}\"",h_name[i].data()));
			  TH1D *th2;
			  th2=(TH1D* )tf1[4]->FindObjectAny(Form("%s_0b_udcsg",endfix.Data()));
 			  thh[4][0]->Add(th2);
			 th2=(TH1D* )tf1[4]->FindObjectAny(Form("%s_1b_udcsg",endfix.Data()));
 			  thh[4][0]->Add(th2);
			  th2=(TH1D* )tf1[4]->FindObjectAny(Form("%s_2b_udcsg",endfix.Data()));
 			  thh[4][0]->Add(th2);
			  th2=(TH1D* )tf1[4]->FindObjectAny(Form("%s_3b_udcsg",endfix.Data()));
 			  thh[4][0]->Add(th2);
		  }
	
	cout<<thh[4][0]->Integral();
	v2.push_back(thh[3][0]);
	v2.push_back(thh[3][1]);
	v2.push_back(thh[3][2]);
	v2.push_back(thh[3][3]);
	
	double temp_scale=0;
	for(int i=0;i<4;i++){
		temp_scale+=thh[3][i]->Integral();
	}
	
	for(int i=0;i<4;i++){
		if(h_name[i].find("HT")!= std::string::npos)continue;
		thh[3][i]->Scale(thh[4][0]->Integral()/temp_scale);
	}
	
	vd.push_back(thh[4][0]);
	
	//--------
	
	TH1D *h_bkg  = (TH1D* )th1[0]->Clone("h_bkg");
	//TH1D *temp = (TH1D* )th1[0]->Clone("h_bkg");
	
	
    TH1D *h_data = (TH1D* )th1[0]->Clone("h_data");
    /*
	h_data->SetTitle(Form("%s",endfix.Data()));
	h_bkg->SetTitle(Form("%s",endfix.Data()));
	c_up->SetTitle(Form("%s",endfix.Data()));
	c.SetTitle(Form("%s",endfix.Data()));
	 */
	 h_data->SetTitle("");
	 h_bkg->SetTitle("");
	 c_up->SetTitle("");
	 c_up->cd();
	 
	 if (h_name[i].find("Nbtagjet")!= std::string::npos)c_up->SetLogy();	
	// if(h_name[i].find("cutflow")!= std::string::npos)c_up->SetLogy();	
	 if(h_name[i].find("Pt")!= std::string::npos)isSetRange=1;	
	 if(h_name[i].find("logPt")!= std::string::npos){
		   isSetRange=0;	
		   c_up->SetLogy(1);	
	 }
	 
	 
	  if(h_name[i].find("total")!= std::string::npos)isSetRange=1;	
	
	
	double scaleTemp[4];
	
	
	
	
	//vd.push_back(th1[4]);
	cout<<h_name[i]<<endl;
	
	
    myPlot(v2,
vd,
	   h_data, h_bkg,1);

    c_up->RedrawAxis();
    
    
    
    
    if(drawSignal){
	    int colorNum[4]={kRed,kBlue,kOrange+2,kViolet};
	    double xsec2[4]={1.9,0.155,0.0158,17.3};
		TH1D* th_signal[4];
		
		TLegend *leg = new TLegend(0.63, 0.68, 0.78, 0.87);
  string legendS[4]={"M_{G}=1.4TeV","M_{G}=1.8TeV","M_{G}=2.5TeV","M_{R}=1.8TeV"};
  
  leg->SetBorderSize(0);
  leg->SetFillColor(0);
  leg->SetFillStyle(0);
  leg->SetTextSize(0.04);
		for(int k=0;k<4;k++){
			
	    th_signal[k]=(TH1D*)tf2[k]->FindObjectAny(Form("%s",h_name[i].data()));
	    leg->AddEntry(th_signal[k],Form("%s",legendS[k].data()));
	    th_signal[k]->SetLineColor(colorNum[k]);
	    th_signal[k]->SetLineWidth(2);
	   // th_signal[k]->SetLineStyle(k+1);
	    
	    
	     TString endfix;
		  if(h_name[i].find("4b")!= std::string::npos){
		  endfix=gSystem->GetFromPipe(Form("file=%s; test=${file%%*_4b}; echo \"${test}\"",h_name[i].data()));
			  TH1D *th2;
			
			  th2=(TH1D* )tf2[k]->FindObjectAny(Form("%s_0b",endfix.Data()));
 			   th_signal[k]->Add(th2);
			  th2=(TH1D* )tf2[k]->FindObjectAny(Form("%s_1b",endfix.Data()));
 			   th_signal[k]->Add(th2);
			  th2=(TH1D* )tf2[k]->FindObjectAny(Form("%s_2b",endfix.Data()));
 			   th_signal[k]->Add(th2);
			   th2=(TH1D* )tf2[k]->FindObjectAny(Form("%s_3b",endfix.Data()));
 			   th_signal[k]->Add(th2);
		  }
	    
	     TH1D *th3=(TH1D* )tf2[k]->FindObjectAny("cutflow");
	     //cout<<"k="<<k<<","<<th2->GetBinContent(1)<<","<<12.883846147301*xsec2[k]*200/th2->GetBinContent(1)<<endl;
	     th_signal[k]->Scale(thh[4][0]->Integral()/(th_signal[k]->Integral()*2));
	     if(h_name[i].find("deltaR")!= std::string::npos)th_signal[k]->Scale(0.5);
	     if(h_name[i].find("noPr")!= std::string::npos &&
	     h_name[i].find("noPr_")== std::string::npos&&
	     h_name[i].find("tau21")== std::string::npos)th_signal[k]->Scale(0.4);
	    //if(k<3)th_signal[k]->Scale(10);
	     cout<<th_signal[k]->Integral()<<",";
	     th_signal[k]->Draw("same hist ");
		}
		leg->Draw("same");
		
    }
    
    
    
    
     
		  
	
		
		  
    
    c_dw->cd();
	string tempName=h_name[i];
	if(h_name[i].find("Eta")!= std::string::npos){
		TString endfix2;
		 endfix2=gSystem->GetFromPipe(Form("file=%s; test=${file##Eta}; echo \"${test}\"",h_name[i].data()));
		 h_name[i]=Form("#eta%s",endfix2.Data());
	}
	
	if(h_name[i].find("tau")!= std::string::npos){
		TString endfix2;
		 endfix2=gSystem->GetFromPipe(Form("file=%s; test=${file##tau}; echo \"${test}\"",h_name[i].data()));
		 h_name[i]=Form("#tau%s",endfix2.Data());
	}
	
	if (h_name[i].find("total")!= std::string::npos)myRatio(h_data, h_bkg,"M_{jj}[GeV]");
	
	else if (h_name[i].find("_j0")!= std::string::npos){
		TString endfix2;
		 endfix2=gSystem->GetFromPipe(Form("file=%s; test=${file%%*_j0*}; echo \"${test}\"",h_name[i].data()));
		 //cout<<endfix2<<endl;
		 if (h_name[i].find("_sj0")!= std::string::npos) myRatio(h_data, h_bkg,Form("%s^{Jet0}_{subjet0}",endfix2.Data()));
		 else  if (h_name[i].find("_sj1")!= std::string::npos) myRatio(h_data, h_bkg,Form("%s^{Jet0}_{subjet1}",endfix2.Data()));
		 else myRatio(h_data, h_bkg,Form("%s^{Jet0}",endfix2.Data()));
	}
	
	else if (h_name[i].find("_j1")!= std::string::npos){
		TString endfix2;
		 endfix2=gSystem->GetFromPipe(Form("file=%s; test=${file%%*_j1*}; echo \"${test}\"",h_name[i].data()));
		 //cout<<endfix2<<endl;
		 if (h_name[i].find("_sj0")!= std::string::npos) myRatio(h_data, h_bkg,Form("%s^{Jet1}_{subjet0}",endfix2.Data()));
		 else  if (h_name[i].find("_sj1")!= std::string::npos) myRatio(h_data, h_bkg,Form("%s^{Jet1}_{subjet1}",endfix2.Data()));
		 else myRatio(h_data, h_bkg,Form("%s^{Jet1}",endfix2.Data()));
	}
	
    else if(h_name[i].find("Pt")!= std::string::npos||
	//h_name[i].find("total")!= std::string::npos||
	h_name[i].find("ass")!= std::string::npos)myRatio(h_data, h_bkg,Form("%s[GeV]",endfix.Data()));
	else if (h_name[i].find("Nbtagje")!= std::string::npos)myRatio(h_data, h_bkg,"Nbtagjet",1);
	
	else myRatio(h_data, h_bkg,Form("%s",endfix.Data()));
	
	
	h_name[i]=tempName;
	
	if(h_name[i].find("Pt")!= std::string::npos)isSetRange=0;	
	 if(h_name[i].find("total")!= std::string::npos)isSetRange=0;	
   // c.Draw();
  
	if(h_name[i].find("0b")!= std::string::npos)c.SaveAs(Form("dataMC_v2/0b/%s.png",h_name[i].data()));
	else if(h_name[i].find("1b")!= std::string::npos)c.SaveAs(Form("dataMC_v2/1b/%s.png",h_name[i].data()));
	else if(h_name[i].find("2b")!= std::string::npos)c.SaveAs(Form("dataMC_v2/2b/%s.png",h_name[i].data()));
    else if(h_name[i].find("4b")!= std::string::npos)c.SaveAs(Form("dataMC_v2/all/%s.png",endfix.Data()));
	else c.SaveAs(Form("dataMC_v2/all/%s.png",h_name[i].data()));
	
	if(h_name[i].find("0b")!= std::string::npos)c.Print(Form("dataMC_v2/0b/%s.pdf",h_name[i].data()));
	else if(h_name[i].find("1b")!= std::string::npos)c.Print(Form("dataMC_v2/1b/%s.pdf",h_name[i].data()));
	else if(h_name[i].find("2b")!= std::string::npos)c.Print(Form("dataMC_v2/2b/%s.pdf",h_name[i].data()));
    else if(h_name[i].find("4b")!= std::string::npos)c.Print(Form("dataMC_v2/all/%s.pdf",endfix.Data()));
	else c.Print(Form("dataMC_v2/all/%s.pdf",h_name[i].data()));
	
	
	
	if(h_name[i].find("logPt")!= std::string::npos){
		   isSetRange=0;	
		   c_up->SetLogy(0);	
	 }
  }
  
}
Ejemplo n.º 15
0
void plotVBTFWP(const string tau_ = "HPS"){


  TCanvas *c1 = new TCanvas("c1","Canvas",10,30,650,600);
  c1->SetGrid(0,0);
  c1->SetFillStyle(4000);
  c1->SetFillColor(10);
  c1->SetTicky();
  c1->SetObjectStat(0);
  c1->SetLogx(1);

  TLegend* leg = new TLegend(0.36,0.15,0.80,0.5,NULL,"brNDC");
  leg->SetFillStyle(4000);
  leg->SetBorderSize(0);
  leg->SetFillColor(10);
  leg->SetTextSize(0.03);

  TFile* f_Zee     = new TFile("/data_CMS/cms/lbianchini/35pb/testNewWriteFromPAT_DYToEE-PYTHIA-TAUEFF.root");
  TFile* f_Ztautau = new TFile("/data_CMS/cms/lbianchini/35pb/testNewWriteFromPAT_DYToTauTau-PYTHIA-TAUEFF.root");


  f_Zee->cd();
  TTree* tree_Zee     = (TTree*) gDirectory->Get( ("tauFakeRateAnalyzer"+tau_+"/tree").c_str() ); 
  f_Ztautau->cd();
  TTree* tree_Ztautau = (TTree*) gDirectory->Get( ("tauFakeRateAnalyzer"+tau_+"/tree").c_str() ); 

  TH2F* h2 = new TH2F("h2","",220,0,1.1,220,0,1.1);

  float vxF[45];
  float vyF[45];

  float vxF_VBTF[6];
  float vyF_VBTF[6];

  float ZeeAll     = (float)tree_Zee->GetEntries("");
  float ZtautauAll = (float)tree_Ztautau->GetEntries("");

  std::cout << ZtautauAll << std::endl;

  for(int i = 0; i<=44; i++){
    float cut = 0.025*i;
    float ZeeCut = (float) tree_Zee->GetEntries(Form("leadPFChargedHadrMva<=%f",-0.1+cut));
    float ZtautauCut = (float) tree_Ztautau->GetEntries(Form("leadPFChargedHadrMva<=%f",-0.1+cut));
    std::cout << ZtautauCut << std::endl;
    vxF[i]=ZeeCut/ZeeAll;
    vyF[i]=ZtautauCut/ZtautauAll;
      //h2->Fill(ZeeCut/ZeeAll,ZtautauCut/ZtautauAll);
    std::cout << Form("leadPFChargedHadrMva<=%f: ",-0.1+cut) <<ZeeCut/ZeeAll << " --- " << ZtautauCut/ZtautauAll << std::endl;
  }

  h2->SetXTitle("e#rightarrow #tau_{had} fake-rate");
  h2->SetYTitle("#tau_{had} efficiency");
  h2->SetAxisRange(0.02,1.0,"X");
  h2->SetAxisRange(0.95,1.01,"Y");
  h2->Draw();

  float ids[] = {1.0,.95,.90,.85,.80,.70,.60};
  for(int i = 0; i<6; i++){
    float ZeeCut_i     = (float) tree_Zee->GetEntries( Form("matchedID>%f",ids[i]-0.025));
    float ZtautauCut_i = (float) tree_Ztautau->GetEntries(Form("matchedID>%f",ids[i]-0.025));
    vxF_VBTF[i]=ZeeCut_i/ZeeAll;
    vyF_VBTF[i]=ZtautauCut_i/ZtautauAll;
    std::cout << Form("matchedID>%f",ids[i]-0.025) << "    " << ZeeCut_i/ZeeAll << " <-- VBTF Zee ----  VBTF Ztautau ---> " << ZtautauCut_i/ZtautauAll << std::endl;
  }

  TVectorF vx_VBTF(6,vxF_VBTF);
  TVectorF vy_VBTF(6,vyF_VBTF);

  TVectorF vx(45,vxF);
  TVectorF vy(45,vyF);
  TGraph* graph = new TGraph(vx,vy);
  TGraph* graph_VBTF = new TGraph(vx_VBTF,vy_VBTF);
  if( tau_.find("HPS")!=string::npos) graph->SetMarkerStyle(kOpenCircle);
  else  graph->SetMarkerStyle(kOpenSquare);
  graph->SetMarkerSize(1.2);
  if( tau_.find("HPS")!=string::npos) graph->SetMarkerColor(kRed);
  else graph->SetMarkerColor(kBlue);
  graph_VBTF->SetMarkerStyle(kFullStar);
  graph_VBTF->SetMarkerSize(1.8);
  graph_VBTF->SetMarkerColor(kBlack);
  graph->Draw("P");
  graph_VBTF->Draw("P");

  string tau = tau_.find("HPS")!=string::npos ? "HPS" : "Shrinking Cone";
  leg->SetHeader( ("#splitline{Simulation: "+tau+" #tau_{had}-candidates}{passing tau-ID and loose isolation}").c_str() );
  leg->AddEntry(graph,"#splitline{discriminator by #xi^{lch}}{-0.1#leq #xi^{lch}_{cut} #leq1.0}","P");
  leg->AddEntry(graph_VBTF,"#splitline{cut-based discriminator}{WP95,90,85,80,70,60 (ID-only)}","P");
  leg->Draw();
}
void paraPull_alpha_FT_EFF_extrapolation_2TeV_2Lep_plots_All()
{
//=========Macro generated from canvas: c1/alpha_FT_EFF_extrapolation
//=========  (Sun Nov 22 20:19:02 2015) by ROOT version6.02/12
   TCanvas *c1 = new TCanvas("c1", "alpha_FT_EFF_extrapolation",0,22,1000,600);
   gStyle->SetOptStat(0);
   c1->Range(-4.125,-0.9756589,37.125,1.048929);
   c1->SetFillColor(0);
   c1->SetBorderMode(0);
   c1->SetBorderSize(2);
   c1->SetGridx();
   c1->SetGridy();
   c1->SetFrameBorderMode(0);
   c1->SetFrameBorderMode(0);
   
   TH1F *NuisanceParameterFreed23 = new TH1F("NuisanceParameterFreed23","alpha_FT_EFF_extrapolation",33,0,33);
   NuisanceParameterFreed23->SetMinimum(-0.7732002);
   NuisanceParameterFreed23->SetMaximum(0.84647);
   NuisanceParameterFreed23->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   NuisanceParameterFreed23->SetLineColor(ci);
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(1,"XS_ttbar");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(2,"EG_SCALE_ALL");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(3,"FT_EFF_Eigen_C_0");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(4,"Luminosity");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(5,"XS_st");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(6,"FT_EFF_Eigen_B_1");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(7,"XS_Zc");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(8,"MUONS_ID");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(9,"FT_EFF_Eigen_C_1");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(10,"FT_EFF_Eigen_C_3");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(11,"MUON_EFF_TrigSystUncertainty");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(12,"XS_Zl");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(13,"EL_EFF_ID_TotalCorrUncertainty");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(14,"FT_EFF_Eigen_B_0");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(15,"FT_EFF_Eigen_B_2");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(16,"EL_EFF_Iso_TotalCorrUncertainty");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(17,"EL_EFF_Reco_TotalCorrUncertainty");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(18,"MUONS_SCALE");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(19,"MUON_ISO_STAT");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(20,"MUON_EFF_STAT");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(21,"MUON_EFF_SYS");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(22,"MUON_EFF_TrigStatUncertainty");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(23,"FT_EFF_Eigen_Light_1");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(24,"FT_EFF_Eigen_Light_2");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(25,"EG_RESOLUTION_ALL");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(26,"XS_diboson");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(27,"FT_EFF_Eigen_Light_4");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(28,"FT_EFF_Eigen_Light_3");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(29,"MUON_ISO_SYS");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(30,"XS_Zb");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(31,"MUONS_MS");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(32,"FT_EFF_Eigen_C_2");
   NuisanceParameterFreed23->GetXaxis()->SetBinLabel(33,"FT_EFF_Eigen_Light_0");
   NuisanceParameterFreed23->GetXaxis()->SetLabelFont(42);
   NuisanceParameterFreed23->GetXaxis()->SetLabelSize(0.035);
   NuisanceParameterFreed23->GetXaxis()->SetTitleSize(0.035);
   NuisanceParameterFreed23->GetXaxis()->SetTitleFont(42);
   NuisanceParameterFreed23->GetYaxis()->SetTitle("#theta_{fit} - #theta_{initial}/#Delta#theta");
   NuisanceParameterFreed23->GetYaxis()->SetLabelFont(42);
   NuisanceParameterFreed23->GetYaxis()->SetLabelSize(0.035);
   NuisanceParameterFreed23->GetYaxis()->SetTitleSize(0.035);
   NuisanceParameterFreed23->GetYaxis()->SetTitleFont(42);
   NuisanceParameterFreed23->GetZaxis()->SetLabelFont(42);
   NuisanceParameterFreed23->GetZaxis()->SetLabelSize(0.035);
   NuisanceParameterFreed23->GetZaxis()->SetTitleSize(0.035);
   NuisanceParameterFreed23->GetZaxis()->SetTitleFont(42);
   NuisanceParameterFreed23->Draw("hist");
   
   Double_t _fx1023[35] = {
   1.22802e-312,
   0.5,
   1.5,
   2.5,
   3.5,
   4.5,
   5.5,
   6.5,
   7.5,
   8.5,
   9.5,
   10.5,
   11.5,
   12.5,
   13.5,
   14.5,
   15.5,
   16.5,
   17.5,
   18.5,
   19.5,
   20.5,
   21.5,
   22.5,
   23.5,
   24.5,
   25.5,
   26.5,
   27.5,
   28.5,
   29.5,
   30.5,
   31.5,
   32.5,
   0};
   Double_t _fy1023[35] = {
   1.22802e-312,
   -0.7732002,
   -0.3921591,
   -0.2934756,
   -0.2062307,
   -0.1826562,
   -0.1278773,
   -0.1247963,
   -0.108241,
   -0.06582277,
   -0.05689324,
   -0.05334169,
   -0.04681761,
   -0.03773949,
   -0.03194355,
   -0.03107318,
   -0.02396662,
   -0.01713834,
   -0.001377884,
   0.0001640769,
   0.01059417,
   0.01807268,
   0.01971767,
   0.02015498,
   0.02031121,
   0.0264387,
   0.04025057,
   0.04268968,
   0.0458893,
   0.05072166,
   0.05322667,
   0.05659235,
   0.05743463,
   0.84647,
   0};
   Double_t _fex1023[35] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t _fey1023[35] = {
   0,
   0,
   0.6107108,
   1.073202,
   1.262649,
   0.9362982,
   0.9916356,
   0.9862464,
   0.9262906,
   0.7691235,
   0.9864321,
   0.9937945,
   0.9917446,
   0.9970094,
   0.9817783,
   0.9372476,
   0.9926669,
   0.9931837,
   0.9925578,
   1.005003,
   0.9933467,
   0.9932277,
   0.9929663,
   0.9927589,
   0.9912906,
   0.9909611,
   1.097757,
   0.9869836,
   0.993171,
   0.9930564,
   0.9854803,
   0.753601,
   0.7380864,
   0.9908989,
   0.785308};
   TGraphErrors *gre = new TGraphErrors(35,_fx1023,_fy1023,_fex1023,_fey1023);
   gre->SetName("");
   gre->SetTitle("");
   gre->SetFillColor(1);
   gre->SetMarkerStyle(20);
   gre->SetMarkerSize(1.2);
   
   TH1F *Graph_Graph1023 = new TH1F("Graph_Graph1023","",100,0,35.75);
   Graph_Graph1023->SetMinimum(-1.799504);
   Graph_Graph1023->SetMaximum(2.167994);
   Graph_Graph1023->SetDirectory(0);
   Graph_Graph1023->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1023->SetLineColor(ci);
   Graph_Graph1023->GetXaxis()->SetLabelFont(42);
   Graph_Graph1023->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1023->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1023->GetXaxis()->SetTitleFont(42);
   Graph_Graph1023->GetYaxis()->SetLabelFont(42);
   Graph_Graph1023->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1023->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1023->GetYaxis()->SetTitleFont(42);
   Graph_Graph1023->GetZaxis()->SetLabelFont(42);
   Graph_Graph1023->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1023->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1023->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1023);
   
   gre->Draw("p");
   
   TLegend *leg = new TLegend(0.1,0.4,0.4,0.95,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextFont(72);
   leg->SetTextSize(0.015);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   leg->Draw();
   
   TPaveText *pt = new TPaveText(0.2917068,0.9341608,0.7082932,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   TText *AText = pt->AddText("alpha_FT_EFF_extrapolation");
   pt->Draw();
   c1->Modified();
   c1->cd();
   c1->SetSelected(c1);
}
Ejemplo n.º 17
0
void EfficiencyByEta_vs_Lz()
{
//=========Macro generated from canvas: eta_lz/eta_lz
//=========  (Thu Oct 29 10:19:05 2015) by ROOT version6.02/05
   TCanvas *eta_lz = new TCanvas("eta_lz", "eta_lz",1123,69,700,500);
   eta_lz->Range(-15,-0.125,95,1.125);
   eta_lz->SetFillColor(0);
   eta_lz->SetBorderMode(0);
   eta_lz->SetBorderSize(2);
   eta_lz->SetFrameBorderMode(0);
   eta_lz->SetFrameBorderMode(0);
   
   TMultiGraph *multigraph = new TMultiGraph();
   multigraph->SetName("");
   multigraph->SetTitle("");
   
   Double_t divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_fx3001[17] = {
   1,
   3,
   5,
   7,
   9,
   11,
   14,
   17,
   19,
   22.5,
   27.5,
   32.5,
   37.5,
   42.5,
   47.5,
   55,
   70};
   Double_t divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_fy3001[17] = {
   0.8207681,
   0.7183406,
   0.6823529,
   0.6296296,
   0.6016949,
   0.5540541,
   0.4752187,
   0.3962264,
   0.4306569,
   0.4033898,
   0.2211982,
   0.2352941,
   0.1679389,
   0.1630435,
   0,
   0,
   0};
   Double_t divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_felx3001[17] = {
   1,
   1,
   1,
   1,
   1,
   1,
   2,
   1,
   1,
   2.5,
   2.5,
   2.5,
   2.5,
   2.5,
   2.5,
   5,
   10};
   Double_t divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_fely3001[17] = {
   0.01564874,
   0.02258889,
   0.02724798,
   0.03011546,
   0.03436919,
   0.03578772,
   0.02830245,
   0.04109258,
   0.04522796,
   0.02985828,
   0.0290375,
   0.03208442,
   0.03356904,
   0.03963993,
   0,
   0,
   0};
   Double_t divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_fehx3001[17] = {
   1,
   1,
   1,
   1,
   1,
   1,
   2,
   1,
   1,
   2.5,
   2.5,
   2.5,
   2.5,
   2.5,
   2.5,
   5,
   10};
   Double_t divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_fehy3001[17] = {
   0.01469211,
   0.02158727,
   0.02611493,
   0.02919205,
   0.03345254,
   0.03526936,
   0.02845448,
   0.04249806,
   0.04632244,
   0.03055065,
   0.03180918,
   0.03514912,
   0.03920329,
   0.04793882,
   0.02750881,
   0.02093884,
   0.05124115};
   TGraphAsymmErrors *grae = new TGraphAsymmErrors(17,divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_fx3001,divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_fy3001,divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_felx3001,divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_fehx3001,divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_fely3001,divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_fehy3001);
   grae->SetName("divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ");
   grae->SetTitle("num_LEp8_1D_A0_LZ");

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#ff0000");
   grae->SetLineColor(ci);

   ci = TColor::GetColor("#ff0000");
   grae->SetMarkerColor(ci);
   grae->SetMarkerStyle(2);
   
   TH1F *Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001 = new TH1F("Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001","num_LEp8_1D_A0_LZ",100,0,88);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->SetMinimum(0);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->SetMaximum(0.9190063);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->SetDirectory(0);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->SetLineColor(ci);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetXaxis()->SetLabelFont(42);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetXaxis()->SetLabelSize(0.035);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetXaxis()->SetTitleSize(0.035);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetXaxis()->SetTitleFont(42);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetYaxis()->SetLabelFont(42);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetYaxis()->SetLabelSize(0.035);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetYaxis()->SetTitleSize(0.035);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetYaxis()->SetTitleFont(42);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetZaxis()->SetLabelFont(42);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetZaxis()->SetLabelSize(0.035);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetZaxis()->SetTitleSize(0.035);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetZaxis()->SetTitleFont(42);
   grae->SetHistogram(Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001);
   
   multigraph->Add(grae,"");
   
   Double_t divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_fx3002[17] = {
   1,
   3,
   5,
   7,
   9,
   11,
   14,
   17,
   19,
   22.5,
   27.5,
   32.5,
   37.5,
   42.5,
   47.5,
   55,
   70};
   Double_t divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_fy3002[17] = {
   0.6232558,
   0.5583756,
   0.5841584,
   0.5437956,
   0.496,
   0.4319249,
   0.3764045,
   0.3773585,
   0.4468085,
   0.3511905,
   0.2879377,
   0.2727273,
   0.2324324,
   0.2269504,
   0.1729323,
   0.139738,
   0.1242424};
   Double_t divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_felx3002[17] = {
   1,
   1,
   1,
   1,
   1,
   1,
   2,
   1,
   1,
   2.5,
   2.5,
   2.5,
   2.5,
   2.5,
   2.5,
   5,
   10};
   Double_t divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_fely3002[17] = {
   0.02003841,
   0.02640712,
   0.03020659,
   0.03202259,
   0.03353345,
   0.03585729,
   0.02667804,
   0.04061892,
   0.04483449,
   0.02702119,
   0.02925602,
   0.0311239,
   0.0321134,
   0.03658286,
   0.03373231,
   0.02335216,
   0.01843313};
   Double_t divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_fehx3002[17] = {
   1,
   1,
   1,
   1,
   1,
   1,
   2,
   1,
   1,
   2.5,
   2.5,
   2.5,
   2.5,
   2.5,
   2.5,
   5,
   10};
   Double_t divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_fehy3002[17] = {
   0.01964108,
   0.02609626,
   0.02961994,
   0.03168431,
   0.03356739,
   0.03653866,
   0.02740908,
   0.04228106,
   0.04564915,
   0.02795583,
   0.03101567,
   0.03334003,
   0.035247,
   0.04082589,
   0.03918793,
   0.02678903,
   0.02089594};
   grae = new TGraphAsymmErrors(17,divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_fx3002,divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_fy3002,divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_felx3002,divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_fehx3002,divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_fely3002,divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_fehy3002);
   grae->SetName("divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ");
   grae->SetTitle("num_LEp8_1D_A1_LZ");
   grae->SetMarkerStyle(2);
   
   TH1F *Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002 = new TH1F("Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002","num_LEp8_1D_A1_LZ",100,0,88);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->SetMinimum(0.05210053);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->SetMaximum(0.6966057);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->SetDirectory(0);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->SetLineColor(ci);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetXaxis()->SetLabelFont(42);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetXaxis()->SetLabelSize(0.035);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetXaxis()->SetTitleSize(0.035);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetXaxis()->SetTitleFont(42);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetYaxis()->SetLabelFont(42);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetYaxis()->SetLabelSize(0.035);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetYaxis()->SetTitleSize(0.035);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetYaxis()->SetTitleFont(42);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetZaxis()->SetLabelFont(42);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetZaxis()->SetLabelSize(0.035);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetZaxis()->SetTitleSize(0.035);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetZaxis()->SetTitleFont(42);
   grae->SetHistogram(Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002);
   
   multigraph->Add(grae,"");
   
   Double_t divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_fx3003[17] = {
   1,
   3,
   5,
   7,
   9,
   11,
   14,
   17,
   19,
   22.5,
   27.5,
   32.5,
   37.5,
   42.5,
   47.5,
   55,
   70};
   Double_t divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_fy3003[17] = {
   0.6829268,
   0.6,
   0.6851852,
   0.6,
   0.6060606,
   0.5588235,
   0.5571429,
   0.5853659,
   0.6071429,
   0.5454545,
   0.3875,
   0.3333333,
   0.2727273,
   0.4090909,
   0.2957746,
   0.1875,
   0.1058201};
   Double_t divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_felx3003[17] = {
   1,
   1,
   1,
   1,
   1,
   1,
   2,
   1,
   1,
   2.5,
   2.5,
   2.5,
   2.5,
   2.5,
   2.5,
   5,
   10};
   Double_t divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_fely3003[17] = {
   0.08888679,
   0.1079526,
   0.07564299,
   0.09880854,
   0.1021968,
   0.1001643,
   0.06689406,
   0.09028307,
   0.1123558,
   0.0589631,
   0.05875506,
   0.06081322,
   0.05358554,
   0.06599562,
   0.05755151,
   0.0355912,
   0.02268587};
   Double_t divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_fehx3003[17] = {
   1,
   1,
   1,
   1,
   1,
   1,
   2,
   1,
   1,
   2.5,
   2.5,
   2.5,
   2.5,
   2.5,
   2.5,
   5,
   10};
   Double_t divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_fehy3003[17] = {
   0.07863764,
   0.1002229,
   0.06787653,
   0.09223778,
   0.0947793,
   0.09618714,
   0.06508215,
   0.08553781,
   0.1034446,
   0.05782793,
   0.06186464,
   0.06620896,
   0.06018711,
   0.06906434,
   0.06399194,
   0.04099953,
   0.02733468};
   grae = new TGraphAsymmErrors(17,divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_fx3003,divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_fy3003,divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_felx3003,divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_fehx3003,divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_fely3003,divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_fehy3003);
   grae->SetName("divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ");
   grae->SetTitle("num_Gp8_1D_A0_LZ");

   ci = TColor::GetColor("#ff0000");
   grae->SetLineColor(ci);
   grae->SetLineStyle(2);

   ci = TColor::GetColor("#ff0000");
   grae->SetMarkerColor(ci);
   grae->SetMarkerStyle(2);
   
   TH1F *Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003 = new TH1F("Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003","num_Gp8_1D_A0_LZ",100,0,88);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->SetMinimum(0.01529121);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->SetMaximum(0.8294075);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->SetDirectory(0);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->SetLineColor(ci);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetXaxis()->SetLabelFont(42);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetXaxis()->SetLabelSize(0.035);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetXaxis()->SetTitleSize(0.035);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetXaxis()->SetTitleFont(42);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetYaxis()->SetLabelFont(42);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetYaxis()->SetLabelSize(0.035);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetYaxis()->SetTitleSize(0.035);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetYaxis()->SetTitleFont(42);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetZaxis()->SetLabelFont(42);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetZaxis()->SetLabelSize(0.035);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetZaxis()->SetTitleSize(0.035);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetZaxis()->SetTitleFont(42);
   grae->SetHistogram(Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003);
   
   multigraph->Add(grae,"");
   
   Double_t divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_fx3004[17] = {
   1,
   3,
   5,
   7,
   9,
   11,
   14,
   17,
   19,
   22.5,
   27.5,
   32.5,
   37.5,
   42.5,
   47.5,
   55,
   70};
   Double_t divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_fy3004[17] = {
   0.7601626,
   0.7016575,
   0.6848485,
   0.6185567,
   0.648,
   0.5301205,
   0.6028369,
   0.5737705,
   0.4423077,
   0.3730159,
   0.3243243,
   0.2906977,
   0.1764706,
   0.3265306,
   0.1176471,
   0.09677419,
   0.03703704};
   Double_t divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_felx3004[17] = {
   1,
   1,
   1,
   1,
   1,
   1,
   2,
   1,
   1,
   2.5,
   2.5,
   2.5,
   2.5,
   2.5,
   2.5,
   5,
   10};
   Double_t divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_fely3004[17] = {
   0.03033946,
   0.03787332,
   0.04029006,
   0.05551651,
   0.04781274,
   0.06080294,
   0.04537447,
   0.07221676,
   0.07639601,
   0.04576098,
   0.04698051,
   0.05176228,
   0.05528972,
   0.07233421,
   0.05543815,
   0.03771076,
   0.02388645};
   Double_t divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_fehx3004[17] = {
   1,
   1,
   1,
   1,
   1,
   1,
   2,
   1,
   1,
   2.5,
   2.5,
   2.5,
   2.5,
   2.5,
   2.5,
   5,
   10};
   Double_t divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_fehy3004[17] = {
   0.02807219,
   0.03547253,
   0.03787114,
   0.05283465,
   0.04523635,
   0.06000368,
   0.04379748,
   0.06951453,
   0.07889241,
   0.047951,
   0.05044641,
   0.05716632,
   0.07010552,
   0.08038169,
   0.08329135,
   0.05332885,
   0.04677086};
   grae = new TGraphAsymmErrors(17,divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_fx3004,divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_fy3004,divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_felx3004,divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_fehx3004,divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_fely3004,divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_fehy3004);
   grae->SetName("divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ");
   grae->SetTitle("num_Gp8_1D_A1_LZ");
   grae->SetLineStyle(2);
   grae->SetMarkerStyle(2);
   
   TH1F *Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004 = new TH1F("Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004","num_Gp8_1D_A1_LZ",100,0,88);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->SetMinimum(0);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->SetMaximum(0.8657432);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->SetDirectory(0);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->SetLineColor(ci);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetXaxis()->SetLabelFont(42);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetXaxis()->SetLabelSize(0.035);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetXaxis()->SetTitleSize(0.035);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetXaxis()->SetTitleFont(42);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetYaxis()->SetLabelFont(42);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetYaxis()->SetLabelSize(0.035);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetYaxis()->SetTitleSize(0.035);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetYaxis()->SetTitleFont(42);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetZaxis()->SetLabelFont(42);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetZaxis()->SetLabelSize(0.035);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetZaxis()->SetTitleSize(0.035);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetZaxis()->SetTitleFont(42);
   grae->SetHistogram(Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004);
   
   multigraph->Add(grae,"");
   multigraph->Draw("ALP");
   multigraph->GetXaxis()->SetTitle("L_{Z} [cm]");
   multigraph->GetXaxis()->SetLabelFont(42);
   multigraph->GetXaxis()->SetLabelSize(0.035);
   multigraph->GetXaxis()->SetTitleSize(0.035);
   multigraph->GetXaxis()->SetTitleFont(42);
   multigraph->GetYaxis()->SetTitle("Efficiency");
   multigraph->GetYaxis()->SetLabelFont(42);
   multigraph->GetYaxis()->SetLabelSize(0.035);
   multigraph->GetYaxis()->SetTitleSize(0.035);
   multigraph->GetYaxis()->SetTitleFont(42);
   TLine *line = new TLine(34.5,0,34.5,1);

   ci = TColor::GetColor("#0000ff");
   line->SetLineColor(ci);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(46.5,0,46.5,1);

   ci = TColor::GetColor("#0000ff");
   line->SetLineColor(ci);
   line->SetLineStyle(2);
   line->Draw();
   
   TLegend *leg = new TLegend(0.6982759,0.6701903,0.8979885,0.8794926,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.03171247);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("divide_num_LEp8_1D_A0_LXY_by_den_LEp8_1D_A0_LXY","|#eta_{#gamma D}| #leq 0.8 A0","L");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("divide_num_Gp8_1D_A0_LXY_by_den_Gp8_1D_A0_LXY","|#eta_{#gamma D}| > 0.8 A0","L");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(2);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("divide_num_LEp8_1D_A1_LXY_by_den_LEp8_1D_A1_LXY","|#eta_{#gamma D}| #leq 0.8 A1","L");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("divide_num_Gp8_1D_A1_LXY_by_den_Gp8_1D_A1_LXY","|#eta_{#gamma D}| > 0.8 A1","L");
   entry->SetLineColor(1);
   entry->SetLineStyle(2);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   eta_lz->Modified();
   eta_lz->cd();
   eta_lz->SetSelected(eta_lz);
}
Ejemplo n.º 18
0
int main (int argc, char * argv[])
{
	// command line input
	if (argc != 3)
	{
		fprintf(stderr, "ERROR - wrong number of arguments\n");
		fprintf(stderr, "usage: %s num_data_points input_file\n", argv[0]);
		return 1;
	}

	int num_data_points = atoi(argv[1]);

	char input_file[256];
	sprintf(input_file, "%s", argv[2]);

	// set style for plots
	SetAtlasStyle();

	// input observed limits
	Float_t mZ[num_data_points];
	Float_t mA[num_data_points];
	Float_t lim_obs[num_data_points];
	Float_t lim_exp[num_data_points];
	Float_t lim_exp_err_hi[num_data_points];
	Float_t lim_exp_err_lo[num_data_points];
	Float_t lim_exp_err_hi_rel[num_data_points];
	Float_t lim_exp_err_lo_rel[num_data_points];

	FILE * file = fopen(input_file, "r");
	for (int i = 0; i < num_data_points; i++)
	{
		fscanf(file, "%f %f %f %f %f %f", &mZ[i], &mA[i], &lim_obs[i], &lim_exp[i], &lim_exp_err_hi[i], &lim_exp_err_lo[i]);
		lim_exp_err_hi_rel[i] = lim_exp_err_hi[i] - lim_exp[i];
		lim_exp_err_lo_rel[i] = lim_exp[i] - lim_exp_err_lo[i];
	}
	fclose(file);

	// set up the graphs
	TGraph * gr_lim_exp_hi_err = new TGraph(num_data_points, mZ, lim_exp_err_hi);
	gr_lim_exp_hi_err->SetFillStyle(1001);
	gr_lim_exp_hi_err->SetFillColor(kGreen);

	TGraph * gr_lim_exp_lo_err = new TGraph(num_data_points, mZ, lim_exp_err_lo);
	gr_lim_exp_lo_err->SetFillStyle(1001);
	gr_lim_exp_lo_err->SetFillColor(kWhite);

	TGraph * gr_lim_exp = new TGraph(num_data_points, mZ, lim_exp);
	gr_lim_exp->SetLineStyle(2);
	gr_lim_exp->SetLineWidth(4);

	TGraph * gr_lim_obs = new TGraph(num_data_points, mZ, lim_obs);
	gr_lim_obs->SetLineWidth(4);

	TGraph * gr_one = new TGraph(2);
	gr_one->SetPoint(0, 600, 1);
	gr_one->SetPoint(1, 1400, 1);
	gr_one->SetLineWidth(4);
	gr_one->SetLineColor(kRed);

	// set up the legend
	TLegend * l = new TLegend(0.67, 0.77, 0.92, 0.92, "");
	l->SetFillStyle(0);
	l->SetBorderSize(0);
	l->SetTextSize(0.04);
	l->SetTextFont(42);
	l->AddEntry(gr_lim_obs, "Observed Limits", "l");
	l->AddEntry(gr_lim_exp, "Expected Limits", "l");
	l->AddEntry(gr_lim_exp_hi_err, "Expected #pm1#sigma", "f");

	// get and print the intersections between the limits and a signal strength of one
	TGraph * gr_obs_one = GetIntersections(gr_lim_obs, gr_one);
	TGraph * gr_exp_one = GetIntersections(gr_lim_exp, gr_one);
	TGraph * gr_exp_lo_err_one = GetIntersections(gr_lim_exp_lo_err, gr_one);
	TGraph * gr_exp_hi_err_one = GetIntersections(gr_lim_exp_hi_err, gr_one);

	gr_obs_one->SetMarkerStyle(20);
	gr_obs_one->SetMarkerColor(kBlue);

	for (int i = 0; i < gr_obs_one->GetN(); i++)
	{
		Double_t x, y = 0;
		gr_obs_one->GetPoint(i, x, y);
		printf("observed limit intersections: %f, %f\n", x, y);
		gr_lim_obs->SetPoint(gr_lim_obs->GetN(), x, y);
		gr_lim_obs->Sort();
	}

	for (int i = 0; i < gr_exp_one->GetN(); i++)
	{
		Double_t x, y = 0;
		gr_exp_one->GetPoint(i, x, y);
		printf("expected limit intersections: %f, %f\n", x, y);
		gr_lim_exp->SetPoint(gr_lim_exp->GetN(), x, y);
		gr_lim_exp->Sort();
	}

	for (int i = 0; i < gr_exp_lo_err_one->GetN(); i++)
	{
		Double_t x, y = 0;
		gr_exp_lo_err_one->GetPoint(i, x, y);
		printf("expected limit low error intersections: %f, %f\n", x, y);
		gr_lim_exp_lo_err->SetPoint(gr_lim_exp_lo_err->GetN(), x, y);
		gr_lim_exp_lo_err->Sort();
	}

	for (int i = 0; i < gr_exp_hi_err_one->GetN(); i++)
	{
		Double_t x, y = 0;
		gr_exp_hi_err_one->GetPoint(i, x, y);
		printf("expected limit high error intersections: %f, %f\n", x, y);
		gr_lim_exp_hi_err->SetPoint(gr_lim_exp_hi_err->GetN(), x, y);
		gr_lim_exp_hi_err->Sort();
	}

	// make the canvas and draw the graphs
	TCanvas * c = new TCanvas("c", "c", 800, 600);
	c->SetLeftMargin(1.2);
	c->SetLogy();

	// add points to make error filling look nice
	Double_t x, y = 0;

	gr_lim_exp_hi_err->GetPoint(0, x, y);
	gr_lim_exp_hi_err->SetPoint(gr_lim_exp_hi_err->GetN(), x - 0.0001, 0.19);
	gr_lim_exp_hi_err->Sort();
	gr_lim_exp_hi_err->GetPoint(gr_lim_exp_hi_err->GetN() - 1, x, y);
	gr_lim_exp_hi_err->SetPoint(gr_lim_exp_hi_err->GetN(), x + 0.0001, 0.19);
	gr_lim_exp_hi_err->Sort();

	gr_lim_exp_lo_err->GetPoint(0, x, y);
	gr_lim_exp_lo_err->SetPoint(gr_lim_exp_lo_err->GetN(), x - 1, y);
	gr_lim_exp_lo_err->Sort();
	gr_lim_exp_lo_err->SetPoint(gr_lim_exp_lo_err->GetN(), x - 2, 0.19);
	gr_lim_exp_lo_err->Sort();
	gr_lim_exp_lo_err->GetPoint(gr_lim_exp_lo_err->GetN() - 1, x, y);
	gr_lim_exp_lo_err->SetPoint(gr_lim_exp_lo_err->GetN(), x + 1, y);
	gr_lim_exp_lo_err->Sort();
	gr_lim_exp_lo_err->SetPoint(gr_lim_exp_lo_err->GetN(), x + 2, 0.19);
	gr_lim_exp_lo_err->Sort();

	// format the axis of the first TGraph that we will draw
	gr_lim_exp_hi_err->GetXaxis()->SetTitle("m_{Z'} [GeV]");
	gr_lim_exp_hi_err->GetYaxis()->SetTitle("Signal Strength @ 95% CL");
	gr_lim_exp_hi_err->GetXaxis()->SetLimits(550, 1450);
	gr_lim_exp_hi_err->GetYaxis()->SetRangeUser(0.2, 15);
	gr_lim_exp_hi_err->GetYaxis()->SetTitleOffset(0.8);

	// draw all the TGraphs
	gr_lim_exp_hi_err->Draw("af");
	gr_lim_exp_lo_err->Draw("f");
	gr_lim_exp->Draw("lx");
	gr_lim_obs->Draw("l");
	gr_one->Draw("l");
	gr_obs_one->Draw("p");

	// redraw the axis
	gPad->RedrawAxis();

	// draw the legend
	l->Draw("same");

	// draw additional text
	TLatex text;
	text.SetNDC();
	text.SetTextSize(0.04);
	char mA_text[256];
	sprintf(mA_text, "m_{A} = %0.f GeV", mA[0]);
	text.DrawLatex(0.67, 0.73, mA_text);

	// output the canvas as a pdf file
	char pdf_file[256];
	sprintf(pdf_file, "mA%0.f_limits_logy.pdf", mA[0]);
	c->SaveAs(pdf_file);

	return 0;
}
 //  fit with 2 components
void fit_chi2_err_two_components(TH1F* dataInput, TH1F* sigTemplate, TH1F* bkgTemplate1,/* TH1F* bkgTemplate2,*/ std::string prefix, 
                                Double_t& sigFrac, Double_t& sigFrac_intial , Double_t& sigFrac_err, 
                                /*Double_t& bkg1Frac, Double_t& bkg1Frac_intial , Double_t& bkg1Frac_err,*/ Double_t& FitChi2)

/*  fit with 3 components
void fit_chi2_err_manytimes(TH1F* dataInput, TH1F* sigTemplate, TH1F* bkgTemplate1, TH1F* bkgTemplate2, std::string prefix, 
			    	Double_t& sigFrac, Double_t& sigFrac_intial , Double_t& sigFrac_err, 
			    	Double_t& bkg1Frac, Double_t& bkg1Frac_intial , Double_t& bkg1Frac_err, Double_t& FitChi2)
*/

//void fit_chi2_err(TH1F* dataInput, TH1F* sigTemplate, TH1F* bkgTemplate, Double_t& sigFrac, Double_t& sigFrac_err)
//void fit_chi2_err(TH1F* dataInput, TH1F* sigTemplate, TH1F* bkgTemplate, Double_t& sigFrac, Double_t& sigFrac_err, Double_t& FitChi2)
{
  gStyle->SetOptStat(kFALSE);
  gStyle->SetCanvasColor(0);
  gStyle->SetCanvasBorderMode(0);
  gStyle->SetPadBorderMode(0);
  gStyle->SetFrameBorderMode(0);

  Double_t scale=1.;




  data = (TH1D*)dataInput->Clone();
  data->SetName("data");
  data->SetLineColor(1);
  data->SetMarkerColor(1);
  data->SetXTitle("SigmaIetaIeta");
  data->Sumw2();
//  scale = 1.0/(Double_t)data->Integral(0,1000); 
  scale = 1.0/(Double_t)data->Integral();
//  scale = 1.0/(Double_t)data->Integral();//changed by Yu-hsiang
  //cout << "scale for data = " << scale << endl;
  data->Scale(scale);


  fit_result = (TH1D*)dataInput->Clone();
  fit_result->SetName("fit_result");
  fit_result->SetLineColor(8); 
  fit_result->SetMarkerColor(8);
  fit_result->SetLineStyle(2);
  fit_result->Sumw2();
  fit_result->Reset();


  signal_pos = (TH1D*)sigTemplate->Clone();
  signal_pos->SetName("signal_pos");
  signal_pos->SetLineColor(2);
  signal_pos->SetMarkerColor(2);
  signal_pos->SetFillColor(2);
  signal_pos->SetXTitle("SigmaIetaIeta");
  signal_pos->Sumw2();
//  scale = 1.0/(Double_t)signal_pos->Integral(0,1000); 
  scale = 1.0/(Double_t)signal_pos->Integral();
//  scale = 1.0/(Double_t)signal_pos->Integral();//changed by Yu-hsiang
  //cout << "scale for signal template = " << scale << endl;
  signal_pos->Scale(scale);


  background_pos1 = (TH1D*)bkgTemplate1->Clone();
  background_pos1->SetName("background_pos1");
  background_pos1->SetLineColor(4);
  background_pos1->SetMarkerColor(4);
  background_pos1->SetFillColor(4);
  background_pos1->SetXTitle("SigmaIetaIeta");
  background_pos1->Sumw2();
//  scale = 1.0/(Double_t)background_pos->Integral(0,1000); 
  scale = 1.0/(Double_t)background_pos1->Integral();
//  scale = 1.0/(Double_t)background_pos->Integral();//changed by Yu-hsiang
  //cout << "scale for background template = " << scale << endl;
  background_pos1->Scale(scale);

/*
  background_pos2 = (TH1D*)bkgTemplate2->Clone();
  background_pos2->SetName("background_pos2");
  background_pos2->SetLineColor(7);
  background_pos2->SetMarkerColor(7);
  background_pos2->SetFillColor(7);
  background_pos2->SetXTitle("SigmaIetaIeta");
  background_pos2->Sumw2();
  scale = 1.0/(Double_t)background_pos2->Integral();
  //cout << "scale for background template = " << scale << endl;
  background_pos2->Scale(scale);
*/

//////////  count the number of points and the dof   



  int Number_of_points =0 ;

//  for (int i=1;i<2000;i++){ //the Sig or Bkg histo has 2000 bins
   for (int i=1;i<= sigTemplate->GetNbinsX();i++){ 
    if(/* ( ( bkgTemplate2->GetBinContent(i) ) != 0) ||*/ ( ( bkgTemplate1->GetBinContent(i) ) != 0) || ( ( sigTemplate->GetBinContent(i) ) != 0 ) ){
    Number_of_points = Number_of_points+1;

    }
  }
//cout<<"Number_of_points:"<<Number_of_points<<endl;
int dof = Number_of_points-1 ;//dof=Number_of_points - free_par
                              //and in this case we normalize it so free_par =1
//cout<<"dof of this fit:"<<dof<<endl;



/////////


  TMinuit *gMinuit = new TMinuit(1); // initialize TMinuit with a maximum of 1 params
//  TMinuit *gMinuit = new TMinuit(2);  //initialize TMinuit with a maximum of 5 (1param??) params
  gMinuit->SetFCN(fcn); // sets function to minimize: fcn is Chi2 with errors on templates

  Double_t arglist[10];
  Int_t ierflg = 0; // status flag, it is 0 when ereything goes fine

  // -- sets error
  arglist[0] = 1;
  gMinuit->mnexcm("SET ERR", arglist ,1,ierflg);

  // set first parameter
  Double_t vstart = sigFrac_intial;
  //Double_t vstart = 0.48 ;//0.11;//intial value
  Double_t step = 0.001;
  gMinuit->mnparm(0, "fsig", vstart, step, 0,1,ierflg);

/*
  // set second parameter
    vstart = bkg1Frac_intial;
//    vstart = 0.4; //0.69;//intial value
    step = 0.001;
  gMinuit->mnparm(1, "fbk1", vstart, step, 0,1,ierflg);
*/

  // Now ready for minimization step
  arglist[0] = 1000;
  arglist[1] = 0.01;
  gMinuit->mnexcm("MIGRAD", arglist ,2,ierflg);

  Double_t fsig=0;
  Double_t fsigerr=0;
  Double_t fbk1=0;
//  Double_t fbk1err=0;
  Double_t chi2 = 0;


  if ( ierflg == 0 ) 
    {

      // Print results
      Double_t amin,edm,errdef;
      Int_t nvpar,nparx,icstat;
      gMinuit->mnstat(amin,edm,errdef,nvpar,nparx,icstat);
      gMinuit->mnprin(3,amin);
      chi2 = (gMinuit->fAmin)/dof;
      gMinuit->GetParameter(0, fsig, fsigerr );  

//      gMinuit->GetParameter(1, fbk1, fbk1err );
      //cout << "Fsig = " << fsig << " +- " << fsigerr << endl;
      //cout << "Fbk1 = " << fbk1 << " +- " << fbk1err << endl;
      //cout << "Chi2/degree of freedom = " << chi2 <<endl;
	fbk1 = 1 - fsig ; 
      TCanvas* c1 = new TCanvas("c1","",500,500);

  TH2F *htmp2 = new TH2F("htmp2","",100, 0., 0.025, 100, 0., data->GetMaximum()*1.25);

  htmp2->SetNdivisions(505,"XY");
  htmp2->SetXTitle("SigmaIetaIeta");
  htmp2->SetYTitle("A.U.");
  htmp2->SetLineColor(1); 

//     htmp2->Draw();


  TH1D* signal_display = (TH1D*)signal_pos->Clone();
  signal_display->SetName("signal_display");
  Double_t scale_sig = signal_display->Integral();
  signal_display->Scale(fsig/scale_sig);
  signal_display->SetFillStyle(3001);

      
  TH1D* background_display1 = (TH1D*)background_pos1->Clone();
  background_display1->SetName("background_display1");
  Double_t scale_background1 = background_display1->Integral();
  background_display1->Scale(fbk1/scale_background1);
  background_display1->SetFillStyle(3001);

/*
  TH1D* background_display2 = (TH1D*)background_pos2->Clone();
  background_display2->SetName("background_display2");
  Double_t scale_background2 = background_display2->Integral();
  background_display2->Scale((1-fsig-fbk1)/scale_background2);
  background_display2->SetFillStyle(3001);
*/

  fit_result->GetXaxis()->SetRangeUser(50,300);
  data->GetXaxis()->SetRangeUser(50,300);
//  fit_result->GetYaxis()->SetRangeUser(0.,0.2);
  fit_result->SetXTitle("mass of hadronic top");
  data->SetXTitle("mass of hadronic top");
//  fit_result->SetXTitle("#sigma_{i#eta i#eta}");
  fit_result->SetTitleSize(0.04,"X");
  fit_result->GetXaxis()->SetLabelSize(0.04);

  data->Draw("histe");
  fit_result->Draw("esame");
//  fit_result->Draw("histe");
//  data->Draw("esame");
  signal_display->Draw("histsame");
  background_display1->Draw("histsame");
//  background_display2->Draw("histsame");

  char result[300];
  sprintf(result,"fsig = %.3lf #pm %.3lf",fsig,fsigerr );
  sigFrac = fsig;
  sigFrac_err = fsigerr ;
//  bkg1Frac =fbk1;
//  bkg1Frac_err =fbk1err;

  FitChi2 = chi2;

  TLegend* leg = new TLegend(0.9,0.6,0.6,0.9);
  leg->SetHeader(result);
  leg->SetFillColor(0);
  leg->SetFillStyle(0);
  leg->SetTextSize(0.035);
  leg->SetBorderSize(0);
  leg->AddEntry(data,"data");
  leg->AddEntry(fit_result,"fit");
  leg->AddEntry(signal_display,"signal template");
  leg->AddEntry(background_display1,"background template1");
//  leg->AddEntry(background_display2,"background template2");
  leg->Draw("same");

cout<< "inside chi2 macro prefix: "<< prefix<< endl;

int save_flag = 0;
if (save_flag == 1){
      std::string outputFile = "plots_of_fit_results/"+  prefix + ".eps";
      c1->Print(outputFile.data());

//      outputFile = prefix + ".gif";
      outputFile = "plots_of_fit_results/"+  prefix + ".gif";
      c1->Print(outputFile.data());

      outputFile = "plots_of_fit_results/"+ prefix + ".C";
      c1->Print(outputFile.data());

      outputFile = "plots_of_fit_results/"+ prefix + ".pdf";
      c1->Print(outputFile.data());
}
    }

    
  else{
    //cout << "Fit failed!\n";
    sigFrac = 0;
    sigFrac_err = 0;
  }

  
  return;

}
Ejemplo n.º 20
0
void plotv2vseta_4p(){

const int ntotbin=4;
const int neta24 = 24;
//const double eta[neta24]={-2.3,-2.1,-1.9,-1.7,-1.5,-1.3,-1.1,-0.9,-0.7,-0.5,-0.3,-0.1,0.1,0.3,0.5,0.7,0.9,1.1,1.3,1.5,1.7,1.9,2.1,2.3};
const double eta[neta24]={2.3,2.1,1.9,1.7,1.5,1.3,1.1,0.9,0.7,0.5,0.3,0.1,-0.1,-0.3,-0.5,-0.7,-0.9,-1.1,-1.3,-1.5,-1.7,-1.9,-2.1,-2.3};
const double v24[5][neta24]={
    {0.0432641,0.0455596,0.047398,0.0487525,0.0474855,0.048846,0.048522,0.0517424,0.0539666,0.0497799,0.0506504,0.0514888,0.052062,0.0549108,0.0568447,0.054158,0.0514865,0.0514555,0.0522606,0.0531111,0.0511507,0.0521319,0.0496498,0.0473403},
    {0.0442665,0.0447503,0.0457534,0.0493462,0.0469372,0.048526,0.0506926,0.0487161,0.0518399,0.0515905,0.0506925,0.0527857,0.0537468,0.0521099,0.0527964,0.0548288,0.051693,0.0509545,0.0495024,0.0510973,0.052487,0.0488386,0.047514,0.0476627},
    {0.0404313,0.0447685,0.0438576,0.0450373,0.0502867,0.0459248,0.0488646,0.0488743,0.052482,0.0522723,0.048692,0.0536635,0.0517914,0.0515041,0.0525336,0.0522464,0.0516658,0.0499649,0.0513079,0.0485047,0.0484243,0.0466903,0.0465833,0.0486667},
    {0.0394377,0.0382888,0.0403906,0.0446794,0.0456563,0.046237,0.0518117,0.0492207,0.0495715,0.0500253,0.0471591,0.0512425,0.0508383,0.0489873,0.0510985,0.0521952,0.0519205,0.0502002,0.0483005,0.0490915,0.0491048,0.0451727,0.0454383,0.0449816}
};
const double v24err[5][neta24]={
    {0.00213252,0.00239273,0.0016591,0.00209502,0.00225771,0.00225458,0.00248255,0.00233681,0.00119202,0.00105722,0.00118857,0.00176323,0.00178824,0.00157164,0.00268905,0.00151479,0.00223109,0.000902273,0.00233205,0.0019693,0.00187124,0.000814683,0.00219925,0.00191728},
    {0.00141958,0.000827599,0.0022066,0.00160681,0.00148752,0.00137974,0.000969869,0.00159642,0.000748125,0.000982856,0.00103947,0.00140614,0.00124063,0.000911796,0.00163491,0.00157494,0.00118583,0.00143245,0.00129396,0.00125119,0.00129714,0.00148963,0.00080729,0.00107534},
    {0.00125317,0.00147008,0.00105077,0.000622335,0.00126054,0.00128997,0.00132659,0.000939361,0.00139537,0.001373,0.000975309,0.00172908,0.00102706,0.00130696,0.00116993,0.00100326,0.00120813,0.00103887,0.00122673,0.00129249,0.00121388,0.00100021,0.000863658,0.00196428},
    {0.00273482,0.00234369,0.00134579,0.00186978,0.00199003,0.0021615,0.00134748,0.00188273,0.00139278,0.00178835,0.00261648,0.00155944,0.00203534,0.00151454,0.0016396,0.00180368,0.00164155,0.00160485,0.00200158,0.00269925,0.00228062,0.00181256,0.00102951,0.00150117}
};
const double v26[5][neta24]={
    {0.0372967,0.0454809,0.0526946,0.040252,0.0568755,0.0402211,0.041394,0.0423501,0.0505429,0.0348172,0.046218,0.0587727,0.0377846,0.0470679,0.0422496,0.0500769,0.0503031,0.0548387,0.0572582,0.0457487,0.049558,0.046186,0.0505475,0.0394379},
    {0.0285363,0.0393923,0.0400587,0.0489756,0.0540125,0.0312662,0.0429369,0.0531532,0.0543499,0.0439156,0.0417407,0.0430776,0.0428994,0.0509004,0.0480431,0.0444528,0.0496354,0.0559514,0.0394878,0.0415313,0.05425,0.0532839,0.0470465,0.0403547},
    {0.0459206,0.0355538,0.0419957,0.0344166,0.0526823,0.0417837,0.0433983,0.0498982,0.0487397,0.0571734,0.0415559,0.0469645,0.0514987,0.0489165,0.0456416,0.0482855,0.0484072,0.0516254,0.043176,0.0435458,0.0392863,0.0450654,0.0406578,0.0389489},
    {0.022798,0.026030,0.035934,0.047467,0.037035,0.041117,0.055143,0.045940,0.028821,0.047708,0.039324,0.056697,0.049173,0.037814,0.051821,0.043677,0.056958,0.042394,0.041518,0.038374,0.046884,0.038156,0.040849,0.048296}
};
const double v26err[5][neta24]={
    {0.00935143,0.00982847,0.00564785,0.00905794,0.0111128,0.00836526,0.0107956,0.0050948,0.00458922,0.00703032,0.00536614,0.00617455,0.00668817,0.00778934,0.0054874,0.00867388,0.00670244,0.00746278,0.0101004,0.00868972,0.00522075,0.00643437,0.00750222,0.0104727},
    {0.00496363,0.00568563,0.00789724,0.0048323,0.00424556,0.00381064,0.00549587,0.00698582,0.00606858,0.005248,0.00389068,0.00377182,0.00558966,0.00829005,0.00499524,0.0048063,0.00470981,0.00472216,0.00394499,0.00481531,0.00674246,0.00472761,0.00462292,0.00781334},
    {0.00545676,0.00422763,0.00492144,0.00519605,0.00478717,0.00489905,0.00360426,0.00377393,0.00562225,0.00593851,0.00600243,0.00362091,0.00439534,0.00214222,0.00588959,0.0060104,0.00502334,0.00448944,0.00550453,0.00430516,0.0046234,0.00400195,0.00446609,0.00440899},
    {0.00638419,0.00604659,0.00874978,0.00639421,0.00870034,0.00465647,0.00681883,0.00506355,0.00564328,0.00414517,0.00490768,0.00585097,0.00484191,0.00889346,0.00481556,0.00689774,0.0100838,0.00806311,0.00644624,0.00440426,0.00577399,0.00511675,0.0054603,0.00638806}
};
const double v28[5][neta24]={
    {0.0715431,0.0622705,0.032117,0.0217226,0.0672875,0.0424787,0.0176958,0.053471,0.040624,0.0637778,0.0481112,0.031055,0.0563658,0.0549635,0.0613547,0.0317414,0.0166499,0.0569516,0.0356099,0.0634825,0.0593198,0.0287702,0.029394,0.0728652},
    {0.00645559,0.0391586,0.0417692,0.0219347,0.0332012,0.0350643,0.022722,0.0145884,0.0449616,0.0458014,0.0352739,0.0583895,0.0283404,0.0515102,0.0462868,0.0586263,0.0491252,0.07865,0.0621928,0.0481825,0.0679307,0.0417835,0.0398492,0.070694},
    {0.0142113,0.0149623,0.0352779,0.0210192,0.0242208,0.0164288,0.0547812,0.0833789,0.066554,0.0481297,0.0383759,0.0512297,0.047438,0.0201015,0.0610993,0.0305725,0.0602495,0.0962027,0.0417315,0.0078534,0.0395888,0.0375707,0.0372333,0.0384892},
    {-0.056093,-0.014727,0.012444,0.060825,0.124009,0.189203,0.147548,-0.025069,-0.042198,0.144555,0.056154,-0.042462,-0.010954,0.011064,0.117553,0.077408,-0.013897,0.008107,-0.099659,0.028184,0.120390,0.080015,-0.064097,0.067662}
};
const double v28err[5][neta24]={
    {0.0189027,0.020825,0.0205137,0.0245923,0.0220476,0.0163261,0.0167048,0.0151245,0.0135629,0.0193551,0.0149366,0.0187209,0.0182479,0.0179809,0.0138375,0.022175,0.0128636,0.0171511,0.0199959,0.0167045,0.00998071,0.0129204,0.0156432,0.0131616},
    {0.0126504,0.0185545,0.0113774,0.00622928,0.0131663,0.00996583,0.0124426,0.0130636,0.0152539,0.0133118,0.0132147,0.0133987,0.0113255,0.0118079,0.0137243,0.0126674,0.0104211,0.0124122,0.00840302,0.0116605,0.00999918,0.0111701,0.0133083,0.0123068},
    {0.0118897,0.016531,0.017573,0.0177533,0.0175104,0.0163231,0.013498,0.0145697,0.0159273,0.0130186,0.0109738,0.00834695,0.0129921,0.0221044,0.014129,0.0152436,0.0193347,0.0141917,0.0178025,0.0183253,0.0154219,0.00937566,0.0139814,0.013235},
    {0.056716,0.0691342,0.0559995,0.0615565,0.0712773,0.0464516,0.0479385,0.0548723,0.0430702,0.0407193,0.0674964,0.0461579,0.0411515,0.0489988,0.0480329,0.0501363,0.0655108,0.0547294,0.0678025,0.0537292,0.0347939,0.0559245,0.0643674,0.0614759}
};
const int trkpointmin[ntotbin] = {120,150,185,220};
const int trkpointmax[ntotbin] = {150,185,220,260};
c1 = new TCanvas("c1"," ",1200,350);
makeMultiPanelCanvas(c1,4,1,0,0,0.15,0.15,0.01);
    gStyle->SetOptFit(1);
    gStyle->SetOptStat(0);
    gStyle->SetOptTitle(0);
    gStyle->SetErrorX(0);
    TH1D *hFrame = new TH1D("","",80,-3,3);
    hFrame->SetTitle("");
    hFrame->SetTitle("v_{2} vs #eta");
    hFrame->GetXaxis()->SetTitle("#eta");
    hFrame->GetYaxis()->SetTitle("v_{2}");	
    hFrame->GetXaxis()->SetTitleSize(0.06);
    hFrame->GetYaxis()->SetTitleSize(0.06);
    hFrame->GetXaxis()->SetLabelSize(0.06);
    hFrame->GetYaxis()->SetLabelSize(0.06);
    hFrame->GetXaxis()->CenterTitle();
    hFrame->GetYaxis()->CenterTitle();
    hFrame->GetYaxis()->SetNdivisions(505);
    hFrame->GetXaxis()->SetRangeUser(-2.5,2.5);
    hFrame->SetMaximum(0.18);

int xbin=0;
for(int i=0;i<ntotbin;i++){
	//TFile *fProderr = TFile::Open(Form("M%d%d/mergedv_Prod2_eta_sub.root",trkpointmax[i],trkpointmin[i]));
	TFile *fProderr = TFile::Open(Form("M%d%d/mergedv_Prod2_coarse_eta_sub.root",trkpointmax[i],trkpointmin[i]));
	//TFile *fProd = TFile::Open(Form("M%d%d/mergedv_Prod2_eta.root",trkpointmax[t-1],trkpointmin[t-1]));
	TVectorD *vecDv2_Proderr = (TVectorD*)fProderr->Get(Form("D_%d/vmeanmean",xbin));
	TVectorD *vecDv2err_Proderr = (TVectorD*)fProderr->Get(Form("D_%d/sigmavmeanmean",xbin));
	TVectorD *vecDavgeta_Proderr = (TVectorD*)fProderr->Get(Form("D_%d/avgavgeta",xbin));
	
	//TVectorD *vecDv2_Prod = (TVectorD*)fProd->Get(Form("D_%d/vmean",xbin));
	//TVectorD *vecDv2err_Prod = (TVectorD*)fProd->Get(Form("D_%d/deltavmean",xbin));
	//TVectorD *vecDavgeta_Prod = (TVectorD*)fProd->Get(Form("D_%d/avgeta",xbin));

	double *avgeta_Proderr = vecDavgeta_Proderr->GetMatrixArray();
	double *v2_Proderr = vecDv2_Proderr->GetMatrixArray();
	double *v2err_Proderr = vecDv2err_Proderr->GetMatrixArray();

	//double *avgeta_Prod = vecDavgeta_Prod->GetMatrixArray();
	//double *v2_Prod = vecDv2_Prod->GetMatrixArray();
	//double *v2err_Prod = vecDv2err_Prod->GetMatrixArray();
	int neta = vecDavgeta_Proderr->GetNrows();
	
	c1->cd(i+1);
	//if(i!=ntotbin-1)
	//TGraphErrors *grProd=new TGraphErrors(neta,avgeta_Prod,v2_Prod,0,v2err_Prod);
	TGraphErrors *grProd=new TGraphErrors(neta,avgeta_Proderr,v2_Proderr,0,v2err_Proderr);
	TGraphErrors *gr24=new TGraphErrors(neta24,eta,v24[i],0,v24err[i]);
	TGraphErrors *gr26=new TGraphErrors(neta24,eta,v26[i],0,v26err[i]);
	TGraphErrors *gr28=new TGraphErrors(neta24,eta,v28[i],0,v28err[i]);
	gr24->SetMarkerSize(1.4);
	gr24->SetMarkerColor(1);
	gr24->SetMarkerStyle(20);
	gr24->SetLineColor(1);
	gr26->SetMarkerSize(1.4);
	gr26->SetMarkerColor(4);
	gr26->SetMarkerStyle(34);
	gr26->SetLineColor(4);
	gr28->SetMarkerSize(1.4);
	gr28->SetMarkerColor(2);
	gr28->SetMarkerStyle(33);
	gr28->SetLineColor(2);
	grProd->SetMarkerSize(1.5);
	grProd->SetMarkerStyle(20);
	grProd->SetMarkerColor(6);
	grProd->SetLineColor(6);
	hFrame->Draw();
	gr24->Draw("Psame");
	gr26->Draw("Psame");
	gr28->Draw("Psame");
	grProd->Draw("Psame");
	TLegend *tl = new TLegend(0.2,0.70,0.4,0.95);
	tl->SetFillColor(0);
	tl->SetBorderSize(0);
	tl->SetTextSize(0.055);
	tl->AddEntry(grProd,"v_{2}{LYZ}","lp");
	tl->AddEntry(gr24,"v_{2}{4} cumulant","lp");
	tl->AddEntry(gr26,"v_{2}{6} cumulant","lp");
	tl->AddEntry(gr28,"v_{2}{8} cumulant","lp");
            TLatex *tlx0 = new TLatex(0.2,0.85,Form("CMS pPb #sqrt{s_{NN}} = 5.02TeV"));
	tlx0->SetNDC();
	tlx0->SetTextSize(0.065);
	if(i==0)
	tlx0->Draw("same");
	if(i==0) 
		TLatex *tlx2 = new TLatex(0.6,0.2,Form("%d<N_{trk}^{offline}<%d",trkpointmin[i],trkpointmax[i]));
	else
		TLatex *tlx2 = new TLatex(0.5,0.2,Form("%d<N_{trk}^{offline}<%d",trkpointmin[i],trkpointmax[i]));
	if(i==1) tl->Draw("same");
	tlx2->SetNDC();
	tlx2->SetTextSize(0.055);
	tlx2->Draw("same");
	//fProd->Close();
        //TLatex *tlx1 = new TLatex(0.12,0.25,Form("%.1f<p_{T}<%.1f (GeV/c)",0.3,6.0));
	//tlx1->SetNDC();
	//tlx1->SetTextSize(0.045);
        }
	//tlx1->Draw("same");
	c1->Print("v2vseta_4p_comp.png");
	c1->Print("v2vseta_4p_comp.pdf");
}
void TracktoSegX_2015all_sameYrange()
{
//=========Macro generated from canvas: TracktoSegX/TracktoSegX
//=========  (Fri Aug  5 08:13:37 2016) by ROOT version6.06/01
   TCanvas *TracktoSegX = new TCanvas("TracktoSegX", "TracktoSegX",0,0,500,500);
   gStyle->SetOptStat(0);
   TracktoSegX->SetHighLightColor(2);
   TracktoSegX->Range(-50,-2.848556,50,2.626708);
   TracktoSegX->SetFillColor(0);
   TracktoSegX->SetBorderMode(0);
   TracktoSegX->SetBorderSize(2);
   TracktoSegX->SetLogy();
   TracktoSegX->SetFrameBorderMode(0);
   TracktoSegX->SetFrameBorderMode(0);
   
   TH1D *TracktoSegX_1__97 = new TH1D("TracktoSegX_1__97","TracktoSegX",100,-40,40);
   TracktoSegX_1__97->SetBinContent(0,375.4342);
   TracktoSegX_1__97->SetBinContent(12,0.001237011);
   TracktoSegX_1__97->SetBinContent(15,0.001237011);
   TracktoSegX_1__97->SetBinContent(16,0.002474023);
   TracktoSegX_1__97->SetBinContent(18,0.001237011);
   TracktoSegX_1__97->SetBinContent(19,0.0105146);
   TracktoSegX_1__97->SetBinContent(20,0.006185057);
   TracktoSegX_1__97->SetBinContent(21,0.01608115);
   TracktoSegX_1__97->SetBinContent(22,0.02968827);
   TracktoSegX_1__97->SetBinContent(23,0.03958436);
   TracktoSegX_1__97->SetBinContent(24,0.0222662);
   TracktoSegX_1__97->SetBinContent(25,0.05319149);
   TracktoSegX_1__97->SetBinContent(26,0.05813953);
   TracktoSegX_1__97->SetBinContent(27,0.08164275);
   TracktoSegX_1__97->SetBinContent(28,0.1292677);
   TracktoSegX_1__97->SetBinContent(29,0.1373083);
   TracktoSegX_1__97->SetBinContent(30,0.1688521);
   TracktoSegX_1__97->SetBinContent(31,0.1929738);
   TracktoSegX_1__97->SetBinContent(32,0.2554429);
   TracktoSegX_1__97->SetBinContent(33,0.3284265);
   TracktoSegX_1__97->SetBinContent(34,0.3698664);
   TracktoSegX_1__97->SetBinContent(35,0.3958436);
   TracktoSegX_1__97->SetBinContent(36,0.494186);
   TracktoSegX_1__97->SetBinContent(37,0.4997526);
   TracktoSegX_1__97->SetBinContent(38,0.5745918);
   TracktoSegX_1__97->SetBinContent(39,0.5838694);
   TracktoSegX_1__97->SetBinContent(40,0.7119);
   TracktoSegX_1__97->SetBinContent(41,0.8040574);
   TracktoSegX_1__97->SetBinContent(42,0.8640524);
   TracktoSegX_1__97->SetBinContent(43,0.8832261);
   TracktoSegX_1__97->SetBinContent(44,1.021153);
   TracktoSegX_1__97->SetBinContent(45,1.113929);
   TracktoSegX_1__97->SetBinContent(46,1.229589);
   TracktoSegX_1__97->SetBinContent(47,1.442355);
   TracktoSegX_1__97->SetBinContent(48,1.804181);
   TracktoSegX_1__97->SetBinContent(49,3.077684);
   TracktoSegX_1__97->SetBinContent(50,32.86739);
   TracktoSegX_1__97->SetBinContent(51,32.61009);
   TracktoSegX_1__97->SetBinContent(52,2.986764);
   TracktoSegX_1__97->SetBinContent(53,1.827684);
   TracktoSegX_1__97->SetBinContent(54,1.49431);
   TracktoSegX_1__97->SetBinContent(55,1.259278);
   TracktoSegX_1__97->SetBinContent(56,1.081148);
   TracktoSegX_1__97->SetBinContent(57,1.019297);
   TracktoSegX_1__97->SetBinContent(58,0.8819891);
   TracktoSegX_1__97->SetBinContent(59,0.8257051);
   TracktoSegX_1__97->SetBinContent(60,0.7174666);
   TracktoSegX_1__97->SetBinContent(61,0.6729342);
   TracktoSegX_1__97->SetBinContent(62,0.650668);
   TracktoSegX_1__97->SetBinContent(63,0.5523256);
   TracktoSegX_1__97->SetBinContent(64,0.5411925);
   TracktoSegX_1__97->SetBinContent(65,0.3983177);
   TracktoSegX_1__97->SetBinContent(66,0.4063582);
   TracktoSegX_1__97->SetBinContent(67,0.329045);
   TracktoSegX_1__97->SetBinContent(68,0.2845126);
   TracktoSegX_1__97->SetBinContent(69,0.2467838);
   TracktoSegX_1__97->SetBinContent(70,0.2523503);
   TracktoSegX_1__97->SetBinContent(71,0.1571004);
   TracktoSegX_1__97->SetBinContent(72,0.1261752);
   TracktoSegX_1__97->SetBinContent(73,0.103909);
   TracktoSegX_1__97->SetBinContent(74,0.07422068);
   TracktoSegX_1__97->SetBinContent(75,0.05999505);
   TracktoSegX_1__97->SetBinContent(76,0.03834735);
   TracktoSegX_1__97->SetBinContent(77,0.0321623);
   TracktoSegX_1__97->SetBinContent(78,0.02350322);
   TracktoSegX_1__97->SetBinContent(79,0.02102919);
   TracktoSegX_1__97->SetBinContent(80,0.01731816);
   TracktoSegX_1__97->SetBinContent(81,0.007422068);
   TracktoSegX_1__97->SetBinContent(82,0.007422068);
   TracktoSegX_1__97->SetBinContent(83,0.007422068);
   TracktoSegX_1__97->SetBinContent(84,0.003711034);
   TracktoSegX_1__97->SetBinContent(85,0.004948046);
   TracktoSegX_1__97->SetBinContent(86,0.001237011);
   TracktoSegX_1__97->SetBinContent(87,0.002474023);
   TracktoSegX_1__97->SetMinimum(0.005);
   TracktoSegX_1__97->SetMaximum(120);
   TracktoSegX_1__97->SetEntries(768682);
   TracktoSegX_1__97->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#ff00ff");
   TracktoSegX_1__97->SetLineColor(ci);

   ci = TColor::GetColor("#ff00ff");
   TracktoSegX_1__97->SetMarkerColor(ci);
   TracktoSegX_1__97->GetXaxis()->SetTitle("cm");
   TracktoSegX_1__97->GetYaxis()->SetTitle("scaled number of entries");
   TracktoSegX_1__97->Draw("H");
   
   TLegend *leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("TracktoSegX_1","ME11A: mean:-0.0cm;RMS:4.5cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_2","ME11B: mean:0.0cm;RMS:4.7cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_3","ME12+13: mean:-0.0cm;RMS:3.5cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_4","ME2: mean:-0.0cm;RMS:3.8cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_5","ME3: mean:0.0cm;RMS:2.8cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_6","ME4: mean:-0.0cm;RMS:2.4cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TH1D *TracktoSegX_2__98 = new TH1D("TracktoSegX_2__98","TracktoSegX",100,-40,40);
   TracktoSegX_2__98->SetBinContent(0,259.1199);
   TracktoSegX_2__98->SetBinContent(4,0.0005124775);
   TracktoSegX_2__98->SetBinContent(5,0.001024955);
   TracktoSegX_2__98->SetBinContent(6,0.001537433);
   TracktoSegX_2__98->SetBinContent(7,0.00204991);
   TracktoSegX_2__98->SetBinContent(8,0.002562388);
   TracktoSegX_2__98->SetBinContent(9,0.003843582);
   TracktoSegX_2__98->SetBinContent(10,0.003587343);
   TracktoSegX_2__98->SetBinContent(11,0.006662208);
   TracktoSegX_2__98->SetBinContent(12,0.01127451);
   TracktoSegX_2__98->SetBinContent(13,0.01281194);
   TracktoSegX_2__98->SetBinContent(14,0.01793671);
   TracktoSegX_2__98->SetBinContent(15,0.01896167);
   TracktoSegX_2__98->SetBinContent(16,0.02383021);
   TracktoSegX_2__98->SetBinContent(17,0.0297237);
   TracktoSegX_2__98->SetBinContent(18,0.03382352);
   TracktoSegX_2__98->SetBinContent(19,0.04048573);
   TracktoSegX_2__98->SetBinContent(20,0.04663546);
   TracktoSegX_2__98->SetBinContent(21,0.05150399);
   TracktoSegX_2__98->SetBinContent(22,0.05406638);
   TracktoSegX_2__98->SetBinContent(23,0.06867199);
   TracktoSegX_2__98->SetBinContent(24,0.09480835);
   TracktoSegX_2__98->SetBinContent(25,0.09942064);
   TracktoSegX_2__98->SetBinContent(26,0.1086452);
   TracktoSegX_2__98->SetBinContent(27,0.1314505);
   TracktoSegX_2__98->SetBinContent(28,0.1450311);
   TracktoSegX_2__98->SetBinContent(29,0.1563057);
   TracktoSegX_2__98->SetBinContent(30,0.1883355);
   TracktoSegX_2__98->SetBinContent(31,0.1965351);
   TracktoSegX_2__98->SetBinContent(32,0.1924353);
   TracktoSegX_2__98->SetBinContent(33,0.216778);
   TracktoSegX_2__98->SetBinContent(34,0.2395833);
   TracktoSegX_2__98->SetBinContent(35,0.2705881);
   TracktoSegX_2__98->SetBinContent(36,0.2711006);
   TracktoSegX_2__98->SetBinContent(37,0.2977495);
   TracktoSegX_2__98->SetBinContent(38,0.3202985);
   TracktoSegX_2__98->SetBinContent(39,0.3223484);
   TracktoSegX_2__98->SetBinContent(40,0.3574531);
   TracktoSegX_2__98->SetBinContent(41,0.3817958);
   TracktoSegX_2__98->SetBinContent(42,0.4087008);
   TracktoSegX_2__98->SetBinContent(43,0.4412432);
   TracktoSegX_2__98->SetBinContent(44,0.5106839);
   TracktoSegX_2__98->SetBinContent(45,0.5993425);
   TracktoSegX_2__98->SetBinContent(46,0.7343803);
   TracktoSegX_2__98->SetBinContent(47,0.9708887);
   TracktoSegX_2__98->SetBinContent(48,1.494897);
   TracktoSegX_2__98->SetBinContent(49,3.267044);
   TracktoSegX_2__98->SetBinContent(50,37.33783);
   TracktoSegX_2__98->SetBinContent(51,36.97833);
   TracktoSegX_2__98->SetBinContent(52,3.26192);
   TracktoSegX_2__98->SetBinContent(53,1.436987);
   TracktoSegX_2__98->SetBinContent(54,0.9283531);
   TracktoSegX_2__98->SetBinContent(55,0.7395051);
   TracktoSegX_2__98->SetBinContent(56,0.5714125);
   TracktoSegX_2__98->SetBinContent(57,0.5099152);
   TracktoSegX_2__98->SetBinContent(58,0.4555925);
   TracktoSegX_2__98->SetBinContent(59,0.4151068);
   TracktoSegX_2__98->SetBinContent(60,0.3835894);
   TracktoSegX_2__98->SetBinContent(61,0.3664214);
   TracktoSegX_2__98->SetBinContent(62,0.3364415);
   TracktoSegX_2__98->SetBinContent(63,0.2885249);
   TracktoSegX_2__98->SetBinContent(64,0.3154299);
   TracktoSegX_2__98->SetBinContent(65,0.2769941);
   TracktoSegX_2__98->SetBinContent(66,0.2685382);
   TracktoSegX_2__98->SetBinContent(67,0.2621323);
   TracktoSegX_2__98->SetBinContent(68,0.2265151);
   TracktoSegX_2__98->SetBinContent(69,0.2298462);
   TracktoSegX_2__98->SetBinContent(70,0.1893605);
   TracktoSegX_2__98->SetBinContent(71,0.1616867);
   TracktoSegX_2__98->SetBinContent(72,0.1775735);
   TracktoSegX_2__98->SetBinContent(73,0.1460561);
   TracktoSegX_2__98->SetBinContent(74,0.1224821);
   TracktoSegX_2__98->SetBinContent(75,0.1260695);
   TracktoSegX_2__98->SetBinContent(76,0.09147724);
   TracktoSegX_2__98->SetBinContent(77,0.09275844);
   TracktoSegX_2__98->SetBinContent(78,0.0799465);
   TracktoSegX_2__98->SetBinContent(79,0.06098483);
   TracktoSegX_2__98->SetBinContent(80,0.06175354);
   TracktoSegX_2__98->SetBinContent(81,0.06098483);
   TracktoSegX_2__98->SetBinContent(82,0.03536095);
   TracktoSegX_2__98->SetBinContent(83,0.02562388);
   TracktoSegX_2__98->SetBinContent(84,0.02459892);
   TracktoSegX_2__98->SetBinContent(85,0.02101158);
   TracktoSegX_2__98->SetBinContent(86,0.0204991);
   TracktoSegX_2__98->SetBinContent(87,0.01229946);
   TracktoSegX_2__98->SetBinContent(88,0.01383689);
   TracktoSegX_2__98->SetBinContent(89,0.01076203);
   TracktoSegX_2__98->SetBinContent(90,0.006149731);
   TracktoSegX_2__98->SetBinContent(91,0.006149731);
   TracktoSegX_2__98->SetBinContent(92,0.005637253);
   TracktoSegX_2__98->SetBinContent(93,0.001537433);
   TracktoSegX_2__98->SetBinContent(94,0.00204991);
   TracktoSegX_2__98->SetBinContent(95,0.00204991);
   TracktoSegX_2__98->SetBinContent(96,0.001024955);
   TracktoSegX_2__98->SetBinContent(97,0.001024955);
   TracktoSegX_2__98->SetBinContent(98,0.0005124775);
   TracktoSegX_2__98->SetEntries(1401505);
   TracktoSegX_2__98->SetStats(0);

   ci = TColor::GetColor("#ff9999");
   TracktoSegX_2__98->SetLineColor(ci);

   ci = TColor::GetColor("#ff9999");
   TracktoSegX_2__98->SetMarkerColor(ci);
   TracktoSegX_2__98->GetXaxis()->SetTitle("cm");
   TracktoSegX_2__98->GetYaxis()->SetTitle("scaled number of entries");
   TracktoSegX_2__98->Draw("H,same");
   
   leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("TracktoSegX_1","ME11A: mean:-0.0cm;RMS:4.5cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_2","ME11B: mean:0.0cm;RMS:4.7cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_3","ME12+13: mean:-0.0cm;RMS:3.5cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_4","ME2: mean:-0.0cm;RMS:3.8cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_5","ME3: mean:0.0cm;RMS:2.8cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_6","ME4: mean:-0.0cm;RMS:2.4cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TH1D *TracktoSegX_3__99 = new TH1D("TracktoSegX_3__99","TracktoSegX",100,-40,40);
   TracktoSegX_3__99->SetBinContent(0,87.29437);
   TracktoSegX_3__99->SetBinContent(1,0.006549083);
   TracktoSegX_3__99->SetBinContent(2,0.01309817);
   TracktoSegX_3__99->SetBinContent(3,0.02292179);
   TracktoSegX_3__99->SetBinContent(4,0.008186354);
   TracktoSegX_3__99->SetBinContent(5,0.006549083);
   TracktoSegX_3__99->SetBinContent(6,0.009823625);
   TracktoSegX_3__99->SetBinContent(7,0.01800998);
   TracktoSegX_3__99->SetBinContent(8,0.01555407);
   TracktoSegX_3__99->SetBinContent(9,0.01473544);
   TracktoSegX_3__99->SetBinContent(10,0.01882861);
   TracktoSegX_3__99->SetBinContent(11,0.01555407);
   TracktoSegX_3__99->SetBinContent(12,0.01719134);
   TracktoSegX_3__99->SetBinContent(13,0.01555407);
   TracktoSegX_3__99->SetBinContent(14,0.0139168);
   TracktoSegX_3__99->SetBinContent(15,0.02292179);
   TracktoSegX_3__99->SetBinContent(16,0.02210316);
   TracktoSegX_3__99->SetBinContent(17,0.02128452);
   TracktoSegX_3__99->SetBinContent(18,0.01800998);
   TracktoSegX_3__99->SetBinContent(19,0.01800998);
   TracktoSegX_3__99->SetBinContent(20,0.03438269);
   TracktoSegX_3__99->SetBinContent(21,0.02210316);
   TracktoSegX_3__99->SetBinContent(22,0.03151746);
   TracktoSegX_3__99->SetBinContent(23,0.03438269);
   TracktoSegX_3__99->SetBinContent(24,0.03151746);
   TracktoSegX_3__99->SetBinContent(25,0.0392945);
   TracktoSegX_3__99->SetBinContent(26,0.02210316);
   TracktoSegX_3__99->SetBinContent(27,0.0392945);
   TracktoSegX_3__99->SetBinContent(28,0.04175041);
   TracktoSegX_3__99->SetBinContent(29,0.0253777);
   TracktoSegX_3__99->SetBinContent(30,0.0392945);
   TracktoSegX_3__99->SetBinContent(31,0.03683859);
   TracktoSegX_3__99->SetBinContent(32,0.03847586);
   TracktoSegX_3__99->SetBinContent(33,0.04502495);
   TracktoSegX_3__99->SetBinContent(34,0.05280198);
   TracktoSegX_3__99->SetBinContent(35,0.05730448);
   TracktoSegX_3__99->SetBinContent(36,0.06057902);
   TracktoSegX_3__99->SetBinContent(37,0.05935107);
   TracktoSegX_3__99->SetBinContent(38,0.07203992);
   TracktoSegX_3__99->SetBinContent(39,0.07981695);
   TracktoSegX_3__99->SetBinContent(40,0.09496171);
   TracktoSegX_3__99->SetBinContent(41,0.1015108);
   TracktoSegX_3__99->SetBinContent(42,0.1530848);
   TracktoSegX_3__99->SetBinContent(43,0.217757);
   TracktoSegX_3__99->SetBinContent(44,0.3307287);
   TracktoSegX_3__99->SetBinContent(45,0.6188884);
   TracktoSegX_3__99->SetBinContent(46,1.039258);
   TracktoSegX_3__99->SetBinContent(47,2.144415);
   TracktoSegX_3__99->SetBinContent(48,4.776738);
   TracktoSegX_3__99->SetBinContent(49,12.08347);
   TracktoSegX_3__99->SetBinContent(50,27.23887);
   TracktoSegX_3__99->SetBinContent(51,27.20489);
   TracktoSegX_3__99->SetBinContent(52,12.24515);
   TracktoSegX_3__99->SetBinContent(53,4.901989);
   TracktoSegX_3__99->SetBinContent(54,2.116991);
   TracktoSegX_3__99->SetBinContent(55,0.9835905);
   TracktoSegX_3__99->SetBinContent(56,0.5615839);
   TracktoSegX_3__99->SetBinContent(57,0.3331846);
   TracktoSegX_3__99->SetBinContent(58,0.2050682);
   TracktoSegX_3__99->SetBinContent(59,0.1690482);
   TracktoSegX_3__99->SetBinContent(60,0.1268885);
   TracktoSegX_3__99->SetBinContent(61,0.09086853);
   TracktoSegX_3__99->SetBinContent(62,0.08186354);
   TracktoSegX_3__99->SetBinContent(63,0.05976039);
   TracktoSegX_3__99->SetBinContent(64,0.05607653);
   TracktoSegX_3__99->SetBinContent(65,0.06385356);
   TracktoSegX_3__99->SetBinContent(66,0.04829949);
   TracktoSegX_3__99->SetBinContent(67,0.04666222);
   TracktoSegX_3__99->SetBinContent(68,0.05566721);
   TracktoSegX_3__99->SetBinContent(69,0.04093177);
   TracktoSegX_3__99->SetBinContent(70,0.03274542);
   TracktoSegX_3__99->SetBinContent(71,0.02947087);
   TracktoSegX_3__99->SetBinContent(72,0.03765723);
   TracktoSegX_3__99->SetBinContent(73,0.03028951);
   TracktoSegX_3__99->SetBinContent(74,0.02578702);
   TracktoSegX_3__99->SetBinContent(75,0.02947087);
   TracktoSegX_3__99->SetBinContent(76,0.02374043);
   TracktoSegX_3__99->SetBinContent(77,0.02660565);
   TracktoSegX_3__99->SetBinContent(78,0.02742429);
   TracktoSegX_3__99->SetBinContent(79,0.02865224);
   TracktoSegX_3__99->SetBinContent(80,0.02374043);
   TracktoSegX_3__99->SetBinContent(81,0.02455906);
   TracktoSegX_3__99->SetBinContent(82,0.02455906);
   TracktoSegX_3__99->SetBinContent(83,0.02455906);
   TracktoSegX_3__99->SetBinContent(84,0.03028951);
   TracktoSegX_3__99->SetBinContent(85,0.0278336);
   TracktoSegX_3__99->SetBinContent(86,0.01473544);
   TracktoSegX_3__99->SetBinContent(87,0.01432612);
   TracktoSegX_3__99->SetBinContent(88,0.01719134);
   TracktoSegX_3__99->SetBinContent(89,0.01637271);
   TracktoSegX_3__99->SetBinContent(90,0.01473544);
   TracktoSegX_3__99->SetBinContent(91,0.0114609);
   TracktoSegX_3__99->SetBinContent(92,0.02046589);
   TracktoSegX_3__99->SetBinContent(93,0.01309817);
   TracktoSegX_3__99->SetBinContent(94,0.0114609);
   TracktoSegX_3__99->SetBinContent(95,0.0114609);
   TracktoSegX_3__99->SetBinContent(96,0.01227953);
   TracktoSegX_3__99->SetBinContent(97,0.01064226);
   TracktoSegX_3__99->SetBinContent(98,0.009823625);
   TracktoSegX_3__99->SetBinContent(99,0.01227953);
   TracktoSegX_3__99->SetBinContent(100,0.008186354);
   TracktoSegX_3__99->SetBinContent(101,0.1338469);
   TracktoSegX_3__99->SetEntries(457904);
   TracktoSegX_3__99->SetStats(0);
   TracktoSegX_3__99->GetXaxis()->SetTitle("cm");
   TracktoSegX_3__99->GetYaxis()->SetTitle("scaled number of entries");
   TracktoSegX_3__99->Draw("H,same");
   
   leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("TracktoSegX_1","ME11A: mean:-0.0cm;RMS:4.5cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_2","ME11B: mean:0.0cm;RMS:4.7cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_3","ME12+13: mean:-0.0cm;RMS:3.5cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_4","ME2: mean:-0.0cm;RMS:3.8cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_5","ME3: mean:0.0cm;RMS:2.8cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_6","ME4: mean:-0.0cm;RMS:2.4cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TH1D *TracktoSegX_4__100 = new TH1D("TracktoSegX_4__100","TracktoSegX",100,-40,40);
   TracktoSegX_4__100->SetBinContent(0,206.7981);
   TracktoSegX_4__100->SetBinContent(1,0.01644545);
   TracktoSegX_4__100->SetBinContent(2,0.021105);
   TracktoSegX_4__100->SetBinContent(3,0.02439409);
   TracktoSegX_4__100->SetBinContent(4,0.01795295);
   TracktoSegX_4__100->SetBinContent(5,0.02055682);
   TracktoSegX_4__100->SetBinContent(6,0.02439409);
   TracktoSegX_4__100->SetBinContent(7,0.01836409);
   TracktoSegX_4__100->SetBinContent(8,0.01863818);
   TracktoSegX_4__100->SetBinContent(9,0.02069386);
   TracktoSegX_4__100->SetBinContent(10,0.02247545);
   TracktoSegX_4__100->SetBinContent(11,0.02507932);
   TracktoSegX_4__100->SetBinContent(12,0.02576454);
   TracktoSegX_4__100->SetBinContent(13,0.02247545);
   TracktoSegX_4__100->SetBinContent(14,0.01918636);
   TracktoSegX_4__100->SetBinContent(15,0.02165318);
   TracktoSegX_4__100->SetBinContent(16,0.02165318);
   TracktoSegX_4__100->SetBinContent(17,0.02754613);
   TracktoSegX_4__100->SetBinContent(18,0.02384591);
   TracktoSegX_4__100->SetBinContent(19,0.02686091);
   TracktoSegX_4__100->SetBinContent(20,0.02466818);
   TracktoSegX_4__100->SetBinContent(21,0.02439409);
   TracktoSegX_4__100->SetBinContent(22,0.02740909);
   TracktoSegX_4__100->SetBinContent(23,0.03124636);
   TracktoSegX_4__100->SetBinContent(24,0.02823136);
   TracktoSegX_4__100->SetBinContent(25,0.03124636);
   TracktoSegX_4__100->SetBinContent(26,0.02576454);
   TracktoSegX_4__100->SetBinContent(27,0.02987591);
   TracktoSegX_4__100->SetBinContent(28,0.02891659);
   TracktoSegX_4__100->SetBinContent(29,0.03645409);
   TracktoSegX_4__100->SetBinContent(30,0.03823568);
   TracktoSegX_4__100->SetBinContent(31,0.03371318);
   TracktoSegX_4__100->SetBinContent(32,0.03563181);
   TracktoSegX_4__100->SetBinContent(33,0.03672818);
   TracktoSegX_4__100->SetBinContent(34,0.03960613);
   TracktoSegX_4__100->SetBinContent(35,0.04714363);
   TracktoSegX_4__100->SetBinContent(36,0.05125499);
   TracktoSegX_4__100->SetBinContent(37,0.05344772);
   TracktoSegX_4__100->SetBinContent(38,0.06071113);
   TracktoSegX_4__100->SetBinContent(39,0.0766084);
   TracktoSegX_4__100->SetBinContent(40,0.07647135);
   TracktoSegX_4__100->SetBinContent(41,0.1047027);
   TracktoSegX_4__100->SetBinContent(42,0.1488313);
   TracktoSegX_4__100->SetBinContent(43,0.208035);
   TracktoSegX_4__100->SetBinContent(44,0.3062966);
   TracktoSegX_4__100->SetBinContent(45,0.494597);
   TracktoSegX_4__100->SetBinContent(46,0.8903842);
   TracktoSegX_4__100->SetBinContent(47,1.721017);
   TracktoSegX_4__100->SetBinContent(48,3.799996);
   TracktoSegX_4__100->SetBinContent(49,10.21386);
   TracktoSegX_4__100->SetBinContent(50,31.05148);
   TracktoSegX_4__100->SetBinContent(51,30.66679);
   TracktoSegX_4__100->SetBinContent(52,10.2155);
   TracktoSegX_4__100->SetBinContent(53,3.816167);
   TracktoSegX_4__100->SetBinContent(54,1.748974);
   TracktoSegX_4__100->SetBinContent(55,0.919986);
   TracktoSegX_4__100->SetBinContent(56,0.4989824);
   TracktoSegX_4__100->SetBinContent(57,0.2987591);
   TracktoSegX_4__100->SetBinContent(58,0.1892597);
   TracktoSegX_4__100->SetBinContent(59,0.1403345);
   TracktoSegX_4__100->SetBinContent(60,0.1081289);
   TracktoSegX_4__100->SetBinContent(61,0.08688681);
   TracktoSegX_4__100->SetBinContent(62,0.07277113);
   TracktoSegX_4__100->SetBinContent(63,0.05892954);
   TracktoSegX_4__100->SetBinContent(64,0.05317363);
   TracktoSegX_4__100->SetBinContent(65,0.04426568);
   TracktoSegX_4__100->SetBinContent(66,0.04399159);
   TracktoSegX_4__100->SetBinContent(67,0.03686522);
   TracktoSegX_4__100->SetBinContent(68,0.04056545);
   TracktoSegX_4__100->SetBinContent(69,0.03357613);
   TracktoSegX_4__100->SetBinContent(70,0.0316575);
   TracktoSegX_4__100->SetBinContent(71,0.02946477);
   TracktoSegX_4__100->SetBinContent(72,0.03398727);
   TracktoSegX_4__100->SetBinContent(73,0.02631272);
   TracktoSegX_4__100->SetBinContent(74,0.0328909);
   TracktoSegX_4__100->SetBinContent(75,0.02631272);
   TracktoSegX_4__100->SetBinContent(76,0.0328909);
   TracktoSegX_4__100->SetBinContent(77,0.02768318);
   TracktoSegX_4__100->SetBinContent(78,0.02631272);
   TracktoSegX_4__100->SetBinContent(79,0.02466818);
   TracktoSegX_4__100->SetBinContent(80,0.02220136);
   TracktoSegX_4__100->SetBinContent(81,0.02398295);
   TracktoSegX_4__100->SetBinContent(82,0.02658681);
   TracktoSegX_4__100->SetBinContent(83,0.02521636);
   TracktoSegX_4__100->SetBinContent(84,0.02247545);
   TracktoSegX_4__100->SetBinContent(85,0.02494227);
   TracktoSegX_4__100->SetBinContent(86,0.02165318);
   TracktoSegX_4__100->SetBinContent(87,0.02192727);
   TracktoSegX_4__100->SetBinContent(88,0.01726773);
   TracktoSegX_4__100->SetBinContent(89,0.02494227);
   TracktoSegX_4__100->SetBinContent(90,0.02192727);
   TracktoSegX_4__100->SetBinContent(91,0.01987159);
   TracktoSegX_4__100->SetBinContent(92,0.01987159);
   TracktoSegX_4__100->SetBinContent(93,0.02028272);
   TracktoSegX_4__100->SetBinContent(94,0.01630841);
   TracktoSegX_4__100->SetBinContent(95,0.02192727);
   TracktoSegX_4__100->SetBinContent(96,0.01480091);
   TracktoSegX_4__100->SetBinContent(97,0.01863818);
   TracktoSegX_4__100->SetBinContent(98,0.02165318);
   TracktoSegX_4__100->SetBinContent(99,0.01534909);
   TracktoSegX_4__100->SetBinContent(100,0.01603432);
   TracktoSegX_4__100->SetBinContent(101,0.4718474);
   TracktoSegX_4__100->SetEntries(2242103);
   TracktoSegX_4__100->SetStats(0);

   ci = TColor::GetColor("#ff0000");
   TracktoSegX_4__100->SetLineColor(ci);

   ci = TColor::GetColor("#ff0000");
   TracktoSegX_4__100->SetMarkerColor(ci);
   TracktoSegX_4__100->GetXaxis()->SetTitle("cm");
   TracktoSegX_4__100->GetYaxis()->SetTitle("scaled number of entries");
   TracktoSegX_4__100->Draw("H,same");
   
   leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("TracktoSegX_1","ME11A: mean:-0.0cm;RMS:4.5cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_2","ME11B: mean:0.0cm;RMS:4.7cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_3","ME12+13: mean:-0.0cm;RMS:3.5cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_4","ME2: mean:-0.0cm;RMS:3.8cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_5","ME3: mean:0.0cm;RMS:2.8cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_6","ME4: mean:-0.0cm;RMS:2.4cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TH1D *TracktoSegX_5__101 = new TH1D("TracktoSegX_5__101","TracktoSegX",100,-40,40);
   TracktoSegX_5__101->SetBinContent(0,158.14);
   TracktoSegX_5__101->SetBinContent(1,0.008312923);
   TracktoSegX_5__101->SetBinContent(2,0.008312923);
   TracktoSegX_5__101->SetBinContent(3,0.007081379);
   TracktoSegX_5__101->SetBinContent(4,0.008005037);
   TracktoSegX_5__101->SetBinContent(5,0.01016024);
   TracktoSegX_5__101->SetBinContent(6,0.007697151);
   TracktoSegX_5__101->SetBinContent(7,0.01046813);
   TracktoSegX_5__101->SetBinContent(8,0.008928695);
   TracktoSegX_5__101->SetBinContent(9,0.008312923);
   TracktoSegX_5__101->SetBinContent(10,0.008928695);
   TracktoSegX_5__101->SetBinContent(11,0.009544467);
   TracktoSegX_5__101->SetBinContent(12,0.005541949);
   TracktoSegX_5__101->SetBinContent(13,0.009852353);
   TracktoSegX_5__101->SetBinContent(14,0.009544467);
   TracktoSegX_5__101->SetBinContent(15,0.007851094);
   TracktoSegX_5__101->SetBinContent(16,0.009236581);
   TracktoSegX_5__101->SetBinContent(17,0.007081379);
   TracktoSegX_5__101->SetBinContent(18,0.01077601);
   TracktoSegX_5__101->SetBinContent(19,0.008620809);
   TracktoSegX_5__101->SetBinContent(20,0.0100063);
   TracktoSegX_5__101->SetBinContent(21,0.01139178);
   TracktoSegX_5__101->SetBinContent(22,0.009852353);
   TracktoSegX_5__101->SetBinContent(23,0.01570219);
   TracktoSegX_5__101->SetBinContent(24,0.0110839);
   TracktoSegX_5__101->SetBinContent(25,0.01462459);
   TracktoSegX_5__101->SetBinContent(26,0.01570219);
   TracktoSegX_5__101->SetBinContent(27,0.009852353);
   TracktoSegX_5__101->SetBinContent(28,0.0175495);
   TracktoSegX_5__101->SetBinContent(29,0.01385487);
   TracktoSegX_5__101->SetBinContent(30,0.01447064);
   TracktoSegX_5__101->SetBinContent(31,0.01693373);
   TracktoSegX_5__101->SetBinContent(32,0.01601007);
   TracktoSegX_5__101->SetBinContent(33,0.0175495);
   TracktoSegX_5__101->SetBinContent(34,0.02678609);
   TracktoSegX_5__101->SetBinContent(35,0.02463088);
   TracktoSegX_5__101->SetBinContent(36,0.02555454);
   TracktoSegX_5__101->SetBinContent(37,0.03032677);
   TracktoSegX_5__101->SetBinContent(38,0.04064096);
   TracktoSegX_5__101->SetBinContent(39,0.05603526);
   TracktoSegX_5__101->SetBinContent(40,0.05896018);
   TracktoSegX_5__101->SetBinContent(41,0.08959484);
   TracktoSegX_5__101->SetBinContent(42,0.1319292);
   TracktoSegX_5__101->SetBinContent(43,0.1904275);
   TracktoSegX_5__101->SetBinContent(44,0.3146595);
   TracktoSegX_5__101->SetBinContent(45,0.5404939);
   TracktoSegX_5__101->SetBinContent(46,1.014023);
   TracktoSegX_5__101->SetBinContent(47,2.059758);
   TracktoSegX_5__101->SetBinContent(48,4.638611);
   TracktoSegX_5__101->SetBinContent(49,11.94228);
   TracktoSegX_5__101->SetBinContent(50,28.39679);
   TracktoSegX_5__101->SetBinContent(51,28.52657);
   TracktoSegX_5__101->SetBinContent(52,11.97584);
   TracktoSegX_5__101->SetBinContent(53,4.541473);
   TracktoSegX_5__101->SetBinContent(54,2.031432);
   TracktoSegX_5__101->SetBinContent(55,1.039731);
   TracktoSegX_5__101->SetBinContent(56,0.5401861);
   TracktoSegX_5__101->SetBinContent(57,0.3011125);
   TracktoSegX_5__101->SetBinContent(58,0.1990483);
   TracktoSegX_5__101->SetBinContent(59,0.1333147);
   TracktoSegX_5__101->SetBinContent(60,0.1006787);
   TracktoSegX_5__101->SetBinContent(61,0.07173745);
   TracktoSegX_5__101->SetBinContent(62,0.04926177);
   TracktoSegX_5__101->SetBinContent(63,0.05003148);
   TracktoSegX_5__101->SetBinContent(64,0.03355958);
   TracktoSegX_5__101->SetBinContent(65,0.03263592);
   TracktoSegX_5__101->SetBinContent(66,0.02309145);
   TracktoSegX_5__101->SetBinContent(67,0.02463088);
   TracktoSegX_5__101->SetBinContent(68,0.024323);
   TracktoSegX_5__101->SetBinContent(69,0.01200756);
   TracktoSegX_5__101->SetBinContent(70,0.01785739);
   TracktoSegX_5__101->SetBinContent(71,0.01724162);
   TracktoSegX_5__101->SetBinContent(72,0.01631796);
   TracktoSegX_5__101->SetBinContent(73,0.01370093);
   TracktoSegX_5__101->SetBinContent(74,0.01570219);
   TracktoSegX_5__101->SetBinContent(75,0.01293121);
   TracktoSegX_5__101->SetBinContent(76,0.01570219);
   TracktoSegX_5__101->SetBinContent(77,0.01200756);
   TracktoSegX_5__101->SetBinContent(78,0.01354699);
   TracktoSegX_5__101->SetBinContent(79,0.008620809);
   TracktoSegX_5__101->SetBinContent(80,0.01231544);
   TracktoSegX_5__101->SetBinContent(81,0.01169967);
   TracktoSegX_5__101->SetBinContent(82,0.01077601);
   TracktoSegX_5__101->SetBinContent(83,0.01062207);
   TracktoSegX_5__101->SetBinContent(84,0.01477853);
   TracktoSegX_5__101->SetBinContent(85,0.009544467);
   TracktoSegX_5__101->SetBinContent(86,0.009544467);
   TracktoSegX_5__101->SetBinContent(87,0.009544467);
   TracktoSegX_5__101->SetBinContent(88,0.01139178);
   TracktoSegX_5__101->SetBinContent(89,0.01016024);
   TracktoSegX_5__101->SetBinContent(90,0.008312923);
   TracktoSegX_5__101->SetBinContent(91,0.01200756);
   TracktoSegX_5__101->SetBinContent(92,0.01231544);
   TracktoSegX_5__101->SetBinContent(93,0.008620809);
   TracktoSegX_5__101->SetBinContent(94,0.008928695);
   TracktoSegX_5__101->SetBinContent(95,0.006465607);
   TracktoSegX_5__101->SetBinContent(96,0.008774752);
   TracktoSegX_5__101->SetBinContent(97,0.006773493);
   TracktoSegX_5__101->SetBinContent(98,0.007081379);
   TracktoSegX_5__101->SetBinContent(99,0.007389265);
   TracktoSegX_5__101->SetBinContent(100,0.008312923);
   TracktoSegX_5__101->SetBinContent(101,0.1988944);
   TracktoSegX_5__101->SetEntries(1678146);
   TracktoSegX_5__101->SetStats(0);

   ci = TColor::GetColor("#00ff00");
   TracktoSegX_5__101->SetLineColor(ci);

   ci = TColor::GetColor("#00ff00");
   TracktoSegX_5__101->SetMarkerColor(ci);
   TracktoSegX_5__101->GetXaxis()->SetTitle("cm");
   TracktoSegX_5__101->GetYaxis()->SetTitle("scaled number of entries");
   TracktoSegX_5__101->Draw("H,same");
   
   leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("TracktoSegX_1","ME11A: mean:-0.0cm;RMS:4.5cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_2","ME11B: mean:0.0cm;RMS:4.7cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_3","ME12+13: mean:-0.0cm;RMS:3.5cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_4","ME2: mean:-0.0cm;RMS:3.8cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_5","ME3: mean:0.0cm;RMS:2.8cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_6","ME4: mean:-0.0cm;RMS:2.4cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TH1D *TracktoSegX_6__102 = new TH1D("TracktoSegX_6__102","TracktoSegX",100,-40,40);
   TracktoSegX_6__102->SetBinContent(0,132.0754);
   TracktoSegX_6__102->SetBinContent(1,0.002446693);
   TracktoSegX_6__102->SetBinContent(2,0.003844803);
   TracktoSegX_6__102->SetBinContent(3,0.006291495);
   TracktoSegX_6__102->SetBinContent(4,0.006291495);
   TracktoSegX_6__102->SetBinContent(5,0.00559244);
   TracktoSegX_6__102->SetBinContent(6,0.006291495);
   TracktoSegX_6__102->SetBinContent(7,0.006990551);
   TracktoSegX_6__102->SetBinContent(8,0.00279622);
   TracktoSegX_6__102->SetBinContent(9,0.00559244);
   TracktoSegX_6__102->SetBinContent(10,0.003844803);
   TracktoSegX_6__102->SetBinContent(11,0.007340078);
   TracktoSegX_6__102->SetBinContent(12,0.007165314);
   TracktoSegX_6__102->SetBinContent(13,0.005242913);
   TracktoSegX_6__102->SetBinContent(14,0.00419433);
   TracktoSegX_6__102->SetBinContent(15,0.00559244);
   TracktoSegX_6__102->SetBinContent(16,0.006641023);
   TracktoSegX_6__102->SetBinContent(17,0.004543858);
   TracktoSegX_6__102->SetBinContent(18,0.004543858);
   TracktoSegX_6__102->SetBinContent(19,0.006291495);
   TracktoSegX_6__102->SetBinContent(20,0.008388661);
   TracktoSegX_6__102->SetBinContent(21,0.006291495);
   TracktoSegX_6__102->SetBinContent(22,0.008388661);
   TracktoSegX_6__102->SetBinContent(23,0.01048583);
   TracktoSegX_6__102->SetBinContent(24,0.007340078);
   TracktoSegX_6__102->SetBinContent(25,0.009437243);
   TracktoSegX_6__102->SetBinContent(26,0.01258299);
   TracktoSegX_6__102->SetBinContent(27,0.009087716);
   TracktoSegX_6__102->SetBinContent(28,0.009087716);
   TracktoSegX_6__102->SetBinContent(29,0.008039133);
   TracktoSegX_6__102->SetBinContent(30,0.01083535);
   TracktoSegX_6__102->SetBinContent(31,0.01258299);
   TracktoSegX_6__102->SetBinContent(32,0.01747638);
   TracktoSegX_6__102->SetBinContent(33,0.01957354);
   TracktoSegX_6__102->SetBinContent(34,0.01642779);
   TracktoSegX_6__102->SetBinContent(35,0.01747638);
   TracktoSegX_6__102->SetBinContent(36,0.01992307);
   TracktoSegX_6__102->SetBinContent(37,0.02901078);
   TracktoSegX_6__102->SetBinContent(38,0.03250606);
   TracktoSegX_6__102->SetBinContent(39,0.03827326);
   TracktoSegX_6__102->SetBinContent(40,0.05959444);
   TracktoSegX_6__102->SetBinContent(41,0.08685759);
   TracktoSegX_6__102->SetBinContent(42,0.1153441);
   TracktoSegX_6__102->SetBinContent(43,0.2154837);
   TracktoSegX_6__102->SetBinContent(44,0.3350221);
   TracktoSegX_6__102->SetBinContent(45,0.6326448);
   TracktoSegX_6__102->SetBinContent(46,1.145402);
   TracktoSegX_6__102->SetBinContent(47,2.402652);
   TracktoSegX_6__102->SetBinContent(48,5.45228);
   TracktoSegX_6__102->SetBinContent(49,12.95646);
   TracktoSegX_6__102->SetBinContent(50,26.20111);
   TracktoSegX_6__102->SetBinContent(51,26.48021);
   TracktoSegX_6__102->SetBinContent(52,12.97551);
   TracktoSegX_6__102->SetBinContent(53,5.350393);
   TracktoSegX_6__102->SetBinContent(54,2.323659);
   TracktoSegX_6__102->SetBinContent(55,1.102585);
   TracktoSegX_6__102->SetBinContent(56,0.5847596);
   TracktoSegX_6__102->SetBinContent(57,0.3282063);
   TracktoSegX_6__102->SetBinContent(58,0.1943373);
   TracktoSegX_6__102->SetBinContent(59,0.1286261);
   TracktoSegX_6__102->SetBinContent(60,0.08458566);
   TracktoSegX_6__102->SetBinContent(61,0.0622159);
   TracktoSegX_6__102->SetBinContent(62,0.03844803);
   TracktoSegX_6__102->SetBinContent(63,0.03495275);
   TracktoSegX_6__102->SetBinContent(64,0.02184547);
   TracktoSegX_6__102->SetBinContent(65,0.02306882);
   TracktoSegX_6__102->SetBinContent(66,0.01642779);
   TracktoSegX_6__102->SetBinContent(67,0.01433063);
   TracktoSegX_6__102->SetBinContent(68,0.0178259);
   TracktoSegX_6__102->SetBinContent(69,0.01817543);
   TracktoSegX_6__102->SetBinContent(70,0.01188394);
   TracktoSegX_6__102->SetBinContent(71,0.01048583);
   TracktoSegX_6__102->SetBinContent(72,0.0101363);
   TracktoSegX_6__102->SetBinContent(73,0.01083535);
   TracktoSegX_6__102->SetBinContent(74,0.01083535);
   TracktoSegX_6__102->SetBinContent(75,0.008039133);
   TracktoSegX_6__102->SetBinContent(76,0.006116732);
   TracktoSegX_6__102->SetBinContent(77,0.0101363);
   TracktoSegX_6__102->SetBinContent(78,0.008039133);
   TracktoSegX_6__102->SetBinContent(79,0.006641023);
   TracktoSegX_6__102->SetBinContent(80,0.00559244);
   TracktoSegX_6__102->SetBinContent(81,0.00559244);
   TracktoSegX_6__102->SetBinContent(82,0.006291495);
   TracktoSegX_6__102->SetBinContent(83,0.006291495);
   TracktoSegX_6__102->SetBinContent(84,0.004893385);
   TracktoSegX_6__102->SetBinContent(85,0.003145748);
   TracktoSegX_6__102->SetBinContent(86,0.00419433);
   TracktoSegX_6__102->SetBinContent(87,0.005242913);
   TracktoSegX_6__102->SetBinContent(88,0.005242913);
   TracktoSegX_6__102->SetBinContent(89,0.004543858);
   TracktoSegX_6__102->SetBinContent(90,0.00559244);
   TracktoSegX_6__102->SetBinContent(91,0.004543858);
   TracktoSegX_6__102->SetBinContent(92,0.003495275);
   TracktoSegX_6__102->SetBinContent(93,0.006466259);
   TracktoSegX_6__102->SetBinContent(94,0.002446693);
   TracktoSegX_6__102->SetBinContent(95,0.002446693);
   TracktoSegX_6__102->SetBinContent(96,0.00559244);
   TracktoSegX_6__102->SetBinContent(97,0.00419433);
   TracktoSegX_6__102->SetBinContent(98,0.00419433);
   TracktoSegX_6__102->SetBinContent(99,0.003495275);
   TracktoSegX_6__102->SetBinContent(100,0.00559244);
   TracktoSegX_6__102->SetBinContent(101,0.09804247);
   TracktoSegX_6__102->SetEntries(1328499);
   TracktoSegX_6__102->SetStats(0);

   ci = TColor::GetColor("#0000ff");
   TracktoSegX_6__102->SetLineColor(ci);

   ci = TColor::GetColor("#0000ff");
   TracktoSegX_6__102->SetMarkerColor(ci);
   TracktoSegX_6__102->GetXaxis()->SetTitle("cm");
   TracktoSegX_6__102->GetYaxis()->SetTitle("scaled number of entries");
   TracktoSegX_6__102->Draw("H,same");
   
   leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("TracktoSegX_1","ME11A: mean:-0.0cm;RMS:4.5cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_2","ME11B: mean:0.0cm;RMS:4.7cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_3","ME12+13: mean:-0.0cm;RMS:3.5cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_4","ME2: mean:-0.0cm;RMS:3.8cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_5","ME3: mean:0.0cm;RMS:2.8cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoSegX_6","ME4: mean:-0.0cm;RMS:2.4cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TPaveText *pt = new TPaveText(0.01,0.9390678,0.3021774,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(1);
   pt->SetFillColor(0);
   TText *AText = pt->AddText("TracktoSegX");
   pt->Draw();
   TracktoSegX->Modified();
   TracktoSegX->cd();
   TracktoSegX->SetSelected(TracktoSegX);
}
Ejemplo n.º 22
0
void plot2D(string type = "HPS",  float WP = 0.3){

  
  TCanvas *c1 = new TCanvas("c1","Canvas",10,30,650,600);
  c1->SetGrid(0,0);
  c1->SetFillStyle(4000);
  c1->SetFillColor(10);
  c1->SetTicky();
  c1->SetObjectStat(0);

  TLegend* leg = new TLegend(0.4,0.6,0.89,0.89,NULL,"brNDC");
  leg->SetFillStyle(4000);
  leg->SetBorderSize(0);
  //leg->SetFillColor(10);
  leg->SetTextSize(0.03);

  TFile* f_Zee     = new TFile("../testNewWriteFromPAT_Zee.root");
  TFile* f_Ztautau = new TFile("../testNewWriteFromPAT_Ztautau.root");

  f_Zee->cd();
  TTree* tree_Zee     = (TTree*) gDirectory->Get("etoTauMargLoose90/fitter_tree"); 
  f_Ztautau->cd();
  TTree* tree_Ztautau = (TTree*) gDirectory->Get("tauFakeRateAnalyzerHPS/tree"); 

  TH2F* h2 = new TH2F("h2","",220,0,1.1,220,0,1.1);
  h2->SetAxisRange(0.16,0.30,"X");
  h2->SetAxisRange(0.99,1.00,"Y");

  float ZeeAll     = (float)tree_Zee->GetEntries("mcTrue");
  float ZtautauAll = (float)tree_Ztautau->GetEntries("");


  float vxF1D[45];
  float vyF1D[45];

  float vxF2D_HoP[61];
  float vyF2D_HoP[61];
  float vxF2D_EoP[61];
  float vyF2D_EoP[61];
  float vxF2D_HoPEoP[961];
  float vyF2D_HoPEoP[961];
  float vxF2D_EMF[61];
  float vyF2D_EMF[61];
  
  std::cout << "MVA" << std::endl;
  for(int i = 0; i<=44; i++){
    float cut = 0.025*i;
    float ZeeCut = (float) tree_Zee->GetEntries(Form("electronPreIDOutput<=%f &&  mcTrue",-0.1+cut));
    float ZtautauCut = (float) tree_Ztautau->GetEntries(Form("leadPFChargedHadrMva<=%f",-0.1+cut));
    vxF1D[i]=ZeeCut/ZeeAll;
    vyF1D[i]=ZtautauCut/ZtautauAll;
  }

  std::cout << "HoP" << std::endl;
  // HoP WP = -0.1
  for(int i = 0; i<=60; i++){
    float cut = 0.02*i;
    float ZeeCut = (float) tree_Zee->GetEntries(Form("(electronPreIDOutput<=%f || (electronPreIDOutput>%f && hcalEnergy/leadPFChargedHadrCandTrackP>=%f) )  && mcTrue",WP, WP, cut));
    float ZtautauCut = (float) tree_Ztautau->GetEntries(Form("leadPFChargedHadrMva<=%f || (leadPFChargedHadrMva>%f && leadPFChargedHadrHcalEnergy/leadPFChargedHadrTrackP>=%f)",WP, WP,cut));
    vxF2D_HoP[i]=ZeeCut/ZeeAll;
    vyF2D_HoP[i]=ZtautauCut/ZtautauAll;
  }
  std::cout << "EoP" << std::endl;
  // EoP WP = -0.1
  for(int i = 0; i<=60; i++){
    float cut = 0.02*i;
    float ZeeCut = (float) tree_Zee->GetEntries(Form("(electronPreIDOutput<=%f || (electronPreIDOutput>%f && ecalEnergy/leadPFChargedHadrCandTrackP<=%f) )  && mcTrue",WP, WP, cut));
    float ZtautauCut = (float) tree_Ztautau->GetEntries(Form("leadPFChargedHadrMva<=%f || (leadPFChargedHadrMva>%f && leadPFChargedHadrEcalEnergy/leadPFChargedHadrTrackP<=%f)",WP, WP,cut));
    vxF2D_EoP[i]=ZeeCut/ZeeAll;
    vyF2D_EoP[i]=ZtautauCut/ZtautauAll;
  }
  std::cout << "HoPEoP" << std::endl;
  // HoPEoP WP = -0.1
  for(int i = 0; i<=30; i++){
    float cuti = 0.04*i;
    for(int j = 0; j<=30; j++){
      float cutj = 0.04*j;
      float ZeeCut = (float) tree_Zee->GetEntries(Form("(electronPreIDOutput<=%f || (electronPreIDOutput>%f && (hcalEnergy/leadPFChargedHadrCandTrackP>=%f || ecalEnergy/leadPFChargedHadrCandTrackP<=%f)) )  && mcTrue",WP, WP, cuti, cutj));
      float ZtautauCut = (float) tree_Ztautau->GetEntries(Form("leadPFChargedHadrMva<=%f || (leadPFChargedHadrMva>%f && (leadPFChargedHadrHcalEnergy/leadPFChargedHadrTrackP>=%f || leadPFChargedHadrEcalEnergy/leadPFChargedHadrTrackP<=%f))",WP, WP,cuti,cutj));
      vxF2D_HoPEoP[i*31+j]=ZeeCut/ZeeAll;
      vyF2D_HoPEoP[i*31+j]=ZtautauCut/ZtautauAll;
    }
  }
  std::cout << "EMF" << std::endl;
  // EMF WP = -0.1
  for(int i = 0; i<=60; i++){
    float cut = 0.02*i;
    float ZeeCut = (float) tree_Zee->GetEntries(Form("(electronPreIDOutput<=%f || (electronPreIDOutput>%f && hcalEnergy/(ecalEnergy+hcalEnergy)>%f) )  && mcTrue",WP, WP, cut));
    float ZtautauCut = (float) tree_Ztautau->GetEntries(Form("leadPFChargedHadrMva<=%f || (leadPFChargedHadrMva>%f && leadPFChargedHadrHcalEnergy/(leadPFChargedHadrEcalEnergy+leadPFChargedHadrHcalEnergy)>=%f)",WP, WP,cut));
    vxF2D_EMF[i]=ZeeCut/ZeeAll;
    vyF2D_EMF[i]=ZtautauCut/ZtautauAll;
  }

  h2->SetMarkerStyle(20);
  h2->SetMarkerSize(1.0);
  h2->SetXTitle("electrons fake-rate");
  h2->SetYTitle("tau-jet efficiency");
  h2->Draw();

  TVectorF vx1D(45,vxF1D);
  TVectorF vy1D(45,vyF1D);
  TGraph* graph1D = new TGraph(vx1D,vy1D);

  TVectorF vx2D_EoP(61,vxF2D_EoP);
  TVectorF vy2D_EoP(61,vyF2D_EoP);
  TGraph* graph2D_EoP = new TGraph(vx2D_EoP,vy2D_EoP);
  TVectorF vx2D_HoP(61,vxF2D_HoP);
  TVectorF vy2D_HoP(61,vyF2D_HoP);
  TGraph* graph2D_HoP = new TGraph(vx2D_HoP,vy2D_HoP);
  TVectorF vx2D_HoPEoP(961,vxF2D_HoPEoP);
  TVectorF vy2D_HoPEoP(961,vyF2D_HoPEoP);
  TGraph* graph2D_HoPEoP = new TGraph(vx2D_HoPEoP,vy2D_HoPEoP);
  TVectorF vx2D_EMF(61,vxF2D_EMF);
  TVectorF vy2D_EMF(61,vyF2D_EMF);
  TGraph* graph2D_EMF = new TGraph(vx2D_EMF,vy2D_EMF);

  graph1D->SetMarkerStyle(21);
  graph1D->SetMarkerSize(1.0);
  graph1D->SetMarkerColor(kBlue);
  graph1D->Draw("P");

  graph2D_EoP->SetMarkerStyle(kFullCircle);
  graph2D_EoP->SetMarkerSize(1.0);
  graph2D_EoP->SetMarkerColor(kGreen);
  graph2D_EoP->Draw("P");
  graph2D_HoP->SetMarkerStyle(kFullSquare);
  graph2D_HoP->SetMarkerSize(1.0);
  graph2D_HoP->SetMarkerColor(kRed);
  graph2D_HoP->Draw("P");
  graph2D_HoPEoP->SetMarkerStyle(kFullTriangleUp);
  graph2D_HoPEoP->SetMarkerSize(1.0);
  graph2D_HoPEoP->SetMarkerColor(5);
  graph2D_HoPEoP->Draw("P");
  graph2D_EMF->SetMarkerStyle(kOpenCircle);
  graph2D_EMF->SetMarkerSize(1.0);
  graph2D_EMF->SetMarkerColor(kBlack);
  graph2D_EMF->Draw("P");

  leg->SetHeader((type+" passing tau-ID and loose iso").c_str());
  leg->AddEntry(graph1D,"(#epsilon_{e},#epsilon_{#tau}) for mva<X, -0.1<X<1.0","P");
  leg->AddEntry(graph2D_HoP,Form("(#epsilon_{e},#epsilon_{#tau}) for mva<%.2f || (mva>%.2f && H/p>X), 0<X<1.2",WP,WP),"P");
  leg->AddEntry(graph2D_EoP,Form("(#epsilon_{e},#epsilon_{#tau}) for mva<%.2f || (mva>%.2f && E/p<X), 0<X<1.2 ",WP,WP),"P");
  leg->AddEntry(graph2D_HoPEoP,Form("(#epsilon_{e},#epsilon_{#tau}) for mva<%.2f || (mva>-%.2f && (H/p>X||E/p<Y)), 0<X,Y<1.2",WP,WP),"P");
  leg->AddEntry(graph2D_EMF,Form("(#epsilon_{e},#epsilon_{#tau}) for mva<%.2f || (mva>%.2f && H/(E+H)>X), 0<X<1.2 ",WP,WP),"P");
  leg->Draw();

}
Ejemplo n.º 23
0
void MakePlotFakeDistMC(){
  
  TString path_ttbar = "/home/jalmond/Analysis/LQanalyzer/data/output/ElectronFakes//MC/FakeRateCalculator_El_SKttbar_5_3_14.root";
  
  TString path_qcd= "/home/jalmond/Analysis/LQanalyzer/data/output/ElectronFakes/FakeRateCalculator_El_SKQCD_5_3_14.root";
  
  TString path_wjet = "/home/jalmond/Analysis/LQanalyzer/data/output/ElectronFakes/MC/FakeRateCalculator_El_SKWjets_5_3_14.root";

  

  setTDRStyle();
  gStyle->SetPalette(1);
  
  TFile * fttbar = new TFile(path_ttbar);
  TFile * fqcd = new TFile(path_qcd);
  TFile * fwjet = new TFile(path_wjet);
  
  vector<TString> list_of_regions;
  list_of_regions.push_back("SingleElFake");
  list_of_regions.push_back("DoubleElFake");
 
  
  vector<TString> list_of_names;
  list_of_names.push_back("HT");
  list_of_names.push_back("eemass");
  list_of_names.push_back("MET");
  list_of_names.push_back("Njets");
  list_of_names.push_back("Nbjets");
  list_of_names.push_back("leadElectrondPhi");
  list_of_names.push_back("ElectronRelIso");


  vector<TString> xaxis_label;
  xaxis_label.push_back("H_{T} GeV");
  xaxis_label.push_back("m(ee) GeV");
  xaxis_label.push_back("MET GeV");
  xaxis_label.push_back("N(jets)");
  xaxis_label.push_back("N(bjets)");
  xaxis_label.push_back("#Delta#phi (ee)");
  xaxis_label.push_back("Iso_{PF} / p_{T}")

  vector<TString> yaxis_label;
  yaxis_label.push_back("Entries");
  yaxis_label.push_back("Entries");
  yaxis_label.push_back("Entries");
  yaxis_label.push_back("Entries");
  yaxis_label.push_back("Entries");
  yaxis_label.push_back("Entries");
  yaxis_label.push_back("Entries");
  
 
  for(unsigned int j = 0; j < list_of_regions.size(); j++){
    for(unsigned int i = 0; i < list_of_names.size(); i++){
      
      
      TCanvas* c1 = new TCanvas((("Plot")+ list_of_regions.at(j )+ "/" + list_of_names.at(i)).Data(), "Plot", 1600, 1200);
      
      cout << "Getting " << ("h_"+list_of_regions.at(j ) + "/"+  list_of_names.at(i) + "_" + list_of_regions.at(j ) ) << endl;
      TH1F* h_ttbar= (TH1F*)fttbar->Get(((list_of_regions.at(j ) + "/h_"+  list_of_names.at(i) + "_" + list_of_regions.at(j ) ).Data()));
      
      
      TH1F* h_qcd= (TH1F*)fqcd->Get(((list_of_regions.at(j ) + "/h_"+  list_of_names.at(i) + "_" + list_of_regions.at(j ) ).Data()));

      
      TH1F* h_wjet= (TH1F*)fwjet->Get(((list_of_regions.at(j ) + "/h_"+  list_of_names.at(i) + "_" + list_of_regions.at(j ) ).Data()));


      cout << h_qcd << endl;
      bool usew = (h_wjet);
      bool usetop = (h_ttbar);
      bool useqcd = (h_qcd);
      
      if(h_qcd){
	h_qcd->SetLineColor(kRed);
	h_qcd->SetFillColor(kRed);
	h_qcd->SetLineWidth(2.);
	h_qcd->SetFillStyle(3003);
      }
      if(usetop){
	h_ttbar->SetLineColor(kCyan);
	h_ttbar->SetFillColor(kCyan);
	h_ttbar->SetLineWidth(2.);
	h_ttbar->SetFillStyle(3004);
      }
      if(usew){
	h_wjet->SetLineColor(kOrange);
	h_wjet->SetFillColor(kOrange);
	h_wjet->SetFillStyle(3007);
	h_wjet->SetLineWidth(2.);
      }
      int nrebin = 1;
      if(list_of_names.at(i).Contains("HT")) nrebin= 1;
      if(list_of_names.at(i).Contains("MET")) nrebin= 2;
      if(list_of_names.at(i).Contains("eemass")) nrebin= 4;
      if(useqcd)h_qcd->Rebin(nrebin);
      if(usetop){
	h_ttbar->Rebin(nrebin);
      }
      if(usew){
	h_wjet->Rebin(nrebin);
      }
      
      if(useqcd){
	h_qcd->GetYaxis()->SetTitle(yaxis_label.at(i));
	h_qcd->GetXaxis()->SetTitle(xaxis_label.at(i));
	
	h_qcd->GetYaxis()->SetRangeUser(0.,  h_qcd->GetMaximum()* 1.1);
	h_qcd->Draw("hist");
	if(usetop)h_ttbar->Draw("histsame");
	if(usew)h_wjet->Draw("histsame");

      }
      else{
	if(usetop){
	  h_ttbar->GetYaxis()->SetTitle(yaxis_label.at(i));
	  h_ttbar->GetXaxis()->SetTitle(xaxis_label.at(i));
	  
	  float max =  h_ttbar->GetMaximum()* 1.1;
	  if(h_wjet->GetMaximum()* 1.1   > max) max = h_wjet->GetMaximum()* 1.1 ;
	  h_ttbar->GetYaxis()->SetRangeUser(0.,  max);
	  h_ttbar->Draw("hist");
	  if(usew)h_wjet->Draw("histsame");

	}
      }

      TLegend* legendH = new TLegend(0.7, 0.75, 0.9, 0.9);
      legendH->SetFillColor(kWhite);
      legendH->SetTextSize(0.03);
      legendH->SetTextFont(42);
      if(useqcd)legendH->AddEntry(h_qcd, "QCD", "f");
      if(usetop)legendH->AddEntry(h_ttbar, "t#bar{t}", "f");
      if(usew)legendH->AddEntry(h_wjet, "W+jet", "f");
      legendH->Draw();
            
      CMS_lumi( c1, 2, 11 );
      c1->Update();
      c1->RedrawAxis();
      
      c1->SaveAs(("/home/jalmond/WebPlots/PreApproval/Fakes/MCFakeDist_all_" + list_of_regions.at(j ) + "_" + list_of_names.at(i) + ".pdf").Data());
    }
  }

}
Ejemplo n.º 24
0
void plotMVALeadVsMVAChargROC(){

  TCanvas *c1 = new TCanvas("c1","Canvas",10,30,650,600);
  c1->SetGrid(0,0);
  c1->SetFillStyle(4000);
  c1->SetFillColor(10);
  c1->SetTicky();
  c1->SetObjectStat(0);

  TLegend* leg = new TLegend(0.4,0.6,0.89,0.89,NULL,"brNDC");
  leg->SetFillStyle(4000);
  leg->SetBorderSize(0);
  //leg->SetFillColor(10);
  leg->SetTextSize(0.03);

  TFile* f_Zee     = new TFile("../testNewWriteFromPAT_Zee.root");
  TFile* f_Ztautau = new TFile("../testNewWriteFromPAT_Ztautau.root");

  f_Zee->cd();
  TTree* tree_Zee     = (TTree*) gDirectory->Get("etoTauSCMarg90/fitter_tree"); 
  f_Ztautau->cd();
  TTree* tree_Ztautau = (TTree*) gDirectory->Get("tauFakeRateAnalyzerSHC/tree"); 

  TH2F* h2 = new TH2F("h2","",220,0,1.1,220,0,1.1);

  float vxF_L[45];
  float vyF_L[45];
  float vxF_C[45];
  float vyF_C[45];

  float ZeeAll     = (float)tree_Zee->GetEntries("mcTrue");
  float ZtautauAll = (float)tree_Ztautau->GetEntries("");

  for(int i = 0; i<=44; i++){
    float cut = 0.025*i;
    float ZeeCut = (float) tree_Zee->GetEntries(Form("electronPreIDOutput<=%f &&  mcTrue",-0.1+cut));
    float ZtautauCut = (float) tree_Ztautau->GetEntries(Form("leadPFChargedHadrMva<=%f",-0.1+cut));
    vxF_C[i]=ZeeCut/ZeeAll;
    vyF_C[i]=ZtautauCut/ZtautauAll;
  }
  for(int i = 0; i<=44; i++){
    float cut = 0.025*i;
    float ZeeCut = (float) tree_Zee->GetEntries(Form("electronPreIDOutputLeadPFCand<=%f &&  mcTrue",-0.1+cut));
    float ZtautauCut = (float) tree_Ztautau->GetEntries(Form("leadPFCandMva<=%f",-0.1+cut));
    vxF_L[i]=ZeeCut/ZeeAll;
    vyF_L[i]=ZtautauCut/ZtautauAll;
  }

  h2->SetXTitle("electrons fake-rate");
  h2->SetYTitle("tau-jet efficiency");
  h2->SetAxisRange(0,1.0,"X");
  h2->SetAxisRange(0.95,1.02,"Y");
  h2->Draw();

  TVectorF vx_L(45,vxF_L);
  TVectorF vy_L(45,vyF_L);
  TGraph* graph_L = new TGraph(vx_L,vy_L);
  TVectorF vx_C(45,vxF_C);
  TVectorF vy_C(45,vyF_C);
  TGraph* graph_C = new TGraph(vx_C,vy_C);
  graph_C->SetMarkerStyle(kFullCircle);
  graph_C->SetMarkerSize(1.0);
  graph_C->SetMarkerColor(kRed);
  graph_C->Draw("P");
  graph_L->SetMarkerStyle(kFullSquare);
  graph_L->SetMarkerSize(1.0);
  graph_L->SetMarkerColor(kBlue);
  graph_L->Draw("P");

  leg->SetHeader("PF-Shrinking Cone passing tau-ID and loose iso");
  leg->AddEntry(graph_C,"discr by mva_e_pi of LeadChargHadr","P");
  leg->AddEntry(graph_L,"discr by mva_e_pi of LeadPFCand","P");
  leg->Draw();

}
Ejemplo n.º 25
0
void PlotKFactor() {

  TFile *EffFile = new TFile("JetVetoEfficiencySystematics.root", "UPDATE");

  TCanvas *cv = 0;
  cv = new TCanvas("cv","cv", 800,600);
  TLegend *tmpLegend = new TLegend(0.23,0.55,0.43,0.70);   
  tmpLegend->SetTextSize(0.03);
  tmpLegend->SetBorderSize(1);


  TH1D* PowhegKFactor160 = (TH1D*)EffFile->Get("kFactorHiggsPt_ggHww160_PowhegToNNLL");
  TH1D* MCAtNLOKFactor160 = (TH1D*)EffFile->Get("kFactorHiggsPt_ggHww160_MCAtNLOToNNLL");
  tmpLegend->Clear();
  tmpLegend->AddEntry(PowhegKFactor160, "Powheg", "LP");   
  tmpLegend->AddEntry(MCAtNLOKFactor160, "MC@NLO", "LP");   


  MCAtNLOKFactor160->SetLineColor(kBlack);
  MCAtNLOKFactor160->Draw("hist");
  MCAtNLOKFactor160->GetYaxis()->SetTitleOffset(1.2);
  MCAtNLOKFactor160->GetYaxis()->SetTitle("KFactor");
  MCAtNLOKFactor160->GetXaxis()->SetTitleOffset(1.05);
  MCAtNLOKFactor160->GetYaxis()->SetRangeUser(0.3,3.2);

  PowhegKFactor160->SetLineColor(kRed);
  PowhegKFactor160->Draw("hist,same");
  tmpLegend->Draw();
  cv->SaveAs("KFactorPowhegVsMCAtNLO.gif");




//   TH1D* KFactor160 = (TH1D*)EffFile->Get("kFactorHiggsPt_ggHww160_PowhegToNNLL");
//   TH1D* KFactor200 = (TH1D*)EffFile->Get("kFactorHiggsPt_ggHww200_PowhegToNNLL");
//   TH1D* KFactor250 = (TH1D*)EffFile->Get("kFactorHiggsPt_ggHww250_PowhegToNNLL");

//   TCanvas *cv = new TCanvas("cv","cv", 800,600);

//   TLegend *tmpLegend = new TLegend(0.73,0.55,0.93,0.70);   
//   tmpLegend->SetTextSize(0.03);
//   tmpLegend->SetBorderSize(1);
//   tmpLegend->AddEntry(KFactor160, "m_{H} = 160", "LP");   
//   tmpLegend->AddEntry(KFactor200, "m_{H} = 200", "LP");   
//   tmpLegend->AddEntry(KFactor250, "m_{H} = 250", "LP");   

//   KFactor160->SetLineColor(kBlack);
//   KFactor160->Draw("hist");
//   KFactor160->GetYaxis()->SetTitleOffset(1.2);
//   KFactor160->GetYaxis()->SetTitle("KFactor");
//   KFactor160->GetXaxis()->SetTitleOffset(1.05);
//   KFactor200->SetLineColor(kRed);
//   KFactor200->Draw("hist,same");
//   KFactor250->SetLineColor(kBlue);
//   KFactor250->Draw("hist,same");
//   tmpLegend->Draw();
//   cv->SaveAs("KFactorVsMass.gif");


 
}
Ejemplo n.º 26
0
void plotSHCvsHPS(const string pion_ = "ch"){

  TCanvas *c1 = new TCanvas("c1","Canvas",10,30,650,600);
  c1->SetGrid(0,0);
  c1->SetFillStyle(4000);
  c1->SetFillColor(10);
  c1->SetTicky();
  c1->SetObjectStat(0);
  c1->SetLogx(1);

  TLegend* leg = new TLegend(0.36,0.15,0.80,0.5,NULL,"brNDC");
  leg->SetFillStyle(4000);
  leg->SetBorderSize(0);
  leg->SetFillColor(0);
  leg->SetTextSize(0.03);

  TFile* f_Zee     = new TFile("/data_CMS/cms/lbianchini/35pb/testNewWriteFromPAT_DYToEE-PYTHIA-TAUEFF.root");
  TFile* f_Ztautau = new TFile("/data_CMS/cms/lbianchini/35pb/testNewWriteFromPAT_DYToTauTau-PYTHIA-TAUEFF.root");


  f_Zee->cd();
  TTree* tree_Zee_SHC     = (TTree*) gDirectory->Get("tauFakeRateAnalyzerSHC/tree"); 
  TTree* tree_Zee_HPS     = (TTree*) gDirectory->Get("tauFakeRateAnalyzerHPS/tree"); 
  f_Ztautau->cd();
  TTree* tree_Ztautau_SHC = (TTree*) gDirectory->Get("tauFakeRateAnalyzerSHC/tree"); 
  TTree* tree_Ztautau_HPS = (TTree*) gDirectory->Get("tauFakeRateAnalyzerHPS/tree"); 

  TH2F* h2 = new TH2F("h2","",220,0,1.1,220,0,1.1);

  float vxF_L[45];
  float vyF_L[45];
  float vxF_C[45];
  float vyF_C[45];

  float ZeeAll_SHC     = (float)tree_Zee_SHC->GetEntries("leadPFChargedHadrTrackPt>3");
  float ZtautauAll_SHC = (float)tree_Ztautau_SHC->GetEntries("leadPFChargedHadrTrackPt>3");
  float ZeeAll_HPS     = (float)tree_Zee_HPS->GetEntries("leadPFChargedHadrTrackPt>3");
  float ZtautauAll_HPS = (float)tree_Ztautau_HPS->GetEntries("leadPFChargedHadrTrackPt>3");

  string pion = pion_.find("ch")!=string::npos ? "leadPFChargedHadrMva" : "leadPFCandMva"; 

  for(int i = 0; i<=44; i++){
    float cut = 0.025*i;
    float ZeeCut = (float)     tree_Zee_SHC->GetEntries(Form("%s<=%f && leadPFChargedHadrTrackPt>3",pion.c_str(),-0.1+cut));
    float ZtautauCut = (float) tree_Ztautau_SHC->GetEntries(Form("%s<=%f  && leadPFChargedHadrTrackPt>3",pion.c_str(),-0.1+cut));
    vxF_C[i]=ZeeCut/ZeeAll_SHC;
    vyF_C[i]=ZtautauCut/ZtautauAll_SHC;
  }
  for(int i = 0; i<=44; i++){
    float cut = 0.025*i;
    float ZeeCut = (float) tree_Zee_HPS->GetEntries(Form("%s<=%f && leadPFChargedHadrTrackPt>3",pion.c_str(),-0.1+cut));
    float ZtautauCut = (float) tree_Ztautau_HPS->GetEntries(Form("%s<=%f && leadPFChargedHadrTrackPt>3",pion.c_str(),-0.1+cut));
    vxF_L[i]=ZeeCut/ZeeAll_HPS;
    vyF_L[i]=ZtautauCut/ZtautauAll_HPS;
  }

  h2->SetXTitle("e#rightarrow#tau_{had} fake-rate");
  h2->SetYTitle("#tau_{had} efficiency");
  h2->SetAxisRange(0.02,1.0,"X");
  h2->SetAxisRange(0.95,1.01,"Y");
  h2->Draw();

  TVectorF vx_L(45,vxF_L);
  TVectorF vy_L(45,vyF_L);
  TGraph* graph_L = new TGraph(vx_L,vy_L);
  TVectorF vx_C(45,vxF_C);
  TVectorF vy_C(45,vyF_C);
  TGraph* graph_C = new TGraph(vx_C,vy_C);
  graph_C->SetMarkerStyle(kOpenSquare);
  graph_C->SetMarkerSize(1.2);
  graph_C->SetMarkerColor(kBlue);
  graph_C->Draw("P");
  graph_L->SetMarkerStyle(kOpenCircle);
  graph_L->SetMarkerSize(1.2);
  graph_L->SetMarkerColor(kRed);
  graph_L->Draw("P");

  string xi = pion_.find("ch")!=string::npos ? "#xi^{lch}" : "#xi^{lh}" ;
  leg->SetHeader(("Simulation: discriminator by "+xi).c_str());
  leg->AddEntry(graph_L,"#splitline{HPS #tau_{had}-candidates}{passing tau-ID and loose isolation}","P");
  leg->AddEntry(graph_C,"#splitline{Shrinking Cone #tau_{had}-candidates}{passing tau-ID and loose isolation}","P");
  leg->Draw();

}
void makePlot(double canvasSizeX, double canvasSizeY,
	      TH1* histogramTTH, 
	      TH1* histogramData, 
	      TH1* histogramTT,
	      TH1* histogramTTV,
	      TH1* histogramEWK,
	      TH1* histogramRares,
	      TH1* histogramBgrSum,
	      TH1* histogramBgrUncertainty,		
	      const std::string& xAxisTitle, double xAxisOffset,
	      bool useLogScale, double yMin, double yMax, const std::string& yAxisTitle, double yAxisOffset,
	      const std::string& outputFileName)
{
  TH1* histogramTTH_density = 0;
  if ( histogramTTH ) {
    if ( histogramData ) checkCompatibleBinning(histogramTTH, histogramData);
    histogramTTH_density = divideHistogramByBinWidth(histogramTTH);
  }
  TH1* histogramData_density = 0;
  if ( histogramData ) {
    histogramData_density = divideHistogramByBinWidth(histogramData);      
  }
  TH1* histogramTT_density = 0;
  if ( histogramTT ) {
    if ( histogramData ) checkCompatibleBinning(histogramTT, histogramData);
    histogramTT_density = divideHistogramByBinWidth(histogramTT);
  } 
  TH1* histogramTTV_density = 0;
  if ( histogramTTV ) {
    if ( histogramData ) checkCompatibleBinning(histogramTTV, histogramData);
    histogramTTV_density = divideHistogramByBinWidth(histogramTTV);
  }    
  TH1* histogramEWK_density = 0;
  if ( histogramEWK ) {
    if ( histogramData ) checkCompatibleBinning(histogramEWK, histogramData);
    histogramEWK_density = divideHistogramByBinWidth(histogramEWK);
  }
  TH1* histogramRares_density = 0;
  if ( histogramRares ) {
    if ( histogramData ) checkCompatibleBinning(histogramRares, histogramData);
    histogramRares_density = divideHistogramByBinWidth(histogramRares);
  }    
  TH1* histogramBgrSum_density = 0;
  if ( histogramBgrSum ) {
    if ( histogramData ) checkCompatibleBinning(histogramBgrSum, histogramData);
    histogramBgrSum_density = divideHistogramByBinWidth(histogramBgrSum); 
  }
  TH1* histogramBgrUncertainty_density = 0;
  if ( histogramBgrUncertainty ) {
    if ( histogramData ) checkCompatibleBinning(histogramBgrUncertainty, histogramData);
    histogramBgrUncertainty_density = divideHistogramByBinWidth(histogramBgrUncertainty);
  }
  
  TCanvas* canvas = new TCanvas("canvas", "", canvasSizeX, canvasSizeY);
  canvas->SetFillColor(10);
  canvas->SetFillStyle(4000);
  canvas->SetFillColor(10);
  canvas->SetTicky();
  canvas->SetBorderSize(2);  
  canvas->SetLeftMargin(0.12);
  canvas->SetBottomMargin(0.12);
  
  TPad* topPad = new TPad("topPad", "topPad", 0.00, 0.35, 1.00, 1.00);
  topPad->SetFillColor(10);
  topPad->SetTopMargin(0.065);
  topPad->SetLeftMargin(0.15);
  topPad->SetBottomMargin(0.03);
  topPad->SetRightMargin(0.05);
  topPad->SetLogy(useLogScale);
  
  TPad* bottomPad = new TPad("bottomPad", "bottomPad", 0.00, 0.00, 1.00, 0.35);
  bottomPad->SetFillColor(10);
  bottomPad->SetTopMargin(0.02);
  bottomPad->SetLeftMargin(0.15);
  bottomPad->SetBottomMargin(0.31);
  bottomPad->SetRightMargin(0.05);
  bottomPad->SetLogy(false);
  
  canvas->cd();
  topPad->Draw();
  topPad->cd();
  
  TAxis* xAxis_top = histogramData_density->GetXaxis();
  xAxis_top->SetTitle(xAxisTitle.data());
  xAxis_top->SetTitleOffset(xAxisOffset);
  xAxis_top->SetLabelColor(10);
  xAxis_top->SetTitleColor(10);
    
  TAxis* yAxis_top = histogramData_density->GetYaxis();
  yAxis_top->SetTitle(yAxisTitle.data());
  yAxis_top->SetTitleOffset(yAxisOffset);
  yAxis_top->SetTitleSize(0.085);
  yAxis_top->SetLabelSize(0.05);
  yAxis_top->SetTickLength(0.04);  
  
  TLegend* legend = new TLegend(0.66, 0.45, 0.94, 0.92, NULL, "brNDC");
  legend->SetFillStyle(0);
  legend->SetBorderSize(0);
  legend->SetFillColor(10);
  legend->SetTextSize(0.055);
  
  histogramData_density->SetTitle("");
  histogramData_density->SetStats(false);
  histogramData_density->SetMaximum(yMax);
  histogramData_density->SetMinimum(yMin);
  histogramData_density->SetMarkerStyle(20);
  histogramData_density->SetMarkerSize(2);
  histogramData_density->SetMarkerColor(kBlack);
  histogramData_density->SetLineColor(kBlack);
  legend->AddEntry(histogramData_density, "Observed", "p");    
  
  histogramData_density->Draw("ep");
  
  legend->AddEntry(histogramTTH_density, "t#bar{t}H", "l");

  histogramTT_density->SetTitle("");
  histogramTT_density->SetStats(false);
  histogramTT_density->SetMaximum(yMax);
  histogramTT_density->SetMinimum(yMin);
  histogramTT_density->SetFillColor(kMagenta - 10); 
  legend->AddEntry(histogramTT_density, "t#bar{t}+jets", "f");

  histogramTTV_density->SetFillColor(kOrange - 4);
  legend->AddEntry(histogramTTV_density, "t#bar{t}+V", "f");

  histogramEWK_density->SetFillColor(kRed + 2); 
  legend->AddEntry(histogramEWK_density, "EWK", "f");

  histogramRares_density->SetFillColor(kBlue - 8); 
  legend->AddEntry(histogramRares_density, "Rares", "f");

  THStack* histogramStack_density = new THStack("stack", "");
  histogramStack_density->Add(histogramRares_density);
  histogramStack_density->Add(histogramEWK_density);
  histogramStack_density->Add(histogramTTV_density);
  histogramStack_density->Add(histogramTT_density);
  histogramStack_density->Draw("histsame");
  
  histogramBgrUncertainty_density->SetFillColor(kBlack);
  histogramBgrUncertainty_density->SetFillStyle(3344);    
  histogramBgrUncertainty_density->Draw("e2same");
  legend->AddEntry(histogramBgrUncertainty_density, "Uncertainty", "f");

  histogramTTH_density->SetLineWidth(2);
  histogramTTH_density->SetLineStyle(1);
  histogramTTH_density->SetLineColor(kBlue);
  histogramTTH_density->Draw("histsame");
  
  histogramData_density->Draw("epsame");
  histogramData_density->Draw("axissame");
  
  legend->Draw();
  
  addLabel_CMS_luminosity(0.2050, 0.9225, 0.6850);
  
  canvas->cd();
  bottomPad->Draw();
  bottomPad->cd();
  
  TH1* histogramRatio = (TH1*)histogramData->Clone("histogramRatio");
  histogramRatio->Reset();
  if ( !histogramRatio->GetSumw2N() ) histogramRatio->Sumw2();
  checkCompatibleBinning(histogramRatio, histogramBgrSum);
  histogramRatio->Divide(histogramData, histogramBgrSum);
  int numBins_bottom = histogramRatio->GetNbinsX();
  for ( int iBin = 1; iBin <= numBins_bottom; ++iBin ) {
    double binContent = histogramRatio->GetBinContent(iBin);
    if ( histogramData && histogramData->GetBinContent(iBin) >= 0. ) histogramRatio->SetBinContent(iBin, binContent - 1.0);
    else histogramRatio->SetBinContent(iBin, -10.);
  }
  histogramRatio->SetTitle("");
  histogramRatio->SetStats(false);
  histogramRatio->SetMinimum(-0.50);
  histogramRatio->SetMaximum(+0.50);
  histogramRatio->SetMarkerStyle(histogramData_density->GetMarkerStyle());
  histogramRatio->SetMarkerSize(histogramData_density->GetMarkerSize());
  histogramRatio->SetMarkerColor(histogramData_density->GetMarkerColor());
  histogramRatio->SetLineColor(histogramData_density->GetLineColor());
  histogramRatio->Draw("ep");
  
  TAxis* xAxis_bottom = histogramRatio->GetXaxis();
  xAxis_bottom->SetTitle(xAxis_top->GetTitle());
  xAxis_bottom->SetLabelColor(1);
  xAxis_bottom->SetTitleColor(1);
  xAxis_bottom->SetTitleOffset(1.20);
  xAxis_bottom->SetTitleSize(0.13);
  xAxis_bottom->SetLabelOffset(0.02);
  xAxis_bottom->SetLabelSize(0.10);
  xAxis_bottom->SetTickLength(0.055);
  
  TAxis* yAxis_bottom = histogramRatio->GetYaxis();
  yAxis_bottom->SetTitle("#frac{Data - Simulation}{Simulation}");
  yAxis_bottom->SetTitleOffset(0.80);
  yAxis_bottom->SetNdivisions(505);
  yAxis_bottom->CenterTitle();
  yAxis_bottom->SetTitleSize(0.09);
  yAxis_bottom->SetLabelSize(0.10);
  yAxis_bottom->SetTickLength(0.04);  
  
  TH1* histogramRatioUncertainty = (TH1*)histogramBgrUncertainty->Clone("histogramRatioUncertainty");
  if ( !histogramRatioUncertainty->GetSumw2N() ) histogramRatioUncertainty->Sumw2();
  checkCompatibleBinning(histogramRatioUncertainty, histogramBgrUncertainty);
  histogramRatioUncertainty->Divide(histogramBgrSum);
  int numBins = histogramRatioUncertainty->GetNbinsX();
  for ( int iBin = 1; iBin <= numBins; ++iBin ) {
    double binContent = histogramRatioUncertainty->GetBinContent(iBin);
    histogramRatioUncertainty->SetBinContent(iBin, binContent - 1.0);
  }
  histogramRatioUncertainty->SetFillColor(histogramBgrUncertainty_density->GetFillColor());
  //histogramRatioUncertainty->SetFillStyle(histogramBgrUncertainty_density->GetFillStyle());    
  histogramRatioUncertainty->SetFillStyle(3644);    
  
  TF1* line = new TF1("line","0", xAxis_bottom->GetXmin(), xAxis_bottom->GetXmax());
  line->SetLineStyle(3);
  line->SetLineWidth(1);
  line->SetLineColor(kBlack);
  line->Draw("same");
  
  histogramRatioUncertainty->Draw("e2same");
  
  histogramRatio->Draw("epsame");
  
  canvas->Update();
  size_t idx = outputFileName.find(".");
  std::string outputFileName_plot(outputFileName, 0, idx);
  if ( useLogScale ) outputFileName_plot.append("_log");
  else outputFileName_plot.append("_linear");
  if ( idx != std::string::npos ) canvas->Print(std::string(outputFileName_plot).append(std::string(outputFileName, idx)).data());
  canvas->Print(std::string(outputFileName_plot).append(".png").data());
  canvas->Print(std::string(outputFileName_plot).append(".pdf").data());
  canvas->Print(std::string(outputFileName_plot).append(".root").data());
  
  delete histogramTTH_density;
  delete histogramData_density;
  delete histogramTT_density;
  delete histogramTTV_density;
  delete histogramEWK_density;
  delete histogramRares_density;
  delete histogramBgrSum_density;
  //delete histogramBgrUncertainty_density;
  delete histogramStack_density;
  delete legend;
  delete topPad;
  delete histogramRatio;
  delete histogramRatioUncertainty;
  delete line;
  delete bottomPad;    
  delete canvas;
}
Ejemplo n.º 28
0
void plotDiffCuts(){

  TCanvas *c1 = new TCanvas("c1","Canvas",10,30,650,600);
  c1->SetGrid(0,0);
  c1->SetFillStyle(4000);
  c1->SetFillColor(10);
  c1->SetTicky();
  c1->SetObjectStat(0);

  TLegend* leg = new TLegend(0.4,0.6,0.89,0.89,NULL,"brNDC");
  leg->SetFillStyle(4000);
  leg->SetBorderSize(0);
  //leg->SetFillColor(10);
  leg->SetTextSize(0.03);

  TFile* f_Zee     = new TFile("../testNewWriteFromPAT_Zee_debug.root");
  TFile* f_Ztautau = new TFile("../testNewWriteFromPAT_Ztautau_debug.root");

  f_Zee->cd();
  TTree* tree_Zee_SHC     = (TTree*) gDirectory->Get("tauFakeRateAnalyzerSHC/tree"); 
  TTree* tree_Zee_HPS     = (TTree*) gDirectory->Get("tauFakeRateAnalyzerHPS/tree"); 
  f_Ztautau->cd();
  TTree* tree_Ztautau_SHC = (TTree*) gDirectory->Get("tauFakeRateAnalyzerSHC/tree"); 
  TTree* tree_Ztautau_HPS = (TTree*) gDirectory->Get("tauFakeRateAnalyzerHPS/tree"); 

  TH2F* h2 = new TH2F("h2","",220,0,1.1,220,0,1.1);

  float vxF_L[45];
  float vyF_L[45];
  float vxF_C[45];
  float vyF_C[45];

  float ZeeAll_SHC     = (float)tree_Zee_SHC->GetEntries("");
  float ZtautauAll_SHC = (float)tree_Ztautau_SHC->GetEntries("");
  float ZeeAll_HPS     = (float)tree_Zee_HPS->GetEntries("");
  float ZtautauAll_HPS = (float)tree_Ztautau_HPS->GetEntries("");

  for(int i = 0; i<=44; i++){
    float cut = 0.005*i;
    float ZeeCut = (float)     tree_Zee_HPS->GetEntries(Form("leadPFChargedHadrMva<=-0.1 && fbrem/leadPFChargedHadrTrackP<%f",cut));
    float ZtautauCut = (float) tree_Ztautau_HPS->GetEntries(Form("leadPFChargedHadrMva<=-0.1 && fbrem/leadPFChargedHadrTrackP<%f",cut));
    cout << Form("leadPFChargedHadrMva<=-0.1 && fbrem/leadPFChargedHadrTrackP<%f",cut) << endl;
    cout << ZeeCut/ZeeAll_HPS <<" ---- "<<ZtautauCut/ZtautauAll_HPS  << endl;
    vxF_C[i]=ZeeCut/ZeeAll_HPS;
    vyF_C[i]=ZtautauCut/ZtautauAll_HPS;
  }
  for(int i = 0; i<=44; i++){
    float cut = 0.005*i;
    float ZeeCut = (float) tree_Zee_HPS->GetEntries(Form("leadPFChargedHadrMva<=%f",cut));
    float ZtautauCut = (float) tree_Ztautau_HPS->GetEntries(Form("leadPFChargedHadrMva<=%f",cut));
    vxF_L[i]=ZeeCut/ZeeAll_HPS;
    vyF_L[i]=ZtautauCut/ZtautauAll_HPS;
  }

  h2->SetXTitle("electrons fake-rate");
  h2->SetYTitle("tau-jet efficiency");
  h2->SetAxisRange(0,1.0,"X");
  h2->SetAxisRange(0.70,1.02,"Y");
  h2->Draw();

  TVectorF vx_L(45,vxF_L);
  TVectorF vy_L(45,vyF_L);
  TGraph* graph_L = new TGraph(vx_L,vy_L);
  TVectorF vx_C(45,vxF_C);
  TVectorF vy_C(45,vyF_C);
  TGraph* graph_C = new TGraph(vx_C,vy_C);
  graph_C->SetMarkerStyle(kFullCircle);
  graph_C->SetMarkerSize(1.0);
  graph_C->SetMarkerColor(kRed);
  graph_C->Draw("P");
  graph_L->SetMarkerStyle(kFullSquare);
  graph_L->SetMarkerSize(1.0);
  graph_L->SetMarkerColor(kBlue);
  graph_L->Draw("P");

  leg->SetHeader("HPS, passing tau-ID and loose iso");
  leg->AddEntry(graph_C,"HPC: discr by mva_e_pi and fbrem<10%","P");
  leg->AddEntry(graph_L,"HPS: discr by mva_e_pi","P");
  leg->Draw();

}
Ejemplo n.º 29
0
void compareThreeVersions(TimeInfoAllSteps TIAS_1,TimeInfoAllSteps TIAS_2,TimeInfoAllSteps TIAS_3,TString file_postfix) {

    gStyle->SetOptStat(0);

    TPaveText* labelcms  = new TPaveText(0.20,0.79,0.54,0.92,"NDCBR");
    labelcms->SetTextAlign(12);
    labelcms->SetTextSize(0.04);
    labelcms->SetFillColor(kWhite);
    labelcms->AddText("CMS Preliminary Simulation");
    //labelcms->AddText("CMS Preliminary");
    //labelcms->AddText("Simulation");
    labelcms->AddText("#sqrt{s} = 8 TeV, t#bar{t}+PU");
    labelcms->SetBorderSize(0);
    labelcms->SetTextFont(42);
    labelcms->SetLineWidth(2);

    TH1F *htime_iter_1 = new TH1F("time_iter_1"+file_postfix,"time_iter_1",8,0,8);
    timingTestPerIter(TIAS_1,htime_iter_1);
    htime_iter_1->SetLineStyle(TIAS_1.style());
    htime_iter_1->SetLineColor(TIAS_1.color());
    TH1F *htime_iter_2 = new TH1F("time_iter_2"+file_postfix,"time_iter_2",8,0,8);
    timingTestPerIter(TIAS_2,htime_iter_2);
    htime_iter_2->SetLineStyle(TIAS_2.style());
    htime_iter_2->SetLineColor(TIAS_2.color());
    TH1F *htime_iter_3 = new TH1F("time_iter_3"+file_postfix,"time_iter_3",8,0,8);
    timingTestPerIter(TIAS_3,htime_iter_3);
    htime_iter_3->SetLineStyle(TIAS_3.style());
    htime_iter_3->SetLineColor(TIAS_3.color());
    float iter_Iter0PU20 = htime_iter_1->GetBinContent(1);
    htime_iter_1->Scale(1./iter_Iter0PU20);
    htime_iter_2->Scale(1./iter_Iter0PU20);
    htime_iter_3->Scale(1./iter_Iter0PU20);
    htime_iter_1->GetYaxis()->SetRangeUser(0,1.1*TMath::Max(htime_iter_1->GetBinContent(htime_iter_1->GetMaximumBin()),TMath::Max(htime_iter_2->GetBinContent(htime_iter_2->GetMaximumBin()),htime_iter_3->GetBinContent(htime_iter_3->GetMaximumBin()))));
    TLegend* leg = new TLegend(0.2,0.59,0.45,0.79);
    leg->SetNColumns(1);
    leg->SetFillColor(kWhite);
    leg->SetLineColor(kWhite);
    leg->SetBorderSize(0);
    leg->SetTextSize(0.04);
    leg->SetTextFont(42);
    leg->AddEntry(htime_iter_1,TIAS_1.legend(),"L");
    leg->AddEntry(htime_iter_2,TIAS_2.legend(),"L");
    leg->AddEntry(htime_iter_3,TIAS_3.legend(),"L");
    htime_iter_1->GetYaxis()->SetTitleOffset(1.2);
    htime_iter_1->GetXaxis()->SetRangeUser(0,7);
    htime_iter_1->GetYaxis()->SetTitle("time [1/iter0@<PU>=20]");
    htime_iter_1->GetYaxis()->SetTitleSize(0.04);
    htime_iter_1->GetXaxis()->SetTitleSize(0.04);
    htime_iter_1->GetYaxis()->SetLabelSize(0.04);
    TCanvas c0;
    c0.SetTicks(1,1);
    htime_iter_1->Draw("H");
    htime_iter_2->Draw("H,same");
    htime_iter_3->Draw("H,same");
    leg->Draw();
    labelcms->Draw();
    c0.SetGridy();
    c0.SaveAs("timingNew_iter_"+file_postfix+".png");

    TH1F *htime_step_1 = new TH1F("time_step_1"+file_postfix,"time_step_1",5,0,5);
    timingTestPerStep(TIAS_1,htime_step_1);
    htime_step_1->SetLineStyle(TIAS_1.style());
    htime_step_1->SetLineColor(TIAS_1.color());
    htime_step_1->GetYaxis()->SetTitle("time [1/building@<PU>=20]");
    TH1F *htime_step_2 = new TH1F("time_step_2"+file_postfix,"time_step_2",5,0,5);
    timingTestPerStep(TIAS_2,htime_step_2);
    htime_step_2->SetLineStyle(TIAS_2.style());
    htime_step_2->SetLineColor(TIAS_2.color());
    TH1F *htime_step_3 = new TH1F("time_step_3"+file_postfix,"time_step_3",5,0,5);
    timingTestPerStep(TIAS_3,htime_step_3);
    htime_step_3->SetLineStyle(TIAS_3.style());
    htime_step_3->SetLineColor(TIAS_3.color());
    float step_BuildPU20 = htime_step_1->GetBinContent(3);
    htime_step_1->Scale(1./step_BuildPU20);
    htime_step_2->Scale(1./step_BuildPU20);
    htime_step_3->Scale(1./step_BuildPU20);
    htime_step_1->GetYaxis()->SetTitleOffset(1.2);
    htime_step_1->GetXaxis()->SetRangeUser(0,7);
    htime_step_1->GetYaxis()->SetTitleSize(0.04);
    htime_step_1->GetXaxis()->SetTitleSize(0.04);
    htime_step_1->GetYaxis()->SetLabelSize(0.04);
    TCanvas c1;
    c1.SetTicks(1,1);
    //htime_step_1->Scale(1./htime_step_1->Integral());
    //htime_step_2->Scale(1./htime_step_2->Integral());
    //htime_step_3->Scale(1./htime_step_3->Integral());
    htime_step_1->GetYaxis()->SetRangeUser(0,1.1*TMath::Max(htime_step_1->GetBinContent(htime_step_1->GetMaximumBin()),TMath::Max(htime_step_2->GetBinContent(htime_step_2->GetMaximumBin()),htime_step_3->GetBinContent(htime_step_3->GetMaximumBin()))));
    htime_step_1->GetXaxis()->SetRangeUser(1,5);
    htime_step_1->Draw("H");
    htime_step_2->Draw("H,same");
    htime_step_3->Draw("H,same");
    leg->SetX1NDC(0.60);
    leg->SetX2NDC(0.85);
    labelcms->SetX1NDC(0.60);
    labelcms->SetX2NDC(0.94);
    leg->Draw();
    labelcms->Draw();
    c1.SetGridy();
    c1.SaveAs("timingNew_step_"+file_postfix+".png");

    TH1F *htime_track_1 = (TH1F*) htime_iter_1->Clone("time_track_1"+file_postfix);
    htime_track_1->Reset();
    makeTimePerTrackPlot(htime_track_1,htime_iter_1,TIAS_1.mtvfile());
    TH1F *htime_track_2 = (TH1F*) htime_iter_2->Clone("time_track_2"+file_postfix);
    htime_track_2->Reset();
    makeTimePerTrackPlot(htime_track_2,htime_iter_2,TIAS_2.mtvfile());
    TH1F *htime_track_3 = (TH1F*) htime_iter_3->Clone("time_track_3"+file_postfix);
    htime_track_3->Reset();
    makeTimePerTrackPlot(htime_track_3,htime_iter_3,TIAS_3.mtvfile());
    float track_Iter0PU20 = htime_track_1->GetBinContent(1);
    htime_track_1->Scale(1./track_Iter0PU20);
    htime_track_2->Scale(1./track_Iter0PU20);
    htime_track_3->Scale(1./track_Iter0PU20);
    htime_track_1->GetYaxis()->SetRangeUser(0,1.1*TMath::Max(htime_track_1->GetBinContent(htime_track_1->GetMaximumBin()),TMath::Max(htime_track_2->GetBinContent(htime_track_2->GetMaximumBin()),htime_track_3->GetBinContent(htime_track_3->GetMaximumBin()))));
    TCanvas c2;
    c2.SetTicks(1,1);
    htime_track_1->GetYaxis()->SetTitleOffset(1.2);
    htime_track_1->GetXaxis()->SetRangeUser(0,7);
    htime_track_1->GetYaxis()->SetTitle("time/track [1/iter0@<PU>=20]");
    htime_track_1->GetYaxis()->SetTitleSize(0.04);
    htime_track_1->GetXaxis()->SetTitleSize(0.04);
    htime_track_1->GetYaxis()->SetLabelSize(0.04);
    htime_track_1->Draw("H");
    htime_track_2->Draw("H,same");
    htime_track_3->Draw("H,same");
    leg->SetX1NDC(0.2);
    leg->SetX2NDC(0.45);
    labelcms->SetX1NDC(0.2);
    labelcms->SetX2NDC(0.54);
    leg->Draw();
    labelcms->Draw();
    c2.SetGridy();
    c2.SaveAs("timingNew_track_"+file_postfix+".png");

}
Ejemplo n.º 30
0
void canvasRAAPbPb_0_100()
{
//=========Macro generated from canvas: canvasRAA/canvasRAA
//=========  (Mon Nov 21 04:10:29 2016) by ROOT version6.02/10
   TCanvas *canvasRAA = new TCanvas("canvasRAA", "canvasRAA",0,0,600,600);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   canvasRAA->SetHighLightColor(2);
   canvasRAA->Range(0.5519499,-0.2310559,1.777118,1.69441);
   canvasRAA->SetFillColor(0);
   canvasRAA->SetBorderMode(0);
   canvasRAA->SetBorderSize(2);
   canvasRAA->SetLogx();
   canvasRAA->SetLeftMargin(0.12);
   canvasRAA->SetRightMargin(0.03);
   canvasRAA->SetTopMargin(0.075);
   canvasRAA->SetBottomMargin(0.12);
   canvasRAA->SetFrameBorderMode(0);
   canvasRAA->SetFrameBorderMode(0);
   
   TH2F *hemptyEff1 = new TH2F("hemptyEff1","",50,5,55,10,0,1.55);
   hemptyEff1->SetMinimum(0);
   hemptyEff1->SetMaximum(2);
   hemptyEff1->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   hemptyEff1->SetLineColor(ci);
   hemptyEff1->SetMarkerStyle(20);
   hemptyEff1->GetXaxis()->SetTitle("p_{T} (GeV/c)");
   hemptyEff1->GetXaxis()->CenterTitle(true);
   hemptyEff1->GetXaxis()->SetLabelFont(42);
   hemptyEff1->GetXaxis()->SetTitleSize(0.05);
   hemptyEff1->GetXaxis()->SetTitleFont(42);
   hemptyEff1->GetYaxis()->SetTitle("R_{AA}");
   hemptyEff1->GetYaxis()->CenterTitle(true);
   hemptyEff1->GetYaxis()->SetLabelFont(42);
   hemptyEff1->GetYaxis()->SetTitleSize(0.05);
   hemptyEff1->GetYaxis()->SetTitleOffset(1.1);
   hemptyEff1->GetYaxis()->SetTitleFont(42);
   hemptyEff1->GetZaxis()->SetLabelFont(42);
   hemptyEff1->GetZaxis()->SetLabelSize(0.035);
   hemptyEff1->GetZaxis()->SetTitleSize(0.035);
   hemptyEff1->GetZaxis()->SetTitleFont(42);
   hemptyEff1->Draw("");
   TLine *line = new TLine(5,1,55,1);
   line->SetLineStyle(2);
   line->SetLineWidth(2);
   line->Draw();
   TBox *box = new TBox(5,0.8492652,5.35,1.150735);
   box->SetFillColor(16);
   box->SetLineColor(16);
   box->Draw();
   TLatex *   tex = new TLatex(0.38,0.595,"Centrality 0-100%");
tex->SetNDC();
   tex->SetTextFont(42);
   tex->SetLineWidth(2);
   tex->Draw();
      tex = new TLatex(0.13,0.936,"25.8 pb^{-1} (5.02 TeV pp) + 350.68 #mub^{-1} (5.02 TeV PbPb)");
tex->SetNDC();
   tex->SetTextFont(42);
   tex->SetTextSize(0.038);
   tex->SetLineWidth(2);
   tex->Draw();
      tex = new TLatex(0.15,0.9,"CMS");
tex->SetNDC();
   tex->SetTextAlign(13);
   tex->SetTextSize(0.06);
   tex->SetLineWidth(2);
   tex->Draw();
      tex = new TLatex(0.15,0.84,"Preliminary");
tex->SetNDC();
   tex->SetTextAlign(13);
   tex->SetTextFont(52);
   tex->SetLineWidth(2);
   tex->Draw();
      tex = new TLatex(0.23,0.7,"T_{AA} and lumi.");
tex->SetNDC();
   tex->SetTextFont(42);
   tex->SetTextSize(0.04);
   tex->SetLineWidth(2);
   tex->Draw();
      tex = new TLatex(0.23,0.65,"uncertainty");
tex->SetNDC();
   tex->SetTextFont(42);
   tex->SetTextSize(0.04);
   tex->SetLineWidth(2);
   tex->Draw();
   
   Double_t gNuclearModification_fx3001[5] = {
   8.5,
   12.5,
   17.5,
   25,
   40};
   Double_t gNuclearModification_fy3001[5] = {
   0.2588925,
   0.3541164,
   0.4248931,
   0.6428491,
   0.3291394};
   Double_t gNuclearModification_felx3001[5] = {
   1.5,
   2.5,
   2.5,
   5,
   10};
   Double_t gNuclearModification_fely3001[5] = {
   0.06471243,
   0.08566381,
   0.1025233,
   0.1541752,
   0.07884685};
   Double_t gNuclearModification_fehx3001[5] = {
   1.5,
   2.5,
   2.5,
   5,
   10};
   Double_t gNuclearModification_fehy3001[5] = {
   0.06471243,
   0.08566381,
   0.1025233,
   0.1541752,
   0.07884685};
   TGraphAsymmErrors *grae = new TGraphAsymmErrors(5,gNuclearModification_fx3001,gNuclearModification_fy3001,gNuclearModification_felx3001,gNuclearModification_fehx3001,gNuclearModification_fely3001,gNuclearModification_fehy3001);
   grae->SetName("gNuclearModification");
   grae->SetTitle("Graph");

   ci = TColor::GetColor("#0099ff");
   grae->SetFillColor(ci);
   grae->SetFillStyle(3001);

   ci = TColor::GetColor("#0099ff");
   grae->SetLineColor(ci);

   ci = TColor::GetColor("#330066");
   grae->SetMarkerColor(ci);
   grae->SetMarkerStyle(21);
   
   TH1F *Graph_gNuclearModification3001 = new TH1F("Graph_gNuclearModification3001","Graph",100,2.7,54.3);
   Graph_gNuclearModification3001->SetMinimum(0.1338956);
   Graph_gNuclearModification3001->SetMaximum(0.8573087);
   Graph_gNuclearModification3001->SetDirectory(0);
   Graph_gNuclearModification3001->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_gNuclearModification3001->SetLineColor(ci);
   Graph_gNuclearModification3001->SetMarkerStyle(20);
   Graph_gNuclearModification3001->GetXaxis()->SetLabelFont(42);
   Graph_gNuclearModification3001->GetXaxis()->SetLabelSize(0.035);
   Graph_gNuclearModification3001->GetXaxis()->SetTitleSize(0.035);
   Graph_gNuclearModification3001->GetXaxis()->SetTitleFont(42);
   Graph_gNuclearModification3001->GetYaxis()->SetLabelFont(42);
   Graph_gNuclearModification3001->GetYaxis()->SetLabelSize(0.035);
   Graph_gNuclearModification3001->GetYaxis()->SetTitleSize(0.035);
   Graph_gNuclearModification3001->GetYaxis()->SetTitleFont(42);
   Graph_gNuclearModification3001->GetZaxis()->SetLabelFont(42);
   Graph_gNuclearModification3001->GetZaxis()->SetLabelSize(0.035);
   Graph_gNuclearModification3001->GetZaxis()->SetTitleSize(0.035);
   Graph_gNuclearModification3001->GetZaxis()->SetTitleFont(42);
   grae->SetHistogram(Graph_gNuclearModification3001);
   
   grae->Draw("5");
   Double_t xAxis1[6] = {7, 10, 15, 20, 30, 50}; 
   
   TH1D *hNuclearModification2 = new TH1D("hNuclearModification2","",5, xAxis1);
   hNuclearModification2->SetBinContent(1,0.2588925);
   hNuclearModification2->SetBinContent(2,0.3541164);
   hNuclearModification2->SetBinContent(3,0.4248931);
   hNuclearModification2->SetBinContent(4,0.6428491);
   hNuclearModification2->SetBinContent(5,0.3291394);
   hNuclearModification2->SetBinError(1,0.1738922);
   hNuclearModification2->SetBinError(2,0.08216078);
   hNuclearModification2->SetBinError(3,0.09029037);
   hNuclearModification2->SetBinError(4,0.1168973);
   hNuclearModification2->SetBinError(5,0.1254217);
   hNuclearModification2->SetEntries(54.19682);

   ci = TColor::GetColor("#330066");
   hNuclearModification2->SetLineColor(ci);
   hNuclearModification2->SetLineWidth(3);

   ci = TColor::GetColor("#330066");
   hNuclearModification2->SetMarkerColor(ci);
   hNuclearModification2->SetMarkerStyle(21);
   hNuclearModification2->SetMarkerSize(1.2);
   hNuclearModification2->GetXaxis()->SetTitle("D^{0} p_{T} (GeV/c)");
   hNuclearModification2->GetXaxis()->SetLabelFont(42);
   hNuclearModification2->GetXaxis()->SetLabelSize(0.035);
   hNuclearModification2->GetXaxis()->SetTitleSize(0.035);
   hNuclearModification2->GetXaxis()->SetTitleFont(42);
   hNuclearModification2->GetYaxis()->SetTitle("Uncorrected dN(D^{0})/dp_{T}");
   hNuclearModification2->GetYaxis()->SetLabelFont(42);
   hNuclearModification2->GetYaxis()->SetLabelSize(0.035);
   hNuclearModification2->GetYaxis()->SetTitleSize(0.035);
   hNuclearModification2->GetYaxis()->SetTitleFont(42);
   hNuclearModification2->GetZaxis()->SetLabelFont(42);
   hNuclearModification2->GetZaxis()->SetLabelSize(0.035);
   hNuclearModification2->GetZaxis()->SetTitleSize(0.035);
   hNuclearModification2->GetZaxis()->SetTitleFont(42);
   hNuclearModification2->Draw("same");
   
   TLegend *leg = new TLegend(0.6036242,0.7474695,0.942953,0.8457592,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.04);
   leg->SetLineColor(0);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("gNuclearModification","B^{+} |y| < 1.0","pf");

   ci = TColor::GetColor("#0099ff");
   entry->SetFillColor(ci);
   entry->SetFillStyle(3001);

   ci = TColor::GetColor("#0099ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);

   ci = TColor::GetColor("#330066");
   entry->SetMarkerColor(ci);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry->SetTextSize(0.038);
   leg->Draw();
   
   TH2F *hemptyEff_copy3 = new TH2F("hemptyEff_copy3","",50,5,55,10,0,1.55);
   hemptyEff_copy3->SetMinimum(0);
   hemptyEff_copy3->SetMaximum(2);
   hemptyEff_copy3->SetDirectory(0);
   hemptyEff_copy3->SetStats(0);

   ci = TColor::GetColor("#000099");
   hemptyEff_copy3->SetLineColor(ci);
   hemptyEff_copy3->SetMarkerStyle(20);
   hemptyEff_copy3->GetXaxis()->SetTitle("p_{T} (GeV/c)");
   hemptyEff_copy3->GetXaxis()->CenterTitle(true);
   hemptyEff_copy3->GetXaxis()->SetLabelFont(42);
   hemptyEff_copy3->GetXaxis()->SetTitleSize(0.05);
   hemptyEff_copy3->GetXaxis()->SetTitleFont(42);
   hemptyEff_copy3->GetYaxis()->SetTitle("R_{AA}");
   hemptyEff_copy3->GetYaxis()->CenterTitle(true);
   hemptyEff_copy3->GetYaxis()->SetLabelFont(42);
   hemptyEff_copy3->GetYaxis()->SetTitleSize(0.05);
   hemptyEff_copy3->GetYaxis()->SetTitleOffset(1.1);
   hemptyEff_copy3->GetYaxis()->SetTitleFont(42);
   hemptyEff_copy3->GetZaxis()->SetLabelFont(42);
   hemptyEff_copy3->GetZaxis()->SetLabelSize(0.035);
   hemptyEff_copy3->GetZaxis()->SetTitleSize(0.035);
   hemptyEff_copy3->GetZaxis()->SetTitleFont(42);
   hemptyEff_copy3->Draw("sameaxis");
   canvasRAA->Modified();
   canvasRAA->cd();
   canvasRAA->SetSelected(canvasRAA);
}