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.

196 lines
6.4 KiB

  1. // all users - please change the name of this file to lhcbStyle.C
  2. // Commits to lhcbdocs svn of .C files are not allowed
  3. {
  4. // define names for colours
  5. Int_t black = 1;
  6. Int_t red = 2;
  7. Int_t green = 3;
  8. Int_t blue = 4;
  9. Int_t yellow = 5;
  10. Int_t magenta= 6;
  11. Int_t cyan = 7;
  12. Int_t purple = 9;
  13. ////////////////////////////////////////////////////////////////////
  14. // PURPOSE:
  15. //
  16. // This macro defines a standard style for (black-and-white)
  17. // "publication quality" LHCb ROOT plots.
  18. //
  19. // USAGE:
  20. //
  21. // Include the lines
  22. // gROOT->ProcessLine(".L lhcbstyle.C");
  23. // lhcbStyle();
  24. // at the beginning of your root macro.
  25. //
  26. // Example usage is given in myPlot.C
  27. //
  28. // COMMENTS:
  29. //
  30. // Font:
  31. //
  32. // The font is chosen to be 132, this is Times New Roman (like the text of
  33. // your document) with precision 2.
  34. //
  35. // "Landscape histograms":
  36. //
  37. // The style here is designed for more or less square plots.
  38. // For longer histograms, or canvas with many pads, adjustements are needed.
  39. // For instance, for a canvas with 1x5 histograms:
  40. // TCanvas* c1 = new TCanvas("c1", "L0 muons", 600, 800);
  41. // c1->Divide(1,5);
  42. // Adaptions like the following will be needed:
  43. // gStyle->SetTickLength(0.05,"x");
  44. // gStyle->SetTickLength(0.01,"y");
  45. // gStyle->SetLabelSize(0.15,"x");
  46. // gStyle->SetLabelSize(0.1,"y");
  47. // gStyle->SetStatW(0.15);
  48. // gStyle->SetStatH(0.5);
  49. //
  50. // Authors: Thomas Schietinger, Andrew Powell, Chris Parkes, Niels Tuning
  51. // Maintained by Editorial board member (currently Niels)
  52. ///////////////////////////////////////////////////////////////////
  53. // Use times new roman, precision 2
  54. Int_t lhcbFont = 132; // Old LHCb style: 62;
  55. // Line thickness
  56. Double_t lhcbWidth = 1.00; // Old LHCb style: 3.00;
  57. // Text size
  58. Double_t lhcbTSize = 0.04; // 0.04
  59. // use plain black on white colors
  60. gROOT->SetStyle("Plain");
  61. TStyle *lhcbStyle= new TStyle("lhcbStyle","LHCb plots style");
  62. //lhcbStyle->SetErrorX(0); // don't suppress the error bar along X
  63. lhcbStyle->SetFillColor(1);
  64. lhcbStyle->SetFillStyle(1001); // solid
  65. lhcbStyle->SetFrameFillColor(0);
  66. lhcbStyle->SetFrameBorderMode(0);
  67. lhcbStyle->SetPadBorderMode(0);
  68. lhcbStyle->SetPadColor(0);
  69. lhcbStyle->SetCanvasBorderMode(0);
  70. lhcbStyle->SetCanvasColor(0);
  71. lhcbStyle->SetStatColor(0);
  72. lhcbStyle->SetLegendBorderSize(0);
  73. lhcbStyle->SetLegendFont(132);
  74. // If you want the usual gradient palette (blue -> red)
  75. lhcbStyle->SetPalette(1);
  76. // If you want colors that correspond to gray scale in black and white:
  77. int colors[8] = {0,5,7,3,6,2,4,1};
  78. lhcbStyle->SetPalette(8,colors);
  79. // set the paper & margin sizes
  80. lhcbStyle->SetPaperSize(20,26);
  81. lhcbStyle->SetPadTopMargin(0.05);
  82. lhcbStyle->SetPadRightMargin(0.06); // increase for colz plots
  83. lhcbStyle->SetPadBottomMargin(0.16);
  84. lhcbStyle->SetPadLeftMargin(0.14);
  85. // use large fonts
  86. lhcbStyle->SetTextFont(lhcbFont);
  87. lhcbStyle->SetTextSize(lhcbTSize);
  88. lhcbStyle->SetLabelFont(lhcbFont,"x");
  89. lhcbStyle->SetLabelFont(lhcbFont,"y");
  90. lhcbStyle->SetLabelFont(lhcbFont,"z");
  91. lhcbStyle->SetLabelSize(lhcbTSize,"x");
  92. lhcbStyle->SetLabelSize(lhcbTSize,"y");
  93. lhcbStyle->SetLabelSize(lhcbTSize,"z");
  94. lhcbStyle->SetTitleFont(lhcbFont);
  95. lhcbStyle->SetTitleFont(lhcbFont,"x");
  96. lhcbStyle->SetTitleFont(lhcbFont,"y");
  97. lhcbStyle->SetTitleFont(lhcbFont,"z");
  98. lhcbStyle->SetTitleSize(1.0*lhcbTSize,"x");
  99. lhcbStyle->SetTitleSize(1.0*lhcbTSize,"y");
  100. lhcbStyle->SetTitleSize(1.0*lhcbTSize,"z");
  101. // use medium bold lines and thick markers
  102. lhcbStyle->SetLineWidth(lhcbWidth);
  103. lhcbStyle->SetFrameLineWidth(lhcbWidth);
  104. lhcbStyle->SetHistLineWidth(lhcbWidth);
  105. lhcbStyle->SetFuncWidth(lhcbWidth);
  106. lhcbStyle->SetGridWidth(lhcbWidth);
  107. lhcbStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes
  108. lhcbStyle->SetMarkerStyle(20);
  109. lhcbStyle->SetMarkerSize(1.0);
  110. // label offsets
  111. lhcbStyle->SetLabelOffset(0.010,"X");
  112. lhcbStyle->SetLabelOffset(0.010,"Y");
  113. // by default, do not display histogram decorations:
  114. lhcbStyle->SetOptStat(0);
  115. //lhcbStyle->SetOptStat("emr"); // show only nent -e , mean - m , rms -r
  116. // full opts at http://root.cern.ch/root/html/TStyle.html#TStyle:SetOptStat
  117. lhcbStyle->SetStatFormat("6.3g"); // specified as c printf options
  118. lhcbStyle->SetOptTitle(0);
  119. //lhcbStyle->SetOptFit(0);
  120. lhcbStyle->SetOptFit(1100); // order is probability, Chi2, errors, parameters
  121. //titles
  122. lhcbStyle->SetTitleOffset(1.2,"X");
  123. lhcbStyle->SetTitleOffset(1.5,"Y");
  124. lhcbStyle->SetTitleOffset(1.2,"Z");
  125. lhcbStyle->SetTitleFillColor(0);
  126. lhcbStyle->SetTitleStyle(0);
  127. lhcbStyle->SetTitleBorderSize(0);
  128. lhcbStyle->SetTitleFont(lhcbFont,"title");
  129. lhcbStyle->SetTitleX(0.0);
  130. lhcbStyle->SetTitleY(1.0);
  131. lhcbStyle->SetTitleW(1.0);
  132. lhcbStyle->SetTitleH(0.05);
  133. // look of the statistics box:
  134. lhcbStyle->SetStatBorderSize(0);
  135. lhcbStyle->SetStatFont(lhcbFont);
  136. lhcbStyle->SetStatFontSize(0.05);
  137. lhcbStyle->SetStatX(0.9);
  138. lhcbStyle->SetStatY(0.9);
  139. lhcbStyle->SetStatW(0.15);
  140. lhcbStyle->SetStatH(0.1);
  141. // put tick marks on top and RHS of plots
  142. lhcbStyle->SetPadTickX(1);
  143. lhcbStyle->SetPadTickY(1);
  144. // histogram divisions: only 5 in x to avoid label overlaps
  145. lhcbStyle->SetNdivisions(505,"x");
  146. lhcbStyle->SetNdivisions(510,"y");
  147. gROOT->SetStyle("lhcbStyle");
  148. gROOT->ForceStyle();
  149. // add LHCb label
  150. /* TPaveText* lhcbName = new TPaveText(gStyle->GetPadLeftMargin() + 0.05,
  151. 0.87 - gStyle->GetPadTopMargin(),
  152. gStyle->GetPadLeftMargin() + 0.20,
  153. 0.95 - gStyle->GetPadTopMargin(),
  154. "BRNDC");
  155. lhcbName->AddText("LHCb");
  156. lhcbName->SetFillColor(0);
  157. lhcbName->SetTextAlign(12);
  158. lhcbName->SetBorderSize(0);
  159. TText *lhcbLabel = new TText();
  160. lhcbLabel->SetTextFont(lhcbFont);
  161. lhcbLabel->SetTextColor(1);
  162. lhcbLabel->SetTextSize(lhcbTSize);
  163. lhcbLabel->SetTextAlign(12);
  164. TLatex *lhcbLatex = new TLatex();
  165. lhcbLatex->SetTextFont(lhcbFont);
  166. lhcbLatex->SetTextColor(1);
  167. lhcbLatex->SetTextSize(lhcbTSize);
  168. lhcbLatex->SetTextAlign(12);*/
  169. cout << "-------------------------" << endl;
  170. cout << "Set LHCb Style - Feb 2012" << endl;
  171. cout << "-------------------------" << endl;
  172. }