data analysis scripts
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.

179 lines
5.8 KiB

  1. {
  2. ////////////////////////////////////////////////////////////////////
  3. // PURPOSE:
  4. //
  5. // This macro defines a reasonable style for (black-and-white)
  6. // "publication quality" ROOT plots. The default settings contain
  7. // many features that are either not desirable for printing on white
  8. // paper or impair the general readibility of plots.
  9. //
  10. // USAGE:
  11. //
  12. // Simply include the line
  13. // gROOT->ProcessLine(".x $LHCBSTYLE/root/lhcbstyle.C");
  14. // at the beginning of your root macro.
  15. //
  16. // SOME COMMENTS:
  17. //
  18. // Statistics and fit boxes:
  19. //
  20. // "Decorative" items around the histogram are kept to a minimum.
  21. // In particular there is no box with statistics or fit information.
  22. // You can easily change this either by editing your private copy
  23. // of this style file or by calls to "gStyle" in your macro.
  24. // For example,
  25. // gStyle->SetOptFit(1011);
  26. // will add some fit information.
  27. //
  28. // Font:
  29. //
  30. // The font is chosen to be 62, i.e.helvetica-bold-r-normal with
  31. // precision 2. Font is of course a matter of taste, but most people
  32. // will probably agree that Helvetica bold gives close to optimal
  33. // readibility in presentations. It appears to be the ROOT default,
  34. // and since there are still some features in ROOT that simply won't
  35. // respond to any font requests, it is the wise choice to avoid
  36. // ugly font mixtures on the same plot... The precision of the font (2)
  37. // is chosen in order to have a rotatable and scalable font. Be sure
  38. // to use true-type fonts! I.e.
  39. // Unix.*.Root.UseTTFonts: true in your .rootrc file.
  40. //
  41. // "Landscape histograms":
  42. //
  43. // The style here is designed for more or less quadratic plots.
  44. // For very long histograms, adjustements are needed. For instance,
  45. // for a canvas with 1x5 histograms:
  46. // TCanvas* c1 = new TCanvas("c1", "L0 muons", 600, 800);
  47. // c1->Divide(1,5);
  48. // adaptions like the following will be needed:
  49. // gStyle->SetTickLength(0.05,"x");
  50. // gStyle->SetTickLength(0.01,"y");
  51. // gStyle->SetLabelSize(0.15,"x");
  52. // gStyle->SetLabelSize(0.1,"y");
  53. // gStyle->SetStatW(0.15);
  54. // gStyle->SetStatH(0.5);
  55. //
  56. ////////////////////////////////////////////////////////////////////
  57. gROOT->Reset();
  58. cout << "executing lhcbStyle.C:" << endl;
  59. cout << " " << endl;
  60. cout << " " << endl;
  61. cout << " $ $ $ $$$ $ " << endl;
  62. cout << " $ $ $ $ $ " << endl;
  63. cout << " $ $$$$$ $ $$$ " << endl;
  64. cout << " $ $ $ $ $ $ " << endl;
  65. cout << " $$$$$ $ $ $$$ $$$ " << endl;
  66. cout << " " << endl;
  67. cout << " LHCb ROOT style file " << endl;
  68. cout << " " << endl;
  69. cout <<
  70. " Problems, suggestions, contributions to Thomas.Schietinger@cern.ch"
  71. << endl;
  72. cout << " " << endl;
  73. TStyle *lhcbStyle= new TStyle("lhcbStyle","LHCb official plots style");
  74. // use helvetica-bold-r-normal, precision 2 (rotatable)
  75. Int_t lhcbFont = 22; //62;
  76. // line thickness
  77. Double_t lhcbWidth = 2;
  78. // use plain black on white colors
  79. lhcbStyle->SetFrameBorderMode(0);
  80. lhcbStyle->SetCanvasBorderMode(0);
  81. lhcbStyle->SetPadBorderMode(0);
  82. lhcbStyle->SetPadColor(0);
  83. lhcbStyle->SetCanvasColor(0);
  84. lhcbStyle->SetStatColor(0);
  85. lhcbStyle->SetPalette(1);
  86. lhcbStyle->SetTitleColor(1);
  87. lhcbStyle->SetFillColor(1);//0
  88. lhcbStyle->SetFillStyle(0);
  89. // set the paper & margin sizes
  90. lhcbStyle->SetPaperSize(20,26);
  91. lhcbStyle->SetPadTopMargin(0.05);
  92. //lhcbStyle->SetPadRightMargin(0.05); // increase for colz plots!!
  93. lhcbStyle->SetPadRightMargin(0.08); // increase for colz plots!!
  94. lhcbStyle->SetPadBottomMargin(0.16);
  95. lhcbStyle->SetPadLeftMargin(0.14);
  96. // use large fonts
  97. lhcbStyle->SetTextFont(lhcbFont);
  98. lhcbStyle->SetTextSize(0.08);
  99. lhcbStyle->SetLabelFont(lhcbFont,"x");
  100. lhcbStyle->SetLabelFont(lhcbFont,"y");
  101. lhcbStyle->SetLabelFont(lhcbFont,"z");
  102. lhcbStyle->SetLabelSize(0.05,"x");
  103. lhcbStyle->SetLabelSize(0.05,"y");
  104. lhcbStyle->SetLabelSize(0.05,"z");
  105. lhcbStyle->SetTitleFont(lhcbFont);
  106. lhcbStyle->SetTitleFont(lhcbFont,"y");
  107. lhcbStyle->SetTitleFont(lhcbFont,"x");
  108. lhcbStyle->SetTitleFont(lhcbFont,"z");
  109. lhcbStyle->SetTitleSize(0.06,"x");
  110. lhcbStyle->SetTitleSize(0.06,"y");
  111. lhcbStyle->SetTitleSize(0.06,"z");
  112. // use bold lines and markers
  113. lhcbStyle->SetLineWidth(lhcbWidth);
  114. lhcbStyle->SetFrameLineWidth(lhcbWidth);
  115. lhcbStyle->SetHistLineWidth(lhcbWidth);
  116. lhcbStyle->SetFuncWidth(lhcbWidth);
  117. lhcbStyle->SetGridWidth(lhcbWidth);
  118. lhcbStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes
  119. lhcbStyle->SetMarkerStyle(21);
  120. lhcbStyle->SetMarkerSize(1.0);
  121. // label offsets
  122. lhcbStyle->SetLabelOffset(0.015);
  123. // by default, do not display histogram decorations:
  124. lhcbStyle->SetOptStat(0);
  125. //lhcbStyle->SetOptStat(1110); // show only nent, mean, rms
  126. lhcbStyle->SetOptTitle(0);
  127. lhcbStyle->SetOptFit(0);
  128. //lhcbStyle->SetOptFit(1011); // show probability, parameters and errors
  129. // look of the statistics box:
  130. lhcbStyle->SetStatBorderSize(1);
  131. lhcbStyle->SetStatFont(lhcbFont);
  132. lhcbStyle->SetStatFontSize(0.05);
  133. lhcbStyle->SetStatX(0.9);
  134. lhcbStyle->SetStatY(0.9);
  135. lhcbStyle->SetStatW(0.25);
  136. lhcbStyle->SetStatH(0.15);
  137. // put tick marks on top and RHS of plots
  138. lhcbStyle->SetPadTickX(1);
  139. lhcbStyle->SetPadTickY(1);
  140. // histogram divisions: only 5 in x to avoid label overlaps
  141. lhcbStyle->SetNdivisions(505,"x");
  142. lhcbStyle->SetNdivisions(510,"y");
  143. gROOT->SetStyle("lhcbStyle");
  144. gROOT->ForceStyle();
  145. TPaveText *lhcbName = new TPaveText(0.65,0.8,0.9,0.9,"BRNDC");
  146. lhcbName->SetFillColor(0);
  147. lhcbName->SetTextAlign(12);
  148. lhcbName->SetBorderSize(0);
  149. lhcbName->AddText("LHCb");
  150. TText *lhcbLabel = new TText();
  151. lhcbLabel->SetTextFont(lhcbFont);
  152. lhcbLabel->SetTextColor(1);
  153. lhcbLabel->SetTextSize(0.04);
  154. lhcbLabel->SetTextAlign(12);
  155. TLatex *lhcbLatex = new TLatex();
  156. lhcbLatex->SetTextFont(lhcbFont);
  157. lhcbLatex->SetTextColor(1);
  158. lhcbLatex->SetTextSize(0.04);
  159. lhcbLatex->SetTextAlign(12);
  160. lhcbStyle->SetLegendFillColor(kWhite);
  161. }