#include void SetPrettyStyle() { // Canvas printing details: white bg, no borders. gStyle->SetCanvasColor(0); gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasBorderSize(0); // Canvas frame printing details: white bg, no borders. gStyle->SetFrameFillColor(0); gStyle->SetFrameBorderMode(0); gStyle->SetFrameBorderSize(0); // Plot title details: centered, no bg, no border, nice font. gStyle->SetTitleX(0.1); gStyle->SetTitleW(0.8); gStyle->SetTitleBorderSize(0); gStyle->SetTitleFillColor(0); // Font details for titles and labels. gStyle->SetTitleFont(42, "xyz"); gStyle->SetTitleFont(42, "pad"); gStyle->SetLabelFont(42, "xyz"); gStyle->SetLabelFont(42, "pad"); // Details for stat box. gStyle->SetStatColor(0); gStyle->SetStatFont(42); gStyle->SetStatBorderSize(1); gStyle->SetStatX(0.975); gStyle->SetStatY(0.9); // gStyle->SetOptStat(0); } void CreateColorTable(UInt_t Number, Double_t* Length, Double_t* Red, Double_t* Green, Double_t* Blue, UInt_t NColors) { #if ROOT_VERSION_CODE >= ROOT_VERSION(5,16,0) TColor::CreateGradientColorTable(Number, Length, Red, Green, Blue, NColors); #else gStyle->CreateGradientColorTable(Number, Length, Red, Green, Blue, NColors); #endif } void SetRootPalette(const Int_t pal = 0) { const Int_t NRGBs = 5; const Int_t NCont = 255; const Int_t ROOTVERSION = gROOT->GetVersionInt()/100; switch (pal) { case 0: cout << "\n ROOT Palette Function\n Usage: SetRootPalette(pal)\n\n" << " o pal = 0: print help\n" << " o pal = 1: rainbow\n" << " o pal = 2: reverse-rainbow\n" << " o pal = 3: amber\n" << " o pal = 4: reverse-amber\n" << " o pal = 5: blue/white\n" << " o pal = 6: white/blue\n" << " o pal = 7: red temperature\n" << " o pal = 8: reverse-red temperature\n" << " o pal = 9: green/white\n" << " o pal = 10: white/green\n" << " o pal = 11: orange/blue\n" << " o pal = 12: blue/orange\n" << " o pal = 13: white/black\n" << " o pal = 14: black/white\n" << endl; break; case 1: 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 }; CreateColorTable(NRGBs, stops, red, green, blue, NCont); gStyle->SetNumberContours(NCont); break; case 2: Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; Double_t red[NRGBs] = { 0.51, 1.00, 0.87, 0.00, 0.00 }; Double_t green[NRGBs] = { 0.00, 0.20, 1.00, 0.81, 0.00 }; Double_t blue[NRGBs] = { 0.00, 0.00, 0.12, 1.00, 0.51 }; CreateColorTable(NRGBs, stops, red, green, blue, NCont); gStyle->SetNumberContours(NCont); break; case 3: Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; Double_t red[NRGBs] = { 0.17, 0.39, 0.62, 0.79, 1.00 }; Double_t green[NRGBs] = { 0.01, 0.02, 0.39, 0.68, 1.00 }; Double_t blue[NRGBs] = { 0.00, 0.09, 0.18, 0.09, 0.00 }; CreateColorTable(NRGBs, stops, red, green, blue, NCont); gStyle->SetNumberContours(NCont); break; case 4: Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; Double_t red[NRGBs] = { 1.00, 0.79, 0.62, 0.39, 0.17 }; Double_t green[NRGBs] = { 1.00, 0.68, 0.39, 0.02, 0.01 }; Double_t blue[NRGBs] = { 0.00, 0.09, 0.18, 0.09, 0.00 }; CreateColorTable(NRGBs, stops, red, green, blue, NCont); gStyle->SetNumberContours(NCont); break; case 5: Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; Double_t red[NRGBs] = { 0.00, 0.00, 0.00, 0.38, 1.00 }; Double_t green[NRGBs] = { 0.00, 0.00, 0.38, 0.76, 1.00 }; Double_t blue[NRGBs] = { 0.00, 0.47, 0.83, 1.00, 1.00 }; CreateColorTable(NRGBs, stops, red, green, blue, NCont); gStyle->SetNumberContours(NCont); break; case 6: Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; Double_t red[NRGBs] = { 1.00, 0.38, 0.00, 0.00, 0.00 }; Double_t green[NRGBs] = { 1.00, 0.76, 0.38, 0.00, 0.00 }; Double_t blue[NRGBs] = { 1.00, 1.00, 0.83, 0.47, 0.00 }; CreateColorTable(NRGBs, stops, red, green, blue, NCont); gStyle->SetNumberContours(NCont); break; case 7: Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; Double_t red[NRGBs] = { 0.00, 0.50, 0.89, 0.95, 1.00 }; Double_t green[NRGBs] = { 0.00, 0.00, 0.27, 0.71, 1.00 }; Double_t blue[NRGBs] = { 0.00, 0.00, 0.00, 0.40, 1.00 }; CreateColorTable(NRGBs, stops, red, green, blue, NCont); gStyle->SetNumberContours(NCont); break; case 8: Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; Double_t red[NRGBs] = { 1.00, 0.95, 0.89, 0.50, 0.00 }; Double_t green[NRGBs] = { 1.00, 0.71, 0.27, 0.00, 0.00 }; Double_t blue[NRGBs] = { 1.00, 0.40, 0.00, 0.00, 0.00 }; CreateColorTable(NRGBs, stops, red, green, blue, NCont); gStyle->SetNumberContours(NCont); break; case 9: Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; Double_t red[NRGBs] = { 0.00, 0.00, 0.38, 0.75, 1.00 }; Double_t green[NRGBs] = { 0.00, 0.35, 0.62, 0.85, 1.00 }; Double_t blue[NRGBs] = { 0.00, 0.00, 0.00, 0.47, 1.00 }; CreateColorTable(NRGBs, stops, red, green, blue, NCont); gStyle->SetNumberContours(NCont); break; case 10: Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; Double_t red[NRGBs] = { 1.00, 0.75, 0.38, 0.00, 0.00 }; Double_t green[NRGBs] = { 1.00, 0.85, 0.62, 0.35, 0.00 }; Double_t blue[NRGBs] = { 1.00, 0.47, 0.00, 0.00, 0.00 }; CreateColorTable(NRGBs, stops, red, green, blue, NCont); gStyle->SetNumberContours(NCont); break; case 11: Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; Double_t red[NRGBs] = { 0.75, 1.00, 0.24, 0.00, 0.00 }; Double_t green[NRGBs] = { 0.24, 1.00, 0.75, 0.18, 0.00 }; Double_t blue[NRGBs] = { 0.00, 0.62, 1.00, 0.68, 0.12 }; CreateColorTable(NRGBs, stops, red, green, blue, NCont); gStyle->SetNumberContours(NCont); break; case 12: Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; Double_t red[NRGBs] = { 0.00, 0.00, 0.24, 1.00, 0.75 }; Double_t green[NRGBs] = { 0.00, 0.18, 0.75, 1.00, 0.24 }; Double_t blue[NRGBs] = { 0.12, 0.68, 1.00, 0.62, 0.00 }; CreateColorTable(NRGBs, stops, red, green, blue, NCont); gStyle->SetNumberContours(NCont); break; case 13: Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; Double_t red[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; Double_t green[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; Double_t blue[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; CreateColorTable(NRGBs, stops, red, green, blue, NCont); gStyle->SetNumberContours(NCont); break; case 14: Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; Double_t red[NRGBs] = { 1.00, 0.84, 0.61, 0.34, 0.00 }; Double_t green[NRGBs] = { 1.00, 0.84, 0.61, 0.34, 0.00 }; Double_t blue[NRGBs] = { 1.00, 0.84, 0.61, 0.34, 0.00 }; CreateColorTable(NRGBs, stops, red, green, blue, NCont); gStyle->SetNumberContours(NCont); break; default: break; } } void SetStyles() { SetPrettyStyle(); SetRootPalette(); }