Angular analysis of B+->K*+(K+pi0)mumu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

239 lines
9.5 KiB

  1. #ifndef DESIGN_HPP
  2. #define DESIGN_HPP
  3. //===========================================================================
  4. //
  5. // Functions for creating pretty figures
  6. //
  7. // 2016: Renata Kopecna
  8. //===========================================================================
  9. //--- c++ libs ---//
  10. #include <string.h>
  11. #include <iostream>
  12. #include <sstream>
  13. //--- ROOT libs ---//
  14. #include <TROOT.h>
  15. #include <TSystem.h>
  16. #include <TH1F.h>
  17. #include <TH1D.h>
  18. #include <TColor.h>
  19. #include <TAxis.h>
  20. #include <TCanvas.h>
  21. #include <TH2F.h>
  22. #include <TF1.h>
  23. #include <TStyle.h>
  24. #include <TPaveText.h>
  25. #include <TLine.h>
  26. #include <TEfficiency.h>
  27. #include <TLegend.h>
  28. #include <TGraphErrors.h>
  29. #include "Paths.hpp"
  30. using namespace std;
  31. ///////////////////////////////////////////////////////////////////////////////////
  32. ///
  33. ///
  34. /// ##### Basic rules for plotting various histograms
  35. ///
  36. /// ### design_markers
  37. /// # Designs histogram's markers, sets titles and color
  38. ///
  39. /// ### design_lines
  40. /// # Designs histogram's lines, sets titles and color
  41. ///
  42. /// ### design_filled_plot
  43. /// # Designs filled histograms, including titles, color and fill style
  44. /// # two options: with or without lines
  45. ///
  46. /// ### design_canvas, design canvas TH2F, design_canvas_ridge_fancy
  47. /// # initializes canvases basic, TH2F and fancy canvases
  48. ///
  49. /// ### design_2D_legend, design_2D_legend_integrated
  50. /// # designes box with legend with given pT and multiplicity
  51. ///
  52. /// ### design_TH2F
  53. /// # Sets axis names and palette for 2D histograms
  54. ///
  55. /// ### design_TH2F_ratio
  56. /// # Sets axis names and palette for 2D histograms for ratios
  57. ///
  58. /// ### design_function
  59. /// # Sets width and color of a TF1
  60. ///
  61. /// ### design_cut_line
  62. /// # Designes the line used for cuts in distribution plots
  63. ///
  64. /// ### design_ratio_line
  65. /// # Designes the line for True/MC ratios
  66. ///
  67. ///
  68. ////////////////////////////////////////////////////////////////////////////////////
  69. ///
  70. const string recoMassKplus = (UseDTF ? "m(K^{+}#pi^{0}#mu^{+}#mu^{-})" : "m(K^{+}#gamma#gamma#mu^{+}#mu^{-})");
  71. void design_markers(TH1F *histogram, string xaxis_name, string yaxis_name, Color_t color);
  72. void design_markers(TH1D *histogram, string xaxis_name, string yaxis_name, Color_t color);
  73. void design_markers(TEfficiency *histogram, string xaxis_name, string yaxis_name, Color_t color);
  74. void design_lines(TH1F *histogram, string xaxis_name, string yaxis_name, Color_t color);
  75. void design_lines(TH1D *histogram, string xaxis_name, string yaxis_name, Color_t color);
  76. void design_lines(TH1 *histogram, string xaxis_name, string yaxis_name, Color_t color);
  77. void design_filled_plot(TH1F *histogram, string xaxis_name, string yaxis_name, Color_t fill_color, int fill_style);
  78. void design_filled_plot(TH1D *histogram, string xaxis_name, string yaxis_name, Color_t fill_color, int fill_style);
  79. void design_filled_plot(TH1F *histogram, string xaxis_name, string yaxis_name, Color_t fill_color, int fill_style, Color_t line_color);
  80. void design_filled_plot(TH1D *histogram, string xaxis_name, string yaxis_name, Color_t fill_color, int fill_style , Color_t line_color);
  81. void design_canvas(TCanvas *canvas);
  82. void design_canvas(TCanvas *canvas, string title);
  83. void design_canvas_Bmass(TCanvas *canvas);
  84. void design_canvas_Bmass(TCanvas *canvas, string title);
  85. TCanvas *c_TH2F(string c_name);
  86. void design_canvas_TH2F(TCanvas *canvas);
  87. void design_canvas_fancy(TCanvas *canvas);
  88. TCanvas *c_canvas(string name);
  89. void design_TH2F(TH2F *histogram, string xaxis_name, string yaxis_name, string zaxis_name);
  90. void design_TH2F(TH2D *histogram, string xaxis_name, string yaxis_name, string zaxis_name);
  91. void design_TH2F(TH2F *histogram, string xaxis_name, string yaxis_name, string zaxis_name, int palette);
  92. void design_TH2F(TH2D *histogram, string xaxis_name, string yaxis_name, string zaxis_name, int palette);
  93. void design_TH2F_ratio(TH2F *histogram, string xaxis_name, string yaxis_name, string zaxis_name, int palette);
  94. void design_TH2F_ratio(TH2D *histogram, string xaxis_name, string yaxis_name, string zaxis_name, int palette);
  95. TH1D *generalHistogram(string hist_name, string title, int nBins, double low_edge, double high_edge, string xaxis_name, string yaxis_name, Color_t color);
  96. void design_function(TF1 *graph, Color_t color);
  97. void design_function(TF1 *graph, Color_t color, int style);
  98. void design_TH1F(TH1F *histogram, string xaxis_name, string yaxis_name, Color_t color);
  99. void design_TH1D(TH1D *histogram, string xaxis_name, string yaxis_name, Color_t color);
  100. void design_TH1F(TH1F *histogram, string xaxis_name, string yaxis_name, Color_t color, int marker_style);
  101. void design_TH1D(TH1D *histogram, string xaxis_name, string yaxis_name, Color_t color, int marker_style);
  102. void design_TH1F(TH1F *histogram, string xaxis_name, string yaxis_name, Color_t color, int marker_style, double x_low, double x_up, double y_low, double y_up);
  103. void design_TH1D(TH1D *histogram, string xaxis_name, string yaxis_name, Color_t color, int marker_style, double x_low, double x_up, double y_low, double y_up);
  104. TLine *design_cut_line(float x1, float y1, float x2, float y2, Color_t color);
  105. TLine *design_veto_line(float x1, float y1, float x2, float y2, Color_t color);
  106. TLine *design_ratio_line(float x1, float x2, Color_t color);
  107. void designTGraph(TGraphErrors *graph, string title, string xAxisName, string yAxisName, Color_t color, Int_t markerStyle);
  108. ////////////////////////////////////
  109. ///
  110. ///
  111. /// TMVA plots
  112. ///
  113. ///
  114. ////////////////////////////////////
  115. bool DesignCorrelationPlots(TH2F *h_corr);
  116. TCanvas *c_forCOLZ(string name);
  117. TCanvas *c_Correlation(string type);
  118. bool designVariablesSignalVsBackground(TH1F *h_variableS, TH1F *h_variableB);
  119. bool designResponseSignalVsBackground(TH1F *h_responseS, TH1F *h_responseB, string method);
  120. bool designOvertraining(TH1F *h_responseS, TH1F *h_responseB);
  121. TCanvas *c_VariablesSignalVsBackground(string variable);
  122. TCanvas *c_Efficiency(string c_name);
  123. bool designEfficiency(TH1F *h_efficiencySignal,TH1F *h_efficiencyBackground,TH1F *h_purity,TH1F *h_significance, string method);
  124. TPaveText *significanceText(double xmin, int nSig, int nBkg, double maxSignificance, double maxSignificanceMLPcut);
  125. TCanvas *c_ROCplot(string c_name);
  126. void designROC(TH1F* h_ROC, int index);
  127. ////////////////////////////////////
  128. ///
  129. ///
  130. /// Efficiencies
  131. ///
  132. ///
  133. ////////////////////////////////////
  134. TPaveText *text_effFromPi0(double yieldSig, double yieldBkg, double ymax);
  135. TCanvas *c_L0MuonEff(string c_name);
  136. void designL0MuonEffHistos(TH1D *L0MuonEffData,TH1D *L0MuonEffMC, TH1D *L0MuonEffRatio);
  137. TCanvas * designL0MuonEfficiencies(string year, string magnet,TH1D *L0MuonEffData,TH1D *L0MuonEffMC, TH1D *L0MuonEffRatio, string extraString);
  138. void designBasicEfficiency(TGraphErrors *graph, string title, string xAxisName, string effName, double lowRange, double highRange);
  139. void designBasicEfficiency(TGraphErrors *graph, string title, string xAxisName, string effName, double lowRange, double highRange, Color_t color);
  140. void designMultiGraphEfficiency(TMultiGraph *graph, string title, string xAxisName, string effName, double lowRange, double highRange);
  141. ////////////////////////////////////
  142. ///
  143. ///
  144. /// Other plots
  145. ///
  146. ///
  147. ////////////////////////////////////
  148. TH1D *BmassHistogram(string hist_name, string title, string xaxis_name,Color_t color);
  149. void TM_canvas(string name, TH1D *all, TH1D *TMed, TH1D *notTMed, string year, bool ReferenceChannel, bool PHSP, bool B0, bool K1, bool Inc);
  150. void designMultiGraph(TMultiGraph *multGraph, string name, string xaxis_name, string yaxis_name, double lowx, double highx, double lowy, double highy);
  151. void designMultiGraph(TMultiGraph *multGraph, string name, string xaxis_name, string yaxis_name);
  152. void addYearTag(Float_t x, Float_t y, string year, int Run, Int_t color, Float_t Scaling);
  153. void addAnyTag(Float_t x, Float_t y, string text, Int_t color, Float_t Scaling);
  154. ////////////////////////////////////
  155. ///
  156. ///
  157. /// Truth-matching stuff
  158. ///
  159. ///
  160. ////////////////////////////////////
  161. TCanvas *c_for_TH2D(string name);
  162. TH1D *hist_cosThetaK(string hist_name, string title, Color_t color, bool cos);
  163. TH1D *hist_cosAngle(string angle, string hist_name, string title, Color_t color, bool cos, bool norm);
  164. ////////////////////////////////////
  165. ///
  166. ///
  167. /// Mass fit stuff
  168. ///
  169. ///
  170. ////////////////////////////////////
  171. void designMassFitFrame(RooPlot* frame, float pullHeight);
  172. void designPullFrame(RooPlot *pullFrame, RooPlot *frame_m, float pullHeight);
  173. TLine *threeSigmaLine (bool plus);
  174. ////////////////////////////////////
  175. ///
  176. ///
  177. /// reweighting control plots
  178. ///
  179. ///
  180. ////////////////////////////////////
  181. void drawKolmogorovTest(TH1D *hist_nTracks, TH1D * hist_nTracks_MC, string canvasPath, string TMtype);
  182. void drawWeightRatio(TH1D *hist_w, string canvasPath, bool is2D, string TMtype);
  183. void drawWeightCorrelation(TH2D *hCorrelationCheck, double CorrelationCoefficent, string canvasPath);
  184. ////////////////////////////////////
  185. ///
  186. ///
  187. /// BDT scan
  188. ///
  189. ///
  190. ////////////////////////////////////
  191. void designYieldGraph(TGraphErrors *graph, int Run, string year, string tag, string basicPath, TFile *TGraphOutput, bool fineScan);
  192. ////////////////////////////////////
  193. ///
  194. ///
  195. /// Yiled plots
  196. ///
  197. ///
  198. ////////////////////////////////////
  199. void design_YieldInQ2(int Run, TGraphErrors *graphSig, TGraphErrors *graphBkg, TGraphErrors *graphSignificance, TGraphErrors *CMS, bool fixRange);
  200. void design_SignificanceInQ2(int Run, TGraphErrors *graphSignificance, TGraphErrors *CMS, bool fixRange);
  201. #endif // DESIGN_HPP