void paraPull_alpha_MUONS_MS_2TeV_2Lep_plots_All()
{
//=========Macro generated from canvas: c1/alpha_MUONS_MS
//=========  (Sun Nov 22 20:19:53 2015) by ROOT version6.02/12
    TCanvas *c1 = new TCanvas("c1", "alpha_MUONS_MS",0,22,1000,600);
    gStyle->SetOptStat(0);
    c1->Range(-4.125,-1.009766,37.125,0.9890026);
    c1->SetFillColor(0);
    c1->SetBorderMode(0);
    c1->SetBorderSize(2);
    c1->SetGridx();
    c1->SetGridy();
    c1->SetFrameBorderMode(0);
    c1->SetFrameBorderMode(0);

    TH1F *NuisanceParameterFreed26 = new TH1F("NuisanceParameterFreed26","alpha_MUONS_MS",33,0,33);
    NuisanceParameterFreed26->SetMinimum(-0.8098895);
    NuisanceParameterFreed26->SetMaximum(0.7891257);
    NuisanceParameterFreed26->SetStats(0);

    Int_t ci;      // for color index setting
    TColor *color; // for color definition with alpha
    ci = TColor::GetColor("#000099");
    NuisanceParameterFreed26->SetLineColor(ci);
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(1,"XS_ttbar");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(2,"FT_EFF_Eigen_C_0");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(3,"EG_SCALE_ALL");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(4,"Luminosity");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(5,"XS_st");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(6,"XS_Zc");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(7,"MUONS_ID");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(8,"FT_EFF_Eigen_B_1");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(9,"FT_EFF_Eigen_C_1");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(10,"EL_EFF_ID_TotalCorrUncertainty");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(11,"FT_EFF_Eigen_C_3");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(12,"XS_Zl");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(13,"MUON_EFF_TrigSystUncertainty");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(14,"FT_EFF_Eigen_B_0");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(15,"FT_EFF_Eigen_B_2");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(16,"EL_EFF_Iso_TotalCorrUncertainty");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(17,"EL_EFF_Reco_TotalCorrUncertainty");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(18,"MUONS_SCALE");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(19,"MUON_ISO_STAT");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(20,"FT_EFF_Eigen_Light_2");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(21,"MUON_EFF_STAT");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(22,"MUON_EFF_SYS");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(23,"MUON_EFF_TrigStatUncertainty");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(24,"EG_RESOLUTION_ALL");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(25,"FT_EFF_Eigen_Light_1");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(26,"XS_diboson");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(27,"FT_EFF_Eigen_Light_4");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(28,"FT_EFF_Eigen_Light_3");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(29,"FT_EFF_extrapolation");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(30,"FT_EFF_Eigen_C_2");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(31,"XS_Zb");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(32,"MUON_ISO_SYS");
    NuisanceParameterFreed26->GetXaxis()->SetBinLabel(33,"FT_EFF_Eigen_Light_0");
    NuisanceParameterFreed26->GetXaxis()->SetLabelFont(42);
    NuisanceParameterFreed26->GetXaxis()->SetLabelSize(0.035);
    NuisanceParameterFreed26->GetXaxis()->SetTitleSize(0.035);
    NuisanceParameterFreed26->GetXaxis()->SetTitleFont(42);
    NuisanceParameterFreed26->GetYaxis()->SetTitle("#theta_{fit} - #theta_{initial}/#Delta#theta");
    NuisanceParameterFreed26->GetYaxis()->SetLabelFont(42);
    NuisanceParameterFreed26->GetYaxis()->SetLabelSize(0.035);
    NuisanceParameterFreed26->GetYaxis()->SetTitleSize(0.035);
    NuisanceParameterFreed26->GetYaxis()->SetTitleFont(42);
    NuisanceParameterFreed26->GetZaxis()->SetLabelFont(42);
    NuisanceParameterFreed26->GetZaxis()->SetLabelSize(0.035);
    NuisanceParameterFreed26->GetZaxis()->SetTitleSize(0.035);
    NuisanceParameterFreed26->GetZaxis()->SetTitleFont(42);
    NuisanceParameterFreed26->Draw("hist");

    Double_t _fx1026[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 _fy1026[35] = {
        1.22802e-312,
        -0.8098895,
        -0.4037362,
        -0.3423096,
        -0.2252411,
        -0.1828675,
        -0.1571762,
        -0.149237,
        -0.1273548,
        -0.07358516,
        -0.06808801,
        -0.06198229,
        -0.06031006,
        -0.05293818,
        -0.03417267,
        -0.03238036,
        -0.02689891,
        -0.02542632,
        -0.001643063,
        0.0001603888,
        0.006036281,
        0.01053148,
        0.01679974,
        0.01757673,
        0.01965372,
        0.02264507,
        0.04078009,
        0.05097348,
        0.05337059,
        0.05443933,
        0.05852469,
        0.09383765,
        0.1011771,
        0.7891257,
        0
    };
    Double_t _fex1026[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 _fey1026[35] = {
        0,
        0,
        0.6078027,
        1.092912,
        1.104476,
        0.9336719,
        0.9913968,
        0.9144366,
        0.7275085,
        0.9893613,
        0.987145,
        0.9819155,
        0.9938071,
        0.9978833,
        0.9917251,
        0.9510144,
        0.9928258,
        0.9931704,
        0.9925399,
        1.005278,
        0.9933467,
        0.9908674,
        0.9932531,
        0.9930728,
        0.9918603,
        1.137459,
        0.9911371,
        0.9865638,
        0.9931418,
        0.9930512,
        0.9596104,
        0.9909946,
        0.753126,
        0.9864575,
        0.77864
    };
    TGraphErrors *gre = new TGraphErrors(35,_fx1026,_fy1026,_fex1026,_fey1026);
    gre->SetName("");
    gre->SetTitle("");
    gre->SetFillColor(1);
    gre->SetMarkerStyle(20);
    gre->SetMarkerSize(1.2);

    TH1F *Graph_Graph1026 = new TH1F("Graph_Graph1026","",100,0,35.75);
    Graph_Graph1026->SetMinimum(-1.756302);
    Graph_Graph1026->SetMaximum(2.096664);
    Graph_Graph1026->SetDirectory(0);
    Graph_Graph1026->SetStats(0);

    ci = TColor::GetColor("#000099");
    Graph_Graph1026->SetLineColor(ci);
    Graph_Graph1026->GetXaxis()->SetLabelFont(42);
    Graph_Graph1026->GetXaxis()->SetLabelSize(0.035);
    Graph_Graph1026->GetXaxis()->SetTitleSize(0.035);
    Graph_Graph1026->GetXaxis()->SetTitleFont(42);
    Graph_Graph1026->GetYaxis()->SetLabelFont(42);
    Graph_Graph1026->GetYaxis()->SetLabelSize(0.035);
    Graph_Graph1026->GetYaxis()->SetTitleSize(0.035);
    Graph_Graph1026->GetYaxis()->SetTitleFont(42);
    Graph_Graph1026->GetZaxis()->SetLabelFont(42);
    Graph_Graph1026->GetZaxis()->SetLabelSize(0.035);
    Graph_Graph1026->GetZaxis()->SetTitleSize(0.035);
    Graph_Graph1026->GetZaxis()->SetTitleFont(42);
    gre->SetHistogram(Graph_Graph1026);

    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.3599799,0.9341608,0.6400201,0.995,"blNDC");
    pt->SetName("title");
    pt->SetBorderSize(0);
    pt->SetFillColor(0);
    pt->SetFillStyle(0);
    pt->SetTextFont(42);
    TText *AText = pt->AddText("alpha_MUONS_MS");
    pt->Draw();
    c1->Modified();
    c1->cd();
    c1->SetSelected(c1);
}
예제 #2
0
void Fit_electron_purity(TH1F * nsigmaE_inclusive[])
{
  TH1D *purity_MB=new TH1D("purity_MB","",NpT_bins_run12_MB,pt_run12_MB);
  TH1D *purity_oneSigma=new TH1D("purity_oneSigma","",NpT_bins_run12_MB,pt_run12_MB);
  TH1D *purity_twoSigma=new TH1D("purity_twoSigma","",NpT_bins_run12_MB,pt_run12_MB);
  TH1D *purity_threeSigma=new TH1D("purity_threeSigma","",NpT_bins_run12_MB,pt_run12_MB);

  TH1F * mh1Electron_Constant=new TH1F("mh1Electron_Constant","",NpT_bins_run12_MB,pt_run12_MB);
  TH1F * mh1Electron_Mean=new TH1F("mh1Electron_Mean","",NpT_bins_run12_MB,pt_run12_MB);
  TH1F * mh1Electron_Sigma=new TH1F("mh1Electron_Sigma","",NpT_bins_run12_MB,pt_run12_MB);
  
  gStyle->SetOptFit(111);
  TCanvas *c2=new TCanvas("c2","",1200,800);
  TCanvas *c3=new TCanvas("c3","",1200,800);
  c2->Divide(3,2);
  c3->Divide(3,2);

  int Npad=1;

  for(Int_t ipt=23;ipt<NpT_bins_run12_MB;ipt++)
     {
       //     TF1 *total_3 =new TF1(TString("total_3"),"[0]*TMath::Gaus(x,[1],[2],1) + [3]*TMath::Gaus(x,[4],[5],1) + [6]*TMath::Gaus(x,[7],[8],1)+[9]*TMath::Gaus(x,[10],[11],1)",-15,15);// fit the total
       TF1 *total_3 =new TF1(TString("total_3"),"[0]*TMath::Gaus(x,[1],[2],1) + [3]*TMath::Gaus(x,[4],[5],1) + [6]*TMath::Gaus(x,[7],[8],1)",-15,15);// fit the total
	      
      TF1 *  g1=new TF1(TString("g1"),"[0]*TMath::Gaus(x,[1],[2],1)",-15,15);   
      TF1 *  g2=new TF1(TString("g2"),"[0]*TMath::Gaus(x,[1],[2],1)",-15,15);   
      TF1 *  g3=new TF1(TString("g3"),"[0]*TMath::Gaus(x,[1],[2],1)",-15,15);
      TF1 *  g4=new TF1(TString("g4"),"[0]*TMath::Gaus(x,[1],[2],1)",-15,15); 
      //      total_3->SetParNames("#pi C", "#pi #mu", "#pi #sigma", "proton C", "proton #mu", "proton #sigma","kaon C","kaon #mu","kaon sigma");
      total_3->SetLineColor(kBlue);
      

      g1->SetLineColor(3);
      g2->SetLineColor(6);
      g3->SetLineColor(7);
      g4->SetLineColor(2);
      
      g1->SetLineStyle(7);
      g2->SetLineStyle(7);
      g3->SetLineStyle(7);

      
      
      if(ipt<29)
	{
	  c2->cd(Npad++);
	  gPad->SetLogy(1);
	}
      else 
        {
          c3->cd(Npad++);
          gPad->SetLogy(1);
        }
      if(Npad==7) Npad=1;
      nsigmaE_inclusive[ipt]->SetTitle(mh1_pT_Title[ipt]);
      nsigmaE_inclusive[ipt]->GetXaxis()->SetTitle("nSigmaE");
      nsigmaE_inclusive[ipt]->GetYaxis()->SetTitle("Counts");
      
      
      nsigmaE_inclusive[ipt]->GetXaxis()->SetRangeUser(-15,15);  
      
//pi mean
      total_3->SetParameter(1,pi_mean_tof->GetBinContent(ipt+1));
      total_3->SetParLimits(1,pi_mean_tof->GetBinContent(ipt+1)-0.5,pi_mean_tof->GetBinContent(ipt+1)+0.5);
      //pi sigma
      total_3->SetParameter(2,pi_sigma_tof->GetBinContent(ipt+1));
      total_3->SetParLimits(2,pi_sigma_tof->GetBinContent(ipt+1)-0.1,pi_sigma_tof->GetBinContent(ipt+1)+0.1);
      //proton mean
      total_3->SetParameter(4,proton_mean_tof->GetBinContent(ipt+1));
      total_3->SetParLimits(4,proton_mean_tof->GetBinContent(ipt+1)-1,proton_mean_tof->GetBinContent(ipt+1)+1);
       //proton sigma     
      total_3->SetParameter(5,proton_sigma_tof->GetBinContent(ipt+1));
      total_3->SetParLimits(5,proton_sigma_tof->GetBinContent(ipt+1)-0.1,proton_sigma_tof->GetBinContent(ipt+1)+0.1);
//       //kaon mean
//       total_3->SetParameter(7,kaon_mean_tof->GetBinContent(ipt+1));
//       total_3->SetParLimits(7,kaon_mean_tof->GetBinContent(ipt+1)-(ipt+1)*kaon_mean_tof->GetBinError(ipt+1)-1,kaon_mean_tof->GetBinContent(ipt+1)+(ipt+1)*kaon_mean_tof->GetBinError(ipt+1)+1);
//       total_3->SetParameter(8,kaon_sigma_tof->GetBinContent(ipt+1));
//       total_3->SetParLimits(8,kaon_sigma_tof->GetBinContent(ipt+1)-(ipt+1)*kaon_sigma_tof->GetBinError(ipt+1),kaon_sigma_tof->GetBinContent(ipt+1)+(ipt+1)*kaon_sigma_tof->GetBinError(ipt+1));
// //kaon sigma
//       total_3->SetParameter(8,kaon_sigma_tof->GetBinContent(ipt+1));
//       total_3->SetParLimits(8,kaon_sigma_tof->GetBinContent(ipt+1)-(ipt+1)*kaon_sigma_tof->GetBinError(ipt+1),kaon_sigma_tof->GetBinContent(ipt+1)+(ipt+1)*kaon_sigma_tof->GetBinError(ipt+1));
      
      //electron mean
      total_3->SetParameter(7,electron_Mean->GetBinContent(ipt+1));
      total_3->SetParLimits(7,electron_Mean->GetBinContent(ipt+1)-3*electron_Mean->GetBinError(ipt+1),electron_Mean->GetBinContent(ipt+1)+3*electron_Mean->GetBinError(ipt+1));
      //electron sigma
      total_3->SetParameter(8,electron_Sigma->GetBinContent(ipt+1));
      total_3->SetParLimits(8,electron_Sigma->GetBinContent(ipt+1)-3*electron_Sigma->GetBinError(ipt+1),electron_Sigma->GetBinContent(ipt+1)+3*electron_Sigma->GetBinError(ipt+1));

      

      nsigmaE_inclusive[ipt]->Fit(total_3,"R","same",-10,4);

      
      
      g1->SetParameter(0,total_3->GetParameter(0));
      g1->SetParameter(1,total_3->GetParameter(1));
      g1->SetParameter(2,total_3->GetParameter(2));
      
      g2->SetParameter(0,total_3->GetParameter(3));
      g2->SetParameter(1,total_3->GetParameter(4));
      g2->SetParameter(2,total_3->GetParameter(5));
      
      g4->SetParameter(0,total_3->GetParameter(6));
      g4->SetParameter(1,total_3->GetParameter(7));
      g4->SetParameter(2,total_3->GetParameter(8));

      // g4->SetParameter(0,total_3->GetParameter(9));
      // g4->SetParameter(1,total_3->GetParameter(10));
      // g4->SetParameter(2,total_3->GetParameter(11));
      
       
      g1->Draw("same");
      g2->Draw("same");
      //  g3->Draw("same");
      g4->Draw("same");
      
      
      TLegend *legend = new TLegend(0.15,0.65,0.35,0.8);
      legend->AddEntry(g1,"#pi ","lp");
      legend->AddEntry(g2,"p+k ","lp");
      //     legend->AddEntry(g3,"kaon","lp");
      legend->AddEntry(g4,"e","lp");

      legend->SetBorderSize(0);
      legend->SetFillStyle(0);
      legend->SetTextSize(0.055);
      legend ->SetTextFont(62);       
      legend->Draw("same");

      c2->SaveAs("purity_fit_c2.pdf");
      c3->SaveAs("purity_fit_c3.pdf");
      
      //continue;


            
      Double_t mPurity=g4->Integral(-1,3)/total_3->Integral(-1,3);
      purity_MB->SetBinContent(ipt+1,mPurity);
          

      mh1Electron_Constant->SetBinContent(ipt+1,total_3->GetParameter(6));
      mh1Electron_Constant->SetBinError(ipt+1,total_3->GetParError(6));
      
      mh1Electron_Mean->SetBinContent(ipt+1,total_3->GetParameter(7));
      mh1Electron_Mean->SetBinError(ipt+1,total_3->GetParError(7));
      
      mh1Electron_Sigma->SetBinContent(ipt+1,total_3->GetParameter(8));
      mh1Electron_Sigma->SetBinError(ipt+1,total_3->GetParError(8));

      
      
      
      Double_t mPurity_temp_oneSigma= Fit_purity(nsigmaE_inclusive[ipt],ipt,electron_Mean->GetBinError(ipt+1),electron_Sigma->GetBinError(ipt+1),total_3,g1,g2,g3,g4,1,1); 
      Double_t mPurity_temp_twoSigma= Fit_purity(nsigmaE_inclusive[ipt],ipt,electron_Mean->GetBinError(ipt+1),electron_Sigma->GetBinError(ipt+1),total_3,g1,g2,g3,g4,2,1); 
      Double_t mPurity_temp_threeSigma= Fit_purity(nsigmaE_inclusive[ipt],ipt,electron_Mean->GetBinError(ipt+1),electron_Sigma->GetBinError(ipt+1),total_3,g1,g2,g3,g4,3,1);

      
      purity_oneSigma->SetBinContent(ipt+1,mPurity_temp_oneSigma);
      purity_twoSigma->SetBinContent(ipt+1,mPurity_temp_twoSigma);
      purity_threeSigma->SetBinContent(ipt+1,mPurity_temp_threeSigma);
      
      
      
      Double_t purity_mean=(mPurity_temp_oneSigma+mPurity_temp_twoSigma+mPurity_temp_threeSigma)/3.;

      
      Double_t mPurity_sys=0;
      if(abs(purity_mean-mPurity_temp_oneSigma)>mPurity_sys)
	mPurity_sys=abs(purity_mean-mPurity_temp_oneSigma);
      
      if(abs(purity_mean-mPurity_temp_twoSigma)>mPurity_sys)
	mPurity_sys=abs(purity_mean-mPurity_temp_twoSigma);
      
      if(abs(purity_mean-mPurity_temp_threeSigma)>mPurity_sys)
	mPurity_sys=abs(purity_mean-mPurity_temp_threeSigma);
      



      Double_t mPurity_sts=0.0;

                 mPurity_sts= Get_sts_Error(nsigmaE_inclusive[ipt],ipt,total_3,g1,g2,g3,g4,3,0,purity_mean,mPurity_sys);

      purity_MB->SetBinContent(ipt+1,purity_mean);
      purity_MB->SetBinError(ipt+1,sqrt(mPurity_sys*mPurity_sys+mPurity_sts*mPurity_sts));

      Fit_purity(nsigmaE_inclusive[ipt],ipt,electron_Mean->GetBinError(ipt+1),electron_Sigma->GetBinError(ipt+1),total_3,g1,g2,g3,g4,1,1); 
      Fit_purity(nsigmaE_inclusive[ipt],ipt,electron_Mean->GetBinError(ipt+1),electron_Sigma->GetBinError(ipt+1),total_3,g1,g2,g3,g4,2,1); 
      Fit_purity(nsigmaE_inclusive[ipt],ipt,electron_Mean->GetBinError(ipt+1),electron_Sigma->GetBinError(ipt+1),total_3,g1,g2,g3,g4,3,1); 
      
       TFile *file_purity=new TFile("purity_MB_highpT.root","RECREATE");
       purity_MB->Write();
       purity_oneSigma->Write();
       purity_twoSigma->Write();
       purity_threeSigma->Write();
       file_purity->Close();
         
 }

   Draw_purity_sys(purity_oneSigma,purity_twoSigma,purity_threeSigma);

   Draw_purity(purity_MB);

   TFile *file_3=new TFile("Mean_Sigma_Hadron.root","RECREATE");
   mh1Electron_Constant->Write();
   mh1Electron_Mean->Write();
   mh1Electron_Sigma->Write();       

}
예제 #3
0
void drawplot_eff_eta()
{

  // gROOT->ProcessLine(".L effFunctions.C");

  TCanvas* cEff = new TCanvas("cEff","cEff",700,450);
  cEff->SetGridx(1);
  cEff->SetGridy(1);

  TTree *gt = getTree(filesDir + "gem_csc_delta_pt40_pad4.root");

  //ht = draw_geff(gt, "Eff. for a SimTrack to have an associated LCT;SimTrack |#eta|;Eff.", "h_odd", "(100,1.54,2.2)", "TMath::Abs(eta)", "", ok_lct1 || ok_lct2, "P", kRed);
  //hh = draw_geff(gt, "Eff. for a SimTrack to have an associated LCT;SimTrack |#eta|;Eff.", "h_odd", "(100,1.54,2.2)", "TMath::Abs(eta)", "", ok_sh1 || ok_sh2, "P same", kViolet);
  h1 = draw_geff(gt, "Eff. for a SimTrack to have an associated ME1/b LCT;SimTrack |#eta|;Eff.", "h_odd", "(70,1.54,2.2)", "TMath::Abs(eta)", ok_sh1, ok_lct1, "P", kRed);
  h2 = draw_geff(gt, "Eff. for a SimTrack to have an associated ME1/b LCT;SimTrack |#eta|;Eff.", "h_odd", "(70,1.54,2.2)", "TMath::Abs(eta)", ok_sh2, ok_lct2, "P same");
  eff_base->GetYaxis()->SetRangeUser(0.6,1.05);
  TLegend *leg = new TLegend(0.42,0.23,.96,0.4, NULL, "brNDC");
  leg->SetBorderSize(0);
  leg->SetFillStyle(0);
  leg->AddEntry(h1, "odd chambers","l");
  leg->AddEntry(h2, "even chambers","l");
  leg->Draw();
  TLatex *  tex = new TLatex(0.17, 0.16,"No Pile-Up");
  tex->SetNDC();
  tex->Draw();
  cEff->Print(plotDir + "lct_eff_for_Trk_vsTrkEta_pt40" + ext);


  h1 = draw_geff(gt, "Eff. for a SimTrack to have an associated ME1/b LCT and GEM Pad;SimTrack |#eta|;Eff.", "h_odd", "(70,1.54,2.2)", "TMath::Abs(eta)", ok_sh1, ok_lct1 && ok_pad1, "P", kRed);
  h2 = draw_geff(gt, "Eff. for a SimTrack to have an associated ME1/b LCT and GEM Pad;SimTrack |#eta|;Eff.", "h_odd", "(70,1.54,2.2)", "TMath::Abs(eta)", ok_sh2, ok_lct2 && ok_pad2, "P same");
  eff_base->GetYaxis()->SetRangeUser(0.6,1.05);
  TLegend *leg = new TLegend(0.42,0.23,.96,0.4, NULL, "brNDC");
  leg->SetBorderSize(0);
  leg->SetFillStyle(0);
  leg->AddEntry(h1, "odd chambers","l");
  leg->AddEntry(h2, "even chambers","l");
  leg->Draw();
  TLatex *  tex = new TLatex(0.17, 0.16,"No Pile-Up");
  tex->SetNDC();
  tex->Draw();
  cEff->Print(plotDir + "gem_pad_and_lct_eff_for_Trk_vsTrkEta_pt40" + ext);

  return;

  h1 = draw_geff(gt, "Eff. for a SimTrack to have an associated GEM Pad;SimTrack |#eta|;Eff.", "h_odd", "(70,1.54,2.2)", "TMath::Abs(eta)", "", ok_pad1 || ok_pad2, "P", kViolet);
  eff_base->GetYaxis()->SetRangeUser(0.6,1.05);
  TLatex *  tex = new TLatex(0.17, 0.16,"No Pile-Up");
  tex->SetNDC();
  tex->Draw();
  cEff->Print(plotDir + "gem_pad0_eff_for_Trk_vsTrkEta_pt40" + ext);




  TTree *gt15 = getTree(filesDir + "gem_csc_delta_pt15_pad4.root");
  h1 = draw_geff(gt15, "Eff. for a SimTrack to have an associated LCT;SimTrack |#eta|;Eff.", "h_odd", "(140,1.54,2.2)", "TMath::Abs(eta)", "", ok_lct1 || ok_lct2, "P", kViolet+2);
  cEff->Print(plotDir + "lct_eff_for_Trk_vsTrkEta_pt15" + ext);


  ho = draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;LCT |#eta|;Eff.", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta_lct_odd)", ok_lct1, ok_pad1, "P", kRed);
  he = draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;LCT |#eta|;Eff.", "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta_lct_even)", ok_lct2, ok_pad2, "P same");
  TLegend *leg = new TLegend(0.42,0.23,.96,0.4, NULL, "brNDC");
  leg->SetBorderSize(0);
  leg->SetFillStyle(0);
  leg->AddEntry(he, "\"Close\" chambers","l");
  leg->AddEntry(ho, "\"Far\" chambers","l");
  leg->Draw();
  cEff->Print(plotDir + "gem_pad_eff_for_LCT_vsLCTEta_pt40" + ext);

  draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;SimTrack |#eta|;Eff.", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct1, ok_pad1, "P", kRed);
  draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;SimTrack |#eta|;Eff.", "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct2, ok_pad2, "P same");
  leg->Draw();
  cEff->Print(plotDir + "gem_pad_eff_for_LCT_vsTrkEta_pt40" + ext);

  draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;LCT |#eta|;Eff.", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta_lct_odd)", ok_lct1, ok_pad1_overlap, "P", kRed);
  draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;LCT |#eta|;Eff.", "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta_lct_even)", ok_lct2, ok_pad2_overlap, "P same");
  leg->Draw();
  cEff->Print(plotDir + "gem_pad_eff_for_LCT_vsLCTEta_pt40_overlap" + ext);

  draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;SimTrack |#eta|;Eff.", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct1, ok_pad1_overlap, "P", kRed);
  draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;SimTrack |#eta|;Eff.", "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct2, ok_pad2_overlap, "P same");
  leg->Draw();
  cEff->Print(plotDir + "gem_pad_eff_for_LCT_vsTrkEta_pt40_overlap" + ext);

  //draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;z SimTrack |#eta|;Eff.", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct1 && Ep, ok_pad1_overlap, "P", kRed);
  //draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;z SimTrack |#eta|;Eff.", "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct2 && Ep, ok_pad2_overlap, "P same");
  //draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;z SimTrack |#eta|;Eff.", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta_gemsh_odd)", ok_gsh1, ok_gdg1, "P", kRed);
  h1 = draw_geff(gt, "Eff. for a SimTrack to have an associated GEM pad;SimTrack |#eta|;Eff.", "h_odd", "(140,1.54,2.2)", "TMath::Abs(eta)", "", ok_pad1 || ok_pad2, "P", kViolet);
  h2 = draw_geff(gt, "Eff. for a SimTrack to have an associated GEM pad;SimTrack |#eta|;Eff.", "h_odd", "(140,1.54,2.2)", "TMath::Abs(eta)", "", ok_2pad1 || ok_2pad2, "P same", kViolet-6);
  TLegend *leg = new TLegend(0.42,0.23,.96,0.4, NULL, "brNDC");
  leg->SetBorderSize(0);
  leg->SetFillStyle(0);
  leg->AddEntry(h1, "at least one pad","l");
  leg->AddEntry(he, "two pads in two GEMs","l");
  leg->Draw();
  cEff->Print(plotDir + "gem_pad_eff_for_Trk_vsTrkEta_pt40" + ext);

  return;
  draw_geff(gt, "Eff. for a SimTrack to have an associated GEM pad;SimTrack |#eta|;Eff.", "h_odd", "(140,1.54,2.2)", "TMath::Abs(eta)", "", ok_gsh1 || ok_gsh2, "P", kViolet);
  draw_geff(gt, "Eff. for a SimTrack to have an associated GEM pad;SimTrack |#eta|;Eff.", "h_odd", "(140,1.54,2.2)", "TMath::Abs(eta)", "", ok_g2sh1 || ok_g2sh2 , "P", kOrange);
  draw_geff(gt, "Eff. for a SimTrack to have an associated GEM pad;SimTrack |#eta|;Eff.", "h_odd", "(140,1.54,2.2)", "TMath::Abs(eta)", "", ok_copad1 || ok_copad2 , "P same", kRed);


}
예제 #4
0
void plot2(){

  typedef std::map<double, ROOT::Math::XYZTVector , User::moreStruct>::iterator CImap;

  TFile* file   = new TFile("../vbfTree.root","READ");

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


  TLegend* leg = new TLegend(0.55,0.45,0.85,0.75,NULL,"brNDC");
  leg->SetFillStyle(0);
  leg->SetBorderSize(0);
  leg->SetFillColor(10);
  leg->SetTextSize(0.04);
  leg->SetHeader("#splitline{POWHEG+PYTHIA qqH(115)#rightarrow#tau#tau}{jets matched to tag partons}");

  TTree* currentTree = (TTree*)file->Get("vbfJetAnalyzer/tree");
  int nEntries = currentTree->GetEntries() ;

  TH2F* h2  = new TH2F("h2","; #Delta#eta_{j1,j2}; min_{i=1,2}#Delta#eta_{ji,j3} ", 80,0,8,40,0,8);
  
  std::vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > >* jets;
  std::vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > >* tagjets;
  currentTree->SetBranchAddress("jetsP4",   &jets);
  currentTree->SetBranchAddress("tagjetsP4",&tagjets);


  for (int n = 0; n < nEntries ; n++) {

    currentTree->GetEntry(n);

    std::map<double, ROOT::Math::XYZTVector , User::moreStruct> sortedTagJets;
    for(unsigned int i = 0; i < tagjets->size(); i++){
      sortedTagJets.insert( make_pair( (*tagjets)[i].Et(),(*tagjets)[i] )  ) ;
    }
    std::map<double, ROOT::Math::XYZTVector , User::moreStruct> sortedJets;
    for(unsigned int i = 0; i < jets->size(); i++){
      sortedJets.insert( make_pair( (*jets)[i].Et(),(*jets)[i] )  ) ;
    }

    if(tagjets->size()<3) continue;

    int counter = 0;
    float eta1,eta2,eta3;

    for(CImap it = sortedTagJets.begin(); 
	it!=sortedTagJets.end(); it++){
      if(counter==0) eta1 = (it->second).Eta();
      if(counter==1) eta2 = (it->second).Eta();
      if(counter==2) eta3 = (it->second).Eta();
      counter++;
    }

    float deta12 = abs(eta1-eta2);
    float detai3 = std::min( abs(eta1-eta3),
			     abs(eta2-eta3)  );
    h2->Fill(deta12,detai3);
   
  }

  h2->Draw("COLZ");


  leg->Draw();


}
예제 #5
0
void makePlots( const char * inputA, const char * inputB, const char * option) 
{
  
  //Output path
  TString path("./paper01-plots/probs/");
  
  TString dataPxxA = TString( "EarthA" ) + TString("_") + TString( "0" ) + TString("_") + TString("Pme") +  TString("/data");
  TString dataPxxB = TString( "EarthB" ) + TString("_") + TString( "0" ) + TString("_") + TString("Pme") +  TString("/data");
  
  TList * v_Labels = new TList();
  TObjString *label;
  label = new TObjString( "Earth: Step function" );
  v_Labels->Add( label ); 
  label = new TObjString( "Earth: Realistic" );
  v_Labels->Add( label ); 
  
  TFile * f1 = new TFile(inputA);
  TFile * f2 = new TFile(inputB);
  
  f1->cd();
  TTree * PxxATreeNu = (TTree*)gDirectory->Get( dataPxxA.Data() );
    
  f2->cd();
  TTree * PxxBTreeNu = (TTree*)gDirectory->Get( dataPxxB.Data() );
  
  //Branches
  double xx = 0.0;
  double yy = 0.0;
  
  TString cname = TString("Earth") + TString("_") + TString("Pee");
  
  TGraph * ProbNu[3];
  ProbNu[0] = new TGraph();
  ProbNu[1] = new TGraph();
  
  PxxATreeNu->SetBranchAddress("Ex",&xx);
  PxxATreeNu->SetBranchAddress("Pb",&yy);
  
  Long64_t nentries = PxxATreeNu->GetEntries();
  
  for (Long64_t i=0;i<nentries;i++) {
    PxxATreeNu->GetEntry(i);
    ProbNu[0]->SetPoint( i, xx, yy);
    if( i < 5 ) 
      std::cout << i << " " << xx << " " << yy << std::endl;
  }
  
  PxxBTreeNu->SetBranchAddress("Ex",&xx);
  PxxBTreeNu->SetBranchAddress("Pb",&yy);
  
  nentries = PxxBTreeNu->GetEntries();
  
  for (Long64_t i=0;i<nentries;i++) {
    PxxBTreeNu->GetEntry(i);
    ProbNu[1]->SetPoint( i, xx, yy);
  }
  
  int ndataset = 0;
  TList * allgraphs = new TList(); //this is a ROOT container. It will store all of your Graphs
  
  allgraphs->Add( ProbNu[0] ); 
  ndataset++;

  allgraphs->Add( ProbNu[1] ); 
  ndataset++;
  
  //Datasets options (Markers: style, color, size) : You can also do it by hand using the interactive Editor
  int style[5];
  int color[5];
  float size[5];
  
  //For dataset No1
  style[0] = 21;
  color[0] = 2;
  size[0]  = 0.7;
  
  //For dataset No2
  style[1] = 20;
  color[1] = 4;
  size[1]  = 0.8;
  
  //For dataset No3
  style[2] = 22;
  color[2] = 38;
  size[2]  = 0.8;

  TCanvas * c1 = new TCanvas( cname.Data(), "Oscillation probabilities", 184,60,861,263); 
  c1->cd();
  gPad->SetGridx();
  gPad->SetGridy();
  gPad->SetLogx();

  float ymin = 0.0;
  float ymax = 0.5;
  float xmin = 0.9e9;
  float xmax = 1.0e10;

  TLegend * leg = new TLegend(0.14,0.58,0.35,0.85);
    
  leg->SetBorderSize(0);
  leg->SetTextSize(0.1);
  leg->SetLineColor(1);
  leg->SetLineStyle(1);
  leg->SetLineWidth(1);
  leg->SetFillColor(0);
  leg->SetFillStyle(1001);
  leg->SetTextFont(62);
  leg->SetTextSize(0.085);

  ndataset = allgraphs->GetSize(); //Get the ndatasets from the size of the List

  // Loop now over the List using the index k
  
  for(int k=0; k < ndataset; ++k) {
    
    if( k == 0 ) {
      //this is our first graph and it is special (to define axis min,max)
      ((TGraph*)allgraphs->At(k))->SetMinimum(ymin);
      ((TGraph*)allgraphs->At(k))->SetMaximum(ymax);
      ((TGraph*)allgraphs->At(k))->Draw("AP");
      ((TGraph*)allgraphs->At(k))->GetXaxis()->SetLimits(xmin, xmax);
      //set the color options
      ((TGraph*)allgraphs->At(k))->SetMarkerStyle( style[k] );
      ((TGraph*)allgraphs->At(k))->SetMarkerSize( size[k] );
      ((TGraph*)allgraphs->At(k))->SetMarkerColor( color[k] );
      ((TGraph*)allgraphs->At(k))->SetLineColor( color[k] );
      ((TGraph*)allgraphs->At(k))->SetFillColor( 10 );
      ((TGraph*)allgraphs->At(k))->GetYaxis()->SetNdivisions(505);
      ((TGraph*)allgraphs->At(k))->GetXaxis()->SetTitle("E [eV]");
      ((TGraph*)allgraphs->At(k))->GetYaxis()->SetTitle("P_{#mue}");

      ((TGraph*)allgraphs->At(k))->GetYaxis()->CenterTitle(true); 
      ((TGraph*)allgraphs->At(k))->GetXaxis()->CenterTitle(true); 
      ((TGraph*)allgraphs->At(k))->GetXaxis()->SetLabelOffset(0.007);
      ((TGraph*)allgraphs->At(k))->GetXaxis()->SetLabelSize(0.08);
      ((TGraph*)allgraphs->At(k))->GetXaxis()->SetTitleSize(0.07);
      ((TGraph*)allgraphs->At(k))->GetXaxis()->SetTitleOffset(0.9);
      ((TGraph*)allgraphs->At(k))->GetXaxis()->SetLabelFont(42);
      ((TGraph*)allgraphs->At(k))->GetYaxis()->SetLabelOffset(0.007);
      ((TGraph*)allgraphs->At(k))->GetYaxis()->SetLabelSize(0.08);
      ((TGraph*)allgraphs->At(k))->GetYaxis()->SetLabelFont(42);
      ((TGraph*)allgraphs->At(k))->GetYaxis()->SetTitleSize(0.09);
      ((TGraph*)allgraphs->At(k))->GetYaxis()->SetTitleOffset(0.45);
      ((TGraph*)allgraphs->At(k))->GetYaxis()->SetTitleFont(42);
      
      ((TGraph*)allgraphs->At(k))->Draw("APL"); // Draw option AP A=draw axis P=draw a marker for the data
      
      TString name = ((TObjString*)v_Labels->At(k))->GetString();
      leg->AddEntry( (TGraph*)allgraphs->At(k), name.Data());
      
      
    }
    else {
      ((TGraph*)allgraphs->At(k))->SetMarkerStyle( style[k] );
      ((TGraph*)allgraphs->At(k))->SetMarkerSize( size[k] );
      ((TGraph*)allgraphs->At(k))->SetMarkerColor( color[k] );
      ((TGraph*)allgraphs->At(k))->SetLineColor( color[k] );
      ((TGraph*)allgraphs->At(k))->SetFillColor( 10 );

      ((TGraph*)allgraphs->At(k))->Draw("PL"); // since we have already plotted the axis on the first graph we only need option P
      
      TString name = ((TObjString*)v_Labels->At(k))->GetString();
      leg->AddEntry( (TGraph*)allgraphs->At(k), name.Data());
    
    }
    
    
  }
  
  topTitle("Earth (corrected)");
  
  /// All done!
  leg->Draw();
  std::stringstream saveAs;
    
  saveAs.str("");
  saveAs << path << "EarthA" << "/pdf/" << "nueosc_earth_AB_" << option << ".pdf";
  c1->SaveAs( saveAs.str().c_str() );
  
  saveAs.str("");
  saveAs << path << "EarthA" << "/png/" << "nueosc_earth_AB_" << option << ".png";
  c1->SaveAs( saveAs.str().c_str() );
  
  saveAs.str("");
  saveAs << path << "EarthA" << "/eps/" << "nueosc_earth_AB_" << option << ".eps";
  c1->SaveAs( saveAs.str().c_str() );
    
  
  
}
예제 #6
0
// -- main function
void fit_chi2(TH1D* dataInput, TH1D* sigTemplate, TH1D* bkgTemplate, std::string prefix, Double_t& sigFrac, Double_t& sigFrac_err)
{
  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("Fisher's isolation [GeV]");
  data->Sumw2();
  scale = 1.0/(Double_t)data->Integral(0,1000); 
  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("Fisher's isolation [GeV]");
  signal_pos->Sumw2();
  scale = 1.0/(Double_t)signal_pos->Integral(0,1000); 
  cout << "scale for signal template = " << scale << endl;
  signal_pos->Scale(scale);


  background_pos = (TH1D*)bkgTemplate->Clone();
  background_pos->SetName("background_pos");
  background_pos->SetLineColor(4);
  background_pos->SetMarkerColor(4);
  background_pos->SetFillColor(4);
  background_pos->SetXTitle("Fisher's isolation [GeV]");
  background_pos->Sumw2();
  scale = 1.0/(Double_t)background_pos->Integral(0,1000); 
  cout << "scale for background template = " << scale << endl;
  background_pos->Scale(scale);



  TMinuit *gMinuit = new TMinuit(1);  //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);


  Double_t vstart = 0.5;
  Double_t step = 0.001;
  gMinuit->mnparm(0, "fsig", 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 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;
      gMinuit->GetParameter(0, fsig, fsigerr);  
      cout << "Fsig = " << fsig << " +- " << fsigerr << endl;

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

      data->Draw();
      TH1D* signal_display = (TH1D*)signal_pos->Clone();
      signal_display->SetName("signal_display");
      signal_display->Scale(fsig/signal_display->Integral(0,1000));
      signal_display->SetFillStyle(3001);
      signal_display->Draw("histsame");

      TH1D* background_display = (TH1D*)background_pos->Clone();
      background_display->SetName("background_display");
      background_display->Scale((1-fsig)/background_display->Integral(0,1000));
      background_display->SetFillStyle(3001);
      background_display->Draw("histsame");

      fit_result->Draw("histesame");

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

      TLegend* leg = new TLegend(0.2,0.6,0.4,0.9);
      leg->SetHeader(result);
      leg->SetFillColor(0);
      leg->SetFillStyle(0);
      leg->SetTextSize(0.045);
      leg->SetBorderSize(0);
      leg->AddEntry(data,"data");
      leg->AddEntry(fit_result,"fit");
      leg->AddEntry(signal_display,"signal template");
      leg->AddEntry(background_display,"background template");
      leg->Draw("same");

      std::string outputFile = prefix + ".eps";
      c1->Print(outputFile.data());

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

      outputFile = prefix + ".C";
      c1->Print(outputFile.data());
    }
    
  else{
    cout << "Fit failed!\n";
    sigFrac = 0;
    sigFrac_err = 0;
  }

  
  return;

}
예제 #7
0
void METJets()
{
//=========Macro generated from canvas: METJets/METJets
//=========  (Fri Nov  6 09:02:55 2015) by ROOT version6.02/05
   TCanvas *METJets = new TCanvas("METJets", "METJets",435,102,700,700);
   METJets->Range(-2.5,-6.939719,22.5,0.708446);
   METJets->SetFillColor(0);
   METJets->SetBorderMode(0);
   METJets->SetBorderSize(2);
   METJets->SetLogy();
   METJets->SetFrameBorderMode(0);
   METJets->SetFrameBorderMode(0);
   
   THStack *METJets = new THStack();
   METJets->SetName("METJets");
   METJets->SetTitle("METJets");
   
   TH1F *METJets_stack_3 = new TH1F("METJets_stack_3","METJets",20,0,20);
   METJets_stack_3->SetMinimum(6.684943e-07);
   METJets_stack_3->SetMaximum(0.8782728);
   METJets_stack_3->SetDirectory(0);
   METJets_stack_3->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   METJets_stack_3->SetLineColor(ci);
   METJets_stack_3->GetXaxis()->SetTitle("METJets");
   METJets_stack_3->GetXaxis()->SetLabelFont(42);
   METJets_stack_3->GetXaxis()->SetLabelSize(0.035);
   METJets_stack_3->GetXaxis()->SetTitleSize(0.035);
   METJets_stack_3->GetXaxis()->SetTitleFont(42);
   METJets_stack_3->GetYaxis()->SetTitle("Events/pb");
   METJets_stack_3->GetYaxis()->SetLabelFont(42);
   METJets_stack_3->GetYaxis()->SetLabelSize(0.035);
   METJets_stack_3->GetYaxis()->SetTitleSize(0.035);
   METJets_stack_3->GetYaxis()->SetTitleFont(42);
   METJets_stack_3->GetZaxis()->SetLabelFont(42);
   METJets_stack_3->GetZaxis()->SetLabelSize(0.035);
   METJets_stack_3->GetZaxis()->SetTitleSize(0.035);
   METJets_stack_3->GetZaxis()->SetTitleFont(42);
   METJets->SetHistogram(METJets_stack_3);
   
   
   TH1D *METJets11 = new TH1D("METJets11"," Number of jets in MET hemisphere",20,0,20);
   METJets11->SetBinContent(4,0.001250901);
   METJets11->SetBinContent(5,0.02882494);
   METJets11->SetBinError(4,0.001250901);
   METJets11->SetBinError(5,0.02638252);
   METJets11->SetEntries(4);

   ci = TColor::GetColor("#00cc00");
   METJets11->SetFillColor(ci);

   ci = TColor::GetColor("#00cc00");
   METJets11->SetLineColor(ci);

   ci = TColor::GetColor("#00cc00");
   METJets11->SetMarkerColor(ci);
   METJets11->SetMarkerStyle(22);
   METJets11->GetXaxis()->SetTitle("METJets");
   METJets11->GetXaxis()->SetLabelFont(42);
   METJets11->GetXaxis()->SetLabelSize(0.035);
   METJets11->GetXaxis()->SetTitleSize(0.035);
   METJets11->GetXaxis()->SetTitleFont(42);
   METJets11->GetYaxis()->SetTitle("Events/pb");
   METJets11->GetYaxis()->SetLabelFont(42);
   METJets11->GetYaxis()->SetLabelSize(0.035);
   METJets11->GetYaxis()->SetTitleSize(0.035);
   METJets11->GetYaxis()->SetTitleFont(42);
   METJets11->GetZaxis()->SetLabelFont(42);
   METJets11->GetZaxis()->SetLabelSize(0.035);
   METJets11->GetZaxis()->SetTitleSize(0.035);
   METJets11->GetZaxis()->SetTitleFont(42);
   METJets->Add(METJets,"");
   
   TH1D *METJets12 = new TH1D("METJets12"," Number of jets in MET hemisphere",20,0,20);
   METJets12->SetBinContent(1,0.1125815);
   METJets12->SetBinContent(2,0.4285217);
   METJets12->SetBinContent(3,0.3409504);
   METJets12->SetBinContent(4,0.1708964);
   METJets12->SetBinContent(5,0.05932811);
   METJets12->SetBinContent(6,0.02373303);
   METJets12->SetBinContent(7,0.006545923);
   METJets12->SetBinContent(8,0.002482997);
   METJets12->SetBinContent(9,0.0004501454);
   METJets12->SetBinContent(10,5.615768e-05);
   METJets12->SetBinContent(11,5.615768e-05);
   METJets12->SetBinContent(12,1.392893e-05);
   METJets12->SetBinError(1,0.007309092);
   METJets12->SetBinError(2,0.01328181);
   METJets12->SetBinError(3,0.01094448);
   METJets12->SetBinError(4,0.006993249);
   METJets12->SetBinError(5,0.003460026);
   METJets12->SetBinError(6,0.002212104);
   METJets12->SetBinError(7,0.0008953739);
   METJets12->SetBinError(8,0.0006170034);
   METJets12->SetBinError(9,0.0001016709);
   METJets12->SetBinError(10,3.448057e-05);
   METJets12->SetBinError(11,3.448057e-05);
   METJets12->SetBinError(12,1.392893e-05);
   METJets12->SetEntries(9534);

   ci = TColor::GetColor("#00ffff");
   METJets12->SetFillColor(ci);

   ci = TColor::GetColor("#00ffff");
   METJets12->SetLineColor(ci);

   ci = TColor::GetColor("#00ffff");
   METJets12->SetMarkerColor(ci);
   METJets12->SetMarkerStyle(20);
   METJets12->GetXaxis()->SetTitle("METJets");
   METJets12->GetXaxis()->SetLabelFont(42);
   METJets12->GetXaxis()->SetLabelSize(0.035);
   METJets12->GetXaxis()->SetTitleSize(0.035);
   METJets12->GetXaxis()->SetTitleFont(42);
   METJets12->GetYaxis()->SetTitle("Events/pb");
   METJets12->GetYaxis()->SetLabelFont(42);
   METJets12->GetYaxis()->SetLabelSize(0.035);
   METJets12->GetYaxis()->SetTitleSize(0.035);
   METJets12->GetYaxis()->SetTitleFont(42);
   METJets12->GetZaxis()->SetLabelFont(42);
   METJets12->GetZaxis()->SetLabelSize(0.035);
   METJets12->GetZaxis()->SetTitleSize(0.035);
   METJets12->GetZaxis()->SetTitleFont(42);
   METJets->Add(METJets,"");
   
   TH1D *METJets13 = new TH1D("METJets13"," Number of jets in MET hemisphere",20,0,20);
   METJets13->SetBinContent(1,0.03196155);
   METJets13->SetBinContent(2,0.1172069);
   METJets13->SetBinContent(3,0.0774148);
   METJets13->SetBinContent(4,0.03694924);
   METJets13->SetBinContent(5,0.01471217);
   METJets13->SetBinContent(6,0.00457922);
   METJets13->SetBinContent(7,0.001196242);
   METJets13->SetBinContent(8,0.0003010538);
   METJets13->SetBinContent(9,3.996704e-05);
   METJets13->SetBinContent(10,2.319189e-05);
   METJets13->SetBinContent(11,2.691694e-06);
   METJets13->SetBinError(1,0.001597341);
   METJets13->SetBinError(2,0.002788097);
   METJets13->SetBinError(3,0.002050992);
   METJets13->SetBinError(4,0.001252285);
   METJets13->SetBinError(5,0.000761537);
   METJets13->SetBinError(6,0.0003464749);
   METJets13->SetBinError(7,0.0001505212);
   METJets13->SetBinError(8,6.572956e-05);
   METJets13->SetBinError(9,1.412354e-05);
   METJets13->SetBinError(10,9.646618e-06);
   METJets13->SetBinError(11,2.691694e-06);
   METJets13->SetEntries(13132);

   ci = TColor::GetColor("#ffcc00");
   METJets13->SetFillColor(ci);

   ci = TColor::GetColor("#ffcc00");
   METJets13->SetLineColor(ci);

   ci = TColor::GetColor("#ffcc00");
   METJets13->SetMarkerColor(ci);
   METJets13->SetMarkerStyle(21);
   METJets13->GetXaxis()->SetTitle("METJets");
   METJets13->GetXaxis()->SetLabelFont(42);
   METJets13->GetXaxis()->SetLabelSize(0.035);
   METJets13->GetXaxis()->SetTitleSize(0.035);
   METJets13->GetXaxis()->SetTitleFont(42);
   METJets13->GetYaxis()->SetTitle("Events/pb");
   METJets13->GetYaxis()->SetLabelFont(42);
   METJets13->GetYaxis()->SetLabelSize(0.035);
   METJets13->GetYaxis()->SetTitleSize(0.035);
   METJets13->GetYaxis()->SetTitleFont(42);
   METJets13->GetZaxis()->SetLabelFont(42);
   METJets13->GetZaxis()->SetLabelSize(0.035);
   METJets13->GetZaxis()->SetTitleSize(0.035);
   METJets13->GetZaxis()->SetTitleFont(42);
   METJets->Add(METJets,"");
   
   TH1D *METJets14 = new TH1D("METJets14"," Number of jets in MET hemisphere",20,0,20);
   METJets14->SetBinContent(1,0.001156843);
   METJets14->SetBinContent(2,0.007372947);
   METJets14->SetBinContent(3,0.009563237);
   METJets14->SetBinContent(4,0.007326674);
   METJets14->SetBinContent(5,0.003763597);
   METJets14->SetBinContent(6,0.002066893);
   METJets14->SetBinContent(7,0.0008175025);
   METJets14->SetBinContent(8,0.0003084915);
   METJets14->SetBinContent(9,0.0001233966);
   METJets14->SetBinContent(10,3.084915e-05);
   METJets14->SetBinContent(11,1.542458e-05);
   METJets14->SetBinError(1,0.0001335807);
   METJets14->SetBinError(2,0.0003372308);
   METJets14->SetBinError(3,0.0003840688);
   METJets14->SetBinError(4,0.0003361708);
   METJets14->SetBinError(5,0.0002409396);
   METJets14->SetBinError(6,0.0001785524);
   METJets14->SetBinError(7,0.0001122926);
   METJets14->SetBinError(8,6.89808e-05);
   METJets14->SetBinError(9,4.362729e-05);
   METJets14->SetBinError(10,2.181364e-05);
   METJets14->SetBinError(11,1.542458e-05);
   METJets14->SetEntries(2110);

   ci = TColor::GetColor("#ff0000");
   METJets14->SetFillColor(ci);

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

   ci = TColor::GetColor("#ff0000");
   METJets14->SetMarkerColor(ci);
   METJets14->SetMarkerStyle(20);
   METJets14->GetXaxis()->SetTitle("METJets");
   METJets14->GetXaxis()->SetLabelFont(42);
   METJets14->GetXaxis()->SetLabelSize(0.035);
   METJets14->GetXaxis()->SetTitleSize(0.035);
   METJets14->GetXaxis()->SetTitleFont(42);
   METJets14->GetYaxis()->SetTitle("Events/pb");
   METJets14->GetYaxis()->SetLabelFont(42);
   METJets14->GetYaxis()->SetLabelSize(0.035);
   METJets14->GetYaxis()->SetTitleSize(0.035);
   METJets14->GetYaxis()->SetTitleFont(42);
   METJets14->GetZaxis()->SetLabelFont(42);
   METJets14->GetZaxis()->SetLabelSize(0.035);
   METJets14->GetZaxis()->SetTitleSize(0.035);
   METJets14->GetZaxis()->SetTitleFont(42);
   METJets->Add(METJets,"");
   
   TH1D *METJets15 = new TH1D("METJets15"," Number of jets in MET hemisphere",20,0,20);
   METJets15->SetBinContent(3,1.677165e-05);
   METJets15->SetBinContent(4,1.677165e-05);
   METJets15->SetBinContent(5,6.708659e-05);
   METJets15->SetBinContent(6,5.031494e-05);
   METJets15->SetBinContent(7,8.385824e-05);
   METJets15->SetBinContent(8,3.35433e-05);
   METJets15->SetBinContent(10,1.677165e-05);
   METJets15->SetBinError(3,1.677165e-05);
   METJets15->SetBinError(4,1.677165e-05);
   METJets15->SetBinError(5,3.35433e-05);
   METJets15->SetBinError(6,2.904935e-05);
   METJets15->SetBinError(7,3.750254e-05);
   METJets15->SetBinError(8,2.371869e-05);
   METJets15->SetBinError(10,1.677165e-05);
   METJets15->SetEntries(17);

   ci = TColor::GetColor("#0000ff");
   METJets15->SetFillColor(ci);

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

   ci = TColor::GetColor("#0000ff");
   METJets15->SetMarkerColor(ci);
   METJets15->SetMarkerStyle(21);
   METJets15->GetXaxis()->SetTitle("METJets");
   METJets15->GetXaxis()->SetLabelFont(42);
   METJets15->GetXaxis()->SetLabelSize(0.035);
   METJets15->GetXaxis()->SetTitleSize(0.035);
   METJets15->GetXaxis()->SetTitleFont(42);
   METJets15->GetYaxis()->SetTitle("Events/pb");
   METJets15->GetYaxis()->SetLabelFont(42);
   METJets15->GetYaxis()->SetLabelSize(0.035);
   METJets15->GetYaxis()->SetTitleSize(0.035);
   METJets15->GetYaxis()->SetTitleFont(42);
   METJets15->GetZaxis()->SetLabelFont(42);
   METJets15->GetZaxis()->SetLabelSize(0.035);
   METJets15->GetZaxis()->SetTitleSize(0.035);
   METJets15->GetZaxis()->SetTitleFont(42);
   METJets->Add(METJets,"");
   METJets->Draw("nostack");
   
   TPaveText *pt = new TPaveText(0.3872701,0.94,0.6127299,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   TText *AText = pt->AddText("METJets");
   pt->Draw();
   
   TLegend *leg = new TLegend(0.54023,0.639881,0.938218,0.924107,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextSize(0.034965);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("METJets","METJets_QCD","lp");

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

   ci = TColor::GetColor("#00cc00");
   entry->SetMarkerColor(ci);
   entry->SetMarkerStyle(22);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("METJets","METJets_WJetsToLNu","lp");

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

   ci = TColor::GetColor("#00ffff");
   entry->SetMarkerColor(ci);
   entry->SetMarkerStyle(20);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("METJets","METJets_ZJetsToNuNu","lp");

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

   ci = TColor::GetColor("#ffcc00");
   entry->SetMarkerColor(ci);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("METJets","METJets_signal","lp");

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

   ci = TColor::GetColor("#ff0000");
   entry->SetMarkerColor(ci);
   entry->SetMarkerStyle(20);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("METJets","METJets_ttbar","lp");

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

   ci = TColor::GetColor("#0000ff");
   entry->SetMarkerColor(ci);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   METJets->Modified();
   METJets->cd();
   METJets->SetSelected(METJets);
}
void LCTX_2016B_June22all_sameYrange()
{
//=========Macro generated from canvas: LCTX/LCTX
//=========  (Fri Aug  5 08:12:16 2016) by ROOT version6.06/01
   TCanvas *LCTX = new TCanvas("LCTX", "LCTX",0,0,500,500);
   gStyle->SetOptStat(0);
   LCTX->SetHighLightColor(2);
   LCTX->Range(-125,-2.848556,125,2.626708);
   LCTX->SetFillColor(0);
   LCTX->SetBorderMode(0);
   LCTX->SetBorderSize(2);
   LCTX->SetLogy();
   LCTX->SetFrameBorderMode(0);
   LCTX->SetFrameBorderMode(0);
   
   TH1D *LCTX_1__43 = new TH1D("LCTX_1__43","LCTX",100,-100,100);
   LCTX_1__43->SetBinContent(0,384.5084);
   LCTX_1__43->SetBinContent(39,0.0007169384);
   LCTX_1__43->SetBinContent(41,0.01003714);
   LCTX_1__43->SetBinContent(42,0.01720652);
   LCTX_1__43->SetBinContent(43,0.05018569);
   LCTX_1__43->SetBinContent(44,0.5054416);
   LCTX_1__43->SetBinContent(45,1.948639);
   LCTX_1__43->SetBinContent(46,4.235672);
   LCTX_1__43->SetBinContent(47,8.363803);
   LCTX_1__43->SetBinContent(48,11.57712);
   LCTX_1__43->SetBinContent(49,11.51905);
   LCTX_1__43->SetBinContent(50,12.02879);
   LCTX_1__43->SetBinContent(51,12.01876);
   LCTX_1__43->SetBinContent(52,11.53984);
   LCTX_1__43->SetBinContent(53,11.428);
   LCTX_1__43->SetBinContent(54,8.141552);
   LCTX_1__43->SetBinContent(55,4.112359);
   LCTX_1__43->SetBinContent(56,1.841815);
   LCTX_1__43->SetBinContent(57,0.4932536);
   LCTX_1__43->SetBinContent(58,0.06810915);
   LCTX_1__43->SetBinContent(59,0.04803487);
   LCTX_1__43->SetBinContent(60,0.02365897);
   LCTX_1__43->SetBinContent(61,0.01935734);
   LCTX_1__43->SetBinContent(62,0.002867754);
   LCTX_1__43->SetBinContent(63,0.002867754);
   LCTX_1__43->SetBinContent(64,0.0007169384);
   LCTX_1__43->SetBinContent(65,0.0007169384);
   LCTX_1__43->SetBinContent(66,0.0007169384);
   LCTX_1__43->SetBinContent(67,0.0007169384);
   LCTX_1__43->SetMinimum(0.005);
   LCTX_1__43->SetMaximum(120);
   LCTX_1__43->SetEntries(675802);
   LCTX_1__43->SetStats(0);

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

   ci = TColor::GetColor("#ff00ff");
   LCTX_1__43->SetMarkerColor(ci);
   LCTX_1__43->GetXaxis()->SetTitle("cm");
   LCTX_1__43->GetYaxis()->SetTitle("scaled number of entries");
   LCTX_1__43->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("LCTX_1","ME11A: mean:-0.0cm;RMS:5.4cm","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("LCTX_2","ME11B: mean:-0.1cm;RMS:8.4cm","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("LCTX_3","ME12+13: mean:-0.1cm;RMS:17.6cm","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("LCTX_4","ME2: mean:-0.1cm;RMS:23.2cm","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("LCTX_5","ME3: mean:-0.2cm;RMS:24.0cm","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("LCTX_6","ME4: mean:-0.2cm;RMS:24.3cm","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 *LCTX_2__44 = new TH1D("LCTX_2__44","LCTX",100,-100,100);
   LCTX_2__44->SetBinContent(0,278.7056);
   LCTX_2__44->SetBinContent(38,0.0003194909);
   LCTX_2__44->SetBinContent(39,0.02523978);
   LCTX_2__44->SetBinContent(40,0.1178921);
   LCTX_2__44->SetBinContent(41,0.333229);
   LCTX_2__44->SetBinContent(42,1.216941);
   LCTX_2__44->SetBinContent(43,2.476374);
   LCTX_2__44->SetBinContent(44,4.080857);
   LCTX_2__44->SetBinContent(45,5.435498);
   LCTX_2__44->SetBinContent(46,6.970332);
   LCTX_2__44->SetBinContent(47,7.301325);
   LCTX_2__44->SetBinContent(48,7.282794);
   LCTX_2__44->SetBinContent(49,7.626566);
   LCTX_2__44->SetBinContent(50,7.370654);
   LCTX_2__44->SetBinContent(51,7.534553);
   LCTX_2__44->SetBinContent(52,7.548611);
   LCTX_2__44->SetBinContent(53,7.32273);
   LCTX_2__44->SetBinContent(54,7.342219);
   LCTX_2__44->SetBinContent(55,6.974805);
   LCTX_2__44->SetBinContent(56,5.285337);
   LCTX_2__44->SetBinContent(57,3.885009);
   LCTX_2__44->SetBinContent(58,2.388194);
   LCTX_2__44->SetBinContent(59,1.042499);
   LCTX_2__44->SetBinContent(60,0.2993629);
   LCTX_2__44->SetBinContent(61,0.1188506);
   LCTX_2__44->SetBinContent(62,0.01916945);
   LCTX_2__44->SetBinContent(63,0.0006389817);
   LCTX_2__44->SetEntries(1185341);
   LCTX_2__44->SetStats(0);

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

   ci = TColor::GetColor("#ff9999");
   LCTX_2__44->SetMarkerColor(ci);
   LCTX_2__44->GetXaxis()->SetTitle("cm");
   LCTX_2__44->GetYaxis()->SetTitle("scaled number of entries");
   LCTX_2__44->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("LCTX_1","ME11A: mean:-0.0cm;RMS:5.4cm","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("LCTX_2","ME11B: mean:-0.1cm;RMS:8.4cm","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("LCTX_3","ME12+13: mean:-0.1cm;RMS:17.6cm","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("LCTX_4","ME2: mean:-0.1cm;RMS:23.2cm","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("LCTX_5","ME3: mean:-0.2cm;RMS:24.0cm","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("LCTX_6","ME4: mean:-0.2cm;RMS:24.3cm","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 *LCTX_3__45 = new TH1D("LCTX_3__45","LCTX",100,-100,100);
   LCTX_3__45->SetBinContent(0,81.70947);
   LCTX_3__45->SetBinContent(29,0.001399215);
   LCTX_3__45->SetBinContent(30,0.01026091);
   LCTX_3__45->SetBinContent(31,0.0382452);
   LCTX_3__45->SetBinContent(32,0.1184668);
   LCTX_3__45->SetBinContent(33,0.3815192);
   LCTX_3__45->SetBinContent(34,0.8185405);
   LCTX_3__45->SetBinContent(35,1.165079);
   LCTX_3__45->SetBinContent(36,1.8409);
   LCTX_3__45->SetBinContent(37,2.562428);
   LCTX_3__45->SetBinContent(38,3.139371);
   LCTX_3__45->SetBinContent(39,3.171087);
   LCTX_3__45->SetBinContent(40,3.272296);
   LCTX_3__45->SetBinContent(41,3.369309);
   LCTX_3__45->SetBinContent(42,3.258771);
   LCTX_3__45->SetBinContent(43,3.390297);
   LCTX_3__45->SetBinContent(44,3.301214);
   LCTX_3__45->SetBinContent(45,3.463989);
   LCTX_3__45->SetBinContent(46,3.452329);
   LCTX_3__45->SetBinContent(47,3.325933);
   LCTX_3__45->SetBinContent(48,3.271364);
   LCTX_3__45->SetBinContent(49,3.196739);
   LCTX_3__45->SetBinContent(50,3.890749);
   LCTX_3__45->SetBinContent(51,2.881449);
   LCTX_3__45->SetBinContent(52,3.613238);
   LCTX_3__45->SetBinContent(53,3.407087);
   LCTX_3__45->SetBinContent(54,3.403356);
   LCTX_3__45->SetBinContent(55,3.291419);
   LCTX_3__45->SetBinContent(56,3.200937);
   LCTX_3__45->SetBinContent(57,3.49757);
   LCTX_3__45->SetBinContent(58,3.154762);
   LCTX_3__45->SetBinContent(59,3.447198);
   LCTX_3__45->SetBinContent(60,3.367909);
   LCTX_3__45->SetBinContent(61,3.405688);
   LCTX_3__45->SetBinContent(62,3.272296);
   LCTX_3__45->SetBinContent(63,3.068478);
   LCTX_3__45->SetBinContent(64,2.526515);
   LCTX_3__45->SetBinContent(65,1.721034);
   LCTX_3__45->SetBinContent(66,1.135696);
   LCTX_3__45->SetBinContent(67,0.7219947);
   LCTX_3__45->SetBinContent(68,0.3185545);
   LCTX_3__45->SetBinContent(69,0.09234816);
   LCTX_3__45->SetBinContent(70,0.02751789);
   LCTX_3__45->SetBinContent(71,0.004197644);
   LCTX_3__45->SetBinContent(72,0.0004664049);
   LCTX_3__45->SetEntries(389596);
   LCTX_3__45->SetStats(0);
   LCTX_3__45->GetXaxis()->SetTitle("cm");
   LCTX_3__45->GetYaxis()->SetTitle("scaled number of entries");
   LCTX_3__45->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("LCTX_1","ME11A: mean:-0.0cm;RMS:5.4cm","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("LCTX_2","ME11B: mean:-0.1cm;RMS:8.4cm","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("LCTX_3","ME12+13: mean:-0.1cm;RMS:17.6cm","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("LCTX_4","ME2: mean:-0.1cm;RMS:23.2cm","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("LCTX_5","ME3: mean:-0.2cm;RMS:24.0cm","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("LCTX_6","ME4: mean:-0.2cm;RMS:24.3cm","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 *LCTX_4__46 = new TH1D("LCTX_4__46","LCTX",100,-100,100);
   LCTX_4__46->SetBinContent(0,200.9297);
   LCTX_4__46->SetBinContent(19,0.0003183254);
   LCTX_4__46->SetBinContent(20,0.002228277);
   LCTX_4__46->SetBinContent(21,0.007958134);
   LCTX_4__46->SetBinContent(22,0.01814455);
   LCTX_4__46->SetBinContent(23,0.05904935);
   LCTX_4__46->SetBinContent(24,0.1626643);
   LCTX_4__46->SetBinContent(25,0.2226686);
   LCTX_4__46->SetBinContent(26,0.3784888);
   LCTX_4__46->SetBinContent(27,0.4620493);
   LCTX_4__46->SetBinContent(28,0.5610484);
   LCTX_4__46->SetBinContent(29,0.6859911);
   LCTX_4__46->SetBinContent(30,0.8537486);
   LCTX_4__46->SetBinContent(31,0.9782138);
   LCTX_4__46->SetBinContent(32,1.264547);
   LCTX_4__46->SetBinContent(33,1.377712);
   LCTX_4__46->SetBinContent(34,1.540695);
   LCTX_4__46->SetBinContent(35,1.908997);
   LCTX_4__46->SetBinContent(36,2.184349);
   LCTX_4__46->SetBinContent(37,2.387758);
   LCTX_4__46->SetBinContent(38,2.491055);
   LCTX_4__46->SetBinContent(39,2.733937);
   LCTX_4__46->SetBinContent(40,2.702582);
   LCTX_4__46->SetBinContent(41,2.72582);
   LCTX_4__46->SetBinContent(42,2.631437);
   LCTX_4__46->SetBinContent(43,2.68778);
   LCTX_4__46->SetBinContent(44,2.712291);
   LCTX_4__46->SetBinContent(45,2.751127);
   LCTX_4__46->SetBinContent(46,2.692714);
   LCTX_4__46->SetBinContent(47,2.757812);
   LCTX_4__46->SetBinContent(48,2.736325);
   LCTX_4__46->SetBinContent(49,2.653878);
   LCTX_4__46->SetBinContent(50,3.206969);
   LCTX_4__46->SetBinContent(51,2.359746);
   LCTX_4__46->SetBinContent(52,2.759722);
   LCTX_4__46->SetBinContent(53,2.841531);
   LCTX_4__46->SetBinContent(54,2.662473);
   LCTX_4__46->SetBinContent(55,2.715156);
   LCTX_4__46->SetBinContent(56,2.707675);
   LCTX_4__46->SetBinContent(57,2.643533);
   LCTX_4__46->SetBinContent(58,2.575093);
   LCTX_4__46->SetBinContent(59,2.644488);
   LCTX_4__46->SetBinContent(60,2.662155);
   LCTX_4__46->SetBinContent(61,2.643692);
   LCTX_4__46->SetBinContent(62,2.610586);
   LCTX_4__46->SetBinContent(63,2.578595);
   LCTX_4__46->SetBinContent(64,2.346217);
   LCTX_4__46->SetBinContent(65,2.166841);
   LCTX_4__46->SetBinContent(66,1.919343);
   LCTX_4__46->SetBinContent(67,1.591468);
   LCTX_4__46->SetBinContent(68,1.393469);
   LCTX_4__46->SetBinContent(69,1.245289);
   LCTX_4__46->SetBinContent(70,1.005271);
   LCTX_4__46->SetBinContent(71,0.8602743);
   LCTX_4__46->SetBinContent(72,0.6673691);
   LCTX_4__46->SetBinContent(73,0.5397206);
   LCTX_4__46->SetBinContent(74,0.4701665);
   LCTX_4__46->SetBinContent(75,0.3549328);
   LCTX_4__46->SetBinContent(76,0.257366);
   LCTX_4__46->SetBinContent(77,0.1411773);
   LCTX_4__46->SetBinContent(78,0.06923576);
   LCTX_4__46->SetBinContent(79,0.01782622);
   LCTX_4__46->SetBinContent(80,0.008435622);
   LCTX_4__46->SetBinContent(81,0.0006366507);
   LCTX_4__46->SetBinContent(82,0.0001591627);
   LCTX_4__46->SetEntries(1890705);
   LCTX_4__46->SetStats(0);

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

   ci = TColor::GetColor("#ff0000");
   LCTX_4__46->SetMarkerColor(ci);
   LCTX_4__46->GetXaxis()->SetTitle("cm");
   LCTX_4__46->GetYaxis()->SetTitle("scaled number of entries");
   LCTX_4__46->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("LCTX_1","ME11A: mean:-0.0cm;RMS:5.4cm","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("LCTX_2","ME11B: mean:-0.1cm;RMS:8.4cm","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("LCTX_3","ME12+13: mean:-0.1cm;RMS:17.6cm","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("LCTX_4","ME2: mean:-0.1cm;RMS:23.2cm","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("LCTX_5","ME3: mean:-0.2cm;RMS:24.0cm","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("LCTX_6","ME4: mean:-0.2cm;RMS:24.3cm","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 *LCTX_5__47 = new TH1D("LCTX_5__47","LCTX",100,-100,100);
   LCTX_5__47->SetBinContent(0,156.985);
   LCTX_5__47->SetBinContent(19,0.0003685155);
   LCTX_5__47->SetBinContent(20,0.001842578);
   LCTX_5__47->SetBinContent(21,0.008475857);
   LCTX_5__47->SetBinContent(22,0.01897855);
   LCTX_5__47->SetBinContent(23,0.08162619);
   LCTX_5__47->SetBinContent(24,0.1719125);
   LCTX_5__47->SetBinContent(25,0.278045);
   LCTX_5__47->SetBinContent(26,0.415317);
   LCTX_5__47->SetBinContent(27,0.5096569);
   LCTX_5__47->SetBinContent(28,0.6279504);
   LCTX_5__47->SetBinContent(29,0.7749881);
   LCTX_5__47->SetBinContent(30,0.9870688);
   LCTX_5__47->SetBinContent(31,1.135212);
   LCTX_5__47->SetBinContent(32,1.388382);
   LCTX_5__47->SetBinContent(33,1.603042);
   LCTX_5__47->SetBinContent(34,1.760214);
   LCTX_5__47->SetBinContent(35,2.100538);
   LCTX_5__47->SetBinContent(36,2.415988);
   LCTX_5__47->SetBinContent(37,2.564868);
   LCTX_5__47->SetBinContent(38,2.508854);
   LCTX_5__47->SetBinContent(39,2.700113);
   LCTX_5__47->SetBinContent(40,2.585136);
   LCTX_5__47->SetBinContent(41,2.567632);
   LCTX_5__47->SetBinContent(42,2.542757);
   LCTX_5__47->SetBinContent(43,2.68095);
   LCTX_5__47->SetBinContent(44,2.59527);
   LCTX_5__47->SetBinContent(45,2.605405);
   LCTX_5__47->SetBinContent(46,2.531149);
   LCTX_5__47->SetBinContent(47,2.55934);
   LCTX_5__47->SetBinContent(48,2.526727);
   LCTX_5__47->SetBinContent(49,2.453761);
   LCTX_5__47->SetBinContent(50,3.010772);
   LCTX_5__47->SetBinContent(51,2.170556);
   LCTX_5__47->SetBinContent(52,2.476424);
   LCTX_5__47->SetBinContent(53,2.568369);
   LCTX_5__47->SetBinContent(54,2.48748);
   LCTX_5__47->SetBinContent(55,2.538335);
   LCTX_5__47->SetBinContent(56,2.604483);
   LCTX_5__47->SetBinContent(57,2.559156);
   LCTX_5__47->SetBinContent(58,2.557313);
   LCTX_5__47->SetBinContent(59,2.552523);
   LCTX_5__47->SetBinContent(60,2.563394);
   LCTX_5__47->SetBinContent(61,2.552154);
   LCTX_5__47->SetBinContent(62,2.549575);
   LCTX_5__47->SetBinContent(63,2.584952);
   LCTX_5__47->SetBinContent(64,2.546074);
   LCTX_5__47->SetBinContent(65,2.260658);
   LCTX_5__47->SetBinContent(66,2.08893);
   LCTX_5__47->SetBinContent(67,1.744184);
   LCTX_5__47->SetBinContent(68,1.528787);
   LCTX_5__47->SetBinContent(69,1.359822);
   LCTX_5__47->SetBinContent(70,1.132264);
   LCTX_5__47->SetBinContent(71,0.9898327);
   LCTX_5__47->SetBinContent(72,0.7617216);
   LCTX_5__47->SetBinContent(73,0.6161579);
   LCTX_5__47->SetBinContent(74,0.5116838);
   LCTX_5__47->SetBinContent(75,0.4127374);
   LCTX_5__47->SetBinContent(76,0.2935226);
   LCTX_5__47->SetBinContent(77,0.1571719);
   LCTX_5__47->SetBinContent(78,0.0902863);
   LCTX_5__47->SetBinContent(79,0.0226637);
   LCTX_5__47->SetBinContent(80,0.00571199);
   LCTX_5__47->SetBinContent(81,0.000737031);
   LCTX_5__47->SetEntries(1394704);
   LCTX_5__47->SetStats(0);

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

   ci = TColor::GetColor("#00ff00");
   LCTX_5__47->SetMarkerColor(ci);
   LCTX_5__47->GetXaxis()->SetTitle("cm");
   LCTX_5__47->GetYaxis()->SetTitle("scaled number of entries");
   LCTX_5__47->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("LCTX_1","ME11A: mean:-0.0cm;RMS:5.4cm","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("LCTX_2","ME11B: mean:-0.1cm;RMS:8.4cm","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("LCTX_3","ME12+13: mean:-0.1cm;RMS:17.6cm","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("LCTX_4","ME2: mean:-0.1cm;RMS:23.2cm","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("LCTX_5","ME3: mean:-0.2cm;RMS:24.0cm","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("LCTX_6","ME4: mean:-0.2cm;RMS:24.3cm","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 *LCTX_6__48 = new TH1D("LCTX_6__48","LCTX",100,-100,100);
   LCTX_6__48->SetBinContent(0,128.1645);
   LCTX_6__48->SetBinContent(20,0.001034957);
   LCTX_6__48->SetBinContent(21,0.003932835);
   LCTX_6__48->SetBinContent(22,0.0190432);
   LCTX_6__48->SetBinContent(23,0.08445247);
   LCTX_6__48->SetBinContent(24,0.1686979);
   LCTX_6__48->SetBinContent(25,0.2908228);
   LCTX_6__48->SetBinContent(26,0.4259882);
   LCTX_6__48->SetBinContent(27,0.5427313);
   LCTX_6__48->SetBinContent(28,0.6774827);
   LCTX_6__48->SetBinContent(29,0.9031032);
   LCTX_6__48->SetBinContent(30,1.072836);
   LCTX_6__48->SetBinContent(31,1.255195);
   LCTX_6__48->SetBinContent(32,1.42617);
   LCTX_6__48->SetBinContent(33,1.67456);
   LCTX_6__48->SetBinContent(34,1.84243);
   LCTX_6__48->SetBinContent(35,2.206321);
   LCTX_6__48->SetBinContent(36,2.382056);
   LCTX_6__48->SetBinContent(37,2.473547);
   LCTX_6__48->SetBinContent(38,2.447259);
   LCTX_6__48->SetBinContent(39,2.568556);
   LCTX_6__48->SetBinContent(40,2.439186);
   LCTX_6__48->SetBinContent(41,2.543303);
   LCTX_6__48->SetBinContent(42,2.405653);
   LCTX_6__48->SetBinContent(43,2.591532);
   LCTX_6__48->SetBinContent(44,2.491141);
   LCTX_6__48->SetBinContent(45,2.57787);
   LCTX_6__48->SetBinContent(46,2.435046);
   LCTX_6__48->SetBinContent(47,2.57166);
   LCTX_6__48->SetBinContent(48,2.574765);
   LCTX_6__48->SetBinContent(49,2.456159);
   LCTX_6__48->SetBinContent(50,2.990404);
   LCTX_6__48->SetBinContent(51,2.138842);
   LCTX_6__48->SetBinContent(52,2.558206);
   LCTX_6__48->SetBinContent(53,2.556343);
   LCTX_6__48->SetBinContent(54,2.433597);
   LCTX_6__48->SetBinContent(55,2.573523);
   LCTX_6__48->SetBinContent(56,2.559034);
   LCTX_6__48->SetBinContent(57,2.638312);
   LCTX_6__48->SetBinContent(58,2.435253);
   LCTX_6__48->SetBinContent(59,2.574765);
   LCTX_6__48->SetBinContent(60,2.533367);
   LCTX_6__48->SetBinContent(61,2.532125);
   LCTX_6__48->SetBinContent(62,2.491969);
   LCTX_6__48->SetBinContent(63,2.537093);
   LCTX_6__48->SetBinContent(64,2.429664);
   LCTX_6__48->SetBinContent(65,2.38868);
   LCTX_6__48->SetBinContent(66,2.152503);
   LCTX_6__48->SetBinContent(67,1.839946);
   LCTX_6__48->SetBinContent(68,1.542913);
   LCTX_6__48->SetBinContent(69,1.398226);
   LCTX_6__48->SetBinContent(70,1.152114);
   LCTX_6__48->SetBinContent(71,1.029161);
   LCTX_6__48->SetBinContent(72,0.8025054);
   LCTX_6__48->SetBinContent(73,0.6667191);
   LCTX_6__48->SetBinContent(74,0.5137525);
   LCTX_6__48->SetBinContent(75,0.4212274);
   LCTX_6__48->SetBinContent(76,0.2817152);
   LCTX_6__48->SetBinContent(77,0.1637301);
   LCTX_6__48->SetBinContent(78,0.08114061);
   LCTX_6__48->SetBinContent(79,0.02463197);
   LCTX_6__48->SetBinContent(80,0.004967792);
   LCTX_6__48->SetBinContent(81,0.001034957);
   LCTX_6__48->SetEntries(1102290);
   LCTX_6__48->SetStats(0);

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

   ci = TColor::GetColor("#0000ff");
   LCTX_6__48->SetMarkerColor(ci);
   LCTX_6__48->GetXaxis()->SetTitle("cm");
   LCTX_6__48->GetYaxis()->SetTitle("scaled number of entries");
   LCTX_6__48->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("LCTX_1","ME11A: mean:-0.0cm;RMS:5.4cm","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("LCTX_2","ME11B: mean:-0.1cm;RMS:8.4cm","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("LCTX_3","ME12+13: mean:-0.1cm;RMS:17.6cm","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("LCTX_4","ME2: mean:-0.1cm;RMS:23.2cm","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("LCTX_5","ME3: mean:-0.2cm;RMS:24.0cm","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("LCTX_6","ME4: mean:-0.2cm;RMS:24.3cm","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.945,0.1469355,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(1);
   pt->SetFillColor(0);
   TText *AText = pt->AddText("LCTX");
   pt->Draw();
   LCTX->Modified();
   LCTX->cd();
   LCTX->SetSelected(LCTX);
}
void DarkSusy_mH_125_mGammaD_2000_cT_10_LHE_dimuon_m_fake()
{
//=========Macro generated from canvas: cnv/cnv
//=========  (Sun May 24 15:17:56 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(-26.5625,-0.008809844,129.6875,0.05895819);
   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_dimuon_m_fake_dummy116 = new TH1F("h_dimuon_m_fake_dummy116","h_dimuon_m_fake_dummy",125,0,125);
   h_dimuon_m_fake_dummy116->SetMaximum(0.05421443);
   h_dimuon_m_fake_dummy116->SetLineStyle(0);
   h_dimuon_m_fake_dummy116->SetMarkerStyle(20);
   h_dimuon_m_fake_dummy116->GetXaxis()->SetTitle("Mass of Fake #mu#mu [GeV]");
   h_dimuon_m_fake_dummy116->GetXaxis()->SetLabelFont(42);
   h_dimuon_m_fake_dummy116->GetXaxis()->SetLabelOffset(0.007);
   h_dimuon_m_fake_dummy116->GetXaxis()->SetTitleSize(0.06);
   h_dimuon_m_fake_dummy116->GetXaxis()->SetTitleOffset(0.95);
   h_dimuon_m_fake_dummy116->GetXaxis()->SetTitleFont(42);
   h_dimuon_m_fake_dummy116->GetYaxis()->SetTitle("Fraction of events / 1 GeV");
   h_dimuon_m_fake_dummy116->GetYaxis()->SetNdivisions(508);
   h_dimuon_m_fake_dummy116->GetYaxis()->SetLabelFont(42);
   h_dimuon_m_fake_dummy116->GetYaxis()->SetLabelOffset(0.007);
   h_dimuon_m_fake_dummy116->GetYaxis()->SetTitleSize(0.06);
   h_dimuon_m_fake_dummy116->GetYaxis()->SetTitleOffset(1.35);
   h_dimuon_m_fake_dummy116->GetYaxis()->SetTitleFont(42);
   h_dimuon_m_fake_dummy116->GetZaxis()->SetLabelFont(42);
   h_dimuon_m_fake_dummy116->GetZaxis()->SetLabelOffset(0.007);
   h_dimuon_m_fake_dummy116->GetZaxis()->SetTitleSize(0.06);
   h_dimuon_m_fake_dummy116->GetZaxis()->SetTitleFont(42);
   h_dimuon_m_fake_dummy116->Draw("");
   
   TH1F *h_dimuon_m_fake_0117 = new TH1F("h_dimuon_m_fake_0117","h_dimuon_m_fake_0",125,0,125);
   h_dimuon_m_fake_0117->SetBinContent(1,0.001193765);
   h_dimuon_m_fake_0117->SetBinContent(2,0.003418793);
   h_dimuon_m_fake_0117->SetBinContent(3,0.005868823);
   h_dimuon_m_fake_0117->SetBinContent(4,0.007793847);
   h_dimuon_m_fake_0117->SetBinContent(5,0.01025013);
   h_dimuon_m_fake_0117->SetBinContent(6,0.01258141);
   h_dimuon_m_fake_0117->SetBinContent(7,0.01408143);
   h_dimuon_m_fake_0117->SetBinContent(8,0.01711896);
   h_dimuon_m_fake_0117->SetBinContent(9,0.01928774);
   h_dimuon_m_fake_0117->SetBinContent(10,0.02063776);
   h_dimuon_m_fake_0117->SetBinContent(11,0.02268153);
   h_dimuon_m_fake_0117->SetBinContent(12,0.0239628);
   h_dimuon_m_fake_0117->SetBinContent(13,0.02550657);
   h_dimuon_m_fake_0117->SetBinContent(14,0.02655658);
   h_dimuon_m_fake_0117->SetBinContent(15,0.02669408);
   h_dimuon_m_fake_0117->SetBinContent(16,0.02803785);
   h_dimuon_m_fake_0117->SetBinContent(17,0.02936287);
   h_dimuon_m_fake_0117->SetBinContent(18,0.0283941);
   h_dimuon_m_fake_0117->SetBinContent(19,0.03011913);
   h_dimuon_m_fake_0117->SetBinContent(20,0.02869411);
   h_dimuon_m_fake_0117->SetBinContent(21,0.02987537);
   h_dimuon_m_fake_0117->SetBinContent(22,0.02950662);
   h_dimuon_m_fake_0117->SetBinContent(23,0.02854411);
   h_dimuon_m_fake_0117->SetBinContent(24,0.02812535);
   h_dimuon_m_fake_0117->SetBinContent(25,0.02756909);
   h_dimuon_m_fake_0117->SetBinContent(26,0.02610658);
   h_dimuon_m_fake_0117->SetBinContent(27,0.02502531);
   h_dimuon_m_fake_0117->SetBinContent(28,0.02491906);
   h_dimuon_m_fake_0117->SetBinContent(29,0.02488781);
   h_dimuon_m_fake_0117->SetBinContent(30,0.02330654);
   h_dimuon_m_fake_0117->SetBinContent(31,0.02198778);
   h_dimuon_m_fake_0117->SetBinContent(32,0.02102526);
   h_dimuon_m_fake_0117->SetBinContent(33,0.02067526);
   h_dimuon_m_fake_0117->SetBinContent(34,0.01935024);
   h_dimuon_m_fake_0117->SetBinContent(35,0.01845648);
   h_dimuon_m_fake_0117->SetBinContent(36,0.01780647);
   h_dimuon_m_fake_0117->SetBinContent(37,0.01737522);
   h_dimuon_m_fake_0117->SetBinContent(38,0.01623145);
   h_dimuon_m_fake_0117->SetBinContent(39,0.01498144);
   h_dimuon_m_fake_0117->SetBinContent(40,0.01449393);
   h_dimuon_m_fake_0117->SetBinContent(41,0.01330642);
   h_dimuon_m_fake_0117->SetBinContent(42,0.0121564);
   h_dimuon_m_fake_0117->SetBinContent(43,0.0116564);
   h_dimuon_m_fake_0117->SetBinContent(44,0.01084389);
   h_dimuon_m_fake_0117->SetBinContent(45,0.01028763);
   h_dimuon_m_fake_0117->SetBinContent(46,0.009437618);
   h_dimuon_m_fake_0117->SetBinContent(47,0.009125114);
   h_dimuon_m_fake_0117->SetBinContent(48,0.007956349);
   h_dimuon_m_fake_0117->SetBinContent(49,0.007906348);
   h_dimuon_m_fake_0117->SetBinContent(50,0.006987588);
   h_dimuon_m_fake_0117->SetBinContent(51,0.006300079);
   h_dimuon_m_fake_0117->SetBinContent(52,0.006368829);
   h_dimuon_m_fake_0117->SetBinContent(53,0.005443818);
   h_dimuon_m_fake_0117->SetBinContent(54,0.005250066);
   h_dimuon_m_fake_0117->SetBinContent(55,0.004668809);
   h_dimuon_m_fake_0117->SetBinContent(56,0.00405005);
   h_dimuon_m_fake_0117->SetBinContent(57,0.003818798);
   h_dimuon_m_fake_0117->SetBinContent(58,0.003637546);
   h_dimuon_m_fake_0117->SetBinContent(59,0.003443793);
   h_dimuon_m_fake_0117->SetBinContent(60,0.002881286);
   h_dimuon_m_fake_0117->SetBinContent(61,0.002731284);
   h_dimuon_m_fake_0117->SetBinContent(62,0.002318779);
   h_dimuon_m_fake_0117->SetBinContent(63,0.002193777);
   h_dimuon_m_fake_0117->SetBinContent(64,0.001856273);
   h_dimuon_m_fake_0117->SetBinContent(65,0.001675021);
   h_dimuon_m_fake_0117->SetBinContent(66,0.001687521);
   h_dimuon_m_fake_0117->SetBinContent(67,0.001306266);
   h_dimuon_m_fake_0117->SetBinContent(68,0.001262516);
   h_dimuon_m_fake_0117->SetBinContent(69,0.001168765);
   h_dimuon_m_fake_0117->SetBinContent(70,0.0007937599);
   h_dimuon_m_fake_0117->SetBinContent(71,0.0007312591);
   h_dimuon_m_fake_0117->SetBinContent(72,0.0005875073);
   h_dimuon_m_fake_0117->SetBinContent(73,0.000637508);
   h_dimuon_m_fake_0117->SetBinContent(74,0.0005125064);
   h_dimuon_m_fake_0117->SetBinContent(75,0.0004500056);
   h_dimuon_m_fake_0117->SetBinContent(76,0.0003250041);
   h_dimuon_m_fake_0117->SetBinContent(77,0.0003687546);
   h_dimuon_m_fake_0117->SetBinContent(78,0.0002937537);
   h_dimuon_m_fake_0117->SetBinContent(79,0.0002250028);
   h_dimuon_m_fake_0117->SetBinContent(80,0.0002000025);
   h_dimuon_m_fake_0117->SetBinContent(81,0.0001750022);
   h_dimuon_m_fake_0117->SetBinContent(82,0.0001062513);
   h_dimuon_m_fake_0117->SetBinContent(83,0.0001187515);
   h_dimuon_m_fake_0117->SetBinContent(84,6.250078e-05);
   h_dimuon_m_fake_0117->SetBinContent(85,5.000062e-05);
   h_dimuon_m_fake_0117->SetBinContent(86,6.250078e-05);
   h_dimuon_m_fake_0117->SetBinContent(87,1.875023e-05);
   h_dimuon_m_fake_0117->SetBinContent(88,1.875023e-05);
   h_dimuon_m_fake_0117->SetBinContent(89,6.250078e-06);
   h_dimuon_m_fake_0117->SetBinContent(90,1.875023e-05);
   h_dimuon_m_fake_0117->SetBinContent(92,1.250016e-05);
   h_dimuon_m_fake_0117->SetBinContent(96,6.250078e-06);
   h_dimuon_m_fake_0117->SetBinError(1,8.63778e-05);
   h_dimuon_m_fake_0117->SetBinError(2,0.000146177);
   h_dimuon_m_fake_0117->SetBinError(3,0.0001915218);
   h_dimuon_m_fake_0117->SetBinError(4,0.0002207083);
   h_dimuon_m_fake_0117->SetBinError(5,0.0002531089);
   h_dimuon_m_fake_0117->SetBinError(6,0.0002804189);
   h_dimuon_m_fake_0117->SetBinError(7,0.0002966648);
   h_dimuon_m_fake_0117->SetBinError(8,0.0003271007);
   h_dimuon_m_fake_0117->SetBinError(9,0.000347203);
   h_dimuon_m_fake_0117->SetBinError(10,0.0003591484);
   h_dimuon_m_fake_0117->SetBinError(11,0.0003765121);
   h_dimuon_m_fake_0117->SetBinError(12,0.0003870005);
   h_dimuon_m_fake_0117->SetBinError(13,0.0003992719);
   h_dimuon_m_fake_0117->SetBinError(14,0.0004074073);
   h_dimuon_m_fake_0117->SetBinError(15,0.0004084607);
   h_dimuon_m_fake_0117->SetBinError(16,0.0004186153);
   h_dimuon_m_fake_0117->SetBinError(17,0.0004283926);
   h_dimuon_m_fake_0117->SetBinError(18,0.0004212664);
   h_dimuon_m_fake_0117->SetBinError(19,0.0004338743);
   h_dimuon_m_fake_0117->SetBinError(20,0.000423486);
   h_dimuon_m_fake_0117->SetBinError(21,0.0004321151);
   h_dimuon_m_fake_0117->SetBinError(22,0.00042944);
   h_dimuon_m_fake_0117->SetBinError(23,0.0004223777);
   h_dimuon_m_fake_0117->SetBinError(24,0.000419268);
   h_dimuon_m_fake_0117->SetBinError(25,0.0004151012);
   h_dimuon_m_fake_0117->SetBinError(26,0.0004039408);
   h_dimuon_m_fake_0117->SetBinError(27,0.0003954872);
   h_dimuon_m_fake_0117->SetBinError(28,0.0003946468);
   h_dimuon_m_fake_0117->SetBinError(29,0.0003943992);
   h_dimuon_m_fake_0117->SetBinError(30,0.0003816644);
   h_dimuon_m_fake_0117->SetBinError(31,0.0003707092);
   h_dimuon_m_fake_0117->SetBinError(32,0.0003625045);
   h_dimuon_m_fake_0117->SetBinError(33,0.0003594746);
   h_dimuon_m_fake_0117->SetBinError(34,0.000347765);
   h_dimuon_m_fake_0117->SetBinError(35,0.0003396387);
   h_dimuon_m_fake_0117->SetBinError(36,0.0003336043);
   h_dimuon_m_fake_0117->SetBinError(37,0.0003295398);
   h_dimuon_m_fake_0117->SetBinError(38,0.0003185088);
   h_dimuon_m_fake_0117->SetBinError(39,0.0003059986);
   h_dimuon_m_fake_0117->SetBinError(40,0.0003009787);
   h_dimuon_m_fake_0117->SetBinError(41,0.0002883854);
   h_dimuon_m_fake_0117->SetBinError(42,0.0002756419);
   h_dimuon_m_fake_0117->SetBinError(43,0.0002699137);
   h_dimuon_m_fake_0117->SetBinError(44,0.0002603366);
   h_dimuon_m_fake_0117->SetBinError(45,0.0002535715);
   h_dimuon_m_fake_0117->SetBinError(46,0.00024287);
   h_dimuon_m_fake_0117->SetBinError(47,0.0002388151);
   h_dimuon_m_fake_0117->SetBinError(48,0.0002229973);
   h_dimuon_m_fake_0117->SetBinError(49,0.0002222955);
   h_dimuon_m_fake_0117->SetBinError(50,0.0002089808);
   h_dimuon_m_fake_0117->SetBinError(51,0.0001984338);
   h_dimuon_m_fake_0117->SetBinError(52,0.0001995136);
   h_dimuon_m_fake_0117->SetBinError(53,0.0001844567);
   h_dimuon_m_fake_0117->SetBinError(54,0.0001811445);
   h_dimuon_m_fake_0117->SetBinError(55,0.0001708228);
   h_dimuon_m_fake_0117->SetBinError(56,0.000159101);
   h_dimuon_m_fake_0117->SetBinError(57,0.000154492);
   h_dimuon_m_fake_0117->SetBinError(58,0.0001507811);
   h_dimuon_m_fake_0117->SetBinError(59,0.0001467105);
   h_dimuon_m_fake_0117->SetBinError(60,0.0001341949);
   h_dimuon_m_fake_0117->SetBinError(61,0.000130655);
   h_dimuon_m_fake_0117->SetBinError(62,0.000120385);
   h_dimuon_m_fake_0117->SetBinError(63,0.0001170952);
   h_dimuon_m_fake_0117->SetBinError(64,0.0001077119);
   h_dimuon_m_fake_0117->SetBinError(65,0.0001023182);
   h_dimuon_m_fake_0117->SetBinError(66,0.0001026993);
   h_dimuon_m_fake_0117->SetBinError(67,9.035633e-05);
   h_dimuon_m_fake_0117->SetBinError(68,8.88303e-05);
   h_dimuon_m_fake_0117->SetBinError(69,8.546853e-05);
   h_dimuon_m_fake_0117->SetBinError(70,7.04348e-05);
   h_dimuon_m_fake_0117->SetBinError(71,6.760493e-05);
   h_dimuon_m_fake_0117->SetBinError(72,6.059676e-05);
   h_dimuon_m_fake_0117->SetBinError(73,6.312269e-05);
   h_dimuon_m_fake_0117->SetBinError(74,5.659686e-05);
   h_dimuon_m_fake_0117->SetBinError(75,5.303367e-05);
   h_dimuon_m_fake_0117->SetBinError(76,4.506995e-05);
   h_dimuon_m_fake_0117->SetBinError(77,4.800776e-05);
   h_dimuon_m_fake_0117->SetBinError(78,4.284838e-05);
   h_dimuon_m_fake_0117->SetBinError(79,3.750047e-05);
   h_dimuon_m_fake_0117->SetBinError(80,3.535578e-05);
   h_dimuon_m_fake_0117->SetBinError(81,3.30723e-05);
   h_dimuon_m_fake_0117->SetBinError(82,2.576973e-05);
   h_dimuon_m_fake_0117->SetBinError(83,2.724346e-05);
   h_dimuon_m_fake_0117->SetBinError(84,1.976448e-05);
   h_dimuon_m_fake_0117->SetBinError(85,1.767789e-05);
   h_dimuon_m_fake_0117->SetBinError(86,1.976448e-05);
   h_dimuon_m_fake_0117->SetBinError(87,1.082545e-05);
   h_dimuon_m_fake_0117->SetBinError(88,1.082545e-05);
   h_dimuon_m_fake_0117->SetBinError(89,6.250078e-06);
   h_dimuon_m_fake_0117->SetBinError(90,1.082545e-05);
   h_dimuon_m_fake_0117->SetBinError(92,8.838945e-06);
   h_dimuon_m_fake_0117->SetBinError(96,6.250078e-06);
   h_dimuon_m_fake_0117->SetEntries(159998);
   h_dimuon_m_fake_0117->SetDirectory(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#ff0000");
   h_dimuon_m_fake_0117->SetLineColor(ci);
   h_dimuon_m_fake_0117->SetLineWidth(2);
   h_dimuon_m_fake_0117->SetMarkerStyle(20);
   h_dimuon_m_fake_0117->GetXaxis()->SetLabelFont(42);
   h_dimuon_m_fake_0117->GetXaxis()->SetLabelOffset(0.007);
   h_dimuon_m_fake_0117->GetXaxis()->SetTitleSize(0.06);
   h_dimuon_m_fake_0117->GetXaxis()->SetTitleOffset(0.95);
   h_dimuon_m_fake_0117->GetXaxis()->SetTitleFont(42);
   h_dimuon_m_fake_0117->GetYaxis()->SetLabelFont(42);
   h_dimuon_m_fake_0117->GetYaxis()->SetLabelOffset(0.007);
   h_dimuon_m_fake_0117->GetYaxis()->SetTitleSize(0.06);
   h_dimuon_m_fake_0117->GetYaxis()->SetTitleOffset(1.3);
   h_dimuon_m_fake_0117->GetYaxis()->SetTitleFont(42);
   h_dimuon_m_fake_0117->GetZaxis()->SetLabelFont(42);
   h_dimuon_m_fake_0117->GetZaxis()->SetLabelOffset(0.007);
   h_dimuon_m_fake_0117->GetZaxis()->SetTitleSize(0.06);
   h_dimuon_m_fake_0117->GetZaxis()->SetTitleFont(42);
   h_dimuon_m_fake_0117->Draw("SAMEHIST");
   
   TLegend *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);
   TLegendEntry *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}} = 10 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);
}
void plotVariable(string variable = "Elec_Fbrem",
		  const TString& category = "TauNoGammas",
		  const TString& xAxisTitle = "Fbrem",
		  const TString& yAxisTitle = "a.u.",
		  float xMin = -0.2, 
		  float xMax = 1,
		  int nBins = 100, 
		  int numPVMin = 0, 
		  int numPVMax = 50,
		  float PtMin = 10, 
		  float PtMax = 60,
		  const TString& Region = "Endcap"
		   )
{
   string discriminator = "";
//   string discriminator = "-AntiEMed";

  float AbsEtaMin = 0; 
  float AbsEtaMax = 3.0;
  if(Region == "Barrel"){
    AbsEtaMin = 0; 
    AbsEtaMax = 1.479;
  }
  if(Region == "Endcap"){
    AbsEtaMin = 1.479; 
    AbsEtaMax = 3.0;
  }
  TCanvas *c1 = new TCanvas("c1","",5,30,650,600);
  c1->SetGrid(0,0);
  c1->SetFillStyle(4000);
  c1->SetFillColor(10);
  c1->SetTicky();
  c1->SetObjectStat(0);

  gStyle->SetOptStat(0);
  gStyle->SetTitleFillColor(0);
  gStyle->SetCanvasBorderMode(0);
  gStyle->SetCanvasColor(0);
  gStyle->SetPadBorderMode(0);
  gStyle->SetPadColor(0);
  gStyle->SetTitleFillColor(0);
  gStyle->SetTitleBorderSize(0);
  gStyle->SetTitleH(0.07);
  gStyle->SetTitleFontSize(0.1);
  gStyle->SetTitleStyle(0);
  gStyle->SetTitleOffset(1.3,"y");

  TLegend* leg = new TLegend(0.6,0.75,0.8,0.88,NULL,"brNDC");
  leg->SetFillStyle(0);
  leg->SetBorderSize(0);
  leg->SetFillColor(10);
  leg->SetTextSize(0.03);
  //leg->SetHeader("#splitline{CMS Preliminary}{ #sqrt{s}=7 TeV}");

//   std::string inputFileName = "/data_CMS/cms/ivo/AntiEMVA/Trees/AntiEMVA_Fall11DYJetsToLL-iter4.root";
//   std::string inputFileName = "/data_CMS/cms/ivo/AntiEMVA/Trees/Trees_ForV4/AntiEMVA_AntiEMVATrees-DYJetsToLL-madgraph-PUS6.root";
  std::string inputFileName = "/data_CMS/cms/ivo/AntiEMVA/Trees/Trees_ForV4/AntiEMVA_V4.root";
  TFile* inputFile = new TFile (inputFileName.data(),"READ");
  if(inputFile->IsZombie()){
    cout << "No such file!" << endl;
    return;
  }
  TTree* inputTree = (TTree*)inputFile->Get("AntiEMVAAnalyzer2/tree");
//   TTree* inputTree = (TTree*)inputFile->Get("AntiEMVAAnalyzer/tree");
  std::vector<TH1*> histograms;

  std::vector<std::string> matchings ; 
  matchings.push_back("GenHadMatch");
  matchings.push_back("GenEleMatch");

  for ( std::vector<std::string>::const_iterator matching = matchings.begin();
	matching  != matchings.end(); ++matching ) {


    TCut PUSelection(Form("NumPV>%i && NumPV<%i",numPVMin,numPVMax));
    TCut ElecPtSelection (Form("Elec_Pt>%0f && Elec_Pt<%0f",PtMin,PtMax));
    TCut TauPtSelection (Form("Tau_Pt>%0f && Tau_Pt<%0f",PtMin,PtMax));
    TCut ElecAbsEtaSelection (Form("Elec_AbsEta>%0f && Elec_AbsEta<%0f",AbsEtaMin,AbsEtaMax));
    TCut TauAbsEtaSelection = "";
    if(Region == "Barrel"){
      TauAbsEtaSelection = "Tau_Eta>-1.479 && Tau_Eta<1.479";
    }
    if(Region == "Endcap"){
      TauAbsEtaSelection = "(Tau_Eta>1.479 && Tau_Eta<3.0) || (Tau_Eta>-3.0 && Tau_Eta<-1.479)";
    }
    //   TCut TauAbsEtaSelection (Form("Tau_AbsEta>%0f && Tau_AbsEta<%0f",AbsEtaMin,AbsEtaMax));
    TCut ElecMatchSelection (Form("Elec_%s == 1",matching->data()));
    //   TCut ElecMatchSelection (Form("Elec_PFTauMatch && Elec_%s",matching->data()));
    TCut TauMatchSelection (Form("Tau_%s",matching->data()));
    TCut CategorySelection = "";
    if(discriminator == ""){
      if (category == "NoEleMatch") CategorySelection = "Tau_GsfEleMatch<0.5"; 
      if (category == "woG") CategorySelection = "Tau_NumGammaCands<0.5"; 
      if (category == "wGwoGSF") CategorySelection = "Tau_NumGammaCands>0.5 && Tau_HasGsf<0.5";
      if (category == "wGwGSFwoPFMVA")CategorySelection = "Tau_NumGammaCands>0.5 && Tau_HasGsf>0.5 && Elec_PFMvaOutput<-0.1";
      if (category == "wGwGSFwPFMVA")CategorySelection = "Tau_NumGammaCands>0.5 && Tau_HasGsf>0.5 && Elec_PFMvaOutput>-0.1";
    }

    if(discriminator == "-AntiEMed"){
      if (category == "NoEleMatch") CategorySelection = "Tau_GsfEleMatch<0.5"; 
      if (category == "woG") CategorySelection = "Tau_NumGammaCands<0.5"; 
      if (category == "wGwoGSF") CategorySelection = "Tau_NumGammaCands>0.5 && (Tau_HasGsf<0.5 || (Tau_HasGsf>0.5 && Elec_PFMvaOutput>-0.1))";
      if (category == "wGwGSFwoPFMVA")CategorySelection = "Tau_NumGammaCands>0.5 && Tau_HasGsf>0.5 && Elec_PFMvaOutput<-0.1";
    }

  TCut ElecSelection = CategorySelection && PUSelection && ElecPtSelection && ElecAbsEtaSelection && ElecMatchSelection ;
  TCut TauSelection = CategorySelection && PUSelection && TauPtSelection && TauAbsEtaSelection && TauMatchSelection ;
  TCut Selection;
  if (variable.find("Elec")!=std::string::npos)Selection = ElecSelection;
  if (variable.find("Tau")!=std::string::npos)Selection = TauSelection;
  

  TH1F* hVariable   = new TH1F( "hVariable" ,"" , nBins ,xMin, xMax);
  hVariable->SetXTitle(Form("%s",variable.data()));

  if (matching->find("EleMatch")!=std::string::npos){
//     hVariable->SetFillColor(kRed);
//     hVariable->SetFillStyle(3345);
    hVariable->SetLineColor(kRed);
    hVariable->SetLineWidth(2);
  }
  if (matching->find("HadMatch")!=std::string::npos){
//     hVariable->SetFillColor(kBlue);
//     hVariable->SetFillStyle(3354);
    hVariable->SetLineColor(kBlue);
    hVariable->SetLineWidth(2);
  }  
  inputTree->Draw(Form("%s>>hVariable",variable.data()));

  cout<<"Variable plotted : "<<variable<<endl;
  cout<<"Matching applied : "<<matching->data()<<endl;
  cout<<"  Total number of Candidates : "<<hVariable->GetEntries()<<endl;
  inputTree->Draw(Form("%s>>hVariable",variable.data()),Selection);
  cout<<"  Number of Cantidates after selection: "<<hVariable->GetEntries()<<endl;
  hVariable->Scale(1./hVariable->Integral());
  leg->AddEntry(hVariable,Form("%s",matching->data()));

  histograms.push_back(hVariable);
  c1->Clear();
  }
//   double yMin = +1.e+6;
//   double yMax = -1.e+6;
  TH1* refHistogram = histograms.front();
  refHistogram->SetStats(false);
  refHistogram->SetTitle("");
//   refHistogram->SetMinimum(yMin);
//   refHistogram->SetMaximum(yMax);


  if (xAxisTitle == "HoHplusE" ) {
    refHistogram->SetMaximum(1.0);
    refHistogram->SetMinimum(0.01);
    c1->SetLogy();
  }

  if(xAxisTitle == "E_{#gamma}/(P_{in}-P_{out})" ){
    refHistogram->SetMaximum(0.03);
    refHistogram->SetMinimum(0.0);
  }

  if(xAxisTitle == "HadrMva(#tau)" ){
    refHistogram->SetMaximum(0.25);
    refHistogram->SetMinimum(0.0);
  }

  TAxis* xAxis = refHistogram->GetXaxis();
  xAxis->SetTitle(xAxisTitle.Data());
  xAxis->SetTitleOffset(1.15);
  //if(variable.find("AbsEta")!=std::string::npos)xAxis->SetLimits(AbsEtaMin, AbsEtaMax);
  TAxis* yAxis = refHistogram->GetYaxis();
  yAxis->SetTitle(yAxisTitle.Data());
  yAxis->SetTitleOffset(1.30);

  int numHistograms = histograms.size();
  float YMax = 0;
  for ( int iHistogram = 0; iHistogram < numHistograms; ++iHistogram ) {
    TH1* histogram = histograms[iHistogram];
    if(histogram->GetMaximum()>YMax) YMax = histogram->GetMaximum();
  }
  for ( int iHistogram = 0; iHistogram < numHistograms; ++iHistogram ) {
    TH1* histogram = histograms[iHistogram];
    yAxis->SetRangeUser(0.,YMax+0.10*YMax);
    std::string drawOption = "hist";
    if ( iHistogram > 0 ) drawOption.append("same");
    histogram->Draw(drawOption.data());
    leg->Draw();

  }//loop matchings
  string outputName = Form("plots/plotVariablesAntiEMVA/%s/plotVariablesAntiEMVA_v4_%s_%s_%s",category.Data(),category.Data(),variable.data(),Region.Data());
  c1->Print(std::string(outputName).append(".png").data());
  c1->Print(std::string(outputName).append(".pdf").data());

}
예제 #11
0
void forPaper_approval_2(std::string var1="h_ystar", 
			 bool logScale=false,
			 std::string datafile="darko_root/goldenWithMCerror_withJESCorr_bigmatrix_corr.root",
			 std::string mcfile1="darko_root/bare_exclusive1Jet_zPt40_both_dressed_DYToLL_M-50_1jEnh2_2jEnh35_3jEnh40_4jEnh50_7TeV-sherpa.root", 
			 std::string mcfile2="darko_root/bare_exclusive1Jet_zPt40_both_dressed_DYJetsToLL_TuneZ2_M-50_7TeV-madgraph-tauola.root", 
			 std::string mcfile3="unified_angular_distributions/rebinnings/zpt40/Z_1jet_tota_cteq66_1___1___ex_m34.root",
			 std::string var2="", 
			 std::string headertitle="Z#rightarrow ll + 1 jet",
			 std::string dataName="Data",
			 std::string mcName1="Sherpa",
			 std::string mcName2="Madgraph",
			 std::string mcName3="MCFM"
			 )
{
  
  setTDRStyle();
  gStyle->SetOptStat(0);

  const double LABELSIZE = 20.0;
  const int LINEWIDTH=3;
  const int NHISTOS=4;
  TH1F* h[NHISTOS];

  char tempName[300];
  if(var2 ==  "" )var2=var1;

  std::string xtitle;
  std::string output;
  std::string datavar;
  std::string var3;
  std::string theoryName;

  std::string remword3  ="h_";
  std::string corrName = var1;
  size_t pos3  = corrName.find(remword3);
  if(pos3!= std::string::npos)
    corrName.replace(pos3,remword3.length(),"");

  datavar = "h_combine_" + corrName;

  double ymax=1.22;
  double ymin=0.78;

  double xmax=3.0;
  double xmin=0.0;

  if(var1=="h_ystar")
    {
      var3  = "id4";
      xtitle = "Y_{dif} = |Y_{Z}-Y_{jet}| / 2";
      output = "DifYAll";
      theoryName = "Ydif";
      ymax = 1.45;
      ymin = 0.55; 
      xmax = 1.7999;
    }
  else if(var1=="h_yB")
    {
      var3 = "id3";
      xtitle = "Y_{sum} = |Y_{Z}+Y_{jet}| / 2";
      output = "SumYAll";
      theoryName = "Ysum";
      ymax = 1.45;
      ymin = 0.55;
      xmax = 2.1999;
    }
  else if(var1=="h_jety")
    {
      var3 = "id1";
      xtitle = "|Y_{jet}|";
      output = "YJetAll";
      datafile = "darko_root/goldenWithMCerror_withJESCorr_jety_bigmatrix.root";
      theoryName = "Yjet";
      xmax = 2.3999;

    }
  else if(var1=="h_zy")
    {
      var3 = "id2";
      xtitle = "|Y_{Z}|";
      output = "YZedAll";
      theoryName = "Yzed";
      xmax = 2.1999;
    }

  

  // first get the histogram files
  TFile *fdata  = TFile::Open(datafile.data());
  cout << "Opening " << fdata->GetName() << endl;

  TFile *fmc1   = TFile::Open(mcfile1.data());
  cout << "Opening " << fmc1->GetName() << endl;

  TFile *fmc2   = TFile::Open(mcfile2.data());
  cout << "Opening " << fmc2->GetName() << endl;

  TFile *fmc3   = TFile::Open(mcfile3.data());
  cout << "Opening " << fmc3->GetName() << endl;

  h[0] = (TH1F*)(fdata->Get(datavar.data()));
  h[1] = (TH1F*)(fmc1->Get(var1.data()));
  h[2] = (TH1F*)(fmc2->Get(var2.data()));
  h[3] = (TH1F*)(fmc3->Get(var3.data()));

  if(var1=="h_jety")
    {
      double value = h[3]->GetBinContent(12);
      value *= 0.9;
      h[3]->SetBinContent(12,value);
    }


  TH1D* hscale[NHISTOS];

  int COLOR[NHISTOS]={1,4,2,kOrange-1};
  int MARKERSTYLE[NHISTOS]={8,24,21,29};
  int MARKERSIZE[NHISTOS]={1,0,0,0};
  int LINESTYLE[NHISTOS]={1,1,2,6};
  int FILLSTYLE[NHISTOS]={1,3345,3436,1};

  for(int i=0; i < NHISTOS; i++){

    hscale[i]   =(TH1D*) h[0]->Clone(Form("hscale%02i",i));
    hscale[i]   ->SetYTitle(Form("Ratio to %s",mcName3.data()));
    hscale[i]   ->SetXTitle(xtitle.data());
    hscale[i]   ->GetXaxis()->SetDecimals();
    hscale[i]   ->GetYaxis()->SetDecimals();

    hscale[i]->SetLineColor(COLOR[i]);
    hscale[i]->SetLineWidth(LINEWIDTH);
    hscale[i]->SetLineStyle(1);
    hscale[i]->SetMarkerColor(COLOR[i]);
    hscale[i]->SetMarkerStyle(MARKERSTYLE[i]);
    hscale[i]->SetMarkerSize(MARKERSIZE[i]);
    hscale[i]->SetFillColor(COLOR[i]);
    hscale[i]->SetFillStyle(FILLSTYLE[i]);

    hscale[i]->SetTitle("");
    hscale[i]->SetMaximum(ymax);
    hscale[i]->SetMinimum(ymin);

    hscale[i]->SetTitleOffset(1.2,"X");
    hscale[i]->SetTitleOffset(1.2,"Y");

    h[i]->SetTitle("");
    h[i]->SetLineStyle(LINESTYLE[i]);
    h[i]->GetXaxis()->SetDecimals();
    h[i]->GetYaxis()->SetDecimals();
    h[i]->SetMarkerSize(1);
    h[i]->SetLineColor(COLOR[i]);
    h[i]->SetLineWidth(LINEWIDTH);
    h[i]->SetMarkerColor(COLOR[i]);
    h[i]->SetMarkerStyle(MARKERSTYLE[i]);
    h[i]->SetTitleOffset(1.2,"Y");

  }
  h[0]->SetLineWidth(1);
  hscale[0]->SetLineWidth(1);

  // if normalizing to the same area, set the scale 

  int binLo = -1;
  int binHi = -1;
  int nbins = h[0]->GetNbinsX();
  binLo = 1;
  binHi = nbins;

  double scaleFactor[NHISTOS]={1};

  for(int ih=0; ih < NHISTOS; ih++){
    
    double integral = h[ih]->Integral(binLo,binHi);
    scaleFactor[ih] = integral > 0? 1.0/integral: 1;
    h[ih]->Sumw2();
    h[ih]->Scale(scaleFactor[ih]);

  }

  for(int ih=0; ih < NHISTOS; ih++)
    cout << "histogram " << ih << " integral = " << h[ih]->Integral() << endl;


  // get the ratio

  for(int ih=0; ih < NHISTOS-1; ih++){
    cout << "===================================================" << endl;
    cout << "For histogram " << ih << endl;
    hscale[ih]->Divide(h[ih], h[NHISTOS-1]);
    hscale[ih]->SetMaximum(ymax);
    hscale[ih]->SetMinimum(ymin);

  } // end of loop over histograms

  vector<double> maxArray;
  maxArray.clear();
  
  for(int ih=0; ih < NHISTOS; ih++){

    h[ih]->GetXaxis()->SetRangeUser(xmin,xmax);
    hscale[ih]->GetXaxis()->SetRangeUser(xmin,xmax);
    double max_this  = h[ih]->GetBinError(h[ih]->GetMaximumBin()) + h[ih]->GetMaximum();
    maxArray.push_back(max_this);

  }


  double max = *(std::max_element(maxArray.begin(),maxArray.end()));
  cout << "Max = " << max << endl;

  for(int ih=0; ih < NHISTOS; ih++){

    h[ih]->SetMaximum(1.1*max);
    if(!logScale)
      h[ih]->SetMinimum(-0.015);
    else
      h[ih]->SetMinimum(5e-6);
  }


  //////////////////////////////////////////////////////////////////////////
  /// 
  ///   Making final figures and save the canvas in files
  ///
  //////////////////////////////////////////////////////////////////////////

  TCanvas* c1 = new TCanvas("c1","",700,1000);  
  c1->Divide(1,2,0.01,0);
  c1->cd(1);
  if(logScale)
    gPad->SetLogy(1);
  gPad->SetTopMargin(0.01);
  gPad->SetBottomMargin(0);
  gPad->SetRightMargin(0.04);
  gStyle->SetStatFontSize(0.05);

  // pad 1 and pad 2 have different sizes, need to rescale to 
  // make the label size the same
  double temp1_pad = gPad->GetWh()*gPad->GetAbsHNDC();
  cout << "pad 1 size in pixels = " << temp1_pad << endl;
  double label1_size = LABELSIZE/temp1_pad;
  for(int ih=0; ih < NHISTOS; ih++)
    {
      h[ih]->GetYaxis()->SetLabelSize(label1_size);
      h[ih]->GetXaxis()->SetLabelSize(label1_size);
    }

  h[0]->SetYTitle("1/#sigma d#sigma/dY");
  h[0]->Draw("9e1");
  for(int ih=1; ih < NHISTOS; ih++)
    h[ih]->Draw("9histsame");
  h[0]->Draw("9e1same");


  double x1NDC = 0.729812;
  double y1NDC = 0.560219;
  double x2NDC = 0.939633;
  double y2NDC = 0.871885;

  TLegend* leg = new TLegend(x1NDC,y1NDC,x2NDC,y2NDC);
  
  leg->SetFillColor(0);
  leg->SetFillStyle(0);
  leg->SetTextSize(0.045);
  leg->SetBorderSize(0);
  leg->SetHeader(headertitle.data());
  leg->AddEntry(h[0], dataName.data());
  leg->AddEntry(h[1], mcName1.data(),"l");
  leg->AddEntry(h[2], mcName2.data(),"l");
  leg->AddEntry(h[3], mcName3.data(),"l");
  leg->Draw("same");

  TLatex *lar = new TLatex(0.33, 0.91, "CMS Preliminary,  #sqrt{s} = 7 TeV, L_{int} = 5 fb^{-1}");
  lar->SetNDC(kTRUE);
  lar->SetTextSize(0.05);
  lar->Draw();


  TPaveText *pavetex = new TPaveText(0.17029, 
				     0.0495665, 
				     0.478939, 
				     0.483501,"NDCBR");
  pavetex->SetBorderSize(0);
  pavetex->SetFillColor(0);
  pavetex->SetFillStyle(0);
  pavetex->SetLineWidth(3);
  pavetex->SetTextAlign(12);
  pavetex->SetTextSize(0.04);
  pavetex->AddText("76 < M_{ll} < 106 GeV");
  pavetex->AddText("p_{T}^{ll} > 40 GeV"); 
  pavetex->AddText("p_{T}^{l} > 20 GeV, |#eta^{l}| < 2.1");
  pavetex->AddText("N_{jet}=1, p_{T}^{jet} > 30 GeV, |#eta^{jet}| < 2.4");
  pavetex->AddText("#Delta R(l,jet)>0.5");
  pavetex->Draw();

  cout << "pad 1 label size = " << h[0]->GetYaxis()->GetLabelSize() << endl;

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

  c1->cd(2);
  gPad->SetRightMargin(0.04);
  gPad->SetTopMargin(0);
  gPad->SetBottomMargin(0.2);
  gPad->SetTickx();

  // pad 1 and pad 2 have different sizes, need to rescale to 
  // make the label size the same
  double temp2_pad = gPad->GetWh()*gPad->GetAbsHNDC();
  cout << "pad 2 size in pixels = " << temp2_pad << endl;
  double label2_size = LABELSIZE/temp2_pad;
  for(int ih=0; ih < NHISTOS; ih++)
    {
      hscale[ih]->GetYaxis()->SetLabelSize(label2_size);
      hscale[ih]->GetXaxis()->SetLabelSize(label2_size);
    }


  hscale[0]->Draw("9e1");
  for(int ih=1; ih < NHISTOS-1; ih++){
    hscale[ih]->Draw("9e3same");
  }
  hscale[0]->Draw("9e1same");

  TLine* l2 = new TLine(xmin,1.,xmax,1.);
  l2->SetLineColor(kOrange-1);
  l2->SetLineStyle(1);
  l2->Draw("same");


  TLegend* leg2 = new TLegend(0.17333,0.244648,0.392274,0.476857);
  
  leg2->SetFillColor(0);
  leg2->SetFillStyle(0);
  leg2->SetTextSize(0.04);
  leg2->SetBorderSize(0);
  leg2->AddEntry(hscale[1], "Sherpa stat. uncertainty","f");
  leg2->AddEntry(hscale[2], "Madgraph stat. uncertainty","f");
  leg2->Draw("same");


  gROOT->ProcessLine(".L ~/scripts/theoryErrorZed.c");
  theoryErrorZed(theoryName.data());

  hscale[0]->Draw("9e1same");
  for(int ih=1; ih < NHISTOS-1; ih++){
    hscale[ih]->Draw("9e3same");
  }
  hscale[0]->Draw("9e1same");
  l2->Draw("same");

  cout << "pad 2 label size = " << hscale[0]->GetYaxis()->GetLabelSize() << endl;
  
  string dirName = "forPaper";
  gSystem->mkdir(dirName.data());

  std::string filename;
  std::string psname = dirName + "/" + output;
  filename = psname + ".eps";
  c1->Print(filename.data());
  filename = psname + ".gif";
  c1->Print(filename.data());
  filename = psname + ".pdf";
  c1->Print(filename.data());
  //   c1->Close();
}
예제 #12
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_bkg){

  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);

  h_bkg->Reset();
  h_bkg->Add(h_DY);
  h_bkg->Add(h_TTbar);
  h_bkg->Add(h_WW);
  h_bkg->Add(h_WZ);
  h_bkg->Add(h_ZZ);

  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->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);

  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()->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->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.14, 0.94, "CMS preliminary 2015");
  lar->DrawLatex(0.63, 0.94, "L = 2.08 fb^{-1} at #sqrt{s} = 13 TeV");

}
void DisttoEdge_2016B_June22all_sameYrange_fullIntegral_10k9k()
{
//=========Macro generated from canvas: DisttoEdge/DisttoEdge
//=========  (Fri Aug  5 09:22:37 2016) by ROOT version6.06/01
   TCanvas *DisttoEdge = new TCanvas("DisttoEdge", "DisttoEdge",0,0,500,500);
   gStyle->SetOptStat(0);
   DisttoEdge->SetHighLightColor(2);
   DisttoEdge->Range(-67.5,-2.848556,7.500001,2.626708);
   DisttoEdge->SetFillColor(0);
   DisttoEdge->SetBorderMode(0);
   DisttoEdge->SetBorderSize(2);
   DisttoEdge->SetLogy();
   DisttoEdge->SetFrameBorderMode(0);
   DisttoEdge->SetFrameBorderMode(0);
   
   TH1D *DisttoEdge_1__7 = new TH1D("DisttoEdge_1__7","DisttoEdge",100,-60,0);
   DisttoEdge_1__7->SetBinContent(64,0.0001479723);
   DisttoEdge_1__7->SetBinContent(65,0.008582395);
   DisttoEdge_1__7->SetBinContent(66,0.01701682);
   DisttoEdge_1__7->SetBinContent(67,0.02944649);
   DisttoEdge_1__7->SetBinContent(68,0.04394778);
   DisttoEdge_1__7->SetBinContent(69,0.05164234);
   DisttoEdge_1__7->SetBinContent(70,0.07191455);
   DisttoEdge_1__7->SetBinContent(71,0.08730368);
   DisttoEdge_1__7->SetBinContent(72,0.1127549);
   DisttoEdge_1__7->SetBinContent(73,0.1222251);
   DisttoEdge_1__7->SetBinContent(74,0.1408697);
   DisttoEdge_1__7->SetBinContent(75,0.1652851);
   DisttoEdge_1__7->SetBinContent(76,0.2007985);
   DisttoEdge_1__7->SetBinContent(77,0.4424373);
   DisttoEdge_1__7->SetBinContent(78,1.415503);
   DisttoEdge_1__7->SetBinContent(79,3.061252);
   DisttoEdge_1__7->SetBinContent(80,4.839287);
   DisttoEdge_1__7->SetBinContent(81,6.813978);
   DisttoEdge_1__7->SetBinContent(82,8.689379);
   DisttoEdge_1__7->SetBinContent(83,9.021873);
   DisttoEdge_1__7->SetBinContent(84,8.897133);
   DisttoEdge_1__7->SetBinContent(85,8.654606);
   DisttoEdge_1__7->SetBinContent(86,8.316933);
   DisttoEdge_1__7->SetBinContent(87,7.941675);
   DisttoEdge_1__7->SetBinContent(88,7.634189);
   DisttoEdge_1__7->SetBinContent(89,7.148396);
   DisttoEdge_1__7->SetBinContent(90,6.559022);
   DisttoEdge_1__7->SetBinContent(91,5.935762);
   DisttoEdge_1__7->SetBinContent(92,3.576639);
   DisttoEdge_1__7->SetMinimum(0.005);
   DisttoEdge_1__7->SetMaximum(120);
   DisttoEdge_1__7->SetEntries(675802);
   DisttoEdge_1__7->SetStats(0);

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

   ci = TColor::GetColor("#ff00ff");
   DisttoEdge_1__7->SetMarkerColor(ci);
   DisttoEdge_1__7->GetXaxis()->SetTitle("cm");
   DisttoEdge_1__7->GetYaxis()->SetTitle("scaled number of entries");
   DisttoEdge_1__7->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("DisttoEdge_1","ME11A: mean:-9.2cm;RMS:2.3cm","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("DisttoEdge_2","ME11B: mean:-12.0cm;RMS:3.8cm","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("DisttoEdge_3","ME12+13: mean:-18.9cm;RMS:8.0cm","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("DisttoEdge_4","ME2: mean:-22.5cm;RMS:10.2cm","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("DisttoEdge_5","ME3: mean:-23.0cm;RMS:10.7cm","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("DisttoEdge_6","ME4: mean:-23.0cm;RMS:10.9cm","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 *DisttoEdge_2__8 = new TH1D("DisttoEdge_2__8","DisttoEdge",100,-60,0);
   DisttoEdge_2__8->SetBinContent(64,0.0151855);
   DisttoEdge_2__8->SetBinContent(65,0.1966523);
   DisttoEdge_2__8->SetBinContent(66,0.5071115);
   DisttoEdge_2__8->SetBinContent(67,0.8573904);
   DisttoEdge_2__8->SetBinContent(68,1.202017);
   DisttoEdge_2__8->SetBinContent(69,1.602071);
   DisttoEdge_2__8->SetBinContent(70,1.995291);
   DisttoEdge_2__8->SetBinContent(71,2.402431);
   DisttoEdge_2__8->SetBinContent(72,2.870398);
   DisttoEdge_2__8->SetBinContent(73,3.344523);
   DisttoEdge_2__8->SetBinContent(74,3.873738);
   DisttoEdge_2__8->SetBinContent(75,4.448846);
   DisttoEdge_2__8->SetBinContent(76,5.006492);
   DisttoEdge_2__8->SetBinContent(77,5.551989);
   DisttoEdge_2__8->SetBinContent(78,5.805418);
   DisttoEdge_2__8->SetBinContent(79,5.618468);
   DisttoEdge_2__8->SetBinContent(80,5.475049);
   DisttoEdge_2__8->SetBinContent(81,5.295016);
   DisttoEdge_2__8->SetBinContent(82,5.143246);
   DisttoEdge_2__8->SetBinContent(83,4.921284);
   DisttoEdge_2__8->SetBinContent(84,4.735009);
   DisttoEdge_2__8->SetBinContent(85,4.518615);
   DisttoEdge_2__8->SetBinContent(86,4.369291);
   DisttoEdge_2__8->SetBinContent(87,4.089794);
   DisttoEdge_2__8->SetBinContent(88,3.87281);
   DisttoEdge_2__8->SetBinContent(89,3.626214);
   DisttoEdge_2__8->SetBinContent(90,3.4191);
   DisttoEdge_2__8->SetBinContent(91,3.210047);
   DisttoEdge_2__8->SetBinContent(92,2.026505);
   DisttoEdge_2__8->SetEntries(1185341);
   DisttoEdge_2__8->SetStats(0);

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

   ci = TColor::GetColor("#ff9999");
   DisttoEdge_2__8->SetMarkerColor(ci);
   DisttoEdge_2__8->GetXaxis()->SetTitle("cm");
   DisttoEdge_2__8->GetYaxis()->SetTitle("scaled number of entries");
   DisttoEdge_2__8->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("DisttoEdge_1","ME11A: mean:-9.2cm;RMS:2.3cm","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("DisttoEdge_2","ME11B: mean:-12.0cm;RMS:3.8cm","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("DisttoEdge_3","ME12+13: mean:-18.9cm;RMS:8.0cm","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("DisttoEdge_4","ME2: mean:-22.5cm;RMS:10.2cm","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("DisttoEdge_5","ME3: mean:-23.0cm;RMS:10.7cm","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("DisttoEdge_6","ME4: mean:-23.0cm;RMS:10.9cm","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 *DisttoEdge_3__9 = new TH1D("DisttoEdge_3__9","DisttoEdge",100,-60,0);
   DisttoEdge_3__9->SetBinContent(34,0.0005133523);
   DisttoEdge_3__9->SetBinContent(35,0.0161706);
   DisttoEdge_3__9->SetBinContent(36,0.05082188);
   DisttoEdge_3__9->SetBinContent(37,0.0839331);
   DisttoEdge_3__9->SetBinContent(38,0.1203811);
   DisttoEdge_3__9->SetBinContent(39,0.1804433);
   DisttoEdge_3__9->SetBinContent(40,0.1706896);
   DisttoEdge_3__9->SetBinContent(41,0.2215115);
   DisttoEdge_3__9->SetBinContent(42,0.3388125);
   DisttoEdge_3__9->SetBinContent(43,0.5279828);
   DisttoEdge_3__9->SetBinContent(44,0.6676147);
   DisttoEdge_3__9->SetBinContent(45,0.8621752);
   DisttoEdge_3__9->SetBinContent(46,1.101654);
   DisttoEdge_3__9->SetBinContent(47,1.315209);
   DisttoEdge_3__9->SetBinContent(48,1.467931);
   DisttoEdge_3__9->SetBinContent(49,1.579328);
   DisttoEdge_3__9->SetBinContent(50,1.657615);
   DisttoEdge_3__9->SetBinContent(51,1.685849);
   DisttoEdge_3__9->SetBinContent(52,1.80546);
   DisttoEdge_3__9->SetBinContent(53,1.862955);
   DisttoEdge_3__9->SetBinContent(54,1.886826);
   DisttoEdge_3__9->SetBinContent(55,1.940985);
   DisttoEdge_3__9->SetBinContent(56,1.994117);
   DisttoEdge_3__9->SetBinContent(57,1.99155);
   DisttoEdge_3__9->SetBinContent(58,2.008748);
   DisttoEdge_3__9->SetBinContent(59,2.031335);
   DisttoEdge_3__9->SetBinContent(60,2.090627);
   DisttoEdge_3__9->SetBinContent(61,2.113471);
   DisttoEdge_3__9->SetBinContent(62,2.142219);
   DisttoEdge_3__9->SetBinContent(63,2.185341);
   DisttoEdge_3__9->SetBinContent(64,2.251563);
   DisttoEdge_3__9->SetBinContent(65,2.281851);
   DisttoEdge_3__9->SetBinContent(66,2.285188);
   DisttoEdge_3__9->SetBinContent(67,2.24951);
   DisttoEdge_3__9->SetBinContent(68,2.267734);
   DisttoEdge_3__9->SetBinContent(69,2.298022);
   DisttoEdge_3__9->SetBinContent(70,2.33909);
   DisttoEdge_3__9->SetBinContent(71,2.366554);
   DisttoEdge_3__9->SetBinContent(72,2.372714);
   DisttoEdge_3__9->SetBinContent(73,2.392735);
   DisttoEdge_3__9->SetBinContent(74,2.403515);
   DisttoEdge_3__9->SetBinContent(75,2.369891);
   DisttoEdge_3__9->SetBinContent(76,2.412499);
   DisttoEdge_3__9->SetBinContent(77,2.395558);
   DisttoEdge_3__9->SetBinContent(78,2.381185);
   DisttoEdge_3__9->SetBinContent(79,2.347047);
   DisttoEdge_3__9->SetBinContent(80,2.363474);
   DisttoEdge_3__9->SetBinContent(81,2.35449);
   DisttoEdge_3__9->SetBinContent(82,2.342683);
   DisttoEdge_3__9->SetBinContent(83,2.291091);
   DisttoEdge_3__9->SetBinContent(84,2.281594);
   DisttoEdge_3__9->SetBinContent(85,2.228976);
   DisttoEdge_3__9->SetBinContent(86,2.16917);
   DisttoEdge_3__9->SetBinContent(87,2.086007);
   DisttoEdge_3__9->SetBinContent(88,2.005154);
   DisttoEdge_3__9->SetBinContent(89,1.90351);
   DisttoEdge_3__9->SetBinContent(90,1.773119);
   DisttoEdge_3__9->SetBinContent(91,1.648888);
   DisttoEdge_3__9->SetBinContent(92,1.034918);
   DisttoEdge_3__9->SetEntries(389596);
   DisttoEdge_3__9->SetStats(0);
   DisttoEdge_3__9->GetXaxis()->SetTitle("cm");
   DisttoEdge_3__9->GetYaxis()->SetTitle("scaled number of entries");
   DisttoEdge_3__9->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("DisttoEdge_1","ME11A: mean:-9.2cm;RMS:2.3cm","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("DisttoEdge_2","ME11B: mean:-12.0cm;RMS:3.8cm","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("DisttoEdge_3","ME12+13: mean:-18.9cm;RMS:8.0cm","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("DisttoEdge_4","ME2: mean:-22.5cm;RMS:10.2cm","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("DisttoEdge_5","ME3: mean:-23.0cm;RMS:10.7cm","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("DisttoEdge_6","ME4: mean:-23.0cm;RMS:10.9cm","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 *DisttoEdge_4__10 = new TH1D("DisttoEdge_4__10","DisttoEdge",100,-60,0);
   DisttoEdge_4__10->SetBinContent(6,5.289032e-05);
   DisttoEdge_4__10->SetBinContent(7,0.001428039);
   DisttoEdge_4__10->SetBinContent(8,0.0065584);
   DisttoEdge_4__10->SetBinContent(9,0.0120061);
   DisttoEdge_4__10->SetBinContent(10,0.02168503);
   DisttoEdge_4__10->SetBinContent(11,0.02861367);
   DisttoEdge_4__10->SetBinContent(12,0.03268622);
   DisttoEdge_4__10->SetBinContent(13,0.03829259);
   DisttoEdge_4__10->SetBinContent(14,0.03601831);
   DisttoEdge_4__10->SetBinContent(15,0.04024954);
   DisttoEdge_4__10->SetBinContent(16,0.04305272);
   DisttoEdge_4__10->SetBinContent(17,0.05495305);
   DisttoEdge_4__10->SetBinContent(18,0.07224818);
   DisttoEdge_4__10->SetBinContent(19,0.09467368);
   DisttoEdge_4__10->SetBinContent(20,0.1241865);
   DisttoEdge_4__10->SetBinContent(21,0.1585652);
   DisttoEdge_4__10->SetBinContent(22,0.1911456);
   DisttoEdge_4__10->SetBinContent(23,0.2162156);
   DisttoEdge_4__10->SetBinContent(24,0.2491663);
   DisttoEdge_4__10->SetBinContent(25,0.2901563);
   DisttoEdge_4__10->SetBinContent(26,0.3411426);
   DisttoEdge_4__10->SetBinContent(27,0.3759973);
   DisttoEdge_4__10->SetBinContent(28,0.443644);
   DisttoEdge_4__10->SetBinContent(29,0.4799268);
   DisttoEdge_4__10->SetBinContent(30,0.5365194);
   DisttoEdge_4__10->SetBinContent(31,0.5794664);
   DisttoEdge_4__10->SetBinContent(32,0.6081329);
   DisttoEdge_4__10->SetBinContent(33,0.6263272);
   DisttoEdge_4__10->SetBinContent(34,0.6319336);
   DisttoEdge_4__10->SetBinContent(35,0.6419828);
   DisttoEdge_4__10->SetBinContent(36,0.679482);
   DisttoEdge_4__10->SetBinContent(37,0.7201547);
   DisttoEdge_4__10->SetBinContent(38,0.7782811);
   DisttoEdge_4__10->SetBinContent(39,0.8550779);
   DisttoEdge_4__10->SetBinContent(40,0.8916251);
   DisttoEdge_4__10->SetBinContent(41,0.9484822);
   DisttoEdge_4__10->SetBinContent(42,1.041146);
   DisttoEdge_4__10->SetBinContent(43,1.110697);
   DisttoEdge_4__10->SetBinContent(44,1.228113);
   DisttoEdge_4__10->SetBinContent(45,1.307925);
   DisttoEdge_4__10->SetBinContent(46,1.369013);
   DisttoEdge_4__10->SetBinContent(47,1.421269);
   DisttoEdge_4__10->SetBinContent(48,1.487646);
   DisttoEdge_4__10->SetBinContent(49,1.545138);
   DisttoEdge_4__10->SetBinContent(50,1.585705);
   DisttoEdge_4__10->SetBinContent(51,1.616646);
   DisttoEdge_4__10->SetBinContent(52,1.679691);
   DisttoEdge_4__10->SetBinContent(53,1.730148);
   DisttoEdge_4__10->SetBinContent(54,1.766378);
   DisttoEdge_4__10->SetBinContent(55,1.812816);
   DisttoEdge_4__10->SetBinContent(56,1.838362);
   DisttoEdge_4__10->SetBinContent(57,1.885381);
   DisttoEdge_4__10->SetBinContent(58,1.927535);
   DisttoEdge_4__10->SetBinContent(59,1.967044);
   DisttoEdge_4__10->SetBinContent(60,1.974713);
   DisttoEdge_4__10->SetBinContent(61,2.0001);
   DisttoEdge_4__10->SetBinContent(62,2.026281);
   DisttoEdge_4__10->SetBinContent(63,2.050875);
   DisttoEdge_4__10->SetBinContent(64,2.040826);
   DisttoEdge_4__10->SetBinContent(65,2.06304);
   DisttoEdge_4__10->SetBinContent(66,2.06579);
   DisttoEdge_4__10->SetBinContent(67,2.08171);
   DisttoEdge_4__10->SetBinContent(68,2.111964);
   DisttoEdge_4__10->SetBinContent(69,2.078484);
   DisttoEdge_4__10->SetBinContent(70,2.081393);
   DisttoEdge_4__10->SetBinContent(71,2.08372);
   DisttoEdge_4__10->SetBinContent(72,2.077215);
   DisttoEdge_4__10->SetBinContent(73,2.047966);
   DisttoEdge_4__10->SetBinContent(74,2.038129);
   DisttoEdge_4__10->SetBinContent(75,1.993595);
   DisttoEdge_4__10->SetBinContent(76,1.973021);
   DisttoEdge_4__10->SetBinContent(77,1.982224);
   DisttoEdge_4__10->SetBinContent(78,1.924256);
   DisttoEdge_4__10->SetBinContent(79,1.892257);
   DisttoEdge_4__10->SetBinContent(80,1.836881);
   DisttoEdge_4__10->SetBinContent(81,1.806522);
   DisttoEdge_4__10->SetBinContent(82,1.769446);
   DisttoEdge_4__10->SetBinContent(83,1.725229);
   DisttoEdge_4__10->SetBinContent(84,1.661179);
   DisttoEdge_4__10->SetBinContent(85,1.607813);
   DisttoEdge_4__10->SetBinContent(86,1.550321);
   DisttoEdge_4__10->SetBinContent(87,1.469875);
   DisttoEdge_4__10->SetBinContent(88,1.397627);
   DisttoEdge_4__10->SetBinContent(89,1.326489);
   DisttoEdge_4__10->SetBinContent(90,1.235359);
   DisttoEdge_4__10->SetBinContent(91,1.150206);
   DisttoEdge_4__10->SetBinContent(92,0.7047107);
   DisttoEdge_4__10->SetEntries(1890705);
   DisttoEdge_4__10->SetStats(0);

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

   ci = TColor::GetColor("#ff0000");
   DisttoEdge_4__10->SetMarkerColor(ci);
   DisttoEdge_4__10->GetXaxis()->SetTitle("cm");
   DisttoEdge_4__10->GetYaxis()->SetTitle("scaled number of entries");
   DisttoEdge_4__10->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("DisttoEdge_1","ME11A: mean:-9.2cm;RMS:2.3cm","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("DisttoEdge_2","ME11B: mean:-12.0cm;RMS:3.8cm","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("DisttoEdge_3","ME12+13: mean:-18.9cm;RMS:8.0cm","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("DisttoEdge_4","ME2: mean:-22.5cm;RMS:10.2cm","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("DisttoEdge_5","ME3: mean:-23.0cm;RMS:10.7cm","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("DisttoEdge_6","ME4: mean:-23.0cm;RMS:10.9cm","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 *DisttoEdge_5__11 = new TH1D("DisttoEdge_5__11","DisttoEdge",100,-60,0);
   DisttoEdge_5__11->SetBinContent(6,0.0001433996);
   DisttoEdge_5__11->SetBinContent(7,0.003226491);
   DisttoEdge_5__11->SetBinContent(8,0.009894573);
   DisttoEdge_5__11->SetBinContent(9,0.02258544);
   DisttoEdge_5__11->SetBinContent(10,0.03398571);
   DisttoEdge_5__11->SetBinContent(11,0.03972169);
   DisttoEdge_5__11->SetBinContent(12,0.05155216);
   DisttoEdge_5__11->SetBinContent(13,0.05363145);
   DisttoEdge_5__11->SetBinContent(14,0.05757494);
   DisttoEdge_5__11->SetBinContent(15,0.05994103);
   DisttoEdge_5__11->SetBinContent(16,0.06474492);
   DisttoEdge_5__11->SetBinContent(17,0.07944338);
   DisttoEdge_5__11->SetBinContent(18,0.108912);
   DisttoEdge_5__11->SetBinContent(19,0.1377353);
   DisttoEdge_5__11->SetBinContent(20,0.1804684);
   DisttoEdge_5__11->SetBinContent(21,0.2225562);
   DisttoEdge_5__11->SetBinContent(22,0.2616326);
   DisttoEdge_5__11->SetBinContent(23,0.2971957);
   DisttoEdge_5__11->SetBinContent(24,0.3312531);
   DisttoEdge_5__11->SetBinContent(25,0.3861034);
   DisttoEdge_5__11->SetBinContent(26,0.4476936);
   DisttoEdge_5__11->SetBinContent(27,0.5128687);
   DisttoEdge_5__11->SetBinContent(28,0.5685077);
   DisttoEdge_5__11->SetBinContent(29,0.6292375);
   DisttoEdge_5__11->SetBinContent(30,0.7008656);
   DisttoEdge_5__11->SetBinContent(31,0.7377193);
   DisttoEdge_5__11->SetBinContent(32,0.7872638);
   DisttoEdge_5__11->SetBinContent(33,0.8056907);
   DisttoEdge_5__11->SetBinContent(34,0.792713);
   DisttoEdge_5__11->SetBinContent(35,0.8489973);
   DisttoEdge_5__11->SetBinContent(36,0.8735187);
   DisttoEdge_5__11->SetBinContent(37,0.9293728);
   DisttoEdge_5__11->SetBinContent(38,0.993114);
   DisttoEdge_5__11->SetBinContent(39,1.052481);
   DisttoEdge_5__11->SetBinContent(40,1.096362);
   DisttoEdge_5__11->SetBinContent(41,1.135151);
   DisttoEdge_5__11->SetBinContent(42,1.150137);
   DisttoEdge_5__11->SetBinContent(43,1.1857);
   DisttoEdge_5__11->SetBinContent(44,1.213591);
   DisttoEdge_5__11->SetBinContent(45,1.256037);
   DisttoEdge_5__11->SetBinContent(46,1.265143);
   DisttoEdge_5__11->SetBinContent(47,1.320567);
   DisttoEdge_5__11->SetBinContent(48,1.344156);
   DisttoEdge_5__11->SetBinContent(49,1.385742);
   DisttoEdge_5__11->SetBinContent(50,1.42446);
   DisttoEdge_5__11->SetBinContent(51,1.468627);
   DisttoEdge_5__11->SetBinContent(52,1.496016);
   DisttoEdge_5__11->SetBinContent(53,1.541474);
   DisttoEdge_5__11->SetBinContent(54,1.562339);
   DisttoEdge_5__11->SetBinContent(55,1.607653);
   DisttoEdge_5__11->SetBinContent(56,1.644076);
   DisttoEdge_5__11->SetBinContent(57,1.685806);
   DisttoEdge_5__11->SetBinContent(58,1.733916);
   DisttoEdge_5__11->SetBinContent(59,1.780378);
   DisttoEdge_5__11->SetBinContent(60,1.857168);
   DisttoEdge_5__11->SetBinContent(61,1.838526);
   DisttoEdge_5__11->SetBinContent(62,1.923992);
   DisttoEdge_5__11->SetBinContent(63,1.928294);
   DisttoEdge_5__11->SetBinContent(64,1.950163);
   DisttoEdge_5__11->SetBinContent(65,1.977767);
   DisttoEdge_5__11->SetBinContent(66,1.989741);
   DisttoEdge_5__11->SetBinContent(67,2.0091);
   DisttoEdge_5__11->SetBinContent(68,2.007953);
   DisttoEdge_5__11->SetBinContent(69,2.041293);
   DisttoEdge_5__11->SetBinContent(70,2.021863);
   DisttoEdge_5__11->SetBinContent(71,1.995907);
   DisttoEdge_5__11->SetBinContent(72,2.005874);
   DisttoEdge_5__11->SetBinContent(73,2.018636);
   DisttoEdge_5__11->SetBinContent(74,1.987232);
   DisttoEdge_5__11->SetBinContent(75,1.973394);
   DisttoEdge_5__11->SetBinContent(76,1.931736);
   DisttoEdge_5__11->SetBinContent(77,1.936325);
   DisttoEdge_5__11->SetBinContent(78,1.914098);
   DisttoEdge_5__11->SetBinContent(79,1.871938);
   DisttoEdge_5__11->SetBinContent(80,1.846198);
   DisttoEdge_5__11->SetBinContent(81,1.812356);
   DisttoEdge_5__11->SetBinContent(82,1.767257);
   DisttoEdge_5__11->SetBinContent(83,1.730116);
   DisttoEdge_5__11->SetBinContent(84,1.683368);
   DisttoEdge_5__11->SetBinContent(85,1.634684);
   DisttoEdge_5__11->SetBinContent(86,1.581483);
   DisttoEdge_5__11->SetBinContent(87,1.517813);
   DisttoEdge_5__11->SetBinContent(88,1.418079);
   DisttoEdge_5__11->SetBinContent(89,1.352904);
   DisttoEdge_5__11->SetBinContent(90,1.247792);
   DisttoEdge_5__11->SetBinContent(91,1.151571);
   DisttoEdge_5__11->SetBinContent(92,0.6957032);
   DisttoEdge_5__11->SetEntries(1394704);
   DisttoEdge_5__11->SetStats(0);

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

   ci = TColor::GetColor("#00ff00");
   DisttoEdge_5__11->SetMarkerColor(ci);
   DisttoEdge_5__11->GetXaxis()->SetTitle("cm");
   DisttoEdge_5__11->GetYaxis()->SetTitle("scaled number of entries");
   DisttoEdge_5__11->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("DisttoEdge_1","ME11A: mean:-9.2cm;RMS:2.3cm","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("DisttoEdge_2","ME11B: mean:-12.0cm;RMS:3.8cm","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("DisttoEdge_3","ME12+13: mean:-18.9cm;RMS:8.0cm","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("DisttoEdge_4","ME2: mean:-22.5cm;RMS:10.2cm","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("DisttoEdge_5","ME3: mean:-23.0cm;RMS:10.7cm","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("DisttoEdge_6","ME4: mean:-23.0cm;RMS:10.9cm","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 *DisttoEdge_6__12 = new TH1D("DisttoEdge_6__12","DisttoEdge",100,-60,0);
   DisttoEdge_6__12->SetBinContent(7,0.005171053);
   DisttoEdge_6__12->SetBinContent(8,0.01669252);
   DisttoEdge_6__12->SetBinContent(9,0.0322964);
   DisttoEdge_6__12->SetBinContent(10,0.0461766);
   DisttoEdge_6__12->SetBinContent(11,0.06268768);
   DisttoEdge_6__12->SetBinContent(12,0.07393699);
   DisttoEdge_6__12->SetBinContent(13,0.07829156);
   DisttoEdge_6__12->SetBinContent(14,0.07611427);
   DisttoEdge_6__12->SetBinContent(15,0.08863366);
   DisttoEdge_6__12->SetBinContent(16,0.1075035);
   DisttoEdge_6__12->SetBinContent(17,0.1345381);
   DisttoEdge_6__12->SetBinContent(18,0.1741828);
   DisttoEdge_6__12->SetBinContent(19,0.2238068);
   DisttoEdge_6__12->SetBinContent(20,0.2754266);
   DisttoEdge_6__12->SetBinContent(21,0.3174301);
   DisttoEdge_6__12->SetBinContent(22,0.3746745);
   DisttoEdge_6__12->SetBinContent(23,0.4066081);
   DisttoEdge_6__12->SetBinContent(24,0.4223027);
   DisttoEdge_6__12->SetBinContent(25,0.442624);
   DisttoEdge_6__12->SetBinContent(26,0.484446);
   DisttoEdge_6__12->SetBinContent(27,0.5122971);
   DisttoEdge_6__12->SetBinContent(28,0.5423255);
   DisttoEdge_6__12->SetBinContent(29,0.5936732);
   DisttoEdge_6__12->SetBinContent(30,0.6491032);
   DisttoEdge_6__12->SetBinContent(31,0.6478331);
   DisttoEdge_6__12->SetBinContent(32,0.6945541);
   DisttoEdge_6__12->SetBinContent(33,0.7206815);
   DisttoEdge_6__12->SetBinContent(34,0.739007);
   DisttoEdge_6__12->SetBinContent(35,0.7577861);
   DisttoEdge_6__12->SetBinContent(36,0.8062307);
   DisttoEdge_6__12->SetBinContent(37,0.8748152);
   DisttoEdge_6__12->SetBinContent(38,0.9201753);
   DisttoEdge_6__12->SetBinContent(39,1.017427);
   DisttoEdge_6__12->SetBinContent(40,1.028949);
   DisttoEdge_6__12->SetBinContent(41,1.080387);
   DisttoEdge_6__12->SetBinContent(42,1.119578);
   DisttoEdge_6__12->SetBinContent(43,1.147248);
   DisttoEdge_6__12->SetBinContent(44,1.165211);
   DisttoEdge_6__12->SetBinContent(45,1.217919);
   DisttoEdge_6__12->SetBinContent(46,1.2357);
   DisttoEdge_6__12->SetBinContent(47,1.277522);
   DisttoEdge_6__12->SetBinContent(48,1.310726);
   DisttoEdge_6__12->SetBinContent(49,1.353274);
   DisttoEdge_6__12->SetBinContent(50,1.405982);
   DisttoEdge_6__12->SetBinContent(51,1.425759);
   DisttoEdge_6__12->SetBinContent(52,1.461503);
   DisttoEdge_6__12->SetBinContent(53,1.514756);
   DisttoEdge_6__12->SetBinContent(54,1.556215);
   DisttoEdge_6__12->SetBinContent(55,1.599035);
   DisttoEdge_6__12->SetBinContent(56,1.642036);
   DisttoEdge_6__12->SetBinContent(57,1.670432);
   DisttoEdge_6__12->SetBinContent(58,1.721507);
   DisttoEdge_6__12->SetBinContent(59,1.774851);
   DisttoEdge_6__12->SetBinContent(60,1.809596);
   DisttoEdge_6__12->SetBinContent(61,1.859493);
   DisttoEdge_6__12->SetBinContent(62,1.899863);
   DisttoEdge_6__12->SetBinContent(63,1.949578);
   DisttoEdge_6__12->SetBinContent(64,1.968901);
   DisttoEdge_6__12->SetBinContent(65,1.986682);
   DisttoEdge_6__12->SetBinContent(66,1.995845);
   DisttoEdge_6__12->SetBinContent(67,2.005189);
   DisttoEdge_6__12->SetBinContent(68,1.992125);
   DisttoEdge_6__12->SetBinContent(69,2.012356);
   DisttoEdge_6__12->SetBinContent(70,2.035943);
   DisttoEdge_6__12->SetBinContent(71,2.011902);
   DisttoEdge_6__12->SetBinContent(72,2.007729);
   DisttoEdge_6__12->SetBinContent(73,2.002921);
   DisttoEdge_6__12->SetBinContent(74,1.982418);
   DisttoEdge_6__12->SetBinContent(75,1.979243);
   DisttoEdge_6__12->SetBinContent(76,1.971441);
   DisttoEdge_6__12->SetBinContent(77,1.976703);
   DisttoEdge_6__12->SetBinContent(78,1.914741);
   DisttoEdge_6__12->SetBinContent(79,1.893603);
   DisttoEdge_6__12->SetBinContent(80,1.851328);
   DisttoEdge_6__12->SetBinContent(81,1.840895);
   DisttoEdge_6__12->SetBinContent(82,1.812137);
   DisttoEdge_6__12->SetBinContent(83,1.74455);
   DisttoEdge_6__12->SetBinContent(84,1.739651);
   DisttoEdge_6__12->SetBinContent(85,1.659092);
   DisttoEdge_6__12->SetBinContent(86,1.595315);
   DisttoEdge_6__12->SetBinContent(87,1.527729);
   DisttoEdge_6__12->SetBinContent(88,1.459053);
   DisttoEdge_6__12->SetBinContent(89,1.357447);
   DisttoEdge_6__12->SetBinContent(90,1.278339);
   DisttoEdge_6__12->SetBinContent(91,1.15006);
   DisttoEdge_6__12->SetBinContent(92,0.700088);
   DisttoEdge_6__12->SetEntries(1102290);
   DisttoEdge_6__12->SetStats(0);

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

   ci = TColor::GetColor("#0000ff");
   DisttoEdge_6__12->SetMarkerColor(ci);
   DisttoEdge_6__12->GetXaxis()->SetTitle("cm");
   DisttoEdge_6__12->GetYaxis()->SetTitle("scaled number of entries");
   DisttoEdge_6__12->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("DisttoEdge_1","ME11A: mean:-9.2cm;RMS:2.3cm","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("DisttoEdge_2","ME11B: mean:-12.0cm;RMS:3.8cm","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("DisttoEdge_3","ME12+13: mean:-18.9cm;RMS:8.0cm","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("DisttoEdge_4","ME2: mean:-22.5cm;RMS:10.2cm","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("DisttoEdge_5","ME3: mean:-23.0cm;RMS:10.7cm","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("DisttoEdge_6","ME4: mean:-23.0cm;RMS:10.9cm","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.263871,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(1);
   pt->SetFillColor(0);
   TText *AText = pt->AddText("DisttoEdge");
   pt->Draw();
   DisttoEdge->Modified();
   DisttoEdge->cd();
   DisttoEdge->SetSelected(DisttoEdge);
}
예제 #14
0
void Unfold2(int algo= 3,bool useSpectraFromFile=0, bool useMatrixFromFile=0, int doToy = 0, int isMC = 0,char *spectraFileName = (char*)"pbpb_spectra_akPu3PF.root",double recoJetPtCut = 60,double trackMaxPtCut = 0, int nBayesianIter = 4, int doBjets=0) // algo 2 =akpu2 ; 3 =akpu3 ; 4 =akpu4 ;1 = icpu5
{
  
  gStyle->SetErrorX(0.5);
  gStyle->SetPaintTextFormat("3.2f");
  gStyle->SetOptLogz(1);
  gStyle->SetPadRightMargin(0.13);	
  gStyle->SetOptTitle(0);

	const float pplumi=5.3e9;
        const bool SavePlot=kTRUE;

  TH1::SetDefaultSumw2();
  TH2::SetDefaultSumw2();
  
  // input files
  char *fileNamePP_data = (char*)"/net/hidsk0001/d00/scratch/maoyx/pPb/Btag/CodeMatt/NewFormatV4_bFractionMCTemplate_pppp1_SSVHEat2.0FixCL0_bin_0_40_eta_0_2.root";
  char *fileNamePbPb_data = (char*)"/net/hidsk0001/d00/scratch/maoyx/pPb/Btag/CodeMatt/AltBinningV6_bFractionMCTemplate_ppPbPb1_SSVHEat2.0FixCL0_bin_0_40_eta_0_2.root";
  char *fileNamePP_mc = NULL;
  if(doBjets) fileNamePP_mc = (char*)"/net/hidsk0001/d00/scratch/kjung/histos/ppMC_ppReco_ak3PF_BjetTrig_noIPupperCut.root";
  else fileNamePP_mc = (char*)"/net/hidsk0001/d00/scratch/kjung/histos//ppMC_ppReco_ak3PF_QCDjetTrig_noIPupperCut.root";
  char *fileNamePbPb_mc = NULL;
  if(doBjets)fileNamePbPb_mc = (char*) "/net/hisrv0001/home/mnguyen/scratch/bTaggingOutput/ntuples/PbPbBMC_pt30by3_ipHICalibCentWeight_noTrig.root";
  else fileNamePbPb_mc = (char*) "/net/hisrv0001/home/mnguyen/scratch/bTaggingOutput/ntuples/PbPbQCDMC_pt30by3_ipHICalibCentWeight_noTrig.root";

  // grab ntuples
  TFile *infPbPb_mc = new TFile(fileNamePbPb_mc);
  TFile *infPP_mc = new TFile(fileNamePP_mc);


  // Output file
  TFile *pbpb_Unfo;
  if (isMC) pbpb_Unfo = new TFile(Form("pbpb_Unfo_%s_MC.root",algoName[algo]),"RECREATE");
  else pbpb_Unfo  = new TFile(Form("pbpb_Unfo_%s_jtpt%.0f_trk%.0f.root",algoName[algo],recoJetPtCut,trackMaxPtCut),"RECREATE");
  // Histograms used by RooUnfold
  UnfoldingHistos *uhist[nbins_cent+1];
		
  // Initialize Histograms   
	
  for (int i=0;i<=nbins_cent;i++) uhist[i] = new UnfoldingHistos(i);
	
  // Initialize reweighting functions
  
  TCut dataSelection;
  TCut dataSelectionPP;
  TCut TriggerSelectionPP;
  TCut TriggerSelectionPbPb80;

  if(doBjets)dataSelection = "weight*(abs(refparton_flavorForB)==5&&abs(jteta)<2)";
  else dataSelection = "weight*(abs(jteta)<2)";
  

  if (isMC) cout<<"This is a MC closure test"<<endl;
  else cout<< "This is a data analysis"<<endl;    		     
	     	
  // Setup jet data branches, basically the jet tree branches are assigned to this object when we loop over the events
	
  JetDataPbPb *dataPbPb   = new JetDataPbPb(fileNamePbPb_mc,(char*)"nt"); // PbPb data	
  JetDataPP *dataPP = new JetDataPP(fileNamePP_mc,(char*)"nt");	// pp data
	
  TFile *fSpectra(0);		
  if (useSpectraFromFile||useMatrixFromFile){
    fSpectra = new TFile(spectraFileName,"read");
  }
  
  // Come back to the output file dir
  pbpb_Unfo->cd();

  // Get Jet spectra from data file
  cout <<"Reading data..."<<endl;

  // This doesn't seem to be relevant for the moment -Matt
  /*	

  TTree *tPbPbJet = (TTree*)infPbPb_mc->Get("nt");
  TTree *tPPJet  = (TTree*)infPP_mc->Get("nt");


  TCanvas * cInput = new TCanvas("cInput","Input",800,400);
  cInput->Divide(2,1);
		
  cout <<"Spectra..."<<endl;	
	
  for (int i=0;i<=nbins_cent;i++){
    cout <<nbins_cent<<endl;
    TCut centCut = Form("bin<%.0f&&bin>=%.0f",boundaries_cent[i+1],boundaries_cent[i]);
    if (useSpectraFromFile) {
      uhist[i]->hMeas = (TH1F*)fSpectra->Get(Form("hMeas_cent%d",i));
    } else {
      if (!isMC) {
	tPbPbJet->Project(Form("hMeas_cent%d",i),"jtptB", dataSelection&&centCut&&TriggerSelectionPbPb80);
      }   
    }
		
    if (useMatrixFromFile) {
      cout <<"Matrix"<<endl;
      uhist[i]->hMatrixFit = (TH2F*) fSpectra->Get(Form("hMatrixFit_cent%d",i));
      uhist[i]->hMeasMatch = (TH1F*)((TH2F*) fSpectra->Get(Form("hMatrixFit_cent%d",i)))->ProjectionY();
      uhist[i]->hMeasMatch->Divide(uhist[i]->hMeas);
    } else {
      uhist[i]->hMeasMatch = 0;
    }
    uhist[i]->hMeas->Draw();
  }

  if (!isMC) tPPJet->Project(Form("hMeas_cent%d",nbins_cent),"jtpt",dataSelectionPP&&TriggerSelectionPP);
  */
  cout <<"MC..."<<endl;	
  
  TH1F *hCent = new TH1F("hCent","",nbins_cent,boundaries_cent);
 
		
  // Fill PbPb MC   
  if (!useMatrixFromFile) {
    for (Long64_t jentry2=0; jentry2<dataPbPb->tJet->GetEntries();jentry2++) {
      dataPbPb->tJet->GetEntry(jentry2);
      
      // change when we switch to centrality binning
      int cBin = 0;
      
      //int cBin = hCent->FindBin(dataPbPb->bin)-1;
      /*
	if (cBin>=nbins_cent) continue;
	if (cBin==-1) continue;
      */
      
      if ( dataPbPb->refpt  < 0. ) continue;
      if ( dataPbPb->jteta  > 2. || dataPbPb->jteta < -2. ) continue;
      if ( dataPbPb->refpt<0) dataPbPb->refpt=0;
      if (doBjets && fabs(dataPbPb->refparton_flavorForB)!=5) continue;
      if (doBjets&& dataPbPb->discr_ssvHighEff<2) continue;
      if (doBjets && dataPbPb->jtptB < recoJetPtCut) continue;
      if (!doBjets && dataPbPb->jtptA < recoJetPtCut) continue;
      //if ( dataPbPb->isTrig <1) continue;
      
      if(!doBjets)if(dataPbPb->refpt < 50 && dataPbPb->jtptA>120) continue;
      if(doBjets)if(dataPbPb->refpt < 50 && dataPbPb->jtptB>120) continue;

      if (!isMC||jentry2 % 2 == 1) {
	if(doBjets)uhist[cBin]-> hMatrix->Fill(dataPbPb->refpt,dataPbPb->jtptB,dataPbPb->weight);
	else uhist[cBin]-> hMatrix->Fill(dataPbPb->refpt,dataPbPb->jtptA,dataPbPb->weight);
      }	  
      if (jentry2 % 2 == 0) {
	uhist[cBin]-> hGen->Fill(dataPbPb->refpt,dataPbPb->weight);   
	if(doBjets)uhist[cBin]-> hMeas->Fill(dataPbPb->jtptB,dataPbPb->weight);  	 
	else uhist[cBin]-> hMeas->Fill(dataPbPb->jtptA,dataPbPb->weight);  	 
	//uhist[cBin]-> hMeasJECSys->Fill(dataPbPb->jtpt*(1.+0.02/nbins_cent*(nbins_cent-i)),dataPbPb->weight); 
	// FIXME!!!!!!  i is supposed to be a loop over centrality !!!!
	if(doBjets)uhist[cBin]-> hMeasJECSys->Fill(dataPbPb->jtptB*(1.+0.02/nbins_cent*(nbins_cent-0)),dataPbPb->weight); 
	else uhist[cBin]-> hMeasJECSys->Fill(dataPbPb->jtptA*(1.+0.02/nbins_cent*(nbins_cent-0)),dataPbPb->weight); 
      }
    }

    //pp will just fill the last index of the centrality array

    // fill pp MC
    for (Long64_t jentry2=0; jentry2<dataPP->tJet->GetEntries();jentry2++) {
      dataPP->tJet->GetEntry(jentry2);
      
      if ( dataPP->refpt<0) continue;
      if ( dataPP->jteta  > 2. || dataPP->jteta < -2. ) continue;
      if ( dataPP->refpt<0) dataPP->refpt=0;
      if ( doBjets && fabs(dataPP->refparton_flavorForB)!=5) continue;
      if ( doBjets && dataPP->discr_ssvHighEff<2) continue;
      if ( dataPP->jtpt < recoJetPtCut) continue;
      
      if (!isMC||jentry2 % 2 == 1) {
	uhist[nbins_cent]-> hMatrix->Fill(dataPP->refpt,dataPP->jtpt,dataPP->weight);
      }	  
      if (jentry2 % 2 == 0) {
	uhist[nbins_cent]-> hGen->Fill(dataPP->refpt,dataPP->weight);   
	uhist[nbins_cent]-> hMeas->Fill(dataPP->jtpt,dataPP->weight); 
      }           
    }
  }

	

  cout <<"Response Matrix..."<<endl;
	
  TCanvas * cMatrix = new TCanvas("cMatrix","Matrix",800,400);
  cMatrix->Divide(2,1);

  for (int i=0;i<=nbins_cent;i++){
    cMatrix->cd(i+1);
    if (!useMatrixFromFile) {
      TF1 *f = new TF1("f","[0]*pow(x+[2],[1])");
      f->SetParameters(1e10,-8.8,40);
      for (int y=1;y<=uhist[i]->hMatrix->GetNbinsY();y++) {
	double sum=0;
	for (int x=1;x<=uhist[i]->hMatrix->GetNbinsX();x++) {
	  if (uhist[i]->hMatrix->GetBinContent(x,y)<=1*uhist[i]->hMatrix->GetBinError(x,y)) {
	    uhist[i]->hMatrix->SetBinContent(x,y,0);
	    uhist[i]->hMatrix->SetBinError(x,y,0);
	  }
	  sum+=uhist[i]->hMatrix->GetBinContent(x,y);
	}
				
	for (int x=1;x<=uhist[i]->hMatrix->GetNbinsX();x++) {	   
	  double ratio = 1;
	  uhist[i]->hMatrix->SetBinContent(x,y,uhist[i]->hMatrix->GetBinContent(x,y)*ratio);
	  uhist[i]->hMatrix->SetBinError(x,y,uhist[i]->hMatrix->GetBinError(x,y)*ratio);
	}
      }
    }
    uhist[i]->hResponse = (TH2F*)uhist[i]->hMatrix->Clone(Form("hResponse_cent%d",i));
    for (int y=1;y<=uhist[i]->hResponse->GetNbinsY();y++) {
      double sum=0;
      for (int x=1;x<=uhist[i]->hResponse->GetNbinsX();x++) {
	if (uhist[i]->hResponse->GetBinContent(x,y)<=0*uhist[i]->hResponse->GetBinError(x,y)) {
	  uhist[i]->hResponse->SetBinContent(x,y,0);
	  uhist[i]->hResponse->SetBinError(x,y,0);
	}
	sum+=uhist[i]->hResponse->GetBinContent(x,y);
      }
			
      for (int x=1;x<=uhist[i]->hResponse->GetNbinsX();x++) {  	
	if (sum==0) continue;
	double ratio = uhist[i]->hMeas->GetBinContent(y)/sum;
	if (uhist[i]->hMeas->GetBinContent(y)==0) ratio = 1e-100/sum;
      }
    }
		
    uhist[i]->hResponseNorm = (TH2F*)uhist[i]->hMatrix->Clone(Form("hResponseNorm_cent%d",i));
    for (int x=1;x<=uhist[i]->hResponseNorm->GetNbinsX();x++) {
      double sum=0;
      for (int y=1;y<=uhist[i]->hResponseNorm->GetNbinsY();y++) {
	if (uhist[i]->hResponseNorm->GetBinContent(x,y)<=0*uhist[i]->hResponseNorm->GetBinError(x,y)) {
	  uhist[i]->hResponseNorm->SetBinContent(x,y,0);
	  uhist[i]->hResponseNorm->SetBinError(x,y,0);
	}
	sum+=uhist[i]->hResponseNorm->GetBinContent(x,y);
      }
			
      for (int y=1;y<=uhist[i]->hResponseNorm->GetNbinsY();y++) {  	
	if (sum==0) continue;
	double ratio = 1./sum;
	uhist[i]->hResponseNorm->SetBinContent(x,y,uhist[i]->hResponseNorm->GetBinContent(x,y)*ratio);
	uhist[i]->hResponseNorm->SetBinError(x,y,uhist[i]->hResponseNorm->GetBinError(x,y)*ratio);
      }
    }
		
    uhist[i]->hResponse->Draw("col");
		
    if (!useMatrixFromFile) uhist[i]->hMatrixFit = uhist[i]->hMatrix;
    uhist[i]->hMatrixFit->SetName(Form("hMatrixFit_cent%d",i));
  }

   cMatrix->Update();
  if (isMC==0) {
    // Use measured histogram from Matt & Kurt's file
	   
    // PbPb file:

    TFile *infMatt = new TFile(fileNamePbPb_data);
    TH1F *hMattPbPb = NULL;
    if(doBjets) hMattPbPb = (TH1F*) infMatt->Get("hRawBData");
    else hMattPbPb = (TH1F*) infMatt->Get("hIncJetsData");
    divideBinWidth(hMattPbPb);
           
    // Need to match the binning carefully, please double check whenever you change the binning
    for (int i=1;i<=hMattPbPb->GetNbinsX();i++)
      {
	uhist[0]->hMeas->SetBinContent(i+uhist[0]->hMeas->FindBin(61)-1,hMattPbPb->GetBinContent(i));  
	uhist[0]->hMeas->SetBinError(i+uhist[0]->hMeas->FindBin(61)-1,hMattPbPb->GetBinError(i));  
      }

    // pp file:
    // The file name needs to be updated!!!!!
    TFile *infMattPP = new TFile(fileNamePP_data);
    TH1F *hMattPP = NULL;
    if(doBjets)hMattPP = (TH1F*) infMattPP->Get("hRawBData");
    else hMattPP = (TH1F*) infMattPP->Get("hIncJetsData");
    divideBinWidth(hMattPP);
	   
    // Need to match the binning carefully, please double check whenever you change the binning
    for (int i=1;i<=hMattPP->GetNbinsX();i++)
      {
	uhist[nbins_cent]->hMeas->SetBinContent(i+uhist[nbins_cent]->hMeas->FindBin(61)-1,hMattPP->GetBinContent(i));  
	uhist[nbins_cent]->hMeas->SetBinError(i+uhist[nbins_cent]->hMeas->FindBin(61)-1,hMattPP->GetBinError(i));  
      }

  }

 
  pbpb_Unfo->cd();
	
  cout << "==================================== UNFOLD ===================================" << endl;
	
  //char chmet[100]; 
	
  // ======================= Reconstructed pp and PbPb spectra =========================================================
  TCanvas * cPbPb = new TCanvas("cPbPb","Comparison",1200,600);
  cPbPb->Divide(2,1); 
  cPbPb->cd(1);
	
	
  for (int i=0;i<=nbins_cent;i++) {
    cPbPb->cd(i+1)->SetLogy();   
    // Do Bin-by-bin
    TH1F *hBinByBinCorRaw = (TH1F*)uhist[i]->hResponse->ProjectionY(); 
    TH1F *hMCGen           = (TH1F*)uhist[i]->hResponse->ProjectionX(); // gen
    hBinByBinCorRaw->Divide(hMCGen);
    TF1 *f = new TF1("f","[0]+[1]*x");
    hBinByBinCorRaw->Fit("f","LL ","",90,300);
    TH1F* hBinByBinCor = (TH1F*)hBinByBinCorRaw->Clone();//functionHist(f,hBinByBinCorRaw,Form("hBinByBinCor_cent%d",i));
    delete hBinByBinCorRaw;
    delete hMCGen;
    uhist[i]->hRecoBinByBin = (TH1F*) uhist[i]->hMeas->Clone(Form("hRecoBinByBin_cent%d",i));
    uhist[i]->hRecoBinByBin->Divide(hBinByBinCor);
		
    // Do unfolding
    //if (isMC) uhist[i]->hMeas = (TH1F*)uhist[i]->hMatrix->ProjectionY()->Clone(Form("hMeas_cent%d",i));
    prior myPrior(uhist[i]->hMatrixFit,uhist[i]->hMeas,0);
  //  myPrior.unfold(uhist[i]->hMeas,1);
    myPrior.unfold(uhist[i]->hMeas,nBayesianIter);
    TH1F *hPrior;//=(TH1F*) functionHist(fPow,uhist[i]->hMeas,Form("hPrior_cent%d",i));
    hPrior = (TH1F*)uhist[i]->hGen->Clone("hPrior");//(TH1F*)uhist[i]->hMeas->Clone(Form("hPrior_cent%d",i));
    removeZero(hPrior);
		
    bayesianUnfold myUnfoldingJECSys(uhist[i]->hMatrixFit,hPrior,0);
    myUnfoldingJECSys.unfold(uhist[i]->hMeasJECSys,nBayesianIter);
    bayesianUnfold myUnfoldingSmearSys(uhist[i]->hMatrixFit,hPrior,0);
    myUnfoldingSmearSys.unfold(uhist[i]->hMeasSmearSys,nBayesianIter);
    bayesianUnfold myUnfolding(uhist[i]->hMatrixFit,myPrior.hPrior,0);
    myUnfolding.unfold(uhist[i]->hMeas,nBayesianIter);
    cout <<"Unfolding bin "<<i<<endl;

    // Iteration Systematics
    for (int j=2;j<=40;j++)
      {
	bayesianUnfold myUnfoldingSys(uhist[i]->hMatrixFit,hPrior,0);
	myUnfoldingSys.unfold(uhist[i]->hMeas,j);
	uhist[i]->hRecoIterSys[j]  = (TH1F*) myUnfoldingSys.hPrior->Clone(Form("hRecoRAA_IterSys%d_cent%d",j,i));
      }
		
		
    uhist[i]->hReco         = (TH1F*) uhist[i]->hRecoIterSys[nBayesianIter]->Clone(Form("Unfolded_cent%i",i));
    uhist[i]->hRecoJECSys   = (TH1F*) myUnfoldingJECSys.hPrior->Clone(Form("UnfoldedJeCSys_cent%i",i));
    uhist[i]->hRecoSmearSys   = (TH1F*) myUnfoldingSmearSys.hPrior->Clone(Form("UnfoldedSmearSys_cent%i",i));
    uhist[i]->hRecoBinByBin->SetName(Form("UnfoldedBinByBin_cent%i",i));
		
    if (doToy) {
      TCanvas *cToy = new TCanvas("cToy","toy",600,600);
      cToy->cd();
      int nExp=1000;
      TH1F *hTmp[nbins_truth+1];
      TH1F *hTmp2[nbins_truth+1];
      for (int j=1;j<=nbins_truth;j++) {
	hTmp[j] = new TH1F(Form("hTmp%d",j),"",200,0,10.+uhist[i]->hReco->GetBinContent(j)*2);
	hTmp2[j] = new TH1F(Form("hTmp2%d",j),"",200,0,10.+uhist[i]->hRecoBinByBin->GetBinContent(j)*2);
      }
      for (int exp =0; exp<nExp; exp++) {
	TH1F *hToy = (TH1F*)uhist[i]->hMeas->Clone();   
	TH2F *hMatrixToy = (TH2F*)uhist[i]->hMatrixFit->Clone();
	hToy->SetName("hToy");
	if (exp%100==0) cout <<"Pseudo-experiment "<<exp<<endl;
	for (int j=1;j<=hToy->GetNbinsX();j++) {
	  double value = gRandom->Poisson(uhist[i]->hMeas->GetBinContent(j));
	  hToy->SetBinContent(j,value);
	}
				
	for (int j=1;j<=hMatrixToy->GetNbinsX();j++) {
	  for (int k=1;k<=hMatrixToy->GetNbinsY();k++) {
	    double value = gRandom->Gaus(uhist[i]->hMatrixFit->GetBinContent(j,k),uhist[i]->hMatrixFit->GetBinError(j,k));
	    hMatrixToy->SetBinContent(j,k,value);
	  }
	}

	prior myPriorToy(hMatrixToy,hToy,0.0);
	myPriorToy.unfold(hToy,1);
	bayesianUnfold myUnfoldingToy(hMatrixToy,myPriorToy.hPrior,0.0);
	myUnfoldingToy.unfold(hToy,nBayesianIter);
	TH1F *hRecoTmp = (TH1F*) myUnfoldingToy.hPrior->Clone();
				
	for (int j=1;j<=hRecoTmp->GetNbinsX();j++) {
	  hTmp[j]->Fill(hRecoTmp->GetBinContent(j));
	}
	delete hToy;
	delete hRecoTmp;
	delete hMatrixToy;
      }
      TF1 *fGaus = new TF1("fGaus","[0]*TMath::Gaus(x,[1],[2])");
      for (int j=1;j<=nbins_truth;j++)
	{
	  f->SetParameters(hTmp[j]->GetMaximum(),hTmp[j]->GetMean(),hTmp[j]->GetRMS());
				
	  if (hTmp[j]->GetMean()>0) {
	    hTmp[j]->Fit(fGaus,"LL Q ");
	    hTmp[j]->Fit(fGaus,"LL Q ");
	    uhist[i]->hReco->SetBinError(j,f->GetParameter(2));
	  }	       
	  f->SetParameters(hTmp2[j]->GetMaximum(),hTmp2[j]->GetMean(),hTmp2[j]->GetRMS());
	  if (hTmp2[j]->GetMean()>0) {
	    hTmp2[j]->Fit(fGaus,"LL Q ");
	    hTmp2[j]->Fit(fGaus,"LL Q ");
	    uhist[i]->hRecoBinByBin->SetBinError(j,f->GetParameter(2));
	  }	       
	  delete hTmp[j];
	  delete hTmp2[j];
	}
      cPbPb->cd(i+1);
    }

    uhist[i]->hMeas->SetMarkerStyle(20);
    uhist[i]->hMeas->SetMarkerColor(1);
    uhist[i]->hReco->SetMarkerStyle(24);
    uhist[i]->hReco->SetMarkerColor(2);
    uhist[i]->hReco->SetLineColor(2);
    uhist[i]->hReco->SetName(Form("hReco_cent%d",i));
    uhist[i]->hReco->Draw("");    
    makeHistTitle(uhist[i]->hReco,"","Jet p_{T} (GeV/c)","dN_{jets} / dp_{T}");
    uhist[i]->hReco->GetYaxis()->SetTitleOffset(1.3);
    uhist[i]->hReco->GetXaxis()->SetTitleOffset(1.2);
    uhist[i]->hGen->SetLineWidth(1);
    uhist[i]->hGen->SetLineColor(1);
    if(isMC)uhist[i]->hGen->Draw("hist same");
    uhist[i]->hReco->Draw("same");    
    uhist[i]->hRecoBinByBin->SetMarkerStyle(28);
    uhist[i]->hRecoBinByBin->SetMarkerColor(4);
    uhist[i]->hRecoBinByBin->SetLineColor(4);
    uhist[i]->hRecoBinByBin->Draw("same");    
    uhist[i]->hReco->SetAxisRange(60,300);
    TH1F *hReproduced = (TH1F*)myUnfolding.hReproduced->Clone(Form("hReproduced_cent%d",i));
    hReproduced->SetMarkerColor(4);
    hReproduced->SetMarkerStyle(24);
    uhist[i]->hMeas->Draw("same");    
		
    TLegend *leg = new TLegend(0.5,0.5,0.9,0.9);
    leg->SetBorderSize(0);
    leg->SetFillStyle(0);
    leg->AddEntry(uhist[i]->hMeas,"Measured","pl");
    leg->AddEntry(uhist[i]->hReco,"Bayesian unfolded","pl");
    leg->AddEntry(uhist[i]->hRecoBinByBin,"Bin-by-bin unfolded","pl");
    if(isMC)leg->AddEntry(uhist[i]->hGen,"Generator level truth","l");
    leg->Draw();
  }	     
  
  cPbPb->Update();

 // ======================= Unfolding closure in MC =========================================================
  TCanvas * cRatio = new TCanvas("cRatio","Ratio",1200,600);
    TH1F * hReco[nbins_cent+1];
    TH1F * hRecoBinByBin[nbins_cent+1];
    TH1F * hMeas[nbins_cent+1];
    TH1F * hGen[nbins_cent+1];
    TLegend *leg[nbins_cent+1];
  TLine *line = new TLine(60,1,250,1);
	line->SetLineStyle(2);
	line->SetLineWidth(2);
 
    for (int i=0;i<=nbins_cent;i++) {
        hReco[i]          = (TH1F*)uhist[i]->hReco->Clone(Form("hReco_Cen%d", i));
        hRecoBinByBin[i]          = (TH1F*)uhist[i]->hRecoBinByBin->Clone(Form("hRecoBinByBin_Cen%d", i));
        hMeas[i]          = (TH1F*)uhist[i]->hMeas->Clone(Form("hMeas_Cen%d", i));
        if(isMC) hGen[i]          = (TH1F*)uhist[i]->hGen->Clone(Form("hGen_Cen%d", i));
    }
    
  if(isMC){
    cRatio->Divide(2,1);
      for (int i=0;i<=nbins_cent;i++) {
          
          hMeas[i]->Divide(hGen[i]);
          hRecoBinByBin[i]->Divide(hGen[i]);
          hReco[i]->Divide(hGen[i]);
          cRatio->cd(i+1);

		//hRecoPP->SetAxisRange(90,300,"X");
		hReco[i]->SetAxisRange(0,2,"Y");
		hReco[i]->SetMarkerStyle(24);
		hReco[i] ->SetLineColor(2);
		hReco[i] ->SetMarkerColor(2);
		hMeas[i]->SetMarkerStyle(20);
		hMeas[i]->SetLineColor(1);
		hMeas[i]->SetMarkerColor(1);
		hRecoBinByBin[i]->SetMarkerStyle(28);
		hRecoBinByBin[i]->SetLineColor(4);
		hRecoBinByBin[i]->SetMarkerColor(4);
		
		makeHistTitle(hReco[i],"","Jet p_{T} (GeV/c)","Reco / Truth");
		hReco[i]->GetYaxis()->SetTitleOffset(1.4);
		hReco[i]->GetXaxis()->SetTitleOffset(1.2);
		hReco[i]->Draw("");
		hRecoBinByBin[i]->Draw("same");
		hMeas[i]->Draw("same");
		line->Draw();
		
		leg[i] = myLegend(0.52,0.65,0.85,0.9);
		leg[i]->AddEntry(hReco[i],"Bayesian","pl");
		leg[i]->AddEntry(hRecoBinByBin[i],"Bin-by-bin","pl");
		leg[i]->AddEntry(hMeas[i],"no unfolding","pl");
		leg[i]->Draw();
		putCMSPrel(0.2,0.83,0.06);
		drawText("Anti-k_{T} Particle Flow Jets   R = 0.3",0.2,0.23,20);
		drawText("CMS Simulation",0.6,0.4,22);
		drawText("| #eta | <2 ",0.6,0.31,22);
      }
  }
  else {
      hMeas[nbins_cent]->Scale(1./CorFac[6]/5.3e9);
      hRecoBinByBin[nbins_cent]->Scale(1./CorFac[6]/5.3e9);
      hReco[nbins_cent]->Scale(1./CorFac[6]/5.3e9);
      cRatio->cd(1);
      
      for (int i=0;i<nbins_cent;i++) {
          hMeas[i]            ->Scale(1./CorFac[i]/1.0908e9/TAA[i]);
          hRecoBinByBin[i]            ->Scale(1./CorFac[i]/1.0908e9/TAA[i]);
          hReco[i]            ->Scale(1./CorFac[i]/1.0908e9/TAA[i]);
          
          hMeas[i]->Divide(hMeas[nbins_cent]);
          hRecoBinByBin[i]->Divide(hRecoBinByBin[nbins_cent]);
          hReco[i]->Divide(hReco[nbins_cent]);
          
          hReco[i]->SetAxisRange(0,2,"Y");
          hReco[i]->SetMarkerStyle(24);
          hReco[i] ->SetLineColor(2);
          hReco[i] ->SetMarkerColor(2);
          hMeas[i]->SetMarkerStyle(20);
          hMeas[i]->SetLineColor(1);
          hMeas[i]->SetMarkerColor(1);
          hRecoBinByBin[i]->SetMarkerStyle(28);
          hRecoBinByBin[i]->SetLineColor(4);
          hRecoBinByBin[i]->SetMarkerColor(4);
         // if(i==0){
          makeHistTitle(hReco[i],"","Jet p_{T} (GeV/c)","Spectra Ratio");
          hReco[i]->GetYaxis()->SetTitleOffset(1.4);
          hReco[i]->GetXaxis()->SetTitleOffset(1.2);
          hReco[i]->Draw("");
              leg[i] = myLegend(0.52,0.65,0.85,0.9);
              leg[i]->AddEntry(hReco[i],"Bayesian","pl");
              leg[i]->AddEntry(hRecoBinByBin[i],"Bin-by-bin","pl");
              leg[i]->AddEntry(hMeas[i],"no unfolding","pl");
              leg[i]->Draw();

       //   }
       //   else {
          hReco[i]->Draw("same");
          hRecoBinByBin[i]->Draw("same");
          hMeas[i]->Draw("same");
      //    }
       } 
         line->Draw();
          
          putCMSPrel(0.2,0.83,0.06);
          drawText(Form("#intL dt = %.f #mub^{-1}",150.),0.2,0.78,22);
          drawText("Anti-k_{T} Particle Flow Jets   R = 0.3",0.2,0.73,20);
          drawText("| #eta | <2 ",0.6,0.69,22);
  
  }
    cRatio->Update();

  pbpb_Unfo->Write();

  SysData systematics;

  // Iteration systematics
  TCanvas *cIterSys = new TCanvas("cIterSys","IterSys",1200,600);
  cIterSys->Divide(2,1);
  cIterSys->cd(2);
  TH1F *hRecoIterSysPP[100];
  TH1F *hRebinPP_tmp         = rebin(uhist[nbins_cent]->hReco, (char*)"hRebinPP_tmp");
  TLegend *legBayesianIterPP = myLegend(0.4,0.7,0.9,0.9);
  legBayesianIterPP->AddEntry("","PP","");
         
  for (int j=2;j<7;j++) {
    hRecoIterSysPP[j] = rebin(uhist[nbins_cent]->hRecoIterSys[j],Form("hRecoIterSysPP_IterSys%d",j));
    hRecoIterSysPP[j]->SetLineColor(colorCode[j-2]);
    hRecoIterSysPP[j]->SetMarkerColor(colorCode[j-2]);
    hRecoIterSysPP[j]->Divide(hRebinPP_tmp);
    if (j==2){
    //  makeHistTitle(hRecoIterSysPP[j],(char*)"",(char*)"Jet p_{T} (GeV/c)",(char*)"Ratio (Unfolded / Nominal)");
      makeHistTitle(hRecoIterSysPP[j],"","Jet p_{T} (GeV/c)","Ratio (Unfolded / Nominal)");
      hRecoIterSysPP[j]->SetTitleOffset(1.3,"Y");
      hRecoIterSysPP[j]->SetTitleOffset(1.2,"X");
      hRecoIterSysPP[j]->SetAxisRange(0,2,"Y");
      hRecoIterSysPP[j]->Draw(); 
    } else {
      hRecoIterSysPP[j]->Draw("same");
    }
         
    checkMaximumSys(systematics.hSysIter[nbins_cent],hRecoIterSysPP[j],0,1.1);
    legBayesianIterPP->AddEntry(hRecoIterSysPP[j],Form("Iteration %d",j),"pl");     
  }
      
  legBayesianIterPP->Draw();
  line->Draw();
  drawEnvelope(systematics.hSysIter[nbins_cent],(char*)"hist same");


  cIterSys->cd(1);
  TH1F *hRecoIterSysPbPb[100];
  TH1F *hRebinPbPb_tmp         = rebin(uhist[0]->hReco, (char*)"hRebinPbPb_tmp");
  TLegend *legBayesianIterPbPb = myLegend(0.4,0.7,0.9,0.9);
  legBayesianIterPbPb->AddEntry("","PbPb","");
  for (int j=2;j<7;j++) {
    hRecoIterSysPbPb[j] = rebin(uhist[0]->hRecoIterSys[j],Form("hRecoIterSysPbPb_IterSys%d",j));
    hRecoIterSysPbPb[j]->SetLineColor(colorCode[j-2]);
    hRecoIterSysPbPb[j]->SetMarkerColor(colorCode[j-2]);
    hRecoIterSysPbPb[j]->Divide(hRebinPbPb_tmp);
    if (j==2){
    //  makeHistTitle(hRecoIterSysPbPb[j],(char*)"",(char*)"Jet p_{T} (GeV/c)",(char*)"Ratio (Unfolded / Nominal)");
      makeHistTitle(hRecoIterSysPbPb[j],"","Jet p_{T} (GeV/c)","Ratio (Unfolded / Nominal)");
      hRecoIterSysPbPb[j]->SetTitleOffset(1.3,"Y");
      hRecoIterSysPbPb[j]->SetTitleOffset(1.2,"X");
      hRecoIterSysPbPb[j]->SetAxisRange(0,2,"Y");
      hRecoIterSysPbPb[j]->Draw(); 
    } else {
      hRecoIterSysPbPb[j]->Draw("same");
    }
         
    checkMaximumSys(systematics.hSysIter[0],hRecoIterSysPbPb[j],0,1.1);
    legBayesianIterPbPb->AddEntry(hRecoIterSysPbPb[j],Form("Iteration %d",j),"pl");     
  }
  legBayesianIterPbPb->Draw();
  line->Draw();
  drawEnvelope(systematics.hSysIter[0],(char*)"hist same");
  
  cIterSys->Update();
  
  TString data ;
  if(isMC) data="MC";
  else data="Data";
 TString anaType ;
  if(doBjets) anaType="Bjet";
  else anaType="Inclusive";
  
  if(SavePlot){
    cMatrix->SaveAs(Form("plots/%s%s%sResponseMatrix.gif", data.Data(), anaType.Data(), algoName[algo]));
    cPbPb->SaveAs(Form("plots/%s%s%sJetSpectra.gif",  data.Data(), anaType.Data(), algoName[algo]));
    cRatio->SaveAs(Form("plots/%s%s%sJetRatio.gif",  data.Data(), anaType.Data(), algoName[algo]));
    cIterSys->SaveAs(Form("plots/%s%s%sIterationSys.gif",  data.Data(), anaType.Data(), algoName[algo]));
}
}
void SegtoLCTXY_2015all_sameYrange_fullIntegral()
{
//=========Macro generated from canvas: SegtoLCTXY/SegtoLCTXY
//=========  (Fri Aug  5 09:06:02 2016) by ROOT version6.06/01
   TCanvas *SegtoLCTXY = new TCanvas("SegtoLCTXY", "SegtoLCTXY",0,0,500,500);
   gStyle->SetOptStat(0);
   SegtoLCTXY->SetHighLightColor(2);
   SegtoLCTXY->Range(-6.125,-2.123713,45.125,2.123713);
   SegtoLCTXY->SetFillColor(0);
   SegtoLCTXY->SetBorderMode(0);
   SegtoLCTXY->SetBorderSize(2);
   SegtoLCTXY->SetLogy();
   SegtoLCTXY->SetFrameBorderMode(0);
   SegtoLCTXY->SetFrameBorderMode(0);
   
   TH1D *SegtoLCTXY_1__85 = new TH1D("SegtoLCTXY_1__85","SegtoLCTXY",100,-1,40);
   SegtoLCTXY_1__85->SetBinContent(3,83.85483);
   SegtoLCTXY_1__85->SetBinContent(4,4.975421);
   SegtoLCTXY_1__85->SetBinContent(5,3.354198);
   SegtoLCTXY_1__85->SetBinContent(6,2.52137);
   SegtoLCTXY_1__85->SetBinContent(7,2.310501);
   SegtoLCTXY_1__85->SetBinContent(8,0.5602304);
   SegtoLCTXY_1__85->SetBinContent(9,0.2634187);
   SegtoLCTXY_1__85->SetBinContent(10,0.1717543);
   SegtoLCTXY_1__85->SetBinContent(11,0.1882513);
   SegtoLCTXY_1__85->SetBinContent(12,0.1231948);
   SegtoLCTXY_1__85->SetBinContent(13,0.1062988);
   SegtoLCTXY_1__85->SetBinContent(14,0.09645383);
   SegtoLCTXY_1__85->SetBinContent(15,0.0973851);
   SegtoLCTXY_1__85->SetBinContent(16,0.08727408);
   SegtoLCTXY_1__85->SetBinContent(17,0.06439124);
   SegtoLCTXY_1__85->SetBinContent(18,0.07104323);
   SegtoLCTXY_1__85->SetBinContent(19,0.06465732);
   SegtoLCTXY_1__85->SetBinContent(20,0.05481238);
   SegtoLCTXY_1__85->SetBinContent(21,0.04377008);
   SegtoLCTXY_1__85->SetBinContent(22,0.05055511);
   SegtoLCTXY_1__85->SetBinContent(23,0.03911369);
   SegtoLCTXY_1__85->SetBinContent(24,0.03565466);
   SegtoLCTXY_1__85->SetBinContent(25,0.03698505);
   SegtoLCTXY_1__85->SetBinContent(26,0.04097625);
   SegtoLCTXY_1__85->SetBinContent(27,0.03099826);
   SegtoLCTXY_1__85->SetBinContent(28,0.03485642);
   SegtoLCTXY_1__85->SetBinContent(29,0.0324617);
   SegtoLCTXY_1__85->SetBinContent(30,0.03139738);
   SegtoLCTXY_1__85->SetBinContent(31,0.02660795);
   SegtoLCTXY_1__85->SetBinContent(32,0.02953483);
   SegtoLCTXY_1__85->SetBinContent(33,0.02980091);
   SegtoLCTXY_1__85->SetBinContent(34,0.03033307);
   SegtoLCTXY_1__85->SetBinContent(35,0.02288284);
   SegtoLCTXY_1__85->SetBinContent(36,0.02181852);
   SegtoLCTXY_1__85->SetBinContent(37,0.02687403);
   SegtoLCTXY_1__85->SetBinContent(38,0.02235068);
   SegtoLCTXY_1__85->SetBinContent(39,0.01782733);
   SegtoLCTXY_1__85->SetBinContent(40,0.01862557);
   SegtoLCTXY_1__85->SetBinContent(41,0.02048812);
   SegtoLCTXY_1__85->SetBinContent(42,0.01516653);
   SegtoLCTXY_1__85->SetBinContent(43,0.01702909);
   SegtoLCTXY_1__85->SetBinContent(44,0.01596477);
   SegtoLCTXY_1__85->SetBinContent(45,0.01729517);
   SegtoLCTXY_1__85->SetBinContent(46,0.01676301);
   SegtoLCTXY_1__85->SetBinContent(47,0.01250574);
   SegtoLCTXY_1__85->SetBinContent(48,0.01197358);
   SegtoLCTXY_1__85->SetBinContent(49,0.01383613);
   SegtoLCTXY_1__85->SetBinContent(50,0.01223966);
   SegtoLCTXY_1__85->SetBinContent(51,0.01596477);
   SegtoLCTXY_1__85->SetBinContent(52,0.01277182);
   SegtoLCTXY_1__85->SetBinContent(53,0.01330398);
   SegtoLCTXY_1__85->SetBinContent(54,0.006651988);
   SegtoLCTXY_1__85->SetBinContent(55,0.009312783);
   SegtoLCTXY_1__85->SetBinContent(56,0.008514545);
   SegtoLCTXY_1__85->SetBinContent(57,0.01011102);
   SegtoLCTXY_1__85->SetBinContent(58,0.008248465);
   SegtoLCTXY_1__85->SetBinContent(59,0.006651988);
   SegtoLCTXY_1__85->SetBinContent(60,0.006651988);
   SegtoLCTXY_1__85->SetBinContent(61,0.007450227);
   SegtoLCTXY_1__85->SetBinContent(62,0.007716306);
   SegtoLCTXY_1__85->SetBinContent(63,0.007716306);
   SegtoLCTXY_1__85->SetBinContent(64,0.007184147);
   SegtoLCTXY_1__85->SetBinContent(65,0.004390312);
   SegtoLCTXY_1__85->SetBinContent(66,0.007051107);
   SegtoLCTXY_1__85->SetBinContent(67,0.00558767);
   SegtoLCTXY_1__85->SetBinContent(68,0.005853749);
   SegtoLCTXY_1__85->SetBinContent(69,0.005055511);
   SegtoLCTXY_1__85->SetBinContent(70,0.006119829);
   SegtoLCTXY_1__85->SetBinContent(71,0.004523352);
   SegtoLCTXY_1__85->SetBinContent(72,0.004789431);
   SegtoLCTXY_1__85->SetBinContent(73,0.004257272);
   SegtoLCTXY_1__85->SetBinContent(74,0.004656392);
   SegtoLCTXY_1__85->SetBinContent(75,0.006651988);
   SegtoLCTXY_1__85->SetBinContent(76,0.004257272);
   SegtoLCTXY_1__85->SetBinContent(77,0.005055511);
   SegtoLCTXY_1__85->SetBinContent(78,0.004523352);
   SegtoLCTXY_1__85->SetBinContent(79,0.004922471);
   SegtoLCTXY_1__85->SetBinContent(80,0.004257272);
   SegtoLCTXY_1__85->SetBinContent(81,0.001596477);
   SegtoLCTXY_1__85->SetBinContent(82,0.002926875);
   SegtoLCTXY_1__85->SetBinContent(83,0.003725113);
   SegtoLCTXY_1__85->SetBinContent(84,0.003725113);
   SegtoLCTXY_1__85->SetBinContent(85,0.004257272);
   SegtoLCTXY_1__85->SetBinContent(86,0.001862557);
   SegtoLCTXY_1__85->SetBinContent(87,0.002394716);
   SegtoLCTXY_1__85->SetBinContent(88,0.003459034);
   SegtoLCTXY_1__85->SetBinContent(89,0.002394716);
   SegtoLCTXY_1__85->SetBinContent(90,0.001862557);
   SegtoLCTXY_1__85->SetBinContent(91,0.001596477);
   SegtoLCTXY_1__85->SetBinContent(92,0.001330398);
   SegtoLCTXY_1__85->SetBinContent(93,0.003192954);
   SegtoLCTXY_1__85->SetBinContent(94,0.001330398);
   SegtoLCTXY_1__85->SetBinContent(95,0.002394716);
   SegtoLCTXY_1__85->SetBinContent(96,0.0007982386);
   SegtoLCTXY_1__85->SetBinContent(97,0.002394716);
   SegtoLCTXY_1__85->SetBinContent(98,0.003192954);
   SegtoLCTXY_1__85->SetBinContent(99,0.002128636);
   SegtoLCTXY_1__85->SetBinContent(100,0.001064318);
   SegtoLCTXY_1__85->SetBinContent(101,2.265268);
   SegtoLCTXY_1__85->SetMinimum(0.02);
   SegtoLCTXY_1__85->SetMaximum(50);
   SegtoLCTXY_1__85->SetEntries(768682);
   SegtoLCTXY_1__85->SetStats(0);

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

   ci = TColor::GetColor("#ff00ff");
   SegtoLCTXY_1__85->SetMarkerColor(ci);
   SegtoLCTXY_1__85->GetXaxis()->SetTitle("cm");
   SegtoLCTXY_1__85->GetYaxis()->SetTitle("scaled number of entries");
   SegtoLCTXY_1__85->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("SegtoLCTXY_1","ME11A: mean:0.4cm;RMS:1.8cm","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("SegtoLCTXY_2","ME11B: mean:0.4cm;RMS:1.8cm","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("SegtoLCTXY_3","ME12+13: mean:0.8cm;RMS:1.8cm","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("SegtoLCTXY_4","ME2: mean:0.4cm;RMS:1.4cm","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("SegtoLCTXY_5","ME3: mean:0.5cm;RMS:1.2cm","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("SegtoLCTXY_6","ME4: mean:0.6cm;RMS:1.3cm","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 *SegtoLCTXY_2__86 = new TH1D("SegtoLCTXY_2__86","SegtoLCTXY",100,-1,40);
   SegtoLCTXY_2__86->SetBinContent(3,75.44745);
   SegtoLCTXY_2__86->SetBinContent(4,5.468124);
   SegtoLCTXY_2__86->SetBinContent(5,5.98796);
   SegtoLCTXY_2__86->SetBinContent(6,4.774382);
   SegtoLCTXY_2__86->SetBinContent(7,4.827162);
   SegtoLCTXY_2__86->SetBinContent(8,0.9908015);
   SegtoLCTXY_2__86->SetBinContent(9,0.3601927);
   SegtoLCTXY_2__86->SetBinContent(10,0.2626692);
   SegtoLCTXY_2__86->SetBinContent(11,0.2477547);
   SegtoLCTXY_2__86->SetBinContent(12,0.1857074);
   SegtoLCTXY_2__86->SetBinContent(13,0.127787);
   SegtoLCTXY_2__86->SetBinContent(14,0.09810274);
   SegtoLCTXY_2__86->SetBinContent(15,0.07993021);
   SegtoLCTXY_2__86->SetBinContent(16,0.07160414);
   SegtoLCTXY_2__86->SetBinContent(17,0.06233687);
   SegtoLCTXY_2__86->SetBinContent(18,0.05697923);
   SegtoLCTXY_2__86->SetBinContent(19,0.0528524);
   SegtoLCTXY_2__86->SetBinContent(20,0.04191992);
   SegtoLCTXY_2__86->SetBinContent(21,0.03764829);
   SegtoLCTXY_2__86->SetBinContent(22,0.03554867);
   SegtoLCTXY_2__86->SetBinContent(23,0.03525907);
   SegtoLCTXY_2__86->SetBinContent(24,0.03381106);
   SegtoLCTXY_2__86->SetBinContent(25,0.02874302);
   SegtoLCTXY_2__86->SetBinContent(26,0.0266434);
   SegtoLCTXY_2__86->SetBinContent(27,0.02135816);
   SegtoLCTXY_2__86->SetBinContent(28,0.02324058);
   SegtoLCTXY_2__86->SetBinContent(29,0.02447139);
   SegtoLCTXY_2__86->SetBinContent(30,0.02114096);
   SegtoLCTXY_2__86->SetBinContent(31,0.01838974);
   SegtoLCTXY_2__86->SetBinContent(32,0.02172016);
   SegtoLCTXY_2__86->SetBinContent(33,0.02012735);
   SegtoLCTXY_2__86->SetBinContent(34,0.01759333);
   SegtoLCTXY_2__86->SetBinContent(35,0.01969295);
   SegtoLCTXY_2__86->SetBinContent(36,0.01730373);
   SegtoLCTXY_2__86->SetBinContent(37,0.01723133);
   SegtoLCTXY_2__86->SetBinContent(38,0.01694173);
   SegtoLCTXY_2__86->SetBinContent(39,0.01491451);
   SegtoLCTXY_2__86->SetBinContent(40,0.01824494);
   SegtoLCTXY_2__86->SetBinContent(41,0.01723133);
   SegtoLCTXY_2__86->SetBinContent(42,0.01520412);
   SegtoLCTXY_2__86->SetBinContent(43,0.01071528);
   SegtoLCTXY_2__86->SetBinContent(44,0.0128149);
   SegtoLCTXY_2__86->SetBinContent(45,0.0134665);
   SegtoLCTXY_2__86->SetBinContent(46,0.01505931);
   SegtoLCTXY_2__86->SetBinContent(47,0.01448011);
   SegtoLCTXY_2__86->SetBinContent(48,0.01476971);
   SegtoLCTXY_2__86->SetBinContent(49,0.008977668);
   SegtoLCTXY_2__86->SetBinContent(50,0.0130321);
   SegtoLCTXY_2__86->SetBinContent(51,0.01187369);
   SegtoLCTXY_2__86->SetBinContent(52,0.008977668);
   SegtoLCTXY_2__86->SetBinContent(53,0.009701674);
   SegtoLCTXY_2__86->SetBinContent(54,0.01028088);
   SegtoLCTXY_2__86->SetBinContent(55,0.01013608);
   SegtoLCTXY_2__86->SetBinContent(56,0.009846475);
   SegtoLCTXY_2__86->SetBinContent(57,0.009991276);
   SegtoLCTXY_2__86->SetBinContent(58,0.007529657);
   SegtoLCTXY_2__86->SetBinContent(59,0.00926727);
   SegtoLCTXY_2__86->SetBinContent(60,0.00666085);
   SegtoLCTXY_2__86->SetBinContent(61,0.004923237);
   SegtoLCTXY_2__86->SetBinContent(62,0.00666085);
   SegtoLCTXY_2__86->SetBinContent(63,0.006371248);
   SegtoLCTXY_2__86->SetBinContent(64,0.01028088);
   SegtoLCTXY_2__86->SetBinContent(65,0.006733251);
   SegtoLCTXY_2__86->SetBinContent(66,0.005357641);
   SegtoLCTXY_2__86->SetBinContent(67,0.004923237);
   SegtoLCTXY_2__86->SetBinContent(68,0.006226447);
   SegtoLCTXY_2__86->SetBinContent(69,0.00521284);
   SegtoLCTXY_2__86->SetBinContent(70,0.004199232);
   SegtoLCTXY_2__86->SetBinContent(71,0.00521284);
   SegtoLCTXY_2__86->SetBinContent(72,0.00390963);
   SegtoLCTXY_2__86->SetBinContent(73,0.004054431);
   SegtoLCTXY_2__86->SetBinContent(74,0.005068038);
   SegtoLCTXY_2__86->SetBinContent(75,0.004054431);
   SegtoLCTXY_2__86->SetBinContent(76,0.00390963);
   SegtoLCTXY_2__86->SetBinContent(77,0.004923237);
   SegtoLCTXY_2__86->SetBinContent(78,0.002896022);
   SegtoLCTXY_2__86->SetBinContent(79,0.003185624);
   SegtoLCTXY_2__86->SetBinContent(80,0.00390963);
   SegtoLCTXY_2__86->SetBinContent(81,0.003620027);
   SegtoLCTXY_2__86->SetBinContent(82,0.002172016);
   SegtoLCTXY_2__86->SetBinContent(83,0.002461619);
   SegtoLCTXY_2__86->SetBinContent(84,0.004488834);
   SegtoLCTXY_2__86->SetBinContent(85,0.003330425);
   SegtoLCTXY_2__86->SetBinContent(86,0.004344033);
   SegtoLCTXY_2__86->SetBinContent(87,0.001882414);
   SegtoLCTXY_2__86->SetBinContent(88,0.003692428);
   SegtoLCTXY_2__86->SetBinContent(89,0.002316818);
   SegtoLCTXY_2__86->SetBinContent(90,0.00260642);
   SegtoLCTXY_2__86->SetBinContent(91,0.003764829);
   SegtoLCTXY_2__86->SetBinContent(92,0.002751221);
   SegtoLCTXY_2__86->SetBinContent(93,0.003185624);
   SegtoLCTXY_2__86->SetBinContent(94,0.001882414);
   SegtoLCTXY_2__86->SetBinContent(95,0.002172016);
   SegtoLCTXY_2__86->SetBinContent(96,0.001448011);
   SegtoLCTXY_2__86->SetBinContent(97,0.002316818);
   SegtoLCTXY_2__86->SetBinContent(98,0.001882414);
   SegtoLCTXY_2__86->SetBinContent(99,0.001737613);
   SegtoLCTXY_2__86->SetBinContent(100,0.002172016);
   SegtoLCTXY_2__86->SetBinContent(101,1.469731);
   SegtoLCTXY_2__86->SetEntries(1401505);
   SegtoLCTXY_2__86->SetStats(0);

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

   ci = TColor::GetColor("#ff9999");
   SegtoLCTXY_2__86->SetMarkerColor(ci);
   SegtoLCTXY_2__86->GetXaxis()->SetTitle("cm");
   SegtoLCTXY_2__86->GetYaxis()->SetTitle("scaled number of entries");
   SegtoLCTXY_2__86->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("SegtoLCTXY_1","ME11A: mean:0.4cm;RMS:1.8cm","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("SegtoLCTXY_2","ME11B: mean:0.4cm;RMS:1.8cm","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("SegtoLCTXY_3","ME12+13: mean:0.8cm;RMS:1.8cm","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("SegtoLCTXY_4","ME2: mean:0.4cm;RMS:1.4cm","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("SegtoLCTXY_5","ME3: mean:0.5cm;RMS:1.2cm","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("SegtoLCTXY_6","ME4: mean:0.6cm;RMS:1.3cm","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 *SegtoLCTXY_3__87 = new TH1D("SegtoLCTXY_3__87","SegtoLCTXY",100,-1,40);
   SegtoLCTXY_3__87->SetBinContent(3,52.28309);
   SegtoLCTXY_3__87->SetBinContent(4,13.35361);
   SegtoLCTXY_3__87->SetBinContent(5,6.225308);
   SegtoLCTXY_3__87->SetBinContent(6,10.4397);
   SegtoLCTXY_3__87->SetBinContent(7,6.743384);
   SegtoLCTXY_3__87->SetBinContent(8,3.390905);
   SegtoLCTXY_3__87->SetBinContent(9,2.427848);
   SegtoLCTXY_3__87->SetBinContent(10,1.31087);
   SegtoLCTXY_3__87->SetBinContent(11,1.108586);
   SegtoLCTXY_3__87->SetBinContent(12,0.9632775);
   SegtoLCTXY_3__87->SetBinContent(13,0.4147261);
   SegtoLCTXY_3__87->SetBinContent(14,0.2124422);
   SegtoLCTXY_3__87->SetBinContent(15,0.1318378);
   SegtoLCTXY_3__87->SetBinContent(16,0.09142524);
   SegtoLCTXY_3__87->SetBinContent(17,0.07287519);
   SegtoLCTXY_3__87->SetBinContent(18,0.05587098);
   SegtoLCTXY_3__87->SetBinContent(19,0.05057097);
   SegtoLCTXY_3__87->SetBinContent(20,0.04284178);
   SegtoLCTXY_3__87->SetBinContent(21,0.04394595);
   SegtoLCTXY_3__87->SetBinContent(22,0.02981258);
   SegtoLCTXY_3__87->SetBinContent(23,0.02716257);
   SegtoLCTXY_3__87->SetBinContent(24,0.03047508);
   SegtoLCTXY_3__87->SetBinContent(25,0.01899172);
   SegtoLCTXY_3__87->SetBinContent(26,0.03224175);
   SegtoLCTXY_3__87->SetBinContent(27,0.02142089);
   SegtoLCTXY_3__87->SetBinContent(28,0.01545837);
   SegtoLCTXY_3__87->SetBinContent(29,0.01722505);
   SegtoLCTXY_3__87->SetBinContent(30,0.01678338);
   SegtoLCTXY_3__87->SetBinContent(31,0.01590004);
   SegtoLCTXY_3__87->SetBinContent(32,0.01413337);
   SegtoLCTXY_3__87->SetBinContent(33,0.01656254);
   SegtoLCTXY_3__87->SetBinContent(34,0.0123667);
   SegtoLCTXY_3__87->SetBinContent(35,0.0110417);
   SegtoLCTXY_3__87->SetBinContent(36,0.01015836);
   SegtoLCTXY_3__87->SetBinContent(37,0.01413337);
   SegtoLCTXY_3__87->SetBinContent(38,0.009275024);
   SegtoLCTXY_3__87->SetBinContent(39,0.009716692);
   SegtoLCTXY_3__87->SetBinContent(40,0.005300014);
   SegtoLCTXY_3__87->SetBinContent(41,0.0123667);
   SegtoLCTXY_3__87->SetBinContent(42,0.00618335);
   SegtoLCTXY_3__87->SetBinContent(43,0.008833357);
   SegtoLCTXY_3__87->SetBinContent(44,0.005741682);
   SegtoLCTXY_3__87->SetBinContent(45,0.007729187);
   SegtoLCTXY_3__87->SetBinContent(46,0.007950021);
   SegtoLCTXY_3__87->SetBinContent(47,0.007066685);
   SegtoLCTXY_3__87->SetBinContent(48,0.01060003);
   SegtoLCTXY_3__87->SetBinContent(49,0.007066685);
   SegtoLCTXY_3__87->SetBinContent(50,0.005300014);
   SegtoLCTXY_3__87->SetBinContent(51,0.005741682);
   SegtoLCTXY_3__87->SetBinContent(52,0.005741682);
   SegtoLCTXY_3__87->SetBinContent(53,0.008391689);
   SegtoLCTXY_3__87->SetBinContent(54,0.006625017);
   SegtoLCTXY_3__87->SetBinContent(55,0.009716692);
   SegtoLCTXY_3__87->SetBinContent(56,0.005300014);
   SegtoLCTXY_3__87->SetBinContent(57,0.007066685);
   SegtoLCTXY_3__87->SetBinContent(58,0.00618335);
   SegtoLCTXY_3__87->SetBinContent(59,0.009716692);
   SegtoLCTXY_3__87->SetBinContent(60,0.006625017);
   SegtoLCTXY_3__87->SetBinContent(61,0.004416678);
   SegtoLCTXY_3__87->SetBinContent(62,0.007508353);
   SegtoLCTXY_3__87->SetBinContent(63,0.002650007);
   SegtoLCTXY_3__87->SetBinContent(64,0.00397501);
   SegtoLCTXY_3__87->SetBinContent(65,0.004858346);
   SegtoLCTXY_3__87->SetBinContent(66,0.005741682);
   SegtoLCTXY_3__87->SetBinContent(67,0.00397501);
   SegtoLCTXY_3__87->SetBinContent(68,0.003312509);
   SegtoLCTXY_3__87->SetBinContent(69,0.005300014);
   SegtoLCTXY_3__87->SetBinContent(70,0.002208339);
   SegtoLCTXY_3__87->SetBinContent(71,0.007066685);
   SegtoLCTXY_3__87->SetBinContent(72,0.004416678);
   SegtoLCTXY_3__87->SetBinContent(73,0.00397501);
   SegtoLCTXY_3__87->SetBinContent(74,0.00397501);
   SegtoLCTXY_3__87->SetBinContent(75,0.007508353);
   SegtoLCTXY_3__87->SetBinContent(76,0.002650007);
   SegtoLCTXY_3__87->SetBinContent(77,0.004416678);
   SegtoLCTXY_3__87->SetBinContent(78,0.00397501);
   SegtoLCTXY_3__87->SetBinContent(79,0.00397501);
   SegtoLCTXY_3__87->SetBinContent(80,0.005300014);
   SegtoLCTXY_3__87->SetBinContent(81,0.00397501);
   SegtoLCTXY_3__87->SetBinContent(82,0.003533343);
   SegtoLCTXY_3__87->SetBinContent(83,0.005300014);
   SegtoLCTXY_3__87->SetBinContent(84,0.00397501);
   SegtoLCTXY_3__87->SetBinContent(85,0.002650007);
   SegtoLCTXY_3__87->SetBinContent(86,0.002650007);
   SegtoLCTXY_3__87->SetBinContent(87,0.004416678);
   SegtoLCTXY_3__87->SetBinContent(88,0.003533343);
   SegtoLCTXY_3__87->SetBinContent(89,0.00618335);
   SegtoLCTXY_3__87->SetBinContent(90,0.005741682);
   SegtoLCTXY_3__87->SetBinContent(91,0.004858346);
   SegtoLCTXY_3__87->SetBinContent(92,0.002650007);
   SegtoLCTXY_3__87->SetBinContent(93,0.002208339);
   SegtoLCTXY_3__87->SetBinContent(94,0.002208339);
   SegtoLCTXY_3__87->SetBinContent(95,0.003091675);
   SegtoLCTXY_3__87->SetBinContent(96,0.002650007);
   SegtoLCTXY_3__87->SetBinContent(97,0.001766671);
   SegtoLCTXY_3__87->SetBinContent(98,0.002208339);
   SegtoLCTXY_3__87->SetBinContent(99,0.001325003);
   SegtoLCTXY_3__87->SetBinContent(100,0.002650007);
   SegtoLCTXY_3__87->SetBinContent(101,1.120732);
   SegtoLCTXY_3__87->SetEntries(457904);
   SegtoLCTXY_3__87->SetStats(0);
   SegtoLCTXY_3__87->GetXaxis()->SetTitle("cm");
   SegtoLCTXY_3__87->GetYaxis()->SetTitle("scaled number of entries");
   SegtoLCTXY_3__87->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("SegtoLCTXY_1","ME11A: mean:0.4cm;RMS:1.8cm","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("SegtoLCTXY_2","ME11B: mean:0.4cm;RMS:1.8cm","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("SegtoLCTXY_3","ME12+13: mean:0.8cm;RMS:1.8cm","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("SegtoLCTXY_4","ME2: mean:0.4cm;RMS:1.4cm","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("SegtoLCTXY_5","ME3: mean:0.5cm;RMS:1.2cm","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("SegtoLCTXY_6","ME4: mean:0.6cm;RMS:1.3cm","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 *SegtoLCTXY_4__88 = new TH1D("SegtoLCTXY_4__88","SegtoLCTXY",100,-1,40);
   SegtoLCTXY_4__88->SetBinContent(3,69.50627);
   SegtoLCTXY_4__88->SetBinContent(4,9.555916);
   SegtoLCTXY_4__88->SetBinContent(5,7.98885);
   SegtoLCTXY_4__88->SetBinContent(6,3.796497);
   SegtoLCTXY_4__88->SetBinContent(7,2.927531);
   SegtoLCTXY_4__88->SetBinContent(8,1.151423);
   SegtoLCTXY_4__88->SetBinContent(9,2.322047);
   SegtoLCTXY_4__88->SetBinContent(10,0.8579425);
   SegtoLCTXY_4__88->SetBinContent(11,0.5186509);
   SegtoLCTXY_4__88->SetBinContent(12,0.3525742);
   SegtoLCTXY_4__88->SetBinContent(13,0.1777328);
   SegtoLCTXY_4__88->SetBinContent(14,0.1042271);
   SegtoLCTXY_4__88->SetBinContent(15,0.09202891);
   SegtoLCTXY_4__88->SetBinContent(16,0.0687619);
   SegtoLCTXY_4__88->SetBinContent(17,0.05624742);
   SegtoLCTXY_4__88->SetBinContent(18,0.04662436);
   SegtoLCTXY_4__88->SetBinContent(19,0.03795006);
   SegtoLCTXY_4__88->SetBinContent(20,0.03198648);
   SegtoLCTXY_4__88->SetBinContent(21,0.02832701);
   SegtoLCTXY_4__88->SetBinContent(22,0.02511933);
   SegtoLCTXY_4__88->SetBinContent(23,0.02168575);
   SegtoLCTXY_4__88->SetBinContent(24,0.01843289);
   SegtoLCTXY_4__88->SetBinContent(25,0.01807146);
   SegtoLCTXY_4__88->SetBinContent(26,0.01752932);
   SegtoLCTXY_4__88->SetBinContent(27,0.01237895);
   SegtoLCTXY_4__88->SetBinContent(28,0.01251449);
   SegtoLCTXY_4__88->SetBinContent(29,0.01346324);
   SegtoLCTXY_4__88->SetBinContent(30,0.009577873);
   SegtoLCTXY_4__88->SetBinContent(31,0.01039109);
   SegtoLCTXY_4__88->SetBinContent(32,0.009668231);
   SegtoLCTXY_4__88->SetBinContent(33,0.009487516);
   SegtoLCTXY_4__88->SetBinContent(34,0.007590013);
   SegtoLCTXY_4__88->SetBinContent(35,0.01021037);
   SegtoLCTXY_4__88->SetBinContent(36,0.006776797);
   SegtoLCTXY_4__88->SetBinContent(37,0.006415368);
   SegtoLCTXY_4__88->SetBinContent(38,0.007770727);
   SegtoLCTXY_4__88->SetBinContent(39,0.004788937);
   SegtoLCTXY_4__88->SetBinContent(40,0.005240723);
   SegtoLCTXY_4__88->SetBinContent(41,0.005240723);
   SegtoLCTXY_4__88->SetBinContent(42,0.005466616);
   SegtoLCTXY_4__88->SetBinContent(43,0.005105187);
   SegtoLCTXY_4__88->SetBinContent(44,0.005918403);
   SegtoLCTXY_4__88->SetBinContent(45,0.004879294);
   SegtoLCTXY_4__88->SetBinContent(46,0.003885364);
   SegtoLCTXY_4__88->SetBinContent(47,0.002801076);
   SegtoLCTXY_4__88->SetBinContent(48,0.003704649);
   SegtoLCTXY_4__88->SetBinContent(49,0.00433715);
   SegtoLCTXY_4__88->SetBinContent(50,0.003252863);
   SegtoLCTXY_4__88->SetBinContent(51,0.003252863);
   SegtoLCTXY_4__88->SetBinContent(52,0.003252863);
   SegtoLCTXY_4__88->SetBinContent(53,0.003523935);
   SegtoLCTXY_4__88->SetBinContent(54,0.002258932);
   SegtoLCTXY_4__88->SetBinContent(55,0.003433577);
   SegtoLCTXY_4__88->SetBinContent(56,0.002575183);
   SegtoLCTXY_4__88->SetBinContent(57,0.002981791);
   SegtoLCTXY_4__88->SetBinContent(58,0.002801076);
   SegtoLCTXY_4__88->SetBinContent(59,0.002891433);
   SegtoLCTXY_4__88->SetBinContent(60,0.002710719);
   SegtoLCTXY_4__88->SetBinContent(61,0.003252863);
   SegtoLCTXY_4__88->SetBinContent(62,0.002530004);
   SegtoLCTXY_4__88->SetBinContent(63,0.002891433);
   SegtoLCTXY_4__88->SetBinContent(64,0.002258932);
   SegtoLCTXY_4__88->SetBinContent(65,0.002258932);
   SegtoLCTXY_4__88->SetBinContent(66,0.00234929);
   SegtoLCTXY_4__88->SetBinContent(67,0.003162505);
   SegtoLCTXY_4__88->SetBinContent(68,0.001897503);
   SegtoLCTXY_4__88->SetBinContent(69,0.002078218);
   SegtoLCTXY_4__88->SetBinContent(70,0.001536074);
   SegtoLCTXY_4__88->SetBinContent(71,0.002530004);
   SegtoLCTXY_4__88->SetBinContent(72,0.001626431);
   SegtoLCTXY_4__88->SetBinContent(73,0.001355359);
   SegtoLCTXY_4__88->SetBinContent(74,0.00234929);
   SegtoLCTXY_4__88->SetBinContent(75,0.001626431);
   SegtoLCTXY_4__88->SetBinContent(76,0.001626431);
   SegtoLCTXY_4__88->SetBinContent(77,0.001536074);
   SegtoLCTXY_4__88->SetBinContent(78,0.001536074);
   SegtoLCTXY_4__88->SetBinContent(79,0.001174645);
   SegtoLCTXY_4__88->SetBinContent(80,0.002439647);
   SegtoLCTXY_4__88->SetBinContent(81,0.00198786);
   SegtoLCTXY_4__88->SetBinContent(82,0.00198786);
   SegtoLCTXY_4__88->SetBinContent(83,0.001807146);
   SegtoLCTXY_4__88->SetBinContent(84,0.002168575);
   SegtoLCTXY_4__88->SetBinContent(85,0.002620362);
   SegtoLCTXY_4__88->SetBinContent(86,0.0009939302);
   SegtoLCTXY_4__88->SetBinContent(87,0.002078218);
   SegtoLCTXY_4__88->SetBinContent(88,0.001265002);
   SegtoLCTXY_4__88->SetBinContent(89,0.001536074);
   SegtoLCTXY_4__88->SetBinContent(90,0.001536074);
   SegtoLCTXY_4__88->SetBinContent(91,0.001626431);
   SegtoLCTXY_4__88->SetBinContent(92,0.001807146);
   SegtoLCTXY_4__88->SetBinContent(93,0.001626431);
   SegtoLCTXY_4__88->SetBinContent(94,0.001716789);
   SegtoLCTXY_4__88->SetBinContent(95,0.002168575);
   SegtoLCTXY_4__88->SetBinContent(96,0.00198786);
   SegtoLCTXY_4__88->SetBinContent(97,0.001355359);
   SegtoLCTXY_4__88->SetBinContent(98,0.001716789);
   SegtoLCTXY_4__88->SetBinContent(99,0.001129466);
   SegtoLCTXY_4__88->SetBinContent(100,0.001897503);
   SegtoLCTXY_4__88->SetBinContent(101,1.295181);
   SegtoLCTXY_4__88->SetEntries(2242103);
   SegtoLCTXY_4__88->SetStats(0);

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

   ci = TColor::GetColor("#ff0000");
   SegtoLCTXY_4__88->SetMarkerColor(ci);
   SegtoLCTXY_4__88->GetXaxis()->SetTitle("cm");
   SegtoLCTXY_4__88->GetYaxis()->SetTitle("scaled number of entries");
   SegtoLCTXY_4__88->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("SegtoLCTXY_1","ME11A: mean:0.4cm;RMS:1.8cm","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("SegtoLCTXY_2","ME11B: mean:0.4cm;RMS:1.8cm","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("SegtoLCTXY_3","ME12+13: mean:0.8cm;RMS:1.8cm","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("SegtoLCTXY_4","ME2: mean:0.4cm;RMS:1.4cm","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("SegtoLCTXY_5","ME3: mean:0.5cm;RMS:1.2cm","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("SegtoLCTXY_6","ME4: mean:0.6cm;RMS:1.3cm","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 *SegtoLCTXY_5__89 = new TH1D("SegtoLCTXY_5__89","SegtoLCTXY",100,-1,40);
   SegtoLCTXY_5__89->SetBinContent(3,63.26456);
   SegtoLCTXY_5__89->SetBinContent(4,11.68324);
   SegtoLCTXY_5__89->SetBinContent(5,9.308105);
   SegtoLCTXY_5__89->SetBinContent(6,4.112811);
   SegtoLCTXY_5__89->SetBinContent(7,4.384166);
   SegtoLCTXY_5__89->SetBinContent(8,2.208953);
   SegtoLCTXY_5__89->SetBinContent(9,3.275674);
   SegtoLCTXY_5__89->SetBinContent(10,0.5539761);
   SegtoLCTXY_5__89->SetBinContent(11,0.2316224);
   SegtoLCTXY_5__89->SetBinContent(12,0.1429886);
   SegtoLCTXY_5__89->SetBinContent(13,0.1133841);
   SegtoLCTXY_5__89->SetBinContent(14,0.09222947);
   SegtoLCTXY_5__89->SetBinContent(15,0.07520987);
   SegtoLCTXY_5__89->SetBinContent(16,0.05483429);
   SegtoLCTXY_5__89->SetBinContent(17,0.04692377);
   SegtoLCTXY_5__89->SetBinContent(18,0.04176994);
   SegtoLCTXY_5__89->SetBinContent(19,0.04063131);
   SegtoLCTXY_5__89->SetBinContent(20,0.02852581);
   SegtoLCTXY_5__89->SetBinContent(21,0.02780668);
   SegtoLCTXY_5__89->SetBinContent(22,0.02313228);
   SegtoLCTXY_5__89->SetBinContent(23,0.01893731);
   SegtoLCTXY_5__89->SetBinContent(24,0.01917702);
   SegtoLCTXY_5__89->SetBinContent(25,0.02133443);
   SegtoLCTXY_5__89->SetBinContent(26,0.01953659);
   SegtoLCTXY_5__89->SetBinContent(27,0.01354377);
   SegtoLCTXY_5__89->SetBinContent(28,0.01234521);
   SegtoLCTXY_5__89->SetBinContent(29,0.009828222);
   SegtoLCTXY_5__89->SetBinContent(30,0.01054736);
   SegtoLCTXY_5__89->SetBinContent(31,0.009348796);
   SegtoLCTXY_5__89->SetBinContent(32,0.007371166);
   SegtoLCTXY_5__89->SetBinContent(33,0.006711956);
   SegtoLCTXY_5__89->SetBinContent(34,0.008270089);
   SegtoLCTXY_5__89->SetBinContent(35,0.004674398);
   SegtoLCTXY_5__89->SetBinContent(36,0.005633249);
   SegtoLCTXY_5__89->SetBinContent(37,0.004794255);
   SegtoLCTXY_5__89->SetBinContent(38,0.005033967);
   SegtoLCTXY_5__89->SetBinContent(39,0.004314829);
   SegtoLCTXY_5__89->SetBinContent(40,0.00395526);
   SegtoLCTXY_5__89->SetBinContent(41,0.005153824);
   SegtoLCTXY_5__89->SetBinContent(42,0.002756696);
   SegtoLCTXY_5__89->SetBinContent(43,0.004254901);
   SegtoLCTXY_5__89->SetBinContent(44,0.002157415);
   SegtoLCTXY_5__89->SetBinContent(45,0.003595691);
   SegtoLCTXY_5__89->SetBinContent(46,0.002756696);
   SegtoLCTXY_5__89->SetBinContent(47,0.002996409);
   SegtoLCTXY_5__89->SetBinContent(48,0.004194973);
   SegtoLCTXY_5__89->SetBinContent(49,0.002816625);
   SegtoLCTXY_5__89->SetBinContent(50,0.002516984);
   SegtoLCTXY_5__89->SetBinContent(51,0.002996409);
   SegtoLCTXY_5__89->SetBinContent(52,0.002277271);
   SegtoLCTXY_5__89->SetBinContent(53,0.002397127);
   SegtoLCTXY_5__89->SetBinContent(54,0.001917702);
   SegtoLCTXY_5__89->SetBinContent(55,0.001438276);
   SegtoLCTXY_5__89->SetBinContent(56,0.00197763);
   SegtoLCTXY_5__89->SetBinContent(57,0.002816625);
   SegtoLCTXY_5__89->SetBinContent(58,0.0009588509);
   SegtoLCTXY_5__89->SetBinContent(59,0.00263684);
   SegtoLCTXY_5__89->SetBinContent(60,0.002876553);
   SegtoLCTXY_5__89->SetBinContent(61,0.001558133);
   SegtoLCTXY_5__89->SetBinContent(62,0.001917702);
   SegtoLCTXY_5__89->SetBinContent(63,0.001797845);
   SegtoLCTXY_5__89->SetBinContent(64,0.001797845);
   SegtoLCTXY_5__89->SetBinContent(65,0.0007191382);
   SegtoLCTXY_5__89->SetBinContent(66,0.001558133);
   SegtoLCTXY_5__89->SetBinContent(67,0.001078707);
   SegtoLCTXY_5__89->SetBinContent(68,0.0003595691);
   SegtoLCTXY_5__89->SetBinContent(69,0.00131842);
   SegtoLCTXY_5__89->SetBinContent(70,0.001917702);
   SegtoLCTXY_5__89->SetBinContent(71,0.001198564);
   SegtoLCTXY_5__89->SetBinContent(72,0.002516984);
   SegtoLCTXY_5__89->SetBinContent(73,0.00131842);
   SegtoLCTXY_5__89->SetBinContent(74,0.0008389945);
   SegtoLCTXY_5__89->SetBinContent(75,0.001438276);
   SegtoLCTXY_5__89->SetBinContent(76,0.0005992818);
   SegtoLCTXY_5__89->SetBinContent(77,0.001558133);
   SegtoLCTXY_5__89->SetBinContent(78,0.002157415);
   SegtoLCTXY_5__89->SetBinContent(79,0.001198564);
   SegtoLCTXY_5__89->SetBinContent(80,0.001917702);
   SegtoLCTXY_5__89->SetBinContent(81,0.001558133);
   SegtoLCTXY_5__89->SetBinContent(82,0.0009588509);
   SegtoLCTXY_5__89->SetBinContent(83,0.00131842);
   SegtoLCTXY_5__89->SetBinContent(84,0.0008389945);
   SegtoLCTXY_5__89->SetBinContent(85,0.0007191382);
   SegtoLCTXY_5__89->SetBinContent(86,0.001198564);
   SegtoLCTXY_5__89->SetBinContent(87,0.00131842);
   SegtoLCTXY_5__89->SetBinContent(88,0.001078707);
   SegtoLCTXY_5__89->SetBinContent(89,0.00131842);
   SegtoLCTXY_5__89->SetBinContent(90,0.0003595691);
   SegtoLCTXY_5__89->SetBinContent(91,0.001018779);
   SegtoLCTXY_5__89->SetBinContent(92,0.0003595691);
   SegtoLCTXY_5__89->SetBinContent(93,0.00131842);
   SegtoLCTXY_5__89->SetBinContent(94,0.001558133);
   SegtoLCTXY_5__89->SetBinContent(95,0.001078707);
   SegtoLCTXY_5__89->SetBinContent(96,0.0007191382);
   SegtoLCTXY_5__89->SetBinContent(97,0.0007191382);
   SegtoLCTXY_5__89->SetBinContent(98,0.0005992818);
   SegtoLCTXY_5__89->SetBinContent(99,0.001198564);
   SegtoLCTXY_5__89->SetBinContent(100,0.0005992818);
   SegtoLCTXY_5__89->SetBinContent(101,0.568239);
   SegtoLCTXY_5__89->SetEntries(1678146);
   SegtoLCTXY_5__89->SetStats(0);

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

   ci = TColor::GetColor("#00ff00");
   SegtoLCTXY_5__89->SetMarkerColor(ci);
   SegtoLCTXY_5__89->GetXaxis()->SetTitle("cm");
   SegtoLCTXY_5__89->GetYaxis()->SetTitle("scaled number of entries");
   SegtoLCTXY_5__89->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("SegtoLCTXY_1","ME11A: mean:0.4cm;RMS:1.8cm","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("SegtoLCTXY_2","ME11B: mean:0.4cm;RMS:1.8cm","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("SegtoLCTXY_3","ME12+13: mean:0.8cm;RMS:1.8cm","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("SegtoLCTXY_4","ME2: mean:0.4cm;RMS:1.4cm","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("SegtoLCTXY_5","ME3: mean:0.5cm;RMS:1.2cm","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("SegtoLCTXY_6","ME4: mean:0.6cm;RMS:1.3cm","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 *SegtoLCTXY_6__90 = new TH1D("SegtoLCTXY_6__90","SegtoLCTXY",100,-1,40);
   SegtoLCTXY_6__90->SetBinContent(3,59.50759);
   SegtoLCTXY_6__90->SetBinContent(4,11.81155);
   SegtoLCTXY_6__90->SetBinContent(5,10.61662);
   SegtoLCTXY_6__90->SetBinContent(6,3.729491);
   SegtoLCTXY_6__90->SetBinContent(7,5.681678);
   SegtoLCTXY_6__90->SetBinContent(8,2.694751);
   SegtoLCTXY_6__90->SetBinContent(9,4.026062);
   SegtoLCTXY_6__90->SetBinContent(10,0.615116);
   SegtoLCTXY_6__90->SetBinContent(11,0.2587609);
   SegtoLCTXY_6__90->SetBinContent(12,0.1539684);
   SegtoLCTXY_6__90->SetBinContent(13,0.1285849);
   SegtoLCTXY_6__90->SetBinContent(14,0.092669);
   SegtoLCTXY_6__90->SetBinContent(15,0.08304597);
   SegtoLCTXY_6__90->SetBinContent(16,0.06523958);
   SegtoLCTXY_6__90->SetBinContent(17,0.05076715);
   SegtoLCTXY_6__90->SetBinContent(18,0.04781205);
   SegtoLCTXY_6__90->SetBinContent(19,0.0374313);
   SegtoLCTXY_6__90->SetBinContent(20,0.03538546);
   SegtoLCTXY_6__90->SetBinContent(21,0.02833868);
   SegtoLCTXY_6__90->SetBinContent(22,0.02947526);
   SegtoLCTXY_6__90->SetBinContent(23,0.02136767);
   SegtoLCTXY_6__90->SetBinContent(24,0.02470163);
   SegtoLCTXY_6__90->SetBinContent(25,0.01954914);
   SegtoLCTXY_6__90->SetBinContent(26,0.01682135);
   SegtoLCTXY_6__90->SetBinContent(27,0.01576055);
   SegtoLCTXY_6__90->SetBinContent(28,0.01189618);
   SegtoLCTXY_6__90->SetBinContent(29,0.01288122);
   SegtoLCTXY_6__90->SetBinContent(30,0.009547256);
   SegtoLCTXY_6__90->SetBinContent(31,0.009547256);
   SegtoLCTXY_6__90->SetBinContent(32,0.01030497);
   SegtoLCTXY_6__90->SetBinContent(33,0.006440609);
   SegtoLCTXY_6__90->SetBinContent(34,0.007577187);
   SegtoLCTXY_6__90->SetBinContent(35,0.005152487);
   SegtoLCTXY_6__90->SetBinContent(36,0.006971012);
   SegtoLCTXY_6__90->SetBinContent(37,0.005607118);
   SegtoLCTXY_6__90->SetBinContent(38,0.004394768);
   SegtoLCTXY_6__90->SetBinContent(39,0.005304031);
   SegtoLCTXY_6__90->SetBinContent(40,0.004546312);
   SegtoLCTXY_6__90->SetBinContent(41,0.005758662);
   SegtoLCTXY_6__90->SetBinContent(42,0.006213293);
   SegtoLCTXY_6__90->SetBinContent(43,0.00363705);
   SegtoLCTXY_6__90->SetBinContent(44,0.004546312);
   SegtoLCTXY_6__90->SetBinContent(45,0.003485506);
   SegtoLCTXY_6__90->SetBinContent(46,0.004091681);
   SegtoLCTXY_6__90->SetBinContent(47,0.003333962);
   SegtoLCTXY_6__90->SetBinContent(48,0.003182419);
   SegtoLCTXY_6__90->SetBinContent(49,0.002121612);
   SegtoLCTXY_6__90->SetBinContent(50,0.001818525);
   SegtoLCTXY_6__90->SetBinContent(51,0.001515437);
   SegtoLCTXY_6__90->SetBinContent(52,0.0024247);
   SegtoLCTXY_6__90->SetBinContent(53,0.001666981);
   SegtoLCTXY_6__90->SetBinContent(54,0.001970069);
   SegtoLCTXY_6__90->SetBinContent(55,0.0024247);
   SegtoLCTXY_6__90->SetBinContent(56,0.0024247);
   SegtoLCTXY_6__90->SetBinContent(57,0.002879331);
   SegtoLCTXY_6__90->SetBinContent(58,0.002273156);
   SegtoLCTXY_6__90->SetBinContent(59,0.002576244);
   SegtoLCTXY_6__90->SetBinContent(60,0.001060806);
   SegtoLCTXY_6__90->SetBinContent(61,0.001818525);
   SegtoLCTXY_6__90->SetBinContent(62,0.00121235);
   SegtoLCTXY_6__90->SetBinContent(63,0.00121235);
   SegtoLCTXY_6__90->SetBinContent(64,0.001515437);
   SegtoLCTXY_6__90->SetBinContent(65,0.001515437);
   SegtoLCTXY_6__90->SetBinContent(66,0.001060806);
   SegtoLCTXY_6__90->SetBinContent(67,0.001970069);
   SegtoLCTXY_6__90->SetBinContent(68,0.001666981);
   SegtoLCTXY_6__90->SetBinContent(69,0.001818525);
   SegtoLCTXY_6__90->SetBinContent(70,0.001060806);
   SegtoLCTXY_6__90->SetBinContent(71,0.001060806);
   SegtoLCTXY_6__90->SetBinContent(72,0.001818525);
   SegtoLCTXY_6__90->SetBinContent(73,0.001363894);
   SegtoLCTXY_6__90->SetBinContent(74,0.001060806);
   SegtoLCTXY_6__90->SetBinContent(75,0.000606175);
   SegtoLCTXY_6__90->SetBinContent(76,0.001818525);
   SegtoLCTXY_6__90->SetBinContent(77,0.001060806);
   SegtoLCTXY_6__90->SetBinContent(78,0.00121235);
   SegtoLCTXY_6__90->SetBinContent(79,0.001970069);
   SegtoLCTXY_6__90->SetBinContent(80,0.0007577187);
   SegtoLCTXY_6__90->SetBinContent(81,0.001363894);
   SegtoLCTXY_6__90->SetBinContent(82,0.001666981);
   SegtoLCTXY_6__90->SetBinContent(83,0.0007577187);
   SegtoLCTXY_6__90->SetBinContent(84,0.0009092624);
   SegtoLCTXY_6__90->SetBinContent(85,0.001363894);
   SegtoLCTXY_6__90->SetBinContent(86,0.001818525);
   SegtoLCTXY_6__90->SetBinContent(87,0.0007577187);
   SegtoLCTXY_6__90->SetBinContent(88,0.001060806);
   SegtoLCTXY_6__90->SetBinContent(89,0.0009092624);
   SegtoLCTXY_6__90->SetBinContent(90,0.0009092624);
   SegtoLCTXY_6__90->SetBinContent(91,0.001060806);
   SegtoLCTXY_6__90->SetBinContent(92,0.000606175);
   SegtoLCTXY_6__90->SetBinContent(93,0.00121235);
   SegtoLCTXY_6__90->SetBinContent(94,0.001363894);
   SegtoLCTXY_6__90->SetBinContent(95,0.001060806);
   SegtoLCTXY_6__90->SetBinContent(96,0.0009092624);
   SegtoLCTXY_6__90->SetBinContent(97,0.000606175);
   SegtoLCTXY_6__90->SetBinContent(98,0.0009092624);
   SegtoLCTXY_6__90->SetBinContent(99,0.000606175);
   SegtoLCTXY_6__90->SetBinContent(100,0.0004546312);
   SegtoLCTXY_6__90->SetBinContent(101,0.6628523);
   SegtoLCTXY_6__90->SetEntries(1328499);
   SegtoLCTXY_6__90->SetStats(0);

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

   ci = TColor::GetColor("#0000ff");
   SegtoLCTXY_6__90->SetMarkerColor(ci);
   SegtoLCTXY_6__90->GetXaxis()->SetTitle("cm");
   SegtoLCTXY_6__90->GetYaxis()->SetTitle("scaled number of entries");
   SegtoLCTXY_6__90->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("SegtoLCTXY_1","ME11A: mean:0.4cm;RMS:1.8cm","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("SegtoLCTXY_2","ME11B: mean:0.4cm;RMS:1.8cm","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("SegtoLCTXY_3","ME12+13: mean:0.8cm;RMS:1.8cm","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("SegtoLCTXY_4","ME2: mean:0.4cm;RMS:1.4cm","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("SegtoLCTXY_5","ME3: mean:0.5cm;RMS:1.2cm","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("SegtoLCTXY_6","ME4: mean:0.6cm;RMS:1.3cm","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.2981452,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(1);
   pt->SetFillColor(0);
   TText *AText = pt->AddText("SegtoLCTXY");
   pt->Draw();
   SegtoLCTXY->Modified();
   SegtoLCTXY->cd();
   SegtoLCTXY->SetSelected(SegtoLCTXY);
}
예제 #16
0
void DataMCComp6(int irun=0, string title="", int plot=0) {

int unfold=0; // use pre-unfolding distributions
//int unfold=1; // use unfolded distributions

//int drawInclusive = 0; // do not plot the "inclusive" histogram
int drawInclusive = 1; // do plot the "inclusive" histogram

string subdir="0";
string postfix="";
if (irun==1) {             // irun==1 => JEC Up
  subdir="1";
  postfix="Up";
}
if (irun==2) {             // irun==2 => JEC Down
  subdir="2";
  postfix="Down";
}
if (irun==3) {             // irun==3 => PU Up
  subdir="3";
  postfix="Pup";
}
if (irun==4) {             // irun==4 => PU Down
  subdir="4";
  postfix="Pum";
}
if (irun==5) {             // irun==5 => top bkg
  subdir="5";
  postfix="";  
}
if (irun==6) {             // irun==6 => b purity
  subdir="6";
  postfix="";   
}
if (irun==7) {             // irun==7 => unfolding
  subdir="7";
  postfix="";   
}
if (irun==8) {             // irun==8 => unfolding with Sherpa
  subdir="8";
  postfix="";
}
if (irun==9) {             // irun==9 => unfolding with Powheg
  subdir="9";
  postfix="";
}
if (irun==10) {            // irun==10 => bkg systematics
  subdir="10";
  postfix="";
}
if (irun==11) {            // irun==11 => JER Up
  subdir="11";
  postfix="JerUp";
}
if (irun==12) {            // irun==12 => JER Down
  subdir="12";
  postfix="JerDown";
}
if (irun==13) {            // irun==13 => bkg statistics
  subdir="13";
  postfix="";
}
if (irun==14) {            // irun==14 => unfolding with data weight
  subdir="14";
  postfix="";
}
if (irun==15) {            // irun==15 => qcd bkg
  subdir="15";
  postfix="";
}
if (irun==77) {            // irun==77 => unfolding with MadGraph 4FS
  subdir="77";
  postfix="";
}
if (irun==88) {            // irun==88 => deltaR
  subdir="88";
  postfix="DR";
}
if (irun==99) {            // irun==99 => pur
  subdir="99";
  postfix="Pur";
}

        string title_e = title;
        string title_m = title;

        if (title=="w_mt_b") {
	  title_e = "w_mt_wenu_b";
	  title_m = "w_mt_wmnu_b";
	}

        if (title=="w_delta_b") {
	  title_e = "w_delta_wenu_b";
	  title_m = "w_delta_wmnu_b";
	}

        if (title=="w_deltaR_b") {
	  title_e = "w_deltaR_wenu_b";
	  title_m = "w_deltaR_wmnu_b";
	}

	if (title=="w_pt_W_b") {
	  title_e = "w_pt_W_wenu_b";
	  title_m = "w_pt_W_wmnu_b";
	}

	if (title=="w_eta_W_b") {
	  title_e = "w_eta_W_wenu_b";
	  title_m = "w_eta_W_wmnu_b";
	}

        string title_e_b = title_e;
        string title_m_b = title_m;

        if (title.find("_bjet_")!=string::npos) {
          title_e.erase(title_e.find("_bjet_")+1, 1);
          title_m.erase(title_m.find("_bjet_")+1, 1);
        } else {
	  title_e_b = title_e_b + "b";
	  title_m_b = title_m_b + "b";
	}

        TFile* f_e;
        TFile* f_e_b;
        if (unfold) {
           f_e = TFile::Open((path + "/electrons/" + version + "/" + subdir + "/unfolding/" + title_e + "_unfolding.root").c_str());
           f_e_b = TFile::Open((path + "/electrons/" + version + "/" + subdir + "/unfolding/" + title_e_b + "_unfolding.root").c_str());
        } else {
          f_e = TFile::Open((path + "/electrons/" + version + "/" + subdir + "/xsecs/" + title_e_b + "_xsecs.root").c_str());
          f_e_b = TFile::Open((path + "/electrons/" + version + "/" + subdir + "/xsecs/" + title_e_b + "_xsecs.root").c_str());
        }
        TH1F* h_data_e = (TH1F*)f_e->Get(title_e.c_str())->Clone();
        TH1F* h_data_e_b = (TH1F*)f_e_b->Get(title_e_b.c_str())->Clone();
        h_data_e->SetDirectory(0);
        h_data_e_b->SetDirectory(0);
        f_e->Close();
        f_e_b->Close();

        TFile* f_m;
        TFile* f_m_b;
        if (unfold) {
          f_m = TFile::Open((path + "/muons/" + version + "/" + subdir + "/unfolding/" + title_m + "_unfolding.root").c_str());
          f_m_b= TFile::Open((path + "/muons/" + version + "/" + subdir + "/unfolding/" + title_m_b + "_unfolding.root").c_str());
        } else {
          f_m= TFile::Open((path + "/muons/" + version + "/" + subdir + "/xsecs/" + title_m_b + "_xsecs.root").c_str());
          f_m_b= TFile::Open((path + "/muons/" + version + "/" + subdir + "/xsecs/" + title_m_b + "_xsecs.root").c_str());
        }
        TH1F* h_data_m = (TH1F*)f_m->Get(title_m.c_str())->Clone();
        TH1F* h_data_m_b = (TH1F*)f_m_b->Get(title_m_b.c_str())->Clone();
        h_data_m->SetDirectory(0);
        h_data_m_b->SetDirectory(0);
        f_m->Close();
        f_m_b->Close();

        h_data_e->SetStats(0);
        h_data_e_b->SetStats(0);
        h_data_m->SetStats(0);
        h_data_m_b->SetStats(0);

	if (unfold) {
	  h_data_e->Scale(1./Lumi2012_ele, "width");
	  h_data_e_b->Scale(1./Lumi2012_ele, "width");
	  h_data_m->Scale(1./Lumi2012_muon, "width");
	  h_data_m_b->Scale(1./Lumi2012_muon, "width");
	}

        TCanvas* c1 = new TCanvas("c", "c", 800, 600);
        c1->cd();

        TPad *pad1 = new TPad("pad1","pad1",0.0,0.3,1.0,1.0);
        pad1->SetBottomMargin(0.001);
        pad1->Draw();
        pad1->cd();
        pad1->SetLogy();

        h_data_e->SetTitle("");
        h_data_e_b->SetTitle("");

        h_data_e->GetYaxis()->SetTitle("#sigma [pb]");

        h_data_e->SetMarkerStyle(20);
        h_data_e->SetMarkerSize(0.7);
        h_data_e->SetMarkerColor(kRed);
        h_data_e->SetLineColor(kRed);
        h_data_e_b->SetMarkerStyle(24);
        h_data_e_b->SetMarkerSize(0.7);
        h_data_e_b->SetMarkerColor(kRed);
        h_data_e_b->SetLineColor(kRed);
        h_data_m->SetMarkerStyle(20);
        h_data_m->SetMarkerSize(0.7);
        h_data_m->SetMarkerColor(kBlue);
        h_data_m->SetLineColor(kBlue);
        h_data_m_b->SetMarkerStyle(24);
        h_data_m_b->SetMarkerSize(0.7);
        h_data_m_b->SetMarkerColor(kBlue);
        h_data_m_b->SetLineColor(kBlue);

	if (drawInclusive) {
	  h_data_e_b->SetMaximum(4*h_data_e->GetMaximum());
	} else {
	  h_data_e_b->SetMaximum(4*h_data_e_b->GetMaximum());
	}
        h_data_e_b->SetMinimum(TMath::Max(0.002,0.25*h_data_e_b->GetBinContent(h_data_e_b->GetMinimumBin())));
	if (title.find("_mt")!=string::npos) h_data_e_b->SetMinimum(TMath::Max(0.00002,0.25*h_data_e_b->GetBinContent(h_data_e_b->GetMinimumBin())));
	if (title.find("_pt")!=string::npos) h_data_e_b->SetMinimum(TMath::Max(0.000004,0.25*h_data_e_b->GetBinContent(h_data_e_b->GetMinimumBin())));
	if (title.find("_mass")!=string::npos) h_data_e_b->SetMinimum(TMath::Max(0.0002,0.25*h_data_e_b->GetBinContent(h_data_e_b->GetMinimumBin())));

        h_data_e_b->Draw("E0PX");
        if (drawInclusive) h_data_e->Draw("E0PXSAME");
        h_data_m_b->Draw("E0PXSAME");
        if (drawInclusive) h_data_m->Draw("E0PXSAME");

        TLegend *leg = new TLegend(0.62, 0.580, 0.88, 0.88);
        leg->SetBorderSize(0);
        leg->SetEntrySeparation(0.01);
        leg->SetFillColor(0);
        leg->SetFillStyle(0);

        leg->AddEntry(h_data_e_b,"W(#rightarrow e#nu)+2b DATA","p");
        if (drawInclusive) leg->AddEntry(h_data_e,"W(#rightarrow e#nu)+1b DATA","p");
        leg->AddEntry(h_data_m_b,"W(#rightarrow #mu#nu)+2b DATA","p");
        if (drawInclusive) leg->AddEntry(h_data_m,"W(#rightarrow #mu#nu)+1b DATA","p");

        leg->Draw();

        pad1->Update();
        c1->Update();

        c1->cd();

        TLatex *latexLabel = CMSPrel((Lumi2012_ele+Lumi2012_muon)/2./1000.,"",0.15,0.94);
        latexLabel->Draw("same");

        TPad *pad2 = new TPad("pad2","pad2",0,0,1,0.3);
        pad2->SetTopMargin(0);
        pad2->SetBottomMargin(0.3);
        pad2->Draw();
        pad2->cd();

        TH1F* h_ratio = (TH1F*)h_data_e->Clone("h_ratio");
        TH1F* h_ratio_b = (TH1F*)h_data_e_b->Clone("h_ratio_b");
        h_ratio->Divide(h_data_m);
        h_ratio_b->Divide(h_data_m_b);

        h_ratio_b->SetTitle("");

        h_ratio_b->GetXaxis()->SetTitleOffset(0.9);
        h_ratio_b->GetXaxis()->SetTitleSize(0.1);
        h_ratio_b->GetXaxis()->SetLabelFont(42);
        h_ratio_b->GetXaxis()->SetLabelSize(0.08);
        h_ratio_b->GetXaxis()->SetTitleFont(42);
        h_ratio_b->GetYaxis()->SetTitle("Electrons/Muons");
        h_ratio_b->GetYaxis()->SetNdivisions(505);
        h_ratio_b->GetYaxis()->SetTitleSize(0.09);
        h_ratio_b->GetYaxis()->SetLabelSize(0.08);
        h_ratio_b->GetYaxis()->SetRangeUser(0.5, 1.5);
        h_ratio_b->GetYaxis()->SetTitleOffset(0.4);

        h_ratio->SetMarkerStyle(20);
        h_ratio->SetMarkerColor(kBlack);
        h_ratio->SetLineColor(kBlack);
        h_ratio_b->SetMarkerStyle(24);
        h_ratio_b->SetMarkerColor(kBlack);
        h_ratio_b->SetLineColor(kBlack);

        h_ratio_b->Draw("E0PX");
        if (drawInclusive) h_ratio->Draw("E0PXSAME");

        TLine *OLine = new TLine(h_ratio->GetXaxis()->GetXmin(),1.,h_ratio->GetXaxis()->GetXmax(),1.);
        OLine->SetLineColor(kGreen);
        OLine->SetLineWidth(1);
        OLine->Draw();

        c1->cd();

	if (plot) {
          if (unfold) {
            gSystem->mkdir((path + "/combined/" + version + "/" + subdir + "/xsecs_unfolding/").c_str(), kTRUE);
            c1->SaveAs((path + "/combined/" + version + "/" + subdir + "/xsecs_unfolding/" + title + "b" + "_xsecs_unfolding.pdf").c_str());
          } else {
            gSystem->mkdir((path + "/combined/" + version + "/" + subdir + "/xsecs/").c_str(), kTRUE);
            c1->SaveAs((path + "/combined/" + version + "/" + subdir + "/xsecs/" + title + "b" + "_xsecs.pdf").c_str());
          }
	}

}
예제 #17
0
void v2ExpClose_pt(bool bSavePlots     = true,
                   float rangeYAxis    = 0.6,
                   float rangeXAxis    = 30,
                   bool  bDrawCh       = true,
                   const char* inputDir      = "../macro_v2/outRoot", // the place where the input root files, with the histograms are
                   const char* figNamePrefix="v2ExpClose_pt")
{
    gSystem->mkdir(Form("./figs/png"), kTRUE);
    gSystem->mkdir(Form("./figs/pdf"), kTRUE);
    setTDRStyle();

    // read CMS graphs
    TFile *pfV2Cms_cent   = new TFile(Form("%s/Prp_v2_pt_plotter.root",inputDir));

    TGraphAsymmErrors *pgV2Low  = (TGraphAsymmErrors *)pfV2Cms_cent->Get("pgV2_low");
    TGraphErrors *pgV2LowSyst   = (TGraphErrors *)pfV2Cms_cent->Get("pgV2_low_sys");
    TGraphErrors *pgV2LowP      = (TGraphErrors *)pfV2Cms_cent->Get("pgV2_low_cont");

    TGraphAsymmErrors *pgV2High = (TGraphAsymmErrors *)pfV2Cms_cent->Get("pgV2");
    TGraphErrors *pgV2HighSyst  = (TGraphErrors *)pfV2Cms_cent->Get("pgV2_sys");
    TGraphErrors *pgV2HighP     = (TGraphErrors *)pfV2Cms_cent->Get("pgV2_cont");

    pgV2Low->SetName("pgV2Low");
    pgV2LowSyst->SetFillColorAlpha(kViolet-9,0.5);
    pgV2High->SetName("pgV2High");
    pgV2HighSyst->SetFillColorAlpha(kRed-9,0.5);

    // -----------------------------------------------------------------------------------------
    // ----- charged hadrons
    TGraphErrors *gChar    = new TGraphErrors(19, pTChar, v2Char, chxerr, v2CharSt);
    TGraphErrors *gChar2   = new TGraphErrors(19, pTChar, v2Char, chxerr, v2CharSt2);
    TGraphErrors *gCharSys = new TGraphErrors(19, pTChar, v2Char, chxerr2, v2CharSys);

    gChar->SetName("gChar");
    gChar->SetMarkerStyle(20);
    gChar->SetMarkerColor(kTeal+3);
    gChar->SetLineColor(kTeal+3);
    gChar->SetMarkerSize(1.3);
    gChar2->SetMarkerStyle(24);
    gChar2->SetMarkerColor(kTeal+4);
    gChar2->SetLineColor(kTeal+4);
    gChar2->SetMarkerSize(1.3);

    gCharSys->SetFillColor(kTeal-9);

    //----------- D from ALICE
    TGraphErrors *pgAlice          = new TGraphErrors(6, v2AliceX_pt, v2Alice_pt, v2AliceXl, v2AliceStat_pt);
    TGraphErrors *pgAliceSys       = new TGraphErrors(6, v2AliceX_pt, v2Alice_pt, v2AliceXl, v2AliceSyst_pt);
    TGraphAsymmErrors *pgAliceSysB = new TGraphAsymmErrors(6, v2AliceX_pt, v2Alice_pt, v2AliceXl2, v2AliceXl2, v2AliceSystBLow_pt, v2AliceSystBHigh_pt);


    pgAlice->SetName("pgAlice");
    pgAlice->SetMarkerStyle(kOpenSquare);
    pgAlice->SetMarkerColor(kGray+2);
    pgAlice->SetLineColor(kGray+2);
    pgAlice->SetMarkerSize(1.0);

    pgAliceSys->SetFillStyle(0);
    pgAliceSys->SetMarkerColor(kGray+2);
    pgAliceSys->SetLineColor(kGray+2);
    pgAliceSys->SetMarkerSize(1.7);

    pgAliceSysB->SetFillColor(kGray);

    // drawing
    //------------------------------------------------------------------------
    // put everything on one plot
    TH1D *phAxis_v2 = new TH1D("phAxis_v2",";p_{T} (GeV/c);v_{2}",1,0,rangeXAxis);
    phAxis_v2->SetDirectory(0);
    phAxis_v2->GetXaxis()->CenterTitle(true);
    phAxis_v2->GetXaxis()->LabelsOption("h");
    phAxis_v2->GetYaxis()->SetRangeUser(0,rangeYAxis);
    phAxis_v2->GetYaxis()->SetTitleOffset(1.25);

    TCanvas *pcCombi = new TCanvas("pcCombi","pcCombi");
    phAxis_v2->Draw();
    CMS_lumi(pcCombi,12001000,0);

    pgAliceSysB->Draw("2");
    pgAliceSys->Draw("2");
    pgAlice->Draw("pz");

    if (bDrawCh) {
        gCharSys->Draw("2");
        gChar->Draw("pz");
        gChar2->Draw("p");
    }

    pgV2LowSyst->Draw("2");
    pgV2Low->Draw("PZ");
    pgV2LowP->Draw("P");

    pgV2HighSyst->Draw("2");
    pgV2High->Draw("PZ");
    pgV2HighP->Draw("P");

    // --------- legends ----
    TLegend *leg = new TLegend(0.2,0.77,0.7,0.89,NULL,"brNDC"); // at top center
    leg->SetBorderSize(0);
    leg->SetTextFont(132);
    leg->SetTextSize(0.03);
    leg->SetLineColor(1);
    leg->SetLineStyle(1);
    leg->SetLineWidth(1);
    leg->SetFillColor(19);
    leg->SetFillStyle(0);

    TLegendEntry *entry, *entry11;
    entry=leg->AddEntry("cmspr","Hidden charm: prompt J/#psi","");
    entry->SetTextFont(132);
    entry->SetTextSize(ltxSetTextSize3);

    entry=leg->AddEntry("pgV2Low", "1.6 < |y| < 2.4","p");
    entry->SetTextFont(42);
    entry->SetTextSize(entrySize);

    entry=leg->AddEntry("pgV2High", "|y| < 2.4","P");
    entry->SetTextFont(42);
    entry->SetTextSize(entrySize);

    TLegend *leg1 = new TLegend(0.2,0.685,0.7,0.765,NULL,"brNDC");
    leg1->SetBorderSize(0);
    leg1->SetTextFont(132);
    leg1->SetTextSize(ltxSetTextSize3);

    if (bDrawCh) {
        TLegendEntry *entry1;
        entry1=leg1->AddEntry("hpm","Charged hadron","");
        entry1->SetTextFont(132);
        entry1->SetTextSize(ltxSetTextSize3);
        entry1=leg1->AddEntry("gChar","|#eta| < 0.8","P");
        entry1->SetTextFont(42);
        entry1->SetTextSize(entrySize);
    }

    //---------------------------
    TLegend *leg_alice;
    if (bDrawCh) {
        leg_alice = new TLegend(0.2,0.60,0.7,0.68,NULL,"brNDC");
    } else {
        leg_alice = new TLegend(0.2,0.685,0.7,0.765,NULL,"brNDC");
    }
    leg_alice->SetBorderSize(0);
    leg_alice->SetTextFont(132);
    leg_alice->SetLineColor(1);
    leg_alice->SetLineStyle(1);
    leg_alice->SetLineWidth(1);
    leg_alice->SetFillColor(19);
    leg_alice->SetFillStyle(0);

    TLegendEntry *entry_alice=leg_alice->AddEntry("pgAlice","Open charm: prompt D (ALICE)","");
    entry_alice->SetTextFont(132);
    entry_alice->SetTextSize(ltxSetTextSize3);
    entry_alice=leg_alice->AddEntry("pgAlice","|y| < 0.8, Cent. 30-50\%","P");
    entry_alice->SetTextFont(42);
    entry_alice->SetTextSize(entrySize);

    TLatex *lat = new TLatex();
    lat->SetNDC();
    lat->SetTextFont(42);
    lat->SetTextSize(ltxSetTextSize2);
    if (bDrawCh) lat->DrawLatex(0.63,0.52,"Cent. 10-60%");
    else lat->DrawLatex(0.63,0.58,"Cent. 10-60%");

    leg->Draw();
    if (bDrawCh) leg1->Draw();
    leg_alice->Draw();

    gPad->RedrawAxis();

    if(bSavePlots)
    {
        pcCombi->SaveAs(Form("figs/pdf/%s_RaaCh%d.pdf",figNamePrefix,bDrawCh));
        pcCombi->SaveAs(Form("figs/png/%s_RaaCh%d.png",figNamePrefix,bDrawCh));
    }


    return;
}
void phielphileadj()
{
//=========Macro generated from canvas: phielphileadj/phielphileadj
//=========  (Sun Nov  8 21:56:11 2015) by ROOT version6.02/05
   TCanvas *phielphileadj = new TCanvas("phielphileadj", "phielphileadj",0,23,700,700);
   phielphileadj->Range(-0.3926991,-4.787882,3.534292,1.179054);
   phielphileadj->SetFillColor(0);
   phielphileadj->SetBorderMode(0);
   phielphileadj->SetBorderSize(2);
   phielphileadj->SetLogy();
   phielphileadj->SetFrameBorderMode(0);
   phielphileadj->SetFrameBorderMode(0);
   
   THStack *phielphileadj = new THStack();
   phielphileadj->SetName("phielphileadj");
   phielphileadj->SetTitle("phielphileadj");
   
   TH1F *phielphileadj_stack_22 = new TH1F("phielphileadj_stack_22","phielphileadj",10,0,3.141593);
   phielphileadj_stack_22->SetMinimum(6.4389e-05);
   phielphileadj_stack_22->SetMaximum(3.822615);
   phielphileadj_stack_22->SetDirectory(0);
   phielphileadj_stack_22->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   phielphileadj_stack_22->SetLineColor(ci);
   phielphileadj_stack_22->GetXaxis()->SetTitle("phielphileadj");
   phielphileadj_stack_22->GetXaxis()->SetLabelFont(42);
   phielphileadj_stack_22->GetXaxis()->SetLabelSize(0.035);
   phielphileadj_stack_22->GetXaxis()->SetTitleSize(0.035);
   phielphileadj_stack_22->GetXaxis()->SetTitleFont(42);
   phielphileadj_stack_22->GetYaxis()->SetTitle("Events/pb");
   phielphileadj_stack_22->GetYaxis()->SetLabelFont(42);
   phielphileadj_stack_22->GetYaxis()->SetLabelSize(0.035);
   phielphileadj_stack_22->GetYaxis()->SetTitleSize(0.035);
   phielphileadj_stack_22->GetYaxis()->SetTitleFont(42);
   phielphileadj_stack_22->GetZaxis()->SetLabelFont(42);
   phielphileadj_stack_22->GetZaxis()->SetLabelSize(0.035);
   phielphileadj_stack_22->GetZaxis()->SetTitleSize(0.035);
   phielphileadj_stack_22->GetZaxis()->SetTitleFont(42);
   phielphileadj->SetHistogram(phielphileadj_stack_22);
   
   
   TH1D *phielphileadj106 = new TH1D("phielphileadj106"," #Delta_{#phi}[e_{-},jet_{1}]",10,0,3.141593);
   phielphileadj106->SetBinContent(1,0.04383576);
   phielphileadj106->SetBinContent(2,0.001250901);
   phielphileadj106->SetBinContent(6,0.001250901);
   phielphileadj106->SetBinContent(8,0.001250901);
   phielphileadj106->SetBinContent(9,0.002501802);
   phielphileadj106->SetBinContent(10,0.01000721);
   phielphileadj106->SetBinError(1,0.02673601);
   phielphileadj106->SetBinError(2,0.001250901);
   phielphileadj106->SetBinError(6,0.001250901);
   phielphileadj106->SetBinError(8,0.001250901);
   phielphileadj106->SetBinError(9,0.001769041);
   phielphileadj106->SetBinError(10,0.003538083);
   phielphileadj106->SetEntries(28);

   ci = TColor::GetColor("#00cc00");
   phielphileadj106->SetFillColor(ci);

   ci = TColor::GetColor("#00cc00");
   phielphileadj106->SetLineColor(ci);

   ci = TColor::GetColor("#00cc00");
   phielphileadj106->SetMarkerColor(ci);
   phielphileadj106->SetMarkerStyle(22);
   phielphileadj106->GetXaxis()->SetTitle("phielphileadj");
   phielphileadj106->GetXaxis()->SetLabelFont(42);
   phielphileadj106->GetXaxis()->SetLabelSize(0.035);
   phielphileadj106->GetXaxis()->SetTitleSize(0.035);
   phielphileadj106->GetXaxis()->SetTitleFont(42);
   phielphileadj106->GetYaxis()->SetTitle("Events/pb");
   phielphileadj106->GetYaxis()->SetLabelFont(42);
   phielphileadj106->GetYaxis()->SetLabelSize(0.035);
   phielphileadj106->GetYaxis()->SetTitleSize(0.035);
   phielphileadj106->GetYaxis()->SetTitleFont(42);
   phielphileadj106->GetZaxis()->SetLabelFont(42);
   phielphileadj106->GetZaxis()->SetLabelSize(0.035);
   phielphileadj106->GetZaxis()->SetTitleSize(0.035);
   phielphileadj106->GetZaxis()->SetTitleFont(42);
   phielphileadj->Add(phielphileadj,"");
   
   TH1D *phielphileadj107 = new TH1D("phielphileadj107"," #Delta_{#phi}[e_{-},jet_{1}]",10,0,3.141593);
   phielphileadj107->SetBinContent(1,0.2179961);
   phielphileadj107->SetBinContent(2,0.01962548);
   phielphileadj107->SetBinContent(3,0.02590187);
   phielphileadj107->SetBinContent(4,0.04624029);
   phielphileadj107->SetBinContent(5,0.09403783);
   phielphileadj107->SetBinContent(6,0.1831221);
   phielphileadj107->SetBinContent(7,0.3913257);
   phielphileadj107->SetBinContent(8,0.7765426);
   phielphileadj107->SetBinContent(9,1.404146);
   phielphileadj107->SetBinContent(10,2.115042);
   phielphileadj107->SetBinError(1,0.008912504);
   phielphileadj107->SetBinError(2,0.002766324);
   phielphileadj107->SetBinError(3,0.0025562);
   phielphileadj107->SetBinError(4,0.003795699);
   phielphileadj107->SetBinError(5,0.00538164);
   phielphileadj107->SetBinError(6,0.007316189);
   phielphileadj107->SetBinError(7,0.01018447);
   phielphileadj107->SetBinError(8,0.01359639);
   phielphileadj107->SetBinError(9,0.01731972);
   phielphileadj107->SetBinError(10,0.01901507);
   phielphileadj107->SetEntries(120946);

   ci = TColor::GetColor("#00ffff");
   phielphileadj107->SetFillColor(ci);

   ci = TColor::GetColor("#00ffff");
   phielphileadj107->SetLineColor(ci);

   ci = TColor::GetColor("#00ffff");
   phielphileadj107->SetMarkerColor(ci);
   phielphileadj107->SetMarkerStyle(20);
   phielphileadj107->GetXaxis()->SetTitle("phielphileadj");
   phielphileadj107->GetXaxis()->SetLabelFont(42);
   phielphileadj107->GetXaxis()->SetLabelSize(0.035);
   phielphileadj107->GetXaxis()->SetTitleSize(0.035);
   phielphileadj107->GetXaxis()->SetTitleFont(42);
   phielphileadj107->GetYaxis()->SetTitle("Events/pb");
   phielphileadj107->GetYaxis()->SetLabelFont(42);
   phielphileadj107->GetYaxis()->SetLabelSize(0.035);
   phielphileadj107->GetYaxis()->SetTitleSize(0.035);
   phielphileadj107->GetYaxis()->SetTitleFont(42);
   phielphileadj107->GetZaxis()->SetLabelFont(42);
   phielphileadj107->GetZaxis()->SetLabelSize(0.035);
   phielphileadj107->GetZaxis()->SetTitleSize(0.035);
   phielphileadj107->GetZaxis()->SetTitleFont(42);
   phielphileadj->Add(phielphileadj,"");
   
   TH1D *phielphileadj108 = new TH1D("phielphileadj108"," #Delta_{#phi}[e_{-},jet_{1}]",10,0,3.141593);
   phielphileadj108->SetBinContent(1,0.05941227);
   phielphileadj108->SetBinContent(2,0.00156904);
   phielphileadj108->SetBinContent(3,0.002351593);
   phielphileadj108->SetBinContent(4,0.001584431);
   phielphileadj108->SetBinContent(5,0.001808185);
   phielphileadj108->SetBinContent(6,0.001742163);
   phielphileadj108->SetBinContent(7,0.001625272);
   phielphileadj108->SetBinContent(8,0.001809533);
   phielphileadj108->SetBinContent(9,0.002412292);
   phielphileadj108->SetBinContent(10,0.002300997);
   phielphileadj108->SetBinError(1,0.001774682);
   phielphileadj108->SetBinError(2,0.0002329711);
   phielphileadj108->SetBinError(3,0.0003550724);
   phielphileadj108->SetBinError(4,0.0002277697);
   phielphileadj108->SetBinError(5,0.0002417215);
   phielphileadj108->SetBinError(6,0.0002105135);
   phielphileadj108->SetBinError(7,0.0001661239);
   phielphileadj108->SetBinError(8,0.0001667856);
   phielphileadj108->SetBinError(9,0.0002762658);
   phielphileadj108->SetBinError(10,0.0001771848);
   phielphileadj108->SetEntries(6831);

   ci = TColor::GetColor("#ffcc00");
   phielphileadj108->SetFillColor(ci);

   ci = TColor::GetColor("#ffcc00");
   phielphileadj108->SetLineColor(ci);

   ci = TColor::GetColor("#ffcc00");
   phielphileadj108->SetMarkerColor(ci);
   phielphileadj108->SetMarkerStyle(21);
   phielphileadj108->GetXaxis()->SetTitle("phielphileadj");
   phielphileadj108->GetXaxis()->SetLabelFont(42);
   phielphileadj108->GetXaxis()->SetLabelSize(0.035);
   phielphileadj108->GetXaxis()->SetTitleSize(0.035);
   phielphileadj108->GetXaxis()->SetTitleFont(42);
   phielphileadj108->GetYaxis()->SetTitle("Events/pb");
   phielphileadj108->GetYaxis()->SetLabelFont(42);
   phielphileadj108->GetYaxis()->SetLabelSize(0.035);
   phielphileadj108->GetYaxis()->SetTitleSize(0.035);
   phielphileadj108->GetYaxis()->SetTitleFont(42);
   phielphileadj108->GetZaxis()->SetLabelFont(42);
   phielphileadj108->GetZaxis()->SetLabelSize(0.035);
   phielphileadj108->GetZaxis()->SetTitleSize(0.035);
   phielphileadj108->GetZaxis()->SetTitleFont(42);
   phielphileadj->Add(phielphileadj,"");
   
   TH1D *phielphileadj109 = new TH1D("phielphileadj109"," #Delta_{#phi}[e_{-},jet_{1}]",10,0,3.141593);
   phielphileadj109->SetBinContent(1,0.001388212);
   phielphileadj109->SetBinContent(2,0.0002313686);
   phielphileadj109->SetBinContent(3,0.0002159441);
   phielphileadj109->SetBinContent(4,0.0002313686);
   phielphileadj109->SetBinContent(5,0.0005707093);
   phielphileadj109->SetBinContent(6,0.0008946254);
   phielphileadj109->SetBinContent(7,0.0008946254);
   phielphileadj109->SetBinContent(8,0.001588731);
   phielphileadj109->SetBinContent(9,0.001789251);
   phielphileadj109->SetBinContent(10,0.002113167);
   phielphileadj109->SetBinError(1,0.0001463304);
   phielphileadj109->SetBinError(2,5.973913e-05);
   phielphileadj109->SetBinError(3,5.771348e-05);
   phielphileadj109->SetBinError(4,5.973913e-05);
   phielphileadj109->SetBinError(5,9.382403e-05);
   phielphileadj109->SetBinError(6,0.0001174701);
   phielphileadj109->SetBinError(7,0.0001174701);
   phielphileadj109->SetBinError(8,0.0001565423);
   phielphileadj109->SetBinError(9,0.0001661278);
   phielphileadj109->SetBinError(10,0.00018054);
   phielphileadj109->SetEntries(643);

   ci = TColor::GetColor("#ff0000");
   phielphileadj109->SetFillColor(ci);

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

   ci = TColor::GetColor("#ff0000");
   phielphileadj109->SetMarkerColor(ci);
   phielphileadj109->SetMarkerStyle(20);
   phielphileadj109->GetXaxis()->SetTitle("phielphileadj");
   phielphileadj109->GetXaxis()->SetLabelFont(42);
   phielphileadj109->GetXaxis()->SetLabelSize(0.035);
   phielphileadj109->GetXaxis()->SetTitleSize(0.035);
   phielphileadj109->GetXaxis()->SetTitleFont(42);
   phielphileadj109->GetYaxis()->SetTitle("Events/pb");
   phielphileadj109->GetYaxis()->SetLabelFont(42);
   phielphileadj109->GetYaxis()->SetLabelSize(0.035);
   phielphileadj109->GetYaxis()->SetTitleSize(0.035);
   phielphileadj109->GetYaxis()->SetTitleFont(42);
   phielphileadj109->GetZaxis()->SetLabelFont(42);
   phielphileadj109->GetZaxis()->SetLabelSize(0.035);
   phielphileadj109->GetZaxis()->SetTitleSize(0.035);
   phielphileadj109->GetZaxis()->SetTitleFont(42);
   phielphileadj->Add(phielphileadj,"");
   
   TH1D *phielphileadj110 = new TH1D("phielphileadj110"," #Delta_{#phi}[e_{-},jet_{1}]",10,0,3.141593);
   phielphileadj110->SetBinContent(1,0.001593307);
   phielphileadj110->SetBinContent(2,0.0005199211);
   phielphileadj110->SetBinContent(3,0.000335433);
   phielphileadj110->SetBinContent(4,0.0004696061);
   phielphileadj110->SetBinContent(5,0.0004696061);
   phielphileadj110->SetBinContent(6,0.0006540943);
   phielphileadj110->SetBinContent(7,0.0008888973);
   phielphileadj110->SetBinContent(8,0.001962283);
   phielphileadj110->SetBinContent(9,0.002331259);
   phielphileadj110->SetBinContent(10,0.003119526);
   phielphileadj110->SetBinError(1,0.0001634698);
   phielphileadj110->SetBinError(2,9.338058e-05);
   phielphileadj110->SetBinError(3,7.500509e-05);
   phielphileadj110->SetBinError(4,8.874722e-05);
   phielphileadj110->SetBinError(5,8.874722e-05);
   phielphileadj110->SetBinError(6,0.0001047389);
   phielphileadj110->SetBinError(7,0.0001220994);
   phielphileadj110->SetBinError(8,0.0001814131);
   phielphileadj110->SetBinError(9,0.0001977348);
   phielphileadj110->SetBinError(10,0.0002287348);
   phielphileadj110->SetEntries(736);

   ci = TColor::GetColor("#0000ff");
   phielphileadj110->SetFillColor(ci);

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

   ci = TColor::GetColor("#0000ff");
   phielphileadj110->SetMarkerColor(ci);
   phielphileadj110->SetMarkerStyle(21);
   phielphileadj110->GetXaxis()->SetTitle("phielphileadj");
   phielphileadj110->GetXaxis()->SetLabelFont(42);
   phielphileadj110->GetXaxis()->SetLabelSize(0.035);
   phielphileadj110->GetXaxis()->SetTitleSize(0.035);
   phielphileadj110->GetXaxis()->SetTitleFont(42);
   phielphileadj110->GetYaxis()->SetTitle("Events/pb");
   phielphileadj110->GetYaxis()->SetLabelFont(42);
   phielphileadj110->GetYaxis()->SetLabelSize(0.035);
   phielphileadj110->GetYaxis()->SetTitleSize(0.035);
   phielphileadj110->GetYaxis()->SetTitleFont(42);
   phielphileadj110->GetZaxis()->SetLabelFont(42);
   phielphileadj110->GetZaxis()->SetLabelSize(0.035);
   phielphileadj110->GetZaxis()->SetTitleSize(0.035);
   phielphileadj110->GetZaxis()->SetTitleFont(42);
   phielphileadj->Add(phielphileadj,"");
   phielphileadj->Draw("nostack");
   
   TPaveText *pt = new TPaveText(0.3377011,0.9342857,0.6622989,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   TText *AText = pt->AddText("phielphileadj");
   pt->Draw();
   
   TLegend *leg = new TLegend(0.54023,0.639881,0.938218,0.924107,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextSize(0.034965);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("phielphileadj","phielphileadj_QCD","lp");

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

   ci = TColor::GetColor("#00cc00");
   entry->SetMarkerColor(ci);
   entry->SetMarkerStyle(22);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("phielphileadj","phielphileadj_WJetsToLNu","lp");

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

   ci = TColor::GetColor("#00ffff");
   entry->SetMarkerColor(ci);
   entry->SetMarkerStyle(20);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("phielphileadj","phielphileadj_ZJetsToNuNu","lp");

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

   ci = TColor::GetColor("#ffcc00");
   entry->SetMarkerColor(ci);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("phielphileadj","phielphileadj_signal","lp");

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

   ci = TColor::GetColor("#ff0000");
   entry->SetMarkerColor(ci);
   entry->SetMarkerStyle(20);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("phielphileadj","phielphileadj_ttbar","lp");

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

   ci = TColor::GetColor("#0000ff");
   entry->SetMarkerColor(ci);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   phielphileadj->Modified();
   phielphileadj->cd();
   phielphileadj->SetSelected(phielphileadj);
}
void paraPull_alpha_EG_RESOLUTION_ALL_2TeV_2Lep_plots_All()
{
//=========Macro generated from canvas: c1/alpha_EG_RESOLUTION_ALL
//=========  (Sun Nov 22 20:14:01 2015) by ROOT version6.02/12
   TCanvas *c1 = new TCanvas("c1", "alpha_EG_RESOLUTION_ALL",0,22,1000,600);
   gStyle->SetOptStat(0);
   c1->Range(-4.125,-0.9756355,37.125,1.049623);
   c1->SetFillColor(0);
   c1->SetBorderMode(0);
   c1->SetBorderSize(2);
   c1->SetGridx();
   c1->SetGridy();
   c1->SetFrameBorderMode(0);
   c1->SetFrameBorderMode(0);
   
   TH1F *NuisanceParameterFreed6 = new TH1F("NuisanceParameterFreed6","alpha_EG_RESOLUTION_ALL",33,0,33);
   NuisanceParameterFreed6->SetMinimum(-0.7731097);
   NuisanceParameterFreed6->SetMaximum(0.8470969);
   NuisanceParameterFreed6->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   NuisanceParameterFreed6->SetLineColor(ci);
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(1,"XS_ttbar");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(2,"EG_SCALE_ALL");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(3,"FT_EFF_Eigen_C_0");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(4,"Luminosity");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(5,"XS_st");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(6,"FT_EFF_Eigen_B_1");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(7,"XS_Zc");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(8,"MUONS_ID");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(9,"FT_EFF_Eigen_C_1");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(10,"FT_EFF_Eigen_C_3");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(11,"MUON_EFF_TrigSystUncertainty");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(12,"XS_Zl");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(13,"EL_EFF_ID_TotalCorrUncertainty");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(14,"FT_EFF_Eigen_B_0");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(15,"FT_EFF_Eigen_B_2");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(16,"EL_EFF_Iso_TotalCorrUncertainty");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(17,"EL_EFF_Reco_TotalCorrUncertainty");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(18,"MUONS_SCALE");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(19,"MUON_ISO_STAT");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(20,"FT_EFF_extrapolation");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(21,"MUON_EFF_STAT");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(22,"MUON_EFF_SYS");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(23,"MUON_EFF_TrigStatUncertainty");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(24,"FT_EFF_Eigen_Light_1");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(25,"FT_EFF_Eigen_Light_2");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(26,"XS_diboson");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(27,"FT_EFF_Eigen_Light_4");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(28,"FT_EFF_Eigen_Light_3");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(29,"MUON_ISO_SYS");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(30,"XS_Zb");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(31,"FT_EFF_Eigen_C_2");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(32,"MUONS_MS");
   NuisanceParameterFreed6->GetXaxis()->SetBinLabel(33,"FT_EFF_Eigen_Light_0");
   NuisanceParameterFreed6->GetXaxis()->SetLabelFont(42);
   NuisanceParameterFreed6->GetXaxis()->SetLabelSize(0.035);
   NuisanceParameterFreed6->GetXaxis()->SetTitleSize(0.035);
   NuisanceParameterFreed6->GetXaxis()->SetTitleFont(42);
   NuisanceParameterFreed6->GetYaxis()->SetTitle("#theta_{fit} - #theta_{initial}/#Delta#theta");
   NuisanceParameterFreed6->GetYaxis()->SetLabelFont(42);
   NuisanceParameterFreed6->GetYaxis()->SetLabelSize(0.035);
   NuisanceParameterFreed6->GetYaxis()->SetTitleSize(0.035);
   NuisanceParameterFreed6->GetYaxis()->SetTitleFont(42);
   NuisanceParameterFreed6->GetZaxis()->SetLabelFont(42);
   NuisanceParameterFreed6->GetZaxis()->SetLabelSize(0.035);
   NuisanceParameterFreed6->GetZaxis()->SetTitleSize(0.035);
   NuisanceParameterFreed6->GetZaxis()->SetTitleFont(42);
   NuisanceParameterFreed6->Draw("hist");
   
   Double_t _fx1006[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 _fy1006[35] = {
   1.22802e-312,
   -0.7731097,
   -0.3921743,
   -0.293631,
   -0.2062229,
   -0.1827488,
   -0.1281174,
   -0.1245126,
   -0.1082091,
   -0.06576492,
   -0.05684313,
   -0.05332309,
   -0.04675272,
   -0.0376783,
   -0.03228676,
   -0.03112064,
   -0.02395027,
   -0.01716815,
   -0.001368855,
   0.0001639766,
   0.01020258,
   0.01060384,
   0.0180787,
   0.01974379,
   0.02028609,
   0.02046257,
   0.04020329,
   0.04266391,
   0.04578831,
   0.05049948,
   0.05319844,
   0.0574024,
   0.05790248,
   0.8470969,
   0};
   Double_t _fex1006[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 _fey1006[35] = {
   0,
   0,
   0.610768,
   1.073217,
   1.263173,
   0.9362314,
   0.9916222,
   0.9863048,
   0.9259827,
   0.7691218,
   0.9864552,
   0.9937942,
   0.9917457,
   0.9970139,
   0.9818237,
   0.9374371,
   0.9926691,
   0.9931835,
   0.9925618,
   1.004989,
   0.9933467,
   0.9550431,
   0.9932277,
   0.9929666,
   0.992751,
   0.9913074,
   0.9909922,
   0.9869917,
   0.9931709,
   0.9930627,
   0.9855153,
   0.7535663,
   0.9909032,
   0.7381565,
   0.7858726};
   TGraphErrors *gre = new TGraphErrors(35,_fx1006,_fy1006,_fex1006,_fey1006);
   gre->SetName("");
   gre->SetTitle("");
   gre->SetFillColor(1);
   gre->SetMarkerStyle(20);
   gre->SetMarkerSize(1.2);
   
   TH1F *Graph_Graph1006 = new TH1F("Graph_Graph1006","",100,0,35.75);
   Graph_Graph1006->SetMinimum(-1.774861);
   Graph_Graph1006->SetMaximum(1.890718);
   Graph_Graph1006->SetDirectory(0);
   Graph_Graph1006->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1006->SetLineColor(ci);
   Graph_Graph1006->GetXaxis()->SetLabelFont(42);
   Graph_Graph1006->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1006->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1006->GetXaxis()->SetTitleFont(42);
   Graph_Graph1006->GetYaxis()->SetLabelFont(42);
   Graph_Graph1006->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1006->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1006->GetYaxis()->SetTitleFont(42);
   Graph_Graph1006->GetZaxis()->SetLabelFont(42);
   Graph_Graph1006->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1006->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1006->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1006);
   
   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.2831727,0.9341608,0.7168273,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   TText *AText = pt->AddText("alpha_EG_RESOLUTION_ALL");
   pt->Draw();
   c1->Modified();
   c1->cd();
   c1->SetSelected(c1);
}
예제 #20
0
void kees_gen() {
  gROOT->SetStyle("HALLA");
  TCanvas *cn = new TCanvas("cn");
  cn->Draw();
  cn->UseCurrentStyle();
  TH1F *frm = new TH1F("frm","",100,0.,10.);
  frm->GetXaxis()->SetTitle("Q^{2}  [GeV^{2}]");
  frm->GetYaxis()->SetTitle("G_{E}^{n}");
  frm->SetMinimum(-.02);
  frm->SetMaximum(0.1);
  frm->UseCurrentStyle();
  frm->Draw();
  frm->SetAxisRange(0.,5.,"X");

  TF1 *genf = new TF1("genf",genff,1.,10.,1);
  genf->SetLineColor(2);
  genf->SetLineStyle(2);
  genf->SetParameter(0,1.);
  genf->SetParameter(1,.3);
  genf->SetParameter(0,-0.632);
  // match to Madey point just below 1.5
  //  genf->SetParameter(0,.0411/genf->Eval(1.45));
  
  TMultiGraph* mgrDta = new TMultiGraph("Data","G_{E}^{n}");
  TLegend *legDta = new TLegend(.54,.6,.875,.90,"","brNDC");

  TMultiGraph* wgr = mgrDta;
  TLegend *wlg = legDta;

   // the data
  legDta->SetBorderSize(0); // turn off border
  legDta->SetFillStyle(0);
  
  datafile_t *f = datafiles;
  TGraph* gr=0;
  while ( f && f->filename ) {
    gr=OneGraph(f);
    if (gr) {
      if (f->lnpt) {
	mgrDta->Add(gr,f->lnpt);
	legDta->AddEntry(gr,f->label,f->lnpt);
      }
      else if (gr->GetMarkerStyle()>=20) {
	mgrDta->Add(gr,"p");
	legDta->AddEntry(gr,f->label,"p");
      }	
      else {
	mgrDta->Add(gr,"l");
	legDta->AddEntry(gr,f->label,"l");
      }
    }
    f++;
  }
    

  mgrDta->Draw("p");
  //  legDta->Draw();   don't draw the data legend
  
  TMultiGraph* mgrThry = new TMultiGraph("Theory","G_{E}^{n}");
  TLegend *legThry = new TLegend(.54,.6,.875,.9,"","brNDC");

  wgr = mgrThry;
  wlg = legThry;

  // the theory
  wlg->SetBorderSize(0); // turn off border
  wlg->SetFillStyle(0);
  
  f = theoryfiles1;
  gr=0;
  while ( f && f->filename ) {
    gr=OneGraph(f);
    if (gr) {
      TGraphAsymmErrors *egr = dynamic_cast<TGraphAsymmErrors*>(gr);
      if (egr && egr->GetN()>1 && egr->GetEYhigh() && egr->GetEYhigh()[1]>0) {
	gr = toerror_band(egr);
	gr->SetFillStyle(3000+f->style);
      }
      if (f->lnpt) {
	wgr->Add(gr,f->lnpt);
	wlg->AddEntry(gr,f->label,f->lnpt);
      }
      else if (gr->GetMarkerStyle()>=20) {
	wgr->Add(gr,"p");
	wlg->AddEntry(gr,f->label,"p");
      }	
      else {
	wgr->Add(gr,"l");
	wlg->AddEntry(gr,f->label,"l");
      }
    }
    f++;
  }

  genf->Draw("same");
  mgrThry->Draw("c");
  legThry->AddEntry(genf,"F_{2}/F_{1} #propto ln^{2}(Q^{2}/#Lambda^{2})/Q^{2}","l");
  legThry->Draw();

  // draw a line at 1
  cn->Modified();

  cn->Update();
  cn->SaveAs(Form("%s.eps",psfile));
  cn->SaveAs(Form("%s.root",psfile));
  gSystem->Exec(Form("./replace_symbols.pl %s.eps",psfile));
  // now an overlay, hopefully matching dimensions

  // remove everything but the graph
  cn->Update();
  TList *clist = cn->GetListOfPrimitives();
  TFrame* frame = cn->GetFrame();
  for (int i=0; i<clist->GetSize(); ) {
    if (clist->At(i) != frame) {
      clist->RemoveAt(i);
    } else i++;
  }
  // draw markers in the corners
  TMarker *mkr = new TMarker(frame->GetX1(),frame->GetY1(),2);
  mkr->Draw();
  mkr = new TMarker(frame->GetX2(),frame->GetY1(),2);
  mkr->Draw();
  mkr = new TMarker(frame->GetX1(),frame->GetY2(),2);
  mkr->Draw();
  mkr = new TMarker(frame->GetX2(),frame->GetY2(),2);
  mkr->Draw();
  frame->SetLineColor(10);
  cn->Update();

  datafile_t miller = { "figure_input/Miller/lattice.GEn.rtf","Miller",
			"[0]","[1]","[1]-[3]","[2]-[1]",0,0,1,3,"F" };

  gr = OneGraph(&miller);
  TGraphAsymmErrors* egr = dynamic_cast<TGraphAsymmErrors*>(gr);
  if (egr && egr->GetEYhigh() && egr->GetEYhigh()[egr->GetN()/2]>0) {
    gr = toerror_band(egr);
    gr->SetLineStyle(1);
    gr->SetFillColor(gr->GetLineColor());
    gr->SetFillStyle(3000+miller.style);
  }
  
  gr->Draw("F");

  cn->Update();
  cn->SaveAs("gen_Miller_Overlay.eps");
  cn->SaveAs("gen_Miller_Overlay.root");
  
}
예제 #21
0
void balanceMetVsAj(TString infname,
                    TString insrc, TString metType = "",bool drawLegend = false,
                    bool drawSys = true
                    )
{
   // ===========================================================
   // Get Input
   // ===========================================================
   TFile *inf = new TFile(infname);
   
   // ===========================================================
   // Analysis Setup
   // ===========================================================
   Int_t plotLayer=10; // 0 only >0.5, 1 >0.5 and highpt, 10 ~ all
   const int nBin = 5;
   double bins[nBin+1] = {0.5,1.0,2,4,8,1000};  
   
   const int nBinAj = 4;
   double ajBins[nBinAj+1] = {0.0001,0.11,0.22,0.33,0.49999};
   
   cout << infname << endl;
   
   TH1D *ppos[nBin+1];
   TH1D *pneg[nBin+1];
   TH1D *pe[nBin+1];
   // =================================
   // Get Weighted Mean for each Aj bin
   // =================================
   for (int i=0;i<nBin+1;i++)
   {
      pe[i]=new TH1D(Form("p%d",i),"",nBinAj,ajBins);
      for (int a=0; a<nBinAj; ++a) {
         TString hname = Form("%s_mptx%s_merge%d_%dSigAll",insrc.Data(),metType.Data(),i,a);
         TH1D * hMpt = (TH1D*)inf->Get(hname);
//         cout << hname << " Aj bin: " << a+1 << " mean: " << hMpt->GetMean() << endl;
         pe[i]->SetBinContent(a+1,hMpt->GetMean());
         pe[i]->SetBinError(a+1,hMpt->GetRMS()/sqrt(hMpt->GetEntries()));
      }      
   }
   
   StackHistograms(nBin,pe,ppos,pneg,nBinAj);
   
   TH1D *pall=pe[nBin];
   
   pall->SetXTitle("A_{J}");
   pall->SetYTitle("<#slash{p}_{T}^{#parallel}> (GeV/c)");
   pall->GetXaxis()->CenterTitle();
   pall->GetYaxis()->CenterTitle();
   pall->GetXaxis()->SetLabelSize(22);
   pall->GetXaxis()->SetLabelFont(43);
   pall->GetXaxis()->SetTitleSize(24);
   pall->GetXaxis()->SetTitleFont(43);
   pall->GetYaxis()->SetLabelSize(22);
   pall->GetYaxis()->SetLabelFont(43);
   pall->GetYaxis()->SetTitleSize(24);
   pall->GetYaxis()->SetTitleFont(43);
   pall->GetXaxis()->SetTitleOffset(1.8);
   pall->GetYaxis()->SetTitleOffset(2.4);
   pall->SetNdivisions(505);
   pall->SetAxisRange(-59.9,59.9,"Y");
   pall->SetMarkerSize(1);
   pall->SetMarkerColor(kBlack);
   pall->SetMarkerStyle(kFullCircle);
   pall->Draw("E");
   float addSys = 0;
   if ( drawSys==1)   addSys=0; // No sys error at this moment
   
   // ====================
   // Finally Draw
   // ====================
   for (int i=0;i<nBin;++i) {
      if (plotLayer==0) continue;
      if (plotLayer==1&&i!=nBin-1) continue;
      ppos[i]->SetLineWidth(1);
      ppos[i]->Draw("hist same");
      pneg[i]->SetLineWidth(1);
      pneg[i]->Draw("hist same");
//      PrintHistogram(ppos[i]);
//      PrintHistogram(pneg[i]);
   }
   
   // ====================
   // Draw Statistical Error bars
   // ====================
   for (int i=0;i<nBin;++i) {
      if (plotLayer==0) continue;
      if (plotLayer==1&&i!=nBin-1) continue;
      if ( i==0 )       drawErrorShift(ppos[i],-0.016, addSys);
      if ( i==1 || i==4)       drawErrorShift(ppos[i],-0.008,addSys);
      if ( i==2 )       drawErrorShift(ppos[i],0.008,addSys);
      if ( i==3 )       drawErrorShift(ppos[i],0.016,addSys);
      if ( i==0 )       drawErrorShift(pneg[i],-0.016, addSys);
      if ( i==1 || i==4)       drawErrorShift(pneg[i],-0.008,addSys);
      if ( i==2 )       drawErrorShift(pneg[i],0.008,addSys);
      if ( i==3 )       drawErrorShift(pneg[i],0.016,addSys);
   }
   pall->Draw("E same");
//   PrintHistogram(pall);
   
   // ====================
   // Draw Systematic Errors
   // ====================
   if (drawSys == 1) {
      for(int i = 0; i < nBinAj; ++i){
         double x = pall->GetBinCenter(i+1);
         double y = pall->GetBinContent(i+1);
         // Quote the difference between GEN and RECO in >8 Bin (20%) before adjusting eff as systematics
         double errReco = -pe[nBin-1]->GetBinContent(i+1)*0.2;
         double errBck = 3.0; // compare HYDJET+SIG to SIG
         double err = sqrt(errReco*errReco+errBck*errBck);
         DrawTick(y,err,err,x,1,0.02,1);
      }
   }
   
   // ====================
   // Draw Legend
   // ====================
   TLegend *leg = new TLegend(0.10,0.68,0.70,0.96);
   leg->SetFillStyle(0);
   leg->SetBorderSize(0);
   leg->SetTextFont(63);
   leg->SetTextSize(16);
   leg->AddEntry(pall,Form("> %.1f GeV/c",bins[0]),"p");
   for (int i=0;i<nBin;++i) {
      if (plotLayer==0) continue;
      if (plotLayer==1&&i!=nBin-1) continue;
      if (i!=nBin-1){
         leg->AddEntry(ppos[i],Form("%.1f - %.1f GeV/c",bins[i],bins[i+1]),"f");
      } else {
         leg->AddEntry(ppos[i],Form("> %.1f GeV/c",bins[i]),"f");
      }
   }
   
   if (drawLegend) leg->Draw();
   
   TLine * l0 = new TLine(0,0,0.5,0);
   l0->SetLineStyle(2);
   l0->Draw();
   
   
   TLine * l1 = new TLine(0.0001,-10,0.0001,10);
   l1->Draw();
}
TF1* fit_histo_poly3bkg_floatwidth_poly2bkg_combinemassvnfit( bool isPbPb, int centlow, int centhigh, TH1D * histo, TH1D * h_mc_matched_signal, TH1D * h_mc_matched_kpiswapped, int ipt, TString cfgname, bool get_sig_bkg_ratio = false, TH1D * Ratio_signal_foreground = NULL, TH1D * h_vnvsmass = NULL, TH1D * h_vnvspt = NULL, TString vnorder = "v2", TString EPorSP = "SP", TH1D * h_vnvspt_bkg = NULL)
{
	Double_t setparam0=100.;
	Double_t setparam1=1.8648;
	Double_t setparam2=0.03;
	Double_t setparam3=0.005;
	Double_t setparam4=0.1;
	Double_t setparam7=0.1;
	Double_t fixparam1=1.8648;

	double fit_range_low = generalfitrange_masslow;
	double fit_range_high = generalfitrange_masshigh;
	double histomassbinsize = histo->GetBinWidth(10);

	float ptmin = ptbins[ipt];
	float ptmax = ptbins[ipt+1];

	//remove the fit function from v2 fit when perform v3 fit
	if( histo->GetListOfFunctions()->FindObject(Form("fmass_combinemassvnfit_%s_%d",cfgname.Data(),ipt)) )
		histo->GetListOfFunctions()->Remove( histo->GetListOfFunctions()->FindObject(Form("fmass_combinemassvnfit_%s_%d",cfgname.Data(),ipt)) );

	TH1F* histo_copy_nofitfun = ( TH1F * ) histo->Clone("histo_copy_nofitfun");
	TH1F* histo_massfit = ( TH1F * ) histo->Clone("histo_massfit");

	TCanvas* cfg= new TCanvas(Form("cfg_poly3bkg_floatwidth_poly2bkg_combinemassvnfit_%s_%d",cfgname.Data(),ipt),Form("cfg_poly3bkg_floatwidth_poly2bkg_combinemassvnfit_%s_%d",cfgname.Data(),ipt),600,600);

    gPad->SetRightMargin(0.043);
    gPad->SetLeftMargin(0.18);
    gPad->SetTopMargin(0.1);
    gPad->SetBottomMargin(0.145);

    TF1* f = new TF1(Form("f_%s_%d",cfgname.Data(),ipt),"[0]*([5]*([4]*TMath::Gaus(x,[1],[2]*(1.0 +[6]))/(sqrt(2*3.14159)*[2]*(1.0 +[6]))+(1-[4])*TMath::Gaus(x,[1],[3]*(1.0 +[6]))/(sqrt(2*3.14159)*[3]*(1.0 +[6])))+(1-[5])*TMath::Gaus(x,[8],[7]*(1.0 +[6]))/(sqrt(2*3.14159)*[7]*(1.0 +[6]))) + [9] + [10]*x + [11]*x*x + [12]*x*x*x", fit_range_low, fit_range_high);

	f->SetParLimits(10,-1000,1000);
	f->SetParLimits(3,0.001,0.05);
	f->SetParLimits(2,0.01,0.1);
	f->SetParLimits(7,0.02,0.2);
	f->SetParLimits(5,0,1);
	f->SetParLimits(4,0,1);

	f->SetParameter(0,setparam0);
	f->SetParameter(1,setparam1);
	f->SetParameter(2,setparam2);
	f->SetParameter(3,setparam3);
	f->SetParameter(4,setparam4);

	f->FixParameter(7,setparam7);
	f->FixParameter(8,setparam1);
	f->FixParameter(5,1);
	f->FixParameter(1,fixparam1);
	f->FixParameter(9,0);
	f->FixParameter(10,0);
	f->FixParameter(11,0);
	f->FixParameter(12,0);
	f->FixParameter(6,0);

	h_mc_matched_signal->Fit(Form("f_%s_%d",cfgname.Data(),ipt),"q","",fit_range_low,fit_range_high);
	h_mc_matched_signal->Fit(Form("f_%s_%d",cfgname.Data(),ipt),"q","",fit_range_low,fit_range_high);
	f->ReleaseParameter(1);
	h_mc_matched_signal->Fit(Form("f_%s_%d",cfgname.Data(),ipt),"L q","",fit_range_low,fit_range_high);
	h_mc_matched_signal->Fit(Form("f_%s_%d",cfgname.Data(),ipt),"L q","",fit_range_low,fit_range_high);
	h_mc_matched_signal->Fit(Form("f_%s_%d",cfgname.Data(),ipt),"L m","",fit_range_low,fit_range_high);

	f->FixParameter(1,f->GetParameter(1));
	f->FixParameter(2,f->GetParameter(2));
	f->FixParameter(3,f->GetParameter(3));
	f->FixParameter(4,f->GetParameter(4));
	f->FixParameter(5,0);
	f->ReleaseParameter(7);
	f->ReleaseParameter(8);
	f->SetParameter(7,setparam7);
    f->SetParameter(8,setparam1);//mean for swapped candidates
    //if want to fix parameter 8 to parameter 1
    //f->FixParameter(8,f->GetParameter(1));

	h_mc_matched_kpiswapped->Fit(Form("f_%s_%d",cfgname.Data(),ipt),"L q","",fit_range_low,fit_range_high);
	h_mc_matched_kpiswapped->Fit(Form("f_%s_%d",cfgname.Data(),ipt),"L q","",fit_range_low,fit_range_high);
	h_mc_matched_kpiswapped->Fit(Form("f_%s_%d",cfgname.Data(),ipt),"L q","",fit_range_low,fit_range_high);
	h_mc_matched_kpiswapped->Fit(Form("f_%s_%d",cfgname.Data(),ipt),"L m","",fit_range_low,fit_range_high);

	f->FixParameter(5,h_mc_matched_signal->Integral(0,1000)/(h_mc_matched_kpiswapped->Integral(0,1000)+h_mc_matched_signal->Integral(0,1000)));
	f->FixParameter(7,f->GetParameter(7));
	f->FixParameter(8,f->GetParameter(8));
	f->ReleaseParameter(9);
	f->ReleaseParameter(10);
	f->ReleaseParameter(11);
	f->ReleaseParameter(12);

	f->SetLineColor(kRed);

	histo_massfit->Fit(Form("f_%s_%d",cfgname.Data(),ipt),"q","",fit_range_low,fit_range_high);
	histo_massfit->Fit(Form("f_%s_%d",cfgname.Data(),ipt),"q","",fit_range_low,fit_range_high);
	f->ReleaseParameter(1);
	////Release Parameter 6 to float signal width
	f->ReleaseParameter(6);
	f->SetParameter(6,0);
	f->SetParLimits(6,-1.0,1.0);
	histo_massfit->Fit(Form("f_%s_%d",cfgname.Data(),ipt),"L q","",fit_range_low,fit_range_high);
	histo_massfit->Fit(Form("f_%s_%d",cfgname.Data(),ipt),"L q","",fit_range_low,fit_range_high);
	histo_massfit->Fit(Form("f_%s_%d",cfgname.Data(),ipt),"L q","",fit_range_low,fit_range_high);
	histo_massfit->Fit(Form("f_%s_%d",cfgname.Data(),ipt),"L m","",fit_range_low,fit_range_high);

	//begin combine fit
    TF1* fmass_combinemassvnfit = new TF1(Form("fmass_combinemassvnfit_%s_%d",cfgname.Data(),ipt),"[0]*([5]*([4]*TMath::Gaus(x,[1],[2]*(1.0 +[6]))/(sqrt(2*3.14159)*[2]*(1.0 +[6]))+(1-[4])*TMath::Gaus(x,[1],[3]*(1.0 +[6]))/(sqrt(2*3.14159)*[3]*(1.0 +[6])))+(1-[5])*TMath::Gaus(x,[8],[7]*(1.0 +[6]))/(sqrt(2*3.14159)*[7]*(1.0 +[6]))) + [9] + [10]*x + [11]*x*x + [12]*x*x*x", fit_range_low, fit_range_high);

	TF1* fvn_combinemassvnfit = new TF1(Form("fvn_combinemassvnfit_%s_%d",cfgname.Data(),ipt), "( ( [0]*([5]*([4]*TMath::Gaus(x,[1],[2]*(1.0 +[6]))/(sqrt(2*3.14159)*[2]*(1.0 +[6]))+(1-[4])*TMath::Gaus(x,[1],[3]*(1.0 +[6]))/(sqrt(2*3.14159)*[3]*(1.0 +[6])))+(1-[5])*TMath::Gaus(x,[8],[7]*(1.0 +[6]))/(sqrt(2*3.14159)*[7]*(1.0 +[6]))) ) / ( [0]*([5]*([4]*TMath::Gaus(x,[1],[2]*(1.0 +[6]))/(sqrt(2*3.14159)*[2]*(1.0 +[6]))+(1-[4])*TMath::Gaus(x,[1],[3]*(1.0 +[6]))/(sqrt(2*3.14159)*[3]*(1.0 +[6])))+(1-[5])*TMath::Gaus(x,[8],[7]*(1.0 +[6]))/(sqrt(2*3.14159)*[7]*(1.0 +[6]))) + [9] + [10]*x + [11]*x*x + [12]*x*x*x ) ) * [13] + ( 1.0 - ( ( [0]*([5]*([4]*TMath::Gaus(x,[1],[2]*(1.0 +[6]))/(sqrt(2*3.14159)*[2]*(1.0 +[6]))+(1-[4])*TMath::Gaus(x,[1],[3]*(1.0 +[6]))/(sqrt(2*3.14159)*[3]*(1.0 +[6])))+(1-[5])*TMath::Gaus(x,[8],[7]*(1.0 +[6]))/(sqrt(2*3.14159)*[7]*(1.0 +[6]))) ) / ( [0]*([5]*([4]*TMath::Gaus(x,[1],[2]*(1.0 +[6]))/(sqrt(2*3.14159)*[2]*(1.0 +[6]))+(1-[4])*TMath::Gaus(x,[1],[3]*(1.0 +[6]))/(sqrt(2*3.14159)*[3]*(1.0 +[6])))+(1-[5])*TMath::Gaus(x,[8],[7]*(1.0 +[6]))/(sqrt(2*3.14159)*[7]*(1.0 +[6]))) + [9] + [10]*x + [11]*x*x + [12]*x*x*x ) ) ) * ( [14] + [15] * x + [16] * x * x)", fit_range_low, fit_range_high);

	ROOT::Math::WrappedMultiTF1 wfmass_combinemassvnfit(*fmass_combinemassvnfit,1);
	ROOT::Math::WrappedMultiTF1 wfvn_combinemassvnfit(*fvn_combinemassvnfit,1);

	ROOT::Fit::DataOptions opt;
	ROOT::Fit::DataRange range_massfit;
	// set the data range
	range_massfit.SetRange(fit_range_low,fit_range_high);
	ROOT::Fit::BinData datamass(opt,range_massfit);
	ROOT::Fit::FillData(datamass, histo);

	ROOT::Fit::DataRange range_vnfit;
	range_vnfit.SetRange(fit_range_low,fit_range_high);
	ROOT::Fit::BinData datavn(opt,range_vnfit);
	ROOT::Fit::FillData(datavn, h_vnvsmass);

	ROOT::Fit::Chi2Function chi2_B(datamass, wfmass_combinemassvnfit);
	ROOT::Fit::Chi2Function chi2_SB(datavn, wfvn_combinemassvnfit);

	GlobalChi2_poly3bkg_floatwidth_poly2bkg globalChi2(chi2_B, chi2_SB);

	ROOT::Fit::Fitter fitter;

	const int Npar = 17;
	double par0[Npar];
	for( int ipar = 0; ipar < f->GetNpar(); ipar++ )
		par0[ipar] = f->GetParameter(ipar);
	par0[13] = 0.01;
	par0[14] = 0.10;
	par0[15] = 0.05;
	par0[16] = 0.05;

	// create before the parameter settings in order to fix or set range on them
	fitter.Config().SetParamsSettings(Npar,par0);
	// fix parameter
	fitter.Config().ParSettings(2).Fix();
	fitter.Config().ParSettings(3).Fix();
	fitter.Config().ParSettings(4).Fix();
	fitter.Config().ParSettings(5).Fix();
	fitter.Config().ParSettings(7).Fix();
	fitter.Config().ParSettings(8).Fix();
	// set limits on the third and 4-th parameter
	fitter.Config().ParSettings(1).SetLimits(1.7, 2.0);
	//fitter.Config().ParSettings(12).SetStepSize(0.005);
	//fitter.Config().UseWeightCorrection();

	fitter.Config().MinimizerOptions().SetPrintLevel(0);
	fitter.Config().SetMinimizer("Minuit2","Migrad");

	// fit FCN function directly
	// (specify optionally data size and flag to indicate that is a chi2 fit)
	//fitter.FitFCN(Npar,globalChi2,0,datamass.Size()+datavn.Size(),false);
	fitter.FitFCN(Npar,globalChi2,0,datamass.Size()+datavn.Size(),true);
	ROOT::Fit::FitResult result = fitter.Result();
	result.Print(std::cout);

	fmass_combinemassvnfit->SetFitResult( result, iparmassfit_poly3bkg_floatwidth_poly2bkg);
	fmass_combinemassvnfit->SetRange(range_massfit().first, range_massfit().second);
	fmass_combinemassvnfit->SetLineColor(kRed);
	histo->GetListOfFunctions()->Add(fmass_combinemassvnfit);

	fvn_combinemassvnfit->SetFitResult( result, iparvnfit_poly3bkg_floatwidth_poly2bkg);
	fvn_combinemassvnfit->SetRange(range_vnfit().first, range_vnfit().second);
	fvn_combinemassvnfit->SetLineColor(4.0);
	fvn_combinemassvnfit->SetLineStyle(2);
	h_vnvsmass->GetListOfFunctions()->Add(fvn_combinemassvnfit);

	h_vnvspt->SetBinContent( ipt+1, fvn_combinemassvnfit->GetParameter(13));
	h_vnvspt->SetBinError( ipt+1, fvn_combinemassvnfit->GetParError(13));

	//double x[2] = {1.73, 1.864};
	//double error[2];
	//does not work
	//result.GetConfidenceIntervals(2, 1, 1, x, error, 0.683, false);

	//h_vnvspt_bkg->SetBinContent( ipt+1, fvn_combinemassvnfit->GetParameter(13) + fvn_combinemassvnfit->GetParameter(14) * 1.864);
	//h_vnvspt_bkg->SetBinError( ipt+1, error[0]);
	h_vnvspt_bkg->SetBinContent( ipt+1, fvn_combinemassvnfit->GetParameter(14) + fvn_combinemassvnfit->GetParameter(15) * 1.864 + fvn_combinemassvnfit->GetParameter(16) * 1.864 * 1.864);
	h_vnvspt_bkg->SetBinError( ipt+1, 0. );

	TCanvas* cfg_massfit_combinemassvn = new TCanvas(Form("cfg_poly3bkg_floatwidth_poly2bkg_combinemassvnfit_massfit_combinemassvn_%s_%d_%s_%s",cfgname.Data(),ipt,vnorder.Data(),EPorSP.Data()),Form("cfg_poly3bkg_floatwidth_poly2bkg_combinemassvnfit_massfit_combinemassvn_%s_%d_%s_%s",cfgname.Data(),ipt,vnorder.Data(),EPorSP.Data()),600,600);

    gPad->SetRightMargin(0.043);
    gPad->SetLeftMargin(0.18);
//    gPad->SetTopMargin(0.1);
    gPad->SetBottomMargin(0.145);

	histo->SetXTitle("m_{#piK} (GeV/c^{2})");
	histo->SetYTitle("Entries / (5 MeV/c^{2})");
	histo->GetXaxis()->CenterTitle();
	histo->GetYaxis()->CenterTitle();
	//histo->SetAxisRange(0,histo->GetMaximum()*1.4*1.2,"Y");
	histo->GetXaxis()->SetRangeUser(fit_range_low+0.0001,fit_range_high-0.0001);
	histo->GetXaxis()->SetTitleOffset(1.3);
	histo->GetYaxis()->SetTitleOffset(1.8);
	histo->GetXaxis()->SetLabelOffset(0.007);
	histo->GetYaxis()->SetLabelOffset(0.007);
	histo->GetXaxis()->SetTitleSize(0.045);
	histo->GetYaxis()->SetTitleSize(0.045);
	histo->GetXaxis()->SetTitleFont(42);
	histo->GetYaxis()->SetTitleFont(42);
	histo->GetXaxis()->SetLabelFont(42);
	histo->GetYaxis()->SetLabelFont(42);
	histo->GetXaxis()->SetLabelSize(0.04);
	histo->GetYaxis()->SetLabelSize(0.04);
	histo->SetMarkerSize(0.8);
	histo->SetMarkerStyle(20);
	histo->SetStats(0);
	histo->Draw("e");
	
	TF1* background = new TF1(Form("background_%s_%d",cfgname.Data(),ipt),"[0]+[1]*x+[2]*x*x+[3]*x*x*x");
	background->SetParameter(0,fmass_combinemassvnfit->GetParameter(9));
	background->SetParameter(1,fmass_combinemassvnfit->GetParameter(10));
	background->SetParameter(2,fmass_combinemassvnfit->GetParameter(11));
	background->SetParameter(3,fmass_combinemassvnfit->GetParameter(12));
	background->SetLineColor(4);
	background->SetRange(fit_range_low,fit_range_high);
	background->SetLineStyle(2);

    TF1* mass = new TF1(Form("fmass_%s_%d",cfgname.Data(),ipt),"[0]*([5]*([4]*Gaus(x,[1],[2]*(1.0 +[6]))/(sqrt(2*3.14159)*[2]*(1.0 +[6]))+(1-[4])*Gaus(x,[1],[3]*(1.0 +[6]))/(sqrt(2*3.14159)*[3]*(1.0 +[6]))))");
    mass->SetParameters(f->GetParameter(0),f->GetParameter(1),f->GetParameter(2),f->GetParameter(3),f->GetParameter(4),f->GetParameter(5),f->GetParameter(6));
    mass->SetParError(0,f->GetParError(0));
    mass->SetParError(1,f->GetParError(1));
    mass->SetParError(2,f->GetParError(2));
    mass->SetParError(3,f->GetParError(3));
    mass->SetParError(4,f->GetParError(4));
    mass->SetParError(5,f->GetParError(5));
    mass->SetParError(6,f->GetParError(6));
    mass->SetFillColor(kOrange-3);
    mass->SetFillStyle(3002);
    mass->SetLineColor(kOrange-3);
    mass->SetLineWidth(3);
    mass->SetLineStyle(2);

	TF1* massSwap = new TF1(Form("fmassSwap_%s_%d",cfgname.Data(),ipt),"[0]*(1-[2])*Gaus(x,[1],[3]*(1.0 +[4]))/(sqrt(2*3.14159)*[3]*(1.0 +[4]))");
	massSwap->SetParameters(fmass_combinemassvnfit->GetParameter(0),fmass_combinemassvnfit->GetParameter(8),fmass_combinemassvnfit->GetParameter(5),fmass_combinemassvnfit->GetParameter(7),fmass_combinemassvnfit->GetParameter(6));
	massSwap->SetParError(0,fmass_combinemassvnfit->GetParError(0));
	massSwap->SetParError(1,fmass_combinemassvnfit->GetParError(8));
	massSwap->SetParError(2,fmass_combinemassvnfit->GetParError(5));
	massSwap->SetParError(3,fmass_combinemassvnfit->GetParError(7));
	massSwap->SetParError(4,fmass_combinemassvnfit->GetParError(6));
	massSwap->SetFillColor(kGreen+4);
	massSwap->SetFillStyle(3005);
	massSwap->SetLineColor(kGreen+4);
	massSwap->SetLineWidth(3);
	massSwap->SetLineStyle(1);

	background->Draw("same");   
	mass->SetRange(fit_range_low,fit_range_high);	
	mass->Draw("same");
	massSwap->SetRange(fit_range_low,fit_range_high);
	massSwap->Draw("same");

	Double_t yield = mass->Integral(fit_range_low,fit_range_high)/histomassbinsize;
	Double_t yieldErr = mass->Integral(fit_range_low,fit_range_high)/histomassbinsize*mass->GetParError(0)/mass->GetParameter(0);

	TLegend* leg = new TLegend(0.65,0.58,0.82,0.88,NULL,"brNDC");
	leg->SetBorderSize(0);
	leg->SetTextSize(0.04);
	leg->SetTextFont(42);
	leg->SetFillStyle(0);
	leg->AddEntry(histo,"Data","pl");
	leg->AddEntry(fmass_combinemassvnfit,"Fit","l");
	leg->AddEntry(mass,"D^{0}+#bar{D^{#lower[0.2]{0}}} Signal","f");
	leg->AddEntry(massSwap,"K-#pi swapped","f");
	leg->AddEntry(background,"Combinatorial","l");
	leg->Draw("same");

	TLatex Tl;
	Tl.SetNDC();
	Tl.SetTextAlign(12);
	Tl.SetTextSize(0.05);
	Tl.SetTextFont(42);
	Tl.DrawLatex(0.18,0.965, "#font[61]{CMS}");
	if( isPbPb )
		Tl.DrawLatex(0.61,0.965, "#scale[0.8]{PbPb #sqrt{s_{NN}} = 5.02 TeV}");
	else
		Tl.DrawLatex(0.65,0.965, "#scale[0.8]{pp #sqrt{s_{NN}} = 5.02 TeV}");

	TLatex* tex;

	if( isPbPb )
	{
		tex = new TLatex(0.22,0.83,"|y| < 1.0");
		tex->SetNDC();
		tex->SetTextFont(42);
		tex->SetTextSize(0.04);
		tex->SetLineWidth(2);
		tex->Draw();

		tex = new TLatex(0.22,0.78,Form("Cent. %d-%d%%", centlow, centhigh));
		tex->SetNDC();
		tex->SetTextFont(42);
		tex->SetTextSize(0.04);
		tex->SetLineWidth(2);
		tex->Draw();

		tex = new TLatex(0.22,0.73,Form("%.1f < p_{T} < %.1f GeV/c",ptmin,ptmax));
		tex->SetNDC();
		tex->SetTextFont(42);
		tex->SetTextSize(0.04);
		tex->SetLineWidth(2);
		tex->Draw();

		tex = new TLatex(0.22,0.68,Form("N_{sig}: %d #pm %d",int(yield),int(yieldErr)));
		tex->SetNDC();
		tex->SetTextFont(42);
		tex->SetTextSize(0.04);
		tex->SetLineWidth(2);
		tex->Draw();
	}
	else
	{
		tex = new TLatex(0.22,0.83,"|y| < 1.0");
		tex->SetNDC();
		tex->SetTextFont(42);
		tex->SetTextSize(0.04);
		tex->SetLineWidth(2);
		tex->Draw();

		tex = new TLatex(0.22,0.78,Form("%.1f < p_{T} < %.1f GeV/c",ptmin,ptmax));
		tex->SetNDC();
		tex->SetTextFont(42);
		tex->SetTextSize(0.04);
		tex->SetLineWidth(2);
		tex->Draw();

		tex = new TLatex(0.22,0.73,Form("N_{sig}: %d #pm %d",int(yield),int(yieldErr)));
		tex->SetNDC();
		tex->SetTextFont(42);
		tex->SetTextSize(0.04);
		tex->SetLineWidth(2);
		tex->Draw();
	}

	histo_copy_nofitfun->Draw("esame");

	if( get_sig_bkg_ratio )
	{
		for(int ibin = 0; ibin < histo->GetNbinsX(); ibin++)
		{
			double foreground = 0.;
			double signal = 0.;
			double ratio = 0.;
			double ratioError = 999.;

			double massbinleftedge = massmin + histomassbinsize * ibin;
			double massbinrightedge = massmin + histomassbinsize * (ibin+1);

			if( massbinleftedge > (fit_range_low - 0.0002) && massbinrightedge < (fit_range_high + 0.0002) )
			{
				foreground = f->Integral(massbinleftedge, massbinrightedge)/histomassbinsize;
				//foregroundErr = f->IntegralError(massbinleftedge, massbinrightedge)/histomassbinsize;
				//foreground =  histo->Integral(ibin+1, ibin+1);
				signal = mass->Integral(massbinleftedge, massbinrightedge)/histomassbinsize + massSwap->Integral(massbinleftedge, massbinrightedge)/histomassbinsize;
				//signal = mass->Integral(massbinleftedge, massbinrightedge)/histomassbinsize;
				//signal = foreground - background->Integral(massbinleftedge, massbinrightedge)/histomassbinsize;
				//signalErr = signal * yieldErr/yield;
				if( foreground > 0 )
				{
					ratio = signal/foreground;
					ratioError = TMath::Sqrt( foreground * ratio * (1.0 - ratio) ) / foreground;
				}
				else
				{
					ratio = 0.5;
					ratioError = 0.5;
				}
			}
			else
			{
				ratio = 0.0;
				ratioError = 1.0;
			}

			Ratio_signal_foreground->SetBinContent(ibin+1, ratio);
			Ratio_signal_foreground->SetBinError(ibin+1, ratioError);
		}

		TF1* Func_Ratio_signal_foreground = new TF1(Form("Func_Ratio_signal_foreground_%s_%d",cfgname.Data(),ipt),"([0]*([5]*([4]*TMath::Gaus(x,[1],[2]*(1.0 +[6]))/(sqrt(2*3.14159)*[2]*(1.0 +[6]))+(1-[4])*TMath::Gaus(x,[1],[3]*(1.0 +[6]))/(sqrt(2*3.14159)*[3]*(1.0 +[6])))+(1-[5])*TMath::Gaus(x,[8],[7]*(1.0 +[6]))/(sqrt(2*3.14159)*[7]*(1.0 +[6]))))/([0]*([5]*([4]*TMath::Gaus(x,[1],[2]*(1.0 +[6]))/(sqrt(2*3.14159)*[2]*(1.0 +[6]))+(1-[4])*TMath::Gaus(x,[1],[3]*(1.0 +[6]))/(sqrt(2*3.14159)*[3]*(1.0 +[6])))+(1-[5])*TMath::Gaus(x,[8],[7]*(1.0 +[6]))/(sqrt(2*3.14159)*[7]*(1.0 +[6]))) + [9] + [10]*x + [11]*x*x + [12]*x*x*x)", generalfitrange_masslow, generalfitrange_masshigh);
        for( int ipar = 0; ipar < 13; ipar++ )
        {
            Func_Ratio_signal_foreground->SetParameter( ipar, f->GetParameter(ipar));
            Func_Ratio_signal_foreground->SetParError(ipar, f->GetParError(ipar));
        }
		Func_Ratio_signal_foreground->SetLineColor(2.0);
		Ratio_signal_foreground->GetListOfFunctions()->Add(Func_Ratio_signal_foreground);
	}

	if(isPbPb)
	{
		cfg_massfit_combinemassvn->SaveAs(Form("Plots_vn/combinemassvnfit/DMass_combinemassvnfit_isPbPb%d_%s_cent%dto%d_%d_%s_%s_poly3bkg_floatwidth_poly2bkg_combinemassvnfit.pdf", isPbPb, cfgname.Data(), centlow, centhigh, ipt, vnorder.Data(),EPorSP.Data()));
		cfg_massfit_combinemassvn->SaveAs(Form("Plots_vn/combinemassvnfit/DMass_combinemassvnfit_isPbPb%d_%s_cent%dto%d_%d_%s_%s_poly3bkg_floatwidth_poly2bkg_combinemassvnfit.png", isPbPb, cfgname.Data(), centlow, centhigh, ipt, vnorder.Data(),EPorSP.Data()));
	}

	TCanvas* cfg_vnfit_combinemassvn = new TCanvas(Form("cfg_poly3bkg_floatwidth_poly2bkg_combinemassvnfit_vnfit_combinemassvn_%s_%d_%s_%s",cfgname.Data(),ipt,vnorder.Data(),EPorSP.Data()),Form("cfg_poly3bkg_floatwidth_poly2bkg_combinemassvnfit_vnfit_combinemassvn_%s_%d_%s_%s",cfgname.Data(),ipt,vnorder.Data(),EPorSP.Data()),600,600);

	h_vnvsmass->GetYaxis()->SetRangeUser(-0.2, 0.6);
	if( vnorder == "v2") h_vnvsmass->GetYaxis()->SetTitle("v_{2}");
	if( vnorder == "v3") h_vnvsmass->GetYaxis()->SetTitle("v_{3}");
	h_vnvsmass->GetXaxis()->SetTitle("m_{#piK} (GeV/c^{2})");
	h_vnvsmass->GetXaxis()->SetTitleSize(0.05);
	h_vnvsmass->GetYaxis()->SetTitleSize(0.05);

	h_vnvsmass->SetMarkerColor(4.0);
	h_vnvsmass->SetLineColor(4.0);
	h_vnvsmass->SetMarkerStyle(21);
	h_vnvsmass->SetMarkerSize(1.3);
	h_vnvsmass->Draw();

    TLatex Tl2; 
    Tl2.SetNDC();
    Tl2.SetTextAlign(12);
    Tl2.SetTextSize(0.05);
    Tl2.SetTextFont(42);
    Tl2.DrawLatex(0.125,0.965, "#font[61]{CMS}");
    Tl2.DrawLatex(0.57,0.965, "#scale[0.8]{PbPb #sqrt{s_{NN}} = 5.02 TeV}");

    tex = new TLatex(0.18,0.83,"|y| < 1.0");
    tex->SetNDC();
    tex->SetTextFont(42);
    tex->SetTextSize(0.04);
    tex->SetLineWidth(2);
    tex->Draw();

    tex = new TLatex(0.18,0.78,Form("Cent. %d-%d%%", centlow, centhigh));
    tex->SetNDC();
    tex->SetTextFont(42);
    tex->SetTextSize(0.04);
    tex->SetLineWidth(2);
    tex->Draw();

    tex = new TLatex(0.18,0.73,Form("%.1f < p_{T} < %.1f GeV/c",ptmin,ptmax));
    tex->SetNDC();
    tex->SetTextFont(42);
    tex->SetTextSize(0.04);
    tex->SetLineWidth(2);
    tex->Draw();

    if( vnorder == "v2" ) 
        tex = new TLatex(0.55,0.83,Form("v_{2}^{sig} = %.3f #pm %.3f",fvn_combinemassvnfit->GetParameter(13), fvn_combinemassvnfit->GetParError(13)));
    else if( vnorder == "v3" )
        tex = new TLatex(0.55,0.83,Form("v_{3}^{sig} = %.3f #pm %.3f",fvn_combinemassvnfit->GetParameter(13), fvn_combinemassvnfit->GetParError(13)));

    tex->SetNDC();
    tex->SetTextFont(42);
    tex->SetTextSize(0.04);
    tex->SetLineWidth(2);
    tex->Draw();
	
	if(isPbPb)
	{
		cfg_vnfit_combinemassvn->SaveAs(Form("Plots_vn/combinemassvnfit/cfg_vnfit_combinemassvn_%s_cent%dto%d_%d_%s_%s_poly3bkg_floatwidth_poly2bkg_combinemassvnfit.pdf",cfgname.Data(),centlow,centhigh,ipt,vnorder.Data(),EPorSP.Data()));
		cfg_vnfit_combinemassvn->SaveAs(Form("Plots_vn/combinemassvnfit/cfg_vnfit_combinemassvn_%s_cent%dto%d_%d_%s_%s_poly3bkg_floatwidth_poly2bkg_combinemassvnfit.png",cfgname.Data(),centlow,centhigh,ipt,vnorder.Data(),EPorSP.Data()));
	}

	return mass;
}
예제 #23
0
void plot(){

  typedef std::map<double, ROOT::Math::XYZTVector , User::moreStruct>::iterator CImap;

  TFile* file   = new TFile("./vbfTree.root","READ");

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

  TPad* pad1 = new TPad("pad1","",0.05,0.27,0.96,0.97);
  TPad* pad2 = new TPad("pad2","",0.05,0.02,0.96,0.26);
  pad1->SetFillColor(0);
  pad2->SetFillColor(0);
  pad1->Draw();
  pad2->Draw();

  pad1->cd();
  pad1->SetLogy(1);

  TLegend* leg = new TLegend(0.55,0.45,0.85,0.75,NULL,"brNDC");
  leg->SetFillStyle(0);
  leg->SetBorderSize(0);
  leg->SetFillColor(10);
  leg->SetTextSize(0.04);
  leg->SetHeader("#splitline{POWHEG+PYTHIA qqH(115)#rightarrow#tau#tau}{jets matched to tag partons}");

  TTree* currentTree = (TTree*)file->Get("vbfJetAnalyzer/tree");
  int nEntries = currentTree->GetEntries() ;

  TH1F* h_TagMult = new TH1F("h_TagMult"," ; multiplicity ; a.u. ", 6,-0.5,5.5);

  TH1F* h_ptTag1  = new TH1F("h_ptTag1","; p_{T} (GeV/c); a.u. ", 60,0,300);
  TH1F* h_ptTag2  = new TH1F("h_ptTag2","; p_{T} (GeV/c); a.u. ", 60,0,300);
  TH1F* h_ptTag3  = new TH1F("h_ptTag3","; p_{T} (GeV/c); a.u. ", 60,0,300);

  std::vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > >* jets;
  std::vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > >* tagjets;
  currentTree->SetBranchAddress("jetsP4",   &jets);
  currentTree->SetBranchAddress("tagjetsP4",&tagjets);


  for (int n = 0; n < nEntries ; n++) {

    currentTree->GetEntry(n);

    std::map<double, ROOT::Math::XYZTVector , User::moreStruct> sortedTagJets;
    for(unsigned int i = 0; i < tagjets->size(); i++){
      sortedTagJets.insert( make_pair( (*tagjets)[i].Et(),(*tagjets)[i] )  ) ;
    }
    std::map<double, ROOT::Math::XYZTVector , User::moreStruct> sortedJets;
    for(unsigned int i = 0; i < jets->size(); i++){
      sortedJets.insert( make_pair( (*jets)[i].Et(),(*jets)[i] )  ) ;
    }

    h_TagMult->Fill(tagjets->size());

    int counter=0;
    for(CImap it = sortedTagJets.begin(); 
	it!=sortedTagJets.end(); it++){
      if( counter==0 ) h_ptTag1->Fill( (it->second).Et() );
      if( counter==1 ) h_ptTag2->Fill( (it->second).Et() );
      if( counter==2 ) h_ptTag3->Fill( (it->second).Et() );
      counter++;
    }
   
  }

  h_ptTag1->SetLineColor(kRed);
  h_ptTag1->SetLineStyle(kSolid);
  h_ptTag2->SetLineColor(kBlue);
  h_ptTag2->SetLineStyle(kDashed);
  h_ptTag2->SetLineColor(kMagenta);
  h_ptTag2->SetLineStyle(kDotted);

  cout << "1st jet " << h_ptTag1->GetEntries() << endl;
  cout << "2nd jet " << h_ptTag2->GetEntries() << endl;
  cout << "3rd jet " << h_ptTag3->GetEntries() << endl;

  h_ptTag3->Draw("HISTS");
  h_ptTag1->Draw("HISTSAME");
  h_ptTag2->Draw("HISTSAME");

  leg->AddEntry(h_ptTag1,"1st largest-p_{T} jet","L");
  leg->AddEntry(h_ptTag2,"2nd largest-p_{T} jet","L");
  leg->AddEntry(h_ptTag3,"3rd largest-p_{T} jet","L");

  leg->Draw();

  pad2->cd();
  TH1F* hLow = (TH1F*)h_TagMult->Clone();
  hLow->SetLabelSize(0.12,"X");
  hLow->SetLabelSize(0.10,"Y");
  hLow->SetTitleSize(0.12,"Y");
  hLow->SetTitleSize(0.12,"X");
  hLow->SetTitleOffset(0.36,"Y");
  hLow->SetTitleOffset(0.36,"X");
  hLow->Draw("HIST");

}
예제 #24
0
void drawQual(TFile * inf, TCanvas * can, Int_t ic, Float_t ymin, Float_t ymax, Int_t doLog, Float_t xmin=0, Float_t xmax=0, Int_t rebinFactor=2)
{
	cout << "ic: " << ic << " ymin: " << ymin << " ymax " << ymax << " xmin " << xmin	<< " xmax " << xmax << endl;
	TH3F * hQual3D_precut_mc = (TH3F*)inf->FindObjectAny(Form("hTrkQual%dPreCut3D_mc80_c0to36",ic));
	TH3F * hQual3D_precut_data = (TH3F*)inf->FindObjectAny(Form("hTrkQual%dPreCut3D_dataj35_c0to36",ic));
	cout << hQual3D_precut_mc->GetName() << ": " << hQual3D_precut_mc << endl;
	cout << hQual3D_precut_data->GetName() << ": " << hQual3D_precut_data << endl;
	TH1D * hPtBin = (TH1D*)hQual3D_precut_data->Project3D("y");
	TH1D * hQual_precut_mc[10][8], * hQual_precut_data[10][8];
	Int_t colors[10] = {kBlack, kGray+2, kBlue+2,kCyan+2,kGreen+2,kYellow+2,kOrange+2,kRed};
	
	for (Int_t p=0; p<=9; ++p){
		for (Int_t c=0; c<=7; ++c) {
			Int_t ptBin=p;
			Int_t cBin=c;
			hQual3D_precut_mc->GetYaxis()->SetRange(ptBin,ptBin);
			//hQual3D_precut_mc->GetZaxis()->SetRange(cBin,cBin+5);
			hQual3D_precut_data->GetYaxis()->SetRange(ptBin,ptBin);
			//hQual3D_precut_data->GetZaxis()->SetRange(cBin,cBin+5);

			hQual_precut_mc[p][c] = (TH1D*)hQual3D_precut_mc->Project3D("x");
			hQual_precut_mc[p][c]->SetName(Form("%s_p%d_c%d",hQual3D_precut_mc->GetName(),ptBin,cBin));
			hQual_precut_data[p][c] = (TH1D*)hQual3D_precut_data->Project3D("x");
			hQual_precut_data[p][c]->SetName(Form("%s_p%d_c%d",hQual3D_precut_data->GetName(),ptBin,cBin));
			//cout << Form("Project data %d: %.1f-%.1f GeV/c: ",ptBin, hPtBin->GetBinLowEdge(ptBin),hPtBin->GetBinLowEdge(ptBin+1)) << hQual_precut_data[p][c]->GetEntries() << endl;
			//rebin
			hQual_precut_data[p][c]->Rebin(rebinFactor);
			hQual_precut_mc[p][c]->Rebin(rebinFactor);
			// styles
			hQual_precut_mc[p][c]->SetMarkerColor(kRed-9);
			hQual_precut_mc[p][c]->SetLineColor(kRed-9);
			hQual_precut_mc[p][c]->SetMarkerStyle(kOpenSquare);
			hQual_precut_mc[p][c]->SetFillStyle(3001);
			hQual_precut_mc[p][c]->SetFillColor(kRed-9);
			hQual_precut_data[p][c]->SetMarkerColor(colors[c]);
			hQual_precut_mc[p][c]->Scale(1./hQual_precut_mc[p][c]->GetEntries()/rebinFactor);
			hQual_precut_data[p][c]->Scale(1./hQual_precut_data[p][c]->GetEntries()/rebinFactor);
			// set title
			fixedFontHist(hQual_precut_mc[p][c]);
			fixedFontHist(hQual_precut_data[p][c]);
			hQual_precut_mc[p][c]->SetYTitle("unit normalization");
			hQual_precut_data[p][c]->SetYTitle("unit normalization");
			// set axis
			if(xmin!=xmax) {
				hQual_precut_mc[p][c]->SetAxisRange(xmin,xmax,"X");
				hQual_precut_data[p][c]->SetAxisRange(xmin,xmax,"X");
			}
			hQual_precut_mc[p][c]->SetAxisRange(ymin,ymax,"Y");
			hQual_precut_data[p][c]->SetAxisRange(ymin,ymax,"Y");
			hQual_precut_mc[p][c]->GetXaxis()->SetNdivisions(508);
			hQual_precut_data[p][c]->GetXaxis()->SetNdivisions(508);
		}
	}
	
	//can->Divide(5,1);
	Int_t centBin=0;
	Int_t ipad=1;
	for (Int_t p=3; p<=7; ++p) {
		can->cd(ipad);
		if (doLog==1) gPad->SetLogy();
		Int_t ptBin=p;
		cout << "ptBin: " << ptBin << endl;
		handsomeTH1(hQual_precut_data[ptBin][centBin]);
		hQual_precut_data[ptBin][centBin]->Draw("E");
		hQual_precut_mc[ptBin][centBin]->Draw("histsame");
		hQual_precut_data[ptBin][centBin]->Draw("Esame");
		cout << Form("%.1f-%.1f GeV/c: ",hPtBin->GetBinLowEdge(ptBin),hPtBin->GetBinLowEdge(ptBin+1)) << hQual_precut_data[ptBin][centBin]->GetEntries() << endl;
		++ipad;
	}
	can->cd(1);
  //TLegend *legdata = new TLegend(0.19,0.71,0.49,0.90);
  TLegend *legdata = new TLegend(0.26,0.72,0.56,0.92);
  legdata->SetFillStyle(0);
  legdata->SetBorderSize(0);
  legdata->SetTextSize(0.035);
	legdata->AddEntry(hQual_precut_data[0][0],"0-90%","");
  legdata->AddEntry(hQual_precut_data[0][0],"Data Jet35U","p");
  legdata->AddEntry(hQual_precut_mc[0][0],"MC, #hat{p}_{T} 80 GeV/c","p");
	legdata->Draw();
	
	ipad=1;
	for (Int_t p=3; p<=7; ++p) {
		can->cd(ipad);
		Int_t ptBin=p;
		cout << "ptBin leg: " << ptBin << endl;
		Float_t px=0.4,py=0.88;
		if (ipad==1) px=0.63;
		drawText(Form("%.1f - %.1f GeV/c",hPtBin->GetBinLowEdge(ptBin),hPtBin->GetBinLowEdge(ptBin+1)),px,py);
		++ipad;
	}
}
예제 #25
0
void DrawRatioAndSave( const char *nameFile,  TGraphErrors* data, TGraphErrors* mc, int xmin, int xmax, const char *XTitle, const char *YTitle){
  char * nameSaved ;
  nameSaved = new char[strlen(nameFile) +20] ;
  //copio stringa 1 in stringa nuova  
  strcpy(nameSaved, nameFile);
  
  gStyle -> SetOptStat(kFALSE);
  TCanvas* c1 = new TCanvas("c1", "c1", 800, 800);
  c1->cd();
  
  // Data / MC comparison
  TPad* pad_hi = new TPad("pad_hi", "", 0., 0.3, 1., 1.);
  pad_hi->Draw();
  // pad_hi->SetLogx();
  pad_hi->SetLeftMargin(0.15);
  pad_hi->SetBottomMargin(0.015);
  
  // Data / MC ratio
  TPad* pad_lo = new TPad("pad_lo", "", 0., 0.05, 1, 0.305);
  pad_lo->Draw();
  //pad_lo->SetLogx();
  pad_lo->SetLeftMargin(0.15);
  pad_lo->SetTopMargin(1.);
  pad_lo->SetBottomMargin(0.3);
  
  TGraphErrors* gr_resp_ratio = 0;
  
  TH2* h2_axes_lo_resp = NULL;
  
  TLine* line_one = new TLine(xmin, 1., xmax, 1.);
  TLine* line_plus_resp = new TLine(xmin, 1.05, xmax, 1.05);
  TLine* line_minus_resp = new TLine(xmin, 0.95, xmax, 0.95);
  
  pad_lo->cd();
  
  //  h2_axes_lo_resp = new TH2D("axes_lo_resp", "", 10, 0, 5, 10, 0.86, 1.14);
  h2_axes_lo_resp = new TH2D("axes_lo_resp", "", 10, xmin, xmax, 10, 0.5, 1.2);
  
  h2_axes_lo_resp->SetXTitle(XTitle);     //"|#eta (jet)|");
  h2_axes_lo_resp->SetYTitle("Data / MC");
  h2_axes_lo_resp->GetXaxis()->SetTitleOffset(1.2);
  h2_axes_lo_resp->GetYaxis()->SetTitleOffset(0.55);
  h2_axes_lo_resp->GetXaxis()->SetTickLength(0.06);
  h2_axes_lo_resp->GetXaxis()->SetMoreLogLabels();
  h2_axes_lo_resp->GetXaxis()->SetNoExponent();
  //h2_axes_lo_resp->GetXaxis()->SetLabelSize(0.);
  h2_axes_lo_resp->GetXaxis()->SetLabelSize(0.085);
  h2_axes_lo_resp->GetYaxis()->SetLabelSize(0.07);
  h2_axes_lo_resp->GetXaxis()->SetTitleSize(0.09);
  h2_axes_lo_resp->GetYaxis()->SetTitleSize(0.08);
  h2_axes_lo_resp->GetYaxis()->SetNdivisions(7, kTRUE);
  h2_axes_lo_resp->Draw("");
  
  line_one->Draw("same");
   
  //line_plus_resp->SetLineColor(46);
  line_plus_resp->SetLineWidth(2);
  line_plus_resp->SetLineStyle(2);  
  //line_minus_resp->SetLineColor(46);
  line_minus_resp->SetLineWidth(2);
  line_minus_resp->SetLineStyle(2);
  
  //this->
  gr_resp_ratio = get_graphRatio(data, mc);
  gr_resp_ratio->SetName("response_ratio");
  gr_resp_ratio->SetMarkerStyle(20);
  gr_resp_ratio->SetMarkerSize(1.5);
  gr_resp_ratio->SetMarkerColor(kBlue - 6);  

  // TF1* ratioFit = new TF1("ratioFit", "[0]", 0, 5);
  //ratioFit->SetParameter(0, 0.);
  //ratioFit->SetLineColor(46);
  //ratioFit->SetLineWidth(2);
  // gr_resp_ratio->Fit(ratioFit, "RQ");
  //std::cout << "-> ChiSquare: " << constline->GetChisquare() << "   NDF: " << constline->GetNDF() << std::endl;
  
  //double fitValue = ratioFit->GetParameter(0);
  //double fitError = ratioFit->GetParError(0);
  
  //  TH1D* errors = new TH1D("errors", "errors", 100, 0, 5);
  //(TVirtualFitter::GetFitter())->GetConfidenceIntervals(errors, 0.68);
  //errors->SetStats(false);
  //errors->SetFillColor(LIGHT_RED);
  //errors->SetLineColor(46);

  //  TPaveText* label = new TPaveText(0.55, 0.77, 0.88, 0.83, "brNDC");
  //fitlabel->SetTextSize(0.08);
  //fitlabel->SetFillColor(0);
  // TString fitLabelText = TString::Format("Fit: %.3f #pm %.3f", fitValue, fitError);
  //fitlabel->AddText(fitLabelText);
  //  fitlabel->Draw("same");
  
  line_plus_resp->Draw("same");
  line_minus_resp->Draw("same");
  
  //  errors->Draw("e3 same");
  //ratioFit->Draw("same");
  
  gr_resp_ratio->Draw("Psame");
  
  gPad->RedrawAxis();
  
  pad_hi->cd();
  
  TH2D* h2_axes = new TH2D("axes_again", "", 10, xmin, xmax, 10, 0.4, 1.25);
  h2_axes->SetYTitle("Jet p_{T} response");
  //h2_axes->SetYTitle("< p_{T}^{jet} / p_{T}^{#gamma} >");
  h2_axes->GetXaxis()->SetTitleOffset(1.1);
  h2_axes->GetYaxis()->SetTitleOffset(1.2);
  h2_axes->GetYaxis()->SetTitleSize(0.045);
  //h2_axes->GetXaxis()->SetMoreLogLabels();
  //h2_axes->GetXaxis()->SetNoExponent();


  h2_axes->Draw();
  
  //  TPaveText* label = new TPaveText(0.55, 0.77, 0.88, 0.83, "brNDC");
  //  label->SetTextSize(0.08);
  //  label->SetFillColor(0);
  //  TString fitLabelText = TString::Format("|#eta|< 1.3");
  //label->AddText("|#eta|< 1.3");
  //label->Draw("same");


  //  Float_t labelTextSize = 0.035;
  //  TPaveText* label_algo = get_labelAlgo(2);

  TLegend* legend = new TLegend(0.85, 0.85, 0.75, 0.75);
  legend->SetTextFont(42);
  legend->SetBorderSize(0);
  legend->SetFillColor(kWhite);
  legend->SetFillStyle(0);
  legend->SetTextSize(0.036);
  //  legend->SetHeader("3.0 <|#eta|< 5.0");
  legend->AddEntry(data, "Data", "P");
  legend->AddEntry(mc, "MC (#gamma+Jet)", "P");
 
  legend->Draw("same");

  mc->SetMarkerStyle(24);
  mc->SetMarkerSize(1.5);
  mc->SetMarkerColor(kBlue - 6);
  mc->SetLineColor(kBlue - 6);
  mc->Draw("Psame");

  data->SetMarkerStyle(20);
  data->SetMarkerSize(1.5);
  data->SetMarkerColor(kBlue - 6);
  data->Draw("Psame");
   
  gPad->RedrawAxis();

  c1->SaveAs(nameSaved);
  c1->Destructor();
}
예제 #26
0
void fit_3to2(){

  gStyle -> SetStripDecimals(kFALSE);
  gStyle -> SetPadTickX(1);
  gStyle -> SetPadTickY(1);
  gStyle -> SetOptTitle(0);
  gStyle -> SetOptStat(0);
  gStyle->SetOptFit(11111);
  float y1=-5 , y2=10;
  float x1=1200.,    x2=5200.;
  Double_t t1=0.2,t2=0.8;
  Double_t t3=0.2, t4=0.72;


   TFile *data   = new TFile("/Users/asifsaddique/CMS_BH/QCD_13TeV/output_qcd/QCD_madgraph.root", "READ");
   TH1F *st_ref  = (TH1F*)gDirectory -> Get("ST/ST_2jet_exc");
   TH1F *st_inp  = (TH1F*)gDirectory -> Get("ST/ST_3jet_exc");

   TH1F* st_32jet_exc = new TH1F("st_32jet_exc","",80,0,8000);
   st_32jet_exc -> Divide(st_inp,st_ref);
   float sf = st_ref->Integral(0,4000)/st_inp->Integral(0,4000);
   st_32jet_exc -> Scale(sf); 
   TF1 *f1 = new TF1("f1","pol1",1200,4200);

   TCanvas *c1 = new TCanvas("c1","c1",800,600);
   st_32jet_exc -> Fit("f1","R");
   st_32jet_exc -> GetYaxis()->SetTitle("Entries / 100 GeV");
   st_32jet_exc -> GetXaxis()->SetTitle("S_{T} [GeV]");
   st_32jet_exc -> GetXaxis()->SetRangeUser(x1,x2);
   st_32jet_exc -> GetYaxis()->SetRangeUser(y1,y2);
   st_32jet_exc -> SetMarkerStyle(21);
   st_32jet_exc -> SetMarkerSize(0.8);
   st_32jet_exc -> SetMarkerColor(1);
   st_32jet_exc -> SetLineColor(1);
   st_32jet_exc -> Draw("E1");
  
   float tsize=0.04;
   tex = new TLatex(t1,t2,"#sqrt[]{s} = 13 TeV, #intLdt = 1000 pb^{-1}");
   tex->SetNDC();
   tex->SetTextFont(42);
   tex->SetTextSize(tsize);
   tex->Draw();
   
   TLatex *   tex = new TLatex(t3,t4,"Jets, E_{T} > 50 GeV, |#eta| < 2.4");
   tex->SetNDC();
   tex->SetTextFont(42);
   tex->SetTextSize(tsize);
   tex->SetLineWidth(2);
   tex->Draw();
   
   TLegend *leg = new TLegend(0.2,0.6,0.6,0.6);
   leg->AddEntry( st_32jet_exc, "N = 3 / N=2", "lp");
   leg->SetTextFont(42);  leg->SetTextSize(tsize);
   leg->SetLineColor(1);  leg->SetBorderSize(0);
   leg->SetBorderSize(0); leg->SetLineStyle(4);
   leg->SetLineWidth(1);  leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   leg->Draw("");
  
   c1->SaveAs("/Users/asifsaddique/CMS_BH/QCD_13TeV/Macros/bh_plots/fitratio/N3to2_fit.eps");

}
예제 #27
0
Double_t Fit_purity(TH1F * const inclusive,Int_t ipt,Float_t E_mean_err,Float_t E_sigma_err,TF1 *total_3,TF1 * g1,TF1 *g2,TF1 *g3, TF1 *g4,Int_t Sigma_flag,Int_t Draw_flag)
{
  TH1F *Inclusive= (TH1F *)  inclusive->Clone("Inclusive");
  TCanvas * c4=new TCanvas("c4","",1200,1000);
  gPad->SetLogy();
  total_3->SetParNames("#pi C", "#pi #mu", "#pi #sigma", "proton C", "proton #mu", "proton #sigma","e C","e #mu","e sigma");  
   total_3->SetLineColor(kBlue);

   g1->SetLineColor(3);
   g2->SetLineColor(6);
   g3->SetLineColor(7);
   
   g4->SetLineColor(2);
   
   g1->SetLineStyle(7);
   g2->SetLineStyle(7);
   g3->SetLineStyle(7);
   
  
  
      Inclusive->SetTitle(mh1_pT_Title[ipt]);
      Inclusive->GetXaxis()->SetTitle("nSigmaE");
      Inclusive->GetYaxis()->SetTitle("Counts");


      total_3->SetParameter(1,pi_mean_tof->GetBinContent(ipt+1));
      total_3->SetParLimits(1,pi_mean_tof->GetBinContent(ipt+1)-0.2,pi_mean_tof->GetBinContent(ipt+1)+0.2);
      //pi sigma
      total_3->SetParameter(2,pi_sigma_tof->GetBinContent(ipt+1));
      total_3->SetParLimits(2,pi_sigma_tof->GetBinContent(ipt+1)-0.1,pi_sigma_tof->GetBinContent(ipt+1)+0.1);
      //proton mean proton + kaon
      total_3->SetParameter(4,proton_mean_tof->GetBinContent(ipt+1));
      total_3->SetParLimits(4,proton_mean_tof->GetBinContent(ipt+1)-1,proton_mean_tof->GetBinContent(ipt+1)+1);
       //proton sigma     
      total_3->SetParameter(5,proton_sigma_tof->GetBinContent(ipt+1));
      total_3->SetParLimits(5,proton_sigma_tof->GetBinContent(ipt+1)-0.2,proton_sigma_tof->GetBinContent(ipt+1)+0.2);
      
      //electron mean
      total_3->SetParameter(7,electron_Mean->GetBinContent(ipt+1));
      total_3->SetParLimits(7,electron_Mean->GetBinContent(ipt+1)-Sigma_flag*electron_Mean->GetBinError(ipt+1),electron_Mean->GetBinContent(ipt+1)+Sigma_flag*electron_Mean->GetBinError(ipt+1));
      //electron sigma
      total_3->SetParameter(8,electron_Sigma->GetBinContent(ipt+1));
      total_3->SetParLimits(8,electron_Sigma->GetBinContent(ipt+1)-Sigma_flag*electron_Sigma->GetBinError(ipt+1),electron_Sigma->GetBinContent(ipt+1)+Sigma_flag*electron_Sigma->GetBinError(ipt+1));

	  
	
  
  if(Draw_flag==0)
    { 
      Inclusive->Fit(total_3,"R0","",-10,4);
    }  
  else
    Inclusive->Fit(total_3,"R","same",-10,4);
  
      g1->SetParameter(0,total_3->GetParameter(0));
      g1->SetParameter(1,total_3->GetParameter(1));
      g1->SetParameter(2,total_3->GetParameter(2));
      
      g2->SetParameter(0,total_3->GetParameter(3));
      g2->SetParameter(1,total_3->GetParameter(4));
      g2->SetParameter(2,total_3->GetParameter(5));
      
      g4->SetParameter(0,total_3->GetParameter(6));
      g4->SetParameter(1,total_3->GetParameter(7));
      g4->SetParameter(2,total_3->GetParameter(8));

      // g4->SetParameter(0,total_3->GetParameter(9));
      // g4->SetParameter(1,total_3->GetParameter(10));
      // g4->SetParameter(2,total_3->GetParameter(11));
    
      if(Draw_flag!=0){
	TLegend *legend = new TLegend(0.15,0.6,0.35,0.8);
	legend->AddEntry(g1,"#pi ","lp");
	legend->AddEntry(g2,"p+k ","lp");
	//legend->AddEntry(g3,"kaon","lp");
	legend->AddEntry(g4,"e","lp");
	
	legend->SetBorderSize(0);
    legend->SetFillStyle(0);
    legend->SetTextSize(0.055);
    legend ->SetTextFont(62);       
    legend->Draw("same");
    
    g1->Draw("same");
    g2->Draw("same");
    g3->Draw("same");
    g4->Draw("same");
    
    sprintf(buf,"purity_fit_%ipt_%i_sigma_constrain.pdf",ipt,Sigma_flag);
    c4->SaveAs(buf);
        
  }
  return g4->Integral(-1,3)/total_3->Integral(-1,3);

}
예제 #28
0
TCanvas *drawOneVariable(TTree *signalTree, TTree *backgroundTree1, TTree *backgroundTree2,TTree *backgroundTree3,
			 TCut signalCuts, TCut backgroundCuts,
			 TString var,
			 int nbins, double xlow, double xhigh,
			 TString sigLegend, TString bg1Legend, TString bg2Legend,TString bg3Legend,
			 TString comment)
{

  TString cname = "c_";
  cname += var;
  TCanvas *c1 = new TCanvas(cname,cname,10,10,600,600);
  c1->cd();

  TH1F *hsig = new TH1F(TString("hsig_")+var,"",nbins, xlow, xhigh);
  TH1F *hbg1 = new TH1F(TString("hbg1_")+var,"",nbins, xlow, xhigh);
  TH1F *hbg2 = new TH1F(TString("hbg2_")+var,"",nbins, xlow, xhigh);
  TH1F *hbg3 = new TH1F(TString("hbg3_")+var,"",nbins, xlow, xhigh);

  TString projectCommandSig = var+TString(">>hsig_")+var;
  TString projectCommandBg1 = var+TString(">>hbg1_")+var;
  TString projectCommandBg2 = var+TString(">>hbg2_")+var;
  TString projectCommandBg3 = var+TString(">>hbg3_")+var;
  
  if( !useSmallEventCount ){
    signalTree->Draw(projectCommandSig, "genWeight"*signalCuts);
  }else{
    printf("DEBUG MODE: using small event count\n");
    signalTree->Draw(projectCommandSig, "genWeight"*signalCuts, "", 100000);
  }
  TGaxis::SetMaxDigits(3);
  hsig->GetXaxis()->SetTitle(var);
  hsig->SetDirectory(0);

  if(backgroundTree1 != 0){
    if( !useSmallEventCount ){
      backgroundTree1->Draw(projectCommandBg1, "genWeight"*backgroundCuts);
    }else{
      printf("DEBUG MODE: using small event count\n");
      backgroundTree1->Draw(projectCommandBg1, "genWeight"*backgroundCuts, "", 100000);
    }
    hbg1->Scale(hsig->GetSumOfWeights() / hbg1->GetSumOfWeights());
    hbg1->SetDirectory(0);
  } else {
    delete hbg1;
    hbg1 = 0;
  }

  if(backgroundTree2 != 0){
    if( !useSmallEventCount ){
      backgroundTree2->Draw(projectCommandBg2, "genWeight"*backgroundCuts);
    }else{
      printf("DEBUG MODE: using small event count\n");
      backgroundTree2->Draw(projectCommandBg2, "genWeight"*backgroundCuts, "", 100000);
    }
    hbg2->Scale(hsig->GetSumOfWeights() / hbg2->GetSumOfWeights());
    hbg2->SetDirectory(0);
  } else {
    delete hbg2;
    hbg2 = 0;
  }


  if(backgroundTree3 != 0){
    if( !useSmallEventCount ){
      backgroundTree3->Draw(projectCommandBg3, "genWeight"*backgroundCuts);
    }else{
      printf("DEBUG MODE: using small event count\n");
      backgroundTree3->Draw(projectCommandBg3, "genWeight"*backgroundCuts, "", 100000);
    }
    hbg3->Scale(hsig->GetSumOfWeights() / hbg3->GetSumOfWeights());
    hbg3->SetDirectory(0);
  } else {
    delete hbg3;
    hbg3 = 0;
  }


  setHistogramAttributes(hsig, hbg1, hbg2, hbg3);

  c1->Clear();

  hsig->Draw("hist");
  if( hbg1 ){

    hbg1->Draw("same");
  }
  if( hbg2 ){

    hbg2->Draw("same");
  }
  if( hbg3 ){

    //hbg3->Draw("same");
  }
  TLegend *leg = new TLegend(0.55, 0.65, 0.95, 0.80); // 0.6 0.9
  leg->SetFillStyle(0);
  leg->SetBorderSize(0);
  leg->AddEntry(hsig, sigLegend, "lf");
  leg->AddEntry(hbg1, bg1Legend, "lf");
  leg->AddEntry(hbg2, bg2Legend, "lf");
  //  leg->AddEntry(hbg3, bg3Legend, "lf");
  leg->Draw("same");

  TLatex *lat = new TLatex(0.5, 0.95, comment); // 0.85
  lat->SetNDC(kTRUE);
  lat->Draw("same");

  c1->Update();

  return c1;
}
예제 #29
0
void gemTurnOns(int label_eff = GEM_EFF98)
{
  //  gROOT->ProcessLine(".L effFunctions.C");

  TCut ok_eta = "TMath::Abs(eta)>1.64 && TMath::Abs(eta)<2.14";

  const int N = 5;

  int pt_lbl[N] = {DPHI_PT10, DPHI_PT15, DPHI_PT20, DPHI_PT30, DPHI_PT40};
  TString pt[N] = {"pt10","pt15","pt20","pt30","pt40"};
  int marker_styles[5] = {24, 28, 22 , 21, 20};

  TCanvas* gEff = new TCanvas("gEff","gEff",700,500);
  gEff->SetGridx(1);  gEff->SetGridy(1);
  TCanvas* gEff_odd = new TCanvas("gEff_odd","gEff_odd",700,500);
  gEff_odd->SetGridx(1);  gEff_odd->SetGridy(1);
  TCanvas* gEff_even = new TCanvas("gEff_even","gEff_even",700,500);
  gEff_even->SetGridx(1);  gEff_even->SetGridy(1);

  TTree *t = getTree(filesDir + "gem_csc_eff_pt2pt50_pad4.root");
  TH1F *ho[N], *he[N];
  for (int n=0; n<N; ++n) {
    if (n==1) continue;
    TString opt = "p";
    if (n>0) opt = "same p";
    setDPhi(n, label_eff);
    gEff->cd();
    ho[n] = draw_eff(gt, "Eff. for track with LCT to have matched GEM pad;p_{T}, GeV/c;Eff.", Form("h_odd%d",n), "(50,0.,50.)", "pt", ok_lct1 && ok_eta && ok_pad1, ok_dphi1, opt, kRed, marker_styles[n]);
    he[n] = draw_eff(gt, "Eff. for track with LCT to have matched GEM pad;p_{T}, GeV/c;Eff.", Form("h_evn%d",n), "(50,0.,50.)", "pt", ok_lct2 && ok_eta && ok_pad2, ok_dphi2, "same p", kBlue, marker_styles[n]);
    gEff_odd->cd();
    ho[n]->Draw(opt);
    gEff_even->cd();
    he[n]->Draw(opt);
  }

  TString pts[N] = {"10","15","20","30","40"};
  TString efs[5] = {"95", "98", "99"};
  TString leg_header =  "    #Delta#phi(LCT,GEM) is " + efs[label_eff] + "% efficient for";

  gEff->cd();
  TLegend *leg = new TLegend(0.50,0.17,.99,0.57, NULL, "brNDC");
  leg->SetNColumns(2);
  leg->SetBorderSize(0);
  leg->SetFillStyle(0);
  leg->SetHeader(leg_header);
  leg->AddEntry(ho[0], "odd chambers", "");
  leg->AddEntry(he[0], "even chambers", "");
  leg->AddEntry(ho[0], "at pt", "");
  leg->AddEntry(he[0], "at pt", "");
  for (int n=0; n<N; ++n) {
    if (n==1) continue;
    leg->AddEntry(ho[n], pts[n], "p");
    leg->AddEntry(he[n], pts[n], "p");
  }
  leg->Draw();
  gEff->Print(plotDir + "gem_pad_eff_for_LCT_gemEff" + efs[label_eff] +"" + ext);

  gEff_odd->cd();
  TLegend *leg = new TLegend(0.50,0.17,.99,0.57, NULL, "brNDC");
  leg->SetBorderSize(0);
  leg->SetFillStyle(0);
  leg->SetHeader(leg_header);
  leg->AddEntry(ho[0], "odd chambers at pt", "");
  for (int n=0; n<N; ++n) {
    if (n==1) continue;
    leg->AddEntry(ho[n], pts[n], "p");
  }
  leg->Draw();
  gEff_odd->Print(plotDir + "gem_pad_eff_for_LCT_gemEff" + efs[label_eff] +"_odd" + ext);

  gEff_even->cd();
  TLegend *leg = new TLegend(0.50,0.17,.99,0.57, NULL, "brNDC");
  leg->SetBorderSize(0);
  leg->SetFillStyle(0);
  leg->SetHeader(leg_header);
  leg->AddEntry(ho[0], "even chambers at pt", "");
  for (int n=0; n<N; ++n) {
    if (n==1) continue;
    leg->AddEntry(he[n], pts[n], "p");
  }
  leg->Draw();
  gEff_even->Print(plotDir + "gem_pad_eff_for_LCT_gemEff" + efs[label_eff] +"_even" + ext);
}
예제 #30
0
plot()
{
//=========Macro generated from canvas: FigExample/FigExample
//=========  (Wed Feb 10 18:30:48 2016) by ROOT version5.34/32
    TCanvas *FigExample = new TCanvas("FigExample", "FigExample",0,23,1366,720);
    gStyle->SetOptFit(1);
    gStyle->SetOptStat(0);
    gStyle->SetOptTitle(0);
    FigExample->Range(1.546456,-0.2025,6.412106,1.485);
    FigExample->SetFillColor(0);
    FigExample->SetBorderMode(0);
    FigExample->SetBorderSize(2);
    FigExample->SetLogx();
    FigExample->SetLeftMargin(0.12);
    FigExample->SetRightMargin(0.04);
    FigExample->SetTopMargin(0.08);
    FigExample->SetBottomMargin(0.12);
    FigExample->SetFrameFillStyle(0);
    FigExample->SetFrameBorderMode(0);
    FigExample->SetFrameFillStyle(0);
    FigExample->SetFrameBorderMode(0);

    TGraphErrors *gre = new TGraphErrors(6);
    gre->SetName("Graph0");
    gre->SetTitle("");
    gre->SetFillColor(1);
    gre->SetLineColor(4);
    gre->SetMarkerColor(4);
    gre->SetMarkerStyle(22);
    gre->SetMarkerSize(1.8);
    gre->SetPoint(0,1500000,0.192982);
    gre->SetPointError(0,0,0.118988);
    gre->SetPoint(1,681818.2,0.704545);
    gre->SetPointError(1,0,0.0473106);
    gre->SetPoint(2,217391.3,0.943028);
    gre->SetPointError(2,0,0.009242);
    gre->SetPoint(3,68181.82,0.973359);
    gre->SetPointError(3,0,0.00320719);
    gre->SetPoint(4,326.0869,0.967568);
    gre->SetPointError(4,0,0.0132405);
    gre->SetPoint(5,150,0.97559);
    gre->SetPointError(5,0,0.00223768);

    TH1F *Graph_Graph_Graph11 = new TH1F("Graph_Graph_Graph11","",100,135,1649985);
    Graph_Graph_Graph11->SetMinimum(0);
    Graph_Graph_Graph11->SetMaximum(1.35);
    Graph_Graph_Graph11->SetDirectory(0);
    Graph_Graph_Graph11->SetStats(0);

    Int_t ci;      // for color index setting
    TColor *color; // for color definition with alpha
    ci = TColor::GetColor("#000099");
    Graph_Graph_Graph11->SetLineColor(ci);
    Graph_Graph_Graph11->SetLineStyle(0);
    Graph_Graph_Graph11->SetMarkerStyle(20);
    Graph_Graph_Graph11->GetXaxis()->SetTitle("Cesium Source Rate ( N_{#gamma}.cm^{-2}.s^{-1} )");
    Graph_Graph_Graph11->GetXaxis()->CenterTitle(true);
    Graph_Graph_Graph11->GetXaxis()->SetLabelFont(42);
    Graph_Graph_Graph11->GetXaxis()->SetLabelOffset(0.007);
    Graph_Graph_Graph11->GetXaxis()->SetLabelSize(0.035);
    Graph_Graph_Graph11->GetXaxis()->SetTitleSize(0.045);
    Graph_Graph_Graph11->GetXaxis()->SetTitleOffset(1.1);
    Graph_Graph_Graph11->GetXaxis()->SetTitleFont(42);
    Graph_Graph_Graph11->GetYaxis()->SetTitle("#mu detection efficiency");
    Graph_Graph_Graph11->GetYaxis()->SetRange(0,1);
    Graph_Graph_Graph11->GetYaxis()->CenterTitle(true);
    Graph_Graph_Graph11->GetYaxis()->SetLabelFont(42);
    Graph_Graph_Graph11->GetYaxis()->SetLabelOffset(0.007);
    Graph_Graph_Graph11->GetYaxis()->SetLabelSize(0.035);
    Graph_Graph_Graph11->GetYaxis()->SetTitleSize(0.045);
    Graph_Graph_Graph11->GetYaxis()->SetTitleOffset(1.1);
    Graph_Graph_Graph11->GetYaxis()->SetTitleFont(42);
    Graph_Graph_Graph11->GetZaxis()->SetLabelFont(42);
    Graph_Graph_Graph11->GetZaxis()->SetLabelOffset(0.007);
    Graph_Graph_Graph11->GetZaxis()->SetLabelSize(0.035);
    Graph_Graph_Graph11->GetZaxis()->SetTitleSize(0.035);
    Graph_Graph_Graph11->GetZaxis()->SetTitleFont(42);
    gre->SetHistogram(Graph_Graph_Graph11);

    gre->Draw("ap");

    gre = new TGraphErrors(6);
    gre->SetName("Graph1");
    gre->SetTitle("");
    gre->SetFillColor(1);
    gre->SetLineColor(2);
    gre->SetMarkerColor(2);
    gre->SetMarkerStyle(3);
    gre->SetMarkerSize(1.8);
    gre->SetPoint(0,1500000,0);
    gre->SetPointError(0,0,0);
    gre->SetPoint(1,681818.2,0.0381356);
    gre->SetPointError(1,0,0.0638412);
    gre->SetPoint(2,217391.3,0.242259);
    gre->SetPointError(2,0,0.0371513);
    gre->SetPoint(3,68181.82,0.70679);
    gre->SetPointError(3,0,0.0113702);
    gre->SetPoint(4,326.0869,0.919075);
    gre->SetPointError(4,0,0.021681);
    gre->SetPoint(5,150,0.929634);
    gre->SetPointError(5,0,0.00395216);

    TH1F *Graph_Graph_Graph22 = new TH1F("Graph_Graph_Graph22","",100,135,1649985);
    Graph_Graph_Graph22->SetMinimum(-0.1223518);
    Graph_Graph_Graph22->SetMaximum(1.037402);
    Graph_Graph_Graph22->SetDirectory(0);
    Graph_Graph_Graph22->SetStats(0);

    ci = TColor::GetColor("#000099");
    Graph_Graph_Graph22->SetLineColor(ci);
    Graph_Graph_Graph22->SetLineStyle(0);
    Graph_Graph_Graph22->SetMarkerStyle(20);
    Graph_Graph_Graph22->GetXaxis()->SetTitle("Cesium Source Rate ( N_{#gamma}.cm^{-2}.s^{-1} )");
    Graph_Graph_Graph22->GetXaxis()->CenterTitle(true);
    Graph_Graph_Graph22->GetXaxis()->SetLabelFont(42);
    Graph_Graph_Graph22->GetXaxis()->SetLabelOffset(0.007);
    Graph_Graph_Graph22->GetXaxis()->SetLabelSize(0.035);
    Graph_Graph_Graph22->GetXaxis()->SetTitleSize(0.045);
    Graph_Graph_Graph22->GetXaxis()->SetTitleOffset(0.9);
    Graph_Graph_Graph22->GetXaxis()->SetTitleFont(42);
    Graph_Graph_Graph22->GetYaxis()->SetTitle("Efficiency");
    Graph_Graph_Graph22->GetYaxis()->CenterTitle(true);
    Graph_Graph_Graph22->GetYaxis()->SetLabelFont(42);
    Graph_Graph_Graph22->GetYaxis()->SetLabelOffset(0.007);
    Graph_Graph_Graph22->GetYaxis()->SetLabelSize(0.035);
    Graph_Graph_Graph22->GetYaxis()->SetTitleSize(0.045);
    Graph_Graph_Graph22->GetYaxis()->SetTitleOffset(1.25);
    Graph_Graph_Graph22->GetYaxis()->SetTitleFont(42);
    Graph_Graph_Graph22->GetZaxis()->SetLabelFont(42);
    Graph_Graph_Graph22->GetZaxis()->SetLabelOffset(0.007);
    Graph_Graph_Graph22->GetZaxis()->SetLabelSize(0.035);
    Graph_Graph_Graph22->GetZaxis()->SetTitleSize(0.035);
    Graph_Graph_Graph22->GetZaxis()->SetTitleFont(42);
    gre->SetHistogram(Graph_Graph_Graph22);

    gre->Draw("p&");

    TLegend *leg = new TLegend(0.15,0.15,0.3,0.3,NULL,"brNDC");
    leg->SetBorderSize(0);
    leg->SetTextFont(62);
    leg->SetTextSize(0.035);
    leg->SetLineColor(1);
    leg->SetLineStyle(1);
    leg->SetLineWidth(1);
    leg->SetFillColor(0);
    leg->SetFillStyle(1001);
    TLegendEntry *entry=leg->AddEntry("NULL","GIF++ test beams 08.2015","h");
    entry->SetLineColor(1);
    entry->SetLineStyle(1);
    entry->SetLineWidth(1);
    entry->SetMarkerColor(1);
    entry->SetMarkerStyle(21);
    entry->SetMarkerSize(1);
    entry->SetTextFont(62);
    entry=leg->AddEntry("Graph0","Low Resistive Glass RPC ~10^{10}#Omega","p");
    entry->SetFillStyle(1001);
    entry->SetLineColor(4);
    entry->SetLineStyle(1);
    entry->SetLineWidth(1);
    entry->SetMarkerColor(4);
    entry->SetMarkerStyle(22);
    entry->SetMarkerSize(1.8);
    entry->SetTextFont(42);
    entry=leg->AddEntry("Graph1","Float Glass RPC ~10^{12}-10^{13}#Omega","p");
    entry->SetFillStyle(1001);
    entry->SetLineColor(2);
    entry->SetLineStyle(1);
    entry->SetLineWidth(1);
    entry->SetMarkerColor(2);
    entry->SetMarkerStyle(3);
    entry->SetMarkerSize(1.8);
    entry->SetTextFont(42);
    leg->Draw();
    TLine *line = new TLine(0,1,1650000,1);
    line->SetLineStyle(2);
    line->Draw();

    TH1F *Graph_Graph1 = new TH1F("Graph_Graph1","",100,135,1649985);
    Graph_Graph1->SetMinimum(0);
    Graph_Graph1->SetMaximum(1.07149);
    Graph_Graph1->SetDirectory(0);
    Graph_Graph1->SetStats(0);

    ci = TColor::GetColor("#000099");
    Graph_Graph1->SetLineColor(ci);
    Graph_Graph1->SetLineStyle(0);
    Graph_Graph1->SetMarkerStyle(20);
    Graph_Graph1->GetXaxis()->SetTitle("Cesium Source Rate ( N_{#gamma}.cm^{-2}.s^{-1} )");
    Graph_Graph1->GetXaxis()->CenterTitle(true);
    Graph_Graph1->GetXaxis()->SetLabelFont(42);
    Graph_Graph1->GetXaxis()->SetLabelOffset(0.007);
    Graph_Graph1->GetXaxis()->SetLabelSize(0.035);
    Graph_Graph1->GetXaxis()->SetTitleSize(0.045);
    Graph_Graph1->GetXaxis()->SetTitleOffset(1.1);
    Graph_Graph1->GetXaxis()->SetTitleFont(42);
    Graph_Graph1->GetYaxis()->SetTitle("#mu detection efficiency");
    Graph_Graph1->GetYaxis()->SetRange(0,1);
    Graph_Graph1->GetYaxis()->CenterTitle(true);
    Graph_Graph1->GetYaxis()->SetLabelFont(42);
    Graph_Graph1->GetYaxis()->SetLabelOffset(0.007);
    Graph_Graph1->GetYaxis()->SetLabelSize(0.035);
    Graph_Graph1->GetYaxis()->SetTitleSize(0.045);
    Graph_Graph1->GetYaxis()->SetTitleOffset(1.1);
    Graph_Graph1->GetYaxis()->SetTitleFont(42);
    Graph_Graph1->GetZaxis()->SetLabelFont(42);
    Graph_Graph1->GetZaxis()->SetLabelOffset(0.007);
    Graph_Graph1->GetZaxis()->SetLabelSize(0.035);
    Graph_Graph1->GetZaxis()->SetTitleSize(0.035);
    Graph_Graph1->GetZaxis()->SetTitleFont(42);
    Graph_Graph1->Draw("sameaxis");
    TLatex *   tex = new TLatex(0.96,0.936," ");
    tex->SetNDC();
    tex->SetTextAlign(31);
    tex->SetTextFont(42);
    tex->SetTextSize(0.048);
    tex->SetLineWidth(2);
    tex->Draw();
    tex = new TLatex(0.1722,0.892,"Preliminary");
    tex->SetNDC();
    tex->SetTextAlign(13);
    tex->SetTextFont(52);
    tex->SetTextSize(0.0456);
    tex->SetLineWidth(2);
    tex->Draw();
    tex = new TLatex(0.1722,0.851872,"CMS gas mixture : 95.2% TFE, 4.5%CO_{2}, 0.3%SF_{6}");
    tex->SetNDC();
    tex->SetTextAlign(13);
    tex->SetTextFont(52);
    tex->SetTextSize(0.032);
    tex->SetLineWidth(2);
    tex->Draw();
    tex = new TLatex(0.1722,0.811744,"Threshold : 0.13pC");
    tex->SetNDC();
    tex->SetTextAlign(13);
    tex->SetTextFont(52);
    tex->SetTextSize(0.032);
    tex->SetLineWidth(2);
    tex->Draw();
    tex = new TLatex(0.1722,0.7635904,"Sensitivity to background with E_{#gamma} = 661.7 keV : 3.1 hits/1000 #gamma");
    tex->SetNDC();
    tex->SetTextAlign(13);
    tex->SetTextFont(52);
    tex->SetTextSize(0.032);
    tex->SetLineWidth(2);
    tex->Draw();

    TH1F *Graph_Graph1 = new TH1F("Graph_Graph1","",100,135,1649985);
    Graph_Graph1->SetMinimum(0);
    Graph_Graph1->SetMaximum(1.07149);
    Graph_Graph1->SetDirectory(0);
    Graph_Graph1->SetStats(0);

    ci = TColor::GetColor("#000099");
    Graph_Graph1->SetLineColor(ci);
    Graph_Graph1->SetLineStyle(0);
    Graph_Graph1->SetMarkerStyle(20);
    Graph_Graph1->GetXaxis()->SetTitle("Cesium Source Rate ( N_{#gamma}.cm^{-2}.s^{-1} )");
    Graph_Graph1->GetXaxis()->CenterTitle(true);
    Graph_Graph1->GetXaxis()->SetLabelFont(42);
    Graph_Graph1->GetXaxis()->SetLabelOffset(0.007);
    Graph_Graph1->GetXaxis()->SetLabelSize(0.035);
    Graph_Graph1->GetXaxis()->SetTitleSize(0.045);
    Graph_Graph1->GetXaxis()->SetTitleOffset(1.1);
    Graph_Graph1->GetXaxis()->SetTitleFont(42);
    Graph_Graph1->GetYaxis()->SetTitle("#mu detection efficiency");
    Graph_Graph1->GetYaxis()->SetRange(0,1);
    Graph_Graph1->GetYaxis()->CenterTitle(true);
    Graph_Graph1->GetYaxis()->SetLabelFont(42);
    Graph_Graph1->GetYaxis()->SetLabelOffset(0.007);
    Graph_Graph1->GetYaxis()->SetLabelSize(0.035);
    Graph_Graph1->GetYaxis()->SetTitleSize(0.045);
    Graph_Graph1->GetYaxis()->SetTitleOffset(1.1);
    Graph_Graph1->GetYaxis()->SetTitleFont(42);
    Graph_Graph1->GetZaxis()->SetLabelFont(42);
    Graph_Graph1->GetZaxis()->SetLabelOffset(0.007);
    Graph_Graph1->GetZaxis()->SetLabelSize(0.035);
    Graph_Graph1->GetZaxis()->SetTitleSize(0.035);
    Graph_Graph1->GetZaxis()->SetTitleFont(42);
    Graph_Graph1->Draw("sameaxis");
    FigExample->Modified();
    FigExample->cd();
    FigExample->SetSelected(FigExample);
}