Utils.h
Go to the documentation of this file.
1 #ifndef WIRECELLTEST_UTILS
2 #define WIRECELLTEST_UTILS
3 
4 #include "TStyle.h"
5 #include "TColor.h"
6 
7 void set_palette(int pal = -1);
8 void set_palette(int pal)
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 }
34 
35 #endif
void set_palette(int pal=-1)
Definition: Utils.h:8