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.

257 lines
8.3 KiB

  1. #ifndef CHARMPRODSCRIPTS_LHCBSTYLE_H
  2. #define CHARMPRODSCRIPTS_LHCBSTYLE_H 1
  3. #include "TStyle.h"
  4. #include "TROOT.h"
  5. #include "TPaveText.h"
  6. #include "TText.h"
  7. #include "TLatex.h"
  8. #include "TColor.h"
  9. #include <iomanip>
  10. #include <iostream>
  11. using namespace std;
  12. TStyle *lhcbStyle= new TStyle("lhcbStyle","LHCb official plots style");
  13. //TPaveText *lhcbName = new TPaveText(0.65,0.8,0.9,0.9,"BRNDC");
  14. TText *lhcbLabel = new TText();
  15. TLatex *lhcbLatex = new TLatex();
  16. TPaveText *lhcb7TeVPrelimL = new TPaveText();
  17. TPaveText *lhcb0_9TeVPrelimL = new TPaveText();
  18. void LHCbStyle(Bool_t colzPlot=kFALSE, Int_t NCont=25)
  19. {
  20. // ////////////////////////////////////////////////////////////////////
  21. // // PURPOSE:
  22. // //
  23. // // This header file defines a reasonable style for (black-and-white)
  24. // // "publication quality" ROOT plots. The default settings contain
  25. // // many features that are either not desirable for printing on white
  26. // // paper or impair the general readibility of plots.
  27. // //
  28. // // USAGE:
  29. //
  30. // Simply include the line
  31. // #include "LHCbStyle.h"
  32. // at the beginning of your root program (and make sure LHCbStyle.h is
  33. // in a location accessible to the compiler). Then add the line
  34. // lhcbStyle();
  35. // somewhere at the beginning of your main().
  36. //
  37. // SOME COMMENTS:
  38. //
  39. // Statistics and fit boxes:
  40. //
  41. // "Decorative" items around the histogram are kept to a minimum.
  42. // In particular there is no box with statistics or fit information.
  43. // You can easily change this either by editing your private copy
  44. // of this style file or by calls to "gStyle" in your macro.
  45. // For example,
  46. // gStyle->SetOptFit(1011);
  47. // will add some fit information.
  48. //
  49. // Font:
  50. //
  51. // The font is chosen to be 62, i.e.helvetica-bold-r-normal with
  52. // precision 2. Font is of course a matter of taste, but most people
  53. // will probably agree that Helvetica bold gives close to optimal
  54. // readibility in presentations. It appears to be the ROOT default,
  55. // and since there are still some features in ROOT that simply won't
  56. // respond to any font requests, it is the wise choice to avoid
  57. // ugly font mixtures on the same plot... The precision of the font (2)
  58. // is chosen in order to have a rotatable and scalable font. Be sure
  59. // to use true-type fonts! I.e.
  60. // Unix.*.Root.UseTTFonts: true in your .rootrc file.
  61. //
  62. // "Landscape histograms":
  63. //
  64. // The style here is designed for more or less quadratic plots.
  65. // For very long histograms, adjustements are needed. For instance,
  66. // for a canvas with 1x5 histograms:
  67. // TCanvas* c1 = new TCanvas("c1", "L0 muons", 600, 800);
  68. // c1->Divide(1,5);
  69. // adaptions like the following will be needed:
  70. // gStyle->SetTickLength(0.05,"x");
  71. // gStyle->SetTickLength(0.01,"y");
  72. // gStyle->SetLabelSize(0.15,"x");
  73. // gStyle->SetLabelSize(0.1,"y");
  74. // gStyle->SetStatW(0.15);
  75. // gStyle->SetStatH(0.5);
  76. //
  77. ////////////////////////////////////////////////////////////////////
  78. // define names for colours
  79. //Int_t black = 1;
  80. //Int_t red = 2;
  81. //Int_t green = 3;
  82. //Int_t blue = 4;
  83. //Int_t yellow = 5;
  84. //Int_t magenta= 6;
  85. //Int_t cyan = 7;
  86. //Int_t purple = 9;
  87. Int_t lhcbFont = 132; // Old LHCb style: 62;
  88. // Line thickness
  89. Double_t lhcbWidth = 2.00; // Old LHCb style: 3.00;
  90. // Text size
  91. Double_t lhcbTSize = 0.06;
  92. lhcbStyle->SetFillColor(1);
  93. lhcbStyle->SetFillStyle(1001); // solid
  94. lhcbStyle->SetFrameFillColor(0);
  95. lhcbStyle->SetFrameBorderMode(0);
  96. lhcbStyle->SetPadBorderMode(0);
  97. lhcbStyle->SetPadColor(0);
  98. lhcbStyle->SetCanvasBorderMode(0);
  99. lhcbStyle->SetCanvasColor(0);
  100. lhcbStyle->SetStatColor(0);
  101. lhcbStyle->SetLegendBorderSize(0);
  102. lhcbStyle->SetLegendFont(132);
  103. // If you want the usual gradient palette (blue -> red)
  104. lhcbStyle->SetPalette(1);
  105. // If you want colors that correspond to gray scale in black and white:
  106. int colors[8] = {0,5,7,3,6,2,4,1};
  107. lhcbStyle->SetPalette(8,colors);
  108. // set the paper & margin sizes
  109. lhcbStyle->SetPaperSize(20,26);
  110. lhcbStyle->SetPadTopMargin(0.05);
  111. lhcbStyle->SetPadRightMargin(0.05); // increase for colz plots
  112. lhcbStyle->SetPadBottomMargin(0.16);
  113. lhcbStyle->SetPadLeftMargin(0.14);
  114. // use large fonts
  115. lhcbStyle->SetTextFont(lhcbFont);
  116. lhcbStyle->SetTextSize(lhcbTSize);
  117. lhcbStyle->SetLabelFont(lhcbFont,"x");
  118. lhcbStyle->SetLabelFont(lhcbFont,"y");
  119. lhcbStyle->SetLabelFont(lhcbFont,"z");
  120. lhcbStyle->SetLabelSize(lhcbTSize,"x");
  121. lhcbStyle->SetLabelSize(lhcbTSize,"y");
  122. lhcbStyle->SetLabelSize(lhcbTSize,"z");
  123. lhcbStyle->SetTitleFont(lhcbFont);
  124. lhcbStyle->SetTitleFont(lhcbFont,"x");
  125. lhcbStyle->SetTitleFont(lhcbFont,"y");
  126. lhcbStyle->SetTitleFont(lhcbFont,"z");
  127. lhcbStyle->SetTitleSize(1.2*lhcbTSize,"x");
  128. lhcbStyle->SetTitleSize(1.2*lhcbTSize,"y");
  129. lhcbStyle->SetTitleSize(1.2*lhcbTSize,"z");
  130. // use medium bold lines and thick markers
  131. lhcbStyle->SetLineWidth(lhcbWidth);
  132. lhcbStyle->SetFrameLineWidth(lhcbWidth);
  133. lhcbStyle->SetHistLineWidth(lhcbWidth);
  134. lhcbStyle->SetFuncWidth(lhcbWidth);
  135. lhcbStyle->SetGridWidth(lhcbWidth);
  136. lhcbStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes
  137. lhcbStyle->SetMarkerStyle(20);
  138. lhcbStyle->SetMarkerSize(1.0);
  139. // label offsets
  140. lhcbStyle->SetLabelOffset(0.010,"X");
  141. lhcbStyle->SetLabelOffset(0.010,"Y");
  142. // by default, do not display histogram decorations:
  143. lhcbStyle->SetOptStat(0);
  144. //lhcbStyle->SetOptStat("emr"); // show only nent -e , mean - m , rms -r
  145. // full opts at http://root.cern.ch/root/html/TStyle.html#TStyle:SetOptStat
  146. lhcbStyle->SetStatFormat("6.3g"); // specified as c printf options
  147. lhcbStyle->SetOptTitle(0);
  148. lhcbStyle->SetOptFit(0);
  149. //lhcbStyle->SetOptFit(1011); // order is probability, Chi2, errors, parameters
  150. //titles
  151. lhcbStyle->SetTitleOffset(0.95,"X");
  152. lhcbStyle->SetTitleOffset(0.95,"Y");
  153. lhcbStyle->SetTitleOffset(1.2,"Z");
  154. lhcbStyle->SetTitleFillColor(0);
  155. lhcbStyle->SetTitleStyle(0);
  156. lhcbStyle->SetTitleBorderSize(0);
  157. lhcbStyle->SetTitleFont(lhcbFont,"title");
  158. lhcbStyle->SetTitleX(0.0);
  159. lhcbStyle->SetTitleY(1.0);
  160. lhcbStyle->SetTitleW(1.0);
  161. lhcbStyle->SetTitleH(0.05);
  162. // look of the statistics box:
  163. lhcbStyle->SetStatBorderSize(0);
  164. lhcbStyle->SetStatFont(lhcbFont);
  165. lhcbStyle->SetStatFontSize(0.05);
  166. lhcbStyle->SetStatX(0.9);
  167. lhcbStyle->SetStatY(0.9);
  168. lhcbStyle->SetStatW(0.25);
  169. lhcbStyle->SetStatH(0.15);
  170. // put tick marks on top and RHS of plots
  171. lhcbStyle->SetPadTickX(1);
  172. lhcbStyle->SetPadTickY(1);
  173. // histogram divisions: only 5 in x to avoid label overlaps
  174. lhcbStyle->SetNdivisions(505,"x");
  175. lhcbStyle->SetNdivisions(510,"y");
  176. //// add LHCb label
  177. //lhcbName = new TPaveText(gStyle->GetPadLeftMargin() + 0.05,
  178. // 0.87 - gStyle->GetPadTopMargin(),
  179. // gStyle->GetPadLeftMargin() + 0.20,
  180. // 0.95 - gStyle->GetPadTopMargin(),
  181. // "BRNDC");
  182. //lhcbName->AddText("LHCb");
  183. //lhcbName->SetFillColor(0);
  184. //lhcbName->SetTextAlign(12);
  185. //lhcbName->SetBorderSize(0);
  186. lhcbLabel->SetTextFont(lhcbFont);
  187. lhcbLabel->SetTextColor(1);
  188. lhcbLabel->SetTextSize(lhcbTSize);
  189. lhcbLabel->SetTextAlign(12);
  190. lhcbLatex->SetTextFont(lhcbFont);
  191. lhcbLatex->SetTextColor(1);
  192. lhcbLatex->SetTextSize(lhcbTSize);
  193. lhcbLatex->SetTextAlign(12);
  194. //update me/michel
  195. {
  196. gStyle->SetPaintTextFormat("0.2f");
  197. const Int_t NRGBs = 5;
  198. const Int_t NCont = 255;
  199. Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
  200. Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
  201. Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
  202. Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
  203. TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
  204. lhcbStyle->SetNumberContours(NCont);
  205. //const Int_t NCont = 200;
  206. //Double_t Red[5] = { 0., 0., 1., 1., 1. };
  207. //Double_t Green[5] = { 0., .5, 1., .5, 0. };
  208. //Double_t Blue[5] = { 1., 1., 1., 0., 0. };
  209. ////Double_t Red[5] = { 0., 0., .6, 1., 0.45 };
  210. ////Double_t Green[5] = { 0., 0., .6, 0., 0. };
  211. ////Double_t Blue[5] = { 0.2, 1., .6, 0., 0. };
  212. //Double_t Length[5] = { 0.00, 0.25, 0.5, 0.75, 1.00 };
  213. //TColor::CreateGradientColorTable(5, Length, Red, Green, Blue, NCont);
  214. //lhcbStyle->SetNumberContours(NCont);
  215. }
  216. gROOT->SetStyle("lhcbStyle");
  217. gROOT->ForceStyle();
  218. }
  219. #endif