DESY Hbb Analysis Framework
Functions
PlotTanBetaLimit.h File Reference
#include "Analysis/Tools/interface/HttStylesNew.h"
#include "Analysis/Tools/interface/CMS_lumi.h"
#include "Analysis/Tools/interface/mssm_xs_tools.h"
#include "TMath.h"
#include "TTree.h"
#include "TGraph.h"
#include "TGraphAsymmErrors.h"
#include "TCanvas.h"
#include "TString.h"
#include "sstream"
#include "string"
#include <iostream>
#include <fstream>

Go to the source code of this file.

Functions

void PlotTanBetaLimit (const std::string fileList="Hbb.limits", std::string output="", const std::string benchmark="mhmodp_mu200_13TeV.root", bool blindData=true, float yMin=1, float yMax=60, float xMin=100, float xMax=1300, std::string Lumi="20 fb^{-1}", std::string xtitle="m_{A} [GeV]", std::string ytitle="tan#beta", bool logY=true)
 
double XSecToTanBeta (mssm_xs_tools my, double mA, double xsection, double minTanBeta, double maxTanBeta)
 

Function Documentation

void PlotTanBetaLimit ( const std::string  fileList = "Hbb.limits",
std::string  output = "",
const std::string  benchmark = "mhmodp_mu200_13TeV.root",
bool  blindData = true,
float  yMin = 1,
float  yMax = 60,
float  xMin = 100,
float  xMax = 1300,
std::string  Lumi = "20 fb^{-1}",
std::string  xtitle = "m_{A} [GeV]",
std::string  ytitle = "tan#beta",
bool  logY = true 
)

Definition at line 65 of file PlotTanBetaLimit.h.

References CMS_lumi(), extraText, nano_94X_2017_rereco31Mar18-v1::fileName, leg, lumi_13TeV, SetStyle(), writeExtraText, and XSecToTanBeta().

73  {-1}",
74  std::string xtitle = "m_{A} [GeV]",
75  std::string ytitle = "tan#beta",
76  bool logY = true
77  ) {
78 
79 
80  // char * filelist - List of files (output RooT files
81  // produced by 'combine -M Asymptotic')
82  // char * benchmarks - MSSM benchmark scenario file
83  // (cross sections + BRs) :
84  // hMSSM_13TeV.root,
85  // mhmodp_mu200_13TeV.root,
86  // etc
87  // blindData - true : blind observed limits
88  // false : show observed limits
89 
90  SetStyle();
91  gStyle->SetOptFit(0000);
92  gStyle->SetErrorX(0.5);
93 
94 
95  mssm_xs_tools my(benchmark.c_str(),true,0);
96 
97  double minTanBeta = 1;
98  double maxTanBeta = 60;
99 
100  std::string Benchmark(benchmark.c_str());
101  std::string bench_name;
102  if(Benchmark.find("mhmodp_mu200") != std::string::npos) bench_name = "mhmodp_mu200";
103  else bench_name = "ANOTHER_BENCH";
104  std::string header("mhmod+");
105  if (Benchmark.find("hMSSM") != std::string::npos)
106  header = "hMSSM";
107 
108 
109  const int nPoints = 100;
110 
111  // signal strength limits sigma*BR / sigma*BR (at tanb=30)
112  double mA[nPoints];
113  double minus2R[nPoints];
114  double minus1R[nPoints];
115  double medianR[nPoints];
116  double plus1R[nPoints];
117  double plus2R[nPoints];
118  double obsR[nPoints];
119 
120  double obs[nPoints];
121  double minus2[nPoints];
122  double minus1[nPoints];
123  double median[nPoints];
124  double plus1[nPoints];
125  double plus2[nPoints];
126 
127  std::ifstream inputList(fileList);
128  std::string FileList(fileList.c_str());
129 
130  std::string fileName;
131 
132  double MH;
133  double LIMIT;
134 
135  int counter = 0;
136 
137  float massMin = 1000;
138  float massMax = 0;
139 
140  while (inputList >> fileName) {
141 
142  // std::cout << fileName << std::endl;
143 
144  TFile * file = new TFile(fileName.c_str());
145 
146  TTree * tree = (TTree*)file->Get("limit");
147 
148  // std::cout << "file : " << file << std::endl;
149  // std::cout << "tree : " << tree << std::endl;
150 
151  tree->SetBranchAddress("limit",&LIMIT);
152  tree->SetBranchAddress("mh",&MH);
153 
154  tree->GetEntry(0);
155 
156  if (MH<massMin) massMin = MH;
157  if (MH>massMax) massMax = MH;
158 
159  mA[counter] = MH;
160  minus2R[counter] = XSecToTanBeta(my,MH,LIMIT,minTanBeta,maxTanBeta);
161 
162  // std::cout << mA[counter] << std::endl;
163 
164  tree->GetEntry(1);
165  minus1R[counter] = XSecToTanBeta(my,MH,LIMIT,minTanBeta,maxTanBeta);
166 
167  tree->GetEntry(2);
168  medianR[counter] = XSecToTanBeta(my,MH,LIMIT,minTanBeta,maxTanBeta);
169 
170  tree->GetEntry(3);
171  plus1R[counter] = XSecToTanBeta(my,MH,LIMIT,minTanBeta,maxTanBeta);
172 
173  tree->GetEntry(4);
174  plus2R[counter] = XSecToTanBeta(my,MH,LIMIT,minTanBeta,maxTanBeta);
175 
176  tree->GetEntry(5);
177  obsR[counter] = XSecToTanBeta(my,MH,LIMIT,minTanBeta,maxTanBeta);
178  if (blindData)
179  obsR[counter] = medianR[counter];
180 
181  counter++;
182 
183  }
184 
185 
186  std::cout << std::endl;
187  std::cout << "m(H) -2s -1s median +1s +2s obs" << std::endl;
188 
189  for (int i=0; i<counter; ++i) {
190 
191  obs[i] = obsR[i];
192  minus2[i] = minus2R[i];
193  minus1[i] = minus1R[i];
194  median[i] = medianR[i];
195  plus1[i] = plus1R[i];
196  plus2[i] = plus2R[i];
197 
198  char strOut[400];
199  sprintf(strOut,"%4i %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f",
200  int(mA[i]),minus2[i],minus1[i],median[i],plus1[i],plus2[i],obs[i]);
201  std::cout << strOut << std::endl;
202 
203  }
204  std::cout << std::endl;
205 
206  double zeros[nPoints];
207  double upper[nPoints];
208  double lower[nPoints];
209  double central[nPoints];
210  for (int i=0; i<counter; ++i) {
211  zeros[i] = 0;
212  central[i] = 15;
213  minus2[i] = median[i] - minus2[i];
214  minus1[i] = median[i] - minus1[i];
215  plus1[i] = plus1[i] - median[i];
216  plus2[i] = plus2[i] - median[i];
217  upper[i] = 15 - central[i];
218  lower[i] = central[i] - obs[i];
219  }
220 
221 
222  int nPointsX = counter;
223 
224  TGraph * obsG = new TGraph(nPointsX, mA, obs);
225  obsG->SetLineWidth(3);
226  obsG->SetLineColor(1);
227  obsG->SetLineWidth(2);
228  obsG->SetMarkerColor(1);
229  obsG->SetMarkerStyle(20);
230  obsG->SetMarkerSize(1.4);
231 
232  TGraph * expG = new TGraph(nPointsX, mA, median);
233  expG->SetLineWidth(3);
234  expG->SetLineColor(2);
235  expG->SetLineStyle(2);
236 
237  TGraphAsymmErrors * observed = new TGraphAsymmErrors(nPointsX, mA, central, zeros, zeros, lower, upper);
238  observed->SetFillColor(kCyan-4);
239  observed->SetLineWidth(3);
240 
241  TGraphAsymmErrors * innerBand = new TGraphAsymmErrors(nPointsX, mA, median, zeros, zeros, minus1, plus1);
242  innerBand->SetFillColor(kGreen);
243  innerBand->SetLineColor(kGreen);
244 
245  TGraphAsymmErrors * outerBand = new TGraphAsymmErrors(nPointsX, mA, median, zeros, zeros, minus2, plus2);
246  outerBand->SetFillColor(kYellow);
247  outerBand->SetLineColor(kYellow);
248 
249  TH2F * frame = NULL;
250 
251  if (xMax>0) massMax = xMax;
252 
253  frame = new TH2F("frame","",2,massMin,massMax,2,yMin,yMax);
254  frame->GetXaxis()->SetTitle(xtitle.c_str());
255  frame->GetYaxis()->SetTitle(ytitle.c_str());
256  frame->GetXaxis()->SetNdivisions(510);
257  frame->GetYaxis()->SetNdivisions(206);
258  frame->GetYaxis()->SetTitleOffset(1.3);
259  frame->GetYaxis()->SetTitleSize(0.048);
260  frame->GetXaxis()->SetTitleOffset(1.05);
261 
262  TCanvas *canv = new TCanvas("canv", "histograms", 600, 600);
263 
264  frame->Draw();
265 
266  outerBand->Draw("3same");
267  innerBand->Draw("3same");
268  expG->Draw("lsame");
269  if (!blindData)
270  obsG->Draw("lpsame");
271 
272 // float xLeg = 0.18;
273 // float yLeg = 0.83;
274 // float xLegend = 0.57;
275 // float yLegend = 0.41;
276 // float sizeLeg = 0.27;
277 
278  TLegend * leg = new TLegend(0.65,0.17,0.92,0.44);
279  leg->SetFillColor(0);
280  leg->SetTextSize(0.035);
281  leg->SetBorderSize(0);
282  leg->SetHeader(header.c_str());
283  if (!blindData)
284  leg->AddEntry(obsG,"Observed","lp");
285  leg->AddEntry(expG,"Expected","l");
286  leg->AddEntry(innerBand,"#pm1#sigma Expected","f");
287  leg->AddEntry(outerBand,"#pm2#sigma Expected","f");
288  leg->Draw();
289  // TLine * line = new TLine(massMin,1,massMax,1);
290  // line->SetLineWidth(2);
291  // line->SetLineStyle(2);
292  // line->Draw();
293 
294  TPad * pad = (TPad*)canv->GetPad(0);
295  writeExtraText = true;
296  lumi_13TeV = Lumi;
297  extraText = "Simulation";
298  CMS_lumi(pad,4,11);
299  pad->RedrawAxis();
300 
301  leg->Draw();
302  canv->SetLogy(false);
303  canv->Update();
304  std::string out_name = bench_name + "_tanBeta";
305  if(output != "") out_name = out_name + output;
306  // canv->Print(suffix+".pdf","Portrait pdf");
307  canv->Print( (out_name + ".png").c_str() );
308  canv->Print( (out_name+".pdf").c_str());
309 
310 }
int H
Definition: PlotsCompare.cc:16
TFile * f[10]
Definition: PlotsCompare.cc:24
double XSecToTanBeta ( mssm_xs_tools  my,
double  mA,
double  xsection,
double  minTanBeta,
double  maxTanBeta 
)

Definition at line 18 of file PlotTanBetaLimit.h.

References mssm_xs_tools::bbHSantander_A(), mssm_xs_tools::bbHSantander_H(), mssm_xs_tools::br_Abb(), mssm_xs_tools::br_Hbb(), and naf_mult_submit::int.

Referenced by PlotTanBetaLimit().

22  {
23 
24  double minimalDifference = 1e+10;
25  bool rangeExceeded = true;
26  double tanBetaTarget = -1;
27  double xsecTarget = -1;
28  int ibmax = 10*int(maxTanBeta-minTanBeta);
29  for (int ib=0; ib<ibmax; ++ib) {
30 
31  double tanBeta = minTanBeta + 0.1*double(ib);
32 
33  double sigmaBBA = my.bbHSantander_A(mA,tanBeta);
34  double sigmaBBH = my.bbHSantander_H(mA,tanBeta);
35 
36  double BrAbb = my.br_Abb(mA,tanBeta);
37  double BrHbb = my.br_Hbb(mA,tanBeta);
38 
39  double totXSec = sigmaBBA*BrAbb + sigmaBBH*BrHbb;
40  double difference = TMath::Abs(totXSec-xsection);
41 
42  if (difference<minimalDifference) {
43  minimalDifference = difference;
44  tanBetaTarget = tanBeta;
45  xsecTarget = totXSec;
46  }
47 
48  if (totXSec>xsection) {
49  rangeExceeded = false;
50  break;
51  }
52 
53  }
54 
55  if (rangeExceeded)
56  tanBetaTarget = tanBetaTarget*TMath::Sqrt(xsection/xsecTarget);
57 
58  return tanBetaTarget;
59 
60 }
double br_Abb(double mA, double tanb)
get BR(A->bb) for given value of mA and tanb
double bbHSantander_H(double mA, double tanb)
get cross section for production of H in association with b quarks (using Santander matching scheme) ...
double bbHSantander_A(double mA, double tanb)
get cross section for production of A in association with b quarks (using Santander matching scheme) ...
double br_Hbb(double mA, double tanb)
get BR(H->bb) for given value of mA and tanb