Exemplo n.º 1
0
//------------------------------------------------------------------------------
// DrawTLegend
//------------------------------------------------------------------------------
TLegend* DrawTLegend(Float_t x1,
		     Float_t y1,
		     TH1*    hist,
		     TString label,
		     TString option,
		     Float_t tsize,
		     Float_t xoffset,
		     Float_t yoffset)
{
  TLegend* legend = new TLegend(x1,
				y1,
				x1 + xoffset,
				y1 + yoffset);
  
  legend->SetBorderSize(    0);
  legend->SetFillColor (    0);
  legend->SetTextAlign (   12);
  legend->SetTextFont  (   42);
  legend->SetTextSize  (tsize);

  legend->AddEntry(hist, label.Data(), option.Data());
  legend->Draw();

  return legend;
}
Exemplo n.º 2
0
void DrawTree::setLegend(float xmin, float ymin, float xsize, float ysize,char* header) {
    _legend = new TLegend(xmin,ymin,xmin+xsize,ymin+ysize);
    _legend->SetTextAlign(12);
    _legend->SetTextColor(1);
    _legend->SetTextSize(0.03);
    _legend->SetFillStyle(0);
    _legend->SetFillColor(0);
    _legend->SetBorderSize(0);

    _legend->SetHeader(header);

}
Exemplo n.º 3
0
void BasePlot::DrawLegend(Float_t x1, Float_t y1, TH1F*   hist, TString label, TString option) {
    TLegend* legend = new TLegend(x1, y1, x1 + _xoffset, y1 + _yoffset);

    legend->SetBorderSize(     0);
    legend->SetFillColor (     0);
    legend->SetTextAlign (    12);
    legend->SetTextFont  (_labelFont);
    legend->SetTextSize  (_legendTextSize);

    legend->AddEntry(hist, label.Data(), option.Data());

    legend->Draw();
}
Exemplo n.º 4
0
void make_1D_Plot(T *hist, configuration *myconfig){
  TCanvas *c1 = new TCanvas("c1","C1",10,10,1280,960);
  gPad->SetTopMargin(0.08);
  gPad->SetRightMargin(0.04);
  gPad->SetLeftMargin(0.12);
  gPad->SetBottomMargin(0.14);
  gPad->SetTickx();
  gPad->SetTicky();
  //gPad->SetLogy();
  //hist->GetYaxis()->SetTitleOffset(0.8);
  hist->SetLineWidth(2);
  if(static_cast<TString>(hist->GetName()).Contains("_IP")){
    hist->SetLineColor(kBlack);
    hist->SetMarkerColor(kBlack);
  }
  else hist->SetLineColor(kBlue+2);
  hist->GetXaxis()->SetLabelSize(0.05);
  hist->GetYaxis()->SetLabelSize(0.05);
  hist->GetXaxis()->SetTitleSize(0.05);
  hist->GetYaxis()->SetTitleSize(0.05);
  hist->GetYaxis()->SetRangeUser(0,1.2*hist->GetMaximum());
  if(static_cast<TString>(hist->GetName()).Contains("_IP"))hist->Draw("e1p");
  else hist->Draw("hist");

  TPaveText *blank_box = new TPaveText(1.001-gPad->GetRightMargin(),gPad->GetBottomMargin(),1.0,gPad->GetBottomMargin()+0.05,"BRNDC");
  blank_box->SetBorderSize(0);blank_box->SetFillColor(kWhite);blank_box->SetTextAlign(12);blank_box->SetFillStyle(1001);
  blank_box->AddText(" ");
  blank_box->Draw();
  hist->Draw("axis same");

  if(static_cast<TString>(hist->GetName()).Contains("_IP")){
    TLegend *leg;
    leg = new TLegend(0.5,0.12+gPad->GetBottomMargin(),0.97-gPad->GetRightMargin(),0.17+gPad->GetBottomMargin());
    leg->SetBorderSize(0);leg->SetFillColor(kWhite);leg->SetFillStyle(1001);leg->SetTextAlign(12);leg->SetTextSize(0.05);leg->SetTextFont(42);
    temp = "#Xi_{c}^{+}+n negative Tracks";
    if(myconfig->get_particle().Contains("Xic0"))temp = "#Xi_{c}^{0} + n positive Tracks";
    if(myconfig->get_particle().Contains("Omega"))temp = "#Omega_{c}^{0} + n positive Tracks^{+}";
    leg->AddEntry(hist,temp,"lp");
    leg->Draw();
  }

  temp = myconfig->get_dumpdir()+"/Plots/";
  if(!gSystem->OpenDirectory(temp))gSystem->mkdir(temp);

  temp += static_cast<TString>(hist->GetName()) + "_" + myconfig->get_current_cs() + ".pdf";
  if(!myconfig->is_debug()) c1->SaveAs(temp);
  delete c1;
  return;
}
TLegend *GetLegendBaselines(TGraphAsymmErrors *gpp,Int_t identifier){
  TLegend * legend = new TLegend(0.27,0.39,0.55,0.47);//pad 0
  //  TLegend * legend = new TLegend(0.40,0.45,0.85,0.55);//pad 1
  // TLegend * legend = new TLegend(0.40,0.6,0.85,0.67);
  // TLegend * legend = new TLegend(0.40,0.64,0.85,0.72);
  //  TLegend * legend = new TLegend(0.011/gPad->GetWNDC()+gPad->GetLeftMargin(),0.22/gPad->GetHNDC()+gPad->GetBottomMargin(),0.27/gPad->GetWNDC()+gPad->GetLeftMargin(),0.28/gPad->GetHNDC()+gPad->GetBottomMargin());
  legend->SetFillColor(0);
  legend->SetFillStyle(0);
  legend->SetBorderSize(0);
  legend->SetTextFont(43);
  legend->SetTextAlign(12);
  // legend->SetTextSize(0.055/(gPad->GetHNDC())*scaleHeightPads);
  legend->SetTextSize(22*innerPadHeight/referencePadHeight*resizeTextFactor);// settings for font 42: 0.07/(gPad->GetHNDC())*scaleHeight
 
  legend->AddEntry(gpp,"baseline-subtraction uncertainty","f");
  legend->SetName(Form("LegendBaselineUncPPandpPb_%d",identifier));
  return legend;
}
Exemplo n.º 6
0
void Plots::Legend(TString histoname1,TString histoname2,TString histoname3, TString histoname4, TH1F *histo1, TH1F *histo2, TH1F *histo3, TH1F *histo4)
{

TLegend *leg = new TLegend(0.45,0.88,1.,1.0); 
leg->SetTextAlign(32);
leg->SetTextColor(1);
leg->SetTextSize(0.020);

char  label[128];
sprintf(label,"perfect alignment;      mean = %1.3f, RMS = %1.3f",convert(histo1->GetMean()),convert(histo1->GetRMS()));
leg->AddEntry(histoname1, label, "l");
sprintf(label,"SurveyLASCosmics alignment; mean = %1.3f, RMS = %1.3f",convert(histo2->GetMean()),convert(histo2->GetRMS()));
leg->AddEntry(histoname2, label, "l");
sprintf(label,"10 pb-1 alignment;  mean = %1.3f, RMS = %1.3f",convert(histo3->GetMean()),convert(histo3->GetRMS()));
leg->AddEntry(histoname3, label, "l");
sprintf(label,"100 pb-1 alignment;  mean = %1.3f, RMS = %1.3f",convert(histo4->GetMean()),convert(histo4->GetRMS()));
leg->AddEntry(histoname4, label, "l");
leg->Draw();

}
Exemplo n.º 7
0
//------------------------------------------------------------------------------
// DrawLegend
//------------------------------------------------------------------------------
void DrawLegend(Float_t x1,
		Float_t y1,
		TH1F*   hist,
		TString label,
		TString option)
{
  TLegend* legend = new TLegend(x1,
				y1,
				x1 + 0.22,
				y1 + 0.05);

  legend->SetBorderSize(    0);
  legend->SetFillColor (    0);
  legend->SetTextAlign (   12);
  legend->SetTextFont  (   42);
  legend->SetTextSize  (0.045);

  legend->AddEntry (hist, label.Data(), option.Data());
  //  legend->AddEntry (hist, label.Data());
  legend->Draw();
}
Exemplo n.º 8
0
void plot(){

TFile* f1 = TFile::Open("prunedmass_cv.root");
TFile* f2 = TFile::Open("prunedmass_up.root");
TFile* f3 = TFile::Open("prunedmass_down.root");

TH1F* cv = (TH1F*)f1->Get("AK8jetPrunedMass");
TH1F* up = (TH1F*)f2->Get("AK8jetPrunedMass");
TH1F* down = (TH1F*)f3->Get("AK8jetPrunedMass");

TLegend* l = new TLegend(0.6645729,0.701049,0.8743719,0.8706294,"","NDC");
l->SetLineWidth(2);
l->SetBorderSize(0);
l->SetFillColor(0);
l->SetFillStyle(0);
l->SetTextFont(42);
l->SetTextSize(0.035);
l->SetTextAlign(12);

cv->SetLineColor(kRed);
cv->SetLineWidth(2);
up->SetLineColor(kBlack);
up->SetFillColor(kBlack);
up->SetFillStyle(3018);
down->SetLineColor(kBlue);
down->SetFillColor(kBlue);

l->AddEntry(cv,"central value","L");
l->AddEntry(up,"scale up","F");
l->AddEntry(down,"scale down","F");

down->Draw("HIST");
cv->Draw("HISTsame");
up->Draw("HISTsame");
l->Draw();

}
void DarkSusy_mH_125_mGammaD_2000_cT_10_LHE_gammaD_Sorted_cT_XY_lab()
{
//=========Macro generated from canvas: cnv/cnv
//=========  (Sun May 24 15:17:52 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(-10.625,-0.01611139,51.875,0.1078224);
   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_gammaD_1_cT_XY_lab_dummy65 = new TH1F("h_gammaD_1_cT_XY_lab_dummy65","h_gammaD_1_cT_XY_lab_dummy",5,0,50);
   h_gammaD_1_cT_XY_lab_dummy65->SetMaximum(0.09914702);
   h_gammaD_1_cT_XY_lab_dummy65->SetLineStyle(0);
   h_gammaD_1_cT_XY_lab_dummy65->SetMarkerStyle(20);
   h_gammaD_1_cT_XY_lab_dummy65->GetXaxis()->SetTitle("L_{XY} of #gamma_{D} [mm]");
   h_gammaD_1_cT_XY_lab_dummy65->GetXaxis()->SetLabelFont(42);
   h_gammaD_1_cT_XY_lab_dummy65->GetXaxis()->SetLabelOffset(0.007);
   h_gammaD_1_cT_XY_lab_dummy65->GetXaxis()->SetTitleSize(0.06);
   h_gammaD_1_cT_XY_lab_dummy65->GetXaxis()->SetTitleOffset(0.95);
   h_gammaD_1_cT_XY_lab_dummy65->GetXaxis()->SetTitleFont(42);
   h_gammaD_1_cT_XY_lab_dummy65->GetYaxis()->SetTitle("Normalized Fraction of events / 10.0 mm");
   h_gammaD_1_cT_XY_lab_dummy65->GetYaxis()->SetLabelFont(42);
   h_gammaD_1_cT_XY_lab_dummy65->GetYaxis()->SetLabelOffset(0.007);
   h_gammaD_1_cT_XY_lab_dummy65->GetYaxis()->SetTitleSize(0.05);
   h_gammaD_1_cT_XY_lab_dummy65->GetYaxis()->SetTitleOffset(1.3);
   h_gammaD_1_cT_XY_lab_dummy65->GetYaxis()->SetTitleFont(42);
   h_gammaD_1_cT_XY_lab_dummy65->GetZaxis()->SetLabelFont(42);
   h_gammaD_1_cT_XY_lab_dummy65->GetZaxis()->SetLabelOffset(0.007);
   h_gammaD_1_cT_XY_lab_dummy65->GetZaxis()->SetTitleSize(0.06);
   h_gammaD_1_cT_XY_lab_dummy65->GetZaxis()->SetTitleFont(42);
   h_gammaD_1_cT_XY_lab_dummy65->Draw("");
   
   TH1F *h_gammaD_1_cT_XY_lab66 = new TH1F("h_gammaD_1_cT_XY_lab66","h_gammaD_1_cT_XY_lab",5,0,50);
   h_gammaD_1_cT_XY_lab66->SetBinContent(1,0.04698479);
   h_gammaD_1_cT_XY_lab66->SetBinContent(2,0.02564764);
   h_gammaD_1_cT_XY_lab66->SetBinContent(3,0.01450027);
   h_gammaD_1_cT_XY_lab66->SetBinContent(4,0.008138182);
   h_gammaD_1_cT_XY_lab66->SetBinContent(5,0.004729106);
   h_gammaD_1_cT_XY_lab66->SetBinContent(6,0.006992016);
   h_gammaD_1_cT_XY_lab66->SetEntries(79999);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#0000ff");
   h_gammaD_1_cT_XY_lab66->SetLineColor(ci);
   h_gammaD_1_cT_XY_lab66->SetLineWidth(2);
   h_gammaD_1_cT_XY_lab66->SetMarkerStyle(20);
   h_gammaD_1_cT_XY_lab66->GetXaxis()->SetLabelFont(42);
   h_gammaD_1_cT_XY_lab66->GetXaxis()->SetLabelOffset(0.007);
   h_gammaD_1_cT_XY_lab66->GetXaxis()->SetTitleSize(0.06);
   h_gammaD_1_cT_XY_lab66->GetXaxis()->SetTitleOffset(0.95);
   h_gammaD_1_cT_XY_lab66->GetXaxis()->SetTitleFont(42);
   h_gammaD_1_cT_XY_lab66->GetYaxis()->SetLabelFont(42);
   h_gammaD_1_cT_XY_lab66->GetYaxis()->SetLabelOffset(0.007);
   h_gammaD_1_cT_XY_lab66->GetYaxis()->SetTitleSize(0.06);
   h_gammaD_1_cT_XY_lab66->GetYaxis()->SetTitleOffset(1.3);
   h_gammaD_1_cT_XY_lab66->GetYaxis()->SetTitleFont(42);
   h_gammaD_1_cT_XY_lab66->GetZaxis()->SetLabelFont(42);
   h_gammaD_1_cT_XY_lab66->GetZaxis()->SetLabelOffset(0.007);
   h_gammaD_1_cT_XY_lab66->GetZaxis()->SetTitleSize(0.06);
   h_gammaD_1_cT_XY_lab66->GetZaxis()->SetTitleFont(42);
   h_gammaD_1_cT_XY_lab66->Draw("same");
   
   TH1F *h_gammaD_2_cT_XY_lab67 = new TH1F("h_gammaD_2_cT_XY_lab67","h_gammaD_2_cT_XY_lab",5,0,50);
   h_gammaD_2_cT_XY_lab67->SetBinContent(1,0.05508168);
   h_gammaD_2_cT_XY_lab67->SetBinContent(2,0.02481173);
   h_gammaD_2_cT_XY_lab67->SetBinContent(3,0.01176736);
   h_gammaD_2_cT_XY_lab67->SetBinContent(4,0.00563072);
   h_gammaD_2_cT_XY_lab67->SetBinContent(5,0.002708513);
   h_gammaD_2_cT_XY_lab67->SetBinContent(6,0.002983999);
   h_gammaD_2_cT_XY_lab67->SetEntries(79999);

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

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

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   
   leg = new TLegend(0.4566667,0.82,0.7822222,0.9066667,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.02777778);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   entry=leg->AddEntry("NULL","#splitline{pp #rightarrow h #rightarrow 2n_{1} #rightarrow 2n_{D} + 2 #gamma_{D} #rightarrow 2n_{D} + 4#mu}{#splitline{m_{h} = 125 GeV, m_{n_{1}} = 50 GeV, m_{n_{D}} = 1 GeV}{m_{#gamma_{D}} = 20 GeV, c#tau_{#gamma_{D}} = 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 DarkSusy_mH_125_mGammaD_2000_cT_10_LHE_gammaD_Sorted_cT_Z_lab()
{
//=========Macro generated from canvas: cnv/cnv
//=========  (Sun May 24 15:17:53 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(-10.625,-0.01342717,51.875,0.08985876);
   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_gammaD_1_cT_Z_lab_dummy68 = new TH1F("h_gammaD_1_cT_Z_lab_dummy68","h_gammaD_1_cT_Z_lab_dummy",5,0,50);
   h_gammaD_1_cT_Z_lab_dummy68->SetMaximum(0.08262875);
   h_gammaD_1_cT_Z_lab_dummy68->SetLineStyle(0);
   h_gammaD_1_cT_Z_lab_dummy68->SetMarkerStyle(20);
   h_gammaD_1_cT_Z_lab_dummy68->GetXaxis()->SetTitle("L_{Z} of #gamma_{D} [mm]");
   h_gammaD_1_cT_Z_lab_dummy68->GetXaxis()->SetLabelFont(42);
   h_gammaD_1_cT_Z_lab_dummy68->GetXaxis()->SetLabelOffset(0.007);
   h_gammaD_1_cT_Z_lab_dummy68->GetXaxis()->SetTitleSize(0.06);
   h_gammaD_1_cT_Z_lab_dummy68->GetXaxis()->SetTitleOffset(0.95);
   h_gammaD_1_cT_Z_lab_dummy68->GetXaxis()->SetTitleFont(42);
   h_gammaD_1_cT_Z_lab_dummy68->GetYaxis()->SetTitle("Normalized Fraction of events / 10.0 mm");
   h_gammaD_1_cT_Z_lab_dummy68->GetYaxis()->SetLabelFont(42);
   h_gammaD_1_cT_Z_lab_dummy68->GetYaxis()->SetLabelOffset(0.007);
   h_gammaD_1_cT_Z_lab_dummy68->GetYaxis()->SetTitleSize(0.05);
   h_gammaD_1_cT_Z_lab_dummy68->GetYaxis()->SetTitleOffset(1.3);
   h_gammaD_1_cT_Z_lab_dummy68->GetYaxis()->SetTitleFont(42);
   h_gammaD_1_cT_Z_lab_dummy68->GetZaxis()->SetLabelFont(42);
   h_gammaD_1_cT_Z_lab_dummy68->GetZaxis()->SetLabelOffset(0.007);
   h_gammaD_1_cT_Z_lab_dummy68->GetZaxis()->SetTitleSize(0.06);
   h_gammaD_1_cT_Z_lab_dummy68->GetZaxis()->SetTitleFont(42);
   h_gammaD_1_cT_Z_lab_dummy68->Draw("");
   
   TH1F *h_gammaD_1_cT_Z_lab69 = new TH1F("h_gammaD_1_cT_Z_lab69","h_gammaD_1_cT_Z_lab",5,0,50);
   h_gammaD_1_cT_Z_lab69->SetBinContent(1,0.04371162);
   h_gammaD_1_cT_Z_lab69->SetBinContent(2,0.02445529);
   h_gammaD_1_cT_Z_lab69->SetBinContent(3,0.01502482);
   h_gammaD_1_cT_Z_lab69->SetBinContent(4,0.01002103);
   h_gammaD_1_cT_Z_lab69->SetBinContent(5,0.006787247);
   h_gammaD_1_cT_Z_lab69->SetBinContent(6,0.03459914);
   h_gammaD_1_cT_Z_lab69->SetEntries(79999);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#0000ff");
   h_gammaD_1_cT_Z_lab69->SetLineColor(ci);
   h_gammaD_1_cT_Z_lab69->SetLineWidth(2);
   h_gammaD_1_cT_Z_lab69->SetMarkerStyle(20);
   h_gammaD_1_cT_Z_lab69->GetXaxis()->SetLabelFont(42);
   h_gammaD_1_cT_Z_lab69->GetXaxis()->SetLabelOffset(0.007);
   h_gammaD_1_cT_Z_lab69->GetXaxis()->SetTitleSize(0.06);
   h_gammaD_1_cT_Z_lab69->GetXaxis()->SetTitleOffset(0.95);
   h_gammaD_1_cT_Z_lab69->GetXaxis()->SetTitleFont(42);
   h_gammaD_1_cT_Z_lab69->GetYaxis()->SetLabelFont(42);
   h_gammaD_1_cT_Z_lab69->GetYaxis()->SetLabelOffset(0.007);
   h_gammaD_1_cT_Z_lab69->GetYaxis()->SetTitleSize(0.06);
   h_gammaD_1_cT_Z_lab69->GetYaxis()->SetTitleOffset(1.3);
   h_gammaD_1_cT_Z_lab69->GetYaxis()->SetTitleFont(42);
   h_gammaD_1_cT_Z_lab69->GetZaxis()->SetLabelFont(42);
   h_gammaD_1_cT_Z_lab69->GetZaxis()->SetLabelOffset(0.007);
   h_gammaD_1_cT_Z_lab69->GetZaxis()->SetTitleSize(0.06);
   h_gammaD_1_cT_Z_lab69->GetZaxis()->SetTitleFont(42);
   h_gammaD_1_cT_Z_lab69->Draw("same");
   
   TH1F *h_gammaD_2_cT_Z_lab70 = new TH1F("h_gammaD_2_cT_Z_lab70","h_gammaD_2_cT_Z_lab",5,0,50);
   h_gammaD_2_cT_Z_lab70->SetBinContent(1,0.04590486);
   h_gammaD_2_cT_Z_lab70->SetBinContent(2,0.02475454);
   h_gammaD_2_cT_Z_lab70->SetBinContent(3,0.01457528);
   h_gammaD_2_cT_Z_lab70->SetBinContent(4,0.008818965);
   h_gammaD_2_cT_Z_lab70->SetBinContent(5,0.005946348);
   h_gammaD_2_cT_Z_lab70->SetBinContent(6,0.02668493);
   h_gammaD_2_cT_Z_lab70->SetEntries(79999);

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

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

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   
   leg = new TLegend(0.4566667,0.82,0.7822222,0.9066667,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.02777778);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   entry=leg->AddEntry("NULL","#splitline{pp #rightarrow h #rightarrow 2n_{1} #rightarrow 2n_{D} + 2 #gamma_{D} #rightarrow 2n_{D} + 4#mu}{#splitline{m_{h} = 125 GeV, m_{n_{1}} = 50 GeV, m_{n_{D}} = 1 GeV}{m_{#gamma_{D}} = 20 GeV, c#tau_{#gamma_{D}} = 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 DarkSusy_mH_125_mGammaD_2000_cT_0_LHE_gammaD_M()
{
//=========Macro generated from canvas: cnv/cnv
//=========  (Sun May 24 15:19:47 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(-1.526695,-0.2275,1.571513,1.5225);
    cnv->SetFillColor(0);
    cnv->SetBorderMode(0);
    cnv->SetBorderSize(2);
    cnv->SetLogx();
    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_gammaD_1_M_dummy86 = new TH1F("h_gammaD_1_M_dummy86","h_gammaD_1_M_dummy",303,0.1,30.1);
    h_gammaD_1_M_dummy86->SetMaximum(1.4);
    h_gammaD_1_M_dummy86->SetLineStyle(0);
    h_gammaD_1_M_dummy86->SetMarkerStyle(20);
    h_gammaD_1_M_dummy86->GetXaxis()->SetTitle("Mass of #gamma_{D} [GeV]");
    h_gammaD_1_M_dummy86->GetXaxis()->SetLabelFont(42);
    h_gammaD_1_M_dummy86->GetXaxis()->SetLabelOffset(0.007);
    h_gammaD_1_M_dummy86->GetXaxis()->SetTitleSize(0.06);
    h_gammaD_1_M_dummy86->GetXaxis()->SetTitleOffset(0.95);
    h_gammaD_1_M_dummy86->GetXaxis()->SetTitleFont(42);
    h_gammaD_1_M_dummy86->GetYaxis()->SetTitle("Fraction of events / 0.1 GeV");
    h_gammaD_1_M_dummy86->GetYaxis()->SetLabelFont(42);
    h_gammaD_1_M_dummy86->GetYaxis()->SetLabelOffset(0.007);
    h_gammaD_1_M_dummy86->GetYaxis()->SetTitleSize(0.06);
    h_gammaD_1_M_dummy86->GetYaxis()->SetTitleOffset(1.35);
    h_gammaD_1_M_dummy86->GetYaxis()->SetTitleFont(42);
    h_gammaD_1_M_dummy86->GetZaxis()->SetLabelFont(42);
    h_gammaD_1_M_dummy86->GetZaxis()->SetLabelOffset(0.007);
    h_gammaD_1_M_dummy86->GetZaxis()->SetTitleSize(0.06);
    h_gammaD_1_M_dummy86->GetZaxis()->SetTitleFont(42);
    h_gammaD_1_M_dummy86->Draw("");

    TH1F *h_gammaD_1_M87 = new TH1F("h_gammaD_1_M87","h_gammaD_1_M",303,0.1,30.1);
    h_gammaD_1_M87->SetBinContent(201,1);
    h_gammaD_1_M87->SetBinError(201,0.002500016);
    h_gammaD_1_M87->SetEntries(159998);
    h_gammaD_1_M87->SetDirectory(0);

    Int_t ci;      // for color index setting
    TColor *color; // for color definition with alpha
    ci = TColor::GetColor("#0000ff");
    h_gammaD_1_M87->SetLineColor(ci);
    h_gammaD_1_M87->SetLineWidth(2);
    h_gammaD_1_M87->SetMarkerStyle(20);
    h_gammaD_1_M87->GetXaxis()->SetLabelFont(42);
    h_gammaD_1_M87->GetXaxis()->SetLabelOffset(0.007);
    h_gammaD_1_M87->GetXaxis()->SetTitleSize(0.06);
    h_gammaD_1_M87->GetXaxis()->SetTitleOffset(0.95);
    h_gammaD_1_M87->GetXaxis()->SetTitleFont(42);
    h_gammaD_1_M87->GetYaxis()->SetLabelFont(42);
    h_gammaD_1_M87->GetYaxis()->SetLabelOffset(0.007);
    h_gammaD_1_M87->GetYaxis()->SetTitleSize(0.06);
    h_gammaD_1_M87->GetYaxis()->SetTitleOffset(1.3);
    h_gammaD_1_M87->GetYaxis()->SetTitleFont(42);
    h_gammaD_1_M87->GetZaxis()->SetLabelFont(42);
    h_gammaD_1_M87->GetZaxis()->SetLabelOffset(0.007);
    h_gammaD_1_M87->GetZaxis()->SetTitleSize(0.06);
    h_gammaD_1_M87->GetZaxis()->SetTitleFont(42);
    h_gammaD_1_M87->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}} = 0 mm}}","h");
    entry->SetLineColor(1);
    entry->SetLineStyle(1);
    entry->SetLineWidth(1);
    entry->SetMarkerColor(1);
    entry->SetMarkerStyle(21);
    entry->SetMarkerSize(1);
    entry->SetTextFont(42);
    leg->Draw();

    leg = new TLegend(0.17,0.935,0.97,1,NULL,"brNDC");
    leg->SetBorderSize(0);
    leg->SetTextAlign(22);
    leg->SetTextSize(0.045);
    leg->SetLineColor(1);
    leg->SetLineStyle(1);
    leg->SetLineWidth(1);
    leg->SetFillColor(0);
    leg->SetFillStyle(0);
    entry=leg->AddEntry("NULL","CMS Simulation (LHE) 14 TeV","h");
    entry->SetLineColor(1);
    entry->SetLineStyle(1);
    entry->SetLineWidth(1);
    entry->SetMarkerColor(1);
    entry->SetMarkerStyle(21);
    entry->SetMarkerSize(1);
    entry->SetTextFont(42);
    leg->Draw();
    cnv->Modified();
    cnv->cd();
    cnv->SetSelected(cnv);
}
void DarkSusy_mH_125_mGammaD_2000_cT_1000_LHE_dimuon_m1_vs_m2()
{
//=========Macro generated from canvas: cnv/cnv
//=========  (Sun May 24 15:19:04 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(-10.36674,-7.877387,51.86701,54.35636);
   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);
   
   TH2F *h_m1_vs_m2113 = new TH2F("h_m1_vs_m2113","h_m1_vs_m2",500,0.213,50,100,0.213,50);
   h_m1_vs_m2113->SetBinContent(20279,79998);
   h_m1_vs_m2113->SetBinContent(20280,1);
   h_m1_vs_m2113->SetEntries(79999);
   h_m1_vs_m2113->SetLineStyle(0);
   h_m1_vs_m2113->SetMarkerStyle(20);
   h_m1_vs_m2113->GetXaxis()->SetTitle("m_{2#mu#mu} [GeV]");
   h_m1_vs_m2113->GetXaxis()->SetLabelFont(42);
   h_m1_vs_m2113->GetXaxis()->SetLabelOffset(0.007);
   h_m1_vs_m2113->GetXaxis()->SetTitleSize(0.06);
   h_m1_vs_m2113->GetXaxis()->SetTitleOffset(0.95);
   h_m1_vs_m2113->GetXaxis()->SetTitleFont(42);
   h_m1_vs_m2113->GetYaxis()->SetTitle("m_{1#mu#mu} [GeV]");
   h_m1_vs_m2113->GetYaxis()->SetLabelFont(42);
   h_m1_vs_m2113->GetYaxis()->SetLabelOffset(0.007);
   h_m1_vs_m2113->GetYaxis()->SetTitleSize(0.06);
   h_m1_vs_m2113->GetYaxis()->SetTitleOffset(1.3);
   h_m1_vs_m2113->GetYaxis()->SetTitleFont(42);
   h_m1_vs_m2113->GetZaxis()->SetLabelFont(42);
   h_m1_vs_m2113->GetZaxis()->SetLabelOffset(0.007);
   h_m1_vs_m2113->GetZaxis()->SetTitleSize(0.06);
   h_m1_vs_m2113->GetZaxis()->SetTitleFont(42);
   h_m1_vs_m2113->Draw("");
   
   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}} = 1000 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);
}
Exemplo n.º 13
0
void drawOneComparison(vector<TH1F*> histos, vector<TString> descr, TString xaxislabel, const char *filename, TPaveText *t=0) {
  
  if(histos.size()!=descr.size()) {
    cout << "description not complete!" << endl;
    return;
  }

  vector<int> colors;
  colors.push_back(kRed+1);
  colors.push_back(kAzure-6);
  colors.push_back(kTeal+3);
  colors.push_back(kBlue+3);

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

  TCanvas *c1 = new TCanvas("c1", "c1", 600, 600);
  c1->SetGridx();
  c1->SetGridy();  
  TLegend* legend = new TLegend(0.20, 0.20, 0.43, 0.36);
  legend->SetBorderSize(   0);
  legend->SetFillColor (   0);
  legend->SetTextAlign (  12);
  legend->SetTextFont  (  42);
  legend->SetTextSize  (0.05);

  for(int i=0;i<(int)histos.size();++i) {
    
    histos[i]->SetMinimum(0.5);
    histos[i]->SetMaximum(1.1);
    histos[i]->SetMarkerSize(2);
    histos[i]->SetMarkerStyle(20);
    histos[i]->SetMarkerColor(colors[i]);
    histos[i]->SetLineColor(colors[i]);
    histos[i]->SetTitle("");
    if(TString(histos[i]->GetName()).Contains("PU")) {
      histos[i]->SetMaximum(1.1);
      histos[i]->Fit("pol1","","same",1,35);
      histos[i]->GetFunction("pol1")->SetLineColor(colors[i]);
    }
    histos[i]->GetXaxis()->SetTitle(xaxislabel);
    histos[i]->GetYaxis()->SetTitle("efficiency");
    histos[i]->GetYaxis()->SetTitleOffset(1.5);

    legend->AddEntry(histos[i],descr[i]);

    if(i==0) { 
      histos[i]->Draw("pe1");
      for(int bin=1;bin<=histos[i]->GetNbinsX();bin++) {
	//cout << "bin i = " << bin << ": " <<  histos[i]->GetBinContent(bin) << " +/- " << histos[i]->GetBinError(bin) << endl;
	//	cout << "m35_fakeRate[" << bin << "] = " << histos[i]->GetBinContent(bin) << ";" << endl;
      }
      for(int bin=1;bin<=histos[i]->GetNbinsX();bin++) {
	//	cout << "m35_fakeRate_err[" << bin << "] = " << histos[i]->GetBinError(bin) << ";" << endl;
      }
    }
    else histos[i]->Draw("same pe1");
  }
  legend->Draw();
  if(t) t->Draw();

  TString basename(filename);
  c1->SaveAs(basename+TString(".png"));
  c1->SaveAs(basename+TString(".pdf"));

}
Exemplo n.º 14
0
void PlotRakeBunch( const TString &sim, Int_t time, Int_t index = 0, const TString &options="") {
  
#ifdef __CINT__  
  gSystem->Load("libplasma.so");
#endif

  PlasmaGlob::Initialize();

  TString opt = options;
 
  // Palettes!
  gROOT->Macro("PlasmaPalettes.C");

  if(opt.Contains("grid")) {
    gStyle->SetPadGridX(1);
    gStyle->SetPadGridY(1);
  }
  gStyle->SetLabelFont(42,"xyz");
  gStyle->SetTextFont(62);
 

  // Load PData
  PData *pData = PData::Get(sim.Data());
  pData->LoadFileNames(time);
  if(!pData->IsInit()) return;

  Bool_t CYL = kFALSE;
  if(sim.Contains("cyl")) CYL = kTRUE; 
    
  Bool_t ThreeD = kFALSE;
  if(sim.Contains("3D")) ThreeD = kTRUE; 

  // Some plasma constants
  Double_t n0 = pData->GetPlasmaDensity();
  Double_t kp = pData->GetPlasmaK();
  Double_t skindepth = 1.;
  if(kp!=0.0) skindepth = 1/kp;
  Double_t E0 = pData->GetPlasmaE0();

  // Time in OU
  Float_t Time = pData->GetRealTime();
  // z start of the plasma in normalized units.
  Float_t zStartPlasma = pData->GetPlasmaStart()*kp;
  // z start of the beam in normalized units.
  Float_t zStartBeam = pData->GetBeamStart()*kp;
  
  opt += "comovcenter";

  // Centering time and z position:
  Double_t shiftz = pData->Shift(opt);
  TString sshiftz = Form("(x1-%f)",shiftz);

  if(opt.Contains("center")) {
    Time -= zStartPlasma;
    if(opt.Contains("comov"))      // Centers on the head of the beam.
      Time += zStartBeam;
  } 
  
  // Spatial coordinates intervals:
  Float_t x1Min = -4.3;
  Float_t x1Max = -3.9;
  Float_t x2Min = -0.5;
  Float_t x2Max =  0.5;
  Float_t x3Min = -0.5;
  Float_t x3Max =  0.5;

  // Momentum coordinates intervals:
  Float_t p1Min =  6500.01;
  Float_t p1Max =  10099.99;
  Float_t p2Min = -20.0;
  Float_t p2Max =  20.0;
  Float_t p3Min = -20.0;
  Float_t p3Max =  20.0;

  // Bining, intervals, labels, etc.
  Int_t xNbin = 200;
  Int_t yNbin = 200;

  if(sim.Contains("DR")) {
    xNbin = 200;
    yNbin = 200;
   
    // p1Min =  2200.01;
    // p1Max =  3399.99;
    // p1Min =  3500.01;
    // p1Max =  4999.99;
    p1Min =  1800.01;
    p1Max =  3999.99;

    // x1Min = -4.0;
    // x1Max = -3.2;
    x1Min = 8637.0;
    x1Max = 8639.0;
    x2Min = -0.5;
    x2Max =  0.5;
    x3Min = -0.5;
    x3Max =  0.5;
  } else if(sim.Contains("flash") && sim.Contains(".G.") ) {
    
    x1Min = -6.3;
    x1Max = -5.0;

    //p1Min =  0.001;
    p1Min =  650.001;
    p1Max =  1499.99;
    
  } else if(sim.Contains("facet_v23kA.G.A")) {
    x1Min = -7.8;
    x1Max = -7.1;

    x2Min = -1.0;
    x2Max =  1.0;
    x3Min = -1.0;
    x3Max =  1.0;
    // t=150
    p1Min =  1100.001;
    p1Max =  1999.99;
  } else if(sim.Contains("facet_v23kA.G")) {
    x1Min = -7.8;
    x1Max = -7.0;

    x2Min = -1.0;
    x2Max =  1.0;
    x3Min = -1.0;
    x3Max =  1.0;
    // t=60
     p1Min =  350.01;
     p1Max =  799.99;
    // t = 100
    // p1Min =  700.01;
    // p1Max =  1399.99;
    // t=105
    //p1Min =  800.001;
    //p1Max =  1399.99;
    // t=183
    // p1Min =  1500.001;
    // p1Max =  2499.99;
    // t=235
    // p1Min =  2000.01;
    // p1Max =  3499.99; 
    // t=310
    // p1Min =  2800.01;
    // p1Max =  4799.99; 
  }
  
  
  // Get phasespace histos
  Int_t Nspecies = pData->NSpecies();
  if(index>Nspecies-1) {
    return;
  }
  if(!pData->GetRawFileName(index)) {
    return;    
  }
  TH1F *hX1 = NULL;
  TH1F *hP1 = NULL;
  TH2F *hP1X1 = NULL;
  TH2F *hP2X2 = NULL;


  cout << Form("\n1. Getting data... ") << endl; 
  char cutString[512];
  sprintf(cutString,"TMath::Abs(q)*(%s > %.1f && %s < %.1f && x2 > %.1f && x2 < %.1f && x3 > %.1f && x3 < %.1f)",sshiftz.Data(),x1Min,sshiftz.Data(),x1Max,x2Min,x2Max,x3Min,x3Max); 
  TCut Cut = cutString;
  cout << Form("   (applied cut: \n %s)",cutString) << endl;
  TTree *tree = pData->GetTreeRaw(pData->GetRawFileName(index)->c_str(),opt);
  
  char hName[24];
  char dCommand[128];

  cout << Form("\n2. Dumping 1D histograms.. ") << endl;
  
  sprintf(hName,"hX1");
  hX1 = (TH1F*) gROOT->FindObject(hName);
  if(hX1) delete hX1;
  hX1 = new TH1F(hName,"",xNbin,x1Min,x1Max);
  sprintf(dCommand,"%s>>%s",sshiftz.Data(),hName);
  cout << Form("   - x1. ") << endl;    
  tree->Draw(dCommand,Cut,"goff");

  sprintf(hName,"hP1");
  hP1 = (TH1F*) gROOT->FindObject(hName);
  if(hP1) delete hP1;
  hP1 = new TH1F(hName,"",yNbin,p1Min,p1Max);
  sprintf(dCommand,"p1>>%s",hName);
  cout << Form("   - p1. ") << endl;    
  tree->Draw(dCommand,Cut,"goff");

  cout << Form("\n3. Dumping 2D histograms.. ") << endl;

  sprintf(hName,"hP1X1");
  hP1X1 = (TH2F*) gROOT->FindObject(hName);
  if(hP1X1) delete hP1X1;
  hP1X1 = new TH2F(hName,"",xNbin,x1Min,x1Max,yNbin,p1Min,p1Max);
  sprintf(dCommand,"p1:%s>>%s",sshiftz.Data(),hName);
  cout << Form("   - p1 vs. x1 ") << endl;    
  tree->Draw(dCommand,Cut,"goff");
  
  sprintf(hName,"hP2X2");
  hP2X2 = (TH2F*) gROOT->FindObject(hName);
  if(hP2X2) delete hP2X2;
  hP2X2 = new TH2F(hName,"",xNbin,x2Min,x2Max,yNbin,p2Min,p2Max);
  sprintf(dCommand,"p2:x2>>%s",hName);
  cout << Form("   - p2 vs. x2 ") << endl;    
  tree->Draw(dCommand,Cut,"goff");
  
  hX1->GetXaxis()->CenterTitle();
  hX1->GetYaxis()->CenterTitle();
  hX1->GetZaxis()->CenterTitle();
  hP1X1->GetXaxis()->CenterTitle();
  hP1X1->GetYaxis()->CenterTitle();
  hP1X1->GetZaxis()->CenterTitle();
  hP2X2->GetXaxis()->CenterTitle();
  hP2X2->GetYaxis()->CenterTitle();
  hP2X2->GetZaxis()->CenterTitle();
   
  // Integrated long. emittance:

  cout << Form("\n4. Calculating integrated quantities.. ") << endl;

  Double_t xmean = 0.0;
  Double_t ymean = 0.0;
  Double_t x2mean = 0.0;
  Double_t y2mean = 0.0;
  Double_t xymean = 0.0;
  Double_t Ntotal = 0.0;
  for(Int_t i=1;i<=xNbin;i++) {
    Double_t x = hP1X1->GetXaxis()->GetBinCenter(i);
    // if(x<xmin || x>xmax) continue;
    for(Int_t j=1;j<=yNbin;j++) {
      Double_t y = hP1X1->GetYaxis()->GetBinCenter(j);
      // if(y<ymin || y>ymax) continue;
      Double_t value = TMath::Abs(hP1X1->GetBinContent(i,j));
      xmean += x*value;
      ymean += y*value;
      x2mean += x*x*value;
      y2mean += y*y*value;
      xymean += x*y*value;

      Ntotal += value;
    }
  }
  
  xmean  /= Ntotal;
  ymean  /= Ntotal;
  x2mean /= Ntotal;
  y2mean /= Ntotal;
  xymean /= Ntotal;

  Double_t xrms2  = x2mean - xmean*xmean;
  Double_t yrms2  = y2mean - ymean*ymean;
  Double_t xrms   = TMath::Sqrt(xrms2);
  Double_t yrms   = TMath::Sqrt(yrms2);
  Double_t xyrms2 = xymean - xmean*ymean;

  Double_t emittance = TMath::Sqrt(xrms2*yrms2 - xyrms2*xyrms2);
  
  // cout << " xrms = " << xrms << endl;
  
  // Sliced emittance:
  // --------------------------------------------------------------------------

  cout << Form("\n5. Slicing ") << endl;


  // Bining for sliced quantities:
  // const Int_t SNbin = 7;
  // Float_t sBinLim[SNbin+1] = {-4.16,-4.14,-4.12,-4.10,-4.08,-4.06,-4.04,-4.02};
  // const Int_t SNbin = 7;
  // Float_t sBinLim[SNbin+1] = {-4.20,-4.17,-4.14,-4.12,-4.10,-4.08,-4.06,-4.00};
  // const Int_t SNbin = 8;
  // Float_t sBinLim[SNbin+1] = {-3.93,-3.87,-3.81,-3.75,-3.69,-3.63,-3.57,-3.51,-3.45};
  
  Int_t SNbin = 7;
  Float_t nsigma = 2;
  Float_t x1BinMin = -4.16;
  Float_t x1BinMax = -4.02;
  if(sim.Contains("DR")) {
    SNbin = 150; 
    nsigma = 1.4;
  } else if(sim.Contains("facet_v23kA.G.A")) {
    SNbin = 46;
    nsigma = 1;
    x1BinMin = -7.55;
    x1BinMax = -7.25;
  } else if(sim.Contains("facet_v23kA.G")) {
    SNbin = 10;
    nsigma = 1;
    x1BinMin = -7.55;
    x1BinMax = -7.15;
  }
  
  Float_t *sBinLim = new Float_t[SNbin+1];

  if(opt.Contains("rms")) {
    sBinLim[0] = xmean - nsigma*xrms;
    sBinLim[SNbin] = xmean + nsigma*xrms;
  } else {
    sBinLim[0] = x1BinMin;
    sBinLim[SNbin] = x1BinMax;
  }

  Float_t slbinSize = (sBinLim[SNbin] - sBinLim[0])/SNbin;
  
  for(Int_t i=1;i<SNbin;i++) {
    sBinLim[i] = sBinLim[i-1] + slbinSize;
  }
  
  TH1F **hP1sl = new TH1F*[SNbin];
  TH2F **hP2X2sl = new TH2F*[SNbin];

  cout << Form("\n   - Dumping in %i bins ",SNbin) << endl;

  
  for(Int_t k=0;k<SNbin;k++) {

    cout<< Form("k = %i : (x1 > %f && x1 < %f)",k,sBinLim[k],sBinLim[k+1]) << endl; 

    sprintf(hName,"hP2X2sl_%2i",k);
    hP2X2sl[k] = (TH2F*) gROOT->FindObject(hName);
    if(hP2X2sl[k]) delete hP2X2sl[k];
    hP2X2sl[k] = new TH2F(hName,"",xNbin,x2Min,x2Max,yNbin,p2Min,p2Max);

    char zCutString[128];
    sprintf(zCutString,"(%s > %f && %s < %f)",sshiftz.Data(),sBinLim[k],sshiftz.Data(),sBinLim[k+1]); 
    TCut zCut = zCutString;
    tree->Project(hName,"p2:x2",Cut + zCut);

    sprintf(hName,"hP1sl_%2i",k);
    hP1sl[k] = (TH1F*) gROOT->FindObject(hName);
    if(hP1sl[k]) delete hP1sl[k];
    hP1sl[k] = new TH1F(hName,"",yNbin,p1Min,p1Max);
    tree->Project(hName,"p1",Cut + zCut);

  }
  

  cout << Form("\n6. Calculating sliced quantities.. ") << endl;

  TGraph *gemit = NULL;
  TGraph *gYrms = NULL;
  TGraph *gErms = NULL;
  TGraph *gErmsB = NULL;
 
  Double_t * sxmean = new Double_t[SNbin];
  Double_t * symean = new Double_t[SNbin];
  Double_t * sx2mean = new Double_t[SNbin];
  Double_t * sy2mean = new Double_t[SNbin];
  Double_t * sxymean = new Double_t[SNbin];
  Double_t * sNtotal = new Double_t[SNbin];
  Double_t * sxrms2 = new Double_t[SNbin];  
  Double_t * syrms2 = new Double_t[SNbin]; 
  Double_t * sxrms = new Double_t[SNbin];  
  Double_t * syrms = new Double_t[SNbin];  
  Double_t * sxyrms2 = new Double_t[SNbin];
 
  Double_t * xbin = new Double_t[SNbin];
  Double_t * semittance = new Double_t[SNbin];

  Double_t * sNEtotal = new Double_t[SNbin]; 
  Double_t * sEmean = new Double_t[SNbin];
  Double_t * sE2mean = new Double_t[SNbin];
  Double_t * sErms = new Double_t[SNbin];

  for(Int_t k=0;k<SNbin;k++) {
    sxmean[k] = symean[k] = sx2mean[k] = sy2mean[k] = sxymean[k] 
      = sNtotal[k] = sxrms2[k] = syrms2[k] = sxrms[k] = syrms[k]
      = sxyrms2[k] = xbin[k] = semittance[k] = 0.0;
    sNEtotal[k] = sEmean[k] = sE2mean[k] = sErms[k] = 0.0;
    
    xbin[k] = (sBinLim[k] + sBinLim[k+1])/2.;
    
    for(Int_t i=1;i<=xNbin;i++) {
      Double_t x = hP2X2sl[k]->GetXaxis()->GetBinCenter(i);
      // if(x<xmin || x>xmax) continue;
      for(Int_t j=1;j<=yNbin;j++) {
	Double_t y = hP2X2sl[k]->GetYaxis()->GetBinCenter(j);
	// if(y<ymin || y>ymax) continue;
	Double_t value = TMath::Abs(hP2X2sl[k]->GetBinContent(i,j));
	sxmean[k] += x*value;
	symean[k] += y*value;
	sx2mean[k] += x*x*value;
	sy2mean[k] += y*y*value;
	sxymean[k] += x*y*value;
	
	sNtotal[k] += value;
      }	
    }
    
    for(Int_t i=1;i<=yNbin;i++) {
      Double_t y = hP1sl[k]->GetXaxis()->GetBinCenter(i);
      Double_t value = TMath::Abs(hP1sl[k]->GetBinContent(i));
      sEmean[k] += y*value;
      sE2mean[k] += y*y*value;
      sNEtotal[k] += value;
    }
    
    sxmean[k]  /= sNtotal[k];
    symean[k]  /= sNtotal[k];
    sx2mean[k] /= sNtotal[k];
    sy2mean[k] /= sNtotal[k];
    sxymean[k] /= sNtotal[k];
      
    sxrms2[k]  = sx2mean[k] - sxmean[k]*sxmean[k];
    syrms2[k]  = sy2mean[k] - symean[k]*symean[k];
    sxrms[k]   = TMath::Sqrt(sxrms2[k]);
    syrms[k]   = TMath::Sqrt(syrms2[k]);
    sxyrms2[k] = sxymean[k] - sxmean[k]*symean[k];
      
    semittance[k] = TMath::Sqrt(sxrms2[k]*syrms2[k] - sxyrms2[k]*sxyrms2[k]);

    sEmean[k]  /= sNEtotal[k];
    sE2mean[k] /= sNEtotal[k];
    sErms[k]   =  TMath::Sqrt(sE2mean[k] - sEmean[k]*sEmean[k]);
    
    
    cout << " Bunch properties: " << endl;
    cout << Form("  xMean = %7.3f   yMean = %7.3f",sxmean[k],symean[k]) << endl;
    cout << Form("  xRms  = %7.3f   yRms  = %7.3f",sxrms[k],syrms[k]) << endl;
    cout << Form("  Emittance = %7.3f",semittance[k]) << endl;

    cout << Form("  Emean = %7.3f   Erms = %7.3f",sEmean[k],sErms[k]) << endl;
    

  }

  // Charge
  Double_t dx1 = pData->GetDX(0);
  Double_t dx2 = pData->GetDX(1);
  Double_t dx3 = pData->GetDX(2);
  
  hX1->Scale(dx1*dx2*dx3);
  Double_t Charge = hX1->Integral();
  
  // Charge *= dx1*dx2*dx3;
 
  if(opt.Contains("units")) {
    Double_t dV = skindepth * skindepth * skindepth;
    Charge *= n0 * dV * (PConst::ElectronCharge/PUnits::picocoulomb);
    cout << Form(" Integrated charge (RAW) of specie %3i = %8f pC",index,Charge) << endl;
  } else {
    cout << Form(" Integrated charge (RAW) of specie %3i = %8.4f n0 * kp^-3",index,Charge) << endl;
  }
  

  // Chaning to user units: 
  // --------------------------
  
  if(opt.Contains("units") && n0) {
    
    Int_t NbinsX = hP1X1->GetNbinsX();
    Double_t xMin = skindepth * hP1X1->GetXaxis()->GetXmin() / PUnits::um;
    Double_t xMax = skindepth * hP1X1->GetXaxis()->GetXmax() / PUnits::um;
    Int_t NbinsY = hP1X1->GetNbinsY();
    Double_t yMin = hP1X1->GetYaxis()->GetXmin() * pData->GetBeamMass() / PUnits::GeV;
    Double_t yMax = hP1X1->GetYaxis()->GetXmax() * pData->GetBeamMass() / PUnits::GeV;
    hP1X1->SetBins(NbinsX,xMin,xMax,NbinsY,yMin,yMax);
    // Converting electron density
    Double_t dVb = skindepth * skindepth * skindepth;
    Double_t dX = (xMax-xMin)/NbinsX; 
    Double_t dE = (yMax-yMin)/NbinsY; 
    for(Int_t j=0;j<hP1X1->GetNbinsX();j++) {
      for(Int_t k=0;k<hP1X1->GetNbinsY();k++) {
	Double_t binValue =  fabs(hP1X1->GetBinContent(j,k) * dx1 * dx2 * dx3 * dVb * n0 *
				  (PConst::ElectronCharge/PUnits::picocoulomb));
     	//cout << Form(" value = %f",binValue) << endl;
	hP1X1->SetBinContent(j,k,binValue);
	
      }
    }
    
    if(opt.Contains("comov"))
      hP1X1->GetXaxis()->SetTitle("#zeta [#mum]");
    else
      hP1X1->GetXaxis()->SetTitle("z [#mum]");
    
    hP1X1->GetYaxis()->SetTitle("p_{z} [GeV/c]");
    
    hP1X1->GetZaxis()->SetTitle("dQ/d#zetadp_{z} [pC]");

    hP1->SetBins(NbinsY,yMin,yMax);
    hP1->GetYaxis()->SetTitle("p_{z} [GeV/c]");

    hX1->SetBins(NbinsX,xMin,xMax);
    Double_t binSize = (xMax - xMin)/NbinsX;

    Double_t dV = skindepth * skindepth * skindepth;
    Double_t  lightspeed =  PConst::c_light / (PUnits::um/PUnits::femtosecond);
    cout << Form("Speed of light = %f",lightspeed) << endl;
    hX1->Scale(TMath::Abs(n0 * dV * (PConst::ElectronCharge/PUnits::picocoulomb) * (lightspeed/binSize)));
    
    // hX1->Scale(TMath::Abs((PUnits::um/skindepth)*(PConst::ElectronCharge/PUnits::picocoulomb)*PConst::c_light));
    
    // hX1->GetYaxis()->SetTitle("I[kA]");
    hX1->GetYaxis()->SetTitle("");
    if(opt.Contains("comov"))
      hX1->GetXaxis()->SetTitle("#zeta [#mum]");
    else
      hX1->GetXaxis()->SetTitle("z [#mum]");
    
    
    xmean *= skindepth / PUnits::um;
    xrms  *= skindepth / PUnits::um;
    ymean *= pData->GetBeamMass() / PUnits::GeV;
    yrms  *= pData->GetBeamMass() / PUnits::GeV;
    
    emittance *= (skindepth / PUnits::um);
    
    for(Int_t k=0;k<SNbin;k++) {
      xbin[k] *= skindepth / PUnits::um;

      sxmean[k] *= skindepth / PUnits::um;
      sxrms[k]  *= skindepth / PUnits::um;
      symean[k] *= pData->GetBeamMass() / PUnits::MeV;
      syrms[k] *= pData->GetBeamMass() / PUnits::MeV;
      
      semittance[k] *= (skindepth / PUnits::um);

      sEmean[k] *= pData->GetBeamMass() / PUnits::GeV;
      sErms[k]  *= 100 * pData->GetBeamMass() / PUnits::GeV / ymean; //sEmean[k];
      // sErms[k]  *= pData->GetBeamMass() / PUnits::GeV;

    }

  }


  // Create the graph with the emittances:
  gemit = new TGraph(SNbin,xbin,semittance);
  gYrms = new TGraph(SNbin,xbin,sxrms);
  gErms = new TGraph(SNbin,xbin,sErms);
  
  
  // Profile energy for p1 vs x1:
  TString pname = hP1X1->GetName();
  pname += "_pfx";
  TProfile *hP1X1prof = (TProfile*) gROOT->FindObject(pname.Data());
  if(hP1X1prof) { delete hP1X1prof; hP1X1prof = NULL; }
  hP1X1prof = hP1X1->ProfileX("_pfx",1,-1,"s");

  // get the errors from the profile:
  Int_t NP1X1Bins = hP1X1prof->GetNbinsX();
  Double_t *x1bins = new Double_t[NP1X1Bins];
  Double_t *eRms   = new Double_t[NP1X1Bins];
  for(Int_t i=1;i<=hP1X1prof->GetNbinsX();i++) {
    x1bins[i] = hP1X1prof->GetBinCenter(i);
    eRms[i] = 100 * hP1X1prof->GetBinError(i) / hP1X1prof->GetBinContent(i);
  }
  gErmsB = new TGraph(NP1X1Bins,x1bins,eRms);
  
  // Vertical Energy histogram:
  // --------------------------------------------------------------------------------   
  TGraph *gP1left = NULL;
  if(hP1) {
    Double_t *yarray   = new Double_t[yNbin];
    Double_t *xarray   = new Double_t[yNbin];
    
    // This is for the right side:
    // Double_t xMax = x1Min + (x1Max-x1Min) * 0.9;
    // Double_t xMin = x1Max;
    // And this for left:
    Double_t xMin = hX1->GetXaxis()->GetXmin();
    Double_t xMax = hX1->GetXaxis()->GetXmin() + (hX1->GetXaxis()->GetXmax()
						  -hX1->GetXaxis()->GetXmin()) * 0.2;
    Double_t EneMax = hP1->GetMaximum();
    // cout << Form("  EneMax = %f ", EneMax) << endl;
 
    for(Int_t j=0; j<yNbin; j++) {
      yarray[j] = hP1->GetBinCenter(j+1);
      xarray[j] = ((xMax-xMin)/EneMax)*hP1->GetBinContent(j+1) + xMin;

      // cout << Form("  x = %f  y = %f ", xarray[j],yarray[j]) << endl;
    }

    gP1left = new TGraph(yNbin,xarray,yarray);
    gP1left->SetLineColor(PlasmaGlob::elecLine);
    gP1left->SetLineWidth(2);
    gP1left->SetFillStyle(1001);
    gP1left->SetFillColor(PlasmaGlob::elecFill);
       
  }

  

  // Plotting
  // -----------------------------------------------
    
  // Canvas setup
  // Create the canvas and the pads before the Frame loop
  // Resolution:
  Int_t sizex = 800;
  Int_t sizey = 600;
  if(opt.Contains("hres")) {
    Int_t sizex = 1600;
    Int_t sizey = 1200;    
  }
  
  TCanvas *C = new TCanvas("C1","Evolution of Injection",sizex,sizey);
  C->cd();

  // Set palette:
  PPalette * pPalette = (PPalette*) gROOT->FindObject("electron");
  pPalette->cd();

  // Float_t Max  = hP1X1->GetMaximum();
  // Float_t Min  = hP1X1->GetMinimum();
  
  // hP1X1->GetZaxis()->SetRangeUser(Min,Max); 


  // Text objects
  TPaveText *textTime = new TPaveText(0.55,0.8,0.82,0.9,"NDC");
  PlasmaGlob::SetPaveTextStyle(textTime,32); 
  textTime->SetTextColor(kGray+2);
  char ctext[128];
  if(opt.Contains("units") && pData->GetPlasmaDensity()) 
    sprintf(ctext,"z = %5.1f mm", Time * skindepth / PUnits::mm);
  else
    sprintf(ctext,"t = %5.1f #omega_{p}^{-1}",Time);
  textTime->AddText(ctext);
 
  TPaveText *textDen = new TPaveText(0.15,0.85,0.48,0.9,"NDC");
  PlasmaGlob::SetPaveTextStyle(textDen,12); 
  textDen->SetTextColor(kOrange+10);
  if(opt.Contains("units") && pData->GetPlasmaDensity())
    sprintf(ctext,"n_{0} = %5.2f x 10^{17} / cc", n0 / (1e17/PUnits::cm3));
  else if(pData->GetBeamDensity() && pData->GetPlasmaDensity())
    sprintf(ctext,"n_{b}/n_{0} = %5.2f", pData->GetBeamDensity()/n0);
  textDen->AddText(ctext);

  TPaveText *textWav = new TPaveText(0.15,0.2,0.48,0.25,"NDC");
  PlasmaGlob::SetPaveTextStyle(textWav,12); 
  textWav->SetTextColor(kGray+2);
  sprintf(ctext,"#lambda_{p} = %5.2f #mum", pData->GetPlasmaWaveLength() / PUnits::um);
  textWav->AddText(ctext);

  TPaveText *textCharge = new TPaveText(0.15,0.25,0.48,0.3,"NDC");
  PlasmaGlob::SetPaveTextStyle(textCharge,12); 
  textCharge->SetTextColor(kGray+2);
  if(opt.Contains("units") && pData->GetPlasmaDensity())
    sprintf(ctext,"Charge = %5.2f pC", Charge);
  else
    sprintf(ctext,"Charge = %5.2f n0#timeskp^{-3}", Charge);    
  textCharge->AddText(ctext);

  TPaveText *textMom = new TPaveText(0.55,0.03,0.82,0.13,"NDC");
  PlasmaGlob::SetPaveTextStyle(textMom,32); 
  textMom->SetTextColor(kGray+3);
  textMom->SetTextFont(62);
  if(opt.Contains("units") && pData->GetPlasmaDensity())
    sprintf(ctext,"#LTp_{z}#GT = %5.2f GeV/c", ymean);
  else
    sprintf(ctext,"Mom = %5.2f mc", ymean);    
  textMom->AddText(ctext);


  TPaveText *textInfo = new TPaveText(0.55,0.52,0.82,0.75,"NDC");
  PlasmaGlob::SetPaveTextStyle(textInfo,32); 
  textInfo->SetTextColor(kGray+2);
  textInfo->SetTextFont(42);
  sprintf(ctext,"Charge = %5.2f pC",Charge);
  textInfo->AddText(ctext);
  sprintf(ctext,"#LT#zeta#GT_{rms} = %5.2f #mum",xrms);
  textInfo->AddText(ctext);
  sprintf(ctext,"#LTp_{z}#GT_{rms} = %5.2f GeV/c",yrms);
  textInfo->AddText(ctext);
  // sprintf(ctext,"#epsilon_{N} = %5.2f #mum",emittance);
  // textInfo->AddText(ctext);
  
  // Setup Pad layout:
  const Int_t NFrames = 2;
  TPad **pad = new TPad*[NFrames];
  TH1F *hFrame[NFrames];

  Double_t lMargin = 0.15;
  Double_t rMargin = 0.18;
  Double_t bMargin = 0.15;
  Double_t tMargin = 0.04;
  Double_t vSpacing = 0.00; 
  Double_t hStep = (1.-lMargin-rMargin);
  Double_t vStep = (1.- bMargin - tMargin - (NFrames-1) * vSpacing) / NFrames;
  
  Float_t vposd = 0.0;
  Float_t vposu = 0.0;
  Float_t vmard = 0.0;
  Float_t vmaru = 0.0;
  Float_t vfactor = 0.0;
  Float_t hposl = 0.0;
  Float_t hposr = 1.0;
  Float_t hmarl = lMargin;
  Float_t hmarr = rMargin;
  Float_t hfactor = 1.0;
  
  // Actual Plotting!
  // ------------------------------------------------------------
  
  
  for(Int_t k=0;k<NFrames;k++) {

    // PLOTTING!
    if(k==0) {
      vposd = 0.0;
      vposu = bMargin + vStep;
      vfactor = vposu-vposd;  
      vmard = bMargin / vfactor;
      vmaru = 0.0;
    } else if(k == NFrames-1) {
      vposd = vposu + vSpacing;
      vposu = vposd + vStep + tMargin;
      vfactor = vposu-vposd;   
      vmard = 0.0;
      vmaru = tMargin / (vposu-vposd);
    } else {
      vposd = vposu + vSpacing;
      vposu = vposd + vStep; 
      vfactor = vposu-vposd;
      vmard = 0.0;
      vmaru = 0.0;
    } 
    hfactor = hposl-hposr;

    char name[16];
    sprintf(name,"pad_%i",k);
    pad[k] = new TPad(name,"",hposl,vposd,hposr,vposu);
    // // cout << Form("%f %f %f %f",hposl,vposd,hposr,vposu) << endl;
    // // cout << Form("%f %f %f %f",hmarl,vmard,hmarr,vmaru) << endl;
    pad[k]->SetLeftMargin(hmarl);
    pad[k]->SetRightMargin(hmarr);  
    pad[k]->SetBottomMargin(vmard);
    pad[k]->SetTopMargin(vmaru);
    pad[k]->SetFrameLineWidth(3);
    
    sprintf(name,"hFrame_%i",k);  
    hFrame[k] = (TH1F*) gROOT->FindObject(name);
    if(hFrame[k]) delete hFrame[k];
    hFrame[k] = (TH1F*) hX1->Clone(name);
    hFrame[k]->Reset();
    
    hFrame[k]->GetXaxis()->CenterTitle();
    hFrame[k]->GetYaxis()->CenterTitle();
    hFrame[k]->GetZaxis()->CenterTitle();
    hFrame[k]->SetLabelFont(42,"xyz");
    hFrame[k]->SetTitleFont(42,"xyz");
  
    hFrame[k]->SetNdivisions(505,"xyz");
  
    hFrame[k]->SetTickLength(0.04,"xyz");
    hFrame[k]->SetTickLength(0.04*vfactor,"y");
  
    hFrame[k]->GetYaxis()->SetLabelSize(0.04/vfactor);
    hFrame[k]->GetYaxis()->SetLabelOffset(0.02);
  
    hFrame[k]->GetYaxis()->SetTitleSize(0.05/vfactor);
    hFrame[k]->GetYaxis()->SetTitleOffset(1.2*vfactor);

    if(k==0) {  
      hFrame[k]->GetXaxis()->SetLabelSize(0.08);
      hFrame[k]->GetXaxis()->SetLabelOffset(0.02);
      hFrame[k]->GetXaxis()->SetTitleSize(0.12);
      hFrame[k]->GetXaxis()->SetTitleOffset(1.0);
    } else {
      hFrame[k]->GetXaxis()->SetLabelSize(0.0);
      hFrame[k]->GetXaxis()->SetTitleSize(0.0);
    }


  }

  // Ranges!!
  Double_t yMin =  999.9;
  Double_t yMax =  -999.9;
  for(Int_t k=0;k<SNbin;k++) {
    if(semittance[k]<yMin)
      yMin = semittance[k];
    
    if(semittance[k]>yMax)
      yMax = semittance[k];

    if(sErms[k]<yMin)
      yMin = sErms[k];
    
    if(sErms[k]>yMax)
      yMax = sErms[k];
  }

  for(Int_t k=1;k<=xNbin;k++) {
    Double_t value = hX1->GetBinContent(k);
    if(value<yMin)
      yMin = value;
    
    if(value>yMax)
      yMax = value;

  }
  
  C->cd();

  pad[1]->Draw();
  pad[1]->cd();

  if(opt.Contains("logz")) {
    gPad->SetLogz(1);
  } else {
    gPad->SetLogz(0);
  }
  
  hFrame[1]->GetYaxis()->SetRangeUser(hP1X1->GetYaxis()->GetXmin(),hP1X1->GetYaxis()->GetXmax());

  if(opt.Contains("units"))
    hFrame[1]->GetYaxis()->SetTitle("p_{z} [GeV/c]");
  
  hFrame[1]->Draw();

  gP1left->SetLineWidth(2);
  gP1left->Draw("F");
  gP1left->Draw("L");

  TLine lZmean(xmean,hP1X1->GetYaxis()->GetXmin(),xmean,hP1X1->GetYaxis()->GetXmax());
  lZmean.SetLineColor(kGray+2);
  lZmean.SetLineStyle(2);
  lZmean.Draw();

  TLine lPmean(hP1X1->GetXaxis()->GetXmin(),ymean,hP1X1->GetXaxis()->GetXmax(),ymean);
  lPmean.SetLineColor(kGray+2);
  lPmean.SetLineStyle(2);
  lPmean.Draw();


  hP1X1->GetYaxis()->SetNdivisions(503);
  hP1X1->GetZaxis()->SetNdivisions(503);
  hP1X1->GetZaxis()->SetRangeUser(0.001*hP1X1->GetMaximum(),hP1X1->GetMaximum());
  hP1X1->GetZaxis()->SetLabelSize(0.05);
  hP1X1->GetZaxis()->SetTitleSize(0.04);
  hP1X1->GetZaxis()->SetTitleFont(42);

  hP1X1->Draw("colzsame");
  // hP1X1->SetContour(20);
  // hP1X1->Draw("contzsame");
  // hP1X1prof->SetMarkerStyle(1);
  // hP1X1prof->SetLineWidth(2);
  // hP1X1prof->Draw("zsame");

  //hP1->Draw("C");
  
  gPad->Update();

  TPaletteAxis *palette = (TPaletteAxis*)hP1X1->GetListOfFunctions()->FindObject("palette");
  if(palette) {
    Float_t y1 = gPad->GetBottomMargin();
    Float_t y2 = 1 - gPad->GetTopMargin();
    Float_t x1 = 1 - gPad->GetRightMargin();
    palette->SetY2NDC(y2 - 0.04);
    palette->SetY1NDC(y1 + 0.04);
    palette->SetX1NDC(x1 + 0.01);
    palette->SetX2NDC(x1 + 0.04);
    
    palette->SetLabelFont(42);
    
    palette->SetLabelSize(0.08);
    //palette->SetLabelOffset(0.005/vfactor);
    palette->SetTitleSize(0.10);
    //    palette->SetTitleOffset(9999.0*vfactor);
    palette->SetTitleOffset(0.6);
    
    palette->SetBorderSize(2);
    palette->SetLineColor(1);
  }


  textTime->Draw();
  textInfo->Draw();
  // textCharge->Draw();
  textMom->Draw();
   
  gPad->RedrawAxis(); 

  // Bottom plot -----------------------------------------

  C->cd();

  pad[0]->Draw();
  pad[0]->cd();

  hFrame[0]->GetYaxis()->SetRangeUser(0.0,1.1*yMax);
  hFrame[0]->Draw();
    

  hX1->SetLineWidth(2);
  hX1->SetFillStyle(1001);
  hX1->SetFillColor(PlasmaGlob::elecFill);
  // hX1->SetLineColor(kBlue);
  hX1->Draw("FL same");
  //hX1->Draw("C");

  TLine lZmean2(xmean,0.0,xmean,1.1*yMax);
  lZmean2.SetLineColor(kGray+2);
  lZmean2.SetLineStyle(2);
  lZmean2.Draw();

  Int_t markerSize = 1.2; 
  Int_t lineWidth  = 2.0;   

  gYrms->SetMarkerStyle(20);
  gYrms->SetLineStyle(1);
  gYrms->SetMarkerColor(kGray+1);
  gYrms->SetMarkerSize(markerSize); 
  gYrms->SetLineColor(kGray+1);
  gYrms->SetLineWidth(lineWidth);
  gYrms->Draw("PL");
  
  // hP2X2sl[0]->Draw("colz");
  gemit->SetMarkerStyle(20);
  //  gemit->SetMarkerColor(kMagenta-2);
  gemit->SetMarkerColor(kGray+2);
  gemit->SetMarkerSize(markerSize);
  gemit->SetLineWidth(lineWidth);
  gemit->SetLineColor(kGray+2);
  gemit->Draw("PL");

  gErms->SetMarkerStyle(20);
  gErms->SetMarkerSize(markerSize);
  gErms->SetMarkerColor(kOrange+10);
  gErms->SetLineColor(kOrange+10);
  gErms->SetLineWidth(lineWidth);
  gErms->Draw("PL");


  TLegend *Leg;
  if(!sim.Contains("DR")) 
    Leg=new TLegend(0.55,0.60,1 - gPad->GetRightMargin() - 0.02,0.95);
  else
    Leg=new TLegend(gPad->GetLeftMargin() + 0.02, 1.0-gPad->GetTopMargin()-0.20,
		    gPad->GetLeftMargin() + 0.30, 1.0-gPad->GetTopMargin()-0.02);
  
  
  PlasmaGlob::SetPaveStyle(Leg);
  Leg->SetTextAlign(12);
  Leg->SetTextColor(kGray+3);
  Leg->SetTextFont(42);
  Leg->SetLineColor(1);
  Leg->SetBorderSize(0);
  Leg->SetFillColor(0);
  Leg->SetFillStyle(1001);
  Leg->SetFillStyle(0); // Hollow
 
  Leg->AddEntry(hX1  ,"Current [kA]","L");
  //  Leg->AddEntry(gErms,"Energy spread (GeV)","PL");
  Leg->AddEntry(gErms,"Energy spread [%]","PL");
  Leg->AddEntry(gemit,"Emittance [#mum]","PL");
  Leg->AddEntry(gYrms,"Bunch width [#mum]","PL");
 
  Leg->Draw();

  gPad->RedrawAxis(); 

  gPad->Update();
  

  // Print to file --------------------------------------
  
  C->cd();
  
  // Print to a file
  // Output file
  TString fOutName = Form("./%s/Plots/RakeBunch/RakeBunch",sim.Data());
  fOutName += Form("-%s_%i",sim.Data(),time);

  PlasmaGlob::imgconv(C,fOutName,opt);
  // ---------------------------------------------------------
  
}
void DarkSusy_mH_125_mGammaD_2000_cT_100_LHE_gammaD_Phi()
{
//=========Macro generated from canvas: cnv/cnv
//=========  (Sun May 24 15:18:26 2015) by ROOT version6.02/05
   TCanvas *cnv = new TCanvas("cnv", "cnv",1,1,904,904);
   gStyle->SetOptFit(1);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   cnv->SetHighLightColor(2);
   cnv->Range(-5.7,-0.00509322,4.3,0.03408539);
   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_gammaD_1_Phi_dummy80 = new TH1F("h_gammaD_1_Phi_dummy80","h_gammaD_1_Phi_dummy",80,-4,4);
   h_gammaD_1_Phi_dummy80->SetMaximum(0.03134289);
   h_gammaD_1_Phi_dummy80->SetLineStyle(0);
   h_gammaD_1_Phi_dummy80->SetMarkerStyle(20);
   h_gammaD_1_Phi_dummy80->GetXaxis()->SetTitle("#phi of #gamma_{D} [rad]");
   h_gammaD_1_Phi_dummy80->GetXaxis()->SetLabelFont(42);
   h_gammaD_1_Phi_dummy80->GetXaxis()->SetLabelOffset(0.007);
   h_gammaD_1_Phi_dummy80->GetXaxis()->SetTitleSize(0.06);
   h_gammaD_1_Phi_dummy80->GetXaxis()->SetTitleOffset(0.95);
   h_gammaD_1_Phi_dummy80->GetXaxis()->SetTitleFont(42);
   h_gammaD_1_Phi_dummy80->GetYaxis()->SetTitle("Fraction of events / 0.1 rad");
   h_gammaD_1_Phi_dummy80->GetYaxis()->SetLabelFont(42);
   h_gammaD_1_Phi_dummy80->GetYaxis()->SetLabelOffset(0.007);
   h_gammaD_1_Phi_dummy80->GetYaxis()->SetTitleSize(0.06);
   h_gammaD_1_Phi_dummy80->GetYaxis()->SetTitleOffset(1.35);
   h_gammaD_1_Phi_dummy80->GetYaxis()->SetTitleFont(42);
   h_gammaD_1_Phi_dummy80->GetZaxis()->SetLabelFont(42);
   h_gammaD_1_Phi_dummy80->GetZaxis()->SetLabelOffset(0.007);
   h_gammaD_1_Phi_dummy80->GetZaxis()->SetTitleSize(0.06);
   h_gammaD_1_Phi_dummy80->GetZaxis()->SetTitleFont(42);
   h_gammaD_1_Phi_dummy80->Draw("");
   
   TH1F *h_gammaD_1_Phi81 = new TH1F("h_gammaD_1_Phi81","h_gammaD_1_Phi",80,-4,4);
   h_gammaD_1_Phi81->SetBinContent(9,0.006925086);
   h_gammaD_1_Phi81->SetBinContent(10,0.01741272);
   h_gammaD_1_Phi81->SetBinContent(11,0.01686271);
   h_gammaD_1_Phi81->SetBinContent(12,0.0160377);
   h_gammaD_1_Phi81->SetBinContent(13,0.01707521);
   h_gammaD_1_Phi81->SetBinContent(14,0.01660021);
   h_gammaD_1_Phi81->SetBinContent(15,0.01686271);
   h_gammaD_1_Phi81->SetBinContent(16,0.0161002);
   h_gammaD_1_Phi81->SetBinContent(17,0.0160127);
   h_gammaD_1_Phi81->SetBinContent(18,0.01698771);
   h_gammaD_1_Phi81->SetBinContent(19,0.0159127);
   h_gammaD_1_Phi81->SetBinContent(20,0.0160377);
   h_gammaD_1_Phi81->SetBinContent(21,0.0160252);
   h_gammaD_1_Phi81->SetBinContent(22,0.0162752);
   h_gammaD_1_Phi81->SetBinContent(23,0.0158877);
   h_gammaD_1_Phi81->SetBinContent(24,0.0161627);
   h_gammaD_1_Phi81->SetBinContent(25,0.01555019);
   h_gammaD_1_Phi81->SetBinContent(26,0.0159502);
   h_gammaD_1_Phi81->SetBinContent(27,0.0161252);
   h_gammaD_1_Phi81->SetBinContent(28,0.0158502);
   h_gammaD_1_Phi81->SetBinContent(29,0.01641271);
   h_gammaD_1_Phi81->SetBinContent(30,0.0161877);
   h_gammaD_1_Phi81->SetBinContent(31,0.01667521);
   h_gammaD_1_Phi81->SetBinContent(32,0.0156127);
   h_gammaD_1_Phi81->SetBinContent(33,0.01521269);
   h_gammaD_1_Phi81->SetBinContent(34,0.0158377);
   h_gammaD_1_Phi81->SetBinContent(35,0.0156252);
   h_gammaD_1_Phi81->SetBinContent(36,0.0157127);
   h_gammaD_1_Phi81->SetBinContent(37,0.01526269);
   h_gammaD_1_Phi81->SetBinContent(38,0.0162752);
   h_gammaD_1_Phi81->SetBinContent(39,0.01507519);
   h_gammaD_1_Phi81->SetBinContent(40,0.0158002);
   h_gammaD_1_Phi81->SetBinContent(41,0.01682521);
   h_gammaD_1_Phi81->SetBinContent(42,0.01663771);
   h_gammaD_1_Phi81->SetBinContent(43,0.0160752);
   h_gammaD_1_Phi81->SetBinContent(44,0.01547519);
   h_gammaD_1_Phi81->SetBinContent(45,0.01653771);
   h_gammaD_1_Phi81->SetBinContent(46,0.0163377);
   h_gammaD_1_Phi81->SetBinContent(47,0.0157627);
   h_gammaD_1_Phi81->SetBinContent(48,0.0159002);
   h_gammaD_1_Phi81->SetBinContent(49,0.01653771);
   h_gammaD_1_Phi81->SetBinContent(50,0.0157002);
   h_gammaD_1_Phi81->SetBinContent(51,0.0160877);
   h_gammaD_1_Phi81->SetBinContent(52,0.0157377);
   h_gammaD_1_Phi81->SetBinContent(53,0.01538769);
   h_gammaD_1_Phi81->SetBinContent(54,0.0163627);
   h_gammaD_1_Phi81->SetBinContent(55,0.01515019);
   h_gammaD_1_Phi81->SetBinContent(56,0.0163377);
   h_gammaD_1_Phi81->SetBinContent(57,0.01542519);
   h_gammaD_1_Phi81->SetBinContent(58,0.01475018);
   h_gammaD_1_Phi81->SetBinContent(59,0.01462518);
   h_gammaD_1_Phi81->SetBinContent(60,0.01502519);
   h_gammaD_1_Phi81->SetBinContent(61,0.0156252);
   h_gammaD_1_Phi81->SetBinContent(62,0.01498769);
   h_gammaD_1_Phi81->SetBinContent(63,0.01530019);
   h_gammaD_1_Phi81->SetBinContent(64,0.0157377);
   h_gammaD_1_Phi81->SetBinContent(65,0.01555019);
   h_gammaD_1_Phi81->SetBinContent(66,0.0157002);
   h_gammaD_1_Phi81->SetBinContent(67,0.01483769);
   h_gammaD_1_Phi81->SetBinContent(68,0.0156127);
   h_gammaD_1_Phi81->SetBinContent(69,0.01525019);
   h_gammaD_1_Phi81->SetBinContent(70,0.0159002);
   h_gammaD_1_Phi81->SetBinContent(71,0.0158502);
   h_gammaD_1_Phi81->SetBinContent(72,0.006625083);
   h_gammaD_1_Phi81->SetBinError(9,0.0002942187);
   h_gammaD_1_Phi81->SetBinError(10,0.0004665423);
   h_gammaD_1_Phi81->SetBinError(11,0.0004591149);
   h_gammaD_1_Phi81->SetBinError(12,0.000447743);
   h_gammaD_1_Phi81->SetBinError(13,0.0004619987);
   h_gammaD_1_Phi81->SetBinError(14,0.0004555274);
   h_gammaD_1_Phi81->SetBinError(15,0.0004591149);
   h_gammaD_1_Phi81->SetBinError(16,0.0004486146);
   h_gammaD_1_Phi81->SetBinError(17,0.0004473938);
   h_gammaD_1_Phi81->SetBinError(18,0.0004608135);
   h_gammaD_1_Phi81->SetBinError(19,0.0004459946);
   h_gammaD_1_Phi81->SetBinError(20,0.000447743);
   h_gammaD_1_Phi81->SetBinError(21,0.0004475684);
   h_gammaD_1_Phi81->SetBinError(22,0.0004510461);
   h_gammaD_1_Phi81->SetBinError(23,0.0004456442);
   h_gammaD_1_Phi81->SetBinError(24,0.0004494845);
   h_gammaD_1_Phi81->SetBinError(25,0.0004408853);
   h_gammaD_1_Phi81->SetBinError(26,0.0004465199);
   h_gammaD_1_Phi81->SetBinError(27,0.0004489627);
   h_gammaD_1_Phi81->SetBinError(28,0.0004451179);
   h_gammaD_1_Phi81->SetBinError(29,0.0004529474);
   h_gammaD_1_Phi81->SetBinError(30,0.000449832);
   h_gammaD_1_Phi81->SetBinError(31,0.0004565553);
   h_gammaD_1_Phi81->SetBinError(32,0.0004417704);
   h_gammaD_1_Phi81->SetBinError(33,0.0004360745);
   h_gammaD_1_Phi81->SetBinError(34,0.0004449424);
   h_gammaD_1_Phi81->SetBinError(35,0.0004419473);
   h_gammaD_1_Phi81->SetBinError(36,0.000443183);
   h_gammaD_1_Phi81->SetBinError(37,0.0004367906);
   h_gammaD_1_Phi81->SetBinError(38,0.0004510461);
   h_gammaD_1_Phi81->SetBinError(39,0.0004340993);
   h_gammaD_1_Phi81->SetBinError(40,0.0004444153);
   h_gammaD_1_Phi81->SetBinError(41,0.0004586041);
   h_gammaD_1_Phi81->SetBinError(42,0.0004560416);
   h_gammaD_1_Phi81->SetBinError(43,0.0004482661);
   h_gammaD_1_Phi81->SetBinError(44,0.0004398208);
   h_gammaD_1_Phi81->SetBinError(45,0.000454669);
   h_gammaD_1_Phi81->SetBinError(46,0.0004519113);
   h_gammaD_1_Phi81->SetBinError(47,0.0004438876);
   h_gammaD_1_Phi81->SetBinError(48,0.0004458194);
   h_gammaD_1_Phi81->SetBinError(49,0.000454669);
   h_gammaD_1_Phi81->SetBinError(50,0.0004430067);
   h_gammaD_1_Phi81->SetBinError(51,0.0004484404);
   h_gammaD_1_Phi81->SetBinError(52,0.0004435354);
   h_gammaD_1_Phi81->SetBinError(53,0.0004385756);
   h_gammaD_1_Phi81->SetBinError(54,0.000452257);
   h_gammaD_1_Phi81->SetBinError(55,0.0004351778);
   h_gammaD_1_Phi81->SetBinError(56,0.0004519113);
   h_gammaD_1_Phi81->SetBinError(57,0.0004391097);
   h_gammaD_1_Phi81->SetBinError(58,0.0004293945);
   h_gammaD_1_Phi81->SetBinError(59,0.0004275711);
   h_gammaD_1_Phi81->SetBinError(60,0.0004333788);
   h_gammaD_1_Phi81->SetBinError(61,0.0004419473);
   h_gammaD_1_Phi81->SetBinError(62,0.0004328377);
   h_gammaD_1_Phi81->SetBinError(63,0.0004373269);
   h_gammaD_1_Phi81->SetBinError(64,0.0004435354);
   h_gammaD_1_Phi81->SetBinError(65,0.0004408853);
   h_gammaD_1_Phi81->SetBinError(66,0.0004430067);
   h_gammaD_1_Phi81->SetBinError(67,0.0004306662);
   h_gammaD_1_Phi81->SetBinError(68,0.0004417704);
   h_gammaD_1_Phi81->SetBinError(69,0.0004366117);
   h_gammaD_1_Phi81->SetBinError(70,0.0004458194);
   h_gammaD_1_Phi81->SetBinError(71,0.0004451179);
   h_gammaD_1_Phi81->SetBinError(72,0.0002877752);
   h_gammaD_1_Phi81->SetEntries(79999);
   h_gammaD_1_Phi81->SetDirectory(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#0000ff");
   h_gammaD_1_Phi81->SetLineColor(ci);
   h_gammaD_1_Phi81->SetLineWidth(2);
   h_gammaD_1_Phi81->SetMarkerStyle(20);
   h_gammaD_1_Phi81->GetXaxis()->SetLabelFont(42);
   h_gammaD_1_Phi81->GetXaxis()->SetLabelOffset(0.007);
   h_gammaD_1_Phi81->GetXaxis()->SetTitleSize(0.06);
   h_gammaD_1_Phi81->GetXaxis()->SetTitleOffset(0.95);
   h_gammaD_1_Phi81->GetXaxis()->SetTitleFont(42);
   h_gammaD_1_Phi81->GetYaxis()->SetLabelFont(42);
   h_gammaD_1_Phi81->GetYaxis()->SetLabelOffset(0.007);
   h_gammaD_1_Phi81->GetYaxis()->SetTitleSize(0.06);
   h_gammaD_1_Phi81->GetYaxis()->SetTitleOffset(1.3);
   h_gammaD_1_Phi81->GetYaxis()->SetTitleFont(42);
   h_gammaD_1_Phi81->GetZaxis()->SetLabelFont(42);
   h_gammaD_1_Phi81->GetZaxis()->SetLabelOffset(0.007);
   h_gammaD_1_Phi81->GetZaxis()->SetTitleSize(0.06);
   h_gammaD_1_Phi81->GetZaxis()->SetTitleFont(42);
   h_gammaD_1_Phi81->Draw("SAMEHIST");
   
   TH1F *h_gammaD_2_Phi82 = new TH1F("h_gammaD_2_Phi82","h_gammaD_2_Phi",80,-4,4);
   h_gammaD_2_Phi82->SetBinContent(9,0.007087589);
   h_gammaD_2_Phi82->SetBinContent(10,0.0164002);
   h_gammaD_2_Phi82->SetBinContent(11,0.01767522);
   h_gammaD_2_Phi82->SetBinContent(12,0.01652521);
   h_gammaD_2_Phi82->SetBinContent(13,0.01690021);
   h_gammaD_2_Phi82->SetBinContent(14,0.01672521);
   h_gammaD_2_Phi82->SetBinContent(15,0.0164002);
   h_gammaD_2_Phi82->SetBinContent(16,0.01701271);
   h_gammaD_2_Phi82->SetBinContent(17,0.0163627);
   h_gammaD_2_Phi82->SetBinContent(18,0.01655021);
   h_gammaD_2_Phi82->SetBinContent(19,0.01680021);
   h_gammaD_2_Phi82->SetBinContent(20,0.0163627);
   h_gammaD_2_Phi82->SetBinContent(21,0.0163377);
   h_gammaD_2_Phi82->SetBinContent(22,0.0160252);
   h_gammaD_2_Phi82->SetBinContent(23,0.01531269);
   h_gammaD_2_Phi82->SetBinContent(24,0.0157502);
   h_gammaD_2_Phi82->SetBinContent(25,0.01515019);
   h_gammaD_2_Phi82->SetBinContent(26,0.0160752);
   h_gammaD_2_Phi82->SetBinContent(27,0.0160252);
   h_gammaD_2_Phi82->SetBinContent(28,0.0158627);
   h_gammaD_2_Phi82->SetBinContent(29,0.01528769);
   h_gammaD_2_Phi82->SetBinContent(30,0.01555019);
   h_gammaD_2_Phi82->SetBinContent(31,0.0156377);
   h_gammaD_2_Phi82->SetBinContent(32,0.01513769);
   h_gammaD_2_Phi82->SetBinContent(33,0.0162502);
   h_gammaD_2_Phi82->SetBinContent(34,0.01548769);
   h_gammaD_2_Phi82->SetBinContent(35,0.0157252);
   h_gammaD_2_Phi82->SetBinContent(36,0.01558769);
   h_gammaD_2_Phi82->SetBinContent(37,0.01522519);
   h_gammaD_2_Phi82->SetBinContent(38,0.0158377);
   h_gammaD_2_Phi82->SetBinContent(39,0.01533769);
   h_gammaD_2_Phi82->SetBinContent(40,0.0158377);
   h_gammaD_2_Phi82->SetBinContent(41,0.0162627);
   h_gammaD_2_Phi82->SetBinContent(42,0.01557519);
   h_gammaD_2_Phi82->SetBinContent(43,0.01702521);
   h_gammaD_2_Phi82->SetBinContent(44,0.0159127);
   h_gammaD_2_Phi82->SetBinContent(45,0.0159627);
   h_gammaD_2_Phi82->SetBinContent(46,0.0159377);
   h_gammaD_2_Phi82->SetBinContent(47,0.01535019);
   h_gammaD_2_Phi82->SetBinContent(48,0.0161877);
   h_gammaD_2_Phi82->SetBinContent(49,0.01671271);
   h_gammaD_2_Phi82->SetBinContent(50,0.01546269);
   h_gammaD_2_Phi82->SetBinContent(51,0.0159002);
   h_gammaD_2_Phi82->SetBinContent(52,0.01558769);
   h_gammaD_2_Phi82->SetBinContent(53,0.01558769);
   h_gammaD_2_Phi82->SetBinContent(54,0.01505019);
   h_gammaD_2_Phi82->SetBinContent(55,0.0159627);
   h_gammaD_2_Phi82->SetBinContent(56,0.01482519);
   h_gammaD_2_Phi82->SetBinContent(57,0.01551269);
   h_gammaD_2_Phi82->SetBinContent(58,0.0159252);
   h_gammaD_2_Phi82->SetBinContent(59,0.01558769);
   h_gammaD_2_Phi82->SetBinContent(60,0.01545019);
   h_gammaD_2_Phi82->SetBinContent(61,0.01461268);
   h_gammaD_2_Phi82->SetBinContent(62,0.01506269);
   h_gammaD_2_Phi82->SetBinContent(63,0.0159502);
   h_gammaD_2_Phi82->SetBinContent(64,0.01476268);
   h_gammaD_2_Phi82->SetBinContent(65,0.01542519);
   h_gammaD_2_Phi82->SetBinContent(66,0.01673771);
   h_gammaD_2_Phi82->SetBinContent(67,0.0161002);
   h_gammaD_2_Phi82->SetBinContent(68,0.0156377);
   h_gammaD_2_Phi82->SetBinContent(69,0.01558769);
   h_gammaD_2_Phi82->SetBinContent(70,0.01535019);
   h_gammaD_2_Phi82->SetBinContent(71,0.01777522);
   h_gammaD_2_Phi82->SetBinContent(72,0.006975087);
   h_gammaD_2_Phi82->SetBinError(9,0.0002976507);
   h_gammaD_2_Phi82->SetBinError(10,0.0004527749);
   h_gammaD_2_Phi82->SetBinError(11,0.0004700458);
   h_gammaD_2_Phi82->SetBinError(12,0.0004544972);
   h_gammaD_2_Phi82->SetBinError(13,0.0004596252);
   h_gammaD_2_Phi82->SetBinError(14,0.0004572392);
   h_gammaD_2_Phi82->SetBinError(15,0.0004527749);
   h_gammaD_2_Phi82->SetBinError(16,0.0004611524);
   h_gammaD_2_Phi82->SetBinError(17,0.000452257);
   h_gammaD_2_Phi82->SetBinError(18,0.0004548408);
   h_gammaD_2_Phi82->SetBinError(19,0.0004582633);
   h_gammaD_2_Phi82->SetBinError(20,0.000452257);
   h_gammaD_2_Phi82->SetBinError(21,0.0004519113);
   h_gammaD_2_Phi82->SetBinError(22,0.0004475684);
   h_gammaD_2_Phi82->SetBinError(23,0.0004375055);
   h_gammaD_2_Phi82->SetBinError(24,0.0004437115);
   h_gammaD_2_Phi82->SetBinError(25,0.0004351778);
   h_gammaD_2_Phi82->SetBinError(26,0.0004482661);
   h_gammaD_2_Phi82->SetBinError(27,0.0004475684);
   h_gammaD_2_Phi82->SetBinError(28,0.0004452934);
   h_gammaD_2_Phi82->SetBinError(29,0.0004371482);
   h_gammaD_2_Phi82->SetBinError(30,0.0004408853);
   h_gammaD_2_Phi82->SetBinError(31,0.000442124);
   h_gammaD_2_Phi82->SetBinError(32,0.0004349983);
   h_gammaD_2_Phi82->SetBinError(33,0.0004506995);
   h_gammaD_2_Phi82->SetBinError(34,0.0004399984);
   h_gammaD_2_Phi82->SetBinError(35,0.0004433592);
   h_gammaD_2_Phi82->SetBinError(36,0.0004414166);
   h_gammaD_2_Phi82->SetBinError(37,0.0004362537);
   h_gammaD_2_Phi82->SetBinError(38,0.0004449424);
   h_gammaD_2_Phi82->SetBinError(39,0.0004378625);
   h_gammaD_2_Phi82->SetBinError(40,0.0004449424);
   h_gammaD_2_Phi82->SetBinError(41,0.0004508729);
   h_gammaD_2_Phi82->SetBinError(42,0.0004412396);
   h_gammaD_2_Phi82->SetBinError(43,0.0004613218);
   h_gammaD_2_Phi82->SetBinError(44,0.0004459946);
   h_gammaD_2_Phi82->SetBinError(45,0.0004466948);
   h_gammaD_2_Phi82->SetBinError(46,0.0004463449);
   h_gammaD_2_Phi82->SetBinError(47,0.0004380409);
   h_gammaD_2_Phi82->SetBinError(48,0.000449832);
   h_gammaD_2_Phi82->SetBinError(49,0.0004570683);
   h_gammaD_2_Phi82->SetBinError(50,0.0004396431);
   h_gammaD_2_Phi82->SetBinError(51,0.0004458194);
   h_gammaD_2_Phi82->SetBinError(52,0.0004414166);
   h_gammaD_2_Phi82->SetBinError(53,0.0004414166);
   h_gammaD_2_Phi82->SetBinError(54,0.0004337392);
   h_gammaD_2_Phi82->SetBinError(55,0.0004466948);
   h_gammaD_2_Phi82->SetBinError(56,0.0004304848);
   h_gammaD_2_Phi82->SetBinError(57,0.0004403534);
   h_gammaD_2_Phi82->SetBinError(58,0.0004461698);
   h_gammaD_2_Phi82->SetBinError(59,0.0004414166);
   h_gammaD_2_Phi82->SetBinError(60,0.0004394654);
   h_gammaD_2_Phi82->SetBinError(61,0.0004273884);
   h_gammaD_2_Phi82->SetBinError(62,0.0004339193);
   h_gammaD_2_Phi82->SetBinError(63,0.0004465199);
   h_gammaD_2_Phi82->SetBinError(64,0.0004295764);
   h_gammaD_2_Phi82->SetBinError(65,0.0004391097);
   h_gammaD_2_Phi82->SetBinError(66,0.0004574101);
   h_gammaD_2_Phi82->SetBinError(67,0.0004486146);
   h_gammaD_2_Phi82->SetBinError(68,0.000442124);
   h_gammaD_2_Phi82->SetBinError(69,0.0004414166);
   h_gammaD_2_Phi82->SetBinError(70,0.0004380409);
   h_gammaD_2_Phi82->SetBinError(71,0.0004713736);
   h_gammaD_2_Phi82->SetBinError(72,0.000295279);
   h_gammaD_2_Phi82->SetEntries(79999);
   h_gammaD_2_Phi82->SetDirectory(0);

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

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

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   
   leg = new TLegend(0.4566667,0.82,0.7822222,0.9066667,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.02777778);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   entry=leg->AddEntry("NULL","#splitline{pp #rightarrow h #rightarrow 2n_{1} #rightarrow 2n_{D} + 2 #gamma_{D} #rightarrow 2n_{D} + 4#mu}{#splitline{m_{h} = 125 GeV, m_{n_{1}} = 50 GeV, m_{n_{D}} = 1 GeV}{m_{#gamma_{D}} = 20 GeV, c#tau_{#gamma_{D}} = 100 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);
}
Exemplo n.º 16
0
void fitSignalShapeW(int massBin,int id, int channels,int categ, int sample, 
		     /* float lumi, bool doSfLepton, */double rangeLow, double rangeHigh,
		     double bwSigma,
		     double fitValues[9], double fitErrors[9], double covQual[1]){
 // ------ root settings ---------
  gROOT->Reset();  
  gROOT->SetStyle("Plain");
  gStyle->SetPadGridX(kFALSE);
  gStyle->SetPadGridY(kFALSE);
  //gStyle->SetOptStat("kKsSiourRmMen");
  gStyle->SetOptStat("iourme");
  //gStyle->SetOptStat("rme");
  //gStyle->SetOptStat("");
  gStyle->SetOptFit(11);
  gStyle->SetPadLeftMargin(0.14);
  gStyle->SetPadRightMargin(0.06);
  // ------------------------------ 

  ROOT::Math::MinimizerOptions::SetDefaultTolerance( 1.E-7);

  stringstream FileName;
  //Insert the file here
  if(sample==1) FileName <<"root://lxcms03//data3/Higgs/150915/ZH125/ZZ4lAnalysis.root" ;
  else if(sample==2) FileName << "root://lxcms03//data3/Higgs/150915/WplusH125/ZZ4lAnalysis.root";
  else if(sample==3) FileName << "root://lxcms03//data3/Higgs/150915/WminusH125/ZZ4lAnalysis.root";
  else if(sample==4) FileName << "root://lxcms03//data3/Higgs/150915/ttH125/ZZ4lAnalysis.root";
  else {
    cout << "Wrong sample." << endl;
    return;
  }
    

  cout << "Using " << FileName.str() << endl;
  
 
  TFile* ggFile = TFile::Open(FileName.str().c_str()); 

  TTree* ggTree = (TTree*) ggFile->Get("ZZTree/candTree");

  float m4l;
  
  Short_t z1flav, z2flav; 
  float weight;

  Short_t nExtraLeptons;   
  float ZZPt;
  Short_t nJets;
  Short_t nBTaggedJets;
  std::vector<float> * jetpt = 0;
  std::vector<float> * jeteta = 0;
  std::vector<float> * jetphi = 0;
  std::vector<float> * jetmass = 0;
  float jet30pt[10];
  float jet30eta[10];
  float jet30phi[10];
  float jet30mass[10];
  float Fisher;
  
  int  nentries = ggTree->GetEntries();
 
  //--- ggTree part
  ggTree->SetBranchAddress("ZZMass",&m4l);
  ggTree->SetBranchAddress("Z1Flav",&z1flav);
  ggTree->SetBranchAddress("Z2Flav",&z2flav);
  ggTree->SetBranchAddress("genHEPMCweight",&weight);
  ggTree->SetBranchAddress("nExtraLep",&nExtraLeptons);
  ggTree->SetBranchAddress("nCleanedJets",&nJets);
  ggTree->SetBranchAddress("nCleanedJetsPt30BTagged",&nBTaggedJets);
  ggTree->SetBranchAddress("DiJetFisher",&Fisher);
  
  ggTree->SetBranchAddress("JetPt",&jetpt);
  ggTree->SetBranchAddress("JetEta",&jeteta);
  ggTree->SetBranchAddress("JetPhi",&jetphi);
  ggTree->SetBranchAddress("JetMass",&jetmass);
  ggTree->SetBranchAddress("ZZPt",&ZZPt);

  //--- rooFit part
  double xMin,xMax,xInit;
  xInit = (double) massBin;
  xMin = rangeLow;
  xMax = rangeHigh ;
  cout << "Fit range: [" << xMin << " , " << xMax << "]. Init value = " << xInit << endl;
  
  TH1F *hmass = new TH1F("hmass","hmass",200,xMin,xMax);
  //---------  
  RooRealVar x("mass","m_{4l}",xInit,xMin,xMax,"GeV");
  RooRealVar w("myW","myW",1.0,0.,1000.);
  RooArgSet ntupleVarSet(x,w);
  RooDataSet dataset("mass4l","mass4l",ntupleVarSet,WeightVar("myW"));

  for(int k=0; k<nentries; k++){
    ggTree->GetEvent(k);

    int njet30 = 0;
    for (unsigned int ijet = 0; ijet < jetpt->size(); ijet++) { 
      if ( (*jetpt)[ijet] > 30. ) {
	jet30pt[njet30] = (*jetpt)[ijet];      
	jet30eta[njet30] = (*jeteta)[ijet];
	jet30phi[njet30] = (*jetphi)[ijet];
	jet30mass[njet30] = (*jetmass)[ijet];
	njet30++;
      }
    }  
    int Cat = category(nExtraLeptons, ZZPt, m4l, njet30, nBTaggedJets, jet30pt, jet30eta, jet30phi,jet30mass, Fisher); 
    if (categ >= 0 && categ != Cat ) continue;

 
    if(channels==0 && z1flav*z2flav != 28561) continue;
    if(channels==1 && z1flav*z2flav != 14641) continue;
    if (weight <= 0 ) cout << "Warning! Negative weight events" << endl;
    if(channels==2 && z1flav*z2flav != 20449) continue;
    

    ntupleVarSet.setRealValue("mass",m4l);
    ntupleVarSet.setRealValue("myW",weight);
    if(x.getVal()>xMin && x.getVal()<xMax)
      dataset.add(ntupleVarSet, weight);
    hmass->Fill(m4l);

  }
  //---------

  cout << "dataset n entries: " << dataset.sumEntries() << endl;


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


  c1->cd();

  TPad *pad1 = new TPad("pad1","This is pad1",0.05,0.35,0.95,0.97);
  pad1->Draw();
  TPad *pad2 = new TPad("pad2","This is pad2",0.05,0.02,0.95,0.35);
  pad2->Draw();

  //--- double CrystalBall
  RooRealVar mean("bias","mean of gaussian",0,-5.,5.) ;
  RooRealVar sigma("sigma","width of gaussian",1.5,0.,30.); 
  RooRealVar a1("a1","a1",1.46,0.5,5.);
  RooRealVar n1("n1","n1",1.92,0.,10.);   
  RooRealVar a2("a2","a2",1.46,1.,10.);
  RooRealVar n2("n2","n2",20,1.,50.);   
  RooDoubleCB DCBall("DCBall","Double Crystal ball",x,mean,sigma,a1,n1,a2,n2);
  if (channels== 1) mean.setVal(-1.);
  //--- Breit-Wigner
  float bwSigmaMax,bwSigmaMin;
  if(massBin<400) bwSigmaMin=bwSigmaMax=bwSigma;
  else { 
    bwSigmaMin=bwSigma-20.; 
    bwSigmaMax=bwSigma+20.; 
  }
  RooRealVar mean3("mean3","mean3",xInit) ;
  RooRealVar sigma3("sigma3","width3",bwSigma,bwSigmaMin,bwSigmaMax); 
  RooRealVar scale3("scale3","scale3 ",1.); 

  RooRelBWUFParam bw("bw","bw",x,mean3,scale3);
  //Chebyshev-Polynomial
  RooRealVar A1("A1","A1",-1,-3,3.);
  RooRealVar A2("A2","A2",0.5,-3.,3.);
  RooChebychev BkgPDF("BkgPDF","BkgPDF",x ,RooArgList(A1,A2));
  //Fraction
  RooRealVar frac("frac","Fraction for PDF",0.5,0.,1.);

  x.setBins(10000,"fft");
  RooFFTConvPdf model("model","model",x,bw,DCBall);
  

  RooAddPdf totPDF("totPDF","Total PDF ",RooArgList(model,BkgPDF),RooArgList(frac));
  
  RooArgSet* params = totPDF.getParameters(x);
  
  if(sample!=1 && categ!=0 && id!=125){
  if(channels==0 ){params->readFromFile("Ch0_Cat0_paraT.txt");}// Read the Parameter for the Resonance + Bkg(ChebyChev) 

  if(channels==1 ){params->readFromFile("Ch1_Cat0_paraT.txt");}// Read the Parameter for the Resonance + Bkg(ChebyChev)

  if(channels==2 ){params->readFromFile("Ch2_Cat0_paraT.txt");}//  Read the Parameter for the Resonance + Bkg(ChebyChev)
  }
  
  RooFitResult *fitres = (RooFitResult*)totPDF.fitTo(dataset,SumW2Error(1),Range(xMin,xMax),Strategy(2),NumCPU(8),Save(true));

  if (sample==1 && categ==0 && id==125){
 
  mean.setConstant(kTRUE);
  sigma.setConstant(kTRUE);
  a1.setConstant(kTRUE);
  n1.setConstant(kTRUE);
  a2.setConstant(kTRUE);
  n2.setConstant(kTRUE);
  mean3.setConstant(kTRUE);
  sigma3.setConstant(kTRUE);
  scale3.setConstant(kTRUE);
  A1.setConstant(kTRUE);
  A2.setConstant(kTRUE);
  frac.setConstant(kTRUE);

  if(channels==0 ){
  params->readFromFile("Ch0_Cat0_para.txt");  // Read the Parameter for the Resonance as ggH sample
  params->writeToFile("Ch0_Cat0_paraT.txt");} // Writing the Parameter for Full PDF including the Chebyshev-Polynomial

  if(channels==1 )
  {params->readFromFile("Ch1_Cat0_para.txt"); // Read the Parameter for the Resonance as in ggH sample
   params->writeToFile("Ch1_Cat0_paraT.txt");}// Writing the Parameter for Full PDF including the Chebyshev-Polynomial

  if(channels==2 ){
  params->readFromFile("Ch2_Cat0_para.txt"); // Read the Parameter for the Resonance as ggH sample
  params->writeToFile("Ch2_Cat0_paraT.txt");}// Writing the Parameter for Full PDF including the Chebyshev-Polynomial
  }
  
  stringstream frameTitle;
  if(channels==0){frameTitle << "4#mu, m_{H} = "; }
  if(channels==1){frameTitle << "4e, m_{H} = ";}
  if(channels==2){frameTitle << "2e2#mu, m_{H} = ";}
  frameTitle << massBin << " GeV";

  stringstream nameFileRoot;
  nameFileRoot << "fitM" << massBin << ".root";
  TFile *fileplot = TFile::Open(nameFileRoot.str().c_str(), "recreate");

  RooPlot* xframe = x.frame() ;
  xframe->SetTitle("");
  xframe->SetName("m4lplot");
  dataset.plotOn(xframe,DataError(RooAbsData::SumW2), MarkerStyle(kOpenCircle), MarkerSize(1.1) );
  int col;
  if(channels==0) col=kOrange+7;
  if(channels==1) col=kAzure+2;
  if(channels==2) col=kGreen+3;
  totPDF.plotOn(xframe,LineColor(col));


  RooHist* hpull = xframe->pullHist();

  RooPlot* frame3 = x.frame(Title("Pull Distribution")) ;
  frame3->addPlotable(hpull,"P");
  
  // cosmetics
  TLegend *legend = new TLegend(0.20,0.45,0.45,0.60,NULL,"brNDC");
  legend->SetBorderSize(0);
  legend->SetFillColor(0);
  legend->SetTextAlign(12);
  legend->SetTextFont (42);
  legend->SetTextSize (0.03);

  TH1F *dummyPoints = new TH1F("dummyP","dummyP",1,0,1);
  TH1F *dummyLine = new TH1F("dummyL","dummyL",1,0,1);
  dummyPoints->SetMarkerStyle(kOpenCircle);
  dummyPoints->SetMarkerSize(1.1);
  dummyLine->SetLineColor(col);
  
  legend->AddEntry(dummyPoints, "Simulation", "pe");
  legend->AddEntry(dummyLine, "Parametric Model", "l");
  
  TPaveText *text = new TPaveText(0.15,0.90,0.77,0.98,"brNDC");
  text->AddText("CMS Simulation");
  text->SetBorderSize(0);
  text->SetFillStyle(0);
  text->SetTextAlign(12);
  text->SetTextFont(42);
  text->SetTextSize(0.03);

  TPaveText *titlet = new TPaveText(0.15,0.80,0.60,0.85,"brNDC");
  titlet->AddText(frameTitle.str().c_str());
  titlet->SetBorderSize(0);
  titlet->SetFillStyle(0);
  titlet->SetTextAlign(12);
  titlet->SetTextFont(132);
  titlet->SetTextSize(0.045);

  TPaveText *sigmat = new TPaveText(0.15,0.65,0.77,0.78,"brNDC");
  stringstream sigmaval0, sigmaval1, sigmaval2;
  sigmaval0 << fixed;
  sigmaval0 << setprecision(1);
  sigmaval0 << "m_{dCB} = " << mean.getVal() + massBin << " GeV";
  sigmaval1 << fixed;
  sigmaval1 << setprecision(1);
  sigmaval1 << "#sigma_{dCB} = " << sigma.getVal() << " GeV";
  sigmaval2 << fixed;
  sigmaval2 << setprecision(1);
  sigmaval2 << "RMS_{eff} = " << effSigma(hmass) << " GeV";
  
  sigmat->AddText(sigmaval1.str().c_str());
  sigmat->AddText(sigmaval2.str().c_str());
  sigmat->SetBorderSize(0);
  sigmat->SetFillStyle(0);
  sigmat->SetTextAlign(12);
  sigmat->SetTextFont(132);
  sigmat->SetTextSize(0.04);
  
  xframe->GetYaxis()->SetTitleOffset(1.5);

  cout << "EFF RMS = " << effSigma(hmass) << "    RMS = " << hmass->GetRMS() << endl;

  pad1->cd();
  stringstream nameFile, nameFileC, nameFilePng;
  nameFile << "fitM" << massBin << "_channel" << channels<< "_category"<< categ << ".pdf";
  nameFileC << "fitM" << massBin << "_channel" << channels << "_category"<< categ << ".C";
  nameFilePng << "fitM" << massBin << "_channel" << channels << "_category"<< categ << ".png";

  xframe->Draw(); 
  gPad->Update(); legend->Draw(); text->Draw(); sigmat->Draw(); titlet->Draw();

  pad2->cd() ;
  frame3->Draw() ;
  frame3->SetMinimum(-3);
  frame3->SetMaximum(3);

  TLine *line1 = new TLine(105,0,140,0);
  line1->SetLineColor(kRed);
  line1->Draw();
  

  c1->Print(nameFile.str().c_str());
  c1->SaveAs(nameFileC.str().c_str());
  c1->SaveAs(nameFilePng.str().c_str());

  fileplot->cd();
  xframe->Write();
  sigmat->Write();
  hmass->Write();

  fileplot->Close();

  if(fitValues!=0){
    fitValues[0] = a1.getVal();
    fitValues[1] = a2.getVal();
    fitValues[2] = mean.getVal();
    fitValues[3] = mean3.getVal();
    fitValues[4] = n1.getVal();
    fitValues[5] = n2.getVal();
    fitValues[6] = sigma.getVal();
    fitValues[7] = A1.getVal();
    fitValues[8] = A2.getVal();

  }  

  if(fitErrors!=0){
    fitErrors[0] = a1.getError();
    fitErrors[1] = a2.getError();
    fitErrors[2] = mean.getError();
    fitErrors[3] = mean3.getError();
    fitErrors[4] = n1.getError();
    fitErrors[5] = n2.getError();
    fitErrors[6] = sigma.getError();
    fitErrors[7] = A1.getError();
    fitErrors[8] = A2.getError();

  }

  covQual[0] = fitres->covQual();
  
}
Exemplo n.º 17
0
void plotScanByDim(int channel) {

  gStyle->SetOptStat(0);
  gStyle->SetOptFit(1111);
  
  TStyle *mystyle = RooHZZStyle("ZZ");
  mystyle->cd();

  string channelstr;
  if (channel==0) channelstr = "4mu";
  if (channel==1) channelstr = "4e";
  if (channel==2) channelstr = "2e2mu";

  stringstream file1D,file2D,file3D;
  file1D << "higgsCombineSCAN1D" << channelstr << "Fast.MultiDimFit.mH125.8.root";
  file2D << "higgsCombineSCAN2D" << channelstr << "Fast.MultiDimFit.mH125.8.root";
  file3D << "higgsCombineSCAN3D" << channelstr << "Fast.MultiDimFit.mH125.8.root";

  TFile *fit1D = TFile::Open(file1D.str().c_str());
  TTree *tree1D = (TTree*)fit1D->Get("limit");

  TFile *fit2D = TFile::Open(file2D.str().c_str());
  TTree *tree2D = (TTree*)fit2D->Get("limit");

  TFile *fit3D = TFile::Open(file3D.str().c_str());
  TTree *tree3D = (TTree*)fit3D->Get("limit");

  TGraph *g1D = new TGraph();
  TGraph *g2D = new TGraph();
  TGraph *g3D = new TGraph();

  vector<TTree*> trees;
  trees.push_back(tree1D);
  trees.push_back(tree2D);
  trees.push_back(tree3D);

  vector<TGraph*> graphs;
  graphs.push_back(g1D);
  graphs.push_back(g2D);
  graphs.push_back(g3D);

  for(int dim=0; dim<(int)trees.size(); ++dim) {
    
    cout << "Analyzing scan for n. dim. fit = " << dim << endl;

    float MH;
    float deltaNLL;
    trees[dim]->SetBranchAddress("MH", &MH);
    trees[dim]->SetBranchAddress("deltaNLL", &deltaNLL);

    graphs[dim]->SetLineWidth(2);

    for(int i=1; i<(int)trees[dim]->GetEntries();++i) {
       trees[dim]->GetEntry(i);
       graphs[dim]->SetPoint(i-1,MH,2*deltaNLL);
    }

  }

  graphs[0]->SetLineColor(kRed);
  graphs[1]->SetLineColor(kGreen+2);
  graphs[2]->SetLineColor(kBlue);

  TCanvas *c1 = new TCanvas("c1","",750,750);
  graphs[0]->GetXaxis()->SetRangeUser(122,130);
  graphs[0]->GetYaxis()->SetRangeUser(0,10);
  graphs[0]->GetXaxis()->SetTitle("m_{X} (GeV)");
  graphs[0]->GetYaxis()->SetTitle("-2 #Delta lnL");

  graphs[0]->Draw("al");
  for(int i=1;i<3;++i) graphs[i]->Draw("l");

  // draw the legend
  TLegend *legend = new TLegend(0.75,0.65,0.90,0.90,NULL,"brNDC");
  legend->SetBorderSize(     0);
  legend->SetFillColor (     0);
  legend->SetTextAlign (    12);
  legend->SetTextFont  (    42);
  legend->SetTextSize  (0.05);
  legend->AddEntry(graphs[0], "1D fit","l");
  legend->AddEntry(graphs[1], "2D fit","l");
  legend->AddEntry(graphs[2], "3D fit","l");
  legend->Draw();

  TLine *line1 = new TLine(122,1,130,1);
  line1->SetLineColor(kRed);
  line1->SetLineWidth(3.0);
  line1->Draw();

  TLine *line2 = new TLine(122,4,130,4);
  line2->SetLineColor(kRed);
  line2->SetLineWidth(1.5);
  line2->Draw();

  TLatex *CP = CMSPreliminary();
  CP->Draw();

  TPaveText *comment;
  if(channel==0) comment = text("H #rightarrow ZZ #rightarrow 4#mu",0.20,0.90,0.40,0.90);
  if(channel==1) comment = text("H #rightarrow ZZ #rightarrow 4e",0.20,0.90,0.40,0.90);
  if(channel==2) comment = text("H #rightarrow ZZ #rightarrow 2e2#mu",0.20,0.90,0.40,0.90);
  comment->Draw();


  stringstream outnamepdf;
  outnamepdf << "scanmass_bydim_" << channelstr << ".pdf";
  c1->SaveAs(outnamepdf.str().c_str());

  stringstream outnamepng;
  outnamepng << "scanmass_bydim_" << channelstr << ".png";
  c1->SaveAs(outnamepng.str().c_str());

}
Exemplo n.º 18
0
void plotScanByChannel(int ndim) {

  gStyle->SetOptStat(0);
  gStyle->SetOptFit(1111);
  
  TStyle *mystyle = RooHZZStyle("ZZ");
  mystyle->cd();

  stringstream file4mu,file4e,file2e2mu,filecomb;
  file4mu   << "higgsCombineSCAN" << ndim << "D4muFast.MultiDimFit.mH125.8.root";
  file4e    << "higgsCombineSCAN" << ndim << "D4eFast.MultiDimFit.mH125.8.root";
  file2e2mu << "higgsCombineSCAN" << ndim << "D2e2muFast.MultiDimFit.mH125.8.root";
  filecomb  << "higgsCombineSCAN" << ndim << "DcombFast.MultiDimFit.mH125.8.root";

  TFile *fit4mu = TFile::Open(file4mu.str().c_str());
  TTree *tree4mu = (TTree*)fit4mu->Get("limit");

  TFile *fit4e = TFile::Open(file4e.str().c_str());
  TTree *tree4e = (TTree*)fit4e->Get("limit");

  TFile *fit2e2mu = TFile::Open(file2e2mu.str().c_str());
  TTree *tree2e2mu = (TTree*)fit2e2mu->Get("limit");

  TFile *fitcomb = TFile::Open(filecomb.str().c_str());
  TTree *treecomb = (TTree*)fitcomb->Get("limit");

  TGraph *g4mu = new TGraph();
  TGraph *g4e = new TGraph();
  TGraph *g2e2mu = new TGraph();
  TGraph *gcomb = new TGraph();

  vector<TTree*> trees;
  trees.push_back(tree4mu);
  trees.push_back(tree4e);
  trees.push_back(tree2e2mu);
  trees.push_back(treecomb);

  vector<TGraph*> graphs;
  graphs.push_back(g4mu);
  graphs.push_back(g4e);
  graphs.push_back(g2e2mu);
  graphs.push_back(gcomb);


  for(int cha=0; cha<(int)trees.size(); ++cha) {
    
    cout << "Analyzing scan for channel = " << cha << endl;

    float MH;
    float deltaNLL;
    trees[cha]->SetBranchAddress("MH", &MH);
    trees[cha]->SetBranchAddress("deltaNLL", &deltaNLL);

    if(cha<3) graphs[cha]->SetLineWidth(2);
    else graphs[cha]->SetLineWidth(4);

    for(int i=1; i<(int)trees[cha]->GetEntries();++i) {
       trees[cha]->GetEntry(i);
       graphs[cha]->SetPoint(i-1,MH,2*deltaNLL);
    }

  }

  graphs[0]->SetLineColor(kRed);
  graphs[1]->SetLineColor(kGreen+2);
  graphs[2]->SetLineColor(kBlue);
  graphs[3]->SetLineColor(kBlack);

  TCanvas *c1 = new TCanvas("c1","",750,750);
  graphs[0]->GetXaxis()->SetRangeUser(122,130);
  graphs[0]->GetYaxis()->SetRangeUser(0,10);
  graphs[0]->GetXaxis()->SetTitle("m_{X} (GeV)");
  graphs[0]->GetYaxis()->SetTitle("-2 #Delta lnL");

  graphs[0]->Draw("al");
  for(int i=1;i<4;++i) graphs[i]->Draw("l");

  // draw the legend
  TLegend *legend = new TLegend(0.55,0.65,0.85,0.90,NULL,"brNDC");
  legend->SetBorderSize(     0);
  legend->SetFillColor (     0);
  legend->SetTextAlign (    12);
  legend->SetTextFont  (    42);
  legend->SetTextSize  (0.05);
  legend->AddEntry(graphs[3], "Combined","l");
  legend->AddEntry(graphs[1], "H #rightarrow ZZ #rightarrow 4e ","l");
  legend->AddEntry(graphs[0], "H #rightarrow ZZ #rightarrow 4#mu ","l");
  legend->AddEntry(graphs[2], "H #rightarrow ZZ #rightarrow 2e2#mu ","l");
  legend->Draw();

  TLine *line1 = new TLine(122,1,130,1);
  line1->SetLineColor(kRed);
  line1->SetLineWidth(3.0);
  line1->Draw();

  TLine *line2 = new TLine(122,4,130,4);
  line2->SetLineColor(kRed);
  line2->SetLineWidth(1.5);
  line2->Draw();

  TLatex *CP = CMSPreliminary();
  CP->Draw();

  TPaveText *comment;
  if(ndim==1) comment = text("H #rightarrow ZZ, 1D",0.20,0.90,0.40,0.90);
  if(ndim==2) comment = text("H #rightarrow ZZ, 2D",0.20,0.90,0.40,0.90);
  if(ndim==3) comment = text("H #rightarrow ZZ, 3D",0.20,0.90,0.40,0.90);
  comment->Draw();


  stringstream outnamepdf;
  outnamepdf << "scanmass_bychannel_" << ndim << "D.pdf";
  c1->SaveAs(outnamepdf.str().c_str());
  stringstream outnamepng;
  outnamepng << "scanmass_bychannel_" << ndim << "D.png";
  c1->SaveAs(outnamepng.str().c_str());
}
Exemplo n.º 19
0
void finalizeMassToys() {

  // data fits (uppere)
  //  float dm1h=0.572;

  gROOT->SetStyle("Plain");
  gStyle->SetOptStat(0);
  gStyle->SetOptFit(1111);

  TFile *fit1D = TFile::Open("histos1D.root");
  TH1F *pull1D = (TH1F*)fit1D->Get("pullh");
  TH1F *errh1D = (TH1F*)fit1D->Get("errh");

  TFile *fit2D = TFile::Open("histos2D.root");
  TH1F *pull2D = (TH1F*)fit2D->Get("pullh");
  TH1F *errh2D = (TH1F*)fit2D->Get("errh");

  TFile *fit3D = TFile::Open("histos3D.root");
  TH1F *pull3D = (TH1F*)fit3D->Get("pullh");
  TH1F *errh3D = (TH1F*)fit3D->Get("errh");

  float m1=errh1D->GetMean();
  float m2=errh2D->GetMean();
  float m3=errh3D->GetMean();

  float me1=errh1D->GetMeanError();
  float me2=errh2D->GetMeanError();
  float me3=errh3D->GetMeanError();

  stringstream m1s,m2s,m3s;
  m1s.precision(2); m2s.precision(2); m3s.precision(2);
  m1s << std::fixed << "m_{4l}. Mean = " << m1 << " #pm " << me1;
  m2s << std::fixed << "m_{4l}, #sigma_{m}. Mean = " << m2 << " #pm " << me2;
  m3s << std::fixed << "m_{4l}, #sigma_{m}, KD. Mean = " << m3 << " #pm " << me3;

  std::vector<TH1F*> pulls,errs;
  pulls.push_back(pull1D);
  pulls.push_back(pull2D);
  pulls.push_back(pull3D);
  errs.push_back(errh1D);
  errs.push_back(errh2D);
  errs.push_back(errh3D);

  
  TPaveText *text = new TPaveText(0.50,0.50,0.85,0.60,"brNDC");
  text->AddText(m1s.str().c_str());
  text->AddText(m2s.str().c_str());
  text->AddText(m3s.str().c_str());
  text->SetBorderSize(0);
  text->SetFillStyle(0);
  text->SetTextAlign(12);
  text->SetTextFont(42);
  text->SetTextSize(0.03);


  // draw the legend
  TLegend *legend = new TLegend(0.50,0.65,0.85,0.85,NULL,"brNDC");
  legend->SetBorderSize(     0);
  legend->SetFillColor (     0);
  legend->SetTextAlign (    12);
  legend->SetTextFont  (    42);
  legend->SetTextSize  (0.05);
  legend->AddEntry(errh1D, "m_{4l}","l");
  legend->AddEntry(errh2D, "m_{4l},#sigma_{m}","l");
  legend->AddEntry(errh3D, "m_{4l},#sigma_{m},KD","l");

  TCanvas *c1 = new TCanvas("c1","",750,750);
  errs[0]->SetMaximum(3000);
  for(int i=0;i<3;++i) {
    errs[i]->SetLineColor(i+1);
    if(i==0) errs[i]->Draw();
    else {
      errs[i]->Scale(errs[0]->Integral()/errs[i]->Integral());
      errs[i]->Draw("same");
    }
  }
  legend->Draw();
  text->Draw();
  c1->SaveAs("errors.png");

  for(int i=0;i<3;++i) {
    pulls[i]->Draw();
    pulls[i]->Fit("gaus");
    stringstream pullc;
    pullc << "pull_" << i+1 << "D.png";
    c1->SaveAs(pullc.str().c_str());
  }  
 
}
Exemplo n.º 20
0
void make_overlay_Plot(TH1D *SS_hist, TH1D *OS_hist, configuration *myconfig){
  TCanvas *c1 = new TCanvas("c1","C1",10,10,1280,960);
  gPad->SetTopMargin(0.08);
  gPad->SetRightMargin(0.04);
  gPad->SetLeftMargin(0.12);
  gPad->SetBottomMargin(0.14);
  gPad->SetTickx();
  gPad->SetTicky();
  //gPad->SetLogy();
  //hist->GetYaxis()->SetTitleOffset(0.8);

  double ymax = TMath::Max(SS_hist->GetMaximum(),OS_hist->GetMaximum());

  //SS_hist->SetLineWidth(2);
  SS_hist->SetLineColor(kOrange+1);

  //OS_hist->SetLineWidth(2);
  OS_hist->SetLineColor(kBlue+2);

  OS_hist->GetXaxis()->SetLabelSize(0.05);
  OS_hist->GetYaxis()->SetLabelSize(0.05);
  OS_hist->GetXaxis()->SetTitleSize(0.05);
  OS_hist->GetYaxis()->SetTitleSize(0.05);
  OS_hist->GetYaxis()->SetRangeUser(0,1.2*ymax);

  //SS_hist->SetFillColorAlpha(kOrange+1, 0.35);
  //SS_hist->SetFillColor(kOrange+1);
  OS_hist->Draw("hist");
  SS_hist->Draw("histsame");

  TPaveText *blank_box = new TPaveText(1.001-gPad->GetRightMargin(),gPad->GetBottomMargin(),1.0,gPad->GetBottomMargin()+0.05,"BRNDC");
  blank_box->SetBorderSize(0);blank_box->SetFillColor(kWhite);blank_box->SetTextAlign(12);blank_box->SetFillStyle(1001);
  blank_box->AddText(" ");
  blank_box->Draw();
  OS_hist->Draw("axis same");

  if(myconfig->get_particle().Contains("Xic") && static_cast<TString>(OS_hist->GetName()).Contains("pi")){

    c1->Update();
    double Xic_2645_mass = 2646;
    double Xic_2790_mass = 2790 - 107.5;//107.5 : Xic' - Xic mass diffrrence
    double LQCD_Xicc_mass = 3610;

    TArrow Xic_arrows;
    Xic_arrows.SetAngle(40);
    Xic_arrows.SetLineWidth(2);
    Xic_arrows.DrawArrow(Xic_2645_mass,0.85*gPad->GetUymax(),Xic_2645_mass,0.88*gPad->GetUymax(),0.03,"<|");
    Xic_arrows.DrawArrow(Xic_2790_mass,0.6*gPad->GetUymax(),Xic_2790_mass,0.7*gPad->GetUymax(),0.03,"<|");
    Xic_arrows.DrawArrow(LQCD_Xicc_mass,0.10*gPad->GetUymax(),LQCD_Xicc_mass,0.2*gPad->GetUymax(),0.03,"<|");

    TLatex Xic_labels;Xic_labels.SetTextAlign(12);Xic_labels.SetTextFont(42);Xic_labels.SetTextSize(0.05);
    Xic_labels.DrawLatex(Xic_2645_mass-10,0.93*gPad->GetUymax(),"#Xi_{c}(2645)");
    Xic_labels.DrawLatex(Xic_2790_mass-10,0.75*gPad->GetUymax(),"#Xi_{c}(2790)#rightarrow#Xi_{c}'#pi");
    Xic_labels.SetTextAlign(22);
    Xic_labels.DrawLatex(LQCD_Xicc_mass,0.25*gPad->GetUymax(),"LQCD #Xi_{cc}");

  }

  if(myconfig->get_particle().CompareTo("Xic") == 0 && static_cast<TString>(OS_hist->GetName()).Contains("K")){

    c1->Update();

    double Marco_1_QVal = 40.0;
    double Marco_2_QVal = 90.0;
    double Marco_3_QVal = 105.0;
    double Marco_4_QVal = 128.0;
    double Marco_5_QVal = 160.0;

    double peak1_mass = Marco_1_QVal + 2469 + 494;
    double peak2_mass = Marco_2_QVal + 2469 + 494;
    double peak3_mass = Marco_3_QVal + 2469 + 494;
    double peak4_mass = Marco_4_QVal + 2469 + 494;
    double peak5_mass = Marco_5_QVal + 2469 + 494;

    TArrow OmegacStar_arrows;
    OmegacStar_arrows.SetAngle(40);
    OmegacStar_arrows.SetLineWidth(2);
    OmegacStar_arrows.DrawArrow(peak1_mass,0.85*gPad->GetUymax(),peak1_mass,0.88*gPad->GetUymax(),0.03,"<|");
    OmegacStar_arrows.DrawArrow(peak2_mass,0.85*gPad->GetUymax(),peak2_mass,0.88*gPad->GetUymax(),0.03,"<|");
    OmegacStar_arrows.DrawArrow(peak3_mass,0.85*gPad->GetUymax(),peak3_mass,0.88*gPad->GetUymax(),0.03,"<|");
    OmegacStar_arrows.DrawArrow(peak4_mass,0.85*gPad->GetUymax(),peak4_mass,0.88*gPad->GetUymax(),0.03,"<|");
    OmegacStar_arrows.DrawArrow(peak5_mass,0.85*gPad->GetUymax(),peak5_mass,0.88*gPad->GetUymax(),0.03,"<|");

    TLatex OmegacStar_labels;OmegacStar_labels.SetTextAlign(21);OmegacStar_labels.SetTextFont(42);OmegacStar_labels.SetTextSize(0.05);
    OmegacStar_labels.DrawLatex(peak1_mass,0.90*gPad->GetUymax(),"1");
    OmegacStar_labels.DrawLatex(peak2_mass,0.90*gPad->GetUymax(),"2");
    OmegacStar_labels.DrawLatex(peak3_mass,0.90*gPad->GetUymax(),"3");
    OmegacStar_labels.DrawLatex(peak4_mass,0.90*gPad->GetUymax(),"4");
    OmegacStar_labels.DrawLatex(peak5_mass,0.90*gPad->GetUymax(),"5");

  }

  TLegend *leg;
  if(static_cast<TString>(SS_hist->GetName()).Contains("SB"))leg = new TLegend(gPad->GetLeftMargin()+0.06,0.82-gPad->GetTopMargin(),0.40-gPad->GetLeftMargin(),0.97-gPad->GetTopMargin());
  else leg = new TLegend(0.6,0.82-gPad->GetTopMargin(),0.97-gPad->GetRightMargin(),0.97-gPad->GetTopMargin());
  leg->SetBorderSize(0);leg->SetFillColor(kWhite);leg->SetFillStyle(1001);leg->SetTextAlign(12);leg->SetTextSize(0.05);leg->SetTextFont(42);
  if(static_cast<TString>(OS_hist->GetName()).Contains("IPfail"))leg->SetHeader("Multiple candidates");
  if(static_cast<TString>(OS_hist->GetName()).Contains("pi")){
    temp = "#Xi_{c}^{#pm}#pi^{#mp} + c.c.";
    if(myconfig->get_particle().Contains("Xic0"))temp = "#Xi_{c}^{0}#pi^{#mp} + c.c.";
    if(myconfig->get_particle().Contains("Omega"))temp = "#Omega_{c}^{0}#pi^{#mp} + c.c.";
  }
  else if(static_cast<TString>(OS_hist->GetName()).Contains("K")){
    temp = "#Xi_{c}^{#pm}K^{#mp} + c.c.";
    if(myconfig->get_particle().Contains("Xic0"))temp = "#Xi_{c}^{0}K^{#mp} + c.c.";
    if(myconfig->get_particle().Contains("Omega"))temp = "#Omega_{c}^{0}K^{#mp} + c.c.";
  }
  else{
    temp = "from #Xi_{c}^{#pm} signal";
    if(myconfig->get_particle().Contains("Xic0"))temp = "from #Xi_{c}^{0} signal";
    if(myconfig->get_particle().Contains("Omega"))temp = "from #Omega_{c}^{0} signal";
  }
  leg->AddEntry(OS_hist,temp,"l");
  if(static_cast<TString>(OS_hist->GetName()).Contains("pi")){
    temp = "#Xi_{c}^{#pm}#pi^{#pm} + c.c.";
    if(myconfig->get_particle().Contains("Xic0"))temp = "#Xi_{c}^{0}#pi^{#pm} + c.c.";
    if(myconfig->get_particle().Contains("Omega"))temp = "#Omega_{c}^{0}#pi^{#pm} + c.c.";
  }
  else if(static_cast<TString>(OS_hist->GetName()).Contains("K")){
    temp = "#Xi_{c}^{#pm}K^{#pm} + c.c.";
    if(myconfig->get_particle().Contains("Xic0"))temp = "#Xi_{c}^{0}K^{#pm} + c.c.";
    if(myconfig->get_particle().Contains("Omega"))temp = "#Omega_{c}^{0}K^{#pm} + c.c.";
  }
  else temp = "from sidebands";
  leg->AddEntry(SS_hist,temp,"l");
  leg->Draw();

  temp = myconfig->get_dumpdir()+"/Plots/";
  if(!gSystem->OpenDirectory(temp))gSystem->mkdir(temp);

  temp += static_cast<TString>(OS_hist->GetName()) + "_" + myconfig->get_current_cs() + ".pdf";
  if(!myconfig->is_debug()) c1->SaveAs(temp);
  delete c1;
  return;
}
Exemplo n.º 21
0
void plotNLLMassToys(long injmass){


  TString filenamesb=TString("nllsb_")+injmass;
  TString filenameb=TString("nllb_")+injmass;

  TH1F * H[8];
  TH1F * HDiff[8];
  TH1F * HDiffFine[8];
  TH1F * HSigma[8];
  TF1* GScanToy[500];
  for(Int_t m=0;m<8;m++){
    H[m]=new TH1F(TString("H")+(long)(110+5*m),TString("mass=")+(long)(110+5*m),50,-200,-25);    
    HDiff[m]=new TH1F(TString("HDiff")+(long)(110+5*m),TString("mass=")+(long)(110+5*m),20,0.0,8);    
    HDiffFine[m]=new TH1F(TString("HDiffFine")+(long)(110+5*m),TString("mass=")+(long)(110+5*m),1000,0.0,8);    
    HSigma[m]=new TH1F(TString("HSigma")+(long)(110+5*m),TString("mass=")+(long)(110+5*m),50,10,10);     
  }


  TH1F HMass("HMass","",8,110-2.5,150-2.5);
  TH1F HPull("HPull","",11,-5.5,5.5);
  TH1F HSigmaLow("HSigmaLow","",8,0,30);
  HSigmaLow.GetXaxis()->SetTitle("#sigma_{low}");
  TH1F HSigmaHigh("HSigmaHigh","",8,0,30);
  HSigmaHigh.GetXaxis()->SetTitle("#sigma_{high}");
  TH2F HSigma2D("HSigma2D","",8,0,20,8,0,20); 
  HSigma2D.GetYaxis()->SetTitle("#sigma_{high}");
  HSigma2D.GetXaxis()->SetTitle("#sigma_{low}");
  TH2F HBestFitvsSigmaHigh("HBestFitvsSigmaHigh","",8,110-2.5,145+2.5,8,110-2.5,145+2.5);
  HBestFitvsSigmaHigh.GetYaxis()->SetTitle("#sigma_{high}");
  HBestFitvsSigmaHigh.GetXaxis()->SetTitle("m_{bestfit}");
  TH1F HSigmaFull("HSigmaFull","",20,0,50);
  HSigmaFull.GetXaxis()->SetTitle("#sigma_{low}+#sigma_{high}");

  ifstream file;
  file.open((filenamesb+".txt").Data());  

  ifstream fileb;
  fileb.open((filenameb+".txt").Data());  

  bool GoodToy[500];
  int n;
  float nll[8];
  float nllb[8];
  int ngood=0;
  while(!file.eof()){

    file>>n>>nll[0]>>nll[1]>>nll[2]>>nll[3]>>nll[4]>>nll[5]>>nll[6]>>nll[7];
    fileb>>n>>nllb[0]>>nllb[1]>>nllb[2]>>nllb[3]>>nllb[4]>>nllb[5]>>nllb[6]>>nllb[7];
    //cout<<n<<nll[0]<<nll[1]<<nll[2]<<nll[3]<<nll[4]<<nll[5]<<nll[6]<<nll[7]<<endl;

    GoodToy[n]=1;
    for(Int_t m=0;m<8;m++)
      if(nll[m]==0.) GoodToy[n]=0;
    if(!GoodToy[n])continue;

    float minnll=100.;
    int minm=0;
    float minmass=0.;
    for(Int_t m=0;m<8;m++)
      if(minnll>nll[m]){
	minnll = nll[m];
	minm   = m;
      }
    minmass=110+minm*5;

    for(Int_t m=0;m<8;m++){
      H[m]->Fill(nll[m]);
      HDiff[m]->Fill(nll[m]-minnll);
      HDiffFine[m]->Fill(nll[m]-minnll);
    }
    
    //////scan of each toy
    GScanToy[n]=new TF1(TString("GScanToy")+(long)(110+5*m),"(110<=x&&x<115)*([0]+([1]-[0])*(x-110)/5) + (115<=x&&x<120)*([1]+([2]-[1])*(x-115)/5)  + (120<=x&&x<125)*([2]+([3]-[2])*(x-120)/5) + (125<=x&&x<130)*([3]+([4]-[3])*(x-125)/5) + (130<=x&&x<135)*([4]+([5]-[4])*(x-130)/5) + (135<=x&&x<140)*([5]+([6]-[5])*(x-135)/5) + (140<=x&&x<145)*([6]+([7]-[6])*(x-140)/5)",110,145);
    for(Int_t m=0;m<8;m++){
      GScanToy[n]->SetParameter(m,(nll[m]-minnll));
    }

    //for this toy find the uncertainty 
    float x1sigmalow=0;
    float x1sigmahigh=0;
    float y1sigmalow=1000;
    float y1sigmahigh=1000;
    for(Int_t m=0;m<1000;m++){
      float xlow=110+m*(145-110)/1000.;
      float xhigh=145+m*(110-145)/1000.;
      float ylow=GScanToy[n]->Eval(xlow);
      float yhigh=GScanToy[n]->Eval(xhigh);
      if(ylow<y1sigmalow && xlow<110+minm*5 && ylow>0.5){
	y1sigmalow=ylow;
	x1sigmalow=xlow;
      }
      if(yhigh<y1sigmahigh && xhigh>110+minm*5 && yhigh>0.5){
	y1sigmahigh=yhigh;
	x1sigmahigh=xhigh;
      }
    }
    //cout<<110+minm*5<<" "<<x1sigmalow<<" "<<x1sigmahigh<<endl;
    float sigmamass=0.;
    if( x1sigmalow !=0  && x1sigmahigh ==0)sigmamass = minmass - x1sigmalow;
    if( x1sigmahigh!=0  && x1sigmalow  ==0)sigmamass = x1sigmahigh - minmass;
    if( x1sigmalow !=0  && x1sigmahigh !=0)sigmamass = ((minmass - x1sigmalow) + (x1sigmahigh - minmass))/2.;
    if(sigmamass!=0.)HPull.Fill((minmass-injmass)/sigmamass);

    if( x1sigmalow !=0 ) {
      HSigmaLow.Fill(minmass-x1sigmalow);
    }
    if( x1sigmahigh !=0 ) {
      HSigmaHigh.Fill(x1sigmahigh-minmass);
      HBestFitvsSigmaHigh.Fill(minmass,x1sigmahigh);
    }
    if( x1sigmalow !=0  && x1sigmahigh !=0 ) {
      HSigma2D.Fill(minmass-x1sigmalow,x1sigmahigh-minmass);
      HSigmaFull.Fill(x1sigmahigh-x1sigmalow);
    }


    /////Find best fit mass 
    HMass.Fill(110 + minm*5);

    ngood++;
  }
  file.close();
  fileb.close();
  cout<<"Number of good toys = "<<ngood<<endl;


  float MinNLL=1000;
  for(Int_t m=0;m<8;m++)
    if(MinNLL>H[m]->GetMean())
      MinNLL=H[m]->GetMean();

  file.open((filenamesb+".txt").Data());  
  fileb.open((filenameb+".txt").Data());  
  while(!file.eof()){
    file>>n>>nll[0]>>nll[1]>>nll[2]>>nll[3]>>nll[4]>>nll[5]>>nll[6]>>nll[7];
    if(!GoodToy[n])continue;
    for(Int_t m=0;m<8;m++)
      HSigma[m]->Fill(nll[m]-MinNLL);
    
  }
  file.close();
  fileb.close();

  TCanvas C("C","",600,600);
  C.Print(filenamesb+".ps[");

  //fill what is effectively the asimov dataset 
  TGraph GScan;
  float minnll=100.;
  for(Int_t m=0;m<8;m++)
    if(minnll>H[m]->GetMean())
      minnll=H[m]->GetMean();

  const double quantiles[5]={0.05,0.16,0.5,0.84,0.95};
  const double xq[8][5];

  TLine QLine;
  QLine.SetLineColor(2);
  
  ///////////////////
  for(Int_t m=0;m<8;m++){
    HDiffFine[m]->GetQuantiles(5,xq[m],quantiles);

    C.Clear();
    //HSigma[m]->Draw("pe");
    //H[m]->Draw("pe");
    //HDiff[m]->Draw("hist");

    HDiffFine[m]->Draw("hist");
    for(Int_t q=0;q<5;q++){
      QLine.DrawLine(xq[m][q],0,xq[m][q],HDiffFine[m]->GetMaximum());     
    }

    C.Print(filenamesb+".ps");
    if(m==7)C.Print(filenamesb+"_DNLLDistribution.png");

    GScan.SetPoint(m,110+m*5,H[m]->GetMean()-minnll);
  }

  TGraph* HBands[5];
  for(Int_t q=0;q<5;q++){
    HBands[q]=new TGraph();
    HBands[q]->SetPoint(0,110,0);
    for(Int_t m=0;m<8;m++){
      HBands[q]->SetPoint(m+1,110+m*5,xq[m][q]);
    }
    HBands[q]->SetPoint(9,145,0);
  }
  HBands[0]->SetFillColor(kYellow);      HBands[0]->SetLineColor(kYellow); HBands[0]->SetLineWidth(0);
  HBands[1]->SetFillColor(kYellow);      HBands[1]->SetLineColor(kYellow); HBands[1]->SetLineWidth(0);
  HBands[2]->SetFillColor(0);            HBands[2]->SetLineColor(kBlue); 
  HBands[3]->SetFillColor(kGreen);       HBands[3]->SetLineColor(kGreen);
  HBands[4]->SetFillColor(kYellow);      HBands[4]->SetLineColor(kYellow);

      
  /////////////////////Likelihood scan
  TH1F HScanFrame("HScanFrame","",1,110,145);
  HScanFrame.GetYaxis()->SetRangeUser(0,4);
  //HScanFrame.GetYaxis()->SetTitle("#scale[1]{#Delta} -ln(#font[132]{L})");
  HScanFrame.GetYaxis()->SetTitle("#scale[1]{#Delta}( -ln L )");
  HScanFrame.GetXaxis()->SetTitle("#bf{m_{H} [GeV]}");
  TLine line;
  line.SetLineColor(2);
  C.Clear();
  HScanFrame.Draw();
  for(Int_t q=4;q>=0;q--){
    if(q!=2) HBands[q]->Draw("Fsame");
  }
 
  GScan.SetLineColor(kBlue);
  GScan.Draw("lsame");


  TFile FData("likelihood-mass-scan.root","READ");
  TGraph*DataInput=(TGraph*)FData.Get("b+_All_final_1nd/mass_scan");
  
  float mindata=100.;
  float minmassdata=0.;
  for(Int_t m=0;m<8;m++){
    double x; double y;
    DataInput->GetPoint(m*5,x,y);
    if(mindata>y){
      mindata=y;
      minmassdata=110+m*5;
    }
  }

  TGraph GData;
  for(Int_t m=0;m<8;m++){
    double x; double y;
    DataInput->GetPoint(m*5,x,y);
    GData.SetPoint(m,x,y-mindata);
  }

  GData.Draw("plsame");
  //DataInput->Draw("plsame");
  //GScanToy[0]->Draw("lsame");

  C.RedrawAxis();
  line.DrawLine(110,0.5,145,0.5);
  line.DrawLine(110,1.92,145,1.92);

  float datasigmahigh=8.55;
  float datasigmalow=5.85;
  TLine verticalline;
  verticalline.SetLineStyle(2);
  verticalline.DrawLine(minmassdata-datasigmalow,0,minmassdata-datasigmalow,0.5);
  verticalline.DrawLine(minmassdata+datasigmahigh,0,minmassdata+datasigmahigh,0.5);


  TLegend legend;
  legend.SetFillStyle(0);
  legend.SetFillColor(0);
  legend.SetBorderSize(0);
  legend.AddEntry(&GData,"observed","LP");  
  legend.AddEntry(&GScan,"H(125 GeV) expected","L");
  legend.AddEntry(HBands[3],"#pm 1#sigma expected","F");
  legend.AddEntry(HBands[4],"#pm 2#sigma expected","F");
  legend.SetX1NDC(0.37);
  legend.SetX2NDC(0.85);
  legend.SetY1NDC(0.67);
  legend.SetY2NDC(0.88);
  legend.SetTextSize(.04);
  legend.SetTextAlign(12);
  legend.Draw();

  TLatex text;
  text.SetTextColor(2);
  text.SetTextSize(0.04);
  text.DrawLatex(142,0.5+0.05,"1#sigma");
  text.DrawLatex(142,1.92+0.05,"2#sigma");
  
  //CMSPrelim("CMS Preliminary,  H#rightarrow#tau#tau,  L = 24.3 fb^{-1}"); //#sqrt{s} = 7 - 8 TeV ,   L = 24.3 fb^{-1}
  //CMSPrelim("CMS Prelim.,  H#rightarrow#tau#tau,  #sqrt{s} = 7 - 8 TeV,  L = 24.3 fb^{-1}"); 
  //CMSPrelim(""); 
  //CMSPrelim("CMS Preliminary, #sqrt{s}=7 TeV, L=4.9 fb^{-1}, #sqrt{s}=8 TeV, L=19.3 fb^{-1}, H#rightarrow#tau#tau"); 
  CMSPrelim(); 
 
  C.Print(filenamesb+".ps");
  C.Print(filenamesb+"_DNLL.png");
  C.Print(filenamesb+"_DNLL.pdf");


  //////////////////////Pull distribution
  TH1F HMassFrame("HMassFrame","",1,100,155);
  HMassFrame.GetYaxis()->SetRangeUser(0,HMass.GetMaximum()*1.3);
  HMassFrame.GetYaxis()->SetTitle("# of toys");
  HMassFrame.GetXaxis()->SetTitle("m_{H}   [GeV]");


  cout<<" Fit with 3 gaussians "<<endl;
  TF1 Gaus("Gaus","[0]*exp(-0.5*(x-[1])**2/([2]*[2])) + [3]*exp(-0.5*(x-[5])**2/([2]*[2])) + [4]*exp(-0.5*(x-[6])**2/([2]*[2]))",110,145);
  Gaus.SetParLimits(0,0,10000);
  Gaus.SetParLimits(1,110,145);
  Gaus.SetParLimits(2,1,20);
  Gaus.SetParLimits(3,0,10000);
  Gaus.SetParLimits(4,0,10000);
  Gaus.FixParameter(5,110-(injmass-110));
  Gaus.FixParameter(6,145+(145-injmass));
  C.Clear();
  HMass.Fit(&Gaus);
  char title[100];
  sprintf(title,"Mean = %.1f +- %.1f  Sigma = %.1f +- %.1f",Gaus.GetParameter(1),Gaus.GetParError(1),Gaus.GetParameter(2),Gaus.GetParError(2));
  HMassFrame.SetTitle(title);
  HMassFrame.Draw("hist");
  HMass.Draw("histpesame");
  Gaus.SetLineColor(4);
  Gaus.Draw("lsame");
  TF1 GausSig("GausSig","[0]*exp(-0.5*(x-[1])**2/([2]*[2]))",90,160);
  GausSig.SetParameter(0,Gaus.GetParameter(0));
  GausSig.SetParameter(1,Gaus.GetParameter(1));
  GausSig.SetParameter(2,Gaus.GetParameter(2));
  GausSig.SetLineColor(2);
  GausSig.Draw("lsame");
  C.Print(filenamesb+".ps");
  C.Print(filenamesb+"_MassUnc.png");
  C.Print(filenamesb+"_MassUnc.pdf");

  cout<<" Fit with 1 gaussian "<<endl;
  C.Clear();
  TF1 GausCore("GausCore","[0]*exp(-0.5*(x-[1])**2/([2]*[2]))",110,145);
  GausCore.SetParLimits(0,0.1,10000);
  GausCore.SetParLimits(1,injmass-5.0,injmass+5.0);
  GausCore.SetParLimits(2,1,20);
  //HMass.Fit(&GausCore,"","",injmass-5.5,injmass+5.5);
  HMass.Fit(&GausCore,"","LL",injmass-10.0,injmass+10.0);
  sprintf(title,"Mean = %.1f +- %.1f  Sigma = %.1f +- %.1f",GausCore.GetParameter(1),GausCore.GetParError(1),GausCore.GetParameter(2),GausCore.GetParError(2));
  HMassFrame.SetTitle(title);
  HMassFrame.Draw("hist");
  HMass.Draw("histpesame");
  GausCore.SetLineColor(2);
  GausCore.Draw("lsame");
  C.Print(filenamesb+".ps");
  C.Print(filenamesb+"_MassUncCore.png");
  C.Print(filenamesb+"_MassUncCore.pdf");

  C.Clear();
  cout<<"# of Pull Toys = "<<HPull.Integral()<<endl;
  TF1 GausPull("GausPull","[0]*exp(-0.5*(x-[1])**2/([2]*[2]))",-5,5);
  GausPull.SetParLimits(0,0.,1000);
  GausPull.SetParLimits(1,-1,1.1);
  GausPull.SetParLimits(2,0.2,3);
  GausPull.SetLineColor(4);
  HPull.Fit(&GausPull,"","I",-2,2);
  sprintf(title,"Mean = %.2f +- %.2f  Sigma = %.2f +- %.2f",GausPull.GetParameter(1),GausPull.GetParError(1),GausPull.GetParameter(2),GausPull.GetParError(2));
  HPull.SetTitle(title);
  HPull.GetXaxis()->SetTitle("(  m_{best-fit}  -  m_{injected}  )/#sigma_{m}");
  HPull.GetYaxis()->SetTitle("# of toys");
  HPull.Draw("pe");
  GausPull.Draw("lsame");
  C.Print(filenamesb+".ps");
  C.Print(filenamesb+"_MassPull.png");
  C.Print(filenamesb+"_MassPull.pdf");

  C.Clear();
  TLine sigmaline;
  cout<<" # of toys for 2D uncertainty plot "<<HSigma2D.Integral()<<endl; 
  TF1 SigmaPol("SigmaPol","[0]+[1]*x",0,20);
  //HSigma2D.Fit(&SigmaPol);
  HSigma2D.Draw("colz");
  //SigmaPol.Draw("lsame");
  C.Print(filenamesb+".ps");
  C.Print(filenamesb+"_sigma2D.png");
  C.Clear();
  cout<<" # of toys for sigmalow "<<HSigmaLow.Integral()<<endl; 
  HSigmaLow.Draw();
  sigmaline.DrawLine(datasigmalow,0,datasigmalow,HSigmaLow.GetMaximum());
  C.Print(filenamesb+".ps");
  C.Print(filenamesb+"_sigmaLow.png");
  C.Clear();
  cout<<" # of toys for sigmahigh "<<HSigmaHigh.Integral()<<endl; 
  HSigmaHigh.Draw();
  sigmaline.DrawLine(datasigmahigh,0,datasigmahigh,HSigmaHigh.GetMaximum());
  C.Print(filenamesb+".ps");
  C.Print(filenamesb+"_sigmaHigh.png");
  C.Clear();
  cout<<" # of toys for sigmafull "<<HSigmaFull.Integral()<<endl; 
  HSigmaFull.Draw();
  sigmaline.DrawLine(datasigmalow+datasigmahigh,0,datasigmalow+datasigmahigh,HSigmaFull.GetMaximum());
  C.Print(filenamesb+".ps");
  C.Print(filenamesb+"_sigmafull.png");
  

  C.Clear();
  TF1 SigmaBFitvsSigma("SigmaBFitvsSigma","[0]+[1]*x",0,20);
  //HBestFitvsSigmaHigh.Fit(&SigmaBFitvsSigma);
  HBestFitvsSigmaHigh.Draw("colz");
  //SigmaBFitvsSigma.Draw("lsame");
  C.Print(filenamesb+".ps");


  C.Print(filenamesb+".ps]");
  gROOT->ProcessLine(".q");
}
void DarkSusy_mH_125_mGammaD_2000_cT_10_LHE_gammaD_L_Z()
{
//=========Macro generated from canvas: cnv/cnv
//=========  (Sun May 24 15:17:52 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(-10.625,-0.01311612,51.875,0.08777715);
   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_gammaD_cT_Z_lab_dummy57 = new TH1F("h_gammaD_cT_Z_lab_dummy57","h_gammaD_cT_Z_lab_dummy",5,0,50);
   h_gammaD_cT_Z_lab_dummy57->SetMaximum(0.08071462);
   h_gammaD_cT_Z_lab_dummy57->SetLineStyle(0);
   h_gammaD_cT_Z_lab_dummy57->SetMarkerStyle(20);
   h_gammaD_cT_Z_lab_dummy57->GetXaxis()->SetTitle("L_{Z} of #gamma_{D} [mm]");
   h_gammaD_cT_Z_lab_dummy57->GetXaxis()->SetLabelFont(42);
   h_gammaD_cT_Z_lab_dummy57->GetXaxis()->SetLabelOffset(0.007);
   h_gammaD_cT_Z_lab_dummy57->GetXaxis()->SetTitleSize(0.06);
   h_gammaD_cT_Z_lab_dummy57->GetXaxis()->SetTitleOffset(0.95);
   h_gammaD_cT_Z_lab_dummy57->GetXaxis()->SetTitleFont(42);
   h_gammaD_cT_Z_lab_dummy57->GetYaxis()->SetTitle("Normalized Fraction of events / 10.0 mm");
   h_gammaD_cT_Z_lab_dummy57->GetYaxis()->SetLabelFont(42);
   h_gammaD_cT_Z_lab_dummy57->GetYaxis()->SetLabelOffset(0.007);
   h_gammaD_cT_Z_lab_dummy57->GetYaxis()->SetTitleSize(0.05);
   h_gammaD_cT_Z_lab_dummy57->GetYaxis()->SetTitleOffset(1.3);
   h_gammaD_cT_Z_lab_dummy57->GetYaxis()->SetTitleFont(42);
   h_gammaD_cT_Z_lab_dummy57->GetZaxis()->SetLabelFont(42);
   h_gammaD_cT_Z_lab_dummy57->GetZaxis()->SetLabelOffset(0.007);
   h_gammaD_cT_Z_lab_dummy57->GetZaxis()->SetTitleSize(0.06);
   h_gammaD_cT_Z_lab_dummy57->GetZaxis()->SetTitleFont(42);
   h_gammaD_cT_Z_lab_dummy57->Draw("");
   
   TH1F *h_gammaD_cT_Z_lab58 = new TH1F("h_gammaD_cT_Z_lab58","h_gammaD_cT_Z_lab",5,0,50);
   h_gammaD_cT_Z_lab58->SetBinContent(1,0.04484145);
   h_gammaD_cT_Z_lab58->SetBinContent(2,0.02460945);
   h_gammaD_cT_Z_lab58->SetBinContent(3,0.01479324);
   h_gammaD_cT_Z_lab58->SetBinContent(4,0.009401793);
   h_gammaD_cT_Z_lab58->SetBinContent(5,0.006354062);
   h_gammaD_cT_Z_lab58->SetBinContent(6,0.03052218);
   h_gammaD_cT_Z_lab58->SetEntries(159998);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#0000ff");
   h_gammaD_cT_Z_lab58->SetLineColor(ci);
   h_gammaD_cT_Z_lab58->SetLineWidth(2);
   h_gammaD_cT_Z_lab58->SetMarkerStyle(20);
   h_gammaD_cT_Z_lab58->GetXaxis()->SetTitle("L_{z} of #gamma_{D} [mm]");
   h_gammaD_cT_Z_lab58->GetXaxis()->SetLabelFont(42);
   h_gammaD_cT_Z_lab58->GetXaxis()->SetLabelOffset(0.007);
   h_gammaD_cT_Z_lab58->GetXaxis()->SetTitleSize(0.06);
   h_gammaD_cT_Z_lab58->GetXaxis()->SetTitleOffset(0.95);
   h_gammaD_cT_Z_lab58->GetXaxis()->SetTitleFont(42);
   h_gammaD_cT_Z_lab58->GetYaxis()->SetTitle("Events");
   h_gammaD_cT_Z_lab58->GetYaxis()->SetLabelFont(42);
   h_gammaD_cT_Z_lab58->GetYaxis()->SetLabelOffset(0.007);
   h_gammaD_cT_Z_lab58->GetYaxis()->SetTitleSize(0.06);
   h_gammaD_cT_Z_lab58->GetYaxis()->SetTitleOffset(1.5);
   h_gammaD_cT_Z_lab58->GetYaxis()->SetTitleFont(42);
   h_gammaD_cT_Z_lab58->GetZaxis()->SetLabelFont(42);
   h_gammaD_cT_Z_lab58->GetZaxis()->SetLabelOffset(0.007);
   h_gammaD_cT_Z_lab58->GetZaxis()->SetTitleSize(0.06);
   h_gammaD_cT_Z_lab58->GetZaxis()->SetTitleFont(42);
   h_gammaD_cT_Z_lab58->Draw("same");
   
   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 DarkSusy_mH_125_mGammaD_2000_cT_10_LHE_dimuon_p()
{
//=========Macro generated from canvas: cnv/cnv
//=========  (Sun May 24 15:17:57 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(-21.25,-0.006229087,103.75,0.04168697);
    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_1_p_dummy132 = new TH1F("h_dimuon_1_p_dummy132","h_dimuon_1_p_dummy",100,0,100);
    h_dimuon_1_p_dummy132->SetMaximum(0.03833284);
    h_dimuon_1_p_dummy132->SetLineStyle(0);
    h_dimuon_1_p_dummy132->SetMarkerStyle(20);
    h_dimuon_1_p_dummy132->GetXaxis()->SetTitle("p of #mu#mu [GeV]");
    h_dimuon_1_p_dummy132->GetXaxis()->SetLabelFont(42);
    h_dimuon_1_p_dummy132->GetXaxis()->SetLabelOffset(0.007);
    h_dimuon_1_p_dummy132->GetXaxis()->SetTitleSize(0.06);
    h_dimuon_1_p_dummy132->GetXaxis()->SetTitleOffset(0.95);
    h_dimuon_1_p_dummy132->GetXaxis()->SetTitleFont(42);
    h_dimuon_1_p_dummy132->GetYaxis()->SetTitle("Fraction of events / 1 GeV");
    h_dimuon_1_p_dummy132->GetYaxis()->SetLabelFont(42);
    h_dimuon_1_p_dummy132->GetYaxis()->SetLabelOffset(0.007);
    h_dimuon_1_p_dummy132->GetYaxis()->SetTitleSize(0.06);
    h_dimuon_1_p_dummy132->GetYaxis()->SetTitleOffset(1.35);
    h_dimuon_1_p_dummy132->GetYaxis()->SetTitleFont(42);
    h_dimuon_1_p_dummy132->GetZaxis()->SetLabelFont(42);
    h_dimuon_1_p_dummy132->GetZaxis()->SetLabelOffset(0.007);
    h_dimuon_1_p_dummy132->GetZaxis()->SetTitleSize(0.06);
    h_dimuon_1_p_dummy132->GetZaxis()->SetTitleFont(42);
    h_dimuon_1_p_dummy132->Draw("");

    TH1F *h_dimuon_1_p133 = new TH1F("h_dimuon_1_p133","h_dimuon_1_p",101,0,101);
    h_dimuon_1_p133->SetBinContent(4,3.64385e-05);
    h_dimuon_1_p133->SetBinContent(5,0.000145754);
    h_dimuon_1_p133->SetBinContent(6,0.0002004118);
    h_dimuon_1_p133->SetBinContent(7,0.0004008235);
    h_dimuon_1_p133->SetBinContent(8,0.0006012353);
    h_dimuon_1_p133->SetBinContent(9,0.0009656203);
    h_dimuon_1_p133->SetBinContent(10,0.001657952);
    h_dimuon_1_p133->SetBinContent(11,0.001967679);
    h_dimuon_1_p133->SetBinContent(12,0.002477818);
    h_dimuon_1_p133->SetBinContent(13,0.003206588);
    h_dimuon_1_p133->SetBinContent(14,0.00413577);
    h_dimuon_1_p133->SetBinContent(15,0.004700567);
    h_dimuon_1_p133->SetBinContent(16,0.005283582);
    h_dimuon_1_p133->SetBinContent(17,0.006832219);
    h_dimuon_1_p133->SetBinContent(18,0.007816059);
    h_dimuon_1_p133->SetBinContent(19,0.008052909);
    h_dimuon_1_p133->SetBinContent(20,0.009437571);
    h_dimuon_1_p133->SetBinContent(21,0.01118662);
    h_dimuon_1_p133->SetBinContent(22,0.01244375);
    h_dimuon_1_p133->SetBinContent(23,0.01186073);
    h_dimuon_1_p133->SetBinContent(24,0.01373732);
    h_dimuon_1_p133->SetBinContent(25,0.01473937);
    h_dimuon_1_p133->SetBinContent(26,0.01512198);
    h_dimuon_1_p133->SetBinContent(27,0.01619691);
    h_dimuon_1_p133->SetBinContent(28,0.01687103);
    h_dimuon_1_p133->SetBinContent(29,0.01738117);
    h_dimuon_1_p133->SetBinContent(30,0.01690746);
    h_dimuon_1_p133->SetBinContent(31,0.01783665);
    h_dimuon_1_p133->SetBinContent(32,0.01896624);
    h_dimuon_1_p133->SetBinContent(33,0.01947638);
    h_dimuon_1_p133->SetBinContent(34,0.02062419);
    h_dimuon_1_p133->SetBinContent(35,0.01967679);
    h_dimuon_1_p133->SetBinContent(36,0.0210068);
    h_dimuon_1_p133->SetBinContent(37,0.02217283);
    h_dimuon_1_p133->SetBinContent(38,0.02055131);
    h_dimuon_1_p133->SetBinContent(39,0.0208246);
    h_dimuon_1_p133->SetBinContent(40,0.02208173);
    h_dimuon_1_p133->SetBinContent(41,0.02321132);
    h_dimuon_1_p133->SetBinContent(42,0.02208173);
    h_dimuon_1_p133->SetBinContent(43,0.02133474);
    h_dimuon_1_p133->SetBinContent(44,0.02189954);
    h_dimuon_1_p133->SetBinContent(45,0.02020515);
    h_dimuon_1_p133->SetBinContent(46,0.01984076);
    h_dimuon_1_p133->SetBinContent(47,0.01860186);
    h_dimuon_1_p133->SetBinContent(48,0.01734473);
    h_dimuon_1_p133->SetBinContent(49,0.01747226);
    h_dimuon_1_p133->SetBinContent(50,0.01475759);
    h_dimuon_1_p133->SetBinContent(51,0.01444787);
    h_dimuon_1_p133->SetBinContent(52,0.01415636);
    h_dimuon_1_p133->SetBinContent(53,0.01381019);
    h_dimuon_1_p133->SetBinContent(54,0.0126806);
    h_dimuon_1_p133->SetBinContent(55,0.01191539);
    h_dimuon_1_p133->SetBinContent(56,0.01129594);
    h_dimuon_1_p133->SetBinContent(57,0.01191539);
    h_dimuon_1_p133->SetBinContent(58,0.011551);
    h_dimuon_1_p133->SetBinContent(59,0.01036675);
    h_dimuon_1_p133->SetBinContent(60,0.0110773);
    h_dimuon_1_p133->SetBinContent(61,0.01056716);
    h_dimuon_1_p133->SetBinContent(62,0.009947711);
    h_dimuon_1_p133->SetBinContent(63,0.009893053);
    h_dimuon_1_p133->SetBinContent(64,0.009018529);
    h_dimuon_1_p133->SetBinContent(65,0.008144005);
    h_dimuon_1_p133->SetBinContent(66,0.008799898);
    h_dimuon_1_p133->SetBinContent(67,0.00849017);
    h_dimuon_1_p133->SetBinContent(68,0.008216882);
    h_dimuon_1_p133->SetBinContent(69,0.008526609);
    h_dimuon_1_p133->SetBinContent(70,0.008799898);
    h_dimuon_1_p133->SetBinContent(71,0.008581267);
    h_dimuon_1_p133->SetBinContent(72,0.008089347);
    h_dimuon_1_p133->SetBinContent(73,0.007360577);
    h_dimuon_1_p133->SetBinContent(74,0.007196604);
    h_dimuon_1_p133->SetBinContent(75,0.007233042);
    h_dimuon_1_p133->SetBinContent(76,0.007160165);
    h_dimuon_1_p133->SetBinContent(77,0.00703263);
    h_dimuon_1_p133->SetBinContent(78,0.006704684);
    h_dimuon_1_p133->SetBinContent(79,0.006686465);
    h_dimuon_1_p133->SetBinContent(80,0.007160165);
    h_dimuon_1_p133->SetBinContent(81,0.00632208);
    h_dimuon_1_p133->SetBinContent(82,0.006121668);
    h_dimuon_1_p133->SetBinContent(83,0.005957695);
    h_dimuon_1_p133->SetBinContent(84,0.006522492);
    h_dimuon_1_p133->SetBinContent(85,0.006048791);
    h_dimuon_1_p133->SetBinContent(86,0.005283582);
    h_dimuon_1_p133->SetBinContent(87,0.006358518);
    h_dimuon_1_p133->SetBinContent(88,0.005739064);
    h_dimuon_1_p133->SetBinContent(89,0.005538652);
    h_dimuon_1_p133->SetBinContent(90,0.005283582);
    h_dimuon_1_p133->SetBinContent(91,0.005083171);
    h_dimuon_1_p133->SetBinContent(92,0.005629749);
    h_dimuon_1_p133->SetBinContent(93,0.005411117);
    h_dimuon_1_p133->SetBinContent(94,0.004828101);
    h_dimuon_1_p133->SetBinContent(95,0.004791663);
    h_dimuon_1_p133->SetBinContent(96,0.005083171);
    h_dimuon_1_p133->SetBinContent(97,0.004700567);
    h_dimuon_1_p133->SetBinContent(98,0.004573032);
    h_dimuon_1_p133->SetBinContent(99,0.004900978);
    h_dimuon_1_p133->SetBinContent(100,0.004664128);
    h_dimuon_1_p133->SetBinError(4,3.64385e-05);
    h_dimuon_1_p133->SetBinError(5,0.000145754);
    h_dimuon_1_p133->SetBinError(6,0.0002004118);
    h_dimuon_1_p133->SetBinError(7,0.0004008235);
    h_dimuon_1_p133->SetBinError(8,0.0006012353);
    h_dimuon_1_p133->SetBinError(9,0.0009656203);
    h_dimuon_1_p133->SetBinError(10,0.001657952);
    h_dimuon_1_p133->SetBinError(11,0.001967679);
    h_dimuon_1_p133->SetBinError(12,0.002477818);
    h_dimuon_1_p133->SetBinError(13,0.003206588);
    h_dimuon_1_p133->SetBinError(14,0.00413577);
    h_dimuon_1_p133->SetBinError(15,0.004700567);
    h_dimuon_1_p133->SetBinError(16,0.005283583);
    h_dimuon_1_p133->SetBinError(17,0.006832219);
    h_dimuon_1_p133->SetBinError(18,0.007816058);
    h_dimuon_1_p133->SetBinError(19,0.008052909);
    h_dimuon_1_p133->SetBinError(20,0.009437572);
    h_dimuon_1_p133->SetBinError(21,0.01118662);
    h_dimuon_1_p133->SetBinError(22,0.01244375);
    h_dimuon_1_p133->SetBinError(23,0.01186073);
    h_dimuon_1_p133->SetBinError(24,0.01373731);
    h_dimuon_1_p133->SetBinError(25,0.01473937);
    h_dimuon_1_p133->SetBinError(26,0.01512198);
    h_dimuon_1_p133->SetBinError(27,0.01619691);
    h_dimuon_1_p133->SetBinError(28,0.01687103);
    h_dimuon_1_p133->SetBinError(29,0.01738116);
    h_dimuon_1_p133->SetBinError(30,0.01690746);
    h_dimuon_1_p133->SetBinError(31,0.01783665);
    h_dimuon_1_p133->SetBinError(32,0.01896624);
    h_dimuon_1_p133->SetBinError(33,0.01947638);
    h_dimuon_1_p133->SetBinError(34,0.02062419);
    h_dimuon_1_p133->SetBinError(35,0.01967679);
    h_dimuon_1_p133->SetBinError(36,0.0210068);
    h_dimuon_1_p133->SetBinError(37,0.02217283);
    h_dimuon_1_p133->SetBinError(38,0.02055131);
    h_dimuon_1_p133->SetBinError(39,0.0208246);
    h_dimuon_1_p133->SetBinError(40,0.02208173);
    h_dimuon_1_p133->SetBinError(41,0.02321133);
    h_dimuon_1_p133->SetBinError(42,0.02208173);
    h_dimuon_1_p133->SetBinError(43,0.02133474);
    h_dimuon_1_p133->SetBinError(44,0.02189954);
    h_dimuon_1_p133->SetBinError(45,0.02020515);
    h_dimuon_1_p133->SetBinError(46,0.01984076);
    h_dimuon_1_p133->SetBinError(47,0.01860185);
    h_dimuon_1_p133->SetBinError(48,0.01734473);
    h_dimuon_1_p133->SetBinError(49,0.01747226);
    h_dimuon_1_p133->SetBinError(50,0.01475759);
    h_dimuon_1_p133->SetBinError(51,0.01444787);
    h_dimuon_1_p133->SetBinError(52,0.01415636);
    h_dimuon_1_p133->SetBinError(53,0.01381019);
    h_dimuon_1_p133->SetBinError(54,0.0126806);
    h_dimuon_1_p133->SetBinError(55,0.01191539);
    h_dimuon_1_p133->SetBinError(56,0.01129594);
    h_dimuon_1_p133->SetBinError(57,0.01191539);
    h_dimuon_1_p133->SetBinError(58,0.011551);
    h_dimuon_1_p133->SetBinError(59,0.01036675);
    h_dimuon_1_p133->SetBinError(60,0.0110773);
    h_dimuon_1_p133->SetBinError(61,0.01056717);
    h_dimuon_1_p133->SetBinError(62,0.009947711);
    h_dimuon_1_p133->SetBinError(63,0.009893053);
    h_dimuon_1_p133->SetBinError(64,0.009018529);
    h_dimuon_1_p133->SetBinError(65,0.008144005);
    h_dimuon_1_p133->SetBinError(66,0.008799898);
    h_dimuon_1_p133->SetBinError(67,0.008490171);
    h_dimuon_1_p133->SetBinError(68,0.008216882);
    h_dimuon_1_p133->SetBinError(69,0.008526609);
    h_dimuon_1_p133->SetBinError(70,0.008799898);
    h_dimuon_1_p133->SetBinError(71,0.008581267);
    h_dimuon_1_p133->SetBinError(72,0.008089347);
    h_dimuon_1_p133->SetBinError(73,0.007360577);
    h_dimuon_1_p133->SetBinError(74,0.007196604);
    h_dimuon_1_p133->SetBinError(75,0.007233042);
    h_dimuon_1_p133->SetBinError(76,0.007160165);
    h_dimuon_1_p133->SetBinError(77,0.007032631);
    h_dimuon_1_p133->SetBinError(78,0.006704684);
    h_dimuon_1_p133->SetBinError(79,0.006686465);
    h_dimuon_1_p133->SetBinError(80,0.007160165);
    h_dimuon_1_p133->SetBinError(81,0.00632208);
    h_dimuon_1_p133->SetBinError(82,0.006121668);
    h_dimuon_1_p133->SetBinError(83,0.005957695);
    h_dimuon_1_p133->SetBinError(84,0.006522492);
    h_dimuon_1_p133->SetBinError(85,0.006048791);
    h_dimuon_1_p133->SetBinError(86,0.005283583);
    h_dimuon_1_p133->SetBinError(87,0.006358518);
    h_dimuon_1_p133->SetBinError(88,0.005739064);
    h_dimuon_1_p133->SetBinError(89,0.005538652);
    h_dimuon_1_p133->SetBinError(90,0.005283583);
    h_dimuon_1_p133->SetBinError(91,0.005083171);
    h_dimuon_1_p133->SetBinError(92,0.005629748);
    h_dimuon_1_p133->SetBinError(93,0.005411117);
    h_dimuon_1_p133->SetBinError(94,0.004828101);
    h_dimuon_1_p133->SetBinError(95,0.004791663);
    h_dimuon_1_p133->SetBinError(96,0.005083171);
    h_dimuon_1_p133->SetBinError(97,0.004700567);
    h_dimuon_1_p133->SetBinError(98,0.004573032);
    h_dimuon_1_p133->SetBinError(99,0.004900978);
    h_dimuon_1_p133->SetBinError(100,0.004664128);
    h_dimuon_1_p133->SetEntries(79999);
    h_dimuon_1_p133->SetDirectory(0);

    Int_t ci;      // for color index setting
    TColor *color; // for color definition with alpha
    ci = TColor::GetColor("#0000ff");
    h_dimuon_1_p133->SetLineColor(ci);
    h_dimuon_1_p133->SetLineWidth(2);
    h_dimuon_1_p133->SetMarkerStyle(20);
    h_dimuon_1_p133->GetXaxis()->SetLabelFont(42);
    h_dimuon_1_p133->GetXaxis()->SetLabelOffset(0.007);
    h_dimuon_1_p133->GetXaxis()->SetTitleSize(0.06);
    h_dimuon_1_p133->GetXaxis()->SetTitleOffset(0.95);
    h_dimuon_1_p133->GetXaxis()->SetTitleFont(42);
    h_dimuon_1_p133->GetYaxis()->SetLabelFont(42);
    h_dimuon_1_p133->GetYaxis()->SetLabelOffset(0.007);
    h_dimuon_1_p133->GetYaxis()->SetTitleSize(0.06);
    h_dimuon_1_p133->GetYaxis()->SetTitleOffset(1.3);
    h_dimuon_1_p133->GetYaxis()->SetTitleFont(42);
    h_dimuon_1_p133->GetZaxis()->SetLabelFont(42);
    h_dimuon_1_p133->GetZaxis()->SetLabelOffset(0.007);
    h_dimuon_1_p133->GetZaxis()->SetTitleSize(0.06);
    h_dimuon_1_p133->GetZaxis()->SetTitleFont(42);
    h_dimuon_1_p133->Draw("SAME");

    TH1F *h_dimuon_2_p134 = new TH1F("h_dimuon_2_p134","h_dimuon_2_p",101,0,101);
    h_dimuon_2_p134->SetBinContent(2,0.0003750449);
    h_dimuon_2_p134->SetBinContent(3,0.001027297);
    h_dimuon_2_p134->SetBinContent(4,0.001989368);
    h_dimuon_2_p134->SetBinContent(5,0.003880899);
    h_dimuon_2_p134->SetBinContent(6,0.006131168);
    h_dimuon_2_p134->SetBinContent(7,0.00722369);
    h_dimuon_2_p134->SetBinContent(8,0.009522878);
    h_dimuon_2_p134->SetBinContent(9,0.01079477);
    h_dimuon_2_p134->SetBinContent(10,0.01260477);
    h_dimuon_2_p134->SetBinContent(11,0.01457783);
    h_dimuon_2_p134->SetBinContent(12,0.01599648);
    h_dimuon_2_p134->SetBinContent(13,0.01635522);
    h_dimuon_2_p134->SetBinContent(14,0.0176108);
    h_dimuon_2_p134->SetBinContent(15,0.0181326);
    h_dimuon_2_p134->SetBinContent(16,0.02015458);
    h_dimuon_2_p134->SetBinContent(17,0.01997522);
    h_dimuon_2_p134->SetBinContent(18,0.02052963);
    h_dimuon_2_p134->SetBinContent(19,0.02088837);
    h_dimuon_2_p134->SetBinContent(20,0.02114927);
    h_dimuon_2_p134->SetBinContent(21,0.0209862);
    h_dimuon_2_p134->SetBinContent(22,0.02000783);
    h_dimuon_2_p134->SetBinContent(23,0.02113296);
    h_dimuon_2_p134->SetBinContent(24,0.02124711);
    h_dimuon_2_p134->SetBinContent(25,0.01973062);
    h_dimuon_2_p134->SetBinContent(26,0.02129602);
    h_dimuon_2_p134->SetBinContent(27,0.02036657);
    h_dimuon_2_p134->SetBinContent(28,0.02074161);
    h_dimuon_2_p134->SetBinContent(29,0.01943711);
    h_dimuon_2_p134->SetBinContent(30,0.01912729);
    h_dimuon_2_p134->SetBinContent(31,0.01840981);
    h_dimuon_2_p134->SetBinContent(32,0.0183772);
    h_dimuon_2_p134->SetBinContent(33,0.01686071);
    h_dimuon_2_p134->SetBinContent(34,0.01700747);
    h_dimuon_2_p134->SetBinContent(35,0.01575188);
    h_dimuon_2_p134->SetBinContent(36,0.01643675);
    h_dimuon_2_p134->SetBinContent(37,0.01560513);
    h_dimuon_2_p134->SetBinContent(38,0.0137136);
    h_dimuon_2_p134->SetBinContent(39,0.01433324);
    h_dimuon_2_p134->SetBinContent(40,0.01338747);
    h_dimuon_2_p134->SetBinContent(41,0.01330594);
    h_dimuon_2_p134->SetBinContent(42,0.01342008);
    h_dimuon_2_p134->SetBinContent(43,0.01271891);
    h_dimuon_2_p134->SetBinContent(44,0.01134918);
    h_dimuon_2_p134->SetBinContent(45,0.01182207);
    h_dimuon_2_p134->SetBinContent(46,0.01095783);
    h_dimuon_2_p134->SetBinContent(47,0.01085999);
    h_dimuon_2_p134->SetBinContent(48,0.00986531);
    h_dimuon_2_p134->SetBinContent(49,0.009441346);
    h_dimuon_2_p134->SetBinContent(50,0.009669635);
    h_dimuon_2_p134->SetBinContent(51,0.009849004);
    h_dimuon_2_p134->SetBinContent(52,0.009310896);
    h_dimuon_2_p134->SetBinContent(53,0.008462968);
    h_dimuon_2_p134->SetBinContent(54,0.008756482);
    h_dimuon_2_p134->SetBinContent(55,0.008707562);
    h_dimuon_2_p134->SetBinContent(56,0.00867495);
    h_dimuon_2_p134->SetBinContent(57,0.007696572);
    h_dimuon_2_p134->SetBinContent(58,0.007859635);
    h_dimuon_2_p134->SetBinContent(59,0.007435672);
    h_dimuon_2_p134->SetBinContent(60,0.007598734);
    h_dimuon_2_p134->SetBinContent(61,0.007419365);
    h_dimuon_2_p134->SetBinContent(62,0.007239996);
    h_dimuon_2_p134->SetBinContent(63,0.006799726);
    h_dimuon_2_p134->SetBinContent(64,0.007011708);
    h_dimuon_2_p134->SetBinContent(65,0.006636663);
    h_dimuon_2_p134->SetBinContent(66,0.006277924);
    h_dimuon_2_p134->SetBinContent(67,0.006799726);
    h_dimuon_2_p134->SetBinContent(68,0.006359456);
    h_dimuon_2_p134->SetBinContent(69,0.006245312);
    h_dimuon_2_p134->SetBinContent(70,0.005788736);
    h_dimuon_2_p134->SetBinContent(71,0.00603333);
    h_dimuon_2_p134->SetBinContent(72,0.00502234);
    h_dimuon_2_p134->SetBinContent(73,0.005886573);
    h_dimuon_2_p134->SetBinContent(74,0.005446303);
    h_dimuon_2_p134->SetBinContent(75,0.005038646);
    h_dimuon_2_p134->SetBinContent(76,0.004842971);
    h_dimuon_2_p134->SetBinContent(77,0.004908196);
    h_dimuon_2_p134->SetBinContent(78,0.004614682);
    h_dimuon_2_p134->SetBinContent(79,0.005120177);
    h_dimuon_2_p134->SetBinContent(80,0.004598376);
    h_dimuon_2_p134->SetBinContent(81,0.004565763);
    h_dimuon_2_p134->SetBinContent(82,0.004598376);
    h_dimuon_2_p134->SetBinContent(83,0.004304863);
    h_dimuon_2_p134->SetBinContent(84,0.004533151);
    h_dimuon_2_p134->SetBinContent(85,0.004728826);
    h_dimuon_2_p134->SetBinContent(86,0.004076574);
    h_dimuon_2_p134->SetBinContent(87,0.004109187);
    h_dimuon_2_p134->SetBinContent(88,0.004255943);
    h_dimuon_2_p134->SetBinContent(89,0.003995043);
    h_dimuon_2_p134->SetBinContent(90,0.003815674);
    h_dimuon_2_p134->SetBinContent(91,0.004174412);
    h_dimuon_2_p134->SetBinContent(92,0.004467926);
    h_dimuon_2_p134->SetBinContent(93,0.003929818);
    h_dimuon_2_p134->SetBinContent(94,0.003701529);
    h_dimuon_2_p134->SetBinContent(95,0.004174412);
    h_dimuon_2_p134->SetBinContent(96,0.003766755);
    h_dimuon_2_p134->SetBinContent(97,0.003473241);
    h_dimuon_2_p134->SetBinContent(98,0.003717836);
    h_dimuon_2_p134->SetBinContent(99,0.003636304);
    h_dimuon_2_p134->SetBinContent(100,0.003244953);
    h_dimuon_2_p134->SetBinError(2,0.0003750448);
    h_dimuon_2_p134->SetBinError(3,0.001027297);
    h_dimuon_2_p134->SetBinError(4,0.001989368);
    h_dimuon_2_p134->SetBinError(5,0.003880899);
    h_dimuon_2_p134->SetBinError(6,0.006131168);
    h_dimuon_2_p134->SetBinError(7,0.00722369);
    h_dimuon_2_p134->SetBinError(8,0.009522878);
    h_dimuon_2_p134->SetBinError(9,0.01079477);
    h_dimuon_2_p134->SetBinError(10,0.01260477);
    h_dimuon_2_p134->SetBinError(11,0.01457783);
    h_dimuon_2_p134->SetBinError(12,0.01599648);
    h_dimuon_2_p134->SetBinError(13,0.01635522);
    h_dimuon_2_p134->SetBinError(14,0.0176108);
    h_dimuon_2_p134->SetBinError(15,0.0181326);
    h_dimuon_2_p134->SetBinError(16,0.02015458);
    h_dimuon_2_p134->SetBinError(17,0.01997521);
    h_dimuon_2_p134->SetBinError(18,0.02052963);
    h_dimuon_2_p134->SetBinError(19,0.02088837);
    h_dimuon_2_p134->SetBinError(20,0.02114927);
    h_dimuon_2_p134->SetBinError(21,0.0209862);
    h_dimuon_2_p134->SetBinError(22,0.02000783);
    h_dimuon_2_p134->SetBinError(23,0.02113296);
    h_dimuon_2_p134->SetBinError(24,0.02124711);
    h_dimuon_2_p134->SetBinError(25,0.01973062);
    h_dimuon_2_p134->SetBinError(26,0.02129602);
    h_dimuon_2_p134->SetBinError(27,0.02036657);
    h_dimuon_2_p134->SetBinError(28,0.02074161);
    h_dimuon_2_p134->SetBinError(29,0.01943711);
    h_dimuon_2_p134->SetBinError(30,0.01912729);
    h_dimuon_2_p134->SetBinError(31,0.01840981);
    h_dimuon_2_p134->SetBinError(32,0.0183772);
    h_dimuon_2_p134->SetBinError(33,0.01686071);
    h_dimuon_2_p134->SetBinError(34,0.01700747);
    h_dimuon_2_p134->SetBinError(35,0.01575188);
    h_dimuon_2_p134->SetBinError(36,0.01643675);
    h_dimuon_2_p134->SetBinError(37,0.01560513);
    h_dimuon_2_p134->SetBinError(38,0.0137136);
    h_dimuon_2_p134->SetBinError(39,0.01433324);
    h_dimuon_2_p134->SetBinError(40,0.01338747);
    h_dimuon_2_p134->SetBinError(41,0.01330594);
    h_dimuon_2_p134->SetBinError(42,0.01342008);
    h_dimuon_2_p134->SetBinError(43,0.01271891);
    h_dimuon_2_p134->SetBinError(44,0.01134918);
    h_dimuon_2_p134->SetBinError(45,0.01182207);
    h_dimuon_2_p134->SetBinError(46,0.01095783);
    h_dimuon_2_p134->SetBinError(47,0.01085999);
    h_dimuon_2_p134->SetBinError(48,0.00986531);
    h_dimuon_2_p134->SetBinError(49,0.009441346);
    h_dimuon_2_p134->SetBinError(50,0.009669634);
    h_dimuon_2_p134->SetBinError(51,0.009849004);
    h_dimuon_2_p134->SetBinError(52,0.009310896);
    h_dimuon_2_p134->SetBinError(53,0.008462968);
    h_dimuon_2_p134->SetBinError(54,0.008756482);
    h_dimuon_2_p134->SetBinError(55,0.008707563);
    h_dimuon_2_p134->SetBinError(56,0.00867495);
    h_dimuon_2_p134->SetBinError(57,0.007696572);
    h_dimuon_2_p134->SetBinError(58,0.007859635);
    h_dimuon_2_p134->SetBinError(59,0.007435672);
    h_dimuon_2_p134->SetBinError(60,0.007598735);
    h_dimuon_2_p134->SetBinError(61,0.007419365);
    h_dimuon_2_p134->SetBinError(62,0.007239996);
    h_dimuon_2_p134->SetBinError(63,0.006799726);
    h_dimuon_2_p134->SetBinError(64,0.007011708);
    h_dimuon_2_p134->SetBinError(65,0.006636663);
    h_dimuon_2_p134->SetBinError(66,0.006277925);
    h_dimuon_2_p134->SetBinError(67,0.006799726);
    h_dimuon_2_p134->SetBinError(68,0.006359456);
    h_dimuon_2_p134->SetBinError(69,0.006245312);
    h_dimuon_2_p134->SetBinError(70,0.005788736);
    h_dimuon_2_p134->SetBinError(71,0.00603333);
    h_dimuon_2_p134->SetBinError(72,0.00502234);
    h_dimuon_2_p134->SetBinError(73,0.005886573);
    h_dimuon_2_p134->SetBinError(74,0.005446303);
    h_dimuon_2_p134->SetBinError(75,0.005038646);
    h_dimuon_2_p134->SetBinError(76,0.00484297);
    h_dimuon_2_p134->SetBinError(77,0.004908196);
    h_dimuon_2_p134->SetBinError(78,0.004614682);
    h_dimuon_2_p134->SetBinError(79,0.005120177);
    h_dimuon_2_p134->SetBinError(80,0.004598376);
    h_dimuon_2_p134->SetBinError(81,0.004565763);
    h_dimuon_2_p134->SetBinError(82,0.004598376);
    h_dimuon_2_p134->SetBinError(83,0.004304863);
    h_dimuon_2_p134->SetBinError(84,0.004533151);
    h_dimuon_2_p134->SetBinError(85,0.004728826);
    h_dimuon_2_p134->SetBinError(86,0.004076574);
    h_dimuon_2_p134->SetBinError(87,0.004109187);
    h_dimuon_2_p134->SetBinError(88,0.004255944);
    h_dimuon_2_p134->SetBinError(89,0.003995043);
    h_dimuon_2_p134->SetBinError(90,0.003815674);
    h_dimuon_2_p134->SetBinError(91,0.004174412);
    h_dimuon_2_p134->SetBinError(92,0.004467926);
    h_dimuon_2_p134->SetBinError(93,0.003929818);
    h_dimuon_2_p134->SetBinError(94,0.00370153);
    h_dimuon_2_p134->SetBinError(95,0.004174412);
    h_dimuon_2_p134->SetBinError(96,0.003766755);
    h_dimuon_2_p134->SetBinError(97,0.003473241);
    h_dimuon_2_p134->SetBinError(98,0.003717836);
    h_dimuon_2_p134->SetBinError(99,0.003636304);
    h_dimuon_2_p134->SetBinError(100,0.003244953);
    h_dimuon_2_p134->SetEntries(79999);
    h_dimuon_2_p134->SetDirectory(0);

    ci = TColor::GetColor("#ff0000");
    h_dimuon_2_p134->SetLineColor(ci);
    h_dimuon_2_p134->SetLineWidth(2);
    h_dimuon_2_p134->SetMarkerStyle(20);
    h_dimuon_2_p134->GetXaxis()->SetLabelFont(42);
    h_dimuon_2_p134->GetXaxis()->SetLabelOffset(0.007);
    h_dimuon_2_p134->GetXaxis()->SetTitleSize(0.06);
    h_dimuon_2_p134->GetXaxis()->SetTitleOffset(0.95);
    h_dimuon_2_p134->GetXaxis()->SetTitleFont(42);
    h_dimuon_2_p134->GetYaxis()->SetLabelFont(42);
    h_dimuon_2_p134->GetYaxis()->SetLabelOffset(0.007);
    h_dimuon_2_p134->GetYaxis()->SetTitleSize(0.06);
    h_dimuon_2_p134->GetYaxis()->SetTitleOffset(1.3);
    h_dimuon_2_p134->GetYaxis()->SetTitleFont(42);
    h_dimuon_2_p134->GetZaxis()->SetLabelFont(42);
    h_dimuon_2_p134->GetZaxis()->SetLabelOffset(0.007);
    h_dimuon_2_p134->GetZaxis()->SetTitleSize(0.06);
    h_dimuon_2_p134->GetZaxis()->SetTitleFont(42);
    h_dimuon_2_p134->Draw("SAME");

    TLegend *leg = new TLegend(0.46,0.6744444,0.6955556,0.7644444,NULL,"brNDC");
    leg->SetBorderSize(0);
    leg->SetTextSize(0.02777778);
    leg->SetLineColor(1);
    leg->SetLineStyle(1);
    leg->SetLineWidth(1);
    leg->SetFillColor(0);
    leg->SetFillStyle(0);
    TLegendEntry *entry=leg->AddEntry("h_dimuon_1_p","1st #mu#mu (leading p_{T})","L");

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

    ci = TColor::GetColor("#ff0000");
    entry->SetLineColor(ci);
    entry->SetLineStyle(1);
    entry->SetLineWidth(2);
    entry->SetMarkerColor(1);
    entry->SetMarkerStyle(21);
    entry->SetMarkerSize(1);
    entry->SetTextFont(42);
    leg->Draw();

    leg = new TLegend(0.4566667,0.82,0.7822222,0.9066667,NULL,"brNDC");
    leg->SetBorderSize(0);
    leg->SetTextSize(0.02777778);
    leg->SetLineColor(1);
    leg->SetLineStyle(1);
    leg->SetLineWidth(1);
    leg->SetFillColor(0);
    leg->SetFillStyle(0);
    entry=leg->AddEntry("NULL","#splitline{pp #rightarrow h #rightarrow 2n_{1} #rightarrow 2n_{D} + 2 #gamma_{D} #rightarrow 2n_{D} + 4#mu}{#splitline{m_{h} = 125 GeV, m_{n_{1}} = 50 GeV, m_{n_{D}} = 1 GeV}{m_{#gamma_{D}} = 20 GeV, c#tau_{#gamma_{D}} = 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);
}
Exemplo n.º 24
0
void PlotPhaseVelocityFunctions( const TString &opt="")
{
#ifdef __CINT__
  gSystem->Load("libplasma.so");
#endif

  PlasmaGlob::Initialize();

  // Palettes!
  gROOT->Macro("PlasmaPalettes.C");
  
  gStyle->SetPadTopMargin(0.06); 
  gStyle->SetPadGridY(0);
  gStyle->SetPadGridX(0);
  gStyle->SetFrameLineWidth(2);
  gStyle->SetLabelSize(0.04, "xyz");
  gStyle->SetTitleOffset(1.2,"y");
  gStyle->SetTitleOffset(1.2,"z");
  gStyle->SetNdivisions(505,"xyz");

  PUnits::UnitsTable::Get();
  
  // // SPS parameters from Pukhov, Kumar et al. PRL107,145003(2011)
  // Double_t n0 = 7.76e14 / PUnits::cm3;
  // Double_t nb = 1.5e12 / PUnits::cm3;
  // Double_t lambda = PFunc::PlasmaWavelength(n0);
  // Double_t kp = PFunc::PlasmaWavenumber(n0);
  // Double_t skindepth =  PFunc::PlasmaSkindepth(n0);
  // Double_t r0 = 0.19 * PUnits::mm;
  // Double_t z  = 2.5 * PUnits::m;
  // Double_t zg = -28.6 * PUnits::mm;
  // Double_t E  = 450 * PUnits::GeV;
  // Double_t gamma = E / PConst::ProtonMassE ;

  // SPS parameters from Schroeder et al. PRL107,145002(2011)
  // Double_t n0 = 1.0;
  // Double_t nb = 0.002;
  // Double_t lambda = TMath::TwoPi();
  // Double_t kp = 1.0;
  // Double_t r0 = 1.0;
  // Double_t z  = 13105;
  // Double_t E  = 450 * PUnits::GeV;
  // Double_t gamma = E / PConst::ProtonMassE ;

  // PITZ parameters
  Double_t n0 = 1.0e15 / PUnits::cm3;
  Double_t nb = 1.05e13 / PUnits::cm3;
  Double_t lambda = PFunc::PlasmaWavelength(n0);
  Double_t kp = PFunc::PlasmaWavenumber(n0);
  Double_t skindepth =  PFunc::PlasmaSkindepth(n0);
  Double_t r0 = 34.259 * PUnits::um;
  Double_t z  = 150. * PUnits::mm;
  Double_t zg = -5. * PUnits::mm;
  Double_t E  = 25 * PUnits::MeV;
  Double_t gamma = (E / PConst::ElectronMassE) + 1.0;
  Double_t vb = TMath::Sqrt(1. - (1./(gamma*gamma)));

  cout << " n0 = " << n0 * PUnits::cm3 << "  e/cc" << endl;
  cout << " Wavelength = " << PUnits::BestUnit(lambda, "Length") << endl;
  cout << " Skindepth = " << PUnits::BestUnit(skindepth, "Length") << endl;
  cout << " Wavenumber = " << kp * PUnits::mm << "  mm^-1" << endl;

  // Normalized variables
  if(!opt.Contains("units")){
    r0 *= kp;
    nb /= n0;
    n0 = 1.0;
    z *= kp;
    zg *= kp;
  }
  

  Double_t N = PFunc::Nefoldings(z,zg,r0,gamma,nb,n0);
  Double_t r1 = (TMath::Power(3.,1./4.)/TMath::Power(8.*TMath::Pi()*N,1./2.)) * TMath::Exp(N) ;
  Double_t Gamma = PFunc::PhaseGamma(z,zg,r0,gamma,nb,n0);
  Double_t vph = PFunc::PhaseVelocity(z,zg,r0,gamma,nb,n0);
  Double_t vph2 = PFunc::PhaseVelocity2(z,zg,gamma,nb,n0);

  cout << " gamma beam = " << gamma << endl;
  cout << " zeta = " << z << endl;
  cout << " zeta comov. = " << zg << endl;
  cout << " r0 = " << r0 << endl;
  cout << " n_b0/n_0 = " << nb/n0 << endl;
  cout << " nu constant = " << PFunc::Nu(r0,n0) << endl;
  cout << " Number e-foldings = " << N << endl; 
  cout << " r1 = " << r1 << endl;
  cout << " Gamma wake = " << Gamma << endl;
  cout << " Wake Phase velocity  = " << vph << endl;
  cout << " Wake Phase velocity2 = " << vph2 << endl;
  cout << " Beam phase velocity  = " << vb << endl;

  const Int_t NPAR = 5;
  Double_t par[NPAR] = {zg,r0,gamma,nb,n0};
  TF1 *fPhaseVsZ2 = new TF1("fPhaseVsZ2",PhaseVelocityVsZ2,0,z,NPAR);
  fPhaseVsZ2->SetParameters(par);  
  TF1 *fPhaseVsZ = new TF1("fPhaseVsZ",PhaseVelocityVsZ,0,z,NPAR);
  fPhaseVsZ->SetParameters(par);

  Double_t par2[NPAR] = {z,r0,gamma,nb,n0};
  TF1 *fPhaseVsZg2 = new TF1("fPhaseVsZg2",PhaseVelocityVsZg2,zg,0.,NPAR);
  fPhaseVsZg2->SetParameters(par2);
  TF1 *fPhaseVsZg = new TF1("fPhaseVsZg",PhaseVelocityVsZg,zg,0.,NPAR);
  fPhaseVsZg->SetParameters(par2);
  
  const Int_t NPAR2D = 4;
  Double_t par3[NPAR2D] = {r0,gamma,nb,n0};
  TF2 *fPhaseVsZVsZg2 = new TF2("fPhaseVsZVsZg2",PhaseVelocityVsZVsZg2,0.,z,zg,0.,NPAR2D);
  fPhaseVsZVsZg2->SetParameters(par3);
  TF2 *fPhaseVsZVsZg = new TF2("fPhaseVsZVsZg",PhaseVelocityVsZVsZg,0.,z,zg,0.,NPAR2D);
  fPhaseVsZVsZg->SetParameters(par3);
  
  char ctext[64];
  TPaveText *textZetag = new TPaveText(0.13,0.85,0.38,0.92,"NDC");
  PlasmaGlob::SetPaveTextStyle(textZetag,12); 
  textZetag->SetTextColor(kGray+3);
  if(opt.Contains("units"))
    sprintf(ctext,"#zeta_{0} = %6.2f mm", zg / PUnits::mm);
  else
    sprintf(ctext,"#zeta_{0} = %6.2f c/#omega_{p}", zg);
  textZetag->AddText(ctext);
  
  TPaveText *textZeta = new TPaveText(0.13,0.85,0.38,0.92,"NDC");
  PlasmaGlob::SetPaveTextStyle(textZeta,12); 
  textZeta->SetTextColor(kGray+3);
  if(opt.Contains("units"))
    sprintf(ctext,"z_{0} = %6.2f mm", z / PUnits::mm);
  else
    sprintf(ctext,"z_{0} = %6.2f c/#omega_{p}", z);
  textZeta->AddText(ctext);

  // Graph for de-phasing:
  const Int_t NP = 100;
  TGraph *gPhase = new TGraph(NP);
  TGraph *gPhase2 = new TGraph(NP);
  Float_t phase  = zg;
  Float_t phase2 = zg;
  Float_t Dz = z / NP;
  for(Int_t i=0;i<NP;i++) {
    Float_t zp = (i+1)*Dz;
    Float_t v = PFunc::PhaseVelocity(zp,phase,r0,gamma,nb,n0);
    phase += (v - vb) * Dz;
    // cout << " z = " << zp << "  phase = " << phase << endl;
    if(opt.Contains("units"))
      gPhase->SetPoint(i,zp,(phase-zg)*kp);
    else
      gPhase->SetPoint(i,zp,(phase-zg));

    v = PFunc::PhaseVelocity2(zp,phase2,gamma,nb,n0);
    phase2 += (v - 1) * Dz;
    // cout << " z = " << zp << "  phase = " << phase << endl;
    if(opt.Contains("units"))
      gPhase2->SetPoint(i,zp,(phase2-zg)*kp);
    else
      gPhase2->SetPoint(i,zp,(phase2-zg));
  }
  
  TCanvas *C = new TCanvas("C","Wake phase velocity",1000,750);
  C->Divide(2,2);

  TLegend *Leg = new TLegend(0.6,0.20,0.85,0.35);
  PlasmaGlob::SetPaveStyle(Leg);
  Leg->SetTextAlign(22);
  Leg->SetTextColor(kGray+3);
  Leg->SetLineColor(1);
  Leg->SetBorderSize(1);
  Leg->SetFillColor(0);
  Leg->SetFillStyle(1001);
  //Leg-> SetNColumns(2);
  Leg->AddEntry(fPhaseVsZ,"PRL 107,145002","L");
  Leg->AddEntry(fPhaseVsZ2,"PRL 107,145003","L");
  Leg->SetTextColor(kGray+3);
  

  C->cd(1);
  fPhaseVsZ->GetYaxis()->SetTitle("(v_{p} - c)/c");
  if(opt.Contains("units")) 
    fPhaseVsZ->GetXaxis()->SetTitle("z [m]"); 
  else
    fPhaseVsZ->GetXaxis()->SetTitle("z [c/#omega_{p}]"); 
  fPhaseVsZ->GetYaxis()->SetRangeUser(-3e-4,0.);
  fPhaseVsZ->GetXaxis()->CenterTitle();
  fPhaseVsZ->GetYaxis()->CenterTitle();
  fPhaseVsZ->SetLineWidth(2);
  fPhaseVsZ->Draw("C");
  fPhaseVsZ2->SetLineWidth(2);
  fPhaseVsZ2->SetLineStyle(2);
  fPhaseVsZ2->Draw("C same");
  textZetag->Draw();
  Leg->Draw();

  C->cd(2);
  fPhaseVsZg->GetYaxis()->SetTitle("(v_{p} - c)/c");
  if(opt.Contains("units"))
    fPhaseVsZg->GetXaxis()->SetTitle("#zeta [m]"); 
  else
    fPhaseVsZg->GetXaxis()->SetTitle("#zeta [c/#omega_{p}]"); 
  fPhaseVsZg->GetYaxis()->SetRangeUser(-3e-4,0.);
  fPhaseVsZg->GetYaxis()->SetNdivisions(505);
  fPhaseVsZg->GetXaxis()->CenterTitle();
  fPhaseVsZg->SetLineWidth(2);
  fPhaseVsZg->GetYaxis()->CenterTitle();
  fPhaseVsZg->Draw("C");
  fPhaseVsZg2->SetLineWidth(2);
  fPhaseVsZg2->SetLineStyle(2);
  fPhaseVsZg2->Draw("C same");
  textZeta->Draw();
  
  C->cd(3);
  gPhase->GetYaxis()->SetTitle("#Delta#zeta [c/#omega_{p}]");
  
  if(opt.Contains("units")) {
    gPhase->GetXaxis()->SetTitle("z [m]"); 
    gPhase->GetXaxis()->SetNdivisions(510);
  } else
    gPhase->GetXaxis()->SetTitle("z [c/#omega_{p}]"); 
 
  
  // gPhase->GetXaxis()->SetNdivisions(510);
  gPhase->GetXaxis()->CenterTitle();
  gPhase->GetYaxis()->CenterTitle();
  gPhase->GetXaxis()->SetRangeUser(0.,z);
  gPhase->GetYaxis()->SetNdivisions(505);  
  gPhase->SetLineWidth(2);
  gPhase->Draw("AC");
  gPhase2->SetLineStyle(2);
  gPhase2->SetLineWidth(2);
  gPhase2->Draw("C");
  textZetag->Draw();

  C->cd(4);
  gPad->SetLeftMargin(0.18);

  if(opt.Contains("units")) {
    fPhaseVsZVsZg->GetYaxis()->SetTitle("#zeta [m]"); 
  } else
    fPhaseVsZVsZg->GetYaxis()->SetTitle("#zeta [c/#omega_{p}]"); 
  
  if(opt.Contains("units")) {
    fPhaseVsZVsZg->GetXaxis()->SetTitle("z [m]"); 
  } else
    fPhaseVsZVsZg->GetXaxis()->SetTitle("z [c/#omega_{p}]"); 
  
  fPhaseVsZVsZg->GetZaxis()->SetTitle("(v_{p} - c)/c"); 

  fPhaseVsZVsZg->GetYaxis()->SetNdivisions(505);
  // fPhaseVsZVsZg->GetXaxis()->SetNdivisions(510);
  fPhaseVsZVsZg->GetXaxis()->CenterTitle();
  fPhaseVsZVsZg->GetXaxis()->SetTitleOffset(1.6);
  fPhaseVsZVsZg->GetYaxis()->CenterTitle();
  fPhaseVsZVsZg->GetYaxis()->SetTitleOffset(2.0); 
  fPhaseVsZVsZg->GetZaxis()->CenterTitle();
  fPhaseVsZVsZg->GetZaxis()->SetTitleOffset(1.4); 
  
  fPhaseVsZVsZg->Draw("surf2");

  C->cd();

  // Print to a file
  PlasmaGlob::imgconv(C,"./WakePhaseVelocity",opt);
  // ---------------------------------------------------------

}
void DarkSusy_mH_125_mGammaD_2000_cT_1000_LHE_nD_Eta()
{
//=========Macro generated from canvas: cnv/cnv
//=========  (Sun May 24 15:18:59 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(-7.125,-0.006704923,5.375,0.04487141);
    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_nD_1_Eta_dummy40 = new TH1F("h_nD_1_Eta_dummy40","h_nD_1_Eta_dummy",100,-5,5);
    h_nD_1_Eta_dummy40->SetMaximum(0.04126107);
    h_nD_1_Eta_dummy40->SetLineStyle(0);
    h_nD_1_Eta_dummy40->SetMarkerStyle(20);
    h_nD_1_Eta_dummy40->GetXaxis()->SetTitle("#eta of n_{D}");
    h_nD_1_Eta_dummy40->GetXaxis()->SetLabelFont(42);
    h_nD_1_Eta_dummy40->GetXaxis()->SetLabelOffset(0.007);
    h_nD_1_Eta_dummy40->GetXaxis()->SetTitleSize(0.06);
    h_nD_1_Eta_dummy40->GetXaxis()->SetTitleOffset(0.95);
    h_nD_1_Eta_dummy40->GetXaxis()->SetTitleFont(42);
    h_nD_1_Eta_dummy40->GetYaxis()->SetTitle("Fraction of events / 0.1");
    h_nD_1_Eta_dummy40->GetYaxis()->SetLabelFont(42);
    h_nD_1_Eta_dummy40->GetYaxis()->SetLabelOffset(0.007);
    h_nD_1_Eta_dummy40->GetYaxis()->SetTitleSize(0.06);
    h_nD_1_Eta_dummy40->GetYaxis()->SetTitleOffset(1.35);
    h_nD_1_Eta_dummy40->GetYaxis()->SetTitleFont(42);
    h_nD_1_Eta_dummy40->GetZaxis()->SetLabelFont(42);
    h_nD_1_Eta_dummy40->GetZaxis()->SetLabelOffset(0.007);
    h_nD_1_Eta_dummy40->GetZaxis()->SetTitleSize(0.06);
    h_nD_1_Eta_dummy40->GetZaxis()->SetTitleFont(42);
    h_nD_1_Eta_dummy40->Draw("");

    TH1F *h_nD_1_Eta41 = new TH1F("h_nD_1_Eta41","h_nD_1_Eta",100,-5,5);
    h_nD_1_Eta41->SetBinContent(0,0.0003126407);
    h_nD_1_Eta41->SetBinContent(1,2.501126e-05);
    h_nD_1_Eta41->SetBinContent(2,7.503376e-05);
    h_nD_1_Eta41->SetBinContent(3,0.0001125506);
    h_nD_1_Eta41->SetBinContent(4,0.0001875844);
    h_nD_1_Eta41->SetBinContent(5,0.0003251463);
    h_nD_1_Eta41->SetBinContent(6,0.0002376069);
    h_nD_1_Eta41->SetBinContent(7,0.0003251463);
    h_nD_1_Eta41->SetBinContent(8,0.0006002701);
    h_nD_1_Eta41->SetBinContent(9,0.0006753039);
    h_nD_1_Eta41->SetBinContent(10,0.0007128208);
    h_nD_1_Eta41->SetBinContent(11,0.001012956);
    h_nD_1_Eta41->SetBinContent(12,0.001250563);
    h_nD_1_Eta41->SetBinContent(13,0.001525687);
    h_nD_1_Eta41->SetBinContent(14,0.002038417);
    h_nD_1_Eta41->SetBinContent(15,0.002588665);
    h_nD_1_Eta41->SetBinContent(16,0.002876294);
    h_nD_1_Eta41->SetBinContent(17,0.003339003);
    h_nD_1_Eta41->SetBinContent(18,0.00337652);
    h_nD_1_Eta41->SetBinContent(19,0.004477015);
    h_nD_1_Eta41->SetBinContent(20,0.004789656);
    h_nD_1_Eta41->SetBinContent(21,0.005327397);
    h_nD_1_Eta41->SetBinContent(22,0.006277825);
    h_nD_1_Eta41->SetBinContent(23,0.006928117);
    h_nD_1_Eta41->SetBinContent(24,0.00766595);
    h_nD_1_Eta41->SetBinContent(25,0.008403782);
    h_nD_1_Eta41->SetBinContent(26,0.00946676);
    h_nD_1_Eta41->SetBinContent(27,0.0104422);
    h_nD_1_Eta41->SetBinContent(28,0.01049222);
    h_nD_1_Eta41->SetBinContent(29,0.01164274);
    h_nD_1_Eta41->SetBinContent(30,0.01228053);
    h_nD_1_Eta41->SetBinContent(31,0.01398129);
    h_nD_1_Eta41->SetBinContent(32,0.01323095);
    h_nD_1_Eta41->SetBinContent(33,0.01480666);
    h_nD_1_Eta41->SetBinContent(34,0.01516933);
    h_nD_1_Eta41->SetBinContent(35,0.01584463);
    h_nD_1_Eta41->SetBinContent(36,0.01779551);
    h_nD_1_Eta41->SetBinContent(37,0.0177705);
    h_nD_1_Eta41->SetBinContent(38,0.01783302);
    h_nD_1_Eta41->SetBinContent(39,0.01923366);
    h_nD_1_Eta41->SetBinContent(40,0.01908359);
    h_nD_1_Eta41->SetBinContent(41,0.02024661);
    h_nD_1_Eta41->SetBinContent(42,0.0204342);
    h_nD_1_Eta41->SetBinContent(43,0.02080936);
    h_nD_1_Eta41->SetBinContent(44,0.02142214);
    h_nD_1_Eta41->SetBinContent(45,0.02122205);
    h_nD_1_Eta41->SetBinContent(46,0.0220099);
    h_nD_1_Eta41->SetBinContent(47,0.02263519);
    h_nD_1_Eta41->SetBinContent(48,0.02238507);
    h_nD_1_Eta41->SetBinContent(49,0.02150968);
    h_nD_1_Eta41->SetBinContent(50,0.02217248);
    h_nD_1_Eta41->SetBinContent(51,0.02292282);
    h_nD_1_Eta41->SetBinContent(52,0.02263519);
    h_nD_1_Eta41->SetBinContent(53,0.02140963);
    h_nD_1_Eta41->SetBinContent(54,0.02134711);
    h_nD_1_Eta41->SetBinContent(55,0.02228503);
    h_nD_1_Eta41->SetBinContent(56,0.02170977);
    h_nD_1_Eta41->SetBinContent(57,0.02117203);
    h_nD_1_Eta41->SetBinContent(58,0.01983393);
    h_nD_1_Eta41->SetBinContent(59,0.02105948);
    h_nD_1_Eta41->SetBinContent(60,0.02004652);
    h_nD_1_Eta41->SetBinContent(61,0.0193337);
    h_nD_1_Eta41->SetBinContent(62,0.01818318);
    h_nD_1_Eta41->SetBinContent(63,0.01834576);
    h_nD_1_Eta41->SetBinContent(64,0.01798309);
    h_nD_1_Eta41->SetBinContent(65,0.01704517);
    h_nD_1_Eta41->SetBinContent(66,0.0166575);
    h_nD_1_Eta41->SetBinContent(67,0.0160072);
    h_nD_1_Eta41->SetBinContent(68,0.0148817);
    h_nD_1_Eta41->SetBinContent(69,0.01471912);
    h_nD_1_Eta41->SetBinContent(70,0.01324346);
    h_nD_1_Eta41->SetBinContent(71,0.01286829);
    h_nD_1_Eta41->SetBinContent(72,0.01219299);
    h_nD_1_Eta41->SetBinContent(73,0.01106748);
    h_nD_1_Eta41->SetBinContent(74,0.01011705);
    h_nD_1_Eta41->SetBinContent(75,0.009616828);
    h_nD_1_Eta41->SetBinContent(76,0.007966084);
    h_nD_1_Eta41->SetBinContent(77,0.007428343);
    h_nD_1_Eta41->SetBinContent(78,0.00657796);
    h_nD_1_Eta41->SetBinContent(79,0.006678005);
    h_nD_1_Eta41->SetBinContent(80,0.005627532);
    h_nD_1_Eta41->SetBinContent(81,0.004739633);
    h_nD_1_Eta41->SetBinContent(82,0.004339453);
    h_nD_1_Eta41->SetBinContent(83,0.003839228);
    h_nD_1_Eta41->SetBinContent(84,0.003063879);
    h_nD_1_Eta41->SetBinContent(85,0.002738732);
    h_nD_1_Eta41->SetBinContent(86,0.002276024);
    h_nD_1_Eta41->SetBinContent(87,0.001663248);
    h_nD_1_Eta41->SetBinContent(88,0.001750788);
    h_nD_1_Eta41->SetBinContent(89,0.001325596);
    h_nD_1_Eta41->SetBinContent(90,0.0009504277);
    h_nD_1_Eta41->SetBinContent(91,0.0008628883);
    h_nD_1_Eta41->SetBinContent(92,0.0005752589);
    h_nD_1_Eta41->SetBinContent(93,0.0004627082);
    h_nD_1_Eta41->SetBinContent(94,0.0004126857);
    h_nD_1_Eta41->SetBinContent(95,0.0003501576);
    h_nD_1_Eta41->SetBinContent(96,0.0002125957);
    h_nD_1_Eta41->SetBinContent(97,0.0001750788);
    h_nD_1_Eta41->SetBinContent(98,8.75394e-05);
    h_nD_1_Eta41->SetBinContent(99,6.252814e-05);
    h_nD_1_Eta41->SetBinContent(100,7.503376e-05);
    h_nD_1_Eta41->SetBinContent(101,0.0001250563);
    h_nD_1_Eta41->SetBinError(0,6.252814e-05);
    h_nD_1_Eta41->SetBinError(1,1.768563e-05);
    h_nD_1_Eta41->SetBinError(2,3.063241e-05);
    h_nD_1_Eta41->SetBinError(3,3.751688e-05);
    h_nD_1_Eta41->SetBinError(4,4.843409e-05);
    h_nD_1_Eta41->SetBinError(5,6.376644e-05);
    h_nD_1_Eta41->SetBinError(6,5.451077e-05);
    h_nD_1_Eta41->SetBinError(7,6.376644e-05);
    h_nD_1_Eta41->SetBinError(8,8.664153e-05);
    h_nD_1_Eta41->SetBinError(9,9.189722e-05);
    h_nD_1_Eta41->SetBinError(10,9.441542e-05);
    h_nD_1_Eta41->SetBinError(11,0.0001125506);
    h_nD_1_Eta41->SetBinError(12,0.0001250563);
    h_nD_1_Eta41->SetBinError(13,0.0001381292);
    h_nD_1_Eta41->SetBinError(14,0.0001596612);
    h_nD_1_Eta41->SetBinError(15,0.0001799246);
    h_nD_1_Eta41->SetBinError(16,0.0001896572);
    h_nD_1_Eta41->SetBinError(17,0.0002043436);
    h_nD_1_Eta41->SetBinError(18,0.0002054884);
    h_nD_1_Eta41->SetBinError(19,0.0002366176);
    h_nD_1_Eta41->SetBinError(20,0.00024474);
    h_nD_1_Eta41->SetBinError(21,0.0002581132);
    h_nD_1_Eta41->SetBinError(22,0.000280193);
    h_nD_1_Eta41->SetBinError(23,0.0002943475);
    h_nD_1_Eta41->SetBinError(24,0.0003096248);
    h_nD_1_Eta41->SetBinError(25,0.0003241829);
    h_nD_1_Eta41->SetBinError(26,0.0003440752);
    h_nD_1_Eta41->SetBinError(27,0.0003613672);
    h_nD_1_Eta41->SetBinError(28,0.0003622317);
    h_nD_1_Eta41->SetBinError(29,0.0003815754);
    h_nD_1_Eta41->SetBinError(30,0.0003918873);
    h_nD_1_Eta41->SetBinError(31,0.0004181445);
    h_nD_1_Eta41->SetBinError(32,0.0004067694);
    h_nD_1_Eta41->SetBinError(33,0.0004303099);
    h_nD_1_Eta41->SetBinError(34,0.0004355479);
    h_nD_1_Eta41->SetBinError(35,0.0004451371);
    h_nD_1_Eta41->SetBinError(36,0.0004717457);
    h_nD_1_Eta41->SetBinError(37,0.0004714141);
    h_nD_1_Eta41->SetBinError(38,0.0004722427);
    h_nD_1_Eta41->SetBinError(39,0.0004904375);
    h_nD_1_Eta41->SetBinError(40,0.0004885205);
    h_nD_1_Eta41->SetBinError(41,0.0005031864);
    h_nD_1_Eta41->SetBinError(42,0.0005055121);
    h_nD_1_Eta41->SetBinError(43,0.0005101315);
    h_nD_1_Eta41->SetBinError(44,0.000517588);
    h_nD_1_Eta41->SetBinError(45,0.0005151651);
    h_nD_1_Eta41->SetBinError(46,0.0005246405);
    h_nD_1_Eta41->SetBinError(47,0.0005320406);
    h_nD_1_Eta41->SetBinError(48,0.000529093);
    h_nD_1_Eta41->SetBinError(49,0.0005186444);
    h_nD_1_Eta41->SetBinError(50,0.0005265745);
    h_nD_1_Eta41->SetBinError(51,0.0005354103);
    h_nD_1_Eta41->SetBinError(52,0.0005320406);
    h_nD_1_Eta41->SetBinError(53,0.0005174369);
    h_nD_1_Eta41->SetBinError(54,0.0005166807);
    h_nD_1_Eta41->SetBinError(55,0.0005279093);
    h_nD_1_Eta41->SetBinError(56,0.0005210511);
    h_nD_1_Eta41->SetBinError(57,0.0005145576);
    h_nD_1_Eta41->SetBinError(58,0.0004980318);
    h_nD_1_Eta41->SetBinError(59,0.000513188);
    h_nD_1_Eta41->SetBinError(60,0.0005006938);
    h_nD_1_Eta41->SetBinError(61,0.0004917114);
    h_nD_1_Eta41->SetBinError(62,0.0004768565);
    h_nD_1_Eta41->SetBinError(63,0.0004789835);
    h_nD_1_Eta41->SetBinError(64,0.0004742255);
    h_nD_1_Eta41->SetBinError(65,0.0004616931);
    h_nD_1_Eta41->SetBinError(66,0.0004564126);
    h_nD_1_Eta41->SetBinError(67,0.0004474149);
    h_nD_1_Eta41->SetBinError(68,0.0004313988);
    h_nD_1_Eta41->SetBinError(69,0.000429036);
    h_nD_1_Eta41->SetBinError(70,0.0004069616);
    h_nD_1_Eta41->SetBinError(71,0.0004011559);
    h_nD_1_Eta41->SetBinError(72,0.0003904881);
    h_nD_1_Eta41->SetBinError(73,0.0003720293);
    h_nD_1_Eta41->SetBinError(74,0.0003556966);
    h_nD_1_Eta41->SetBinError(75,0.0003467917);
    h_nD_1_Eta41->SetBinError(76,0.0003156278);
    h_nD_1_Eta41->SetBinError(77,0.0003047886);
    h_nD_1_Eta41->SetBinError(78,0.0002868127);
    h_nD_1_Eta41->SetBinError(79,0.0002889855);
    h_nD_1_Eta41->SetBinError(80,0.0002652844);
    h_nD_1_Eta41->SetBinError(81,0.0002434586);
    h_nD_1_Eta41->SetBinError(82,0.000232954);
    h_nD_1_Eta41->SetBinError(83,0.0002191163);
    h_nD_1_Eta41->SetBinError(84,0.000195744);
    h_nD_1_Eta41->SetBinError(85,0.0001850664);
    h_nD_1_Eta41->SetBinError(86,0.0001687101);
    h_nD_1_Eta41->SetBinError(87,0.0001442219);
    h_nD_1_Eta41->SetBinError(88,0.0001479686);
    h_nD_1_Eta41->SetBinError(89,0.0001287533);
    h_nD_1_Eta41->SetBinError(90,0.0001090215);
    h_nD_1_Eta41->SetBinError(91,0.0001038795);
    h_nD_1_Eta41->SetBinError(92,8.481729e-05);
    h_nD_1_Eta41->SetBinError(93,7.606876e-05);
    h_nD_1_Eta41->SetBinError(94,7.183936e-05);
    h_nD_1_Eta41->SetBinError(95,6.617356e-05);
    h_nD_1_Eta41->SetBinError(96,5.156202e-05);
    h_nD_1_Eta41->SetBinError(97,4.679177e-05);
    h_nD_1_Eta41->SetBinError(98,3.308678e-05);
    h_nD_1_Eta41->SetBinError(99,2.796343e-05);
    h_nD_1_Eta41->SetBinError(100,3.063241e-05);
    h_nD_1_Eta41->SetBinError(101,3.954627e-05);
    h_nD_1_Eta41->SetEntries(79999);
    h_nD_1_Eta41->SetDirectory(0);

    Int_t ci;      // for color index setting
    TColor *color; // for color definition with alpha
    ci = TColor::GetColor("#0000ff");
    h_nD_1_Eta41->SetLineColor(ci);
    h_nD_1_Eta41->SetLineWidth(2);
    h_nD_1_Eta41->SetMarkerStyle(20);
    h_nD_1_Eta41->GetXaxis()->SetLabelFont(42);
    h_nD_1_Eta41->GetXaxis()->SetLabelOffset(0.007);
    h_nD_1_Eta41->GetXaxis()->SetTitleSize(0.06);
    h_nD_1_Eta41->GetXaxis()->SetTitleOffset(0.95);
    h_nD_1_Eta41->GetXaxis()->SetTitleFont(42);
    h_nD_1_Eta41->GetYaxis()->SetLabelFont(42);
    h_nD_1_Eta41->GetYaxis()->SetLabelOffset(0.007);
    h_nD_1_Eta41->GetYaxis()->SetTitleSize(0.06);
    h_nD_1_Eta41->GetYaxis()->SetTitleOffset(1.3);
    h_nD_1_Eta41->GetYaxis()->SetTitleFont(42);
    h_nD_1_Eta41->GetZaxis()->SetLabelFont(42);
    h_nD_1_Eta41->GetZaxis()->SetLabelOffset(0.007);
    h_nD_1_Eta41->GetZaxis()->SetTitleSize(0.06);
    h_nD_1_Eta41->GetZaxis()->SetTitleFont(42);
    h_nD_1_Eta41->Draw("SAMEHIST");

    TH1F *h_nD_2_Eta42 = new TH1F("h_nD_2_Eta42","h_nD_2_Eta",100,-5,5);
    h_nD_2_Eta42->SetBinContent(0,0.003041768);
    h_nD_2_Eta42->SetBinContent(1,0.0004524944);
    h_nD_2_Eta42->SetBinContent(2,0.0007038802);
    h_nD_2_Eta42->SetBinContent(3,0.0008924195);
    h_nD_2_Eta42->SetBinContent(4,0.0008170037);
    h_nD_2_Eta42->SetBinContent(5,0.001282067);
    h_nD_2_Eta42->SetBinContent(6,0.001382622);
    h_nD_2_Eta42->SetBinContent(7,0.001520884);
    h_nD_2_Eta42->SetBinContent(8,0.001897963);
    h_nD_2_Eta42->SetBinContent(9,0.002136779);
    h_nD_2_Eta42->SetBinContent(10,0.001960809);
    h_nD_2_Eta42->SetBinContent(11,0.002501288);
    h_nD_2_Eta42->SetBinContent(12,0.00263955);
    h_nD_2_Eta42->SetBinContent(13,0.003154891);
    h_nD_2_Eta42->SetBinContent(14,0.003205169);
    h_nD_2_Eta42->SetBinContent(15,0.004047311);
    h_nD_2_Eta42->SetBinContent(16,0.003858771);
    h_nD_2_Eta42->SetBinContent(17,0.004675775);
    h_nD_2_Eta42->SetBinContent(18,0.005241393);
    h_nD_2_Eta42->SetBinContent(19,0.005970412);
    h_nD_2_Eta42->SetBinContent(20,0.006096105);
    h_nD_2_Eta42->SetBinContent(21,0.00723991);
    h_nD_2_Eta42->SetBinContent(22,0.007076509);
    h_nD_2_Eta42->SetBinContent(23,0.007453588);
    h_nD_2_Eta42->SetBinContent(24,0.008685378);
    h_nD_2_Eta42->SetBinContent(25,0.008949333);
    h_nD_2_Eta42->SetBinContent(26,0.009980015);
    h_nD_2_Eta42->SetBinContent(27,0.009954876);
    h_nD_2_Eta42->SetBinContent(28,0.01126208);
    h_nD_2_Eta42->SetBinContent(29,0.01131236);
    h_nD_2_Eta42->SetBinContent(30,0.01194082);
    h_nD_2_Eta42->SetBinContent(31,0.01265727);
    h_nD_2_Eta42->SetBinContent(32,0.01349942);
    h_nD_2_Eta42->SetBinContent(33,0.01419073);
    h_nD_2_Eta42->SetBinContent(34,0.01454267);
    h_nD_2_Eta42->SetBinContent(35,0.0155105);
    h_nD_2_Eta42->SetBinContent(36,0.01563619);
    h_nD_2_Eta42->SetBinContent(37,0.01654118);
    h_nD_2_Eta42->SetBinContent(38,0.01732048);
    h_nD_2_Eta42->SetBinContent(39,0.01831345);
    h_nD_2_Eta42->SetBinContent(40,0.01809978);
    h_nD_2_Eta42->SetBinContent(41,0.01857741);
    h_nD_2_Eta42->SetBinContent(42,0.01881623);
    h_nD_2_Eta42->SetBinContent(43,0.01941955);
    h_nD_2_Eta42->SetBinContent(44,0.0191556);
    h_nD_2_Eta42->SetBinContent(45,0.01938184);
    h_nD_2_Eta42->SetBinContent(46,0.01901733);
    h_nD_2_Eta42->SetBinContent(47,0.02086502);
    h_nD_2_Eta42->SetBinContent(48,0.01940698);
    h_nD_2_Eta42->SetBinContent(49,0.02007315);
    h_nD_2_Eta42->SetBinContent(50,0.02038739);
    h_nD_2_Eta42->SetBinContent(51,0.02047537);
    h_nD_2_Eta42->SetBinContent(52,0.01944469);
    h_nD_2_Eta42->SetBinContent(53,0.01934413);
    h_nD_2_Eta42->SetBinContent(54,0.02050051);
    h_nD_2_Eta42->SetBinContent(55,0.01914303);
    h_nD_2_Eta42->SetBinContent(56,0.01950753);
    h_nD_2_Eta42->SetBinContent(57,0.01955781);
    h_nD_2_Eta42->SetBinContent(58,0.01946983);
    h_nD_2_Eta42->SetBinContent(59,0.01909275);
    h_nD_2_Eta42->SetBinContent(60,0.01799922);
    h_nD_2_Eta42->SetBinContent(61,0.01791123);
    h_nD_2_Eta42->SetBinContent(62,0.01812491);
    h_nD_2_Eta42->SetBinContent(63,0.0171068);
    h_nD_2_Eta42->SetBinContent(64,0.01593786);
    h_nD_2_Eta42->SetBinContent(65,0.01664174);
    h_nD_2_Eta42->SetBinContent(66,0.01622695);
    h_nD_2_Eta42->SetBinContent(67,0.01473121);
    h_nD_2_Eta42->SetBinContent(68,0.0139142);
    h_nD_2_Eta42->SetBinContent(69,0.01386392);
    h_nD_2_Eta42->SetBinContent(70,0.01298407);
    h_nD_2_Eta42->SetBinContent(71,0.01240589);
    h_nD_2_Eta42->SetBinContent(72,0.01197853);
    h_nD_2_Eta42->SetBinContent(73,0.01152604);
    h_nD_2_Eta42->SetBinContent(74,0.01014342);
    h_nD_2_Eta42->SetBinContent(75,0.010068);
    h_nD_2_Eta42->SetBinContent(76,0.008584823);
    h_nD_2_Eta42->SetBinContent(77,0.008182607);
    h_nD_2_Eta42->SetBinContent(78,0.008094622);
    h_nD_2_Eta42->SetBinContent(79,0.007252479);
    h_nD_2_Eta42->SetBinContent(80,0.006334921);
    h_nD_2_Eta42->SetBinContent(81,0.006133812);
    h_nD_2_Eta42->SetBinContent(82,0.005844719);
    h_nD_2_Eta42->SetBinContent(83,0.005228824);
    h_nD_2_Eta42->SetBinContent(84,0.004386682);
    h_nD_2_Eta42->SetBinContent(85,0.004097588);
    h_nD_2_Eta42->SetBinContent(86,0.003758217);
    h_nD_2_Eta42->SetBinContent(87,0.003733078);
    h_nD_2_Eta42->SetBinContent(88,0.003142322);
    h_nD_2_Eta42->SetBinContent(89,0.002752674);
    h_nD_2_Eta42->SetBinContent(90,0.002526427);
    h_nD_2_Eta42->SetBinContent(91,0.002099071);
    h_nD_2_Eta42->SetBinContent(92,0.001621438);
    h_nD_2_Eta42->SetBinContent(93,0.001558592);
    h_nD_2_Eta42->SetBinContent(94,0.001332345);
    h_nD_2_Eta42->SetBinContent(95,0.00140776);
    h_nD_2_Eta42->SetBinContent(96,0.001080959);
    h_nD_2_Eta42->SetBinContent(97,0.001043251);
    h_nD_2_Eta42->SetBinContent(98,0.0008547116);
    h_nD_2_Eta42->SetBinContent(99,0.0006661723);
    h_nD_2_Eta42->SetBinContent(100,0.0004776329);
    h_nD_2_Eta42->SetBinContent(101,0.002488719);
    h_nD_2_Eta42->SetBinError(0,0.0001955322);
    h_nD_2_Eta42->SetBinError(1,7.541573e-05);
    h_nD_2_Eta42->SetBinError(2,9.405994e-05);
    h_nD_2_Eta42->SetBinError(3,0.0001059107);
    h_nD_2_Eta42->SetBinError(4,0.0001013368);
    h_nD_2_Eta42->SetBinError(5,0.0001269436);
    h_nD_2_Eta42->SetBinError(6,0.0001318278);
    h_nD_2_Eta42->SetBinError(7,0.0001382622);
    h_nD_2_Eta42->SetBinError(8,0.000154454);
    h_nD_2_Eta42->SetBinError(9,0.0001638835);
    h_nD_2_Eta42->SetBinError(10,0.0001569904);
    h_nD_2_Eta42->SetBinError(11,0.0001773116);
    h_nD_2_Eta42->SetBinError(12,0.0001821463);
    h_nD_2_Eta42->SetBinError(13,0.000199135);
    h_nD_2_Eta42->SetBinError(14,0.0002007154);
    h_nD_2_Eta42->SetBinError(15,0.0002255478);
    h_nD_2_Eta42->SetBinError(16,0.0002202317);
    h_nD_2_Eta42->SetBinError(17,0.0002424277);
    h_nD_2_Eta42->SetBinError(18,0.0002566721);
    h_nD_2_Eta42->SetBinError(19,0.0002739413);
    h_nD_2_Eta42->SetBinError(20,0.0002768099);
    h_nD_2_Eta42->SetBinError(21,0.0003016629);
    h_nD_2_Eta42->SetBinError(22,0.0002982393);
    h_nD_2_Eta42->SetBinError(23,0.0003060822);
    h_nD_2_Eta42->SetBinError(24,0.0003304074);
    h_nD_2_Eta42->SetBinError(25,0.0003353904);
    h_nD_2_Eta42->SetBinError(26,0.0003541775);
    h_nD_2_Eta42->SetBinError(27,0.0003537311);
    h_nD_2_Eta42->SetBinError(28,0.0003762398);
    h_nD_2_Eta42->SetBinError(29,0.0003770786);
    h_nD_2_Eta42->SetBinError(30,0.0003874115);
    h_nD_2_Eta42->SetBinError(31,0.0003988645);
    h_nD_2_Eta42->SetBinError(32,0.0004119199);
    h_nD_2_Eta42->SetBinError(33,0.0004223356);
    h_nD_2_Eta42->SetBinError(34,0.0004275406);
    h_nD_2_Eta42->SetBinError(35,0.0004415382);
    h_nD_2_Eta42->SetBinError(36,0.0004433236);
    h_nD_2_Eta42->SetBinError(37,0.0004559725);
    h_nD_2_Eta42->SetBinError(38,0.0004665899);
    h_nD_2_Eta42->SetBinError(39,0.0004797781);
    h_nD_2_Eta42->SetBinError(40,0.000476971);
    h_nD_2_Eta42->SetBinError(41,0.0004832233);
    h_nD_2_Eta42->SetBinError(42,0.0004863194);
    h_nD_2_Eta42->SetBinError(43,0.0004940546);
    h_nD_2_Eta42->SetBinError(44,0.0004906854);
    h_nD_2_Eta42->SetBinError(45,0.0004935747);
    h_nD_2_Eta42->SetBinError(46,0.0004889114);
    h_nD_2_Eta42->SetBinError(47,0.0005121117);
    h_nD_2_Eta42->SetBinError(48,0.0004938947);
    h_nD_2_Eta42->SetBinError(49,0.0005023);
    h_nD_2_Eta42->SetBinError(50,0.0005062163);
    h_nD_2_Eta42->SetBinError(51,0.0005073074);
    h_nD_2_Eta42->SetBinError(52,0.0004943742);
    h_nD_2_Eta42->SetBinError(53,0.0004930943);
    h_nD_2_Eta42->SetBinError(54,0.0005076188);
    h_nD_2_Eta42->SetBinError(55,0.0004905244);
    h_nD_2_Eta42->SetBinError(56,0.0004951725);
    h_nD_2_Eta42->SetBinError(57,0.0004958102);
    h_nD_2_Eta42->SetBinError(58,0.0004946937);
    h_nD_2_Eta42->SetBinError(59,0.0004898798);
    h_nD_2_Eta42->SetBinError(60,0.0004756442);
    h_nD_2_Eta42->SetBinError(61,0.0004744802);
    h_nD_2_Eta42->SetBinError(62,0.0004773021);
    h_nD_2_Eta42->SetBinError(63,0.0004637028);
    h_nD_2_Eta42->SetBinError(64,0.0004475796);
    h_nD_2_Eta42->SetBinError(65,0.0004573563);
    h_nD_2_Eta42->SetBinError(66,0.0004516207);
    h_nD_2_Eta42->SetBinError(67,0.0004303031);
    h_nD_2_Eta42->SetBinError(68,0.0004182004);
    h_nD_2_Eta42->SetBinError(69,0.0004174442);
    h_nD_2_Eta42->SetBinError(70,0.0004039809);
    h_nD_2_Eta42->SetBinError(71,0.0003948837);
    h_nD_2_Eta42->SetBinError(72,0.0003880227);
    h_nD_2_Eta42->SetBinError(73,0.0003806233);
    h_nD_2_Eta42->SetBinError(74,0.0003570651);
    h_nD_2_Eta42->SetBinError(75,0.0003557353);
    h_nD_2_Eta42->SetBinError(76,0.0003284892);
    h_nD_2_Eta42->SetBinError(77,0.0003207016);
    h_nD_2_Eta42->SetBinError(78,0.0003189728);
    h_nD_2_Eta42->SetBinError(79,0.0003019247);
    h_nD_2_Eta42->SetBinError(80,0.0002821798);
    h_nD_2_Eta42->SetBinError(81,0.0002776647);
    h_nD_2_Eta42->SetBinError(82,0.0002710424);
    h_nD_2_Eta42->SetBinError(83,0.0002563642);
    h_nD_2_Eta42->SetBinError(84,0.0002348137);
    h_nD_2_Eta42->SetBinError(85,0.0002269444);
    h_nD_2_Eta42->SetBinError(86,0.0002173433);
    h_nD_2_Eta42->SetBinError(87,0.0002166152);
    h_nD_2_Eta42->SetBinError(88,0.0001987379);
    h_nD_2_Eta42->SetBinError(89,0.0001860085);
    h_nD_2_Eta42->SetBinError(90,0.0001782004);
    h_nD_2_Eta42->SetBinError(91,0.000162431);
    h_nD_2_Eta42->SetBinError(92,0.0001427597);
    h_nD_2_Eta42->SetBinError(93,0.0001399657);
    h_nD_2_Eta42->SetBinError(94,0.0001294087);
    h_nD_2_Eta42->SetBinError(95,0.0001330208);
    h_nD_2_Eta42->SetBinError(96,0.0001165628);
    h_nD_2_Eta42->SetBinError(97,0.0001145117);
    h_nD_2_Eta42->SetBinError(98,0.000103649);
    h_nD_2_Eta42->SetBinError(99,9.15058e-05);
    h_nD_2_Eta42->SetBinError(100,7.74823e-05);
    h_nD_2_Eta42->SetBinError(101,0.0001768656);
    h_nD_2_Eta42->SetEntries(79999);
    h_nD_2_Eta42->SetDirectory(0);

    ci = TColor::GetColor("#ff0000");
    h_nD_2_Eta42->SetLineColor(ci);
    h_nD_2_Eta42->SetLineWidth(2);
    h_nD_2_Eta42->SetMarkerStyle(20);
    h_nD_2_Eta42->GetXaxis()->SetLabelFont(42);
    h_nD_2_Eta42->GetXaxis()->SetLabelOffset(0.007);
    h_nD_2_Eta42->GetXaxis()->SetTitleSize(0.06);
    h_nD_2_Eta42->GetXaxis()->SetTitleOffset(0.95);
    h_nD_2_Eta42->GetXaxis()->SetTitleFont(42);
    h_nD_2_Eta42->GetYaxis()->SetLabelFont(42);
    h_nD_2_Eta42->GetYaxis()->SetLabelOffset(0.007);
    h_nD_2_Eta42->GetYaxis()->SetTitleSize(0.06);
    h_nD_2_Eta42->GetYaxis()->SetTitleOffset(1.3);
    h_nD_2_Eta42->GetYaxis()->SetTitleFont(42);
    h_nD_2_Eta42->GetZaxis()->SetLabelFont(42);
    h_nD_2_Eta42->GetZaxis()->SetLabelOffset(0.007);
    h_nD_2_Eta42->GetZaxis()->SetTitleSize(0.06);
    h_nD_2_Eta42->GetZaxis()->SetTitleFont(42);
    h_nD_2_Eta42->Draw("SAMEHIST");

    TLegend *leg = new TLegend(0.46,0.6744444,0.6955556,0.7644444,NULL,"brNDC");
    leg->SetBorderSize(0);
    leg->SetTextSize(0.02777778);
    leg->SetLineColor(1);
    leg->SetLineStyle(1);
    leg->SetLineWidth(1);
    leg->SetFillColor(0);
    leg->SetFillStyle(0);
    TLegendEntry *entry=leg->AddEntry("h_nD_1_Eta","1st n_{D} (leading p_{T})","L");

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

    ci = TColor::GetColor("#ff0000");
    entry->SetLineColor(ci);
    entry->SetLineStyle(1);
    entry->SetLineWidth(2);
    entry->SetMarkerColor(1);
    entry->SetMarkerStyle(21);
    entry->SetMarkerSize(1);
    entry->SetTextFont(42);
    leg->Draw();

    leg = new TLegend(0.4566667,0.82,0.7822222,0.9066667,NULL,"brNDC");
    leg->SetBorderSize(0);
    leg->SetTextSize(0.02777778);
    leg->SetLineColor(1);
    leg->SetLineStyle(1);
    leg->SetLineWidth(1);
    leg->SetFillColor(0);
    leg->SetFillStyle(0);
    entry=leg->AddEntry("NULL","#splitline{pp #rightarrow h #rightarrow 2n_{1} #rightarrow 2n_{D} + 2 #gamma_{D} #rightarrow 2n_{D} + 4#mu}{#splitline{m_{h} = 125 GeV, m_{n_{1}} = 50 GeV, m_{n_{D}} = 1 GeV}{m_{#gamma_{D}} = 20 GeV, c#tau_{#gamma_{D}} = 1000 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);
}
Exemplo n.º 26
0
void 
sobWeightedPlot(TString filename,const char* dataset , const char* channel,const char* cat)
{
  TFile F((TString("Plot_")+filename+".root").Data(),"READ");
  gROOT->cd();
  TH1F* data=(TH1F*)F.Get("data_obs");
  TH1F* Ztt=(TH1F*)F.Get("Ztt");
  TH1F* ggH=(TH1F*)F.Get("ggH");
  TH1F* sig=(TH1F*)F.Get("signal");
  TH1F* tt=(TH1F*)F.Get("ttbar");
  TH1F* ewk=(TH1F*)F.Get("EWK");
  TH1F* fakes=(TH1F*)F.Get("Fakes");
  if(!sig){cout<<"No input histograms in file: "<<filename.Data()<<endl; return;}

  float xmininset=60; float xmaxinset=180;
  //float xmininset=0; float xmaxinset=340;//full range

  ////Format the histograms
  Ztt->GetYaxis()->SetRangeUser(0.,1.3*findMaxY(data,0));
  Ztt->GetXaxis()->SetTitle("#bf{m_{#tau#tau}  [GeV]}");
  Ztt->GetYaxis()->SetTitle("#bf{S/B Weighted dN/dm_{#tau#tau} [1/GeV]}");
  Ztt->SetTitleOffset(1.300, "Y");
  Ztt->SetTitleOffset(1.000, "X");
  Ztt->SetNdivisions(505);

  for(Int_t b=0;b<=sig->GetNbinsX()+1;b++){
    //remove red line on top of y axis in plot
    if(sig->GetBinCenter(b)<xmininset||xmaxinset<sig->GetBinCenter(b)){
      sig->SetBinContent(b,0);
      sig->SetBinError(b,0);
    }
  }

  sig->SetName("sig");
  sig->SetFillStyle(3353);//1001=solid , 3004,3005=diagonal
  sig->SetFillColor(2);
  sig->SetLineColor(2);
  sig->SetLineStyle(1);
  sig->SetLineWidth(0.);

  ggH->SetBinContent(0,0);//remove red line on top of y axis in plot
  ggH->SetBinContent(ggH->GetNbinsX()+1,0);
  ggH->SetBinError(0,0);
  ggH->SetBinError(ggH->GetNbinsX()+1,0);
  ggH->SetName("ggH");
  ggH->SetFillStyle(3353);//1001=solid , 3004,3005=diagonal
  ggH->SetFillColor(2);
  ggH->SetLineColor(2);
  ggH->SetLineStyle(1);
  ggH->SetLineWidth(0.);

  TH1F* errorBand = (TH1F*)Ztt->Clone("errorBand");
  errorBand->SetMarkerSize(0);
  errorBand->SetFillColor(1);
  errorBand->SetFillStyle(3013);
  errorBand->SetLineWidth(1);

  TLegend legend;
  TString higgslabel="H(125 GeV)#rightarrow#tau#tau";
  legend.SetFillStyle(0);
  legend.SetFillColor(0);
  legend.SetBorderSize(0);
  legend.AddEntry(ggH,higgslabel,"F");
  legend.AddEntry(data,"observed","LP");  
  legend.AddEntry(Ztt,"Z#rightarrow#tau#tau","F");
  legend.AddEntry(tt,"t#bar{t}","F");
  legend.AddEntry(ewk,"electroweak","F");
  legend.AddEntry(fakes,"QCD","F");

  legend.SetX1NDC(0.63);
  legend.SetX2NDC(1.05);
  legend.SetY1NDC(0.27);
  legend.SetY2NDC(0.48);
  legend.SetTextSize(.028);
  legend.SetTextAlign(   12 );

  //TH1F* dataDiff=diffPlot(data,Ztt,2);
  TH1F* dataDiff=diffPlot(data,Ztt,1);

  TH1F* errBand=getErrorBand(Ztt);
  errBand->SetFillStyle(3013);//1001=solid , 3004,3005=diagonal, 3013=hatched official for H->tau tau
  errBand->SetFillColor(1);
  errBand->SetLineStyle(1);
  errBand->SetLineColor(1);
  errBand->SetLineWidth(1);
  
  TH1F errBandFrame("errBandFrame","",(xmaxinset-xmininset)/dataDiff->GetBinWidth(1),xmininset,xmaxinset);
  errBandFrame.GetYaxis()->SetTitle("");
  errBandFrame.GetYaxis()->SetRangeUser(-1.1*findMinY(dataDiff,0,xmininset,xmaxinset),2.0*findMaxY(dataDiff,0,xmininset,xmaxinset));
  errBandFrame.GetYaxis()->SetNdivisions(5);
  errBandFrame.GetYaxis()->SetLabelSize(0.06);
  errBandFrame.GetXaxis()->SetTitle("#bf{m_{#tau#tau} [GeV]}    ");
  errBandFrame.GetXaxis()->SetTitleColor(kBlack);
  errBandFrame.GetXaxis()->SetTitleSize(0.07);
  errBandFrame.GetXaxis()->SetTitleOffset(0.95);
  errBandFrame.GetXaxis()->SetLabelSize(0.06);
  errBandFrame.SetNdivisions(505);

  TLegend legendDiff;
  legendDiff.SetFillStyle(0);
  legendDiff.SetFillColor(0);
  legendDiff.SetBorderSize(0);
  legendDiff.AddEntry(sig,higgslabel,"F");
  legendDiff.AddEntry(dataDiff,"Data - Background","LP");  
  legendDiff.AddEntry(errBand,"Bkg. Uncertainty","F");
  legendDiff.SetX1NDC(0.45);
  legendDiff.SetX2NDC(0.88);
  legendDiff.SetY1NDC(0.67);
  legendDiff.SetY2NDC(0.88);
  legendDiff.SetTextSize(.045);
  legendDiff.SetTextAlign(12);


  TCanvas C(filename,"",600,600);
  TPad padBack("padBack","padBack",0.57,0.58,0.975,0.956);//TPad must be created after TCanvas otherwise ROOT crashes
  padBack.SetFillColor(0);

  TPad pad("diff","diff",0.45,0.5,0.9765,0.957);//TPad must be created after TCanvas otherwise ROOT crashes
  pad.cd();
  pad.SetFillColor(0);
  pad.SetFillStyle(0);
  errBandFrame.Draw();
  errBand->Draw("e2lsame");
  sig->Draw("histsame");
  TLine line;
  line.DrawLine(xmininset,0,xmaxinset,0);
  dataDiff->Draw("pesame");
  legendDiff.Draw();
  pad.RedrawAxis();

  C.cd();
  Ztt->Draw("hist");
  ggH->Draw("histsame");
  Ztt->Draw("histsame");
  errorBand->Draw("e2same");

  tt->Draw("histsame");
  ewk->Draw("histsame");
  fakes->Draw("histsame");
  data->Draw("pesame");
  legend.Draw();
  C.RedrawAxis();
  padBack.Draw();//clear the background axes
  pad.Draw();

  CMSPrelim(dataset,channel,cat);
  C.Print(TString("Plot_")+filename+".eps");
  C.Print(TString("Plot_")+filename+".png");
  C.Print(TString("Plot_")+filename+".pdf");
  
  delete errorBand;
  delete dataDiff;
  delete errBand;
}
void DarkSusy_mH_125_mGammaD_2000_cT_10_LHE_Higgs_m()
{
//=========Macro generated from canvas: cnv/cnv
//=========  (Sun May 24 15:17:47 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(1.784236,-0.24375,2.499296,1.63125);
   cnv->SetFillColor(0);
   cnv->SetBorderMode(0);
   cnv->SetBorderSize(2);
   cnv->SetLogx();
   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_higgs_M_dummy9 = new TH1F("h_higgs_M_dummy9","h_higgs_M_dummy",220,80.5,300.5);
   h_higgs_M_dummy9->SetMaximum(1.5);
   h_higgs_M_dummy9->SetLineStyle(0);
   h_higgs_M_dummy9->SetMarkerStyle(20);
   h_higgs_M_dummy9->GetXaxis()->SetTitle("Mass of h [GeV]");
   h_higgs_M_dummy9->GetXaxis()->SetMoreLogLabels();
   h_higgs_M_dummy9->GetXaxis()->SetNdivisions(10);
   h_higgs_M_dummy9->GetXaxis()->SetLabelFont(42);
   h_higgs_M_dummy9->GetXaxis()->SetLabelOffset(0.007);
   h_higgs_M_dummy9->GetXaxis()->SetLabelSize(0.03);
   h_higgs_M_dummy9->GetXaxis()->SetTitleSize(0.06);
   h_higgs_M_dummy9->GetXaxis()->SetTitleOffset(0.95);
   h_higgs_M_dummy9->GetXaxis()->SetTitleFont(42);
   h_higgs_M_dummy9->GetYaxis()->SetTitle("Fraction of events / 1 GeV");
   h_higgs_M_dummy9->GetYaxis()->SetLabelFont(42);
   h_higgs_M_dummy9->GetYaxis()->SetLabelOffset(0.007);
   h_higgs_M_dummy9->GetYaxis()->SetTitleSize(0.06);
   h_higgs_M_dummy9->GetYaxis()->SetTitleOffset(1.35);
   h_higgs_M_dummy9->GetYaxis()->SetTitleFont(42);
   h_higgs_M_dummy9->GetZaxis()->SetLabelFont(42);
   h_higgs_M_dummy9->GetZaxis()->SetLabelOffset(0.007);
   h_higgs_M_dummy9->GetZaxis()->SetTitleSize(0.06);
   h_higgs_M_dummy9->GetZaxis()->SetTitleFont(42);
   h_higgs_M_dummy9->Draw("");
   
   TH1F *h_higgs_M_dummy10 = new TH1F("h_higgs_M_dummy10","h_higgs_M_dummy",220,80.5,300.5);
   h_higgs_M_dummy10->SetMaximum(1.5);
   h_higgs_M_dummy10->SetLineStyle(0);
   h_higgs_M_dummy10->SetMarkerStyle(20);
   h_higgs_M_dummy10->GetXaxis()->SetTitle("Mass of h [GeV]");
   h_higgs_M_dummy10->GetXaxis()->SetMoreLogLabels();
   h_higgs_M_dummy10->GetXaxis()->SetNdivisions(10);
   h_higgs_M_dummy10->GetXaxis()->SetLabelFont(42);
   h_higgs_M_dummy10->GetXaxis()->SetLabelOffset(0.007);
   h_higgs_M_dummy10->GetXaxis()->SetLabelSize(0.03);
   h_higgs_M_dummy10->GetXaxis()->SetTitleSize(0.06);
   h_higgs_M_dummy10->GetXaxis()->SetTitleOffset(0.95);
   h_higgs_M_dummy10->GetXaxis()->SetTitleFont(42);
   h_higgs_M_dummy10->GetYaxis()->SetTitle("Fraction of events / 1 GeV");
   h_higgs_M_dummy10->GetYaxis()->SetLabelFont(42);
   h_higgs_M_dummy10->GetYaxis()->SetLabelOffset(0.007);
   h_higgs_M_dummy10->GetYaxis()->SetTitleSize(0.06);
   h_higgs_M_dummy10->GetYaxis()->SetTitleOffset(1.35);
   h_higgs_M_dummy10->GetYaxis()->SetTitleFont(42);
   h_higgs_M_dummy10->GetZaxis()->SetLabelFont(42);
   h_higgs_M_dummy10->GetZaxis()->SetLabelOffset(0.007);
   h_higgs_M_dummy10->GetZaxis()->SetTitleSize(0.06);
   h_higgs_M_dummy10->GetZaxis()->SetTitleFont(42);
   h_higgs_M_dummy10->Draw("same");
   
   TH1F *h_higgs_M11 = new TH1F("h_higgs_M11","h_higgs_M",10,120.5,130.5);
   h_higgs_M11->SetBinContent(5,1);
   h_higgs_M11->SetBinError(5,0.003535556);
   h_higgs_M11->SetEntries(79999);
   h_higgs_M11->SetDirectory(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#0000ff");
   h_higgs_M11->SetLineColor(ci);
   h_higgs_M11->SetLineWidth(2);
   h_higgs_M11->SetMarkerStyle(20);
   h_higgs_M11->GetXaxis()->SetLabelFont(42);
   h_higgs_M11->GetXaxis()->SetLabelOffset(0.007);
   h_higgs_M11->GetXaxis()->SetTitleSize(0.06);
   h_higgs_M11->GetXaxis()->SetTitleOffset(0.95);
   h_higgs_M11->GetXaxis()->SetTitleFont(42);
   h_higgs_M11->GetYaxis()->SetLabelFont(42);
   h_higgs_M11->GetYaxis()->SetLabelOffset(0.007);
   h_higgs_M11->GetYaxis()->SetTitleSize(0.06);
   h_higgs_M11->GetYaxis()->SetTitleOffset(1.3);
   h_higgs_M11->GetYaxis()->SetTitleFont(42);
   h_higgs_M11->GetZaxis()->SetLabelFont(42);
   h_higgs_M11->GetZaxis()->SetLabelOffset(0.007);
   h_higgs_M11->GetZaxis()->SetTitleSize(0.06);
   h_higgs_M11->GetZaxis()->SetTitleFont(42);
   h_higgs_M11->Draw("SAMEHIST");
   
   TH1F *h_higgs_M12 = new TH1F("h_higgs_M12","h_higgs_M",10,120.5,130.5);
   h_higgs_M12->SetBinContent(5,1);
   h_higgs_M12->SetBinError(5,0.003535556);
   h_higgs_M12->SetEntries(79999);
   h_higgs_M12->SetDirectory(0);

   ci = TColor::GetColor("#0000ff");
   h_higgs_M12->SetLineColor(ci);
   h_higgs_M12->SetLineWidth(2);
   h_higgs_M12->SetMarkerStyle(20);
   h_higgs_M12->GetXaxis()->SetMoreLogLabels();
   h_higgs_M12->GetXaxis()->SetLabelFont(42);
   h_higgs_M12->GetXaxis()->SetLabelOffset(0.007);
   h_higgs_M12->GetXaxis()->SetTitleSize(0.06);
   h_higgs_M12->GetXaxis()->SetTitleOffset(0.95);
   h_higgs_M12->GetXaxis()->SetTitleFont(42);
   h_higgs_M12->GetYaxis()->SetLabelFont(42);
   h_higgs_M12->GetYaxis()->SetLabelOffset(0.007);
   h_higgs_M12->GetYaxis()->SetTitleSize(0.06);
   h_higgs_M12->GetYaxis()->SetTitleOffset(1.3);
   h_higgs_M12->GetYaxis()->SetTitleFont(42);
   h_higgs_M12->GetZaxis()->SetLabelFont(42);
   h_higgs_M12->GetZaxis()->SetLabelOffset(0.007);
   h_higgs_M12->GetZaxis()->SetTitleSize(0.06);
   h_higgs_M12->GetZaxis()->SetTitleFont(42);
   h_higgs_M12->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();
   
   TH1F *h_higgs_M_dummy13 = new TH1F("h_higgs_M_dummy13","h_higgs_M_dummy",220,80.5,300.5);
   h_higgs_M_dummy13->SetMaximum(1.5);
   h_higgs_M_dummy13->SetLineStyle(0);
   h_higgs_M_dummy13->SetMarkerStyle(20);
   h_higgs_M_dummy13->GetXaxis()->SetTitle("Mass of h [GeV]");
   h_higgs_M_dummy13->GetXaxis()->SetMoreLogLabels();
   h_higgs_M_dummy13->GetXaxis()->SetNdivisions(10);
   h_higgs_M_dummy13->GetXaxis()->SetLabelFont(42);
   h_higgs_M_dummy13->GetXaxis()->SetLabelOffset(0.007);
   h_higgs_M_dummy13->GetXaxis()->SetLabelSize(0.03);
   h_higgs_M_dummy13->GetXaxis()->SetTitleSize(0.06);
   h_higgs_M_dummy13->GetXaxis()->SetTitleOffset(0.95);
   h_higgs_M_dummy13->GetXaxis()->SetTitleFont(42);
   h_higgs_M_dummy13->GetYaxis()->SetTitle("Fraction of events / 1 GeV");
   h_higgs_M_dummy13->GetYaxis()->SetLabelFont(42);
   h_higgs_M_dummy13->GetYaxis()->SetLabelOffset(0.007);
   h_higgs_M_dummy13->GetYaxis()->SetTitleSize(0.06);
   h_higgs_M_dummy13->GetYaxis()->SetTitleOffset(1.35);
   h_higgs_M_dummy13->GetYaxis()->SetTitleFont(42);
   h_higgs_M_dummy13->GetZaxis()->SetLabelFont(42);
   h_higgs_M_dummy13->GetZaxis()->SetLabelOffset(0.007);
   h_higgs_M_dummy13->GetZaxis()->SetTitleSize(0.06);
   h_higgs_M_dummy13->GetZaxis()->SetTitleFont(42);
   h_higgs_M_dummy13->Draw("same");
   
   TH1F *h_higgs_M14 = new TH1F("h_higgs_M14","h_higgs_M",10,120.5,130.5);
   h_higgs_M14->SetBinContent(5,1);
   h_higgs_M14->SetBinError(5,0.003535556);
   h_higgs_M14->SetEntries(79999);
   h_higgs_M14->SetDirectory(0);

   ci = TColor::GetColor("#0000ff");
   h_higgs_M14->SetLineColor(ci);
   h_higgs_M14->SetLineWidth(2);
   h_higgs_M14->SetMarkerStyle(20);
   h_higgs_M14->GetXaxis()->SetMoreLogLabels();
   h_higgs_M14->GetXaxis()->SetLabelFont(42);
   h_higgs_M14->GetXaxis()->SetLabelOffset(0.007);
   h_higgs_M14->GetXaxis()->SetTitleSize(0.06);
   h_higgs_M14->GetXaxis()->SetTitleOffset(0.95);
   h_higgs_M14->GetXaxis()->SetTitleFont(42);
   h_higgs_M14->GetYaxis()->SetLabelFont(42);
   h_higgs_M14->GetYaxis()->SetLabelOffset(0.007);
   h_higgs_M14->GetYaxis()->SetTitleSize(0.06);
   h_higgs_M14->GetYaxis()->SetTitleOffset(1.3);
   h_higgs_M14->GetYaxis()->SetTitleFont(42);
   h_higgs_M14->GetZaxis()->SetLabelFont(42);
   h_higgs_M14->GetZaxis()->SetLabelOffset(0.007);
   h_higgs_M14->GetZaxis()->SetTitleSize(0.06);
   h_higgs_M14->GetZaxis()->SetTitleFont(42);
   h_higgs_M14->Draw("SAMEHIST");
   cnv->Modified();
   cnv->cd();
   cnv->SetSelected(cnv);
}
void DarkSusy_mH_125_mGammaD_2000_cT_100_LHE_dimuon_m_fake()
{
//=========Macro generated from canvas: cnv/cnv
//=========  (Sun May 24 15:18:28 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}} = 100 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);
}
Exemplo n.º 29
0
void plotRegrVsNoRegr(int channel, int massBin) {
  stringstream filenom, filenoregr;
  filenom << "m4lplots/nominal/fitM" << massBin << "_channel" << channel << ".root";
  filenoregr << "m4lplots/noregr/fitM" << massBin << "_channel" << channel << ".root";

  int col;
  if(channel==0) col=kOrange+7;
  if(channel==1) col=kAzure+2;
  if(channel==2) col=kGreen+3;

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

  TFile *tfilenom = TFile::Open(filenom.str().c_str());
  RooPlot *plotnom = (RooPlot*)tfilenom->Get("m4lplot");
  plotnom->SetMarkerStyle(kOpenSquare);
  plotnom->Draw();
  TPaveText *pavenom = (TPaveText*)tfilenom->Get("TPave");
  pavenom->SetTextColor(col);
  pavenom->Draw("same");

  TFile *tfilenoregr = TFile::Open(filenoregr.str().c_str());
  RooPlot *plotnoregr = (RooPlot*)tfilenoregr->Get("m4lplot");
  plotnoregr->Draw("same");
  TPaveText *pavenoregr = (TPaveText*)tfilenoregr->Get("TPave");
  pavenoregr->Draw("same");

  // cosmetics
  TLegend *legend = new TLegend(0.20,0.45,0.45,0.60,NULL,"brNDC");
  legend->SetBorderSize(     0);
  legend->SetFillColor (     0);
  legend->SetTextAlign (    12);
  legend->SetTextFont  (    42);
  legend->SetTextSize  (0.03);

  TH1F *dummyPointsNom = new TH1F("dummyPNom","dummyPNom",1,0,1);
  TH1F *dummyPointsNoRegr = new TH1F("dummyPNoregr","dummyPNoregr",1,0,1);
  TH1F *dummyLine = new TH1F("dummyL","dummyL",1,0,1);
  dummyPointsNoRegr->SetMarkerStyle(kFullCircle);
  dummyPointsNoRegr->SetMarkerSize(1.1);
  dummyPointsNom->SetMarkerStyle(kFullSquare);
  dummyPointsNom->SetMarkerColor(col);
  dummyPointsNom->SetLineColor(col);
  dummyPointsNom->SetMarkerSize(1.1);
  dummyLine->SetLineColor(col);
  
  legend->AddEntry(dummyPointsNoRegr, "Simulation (E_{std}-p comb.)", "pel");
  legend->AddEntry(dummyPointsNom, "Simulation (E_{regr}-p comb.)", "pel");

  legend->Draw();

  TPaveText *text = new TPaveText(0.15,0.90,0.77,0.98,"brNDC");
  text->AddText("CMS Simulation");
  text->SetBorderSize(0);
  text->SetFillStyle(0);
  text->SetTextAlign(12);
  text->SetTextFont(42);
  text->SetTextSize(0.03);

  text->Draw();

  stringstream frameTitle;
  if(channel==0){frameTitle << "4#mu, m_{H} = ";}
  if(channel==1){frameTitle << "4e, m_{H} = ";}
  if(channel==2){frameTitle << "2e2#mu, m_{H} = ";}
  frameTitle << massBin << " GeV";

  TPaveText *titlet = new TPaveText(0.15,0.80,0.60,0.85,"brNDC");
  titlet->AddText(frameTitle.str().c_str());
  titlet->SetBorderSize(0);
  titlet->SetFillStyle(0);
  titlet->SetTextAlign(12);
  titlet->SetTextFont(132);
  titlet->SetTextSize(0.045);

  titlet->Draw();

  c1->SaveAs("comp.pdf");

}
Exemplo n.º 30
0
// -----------------------------------------------------------------------------
//
TCanvas* createPlot( TDirectory* output_file,
		     std::string output_canvas, 
		     //std::vector< std::vector<std::string> > input_files, 
		     std::vector<std::string> input_files, 
		     std::vector<std::string> input_histos, 
		     std::vector<std::string> input_legend, 
 		     std::vector<int> marker_style, 
 		     std::vector<int> marker_colour, 
 		     std::vector<float> marker_size, 
 		     std::vector<float> lumis, 
		     double lumi,
		     int rebin, 
		     bool norm, 
		     bool log,
		     double min = -1.,
		     double max = -1.,
		     int integral = -1 )
{

  // SetSomeStyles();

  // Check integral
  if ( integral >= input_files.size() ) { integral = -1; }

  // Loop through histogram names
  std::vector<TH1D*> his;
  for ( uint ihis = 0; ihis < input_histos.size(); ++ihis ) {
    if ( integral < 0 || ihis <= integral ) {
      his.push_back( (TH1D*)getHisto( input_files[ihis], input_histos[ihis], "QcdBkgdEst", rebin ) );
    } else {
      his.back()->Add( (TH1D*)getHisto( input_files[ihis], input_histos[ihis], "QcdBkgdEst", rebin ) );
    }
  }
  
  // Create legend
  TLegend* legend = new TLegend( 0.65, 0.52-0.03*his.size(), 0.9, 0.52,  NULL, "brNDC" );
  legend->SetFillColor(0);
  legend->SetLineColor(0); 
  legend->SetTextAlign(31);
  legend->SetTextSize(0.025);
  
  // Create canvas
  TCanvas* aCanvas = createCanvas( output_canvas, output_file, log );
  
  TPaveText* stats = new TPaveText( 0.65, 0.54, 0.9, 0.54+0.03*his.size(), "brNDC" );
  stats->SetFillColor(0);
  stats->SetLineColor(0);

  TLatex* prelim = new TLatex( 0.15, 0.96, "#scale[0.8]{CMS preliminary 2011}" );
  prelim->SetTextSize(0.03);
  prelim->SetNDC();
  std::stringstream ssl; ssl << "#scale[0.8]{#int L dt = " << lumi/1000. << " fb^{-1}, #sqrt{s} = 7 TeV}";
  TLatex* lumistxt = new TLatex( 0.95, 0.96, ssl.str().c_str() );
  lumistxt->SetTextSize(0.03);
  lumistxt->SetNDC();
  lumistxt->SetTextAlign(31);
  
  // For Ted
  bool print_ted = true;
  std::stringstream ted;
  if ( print_ted ) { ted << "self._htMeans = ("; }

  // Loop through histograms
  double aMax = 0.;
  double aMin = 1.e12;
  for ( uint ihis = 0; ihis < his.size(); ++ihis ) {
    if ( !his[ihis] ) { continue; }
    
    // Line colour and fill
    his[ihis]->Scale(lumis[ihis]/100.);
    his[ihis]->SetMarkerStyle(marker_style[ihis]);
    his[ihis]->SetMarkerColor(marker_colour[ihis]);
    his[ihis]->SetMarkerSize(marker_size[ihis]);
    his[ihis]->SetLineColor(marker_colour[ihis]);
    his[ihis]->SetLineStyle(0);
    his[ihis]->SetLineWidth(0);
    
    // Populate legend
    if ( input_legend.size() > ihis ) { legend->AddEntry( his[ihis], input_legend[ihis].c_str(), "ep" ); }
    else                              { legend->AddEntry( his[ihis], input_histos[ihis].c_str(), "ep" ); }

    // Populate stats box
    std::stringstream ss;
    //ss << "Mean=" << int(his[ihis]->GetMean()*100.)/100. << ", RMS=" << int(his[ihis]->GetRMS()*100.)/100.;
    ss << "Entries=" << his[ihis]->GetEntries();
    TText* text = stats->AddText(ss.str().c_str());
    text->SetTextAlign(11);
    text->SetTextSize(0.025);
    text->SetTextColor(marker_colour[ihis]);

    // For Ted
    if ( print_ted ) ted << std::setw(9) << std::scientific << std::setprecision(3) << his[ihis]->GetMean() << ", ";
    
    // Calc min/max number of entries
    if ( his[ihis]->GetMaximum() > aMax ) { aMax = his[ihis]->GetMaximum(); }
    if ( his[ihis]->GetMinimum(1.e-12) < aMin ) { aMin = his[ihis]->GetMinimum(1.e-12); }

  }

  // For Ted
  if ( print_ted ) { 
    ted << ")" << std::endl;
    std::cout << ted.str() << std::endl;
  }

  if ( !his.empty() ) {
    if ( his[0] ) his[0]->GetYaxis()->SetTitleOffset(1.43);
    if ( his[0] ) his[0]->GetYaxis()->SetTitleSize(0.06);
    if ( his[0] ) his[0]->GetXaxis()->SetTitleSize(0.06);
    if ( his[0] ) his[0]->GetXaxis()->SetTitleOffset(0.9);
  }

  // First histo be drawn
  bool first = true;
  for ( uint ihis = 0; ihis < his.size(); ++ihis ) {

    if ( !his[ihis] ) { continue; }
    
    //his[ihis]->GetYaxis()->SetTitle("a.u.");
    
    if ( log ) {
      his[ihis]->SetMaximum( aMax * 10. );
      his[ihis]->SetMinimum( aMin * 0.1 );
    } else {
      his[ihis]->SetMaximum( aMax * 1.1 );
      his[ihis]->SetMinimum( aMin * 0.9 );
    }

    if ( min > 0. ) his[ihis]->SetMinimum( min );
    if ( max > 0. ) his[ihis]->SetMaximum( max );
    
    if ( norm ) {
      std::string options = "";
      if ( first ) { options = "Ehist"; first = false; }
      else { options = "psame"; }
      if ( his[ihis]->GetEntries() > 0. ) { his[ihis]->DrawNormalized(options.c_str()); }
    } else {
      std::string options = "";
      if ( first ) { options = "Ehist"; first = false; }
      else { options = "psame"; }
      his[ihis]->Draw(options.c_str());
    }
    
  } // Loop through histos

  output_file->cd();
  legend->Draw("same");
  stats->Draw("same");
  prelim->Draw("same");
  lumistxt->Draw("same");
  aCanvas->Modified();
  //aCanvas->SaveAs( std::string(output_canvas+".png").c_str() );
  aCanvas->SaveAs( std::string(output_canvas+".pdf").c_str() );
  aCanvas->SaveAs( std::string(output_canvas+".C").c_str() );
  aCanvas->Write();
  return aCanvas;

}