Functions
Utils.h File Reference
#include "TStyle.h"
#include "TColor.h"

Go to the source code of this file.

Functions

void set_palette (int pal=-1)
 

Function Documentation

void set_palette ( int  pal = -1)

Definition at line 8 of file Utils.h.

9 {
10  if (pal > 0) {
11  gStyle->SetPalette(pal);
12  return;
13  }
14 
15  // custom
16  const int ncolors = 50;
17  static int colors[ncolors];
18  static bool initialized = false;
19  const int npars=6;
20  double stops[npars] = { 0.00, 0.45, 0.49, 0.51, 0.55, 1.00 };
21  double reds[npars] = { 0.00, 0.00, 1.00, 1.00, 1.00, 1.00 };
22  double greens[npars] = { 0.00, 0.81, 1.00, 1.00, 0.20, 0.00 };
23  double blues[npars] = { 1.00, 1.00, 1.00, 1.00, 0.00, 0.00 };
24  if (!initialized) {
25  int FI = TColor::CreateGradientColorTable(npars, stops, reds, greens, blues, ncolors);
26  for (int ind=0; ind<ncolors; ++ind) {
27  colors[ind] = FI + ind;
28  }
29  initialized = true;
30  return;
31  }
32  gStyle->SetPalette(50,colors);
33 }