258 lines
8.3 KiB
C
258 lines
8.3 KiB
C
|
#ifndef CHARMPRODSCRIPTS_LHCBSTYLE_H
|
||
|
#define CHARMPRODSCRIPTS_LHCBSTYLE_H 1
|
||
|
|
||
|
#include "TStyle.h"
|
||
|
#include "TROOT.h"
|
||
|
#include "TPaveText.h"
|
||
|
#include "TText.h"
|
||
|
#include "TLatex.h"
|
||
|
#include "TColor.h"
|
||
|
|
||
|
#include <iomanip>
|
||
|
#include <iostream>
|
||
|
using namespace std;
|
||
|
|
||
|
TStyle *lhcbStyle= new TStyle("lhcbStyle","LHCb official plots style");
|
||
|
//TPaveText *lhcbName = new TPaveText(0.65,0.8,0.9,0.9,"BRNDC");
|
||
|
TText *lhcbLabel = new TText();
|
||
|
TLatex *lhcbLatex = new TLatex();
|
||
|
TPaveText *lhcb7TeVPrelimL = new TPaveText();
|
||
|
TPaveText *lhcb0_9TeVPrelimL = new TPaveText();
|
||
|
|
||
|
void LHCbStyle(Bool_t colzPlot=kFALSE, Int_t NCont=25)
|
||
|
{
|
||
|
// ////////////////////////////////////////////////////////////////////
|
||
|
// // PURPOSE:
|
||
|
// //
|
||
|
// // This header file defines a reasonable style for (black-and-white)
|
||
|
// // "publication quality" ROOT plots. The default settings contain
|
||
|
// // many features that are either not desirable for printing on white
|
||
|
// // paper or impair the general readibility of plots.
|
||
|
// //
|
||
|
// // USAGE:
|
||
|
//
|
||
|
// Simply include the line
|
||
|
// #include "LHCbStyle.h"
|
||
|
// at the beginning of your root program (and make sure LHCbStyle.h is
|
||
|
// in a location accessible to the compiler). Then add the line
|
||
|
// lhcbStyle();
|
||
|
// somewhere at the beginning of your main().
|
||
|
//
|
||
|
// SOME COMMENTS:
|
||
|
//
|
||
|
// Statistics and fit boxes:
|
||
|
//
|
||
|
// "Decorative" items around the histogram are kept to a minimum.
|
||
|
// In particular there is no box with statistics or fit information.
|
||
|
// You can easily change this either by editing your private copy
|
||
|
// of this style file or by calls to "gStyle" in your macro.
|
||
|
// For example,
|
||
|
// gStyle->SetOptFit(1011);
|
||
|
// will add some fit information.
|
||
|
//
|
||
|
// Font:
|
||
|
//
|
||
|
// The font is chosen to be 62, i.e.helvetica-bold-r-normal with
|
||
|
// precision 2. Font is of course a matter of taste, but most people
|
||
|
// will probably agree that Helvetica bold gives close to optimal
|
||
|
// readibility in presentations. It appears to be the ROOT default,
|
||
|
// and since there are still some features in ROOT that simply won't
|
||
|
// respond to any font requests, it is the wise choice to avoid
|
||
|
// ugly font mixtures on the same plot... The precision of the font (2)
|
||
|
// is chosen in order to have a rotatable and scalable font. Be sure
|
||
|
// to use true-type fonts! I.e.
|
||
|
// Unix.*.Root.UseTTFonts: true in your .rootrc file.
|
||
|
//
|
||
|
// "Landscape histograms":
|
||
|
//
|
||
|
// The style here is designed for more or less quadratic plots.
|
||
|
// For very long histograms, adjustements are needed. For instance,
|
||
|
// for a canvas with 1x5 histograms:
|
||
|
// TCanvas* c1 = new TCanvas("c1", "L0 muons", 600, 800);
|
||
|
// c1->Divide(1,5);
|
||
|
// adaptions like the following will be needed:
|
||
|
// gStyle->SetTickLength(0.05,"x");
|
||
|
// gStyle->SetTickLength(0.01,"y");
|
||
|
// gStyle->SetLabelSize(0.15,"x");
|
||
|
// gStyle->SetLabelSize(0.1,"y");
|
||
|
// gStyle->SetStatW(0.15);
|
||
|
// gStyle->SetStatH(0.5);
|
||
|
//
|
||
|
////////////////////////////////////////////////////////////////////
|
||
|
|
||
|
|
||
|
// define names for colours
|
||
|
//Int_t black = 1;
|
||
|
//Int_t red = 2;
|
||
|
//Int_t green = 3;
|
||
|
//Int_t blue = 4;
|
||
|
//Int_t yellow = 5;
|
||
|
//Int_t magenta= 6;
|
||
|
//Int_t cyan = 7;
|
||
|
//Int_t purple = 9;
|
||
|
|
||
|
Int_t lhcbFont = 132; // Old LHCb style: 62;
|
||
|
// Line thickness
|
||
|
Double_t lhcbWidth = 2.00; // Old LHCb style: 3.00;
|
||
|
// Text size
|
||
|
Double_t lhcbTSize = 0.06;
|
||
|
|
||
|
|
||
|
|
||
|
lhcbStyle->SetFillColor(1);
|
||
|
lhcbStyle->SetFillStyle(1001); // solid
|
||
|
lhcbStyle->SetFrameFillColor(0);
|
||
|
lhcbStyle->SetFrameBorderMode(0);
|
||
|
lhcbStyle->SetPadBorderMode(0);
|
||
|
lhcbStyle->SetPadColor(0);
|
||
|
lhcbStyle->SetCanvasBorderMode(0);
|
||
|
lhcbStyle->SetCanvasColor(0);
|
||
|
lhcbStyle->SetStatColor(0);
|
||
|
lhcbStyle->SetLegendBorderSize(0);
|
||
|
lhcbStyle->SetLegendFont(132);
|
||
|
|
||
|
// If you want the usual gradient palette (blue -> red)
|
||
|
lhcbStyle->SetPalette(1);
|
||
|
// If you want colors that correspond to gray scale in black and white:
|
||
|
int colors[8] = {0,5,7,3,6,2,4,1};
|
||
|
lhcbStyle->SetPalette(8,colors);
|
||
|
|
||
|
|
||
|
// set the paper & margin sizes
|
||
|
lhcbStyle->SetPaperSize(20,26);
|
||
|
lhcbStyle->SetPadTopMargin(0.05);
|
||
|
lhcbStyle->SetPadRightMargin(0.05); // increase for colz plots
|
||
|
lhcbStyle->SetPadBottomMargin(0.16);
|
||
|
lhcbStyle->SetPadLeftMargin(0.14);
|
||
|
|
||
|
// use large fonts
|
||
|
lhcbStyle->SetTextFont(lhcbFont);
|
||
|
lhcbStyle->SetTextSize(lhcbTSize);
|
||
|
lhcbStyle->SetLabelFont(lhcbFont,"x");
|
||
|
lhcbStyle->SetLabelFont(lhcbFont,"y");
|
||
|
lhcbStyle->SetLabelFont(lhcbFont,"z");
|
||
|
lhcbStyle->SetLabelSize(lhcbTSize,"x");
|
||
|
lhcbStyle->SetLabelSize(lhcbTSize,"y");
|
||
|
lhcbStyle->SetLabelSize(lhcbTSize,"z");
|
||
|
lhcbStyle->SetTitleFont(lhcbFont);
|
||
|
lhcbStyle->SetTitleFont(lhcbFont,"x");
|
||
|
lhcbStyle->SetTitleFont(lhcbFont,"y");
|
||
|
lhcbStyle->SetTitleFont(lhcbFont,"z");
|
||
|
lhcbStyle->SetTitleSize(1.2*lhcbTSize,"x");
|
||
|
lhcbStyle->SetTitleSize(1.2*lhcbTSize,"y");
|
||
|
lhcbStyle->SetTitleSize(1.2*lhcbTSize,"z");
|
||
|
|
||
|
// use medium bold lines and thick markers
|
||
|
lhcbStyle->SetLineWidth(lhcbWidth);
|
||
|
lhcbStyle->SetFrameLineWidth(lhcbWidth);
|
||
|
lhcbStyle->SetHistLineWidth(lhcbWidth);
|
||
|
lhcbStyle->SetFuncWidth(lhcbWidth);
|
||
|
lhcbStyle->SetGridWidth(lhcbWidth);
|
||
|
lhcbStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes
|
||
|
lhcbStyle->SetMarkerStyle(20);
|
||
|
lhcbStyle->SetMarkerSize(1.0);
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
// label offsets
|
||
|
lhcbStyle->SetLabelOffset(0.010,"X");
|
||
|
lhcbStyle->SetLabelOffset(0.010,"Y");
|
||
|
|
||
|
// by default, do not display histogram decorations:
|
||
|
lhcbStyle->SetOptStat(0);
|
||
|
//lhcbStyle->SetOptStat("emr"); // show only nent -e , mean - m , rms -r
|
||
|
// full opts at http://root.cern.ch/root/html/TStyle.html#TStyle:SetOptStat
|
||
|
lhcbStyle->SetStatFormat("6.3g"); // specified as c printf options
|
||
|
lhcbStyle->SetOptTitle(0);
|
||
|
lhcbStyle->SetOptFit(0);
|
||
|
//lhcbStyle->SetOptFit(1011); // order is probability, Chi2, errors, parameters
|
||
|
//titles
|
||
|
lhcbStyle->SetTitleOffset(0.95,"X");
|
||
|
lhcbStyle->SetTitleOffset(0.95,"Y");
|
||
|
lhcbStyle->SetTitleOffset(1.2,"Z");
|
||
|
lhcbStyle->SetTitleFillColor(0);
|
||
|
lhcbStyle->SetTitleStyle(0);
|
||
|
lhcbStyle->SetTitleBorderSize(0);
|
||
|
lhcbStyle->SetTitleFont(lhcbFont,"title");
|
||
|
lhcbStyle->SetTitleX(0.0);
|
||
|
lhcbStyle->SetTitleY(1.0);
|
||
|
lhcbStyle->SetTitleW(1.0);
|
||
|
lhcbStyle->SetTitleH(0.05);
|
||
|
|
||
|
// look of the statistics box:
|
||
|
lhcbStyle->SetStatBorderSize(0);
|
||
|
lhcbStyle->SetStatFont(lhcbFont);
|
||
|
lhcbStyle->SetStatFontSize(0.05);
|
||
|
lhcbStyle->SetStatX(0.9);
|
||
|
lhcbStyle->SetStatY(0.9);
|
||
|
lhcbStyle->SetStatW(0.25);
|
||
|
lhcbStyle->SetStatH(0.15);
|
||
|
|
||
|
// put tick marks on top and RHS of plots
|
||
|
lhcbStyle->SetPadTickX(1);
|
||
|
|
||
|
|
||
|
|
||
|
lhcbStyle->SetPadTickY(1);
|
||
|
|
||
|
// histogram divisions: only 5 in x to avoid label overlaps
|
||
|
lhcbStyle->SetNdivisions(505,"x");
|
||
|
lhcbStyle->SetNdivisions(510,"y");
|
||
|
|
||
|
//// add LHCb label
|
||
|
//lhcbName = new TPaveText(gStyle->GetPadLeftMargin() + 0.05,
|
||
|
// 0.87 - gStyle->GetPadTopMargin(),
|
||
|
// gStyle->GetPadLeftMargin() + 0.20,
|
||
|
// 0.95 - gStyle->GetPadTopMargin(),
|
||
|
// "BRNDC");
|
||
|
//lhcbName->AddText("LHCb");
|
||
|
//lhcbName->SetFillColor(0);
|
||
|
//lhcbName->SetTextAlign(12);
|
||
|
//lhcbName->SetBorderSize(0);
|
||
|
|
||
|
lhcbLabel->SetTextFont(lhcbFont);
|
||
|
lhcbLabel->SetTextColor(1);
|
||
|
lhcbLabel->SetTextSize(lhcbTSize);
|
||
|
lhcbLabel->SetTextAlign(12);
|
||
|
|
||
|
lhcbLatex->SetTextFont(lhcbFont);
|
||
|
lhcbLatex->SetTextColor(1);
|
||
|
lhcbLatex->SetTextSize(lhcbTSize);
|
||
|
lhcbLatex->SetTextAlign(12);
|
||
|
|
||
|
|
||
|
//update me/michel
|
||
|
{
|
||
|
gStyle->SetPaintTextFormat("0.2f");
|
||
|
|
||
|
const Int_t NRGBs = 5;
|
||
|
const Int_t NCont = 255;
|
||
|
Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
|
||
|
Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
|
||
|
Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
|
||
|
Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
|
||
|
TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
|
||
|
lhcbStyle->SetNumberContours(NCont);
|
||
|
|
||
|
//const Int_t NCont = 200;
|
||
|
//Double_t Red[5] = { 0., 0., 1., 1., 1. };
|
||
|
//Double_t Green[5] = { 0., .5, 1., .5, 0. };
|
||
|
//Double_t Blue[5] = { 1., 1., 1., 0., 0. };
|
||
|
////Double_t Red[5] = { 0., 0., .6, 1., 0.45 };
|
||
|
////Double_t Green[5] = { 0., 0., .6, 0., 0. };
|
||
|
////Double_t Blue[5] = { 0.2, 1., .6, 0., 0. };
|
||
|
//Double_t Length[5] = { 0.00, 0.25, 0.5, 0.75, 1.00 };
|
||
|
//TColor::CreateGradientColorTable(5, Length, Red, Green, Blue, NCont);
|
||
|
//lhcbStyle->SetNumberContours(NCont);
|
||
|
|
||
|
}
|
||
|
|
||
|
gROOT->SetStyle("lhcbStyle");
|
||
|
gROOT->ForceStyle();
|
||
|
|
||
|
|
||
|
}
|
||
|
#endif
|
||
|
|