Example #1
0
void IsoMultipole(Char_t* Mlp, Char_t* Iso, Bool_t SAVE=false, Double_t Lo=0.0, Double_t Hi=0.0)
{
  if(SAVE) TCanvas* Canvas = new TCanvas();
  //if(SAVE) SetBit(TH1::kNoTitle);

  FILE* InPlots;
  FILE* InModel_0;
  FILE* InModel_p;
  Char_t Buffer[256];
  Char_t M, p;
  Int_t l;
  Double_t PlRe[N_MAX];
  Double_t PlIm[N_MAX];
  Double_t PlDRe[N_MAX];
  Double_t PlDIm[N_MAX];
  Double_t PlW[N_MAX];
  Double_t MoRe_0[N_MAX];
  Double_t MoRe_p[N_MAX];
  Double_t MoIm_0[N_MAX];
  Double_t MoIm_p[N_MAX];
  Double_t MoW_0[N_MAX];
  Double_t MoW_p[N_MAX];
  Double_t MoRe[N_MAX];
  Double_t MoIm[N_MAX];
  Int_t PlPts;
  Int_t MoPts_0, MoPts_p;
  Double_t W, Re, DRe, Im, DIm;
  Double_t Min = 0.0;
  Double_t Max = 0.0;
  TGraphErrors* PlotsRe;
  TGraphErrors* PlotsIm;
  TGraph* ModelRe;
  TGraph* ModelIm;

  //Decompose multipole name
  sscanf(Mlp, "%c%d%c", &M, &l, &p);

  //Open text file with fit results for given multipole
  sprintf(Buffer, "isospin/%s_%s.txt", Mlp, Iso);
  InPlots = fopen(Buffer, "r");

  //Skip two lines with table header
  fgets(Buffer, sizeof(Buffer), InPlots);
  fgets(Buffer, sizeof(Buffer), InPlots);
  //Read multipole fit values from file
  PlPts = 0;
  while(!feof(InPlots))
  {
    if(fscanf(InPlots, "%lf %lf %lf %lf %lf", &W, &Re, &DRe, &Im, &DIm)==5)
    {
      //Look for maximum & minimum of values to adjust plotting range
      if(Re+DRe > Max) Max = Re+DRe;
      if(Im+DIm > Max) Max = Im+DIm;
      if(Re-DRe < Min) Min = Re-DRe;
      if(Im-DIm < Min) Min = Im-DIm;
      //Add real and imaginary parts of multipole (w/ errors) to graph
      PlW[PlPts] = W;
      PlRe[PlPts] = Re;
      PlIm[PlPts] = Im;
      PlDRe[PlPts] = DRe;
      PlDIm[PlPts] = DIm;
      PlPts++;
    }
  }
  //Close file with fit values
  fclose(InPlots);

  //Create graphs for real and imaginary parts of fitted multipole
  PlotsRe = new TGraphErrors(PlPts, PlW, PlRe, NULL, PlDRe);
  PlotsIm = new TGraphErrors(PlPts, PlW, PlIm, NULL, PlDIm);

  //Color, line size, marker style adjustments
  PlotsRe->SetLineColor(kRed+2);
  PlotsIm->SetLineColor(kBlue+2);
  PlotsRe->SetMarkerColor(kRed+2);
  PlotsIm->SetMarkerColor(kBlue+2);
  PlotsRe->SetMarkerStyle(21);
  PlotsIm->SetMarkerStyle(21);
  PlotsRe->SetMarkerSize(0.7);
  PlotsIm->SetMarkerSize(0.7);

  //Set plot titles and object names
  sprintf(Buffer, "%s_%s", Mlp, Iso);
  PlotsRe->SetTitle(Buffer);
  PlotsIm->SetTitle(Buffer);
  sprintf(Buffer, "Fit_Re%s_%s", Mlp, Iso);
  PlotsRe->SetName(Buffer);
  sprintf(Buffer, "Fit_Im%s_%s", Mlp, Iso);
  PlotsIm->SetName(Buffer);

  PlotsRe->Draw("APZ"); //Plot with x,y axis, points and small error bars
  PlotsIm->Draw("PZ"); //Plot with points and small error bars, into existing frame

  //x-axis labeling
  PlotsRe->GetXaxis()->SetTitle("W / MeV");
  //y-axis labeling
  sprintf(Buffer, "%c_{%1d%c}", M, l, p);
  for(Int_t n=0; n<strlen(Buffer); n++)
  {
    if(Buffer[n]=='p') Buffer[n] = '+';
    if(Buffer[n]=='m') Buffer[n] = '-';
  }
  if(!strcmp(Iso, "32"))  sprintf(Buffer, "%s^{3/2}",  Buffer, Iso);
  if(!strcmp(Iso, "p12")) sprintf(Buffer, "%s^{p1/2}", Buffer, Iso);
  PlotsRe->GetYaxis()->SetTitle(Buffer);

  //Open text file with model values for given p pi0 multipole
  sprintf(Buffer, "model/ppi0/%s.txt", Mlp);
  InModel_0 = fopen(Buffer, "r");
  //Skip two lines with table header
  fgets(Buffer, sizeof(Buffer), InModel_0);
  fgets(Buffer, sizeof(Buffer), InModel_0);
  //Read multipole model values from file
  MoPts_0 = 0;
  while(!feof(InModel_0))
  {
    if(fscanf(InModel_0, "%lf %lf %lf", &W, &Re, &Im)==3)
    {
      MoW_0[MoPts_0]  = W;
      MoRe_0[MoPts_0] = Re;
      MoIm_0[MoPts_0] = Im;
      MoPts_0++;
    }
  }
  //Close file with model values
  fclose(InModel_0);

  //Open text file with model values for given n pi+ multipole
  sprintf(Buffer, "model/npip/%s.txt", Mlp);
  InModel_p = fopen(Buffer, "r");
  //Skip two lines with table header
  fgets(Buffer, sizeof(Buffer), InModel_p);
  fgets(Buffer, sizeof(Buffer), InModel_p);
  //Read multipole model values from file
  MoPts_p = 0;
  while(!feof(InModel_p))
  {
    if(fscanf(InModel_p, "%lf %lf %lf", &W, &Re, &Im)==3)
    {
      MoW_p[MoPts_p]  = W;
      MoRe_p[MoPts_p] = Re;
      MoIm_p[MoPts_p] = Im;
      MoPts_p++;
    }
  }
  //Close file with model values
  fclose(InModel_p);

  //Create selected isospin multipole from p pi0 and n pi+ multipoles
  for(Int_t wp=0; wp<MoPts_p; wp++)
  {
    //Find corresponding energy bin between n pi+ and p pi0 multipoles
    Int_t w0;
    for(Int_t w0=0; w0<MoPts_0; w0++)
      if(MoW_p[wp]==MoW_0[w0]) break;
    //Create isospin multipoles
    if(!strcmp(Iso, "32"))  { MoRe[wp] = A_32(MoRe_0[w0], MoRe_p[wp]); MoIm[wp] = A_32(MoIm_0[w0], MoIm_p[wp]); }
    if(!strcmp(Iso, "p12")) { MoRe[wp] = A_12(MoRe_0[w0], MoRe_p[wp]); MoIm[wp] = A_12(MoIm_0[w0], MoIm_p[wp]); }
  }

  //Create graphs for real and imaginary parts of model multipole
  ModelRe = new TGraph(MoPts_p, MoW_p, MoRe);
  ModelIm = new TGraph(MoPts_p, MoW_p, MoIm);

  //Color, line size adjustments
  ModelRe->SetLineColor(kRed);
  ModelIm->SetLineColor(kBlue);
  ModelRe->SetLineWidth(2);
  ModelIm->SetLineWidth(2);

  //Set plot titles and object names
  sprintf(Buffer, "%s_%s", Mlp, Iso);
  ModelRe->SetTitle(Buffer);
  ModelIm->SetTitle(Buffer);
  sprintf(Buffer, "Model_Re%s_%s", Mlp, Iso);
  ModelRe->SetName(Buffer);
  sprintf(Buffer, "Model_Im%s_%s", Mlp, Iso);
  ModelIm->SetName(Buffer);

  //Plot graphs
  ModelRe->Draw("L"); //Plot as line, into same frame
  ModelIm->Draw("L"); //Plot as line, into same frame

  //Adjust drawing ranges for y-axis
  if((Lo==0.0) && (Hi==0.0))
  {
    PlotsRe->SetMinimum(Min*1.05);
    PlotsRe->SetMaximum(Max*1.05);
  }
  else
  {
    PlotsRe->SetMinimum(Lo);
    PlotsRe->SetMaximum(Hi);
  }

  if(SAVE) PlotsRe->SetTitle("");
  if(SAVE) sprintf(Buffer, "isospin/%s_%s.eps", Mlp, Iso);
  if(SAVE) Canvas->SaveAs(Buffer);
}
Example #2
0
void plotPerCategory(){
  gStyle->SetOptStat(0);
  gStyle->SetOptTitle(0);
  //   setTDRStyle();
   gStyle->SetPadTopMargin   (0.04);
   gStyle->SetPadBottomMargin(0.12);
   gStyle->SetPadRightMargin (0.05);
   gStyle->SetPadLeftMargin  (0.12);
   gStyle->SetTitleSize(0.04, "XYZ");
   gStyle->SetTitleXOffset(1.1);
   gStyle->SetTitleYOffset(1.45);
   gStyle->SetPalette(1);
   gStyle->SetNdivisions(505);

   TCanvas* c1;
   TH1F* framework;
   TH2F* framework2d;
   TLegend* LEG, *LEGTH;
   TGraph* Ref;

   string Directories[]={"cards_SB13TeV_cp1.00_brn0.00", "cards_SB13TeV_GGF_cp1.00_brn0.00", "cards_SB13TeV_VBF_cp1.00_brn0.00"};
   for(unsigned int D=0;D<sizeof(Directories)/sizeof(string);D++){
      string Dir = Directories[D];

     string prod = "pp";
     if(Dir.find("GGF")!=std::string::npos)prod="gg";
     if(Dir.find("VBF")!=std::string::npos)prod="qq";
     bool strengthLimit = false;
     if(prod=="pp")strengthLimit=true;

      c1 = new TCanvas("c", "c",600,600);
      c1->SetLogy(true);
      framework = new TH1F("Graph","Graph",1,190,1510);
      framework->SetStats(false);
      framework->SetTitle("");
      framework->GetXaxis()->SetTitle("Higgs boson mass [GeV]");
      if(strengthLimit){
         framework->GetYaxis()->SetTitle("#mu = #sigma_{95%} / #sigma_{th}");
         framework->GetYaxis()->SetRangeUser(1E-2,1E3);
      }else{
         framework->GetYaxis()->SetTitle((string("#sigma_{95%} (") + prod + " #rightarrow H #rightarrow ZZ) (fb)").c_str());        
         framework->GetYaxis()->SetRangeUser(1E1,1E5);
      }
      framework->GetYaxis()->SetTitleOffset(1.40);
      framework->Draw();

      LEG = new TLegend(0.70,0.70,0.95,0.94);
      LEG->SetFillStyle(0);
      LEG->SetBorderSize(0);
      LEG->SetHeader("Observed:");

      TLegend* LEGExp = NULL;
      LEGExp = new TLegend(0.45,0.70,0.70,0.94);
      LEGExp->SetFillStyle(0);
      LEGExp->SetBorderSize(0);
      LEGExp->SetHeader("Expected:");


      getGraph("=0 Jet"                       , 2, 2, 1, LEG  , NULL, 2, Dir+ "_eq0jets/Stength_LimitSummary")->Draw("C same");
      getGraph("#geq1 Jets"                   , 4, 2, 1, LEG  , NULL, 2, Dir+"_geq1jets/Stength_LimitSummary")->Draw("C same");
      getGraph("VBF"                          , 6, 2, 1, LEG  , NULL, 2, Dir+     "_vbf/Stength_LimitSummary")->Draw("C same");
      getGraph("Combined"                     , 1, 2, 1, LEG  , NULL, 2, Dir+         "/Stength_LimitSummary")->Draw("C same");

      getGraph("=0 Jet"                       , 2, 2, 2, LEGExp  , NULL, 1, Dir+ "_eq0jets/Stength_LimitSummary")->Draw("C same");
      getGraph("#geq1 Jets"                   , 4, 2, 2, LEGExp  , NULL, 1, Dir+"_geq1jets/Stength_LimitSummary")->Draw("C same");
      getGraph("VBF"                          , 6, 2, 2, LEGExp  , NULL, 1, Dir+     "_vbf/Stength_LimitSummary")->Draw("C same");
      getGraph("Combined"                     , 1, 2, 2, LEGExp  , NULL, 1, Dir+         "/Stength_LimitSummary")->Draw("C same");


   //   LEGTH->Draw("same");
      LEGExp  ->Draw("same");
      LEG  ->Draw("same");


      /*
      char LumiLabel[1024];
      sprintf(LumiLabel,"CMS preliminary,  #sqrt{s}=%.0f TeV #scale[0.5]{#int} L=%6.1ffb^{-1}",13.0,2.3);
      TPaveText *pave = new TPaveText(0.1,0.96,0.94,0.99,"NDC");
      pave->SetBorderSize(0);
      pave->SetFillStyle(0);
      pave->SetTextAlign(32);
      pave->SetTextFont(42);
      pave->AddText(LumiLabel);
      pave->Draw("same");*/

      utils::root::DrawPreliminary(2268.759, 13, gPad->GetLeftMargin(),gPad->GetBottomMargin(),gPad->GetRightMargin(),gPad->GetTopMargin()+0.025);     
      if(strengthLimit){
         TLine* SMLine = new TLine(framework->GetXaxis()->GetXmin(),1.0,framework->GetXaxis()->GetXmax(),1.0);
         SMLine->SetLineWidth(2); SMLine->SetLineStyle(1); SMLine->SetLineColor(4);      
         SMLine->Draw("same C");
      }else{
         TGraph* THXSec   = Hxswg::utils::getXSec(Dir); 
         THXSec->SetLineWidth(2); THXSec->SetLineStyle(1); THXSec->SetLineColor(4);
         scaleGraph(THXSec, 1000);  //convert cross-section to fb
         THXSec->Draw("same C");
      }

      c1->SaveAs((Dir+"/perCat_FinalPlot.png").c_str());
      c1->SaveAs((Dir+"/perCat_FinalPlot.pdf").c_str());
      c1->SaveAs((Dir+"/perCat_FinalPlot.C"  ).c_str());
   }



/*
   for(unsigned int D=0;D<sizeof(Directories)/sizeof(string);D++){
      string Dir = Directories[D];

      c1 = new TCanvas("c", "c",600,600);
      c1->SetLogy(true);
      framework = new TH1F("Graph","Graph",1,150,1050);
      framework->SetStats(false);
      framework->SetTitle("");
      framework->GetXaxis()->SetTitle("Higgs boson mass [GeV]");
//      framework->GetYaxis()->SetTitle("#mu = #sigma_{95%} / #sigma_{th}");
//      framework->GetYaxis()->SetTitle("#sigma_{95%} (fb)");
      framework->GetYaxis()->SetTitle("#sigma_{95%} (pp #rightarrow H #rightarrow ZZ) (fb)");        
      framework->GetYaxis()->SetTitleOffset(1.40);
      framework->GetYaxis()->SetRangeUser(1E1,1E4);
      framework->Draw();

      LEG = new TLegend(0.70,0.70,0.95,0.94);
      LEG->SetFillStyle(0);
      LEG->SetBorderSize(0);
//      LEG->SetHeader("Expected @95% C.L.");

      LEGTH = new TLegend(0.45,0.70,0.70,0.94);
      LEGTH->SetFillStyle(0);
      LEGTH->SetBorderSize(0);
      LEGTH->SetHeader("Theoretical");

//      getGraph("SM-like"                     , 1, 2, 1, LEG  , NULL, 1, Dir+               "/Stength_LimitSummary")->Draw("C same");
      getGraph("C'=1.0"                      , 2, 2, 2, LEG  , NULL, 1, Dir+"_cp1.00_brn0.00/Stength_LimitSummary")->Draw("C same");
      getGraph("C'=0.8"                      , 4, 2, 2, LEG  , NULL, 1, Dir+"_cp0.80_brn0.00/Stength_LimitSummary")->Draw("C same");
      getGraph("C'=0.6"                      , 6, 2, 2, LEG  , NULL, 1, Dir+"_cp0.60_brn0.00/Stength_LimitSummary")->Draw("C same");
      getGraph("C'=0.4"                      , 7, 2, 2, LEG  , NULL, 1, Dir+"_cp0.40_brn0.00/Stength_LimitSummary")->Draw("C same");
      getGraph("C'=0.2"                      , 8, 2, 2, LEG  , NULL, 1, Dir+"_cp0.20_brn0.00/Stength_LimitSummary")->Draw("C same");

   //   LEGTH->Draw("same");
      LEG  ->Draw("same");

      char LumiLabel[1024];
      sprintf(LumiLabel,"CMS preliminary,  #sqrt{s}=%.0f TeV #scale[0.5]{#int} L=%6.1ffb^{-1}",13.0,2.2);
      TPaveText *pave = new TPaveText(0.1,0.96,0.94,0.99,"NDC");
      pave->SetBorderSize(0);
      pave->SetFillStyle(0);
      pave->SetTextAlign(32);
      pave->SetTextFont(42);
      pave->AddText(LumiLabel);
      pave->Draw("same");

      TLine* SMLine = new TLine(framework->GetXaxis()->GetXmin(),1.0,framework->GetXaxis()->GetXmax(),1.0);
      SMLine->SetLineWidth(2); SMLine->SetLineStyle(1); SMLine->SetLineColor(4);      
//      SMLine->Draw("same C");


      c1->SaveAs((Dir+"/perC_FinalPlot.png").c_str());
      c1->SaveAs((Dir+"/perC_FinalPlot.pdf").c_str());
      c1->SaveAs((Dir+"/perC_FinalPlot.C"  ).c_str());
   }
*/
}
void ExtractSignalYield(string ModelName, string decayMode, float natural_width, bool dependsOnKtilde=0)
{
  
  string dir = "/usr/users/dschaefer/root/results/";
  string outputfile = ModelName+"_"+decayMode+"_signalYield.root";
  //float natural_width =0.05;
  std::stringstream s;
      if(int(natural_width*100+0.5) == 10 or int(100*natural_width+0.5)==20 or int(natural_width*100+0.5)==30)
      {
	s << std::fixed << std::setprecision(1) << natural_width;
      }
      else
      {
	s << std::fixed << std::setprecision(2) << natural_width;
      }
  string swidth = s.str();
  float ktilde;
  string sktilde;
  if(dependsOnKtilde)
  {
   ktilde = natural_width;
   sktilde = swidth;
  }
  
  TGraph* limit = getObservedLimit(ModelName,decayMode,natural_width,dependsOnKtilde);
  TGraph* limitUP = getLimitUp(ModelName,decayMode,natural_width,1,dependsOnKtilde);
  TGraph* limitDOWN = getLimitDown(ModelName,decayMode,natural_width,1,dependsOnKtilde);
  TGraph* limitUP2 = getLimitUp(ModelName,decayMode,natural_width,2,dependsOnKtilde);
  TGraph* limitDOWN2 = getLimitDown(ModelName,decayMode,natural_width,2,dependsOnKtilde);
  
  
  int number;
  float* masses;
  if(decayMode.find("lvjj")!=string::npos)
  {
    masses = new float[38];
    number =38;
    float array[38] = {800,900,1000,1100,1200,1300,1400,1500,1600,1700,1800,1900,2000,2100,2200,2300,2400,2500,2600,2700,2800,2900,3000,3100,3200,3300,3400,3500,3600,3700,3800,3900,4000,4100,4200,4300,4400,4500};
    masses = array;
  }
  else
  {
   number = 29;
   masses = new float[29];
   float array[29] = {1200,1300,1400,1500,1600,1700,1800,1900,2000,2100,2200,2300,2400,2500,2600,2700,2800,2900,3000,3100,3200,3300,3400,3500,3600,3700,3800,3900,4000};
   masses = array;
  }
  TGraph* gryellow = new TGraph(2*number);
  TGraph* grgreen  = new TGraph(2*number);
  
  for(int m=0;m<number;m++)
  {
    gryellow->SetPoint(m,masses[m],limitUP->Eval(masses[m]));
    gryellow->SetPoint(number+m,masses[number-m-1],limitDOWN->Eval(masses[number-m-1]));
    grgreen->SetPoint(m,masses[m],limitUP2->Eval(masses[m]));
    grgreen->SetPoint(number+m,masses[number-m-1],limitDOWN2->Eval(masses[number-m-1]));
    
  }
  gryellow->SetFillColor(kYellow);
  grgreen->SetFillColor(kGreen);
  
  TCanvas* test = new TCanvas("test","test",400,400);
  test->SetLogy();
  limitUP->SetFillColor(kGreen+2);
  limitUP->SetLineColor(kGreen+2);
  limitUP->SetLineWidth(-1504);
  
  //limitUP->Draw("ACP");
  limitDOWN->SetFillColor(kBlue);
  limitDOWN->SetLineColor(kGreen+2);
  limitDOWN->SetLineWidth(-1504);
  //limitDOWN->Draw("CPsame");
  gryellow->Draw("AFsame");
  grgreen->Draw("Fsame");
  limit->SetLineColor(kBlue);
  limit->SetLineWidth(3);
  limit->Draw("Lsame");
  test->Update();
  
  float lumi = 2.10*1000;  //pb^-1
  if(decayMode.find("jjjj")!=string::npos){lumi = 2.6*1000;}//pb^-1
  
  
  
  
  //float *xs = getTheoryCrossSection(ModelName,0.1);
  
  //x values for which a theory prediction for production cross section exists
  float m_xs[10]  =  {800,900,1000,1500,1800,2000,2500,3000,3500,4500};
  float BR_G_to_WW[10];
  float BR_G_to_ZZ[10];
  float *acceptance;
  float *N_expected;
  //float xs = 0.01;
  float *xs = new float[10];
  
  if(dependsOnKtilde)
  {
    xs = getTheoryCrossSection(ModelName,ktilde);
  }
  else
  {
    for(int i=0;i<10;i++)
    {
    if(natural_width!=0)
    {
      ktilde = getKtilde(ModelName,m_xs[i],natural_width);
      //std::cout << m_xs[i] << " k = " << ktilde <<std::endl;
      xs[i] = getTheoryCrossSection(ModelName,m_xs[i],ktilde);
    }
    else
    {
      ktilde = getKtilde(ModelName,m_xs[i],0.02);
      //std::cout <<  m_xs[i] << " k = " << ktilde <<std::endl;
      xs[i] = getTheoryCrossSection(ModelName,m_xs[i],ktilde);
    }
    }
  }
  
 
 
 
  
  TGraph* production_xs = new TGraph(10,m_xs,xs);
  
  // TCanvas* c_xs = new TCanvas("c_xs","c_xs",400,400);
  // c_xs->SetLogy();
  // production_xs->SetMarkerColor(1);
  // production_xs->GetXaxis()->SetTitle("m_G [GeV]");
  // production_xs->GetYaxis()->SetTitle("theory production cross section");
  // production_xs->Draw("AL");
  
  
  
  if(!dependsOnKtilde)
  {
  acceptance = getAcceptance(ModelName,decayMode,m_xs,10);
  }
  else
  {
   acceptance = getAcceptance(decayMode,ktilde); 
  }
  
  N_expected = getNumberOfExpectedEvents(xs,m_xs,acceptance,ModelName,decayMode);
  

 std::cout << "production cross section : "<< std::endl;
  for(int i=0;i<10;i++)
    {
      std::cout << m_xs[i] <<  " " << xs[i]<< std::endl;
    }
  std::cout << " acceptance : "<<std::endl;
  for(int i=0;i<10;i++)
    {
      std::cout << m_xs[i] << " "<<acceptance[i]<<std::endl;
    }
  float br[10];
  std::cout << "Branching Ratios : "<<std::endl;
  for(int i=0;i<10;i++)
    {
      float BR_W_to_lv = 0.327;
      float BR_W_to_jj = 0.674;
      float BR_Z_to_jj = 0.6991;
      br[i] = getBranchingRatioToWW(ModelName,m_xs[i])*std::pow(BR_W_to_jj,2)*2 + getBranchingRatioToZZ(ModelName,m_xs[i])*std::pow(BR_Z_to_jj,2)*2;
      if(decayMode.find("lvjj")!=std::string::npos)
	{
	  br[i] = getBranchingRatioToWW(ModelName,m_xs[i])*2*BR_W_to_lv*BR_W_to_jj;
	}
      std::cout << m_xs[i] << " "<< br[i] << std::endl;
    }
  std::cout << lumi <<std::endl;
  std::cout << " N expected : "<<std::endl;
  for(int i=0;i<10;i++)
    {
      std::cout << m_xs[i] << " "<<N_expected[i] << " " <<xs[i]*lumi*br[i]*acceptance[i] << std::endl;
    }

  
  TGraph* N = new TGraph(10,m_xs,N_expected);
  //N->SetName("expected signal yield");
  grgreen->GetXaxis()->SetTitle("m_{VV} [GeV]");
  grgreen->GetYaxis()->SetTitle("number signal events");
  grgreen->GetYaxis()->SetTitleOffset(1.3);
  grgreen->SetTitle("");
  TCanvas* c_N = new TCanvas("c_N","c_N",600,400);
  gPad->SetRightMargin(0.1);
  gPad->SetLeftMargin(0.1);
  limit->SetLineColor(kBlue);
  limit->SetLineWidth(3);
  c_N->SetLogy();
  N->SetLineColor(kRed);
  N->SetLineWidth(2);
  //N->Draw("A");
  grgreen->SetMaximum(1000);
  grgreen->Draw("AF");
  gryellow->Draw("Fsame");
  limit->Draw("Csame");
  N->Draw("Lsame");
  TLegend* leg = new TLegend(0.59,0.65,0.95,0.89);
  leg->SetFillColor(kWhite);
  leg->SetFillStyle(0);
  leg->SetTextSize(0.04);
  leg->SetBorderSize(0);
  
  string title = "Preliminary";
  string cms = "#font[62]{CMS} #font[52]{"+string(title)+"} ";
  string lumitext = "2.6 fb^{-1}, #sqrt{s} = 13 TeV";
  string cmstext = "CMS ,2.6 fb^{-1}, #sqrt{s} = 13 TeV";
  if(decayMode.find("had")==string::npos){lumitext = "2.1 fb^{-1}, #sqrt{s} = 13 TeV";}
  string theory = "G #rightarrow WW, #Gamma = "+swidth;
  if(dependsOnKtilde)
  {
    theory = "G #rightarrow WW, #tilde{k} = "+sktilde;
  }
  if(ModelName.find("RSGrav")!=string::npos)
  {
   theory = "RS #rightarrow WW, #Gamma = "+swidth;
   if(dependsOnKtilde)
    {
      theory = "RS #rightarrow WW, #tilde{k} = "+sktilde;
    }
  }
  
  leg->AddEntry(grgreen,"Expected (95%)","f");
  leg->AddEntry(gryellow,"Expected (68%)","f");
  leg->AddEntry(limit,"observed","L");
  leg->AddEntry(N,theory.c_str(),"L");
  leg->Draw("same");
  
  TLatex CMS;
  int y = 1050;
  int x = 500;
  int x2 = 3400;
  if(decayMode.find("jjjj")!= string::npos){y=1050;x=1000;x2=3000;}
  CMS.SetTextFont(43);
  CMS.SetTextSize(18);
  CMS.DrawLatex(x,y,cms.c_str());
  CMS.DrawLatex(x2,y,lumitext.c_str());
  
  c_N->Update();
  if(dependsOnKtilde)
  {
    c_N->SaveAs(("/usr/users/dschaefer/root/results/misc/"+ModelName+"_limit_"+decayMode+"_ktilde"+swidth+".pdf").c_str());
  }
  else
  {
  c_N->SaveAs(("/usr/users/dschaefer/root/results/misc/"+ModelName+"_limit_"+decayMode+"_"+swidth+".pdf").c_str());
  }
  
  
  //===========================================================================================
  //======== my own produced samples with ktilde = 0.095 ======================================
  //===========================================================================================
  
  
  
  float* acc2 = getAcceptance(decayMode,0.095);
  float* xs_new = getTheoryCrossSection(ModelName,0.095);
  
  for(int i=0;i<10;i++)
  {
   std::cout << " acceptance int : " << acceptance[i] <<std::endl;
   std::cout << " acceptance 2   : " << acc2[i] << std::endl;
  }
  
   // TGraph* testa
   // TCanvas* test2 = new TCanvas("test2","test2",400,400);
//   obsl->Draw("AL");
//   Neve->Draw("LSAME");
  
  float* N_expected2 = getNumberOfExpectedEvents(xs_new,m_xs,acc2,ModelName,decayMode);
  TGraph* obsl = getObservedLimit(ModelName,decayMode,0.095,1);
  TGraph* Neve = new TGraph(10,m_xs,N_expected2);
  

  
  
  TGraph* pl = getExcludedPoints(ModelName,decayMode,obsl,Neve,0.095);
  pl->SetLineWidth(3);
  pl->SetLineColor(kWhite);
  //pl->SetFillStyle(3013);
  //pl->SetFillColor(kWhite);
  
  string channel = "had";
  if(decayMode.find("lvjj")!=std::string::npos)
  {
   channel = "em"; 
  }
  
  TFile* file = new TFile(("/home/dschaefer/CMSSW_7_1_5/src/HiggsAnalysis/CombinedLimit/graphs_"+channel+".root").c_str(),"READ");
  string histoname = "ExclusionLimitOnEventNumber_BulkG_WW_em_HP";
  if(channel.find("had")!=std::string::npos)
  {
   histoname =  "ExclusionLimitOnEventNumber_BulkWW_had_HP";
  }
  TH2F* obsLim = dynamic_cast<TH2F*>(file->Get(histoname.c_str()));
  TCanvas* MyC = new TCanvas("MyC","MyC",800,600);
  MyC->SetRightMargin(0.19);
//   MyC->SetLeftMargin(0.12);
//   MyC->SetTopMargin(0.08);
//   MyC->SetBottomMargin(0.15);
  MyC->SetLogz();
  obsLim->Draw("COLZ");
  //pl->Draw("f");
  pl->Draw("Same");
  
  std::map<float,float> mass_acc;
  for(int i=0;i<10;i++)
  {
   mass_acc.insert(std::pair<float, float>(m_xs[i],acc2[i]));   
  }
  TGraph* allpoints = findAllExcludedPoints(ModelName,decayMode, mass_acc,0.095);
  MyC->cd();
  allpoints->Draw("Psame");
  
  
  float massmax = 4500;
  float massmin = 800;
  int n = (massmax-massmin)/100;
  float* k = new float[n*2];
  int t=0;
  for(int i=0;i<=n;i++)
  {
    k[i] = getKtilde("RSGrav",massmin+i*100,0.3);
    std::cout << "mass max: "<< massmin+i*100 << " ktilde " << k[i]<<std::endl;
  }
  for(int i=n;i<2*n;i++)
  {
   k[i] = getKtilde("RSGrav",massmin+(i-n)*100,0.02);
   std::cout << " mass min : "<< massmin+(i-n)*100 << " ktilde " << k[i] << std::endl;
  }
  
  printWidthForKtilde("RSGrav",0.12,3600,800);
  printWidthForKtilde("RSGrav",0.2 ,2400,800);
  printWidthForKtilde("RSGrav",0.3 ,1800,800);
  printWidthForKtilde("RSGrav",0.4 ,1500,800);
  printWidthForKtilde("RSGrav",0.5 ,1100 ,800);
  printWidthForKtilde("RSGrav",0.05,4500,2000);
  printWidthForKtilde("RSGrav",0.03,4600,3200);
  
}
void makePlots( const char * model,
                const char * target, 
                const char * src, 
                const char * config,
                const char * infile) 
{

  double MAXY = 2.4;
  
  double x_Q13_SetI = sin(8.8*TMath::Pi()/180.0)*sin(8.8*TMath::Pi()/180.0);
  
  double x_Q13_SetII = sin(12.0*TMath::Pi()/180.0)*sin(12.0*TMath::Pi()/180.0);

  //Input path
  TString inpath("./root_files/RvsQ13/");
  
  TString inputfile = inpath + TString(infile);

  //Output path
  TString path("./paper02-plots/ratio/");
    
  TList * v_Variations = new TList();
  TObjString *var;

  var = new TObjString("Sin2Q13-1.8-dCP0");
  v_Variations->Add( var ); 
  var = new TObjString("Sin2Q13-1.8-dCP180");
  v_Variations->Add( var );

  if ( TString(model) != TString("StdPicture") ) {
    
    var = new TObjString("Sin2Q13-2.0-dCP0");
    v_Variations->Add( var ); 
    var = new TObjString("Sin2Q13-2.0-dCP180");
    v_Variations->Add( var );

  } else {

    var = new TObjString("Sin2Q13-2-dCP0");
    v_Variations->Add( var ); 
    var = new TObjString("Sin2Q13-2-dCP180");
    v_Variations->Add( var );  
  
  }
  
  var = new TObjString("Sin2Q13-2.2-dCP0");
  v_Variations->Add( var ); 
  var = new TObjString("Sin2Q13-2.2-dCP180");
  v_Variations->Add( var );
  
  int * linewidth = new int[6];
  int * linestyle = new int[6];
  int * linecolor = new int[6];
  
  linewidth[0] = 2;
  linewidth[1] = 3;
  linewidth[2] = 2;
  linewidth[3] = 3;
  linewidth[4] = 2;
  linewidth[5] = 3;

  linecolor[0] = 1;
  linecolor[1] = 2;
  linecolor[2] = 1;
  linecolor[3] = 2;
  linecolor[4] = 1;
  linecolor[5] = 2;

  linestyle[0] = 1;
  linestyle[1] = 1;
  linestyle[2] = 2;
  linestyle[3] = 2;
  linestyle[4] = 3;
  linestyle[5] = 3;

  TList * v_Labels = new TList();
  TObjString *label;
  
  label = new TObjString( "#alpha = 1.8" );
  v_Labels->Add( label ); 
  label = new TObjString( "#alpha = 2.0" );
  v_Labels->Add( label ); 
  label = new TObjString( "#alpha = 2.2" );
  v_Labels->Add( label ); 
  
  TFile * f1 = new TFile( inputfile.Data() );
  f1->cd();

  TList * v_Graphs = new TList();

  int max = v_Variations->GetEntries();
  
  for( int k = 0; k < max; ++k ) 
  {
    
    TString current = ((TObjString*)v_Variations->At(k))->GetString();

    TString dataPxx = TString( "Ratio_" ) 
      + TString( model )  + TString("_")
      + TString( target ) + TString("_") 
      + TString( src )    + TString("_") 
      + TString( current.Data() )
      + TString("/data");
   
    std::cout << dataPxx << std::endl;
    
 
    TTree * PxxTreeNu = (TTree*)gDirectory->Get( dataPxx.Data() );
    
    //Branches
    double xx = 0.0;
    double yy = 0.0;
    
    PxxTreeNu->SetBranchAddress("Xx",&xx);
    PxxTreeNu->SetBranchAddress("Ratio",&yy);
    
    Long64_t nentries = PxxTreeNu->GetEntries();
    
    TGraph * g1 = new TGraph();
    
    for (Long64_t i=0;i<nentries;i++) {
      PxxTreeNu->GetEntry(i);
      g1->SetPoint( i, xx, yy);
    }
    
    v_Graphs->Add( g1 );
      
  }
  
  TString cname = TString("Ratio") + TString("_") + TString(model) +  TString("_") + TString(config);
  
  TCanvas * c1 = new TCanvas( cname.Data(), "track/shower ratio", 206,141,722,575); 

  c1->SetBorderSize(2);
    
  TLegend * leg = new TLegend(0.18,0.64,0.44,0.87);
  
  leg->SetBorderSize(0);
  leg->SetTextFont(22);
  leg->SetTextSize(0.062);
  leg->SetLineColor(1);
  leg->SetLineStyle(1);
  leg->SetLineWidth(1);
  leg->SetFillColor(0);
  leg->SetFillStyle(0);

  int labelpos = 0;
  
  for( int k = 0; k < max; ++k ) 
  {

    TGraph * gg = (TGraph*)v_Graphs->At(k);

    gg->SetMarkerStyle(25);
    gg->SetFillColor(10);

    gg->SetLineColor(linecolor[k]);
    gg->SetLineWidth(linewidth[k]);
    gg->SetLineStyle(linestyle[k]);

    gg->SetMaximum(MAXY);
    gg->SetMinimum(1.6);

    gg->GetXaxis()->SetLimits( 0.0, 0.055 );

    gg->GetXaxis()->SetTitle("sin^{2}#theta_{13}");
    gg->GetXaxis()->CenterTitle(true);
    gg->GetXaxis()->SetLabelFont(42);
    gg->GetXaxis()->SetLabelOffset(0.006);
    gg->GetXaxis()->SetLabelSize(0.06);
    gg->GetXaxis()->SetTitleSize(0.06);
    gg->GetXaxis()->SetTickLength(0.05);
    gg->GetXaxis()->SetTitleOffset(1.07);
    gg->GetXaxis()->SetTitleFont(42);
    gg->GetXaxis()->SetNdivisions(509);
    gg->GetYaxis()->SetTitle("R");
    gg->GetYaxis()->CenterTitle(true);
    gg->GetYaxis()->SetNdivisions(509);
    gg->GetYaxis()->SetLabelFont(42);
    gg->GetYaxis()->SetLabelOffset(0.007);
    gg->GetYaxis()->SetLabelSize(0.06);
    gg->GetYaxis()->SetTitleSize(0.06);
    gg->GetYaxis()->SetTitleOffset(0.93);
    gg->GetYaxis()->SetTitleFont(42);

    if ( ((k+1) % 2) == 0 )
    {
      TString alpha = ((TObjString*)v_Labels->At(labelpos))->GetString();      
      leg->AddEntry( gg, alpha.Data(),"l");
      labelpos+=1;
    }
    
    c1->cd();

    if( k == 0 )
      gg->Draw("AC");
    else
      gg->Draw("C");

    TString ThisModel;
    TString ThisConfig;
    
    if( TString(model) == TString("StdPicture") )
      ThisModel = TString("No matter effect");
    else 
    {
      ThisModel = TString(model);
      ThisModel.Insert(5," ");
    }

    ThisConfig = TString(config);
    ThisConfig.Insert(3," ");
      
    TLatex *   tex = new TLatex(0.033, (MAXY-(MAXY*0.035)), ThisModel.Data() );
    tex->SetLineWidth(2);
    tex->Draw();

    if ( TString(model) != TString("StdPicture") ) {
      tex = new TLatex(0.033, (MAXY-(MAXY*0.055)), ThisConfig.Data() );
      tex->SetLineWidth(2);
      tex->Draw();
    }
      
  
  }
  
  leg->Draw();

  
  
  double y_min = 1.60;
  double y_max = MAXY;
  
  TLine *line = new TLine(x_Q13_SetI, y_min,x_Q13_SetI, y_max);
  //line->Draw();
  line = new TLine(x_Q13_SetII, y_min,x_Q13_SetII, y_max);
  //line->Draw();

  c1->cd();
  
  std::stringstream saveAs;
  
  saveAs.str("");
  saveAs << path << model << "/pdf/" << "RvsSin2Q13_" << model << "_" << target << "_" << config << ".pdf";
  c1->SaveAs( saveAs.str().c_str() );
  
  saveAs.str("");
  saveAs << path << model << "/png/" << "RvsSin2Q13_" << model << "_" << target << "_" << config << ".png";
  c1->SaveAs( saveAs.str().c_str() );

  saveAs.str("");
  saveAs << path << model << "/eps/" << "RvsSin2Q13_" << model<< "_" <<  target << "_" << config << ".eps";
  c1->SaveAs( saveAs.str().c_str() );
  
  
}
Example #5
0
void limitSemiLep(bool only_leptonTAG=false, bool save_plots = false, float min=0.006, float max=900., TString plot_name="Limit_prova.pdf") {
  setTDRStyle();
  TCanvas* c1  = new TCanvas("c1","c1",0,0,800,600); //c1->SetLogy();
  c1->SetLogy();
  save_plots = true;
  plot_name="LimitSemiLep.pdf";

  Double_t XMass[val]    = {1000, 1500, 2000, 2500};
	
  //LIMIT - Breit-Wigner
  Double_t Limit_Obs[val]     = {0,0,0,0};
  Double_t Limit_Exp_m2s[val] = {1.8, 0.9, 0.2, 0.3};
  Double_t Limit_Exp_m1s[val] = {2.5, 1.3, 0.4, 0.4};
  Double_t Limit_Exp[val]     = {3.6, 1.9, 0.7, 0.8};
  Double_t Limit_Exp_p1s[val] = {5.3, 2.9, 1.3, 1.5};
  Double_t Limit_Exp_p2s[val] = {7.5, 4.3, 2.1, 2.4};

  Double_t XSEC[val] = {1.54, 0.22, 0.03, 0.01};
	
  //Draw limit
  TLegend *legendr = new TLegend(0.48,0.70,0.87,0.92);
  legendr->SetTextSize(0.030); 
  legendr->SetFillColor(0);
  legendr->SetBorderSize(1);
	
  //2 sigma 
  TGraph *band_2s = new TGraph(2*val+1);
  for(int i=0;i<val;i++){
    band_2s->SetPoint(i,XMass[i],Limit_Exp_p2s[i]);
    band_2s->SetPoint(i+val,XMass[val-1-i],Limit_Exp_m2s[val-1-i]);
  }
  band_2s->SetPoint(2*val,XMass[0],Limit_Exp_p2s[0]);
  band_2s->SetLineStyle(2);
  band_2s->SetFillColor(kYellow);
  band_2s->Draw("ALF2");
  band_2s->SetMinimum(min);
  band_2s->SetMaximum(max);
  band_2s->SetTitle(0);
  band_2s->GetXaxis()->SetTitle("M(Z,H) [GeV]");
  band_2s->GetYaxis()->SetTitle("#sigma(pp #rightarrow Z' #rightarrow ZH) x BR(Z #rightarrow qq) X BR(H #rightarrow #tau#tau) [fb]");
  band_2s->GetXaxis()->SetTitleOffset(1.1);
  band_2s->GetYaxis()->SetTitleOffset(1.3);
  band_2s->GetXaxis()->SetRangeUser(1000,2500);
  band_2s->GetYaxis()->SetTitleSize(0.040);
  band_2s->GetXaxis()->SetNdivisions(1005);
  band_2s->Draw("LF2");
	
  //1 sigma
  TGraph *band_1s = new TGraph(2*val+1);
  for(int i=0;i<val;i++){
    band_1s->SetPoint(i,XMass[i],Limit_Exp_p1s[i]);
    band_1s->SetPoint(i+val,XMass[val-1-i],Limit_Exp_m1s[val-1-i]);
  }
  band_1s->SetPoint(2*val,XMass[0],Limit_Exp_p1s[0]);
  band_1s->SetLineStyle(2);
  band_1s->SetFillColor(kGreen);
  band_1s->Draw("LF2");
  //Expected
  TGraph *limit_exp = new TGraph(val,XMass,Limit_Exp);
  limit_exp->SetLineWidth(2);
  limit_exp->SetLineStyle(2);
  limit_exp->SetMarkerSize(1.3);
  limit_exp->Draw("LP");
  //Observed
  TGraph *limit_obs = new TGraph(val,XMass,Limit_Obs);
  limit_obs->SetMarkerStyle(21);
  //limit_obs->Draw("LP");

  TGraph *xsec = new TGraph(val,XMass,XSEC);
  xsec->SetMarkerStyle(21);
  xsec->SetLineColor(2);
  xsec->SetMarkerColor(2);
  xsec->SetLineWidth(2);
  //xsec->Draw("LP");

  TGraph *band_1s2 = new TGraph(2*val+1);
  TGraph *band_2s2 = new TGraph(2*val+1);
  band_1s2->SetLineStyle(2);
  band_1s2->SetFillColor(kGreen);
  band_1s2->SetLineColor(kBlue);
  band_1s2->SetMarkerColor(kBlue);
  band_2s2->SetLineStyle(2);
  band_2s2->SetFillColor(kYellow);
  band_2s2->SetLineColor(kBlue);
  band_2s2->SetMarkerColor(kBlue);

  //Legend
  //legendr->AddEntry(xsec,"Theoretical cross-section","LP");
  legendr->AddEntry(band_1s, "Expected #pm 1#sigma","flP");
  legendr->AddEntry(band_2s, "Expected #pm 2#sigma","flP");
  //legendr->AddEntry(band_1s2,"Expected #pm 1#sigma - GaussianXLandau","flP");
  //legendr->AddEntry(band_2s2,"Expected #pm 2#sigma - GaussianXLandau","flP");
  legendr->Draw();
	
  //Save plot
  if(save_plots) c1->SaveAs(plot_name); 
}
Example #6
0
void graphLE3(Long64_t entry=0,int num=2,int spot=0){
  
  gROOT->ProcessLine(".L ~/analysis/scripts/LoadStyle.C");
  LoadStyle();

  LendaEvent * event = new LendaEvent();
  
  TTree* flt =(TTree*)gDirectory->Get("flt");
  
  flt->SetBranchAddress("Event",&event);

  flt->GetEntry(entry);

  cout<<event->Traces.size()<<endl;


  int size = (int) event->Traces[spot].size();

  Double_t* x = malloc(size*sizeof(Double_t));
  Double_t* y = malloc(size*sizeof(Double_t));

  Double_t* y1= malloc(size*sizeof(Double_t));
    

  Double_t* y2=malloc(size*sizeof(Double_t));
    

    cout<<"size is "<<size<<endl;
    for (int i=0;i<size;i++){

      x[i]=i*10;
      y[i]=event->Traces[spot][i] -380;
      y1[i]=event->Filters[spot][i];
      y2[i]=event->CFDs[spot][i];
    }
    cout<<"50 "<<event->CFDs[spot][50]<<endl;
    cout<<"50 "<<event->CFDs[spot][51]<<endl;
    cout<<"50 "<<event->CFDs[spot][52]<<endl;
    cout<<"50 "<<event->CFDs[spot][53]<<endl;



    TGraph *gr = new TGraph(size,x,y);
    TGraph *gr1 = new TGraph(size,x,y1);
    TGraph *gr2 = new TGraph(size,x,y2);

    TCanvas *c = new TCanvas();

    c->cd(1);

    gr->SetFillColor(kBlack);
    gr1->SetFillColor(0);
    gr2->SetFillColor(0);

    gr->SetLineColor(kBlack);
    gr1->SetLineColor(kBlue);
    gr2->SetLineColor(kRed);
    gr->SetLineWidth(3);
    gr2->SetLineWidth(3);
    gr1->SetLineWidth(3);

    gr->SetMarkerSize(.7);
    gr1->SetMarkerSize(.7);
    gr2->SetMarkerSize(.7);


    gr->SetMarkerStyle(8);
    gr1->SetMarkerStyle(8);
    gr2->SetMarkerStyle(8);
    TMultiGraph *mg = new TMultiGraph();

    leg = new TLegend(0.7,0.7,1,1);
    leg->SetLineWidth(0);
    leg->SetHeader("");
    leg->AddEntry(gr, "Trace","l");
    leg->AddEntry(gr1,"Fast Filter","l");
    leg->AddEntry(gr2,"CFD Filter","l");

    leg->SetTextSize(.05);
    leg->SetFillColor(kWhite);
    mg->Add(gr);
    mg->Add(gr1);
    mg->Add(gr2);

    mg->SetTitle("Pixie Digital Waveform");
    mg->Draw("a L P");
    mg->GetHistogram()->GetXaxis()->SetTitle("Time [ns]");
    mg->GetHistogram()->GetYaxis()->SetTitle("ADC Channel");
    mg->GetHistogram()->GetYaxis()->SetTitleOffset(1.3);

    leg->Draw();      
    
}
Example #7
0
void DMplot()
{

    TCanvas *canv = new TCanvas("canv", "limits canvas", 800., 680.);
	gStyle->SetCanvasDefH(600); //Height of canvas
	gStyle->SetCanvasDefW(640); //Width of canvas
	gStyle->SetCanvasDefX(0);   //POsition on screen
	gStyle->SetCanvasDefY(0);

	gStyle->SetPadLeftMargin(0.14);//0.16);
	gStyle->SetPadRightMargin(0.165);//0.02);
	gStyle->SetPadTopMargin(0.085);//0.02);
	gStyle->SetPadBottomMargin(0.12);//0.02);

	  // For g axis titles:
	gStyle->SetTitleColor(1, "XYZ");
	gStyle->SetTitleFont(42, "XYZ");
	gStyle->SetTitleSize(0.045, "Z");
	gStyle->SetTitleSize(0.055, "XY");
	gStyle->SetTitleXOffset(1.0);//0.9);
	gStyle->SetTitleYOffset(1.15); // => 1.15 if exponents

	// For g axis labels:
	gStyle->SetLabelColor(1, "XYZ");
	gStyle->SetLabelFont(42, "XYZ");
	gStyle->SetLabelOffset(0.007, "XYZ");
	gStyle->SetLabelSize(0.04, "XYZ");

	// Legends
	gStyle->SetLegendBorderSize(0);
	gStyle->SetLegendFillColor(kWhite);
	gStyle->SetLegendFont(42);
    TPad* t1d = new TPad();
    t1d = new TPad("t1d","t1d", 0.0, 0.0, 1.0, 1.0);
    t1d->Draw();
    t1d->SetTicky();
    t1d->SetTickx();
    t1d->SetRightMargin(0.03);
    t1d->cd();

    //t1d->SetGridx(1);
    //t1d->SetGridy(1);
    t1d->SetLogy();
    t1d->SetLogx();

    //double const fn = 0.629;//0.326;
    TGraph *h_scalar_min = MakeGraph(0,0.260);
    TGraph *h_scalar_lat = MakeGraph(0,0.326);
    TGraph *h_scalar_max = MakeGraph(0,0.629);
    TGraph *h_fermion_min = MakeGraph(1,0.260);
    TGraph *h_fermion_lat = MakeGraph(1,0.326);
    TGraph *h_fermion_max = MakeGraph(1,0.629);

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

    // Get LUX bound 
    //TGraph *z1 = new TGraph("LUX_90CL.dat","%lg %lg");
    //
    TFile *fi_LUX2015 = TFile::Open("LUX_latest_2015.root");
    TGraph *z12015 =(TGraph*) fi_LUX2015->Get("LUX_2015");
    //TFile *fi_LUX2016 = TFile::Open("LUX_latest_2016.root");
    //TGraph *z12016 =(TGraph*) fi_LUX2016->Get("LUX_2016");
    TFile *fi_LUX2016 = TFile::Open("LUX_2013_2014_2015_combined.root");
    TGraph *z12016 =(TGraph*) fi_LUX2016->Get("LUX_2013_2014_2015_combined");

    z12015->SetLineWidth(3);
    z12015->SetLineColor(kGreen+2);
//    z12015->SetLineStyle(2);
    z12016->SetLineWidth(3);
    //z12016->SetLineStyle(2);
    z12016->SetLineColor(kGreen+2);

//    TLegend *leg2 = new TLegend(0.65, 0.15, 0.93, 0.42);
    TLegend *leg2 = new TLegend(0.70, 0.15, 0.97, 0.42);
    leg2->SetFillColor(0);
    leg2->SetBorderSize(0);
    //leg2->AddEntry(z1,"LUX(90\%CL)","L");
//////////////////////////////////////////////////
//  CDMS/ CRESST TOO
    TFile *CDMS_2016f = TFile::Open("CDMS_2016.root");
    TGraph *SCDMS = (TGraph*)CDMS_2016f->Get("CDMS_2016");

    TFile *CRESST2_2016f = TFile::Open("CRESST_2.root");
    TGraph *CRESST2 = (TGraph*)CRESST2_2016f->Get("CRESST_2_2016");

    TFile *PANDAX_2016f = TFile::Open("PANDAX.root");
    TGraph *PANDAX = (TGraph*)PANDAX_2016f->Get("PANDAX");

    SCDMS->SetLineColor(kAzure+7); SCDMS->SetLineStyle(9); SCDMS->SetLineWidth(3);
    CRESST2->SetLineColor(kMagenta+2); CRESST2->SetLineStyle(7); CRESST2->SetLineWidth(3);
    PANDAX->SetLineColor(kMagenta+2); PANDAX->SetLineStyle(4); PANDAX->SetLineWidth(3);
	
//
//

    h_scalar_min->SetTitle("");
    h_scalar_min->SetMinimum(2.0e-47);
    h_scalar_min->SetMaximum(1.0e-39);
    //h_scalar_min->SetMinimum(0.6e-46);
    //h_scalar_min->SetMaximum(1.0e-42);
    h_scalar_min->SetLineColor(4);
    h_scalar_min->SetLineStyle(2);
    h_scalar_min->SetLineWidth(3);
    h_scalar_min->GetXaxis()->SetTitleOffset(1.03);
    h_scalar_min->GetXaxis()->SetTitle("DM mass [GeV]");
    h_scalar_min->GetYaxis()->SetTitle("DM-nucleon cross section [cm^{2}]");
    h_scalar_lat->SetLineColor(4);
    h_scalar_lat->SetLineStyle(1);
    h_scalar_lat->SetLineWidth(3);
    h_scalar_max->SetLineColor(4);
    h_scalar_max->SetLineStyle(2);
    h_scalar_max->SetLineWidth(3);


    h_fermion_min->SetLineColor(kRed);
    h_fermion_min->SetLineStyle(2);
    h_fermion_min->SetLineWidth(3);
    h_fermion_lat->SetLineColor(kRed);
    h_fermion_lat->SetLineStyle(1);
    h_fermion_lat->SetLineWidth(3);
    h_fermion_max->SetLineColor(kRed);
    h_fermion_max->SetLineStyle(2);
    h_fermion_max->SetLineWidth(3);


    //h_scalar_lat->SetFillStyle(3005);
    //h_scalar_lat->SetLineWidth(-402);

    h_scalar_min->Draw("AL");
    h_scalar_lat->Draw("L");
    h_scalar_max->Draw("L");

    h_fermion_min->Draw("L");
    h_fermion_lat->Draw("L");
    h_fermion_max->Draw("L");
    z12016->Draw("L");
    //z12015->Draw("L");
    //CRESST2->Draw("C");
    SCDMS->Draw("C");
    PANDAX->Draw("C");

    //leg2->Draw();
    TLatex *lat = new TLatex(); lat->SetTextSize(0.025);
    lat->SetTextFont(42);
    lat->SetTextColor(kGreen+2);
    lat->SetTextAngle(15);
    //lat->DrawLatex(130,z1->Eval(130)*1.5,"LUX #it{Phys. Rev. Lett.} #bf{116} (2016)");


    //lat->DrawLatex(130,z12015->Eval(130)*1.5,"LUX (2015)");
    lat->DrawLatex(130,z12016->Eval(130)*0.5,"LUX (2013+2014-16)");
    
    lat->SetTextColor(SCDMS->GetLineColor());
    lat->SetTextAngle(344);
    //lat->SetFillColor(kWhite);
    lat->DrawLatex(5,SCDMS->Eval(5)*1.5,"CDMSlite (2015)");
    
    lat->SetTextColor(kBlue);
    lat->SetTextAngle(330);
    lat->DrawLatex(13,h_scalar_lat->Eval(13)*1.5,"Scalar DM");

    lat->SetTextColor(kRed);
    lat->SetTextAngle(4);
    lat->DrawLatex(5,h_fermion_lat->Eval(5)*1.5,"Fermion DM");


    lat->SetTextColor(kMagenta+2);
    lat->SetTextAngle(15);
    lat->DrawLatex(130,PANDAX->Eval(130)*1.25,"PandaX-II (2016)");

	TLatex * tex = new TLatex();
	tex->SetNDC();
	tex->SetTextFont(42);
	tex->SetLineWidth(2);
	tex->SetTextSize(0.04);
	tex->SetTextAlign(31);
	tex->DrawLatex(0.93,0.78,"4.9 fb^{-1} (7 TeV) + 19.7 fb^{-1} (8 TeV)");
	tex->DrawLatex(0.93,0.74,"+ 2.3 fb^{-1} (13 TeV)");
	//tex->SetTextAlign(11);
  	tex->SetTextFont(42);
	tex->SetTextSize(0.06);
        TLegend *legBOX; 
	if (isPrelim)	{
   		legBOX = new TLegend(0.16,0.83,0.38,0.89);
		legBOX->SetFillColor(kWhite);
		legBOX->SetLineWidth(0);
		legBOX->Draw();
		tex->DrawLatex(0.17, 0.84, "#bf{CMS} #it{Preliminary}");
	} else {
   		legBOX = new TLegend(0.16,0.83,0.28,0.89);
		legBOX->SetFillColor(kWhite);
		legBOX->SetLineWidth(0);
		//legBOX->Draw();
		tex->DrawLatex(0.93, 0.84, "#bf{CMS}");
	}
  tex->SetTextSize(0.045);
  tex->DrawLatex(0.93,0.68,Form("B(H #rightarrow inv.) < %.2f",BRinv));
  tex->DrawLatex(0.93,0.5,"90% CL limits");
  canv->SetTicky(1);
  canv->SetTickx(1);
  canv->SaveAs("limitsDM.pdf"); 

}
Example #8
0
///
/// Make a plot out of a 1D histogram holding a 1-CL curve.
/// The strategy is to always convert the 1-CL histogram (hCL) into
/// a TGraph. This way we can add known points (solutions, points
/// at end of scan range) and also have a filled area without line
/// smoothing. This is not possible with histograms due to a Root bug.
///
/// The function draws the TGraphs, and returns a pointer to the
/// TGraph object that can be used in the TLegend.
///
/// Markers are plotted if the method name of the scanner is "Plugin" or "BergerBoos" or "DatasetsPlugin".
/// One can plot a line instead of points even for the Plugin method by
/// using setPluginMarkers().
///
/// For the angle variables, a new axis is painted that is in Deg.
///
/// \param s The scanner to plot.
/// \param first
/// \param last
/// \param filled
///
TGraph* OneMinusClPlot::scan1dPlot(MethodAbsScan* s, bool first, bool last, bool filled, int CLsType)
{
	if ( arg->debug ){
		cout << "OneMinusClPlot::scan1dPlot() : plotting ";
		cout << s->getName() << " (" << s->getMethodName() << ")" << endl;
	}
	if ( m_mainCanvas==0 ){
		m_mainCanvas = newNoWarnTCanvas(name+getUniqueRootName(), title, 800, 600);
	}
	m_mainCanvas->cd();
	bool plotPoints = ( s->getMethodName()=="Plugin" || s->getMethodName()=="BergerBoos" || s->getMethodName()=="DatasetsPlugin" ) && plotPluginMarkers;
	TH1F *hCL = (TH1F*)s->getHCL()->Clone(getUniqueRootName());
	if (CLsType==1) hCL = (TH1F*)s->getHCLs()->Clone(getUniqueRootName());
  else if (CLsType==2) hCL = (TH1F*)s->getHCLsFreq()->Clone(getUniqueRootName());
	// fix inf and nan entries
	for ( int i=1; i<=s->getHCL()->GetNbinsX(); i++ ){
		if ( s->getHCL()->GetBinContent(i)!=s->getHCL()->GetBinContent(i)
				|| std::isinf(s->getHCL()->GetBinContent(i)) ) s->getHCL()->SetBinContent(i, 0.0);
	}

	// remove errors the hard way, else root ALWAYS plots them
	if ( !plotPoints ) hCL = histHardCopy(hCL, true, true);

	// disable any statistics box
	hCL->SetStats(0);

	// Convert the histogram into a TGraph so we can add the solution.
	// Also, the lf2 drawing option is broken in latest root versions.
	TGraph *g;
	if ( plotPoints ) g = new TGraphErrors(hCL->GetNbinsX());
	else              g = new TGraph(hCL->GetNbinsX());
	g->SetName(getUniqueRootName());
	for ( int i=0; i<hCL->GetNbinsX(); i++ ){
		g->SetPoint(i, hCL->GetBinCenter(i+1), hCL->GetBinContent(i+1));
		if ( plotPoints ) ((TGraphErrors*)g)->SetPointError(i, 0.0, hCL->GetBinError(i+1));
	}

	// add solution
	if ( ! s->getSolutions().empty() ){
		TGraphTools t;
		TGraph *gNew = t.addPointToGraphAtFirstMatchingX(g, s->getScanVar1Solution(0), 1.0);
		delete g;
		g = gNew;
	}

	// // set last point to the same p-value as first point by hand
	// // some angle plots sometimes don't manage to do it by themselves...
	// if ( arg->isQuickhack(XX) )
	// {
	//   Double_t pointx0, pointy0, err0;
	//   Double_t pointx1, pointy1, err1;
	//   g->GetPoint(0, pointx0, pointy0);
	//   g->GetPoint(g->GetN()-1, pointx1, pointy1);
	//   g->SetPoint(g->GetN()-1, pointx1, pointy0);
	//   if ( plotPoints ) err0 = ((TGraphErrors*)g)->GetErrorY(0);
	//   if ( plotPoints ) ((TGraphErrors*)g)->SetPointError(g->GetN()-1, 0.0, err0);
	// }

	// add end points of scan range
	if ( !plotPoints )
	{
		Double_t pointx0, pointy0;
		TGraph *gNew = new TGraph(g->GetN()+4);
		gNew->SetName(getUniqueRootName());
		for ( int i=0; i<g->GetN(); i++)
		{
			g->GetPoint(i, pointx0, pointy0);
			gNew->SetPoint(i+2, pointx0, pointy0);
		}

		// add origin
		gNew->SetPoint(0, hCL->GetXaxis()->GetXmin(), 0);

		// add a point at first y height but at x=origin.
		g->GetPoint(0, pointx0, pointy0);
		gNew->SetPoint(1, hCL->GetXaxis()->GetXmin(), pointy0);

		// add a point at last y height but at x=xmax.
		g->GetPoint(g->GetN()-1, pointx0, pointy0);
		gNew->SetPoint(gNew->GetN()-2, hCL->GetXaxis()->GetXmax(), pointy0);

		// add a point at xmax, 0
		gNew->SetPoint(gNew->GetN()-1, hCL->GetXaxis()->GetXmax(), 0);
		g = gNew;
	}

	int color = s->getLineColor();
	if(CLsType>0 && s->getMethodName().Contains("Plugin") && !arg->plotpluginonly) {
    if (CLsType==1) color = kBlue-7;
    else if (CLsType==2) color = kBlue+2;
  }
	else if(CLsType>0) {
    if (CLsType==1) color = s->getLineColor() - 5;
    if (CLsType==2) color = s->getLineColor() - 4;
  }
	g->SetLineColor(color);

	if ( filled ){
		g->SetLineWidth(2);
    double alpha = arg->isQuickhack(12) ? 0.4 : 1.;
    if ( arg->isQuickhack(24) ) alpha = 0.;
		g->SetFillColorAlpha(color,alpha);
		g->SetLineStyle(1);
    g->SetFillStyle( s->getFillStyle() );
	}
	else{
		g->SetLineWidth(2);
		g->SetLineStyle(s->getLineStyle());
    if ( last && arg->isQuickhack(25) ) g->SetLineWidth(3);
	}

	if ( plotPoints ){
		g->SetLineWidth(1);
		g->SetMarkerColor(color);
		g->SetMarkerStyle(8);
		g->SetMarkerSize(0.6);
		if(CLsType==1) {
			g->SetMarkerStyle(33);
			g->SetMarkerSize(1);
		}
		if(CLsType==2) {
			g->SetMarkerStyle(21);
		}
	}

	// build a histogram which holds the axes
	float min = arg->scanrangeMin == arg->scanrangeMax ? hCL->GetXaxis()->GetXmin() : arg->scanrangeMin;
	float max = arg->scanrangeMin == arg->scanrangeMax ? hCL->GetXaxis()->GetXmax() : arg->scanrangeMax;
	TH1F *haxes = new TH1F("haxes"+getUniqueRootName(), "", 100, min, max);
	haxes->SetStats(0);
	haxes->GetXaxis()->SetTitle(s->getScanVar1()->GetTitle());
	haxes->GetYaxis()->SetTitle("1-CL");
	haxes->GetXaxis()->SetLabelFont(font);
	haxes->GetYaxis()->SetLabelFont(font);
	haxes->GetXaxis()->SetTitleFont(font);
	haxes->GetYaxis()->SetTitleFont(font);
	haxes->GetXaxis()->SetTitleOffset(0.9);
	haxes->GetYaxis()->SetTitleOffset(0.85);
	haxes->GetXaxis()->SetLabelSize(labelsize);
	haxes->GetYaxis()->SetLabelSize(labelsize);
	haxes->GetXaxis()->SetTitleSize(titlesize);
	haxes->GetYaxis()->SetTitleSize(titlesize);
	int xndiv = arg->ndiv==-1 ? 407 : abs(arg->ndiv);
	bool optimizeNdiv = arg->ndiv<0 ? true : false;
	haxes->GetXaxis()->SetNdivisions(xndiv, optimizeNdiv);
	haxes->GetYaxis()->SetNdivisions(407, true);

  // plot y range
  float plotYMax;
  float plotYMin;
  if ( plotLegend && !arg->isQuickhack(22) ) {
    if ( arg->plotlog ) { plotYMin = 1.e-3; plotYMax = 10.; }
    else                { plotYMin = 0.0  ; plotYMax = 1.3; }
  }
  else {
    if ( arg->plotlog ) { plotYMin = 1.e-3; plotYMax = 1.0; }
    else                { plotYMin = 0.0  ; plotYMax = 1.0; }
  }
  // change if passed as option
	plotYMin = arg->plotymin > 0. ? arg->plotymin : plotYMin;
  plotYMax = arg->plotymax > 0. ? arg->plotymax : plotYMax;

  haxes->GetYaxis()->SetRangeUser( plotYMin, plotYMax );
	haxes->Draw("axissame");
	g->SetHistogram(haxes);

	TString drawOption = "";
	if ( plotPoints )   drawOption += " pe";
	else if ( filled )  drawOption += " F";
	else                drawOption += " L";
	if ( first )        drawOption += " A";
	g->Draw(drawOption);
  //if ( drawOption.Contains("F") ) ((TGraph*)g->Clone())->Draw("L");

	gPad->Update();
	float ymin = gPad->GetUymin();
	float ymax = gPad->GetUymax();
	float xmin = gPad->GetUxmin();
	float xmax = gPad->GetUxmax();

	// for the angles, draw a new axis in units of degrees
	if ( isAngle(s->getScanVar1()) ){
		haxes->GetXaxis()->SetTitle(s->getScanVar1()->GetTitle() + TString(" [#circ]"));
		haxes->GetXaxis()->SetNdivisions(0);  // disable old axis
		if ( last ){
			// new top axis
			TString chopt = "-U"; // - = downward ticks, U = unlabeled, http://root.cern.ch/root/html534/TGaxis.html
			if ( !optimizeNdiv ) chopt += "N"; // n = no bin optimization
			TGaxis *axist = new TGaxis(xmin, 1, xmax, 1, RadToDeg(xmin), RadToDeg(xmax), xndiv, chopt);
			axist->SetName("axist");
			axist->Draw();

			// new bottom axis
			float axisbMin = RadToDeg(xmin);
			float axisbMax = RadToDeg(xmax);
			if ( arg->isQuickhack(3) ){ ///< see documentation of --qh option in OptParser.cpp
				axisbMin += 180.;
				axisbMax += 180.;
			}
			chopt = ""; // - = downward ticks, U = unlabeled, http://root.cern.ch/root/html534/TGaxis.html
			if ( !optimizeNdiv ) chopt += "N"; // n = no bin optimization
			TGaxis *axisb = new TGaxis(xmin, ymin, xmax, ymin, axisbMin, axisbMax, xndiv, chopt);
			axisb->SetName("axisb");
			axisb->SetLabelFont(font);
			axisb->SetLabelSize(labelsize);
			axisb->Draw();
		}
	}
	else
	{
		if ( last ){
			// add top axis
			TString chopt = "-U"; // - = downward ticks, U = unlabeled, http://root.cern.ch/root/html534/TGaxis.html
			if ( !optimizeNdiv ) chopt += "N"; // n = no bin optimization
			TGaxis *axist = new TGaxis(xmin, 1.0, xmax, 1.0, xmin, xmax, xndiv, chopt);
			axist->SetName("axist");
			axist->SetLineWidth(1);
			axist->Draw();
		}
	}

	if ( last )
	{
		// add right axis
		TGaxis *axisr = 0;
		if ( arg->plotlog ){
			float f3min = 1e-3;
			float f3max = (plotLegend && !arg->isQuickhack(22)) ? 10. : 1.;
			TF1 *f3 = new TF1("f3","log10(x)",f3min,f3max);
			axisr = new TGaxis(xmax, f3min, xmax, f3max, "f3", 510, "G+");
		}
		else{
			axisr = new TGaxis(xmax, ymin, xmax, ymax, 0, (plotLegend && !arg->isQuickhack(22)) ? 1.3 : 1.0, 407, "+");
		}
		axisr->SetLabelSize(0);
		axisr->SetLineWidth(1);
		axisr->SetName("axisr");
		axisr->SetLabelColor(kWhite);
		axisr->SetTitleColor(kWhite);
		axisr->Draw();

		// redraw right axis as well because the 1-CL graph can cover the old one
		haxes->Draw("axissame");
	}

	return g;
}
Example #9
0
void plotLimit(TString outputDir="./", TString inputs="", TString inputXSec="", bool strengthLimit=true, bool blind=false, double energy=7, double luminosity=5.035, TString legendName="ee and #mu#mu channels")
{
  //style options
  gStyle->SetCanvasBorderMode(0);
  gStyle->SetCanvasColor(kWhite);
  gStyle->SetFrameBorderMode(0);
  gStyle->SetFrameBorderSize(1);
  gStyle->SetFrameFillColor(0);
  gStyle->SetFrameFillStyle(0);
  gStyle->SetFrameLineColor(1);
  gStyle->SetFrameLineStyle(1);
  gStyle->SetFrameLineWidth(1);
  gStyle->SetOptFit(1);
  gStyle->SetFitFormat("5.4g");
  gStyle->SetFuncColor(2);
  gStyle->SetOptFile(0);
  //gStyle->SetOptStat(0);
  gStyle->SetOptStat("mr");
  gStyle->SetStatColor(kWhite);
  gStyle->SetStatFont(42);
  gStyle->SetStatFontSize(0.04);
  gStyle->SetStatTextColor(1);
  gStyle->SetStatFormat("6.4g");
  gStyle->SetStatBorderSize(1);
  gStyle->SetStatH(0.1);
  gStyle->SetStatW(0.2);
  gStyle->SetPadTopMargin(0.05);
  gStyle->SetPadBottomMargin(0.13);
  gStyle->SetPadLeftMargin(0.16);
  gStyle->SetPadRightMargin(0.02);
  gStyle->SetOptTitle(0);
  gStyle->SetTitleFont(42);
  gStyle->SetTitleColor(1);
  gStyle->SetTitleTextColor(1);
  gStyle->SetTitleFillColor(10);
  gStyle->SetTitleFontSize(0.05);
  gStyle->SetAxisColor(1, "XYZ");
  gStyle->SetStripDecimals(kTRUE);
  gStyle->SetTickLength(0.03, "XYZ");
  gStyle->SetNdivisions(510, "XYZ");
  gStyle->SetPadTickX(1);  // To get tick marks on the opposite side of the frame
  gStyle->SetPadTickY(1);
  gStyle->SetEndErrorSize(2);
  gStyle->SetErrorX(0.);
  gStyle->SetMarkerStyle(20); 
  gROOT->ForceStyle();
  gStyle->SetPadTopMargin   (0.06);
  gStyle->SetPadBottomMargin(0.12);
  gStyle->SetPadRightMargin (0.06);
  gStyle->SetPadLeftMargin  (0.14);
  gStyle->SetTitleSize(0.04, "XYZ");
  gStyle->SetTitleXOffset(1.1);
  gStyle->SetTitleYOffset(1.45);
  gStyle->SetPalette(1);
  gStyle->SetNdivisions(505);


  string suffix = string(outputDir.Data());
  double cprime=1.0; double  brnew=0.0;
  double XSecScaleFactor = 1.0;
  if(suffix.find("_cp")!=string::npos){
     sscanf(suffix.c_str()+suffix.find("_cp"), "_cp%lf_brn%lf", &cprime, &brnew);
     XSecScaleFactor = pow(cprime,2) * (1-brnew);
  }
 
  //get xsec * br from summary file
  getXSecXBR(inputXSec); 
  //get the limits from the tree
  TFile* file = TFile::Open(inputs);
  printf("Looping on %s\n",inputs.Data());
  if(!file) return;
  if(file->IsZombie()) return;
  TTree* tree = (TTree*)file->Get("limit");
  tree->GetBranch("mh"              )->SetAddress(&Tmh      );
  tree->GetBranch("limit"           )->SetAddress(&Tlimit   );
  tree->GetBranch("limitErr"        )->SetAddress(&TlimitErr);
  tree->GetBranch("quantileExpected")->SetAddress(&TquantExp);
  int N = tree->GetEntriesFast() / 6 ;// 6Limits per mass point (observed, meand , +-1sigma, +-2sigma)
  double* MassAxis   = new double[N];
  double* ObsLimit   = new double[N];  fillLimitArray(tree,-1   ,ObsLimit,MassAxis);  if(!strengthLimit)scaleLimitsByXSecXBR(N, MassAxis, ObsLimit);
  double* ExpLimitm2 = new double[N];  fillLimitArray(tree,0.025,ExpLimitm2);         if(!strengthLimit)scaleLimitsByXSecXBR(N, MassAxis, ExpLimitm2);
  double* ExpLimitm1 = new double[N];  fillLimitArray(tree,0.160,ExpLimitm1);         if(!strengthLimit)scaleLimitsByXSecXBR(N, MassAxis, ExpLimitm1);
  double* ExpLimit   = new double[N];  fillLimitArray(tree,0.500,ExpLimit  );         if(!strengthLimit)scaleLimitsByXSecXBR(N, MassAxis, ExpLimit);
  double* ExpLimitp1 = new double[N];  fillLimitArray(tree,0.840,ExpLimitp1);         if(!strengthLimit)scaleLimitsByXSecXBR(N, MassAxis, ExpLimitp1);
  double* ExpLimitp2 = new double[N];  fillLimitArray(tree,0.975,ExpLimitp2);         if(!strengthLimit)scaleLimitsByXSecXBR(N, MassAxis, ExpLimitp2);
  file->Close();

  //make TH Cross-sections
  double* ThXSec   = new double[N]; for(unsigned int i=0;i<N;i++){ThXSec[i] = xsecXbr[MassAxis[i]];} 

  //scale TH cross-section and limits according to scale factor 
  //this only apply to NarrowResonnance case
  for(unsigned int i=0;i<N;i++){
    if(strengthLimit){
    ObsLimit[i]  /= XSecScaleFactor;
    ExpLimitm2[i]/= XSecScaleFactor;
    ExpLimitm1[i]/= XSecScaleFactor;
    ExpLimit  [i]/= XSecScaleFactor;
    ExpLimitp1[i]/= XSecScaleFactor;
    ExpLimitp2[i]/= XSecScaleFactor;
    }
    ThXSec[i]    *= XSecScaleFactor;
  }

    
  //limits in terms of signal strength
  TCanvas* c = new TCanvas("c", "c",600,600);
  TH1F* framework = new TH1F("Graph","Graph",1,15,70);
  framework->SetStats(false);
  framework->SetTitle("");
  framework->GetXaxis()->SetTitle("A boson mass [GeV]");
  framework->GetYaxis()->SetTitleOffset(1.70);
  if(strengthLimit){
  framework->GetYaxis()->SetTitle("#mu = #sigma_{95%} / #sigma_{th}");
  framework->GetYaxis()->SetRangeUser(5E-2,5E1);
  c->SetLogy(true);
  }else{
  framework->GetYaxis()->SetTitle("#sigma_{95%} (fb)");
  framework->GetYaxis()->SetRangeUser(1E-1,1E3);
  c->SetLogy(true);
  }
  framework->Draw();

  TGraph* TGObsLimit   = new TGraph(N,MassAxis,ObsLimit);  TGObsLimit->SetLineWidth(2);
  TGraph* TGExpLimit   = new TGraph(N,MassAxis,ExpLimit);  TGExpLimit->SetLineWidth(2); TGExpLimit->SetLineStyle(2);
  TCutG* TGExpLimit1S  = GetErrorBand("1S", N, MassAxis, ExpLimitm1, ExpLimitp1);  
  TCutG* TGExpLimit2S  = GetErrorBand("2S", N, MassAxis, ExpLimitm2, ExpLimitp2);  TGExpLimit2S->SetFillColor(5);
  TGraph* THXSec        = new TGraph(N,MassAxis,ThXSec); THXSec->SetLineWidth(2); THXSec->SetLineStyle(1); THXSec->SetLineColor(4);


  TGExpLimit->SetLineColor(2);  TGExpLimit->SetLineStyle(1);
  TGObsLimit->SetLineWidth(2);  TGObsLimit->SetMarkerStyle(20);
  TGExpLimit2S->Draw("fc same");
  TGExpLimit1S->Draw("fc same");
  if(!blind) TGObsLimit->Draw("same CP");
  TGExpLimit->Draw("same C");

  if(strengthLimit){
     TLine* SMLine = new TLine(framework->GetXaxis()->GetXmin(),1.0,framework->GetXaxis()->GetXmax(),1.0);
     SMLine->SetLineWidth(2); SMLine->SetLineStyle(1); SMLine->SetLineColor(4);      
     SMLine->Draw("same C");
  }else{
     THXSec->Draw("same C");
  }


  TPaveText *pave = new TPaveText(0.1,0.96,0.99,0.99,"NDC");
  char LumiLabel[1024];
  if(energy<9){  sprintf(LumiLabel,"CMS preliminary,  #sqrt{s}=%.0f TeV, #scale[0.5]{#int} L=%6.1ffb^{-1} - %20s",energy, luminosity,legendName.Data());
  }else{         sprintf(LumiLabel,"CMS preliminary,  #sqrt{s}=%.0f TeV #scale[0.5]{#int} L=%6.1ffb^{-1}, #sqrt{s}=%.0f TeV #scale[0.5]{#int} L=%6.1ffb^{-1}",7.0,5.0,8.0,19.7);
  }
  pave->SetBorderSize(0);
  pave->SetFillStyle(0);
  pave->SetTextFont(42);
  TObjArray* tokens = (TString(LumiLabel)).Tokenize("\\\\");
  int nt = tokens->GetEntries();
  for(int it=0; it<nt; ++it){
    TObjString * t = (TObjString *)tokens->At(it);
    pave->AddText(t->GetString());
  }
  pave->Draw("same");


  TLegend* LEG = new TLegend(0.55,0.75,0.85,0.95);
  LEG->SetHeader("Signal XSec x 1000");
  LEG->SetFillColor(0);
  LEG->SetFillStyle(0);
  LEG->SetTextFont(42);
  LEG->SetBorderSize(0);
  LEG->AddEntry(THXSec  , "TH prediction"  ,"L");
  LEG->AddEntry(TGExpLimit  , "median expected"  ,"L");
  LEG->AddEntry(TGExpLimit1S  , "expected #pm 1#sigma"  ,"F");
  LEG->AddEntry(TGExpLimit2S  , "expected #pm 2#sigma"  ,"F");
  if(!blind) LEG->AddEntry(TGObsLimit  , "observed"  ,"LP");
  LEG->Draw();
  c->RedrawAxis();
  c->SaveAs(outputDir+"Limit.png");
  c->SaveAs(outputDir+"Limit.C");
  c->SaveAs(outputDir+"Limit.pdf"); 


  //save a summary of the limits
  FILE* pFileSum = fopen((outputDir+"LimitSummary").Data(),"w");
  for(int i=0;i<N;i++){
    fprintf(pFileSum, "$%8.6E$ & $%8.6E$ & $[%8.6E,%8.6E]$ & $[%8.6E,%8.6E]$ & $%8.6E$ & Th=$%8.6E$\\\\\\hline\n",MassAxis[i], ExpLimit[i], ExpLimitm1[i], ExpLimitp1[i], ExpLimitm2[i],  ExpLimitp2[i], ObsLimit[i], ThXSec[i]);
    if(int(MassAxis[i])%50!=0)continue; printf("%f ",ObsLimit[i]);
  }printf("\n");
  fclose(pFileSum);

  pFileSum = fopen((outputDir+"LimitRange").Data(),"w");
  fprintf(pFileSum, "EXPECTED LIMIT --> ");                   printLimits(pFileSum,TGExpLimit, MassAxis[0], MassAxis[N-1]);
  if(!blind) fprintf(pFileSum, "OBSERVED LIMIT --> ");        printLimits(pFileSum,TGObsLimit, MassAxis[0], MassAxis[N-1]);
  fprintf(pFileSum, "Exp Limits for Model are: ");              for(int i=0;i<N;i++){if(int(MassAxis[i])%50!=0)continue; fprintf(pFileSum, "%f+-%f ",ExpLimit[i], (ExpLimitp1[i]-ExpLimitm1[i]))/2.0;}fprintf(pFileSum,"\n");
  if(!blind) { fprintf(pFileSum, "Obs Limits for Model are: "); for(int i=0;i<N;i++){if(int(MassAxis[i])%50!=0)continue; fprintf(pFileSum, "%f ",ObsLimit[i]);}fprintf(pFileSum,"\n"); }
  fclose(pFileSum);
}
Example #10
0
void timeonaxis()
{
// This macro illustrates the use of the time mode on the axis
// with different time intervals and time formats. It's result can
// be seen begin_html <a href="gif/timeonaxis.gif">here</a> end_html
// Through all this script, the time is expressed in UTC. some
// information about this format (and others like GPS) may be found at
// begin_html <a href="http://tycho.usno.navy.mil/systime.html">http://tycho.usno.navy.mil/systime.html</a> end_html
//  or
// begin_html <a href="http://www.topology.org/sci/time.html">http://www.topology.org/sci/time.html</a> end_html
//
// The start time is : almost NOW (the time at which the script is executed)
// actualy, the nearest preceding hour beginning.
// The time is in general expressed in UTC time with the C time() function
// This will obviously most of the time not be the time displayed on your watch
// since it is universal time. See the C time functions for converting this time
// into more useful structures.
//Author: Damir Buskulic

   time_t script_time;
   script_time = time(0);
   script_time = 3600*(int)(script_time/3600);

// The time offset is the one that will be used by all graphs.
// If one changes it, it will be changed even on the graphs already defined
   gStyle->SetTimeOffset(script_time);

   TCanvas *ct = new TCanvas("ct","Time on axis",10,10,700,900);
   ct->Divide(1,3);
   ct->SetFillColor(28);

   int i;

//======= Build a signal : noisy damped sine ======
//        Time interval : 30 minutes

   gStyle->SetTitleH(0.08);
   float noise;
   TH1F *ht = new TH1F("ht","Love at first sight",3000,0.,2000.);
   for (i=1;i<3000;i++) {
      noise = gRandom->Gaus(0,120);
      if (i>700) {
         noise += 1000*sin((i-700)*6.28/30)*exp((double)(700-i)/300);
      }
      ht->SetBinContent(i,noise);
   }
   ct->cd(1);
   ct_1->SetFillColor(41);
   ct_1->SetFrameFillColor(33);
   ht->SetLineColor(2);
   ht->GetXaxis()->SetLabelSize(0.05);
   ht->Draw();
// Sets time on the X axis
// The time used is the one set as time offset added to the value
// of the axis. This is converted into day/month/year hour:min:sec and
// a reasonnable tick interval value is chosen.
   ht->GetXaxis()->SetTimeDisplay(1);

//======= Build a simple graph beginning at a different time ======
//        Time interval : 5 seconds

   float x[100], t[100];
   for (i=0;i<100;i++) {
      x[i] = sin(i*4*3.1415926/50)*exp(-(double)i/20);
      t[i] = 6000+(double)i/20;
   }
   TGraph *gt = new TGraph(100,t,x);
   gt->SetTitle("Politics");
   ct->cd(2);
   ct_2->SetFillColor(41);
   ct_2->SetFrameFillColor(33);
   gt->SetFillColor(19);
   gt->SetLineColor(5);
   gt->SetLineWidth(2);
   gt->Draw("AL");
   gt->GetXaxis()->SetLabelSize(0.05);
// Sets time on the X axis
   gt->GetXaxis()->SetTimeDisplay(1);
   gPad->Modified();

//======= Build a second simple graph for a very long time interval ======
//        Time interval : a few years

   float x2[10], t2[10];
   for (i=0;i<10;i++) {
      x2[i] = gRandom->Gaus(500,100)*i;
      t2[i] = i*365*86400;
   }
   TGraph *gt2 = new TGraph(10,t2,x2);
   gt2->SetTitle("Number of monkeys on the moon");
   ct->cd(3);
   ct_3->SetFillColor(41);
   ct_3->SetFrameFillColor(33);
   gt2->SetFillColor(19);
   gt2->SetMarkerColor(4);
   gt2->SetMarkerStyle(29);
   gt2->SetMarkerSize(1.3);
   gt2->Draw("AP");
   gt2->GetXaxis()->SetLabelSize(0.05);
// Sets time on the X axis
   gt2->GetXaxis()->SetTimeDisplay(1);
//
// One can choose a different time format than the one chosen by default
// The time format is the same as the one of the C strftime() function
// It's a string containing the following formats :
//    for date :
//      %a abbreviated weekday name
//      %b abbreviated month name
//      %d day of the month (01-31)
//      %m month (01-12)
//      %y year without century
//      %Y year with century
//
//    for time :
//      %H hour (24-hour clock)
//      %I hour (12-hour clock)
//      %p local equivalent of AM or PM
//      %M minute (00-59)
//      %S seconds (00-61)
//      %% %
// The other characters are output as is.

   gt2->GetXaxis()->SetTimeFormat("y. %Y %F2000-01-01 00:00:00");
   gPad->Modified();
}
Example #11
0
///
/// Make a plot for the CLs stuff.
/// The strategy is to convert the hCLExp and hCLErr histogrms
/// into TGraphs and TGraphAsymmErrors
/// We can then provide some smoothing options as well
///
/// \param s The scanner to plot.
/// \param smooth
///
void OneMinusClPlot::scan1dCLsPlot(MethodAbsScan *s, bool smooth, bool obsError)
{
  if ( arg->debug ){
    cout << "OneMinusClPlot::scan1dCLsPlot() : plotting ";
    cout << s->getName() << " (" << s->getMethodName() << ")" << endl;
  }
  m_mainCanvas->cd();

  s->checkCLs();

  TH1F *hObs    = (TH1F*)s->getHCLsFreq()->Clone(getUniqueRootName());
  TH1F *hExp    = (TH1F*)s->getHCLsExp()->Clone(getUniqueRootName());
  TH1F *hErr1Up = (TH1F*)s->getHCLsErr1Up()->Clone(getUniqueRootName());
  TH1F *hErr1Dn = (TH1F*)s->getHCLsErr1Dn()->Clone(getUniqueRootName());
  TH1F *hErr2Up = (TH1F*)s->getHCLsErr2Up()->Clone(getUniqueRootName());
  TH1F *hErr2Dn = (TH1F*)s->getHCLsErr2Dn()->Clone(getUniqueRootName());

  if ( !hObs ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - can't find histogram hObs" << endl;
  if ( !hExp ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - can't find histogram hExp" << endl;
  if ( !hErr1Up ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - can't find histogram hErr1Up" << endl;
  if ( !hErr1Dn ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - can't find histogram hErr1Dn" << endl;
  if ( !hErr2Up ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - can't find histogram hErr2Up" << endl;
  if ( !hErr2Dn ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - can't find histogram hErr2Dn" << endl;

  // convert obs to graph
  TGraph *gObs = convertTH1ToTGraph(hObs,obsError);

  // convert others to raw graphs
  TGraph *gExpRaw    = convertTH1ToTGraph(hExp);
  TGraph *gErr1UpRaw = convertTH1ToTGraph(hErr1Up);
  TGraph *gErr1DnRaw = convertTH1ToTGraph(hErr1Dn);
  TGraph *gErr2UpRaw = convertTH1ToTGraph(hErr2Up);
  TGraph *gErr2DnRaw = convertTH1ToTGraph(hErr2Dn);

  // smoothing if needed
  TGraph *gExp;
  TGraph *gErr1Up;
  TGraph *gErr1Dn;
  TGraph *gErr2Up;
  TGraph *gErr2Dn;

  TGraphSmooth *smoother = new TGraphSmooth();
  if (smooth) {
    if ( arg->debug ) cout << "OneMinusClPlot::scan1dCLsPlot() : smoothing graphs" << endl;
    gExp    = (TGraph*)smoother->SmoothSuper( gExpRaw    )->Clone("gExp");
    gErr1Up = (TGraph*)smoother->SmoothSuper( gErr1UpRaw )->Clone("gErr1Up");
    gErr1Dn = (TGraph*)smoother->SmoothSuper( gErr1DnRaw )->Clone("gErr1Dn");
    gErr2Up = (TGraph*)smoother->SmoothSuper( gErr2UpRaw )->Clone("gErr2Up");
    gErr2Dn = (TGraph*)smoother->SmoothSuper( gErr2DnRaw )->Clone("gErr2Dn");
    if ( arg->debug ) cout << "OneMinusClPlot::scan1dCLsPlot() : done smoothing graphs" << endl;
  }
  else {
    gExp    = gExpRaw;
    gErr1Up = gErr1UpRaw;
    gErr1Dn = gErr1DnRaw;
    gErr2Up = gErr2UpRaw;
    gErr2Dn = gErr2DnRaw;
  }

  if ( !gObs ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - null graph gObs" << endl;
  if ( !gExp ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - null graph gExp" << endl;
  if ( !gErr1Up ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - null graph gErr1Up" << endl;
  if ( !gErr1Dn ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - null graph gErr1Dn" << endl;
  if ( !gErr2Up ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - null graph gErr2Up" << endl;
  if ( !gErr2Dn ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - null graph gErr2Dn" << endl;

  gObs->SetName("gObs");
  gExp->SetName("gExp");
  gErr1Up->SetName("gErr1Up");
  gErr1Dn->SetName("gErr1Dn");
  gErr2Up->SetName("gErr2Up");
  gErr2Dn->SetName("gErr2Dn");

  // now make the graphs for the error bands
  TGraphAsymmErrors *gErr1 = new TGraphAsymmErrors( gExp->GetN() );
  gErr1->SetName("gErr1");
  TGraphAsymmErrors *gErr2 = new TGraphAsymmErrors( gExp->GetN() );
  gErr2->SetName("gErr2");

  double x,y,yerrUp,yerrDn;
  double xerr = (hExp->GetBinCenter(2)-hExp->GetBinCenter(1))/2.;

  // protect against smoothing over 1
  for (int i=0; i<gExp->GetN(); i++) {
    gExp->GetPoint(i,x,y); gExp->SetPoint(i,x,TMath::Min(y,1.));
    gErr1Up->GetPoint(i,x,y); gErr1Up->SetPoint(i,x,TMath::Min(y,1.));
    gErr1Dn->GetPoint(i,x,y); gErr1Dn->SetPoint(i,x,TMath::Min(y,1.));
    gErr2Up->GetPoint(i,x,y); gErr2Up->SetPoint(i,x,TMath::Min(y,1.));
    gErr2Dn->GetPoint(i,x,y); gErr2Dn->SetPoint(i,x,TMath::Min(y,1.));
  }

  for (int i=0; i<gExp->GetN(); i++) {
    gExp->GetPoint(i,x,y);
    gErr1->SetPoint(i,x,y);
    gErr2->SetPoint(i,x,y);

    gErr1Up->GetPoint(i,x,yerrUp);
    gErr1Dn->GetPoint(i,x,yerrDn);
    gErr1->SetPointError(i, xerr, xerr, y-yerrDn, yerrUp-y );

    gErr2Up->GetPoint(i,x,yerrUp);
    gErr2Dn->GetPoint(i,x,yerrDn);
    gErr2->SetPointError(i, xerr, xerr, y-yerrDn, yerrUp-y );
  }

  gErr2->SetFillColor( TColor::GetColor("#3182bd") );
  gErr2->SetLineColor( TColor::GetColor("#3182bd") );
  gErr1->SetFillColor( TColor::GetColor("#9ecae1") );
  gErr1->SetLineColor( TColor::GetColor("#9ecae1") );
  gExp->SetLineColor(kRed);
  gExp->SetLineWidth(3);
  gObs->SetLineColor(kBlack);
  gObs->SetMarkerColor(kBlack);
  gObs->SetLineWidth(3);
  gObs->SetMarkerSize(1);
  gObs->SetMarkerStyle(20);

	float min = arg->scanrangeMin == arg->scanrangeMax ? hObs->GetXaxis()->GetXmin() : arg->scanrangeMin;
	float max = arg->scanrangeMin == arg->scanrangeMax ? hObs->GetXaxis()->GetXmax() : arg->scanrangeMax;
	TH1F *haxes = new TH1F("haxes"+getUniqueRootName(), "", 100, min, max);
	haxes->SetStats(0);
	haxes->GetXaxis()->SetTitle(s->getScanVar1()->GetTitle());
	haxes->GetYaxis()->SetTitle("CL_{S}");
	haxes->GetXaxis()->SetLabelFont(font);
	haxes->GetYaxis()->SetLabelFont(font);
	haxes->GetXaxis()->SetTitleFont(font);
	haxes->GetYaxis()->SetTitleFont(font);
	haxes->GetXaxis()->SetTitleOffset(0.9);
	haxes->GetYaxis()->SetTitleOffset(0.85);
	haxes->GetXaxis()->SetLabelSize(labelsize);
	haxes->GetYaxis()->SetLabelSize(labelsize);
	haxes->GetXaxis()->SetTitleSize(titlesize);
	haxes->GetYaxis()->SetTitleSize(titlesize);
	int xndiv = arg->ndiv==-1 ? 407 : abs(arg->ndiv);
	bool optimizeNdiv = arg->ndiv<0 ? true : false;
	haxes->GetXaxis()->SetNdivisions(xndiv, optimizeNdiv);
	haxes->GetYaxis()->SetNdivisions(407, true);
  haxes->GetYaxis()->SetRangeUser(0.,1.);

  // Legend:
	// make the legend short, the text will extend over the boundary, but the symbol will be shorter
  float legendXmin = 0.68 ;
  float legendYmin = 0.58 ;
  float legendXmax = legendXmin + 0.25 ;
  float legendYmax = legendYmin + 0.22 ;
	TLegend* leg = new TLegend(legendXmin,legendYmin,legendXmax,legendYmax);
	leg->SetFillColor(kWhite);
	leg->SetFillStyle(0);
	leg->SetLineColor(kWhite);
	leg->SetBorderSize(0);
	leg->SetTextFont(font);
	leg->SetTextSize(legendsize*0.75);

  if (obsError) leg->AddEntry( gObs, "Observed", "LEP" );
  else          leg->AddEntry( gObs, "Observed", "LP"  );
  leg->AddEntry( gExp, "Expected", "L" );
  leg->AddEntry( gErr1, "#pm 1#sigma", "F");
  leg->AddEntry( gErr2, "#pm 2#sigma", "F");

  haxes->Draw("AXIS+");
  gErr2->Draw("E3same");
  gErr1->Draw("E3same");
  gExp->Draw("Lsame");
  if (obsError) gObs->Draw("LEPsame");
  else          gObs->Draw("LPsame");
  leg->Draw("same");

  drawCLguideLine(0.1);

  double yGroup = 0.83;
  if ( arg->plotprelim || arg->plotunoff ) yGroup = 0.8;
  drawGroup(yGroup);

  m_mainCanvas->SetTicks();
  m_mainCanvas->RedrawAxis();
  m_mainCanvas->Update();
  m_mainCanvas->Modified();
  m_mainCanvas->Show();
  savePlot( m_mainCanvas, name+"_cls"+arg->plotext );
  m_mainCanvas->SetTicks(false);
}
Example #12
0
// -------------------------
// -- Functions           --
// -------------------------
void makeDeadEcalEff() {
   
  gStyle->SetOptStat(0);  
  TCanvas *c1 = new TCanvas("c1","A Simple Graph with error bars",200,10,700,500);
  
  const Int_t nbins = 6;

  TString lifetime = "0.5";
  //   TString lifetime = "1";
   //   TString lifetime = "5";

   Float_t masses      [nbins] = {103, 164, 246, 328, 408, 488};  
   Float_t effOld0p5ns [nbins] = {0.884, 0.958, 0.889, 0.895, 0.897, 0.909}; 
   Float_t effDPG0p5ns [nbins] = {0.877, 0.958, 0.894, 0.884, 0.901, 0.888};  // Federico's DPG map 

   Float_t effOld1ns   [nbins] = {0.896, 0.93, 0.912, 0.944, 0.918, 0.914}; 
   Float_t effDPG1ns   [nbins] = {0.899, 0.92, 0.912, 0.926, 0.90, 0.901};  // Federico's DPG map 

   Float_t effOld5ns   [nbins] = {0.921, 0.938, 0.942, 0.92, 0.936, 0.942}; 
   Float_t effDPG5ns   [nbins] = {0.909, 0.913, 0.934, 0.911, 0.93, 0.936};  // Federico's DPG map 

   Float_t* effOld;
   Float_t* effDPG; 

   if (lifetime=="0p5") {
     effOld = effOld0p5ns;
     effDPG = effDPG0p5ns;
   }

   if (lifetime=="1") {
     effOld = effOld1ns;
     effDPG = effDPG1ns;
   }

   if (lifetime=="5") {
     effOld = effOld5ns;
     effDPG = effDPG5ns;
   }

   for (int i=0; i<nbins; i++) {
     effOld[i] = 1.0 - effOld[i];
     effDPG[i] = 1.0 - effDPG[i];
   }

   TGraph *grEffOld = new TGraph(nbins, masses, effOld);  
   TGraph *grEffDPG = new TGraph(nbins, masses, effDPG);  

   grEffOld->SetMarkerStyle(21); // 21:  square  
   grEffOld->SetMarkerSize(0.8);
   grEffOld->SetMarkerColor(kBlue);
   grEffOld->SetLineWidth(2);  
   grEffOld->SetMinimum(0);
   grEffOld->SetMaximum(0.25);
   //  grEffOld->SetTitle(";chargino mass;efficiency of dead ECAL veto"); 
   grEffOld->SetTitle(";chargino mass;1 - #epsilon"); 
   grEffOld->Draw("AP");
   //   grEffOld->Draw("P");

   grEffDPG->SetMarkerStyle(26); // 26:  hollow triangle 
   grEffDPG->SetMarkerSize(0.8);
   grEffDPG->SetMarkerColor(kRed);
   grEffDPG->SetLineWidth(2);  
   grEffDPG->Draw("P, same");

  TLine l;
  l.SetLineColor(kRed);
  l.DrawLine(2.5,1.0,6.5,1.0); 
  TLegend leg2(0.50,0.6,0.85,0.8);
  leg2.AddEntry(grEffOld, "old map ("      + lifetime + " ns)", "pl");  
  leg2.AddEntry(grEffDPG, "ECAL DPG map (" + lifetime + " ns)", "pl");  
  leg2.SetBorderSize(0);
  leg2.SetFillStyle(1001);
  leg2.SetFillColor(kWhite);
  leg2.SetBorderSize(0);
  leg2.SetTextFont(gStyle->GetTitleFont());
  leg2.Draw();


  TPaveText* pt = new TPaveText(0.50, 0.82, 0.90, 0.88, "NDC");
  pt->SetFillStyle(0);
  pt->SetBorderSize(0);
  pt->SetTextFont(gStyle->GetTitleFont());
  pt->AddText("CMS Preliminary, #sqrt{s} = 8 TeV");
  //  pt->Draw();


  c1->SetLogy(0);
  c1->Print("deadEcalEff" + lifetime + "ns.pdf");  
  c1->Clear();

  return;

} 
void mssm_limit_RHW_12p9_Final()
{
//=========Macro generated from canvas: c1/c1
//=========  (Wed Jul 27 09:42:19 2016) by ROOT version6.04/14
    //=========  (Wed Jul 27 09:41:49 2016) by ROOT version6.04/14
    TCanvas *c1 = new TCanvas("c1", "c1",0,45,600,600);
    gStyle->SetOptStat(0);
    c1->SetHighLightColor(2);
    c1->Range(0,0,1,1);
    c1->SetFillColor(0);
    c1->SetBorderMode(0);
    c1->SetBorderSize(2);
    c1->SetLeftMargin(0.12);
    c1->SetRightMargin(0.04);
    c1->SetTopMargin(0.06);
    c1->SetBottomMargin(0.12);
    c1->SetFrameFillStyle(0);
    c1->SetFrameLineWidth(2);
    c1->SetFrameBorderMode(0);
    
    // ------------>Primitives in pad: pad_leg
    TPad *pad_leg = new TPad("pad_leg", "pad_leg",0.4,0.65,0.9,0.9);
    pad_leg->Draw();
    pad_leg->cd();
    pad_leg->Range(0,0,1,1);
    pad_leg->SetFillColor(0);
    pad_leg->SetFillStyle(4000);
    pad_leg->SetBorderMode(0);
    pad_leg->SetBorderSize(2);
    pad_leg->SetLeftMargin(0.12);
    pad_leg->SetRightMargin(0.04);
    pad_leg->SetTopMargin(0.06);
    pad_leg->SetBottomMargin(0.12);
    pad_leg->SetFrameFillStyle(0);
    pad_leg->SetFrameLineWidth(2);
    pad_leg->SetFrameBorderMode(0);
    
    TLegend *leg = new TLegend(0.29,0.01,0.79,0.91,NULL,"NBNDC");
    leg->SetBorderSize(0);
    leg->SetTextFont(62);
    leg->SetTextSize(0.15);
    leg->SetLineColor(1);
    leg->SetLineStyle(1);
    leg->SetLineWidth(1);
    leg->SetFillColor(0);
    leg->SetFillStyle(1001);
    
    //    TLegendEntry *entry=leg->AddEntry("NULL","95% CL Excluded:","h");
    //   entry->SetLineColor(1);
    //   entry->SetLineStyle(1);
    //   entry->SetLineWidth(1);
    //   entry->SetMarkerColor(1);
    //   entry->SetMarkerStyle(21);
    //   entry->SetMarkerSize(1);
    //   entry->SetTextFont(62);
    
    TLegendEntry * entry=leg->AddEntry("Graph1","Theory (M_{Nu}=M_{W}/2)","L");
    entry->SetLineColor(4);
    entry->SetLineStyle(1);
    entry->SetLineWidth(3);
    entry->SetMarkerColor(4);
    entry->SetMarkerStyle(21);
    entry->SetMarkerSize(1);
    entry->SetTextFont(62);
    
    entry=leg->AddEntry("Graph","Observed","L");
    entry->SetLineColor(1);
    entry->SetLineStyle(1);
    entry->SetLineWidth(3);
    entry->SetMarkerColor(1);
    entry->SetMarkerStyle(21);
    entry->SetMarkerSize(1);
    entry->SetTextFont(62);
    
    entry=leg->AddEntry("Graph","Expected","L");
    
    Int_t ci;      // for color index setting
    TColor *color; // for color definition with alpha
    
    ci = TColor::GetColor("#ff0000");
    entry->SetLineColor(ci);
    entry->SetLineStyle(1);
    entry->SetLineWidth(3);
    entry->SetMarkerColor(1);
    entry->SetMarkerStyle(21);
    entry->SetMarkerSize(1);
    entry->SetTextFont(62);
    
    
    entry=leg->AddEntry("","#pm 1#sigma Expected","F");
    
    
    ci = TColor::GetColor("#00ff00");
    entry->SetFillColor(ci);
    entry->SetFillStyle(1001);
    entry->SetLineColor(1);
    entry->SetLineStyle(1);
    entry->SetLineWidth(1);
    entry->SetMarkerColor(1);
    entry->SetMarkerStyle(21);
    entry->SetMarkerSize(1);
    entry->SetTextFont(62);
    
    
    entry=leg->AddEntry("","#pm 2#sigma Expected","F");
    
    ci = TColor::GetColor("#fcf10f");
    entry->SetFillColor(ci);
    entry->SetFillStyle(1001);
    entry->SetLineColor(1);
    entry->SetLineStyle(1);
    entry->SetLineWidth(1);
    entry->SetMarkerColor(1);
    entry->SetMarkerStyle(21);
    entry->SetMarkerSize(1);
    entry->SetTextFont(62);
    leg->Draw();
    pad_leg->Modified();
    c1->cd();
    
    // ------------>Primitives in pad: pad_plot
    TPad *pad_plot = new TPad("pad_plot", "pad_plot",0,0,1,1);
    pad_plot->Draw();
    pad_plot->cd();
    pad_plot->Range(10.71429,-5.02439,1588.095,3.512195);
    pad_plot->SetFillColor(0);
    pad_plot->SetFillStyle(4000);
    pad_plot->SetBorderMode(0);
    pad_plot->SetBorderSize(2);
    pad_plot->SetLogy();
    pad_plot->SetGridx();
    pad_plot->SetGridy();
    pad_plot->SetLeftMargin(0.12);
    pad_plot->SetRightMargin(0.04);
    pad_plot->SetTopMargin(0.06);
    pad_plot->SetBottomMargin(0.12);
    pad_plot->SetFrameFillStyle(0);
    pad_plot->SetFrameLineWidth(2);
    pad_plot->SetFrameBorderMode(0);
    pad_plot->SetFrameFillStyle(0);
    pad_plot->SetFrameLineWidth(2);
    pad_plot->SetFrameBorderMode(0);

    
    
  
   
   TH1F *hist1d__1 = new TH1F("hist1d__1","",4,1000,4000);
   hist1d__1->SetMinimum(0.0001);
   hist1d__1->SetMaximum(10);
   hist1d__1->SetDirectory(0);
   hist1d__1->SetLineStyle(0);
   hist1d__1->SetMarkerStyle(20);
   hist1d__1->GetXaxis()->SetTitle("M_{W_{R}} [GeV]");
   hist1d__1->GetXaxis()->SetMoreLogLabels();
   hist1d__1->GetXaxis()->SetNoExponent();
   hist1d__1->GetXaxis()->SetNdivisions(50005);
   hist1d__1->GetXaxis()->SetLabelFont(42);
   hist1d__1->GetXaxis()->SetTitleSize(0.05);
   hist1d__1->GetXaxis()->SetTickLength(0.02);
   hist1d__1->GetXaxis()->SetTitleOffset(1.08);
   hist1d__1->GetXaxis()->SetTitleFont(42);
   hist1d__1->GetYaxis()->SetTitle("95% CL limit on #sigma#font[42]{}(pp#rightarrowW)#timesB(W#rightarrow#tau#taujj)[pb]");
   hist1d__1->GetYaxis()->SetNdivisions(506);
   hist1d__1->GetYaxis()->SetLabelFont(42);
   hist1d__1->GetYaxis()->SetLabelOffset(0.007);
   hist1d__1->GetYaxis()->SetTitleSize(0.045);
   hist1d__1->GetYaxis()->SetTickLength(0.02);
   hist1d__1->GetYaxis()->SetTitleOffset(1.08);
   hist1d__1->GetYaxis()->SetTitleFont(42);
   hist1d__1->GetZaxis()->SetNdivisions(506);
   hist1d__1->GetZaxis()->SetLabelFont(42);
   hist1d__1->GetZaxis()->SetLabelOffset(0.007);
   hist1d__1->GetZaxis()->SetTitleSize(0.05);
   hist1d__1->GetZaxis()->SetTickLength(0.02);
   hist1d__1->GetZaxis()->SetTitleFont(42);
   hist1d__1->Draw("");
   
    Double_t _fx3001[7] = {
        1000,
        1500,
        2000,
        2500,
        3000,
        3500,
        4000};
    Double_t _fy3001[7] = {
        0.1098728,
        0.01945496,
        0.007522583,
        0.003204346,
        0.001922607,
        0.001281738,
        0.0009155273};
    Double_t _felx3001[7] = {
        0,
        0,
        0,
        0,
        0,
        0,
        0};
    Double_t _fely3001[7] = {
        0,
        0,
        0,
        0,
        0,
        0,
        0};
    Double_t _fehx3001[7] = {
        0,
        0,
        0,
        0,
        0,
        0,
        0};
    Double_t _fehy3001[7] = {
        0.2584203,
        0.05385332,
        0.02205356,
        0.01286367,
        0.008620317,
        0.006632206,
        0.006158097};
    TGraphAsymmErrors *grae = new TGraphAsymmErrors(7,_fx3001,_fy3001,_felx3001,_fehx3001,_fely3001,_fehy3001);
    grae->SetName("");
    grae->SetTitle("");
    
    ci = TColor::GetColor("#fcf10f");
    grae->SetFillColor(ci);
    grae->SetMarkerStyle(20);
    
    TH1F *Graph_Graph_Graph13001 = new TH1F("Graph_Graph_Graph13001","",100,700,4300);
    Graph_Graph_Graph13001->SetMinimum(0.0008239746);
    Graph_Graph_Graph13001->SetMaximum(0.4050309);
    Graph_Graph_Graph13001->SetDirectory(0);
    Graph_Graph_Graph13001->SetStats(0);
    Graph_Graph_Graph13001->SetLineStyle(0);
    Graph_Graph_Graph13001->SetMarkerStyle(20);
    Graph_Graph_Graph13001->GetXaxis()->SetNdivisions(506);
    Graph_Graph_Graph13001->GetXaxis()->SetLabelFont(42);
    Graph_Graph_Graph13001->GetXaxis()->SetTitleSize(0.05);
    Graph_Graph_Graph13001->GetXaxis()->SetTickLength(0.02);
    Graph_Graph_Graph13001->GetXaxis()->SetTitleOffset(1.08);
    Graph_Graph_Graph13001->GetXaxis()->SetTitleFont(42);
    Graph_Graph_Graph13001->GetYaxis()->SetNdivisions(506);
    Graph_Graph_Graph13001->GetYaxis()->SetLabelFont(42);
    Graph_Graph_Graph13001->GetYaxis()->SetLabelOffset(0.007);
    Graph_Graph_Graph13001->GetYaxis()->SetTitleSize(0.05);
    Graph_Graph_Graph13001->GetYaxis()->SetTickLength(0.02);
    Graph_Graph_Graph13001->GetYaxis()->SetTitleOffset(1.08);
    Graph_Graph_Graph13001->GetYaxis()->SetTitleFont(42);
    Graph_Graph_Graph13001->GetZaxis()->SetNdivisions(506);
    Graph_Graph_Graph13001->GetZaxis()->SetLabelFont(42);
    Graph_Graph_Graph13001->GetZaxis()->SetLabelOffset(0.007);
    Graph_Graph_Graph13001->GetZaxis()->SetTitleSize(0.05);
    Graph_Graph_Graph13001->GetZaxis()->SetTickLength(0.02);
    Graph_Graph_Graph13001->GetZaxis()->SetTitleFont(42);
    grae->SetHistogram(Graph_Graph_Graph13001);
    
    grae->Draw("3");
    
    Double_t _fx3002[7] = {
        1000,
        1500,
        2000,
        2500,
        3000,
        3500,
        4000};
    Double_t _fy3002[7] = {
        0.1444494,
        0.02616048,
        0.009596825,
        0.004491806,
        0.002849579,
        0.002082825,
        0.001296997};
    Double_t _felx3002[7] = {
        0,
        0,
        0,
        0,
        0,
        0,
        0};
    Double_t _fely3002[7] = {
        0,
        0,
        0,
        0,
        0,
        0,
        0};
    Double_t _fehx3002[7] = {
        0,
        0,
        0,
        0,
        0,
        0,
        0};
    Double_t _fehy3002[7] = {
        0.1315547,
        0.02651767,
        0.01133649,
        0.006102214,
        0.00406737,
        0.002643064,
        0.003324276};
    grae = new TGraphAsymmErrors(7,_fx3002,_fy3002,_felx3002,_fehx3002,_fely3002,_fehy3002);
    grae->SetName("");
    grae->SetTitle("");
    
    ci = TColor::GetColor("#00ff00");
    grae->SetFillColor(ci);
    grae->SetMarkerStyle(20);
    
    TH1F *Graph_Graph_Graph23002 = new TH1F("Graph_Graph_Graph23002","",100,700,4300);
    Graph_Graph_Graph23002->SetMinimum(0.001167297);
    Graph_Graph_Graph23002->SetMaximum(0.3034748);
    Graph_Graph_Graph23002->SetDirectory(0);
    Graph_Graph_Graph23002->SetStats(0);
    Graph_Graph_Graph23002->SetLineStyle(0);
    Graph_Graph_Graph23002->SetMarkerStyle(20);
    Graph_Graph_Graph23002->GetXaxis()->SetNdivisions(506);
    Graph_Graph_Graph23002->GetXaxis()->SetLabelFont(42);
    Graph_Graph_Graph23002->GetXaxis()->SetTitleSize(0.05);
    Graph_Graph_Graph23002->GetXaxis()->SetTickLength(0.02);
    Graph_Graph_Graph23002->GetXaxis()->SetTitleOffset(1.08);
    Graph_Graph_Graph23002->GetXaxis()->SetTitleFont(42);
    Graph_Graph_Graph23002->GetYaxis()->SetNdivisions(506);
    Graph_Graph_Graph23002->GetYaxis()->SetLabelFont(42);
    Graph_Graph_Graph23002->GetYaxis()->SetLabelOffset(0.007);
    Graph_Graph_Graph23002->GetYaxis()->SetTitleSize(0.05);
    Graph_Graph_Graph23002->GetYaxis()->SetTickLength(0.02);
    Graph_Graph_Graph23002->GetYaxis()->SetTitleOffset(1.08);
    Graph_Graph_Graph23002->GetYaxis()->SetTitleFont(42);
    Graph_Graph_Graph23002->GetZaxis()->SetNdivisions(506);
    Graph_Graph_Graph23002->GetZaxis()->SetLabelFont(42);
    Graph_Graph_Graph23002->GetZaxis()->SetLabelOffset(0.007);
    Graph_Graph_Graph23002->GetZaxis()->SetTitleSize(0.05);
    Graph_Graph_Graph23002->GetZaxis()->SetTickLength(0.02);
    Graph_Graph_Graph23002->GetZaxis()->SetTitleFont(42);
    grae->SetHistogram(Graph_Graph_Graph23002);
    
    grae->Draw("3");
    
    Double_t Graph0_fx1[7] = {
        1000,
        1500,
        2000,
        2500,
        3000,
        3500,
        4000};
    Double_t Graph0_fy1[7] = {
        0.2001953,
        0.03662109,
        0.01416016,
        0.007324219,
        0.004394531,
        0.003417969,
        0.002441406};
    TGraph *graph = new TGraph(7,Graph0_fx1,Graph0_fy1);
    graph->SetName("Graph0");
    graph->SetTitle("Graph");
    graph->SetFillColor(1);
    
    ci = TColor::GetColor("#ff0000");
    graph->SetLineColor(ci);
    graph->SetLineWidth(3);
    
    TH1F *Graph_Graph_Graph11 = new TH1F("Graph_Graph_Graph11","Graph",100,700,4300);
    Graph_Graph_Graph11->SetMinimum(0.002197266);
    Graph_Graph_Graph11->SetMaximum(0.2199707);
    Graph_Graph_Graph11->SetDirectory(0);
    Graph_Graph_Graph11->SetStats(0);
    Graph_Graph_Graph11->SetLineStyle(0);
    Graph_Graph_Graph11->SetMarkerStyle(20);
    Graph_Graph_Graph11->GetXaxis()->SetNdivisions(506);
    Graph_Graph_Graph11->GetXaxis()->SetLabelFont(42);
    Graph_Graph_Graph11->GetXaxis()->SetTitleSize(0.05);
    Graph_Graph_Graph11->GetXaxis()->SetTickLength(0.02);
    Graph_Graph_Graph11->GetXaxis()->SetTitleOffset(1.08);
    Graph_Graph_Graph11->GetXaxis()->SetTitleFont(42);
    Graph_Graph_Graph11->GetYaxis()->SetNdivisions(506);
    Graph_Graph_Graph11->GetYaxis()->SetLabelFont(42);
    Graph_Graph_Graph11->GetYaxis()->SetLabelOffset(0.007);
    Graph_Graph_Graph11->GetYaxis()->SetTitleSize(0.05);
    Graph_Graph_Graph11->GetYaxis()->SetTickLength(0.02);
    Graph_Graph_Graph11->GetYaxis()->SetTitleOffset(1.08);
    Graph_Graph_Graph11->GetYaxis()->SetTitleFont(42);
    Graph_Graph_Graph11->GetZaxis()->SetNdivisions(506);
    Graph_Graph_Graph11->GetZaxis()->SetLabelFont(42);
    Graph_Graph_Graph11->GetZaxis()->SetLabelOffset(0.007);
    Graph_Graph_Graph11->GetZaxis()->SetTitleSize(0.05);
    Graph_Graph_Graph11->GetZaxis()->SetTickLength(0.02);
    Graph_Graph_Graph11->GetZaxis()->SetTitleFont(42);
    graph->SetHistogram(Graph_Graph_Graph11);
    
    graph->Draw("l");
    
    Double_t Graph1_fx2[7] = {
        1000,
        1500,
        2000,
        2500,
        3000,
        3500,
        4000};
    Double_t Graph1_fy2[7] = {
        0.2611428,
        0.02795093,
        0.01375811,
        0.007949162,
        0.00466821,
        0.003475476,
        0.002687559};
    graph = new TGraph(7,Graph1_fx2,Graph1_fy2);
    graph->SetName("Graph1");
    graph->SetTitle("Graph");
    graph->SetFillColor(1);
    graph->SetLineWidth(3);
    graph->SetMarkerStyle(20);
    
    TH1F *Graph_Graph_Graph22 = new TH1F("Graph_Graph_Graph22","Graph",100,700,4300);
    Graph_Graph_Graph22->SetMinimum(0.002418803);
    Graph_Graph_Graph22->SetMaximum(0.2869883);
    Graph_Graph_Graph22->SetDirectory(0);
    Graph_Graph_Graph22->SetStats(0);
    Graph_Graph_Graph22->SetLineStyle(0);
    Graph_Graph_Graph22->SetMarkerStyle(20);
    Graph_Graph_Graph22->GetXaxis()->SetNdivisions(506);
    Graph_Graph_Graph22->GetXaxis()->SetLabelFont(42);
    Graph_Graph_Graph22->GetXaxis()->SetTitleSize(0.05);
    Graph_Graph_Graph22->GetXaxis()->SetTickLength(0.02);
    Graph_Graph_Graph22->GetXaxis()->SetTitleOffset(1.08);
    Graph_Graph_Graph22->GetXaxis()->SetTitleFont(42);
    Graph_Graph_Graph22->GetYaxis()->SetNdivisions(506);
    Graph_Graph_Graph22->GetYaxis()->SetLabelFont(42);
    Graph_Graph_Graph22->GetYaxis()->SetLabelOffset(0.007);
    Graph_Graph_Graph22->GetYaxis()->SetTitleSize(0.05);
    Graph_Graph_Graph22->GetYaxis()->SetTickLength(0.02);
    Graph_Graph_Graph22->GetYaxis()->SetTitleOffset(1.08);
    Graph_Graph_Graph22->GetYaxis()->SetTitleFont(42);
    Graph_Graph_Graph22->GetZaxis()->SetNdivisions(506);
    Graph_Graph_Graph22->GetZaxis()->SetLabelFont(42);
    Graph_Graph_Graph22->GetZaxis()->SetLabelOffset(0.007);
    Graph_Graph_Graph22->GetZaxis()->SetTitleSize(0.05);
    Graph_Graph_Graph22->GetZaxis()->SetTickLength(0.02);
    Graph_Graph_Graph22->GetZaxis()->SetTitleFont(42);
    graph->SetHistogram(Graph_Graph_Graph22);
    
    graph->Draw("pl");
    
    
    
    const int nTH=7;
    
    Double_t mTh[nTH] = {1000,1500,2000,2500,3000,3500,4000};
    
    
    
    
//    Double_t xsTh[nTH] = {1.692E0,2.9E-1,6.563E-02,1.92E-02,6.030E-03,1.92E-03,6.030E-04};
    Double_t xsTh[nTH] = {1.692E0,2.9E-1,6.563E-02,1.92E-02,6.030E-03,0.00209,0.000801};
    
    
    
    TGraph *xsTh_vs_m = new TGraph(nTH, mTh, xsTh);
    
    xsTh_vs_m->SetLineWidth(2);
    
    xsTh_vs_m->SetLineColor(kBlue);
    
    xsTh_vs_m->SetFillColor(kCyan-6);
    
    xsTh_vs_m->SetMarkerSize(0.00001);
    
    xsTh_vs_m->SetMarkerStyle(22);
    
    xsTh_vs_m->SetMarkerColor(kBlue);
    
    
    //    TGraph *grshade = new TGraph(2*nTH,x_pdf,y_pdf);
    //
    //    grshade->SetFillColor(kCyan-6);
    //
    //    grshade->SetFillStyle(3001);
    
    
    xsTh_vs_m->Draw("L");
    
    //    grshade->Draw("f");
    
    
    
    tex = new TLatex(0.1578,0.9113,"");
    tex->SetNDC();
    tex->SetTextAlign(13);
    tex->SetTextSize(0.048);
    tex->SetLineWidth(2);
    tex->Draw();
    tex = new TLatex(0.2,0.88,"CMS  ");
    tex->SetNDC();
    tex->SetTextAlign(12);
    tex->SetTextFont(61);
    tex->SetTextSize(0.06);
    tex->SetLineWidth(2);
    tex->Draw();
    tex = new TLatex(0.2,0.8," Preliminary ");
    tex->SetNDC();
    tex->SetTextAlign(12);
    tex->SetTextFont(52);
    tex->SetTextSize(0.055);
    tex->SetLineWidth(2);
    tex->Draw();
    
    tex = new TLatex(0.96,0.952,"12.9 fb^{-1} (13 TeV)");
    tex->SetNDC();
    tex->SetTextAlign(31);
    tex->SetTextFont(42);
    tex->SetTextSize(0.056);
    tex->SetLineWidth(2);
    tex->Draw();
   
    TH1F *hist1d__2 = new TH1F("hist1d__2","",3,2000,4000);
    hist1d__2->SetMinimum(0.0001);
    hist1d__2->SetMaximum(10);
    hist1d__2->SetDirectory(0);
    
    ptstats = new TPaveStats(0.78,0.775,0.98,0.935,"brNDC");
    ptstats->SetName("stats");
    ptstats->SetBorderSize(1);
    ptstats->SetFillColor(0);
    ptstats->SetTextAlign(12);
    ptstats->SetTextFont(42);
    AText = ptstats->AddText("hist1d");
    AText->SetTextSize(0.0368);
    //   AText = ptstats->AddText("Entries = 0      ");
    //   AText = ptstats->AddText("Mean  =      0");
    //   AText = ptstats->AddText("Std Dev   =      0");
    ptstats->SetOptStat(0);
    ptstats->SetOptFit(0);
    //   ptstats->Draw();
    hist1d__2->GetListOfFunctions()->Add(ptstats);
    ptstats->SetParent(hist1d__2);
    hist1d__2->SetLineStyle(0);
    hist1d__2->SetMarkerStyle(20);
    hist1d__2->GetXaxis()->SetTitle("M_{W_{R}} [GeV]");
    hist1d__2->GetXaxis()->SetMoreLogLabels();
    hist1d__2->GetXaxis()->SetNoExponent();
    hist1d__2->GetXaxis()->SetNdivisions(50005);
    hist1d__2->GetXaxis()->SetLabelFont(42);
    hist1d__2->GetXaxis()->SetTitleSize(0.05);
    hist1d__2->GetXaxis()->SetTickLength(0.02);
    hist1d__2->GetXaxis()->SetTitleOffset(1.08);
    hist1d__2->GetXaxis()->SetTitleFont(42);
    hist1d__2->GetYaxis()->SetTitle("95% CL limit on #sigma#font[42]{}(pp#rightarrowW)#timesB(W#rightarrow#tau#taujj)[pb]");
    hist1d__2->GetYaxis()->SetNdivisions(506);
    hist1d__2->GetYaxis()->SetLabelFont(42);
    hist1d__2->GetYaxis()->SetLabelOffset(0.007);
    hist1d__2->GetYaxis()->SetTitleSize(0.045);
    hist1d__2->GetYaxis()->SetTickLength(0.02);
    hist1d__2->GetYaxis()->SetTitleOffset(1.08);
    hist1d__2->GetYaxis()->SetTitleFont(42);
    hist1d__2->GetZaxis()->SetNdivisions(506);
    hist1d__2->GetZaxis()->SetLabelFont(42);
    hist1d__2->GetZaxis()->SetLabelOffset(0.007);
    hist1d__2->GetZaxis()->SetTitleSize(0.05);
    hist1d__2->GetZaxis()->SetTickLength(0.02);
    hist1d__2->GetZaxis()->SetTitleFont(42);
    hist1d__2->Draw("sameaxis");
    pad_plot->Modified();
    c1->cd();
    c1->Modified();
    c1->cd();
    c1->SetSelected(c1);
}
   void ws_constrained_profile3D( const char* wsfile = "rootfiles/ws-data-unblind.root",
                                   const char* new_poi_name = "n_M234_H4_3b",
                                   int npoiPoints = 20,
                                   double poiMinVal = 0.,
                                   double poiMaxVal = 20.,
                                   double constraintWidth = 1.5,
                                   double ymax = 10.,
                                   int verbLevel=0 ) {


     gStyle->SetOptStat(0) ;

     //--- make output directory.

     char command[10000] ;
     sprintf( command, "basename %s", wsfile ) ;
     TString wsfilenopath = gSystem->GetFromPipe( command ) ;
     wsfilenopath.ReplaceAll(".root","") ;
     char outputdirstr[1000] ;
     sprintf( outputdirstr, "outputfiles/scans-%s", wsfilenopath.Data() ) ;
     TString outputdir( outputdirstr ) ;


     printf("\n\n Creating output directory: %s\n\n", outputdir.Data() ) ;
     sprintf(command, "mkdir -p %s", outputdir.Data() ) ;
     gSystem->Exec( command ) ;


     //--- Tell RooFit to shut up about anything less important than an ERROR.
      RooMsgService::instance().setGlobalKillBelow(RooFit::ERROR) ;



       if ( verbLevel > 0 ) { printf("\n\n Verbose level : %d\n\n", verbLevel) ; }


       TFile* wstf = new TFile( wsfile ) ;

       RooWorkspace* ws = dynamic_cast<RooWorkspace*>( wstf->Get("ws") );

       if ( verbLevel > 0 ) { ws->Print() ; }






       RooDataSet* rds = (RooDataSet*) ws->obj( "ra2b_observed_rds" ) ;

       if ( verbLevel > 0 ) {
          printf("\n\n\n  ===== RooDataSet ====================\n\n") ;
          rds->Print() ;
          rds->printMultiline(cout, 1, kTRUE, "") ;
       }





       ModelConfig* modelConfig = (ModelConfig*) ws->obj( "SbModel" ) ;
       RooAbsPdf* likelihood = modelConfig->GetPdf() ;

       RooRealVar* rrv_mu_susy_all0lep = ws->var("mu_susy_all0lep") ;
       if ( rrv_mu_susy_all0lep == 0x0 ) {
          printf("\n\n\n *** can't find mu_susy_all0lep in workspace.  Quitting.\n\n\n") ;
          return ;
       }





       //-- do BG only.
       rrv_mu_susy_all0lep->setVal(0.) ;
       rrv_mu_susy_all0lep->setConstant( kTRUE ) ;










       //-- do a prefit.

       printf("\n\n\n ====== Pre fit with unmodified nll var.\n\n") ;

       RooFitResult* dataFitResultSusyFixed = likelihood->fitTo(*rds, Save(true),Hesse(false),Minos(false),Strategy(1),PrintLevel(verbLevel));
       int dataSusyFixedFitCovQual = dataFitResultSusyFixed->covQual() ;
       if ( dataSusyFixedFitCovQual < 2 ) { printf("\n\n\n *** Failed fit!  Cov qual %d.  Quitting.\n\n", dataSusyFixedFitCovQual ) ; return ; }
       double dataFitSusyFixedNll = dataFitResultSusyFixed->minNll() ;

       if ( verbLevel > 0 ) {
          dataFitResultSusyFixed->Print("v") ;
       }

       printf("\n\n Nll value, from fit result : %.3f\n\n", dataFitSusyFixedNll ) ;

       delete dataFitResultSusyFixed ;






       //-- Construct the new POI parameter.
       RooAbsReal* new_poi_rar(0x0) ;

       new_poi_rar = ws->var( new_poi_name ) ;
       if ( new_poi_rar == 0x0 ) {
          printf("\n\n New POI %s is not a variable.  Trying function.\n\n", new_poi_name ) ;
          new_poi_rar = ws->function( new_poi_name ) ;
          if ( new_poi_rar == 0x0 ) {
             printf("\n\n New POI %s is not a function.  I quit.\n\n", new_poi_name ) ;
             return ;
          }
       } else {
          printf("\n\n     New POI %s is a variable with current value %.1f.\n\n", new_poi_name, new_poi_rar->getVal() ) ;
       }








       if ( npoiPoints <=0 ) {
          printf("\n\n Quitting now.\n\n" ) ;
          return ;
       }


       double startPoiVal = new_poi_rar->getVal() ;



      //--- The RooNLLVar is NOT equivalent to what minuit uses.
  //   RooNLLVar* nll = new RooNLLVar("nll","nll", *likelihood, *rds ) ;
  //   printf("\n\n Nll value, from construction : %.3f\n\n", nll->getVal() ) ;

      //--- output of createNLL IS what minuit uses, so use that.
       RooAbsReal* nll = likelihood -> createNLL( *rds, Verbose(true) ) ;

       RooRealVar* rrv_poiValue = new RooRealVar( "poiValue", "poiValue", 0., -10000., 10000. ) ;
   /// rrv_poiValue->setVal( poiMinVal ) ;
   /// rrv_poiValue->setConstant(kTRUE) ;

       RooRealVar* rrv_constraintWidth = new RooRealVar("constraintWidth","constraintWidth", 0.1, 0.1, 1000. ) ;
       rrv_constraintWidth -> setVal( constraintWidth ) ;
       rrv_constraintWidth -> setConstant(kTRUE) ;




       if ( verbLevel > 0 ) {
          printf("\n\n ======= debug likelihood print\n\n") ;
          likelihood->Print("v") ;
          printf("\n\n ======= debug nll print\n\n") ;
          nll->Print("v") ;
       }






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

       RooMinuit* rminuit( 0x0 ) ;


       RooMinuit* rminuit_uc = new RooMinuit( *nll  ) ;

       rminuit_uc->setPrintLevel(verbLevel-1) ;
       rminuit_uc->setNoWarn() ;

       rminuit_uc->migrad() ;
       rminuit_uc->hesse() ;

       RooFitResult* rfr_uc = rminuit_uc->fit("mr") ;

       double floatParInitVal[10000] ;
       char   floatParName[10000][100] ;
       int nFloatParInitVal(0) ;
       RooArgList ral_floats = rfr_uc->floatParsFinal() ;
       TIterator* floatParIter = ral_floats.createIterator() ;
       {
          RooRealVar* par ;
          while ( (par = (RooRealVar*) floatParIter->Next()) ) {
             sprintf( floatParName[nFloatParInitVal], "%s", par->GetName() ) ;
             floatParInitVal[nFloatParInitVal] = par->getVal() ;
             nFloatParInitVal++ ;
          }
       }



     //-------

       printf("\n\n Unbiased best value for new POI %s is : %7.1f\n\n", new_poi_rar->GetName(), new_poi_rar->getVal() ) ;
       double best_poi_val = new_poi_rar->getVal() ;

       char minuit_formula[10000] ;
       sprintf( minuit_formula, "%s+%s*(%s-%s)*(%s-%s)",
         nll->GetName(),
         rrv_constraintWidth->GetName(),
         new_poi_rar->GetName(), rrv_poiValue->GetName(),
         new_poi_rar->GetName(), rrv_poiValue->GetName()
          ) ;

       printf("\n\n Creating new minuit variable with formula: %s\n\n", minuit_formula ) ;
       RooFormulaVar* new_minuit_var = new RooFormulaVar("new_minuit_var", minuit_formula,
           RooArgList( *nll,
                       *rrv_constraintWidth,
                       *new_poi_rar, *rrv_poiValue,
                       *new_poi_rar, *rrv_poiValue
                       ) ) ;

       printf("\n\n Current value is %.2f\n\n",
            new_minuit_var->getVal() ) ;

       rminuit = new RooMinuit( *new_minuit_var ) ;


       RooAbsReal* plot_var = nll ;

       printf("\n\n Current value is %.2f\n\n",
            plot_var->getVal() ) ;




       rminuit->setPrintLevel(verbLevel-1) ;
       if ( verbLevel <=0 ) { rminuit->setNoWarn() ; }

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

       //-- If POI range is -1 to -1, automatically determine the range using the set value.

       if ( poiMinVal < 0. && poiMaxVal < 0. ) {

          printf("\n\n Automatic determination of scan range.\n\n") ;

          if ( startPoiVal <= 0. ) {
             printf("\n\n *** POI starting value zero or negative %g.  Quit.\n\n\n", startPoiVal ) ;
             return ;
          }

          poiMinVal = startPoiVal - 3.5 * sqrt(startPoiVal) ;
          poiMaxVal = startPoiVal + 6.0 * sqrt(startPoiVal) ;

          if ( poiMinVal < 0. ) { poiMinVal = 0. ; }

          printf("    Start val = %g.   Scan range:   %g  to  %g\n\n", startPoiVal, poiMinVal, poiMaxVal ) ;


       }



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


       double poiVals_scanDown[1000] ;
       double nllVals_scanDown[1000] ;

       //-- Do scan down from best value.

       printf("\n\n +++++ Starting scan down from best value.\n\n") ;

       double minNllVal(1.e9) ;

       for ( int poivi=0; poivi < npoiPoints/2 ; poivi++ ) {

          ////double poiValue = poiMinVal + poivi*(poiMaxVal-poiMinVal)/(1.*(npoiPoints-1)) ;
          double poiValue = best_poi_val - poivi*(best_poi_val-poiMinVal)/(1.*(npoiPoints/2-1)) ;

          rrv_poiValue -> setVal( poiValue ) ;
          rrv_poiValue -> setConstant( kTRUE ) ;


       //+++++++++++++++++++++++++++++++++++

          rminuit->migrad() ;
          rminuit->hesse() ;
          RooFitResult* rfr = rminuit->save() ;

       //+++++++++++++++++++++++++++++++++++


          if ( verbLevel > 0 ) { rfr->Print("v") ; }


          float fit_minuit_var_val = rfr->minNll() ;

          printf(" %02d : poi constraint = %.2f : allvars : MinuitVar, createNLL, PV, POI :    %.5f   %.5f   %.5f   %.5f\n",
                poivi, rrv_poiValue->getVal(), fit_minuit_var_val, nll->getVal(), plot_var->getVal(), new_poi_rar->getVal() ) ;
          cout << flush ;



          poiVals_scanDown[poivi] = new_poi_rar->getVal() ;
          nllVals_scanDown[poivi] = plot_var->getVal() ;

          if ( nllVals_scanDown[poivi] < minNllVal ) { minNllVal = nllVals_scanDown[poivi] ; }

          delete rfr ;


       } // poivi


       printf("\n\n +++++ Resetting floats to best fit values.\n\n") ;

       for ( int pi=0; pi<nFloatParInitVal; pi++ ) {
          RooRealVar* par = ws->var( floatParName[pi] ) ;
          par->setVal( floatParInitVal[pi] ) ;
       } // pi.

       printf("\n\n +++++ Starting scan up from best value.\n\n") ;

      //-- Now do scan up.

       double poiVals_scanUp[1000] ;
       double nllVals_scanUp[1000] ;

       for ( int poivi=0; poivi < npoiPoints/2 ; poivi++ ) {

          double poiValue = best_poi_val + poivi*(poiMaxVal-best_poi_val)/(1.*(npoiPoints/2-1)) ;

          rrv_poiValue -> setVal( poiValue ) ;
          rrv_poiValue -> setConstant( kTRUE ) ;


       //+++++++++++++++++++++++++++++++++++

          rminuit->migrad() ;
          rminuit->hesse() ;
          RooFitResult* rfr = rminuit->save() ;

       //+++++++++++++++++++++++++++++++++++


          if ( verbLevel > 0 ) { rfr->Print("v") ; }


          float fit_minuit_var_val = rfr->minNll() ;

          printf(" %02d : poi constraint = %.2f : allvars : MinuitVar, createNLL, PV, POI :    %.5f   %.5f   %.5f   %.5f\n",
                poivi, rrv_poiValue->getVal(), fit_minuit_var_val, nll->getVal(), plot_var->getVal(), new_poi_rar->getVal() ) ;
          cout << flush ;

          poiVals_scanUp[poivi] = new_poi_rar->getVal() ;
          nllVals_scanUp[poivi] = plot_var->getVal() ;

          if ( nllVals_scanUp[poivi] < minNllVal ) { minNllVal = nllVals_scanUp[poivi] ; }

          delete rfr ;


       } // poivi





       double poiVals[1000] ;
       double nllVals[1000] ;

       int pointCount(0) ;
       for ( int pi=0; pi<npoiPoints/2; pi++ ) {
          poiVals[pi] = poiVals_scanDown[(npoiPoints/2-1)-pi] ;
          nllVals[pi] = nllVals_scanDown[(npoiPoints/2-1)-pi] ;
          pointCount++ ;
       }
       for ( int pi=1; pi<npoiPoints/2; pi++ ) {
          poiVals[pointCount] = poiVals_scanUp[pi] ;
          nllVals[pointCount] = nllVals_scanUp[pi] ;
          pointCount++ ;
       }
       npoiPoints = pointCount ;

       printf("\n\n --- TGraph arrays:\n") ;
       for ( int i=0; i<npoiPoints; i++ ) {
          printf("  %2d : poi = %6.1f, nll = %g\n", i, poiVals[i], nllVals[i] ) ;
       }
       printf("\n\n") ;

       double nllDiffVals[1000] ;

       double poiAtMinlnL(-1.) ;
       double poiAtMinusDelta2(-1.) ;
       double poiAtPlusDelta2(-1.) ;
       for ( int poivi=0; poivi < npoiPoints ; poivi++ ) {
          nllDiffVals[poivi] = 2.*(nllVals[poivi] - minNllVal) ;
          double poiValue = poiMinVal + poivi*(poiMaxVal-poiMinVal)/(1.*npoiPoints) ;
          if ( nllDiffVals[poivi] < 0.01 ) { poiAtMinlnL = poiValue ; }
          if ( poiAtMinusDelta2 < 0. && nllDiffVals[poivi] < 2.5 ) { poiAtMinusDelta2 = poiValue ; }
          if ( poiAtMinlnL > 0. && poiAtPlusDelta2 < 0. && nllDiffVals[poivi] > 2.0 ) { poiAtPlusDelta2 = poiValue ; }
       } // poivi

       printf("\n\n Estimates for poi at delta ln L = -2, 0, +2:  %g ,   %g ,   %g\n\n", poiAtMinusDelta2, poiAtMinlnL, poiAtPlusDelta2 ) ;




      //--- Main canvas

       TCanvas* cscan = (TCanvas*) gDirectory->FindObject("cscan") ;
       if ( cscan == 0x0 ) {
          printf("\n Creating canvas.\n\n") ;
          cscan = new TCanvas("cscan","Delta nll") ;
       }


       char gname[1000] ;

       TGraph* graph = new TGraph( npoiPoints, poiVals, nllDiffVals ) ;
       sprintf( gname, "scan_%s", new_poi_name ) ;
       graph->SetName( gname ) ;

       double poiBest(-1.) ;
       double poiMinus1stdv(-1.) ;
       double poiPlus1stdv(-1.) ;
       double poiMinus2stdv(-1.) ;
       double poiPlus2stdv(-1.) ;
       double twoDeltalnLMin(1e9) ;

       int nscan(1000) ;
       for ( int xi=0; xi<nscan; xi++ ) {

          double x = poiVals[0] + xi*(poiVals[npoiPoints-1]-poiVals[0])/(nscan-1) ;

          double twoDeltalnL = graph -> Eval( x, 0, "S" ) ;

          if ( poiMinus1stdv < 0. && twoDeltalnL < 1.0 ) { poiMinus1stdv = x ; printf(" set m1 : %d, x=%g, 2dnll=%g\n", xi, x, twoDeltalnL) ;}
          if ( poiMinus2stdv < 0. && twoDeltalnL < 4.0 ) { poiMinus2stdv = x ; printf(" set m2 : %d, x=%g, 2dnll=%g\n", xi, x, twoDeltalnL) ;}
          if ( twoDeltalnL < twoDeltalnLMin ) { poiBest = x ; twoDeltalnLMin = twoDeltalnL ; }
          if ( twoDeltalnLMin < 0.3 && poiPlus1stdv < 0. && twoDeltalnL > 1.0 ) { poiPlus1stdv = x ; printf(" set p1 : %d, x=%g, 2dnll=%g\n", xi, x, twoDeltalnL) ;}
          if ( twoDeltalnLMin < 0.3 && poiPlus2stdv < 0. && twoDeltalnL > 4.0 ) { poiPlus2stdv = x ; printf(" set p2 : %d, x=%g, 2dnll=%g\n", xi, x, twoDeltalnL) ;}

          if ( xi%100 == 0 ) { printf( " %4d : poi=%6.2f,  2DeltalnL = %6.2f\n", xi, x, twoDeltalnL ) ; }

       }
       printf("\n\n POI estimate :  %g  +%g  -%g    [%g,%g],   two sigma errors: +%g  -%g   [%g,%g]\n\n",
               poiBest,
               (poiPlus1stdv-poiBest), (poiBest-poiMinus1stdv), poiMinus1stdv, poiPlus1stdv,
               (poiPlus2stdv-poiBest), (poiBest-poiMinus2stdv), poiMinus2stdv, poiPlus2stdv
               ) ;

       printf(" %s val,pm1sig,pm2sig: %7.2f  %7.2f  %7.2f  %7.2f  %7.2f\n",
          new_poi_name, poiBest, (poiPlus1stdv-poiBest), (poiBest-poiMinus1stdv), (poiPlus2stdv-poiBest), (poiBest-poiMinus2stdv) ) ;

       char htitle[1000] ;
       sprintf(htitle, "%s profile likelihood scan: -2ln(L/Lm)", new_poi_name ) ;
       TH1F* hscan = new TH1F("hscan", htitle, 10, poiMinVal, poiMaxVal ) ;
       hscan->SetMinimum(0.) ;
       hscan->SetMaximum(ymax) ;


       hscan->DrawCopy() ;
       graph->SetLineColor(4) ;
       graph->SetLineWidth(3) ;
       graph->Draw("CP") ;
       gPad->SetGridx(1) ;
       gPad->SetGridy(1) ;
       cscan->Update() ;

       TLine* line = new TLine() ;
       line->SetLineColor(2) ;
       line->DrawLine(poiMinVal, 1., poiPlus1stdv, 1.) ;
       line->DrawLine(poiMinus1stdv,0., poiMinus1stdv, 1.) ;
       line->DrawLine(poiPlus1stdv ,0., poiPlus1stdv , 1.) ;

       TText* text = new TText() ;
       text->SetTextSize(0.04) ;
       char tstring[1000] ;

       sprintf( tstring, "%s = %.1f +%.1f -%.1f", new_poi_name, poiBest, (poiPlus1stdv-poiBest), (poiBest-poiMinus1stdv) ) ;
       text -> DrawTextNDC( 0.15, 0.85, tstring ) ;

       sprintf( tstring, "68%% interval [%.1f,  %.1f]", poiMinus1stdv, poiPlus1stdv ) ;
       text -> DrawTextNDC( 0.15, 0.78, tstring ) ;


       char hname[1000] ;
       sprintf( hname, "hscanout_%s", new_poi_name ) ;
       TH1F* hsout = new TH1F( hname,"scan results",4,0.,4.) ;
       double obsVal(-1.) ;
       hsout->SetBinContent(1, obsVal ) ;
       hsout->SetBinContent(2, poiPlus1stdv ) ;
       hsout->SetBinContent(3, poiBest ) ;
       hsout->SetBinContent(4, poiMinus1stdv ) ;
       TAxis* xaxis = hsout->GetXaxis() ;
       xaxis->SetBinLabel(1,"Observed val.") ;
       xaxis->SetBinLabel(2,"Model+1sd") ;
       xaxis->SetBinLabel(3,"Model") ;
       xaxis->SetBinLabel(4,"Model-1sd") ;

       char outrootfile[10000] ;
       sprintf( outrootfile, "%s/scan-ff-%s.root", outputdir.Data(), new_poi_name ) ;

       char outpdffile[10000] ;
       sprintf( outpdffile, "%s/scan-ff-%s.pdf", outputdir.Data(), new_poi_name ) ;

       cscan->Update() ; cscan->Draw() ;

       printf("\n Saving %s\n", outpdffile ) ;
       cscan->SaveAs( outpdffile ) ;



     //--- save in root file

       printf("\n Saving %s\n", outrootfile ) ;
       TFile fout(outrootfile,"recreate") ;
       graph->Write() ;
       hsout->Write() ;
       fout.Close() ;

       delete ws ;
       wstf->Close() ;

   }
void
draw2DLimitContours(map<string,TList *>& m_contours,
		    const TString& par1,
		    const TString& par2,
		    const TString& plotprefix,
		    TLegend *legend,
		    float par1_bestfit,
		    float par2_bestfit)
{

  //from here we build the two-dimensional aTGC limit

  TCanvas *finalPlot = new TCanvas("final","limits",500,500);
  finalPlot->cd();

  cout << "Drawing expected 68%" << endl;

  TList *contLevel = m_contours["exp68"];
  TGraph *curv;

  std::cout << "m_contours.size() = " << m_contours.size() << std::endl;

  for (map<string,TList *>::const_iterator iter = m_contours.begin(); iter != m_contours.end(); iter++ ){
    std::cout << "iter->first = " << iter->first << std::endl;
    std::cout << "iter->second = " << iter->second << std::endl;
  }

  std::cout << "contLevel = " << contLevel << std::endl;

  assert(contLevel);

  curv = (TGraph*)(contLevel->First());

  curv->GetXaxis()->SetLimits(parmin(par1),parmax(par1));
  curv->GetYaxis()->SetRangeUser(parmin(par2),parmax(par2));

  curv->SetTitle();
  curv->GetXaxis()->SetTitle(par2latex(par1));
  curv->GetXaxis()->SetTitleFont(42);
  curv->GetYaxis()->SetTitle(par2latex(par2));
  curv->GetYaxis()->SetTitleFont(42);
  curv->GetYaxis()->SetTitleOffset(1.20);

  legend->SetNColumns(2);

  for (int i=0; i<contLevel->GetSize(); i++) {
    assert(curv);
    curv->SetLineColor(kBlue);
    curv->SetLineWidth(2);
    curv->SetLineStyle(9);
    if (!i) {
      curv->Draw("AC");
      legend->AddEntry(curv,"Expected 68% C.L.","L");
    } else 
      curv->Draw("SAME C");
    curv=(TGraph *)(contLevel->After(curv));
  }

  cout << "Drawing expected 95%" << endl;
  
  contLevel = m_contours["exp95"];

  curv = (TGraph*)(contLevel->First());

  for (int i=0; i<contLevel->GetSize(); i++) {
    curv->SetLineColor(kGreen);
    curv->SetLineWidth(2);
    curv->SetLineStyle(9);
    curv->Draw("SAME C");
    if (!i) legend->AddEntry(curv,"Expected 95% C.L.","L");
    curv=(TGraph *)(contLevel->After(curv));
  }

  cout << "Drawing expected 99%" << endl;

  contLevel = m_contours["exp99"];
  curv = (TGraph*)(contLevel->First());
  for (int i=0; i<contLevel->GetSize(); i++) {
    curv->SetLineColor(kRed);
    curv->SetLineWidth(2);
    curv->SetLineStyle(9);
    curv->Draw("SAME C");
    if (!i) legend->AddEntry(curv,"Expected 99% C.L.","L");
    curv=(TGraph *)(contLevel->After(curv));
  }

  
  contLevel = m_contours["obs95"];

  if (contLevel) {
    cout << "Drawing obs95" << endl;

    curv = (TGraph*)(contLevel->First());

    for (int i=0; i<contLevel->GetSize(); i++) {
      curv->Draw("SAME C");
      curv->SetLineWidth(3);
      if (!i) legend->AddEntry(curv,"Observed 95% C.L.","L");
      curv=(TGraph *)(contLevel->After(curv));
    }
  }

  
  TGraph *SMpoint = new TGraph(1);
  SMpoint->SetPoint(1,0,0);
  SMpoint->Draw("SAME P");
  legend->AddEntry(SMpoint,"SM","P");
  TGraph *bestfit = new TGraph(1);
  bestfit->SetPoint(1,par1_bestfit,par2_bestfit);
  bestfit->Draw("SAME *");
  legend->AddEntry(bestfit,"Best fit value","P");
  
  //smLabel = TPaveText(0,
  //                    m_contours["-2s"]->GetYaxis()->GetXmax()/8,
  //                    m_contours["-2s"]->GetXaxis()->GetXmax()/3->5,
  //                    -m_contours["-2s"]->GetYaxis()->GetXmax()/8);
  //smLabel->SetFillStyle(0);
  //smLabel->SetBorderSize(0);
  //smLabel->AddText(" SM");
  //smLabel->Draw();

  legend->Draw();

  TPaveText *text = new TPaveText(0.566,0.89,0.965,1.13,"NDC");
  text->SetFillStyle(0);
  text->SetBorderSize(0);
  text->SetTextFont(42);
  text->SetTextSize(0.05);
  //text->AddText(Form("95%% CL Limit on %s and %s",par2latex(par1).Data(),par2latex(par2).Data()));
  text->AddText(0,0.35,Form("2.3 fb^{-1} (%d TeV)",beamcometev));
  text->Draw();

  // text2 = TPaveText(0.155,0.199,0.974,0.244,"NDC");
  // text2->SetFillStyle(0);
  // text2->SetBorderSize(0);
  // text2->AddText("Values outside contour excluded");
  // text2->Draw();

  //text3 = TPaveText(0.506,0.699,0.905,0.758,"NDC");
  //text3->SetFillStyle(0);
  //text3->SetBorderSize(0);
  //text3->AddText(options.flavorText);
  //text3->Draw();    
  
  gPad->SetGrid(1,1);

  finalPlot->RedrawAxis();
  finalPlot->ResetAttPad();
  finalPlot->Update();

  finalPlot->Draw();
  finalPlot->Update();
  finalPlot->Modified();
  finalPlot->Update();
  finalPlot->Print(Form("%s.pdf",plotprefix.Data()));
  finalPlot->Print(Form("%s.eps",plotprefix.Data()));
  //finalPlot->Print(Form("%s.png",plotprefix.Data()));

}                                                 // draw2DlimitContours
Example #16
0
   void constrained_scan( const char* wsfile = "outputfiles/ws.root",
                          const char* new_poi_name="mu_bg_4b_msig_met1",
                          double constraintWidth=1.5,
                          int npoiPoints = 20,
                          double poiMinVal = 0.,
                          double poiMaxVal = 10.0,
                          double ymax = 9.,
                          int verbLevel=1  ) {

      TString outputdir("outputfiles") ;

      gStyle->SetOptStat(0) ;

      TFile* wstf = new TFile( wsfile ) ;
      RooWorkspace* ws = dynamic_cast<RooWorkspace*>( wstf->Get("ws") );
      ws->Print() ;

      RooDataSet* rds = (RooDataSet*) ws->obj( "hbb_observed_rds" ) ;
      cout << "\n\n\n  ===== RooDataSet ====================\n\n" << endl ;
      rds->Print() ;
      rds->printMultiline(cout, 1, kTRUE, "") ;

      RooRealVar* rv_sig_strength = ws->var("sig_strength") ;
      if ( rv_sig_strength == 0x0 ) { printf("\n\n *** can't find sig_strength in workspace.\n\n" ) ; return ; }

      RooAbsPdf* likelihood = ws->pdf("likelihood") ;
      if ( likelihood == 0x0 ) { printf("\n\n *** can't find likelihood in workspace.\n\n" ) ; return ; }
      printf("\n\n Likelihood:\n") ;
      likelihood -> Print() ;



      /////rv_sig_strength -> setConstant( kFALSE ) ;
      rv_sig_strength -> setVal(0.) ;
      rv_sig_strength -> setConstant( kTRUE ) ;

      likelihood->fitTo( *rds, Save(false), PrintLevel(0), Hesse(true), Strategy(1) ) ;
      //RooFitResult* fitResult = likelihood->fitTo( *rds, Save(true), PrintLevel(0), Hesse(true), Strategy(1) ) ;
      //double minNllSusyFloat = fitResult->minNll() ;
      //double susy_ss_atMinNll = rv_sig_strength -> getVal() ;

      RooMsgService::instance().getStream(1).removeTopic(Minimization) ;
      RooMsgService::instance().getStream(1).removeTopic(Fitting) ;



     //-- Construct the new POI parameter.
      RooAbsReal* new_poi_rar(0x0) ;

      new_poi_rar = ws->var( new_poi_name ) ;
      if ( new_poi_rar == 0x0 ) {
         printf("\n\n New POI %s is not a variable.  Trying function.\n\n", new_poi_name ) ;
         new_poi_rar = ws->function( new_poi_name ) ;
         if ( new_poi_rar == 0x0 ) {
            printf("\n\n New POI %s is not a function.  I quit.\n\n", new_poi_name ) ;
            return ;
         } else {
            printf("\n Found it.\n\n") ;
         }
      } else {
         printf("\n\n     New POI %s is a variable with current value %.1f.\n\n", new_poi_name, new_poi_rar->getVal() ) ;
      }

       double startPoiVal = new_poi_rar->getVal() ;


       RooAbsReal* nll = likelihood -> createNLL( *rds, Verbose(true) ) ;

       RooRealVar* rrv_poiValue = new RooRealVar( "poiValue", "poiValue", 0., -10000., 10000. ) ;

       RooRealVar* rrv_constraintWidth = new RooRealVar("constraintWidth","constraintWidth", 0.1, 0.1, 1000. ) ;
       rrv_constraintWidth -> setVal( constraintWidth ) ;
       rrv_constraintWidth -> setConstant(kTRUE) ;


       RooMinuit* rminuit( 0x0 ) ;


       RooMinuit* rminuit_uc = new RooMinuit( *nll  ) ;

       rminuit_uc->setPrintLevel(verbLevel-1) ;
       rminuit_uc->setNoWarn() ;

       rminuit_uc->migrad() ;
       rminuit_uc->hesse() ;

       RooFitResult* rfr_uc = rminuit_uc->fit("mr") ;

       double floatParInitVal[10000] ;
       char   floatParName[10000][100] ;
       int nFloatParInitVal(0) ;
       RooArgList ral_floats = rfr_uc->floatParsFinal() ;
       TIterator* floatParIter = ral_floats.createIterator() ;
       {
          RooRealVar* par ;
          while ( (par = (RooRealVar*) floatParIter->Next()) ) {
             sprintf( floatParName[nFloatParInitVal], "%s", par->GetName() ) ;
             floatParInitVal[nFloatParInitVal] = par->getVal() ;
             nFloatParInitVal++ ;
          }
       }


       printf("\n\n Unbiased best value for new POI %s is : %7.1f\n\n", new_poi_rar->GetName(), new_poi_rar->getVal() ) ;
       double best_poi_val = new_poi_rar->getVal() ;

       char minuit_formula[10000] ;
       sprintf( minuit_formula, "%s+%s*(%s-%s)*(%s-%s)",
         nll->GetName(),
         rrv_constraintWidth->GetName(),
         new_poi_rar->GetName(), rrv_poiValue->GetName(),
         new_poi_rar->GetName(), rrv_poiValue->GetName()
          ) ;

       printf("\n\n Creating new minuit variable with formula: %s\n\n", minuit_formula ) ;
       RooFormulaVar* new_minuit_var = new RooFormulaVar("new_minuit_var", minuit_formula,
           RooArgList( *nll,
                       *rrv_constraintWidth,
                       *new_poi_rar, *rrv_poiValue,
                       *new_poi_rar, *rrv_poiValue
                       ) ) ;

       printf("\n\n Current value is %.2f\n\n",
            new_minuit_var->getVal() ) ;

       rminuit = new RooMinuit( *new_minuit_var ) ;


       RooAbsReal* plot_var = nll ;

       printf("\n\n Current value is %.2f\n\n",
            plot_var->getVal() ) ;


       rminuit->setPrintLevel(verbLevel-1) ;
       if ( verbLevel <=0 ) { rminuit->setNoWarn() ; }


       if ( poiMinVal < 0. && poiMaxVal < 0. ) {

          printf("\n\n Automatic determination of scan range.\n\n") ;

          if ( startPoiVal <= 0. ) {
             printf("\n\n *** POI starting value zero or negative %g.  Quit.\n\n\n", startPoiVal ) ;
             return ;
          }

          poiMinVal = startPoiVal - 3.5 * sqrt(startPoiVal) ;
          poiMaxVal = startPoiVal + 6.0 * sqrt(startPoiVal) ;

          if ( poiMinVal < 0. ) { poiMinVal = 0. ; }

          printf("    Start val = %g.   Scan range:   %g  to  %g\n\n", startPoiVal, poiMinVal, poiMaxVal ) ;


       }



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


       double poiVals_scanDown[1000] ;
       double nllVals_scanDown[1000] ;

       //-- Do scan down from best value.

       printf("\n\n +++++ Starting scan down from best value.\n\n") ;

       double minNllVal(1.e9) ;

       for ( int poivi=0; poivi < npoiPoints/2 ; poivi++ ) {

          ////double poiValue = poiMinVal + poivi*(poiMaxVal-poiMinVal)/(1.*(npoiPoints-1)) ;
          double poiValue = best_poi_val - poivi*(best_poi_val-poiMinVal)/(1.*(npoiPoints/2-1)) ;

          rrv_poiValue -> setVal( poiValue ) ;
          rrv_poiValue -> setConstant( kTRUE ) ;


       //+++++++++++++++++++++++++++++++++++

          rminuit->migrad() ;
          rminuit->hesse() ;
          RooFitResult* rfr = rminuit->save() ;

       //+++++++++++++++++++++++++++++++++++


          if ( verbLevel > 0 ) { rfr->Print("v") ; }


          float fit_minuit_var_val = rfr->minNll() ;

          printf(" %02d : poi constraint = %.2f : allvars : MinuitVar, createNLL, PV, POI :    %.5f   %.5f   %.5f   %.5f\n",
                poivi, rrv_poiValue->getVal(), fit_minuit_var_val, nll->getVal(), plot_var->getVal(), new_poi_rar->getVal() ) ;
          cout << flush ;



          poiVals_scanDown[poivi] = new_poi_rar->getVal() ;
          nllVals_scanDown[poivi] = plot_var->getVal() ;

          if ( nllVals_scanDown[poivi] < minNllVal ) { minNllVal = nllVals_scanDown[poivi] ; }

          delete rfr ;


       } // poivi


       printf("\n\n +++++ Resetting floats to best fit values.\n\n") ;

       for ( int pi=0; pi<nFloatParInitVal; pi++ ) {
          RooRealVar* par = ws->var( floatParName[pi] ) ;
          par->setVal( floatParInitVal[pi] ) ;
       } // pi.

       printf("\n\n +++++ Starting scan up from best value.\n\n") ;

      //-- Now do scan up.

       double poiVals_scanUp[1000] ;
       double nllVals_scanUp[1000] ;

       for ( int poivi=0; poivi < npoiPoints/2 ; poivi++ ) {

          double poiValue = best_poi_val + poivi*(poiMaxVal-best_poi_val)/(1.*(npoiPoints/2-1)) ;

          rrv_poiValue -> setVal( poiValue ) ;
          rrv_poiValue -> setConstant( kTRUE ) ;


       //+++++++++++++++++++++++++++++++++++

          rminuit->migrad() ;
          rminuit->hesse() ;
          RooFitResult* rfr = rminuit->save() ;

       //+++++++++++++++++++++++++++++++++++


          if ( verbLevel > 0 ) { rfr->Print("v") ; }


          float fit_minuit_var_val = rfr->minNll() ;

          printf(" %02d : poi constraint = %.2f : allvars : MinuitVar, createNLL, PV, POI :    %.5f   %.5f   %.5f   %.5f\n",
                poivi, rrv_poiValue->getVal(), fit_minuit_var_val, nll->getVal(), plot_var->getVal(), new_poi_rar->getVal() ) ;
          cout << flush ;

          poiVals_scanUp[poivi] = new_poi_rar->getVal() ;
          nllVals_scanUp[poivi] = plot_var->getVal() ;

          if ( nllVals_scanUp[poivi] < minNllVal ) { minNllVal = nllVals_scanUp[poivi] ; }

          delete rfr ;


       } // poivi





       double poiVals[1000] ;
       double nllVals[1000] ;

       int pointCount(0) ;
       for ( int pi=0; pi<npoiPoints/2; pi++ ) {
          poiVals[pi] = poiVals_scanDown[(npoiPoints/2-1)-pi] ;
          nllVals[pi] = nllVals_scanDown[(npoiPoints/2-1)-pi] ;
          pointCount++ ;
       }
       for ( int pi=1; pi<npoiPoints/2; pi++ ) {
          poiVals[pointCount] = poiVals_scanUp[pi] ;
          nllVals[pointCount] = nllVals_scanUp[pi] ;
          pointCount++ ;
       }
       npoiPoints = pointCount ;

       printf("\n\n --- TGraph arrays:\n") ;
       for ( int i=0; i<npoiPoints; i++ ) {
          printf("  %2d : poi = %6.1f, nll = %g\n", i, poiVals[i], nllVals[i] ) ;
       }
       printf("\n\n") ;

       double nllDiffVals[1000] ;

       double poiAtMinlnL(-1.) ;
       double poiAtMinusDelta2(-1.) ;
       double poiAtPlusDelta2(-1.) ;
       for ( int poivi=0; poivi < npoiPoints ; poivi++ ) {
          nllDiffVals[poivi] = 2.*(nllVals[poivi] - minNllVal) ;
          double poiValue = poiMinVal + poivi*(poiMaxVal-poiMinVal)/(1.*npoiPoints) ;
          if ( nllDiffVals[poivi] < 0.01 ) { poiAtMinlnL = poiValue ; }
          if ( poiAtMinusDelta2 < 0. && nllDiffVals[poivi] < 2.5 ) { poiAtMinusDelta2 = poiValue ; }
          if ( poiAtMinlnL > 0. && poiAtPlusDelta2 < 0. && nllDiffVals[poivi] > 2.0 ) { poiAtPlusDelta2 = poiValue ; }
       } // poivi

       printf("\n\n Estimates for poi at delta ln L = -2, 0, +2:  %g ,   %g ,   %g\n\n", poiAtMinusDelta2, poiAtMinlnL, poiAtPlusDelta2 ) ;




      //--- Main canvas

       TCanvas* cscan = (TCanvas*) gDirectory->FindObject("cscan") ;
       if ( cscan == 0x0 ) {
          printf("\n Creating canvas.\n\n") ;
          cscan = new TCanvas("cscan","Delta nll") ;
       }


       char gname[1000] ;

       TGraph* graph = new TGraph( npoiPoints, poiVals, nllDiffVals ) ;
       sprintf( gname, "scan_%s", new_poi_name ) ;
       graph->SetName( gname ) ;

       double poiBest(-1.) ;
       double poiMinus1stdv(-1.) ;
       double poiPlus1stdv(-1.) ;
       double poiMinus2stdv(-1.) ;
       double poiPlus2stdv(-1.) ;
       double twoDeltalnLMin(1e9) ;

       int nscan(1000) ;
       for ( int xi=0; xi<nscan; xi++ ) {

          double x = poiVals[0] + xi*(poiVals[npoiPoints-1]-poiVals[0])/(nscan-1) ;

          double twoDeltalnL = graph -> Eval( x, 0, "S" ) ;

          if ( poiMinus1stdv < 0. && twoDeltalnL < 1.0 ) { poiMinus1stdv = x ; printf(" set m1 : %d, x=%g, 2dnll=%g\n", xi, x, twoDeltalnL) ;}
          if ( poiMinus2stdv < 0. && twoDeltalnL < 4.0 ) { poiMinus2stdv = x ; printf(" set m2 : %d, x=%g, 2dnll=%g\n", xi, x, twoDeltalnL) ;}
          if ( twoDeltalnL < twoDeltalnLMin ) { poiBest = x ; twoDeltalnLMin = twoDeltalnL ; }
          if ( twoDeltalnLMin < 0.3 && poiPlus1stdv < 0. && twoDeltalnL > 1.0 ) { poiPlus1stdv = x ; printf(" set p1 : %d, x=%g, 2dnll=%g\n", xi, x, twoDeltalnL) ;}
          if ( twoDeltalnLMin < 0.3 && poiPlus2stdv < 0. && twoDeltalnL > 4.0 ) { poiPlus2stdv = x ; printf(" set p2 : %d, x=%g, 2dnll=%g\n", xi, x, twoDeltalnL) ;}

          if ( xi%100 == 0 ) { printf( " %4d : poi=%6.2f,  2DeltalnL = %6.2f\n", xi, x, twoDeltalnL ) ; }

       }
       printf("\n\n POI estimate :  %g  +%g  -%g    [%g,%g],   two sigma errors: +%g  -%g   [%g,%g]\n\n",
               poiBest,
               (poiPlus1stdv-poiBest), (poiBest-poiMinus1stdv), poiMinus1stdv, poiPlus1stdv,
               (poiPlus2stdv-poiBest), (poiBest-poiMinus2stdv), poiMinus2stdv, poiPlus2stdv
               ) ;

       printf(" %s val,pm1sig,pm2sig: %7.2f  %7.2f  %7.2f  %7.2f  %7.2f\n",
          new_poi_name, poiBest, (poiPlus1stdv-poiBest), (poiBest-poiMinus1stdv), (poiPlus2stdv-poiBest), (poiBest-poiMinus2stdv) ) ;

       char htitle[1000] ;
       sprintf(htitle, "%s profile likelihood scan: -2ln(L/Lm)", new_poi_name ) ;
       TH1F* hscan = new TH1F("hscan", htitle, 10, poiMinVal, poiMaxVal ) ;
       hscan->SetMinimum(0.) ;
       hscan->SetMaximum(ymax) ;


       hscan->DrawCopy() ;
       graph->SetLineColor(4) ;
       graph->SetLineWidth(3) ;
       graph->Draw("CP") ;
       gPad->SetGridx(1) ;
       gPad->SetGridy(1) ;
       cscan->Update() ;

       TLine* line = new TLine() ;
       line->SetLineColor(2) ;
       line->DrawLine(poiMinVal, 1., poiPlus1stdv, 1.) ;
       line->DrawLine(poiMinus1stdv,0., poiMinus1stdv, 1.) ;
       line->DrawLine(poiPlus1stdv ,0., poiPlus1stdv , 1.) ;

       TText* text = new TText() ;
       text->SetTextSize(0.04) ;
       char tstring[1000] ;

       sprintf( tstring, "%s = %.1f +%.1f -%.1f", new_poi_name, poiBest, (poiPlus1stdv-poiBest), (poiBest-poiMinus1stdv) ) ;
       text -> DrawTextNDC( 0.15, 0.85, tstring ) ;

       sprintf( tstring, "68%% interval [%.1f,  %.1f]", poiMinus1stdv, poiPlus1stdv ) ;
       text -> DrawTextNDC( 0.15, 0.78, tstring ) ;


       char hname[1000] ;
       sprintf( hname, "hscanout_%s", new_poi_name ) ;
       TH1F* hsout = new TH1F( hname,"scan results",4,0.,4.) ;
       double obsVal(-1.) ;
       hsout->SetBinContent(1, obsVal ) ;
       hsout->SetBinContent(2, poiPlus1stdv ) ;
       hsout->SetBinContent(3, poiBest ) ;
       hsout->SetBinContent(4, poiMinus1stdv ) ;
       TAxis* xaxis = hsout->GetXaxis() ;
       xaxis->SetBinLabel(1,"Observed val.") ;
       xaxis->SetBinLabel(2,"Model+1sd") ;
       xaxis->SetBinLabel(3,"Model") ;
       xaxis->SetBinLabel(4,"Model-1sd") ;

       char outrootfile[10000] ;
       sprintf( outrootfile, "%s/scan-ff-%s.root", outputdir.Data(), new_poi_name ) ;

       char outpdffile[10000] ;
       sprintf( outpdffile, "%s/scan-ff-%s.pdf", outputdir.Data(), new_poi_name ) ;

       cscan->Update() ; cscan->Draw() ;

       printf("\n Saving %s\n", outpdffile ) ;
       cscan->SaveAs( outpdffile ) ;



     //--- save in root file

       printf("\n Saving %s\n", outrootfile ) ;
       TFile fout(outrootfile,"recreate") ;
       graph->Write() ;
       hsout->Write() ;
       fout.Close() ;

       delete ws ;
       wstf->Close() ;




   } // constrained_scan.
Example #17
0
Int_t sf_eta_calc() {

  // Code to calculate draw the scale factor
  // Save the (fit) eff canvases in .C and then take the relevant graphs, port them here
  // MC is red, data is blue

  gStyle->SetOptStat(0);

  string scenario = "r11a_02";
  Float_t eff_ymin = 0., eff_ymax = 1.;
  Float_t sf_ymin = .8, sf_ymax = 1.2;

  // Make sure uncertainty in histogram bins is calculated correctly
  TH1::SetDefaultSumw2(kTRUE);

  TGraphAsymmErrors *mc_eta_gr = new TGraphAsymmErrors(8);
  mc_eta_gr->SetName("mc_eta_gr");
  mc_eta_gr->SetTitle("Efficiency of IsoMu17::pass");
  mc_eta_gr->SetFillColor(1);
  mc_eta_gr->SetLineWidth(2);

  TGraphAsymmErrors *data_eta_gr = new TGraphAsymmErrors(8);
  data_eta_gr->SetName("data_eta_gr");
  data_eta_gr->SetTitle("Efficiency of IsoMu17::pass");
  data_eta_gr->SetFillColor(1);
  data_eta_gr->SetLineWidth(2);

  if (scenario == "r11a_02") {

    mc_eta_gr->SetPoint(0,-1.86838,0.7995214);
    mc_eta_gr->SetPointError(0,0.2316202,0.2183798,0.0005931561,0.0005918513);
    mc_eta_gr->SetPoint(1,-1.417241,0.8617826);
    mc_eta_gr->SetPointError(1,0.2327595,0.2172405,0.0004556456,0.0004543949);
    mc_eta_gr->SetPoint(2,-1.047956,0.8586515);
    mc_eta_gr->SetPointError(2,0.1520436,0.1479564,0.0005296333,0.0005279902);
    mc_eta_gr->SetPoint(3,-0.66943,0.9096112);
    mc_eta_gr->SetPointError(3,0.23057,0.21943,0.0003358943,0.0003347802);
    mc_eta_gr->SetPoint(4,-0.2240906,0.919867);
    mc_eta_gr->SetPointError(4,0.2259094,0.2240906,0.0003106755,0.0003095861);
    mc_eta_gr->SetPoint(5,0.2240117,0.920754);
    mc_eta_gr->SetPointError(5,0.2240117,0.2259883,0.0003101179,0.0003090191);
    mc_eta_gr->SetPoint(6,0.6694087,0.9077555);
    mc_eta_gr->SetPointError(6,0.2194087,0.2305913,0.0003403255,0.0003392076);
    mc_eta_gr->SetPoint(7,1.047288,0.8595425);
    mc_eta_gr->SetPointError(7,0.1472878,0.1527122,0.000532236,0.000530564);
    mc_eta_gr->SetPoint(8,1.417839,0.8565741);
    mc_eta_gr->SetPointError(8,0.2178395,0.2321605,0.0004671892,0.0004659327);
    mc_eta_gr->SetPoint(9,1.869129,0.7849424);
    mc_eta_gr->SetPointError(9,0.2191293,0.2308707,0.0006172086,0.0006159323);

    data_eta_gr->SetPoint(0,-1.868882,0.82801);
    data_eta_gr->SetPointError(0,0.2311176,0.2188824,0.002314924,0.002301582);
    data_eta_gr->SetPoint(1,-1.417679,0.8635589);
    data_eta_gr->SetPointError(1,0.2323207,0.2176793,0.001844261,0.001834545);
    data_eta_gr->SetPoint(2,-1.047022,0.868548);
    data_eta_gr->SetPointError(2,0.1529783,0.1470217,0.002081084,0.002063542);
    data_eta_gr->SetPoint(3,-0.6692046,0.8947471);
    data_eta_gr->SetPointError(3,0.2307954,0.2192046,0.001420159,0.001441598);
    data_eta_gr->SetPoint(4,-0.2243651,0.9000754);
    data_eta_gr->SetPointError(4,0.2256349,0.2243651,0.001382941,0.001380326);
    data_eta_gr->SetPoint(5,0.2235801,0.902705);
    data_eta_gr->SetPointError(5,0.2235801,0.2264199,0.001359295,0.001353093);
    data_eta_gr->SetPoint(6,0.6692666,0.8955032);
    data_eta_gr->SetPointError(6,0.2192666,0.2307334,0.00144139,0.001457894);
    data_eta_gr->SetPoint(7,1.04765,0.8633123);
    data_eta_gr->SetPointError(7,0.1476503,0.1523497,0.002098349,0.002099758);
    data_eta_gr->SetPoint(8,1.417202,0.8478178);
    data_eta_gr->SetPointError(8,0.217202,0.232798,0.001936715,0.001923869);
    data_eta_gr->SetPoint(9,1.867179,0.8412232);
    data_eta_gr->SetPointError(9,0.2171791,0.2328209,0.002212608,0.002206214);

  }

  else if (scenario == "r11ab_03") {

    mc_eta_gr->SetPoint(0,-1.868171,0.782932);
    mc_eta_gr->SetPointError(0,0.2318294,0.2181706,0.0006107667,0.0006095339);
    mc_eta_gr->SetPoint(1,-1.417316,0.8403162);
    mc_eta_gr->SetPointError(1,0.2326838,0.2173162,0.0004827777,0.0004816048);
    mc_eta_gr->SetPoint(2,-1.04792,0.8402417);
    mc_eta_gr->SetPointError(2,0.1520805,0.1479195,0.0005555163,0.0005539652);
    mc_eta_gr->SetPoint(3,-0.6695814,0.8921657);
    mc_eta_gr->SetPointError(3,0.2304186,0.2195814,0.0003626095,0.0003615467);
    mc_eta_gr->SetPoint(4,-0.2240705,0.9047071);
    mc_eta_gr->SetPointError(4,0.2259295,0.2240705,0.0003352504,0.0003342044);
    mc_eta_gr->SetPoint(5,0.2239957,0.906056);
    mc_eta_gr->SetPointError(5,0.2239957,0.2260043,0.0003341179,0.0003330621);
    mc_eta_gr->SetPoint(6,0.6692371,0.8902333);
    mc_eta_gr->SetPointError(6,0.2192371,0.2307629,0.0003669275,0.0003658612);
    mc_eta_gr->SetPoint(7,1.047165,0.8416174);
    mc_eta_gr->SetPointError(7,0.1471655,0.1528345,0.0005581294,0.0005565464);
    mc_eta_gr->SetPoint(8,1.417878,0.8348124);
    mc_eta_gr->SetPointError(8,0.2178779,0.2321221,0.0004942594,0.0004930825);
    mc_eta_gr->SetPoint(9,1.869087,0.7699485);
    mc_eta_gr->SetPointError(9,0.2190873,0.2309127,0.000632439,0.0006312288);

    data_eta_gr->SetPoint(0,-1.871494,0.7961821);
    data_eta_gr->SetPointError(0,0.2285056,0.2214944,0.001634904,0.001644249);
    data_eta_gr->SetPoint(1,-1.417084,0.8409349);
    data_eta_gr->SetPointError(1,0.2329158,0.2170842,0.00130698,0.001302522);
    data_eta_gr->SetPoint(2,-1.046806,0.8543268);
    data_eta_gr->SetPointError(2,0.1531945,0.1468055,0.001434821,0.00142465);
    data_eta_gr->SetPoint(3,-0.6702068,0.8774799);
    data_eta_gr->SetPointError(3,0.2297932,0.2202068,0.0010267,0.001020332);
    data_eta_gr->SetPoint(4,-0.2238056,0.8836152);
    data_eta_gr->SetPointError(4,0.2261944,0.2238056,0.000976152,0.0009762142);
    data_eta_gr->SetPoint(5,0.2234861,0.8866499);
    data_eta_gr->SetPointError(5,0.2234861,0.2265139,0.0009692998,0.0009617757);
    data_eta_gr->SetPoint(6,0.6688665,0.8797154);
    data_eta_gr->SetPointError(6,0.2188665,0.2311335,0.001019392,0.001014589);
    data_eta_gr->SetPoint(7,1.04662,0.8536259);
    data_eta_gr->SetPointError(7,0.1466205,0.1533795,0.001431579,0.001427786);
    data_eta_gr->SetPoint(8,1.41611,0.8273635);
    data_eta_gr->SetPointError(8,0.2161098,0.2338902,0.001359048,0.00135852);
    data_eta_gr->SetPoint(9,1.86979,0.8093114);
    data_eta_gr->SetPointError(9,0.2197902,0.2302098,0.001597748,0.001589389);

  }

  else if (scenario == "r11b_04") {

    mc_eta_gr->SetPoint(0,-1.868021,0.7753776);
    mc_eta_gr->SetPointError(0,0.2319786,0.2180214,0.0006184966,0.0006172958);
    mc_eta_gr->SetPoint(1,-1.41741,0.8304193);
    mc_eta_gr->SetPointError(1,0.2325896,0.2174104,0.0004944344,0.0004932961);
    mc_eta_gr->SetPoint(2,-1.047899,0.8319871);
    mc_eta_gr->SetPointError(2,0.1521005,0.1478995,0.0005667252,0.0005652123);
    mc_eta_gr->SetPoint(3,-0.6696206,0.8840301);
    mc_eta_gr->SetPointError(3,0.2303794,0.2196206,0.0003743403,0.0003732992);
    mc_eta_gr->SetPoint(4,-0.2240717,0.8979218);
    mc_eta_gr->SetPointError(4,0.2259283,0.2240717,0.0003455848,0.0003445567);
    mc_eta_gr->SetPoint(5,0.224021,0.8991673);
    mc_eta_gr->SetPointError(5,0.224021,0.225979,0.0003447555,0.0003437179);
    mc_eta_gr->SetPoint(6,0.6691805,0.882004);
    mc_eta_gr->SetPointError(6,0.2191805,0.2308195,0.0003785452,0.0003775019);
    mc_eta_gr->SetPoint(7,1.047185,0.8332385);
    mc_eta_gr->SetPointError(7,0.1471847,0.1528153,0.0005696473,0.0005681039);
    mc_eta_gr->SetPoint(8,1.417844,0.8249634);
    mc_eta_gr->SetPointError(8,0.2178442,0.2321558,0.000505789,0.0005046464);
    mc_eta_gr->SetPoint(9,1.869038,0.7628416);
    mc_eta_gr->SetPointError(9,0.2190382,0.2309618,0.0006394743,0.0006382947);

    data_eta_gr->SetPoint(0,-1.87186,0.7735479);
    data_eta_gr->SetPointError(0,0.22814,0.22186,0.002680643,0.002668542);
    data_eta_gr->SetPoint(1,-1.417005,0.8211248);
    data_eta_gr->SetPointError(1,0.2329954,0.2170046,0.002186533,0.002173973);
    data_eta_gr->SetPoint(2,-1.046489,0.8036982);
    data_eta_gr->SetPointError(2,0.1535106,0.1464894,0.002517941,0.00250351);
    data_eta_gr->SetPoint(3,-0.6689632,0.8695973);
    data_eta_gr->SetPointError(3,0.2310368,0.2189632,0.001643221,0.001627639);
    data_eta_gr->SetPoint(4,-0.2243822,0.8774297);
    data_eta_gr->SetPointError(4,0.2256178,0.2243822,0.00155731,0.001557406);
    data_eta_gr->SetPoint(5,0.2231291,0.8779198);
    data_eta_gr->SetPointError(5,0.2231291,0.2268709,0.001562685,0.001552265);
    data_eta_gr->SetPoint(6,0.6695505,0.8712197);
    data_eta_gr->SetPointError(6,0.2195505,0.2304495,0.001652604,0.001638263);
    data_eta_gr->SetPoint(7,1.045993,0.7968811);
    data_eta_gr->SetPointError(7,0.1459928,0.1540072,0.002562149,0.002558131);
    data_eta_gr->SetPoint(8,1.416851,0.8102566);
    data_eta_gr->SetPointError(8,0.2168512,0.2331488,0.002223707,0.00220749);
    data_eta_gr->SetPoint(9,1.869563,0.7828316);
    data_eta_gr->SetPointError(9,0.219563,0.230437,0.002650316,0.002629268);

  }

  else {

    cout << "Scenario not supported, exiting." << endl;
    return 0;

  }

  const Int_t nBin = 10;
  Float_t etaEdges[nBin + 1] = {-2.1, -1.65, -1.2, -0.9, -0.45, 0., 0.45, 0.9, 1.2, 1.65, 2.1};

  TH1F *mc_eta_hist = new TH1F("eta_mc", "", nBin, etaEdges);
  mc_eta_hist->SetMarkerColor(kRed + 1);
  mc_eta_hist->SetLineColor(kRed);
  mc_eta_hist->SetLineWidth(2);
  mc_eta_hist->GetYaxis()->SetTitle("Efficiency");
  mc_eta_hist->GetYaxis()->SetTitleSize(30);
  mc_eta_hist->GetYaxis()->SetTitleFont(43);
  mc_eta_hist->GetYaxis()->SetTitleOffset(.8);
  mc_eta_hist->SetAxisRange(eff_ymin, eff_ymax, "y");

  TH1F *data_eta_hist = new TH1F("eta_data", "", nBin, etaEdges);
  data_eta_hist->SetMarkerColor(kBlue + 1);
  data_eta_hist->SetLineColor(kBlue);
  data_eta_hist->SetLineWidth(2);

  Float_t l1[nBin + 1] = {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.};
  TGraph *liner = new TGraph(nBin + 1, etaEdges, l1);
  liner->SetLineColor(kYellow + 1);
  liner->SetLineWidth(2);

  Double_t x_mc, y_mc, ye_mc, yer_mc, x_data, y_data, ye_data, yer_data;
  Double_t sum_sf = 0., dif_sf = 0., max_sf = 0., min_sf = 0.;

  for (Int_t i = 0; i < nBin; i++) {

    x_mc = 0.;
    y_mc = 0.;
    ye_mc = 0.;
    yer_mc = 0.;

    x_data = 0.;
    y_data = 0.;
    ye_data = 0.;
    yer_data = 0.;

    mc_eta_gr->GetPoint(i, x_mc, y_mc);
    ye_mc = mc_eta_gr->GetErrorY(i);
    if (y_mc != 0.) yer_mc = ye_mc / y_mc;
    mc_eta_hist->SetBinContent(i+1, y_mc);
    mc_eta_hist->SetBinError(i+1, ye_mc);

    data_eta_gr->GetPoint(i, x_data, y_data);
    ye_data = data_eta_gr->GetErrorY(i);
    if (y_data != 0.) yer_data = ye_data / y_data;
    data_eta_hist->SetBinContent(i+1, y_data);
    data_eta_hist->SetBinError(i+1, ye_data);

    sum_sf += (y_data / y_mc);
    //sume_sf += ((y_data / y_mc) * quadSum(yer_data, yer_mc)) * ((y_data / y_mc) * quadSum(yer_data, yer_mc));

    if (i == 0) {

      max_sf = (y_data / y_mc);
      min_sf = (y_data / y_mc);

    }

    else if (i != 0) {

      if ((y_data / y_mc) > max_sf) max_sf = (y_data / y_mc);
      if ((y_data / y_mc) < min_sf) min_sf = (y_data / y_mc);

    }

    cout<< "Bin "<< i + 1 << " scale factor: "<< y_data / y_mc << " +- " << (y_data / y_mc) * quadSum(yer_data, yer_mc) << endl;
    //cout<< "  Efficiencies mc: "<< y_mc << " +- " << ye_mc << " data " << y_data << " +- " << ye_data <<endl;

  }

  dif_sf = max_sf - min_sf;

  cout << "\nAverage scale factor: " << sum_sf / nBin << " +- " << dif_sf / (2 * sqrt(nBin)) << endl;

  TH1F *sf_eta_hist = (TH1F*) data_eta_hist->Clone("");
  sf_eta_hist->Divide(mc_eta_hist);
  sf_eta_hist->SetMarkerColor(kBlack);
  sf_eta_hist->SetLineColor(kBlack);
  sf_eta_hist->SetTitle("");
  sf_eta_hist->GetYaxis()->SetTitle("Data / MC");
  sf_eta_hist->GetYaxis()->SetNdivisions(505);
  sf_eta_hist->GetYaxis()->SetTitleSize(30);
  sf_eta_hist->GetYaxis()->SetTitleFont(43);
  sf_eta_hist->GetYaxis()->SetTitleOffset(.8);
  sf_eta_hist->GetYaxis()->SetLabelFont(43); // Absolute font size in pixel (precision 3)
  sf_eta_hist->GetYaxis()->SetLabelSize(20);
  sf_eta_hist->SetAxisRange(sf_ymin, sf_ymax, "y");

  sf_eta_hist->GetXaxis()->SetTitle("#eta");
  sf_eta_hist->GetXaxis()->SetTitleSize(30);
  sf_eta_hist->GetXaxis()->SetTitleFont(43);
  sf_eta_hist->GetXaxis()->SetTitleOffset(5.);
  sf_eta_hist->GetXaxis()->SetLabelFont(43); // Absolute font size in pixel (precision 3)
  sf_eta_hist->GetXaxis()->SetLabelSize(30);

  TCanvas *c1 = new TCanvas("c1","eta sf", 200, 10, 1600, 900);

  // Upper plot will be in pad1
  TPad *pad1 = new TPad("pad1", "pad1", 0, 0.3, 1, 1.0);
  pad1->SetBottomMargin(0); // Upper and lower plot are joined
  pad1->SetGridx();         // Vertical grid
  pad1->Draw();             // Draw the upper pad: pad1
  pad1->cd();               // pad1 becomes the current pad

  mc_eta_hist->Draw();
  data_eta_hist->Draw("same");

  // lower plot will be in pad
  c1->cd();          // Go back to the main canvas before defining pad2
  TPad *pad2 = new TPad("pad2", "pad2", 0, 0.05, 1, 0.3);
  pad2->SetTopMargin(0);
  pad2->SetBottomMargin(0.2);
  pad2->SetGridx(); // vertical grid
  pad2->Draw();
  pad2->cd();       // pad2 becomes the current pad);

  sf_eta_hist->Draw();
  liner->Draw("lsame");
  sf_eta_hist->Draw("same");

  c1->cd();
  //c1->SaveAs(("/home/ieeya/Downloads/t_schan/Part1_TagProbe/img/isomu17/sf_eta_" + scenario + ".png").c_str());
  c1->Close();

  return 0;

}
Example #18
0
// -----------------------------------------------------------------------------
//
void test() {

  time_t start = TTimeStamp().GetSec();

  set_plot_style();

  bool draw = true;
  //bool debug = true;

  // Define analysis configuration
  PSet ps;
  defaultPSet(ps);

  // Response plots
  if (false) {
    //xSectDistr(ps);
    responseProfile();
    return;
  }
  
  // Print configuration
  std::stringstream ss;
  printPSet(ps,ss);
  std::cout << ss.str() << std::endl;
  
  // Params to store
  DoubleVV ratio, ratio_errh, ratio_errl, pass, pass_err, fail, fail_err;
  IntV length;
  clear( ratio, ratio_errh, ratio_errl, pass, pass_err, fail, fail_err, length );
  init( ps, ratio, ratio_errh, ratio_errl, pass, pass_err, fail, fail_err, length );
  
  // Loop through Meff bins 
  int loop = 0;
  int nloops = ps.nmeff;
  for ( int imeff = 0; imeff < ps.nmeff; ++imeff ) {

    // Generate numbers in (x1,x2) plane
    DoubleVV dalitz;
    generateTruth( ps, imeff, dalitz, true );

    // Integrate across dalitz plane
    integrate( ps, imeff, dalitz, ratio, ratio_errh, ratio_errl, 
	       pass, pass_err, fail, fail_err, length );
    
    // Labeling
    std::stringstream ss;
    ss << "Meff" << int( ps.meff_bins[imeff] );
    
    // New canvas for plots
    TCanvas* c1 = 0;
    if (draw) c1 = new TCanvas( TString("Canvas"+ss.str()), "" );
    
    // Pad for cross-section plot
    TPad* pad = 0;
    if (draw) pad = new TPad(TString("Pad"+ss.str()),"",0.,0.,1.,1.);
    if (pad) {
      pad->SetGrid();
      pad->Draw();
      pad->cd();
      pad->SetLogz();
    }
    TH1F* hr = 0;
    if (draw) hr = pad->DrawFrame(ps.min,ps.min,ps.max,ps.max);
    
    // Histo title
    if (hr) {
      std::stringstream sss;
      sss << "M_{eff}=" << ps.meff_bins[imeff] << " GeV"
	  << ", p_{T1}=" << dr(ps.pt1_bins[imeff],1) << " GeV"
	  << ", p_{T2}=" << dr(ps.pt2_bins[imeff],1) << " GeV"
	  << ", p_{T3}=" << dr(ps.pt3_bins[imeff],1) << " GeV";
      hr->SetTitle( sss.str().c_str() );
      hr->GetXaxis()->SetTitle( "x_{2}" );
      hr->GetYaxis()->SetTitle( "x_{1}" );
    }
    
    // Create 2D cross-section plot
    TH2D* his = 0;
    if (draw) his = new TH2D(TString("Histo"+ss.str()),"",
			     ps.nbins,ps.min,ps.max,
			     ps.nbins,ps.min,ps.max);
    
    //double x3 = ( 2. * ps.pt3_bins[imeff] ) / ( ps.meff_bins[imeff] + ps.pt3_bins[imeff] );
    
    // Fill 2D cross-section plot
    for ( int x2_bin = 0; x2_bin < ps.nbins; ++x2_bin ) { 
      for ( int x1_bin = 0; x1_bin < ps.nbins; ++x1_bin ) { 
// 	std::cout << " Fill:"
// 		  << " x2_bin: " << x2_bin 
// 		  << " x2: " << val(x2_bin,nbins) 
// 		  << " x1_bin: " << x1_bin 
// 		  << " x1: " << val(x1_bin,nbins) 
// 		  << " val: " << dalitz[x2_bin][x1_bin]
// 		  << std::endl;
	if (his) his->Fill( val(x2_bin,ps)+ps.width/2.,
			    val(x1_bin,ps)+ps.width/2.,
			    dalitz[x2_bin][x1_bin] ); 
      }
    }
    
    // Draw 2D cross-section plot
    gStyle->SetPalette(1);
    if (his) {
      //his->SetMaximum( his->GetMaximum()*10. );
      //his->SetMinimum( his->GetMinimum(1.e-12)*0.1 );
//       his->SetMaximum( 1.e9 );
//       his->SetMinimum( 1.e0 );
      his->Draw("COLZsame");
    }
    
    // Pad for AlphaT contours
    if (c1) c1->cd();
    TPad* overlay = 0;
    if (draw) overlay = new TPad(TString("Overlay"+ss.str()),"",0.,0.,1.,1.);
    if (overlay) {
      overlay->SetFillStyle(4000);
      overlay->SetFillColor(0);
      overlay->SetFrameFillStyle(4000);
      overlay->Draw();
      overlay->cd();
    }
    //TH1F* hframe = 0;
    if (draw) overlay->DrawFrame(pad->GetUxmin(),
				 pad->GetUymin(),
				 pad->GetUxmax(),
				 pad->GetUymax());
	  
    // Graphs of AlphaT contours
    TMultiGraph* mg = 0;
    if (draw) {
      mg = new TMultiGraph();
      for ( Int_t icut = 0; icut < (int)ps.cutValues.size(); icut++ ) {
	Double_t alpha_t = ps.cutValues[icut];
	const Int_t n = ps.nbins;
	DoubleV x1(n,0.);
	DoubleV x2(n,0.);
	for ( Int_t x2_bin = 0; x2_bin < ps.nbins; x2_bin++ ) {
	  x2[x2_bin] = x2_bin * ps.width;
	  x1[x2_bin] = cutAlgoInverse(ps.cutValues[icut],x2[x2_bin],ALGO_TYPE);
	}
	TGraph* gr = new TGraph(n,&x2.front(),&x1.front());
	mg->Add(gr,"l");
      }
      mg->Draw();
    }
	  
    if (c1) c1->cd();
    if (c1) c1->SaveAs(TString(ss.str()+".png"));
    if (c1) c1->SaveAs(TString(ss.str()+".pdf"));
    if (c1) c1->SaveAs(TString(ss.str()+".C"));

  }

  // Canvas for ratio vs Meff
  if (false) {
    
    TCanvas* c2 = new TCanvas( "c2", "" );
    c2->SetRightMargin(0.2);
    c2->SetLogy();
    c2->cd();
    TMultiGraph* mg2 = new TMultiGraph();

    DoubleV err( ps.nmeff, 0. );
    for ( Int_t icut = 0; icut < (int)ps.cutValues.size(); icut++ ) {
      if ( length[icut] == 0 ) { continue; }
//       TGraphAsymmErrors* gr = new TGraphAsymmErrors( length[icut], 
//  						     &ps.meff_bins.front(), 
//  						     &err.front(),
//  						     &err.front(),
//  						     &ratio[icut].front(),
//  						     &ratio_errl[icut].front(),
//  						     &ratio_errh[icut].front() );
      TGraph* gr = new TGraphAsymmErrors( length[icut], 
 					  &ps.meff_bins.front(), 
 					  &ratio[icut].front() );
      std::stringstream ss;
      ss << "a_{T}=" << ps.cutValues[icut];
// 	 << " Meff=" << meff_bins[imeff]
// 	 << ", p_{T3}=" << pt3_bins[imeff];
      mg2->Add(gr,"lp");
      gr->SetTitle(TString(ss.str()));
      gr->SetLineColor(2+icut);
      gr->SetLineWidth(2);
      gr->SetMarkerStyle(20+icut);
      gr->SetMarkerColor(2+icut);
      gr->SetMarkerSize(1.5);
    }
    
    mg2->Draw("a");
    mg2->GetYaxis()->SetRangeUser(1.e-6,1.e0);
    c2->Update();
    c2->BuildLegend(0.81,0.1,0.99,0.9);
    
    // Save canvases
    c2->cd();
    c2->SaveAs("RatioVsMeff.png");
    c2->SaveAs("RatioVsMeff.pdf");
    c2->SaveAs("RatioVsMeff.C");
    
  }
  
  time_t stop = TTimeStamp().GetSec();
  std::cout << " Time taken: " << stop - start <<  " seconds" << std::endl;

}
void rsLimit7TeV(){

  setTDRStyle();

//=========Macro generated from canvas: cLimit/Limit
//=========  (Mon Feb 22 22:44:48 2010) by ROOT version5.18/00a
//   TCanvas *cLimit = new TCanvas("cLimit", "Limit",450,40,800,550);
//  TCanvas *cLimit = new TCanvas("cLimit", "Limit",100,122,600,600);
  cLimit = new TCanvas("cLimit","cLimit",800,600);

   gStyle->SetOptStat(0);
   //   cLimit->Range(595.5973,-0.03483694,1345.283,0.2539571);
   cLimit->SetFillColor(0);
   cLimit->SetBorderMode(0);
   cLimit->SetBorderSize(2);
   cLimit->SetLeftMargin(0.139262);
   cLimit->SetRightMargin(0.0604027);
   cLimit->SetTopMargin(0.0804196);
   cLimit->SetBottomMargin(0.120629);
   cLimit->SetFrameBorderMode(0);
   cLimit->SetFrameBorderMode(0);
   
   TGraph *graph = new TGraph(11);
   graph->SetName("Graph");
   graph->SetTitle("");
   graph->SetFillColor(1);


   Int_t ci;   // for color index setting
   ci = TColor::GetColor("#ff0000");
   graph->SetLineColor(ci);
   graph->SetLineWidth(3);

   ci = TColor::GetColor("#ff0000");
   graph->SetMarkerColor(ci);
   graph->SetMarkerStyle(20);
   graph->SetMarkerSize(1.0);
   graph->SetPoint(0,  863,0.01);
   graph->SetPoint(1, 1132,0.02);
   graph->SetPoint(2, 1274,0.03);
   graph->SetPoint(3, 1395,0.04);
   graph->SetPoint(4, 1503,0.05);
   graph->SetPoint(5, 1597,0.06);
   graph->SetPoint(6, 1676,0.07);
   graph->SetPoint(7, 1742,0.08);
   graph->SetPoint(8, 1801,0.09);
   graph->SetPoint(9, 1844,0.1);
   graph->SetPoint(10,1881,0.11);
   
   cout << " Don't forget to change this..." << endl;
   TH1 *Graph6 = new TH1F("Graph6","",100,863,1881);
   Graph6->SetMinimum(0);
   Graph6->SetMaximum(0.12);
   Graph6->SetDirectory(0);
   Graph6->SetStats(0);
   Graph6->GetXaxis()->SetTitle("M_{1} [GeV]");
   Graph6->GetYaxis()->SetTitle("Coupling k/#bar{M}_{Pl}");
   Graph6->GetXaxis()->SetLabelFont(42);
   Graph6->GetYaxis()->SetLabelFont(42);
   Graph6->GetYaxis()->SetTitleOffset(1.8);
   graph->SetHistogram(Graph6);
   
   graph->GetYaxis()->SetTitleOffset(1.19);
   graph->Draw("al");


   TGraph* graph2 = new TGraph(11);
   graph2->SetMarkerColor(ci);
   graph2->SetMarkerStyle(20);
   graph2->SetMarkerSize(0.0);
   graph2->SetPoint(0,  845,0.01);
   graph2->SetPoint(1, 1133,0.02);
   graph2->SetPoint(2, 1275,0.03);
   graph2->SetPoint(3, 1396,0.04);
   graph2->SetPoint(4, 1504,0.05);
   graph2->SetPoint(5, 1598,0.06);
   graph2->SetPoint(6, 1677,0.07);
   graph2->SetPoint(7, 1743,0.08);
   graph2->SetPoint(8, 1801,0.09);
   graph2->SetPoint(9, 1844,0.1);
   graph2->SetPoint(10,1881,0.11);
   graph2->SetLineStyle(kDashed);
   graph2->SetLineColor(ci);
   graph2->SetLineWidth(3);
   graph2->GetXaxis()->SetLabelFont(42);
   graph2->GetYaxis()->SetLabelFont(42);
   graph2->Draw("plsame");


//    graph = new TGraph(3);
//    graph->SetName("Graph");
//    graph->SetTitle("");
//    graph->SetFillColor(1);

//    ci = TColor::GetColor("#0000ff");
//    graph->SetLineColor(ci);
//    graph->SetLineWidth(3);

//    ci = TColor::GetColor("#0000ff");
//    graph->SetMarkerColor(ci);
//    graph->SetMarkerStyle(22);
//    graph->SetMarkerSize(1.4);
//    graph->SetPoint(0,750,0.03355478);
//    graph->SetPoint(1,1000,0.07617687);
//    graph->SetPoint(2,1250,0.1542326);
   
//    TH1 *Graph7 = new TH1F("Graph7","",100,700,1300);
//    Graph7->SetMinimum(0.021487);
//    Graph7->SetMaximum(0.1663004);
//    Graph7->SetDirectory(0);
//    Graph7->SetStats(0);
//    Graph7->GetXaxis()->SetTitle("Graviton Mass (GeV)");
//    Graph7->GetYaxis()->SetTitle("Coupling k/#bar{M}_{Pl}");
//    graph->SetHistogram(Graph7);
   
//    graph->Draw("pc");
   
//    graph = new TGraph(3);
//    graph->SetName("Graph");
//    graph->SetTitle("");
//    graph->SetFillColor(1);

//    ci = TColor::GetColor("#00ff00");
//    graph->SetLineColor(ci);
//    graph->SetLineWidth(3);

//    ci = TColor::GetColor("#00ff00");
//    graph->SetMarkerColor(ci);
//    graph->SetMarkerStyle(21);
//    graph->SetMarkerSize(1.3);
//    graph->SetPoint(0,750,0.02431275);
//    graph->SetPoint(1,1000,0.05519538);
//    graph->SetPoint(2,1250,0.1117521);
   
//    TH1 *Graph8 = new TH1F("Graph8","",100,700,1300);
//    Graph8->SetMinimum(0.01556881);
//    Graph8->SetMaximum(0.1204961);
//    Graph8->SetDirectory(0);
//    Graph8->SetStats(0);
//    Graph8->GetXaxis()->SetTitle("Graviton Mass (GeV/c^{2})");
//    Graph8->GetYaxis()->SetTitle("Coupling k/#bar{M}_{Pl}");
//    graph->SetHistogram(Graph8);
   
//    graph->Draw("pc");
   
//    TF1 *LambdaPi = new TF1("LambdaPi","pol1",500,2500);
//    LambdaPi->SetFillColor(15);
//    LambdaPi->SetFillStyle(3004);
//    LambdaPi->SetLineColor(15);
//    LambdaPi->SetLineWidth(1);
//    LambdaPi->SetParameter(0,0);
//    LambdaPi->SetParError(0,0);
//    LambdaPi->SetParLimits(0,0,0);
//    LambdaPi->SetParameter(1,2.61097e-05);
//    LambdaPi->SetParError(1,0);
//    LambdaPi->SetParLimits(1,0,0);
//    LambdaPi->Draw("same");
// 
    TF1 *LambdaPi = new TF1("LambdaPi","pol1",250,2500);
    LambdaPi->SetFillColor(15);
    LambdaPi->SetFillStyle(3004);
    LambdaPi->SetLineColor(15);
    LambdaPi->SetLineWidth(1);
    LambdaPi->SetParameter(0,0);
    LambdaPi->SetParError(0,0);
    LambdaPi->SetParLimits(0,0,0);
    LambdaPi->SetParameter(1,2.61097e-05);
    LambdaPi->SetParError(1,0);
    LambdaPi->SetParLimits(1,0,0);
    LambdaPi->GetXaxis()->SetLabelFont(42);
    LambdaPi->GetYaxis()->SetLabelFont(42);
    LambdaPi->Draw("same");
   
    graph = new TGraph(27);
    graph->SetName("Graph");
    graph->SetTitle("Graph");
    graph->SetFillColor(1);
    graph->SetFillStyle(3004);    
    graph->SetLineStyle(5);
    graph->SetLineWidth(3);
    graph->SetPoint(0,180,0.1071);
    graph->SetPoint(1,183,0.1062);
    graph->SetPoint(2,190,0.1043);
    graph->SetPoint(3,200,0.1016);
    graph->SetPoint(4,210,0.0989);
    graph->SetPoint(5,220,0.0963);
    graph->SetPoint(6,230,0.0938);
    graph->SetPoint(7,240,0.0913);
    graph->SetPoint(8,250,0.0889);
    graph->SetPoint(9,260,0.0866);
    graph->SetPoint(10,270,0.0843);
    graph->SetPoint(11,280,0.0821);
    graph->SetPoint(12,290,0.0799);
    graph->SetPoint(13,300,0.0778);
    graph->SetPoint(14,400,0.0603);
    graph->SetPoint(15,500,0.0481);
    graph->SetPoint(16,600,0.0397);
    graph->SetPoint(17,700,0.0337);
    graph->SetPoint(18,800,0.0292);
    graph->SetPoint(19,900,0.0258);
    graph->SetPoint(20,1000,0.0231);
    graph->SetPoint(21,1100,0.0209);
    graph->SetPoint(22,1200,0.0191);
    graph->SetPoint(23,1300,0.0176);
    graph->SetPoint(24,1400,0.0163);
    graph->SetPoint(25,1500,0.0152);
    graph->SetPoint(26,2200,0.01);
    graph->GetXaxis()->SetLabelFont(42);
    graph->GetYaxis()->SetLabelFont(42);
    graph->SetFillColor(kBlack);
    graph->SetFillStyle(3004);
    graph->SetLineWidth(1);
    graph->SetFillStyle(3002);
    graph->SetFillColor(kBlack);
    graph->SetLineWidth(-10000);

    graph->Draw("c");
    //    graph->Draw("same");

//    TPaveText *pt = new TPaveText(0.194631,0.748252,0.436242,0.816434,"blNDC");
//    pt->SetName("95% CL Limit");
//    pt->SetFillColor(0);
//    pt->SetBorderSize(1);
//    pt->SetLineColor(0);
//    pt->SetTextSize(0.04);
//    TText *text = pt->AddText("95% CL Limit");
//    pt->Draw();
  
   TLegend *leg = new TLegend(0.2072864,0.4667832,0.4007538,0.7517483,NULL,"brNDC");
   //    TLegend *leg = new TLegend(0.2072864,0.5332168,0.4007538,0.7517483,NULL,"brNDC"); 
    //   TLegend *leg = new TLegend(0.2110553,0.4248252,0.4120603,0.6433566,NULL,"brNDC");
   //   TLegend *leg = new TLegend(0.2181208,0.5297203,0.4194631,0.7482517,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.05);
   leg->SetLineColor(0);
   leg->SetLineStyle(0);
   leg->SetLineWidth(0);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   //   TLegendEntry *entry=leg->AddEntry("graph","50/pb","pl");

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

    entry=leg->AddEntry("graph","Electroweak Limits","lf");
    entry->SetLineColor(1);
    entry->SetLineStyle(5);
    entry->SetLineWidth(3);
    entry->SetMarkerColor(1);
    entry->SetMarkerStyle(21);
    entry->SetMarkerSize(1);

    ci = TColor::GetColor("#ff0000");
    entry->SetMarkerColor(ci);
    entry->SetMarkerStyle(20);
    entry->SetMarkerSize(1.3);
    entry=leg->AddEntry("Graph","95% CL Limit","l");


    leg->AddEntry(graph2,"Expected Limit","l");
    ci = TColor::GetColor("#00ff00");
    entry->SetMarkerColor(ci);
    entry->SetMarkerStyle(21);
    entry->SetMarkerSize(1.3);
    //    entry=leg->AddEntry("LambdaPi","#Lambda_{#pi}> 10TeV","lf");
    entry=leg->AddEntry("LambdaPi","M_{D} > 10TeV","lf");

//     entry->SetFillColor(15);
//     entry->SetFillStyle(3004);
//     entry->SetLineColor(15);
//     entry->SetLineStyle(1);
//     entry->SetLineWidth(1);
//     entry->SetMarkerColor(1);
//     entry->SetMarkerStyle(1);
//     entry->SetMarkerSize(1);

    leg->Draw();
   
   TPaveText *pt = new TPaveText(0.2236181,0.7884615,0.4736181,0.8583916,"blNDC");
   //   TPaveText *pt = new TPaveText(0.1959799,0.7954545,0.4459799,0.8653846,"blNDC");
   //   TPaveText *pt = new TPaveText(0.2130872,0.8339161,0.4630872,0.9038462,"blNDC");
   pt->SetName("CMS Preliminary");
   pt->SetBorderSize(1);
   pt->SetLineColor(0);
   pt->SetFillColor(0);
   //   pt->SetTextFont(72);
   pt->SetTextSize(0.06);
   text = pt->AddText("CMS Preliminary");
   pt->Draw();
   
   pt = new TPaveText(0.629397,0.798951,0.8002513,0.8653846,"blNDC");
   //   pt = new TPaveText(0.6005025,0.8059441,0.7713568,0.8723776,"blNDC");
   //   pt = new TPaveText(0.2738693,0.7027972,0.4447236,0.7692308,"blNDC");
   //   pt = new TPaveText(0.2416107,0.7727273,0.4127517,0.8391608,"blNDC");
   pt->SetFillColor(0);
   pt->SetBorderSize(1);
   pt->SetLineColor(0);
   pt->SetTextSize(0.06);
   text = pt->AddText("2.2 fb^{-1} at 7 TeV");
   pt->Draw();

   //   pt = new TPaveText(0.6879195,0.8129371,0.7885906,0.9108392,"blNDC");
   //   pt->SetFillColor(0);
   //   pt->SetBorderSize(1);
   //   pt->SetLineColor(0);
   //   pt->SetTextSize(0.0454545);
   //   text = pt->AddText("L = 1091 pb^{-1}");
   //  pt->Draw();


   cLimit->Modified();
   cLimit->cd();
   cLimit->SetSelected(cLimit);
}
Example #20
0
void Ratio()
{
  gStyle->SetOptStat(0);
  gStyle->SetOptTitle(0);

  double baseline[6]={0.496651, 0.491322, 0.554113, 1.62655-0.03, 1.62818, 1.6321+0.03};
  //double baseline[6]={0.571804, 0.567082, 0.592606, 1.63217-0.03, 1.63368, 1.63768+0.03};
  double be[6]={0,0,0,0,0,0};
  double ratio[6]={0.9834, 0.9849, 0.9864, 0.9282, 0.9086, 0.9571};
  //0.9834_0.0069 & 0.9849_0.0069 & 0.9864_0.0073 & 0.9282_0.0160 & 0.9086_0.0161 & 0.9571_0.0166
  double ratioe[6]={0.0069, 0.0069, 0.0073, 0.0160, 0.0161, 0.0166};
  
  double t13 =  8.78022e-02;
  double t13e = 1.63739e-02;
  double chi2 = 4.54385;

  double x[6],y[4];
  x[0] = 0;
  x[1] = t13 - 3.2*t13e;
  x[2] = t13 - t13e;
  x[3] = t13 + t13e;
  x[4] = t13 + 3.1*t13e;
  x[5] = t13 + 5.2*t13e;
  y[0] = 0;
  y[1] = chi2+1;
  y[2] = chi2+9;
  y[3] = chi2+25;
  
  TGraphErrors *ratiog = new TGraphErrors(6,baseline, ratio, be, ratioe);
  TCanvas* c = new TCanvas("c1","multipads",600,500);
  c->SetLeftMargin(0.15);
  ratiog->GetYaxis()->SetRangeUser(0.88,1.15);
  ratiog->GetXaxis()->SetLimits(0.0,2.0);
  ratiog->SetMarkerStyle(25);
  ratiog->SetLineColor(4);
  ratiog->SetLineWidth(2);
  ratiog->GetYaxis()->SetTitle("Measured/Prediction");
  ratiog->GetYaxis()->SetTitleOffset(1.5);
  ratiog->GetXaxis()->SetTitle("Weighted baseline [km]");

  ratiog->Draw("AP");

  TLine line;
  line.SetLineStyle(2);
  line.DrawLine(0,1,2,1);

  // Make the red curve
  TFile f("result.root");
  TH1D * Truth_16 = (TH1D*)f.Get("Truth_13");
  int nbins = Truth_16->GetNbinsX();
  double emin = Truth_16->GetXaxis()->GetXmin();
  double emax = Truth_16->GetXaxis()->GetXmax();
  double eng[nbins];
  double num[nbins];
  for( int b=1; b<=nbins; b++ ) {
    eng[b-1] = emin + (emax-emin)/nbins * (b-0.5);
    num[b-1] = Truth_16->GetBinContent(b);
    //cout<<b<<" "<<eng[b-1]<<" "<<num[b-1]<<endl;
  }

  TGraph* Disp;
  int npt = 30;
  double dist[30];
  double lost[30];

  for( int dc=0; dc<npt; dc++ ) {
    dist[ dc ] = 2.0/(npt-1) * dc;
    // Calculate the survival probability
    double noos=0;
    double osci=0;
    for(int idx=15; idx<nbins; idx++) {
      //cout<<eng[idx]<<endl;
      noos += num[idx];
      osci += num[idx] * SurvProb(t13, dist[dc]*1000, eng[idx]+0.792);
    }
    lost[ dc ] = osci/noos;
  }
  Disp = new TGraph(npt, dist, lost);
  Disp->SetLineColor(kRed);
  Disp->SetLineWidth(2);
  Disp->Draw("lsame");

  {
    TPad* pad = new TPad("name","Title",0.35, 0.47, 0.96, 0.95);
    pad->Draw();
    pad->cd();
    pad->SetLeftMargin(0.15);
    pad->SetBottomMargin(0.15);

    TGraph* Graph;
    const int n = 20;    
    double S13[n] = {0.000000, 0.009250, 0.018500, 0.027750, 0.037000, 0.046250, 0.055500, 0.064750, 0.074000, 0.083250, 0.092500, 0.101750, 0.111000, 0.120250, 0.129500, 0.138750, 0.148000, 0.157250, 0.166500, 0.175750};
    double Chi[n] = {28.838118, 24.120320, 19.884366, 16.140633, 12.899639, 10.172040, 7.968632, 6.300351, 5.178271, 4.613608, 4.617718, 5.202101, 6.378396, 8.158386, 10.553995, 13.577293, 17.240488, 21.555937, 26.536136, 32.193726};
    Graph = new TGraph(n, S13, Chi);

    Graph->GetYaxis()->SetRangeUser(0.0, 34.0);
    Graph->GetYaxis()->SetTitle("#chi^{2}");    
    //Graph->GetYaxis()->SetTitleOffset(1.5);
    Graph->GetYaxis()->SetLabelSize(0.07);
    Graph->GetYaxis()->SetTitleSize(0.07);
    Graph->GetYaxis()->SetTitleOffset(0.9);
    Graph->GetYaxis()->CenterTitle();

    Graph->GetXaxis()->SetTitle("sin^{2}(2#theta_{13})");
    //Graph->GetXaxis()->SetTitleOffset(1.5);
    Graph->GetXaxis()->SetLabelSize(0.07);
    Graph->GetXaxis()->SetTitleSize(0.07);
    Graph->GetXaxis()->SetLimits(0,0.18);
    Graph->GetXaxis()->SetNdivisions(4,5,0);
    Graph->GetXaxis()->SetTitleOffset(0.9);
    Graph->GetXaxis()->CenterTitle();

    Graph->SetLineWidth(2);
    Graph->Draw("alp");

    TLatex text;
    text.SetTextSize(0.08);
    text.SetTextAlign(11);

    TLine line;
    line.SetLineStyle(2);
    line.DrawLine(x[0],y[0],x[0],y[3]);
    line.DrawLine(x[0],y[3],x[5],y[3]);
    line.DrawLine(x[5],y[3],x[5],y[0]);
    text.DrawLatex( t13-0.4*t13e, y[3], "5#sigma" );

    line.DrawLine(x[1],y[0],x[1],y[2]);
    line.DrawLine(x[1],y[2],x[4],y[2]);
    line.DrawLine(x[4],y[2],x[4],y[0]);
    text.DrawLatex( t13-0.4*t13e, y[2], "3#sigma" );

    line.DrawLine(x[2],y[0],x[2],y[1]);
    line.DrawLine(x[2],y[1],x[3],y[1]);
    line.DrawLine(x[3],y[1],x[3],y[0]);
    text.DrawLatex( t13-0.4*t13e, y[1], "1#sigma" );
  }

}
void showGraph(TGraph* graph, 
	       const std::string& xAxisTitle,
	       Float_t* genX, 
	       double yMin, double yMax, const std::string& yAxisTitle,
	       const std::string& outputFileName)
{
  TCanvas* canvas = new TCanvas("canvas", "canvas", 800, 600);
  canvas->SetFillColor(10);
  canvas->SetBorderSize(2);

  canvas->SetTopMargin(0.10);
  canvas->SetLeftMargin(0.16);
  canvas->SetRightMargin(0.14);
  canvas->SetBottomMargin(0.12);

  int numPoints = graph->GetN();
  double xMin, xMax, yDummy;
  graph->GetPoint(0, xMin, yDummy);
  graph->GetPoint(numPoints - 1, xMax, yDummy);

  TH1* dummyHistogram = new TH1D("dummyHistogram", "dummyHistogram", numPoints/100, xMin, xMax);
  dummyHistogram->SetStats(false);
  dummyHistogram->SetMinimum(yMin);
  dummyHistogram->SetMaximum(yMax);

  TAxis* xAxis = dummyHistogram->GetXaxis();
  xAxis->SetTitle(xAxisTitle.data());
  xAxis->SetTitleOffset(1.15);

  TAxis* yAxis = dummyHistogram->GetYaxis();
  yAxis->SetTitle(yAxisTitle.data());
  yAxis->SetTitleOffset(1.15);

  dummyHistogram->Draw("axis");

  TGraph* genMarker = 0;
  if ( genX ) {
    genMarker = new TGraph(2);
    genMarker->SetPoint(0, xMin, *genX);
    genMarker->SetPoint(1, xMax, *genX);
    genMarker->SetLineColor(8);
    genMarker->SetLineWidth(1);
    genMarker->SetMarkerColor(8);
    genMarker->SetMarkerStyle(20);
    genMarker->SetMarkerSize(1);
    genMarker->Draw("L");
  }

  graph->SetLineColor(1);
  graph->SetLineWidth(2);
  graph->SetMarkerColor(1);
  graph->SetMarkerStyle(20);
  graph->SetMarkerSize(1);
  graph->Draw("L");

  canvas->Update();
  size_t idx = outputFileName.find_last_of('.');
  std::string outputFileName_plot = std::string(outputFileName, 0, idx);
  if ( idx != std::string::npos ) canvas->Print(std::string(outputFileName_plot).append(std::string(outputFileName, idx)).data());
  canvas->Print(std::string(outputFileName_plot).append(".png").data());
  canvas->Print(std::string(outputFileName_plot).append(".pdf").data());
  canvas->Print(std::string(outputFileName_plot).append(".root").data());

  delete dummyHistogram;
  delete genMarker;
  delete canvas;  
}
Example #22
0
void plotLimit(int signal = 0){
//signal: 0 = ZPN, 1 = ZPW, 2 = ZPXW, 3 = RSG  

setTDRStyle();

//gROOT->SetStyle("Plain");
gStyle->SetOptStat(0000000000); //this clears all the boxes and crap
gStyle->SetLegendBorderSize(1);

TGraph * limit_obs = new TGraph(3);
TGraph * limit_exp = new TGraph(3);
TGraphAsymmErrors * band_exp1 = new TGraphAsymmErrors();
TGraphAsymmErrors * band_exp2 = new TGraphAsymmErrors();

TGraph * limit_obs_2 = new TGraph(3);
TGraph * limit_exp_2 = new TGraph(3);
TGraphAsymmErrors * band_exp1_2 = new TGraphAsymmErrors();
TGraphAsymmErrors * band_exp2_2 = new TGraphAsymmErrors();
TGraph * limit_obs_3 = new TGraph(3);
TGraph * limit_exp_3 = new TGraph(3);
TGraphAsymmErrors * band_exp1_3 = new TGraphAsymmErrors();
TGraphAsymmErrors * band_exp2_3 = new TGraphAsymmErrors();
TGraph * limit_obs_4 = new TGraph(3);
TGraph * limit_exp_4 = new TGraph(3);
TGraphAsymmErrors * band_exp1_4 = new TGraphAsymmErrors();
TGraphAsymmErrors * band_exp2_4 = new TGraphAsymmErrors();
TGraph *theory = new TGraph(3);
TGraph *theory2 = new TGraph(3);
TGraph *theory3 = new TGraph(3);
TGraph *theory4 = new TGraph(3);

   theory->SetPoint(0,  0.01, 4.24671);

   theory->SetPoint(1,  0.1, 42.24246);

   theory->SetPoint(2,  0.3, 122.17487);
   theory2->SetPoint(0,  0.01, 0.17980);
   theory2->SetPoint(1,  0.1, 2.00723);
   theory2->SetPoint(2,  0.3, 6.99950);
   theory3->SetPoint(0, 0.01, 0.01659*0.1);
   theory3->SetPoint(1,  0.1, 0.23030*0.1);
   theory3->SetPoint(2,  0.3, 1.03387*0.1);
   theory4->SetPoint(0, 0.01, 0.00203*0.01);
   theory4->SetPoint(1, 0.1, 0.04254*0.01);
   theory4->SetPoint(2, 0.3, 0.25352*0.01); 

 string filename = "Limits/comb_width_1TeV.txt";
 if (signal == 1) filename= "Limits/comb_width_2TeV.txt";
 if (signal == 2) filename= "Limits/comb_width_3TeV.txt";
 if (signal == 3) filename= "Limits/comb_width_4TeV.txt";

ifstream infile(filename);

double mass, exp, obs, up1, up2, dn1, dn2;
int point = 0;

while (!infile.eof()){

  //infile >> mass >> exp >>  dn2 >> up2 >> dn1 >> up1;
  //obs = exp;	

  infile >> mass >> obs >> exp >>  dn2 >> up2 >> dn1 >> up1;

 
  double sf = 1.0;
  cout.precision(3);
  //cout << mass << " & " << obs << " & " << exp << " & " << "["<<dn1<<", "<<up1<<"] & ["<<dn2<<", "<<up2<<"] \\" << endl;
  cout << mass << " & \\textbf{" << obs*sf << "} & " << dn2*sf << " & " << dn1*sf << " & \\textbf{" << exp*sf << "} & " << up1*sf << " & " << up2*sf <<  " \\\\" << endl;


  //if (mass == 2500) sf = 0.01;
  //if (mass == 3000) sf = 0.001;
  //if (mass == 3500) sf = 0.0001;
  //if (mass == 4000) sf = 0.0001;


  limit_obs->SetPoint(point, mass, obs*sf);
  limit_exp->SetPoint(point, mass, exp*sf);
  band_exp1->SetPoint(point, mass, exp*sf);
  band_exp2->SetPoint(point, mass, exp*sf);
  
  band_exp1->SetPointEYhigh(point, up1*sf - exp*sf);
  band_exp1->SetPointEYlow(point, exp*sf - dn1*sf);
  band_exp2->SetPointEYhigh(point, up2*sf - exp*sf);
  band_exp2->SetPointEYlow(point, exp*sf - dn2*sf);
  point++;

}

ifstream infile2 ("Limits/comb_width_2TeV.txt");
point = 0;
while (!infile2.eof()){

  //infile >> mass >> exp >>  dn2 >> up2 >> dn1 >> up1;
  //obs = exp;	

  infile2 >> mass >> obs >> exp >>  dn2 >> up2 >> dn1 >> up1;

 
  double sf = 1.0;
  cout.precision(3);
  //cout << mass << " & " << obs << " & " << exp << " & " << "["<<dn1<<", "<<up1<<"] & ["<<dn2<<", "<<up2<<"] \\" << endl;
  cout << mass << " & \\textbf{" << obs*sf << "} & " << dn2*sf << " & " << dn1*sf << " & \\textbf{" << exp*sf << "} & " << up1*sf << " & " << up2*sf <<  " \\\\" << endl;


  //if (mass == 2500) sf = 0.01;
  //if (mass == 3000) sf = 0.001;
  //if (mass == 3500) sf = 0.0001;
  //if (mass == 4000) sf = 0.0001;


  limit_obs_2->SetPoint(point, mass, obs*sf);
  limit_exp_2->SetPoint(point, mass, exp*sf);
  band_exp1_2->SetPoint(point, mass, exp*sf);
  band_exp2_2->SetPoint(point, mass, exp*sf);
  
  band_exp1_2->SetPointEYhigh(point, up1*sf - exp*sf);
  band_exp1_2->SetPointEYlow(point, exp*sf - dn1*sf);
  band_exp2_2->SetPointEYhigh(point, up2*sf - exp*sf);
  band_exp2_2->SetPointEYlow(point, exp*sf - dn2*sf);
  point++;

}

ifstream infile3 ("Limits/comb_width_3TeV.txt");
point = 0;

while (!infile3.eof()){

  //infile >> mass >> exp >>  dn2 >> up2 >> dn1 >> up1;
  //obs = exp;	

  infile3 >> mass >> obs >> exp >>  dn2 >> up2 >> dn1 >> up1;

 
  double sf = 0.1;
  cout.precision(3);
  //cout << mass << " & " << obs << " & " << exp << " & " << "["<<dn1<<", "<<up1<<"] & ["<<dn2<<", "<<up2<<"] \\" << endl;
  cout << mass << " & \\textbf{" << obs*sf << "} & " << dn2*sf << " & " << dn1*sf << " & \\textbf{" << exp*sf << "} & " << up1*sf << " & " << up2*sf <<  " \\\\" << endl;


  //if (mass == 2500) sf = 0.01;
  //if (mass == 3000) sf = 0.001;
  //if (mass == 3500) sf = 0.0001;
  //if (mass == 4000) sf = 0.0001;


  limit_obs_3->SetPoint(point, mass, obs*sf);
  limit_exp_3->SetPoint(point, mass, exp*sf);
  band_exp1_3->SetPoint(point, mass, exp*sf);
  band_exp2_3->SetPoint(point, mass, exp*sf);

  band_exp1_3->SetPointEYhigh(point, up1*sf - exp*sf);
  band_exp1_3->SetPointEYlow(point, exp*sf - dn1*sf);
  band_exp2_3->SetPointEYhigh(point, up2*sf - exp*sf);
  band_exp2_3->SetPointEYlow(point, exp*sf - dn2*sf);
  point++;

}

ifstream infile4 ("Limits/comb_width_4TeV.txt");
point = 0;

while (!infile4.eof()){

  //infile >> mass >> exp >>  dn2 >> up2 >> dn1 >> up1;
  //obs = exp;	

  infile4 >> mass >> obs >> exp >>  dn2 >> up2 >> dn1 >> up1;

 
  double sf = 0.01;
  cout.precision(3);
  //cout << mass << " & " << obs << " & " << exp << " & " << "["<<dn1<<", "<<up1<<"] & ["<<dn2<<", "<<up2<<"] \\" << endl;
  cout << mass << " & \\textbf{" << obs*sf << "} & " << dn2*sf << " & " << dn1*sf << " & \\textbf{" << exp*sf << "} & " << up1*sf << " & " << up2*sf <<  " \\\\" << endl;


  //if (mass == 2500) sf = 0.01;
  //if (mass == 3000) sf = 0.001;
  //if (mass == 3500) sf = 0.0001;
  //if (mass == 4000) sf = 0.0001;


  limit_obs_4->SetPoint(point, mass, obs*sf);
  limit_exp_4->SetPoint(point, mass, exp*sf);
  band_exp1_4->SetPoint(point, mass, exp*sf);
  band_exp2_4->SetPoint(point, mass, exp*sf);
  band_exp1_4->SetPointEYhigh(point, up1*sf - exp*sf);
  band_exp1_4->SetPointEYlow(point, exp*sf - dn1*sf);
  band_exp2_4->SetPointEYhigh(point, up2*sf - exp*sf);
  band_exp2_4->SetPointEYlow(point, exp*sf - dn2*sf);
  point++;

}





double max = 200000.0; //band_exp2->GetHistogram()->GetMaximum()*50;

  TCanvas *canvas = new TCanvas("limit set ZPN","limit set ZPN", 500,500);

  limit_exp->SetMinimum(0.00001);
  limit_exp->GetXaxis()->SetLabelSize(0.05);
  limit_exp->GetYaxis()->SetLabelSize(0.05);
  limit_exp->Draw("AL");
  if (signal == 0){
    limit_exp->GetXaxis()->SetTitle("#Gamma_{Z'} / M_{Z'}");
    limit_exp->GetYaxis()->SetTitle("95% CL Limit on #sigma_{Z'} #times B(Z'#rightarrowt#bar{t}) [pb]");
  }
  else if (signal == 1){
    limit_exp->GetXaxis()->SetTitle("M_{Z'} [GeV]");
    limit_exp->GetYaxis()->SetTitle("95% CL Limit on #sigma_{Z'} #times B(Z'#rightarrowt#bar{t}) [pb]");
  }
  else if (signal == 2){
    limit_exp->GetXaxis()->SetTitle("M_{Z'} [GeV]");
    limit_exp->GetYaxis()->SetTitle("95% CL Limit on #sigma_{Z'} #times B(Z'#rightarrowt#bar{t}) [pb]");
  }
  else if (signal == 3){
    limit_exp->GetXaxis()->SetTitle("M_{g_{KK}} [GeV]");
    limit_exp->GetYaxis()->SetTitle("95% CL Limit on #sigma_{g_{KK}} #times B(g_{KK}#rightarrowt#bar{t}) [pb]");
  }
  //limit_exp->GetYaxis()->SetTitleOffset(1.2);
  limit_exp->GetYaxis()->SetRangeUser(0.00001,2000);


  band_exp2->SetFillColor(5);
  band_exp2->SetLineColor(0);
  //band_exp2->SetFillStyle(4000);
  band_exp2->Draw("3same");

  band_exp1->SetFillColor(3);
  band_exp1->SetLineColor(0);
  //band_exp1->SetFillStyle(4000);
  band_exp1->Draw("3same");

  limit_obs->Draw("Lsame");
  limit_obs->SetLineWidth(2);
  limit_obs->SetMarkerSize(1.0);
  limit_obs->SetMarkerStyle(20);
   
  limit_exp->Draw("Lsame");
  limit_exp->SetLineStyle(2);
  limit_exp->SetLineWidth(2);
  limit_exp->SetMarkerSize(1.0);
  limit_exp->SetMaximum(max);
  limit_exp->SetMinimum(0.000001);
  limit_exp->SetMarkerStyle(20);
  

  band_exp2_2->SetFillColor(5);
  band_exp2_2->SetLineColor(0);
  band_exp1_2->SetFillColor(3);
  band_exp1_2->SetLineColor(0);
  band_exp2_3->SetFillColor(5);
  band_exp2_3->SetLineColor(0);
  band_exp1_3->SetFillColor(3);
  band_exp1_3->SetLineColor(0);
  band_exp2_4->SetFillColor(5);
  band_exp2_4->SetLineColor(0);
  band_exp1_4->SetFillColor(3);
  band_exp1_4->SetLineColor(0);
  band_exp2_2->Draw("3same");
  band_exp1_2->Draw("3same");
  limit_obs_2->Draw("Lsame");
  limit_obs_2->SetLineWidth(2);
  limit_obs_2->SetMarkerSize(1.0);
  limit_obs_2->SetMarkerStyle(20);
  band_exp2_3->Draw("3same");
  band_exp1_3->Draw("3same");
  limit_obs_3->Draw("Lsame");
  limit_obs_3->SetLineWidth(2);
  limit_obs_3->SetMarkerSize(1.0);
  limit_obs_3->SetMarkerStyle(20);
  band_exp2_4->Draw("3same");
  band_exp1_4->Draw("3same");
  limit_obs_4->Draw("Lsame");
  limit_obs_4->SetLineWidth(2);
  limit_obs_4->SetMarkerSize(1.0);
  limit_obs_4->SetMarkerStyle(20);

  limit_exp_2->Draw("L same");
  limit_exp_2->SetLineStyle(2);
  limit_exp_2->SetLineWidth(2);
  limit_exp_2->SetMarkerSize(1.0);
  limit_exp_3->Draw("L same");
  limit_exp_3->SetLineStyle(2);
  limit_exp_3->SetLineWidth(2);
  limit_exp_3->SetMarkerSize(1.0);
  limit_exp_4->Draw("L same");
  limit_exp_4->SetLineStyle(2);
  limit_exp_4->SetLineWidth(2);
  limit_exp_4->SetMarkerSize(1.0);








    canvas->RedrawAxis();

  double x1 = 595; 
  double y1 = 1.0;
  double x2 = 905;
  double y2 = 1.0;
  TLine * line = new TLine(x1, y1, x2, y2);
  theory->SetLineColor(2);
  theory->SetLineWidth(2);
  theory->Draw("same");
	theory2->SetLineColor(kBlue);
	theory2->SetLineWidth(2);
	theory2->Draw("same");
	theory3->SetLineColor(kMagenta);
	theory3->SetLineWidth(2);
	theory3->Draw("same");
	theory4->SetLineColor(kCyan);
	theory4->SetLineWidth(2);
	theory4->Draw("same");

  CMS_lumi(canvas, 4, 10);

  float t = canvas->GetTopMargin();
  float r = canvas->GetRightMargin();

  //Legend
  TLegend *l = new TLegend(0.51,0.63,0.99-r,0.99-t);
  l->AddEntry(limit_obs,"Observed", "L");
  l->AddEntry(limit_exp,"Expected", "L");
  l->AddEntry(band_exp1,"#pm1 #sigma Exp.", "F");
  l->AddEntry(band_exp2,"#pm2 #sigma Exp.", "F");
    l->AddEntry(theory, "Z' 1 TeV (NLO)", "L");
    l->AddEntry(theory2, "Z' 2 TeV (NLO)", "L");
    l->AddEntry(theory3, "Z' 3 TeV (NLO x 0.1)", "L");
    l->AddEntry(theory4, "Z' 4 TeV (NLO x 0.01)", "L");
  l->SetFillColor(0);
  l->SetLineColor(0);
  l->SetTextSize(0.04);
  l->SetTextFont(42);
  l->Draw();

  //TLatex * label = new TLatex();
  //label->SetNDC();
  //label->DrawLatex(0.2,0.86,"CMS Preliminary, 19.7 fb^{-1}");
  //label->DrawLatex(0.2,0.80,"#sqrt{s} = 8 TeV");
  //label->DrawLatex(0.6,0.80, Form("BR(b'#rightarrow %s) = 1", channel.Data()));
  //label->DrawLatex(0.55,0.80, "BR(b'#rightarrow tW) = 0.5");
  //label->DrawLatex(0.55,0.74, "BR(b'#rightarrow bH) = 0.25");
  //label->DrawLatex(0.55,0.68, "BR(b'#rightarrow bZ) = 0.25");
  //label->DrawLatex(0.2,0.74, lepton.Data());

  canvas->SetLogy(1);
  canvas->SetLogx(1);
  canvas->SetTickx(1);
  canvas->SetTicky(1);


  if (signal == 0){
    canvas->Print("Limits/comb_ZPN_limit.pdf");
    canvas->Print("Limits/comb_ZPN_limit.root");
  }
  else if (signal == 1){
    canvas->Print("Limits/comb_ZPW_limit.pdf");
    canvas->Print("Limits/comb_ZPW_limit.root");
  }
  else if (signal == 2){
    canvas->Print("Limits/comb_ZPXW_limit.pdf");
    canvas->Print("Limits/comb_ZPXW_limit.root");
  }
  else if (signal == 3){
    canvas->Print("Limits/comb_RSG_limit.pdf");
    canvas->Print("Limits/comb_RSG_limit.root");
  }
}
void Final_av_Lambda_VarCoupling_40Percent()
{
//=========Macro generated from canvas: c/c
//=========  (Wed Sep 30 17:46:25 2015) by ROOT version6.03/03
   TCanvas *c = new TCanvas("c", "c",0,0,800,700);
   c->SetHighLightColor(2);
   c->Range(-0.4838898,1.111111,3.167213,8.518519);
   c->SetFillColor(0);
   c->SetBorderMode(0);
   c->SetBorderSize(2);
   c->SetLogx();
   c->SetLogy();
   c->SetLeftMargin(0.12);
   c->SetRightMargin(0.04);
   c->SetTopMargin(0.07);
   c->SetBottomMargin(0.12);
   c->SetFrameBorderMode(0);
   c->SetFrameBorderMode(0);
   
   TMultiGraph *multigraph = new TMultiGraph();
   multigraph->SetName("");
   multigraph->SetTitle("");
   
   Double_t Graph_fx1[12] = {
   1,
   10,
   100,
   400,
   700,
   1000,
   1000,
   700,
   400,
   100,
   10,
   1};
   Double_t Graph_fy1[12] = {
   881.525,
   896.549,
   871.907,
   667.806,
   471.744,
   308.777,
   382.832,
   584.437,
   826.374,
   1079.16,
   1110.85,
   1092.23};
   TGraph *graph = new TGraph(12,Graph_fx1,Graph_fy1);
   graph->SetName("Graph");
   graph->SetTitle("");

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#ffcc00");
   graph->SetFillColor(ci);

   ci = TColor::GetColor("#ff6666");
   graph->SetLineColor(ci);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph1 = new TH1F("Graph_Graph1","",100,0.9,1099.9);
   Graph_Graph1->SetMinimum(228.5697);
   Graph_Graph1->SetMaximum(1191.057);
   Graph_Graph1->SetDirectory(0);
   Graph_Graph1->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1->SetLineColor(ci);
   Graph_Graph1->GetXaxis()->SetLabelFont(42);
   Graph_Graph1->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1->GetXaxis()->SetTitleFont(42);
   Graph_Graph1->GetYaxis()->SetLabelFont(42);
   Graph_Graph1->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1->GetYaxis()->SetTitleFont(42);
   Graph_Graph1->GetZaxis()->SetLabelFont(42);
   Graph_Graph1->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph1);
   
   multigraph->Add(graph,"");
   multigraph->Draw("af");
   multigraph->GetXaxis()->SetTitle("M_{#chi} (GeV)");
   multigraph->GetXaxis()->SetLabelFont(42);
   multigraph->GetXaxis()->SetTitleSize(0.05);
   multigraph->GetXaxis()->SetTitleOffset(1.1);
   multigraph->GetXaxis()->SetTitleFont(42);
   multigraph->GetYaxis()->SetTitle("#Lambda (GeV)");
   multigraph->GetYaxis()->SetLabelFont(42);
   multigraph->GetYaxis()->SetTitleSize(0.05);
   multigraph->GetYaxis()->SetTitleOffset(1.05);
   multigraph->GetYaxis()->SetTitleFont(42);
   
   multigraph = new TMultiGraph();
   multigraph->SetName("");
   multigraph->SetTitle("");
   
   Double_t Graph_fx2[6] = {
   1,
   10,
   100,
   400,
   700,
   1000};
   Double_t Graph_fy2[6] = {
   1092.23,
   1110.85,
   1079.16,
   826.374,
   584.437,
   382.832};
   graph = new TGraph(6,Graph_fx2,Graph_fy2);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#ff6666");
   graph->SetLineColor(ci);
   
   TH1F *Graph_Graph2 = new TH1F("Graph_Graph2","Graph",100,0.9,1099.9);
   Graph_Graph2->SetMinimum(310.0302);
   Graph_Graph2->SetMaximum(1183.652);
   Graph_Graph2->SetDirectory(0);
   Graph_Graph2->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph2->SetLineColor(ci);
   Graph_Graph2->GetXaxis()->SetLabelFont(42);
   Graph_Graph2->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph2->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph2->GetXaxis()->SetTitleFont(42);
   Graph_Graph2->GetYaxis()->SetLabelFont(42);
   Graph_Graph2->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph2->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph2->GetYaxis()->SetTitleFont(42);
   Graph_Graph2->GetZaxis()->SetLabelFont(42);
   Graph_Graph2->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph2->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph2->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph2);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx3[6] = {
   1,
   10,
   100,
   400,
   700,
   1000};
   Double_t Graph_fy3[6] = {
   980.038,
   996.742,
   968.943,
   742.067,
   524.44,
   343.371};
   graph = new TGraph(6,Graph_fx3,Graph_fy3);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#ff6666");
   graph->SetLineColor(ci);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph3 = new TH1F("Graph_Graph3","Graph",100,0.9,1099.9);
   Graph_Graph3->SetMinimum(278.0339);
   Graph_Graph3->SetMaximum(1062.079);
   Graph_Graph3->SetDirectory(0);
   Graph_Graph3->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph3->SetLineColor(ci);
   Graph_Graph3->GetXaxis()->SetLabelFont(42);
   Graph_Graph3->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph3->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph3->GetXaxis()->SetTitleFont(42);
   Graph_Graph3->GetYaxis()->SetLabelFont(42);
   Graph_Graph3->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph3->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph3->GetYaxis()->SetTitleFont(42);
   Graph_Graph3->GetZaxis()->SetLabelFont(42);
   Graph_Graph3->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph3->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph3->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph3);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx4[6] = {
   1,
   10,
   100,
   400,
   700,
   1000};
   Double_t Graph_fy4[6] = {
   881.525,
   896.549,
   871.907,
   667.806,
   471.744,
   308.777};
   graph = new TGraph(6,Graph_fx4,Graph_fy4);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#ff6666");
   graph->SetLineColor(ci);
   
   TH1F *Graph_Graph4 = new TH1F("Graph_Graph4","Graph",100,0.9,1099.9);
   Graph_Graph4->SetMinimum(249.9998);
   Graph_Graph4->SetMaximum(955.3262);
   Graph_Graph4->SetDirectory(0);
   Graph_Graph4->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph4->SetLineColor(ci);
   Graph_Graph4->GetXaxis()->SetLabelFont(42);
   Graph_Graph4->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph4->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph4->GetXaxis()->SetTitleFont(42);
   Graph_Graph4->GetYaxis()->SetLabelFont(42);
   Graph_Graph4->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph4->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph4->GetYaxis()->SetTitleFont(42);
   Graph_Graph4->GetZaxis()->SetLabelFont(42);
   Graph_Graph4->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph4->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph4->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph4);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx5[6] = {
   1,
   10,
   100,
   400,
   700,
   1000};
   Double_t Graph_fy5[6] = {
   1028.6,
   1012.32,
   1016.7,
   751.989,
   524.44,
   360.443};
   graph = new TGraph(6,Graph_fx5,Graph_fy5);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#0000ff");
   graph->SetLineColor(ci);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph5 = new TH1F("Graph_Graph5","Graph",100,0.9,1099.9);
   Graph_Graph5->SetMinimum(293.6273);
   Graph_Graph5->SetMaximum(1095.416);
   Graph_Graph5->SetDirectory(0);
   Graph_Graph5->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph5->SetLineColor(ci);
   Graph_Graph5->GetXaxis()->SetLabelFont(42);
   Graph_Graph5->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph5->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph5->GetXaxis()->SetTitleFont(42);
   Graph_Graph5->GetYaxis()->SetLabelFont(42);
   Graph_Graph5->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph5->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph5->GetYaxis()->SetTitleFont(42);
   Graph_Graph5->GetZaxis()->SetLabelFont(42);
   Graph_Graph5->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph5->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph5->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph5);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx6[35] = {
   3.981,
   4.365,
   4.786,
   5.248,
   5.754,
   6.31,
   6.918,
   7.586,
   8.318,
   9.12,
   10,
   10.965,
   12.023,
   13.183,
   14.454,
   15.849,
   17.378,
   19.055,
   20.893,
   22.909,
   25.119,
   31.623,
   39.811,
   50.119,
   63.096,
   79.433,
   100,
   125.893,
   158.489,
   199.526,
   251.189,
   316.228,
   1000,
   3162.278,
   10000};
   Double_t Graph_fy6[35] = {
   19.76533,
   32.58338,
   47.96959,
   63.10164,
   79.00995,
   95.55754,
   111.9766,
   129.0118,
   146.2376,
   163.5577,
   179.3658,
   194.9584,
   209.5672,
   223.2999,
   236.0683,
   247.7404,
   258.366,
   268.0662,
   277.1383,
   285.1146,
   292.3901,
   306.3527,
   314.441,
   317.1059,
   314.8684,
   308.9039,
   300.2537,
   289.8022,
   278.2241,
   266.1082,
   253.7422,
   241.4337,
   184.6404,
   139.2985,
   104.656};
   graph = new TGraph(35,Graph_fx6,Graph_fy6);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#6666ff");
   graph->SetLineColor(ci);
   graph->SetLineStyle(6);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph6 = new TH1F("Graph_Graph6","Graph",100,3.5829,10999.6);
   Graph_Graph6->SetMinimum(17.78879);
   Graph_Graph6->SetMaximum(346.84);
   Graph_Graph6->SetDirectory(0);
   Graph_Graph6->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph6->SetLineColor(ci);
   Graph_Graph6->GetXaxis()->SetLabelFont(42);
   Graph_Graph6->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph6->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph6->GetXaxis()->SetTitleFont(42);
   Graph_Graph6->GetYaxis()->SetLabelFont(42);
   Graph_Graph6->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph6->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph6->GetYaxis()->SetTitleFont(42);
   Graph_Graph6->GetZaxis()->SetLabelFont(42);
   Graph_Graph6->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph6->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph6->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph6);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx7[33] = {
   5.050109,
   5.570498,
   6.092375,
   6.79836,
   7.629504,
   8.933253,
   10.64203,
   12.05014,
   13.68495,
   14.93901,
   17.1131,
   19.54765,
   22.0792,
   25.65551,
   29.39341,
   34.84152,
   41.41884,
   48.68491,
   59.2071,
   75.34994,
   97.26741,
   131.0246,
   163.9459,
   202.8261,
   243.2248,
   309.5828,
   383.0166,
   473.8718,
   622.2993,
   833.6,
   1028.448,
   1283.339,
   2026.806};
   Double_t Graph_fy7[33] = {
   71.77067,
   88.82209,
   110.1401,
   130.7052,
   154.2557,
   185.7482,
   213.1504,
   232.735,
   248.5277,
   258.1632,
   268.4587,
   280.1818,
   286.5229,
   293.3758,
   296.7995,
   299.6924,
   299.6947,
   297.0875,
   293.2892,
   285.6511,
   275.8293,
   262.4571,
   252.7364,
   243.3346,
   234.001,
   222.0121,
   212.1495,
   202.5032,
   189.9106,
   177.908,
   168.9168,
   159.7122,
   142.9221};
   graph = new TGraph(33,Graph_fx7,Graph_fy7);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#cccccc");
   graph->SetLineColor(ci);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph7 = new TH1F("Graph_Graph7","Graph",100,4.545098,2228.982);
   Graph_Graph7->SetMinimum(48.97827);
   Graph_Graph7->SetMaximum(322.4871);
   Graph_Graph7->SetDirectory(0);
   Graph_Graph7->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph7->SetLineColor(ci);
   Graph_Graph7->GetXaxis()->SetLabelFont(42);
   Graph_Graph7->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph7->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph7->GetXaxis()->SetTitleFont(42);
   Graph_Graph7->GetYaxis()->SetLabelFont(42);
   Graph_Graph7->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph7->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph7->GetYaxis()->SetTitleFont(42);
   Graph_Graph7->GetZaxis()->SetLabelFont(42);
   Graph_Graph7->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph7->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph7->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph7);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx8[90] = {
   18.74425,
   19.90368,
   20.73627,
   21.82644,
   23.00752,
   24.07546,
   25.0827,
   25.71454,
   26.71212,
   27.99356,
   28.53122,
   29.59491,
   30.69819,
   31.93543,
   33.71249,
   35.53626,
   36.69926,
   39.48566,
   41.74415,
   44.52103,
   47.27444,
   49.54151,
   51.99283,
   54.56543,
   56.59926,
   59.57426,
   61.97591,
   64.94736,
   67.7638,
   72.165,
   77.52983,
   78.67276,
   79.25885,
   79.50015,
   79.8577,
   79.98559,
   80.10781,
   80.93361,
   82.97299,
   85.0636,
   87.3346,
   89.6657,
   93.68976,
   97.60831,
   101.0972,
   103.4923,
   107.3498,
   111.0254,
   114.4909,
   118.2376,
   120.3333,
   131.3772,
   140.9375,
   145.9754,
   148.1289,
   150.9739,
   154.3249,
   158.6761,
   165.3121,
   170.7206,
   172.2259,
   173.4824,
   174.2374,
   175.2489,
   175.7591,
   179.6599,
   186.3538,
   196.4347,
   207.6675,
   217.3037,
   228.0541,
   241.4457,
   256.7473,
   271.0309,
   292.4573,
   319.2919,
   352.6953,
   387.3116,
   421.6106,
   459.6163,
   505.4719,
   563.2603,
   635.9718,
   692.2802,
   745.897,
   789.6904,
   831.1771,
   886.4295,
   950.901,
   983.4362};
   Double_t Graph_fy8[90] = {
   190.042,
   192.3104,
   192.9376,
   195.179,
   197.2136,
   198.0799,
   199.3876,
   199.4802,
   201.01,
   204.4632,
   204.529,
   206.7971,
   208.8441,
   208.9712,
   209.8662,
   210.2649,
   211.3333,
   212.7612,
   214.3898,
   216.0449,
   217.1898,
   218.8107,
   219.1693,
   219.524,
   220.873,
   221.9988,
   223.3628,
   223.7069,
   225.3419,
   225.4478,
   225.5616,
   225.584,
   239.8787,
   256.2561,
   271.2293,
   293.7999,
   304.8973,
   307.0445,
   308.5203,
   309.6434,
   310.7722,
   310.8221,
   310.5429,
   310.2559,
   309.9569,
   309.996,
   311.8566,
   313.3588,
   314.1336,
   315.2763,
   316.7668,
   317.2607,
   317.3559,
   317.4016,
   319.264,
   319.2881,
   319.6855,
   319.7195,
   318.6591,
   318.3273,
   317.9688,
   309.2591,
   300.7849,
   289.5104,
   286.1793,
   286.2011,
   285.5743,
   285.6238,
   285.3433,
   284.0635,
   283.1184,
   281.2031,
   278.656,
   277.7288,
   275.8579,
   273.0541,
   270.9095,
   265.6796,
   261.7535,
   256.9895,
   253.7797,
   247.4406,
   240.1473,
   234.4071,
   229.3303,
   226.7081,
   224.3734,
   220.2731,
   215.7486,
   213.7682};
   graph = new TGraph(90,Graph_fx8,Graph_fy8);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#cc33ff");
   graph->SetLineColor(ci);
   graph->SetLineStyle(6);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph8 = new TH1F("Graph_Graph8","Graph",100,16.86982,1079.905);
   Graph_Graph8->SetMinimum(177.0742);
   Graph_Graph8->SetMaximum(332.6873);
   Graph_Graph8->SetDirectory(0);
   Graph_Graph8->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph8->SetLineColor(ci);
   Graph_Graph8->GetXaxis()->SetLabelFont(42);
   Graph_Graph8->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph8->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph8->GetXaxis()->SetTitleFont(42);
   Graph_Graph8->GetYaxis()->SetLabelFont(42);
   Graph_Graph8->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph8->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph8->GetYaxis()->SetTitleFont(42);
   Graph_Graph8->GetZaxis()->SetLabelFont(42);
   Graph_Graph8->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph8->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph8->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph8);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx9[5] = {
   250,
   500,
   1000,
   3000,
   5000};
   Double_t Graph_fy9[5] = {
   597.2217,
   587.5585,
   450.4588,
   245.3363,
   177.6733};
   graph = new TGraph(5,Graph_fx9,Graph_fy9);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#66ccff");
   graph->SetLineColor(ci);
   graph->SetLineStyle(4);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph9 = new TH1F("Graph_Graph9","Graph",100,225,5475);
   Graph_Graph9->SetMinimum(135.7185);
   Graph_Graph9->SetMaximum(639.1765);
   Graph_Graph9->SetDirectory(0);
   Graph_Graph9->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph9->SetLineColor(ci);
   Graph_Graph9->GetXaxis()->SetLabelFont(42);
   Graph_Graph9->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph9->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph9->GetXaxis()->SetTitleFont(42);
   Graph_Graph9->GetYaxis()->SetLabelFont(42);
   Graph_Graph9->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph9->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph9->GetYaxis()->SetTitleFont(42);
   Graph_Graph9->GetZaxis()->SetLabelFont(42);
   Graph_Graph9->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph9->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph9->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph9);
   
   multigraph->Add(graph,"");
   multigraph->Draw("L");
   
   TLegend *leg = new TLegend(0.185,0.5,0.59,0.79,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.03);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("NULL","Razor-0#mu 90% CL limit: AV EFT operator","h");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","Expected limit, with uncertainty","lf");

   ci = TColor::GetColor("#ffcc00");
   entry->SetFillColor(ci);
   entry->SetFillStyle(1001);

   ci = TColor::GetColor("#ff6666");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","Observed limit","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   
   leg = new TLegend(0.7,0.5,0.95,0.79,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.03);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("Graph","IceCube W^{+}W^{-}","l");

   ci = TColor::GetColor("#66ccff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(4);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","COUPP 2012","l");

   ci = TColor::GetColor("#6666ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(6);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","SIMPLE 2012","l");

   ci = TColor::GetColor("#cccccc");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","Super-K W^{+}W^{-}","l");

   ci = TColor::GetColor("#cc33ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(6);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   TLatex *   tex = new TLatex(0.955,0.945,"18.8 fb^{-1} (8 TeV)");
tex->SetNDC();
   tex->SetTextAlign(31);
   tex->SetTextFont(42);
   tex->SetTextSize(0.06);
   tex->SetLineWidth(2);
   tex->Draw();
      tex = new TLatex(0.33,0.875,"CMS");
tex->SetNDC();
   tex->SetTextAlign(31);
   tex->SetTextFont(61);
   tex->SetTextSize(0.06);
   tex->SetLineWidth(2);
   tex->Draw();
      tex = new TLatex(0.408,0.835,"Preliminary");
tex->SetNDC();
   tex->SetTextAlign(31);
   tex->SetTextFont(52);
   tex->SetTextSize(0.0456);
   tex->SetLineWidth(2);
   tex->Draw();
   c->Modified();
   c->cd();
   c->SetSelected(c);
}
Example #24
0
void plotLimit(string outputDir="./", TString inputs="", TString inputs_blinded="", TString inputXSec="", bool strengthLimit=true, bool blind=false, double energy=7, double luminosity=5.035, TString legendName="ee and #mu#mu channels")
{
   setTDRStyle();  
   gStyle->SetPadTopMargin   (0.05);
   gStyle->SetPadBottomMargin(0.12);
   gStyle->SetPadRightMargin (0.16);
   gStyle->SetPadLeftMargin  (0.14);
   gStyle->SetTitleSize(0.04, "XYZ");
   gStyle->SetTitleXOffset(1.1);
   gStyle->SetTitleYOffset(1.45);
   gStyle->SetPalette(1);
   gStyle->SetNdivisions(505);
  
  //get the limits from the tree
  TFile* file = TFile::Open(inputs);
  printf("Looping on %s\n",inputs.Data());
  if(!file) return;
  if(file->IsZombie()) return;
  TFile* file_blinded = TFile::Open(inputs_blinded);
  printf("Looping on %s\n",inputs_blinded.Data());
  if(!file_blinded) return;
  if(file_blinded->IsZombie()) return;
  TTree* tree_blinded = (TTree*)file_blinded->Get("limit");
  tree_blinded->GetBranch("mh"              )->SetAddress(&Tmh      );
  tree_blinded->GetBranch("limit"           )->SetAddress(&Tlimit   );
  tree_blinded->GetBranch("limitErr"        )->SetAddress(&TlimitErr);
  tree_blinded->GetBranch("quantileExpected")->SetAddress(&TquantExp);
  TGraph* ExpLimitm2 = getLimitGraph(tree_blinded,0.025);
  TGraph* ExpLimitm1 = getLimitGraph(tree_blinded,0.160);
  TGraph* ExpLimit   = getLimitGraph(tree_blinded,0.500);
  TGraph* ExpLimitp1 = getLimitGraph(tree_blinded,0.840);
  TGraph* ExpLimitp2 = getLimitGraph(tree_blinded,0.975);
  file_blinded->Close(); 
  TTree* tree = (TTree*)file->Get("limit");
  tree->GetBranch("mh"              )->SetAddress(&Tmh      );
  tree->GetBranch("limit"           )->SetAddress(&Tlimit   );
  tree->GetBranch("limitErr"        )->SetAddress(&TlimitErr);
  tree->GetBranch("quantileExpected")->SetAddress(&TquantExp);
  TGraph* ObsLimit   = getLimitGraph(tree,-1   ); 
  file->Close(); 

  FILE* pFileSStrenght = fopen((outputDir+"SignalStrenght").c_str(),"w");
  std::cout << "Printing Signal Strenght" << std::endl;
  for(int i=0;i<ExpLimit->GetN();i++){
     double M = ExpLimit->GetX()[i];
     std::cout << "Mass: " << M << "; ExpLimit: " << ExpLimit->Eval(M) << std::endl; 
     printf("$%8.6E$ & $%8.6E$ & $[%8.6E,%8.6E]$ & $[%8.6E,%8.6E]$ \\\\\\hline\n",M, ExpLimit->Eval(M), ExpLimitm1->Eval(M), ExpLimitp1->Eval(M), ExpLimitm2->Eval(M),  ExpLimitp2->Eval(M));
     fprintf(pFileSStrenght, "$%8.6E$ & $%8.6E$ & $[%8.6E,%8.6E]$ & $[%8.6E,%8.6E]$ & $%8.6E$ \\\\\\hline\n",M, ExpLimit->Eval(M), ExpLimitm1->Eval(M), ExpLimitp1->Eval(M), ExpLimitm2->Eval(M),  ExpLimitp2->Eval(M), ObsLimit->Eval(M));
    if(int(ExpLimit->GetX()[i])%50!=0)continue; //printf("%f ",ObsLimit->Eval(M));
  }printf("\n");
  fclose(pFileSStrenght); 
 

  //get the pValue
  inputs = inputs.ReplaceAll("/LimitTree", "/PValueTree");
  file = TFile::Open(inputs);
  
  printf("Looping on %s\n",inputs.Data());
  if(!file) return;
  if(file->IsZombie()) return;
  
  tree = (TTree*)file->Get("limit");
  
  tree->GetBranch("limit"           )->SetAddress(&Tlimit   );
  
  TGraph* pValue     = getLimitGraph(tree,-1);
  
  file->Close();

  
  //make TH Cross-sections
   string suffix = outputDir;
   TGraph* THXSec   = Hxswg::utils::getXSec(outputDir); 
   scaleGraph(THXSec, 1000);  //convert cross-section to fb
   double cprime=1.0; double  brnew=0.0;
   double XSecScaleFactor = 1.0;
   if(suffix.find("_cp")!=string::npos){
     sscanf(suffix.c_str()+suffix.find("_cp"), "_cp%lf_brn%lf", &cprime, &brnew);
     XSecScaleFactor = pow(cprime,2) * (1-brnew);
   }
  //XSecScaleFactor = 0.001; //pb to fb
  scaleGraph(THXSec, XSecScaleFactor);


  string prod = "pp_SM";
  if(outputDir.find("ggH")!=std::string::npos)prod="gg";
  if(outputDir.find("qqH")!=std::string::npos)prod="qq";
  if(outputDir.find("ppH")!=std::string::npos)prod="pp";

  
  strengthLimit = false;
  if(prod=="pp_SM")strengthLimit=true;
 
  //TGraph *XSecMELA = Hxswg::utils::getXSecMELA(cprime);

  //Hxswg::utils::multiplyGraph(   ObsLimit, XSecMELA);
  //Hxswg::utils::multiplyGraph( ExpLimitm2, XSecMELA);
  //Hxswg::utils::multiplyGraph( ExpLimitm1, XSecMELA);
  //Hxswg::utils::multiplyGraph(   ExpLimit, XSecMELA);
  //Hxswg::utils::multiplyGraph( ExpLimitp1, XSecMELA);
  //Hxswg::utils::multiplyGraph( ExpLimitp2, XSecMELA);
 
  //Scale exclusion XSec in fb
  scaleGraph(ObsLimit  , 0.001); //pb to fb
  scaleGraph(ExpLimitm2, 0.001); //pb to fb
  scaleGraph(ExpLimitm1, 0.001); //pb to fb
  scaleGraph(ExpLimit  , 0.001); //pb to fb
  scaleGraph(ExpLimitp1, 0.001); //pb to fb
  scaleGraph(ExpLimitp2, 0.001); //pb to fb

  //scal eTH cross-section and limits according to scale factor 
  //this only apply to NarrowResonnance case
  if(strengthLimit){
     Hxswg::utils::divideGraph(ObsLimit   , THXSec);
     Hxswg::utils::divideGraph(ExpLimitm2 , THXSec);
     Hxswg::utils::divideGraph(ExpLimitm1 , THXSec);
     Hxswg::utils::divideGraph(ExpLimit   , THXSec);
     Hxswg::utils::divideGraph(ExpLimitp1 , THXSec);
     Hxswg::utils::divideGraph(ExpLimitp2 , THXSec);
     Hxswg::utils::divideGraph(THXSec     , THXSec);
  }


  //limits in terms of signal strength
  TCanvas* c = new TCanvas("c", "c",800,800);
  c->SetGridx();
  c->SetGridy();
  TH1F* framework = new TH1F("Graph","Graph",1,strengthLimit?199:199,2500); //3000);
  framework->SetStats(false);
  framework->SetTitle("");
  framework->GetXaxis()->SetTitle("M_{H} [GeV]");
  framework->GetYaxis()->SetTitleOffset(1.70);
  if(strengthLimit){
  framework->GetYaxis()->SetTitle("#mu = #sigma_{95%} / #sigma_{th}");
  framework->GetYaxis()->SetRangeUser(1E-4,1E3);
  c->SetLogy(true);
  }else{
  framework->GetYaxis()->SetTitle((string("#sigma_{95%} (") + prod +" #rightarrow H #rightarrow ZZ) (pb)").c_str());
  framework->GetYaxis()->SetRangeUser(1E-3,1E3);
  c->SetLogy(true);
  }
  framework->GetXaxis()->SetLabelOffset(0.007);
  framework->GetXaxis()->SetLabelSize(0.03);
  framework->GetXaxis()->SetTitleOffset(1.0);
  framework->GetXaxis()->SetTitleFont(42);
  framework->GetXaxis()->SetTitleSize(0.035);
  framework->GetYaxis()->SetLabelFont(42);
  framework->GetYaxis()->SetLabelOffset(0.007);
  framework->GetYaxis()->SetLabelSize(0.03);
  framework->GetYaxis()->SetTitleOffset(1.3);
  framework->GetYaxis()->SetTitleFont(42);
  framework->GetYaxis()->SetTitleSize(0.035);
  framework->Draw();

  
  TGraph* TGObsLimit   = ObsLimit;  TGObsLimit->SetLineWidth(2);
  TGraph* TGExpLimit   = ExpLimit;  TGExpLimit->SetLineWidth(2); TGExpLimit->SetLineStyle(2);
  TCutG* TGExpLimit1S  = GetErrorBand("1S", ExpLimitm1, ExpLimitp1);  
  TCutG* TGExpLimit2S  = GetErrorBand("2S", ExpLimitm2, ExpLimitp2);  TGExpLimit2S->SetFillColor(5);
  THXSec->SetLineWidth(2); THXSec->SetLineStyle(1); THXSec->SetLineColor(4);

  TGExpLimit->SetLineColor(1);  TGExpLimit->SetLineStyle(2);
  TGObsLimit->SetLineWidth(2);  TGObsLimit->SetMarkerStyle(20);
  TGExpLimit2S->Draw("fc same");
  TGExpLimit1S->Draw("fc same");
  if(!blind) TGObsLimit->Draw("same P");
  TGExpLimit->Draw("same c");

  
  /*if(strengthLimit){
     TLine* SMLine = new TLine(framework->GetXaxis()->GetXmin(),1.0,framework->GetXaxis()->GetXmax(),1.0);
     SMLine->SetLineWidth(2); SMLine->SetLineStyle(1); SMLine->SetLineColor(4);      
     SMLine->Draw("same C");
  }else{
     THXSec->Draw("same C");
  }*/

  utils::root::DrawPreliminary(luminosity, energy, c);

  
  TLegend* LEG = new TLegend(0.55,0.75,0.85,0.95);
  LEG->SetHeader("");
  LEG->SetFillColor(0);
  LEG->SetFillStyle(0);
  LEG->SetTextFont(42);
  LEG->SetBorderSize(0);
  //LEG->AddEntry(THXSec  , "Th prediction"  ,"L");
  LEG->AddEntry(TGExpLimit  , "median expected"  ,"L");
  LEG->AddEntry(TGExpLimit1S  , "expected #pm 1#sigma"  ,"F");
  LEG->AddEntry(TGExpLimit2S  , "expected #pm 2#sigma"  ,"F");
  if(!blind) LEG->AddEntry(TGObsLimit  , "observed"  ,"LP");
  LEG->Draw();
  c->RedrawAxis();
  c->SaveAs((outputDir+"Limit.png").c_str());
  c->SaveAs((outputDir+"Limit.C").c_str());
  c->SaveAs((outputDir+"Limit.pdf").c_str()); 

  
  //save a summary of the limits
  FILE* pFileSum = fopen((outputDir+"LimitSummary").c_str(),"w");
  for(int i=0;i<TGExpLimit->GetN();i++){
     double M = ExpLimit->GetX()[i];
     fprintf(pFileSum, "$%8.6E$ & $%8.6E$ & $[%8.6E,%8.6E]$ & $[%8.6E,%8.6E]$ & $%8.6E$ & Th=$%8.6E$ & pValue=$%8.6E$\\\\\\hline\n",M, ExpLimit->Eval(M), ExpLimitm1->Eval(M), ExpLimitp1->Eval(M), ExpLimitm2->Eval(M),  ExpLimitp2->Eval(M), ObsLimit->Eval(M), (THXSec!=NULL)?THXSec->Eval(M):-1, pValue->Eval(M));
    if(int(ExpLimit->GetX()[i])%50!=0)continue; printf("%f ",ObsLimit->Eval(M));
  }printf("\n");
  fclose(pFileSum);

  pFileSum = fopen((outputDir+"LimitRange").c_str(),"w");
  fprintf(pFileSum, "EXPECTED LIMIT --> ");                   printLimits(pFileSum,TGExpLimit, TGExpLimit->GetX()[0], TGExpLimit->GetX()[TGExpLimit->GetN()-1]);
  if(!blind) fprintf(pFileSum, "OBSERVED LIMIT --> ");        printLimits(pFileSum,TGObsLimit, TGObsLimit->GetX()[0], TGObsLimit->GetX()[TGObsLimit->GetN()-1]);
  fprintf(pFileSum, "Exp Limits for Model are: ");              for(int i=0;i<TGExpLimit->GetN();i++){if(int(TGExpLimit->GetX()[i])%50==0) fprintf(pFileSum, "%f+-%f ",TGExpLimit->GetY()[i], (ExpLimitp1->GetY()[i]-ExpLimitm1->GetY()[i])/2.0);}fprintf(pFileSum,"\n");
  if(!blind) { fprintf(pFileSum, "Obs Limits for Model are: "); for(int i=0;i<TGObsLimit->GetN();i++){if(int(TGObsLimit->GetX()[i])%50==0) fprintf(pFileSum, "%f ",TGObsLimit->GetY()[i]);}fprintf(pFileSum,"\n"); }
  fclose(pFileSum); 
}
Example #25
0
void runBATCalculator()
{
    // Definiton of a RooWorkspace containing the statistics model. Later the
    // information for BATCalculator is retrieved from the workspace. This is
    // certainly a bit of overhead but better from an educative point of view.
    cout << "preparing the RooWorkspace object" << endl;

    RooWorkspace* myWS = new RooWorkspace("myWS", true);

    // combined prior for signal contribution
    myWS->factory("Product::signal({sigma_s[0,20],L[5,15],epsilon[0,1]})");
    myWS->factory("N_bkg[0,3]");
    // define prior functions
    // uniform prior for signal crosssection
    myWS->factory("Uniform::prior_sigma_s(sigma_s)");
    // (truncated) prior for efficiency
    myWS->factory("Gaussian::prior_epsilon(epsilon,0.51,0.0765)");
    // (truncated) Gaussian prior for luminosity
    myWS->factory("Gaussian::prior_L(L,10,1)");
    // (truncated) Gaussian prior for bkg crosssection
    myWS->factory("Gaussian::prior_N_bkg(N_bkg,0.52,0.156)");

    // Poisson distribution with mean signal+bkg
    myWS->factory("Poisson::model(n[0,300],sum(signal,N_bkg))");

    // define the global prior function
    myWS->factory("PROD::prior(prior_sigma_s,prior_epsilon,prior_L,prior_N_bkg)");

    // Definition of observables and parameters of interest
    myWS->defineSet("obsSet", "n");
    myWS->defineSet("poiSet", "sigma_s");
    myWS->defineSet("nuisanceSet", "N_bkg,L,epsilon");

    // ->model complete (Additional information can be found in the
    // RooStats manual)

    //  feel free to vary the parameters, but don't forget to choose reasonable ranges for the
    // variables. Currently the Bayesian methods will often not work well if the variable ranges
    // are either too short (for obvious reasons) or too large (for technical reasons).

    // A ModelConfig object is used to associate parts of your workspace with their statistical
    // meaning (it is also possible to initialize BATCalculator directly with elements from the
    // workspace but if you are sharing your workspace with others or if you want to use several
    // different methods the use of ModelConfig will most often turn out to be the better choice.)

    // setup the ModelConfig object
    cout << "preparing the ModelConfig object" << endl;

    ModelConfig modelconfig("modelconfig", "ModelConfig for this example");
    modelconfig.SetWorkspace(*myWS);

    modelconfig.SetPdf(*(myWS->pdf("model")));
    modelconfig.SetParametersOfInterest(*(myWS->set("poiSet")));
    modelconfig.SetPriorPdf(*(myWS->pdf("prior")));
    modelconfig.SetNuisanceParameters(*(myWS->set("nuisanceSet")));
    modelconfig.SetObservables(*(myWS->set("obsSet")));


    // use BATCalculator to the derive credibility intervals as a function of the observed number of
    // events in the hypothetical experiment

    // define vector with tested numbers of events
    TVectorD obsEvents;
    // define vectors which will be filled with the lower and upper limits for each tested number
    // of observed events
    TVectorD BATul;
    TVectorD BATll;

    // fix upper limit of tested observed number of events
    int obslimit = 10;

    obsEvents.ResizeTo(obslimit);
    BATul.ResizeTo(obslimit);
    BATll.ResizeTo(obslimit);


    cout << "starting the calculation of Bayesian credibility intervals with BATCalculator" << endl;
    // loop over observed number of events in the hypothetical experiment
    for (int obs = 1; obs <= obslimit; obs++) {

        obsEvents[obs - 1] = (static_cast<double>(obs));

        // prepare data input for the the observed number of events
        // adjust number of observed events in the workspace. This is communicated to ModelConfig!
        myWS->var("n")->setVal(obs);
        // create data
        RooDataSet data("data", "", *(modelconfig.GetObservables()));
        data.add( *(modelconfig.GetObservables()));

        // prepare BATCalulator
        BATCalculator batcalc(data, modelconfig);

        // give the BATCalculator a unique name (always a good idea in ROOT)
        TString namestring = "mybatc_";
        namestring += obs;
        batcalc.SetName(namestring);

        // fix amount of posterior probability in the calculated interval.
        // the name confidence level is incorrect here
        batcalc.SetConfidenceLevel(0.90);

        // fix length of the Markov chain. (in general: the longer the Markov chain the more
        // precise will be the results)
        batcalc.SetnMCMC(20000);

        // retrieve SimpleInterval object containing the information about the interval (this
        // triggers the actual calculations)
        SimpleInterval* interval = batcalc.GetInterval1D("sigma_s");

        std::cout << "BATCalculator: 90% credibility interval: [ " << interval->LowerLimit() << " - " << interval->UpperLimit() << " ] or 95% credibility upper limit\n";

        // add the interval borders for the current number of observed events to the vectors
        // containing the lower and upper limits
        BATll[obs - 1] = interval->LowerLimit();
        BATul[obs - 1] = interval->UpperLimit();

        // clean up for next loop element
        batcalc.CleanCalculatorForNewData();
        delete interval;
    }
    cout << "all limits calculated" << endl;

    // summarize the results in a plot

    TGraph* grBATll = new TGraph(obsEvents, BATll);
    grBATll->SetLineColor(kGreen);
    grBATll->SetLineWidth(200);
    grBATll->SetFillStyle(3001);
    grBATll->SetFillColor(kGreen);

    TGraph* grBATul = new TGraph(obsEvents, BATul);
    grBATul->SetLineColor(kGreen);
    grBATul->SetLineWidth(-200);
    grBATul->SetFillStyle(3001);
    grBATul->SetFillColor(kGreen);

    // create and draw multigraph
    TMultiGraph* mg = new TMultiGraph("BayesianLimitsBATCalculator", "BayesianLimitsBATCalculator");
    mg->SetTitle("example of Bayesian credibility intervals derived with BATCAlculator ");

    mg->Add(grBATll);
    mg->Add(grBATul);

    mg->Draw("AC");

    mg->GetXaxis()->SetTitle ("# observed events");
    mg->GetYaxis()->SetTitle("limits on signal S (size of test: 0.1)");

    mg->Draw("AC");
}
Example #26
0
void mass4Chan(){
//=========Macro generated from canvas: ccc/
//=========  (Thu Mar  7 22:11:11 2013) by ROOT version5.34/03
   TCanvas *ccc = new TCanvas("ccc", "",0,0,600,600);
   gStyle->SetOptFit(1);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   ccc->Range(86.5625,-1.875,92.8125,10.625);
   ccc->SetFillColor(0);
   ccc->SetBorderMode(0);
   ccc->SetBorderSize(2);
   ccc->SetLeftMargin(0.15);
   ccc->SetRightMargin(0.05);
   ccc->SetTopMargin(0.05);
   ccc->SetBottomMargin(0.15);
   ccc->SetFrameFillStyle(0);
   ccc->SetFrameBorderMode(0);
   ccc->SetFrameFillStyle(0);
   ccc->SetFrameBorderMode(0);
   
  

   
   TH2F *hframe = new TH2F("hframe","",100,85,96,100,0,10);
   hframe->SetLineStyle(0);
   hframe->SetMarkerStyle(20);
   hframe->GetXaxis()->SetTitle(" m_{Z} (GeV)");
   hframe->GetXaxis()->SetNdivisions(510);
   hframe->GetXaxis()->SetLabelFont(42);
   hframe->GetXaxis()->SetLabelOffset(0.01);
   hframe->GetXaxis()->SetLabelSize(0.05);
   hframe->GetXaxis()->SetTitleSize(0.05);
   hframe->GetXaxis()->SetTitleOffset(1.15);
   hframe->GetXaxis()->SetTitleFont(42);
   hframe->GetYaxis()->SetTitle(" -2#Delta ln L");
   hframe->GetYaxis()->SetLabelFont(42);
   hframe->GetYaxis()->SetLabelOffset(0.01);
   hframe->GetYaxis()->SetLabelSize(0.05);
   hframe->GetYaxis()->SetTitleSize(0.05);
   hframe->GetYaxis()->SetTitleOffset(1.4);
   hframe->GetYaxis()->SetTitleFont(42);
   hframe->GetZaxis()->SetLabelFont(42);
   hframe->GetZaxis()->SetLabelOffset(0.007);
   hframe->GetZaxis()->SetLabelSize(0.045);
   hframe->GetZaxis()->SetTitleSize(0.05);
   hframe->GetZaxis()->SetTitleFont(42);
   hframe->Draw("");
   
   //4e
   TGraph *graph = new TGraph(211);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetLineColor(kGreen+1);
   graph->SetLineWidth(3);
   graph->SetMarkerStyle(20);
   graph->SetPoint(0,88.01999664,7.234320164);
   graph->SetPoint(1,88.05999756,7.121326923);
   graph->SetPoint(2,88.09999847,7.008939743);
   graph->SetPoint(3,88.13999939,6.897168636);
   graph->SetPoint(4,88.18000031,6.786022186);
   graph->SetPoint(5,88.22000122,6.67550993);
   graph->SetPoint(6,88.26000214,6.565642357);
   graph->SetPoint(7,88.30000305,6.456428051);
   graph->SetPoint(8,88.33999634,6.347877979);
   graph->SetPoint(9,88.37999725,6.240002632);
   graph->SetPoint(10,88.41999817,6.1328125);
   graph->SetPoint(11,88.45999908,6.026317596);
   graph->SetPoint(12,88.5,5.920529366);
   graph->SetPoint(13,88.54000092,5.815458775);
   graph->SetPoint(14,88.58000183,5.711116314);
   graph->SetPoint(15,88.62000275,5.607512951);
   graph->SetPoint(16,88.66000366,5.504659653);
   graph->SetPoint(17,88.69999695,5.402567387);
   graph->SetPoint(18,88.73999786,5.301246643);
   graph->SetPoint(19,88.77999878,5.200707436);
   graph->SetPoint(20,88.81999969,5.100960732);
   graph->SetPoint(21,88.81999969,5.100960732);
   graph->SetPoint(22,88.86000061,5.002016068);
   graph->SetPoint(23,88.90000153,4.903883457);
   graph->SetPoint(24,88.94000244,4.806572437);
   graph->SetPoint(25,88.98000336,4.710093021);
   graph->SetPoint(26,89.01999664,4.614454269);
   graph->SetPoint(27,89.05999756,4.519664764);
   graph->SetPoint(28,89.09999847,4.425733089);
   graph->SetPoint(29,89.13999939,4.332668304);
   graph->SetPoint(30,89.18000031,4.240478516);
   graph->SetPoint(31,89.22000122,4.149171829);
   graph->SetPoint(32,89.26000214,4.058755875);
   graph->SetPoint(33,89.30000305,3.969237804);
   graph->SetPoint(34,89.33999634,3.880625486);
   graph->SetPoint(35,89.37999725,3.792925596);
   graph->SetPoint(36,89.41999817,3.706145048);
   graph->SetPoint(37,89.45999908,3.620290518);
   graph->SetPoint(38,89.5,3.535368204);
   graph->SetPoint(39,89.54000092,3.451384068);
   graph->SetPoint(40,89.58000183,3.368344069);
   graph->SetPoint(41,89.62000275,3.286253691);
   graph->SetPoint(42,89.62000275,3.286253691);
   graph->SetPoint(43,89.66000366,3.205118656);
   graph->SetPoint(44,89.69999695,3.124943733);
   graph->SetPoint(45,89.73999786,3.045734167);
   graph->SetPoint(46,89.77999878,2.967494488);
   graph->SetPoint(47,89.81999969,2.890229225);
   graph->SetPoint(48,89.86000061,2.813942432);
   graph->SetPoint(49,89.90000153,2.738638639);
   graph->SetPoint(50,89.94000244,2.664321423);
   graph->SetPoint(51,89.98000336,2.590994596);
   graph->SetPoint(52,90.01999664,2.518661499);
   graph->SetPoint(53,90.05999756,2.447325468);
   graph->SetPoint(54,90.09999847,2.376989603);
   graph->SetPoint(55,90.13999939,2.307657003);
   graph->SetPoint(56,90.18000031,2.23933053);
   graph->SetPoint(57,90.22000122,2.172012329);
   graph->SetPoint(58,90.26000214,2.105705023);
   graph->SetPoint(59,90.30000305,2.040410995);
   graph->SetPoint(60,90.33999634,1.976132512);
   graph->SetPoint(61,90.37999725,1.912871242);
   graph->SetPoint(62,90.41999817,1.85062921);
   graph->SetPoint(63,90.41999817,1.85062921);
   graph->SetPoint(64,90.45999908,1.789408088);
   graph->SetPoint(65,90.5,1.729209423);
   graph->SetPoint(66,90.54000092,1.670034766);
   graph->SetPoint(67,90.58000183,1.611885428);
   graph->SetPoint(68,90.62000275,1.554762602);
   graph->SetPoint(69,90.66000366,1.498667479);
   graph->SetPoint(70,90.69999695,1.443601012);
   graph->SetPoint(71,90.73999786,1.389564157);
   graph->SetPoint(72,90.77999878,1.336557865);
   graph->SetPoint(73,90.81999969,1.284582734);
   graph->SetPoint(74,90.86000061,1.233639359);
   graph->SetPoint(75,90.90000153,1.183728576);
   graph->SetPoint(76,90.94000244,1.134850621);
   graph->SetPoint(77,90.98000336,1.087006092);
   graph->SetPoint(78,91.01999664,1.040195346);
   graph->SetPoint(79,91.05999756,0.9944185615);
   graph->SetPoint(80,91.09999847,0.9496760368);
   graph->SetPoint(81,91.13999939,0.9059679508);
   graph->SetPoint(82,91.18000031,0.8632944226);
   graph->SetPoint(83,91.22000122,0.8216554523);
   graph->SetPoint(84,91.22000122,0.8216554523);
   graph->SetPoint(85,91.26000214,0.7810510397);
   graph->SetPoint(86,91.30000305,0.7414811254);
   graph->SetPoint(87,91.33999634,0.70294559);
   graph->SetPoint(88,91.37999725,0.6654443145);
   graph->SetPoint(89,91.41999817,0.6289771199);
   graph->SetPoint(90,91.45999908,0.5935436487);
   graph->SetPoint(91,91.5,0.5591436625);
   graph->SetPoint(92,91.54000092,0.5257768631);
   graph->SetPoint(93,91.58000183,0.4934427738);
   graph->SetPoint(94,91.62000275,0.462141037);
   graph->SetPoint(95,91.66000366,0.431871146);
   graph->SetPoint(96,91.69999695,0.4026326835);
   graph->SetPoint(97,91.73999786,0.3744250238);
   graph->SetPoint(98,91.77999878,0.3472476304);
   graph->SetPoint(99,91.81999969,0.3210999072);
   graph->SetPoint(100,91.86000061,0.2959812582);
   graph->SetPoint(101,91.90000153,0.2718909979);
   graph->SetPoint(102,91.94000244,0.2488284409);
   graph->SetPoint(103,91.98000336,0.2267929316);
   graph->SetPoint(104,92.01999664,0.2057837248);
   graph->SetPoint(105,92.01999664,0.2057837248);
   graph->SetPoint(106,92.05999756,0.1858001053);
   graph->SetPoint(107,92.09999847,0.1668412983);
   graph->SetPoint(108,92.13999939,0.1489065737);
   graph->SetPoint(109,92.18000031,0.1319951713);
   graph->SetPoint(110,92.22000122,0.1161063388);
   graph->SetPoint(111,92.26000214,0.1012392938);
   graph->SetPoint(112,92.30000305,0.08739329875);
   graph->SetPoint(113,92.33999634,0.07456759363);
   graph->SetPoint(114,92.37999725,0.06276145577);
   graph->SetPoint(115,92.41999817,0.05197418481);
   graph->SetPoint(116,92.45999908,0.04220509902);
   graph->SetPoint(117,92.5,0.03345353901);
   graph->SetPoint(118,92.54000092,0.02571888082);
   graph->SetPoint(119,92.58000183,0.01900054142);
   graph->SetPoint(120,92.62000275,0.01329800207);
   graph->SetPoint(121,92.66000366,0.008610763587);
   graph->SetPoint(122,92.69999695,0.004938419908);
   graph->SetPoint(123,92.73999786,0.002280603396);
   graph->SetPoint(124,92.77999878,0.0006370125338);
   graph->SetPoint(125,92.81999969,7.419047051e-06);
   //graph->SetPoint(126,92.81999969,7.419047961e-06);
   graph->SetPoint(127,92.82485199,0);
   graph->SetPoint(128,92.82485199,0);
   graph->SetPoint(129,92.82485199,0);
   graph->SetPoint(130,92.82485199,0);
   graph->SetPoint(131,92.82485199,0);
   graph->SetPoint(132,92.82485199,0);
   graph->SetPoint(133,92.82485199,0);
   graph->SetPoint(134,93.05999756,0.01752127893);
   graph->SetPoint(135,93.09999847,0.02399016172);
   graph->SetPoint(136,93.13999939,0.0314742066);
   graph->SetPoint(137,93.18000031,0.03997394815);
   graph->SetPoint(138,93.22000122,0.04949002713);
   graph->SetPoint(139,93.26000214,0.06002314016);
   graph->SetPoint(140,93.30000305,0.07157406956);
   graph->SetPoint(141,93.33999634,0.08414366841);
   graph->SetPoint(142,93.37999725,0.09773286432);
   graph->SetPoint(143,93.41999817,0.1123426482);
   graph->SetPoint(144,93.45999908,0.1279740632);
   graph->SetPoint(145,93.5,0.144628197);
   graph->SetPoint(146,93.54000092,0.1623062044);
   graph->SetPoint(147,93.58000183,0.1810092628);
   graph->SetPoint(148,93.62000275,0.200738579);
   graph->SetPoint(149,93.62000275,0.200738579);
   graph->SetPoint(150,93.66000366,0.2214953899);
   graph->SetPoint(151,93.69999695,0.2432809174);
   graph->SetPoint(152,93.73999786,0.2660964429);
   graph->SetPoint(153,93.77999878,0.2899431586);
   graph->SetPoint(154,93.81999969,0.3148224056);
   graph->SetPoint(155,93.86000061,0.3407353461);
   graph->SetPoint(156,93.90000153,0.367683202);
   graph->SetPoint(157,93.94000244,0.3956672251);
   graph->SetPoint(158,93.98000336,0.4246885478);
   graph->SetPoint(159,94.01999664,0.4547482729);
   graph->SetPoint(160,94.05999756,0.4858476222);
   graph->SetPoint(161,94.09999847,0.5179876089);
   graph->SetPoint(162,94.13999939,0.5511692166);
   graph->SetPoint(163,94.18000031,0.585393548);
   graph->SetPoint(164,94.22000122,0.6206615567);
   graph->SetPoint(165,94.26000214,0.6569740772);
   graph->SetPoint(166,94.30000305,0.6943320632);
   graph->SetPoint(167,94.33999634,0.7327364087);
   graph->SetPoint(168,94.37999725,0.772187829);
   graph->SetPoint(169,94.41999817,0.8126871586);
   graph->SetPoint(170,94.41999817,0.8126871586);
   graph->SetPoint(171,94.45999908,0.8542351723);
   graph->SetPoint(172,94.5,0.8968324661);
   graph->SetPoint(173,94.54000092,0.940479815);
   graph->SetPoint(174,94.58000183,0.985177815);
   graph->SetPoint(175,94.62000275,1.030927062);
   graph->SetPoint(176,94.66000366,1.077728152);
   graph->SetPoint(177,94.69999695,1.125581622);
   graph->SetPoint(178,94.73999786,1.174487948);
   graph->SetPoint(179,94.77999878,1.224447489);
   graph->SetPoint(180,94.81999969,1.27546072);
   graph->SetPoint(181,94.86000061,1.327528);
   graph->SetPoint(182,94.90000153,1.380649686);
   graph->SetPoint(183,94.94000244,1.434825897);
   graph->SetPoint(184,94.98000336,1.490056992);
   graph->SetPoint(185,95.01999664,1.546342969);
   graph->SetPoint(186,95.05999756,1.603683949);
   graph->SetPoint(187,95.09999847,1.66207993);
   graph->SetPoint(188,95.13999939,1.721530676);
   graph->SetPoint(189,95.18000031,1.782036185);
   graph->SetPoint(190,95.22000122,1.843595982);
   graph->SetPoint(191,95.22000122,1.843595982);
   graph->SetPoint(192,95.26000214,1.906209826);
   graph->SetPoint(193,95.30000305,1.969877124);
   graph->SetPoint(194,95.33999634,2.034597158);
   graph->SetPoint(195,95.37999725,2.100369453);
   graph->SetPoint(196,95.41999817,2.167192936);
   graph->SetPoint(197,95.45999908,2.235066652);
   graph->SetPoint(198,95.5,2.30398941);
   graph->SetPoint(199,95.54000092,2.37395978);
   graph->SetPoint(200,95.58000183,2.44497633);
   graph->SetPoint(201,95.62000275,2.517037392);
   graph->SetPoint(202,95.66000366,2.590141296);
   graph->SetPoint(203,95.69999695,2.66428566);
   graph->SetPoint(204,95.73999786,2.739468575);
   graph->SetPoint(205,95.77999878,2.815687418);
   graph->SetPoint(206,95.81999969,2.892939568);
   graph->SetPoint(207,95.86000061,2.971222401);
   graph->SetPoint(208,95.90000153,3.050532341);
   graph->SetPoint(209,95.94000244,3.130866289);
   graph->SetPoint(210,95.98000336,3.212220907);


   graph->Sort();

   cout << "4e: " << graph->Eval(91.1876) << endl;


   //2e2mu
   TGraph *graph1 = new TGraph(211);
   graph1->SetName("Graph1");
   graph1->SetTitle("Graph1");
   graph1->SetFillColor(1);
   graph1->SetLineWidth(3);
   graph1->SetLineColor(kBlue);
   graph1->SetMarkerStyle(20);
   graph1->SetPoint(0,88.01999664,8.795412064);
   graph1->SetPoint(1,88.05999756,8.61370182);
   graph1->SetPoint(2,88.09999847,8.43285656);
   graph1->SetPoint(3,88.13999939,8.252916336);
   graph1->SetPoint(4,88.18000031,8.073918343);
   graph1->SetPoint(5,88.22000122,7.895903111);
   graph1->SetPoint(6,88.26000214,7.718908787);
   graph1->SetPoint(7,88.30000305,7.542974472);
   graph1->SetPoint(8,88.33999634,7.36813879);
   graph1->SetPoint(9,88.37999725,7.194441795);
   graph1->SetPoint(10,88.41999817,7.021921158);
   graph1->SetPoint(11,88.45999908,6.850616932);
   graph1->SetPoint(12,88.5,6.680567265);
   graph1->SetPoint(13,88.54000092,6.51181221);
   graph1->SetPoint(14,88.58000183,6.344389915);
   graph1->SetPoint(15,88.62000275,6.178339481);
   graph1->SetPoint(16,88.66000366,6.013700008);
   graph1->SetPoint(17,88.69999695,5.850510597);
   graph1->SetPoint(18,88.73999786,5.688809872);
   graph1->SetPoint(19,88.77999878,5.528635979);
   graph1->SetPoint(20,88.81999969,5.370028496);
   graph1->SetPoint(21,88.81999969,5.370028496);
   graph1->SetPoint(22,88.86000061,5.21302557);
   graph1->SetPoint(23,88.90000153,5.057665825);
   graph1->SetPoint(24,88.94000244,4.903987885);
   graph1->SetPoint(25,88.98000336,4.752028942);
   graph1->SetPoint(26,89.01999664,4.601828575);
   graph1->SetPoint(27,89.05999756,4.4534235);
   graph1->SetPoint(28,89.09999847,4.306852341);
   graph1->SetPoint(29,89.13999939,4.162151814);
   graph1->SetPoint(30,89.18000031,4.019360065);
   graph1->SetPoint(31,89.22000122,3.87851429);
   graph1->SetPoint(32,89.26000214,3.739651203);
   graph1->SetPoint(33,89.30000305,3.602807283);
   graph1->SetPoint(34,89.33999634,3.468019247);
   graph1->SetPoint(35,89.37999725,3.335323095);
   graph1->SetPoint(36,89.41999817,3.204754591);
   graph1->SetPoint(37,89.45999908,3.076349258);
   graph1->SetPoint(38,89.5,2.950142145);
   graph1->SetPoint(39,89.54000092,2.82616806);
   graph1->SetPoint(40,89.58000183,2.704461336);
   graph1->SetPoint(41,89.62000275,2.58505559);
   graph1->SetPoint(42,89.62000275,2.58505559);
   graph1->SetPoint(43,89.66000366,2.467984438);
   graph1->SetPoint(44,89.69999695,2.353280783);
   graph1->SetPoint(45,89.73999786,2.240977049);
   graph1->SetPoint(46,89.77999878,2.131105185);
   graph1->SetPoint(47,89.81999969,2.023696423);
   graph1->SetPoint(48,89.86000061,1.918781519);
   graph1->SetPoint(49,89.90000153,1.816390634);
   graph1->SetPoint(50,89.94000244,1.716553092);
   graph1->SetPoint(51,89.98000336,1.619297981);
   graph1->SetPoint(52,90.01999664,1.524653077);
   graph1->SetPoint(53,90.05999756,1.432646155);
   graph1->SetPoint(54,90.09999847,1.343303561);
   graph1->SetPoint(55,90.13999939,1.256651402);
   graph1->SetPoint(56,90.18000031,1.17271471);
   graph1->SetPoint(57,90.22000122,1.091517925);
   graph1->SetPoint(58,90.26000214,1.013084531);
   graph1->SetPoint(59,90.30000305,0.9374370575);
   graph1->SetPoint(60,90.33999634,0.864597559);
   graph1->SetPoint(61,90.37999725,0.7945868969);
   graph1->SetPoint(62,90.41999817,0.727425158);
   graph1->SetPoint(63,90.41999817,0.727425158);
   graph1->SetPoint(64,90.45999908,0.6631317139);
   graph1->SetPoint(65,90.5,0.6017247438);
   graph1->SetPoint(66,90.54000092,0.5432218313);
   graph1->SetPoint(67,90.58000183,0.4876395166);
   graph1->SetPoint(68,90.62000275,0.4349934459);
   graph1->SetPoint(69,90.66000366,0.3852983713);
   graph1->SetPoint(70,90.69999695,0.3385681808);
   graph1->SetPoint(71,90.73999786,0.2948157787);
   graph1->SetPoint(72,90.77999878,0.2540532351);
   graph1->SetPoint(73,90.81999969,0.2162916809);
   graph1->SetPoint(74,90.86000061,0.1815413088);
   graph1->SetPoint(75,90.90000153,0.1498114169);
   graph1->SetPoint(76,90.94000244,0.1211103573);
   graph1->SetPoint(77,90.98000336,0.09544557333);
   graph1->SetPoint(78,91.01999664,0.07282357663);
   graph1->SetPoint(79,91.05999756,0.05324992537);
   graph1->SetPoint(80,91.09999847,0.0367292501);
   graph1->SetPoint(81,91.13999939,0.02326522022);
   graph1->SetPoint(82,91.18000031,0.01286056917);
   graph1->SetPoint(83,91.22000122,0.005517064128);
   graph1->SetPoint(84,91.22000122,0.005517064128);
   graph1->SetPoint(85,91.26000214,0.001235519536);
   graph1->SetPoint(86,91.29593658,0);
   graph1->SetPoint(87,91.29593658,0);
   graph1->SetPoint(88,91.29593658,0);
   graph1->SetPoint(89,91.29593658,0);
   graph1->SetPoint(90,91.29593658,0);
   graph1->SetPoint(91,91.29593658,0);
   graph1->SetPoint(92,91.29593658,0);
   graph1->SetPoint(93,91.5,0.03977194428);
   graph1->SetPoint(94,91.54000092,0.05686627701);
   graph1->SetPoint(95,91.58000183,0.07699460536);
   graph1->SetPoint(96,91.62000275,0.1001491994);
   graph1->SetPoint(97,91.66000366,0.1263214052);
   graph1->SetPoint(98,91.69999695,0.1555016339);
   graph1->SetPoint(99,91.73999786,0.1876795292);
   graph1->SetPoint(100,91.77999878,0.2228437364);
   graph1->SetPoint(101,91.81999969,0.260982126);
   graph1->SetPoint(102,91.86000061,0.3020817041);
   graph1->SetPoint(103,91.90000153,0.3461286724);
   graph1->SetPoint(104,91.94000244,0.3931084573);
   graph1->SetPoint(105,91.98000336,0.443005681);
   graph1->SetPoint(106,92.01999664,0.4958042502);
   //graph1->SetPoint(107,92.01999664,0.4958042204);
   graph1->SetPoint(108,92.05999756,0.551487267);
   graph1->SetPoint(109,92.09999847,0.6100373268);
   graph1->SetPoint(110,92.13999939,0.671436131);
   graph1->SetPoint(111,92.18000031,0.7356648445);
   graph1->SetPoint(112,92.22000122,0.802703917);
   graph1->SetPoint(113,92.26000214,0.872533381);
   graph1->SetPoint(114,92.30000305,0.945132494);
   graph1->SetPoint(115,92.33999634,1.020480037);
   graph1->SetPoint(116,92.37999725,1.098554254);
   graph1->SetPoint(117,92.41999817,1.179333091);
   graph1->SetPoint(118,92.45999908,1.262793779);
   graph1->SetPoint(119,92.5,1.348913193);
   graph1->SetPoint(120,92.54000092,1.437667727);
   graph1->SetPoint(121,92.58000183,1.52903378);
   graph1->SetPoint(122,92.62000275,1.622986913);
   graph1->SetPoint(123,92.66000366,1.719502687);
   graph1->SetPoint(124,92.69999695,1.818556309);
   graph1->SetPoint(125,92.73999786,1.920122623);
   graph1->SetPoint(126,92.77999878,2.024176359);
   graph1->SetPoint(127,92.81999969,2.130692005);
   graph1->SetPoint(128,92.81999969,2.130692005);
   graph1->SetPoint(129,92.86000061,2.239643812);
   graph1->SetPoint(130,92.90000153,2.351006031);
   graph1->SetPoint(131,92.94000244,2.464752674);
   graph1->SetPoint(132,92.98000336,2.580857754);
   graph1->SetPoint(133,93.01999664,2.699294806);
   graph1->SetPoint(134,93.05999756,2.820037603);
   graph1->SetPoint(135,93.09999847,2.94306016);
   graph1->SetPoint(136,93.13999939,3.068335533);
   graph1->SetPoint(137,93.18000031,3.195837736);
   graph1->SetPoint(138,93.22000122,3.325540066);
   graph1->SetPoint(139,93.26000214,3.457416296);
   graph1->SetPoint(140,93.30000305,3.591439486);
   graph1->SetPoint(141,93.33999634,3.727583647);
   graph1->SetPoint(142,93.37999725,3.865821838);
   graph1->SetPoint(143,93.41999817,4.006127834);
   graph1->SetPoint(144,93.45999908,4.148474216);
   graph1->SetPoint(145,93.5,4.292835712);
   graph1->SetPoint(146,93.54000092,4.439184189);
   graph1->SetPoint(147,93.58000183,4.587494373);
   graph1->SetPoint(148,93.62000275,4.737738609);
   graph1->SetPoint(149,93.62000275,4.737738609);
   graph1->SetPoint(150,93.66000366,4.889890194);
   graph1->SetPoint(151,93.69999695,5.043922424);
   graph1->SetPoint(152,93.73999786,5.199808598);
   graph1->SetPoint(153,93.77999878,5.357521057);
   graph1->SetPoint(154,93.81999969,5.517033577);
   graph1->SetPoint(155,93.86000061,5.678318024);
   graph1->SetPoint(156,93.90000153,5.841347694);
   graph1->SetPoint(157,93.94000244,6.006094933);
   graph1->SetPoint(158,93.98000336,6.172532082);
   graph1->SetPoint(159,94.01999664,6.340631485);
   graph1->SetPoint(160,94.05999756,6.510365486);
   graph1->SetPoint(161,94.09999847,6.681705952);
   graph1->SetPoint(162,94.13999939,6.854624748);
   graph1->SetPoint(163,94.18000031,7.029093266);
   graph1->SetPoint(164,94.22000122,7.205083847);
   graph1->SetPoint(165,94.26000214,7.382567883);
   graph1->SetPoint(166,94.30000305,7.561516285);
   graph1->SetPoint(167,94.33999634,7.741900921);
   graph1->SetPoint(168,94.37999725,7.923692226);
   graph1->SetPoint(169,94.41999817,8.106862068);
   graph1->SetPoint(170,94.41999817,8.106862068);
   graph1->SetPoint(171,94.45999908,8.291379929);
   graph1->SetPoint(172,94.5,8.477218628);
   graph1->SetPoint(173,94.54000092,8.664347649);
   graph1->SetPoint(174,94.58000183,8.85273838);
   graph1->SetPoint(175,94.62000275,9.042361259);
   graph1->SetPoint(176,94.66000366,9.233187675);
   graph1->SetPoint(177,94.69999695,9.425187111);
   graph1->SetPoint(178,94.73999786,9.618330002);
   graph1->SetPoint(179,94.77999878,9.812587738);
   graph1->SetPoint(180,94.81999969,10.00793171);
   graph1->SetPoint(181,94.86000061,10.20433044);
   graph1->SetPoint(182,94.90000153,10.40175724);
   graph1->SetPoint(183,94.94000244,10.60017967);
   graph1->SetPoint(184,94.98000336,10.79957104);
   graph1->SetPoint(185,95.01999664,10.99990082);
   graph1->SetPoint(186,95.05999756,11.20113945);
   graph1->SetPoint(187,95.09999847,11.40325832);
   graph1->SetPoint(188,95.13999939,11.60622883);
   graph1->SetPoint(189,95.18000031,11.81002045);
   graph1->SetPoint(190,95.22000122,12.01460457);
   graph1->SetPoint(191,95.22000122,12.01460457);
   graph1->SetPoint(192,95.26000214,12.21995258);
   graph1->SetPoint(193,95.30000305,12.42603588);
   graph1->SetPoint(194,95.33999634,12.63282394);
   graph1->SetPoint(195,95.37999725,12.84028816);
   graph1->SetPoint(196,95.41999817,13.04840088);
   graph1->SetPoint(197,95.45999908,13.25713253);
   graph1->SetPoint(198,95.5,13.46645451);
   graph1->SetPoint(199,95.54000092,13.6763382);
   graph1->SetPoint(200,95.58000183,13.88675499);
   graph1->SetPoint(201,95.62000275,14.09767723);
   graph1->SetPoint(202,95.66000366,14.3090744);
   graph1->SetPoint(203,95.69999695,14.5209198);
   graph1->SetPoint(204,95.73999786,14.73318481);
   graph1->SetPoint(205,95.77999878,14.94584179);
   graph1->SetPoint(206,95.81999969,15.15886116);
   graph1->SetPoint(207,95.86000061,15.37221718);
   graph1->SetPoint(208,95.90000153,15.58588123);
   graph1->SetPoint(209,95.94000244,15.79982567);
   graph1->SetPoint(210,95.98000336,16.01402283);

   
   graph1->Sort();
   
   cout<< "2e2mu: " << graph1->Eval(91.1876) << endl;


   //4mu
   TGraph *graph2 = new TGraph(216);
   graph2->SetName("Graph2");
   graph2->SetTitle("Graph2");
   graph2->SetFillColor(1);
   graph2->SetLineWidth(3);
   graph2->SetLineColor(kRed);
   graph2->SetMarkerStyle(20);
   graph2->SetPoint(0,88.01999664,42.99673462);
   graph2->SetPoint(1,88.05999756,42.01807404);
   graph2->SetPoint(2,88.09999847,41.04578781);
   graph2->SetPoint(3,88.13999939,40.08004379);
   graph2->SetPoint(4,88.18000031,39.12101746);
   graph2->SetPoint(5,88.22000122,38.16888046);
   graph2->SetPoint(6,88.26000214,37.22380447);
   graph2->SetPoint(7,88.30000305,36.2859726);
   graph2->SetPoint(8,88.33999634,35.35555267);
   graph2->SetPoint(9,88.37999725,34.43272781);
   graph2->SetPoint(10,88.41999817,33.51767731);
   graph2->SetPoint(11,88.45999908,32.61057281);
   graph2->SetPoint(12,88.5,31.71160507);
   graph2->SetPoint(13,88.54000092,30.82094765);
   graph2->SetPoint(14,88.58000183,29.93878746);
   graph2->SetPoint(15,88.62000275,29.06530762);
   graph2->SetPoint(16,88.66000366,28.20069313);
   graph2->SetPoint(17,88.69999695,27.34512901);
   graph2->SetPoint(18,88.73999786,26.49880409);
   graph2->SetPoint(19,88.77999878,25.66190529);
   graph2->SetPoint(20,88.81999969,24.83462334);
   graph2->SetPoint(21,88.81999969,24.83462334);
   graph2->SetPoint(22,88.86000061,24.01715088);
   graph2->SetPoint(23,88.90000153,23.20967865);
   graph2->SetPoint(24,88.94000244,22.41239929);
   graph2->SetPoint(25,88.98000336,21.62551308);
   graph2->SetPoint(26,89.01999664,20.84921074);
   graph2->SetPoint(27,89.05999756,20.08369446);
   graph2->SetPoint(28,89.09999847,19.32916451);
   graph2->SetPoint(29,89.13999939,18.58581734);
   graph2->SetPoint(30,89.18000031,17.85385895);
   graph2->SetPoint(31,89.22000122,17.13349152);
   graph2->SetPoint(32,89.26000214,16.42491913);
   graph2->SetPoint(33,89.30000305,15.72835064);
   graph2->SetPoint(34,89.33999634,15.04399014);
   graph2->SetPoint(35,89.37999725,14.37204742);
   graph2->SetPoint(36,89.41999817,13.71273041);
   graph2->SetPoint(37,89.45999908,13.0662508);
   graph2->SetPoint(38,89.5,12.43281651);
   graph2->SetPoint(39,89.54000092,11.81264019);
   graph2->SetPoint(40,89.58000183,11.20593262);
   graph2->SetPoint(41,89.62000275,10.6129055);
   graph2->SetPoint(42,89.62000275,10.6129055);
   graph2->SetPoint(43,89.66000366,10.03376961);
   graph2->SetPoint(44,89.69999695,9.468736649);
   graph2->SetPoint(45,89.73999786,8.918016434);
   graph2->SetPoint(46,89.77999878,8.381820679);
   graph2->SetPoint(47,89.81999969,7.860357285);
   graph2->SetPoint(48,89.86000061,7.353835583);
   graph2->SetPoint(49,89.90000153,6.862462997);
   graph2->SetPoint(50,89.94000244,6.386445045);
   graph2->SetPoint(51,89.98000336,5.92598629);
   graph2->SetPoint(52,90.01999664,5.481288433);
   graph2->SetPoint(53,90.05999756,5.0525527);
   graph2->SetPoint(54,90.09999847,4.639976501);
   graph2->SetPoint(55,90.13999939,4.243755817);
   graph2->SetPoint(56,90.18000031,3.864083052);
   graph2->SetPoint(57,90.22000122,3.501147509);
   graph2->SetPoint(58,90.26000214,3.155135393);
   graph2->SetPoint(59,90.30000305,2.826228619);
   graph2->SetPoint(60,90.33999634,2.514605522);
   graph2->SetPoint(61,90.37999725,2.220438957);
   graph2->SetPoint(62,90.41999817,1.943897605);
   graph2->SetPoint(63,90.41999817,1.943897605);
   graph2->SetPoint(64,90.45999908,1.685144305);
   graph2->SetPoint(65,90.5,1.444335938);
   graph2->SetPoint(66,90.54000092,1.221622825);
   graph2->SetPoint(67,90.58000183,1.017148852);
   graph2->SetPoint(68,90.62000275,0.8310500383);
   graph2->SetPoint(69,90.66000366,0.663454473);
   graph2->SetPoint(70,90.69999695,0.5144816637);
   graph2->SetPoint(71,90.73999786,0.3842421472);
   graph2->SetPoint(72,90.77999878,0.2728365958);
   graph2->SetPoint(73,90.81999969,0.1803556085);
   graph2->SetPoint(74,90.86000061,0.1068789586);
   graph2->SetPoint(75,90.90000153,0.05247514695);
   graph2->SetPoint(76,90.94000244,0.01720083691);
   graph2->SetPoint(77,90.98000336,0.00110038009);
   graph2->SetPoint(78,90.9935379,0);
   graph2->SetPoint(79,90.9935379,0);
   graph2->SetPoint(80,90.9935379,0);
   graph2->SetPoint(81,90.9935379,0);
   graph2->SetPoint(82,90.9935379,0);
   graph2->SetPoint(83,90.9935379,0);
   graph2->SetPoint(84,90.9935379,0);
   graph2->SetPoint(85,91.01999664,0.004205350298);
   graph2->SetPoint(86,91.05999756,0.02653408609);
   graph2->SetPoint(87,91.09999847,0.06809128821);
   graph2->SetPoint(88,91.13999939,0.1288676411);
   graph2->SetPoint(89,91.18000031,0.208839491);
   graph2->SetPoint(90,91.22000122,0.3079685569);
   graph2->SetPoint(91,91.22000122,0.3079685569);
   graph2->SetPoint(92,91.26000214,0.4262017608);
   graph2->SetPoint(93,91.30000305,0.5634709001);
   graph2->SetPoint(94,91.33999634,0.7196927667);
   graph2->SetPoint(95,91.37999725,0.8947688341);
   graph2->SetPoint(96,91.41999817,1.088585615);
   graph2->SetPoint(97,91.45999908,1.301014304);
   graph2->SetPoint(98,91.5,1.531911612);
   graph2->SetPoint(99,91.54000092,1.781119347);
   graph2->SetPoint(100,91.58000183,2.048465252);
   graph2->SetPoint(101,91.62000275,2.333762884);
   graph2->SetPoint(102,91.66000366,2.636813402);
   graph2->SetPoint(103,91.69999695,2.957404137);
   graph2->SetPoint(104,91.73999786,3.295311213);
   graph2->SetPoint(105,91.77999878,3.650299788);
   graph2->SetPoint(106,91.81999969,4.022123814);
   graph2->SetPoint(107,91.86000061,4.410528183);
   graph2->SetPoint(108,91.90000153,4.815249443);
   graph2->SetPoint(109,91.94000244,5.23601675);
   graph2->SetPoint(110,91.98000336,5.672553062);
   graph2->SetPoint(111,92.01999664,6.124575138);
   graph2->SetPoint(112,92.01999664,6.124575138);
   graph2->SetPoint(113,92.05999756,6.591795921);
   graph2->SetPoint(114,92.09999847,7.073926449);
   graph2->SetPoint(115,92.13999939,7.570672989);
   graph2->SetPoint(116,92.18000031,8.08174324);
   graph2->SetPoint(117,92.22000122,8.606842995);
   graph2->SetPoint(118,92.26000214,9.145680428);
   graph2->SetPoint(119,92.30000305,9.697964668);
   graph2->SetPoint(120,92.33999634,10.26340675);
   graph2->SetPoint(121,92.37999725,10.84172058);
   graph2->SetPoint(122,92.41999817,11.43262482);
   graph2->SetPoint(123,92.45999908,12.03584099);
   graph2->SetPoint(124,92.5,12.65109539);
   graph2->SetPoint(125,92.54000092,13.27812099);
   graph2->SetPoint(126,92.58000183,13.91665268);
   graph2->SetPoint(127,92.62000275,14.56643105);
   graph2->SetPoint(128,92.66000366,15.22720337);
   graph2->SetPoint(129,92.69999695,15.89872169);
   graph2->SetPoint(130,92.73999786,16.58073997);
   graph2->SetPoint(131,92.77999878,17.2730217);
   graph2->SetPoint(132,92.81999969,17.97533035);
   graph2->SetPoint(133,92.81999969,17.97533035);
   graph2->SetPoint(134,92.86000061,18.68743896);
   graph2->SetPoint(135,92.90000153,19.40911865);
   graph2->SetPoint(136,92.94000244,20.14015007);
   graph2->SetPoint(137,92.98000336,20.88031387);
   graph2->SetPoint(138,93.01999664,21.62939453);
   graph2->SetPoint(139,93.05999756,22.38718414);
   graph2->SetPoint(140,93.09999847,23.15346909);
   graph2->SetPoint(141,93.13999939,23.92804527);
   graph2->SetPoint(142,93.18000031,24.71071243);
   graph2->SetPoint(143,93.22000122,25.50126266);
   graph2->SetPoint(144,93.26000214,26.29950333);
   graph2->SetPoint(145,93.30000305,27.10523224);
   graph2->SetPoint(146,93.33999634,27.91825485);
   graph2->SetPoint(147,93.37999725,28.73837852);
   graph2->SetPoint(148,93.41999817,29.56540871);
   graph2->SetPoint(149,93.45999908,30.39915657);
   graph2->SetPoint(150,93.5,31.23942947);
   graph2->SetPoint(151,93.54000092,32.0860405);
   graph2->SetPoint(152,93.58000183,32.93880081);
   graph2->SetPoint(153,93.62000275,33.79752731);
   graph2->SetPoint(154,93.62000275,33.79752731);
   graph2->SetPoint(155,93.66000366,34.66203308);
   graph2->SetPoint(156,93.69999695,35.53213501);
   graph2->SetPoint(157,93.73999786,36.40764999);
   graph2->SetPoint(158,93.77999878,37.28839874);
   graph2->SetPoint(159,93.81999969,38.17420197);
   graph2->SetPoint(160,93.86000061,39.06488037);
   graph2->SetPoint(161,93.90000153,39.96025848);
   graph2->SetPoint(162,93.94000244,40.86016464);
   graph2->SetPoint(163,93.98000336,41.76441956);
   graph2->SetPoint(164,94.01999664,42.67286301);
   graph2->SetPoint(165,94.05999756,43.5853157);
   graph2->SetPoint(166,94.09999847,44.50161362);
   graph2->SetPoint(167,94.13999939,45.42160034);
   graph2->SetPoint(168,94.18000031,46.34510422);
   graph2->SetPoint(169,94.22000122,47.27197266);
   graph2->SetPoint(170,94.26000214,48.20204544);
   graph2->SetPoint(171,94.30000305,49.13516998);
   graph2->SetPoint(172,94.33999634,50.07119751);
   graph2->SetPoint(173,94.37999725,51.00997925);
   graph2->SetPoint(174,94.41999817,51.95137024);
   graph2->SetPoint(175,94.41999817,51.95137024);
   graph2->SetPoint(176,94.45999908,52.89523315);
   graph2->SetPoint(177,94.5,53.84142303);
   graph2->SetPoint(178,94.54000092,54.789814);
   graph2->SetPoint(179,94.58000183,55.74026871);
   graph2->SetPoint(180,94.62000275,56.69266129);
   graph2->SetPoint(181,94.66000366,57.64687347);
   graph2->SetPoint(182,94.69999695,58.60277939);
   graph2->SetPoint(183,94.73999786,59.5602684);
   graph2->SetPoint(184,94.77999878,60.51922989);
   graph2->SetPoint(185,94.81999969,61.47954941);
   graph2->SetPoint(186,94.86000061,62.44112778);
   graph2->SetPoint(187,94.90000153,63.40386581);
   graph2->SetPoint(188,94.94000244,64.36766815);
   graph2->SetPoint(189,94.98000336,65.33243561);
   graph2->SetPoint(190,95.01999664,66.29808044);
   graph2->SetPoint(191,95.05999756,67.264534);
   graph2->SetPoint(192,95.09999847,68.23168945);
   graph2->SetPoint(193,95.13999939,69.19949341);
   graph2->SetPoint(194,95.18000031,70.16786194);
   graph2->SetPoint(195,95.22000122,71.13671875);
   graph2->SetPoint(196,95.22000122,71.13671875);
   graph2->SetPoint(197,95.26000214,72.10600281);
   graph2->SetPoint(198,95.30000305,73.07565308);
   graph2->SetPoint(199,95.33999634,74.04560852);
   graph2->SetPoint(200,95.37999725,75.01580811);
   graph2->SetPoint(201,95.41999817,75.98619843);
   graph2->SetPoint(202,95.45999908,76.95672607);
   graph2->SetPoint(203,95.5,77.92734528);
   graph2->SetPoint(204,95.54000092,78.89801788);
   graph2->SetPoint(205,95.58000183,79.86868286);
   graph2->SetPoint(206,95.62000275,80.83930969);
   graph2->SetPoint(207,95.66000366,81.80986023);
   graph2->SetPoint(208,95.69999695,82.7802887);
   graph2->SetPoint(209,95.73999786,83.7505722);
   graph2->SetPoint(210,95.77999878,84.72067261);
   graph2->SetPoint(211,95.81999969,85.69055176);
   graph2->SetPoint(212,95.86000061,86.6601944);
   graph2->SetPoint(213,95.90000153,87.62956238);
   graph2->SetPoint(214,95.94000244,88.59862518);
   graph2->SetPoint(215,95.98000336,89.56736755);



   cout<< "4mu: " << graph2->Eval(91.1876) << endl;


   //4l
   TGraph *graph3 = new TGraph(212);
   graph3->SetName("Graph3");
   graph3->SetTitle("Graph3");
   graph3->SetFillColor(1);
   graph3->SetLineWidth(3);
   graph3->SetMarkerStyle(20);
   graph3->SetPoint(0,88.01999664,57.33911514);
   graph3->SetPoint(1,88.05999756,56.08871841);
   graph3->SetPoint(2,88.09999847,54.84604263);
   graph3->SetPoint(3,88.13999939,53.61128998);
   graph3->SetPoint(4,88.18000031,52.38465881);
   graph3->SetPoint(5,88.22000122,51.1663475);
   graph3->SetPoint(6,88.26000214,49.95656586);
   graph3->SetPoint(7,88.30000305,48.75551605);
   graph3->SetPoint(8,88.33999634,47.56340408);
   graph3->SetPoint(9,88.37999725,46.38043976);
   graph3->SetPoint(10,88.41999817,45.20683289);
   graph3->SetPoint(11,88.45999908,44.04279709);
   graph3->SetPoint(12,88.5,42.88854218);
   graph3->SetPoint(13,88.54000092,41.74428558);
   graph3->SetPoint(14,88.58000183,40.61024094);
   graph3->SetPoint(15,88.62000275,39.48662186);
   graph3->SetPoint(16,88.66000366,38.37365723);
   graph3->SetPoint(17,88.69999695,37.27156067);
   graph3->SetPoint(18,88.73999786,36.18055725);
   graph3->SetPoint(19,88.77999878,35.10086823);
   graph3->SetPoint(20,88.81999969,34.03272247);
   graph3->SetPoint(21,88.81999969,34.03272247);
   graph3->SetPoint(22,88.86000061,32.97634506);
   graph3->SetPoint(23,88.90000153,31.93196487);
   graph3->SetPoint(24,88.94000244,30.89981461);
   graph3->SetPoint(25,88.98000336,29.88012505);
   graph3->SetPoint(26,89.01999664,28.87313271);
   graph3->SetPoint(27,89.05999756,27.87907028);
   graph3->SetPoint(28,89.09999847,26.8981781);
   graph3->SetPoint(29,89.13999939,25.93069649);
   graph3->SetPoint(30,89.18000031,24.97686577);
   graph3->SetPoint(31,89.22000122,24.03692818);
   graph3->SetPoint(32,89.26000214,23.11112785);
   graph3->SetPoint(33,89.30000305,22.19971466);
   graph3->SetPoint(34,89.33999634,21.30293083);
   graph3->SetPoint(35,89.37999725,20.42103004);
   graph3->SetPoint(36,89.41999817,19.55426025);
   graph3->SetPoint(37,89.45999908,18.70287132);
   graph3->SetPoint(38,89.5,17.86711502);
   graph3->SetPoint(39,89.54000092,17.04724693);
   graph3->SetPoint(40,89.58000183,16.24351692);
   graph3->SetPoint(41,89.62000275,15.45617962);
   graph3->SetPoint(42,89.62000275,15.45617962);
   graph3->SetPoint(43,89.66000366,14.6854887);
   graph3->SetPoint(44,89.69999695,13.93169785);
   graph3->SetPoint(45,89.73999786,13.19505882);
   graph3->SetPoint(46,89.77999878,12.47582531);
   graph3->SetPoint(47,89.81999969,11.77424908);
   graph3->SetPoint(48,89.86000061,11.09057903);
   graph3->SetPoint(49,89.90000153,10.4250679);
   graph3->SetPoint(50,89.94000244,9.777960777);
   graph3->SetPoint(51,89.98000336,9.149505615);
   graph3->SetPoint(52,90.01999664,8.539945602);
   graph3->SetPoint(53,90.05999756,7.949523926);
   graph3->SetPoint(54,90.09999847,7.378479958);
   graph3->SetPoint(55,90.13999939,6.827050209);
   graph3->SetPoint(56,90.18000031,6.295467854);
   graph3->SetPoint(57,90.22000122,5.783964634);
   graph3->SetPoint(58,90.26000214,5.292765617);
   graph3->SetPoint(59,90.30000305,4.82209301);
   graph3->SetPoint(60,90.33999634,4.37216568);
   graph3->SetPoint(61,90.37999725,3.943194866);
   graph3->SetPoint(62,90.41999817,3.535388231);
   graph3->SetPoint(63,90.41999817,3.535388231);
   graph3->SetPoint(64,90.45999908,3.148947239);
   graph3->SetPoint(65,90.5,2.784065962);
   graph3->SetPoint(66,90.54000092,2.440932035);
   graph3->SetPoint(67,90.58000183,2.119725466);
   graph3->SetPoint(68,90.62000275,1.820617914);
   graph3->SetPoint(69,90.66000366,1.543772101);
   graph3->SetPoint(70,90.69999695,1.28934145);
   graph3->SetPoint(71,90.73999786,1.057468891);
   graph3->SetPoint(72,90.77999878,0.8482871056);
   graph3->SetPoint(73,90.81999969,0.6619167924);
   graph3->SetPoint(74,90.86000061,0.4984668195);
   graph3->SetPoint(75,90.90000153,0.3580331504);
   graph3->SetPoint(76,90.94000244,0.240698427);
   graph3->SetPoint(77,90.98000336,0.1465311348);
   graph3->SetPoint(78,91.01999664,0.07558509707);
   graph3->SetPoint(79,91.05999756,0.02789884619);
   graph3->SetPoint(80,91.09999847,0.003495044075);
   graph3->SetPoint(81,91.12191772,0);
   graph3->SetPoint(82,91.12191772,0);
   graph3->SetPoint(83,91.12191772,0);
   graph3->SetPoint(84,91.12191772,0);
   graph3->SetPoint(85,91.12191772,0);
   graph3->SetPoint(86,91.12191772,0);
   graph3->SetPoint(87,91.12191772,0);
   graph3->SetPoint(88,91.26000214,0.1385737211);
   graph3->SetPoint(89,91.30000305,0.230332002);
   graph3->SetPoint(90,91.33999634,0.345148921);
   graph3->SetPoint(91,91.37999725,0.4829240143);
   graph3->SetPoint(92,91.41999817,0.643538177);
   graph3->SetPoint(93,91.45999908,0.8268537521);
   graph3->SetPoint(94,91.5,1.032714605);
   graph3->SetPoint(95,91.54000092,1.260946751);
   graph3->SetPoint(96,91.58000183,1.511358023);
   graph3->SetPoint(97,91.62000275,1.783738732);
   graph3->SetPoint(98,91.66000366,2.07786274);
   graph3->SetPoint(99,91.69999695,2.39348793);
   graph3->SetPoint(100,91.73999786,2.730356455);
   graph3->SetPoint(101,91.77999878,3.088196516);
   graph3->SetPoint(102,91.81999969,3.466723442);
   graph3->SetPoint(103,91.86000061,3.865639925);
   graph3->SetPoint(104,91.90000153,4.284637928);
   graph3->SetPoint(105,91.94000244,4.723400593);
   graph3->SetPoint(106,91.98000336,5.181601524);
   graph3->SetPoint(107,92.01999664,5.658910275);
   graph3->SetPoint(108,92.01999664,5.658910275);
   graph3->SetPoint(109,92.05999756,6.154988289);
   graph3->SetPoint(110,92.09999847,6.669495583);
   graph3->SetPoint(111,92.13999939,7.202087879);
   graph3->SetPoint(112,92.18000031,7.752422333);
   graph3->SetPoint(113,92.22000122,8.32015419);
   graph3->SetPoint(114,92.26000214,8.904941559);
   graph3->SetPoint(115,92.30000305,9.506444931);
   graph3->SetPoint(116,92.33999634,10.12432957);
   graph3->SetPoint(117,92.37999725,10.75826359);
   graph3->SetPoint(118,92.41999817,11.40792084);
   graph3->SetPoint(119,92.45999908,12.07298279);
   graph3->SetPoint(120,92.5,12.75313663);
   graph3->SetPoint(121,92.54000092,13.44807529);
   graph3->SetPoint(122,92.58000183,14.15750027);
   graph3->SetPoint(123,92.62000275,14.88112068);
   graph3->SetPoint(124,92.66000366,15.61865044);
   graph3->SetPoint(125,92.69999695,16.36981392);
   graph3->SetPoint(126,92.73999786,17.13433838);
   graph3->SetPoint(127,92.77999878,17.91196251);
   graph3->SetPoint(128,92.81999969,18.70242691);
   graph3->SetPoint(129,92.81999969,18.70242691);
   graph3->SetPoint(130,92.86000061,19.50548172);
   graph3->SetPoint(131,92.90000153,20.32088089);
   graph3->SetPoint(132,92.94000244,21.14838409);
   graph3->SetPoint(133,92.98000336,21.98775864);
   graph3->SetPoint(134,93.01999664,22.83877182);
   graph3->SetPoint(135,93.05999756,23.70119667);
   graph3->SetPoint(136,93.09999847,24.57481003);
   graph3->SetPoint(137,93.13999939,25.45939636);
   graph3->SetPoint(138,93.18000031,26.35473442);
   graph3->SetPoint(139,93.22000122,27.2606163);
   graph3->SetPoint(140,93.26000214,28.17682648);
   graph3->SetPoint(141,93.30000305,29.10315895);
   graph3->SetPoint(142,93.33999634,30.03940773);
   graph3->SetPoint(143,93.37999725,30.98536491);
   graph3->SetPoint(144,93.41999817,31.94083023);
   graph3->SetPoint(145,93.45999908,32.9056015);
   graph3->SetPoint(146,93.5,33.87947845);
   graph3->SetPoint(147,93.54000092,34.86225891);
   graph3->SetPoint(148,93.58000183,35.85375214);
   graph3->SetPoint(149,93.62000275,36.85375214);
   graph3->SetPoint(150,93.62000275,36.85375214);
   graph3->SetPoint(151,93.66000366,37.86207199);
   graph3->SetPoint(152,93.69999695,38.87851334);
   graph3->SetPoint(153,93.73999786,39.90288162);
   graph3->SetPoint(154,93.77999878,40.93498611);
   graph3->SetPoint(155,93.81999969,41.97463608);
   graph3->SetPoint(156,93.86000061,43.02164078);
   graph3->SetPoint(157,93.90000153,44.07581329);
   graph3->SetPoint(158,93.94000244,45.13696671);
   graph3->SetPoint(159,93.98000336,46.20491409);
   graph3->SetPoint(160,94.01999664,47.27947617);
   graph3->SetPoint(161,94.05999756,48.360466);
   graph3->SetPoint(162,94.09999847,49.44770813);
   graph3->SetPoint(163,94.13999939,50.54101944);
   graph3->SetPoint(164,94.18000031,51.64023209);
   graph3->SetPoint(165,94.22000122,52.74516296);
   graph3->SetPoint(166,94.26000214,53.85564804);
   graph3->SetPoint(167,94.30000305,54.97151947);
   graph3->SetPoint(168,94.33999634,56.09260941);
   graph3->SetPoint(169,94.37999725,57.21875763);
   graph3->SetPoint(170,94.41999817,58.34980011);
   graph3->SetPoint(171,94.41999817,58.34980011);
   graph3->SetPoint(172,94.45999908,59.48558426);
   graph3->SetPoint(173,94.5,60.62595749);
   graph3->SetPoint(174,94.54000092,61.77076721);
   graph3->SetPoint(175,94.58000183,62.91986847);
   graph3->SetPoint(176,94.62000275,64.07312012);
   graph3->SetPoint(177,94.66000366,65.2303772);
   graph3->SetPoint(178,94.69999695,66.39151001);
   graph3->SetPoint(179,94.73999786,67.55638123);
   graph3->SetPoint(180,94.77999878,68.72486877);
   graph3->SetPoint(181,94.81999969,69.89684296);
   graph3->SetPoint(182,94.86000061,71.07218933);
   graph3->SetPoint(183,94.90000153,72.25079346);
   graph3->SetPoint(184,94.94000244,73.43252563);
   graph3->SetPoint(185,94.98000336,74.61729431);
   graph3->SetPoint(186,95.01999664,75.80497742);
   graph3->SetPoint(187,95.05999756,76.99549103);
   graph3->SetPoint(188,95.09999847,78.18872833);
   graph3->SetPoint(189,95.13999939,79.38459015);
   graph3->SetPoint(190,95.18000031,80.58299255);
   graph3->SetPoint(191,95.22000122,81.78383636);
   graph3->SetPoint(192,95.22000122,81.78383636);
   graph3->SetPoint(193,95.26000214,82.98705292);
   graph3->SetPoint(194,95.30000305,84.19254303);
   graph3->SetPoint(195,95.33999634,85.40024567);
   graph3->SetPoint(196,95.37999725,86.61006927);
   graph3->SetPoint(197,95.41999817,87.82195282);
   graph3->SetPoint(198,95.45999908,89.03581238);
   graph3->SetPoint(199,95.5,90.25159454);
   graph3->SetPoint(200,95.54000092,91.46923065);
   graph3->SetPoint(201,95.58000183,92.68865204);
   graph3->SetPoint(202,95.62000275,93.90979767);
   graph3->SetPoint(203,95.66000366,95.13261414);
   graph3->SetPoint(204,95.69999695,96.35704803);
   graph3->SetPoint(205,95.73999786,97.58303833);
   graph3->SetPoint(206,95.77999878,98.81052399);
   graph3->SetPoint(207,95.81999969,100.0394745);
   graph3->SetPoint(208,95.86000061,101.2698212);
   graph3->SetPoint(209,95.90000153,102.5015259);
   graph3->SetPoint(210,95.94000244,103.7345352);
   graph3->SetPoint(211,95.98000336,104.9688034);



   TH1F *Graph_Graph1 = new TH1F("Graph_Graph1","Graph",212,84.03,95.97);
   Graph_Graph1->SetMinimum(0);
   Graph_Graph1->SetMaximum(57.47094);
   Graph_Graph1->SetDirectory(0);
   Graph_Graph1->SetStats(0);
   Graph_Graph1->SetLineStyle(0);
   Graph_Graph1->SetMarkerStyle(20);
   Graph_Graph1->GetXaxis()->SetLabelFont(42);
   Graph_Graph1->GetXaxis()->SetLabelOffset(0.01);
   Graph_Graph1->GetXaxis()->SetLabelSize(0.045);
   Graph_Graph1->GetXaxis()->SetTitleSize(0.055);
   Graph_Graph1->GetXaxis()->SetTitleOffset(0.9);
   Graph_Graph1->GetXaxis()->SetTitleFont(42);
   Graph_Graph1->GetYaxis()->SetLabelFont(42);
   Graph_Graph1->GetYaxis()->SetLabelOffset(0.01);
   Graph_Graph1->GetYaxis()->SetLabelSize(0.045);
   Graph_Graph1->GetYaxis()->SetTitleSize(0.055);
   Graph_Graph1->GetYaxis()->SetTitleOffset(1.25);
   Graph_Graph1->GetYaxis()->SetTitleFont(42);
   Graph_Graph1->GetZaxis()->SetLabelFont(42);
   Graph_Graph1->GetZaxis()->SetLabelOffset(0.01);
   Graph_Graph1->GetZaxis()->SetLabelSize(0.045);
   Graph_Graph1->GetZaxis()->SetTitleSize(0.055);
   Graph_Graph1->GetZaxis()->SetTitleFont(42);
   Graph_Graph1->GetXaxis()->SetNdivisions(510);
   
   graph->SetHistogram(Graph_Graph1);
   graph->Draw("cx");
   graph1->Draw("cx");
   graph2->Draw("cx");
   graph3->Draw("cx");

   TPaveText *pt = new TPaveText(0.1577181,0.95,0.9580537,0.99,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillStyle(0);
   pt->SetTextAlign(12);
   pt->SetTextFont(42);
   pt->SetTextSize(0.03);
   TText *text = pt->AddText(0.01,0.5,"CMS");
   text = pt->AddText(0.3,0.6,"#sqrt{s} = 7 TeV, L = 5.1 fb^{-1}  #sqrt{s} = 8 TeV, L = 19.7 fb^{-1}");
   pt->Draw();
   

   TLegend *leg = new TLegend(0.73,0.77,0.94,0.94);
   leg->SetTextSize(0.035);
   leg->SetTextFont(42);
   leg->SetFillColor(kWhite);
   //leg->SetBorderSize(0);
   //leg->SetFillStyle(0);

   leg->AddEntry(graph3,"Combined","L");
   leg->AddEntry(graph,"Z#rightarrow 4e","L");
   leg->AddEntry(graph2,"Z#rightarrow 4#mu","L");
   leg->AddEntry(graph1,"Z#rightarrow 2e2#mu","L");






   double yLow = 0.5;

   

   pt = new TPaveText(0.11,yLow,0.4,yLow+0.04,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillStyle(0);
   pt->SetTextAlign(12);
   pt->SetTextFont(42);
   pt->SetTextSize(0.03);
   pt->SetTextColor(kBlue);
   text = pt->AddText(0.2,0.2,"m_{2e2#mu} = 91.24 #pm 0.46 GeV");
   //text = pt->AddText(0.2,0.2,"m_{2e2#mu} = 91.24 #pm 0.40 #pm 0.16 GeV");
   //stat 91.4315 +0.405948-0.397679
   cout << "Syst 2e2mu: " << findSystErr(0.43,0.40) << endl;
   //pt->Draw();

   pt = new TPaveText(0.11,yLow+0.06,0.4,yLow+0.1,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillStyle(0);
   pt->SetTextAlign(12);
   pt->SetTextFont(42);
   pt->SetTextSize(0.03);
   pt->SetTextColor(kRed);
   text = pt->AddText(0.2,0.2,"m_{4#mu} = 91.00 #pm 0.26 GeV");
   //text = pt->AddText(0.2,0.2,"m_{4#mu} = 91.00 #pm 0.25 #pm 0.09 GeV");
   //stat 91.0078 +0.255715-0.25533
   cout << "Syst 4mu: " << findSystErr(0.27,0.255) << endl;
   //pt->Draw();

   pt = new TPaveText(0.11,yLow+0.12,0.4,yLow+0.16,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillStyle(0);
   pt->SetTextAlign(12);
   pt->SetTextFont(42);
   pt->SetTextSize(0.03);
   pt->SetTextColor(kGreen+1);
   text = pt->AddText(0.2,0.2,"m_{4e} = 93.67 #pm 1.08 GeV");
   //text = pt->AddText(0.2,0.2,"m_{4e} = 9 #pm 0.74 #pm 0.30 GeV");
   //stat 91.8026 +0.745333-0.740755
   cout << "Syst 4e: " << findSystErr(0.8,0.74) << endl;
   //pt->Draw();

   pt = new TPaveText(0.11,yLow+0.18,0.4,yLow+0.22,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillStyle(0);
   pt->SetTextAlign(12);
   pt->SetTextFont(42);
   pt->SetTextSize(0.03);
   text = pt->AddText(0.2,0.2,"m_{4l} = 91.15 #pm 0.23 GeV");
   //text = pt->AddText(0.2,0.2,"m_{4l} = 91.17 #pm 0.18 #pm 0.13 GeV");
   //stat  91.1724 +0.168014-0.204439
   cout << "Syst 4l: " << findSystErr(0.22,0.18) << endl;
   //pt->Draw();

   pt = new TPaveText(0.18,yLow+0.24,0.4,yLow+0.28,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillStyle(0);
   pt->SetTextAlign(12);
   pt->SetTextFont(42);
   pt->SetTextSize(0.035);
   text = pt->AddText(0.2,0.2,"#chi^{2}/ndof = 1.38/3");
   //pt->Draw();
   
   gPad->SetTicks(1,1);

   TLine *line95 = new TLine(88,3.84,96,3.84);
   line95->SetLineColor(kRed);
   line95->SetLineWidth(2);
   line95->Draw();

   TLine *line68 = new TLine(88,1,96,1);
   line68->SetLineColor(kRed);
   line68->SetLineWidth(3);
   line68->Draw();
   
   TLine *lineZ = new TLine(91.1876,0,91.1876,10);
   lineZ->SetLineColor(kGray+2);
   lineZ->SetLineStyle(7);
   lineZ->Draw();

   leg->Draw();
   hframe->GetXaxis()->SetRangeUser(88,96);
   ccc->Modified();
   ccc->cd();
   ccc->SetSelected(ccc);

   ccc->SaveAs("massZ4lScan_MZ2gt12_Legacy_split.eps");
   ccc->SaveAs("massZ4lScan_MZ2gt12_Legacy_split.png");
}
Example #27
0
void fitLMdataLL1()
{
//=========Macro generated from canvas: c1/data fits
//=========  (Thu Jun 30 23:00:26 2016) by ROOT version6.06/02
   TCanvas *c1 = new TCanvas("c1", "data fits",0,0,1200,800);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   c1->Range(0,0,1,1);
   c1->SetFillColor(0);
   c1->SetBorderMode(0);
   c1->SetBorderSize(2);
   c1->SetTickx(1);
   c1->SetTicky(1);
   c1->SetLeftMargin(0.14);
   c1->SetRightMargin(0.05);
   c1->SetTopMargin(0.05);
   c1->SetBottomMargin(0.16);
   c1->SetFrameLineWidth(2);
   c1->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: pad2
   TPad *pad2 = new TPad("pad2", "pad2",0,0,1,0.3);
   pad2->Draw();
   pad2->cd();
   pad2->Range(1075.63,-26.4,1149.704,8.8);
   pad2->SetFillColor(0);
   pad2->SetBorderMode(0);
   pad2->SetBorderSize(2);
   pad2->SetTickx(1);
   pad2->SetTicky(1);
   pad2->SetLeftMargin(0.14);
   pad2->SetRightMargin(0.05);
   pad2->SetTopMargin(0);
   pad2->SetBottomMargin(0.5);
   pad2->SetFrameLineWidth(2);
   pad2->SetFrameBorderMode(0);
   pad2->SetFrameLineWidth(2);
   pad2->SetFrameBorderMode(0);
   
   TH1D *frame_3eff460__1 = new TH1D("frame_3eff460__1","",100,1086,1146);
   frame_3eff460__1->SetBinContent(1,3.875628);
   frame_3eff460__1->SetMinimum(-8.8);
   frame_3eff460__1->SetMaximum(8.8);
   frame_3eff460__1->SetEntries(1);
   frame_3eff460__1->SetDirectory(0);
   frame_3eff460__1->SetStats(0);
   frame_3eff460__1->SetLineWidth(2);
   frame_3eff460__1->SetMarkerStyle(20);
   frame_3eff460__1->GetXaxis()->SetTitle("#Lambda mass (MeV)");
   frame_3eff460__1->GetXaxis()->SetNdivisions(505);
   frame_3eff460__1->GetXaxis()->SetLabelFont(132);
   frame_3eff460__1->GetXaxis()->SetLabelOffset(0.01);
   frame_3eff460__1->GetXaxis()->SetLabelSize(0.15);
   frame_3eff460__1->GetXaxis()->SetTitleSize(0.2);
   frame_3eff460__1->GetXaxis()->SetTitleOffset(1.1);
   frame_3eff460__1->GetXaxis()->SetTitleFont(132);
   frame_3eff460__1->GetYaxis()->SetTitle("Pull");
   frame_3eff460__1->GetYaxis()->CenterTitle(true);
   frame_3eff460__1->GetYaxis()->SetNdivisions(505);
   frame_3eff460__1->GetYaxis()->SetLabelFont(132);
   frame_3eff460__1->GetYaxis()->SetLabelOffset(0.01);
   frame_3eff460__1->GetYaxis()->SetLabelSize(0.15);
   frame_3eff460__1->GetYaxis()->SetTitleSize(0.15);
   frame_3eff460__1->GetYaxis()->SetTitleOffset(0.45);
   frame_3eff460__1->GetYaxis()->SetTitleFont(132);
   frame_3eff460__1->GetZaxis()->SetLabelFont(132);
   frame_3eff460__1->GetZaxis()->SetLabelSize(0.06);
   frame_3eff460__1->GetZaxis()->SetTitleSize(0.072);
   frame_3eff460__1->GetZaxis()->SetTitleOffset(1.2);
   frame_3eff460__1->GetZaxis()->SetTitleFont(132);
   frame_3eff460__1->Draw("FUNC");
   
   Double_t pull_Hist_curvetot_fx3001[100] = {
   1086.3,
   1086.9,
   1087.5,
   1088.1,
   1088.7,
   1089.3,
   1089.9,
   1090.5,
   1091.1,
   1091.7,
   1092.3,
   1092.9,
   1093.5,
   1094.1,
   1094.7,
   1095.3,
   1095.9,
   1096.5,
   1097.1,
   1097.7,
   1098.3,
   1098.9,
   1099.5,
   1100.1,
   1100.7,
   1101.3,
   1101.9,
   1102.5,
   1103.1,
   1103.7,
   1104.3,
   1104.9,
   1105.5,
   1106.1,
   1106.7,
   1107.3,
   1107.9,
   1108.5,
   1109.1,
   1109.7,
   1110.3,
   1110.9,
   1111.5,
   1112.1,
   1112.7,
   1113.3,
   1113.9,
   1114.5,
   1115.1,
   1115.7,
   1116.3,
   1116.9,
   1117.5,
   1118.1,
   1118.7,
   1119.3,
   1119.9,
   1120.5,
   1121.1,
   1121.7,
   1122.3,
   1122.9,
   1123.5,
   1124.1,
   1124.7,
   1125.3,
   1125.9,
   1126.5,
   1127.1,
   1127.7,
   1128.3,
   1128.9,
   1129.5,
   1130.1,
   1130.7,
   1131.3,
   1131.9,
   1132.5,
   1133.1,
   1133.7,
   1134.3,
   1134.9,
   1135.5,
   1136.1,
   1136.7,
   1137.3,
   1137.9,
   1138.5,
   1139.1,
   1139.7,
   1140.3,
   1140.9,
   1141.5,
   1142.1,
   1142.7,
   1143.3,
   1143.9,
   1144.5,
   1145.1,
   1145.7};
   Double_t pull_Hist_curvetot_fy3001[100] = {
   0.9512912,
   0.883351,
   0.1548353,
   0.7510138,
   -0.02897719,
   -0.118378,
   0.561366,
   0,
   -0.3765588,
   -0.4592785,
   -0.5403279,
   0,
   0.2139593,
   0,
   -0.8478228,
   -0.9205208,
   0,
   0.969547,
   -1.128593,
   0.902695,
   -0.18311,
   -1.321633,
   0,
   0,
   -0.3532991,
   -1.555636,
   -1.609962,
   -0.4685441,
   -0.504611,
   -1.763031,
   -0.5734706,
   -1.858166,
   1.800879,
   0.02262506,
   -0.02043063,
   -0.09438004,
   1.053636,
   -1.380581,
   -1.177628,
   1.625469,
   0.3098203,
   -2.75568,
   -2.146013,
   -3.314961,
   0.1221816,
   -2.261606,
   0.4337666,
   -0.1938409,
   0.9558935,
   0.8158385,
   -1.4281,
   -1.47963,
   0.7996723,
   0.9944353,
   2.145797,
   2.4856,
   -0.4572304,
   -1.249876,
   -1.463024,
   1.82233,
   1.717098,
   0.5503893,
   1.146609,
   -1.168029,
   1.014951,
   0.2735732,
   0.7056306,
   0.2990673,
   1.631963,
   0.7307242,
   1.083193,
   0.337073,
   0.3483316,
   -0.1611711,
   1.121332,
   0.3871056,
   -0.1135068,
   -0.09569017,
   -2.133211,
   0.4504947,
   -0.7517538,
   -0.01478014,
   0,
   -1.945508,
   0.5485216,
   -0.6072175,
   0,
   -0.5411355,
   -0.5063229,
   0.1933281,
   0.2236811,
   0.7208352,
   -1.502416,
   -1.444832,
   -0.2726449,
   -1.324654,
   -0.1853037,
   0.4631539,
   0.9340706,
   -1.064253};
   Double_t pull_Hist_curvetot_felx3001[100] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t pull_Hist_curvetot_fely3001[100] = {
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   0,
   1,
   1,
   1,
   0,
   1,
   0,
   1,
   1,
   0,
   1,
   1,
   1,
   1,
   1,
   0,
   0,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   0,
   1,
   1,
   1,
   0,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1};
   Double_t pull_Hist_curvetot_fehx3001[100] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t pull_Hist_curvetot_fehy3001[100] = {
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   0,
   1,
   1,
   1,
   0,
   1,
   0,
   1,
   1,
   0,
   1,
   1,
   1,
   1,
   1,
   0,
   0,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   0,
   1,
   1,
   1,
   0,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1};
   TGraphAsymmErrors *grae = new TGraphAsymmErrors(100,pull_Hist_curvetot_fx3001,pull_Hist_curvetot_fy3001,pull_Hist_curvetot_felx3001,pull_Hist_curvetot_fehx3001,pull_Hist_curvetot_fely3001,pull_Hist_curvetot_fehy3001);
   grae->SetName("pull_Hist_curvetot");
   grae->SetTitle("Pull of Histogram of data_plot__R_M and Projection of totalPdf");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(8);
   
   TH1F *Graph_pull_Hist_curvetot3001 = new TH1F("Graph_pull_Hist_curvetot3001","Pull of Histogram of data_plot__R_M and Projection of totalPdf",100,1080.36,1151.64);
   Graph_pull_Hist_curvetot3001->SetMinimum(-5.095017);
   Graph_pull_Hist_curvetot3001->SetMaximum(4.265656);
   Graph_pull_Hist_curvetot3001->SetDirectory(0);
   Graph_pull_Hist_curvetot3001->SetStats(0);
   Graph_pull_Hist_curvetot3001->SetLineWidth(2);
   Graph_pull_Hist_curvetot3001->SetMarkerStyle(20);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetNdivisions(505);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetLabelFont(132);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetLabelOffset(0.01);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetLabelSize(0.06);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetTitleSize(0.072);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetTitleOffset(0.95);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetTitleFont(132);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetLabelFont(132);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetLabelOffset(0.01);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetLabelSize(0.06);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetTitleSize(0.072);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetTitleOffset(0.95);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetTitleFont(132);
   Graph_pull_Hist_curvetot3001->GetZaxis()->SetLabelFont(132);
   Graph_pull_Hist_curvetot3001->GetZaxis()->SetLabelSize(0.06);
   Graph_pull_Hist_curvetot3001->GetZaxis()->SetTitleSize(0.072);
   Graph_pull_Hist_curvetot3001->GetZaxis()->SetTitleOffset(1.2);
   Graph_pull_Hist_curvetot3001->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_pull_Hist_curvetot3001);
   
   grae->Draw("p");
   
   TH1D *frame_3eff460__2 = new TH1D("frame_3eff460__2","",100,1086,1146);
   frame_3eff460__2->SetBinContent(1,3.875628);
   frame_3eff460__2->SetMinimum(-8.8);
   frame_3eff460__2->SetMaximum(8.8);
   frame_3eff460__2->SetEntries(1);
   frame_3eff460__2->SetDirectory(0);
   frame_3eff460__2->SetStats(0);
   frame_3eff460__2->SetLineWidth(2);
   frame_3eff460__2->SetMarkerStyle(20);
   frame_3eff460__2->GetXaxis()->SetTitle("#Lambda mass (MeV)");
   frame_3eff460__2->GetXaxis()->SetNdivisions(505);
   frame_3eff460__2->GetXaxis()->SetLabelFont(132);
   frame_3eff460__2->GetXaxis()->SetLabelOffset(0.01);
   frame_3eff460__2->GetXaxis()->SetLabelSize(0.15);
   frame_3eff460__2->GetXaxis()->SetTitleSize(0.2);
   frame_3eff460__2->GetXaxis()->SetTitleOffset(1.1);
   frame_3eff460__2->GetXaxis()->SetTitleFont(132);
   frame_3eff460__2->GetYaxis()->SetTitle("Pull");
   frame_3eff460__2->GetYaxis()->CenterTitle(true);
   frame_3eff460__2->GetYaxis()->SetNdivisions(505);
   frame_3eff460__2->GetYaxis()->SetLabelFont(132);
   frame_3eff460__2->GetYaxis()->SetLabelOffset(0.01);
   frame_3eff460__2->GetYaxis()->SetLabelSize(0.15);
   frame_3eff460__2->GetYaxis()->SetTitleSize(0.15);
   frame_3eff460__2->GetYaxis()->SetTitleOffset(0.45);
   frame_3eff460__2->GetYaxis()->SetTitleFont(132);
   frame_3eff460__2->GetZaxis()->SetLabelFont(132);
   frame_3eff460__2->GetZaxis()->SetLabelSize(0.06);
   frame_3eff460__2->GetZaxis()->SetTitleSize(0.072);
   frame_3eff460__2->GetZaxis()->SetTitleOffset(1.2);
   frame_3eff460__2->GetZaxis()->SetTitleFont(132);
   frame_3eff460__2->Draw("AXISSAME");
   pad2->Modified();
   c1->cd();
  
// ------------>Primitives in pad: pad1
   TPad *pad1 = new TPad("pad1", "pad1",0,0.3,1,1);
   pad1->Draw();
   pad1->cd();
   pad1->Range(1075.63,0,1149.704,4.122406);
   pad1->SetFillColor(0);
   pad1->SetBorderMode(0);
   pad1->SetBorderSize(2);
   pad1->SetLogy();
   pad1->SetTickx(1);
   pad1->SetTicky(1);
   pad1->SetLeftMargin(0.14);
   pad1->SetRightMargin(0.05);
   pad1->SetTopMargin(0.06);
   pad1->SetBottomMargin(0);
   pad1->SetFrameLineWidth(2);
   pad1->SetFrameBorderMode(0);
   pad1->SetFrameLineWidth(2);
   pad1->SetFrameBorderMode(0);
   
   TH1D *frame_3cf79b0__3 = new TH1D("frame_3cf79b0__3","A RooPlot of \"#Lambda mass\"",100,1086,1146);
   frame_3cf79b0__3->SetBinContent(1,1119.464);
   frame_3cf79b0__3->SetMinimum(1);
   frame_3cf79b0__3->SetMaximum(7500);
   frame_3cf79b0__3->SetEntries(1);
   frame_3cf79b0__3->SetDirectory(0);
   frame_3cf79b0__3->SetStats(0);
   frame_3cf79b0__3->SetLineWidth(2);
   frame_3cf79b0__3->SetMarkerStyle(20);
   frame_3cf79b0__3->GetXaxis()->SetTitle("#Lambda mass (MeV)");
   frame_3cf79b0__3->GetXaxis()->SetNdivisions(505);
   frame_3cf79b0__3->GetXaxis()->SetLabelFont(132);
   frame_3cf79b0__3->GetXaxis()->SetLabelOffset(0.01);
   frame_3cf79b0__3->GetXaxis()->SetLabelSize(0.06);
   frame_3cf79b0__3->GetXaxis()->SetTitleSize(0.072);
   frame_3cf79b0__3->GetXaxis()->SetTitleOffset(0.95);
   frame_3cf79b0__3->GetXaxis()->SetTitleFont(132);
   frame_3cf79b0__3->GetYaxis()->SetTitle("Events/(5 MeV)");
   frame_3cf79b0__3->GetYaxis()->SetLabelFont(132);
   frame_3cf79b0__3->GetYaxis()->SetLabelOffset(0.01);
   frame_3cf79b0__3->GetYaxis()->SetLabelSize(0.06);
   frame_3cf79b0__3->GetYaxis()->SetTitleSize(0.072);
   frame_3cf79b0__3->GetYaxis()->SetTitleOffset(0.95);
   frame_3cf79b0__3->GetYaxis()->SetTitleFont(132);
   frame_3cf79b0__3->GetZaxis()->SetLabelFont(132);
   frame_3cf79b0__3->GetZaxis()->SetLabelSize(0.06);
   frame_3cf79b0__3->GetZaxis()->SetTitleSize(0.072);
   frame_3cf79b0__3->GetZaxis()->SetTitleOffset(1.2);
   frame_3cf79b0__3->GetZaxis()->SetTitleFont(132);
   frame_3cf79b0__3->Draw("FUNC");
   
   Double_t Hist_fx3002[100] = {
   1086.3,
   1086.9,
   1087.5,
   1088.1,
   1088.7,
   1089.3,
   1089.9,
   1090.5,
   1091.1,
   1091.7,
   1092.3,
   1092.9,
   1093.5,
   1094.1,
   1094.7,
   1095.3,
   1095.9,
   1096.5,
   1097.1,
   1097.7,
   1098.3,
   1098.9,
   1099.5,
   1100.1,
   1100.7,
   1101.3,
   1101.9,
   1102.5,
   1103.1,
   1103.7,
   1104.3,
   1104.9,
   1105.5,
   1106.1,
   1106.7,
   1107.3,
   1107.9,
   1108.5,
   1109.1,
   1109.7,
   1110.3,
   1110.9,
   1111.5,
   1112.1,
   1112.7,
   1113.3,
   1113.9,
   1114.5,
   1115.1,
   1115.7,
   1116.3,
   1116.9,
   1117.5,
   1118.1,
   1118.7,
   1119.3,
   1119.9,
   1120.5,
   1121.1,
   1121.7,
   1122.3,
   1122.9,
   1123.5,
   1124.1,
   1124.7,
   1125.3,
   1125.9,
   1126.5,
   1127.1,
   1127.7,
   1128.3,
   1128.9,
   1129.5,
   1130.1,
   1130.7,
   1131.3,
   1131.9,
   1132.5,
   1133.1,
   1133.7,
   1134.3,
   1134.9,
   1135.5,
   1136.1,
   1136.7,
   1137.3,
   1137.9,
   1138.5,
   1139.1,
   1139.7,
   1140.3,
   1140.9,
   1141.5,
   1142.1,
   1142.7,
   1143.3,
   1143.9,
   1144.5,
   1145.1,
   1145.7};
   Double_t Hist_fy3002[100] = {
   2,
   2,
   1,
   2,
   1,
   1,
   2,
   0,
   1,
   1,
   1,
   0,
   2,
   0,
   1,
   1,
   0,
   4,
   1,
   4,
   2,
   1,
   0,
   0,
   2,
   1,
   1,
   2,
   2,
   1,
   2,
   1,
   8,
   3,
   3,
   3,
   6,
   2,
   3,
   13,
   12,
   9,
   18,
   25,
   63,
   83,
   216,
   442,
   813,
   1034,
   864,
   545,
   301,
   147,
   96,
   69,
   30,
   16,
   9,
   16,
   12,
   6,
   7,
   2,
   6,
   4,
   5,
   4,
   8,
   5,
   6,
   4,
   4,
   3,
   6,
   4,
   3,
   3,
   1,
   4,
   2,
   3,
   0,
   1,
   4,
   2,
   0,
   2,
   2,
   3,
   3,
   4,
   1,
   1,
   2,
   1,
   2,
   3,
   4,
   1};
   Double_t Hist_felx3002[100] = {
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3};
   Double_t Hist_fely3002[100] = {
   1.414214,
   1.414214,
   1,
   1.414214,
   1,
   1,
   1.414214,
   0,
   1,
   1,
   1,
   0,
   1.414214,
   0,
   1,
   1,
   0,
   2,
   1,
   2,
   1.414214,
   1,
   0,
   0,
   1.414214,
   1,
   1,
   1.414214,
   1.414214,
   1,
   1.414214,
   1,
   2.828427,
   1.732051,
   1.732051,
   1.732051,
   2.44949,
   1.414214,
   1.732051,
   3.605551,
   3.464102,
   3,
   4.242641,
   5,
   7.937254,
   9.110434,
   14.69694,
   21.0238,
   28.51315,
   32.15587,
   29.39388,
   23.34524,
   17.34935,
   12.12436,
   9.797959,
   8.306624,
   5.477226,
   4,
   3,
   4,
   3.464102,
   2.44949,
   2.645751,
   1.414214,
   2.44949,
   2,
   2.236068,
   2,
   2.828427,
   2.236068,
   2.44949,
   2,
   2,
   1.732051,
   2.44949,
   2,
   1.732051,
   1.732051,
   1,
   2,
   1.414214,
   1.732051,
   0,
   1,
   2,
   1.414214,
   0,
   1.414214,
   1.414214,
   1.732051,
   1.732051,
   2,
   1,
   1,
   1.414214,
   1,
   1.414214,
   1.732051,
   2,
   1};
   Double_t Hist_fehx3002[100] = {
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3};
   Double_t Hist_fehy3002[100] = {
   1.414214,
   1.414214,
   1,
   1.414214,
   1,
   1,
   1.414214,
   0,
   1,
   1,
   1,
   0,
   1.414214,
   0,
   1,
   1,
   0,
   2,
   1,
   2,
   1.414214,
   1,
   0,
   0,
   1.414214,
   1,
   1,
   1.414214,
   1.414214,
   1,
   1.414214,
   1,
   2.828427,
   1.732051,
   1.732051,
   1.732051,
   2.44949,
   1.414214,
   1.732051,
   3.605551,
   3.464102,
   3,
   4.242641,
   5,
   7.937254,
   9.110434,
   14.69694,
   21.0238,
   28.51315,
   32.15587,
   29.39388,
   23.34524,
   17.34935,
   12.12436,
   9.797959,
   8.306624,
   5.477226,
   4,
   3,
   4,
   3.464102,
   2.44949,
   2.645751,
   1.414214,
   2.44949,
   2,
   2.236068,
   2,
   2.828427,
   2.236068,
   2.44949,
   2,
   2,
   1.732051,
   2.44949,
   2,
   1.732051,
   1.732051,
   1,
   2,
   1.414214,
   1.732051,
   0,
   1,
   2,
   1.414214,
   0,
   1.414214,
   1.414214,
   1.732051,
   1.732051,
   2,
   1,
   1,
   1.414214,
   1,
   1.414214,
   1.732051,
   2,
   1};
   grae = new TGraphAsymmErrors(100,Hist_fx3002,Hist_fy3002,Hist_felx3002,Hist_fehx3002,Hist_fely3002,Hist_fehy3002);
   grae->SetName("Hist");
   grae->SetTitle("Histogram of data_plot__R_M");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(8);
   
   TH1F *Graph_Hist3002 = new TH1F("Graph_Hist3002","Histogram of data_plot__R_M",100,1080,1152);
   Graph_Hist3002->SetMinimum(1.172771);
   Graph_Hist3002->SetMaximum(1172.771);
   Graph_Hist3002->SetDirectory(0);
   Graph_Hist3002->SetStats(0);
   Graph_Hist3002->SetLineWidth(2);
   Graph_Hist3002->SetMarkerStyle(20);
   Graph_Hist3002->GetXaxis()->SetNdivisions(505);
   Graph_Hist3002->GetXaxis()->SetLabelFont(132);
   Graph_Hist3002->GetXaxis()->SetLabelOffset(0.01);
   Graph_Hist3002->GetXaxis()->SetLabelSize(0.06);
   Graph_Hist3002->GetXaxis()->SetTitleSize(0.072);
   Graph_Hist3002->GetXaxis()->SetTitleOffset(0.95);
   Graph_Hist3002->GetXaxis()->SetTitleFont(132);
   Graph_Hist3002->GetYaxis()->SetLabelFont(132);
   Graph_Hist3002->GetYaxis()->SetLabelOffset(0.01);
   Graph_Hist3002->GetYaxis()->SetLabelSize(0.06);
   Graph_Hist3002->GetYaxis()->SetTitleSize(0.072);
   Graph_Hist3002->GetYaxis()->SetTitleOffset(0.95);
   Graph_Hist3002->GetYaxis()->SetTitleFont(132);
   Graph_Hist3002->GetZaxis()->SetLabelFont(132);
   Graph_Hist3002->GetZaxis()->SetLabelSize(0.06);
   Graph_Hist3002->GetZaxis()->SetTitleSize(0.072);
   Graph_Hist3002->GetZaxis()->SetTitleOffset(1.2);
   Graph_Hist3002->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_Hist3002);
   
   grae->Draw("p");
   
   Double_t curvetot_fx1[150] = {
   1086,
   1086.6,
   1087.2,
   1087.8,
   1088.4,
   1089,
   1089.6,
   1090.2,
   1090.8,
   1091.4,
   1092,
   1092.6,
   1093.2,
   1093.8,
   1094.4,
   1095,
   1095.6,
   1096.2,
   1096.8,
   1097.4,
   1098,
   1098.6,
   1099.2,
   1099.8,
   1100.4,
   1101,
   1101.6,
   1102.2,
   1102.8,
   1103.4,
   1104,
   1104.6,
   1105.2,
   1105.8,
   1106.4,
   1107,
   1107.6,
   1108.2,
   1108.8,
   1109.4,
   1110,
   1110.6,
   1111.2,
   1111.8,
   1112.4,
   1112.7,
   1113,
   1113.15,
   1113.3,
   1113.45,
   1113.6,
   1113.75,
   1113.825,
   1113.9,
   1113.975,
   1114.05,
   1114.125,
   1114.2,
   1114.275,
   1114.35,
   1114.425,
   1114.5,
   1114.65,
   1114.8,
   1114.95,
   1115.1,
   1115.175,
   1115.25,
   1115.325,
   1115.4,
   1115.475,
   1115.55,
   1115.625,
   1115.7,
   1115.775,
   1115.85,
   1115.925,
   1116,
   1116.075,
   1116.15,
   1116.225,
   1116.3,
   1116.375,
   1116.45,
   1116.6,
   1116.9,
   1117.05,
   1117.2,
   1117.275,
   1117.35,
   1117.425,
   1117.5,
   1117.575,
   1117.65,
   1117.725,
   1117.8,
   1117.95,
   1118.1,
   1118.25,
   1118.4,
   1118.55,
   1118.7,
   1119,
   1119.3,
   1119.6,
   1120.2,
   1120.8,
   1121.4,
   1122,
   1122.6,
   1123.2,
   1123.8,
   1124.4,
   1125,
   1125.6,
   1126.2,
   1126.8,
   1127.4,
   1128,
   1128.6,
   1129.2,
   1129.8,
   1130.4,
   1131,
   1131.6,
   1132.2,
   1132.8,
   1133.4,
   1134,
   1134.6,
   1135.2,
   1135.8,
   1136.4,
   1137,
   1137.6,
   1138.2,
   1138.8,
   1139.4,
   1140,
   1140.6,
   1141.2,
   1141.8,
   1142.4,
   1143,
   1143.6,
   1144.2,
   1144.8,
   1145.4,
   1146,
   1146};
   Double_t curvetot_fy1[150] = {
   0.6062126,
   0.7031296,
   0.7983764,
   0.891953,
   0.9838592,
   1.074095,
   1.162661,
   1.249556,
   1.334781,
   1.418336,
   1.500221,
   1.580435,
   1.658979,
   1.735853,
   1.811056,
   1.884589,
   1.956452,
   2.026645,
   2.095167,
   2.162019,
   2.227201,
   2.290712,
   2.352554,
   2.412725,
   2.471225,
   2.528056,
   2.583216,
   2.636708,
   2.688535,
   2.73872,
   2.787341,
   2.834679,
   2.881652,
   2.931039,
   2.990586,
   3.080188,
   3.246754,
   3.591503,
   4.31337,
   5.766055,
   8.512525,
   13.34098,
   21.1931,
   33.01642,
   50.13319,
   62.03021,
   78.49357,
   89.60889,
   103.6042,
   121.4321,
   144.216,
   173.1953,
   190.4036,
   209.625,
   230.9942,
   254.6259,
   280.6078,
   308.9935,
   339.7956,
   372.979,
   408.4549,
   446.0753,
   526.8424,
   612.8174,
   700.5436,
   785.7445,
   825.9131,
   863.6421,
   898.3277,
   929.3933,
   956.3061,
   978.5922,
   995.8506,
   1007.766,
   1014.118,
   1014.789,
   1009.765,
   999.1411,
   983.1137,
   961.9767,
   936.1119,
   905.9774,
   872.0935,
   835.0281,
   753.7627,
   579.5423,
   495.2118,
   417.1541,
   381.1637,
   347.4366,
   316.075,
   287.1262,
   260.5881,
   236.4159,
   214.5295,
   194.8199,
   161.3932,
   134.9431,
   114.2056,
   97.97649,
   85.19334,
   74.97557,
   59.64116,
   48.35306,
   39.35099,
   25.65771,
   16.34129,
   10.43685,
   6.984517,
   5.119076,
   4.184578,
   3.74814,
   3.555545,
   3.472231,
   3.433477,
   3.410847,
   3.392884,
   3.375339,
   3.356763,
   3.336698,
   3.31501,
   3.291664,
   3.266649,
   3.239966,
   3.211612,
   3.181587,
   3.149893,
   3.116528,
   3.081493,
   3.044788,
   3.006412,
   2.966366,
   2.92465,
   2.881264,
   2.836207,
   2.78948,
   2.741082,
   2.691015,
   2.639277,
   2.585869,
   2.53079,
   2.474042,
   2.415623,
   2.355533,
   2.293774,
   2.230344,
   2.165244,
   2.098474,
   2.030033,
   2.030033};
   TGraph *graph = new TGraph(150,curvetot_fx1,curvetot_fy1);
   graph->SetName("curvetot");
   graph->SetTitle("Projection of totalPdf");
   graph->SetFillColor(1);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#0000ff");
   graph->SetLineColor(ci);
   graph->SetLineWidth(3);
   graph->SetMarkerStyle(20);
   
   TH1F *Graph_curvetot1 = new TH1F("Graph_curvetot1","Projection of totalPdf",150,1080,1152);
   Graph_curvetot1->SetMinimum(0.5455913);
   Graph_curvetot1->SetMaximum(1116.207);
   Graph_curvetot1->SetDirectory(0);
   Graph_curvetot1->SetStats(0);
   Graph_curvetot1->SetLineWidth(2);
   Graph_curvetot1->SetMarkerStyle(20);
   Graph_curvetot1->GetXaxis()->SetNdivisions(505);
   Graph_curvetot1->GetXaxis()->SetLabelFont(132);
   Graph_curvetot1->GetXaxis()->SetLabelOffset(0.01);
   Graph_curvetot1->GetXaxis()->SetLabelSize(0.06);
   Graph_curvetot1->GetXaxis()->SetTitleSize(0.072);
   Graph_curvetot1->GetXaxis()->SetTitleOffset(0.95);
   Graph_curvetot1->GetXaxis()->SetTitleFont(132);
   Graph_curvetot1->GetYaxis()->SetLabelFont(132);
   Graph_curvetot1->GetYaxis()->SetLabelOffset(0.01);
   Graph_curvetot1->GetYaxis()->SetLabelSize(0.06);
   Graph_curvetot1->GetYaxis()->SetTitleSize(0.072);
   Graph_curvetot1->GetYaxis()->SetTitleOffset(0.95);
   Graph_curvetot1->GetYaxis()->SetTitleFont(132);
   Graph_curvetot1->GetZaxis()->SetLabelFont(132);
   Graph_curvetot1->GetZaxis()->SetLabelSize(0.06);
   Graph_curvetot1->GetZaxis()->SetTitleSize(0.072);
   Graph_curvetot1->GetZaxis()->SetTitleOffset(1.2);
   Graph_curvetot1->GetZaxis()->SetTitleFont(132);
   graph->SetHistogram(Graph_curvetot1);
   
   graph->Draw("l");
   
   Double_t bkg_fx2[102] = {
   1086,
   1086.6,
   1087.2,
   1087.8,
   1088.4,
   1089,
   1089.6,
   1090.2,
   1090.8,
   1091.4,
   1092,
   1092.6,
   1093.2,
   1093.8,
   1094.4,
   1095,
   1095.6,
   1096.2,
   1096.8,
   1097.4,
   1098,
   1098.6,
   1099.2,
   1099.8,
   1100.4,
   1101,
   1101.6,
   1102.2,
   1102.8,
   1103.4,
   1104,
   1104.6,
   1105.2,
   1105.8,
   1106.4,
   1107,
   1107.6,
   1108.2,
   1108.8,
   1109.4,
   1110,
   1110.6,
   1111.2,
   1111.8,
   1112.4,
   1113,
   1113.6,
   1114.2,
   1114.8,
   1115.4,
   1116,
   1116.6,
   1117.2,
   1117.8,
   1118.4,
   1119,
   1119.6,
   1120.2,
   1120.8,
   1121.4,
   1122,
   1122.6,
   1123.2,
   1123.8,
   1124.4,
   1125,
   1125.6,
   1126.2,
   1126.8,
   1127.4,
   1128,
   1128.6,
   1129.2,
   1129.8,
   1130.4,
   1131,
   1131.6,
   1132.2,
   1132.8,
   1133.4,
   1134,
   1134.6,
   1135.2,
   1135.8,
   1136.4,
   1137,
   1137.6,
   1138.2,
   1138.8,
   1139.4,
   1140,
   1140.6,
   1141.2,
   1141.8,
   1142.4,
   1143,
   1143.6,
   1144.2,
   1144.8,
   1145.4,
   1146,
   1146};
   Double_t bkg_fy2[102] = {
   0.6062126,
   0.7031296,
   0.7983764,
   0.891953,
   0.9838592,
   1.074095,
   1.162661,
   1.249556,
   1.334781,
   1.418336,
   1.500221,
   1.580435,
   1.658979,
   1.735853,
   1.811056,
   1.884589,
   1.956452,
   2.026645,
   2.095167,
   2.162019,
   2.227201,
   2.290712,
   2.352554,
   2.412725,
   2.471225,
   2.528056,
   2.583216,
   2.636705,
   2.688525,
   2.738674,
   2.787153,
   2.833962,
   2.8791,
   2.922568,
   2.964366,
   3.004494,
   3.042951,
   3.079738,
   3.114855,
   3.148301,
   3.180077,
   3.210183,
   3.238619,
   3.265384,
   3.290479,
   3.313904,
   3.335658,
   3.355742,
   3.374156,
   3.3909,
   3.405973,
   3.419376,
   3.431109,
   3.441172,
   3.449564,
   3.456286,
   3.461337,
   3.464719,
   3.46643,
   3.466471,
   3.464841,
   3.461541,
   3.456571,
   3.449931,
   3.441621,
   3.43164,
   3.419989,
   3.406667,
   3.391675,
   3.375013,
   3.356681,
   3.336679,
   3.315006,
   3.291663,
   3.266649,
   3.239966,
   3.211612,
   3.181587,
   3.149893,
   3.116528,
   3.081493,
   3.044788,
   3.006412,
   2.966366,
   2.92465,
   2.881264,
   2.836207,
   2.78948,
   2.741082,
   2.691015,
   2.639277,
   2.585869,
   2.53079,
   2.474042,
   2.415623,
   2.355533,
   2.293774,
   2.230344,
   2.165244,
   2.098474,
   2.030033,
   2.030033};
   graph = new TGraph(102,bkg_fx2,bkg_fy2);
   graph->SetName("bkg");
   graph->SetTitle("Projection of totalPdf");
   graph->SetFillColor(1);
   graph->SetLineColor(2);
   graph->SetLineStyle(2);
   graph->SetLineWidth(3);
   graph->SetMarkerStyle(20);
   
   TH1F *Graph_bkg2 = new TH1F("Graph_bkg2","Projection of totalPdf",102,1080,1152);
   Graph_bkg2->SetMinimum(0.3201867);
   Graph_bkg2->SetMaximum(3.752497);
   Graph_bkg2->SetDirectory(0);
   Graph_bkg2->SetStats(0);
   Graph_bkg2->SetLineWidth(2);
   Graph_bkg2->SetMarkerStyle(20);
   Graph_bkg2->GetXaxis()->SetNdivisions(505);
   Graph_bkg2->GetXaxis()->SetLabelFont(132);
   Graph_bkg2->GetXaxis()->SetLabelOffset(0.01);
   Graph_bkg2->GetXaxis()->SetLabelSize(0.06);
   Graph_bkg2->GetXaxis()->SetTitleSize(0.072);
   Graph_bkg2->GetXaxis()->SetTitleOffset(0.95);
   Graph_bkg2->GetXaxis()->SetTitleFont(132);
   Graph_bkg2->GetYaxis()->SetLabelFont(132);
   Graph_bkg2->GetYaxis()->SetLabelOffset(0.01);
   Graph_bkg2->GetYaxis()->SetLabelSize(0.06);
   Graph_bkg2->GetYaxis()->SetTitleSize(0.072);
   Graph_bkg2->GetYaxis()->SetTitleOffset(0.95);
   Graph_bkg2->GetYaxis()->SetTitleFont(132);
   Graph_bkg2->GetZaxis()->SetLabelFont(132);
   Graph_bkg2->GetZaxis()->SetLabelSize(0.06);
   Graph_bkg2->GetZaxis()->SetTitleSize(0.072);
   Graph_bkg2->GetZaxis()->SetTitleOffset(1.2);
   Graph_bkg2->GetZaxis()->SetTitleFont(132);
   graph->SetHistogram(Graph_bkg2);
   
   graph->Draw("l");
   
   Double_t sigLM_fx3[150] = {
   1086,
   1086.6,
   1087.2,
   1087.8,
   1088.4,
   1089,
   1089.6,
   1090.2,
   1090.8,
   1091.4,
   1092,
   1092.6,
   1093.2,
   1093.8,
   1094.4,
   1095,
   1095.6,
   1096.2,
   1096.8,
   1097.4,
   1098,
   1098.6,
   1099.2,
   1099.8,
   1100.4,
   1101,
   1101.6,
   1102.2,
   1102.8,
   1103.4,
   1104,
   1104.6,
   1105.2,
   1105.8,
   1106.4,
   1107,
   1107.6,
   1108.2,
   1108.8,
   1109.4,
   1110,
   1110.6,
   1111.2,
   1111.8,
   1112.4,
   1112.7,
   1113,
   1113.15,
   1113.3,
   1113.45,
   1113.6,
   1113.75,
   1113.825,
   1113.9,
   1113.975,
   1114.05,
   1114.125,
   1114.2,
   1114.275,
   1114.35,
   1114.425,
   1114.5,
   1114.65,
   1114.8,
   1114.95,
   1115.1,
   1115.175,
   1115.25,
   1115.325,
   1115.4,
   1115.475,
   1115.55,
   1115.625,
   1115.7,
   1115.775,
   1115.85,
   1115.925,
   1116,
   1116.075,
   1116.15,
   1116.225,
   1116.3,
   1116.375,
   1116.45,
   1116.6,
   1116.9,
   1117.05,
   1117.2,
   1117.275,
   1117.35,
   1117.425,
   1117.5,
   1117.575,
   1117.65,
   1117.725,
   1117.8,
   1117.95,
   1118.1,
   1118.25,
   1118.4,
   1118.55,
   1118.7,
   1119,
   1119.3,
   1119.6,
   1120.2,
   1120.8,
   1121.4,
   1122,
   1122.6,
   1123.2,
   1123.8,
   1124.4,
   1125,
   1125.6,
   1126.2,
   1126.8,
   1127.4,
   1128,
   1128.6,
   1129.2,
   1129.8,
   1130.4,
   1131,
   1131.6,
   1132.2,
   1132.8,
   1133.4,
   1134,
   1134.6,
   1135.2,
   1135.8,
   1136.4,
   1137,
   1137.6,
   1138.2,
   1138.8,
   1139.4,
   1140,
   1140.6,
   1141.2,
   1141.8,
   1142.4,
   1143,
   1143.6,
   1144.2,
   1144.8,
   1145.4,
   1146,
   1146};
   Double_t sigLM_fy3[150] = {
   5.530582e-36,
   1.709941e-34,
   4.930645e-33,
   1.325986e-31,
   3.325727e-30,
   7.779412e-29,
   1.697147e-27,
   3.453064e-26,
   6.552428e-25,
   1.159611e-23,
   1.91397e-22,
   2.946254e-21,
   4.229781e-20,
   5.663411e-19,
   7.072138e-18,
   8.23637e-17,
   8.946095e-16,
   9.062409e-15,
   8.561824e-14,
   7.543996e-13,
   6.199392e-12,
   4.751265e-11,
   3.396111e-10,
   2.263951e-09,
   1.407553e-08,
   8.161589e-08,
   4.413645e-07,
   2.226038e-06,
   1.047081e-05,
   4.593463e-05,
   0.0001879372,
   0.0007171301,
   0.002552087,
   0.008470434,
   0.02621973,
   0.07569433,
   0.2038032,
   0.5117656,
   1.198515,
   2.617754,
   5.332448,
   10.13079,
   17.95448,
   29.75104,
   46.84271,
   58.72781,
   75.17966,
   86.28939,
   100.2792,
   118.1017,
   140.8803,
   169.8545,
   187.0602,
   206.279,
   227.6458,
   251.2751,
   277.2545,
   305.6377,
   336.4374,
   369.6185,
   405.092,
   442.7101,
   523.4727,
   609.4432,
   697.1651,
   782.3617,
   822.5283,
   860.2552,
   894.9388,
   926.0024,
   952.9133,
   975.1973,
   992.4538,
   1004.367,
   1010.718,
   1011.386,
   1006.361,
   995.7352,
   979.706,
   958.5672,
   932.7007,
   902.5645,
   868.679,
   831.6119,
   750.3434,
   576.1169,
   491.7835,
   413.723,
   377.7313,
   344.0028,
   312.64,
   283.6899,
   257.1505,
   232.9771,
   211.0895,
   191.3787,
   157.9498,
   131.4975,
   110.758,
   94.52692,
   81.74194,
   71.52244,
   56.18488,
   44.89404,
   35.88966,
   22.193,
   12.87486,
   6.970376,
   3.519676,
   1.657535,
   0.7280064,
   0.2982086,
   0.1139247,
   0.04059082,
   0.01348809,
   0.004180087,
   0.001208183,
   0.0003256813,
   8.187766e-05,
   1.919775e-05,
   4.198053e-06,
   8.561659e-07,
   1.628473e-07,
   2.888787e-08,
   4.779285e-09,
   7.374337e-10,
   1.061196e-10,
   1.424231e-11,
   1.782699e-12,
   2.081076e-13,
   2.265742e-14,
   2.300623e-15,
   2.178677e-16,
   1.924212e-17,
   1.584986e-18,
   1.217616e-19,
   8.723842e-21,
   5.829318e-22,
   3.63279e-23,
   2.111423e-24,
   1.144518e-25,
   5.786056e-27,
   2.728067e-28,
   1.19961e-29,
   4.919687e-31,
   1.881687e-32,
   6.712278e-34,
   2.233083e-35,
   6.928709e-37,
   6.928709e-37};
   graph = new TGraph(150,sigLM_fx3,sigLM_fy3);
   graph->SetName("sigLM");
   graph->SetTitle("Projection of totalPdf");
   graph->SetFillColor(1);
   graph->SetLineColor(3);
   graph->SetLineStyle(2);
   graph->SetLineWidth(3);
   graph->SetMarkerStyle(20);
   
   TH1F *Graph_sigLM3 = new TH1F("Graph_sigLM3","Projection of totalPdf",150,1080,1152);
   Graph_sigLM3->SetMinimum(6.235838e-37);
   Graph_sigLM3->SetMaximum(1112.525);
   Graph_sigLM3->SetDirectory(0);
   Graph_sigLM3->SetStats(0);
   Graph_sigLM3->SetLineWidth(2);
   Graph_sigLM3->SetMarkerStyle(20);
   Graph_sigLM3->GetXaxis()->SetNdivisions(505);
   Graph_sigLM3->GetXaxis()->SetLabelFont(132);
   Graph_sigLM3->GetXaxis()->SetLabelOffset(0.01);
   Graph_sigLM3->GetXaxis()->SetLabelSize(0.06);
   Graph_sigLM3->GetXaxis()->SetTitleSize(0.072);
   Graph_sigLM3->GetXaxis()->SetTitleOffset(0.95);
   Graph_sigLM3->GetXaxis()->SetTitleFont(132);
   Graph_sigLM3->GetYaxis()->SetLabelFont(132);
   Graph_sigLM3->GetYaxis()->SetLabelOffset(0.01);
   Graph_sigLM3->GetYaxis()->SetLabelSize(0.06);
   Graph_sigLM3->GetYaxis()->SetTitleSize(0.072);
   Graph_sigLM3->GetYaxis()->SetTitleOffset(0.95);
   Graph_sigLM3->GetYaxis()->SetTitleFont(132);
   Graph_sigLM3->GetZaxis()->SetLabelFont(132);
   Graph_sigLM3->GetZaxis()->SetLabelSize(0.06);
   Graph_sigLM3->GetZaxis()->SetTitleSize(0.072);
   Graph_sigLM3->GetZaxis()->SetTitleOffset(1.2);
   Graph_sigLM3->GetZaxis()->SetTitleFont(132);
   graph->SetHistogram(Graph_sigLM3);
   
   graph->Draw("l");
   
   TLegend *leg = new TLegend(0.75,0.5,1,0.9,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextFont(132);
   leg->SetTextSize(0.06);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(2);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("curvetot","Total PDF","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("bkg","Background","l");
   entry->SetLineColor(2);
   entry->SetLineStyle(2);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("sigLM","#Lambda M (dbl Gaus)","l");
   entry->SetLineColor(3);
   entry->SetLineStyle(2);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   leg->Draw();
   
   TH1D *frame_3cf79b0__4 = new TH1D("frame_3cf79b0__4","A RooPlot of \"#Lambda mass\"",100,1086,1146);
   frame_3cf79b0__4->SetBinContent(1,1119.464);
   frame_3cf79b0__4->SetMinimum(1);
   frame_3cf79b0__4->SetMaximum(7500);
   frame_3cf79b0__4->SetEntries(1);
   frame_3cf79b0__4->SetDirectory(0);
   frame_3cf79b0__4->SetStats(0);
   frame_3cf79b0__4->SetLineWidth(2);
   frame_3cf79b0__4->SetMarkerStyle(20);
   frame_3cf79b0__4->GetXaxis()->SetTitle("#Lambda mass (MeV)");
   frame_3cf79b0__4->GetXaxis()->SetNdivisions(505);
   frame_3cf79b0__4->GetXaxis()->SetLabelFont(132);
   frame_3cf79b0__4->GetXaxis()->SetLabelOffset(0.01);
   frame_3cf79b0__4->GetXaxis()->SetLabelSize(0.06);
   frame_3cf79b0__4->GetXaxis()->SetTitleSize(0.072);
   frame_3cf79b0__4->GetXaxis()->SetTitleOffset(0.95);
   frame_3cf79b0__4->GetXaxis()->SetTitleFont(132);
   frame_3cf79b0__4->GetYaxis()->SetTitle("Events/(5 MeV)");
   frame_3cf79b0__4->GetYaxis()->SetLabelFont(132);
   frame_3cf79b0__4->GetYaxis()->SetLabelOffset(0.01);
   frame_3cf79b0__4->GetYaxis()->SetLabelSize(0.06);
   frame_3cf79b0__4->GetYaxis()->SetTitleSize(0.072);
   frame_3cf79b0__4->GetYaxis()->SetTitleOffset(0.95);
   frame_3cf79b0__4->GetYaxis()->SetTitleFont(132);
   frame_3cf79b0__4->GetZaxis()->SetLabelFont(132);
   frame_3cf79b0__4->GetZaxis()->SetLabelSize(0.06);
   frame_3cf79b0__4->GetZaxis()->SetTitleSize(0.072);
   frame_3cf79b0__4->GetZaxis()->SetTitleOffset(1.2);
   frame_3cf79b0__4->GetZaxis()->SetTitleFont(132);
   frame_3cf79b0__4->Draw("AXISSAME");
   pad1->Modified();
   c1->cd();
   c1->Modified();
   c1->cd();
   c1->SetSelected(c1);
}
void
draw2DLimitBFstyle(map<string,TList *>& m_contours,
		     const TString& par1,
		     const TString& par2,
		     const TString& plotprefix,
		     TLegend *legend)
{

  //from here we build the two-dimensional aTGC limit

  TCanvas *finalPlot = new TCanvas("final","limits",500,500);
  finalPlot->cd();

  cout << "Drawing +2s" << endl;

  TList *contLevel = m_contours["+2s"];
  TGraph *curv;

  assert(contLevel);

  curv = (TGraph*)(contLevel->First());

  //curv->GetYaxis()->SetRangeUser(-1.25*curv->GetYaxis()->GetXmax(),
	  			   //+2.0*curv->GetYaxis()->GetXmax());
  //curv->GetYaxis()->SetRangeUser(-0.1,0.15);
  curv->GetYaxis()->SetRangeUser(parmin(par2),parmax(par2));

  curv->SetTitle();
  curv->GetXaxis()->SetTitle(par2latex(par1));
  curv->GetXaxis()->SetTitleFont(42);
  curv->GetYaxis()->SetTitle(par2latex(par2));
  curv->GetYaxis()->SetTitleFont(42);
  curv->GetYaxis()->SetTitleOffset(1.20);

  for (int i=0; i<contLevel->GetSize(); i++) {
    assert(curv);
    curv->SetLineColor(kYellow);
    curv->SetFillColor(kYellow);
    curv->GetXaxis()->SetLimits(parmin(par1),parmax(par1));
    if (!i) {
      curv->Draw("ACF");
      legend->AddEntry(curv,"#pm 2#sigma","F");
    } else 
      curv->Draw("SAME CF");
    curv=(TGraph *)(contLevel->After(curv));
  }

  cout << "Drawing +1s" << endl;
  
  contLevel = m_contours["+1s"];

  curv = (TGraph*)(contLevel->First());

  for (int i=0; i<contLevel->GetSize(); i++) {
    curv->SetLineColor(kGreen);
    curv->SetFillColor(kGreen);
    curv->Draw("SAME CF");
    if (!i) legend->AddEntry(curv,"#pm 1#sigma","F");
    curv=(TGraph *)(contLevel->After(curv));
  }

  cout << "Drawing -1s" << endl;

  contLevel = m_contours["-1s"];
  curv = (TGraph*)(contLevel->First());
  for (int i=0; i<contLevel->GetSize(); i++) {
    curv->SetLineColor(kYellow);
    curv->SetFillColor(kYellow);
    curv->Draw("SAME CF");
    curv=(TGraph *)(contLevel->After(curv));
  }

  cout << "Drawing -2s" << endl;
  
  contLevel = m_contours["-2s"];

  if (!contLevel)
    //  this can happen more often for this contour if there is insufficient
    // sensitivity close to the SM
    cerr << "No contour level for +2s, have to fill in the central region" << endl;
  else {
    curv = (TGraph*)(contLevel->First());
    for (int i=0; i<contLevel->GetSize(); i++) {
      curv->SetFillColor(kWhite);
      curv->SetLineColor(kYellow);
      curv->Draw("SAME CF");
      curv=(TGraph *)(contLevel->After(curv));
    }
  }
  cout << "Drawing median" << endl;
  
  curv = (TGraph*)(m_contours["median"]->First());
  curv->SetLineColor(kBlack);
  curv->SetLineWidth(2);
  curv->SetLineStyle(2);
  curv->Draw("SAME C");

  legend->AddEntry(curv,"Expected","L");
  
  cout << "Drawing obs" << endl;

  contLevel = m_contours["obs"];
  curv = (TGraph*)(contLevel->First());
  for (int i=0; i<contLevel->GetSize(); i++) {
    curv->SetLineColor(kBlack);
    curv->SetLineWidth(2);
    curv->Draw("SAME C");
    if (!i) legend->AddEntry(curv,"Observed","L");
    curv=(TGraph *)(contLevel->After(curv));
  }

  
  TGraph *SMpoint = new TGraph(1);
  SMpoint->SetPoint(1,0,0);
  SMpoint->Draw("SAME Po");
  
  // smLabel = TPaveText(0,
  //                     m_contours["-2s"]->GetYaxis()->GetXmax()/8,
  //                     m_contours["-2s"]->GetXaxis()->GetXmax()/3->5,
  //                     -m_contours["-2s"]->GetYaxis()->GetXmax()/8);
  // smLabel->SetFillStyle(0);
  // smLabel->SetBorderSize(0);
  // smLabel->AddText(" SM");
  // smLabel->Draw();

  legend->Draw();

  TPaveText *text = new TPaveText(0.566,0.87,0.965,1.101,"NDC");
  text->SetFillStyle(0);
  text->SetBorderSize(0);
  text->AddText(Form("95%% CL Limit on %s and %s",par2latex(par1).Data(),par2latex(par2).Data()));
  text->AddText(0,0.35,Form("#intL dt= %.1f fb^{-1}, #sqrt{s} = %d TeV",intlumifbinv,beamcometev));
  text->Draw();

  // text2 = TPaveText(0.155,0.199,0.974,0.244,"NDC");
  // text2->SetFillStyle(0);
  // text2->SetBorderSize(0);
  // text2->AddText("Values outside contour excluded");
  // text2->Draw();

  //text3 = TPaveText(0.506,0.699,0.905,0.758,"NDC");
  //text3->SetFillStyle(0);
  //text3->SetBorderSize(0);
  //text3->AddText(options.flavorText);
  //text3->Draw();    
  
  finalPlot->RedrawAxis();
  finalPlot->ResetAttPad();
  finalPlot->Update();

  finalPlot->Draw();
  finalPlot->Update();
  finalPlot->Modified();
  finalPlot->Update();
  finalPlot->Print(Form("%s.pdf",plotprefix.Data()));
  finalPlot->Print(Form("%s.eps",plotprefix.Data()));
  finalPlot->Print(Form("%s.png",plotprefix.Data()));

}                                                  // draw2DlimitBFstyle
Example #29
0
ScanResult scanTau(TH2* responseMatrix, TH1* input, bool writeCanvas=true)
{
    const int N = 2000;
    const int NBINS = responseMatrix->GetNbinsX();
    
    double* tau = new double[N];
    double* pmean = new double[N];
    double pmean_min=1.0;
    double pmean_min_tau=0.0;
    double* pmax = new double[N];
    double pmax_min=1.0;
    double pmax_min_tau=0.0;

    double** rho_avg = new double*[NBINS];
    for (int i = 0; i < NBINS; ++i)
    {
        rho_avg[i]=new double[N];
    }
    
    TH2D error("errorMatrixTauScan","",NBINS,0,NBINS,NBINS,0,NBINS);
    TUnfoldSys tunfold(responseMatrix,TUnfold::kHistMapOutputHoriz,TUnfold::kRegModeCurvature);
    for (int iscan=0;iscan< N;++iscan) 
    {
        tau[iscan]=TMath::Power(10.0,1.0*(iscan/(1.0*N)*5.0-7.0));
        tunfold.DoUnfold(tau[iscan],input);
        error.Scale(0.0);
        tunfold.GetEmatrix(&error);
        
        TMatrixD cov_matrix = convertHistToMatrix(error);
        TMatrixD inv_cov_matrix=TMatrixD(TMatrixD::kInverted,cov_matrix);
        TMatrixD diag_cov_halfs(NBINS,NBINS);
        for (int i=0; i<NBINS; ++i) {
            for (int j=0; j<NBINS; ++j) {
                if (i==j)
                {
                    diag_cov_halfs[i][j]=1.0/TMath::Sqrt((cov_matrix)[i][j]);
                }
                else
                {
                    diag_cov_halfs[i][j]=0.0;
                }
            }
        }
        //correlations of the unfolded dist
        TMatrixD rho = diag_cov_halfs*(cov_matrix)*diag_cov_halfs;
        
        //calculate the average per bin correlation; will be used in the "subway" plot
        for (int offrow = 1; offrow<NBINS; ++offrow)
        {
            double sum=0.0;
            for (int entry = 0; entry < NBINS-offrow; ++entry)
            {
                sum+=rho[offrow+entry][entry];
            }
            rho_avg[offrow][iscan]=sum/(NBINS-offrow);
        }
       
        double* p = new double[NBINS];
        pmean[iscan]=0.0; //will store the average global correlation over bins
        pmax[iscan]=0.0; //will store the max global correlation over bins
        for (int i=0; i<NBINS; ++i) 
        {
            //calculate the global correlations
            p[i]=sqrt(1.0-1.0/(inv_cov_matrix[i][i]*(cov_matrix)[i][i]));
            pmean[iscan]+=p[i];
            if (p[i]>pmax[iscan]) 
            {
                pmax[iscan]=p[i];
            }
        }
        pmean[iscan]=pmean[iscan]/(1.0*NBINS);
        
        //check if this is the minimum
        if (pmean[iscan]<pmean_min) 
        {
            pmean_min=pmean[iscan];
            pmean_min_tau=tau[iscan];
        }
        //check if this is the minimum
        if (pmax[iscan]<pmax_min) 
        {
            pmax_min=pmax[iscan];
            pmax_min_tau=tau[iscan];
        }
    }
    TCanvas cv_subway("cv_subway","",800,600);
    cv_subway.SetRightMargin(0.27);
    TH2F axes("axes",";#tau;#rho",50,tau[0],tau[N-1],50,-1.1,1.1);
    axes.Draw("AXIS");
    cv_subway.SetLogx(1);
    
    double Red[5]   = {0.00, 0.00, 0.83, 0.90, 0.65};
    double Green[5] = { 0.00, 0.71, 0.90, 0.15, 0.00};
    double Blue[5]   ={  0.71, 1.00, 0.12, 0.00, 0.00};
    double Length[5] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
    int start = TColor::CreateGradientColorTable(5,Length,Red,Green,Blue,(NBINS)*2);

    TLegend legend(0.74,0.9,0.99,0.2);
    legend.SetFillColor(kWhite);
    legend.SetBorderSize(0);
    legend.SetTextFont(42);
    
    for (int i=1; i<NBINS; ++i) 
    {
       
        TGraph* graph = new TGraph(N,tau,rho_avg[i]);
        graph->SetLineColor(start+(i-1)*2+1);
        graph->SetLineWidth(2);
        graph->Draw("SameL"); 
        
        char* graphName= new char[50];
        sprintf(graphName,"#LT #rho(i,i+%i) #GT",i);
        legend.AddEntry(graph,graphName,"L");
    }
    legend.AddEntry("","","");
    TGraph* graph_globalrho_avg = new TGraph(N,tau,pmean);
    graph_globalrho_avg->SetLineColor(kBlack);
    graph_globalrho_avg->SetLineStyle(2);
    graph_globalrho_avg->SetLineWidth(3);
    graph_globalrho_avg->Draw("SameL"); 
    legend.AddEntry(graph_globalrho_avg,"avg. global #rho","L");
    
    char* globalrho_mean= new char[50];
    sprintf(globalrho_mean,"#rho|min=%4.3f",pmean_min);
    legend.AddEntry("",globalrho_mean,"");
    char* globalrho_mean_tau= new char[50];
    sprintf(globalrho_mean_tau,"#tau|min=%3.2e",pmean_min_tau);
    legend.AddEntry("",globalrho_mean_tau,"");
    
    
    legend.AddEntry("","","");
    TGraph* graph_globalrho_max = new TGraph(N,tau,pmax);
    graph_globalrho_max->SetLineColor(kBlack);
    graph_globalrho_max->SetLineWidth(3);
    graph_globalrho_max->SetLineStyle(3);
    graph_globalrho_max->Draw("SameL"); 
    legend.AddEntry(graph_globalrho_max,"max. global #rho","L");
    
    char* globalrho_max= new char[50];
    sprintf(globalrho_max,"#rho|min=%4.3f",pmax_min);
    legend.AddEntry("",globalrho_max,"");
    char* globalrho_max_tau= new char[50];
    sprintf(globalrho_max_tau,"#tau|min=%3.2e",pmax_min_tau);
    legend.AddEntry("",globalrho_max_tau,"");
    
    legend.Draw("Same");
    if (writeCanvas)
    {
        cv_subway.Write();
    }
    ScanResult scanResult;
    scanResult.taumean=pmean_min_tau;
    scanResult.pmean=pmean_min;
    scanResult.taumax=pmax_min_tau;
    scanResult.pmax=pmax_min;
    return scanResult;
}
void Sens_Matrix_LAr1ND_150m_T600_off_axis_Shape_and_Rate(TCanvas* c)
{
    c->cd();


    TGraph *graph = new TGraph(501);
    graph->SetName("Graph0");
    graph->SetTitle("Graph");
    graph->SetFillColor(1);
    graph->SetLineWidth(2);
    graph->SetPoint(0,1,0.01);
    graph->SetPoint(1,1,0.01018591388);
    graph->SetPoint(2,1,0.01037528416);
    graph->SetPoint(3,1,0.01056817509);
    graph->SetPoint(4,1,0.01076465214);
    graph->SetPoint(5,1,0.01096478196);
    graph->SetPoint(6,1,0.01116863248);
    graph->SetPoint(7,1,0.01137627286);
    graph->SetPoint(8,1,0.01158777356);
    graph->SetPoint(9,1,0.01180320636);
    graph->SetPoint(10,1,0.01202264435);
    graph->SetPoint(11,1,0.01224616199);
    graph->SetPoint(12,1,0.01247383514);
    graph->SetPoint(13,1,0.01270574105);
    graph->SetPoint(14,1,0.01294195841);
    graph->SetPoint(15,1,0.01318256739);
    graph->SetPoint(16,1,0.01342764961);
    graph->SetPoint(17,1,0.01367728826);
    graph->SetPoint(18,1,0.01393156803);
    graph->SetPoint(19,1,0.01419057522);
    graph->SetPoint(20,1,0.01445439771);
    graph->SetPoint(21,1,0.01472312502);
    graph->SetPoint(22,1,0.01499684836);
    graph->SetPoint(23,1,0.01527566058);
    graph->SetPoint(24,1,0.01555965632);
    graph->SetPoint(25,1,0.01584893192);
    graph->SetPoint(26,1,0.01614358557);
    graph->SetPoint(27,1,0.01644371723);
    graph->SetPoint(28,1,0.01674942876);
    graph->SetPoint(29,1,0.01706082389);
    graph->SetPoint(30,1,0.01737800829);
    graph->SetPoint(31,1,0.01770108958);
    graph->SetPoint(32,1,0.01803017741);
    graph->SetPoint(33,1,0.01836538343);
    graph->SetPoint(34,1,0.0187068214);
    graph->SetPoint(35,1,0.01905460718);
    graph->SetPoint(36,1,0.01940885878);
    graph->SetPoint(37,1,0.0197696964);
    graph->SetPoint(38,1,0.0201372425);
    graph->SetPoint(39,1,0.02051162179);
    graph->SetPoint(40,1,0.02089296131);
    graph->SetPoint(41,1,0.02128139046);
    graph->SetPoint(42,1,0.02167704105);
    graph->SetPoint(43,1,0.02208004733);
    graph->SetPoint(44,1,0.02249054606);
    graph->SetPoint(45,1,0.02290867653);
    graph->SetPoint(46,1,0.02333458062);
    graph->SetPoint(47,1,0.02376840287);
    graph->SetPoint(48,1,0.02421029047);
    graph->SetPoint(49,1,0.02466039337);
    graph->SetPoint(50,1,0.02511886432);
    graph->SetPoint(51,1,0.02558585887);
    graph->SetPoint(52,1,0.0260615355);
    graph->SetPoint(53,1,0.02654605562);
    graph->SetPoint(54,1,0.02703958364);
    graph->SetPoint(55,1,0.02754228703);
    graph->SetPoint(56,1,0.02805433638);
    graph->SetPoint(57,1,0.02857590543);
    graph->SetPoint(58,1,0.02910717118);
    graph->SetPoint(59,1,0.0296483139);
    graph->SetPoint(60,1,0.0301995172);
    graph->SetPoint(61,1,0.03076096815);
    graph->SetPoint(62,1,0.03133285724);
    graph->SetPoint(63,1,0.03191537855);
    graph->SetPoint(64,1,0.03250872974);
    graph->SetPoint(65,1,0.03311311215);
    graph->SetPoint(66,1,0.03372873087);
    graph->SetPoint(67,1,0.03435579479);
    graph->SetPoint(68,1,0.0349945167);
    graph->SetPoint(69,1,0.03564511334);
    graph->SetPoint(70,1,0.03630780548);
    graph->SetPoint(71,1,0.03698281798);
    graph->SetPoint(72,1,0.0376703799);
    graph->SetPoint(73,1,0.03837072455);
    graph->SetPoint(74,1,0.03908408958);
    graph->SetPoint(75,1,0.03981071706);
    graph->SetPoint(76,1,0.04055085354);
    graph->SetPoint(77,1,0.0413047502);
    graph->SetPoint(78,1,0.04207266284);
    graph->SetPoint(79,1,0.04285485204);
    graph->SetPoint(80,1,0.04365158322);
    graph->SetPoint(81,1,0.04446312675);
    graph->SetPoint(82,1,0.04528975799);
    graph->SetPoint(83,1,0.04613175746);
    graph->SetPoint(84,1,0.04698941086);
    graph->SetPoint(85,1,0.04786300923);
    graph->SetPoint(86,0.981747943,0.04875284901);
    graph->SetPoint(87,0.9462371614,0.04965923215);
    graph->SetPoint(88,0.9120108394,0.0505824662);
    graph->SetPoint(89,0.8790225168,0.05152286446);
    graph->SetPoint(90,0.8472274141,0.05248074602);
    graph->SetPoint(91,0.8165823714,0.05345643594);
    graph->SetPoint(92,0.7870457897,0.05445026528);
    graph->SetPoint(93,0.758577575,0.0554625713);
    graph->SetPoint(94,0.7311390835,0.05649369748);
    graph->SetPoint(95,0.704693069,0.05754399373);
    graph->SetPoint(96,0.6792036326,0.05861381645);
    graph->SetPoint(97,0.6546361741,0.05970352866);
    graph->SetPoint(98,0.6309573445,0.06081350013);
    graph->SetPoint(99,0.6081350013,0.06194410751);
    graph->SetPoint(100,0.5861381645,0.06309573445);
    graph->SetPoint(101,0.5649369748,0.06426877173);
    graph->SetPoint(102,0.5445026528,0.06546361741);
    graph->SetPoint(103,0.5248074602,0.06668067692);
    graph->SetPoint(104,0.505824662,0.06792036326);
    graph->SetPoint(105,0.4875284901,0.06918309709);
    graph->SetPoint(106,0.4698941086,0.0704693069);
    graph->SetPoint(107,0.4528975799,0.07177942913);
    graph->SetPoint(108,0.4365158322,0.07311390835);
    graph->SetPoint(109,0.4207266284,0.07447319739);
    graph->SetPoint(110,0.4055085354,0.0758577575);
    graph->SetPoint(111,0.3908408958,0.07726805851);
    graph->SetPoint(112,0.376703799,0.07870457897);
    graph->SetPoint(113,0.3630780548,0.08016780634);
    graph->SetPoint(114,0.349945167,0.08165823714);
    graph->SetPoint(115,0.3372873087,0.08317637711);
    graph->SetPoint(116,0.3250872974,0.08472274141);
    graph->SetPoint(117,0.3191537855,0.08629785478);
    graph->SetPoint(118,0.3076096815,0.08790225168);
    graph->SetPoint(119,0.296483139,0.08953647655);
    graph->SetPoint(120,0.2857590543,0.09120108394);
    graph->SetPoint(121,0.2754228703,0.09289663868);
    graph->SetPoint(122,0.2654605562,0.09462371614);
    graph->SetPoint(123,0.2558585887,0.09638290236);
    graph->SetPoint(124,0.2466039337,0.0981747943);
    graph->SetPoint(125,0.2376840287,0.1);
    graph->SetPoint(126,0.2290867653,0.1018591388);
    graph->SetPoint(127,0.2208004733,0.1037528416);
    graph->SetPoint(128,0.2128139046,0.1056817509);
    graph->SetPoint(129,0.2051162179,0.1076465214);
    graph->SetPoint(130,0.197696964,0.1096478196);
    graph->SetPoint(131,0.1905460718,0.1116863248);
    graph->SetPoint(132,0.1836538343,0.1137627286);
    graph->SetPoint(133,0.1770108958,0.1158777356);
    graph->SetPoint(134,0.1706082389,0.1180320636);
    graph->SetPoint(135,0.1644371723,0.1202264435);
    graph->SetPoint(136,0.1584893192,0.1224616199);
    graph->SetPoint(137,0.1527566058,0.1247383514);
    graph->SetPoint(138,0.1472312502,0.1270574105);
    graph->SetPoint(139,0.1419057522,0.1294195841);
    graph->SetPoint(140,0.1367728826,0.1318256739);
    graph->SetPoint(141,0.1318256739,0.1342764961);
    graph->SetPoint(142,0.1270574105,0.1367728826);
    graph->SetPoint(143,0.1224616199,0.1393156803);
    graph->SetPoint(144,0.1180320636,0.1419057522);
    graph->SetPoint(145,0.1137627286,0.1445439771);
    graph->SetPoint(146,0.1116863248,0.1472312502);
    graph->SetPoint(147,0.1076465214,0.1499684836);
    graph->SetPoint(148,0.1037528416,0.1527566058);
    graph->SetPoint(149,0.1,0.1555965632);
    graph->SetPoint(150,0.09638290236,0.1584893192);
    graph->SetPoint(151,0.09289663868,0.1614358557);
    graph->SetPoint(152,0.08953647655,0.1644371723);
    graph->SetPoint(153,0.08629785478,0.1674942876);
    graph->SetPoint(154,0.08317637711,0.1706082389);
    graph->SetPoint(155,0.08016780634,0.1737800829);
    graph->SetPoint(156,0.07726805851,0.1770108958);
    graph->SetPoint(157,0.07447319739,0.1803017741);
    graph->SetPoint(158,0.07177942913,0.1836538343);
    graph->SetPoint(159,0.06918309709,0.187068214);
    graph->SetPoint(160,0.06792036326,0.1905460718);
    graph->SetPoint(161,0.06546361741,0.1940885878);
    graph->SetPoint(162,0.06309573445,0.197696964);
    graph->SetPoint(163,0.06081350013,0.201372425);
    graph->SetPoint(164,0.05861381645,0.2051162179);
    graph->SetPoint(165,0.05649369748,0.2089296131);
    graph->SetPoint(166,0.05445026528,0.2128139046);
    graph->SetPoint(167,0.05248074602,0.2167704105);
    graph->SetPoint(168,0.0505824662,0.2208004733);
    graph->SetPoint(169,0.04965923215,0.2249054606);
    graph->SetPoint(170,0.04786300923,0.2290867653);
    graph->SetPoint(171,0.04613175746,0.2333458062);
    graph->SetPoint(172,0.04446312675,0.2376840287);
    graph->SetPoint(173,0.04285485204,0.2421029047);
    graph->SetPoint(174,0.0413047502,0.2466039337);
    graph->SetPoint(175,0.03981071706,0.2511886432);
    graph->SetPoint(176,0.03908408958,0.2558585887);
    graph->SetPoint(177,0.0376703799,0.260615355);
    graph->SetPoint(178,0.03630780548,0.2654605562);
    graph->SetPoint(179,0.0349945167,0.2703958364);
    graph->SetPoint(180,0.03372873087,0.2754228703);
    graph->SetPoint(181,0.03250872974,0.2805433638);
    graph->SetPoint(182,0.03191537855,0.2857590543);
    graph->SetPoint(183,0.03076096815,0.2910717118);
    graph->SetPoint(184,0.0296483139,0.296483139);
    graph->SetPoint(185,0.02857590543,0.301995172);
    graph->SetPoint(186,0.02754228703,0.3076096815);
    graph->SetPoint(187,0.02703958364,0.3133285724);
    graph->SetPoint(188,0.0260615355,0.3191537855);
    graph->SetPoint(189,0.02511886432,0.3250872974);
    graph->SetPoint(190,0.02421029047,0.3311311215);
    graph->SetPoint(191,0.02376840287,0.3372873087);
    graph->SetPoint(192,0.02290867653,0.3435579479);
    graph->SetPoint(193,0.02208004733,0.349945167);
    graph->SetPoint(194,0.02167704105,0.3564511334);
    graph->SetPoint(195,0.02089296131,0.3630780548);
    graph->SetPoint(196,0.0201372425,0.3698281798);
    graph->SetPoint(197,0.0197696964,0.376703799);
    graph->SetPoint(198,0.01905460718,0.3837072455);
    graph->SetPoint(199,0.01836538343,0.3908408958);
    graph->SetPoint(200,0.01803017741,0.3981071706);
    graph->SetPoint(201,0.01737800829,0.4055085354);
    graph->SetPoint(202,0.01674942876,0.413047502);
    graph->SetPoint(203,0.01644371723,0.4207266284);
    graph->SetPoint(204,0.01584893192,0.4285485204);
    graph->SetPoint(205,0.01555965632,0.4365158322);
    graph->SetPoint(206,0.01499684836,0.4446312675);
    graph->SetPoint(207,0.01472312502,0.4528975799);
    graph->SetPoint(208,0.01419057522,0.4613175746);
    graph->SetPoint(209,0.01393156803,0.4698941086);
    graph->SetPoint(210,0.01342764961,0.4786300923);
    graph->SetPoint(211,0.01318256739,0.4875284901);
    graph->SetPoint(212,0.01270574105,0.4965923215);
    graph->SetPoint(213,0.01247383514,0.505824662);
    graph->SetPoint(214,0.01202264435,0.5152286446);
    graph->SetPoint(215,0.01180320636,0.5248074602);
    graph->SetPoint(216,0.01158777356,0.5345643594);
    graph->SetPoint(217,0.01116863248,0.5445026528);
    graph->SetPoint(218,0.01096478196,0.554625713);
    graph->SetPoint(219,0.01056817509,0.5649369748);
    graph->SetPoint(220,0.01037528416,0.5754399373);
    graph->SetPoint(221,0.01018591388,0.5861381645);
    graph->SetPoint(222,0.01,0.5970352866);
    graph->SetPoint(223,0.009638290236,0.6081350013);
    graph->SetPoint(224,0.009462371614,0.6194410751);
    graph->SetPoint(225,0.009289663868,0.6309573445);
    graph->SetPoint(226,0.009120108394,0.6426877173);
    graph->SetPoint(227,0.008953647655,0.6546361741);
    graph->SetPoint(228,0.008629785478,0.6668067692);
    graph->SetPoint(229,0.008472274141,0.6792036326);
    graph->SetPoint(230,0.008317637711,0.6918309709);
    graph->SetPoint(231,0.008165823714,0.704693069);
    graph->SetPoint(232,0.008016780634,0.7177942913);
    graph->SetPoint(233,0.007870457897,0.7311390835);
    graph->SetPoint(234,0.007726805851,0.7447319739);
    graph->SetPoint(235,0.00758577575,0.758577575);
    graph->SetPoint(236,0.007447319739,0.7726805851);
    graph->SetPoint(237,0.007311390835,0.7870457897);
    graph->SetPoint(238,0.007177942913,0.8016780634);
    graph->SetPoint(239,0.00704693069,0.8165823714);
    graph->SetPoint(240,0.006918309709,0.8317637711);
    graph->SetPoint(241,0.006792036326,0.8472274141);
    graph->SetPoint(242,0.006668067692,0.8629785478);
    graph->SetPoint(243,0.006668067692,0.8790225168);
    graph->SetPoint(244,0.006546361741,0.8953647655);
    graph->SetPoint(245,0.006426877173,0.9120108394);
    graph->SetPoint(246,0.006309573445,0.9289663868);
    graph->SetPoint(247,0.006194410751,0.9462371614);
    graph->SetPoint(248,0.006194410751,0.9638290236);
    graph->SetPoint(249,0.006081350013,0.981747943);
    graph->SetPoint(250,0.005970352866,1);
    graph->SetPoint(251,0.005861381645,1.018591388);
    graph->SetPoint(252,0.005861381645,1.037528416);
    graph->SetPoint(253,0.005754399373,1.056817509);
    graph->SetPoint(254,0.005649369748,1.076465214);
    graph->SetPoint(255,0.005649369748,1.096478196);
    graph->SetPoint(256,0.00554625713,1.116863248);
    graph->SetPoint(257,0.00554625713,1.137627286);
    graph->SetPoint(258,0.005445026528,1.158777356);
    graph->SetPoint(259,0.005345643594,1.180320636);
    graph->SetPoint(260,0.005345643594,1.202264435);
    graph->SetPoint(261,0.005248074602,1.224616199);
    graph->SetPoint(262,0.005248074602,1.247383514);
    graph->SetPoint(263,0.005248074602,1.270574105);
    graph->SetPoint(264,0.005152286446,1.294195841);
    graph->SetPoint(265,0.005152286446,1.318256739);
    graph->SetPoint(266,0.00505824662,1.342764961);
    graph->SetPoint(267,0.00505824662,1.367728826);
    graph->SetPoint(268,0.00505824662,1.393156803);
    graph->SetPoint(269,0.00505824662,1.419057522);
    graph->SetPoint(270,0.004965923215,1.445439771);
    graph->SetPoint(271,0.004965923215,1.472312502);
    graph->SetPoint(272,0.004965923215,1.499684836);
    graph->SetPoint(273,0.004965923215,1.527566058);
    graph->SetPoint(274,0.004965923215,1.555965632);
    graph->SetPoint(275,0.004965923215,1.584893192);
    graph->SetPoint(276,0.004965923215,1.614358557);
    graph->SetPoint(277,0.004965923215,1.644371723);
    graph->SetPoint(278,0.004965923215,1.674942876);
    graph->SetPoint(279,0.004965923215,1.706082389);
    graph->SetPoint(280,0.004965923215,1.737800829);
    graph->SetPoint(281,0.004965923215,1.770108958);
    graph->SetPoint(282,0.004965923215,1.803017741);
    graph->SetPoint(283,0.00505824662,1.836538343);
    graph->SetPoint(284,0.00505824662,1.87068214);
    graph->SetPoint(285,0.00505824662,1.905460718);
    graph->SetPoint(286,0.005152286446,1.940885878);
    graph->SetPoint(287,0.005152286446,1.97696964);
    graph->SetPoint(288,0.005248074602,2.01372425);
    graph->SetPoint(289,0.005248074602,2.051162179);
    graph->SetPoint(290,0.005345643594,2.089296131);
    graph->SetPoint(291,0.005345643594,2.128139046);
    graph->SetPoint(292,0.005445026528,2.167704105);
    graph->SetPoint(293,0.00554625713,2.208004733);
    graph->SetPoint(294,0.00554625713,2.249054606);
    graph->SetPoint(295,0.005649369748,2.290867653);
    graph->SetPoint(296,0.005754399373,2.333458062);
    graph->SetPoint(297,0.005861381645,2.376840287);
    graph->SetPoint(298,0.005970352866,2.421029047);
    graph->SetPoint(299,0.006081350013,2.466039337);
    graph->SetPoint(300,0.006194410751,2.511886432);
    graph->SetPoint(301,0.006309573445,2.558585887);
    graph->SetPoint(302,0.006426877173,2.60615355);
    graph->SetPoint(303,0.006546361741,2.654605562);
    graph->SetPoint(304,0.006792036326,2.703958364);
    graph->SetPoint(305,0.006918309709,2.754228703);
    graph->SetPoint(306,0.00704693069,2.805433638);
    graph->SetPoint(307,0.007311390835,2.857590543);
    graph->SetPoint(308,0.007447319739,2.910717118);
    graph->SetPoint(309,0.00758577575,2.96483139);
    graph->SetPoint(310,0.007870457897,3.01995172);
    graph->SetPoint(311,0.008016780634,3.076096815);
    graph->SetPoint(312,0.008317637711,3.133285724);
    graph->SetPoint(313,0.008472274141,3.191537855);
    graph->SetPoint(314,0.008790225168,3.250872974);
    graph->SetPoint(315,0.008953647655,3.311311215);
    graph->SetPoint(316,0.009120108394,3.372873087);
    graph->SetPoint(317,0.009462371614,3.435579479);
    graph->SetPoint(318,0.009638290236,3.49945167);
    graph->SetPoint(319,0.00981747943,3.564511334);
    graph->SetPoint(320,0.01018591388,3.630780548);
    graph->SetPoint(321,0.01037528416,3.698281798);
    graph->SetPoint(322,0.01056817509,3.76703799);
    graph->SetPoint(323,0.01076465214,3.837072455);
    graph->SetPoint(324,0.01096478196,3.908408958);
    graph->SetPoint(325,0.01116863248,3.981071706);
    graph->SetPoint(326,0.01137627286,4.055085354);
    graph->SetPoint(327,0.01137627286,4.13047502);
    graph->SetPoint(328,0.01158777356,4.207266284);
    graph->SetPoint(329,0.01180320636,4.285485204);
    graph->SetPoint(330,0.01180320636,4.365158322);
    graph->SetPoint(331,0.01202264435,4.446312675);
    graph->SetPoint(332,0.01202264435,4.528975799);
    graph->SetPoint(333,0.01224616199,4.613175746);
    graph->SetPoint(334,0.01224616199,4.698941086);
    graph->SetPoint(335,0.01224616199,4.786300923);
    graph->SetPoint(336,0.01224616199,4.875284901);
    graph->SetPoint(337,0.01224616199,4.965923215);
    graph->SetPoint(338,0.01224616199,5.05824662);
    graph->SetPoint(339,0.01224616199,5.152286446);
    graph->SetPoint(340,0.01224616199,5.248074602);
    graph->SetPoint(341,0.01224616199,5.345643594);
    graph->SetPoint(342,0.01224616199,5.445026528);
    graph->SetPoint(343,0.01224616199,5.54625713);
    graph->SetPoint(344,0.01224616199,5.649369748);
    graph->SetPoint(345,0.01224616199,5.754399373);
    graph->SetPoint(346,0.01224616199,5.861381645);
    graph->SetPoint(347,0.01202264435,5.970352866);
    graph->SetPoint(348,0.01202264435,6.081350013);
    graph->SetPoint(349,0.01202264435,6.194410751);
    graph->SetPoint(350,0.01202264435,6.309573445);
    graph->SetPoint(351,0.01180320636,6.426877173);
    graph->SetPoint(352,0.01180320636,6.546361741);
    graph->SetPoint(353,0.01180320636,6.668067692);
    graph->SetPoint(354,0.01158777356,6.792036326);
    graph->SetPoint(355,0.01158777356,6.918309709);
    graph->SetPoint(356,0.01137627286,7.04693069);
    graph->SetPoint(357,0.01137627286,7.177942913);
    graph->SetPoint(358,0.01137627286,7.311390835);
    graph->SetPoint(359,0.01116863248,7.447319739);
    graph->SetPoint(360,0.01116863248,7.58577575);
    graph->SetPoint(361,0.01096478196,7.726805851);
    graph->SetPoint(362,0.01096478196,7.870457897);
    graph->SetPoint(363,0.01096478196,8.016780634);
    graph->SetPoint(364,0.01076465214,8.165823714);
    graph->SetPoint(365,0.01076465214,8.317637711);
    graph->SetPoint(366,0.01076465214,8.472274141);
    graph->SetPoint(367,0.01056817509,8.629785478);
    graph->SetPoint(368,0.01056817509,8.790225168);
    graph->SetPoint(369,0.01056817509,8.953647655);
    graph->SetPoint(370,0.01056817509,9.120108394);
    graph->SetPoint(371,0.01056817509,9.289663868);
    graph->SetPoint(372,0.01037528416,9.462371614);
    graph->SetPoint(373,0.01037528416,9.638290236);
    graph->SetPoint(374,0.01056817509,9.81747943);
    graph->SetPoint(375,0.01056817509,10);
    graph->SetPoint(376,0.01056817509,10.18591388);
    graph->SetPoint(377,0.01076465214,10.37528416);
    graph->SetPoint(378,0.01096478196,10.56817509);
    graph->SetPoint(379,0.01116863248,10.76465214);
    graph->SetPoint(380,0.01137627286,10.96478196);
    graph->SetPoint(381,0.01158777356,11.16863248);
    graph->SetPoint(382,0.01180320636,11.37627286);
    graph->SetPoint(383,0.01202264435,11.58777356);
    graph->SetPoint(384,0.01224616199,11.80320636);
    graph->SetPoint(385,0.01247383514,12.02264435);
    graph->SetPoint(386,0.01294195841,12.24616199);
    graph->SetPoint(387,0.01318256739,12.47383514);
    graph->SetPoint(388,0.01342764961,12.70574105);
    graph->SetPoint(389,0.01393156803,12.94195841);
    graph->SetPoint(390,0.01419057522,13.18256739);
    graph->SetPoint(391,0.01445439771,13.42764961);
    graph->SetPoint(392,0.01472312502,13.67728826);
    graph->SetPoint(393,0.01472312502,13.93156803);
    graph->SetPoint(394,0.01499684836,14.19057522);
    graph->SetPoint(395,0.01527566058,14.45439771);
    graph->SetPoint(396,0.01584893192,14.72312502);
    graph->SetPoint(397,0.01644371723,14.99684836);
    graph->SetPoint(398,0.01706082389,15.27566058);
    graph->SetPoint(399,0.01770108958,15.55965632);
    graph->SetPoint(400,0.01836538343,15.84893192);
    graph->SetPoint(401,0.01905460718,16.14358557);
    graph->SetPoint(402,0.01940885878,16.44371723);
    graph->SetPoint(403,0.0197696964,16.74942876);
    graph->SetPoint(404,0.0197696964,17.06082389);
    graph->SetPoint(405,0.0197696964,17.37800829);
    graph->SetPoint(406,0.0197696964,17.70108958);
    graph->SetPoint(407,0.01940885878,18.03017741);
    graph->SetPoint(408,0.01940885878,18.36538343);
    graph->SetPoint(409,0.01940885878,18.7068214);
    graph->SetPoint(410,0.0197696964,19.05460718);
    graph->SetPoint(411,0.0197696964,19.40885878);
    graph->SetPoint(412,0.0197696964,19.7696964);
    graph->SetPoint(413,0.0197696964,20.1372425);
    graph->SetPoint(414,0.01940885878,20.51162179);
    graph->SetPoint(415,0.01940885878,20.89296131);
    graph->SetPoint(416,0.01905460718,21.28139046);
    graph->SetPoint(417,0.01905460718,21.67704105);
    graph->SetPoint(418,0.01905460718,22.08004733);
    graph->SetPoint(419,0.01905460718,22.49054606);
    graph->SetPoint(420,0.01940885878,22.90867653);
    graph->SetPoint(421,0.0197696964,23.33458062);
    graph->SetPoint(422,0.02051162179,23.76840287);
    graph->SetPoint(423,0.02128139046,24.21029047);
    graph->SetPoint(424,0.02208004733,24.66039337);
    graph->SetPoint(425,0.02249054606,25.11886432);
    graph->SetPoint(426,0.02333458062,25.58585887);
    graph->SetPoint(427,0.02421029047,26.0615355);
    graph->SetPoint(428,0.02466039337,26.54605562);
    graph->SetPoint(429,0.0260615355,27.03958364);
    graph->SetPoint(430,0.02754228703,27.54228703);
    graph->SetPoint(431,0.02857590543,28.05433638);
    graph->SetPoint(432,0.0301995172,28.57590543);
    graph->SetPoint(433,0.03191537855,29.10717118);
    graph->SetPoint(434,0.03311311215,29.6483139);
    graph->SetPoint(435,0.03372873087,30.1995172);
    graph->SetPoint(436,0.03435579479,30.76096815);
    graph->SetPoint(437,0.03435579479,31.33285724);
    graph->SetPoint(438,0.0349945167,31.91537855);
    graph->SetPoint(439,0.03564511334,32.50872974);
    graph->SetPoint(440,0.03630780548,33.11311215);
    graph->SetPoint(441,0.0376703799,33.72873087);
    graph->SetPoint(442,0.0376703799,34.35579479);
    graph->SetPoint(443,0.0376703799,34.9945167);
    graph->SetPoint(444,0.0376703799,35.64511334);
    graph->SetPoint(445,0.03837072455,36.30780548);
    graph->SetPoint(446,0.03908408958,36.98281798);
    graph->SetPoint(447,0.04055085354,37.6703799);
    graph->SetPoint(448,0.04285485204,38.37072455);
    graph->SetPoint(449,0.04446312675,39.08408958);
    graph->SetPoint(450,0.04613175746,39.81071706);
    graph->SetPoint(451,0.04698941086,40.55085354);
    graph->SetPoint(452,0.04875284901,41.3047502);
    graph->SetPoint(453,0.0505824662,42.07266284);
    graph->SetPoint(454,0.05345643594,42.85485204);
    graph->SetPoint(455,0.05445026528,43.65158322);
    graph->SetPoint(456,0.05649369748,44.46312675);
    graph->SetPoint(457,0.05970352866,45.28975799);
    graph->SetPoint(458,0.06194410751,46.13175746);
    graph->SetPoint(459,0.06309573445,46.98941086);
    graph->SetPoint(460,0.06426877173,47.86300923);
    graph->SetPoint(461,0.06546361741,48.75284901);
    graph->SetPoint(462,0.06668067692,49.65923215);
    graph->SetPoint(463,0.06918309709,50.5824662);
    graph->SetPoint(464,0.0704693069,51.52286446);
    graph->SetPoint(465,0.07311390835,52.48074602);
    graph->SetPoint(466,0.07447319739,53.45643594);
    graph->SetPoint(467,0.07726805851,54.45026528);
    graph->SetPoint(468,0.08165823714,55.4625713);
    graph->SetPoint(469,0.08472274141,56.49369748);
    graph->SetPoint(470,0.08629785478,57.54399373);
    graph->SetPoint(471,0.08472274141,58.61381645);
    graph->SetPoint(472,0.08472274141,59.70352866);
    graph->SetPoint(473,0.08472274141,60.81350013);
    graph->SetPoint(474,0.08472274141,61.94410751);
    graph->SetPoint(475,0.08790225168,63.09573445);
    graph->SetPoint(476,0.09120108394,64.26877173);
    graph->SetPoint(477,0.09462371614,65.46361741);
    graph->SetPoint(478,0.09462371614,66.68067692);
    graph->SetPoint(479,0.0981747943,67.92036326);
    graph->SetPoint(480,0.1,69.18309709);
    graph->SetPoint(481,0.1037528416,70.4693069);
    graph->SetPoint(482,0.1076465214,71.77942913);
    graph->SetPoint(483,0.1096478196,73.11390835);
    graph->SetPoint(484,0.1076465214,74.47319739);
    graph->SetPoint(485,0.1076465214,75.8577575);
    graph->SetPoint(486,0.1037528416,77.26805851);
    graph->SetPoint(487,0.1037528416,78.70457897);
    graph->SetPoint(488,0.1037528416,80.16780634);
    graph->SetPoint(489,0.1037528416,81.65823714);
    graph->SetPoint(490,0.1056817509,83.17637711);
    graph->SetPoint(491,0.1056817509,84.72274141);
    graph->SetPoint(492,0.1076465214,86.29785478);
    graph->SetPoint(493,0.1096478196,87.90225168);
    graph->SetPoint(494,0.1116863248,89.53647655);
    graph->SetPoint(495,0.1096478196,91.20108394);
    graph->SetPoint(496,0.1096478196,92.89663868);
    graph->SetPoint(497,0.1096478196,94.62371614);
    graph->SetPoint(498,0.1116863248,96.38290236);
    graph->SetPoint(499,0.1116863248,98.1747943);
    graph->SetPoint(500,0.1096478196,100);

    graph->SetLineColor(kRed-3);
    graph->SetLineStyle(1);
    graph->SetLineWidth(2);
    graph->Draw("l same");

}