Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
evdb::Colors Class Reference

#include "/cvmfs/nova.opensciencegrid.org/externals/nuevdb/v1_00_02/source/nuevdb/EventDisplayBase/Colors.h"

Inheritance diagram for evdb::Colors:
evdb::Reconfigurable

Public Member Functions

 Colors (fhicl::ParameterSet const &p)
 
 ~Colors ()
 
void reconfigure (fhicl::ParameterSet const &p)
 
void WhiteOnBlack ()
 
void BlackOnWhite ()
 
int Foreground (int i=0)
 
int Background (int i=0)
 
ColorScaleScale (const std::string &nm)
 
void do_reconfigure (fhicl::ParameterSet const &pset)
 

Private Member Functions

void UnpackColorScale (fhicl::ParameterSet const &p, const std::string &c)
 
void SetStyle ()
 

Private Attributes

int fFG [kMAX_FGBG]
 Foreground colors. More...
 
int fBG [kMAX_FGBG]
 
std::map< std::string, ColorScale * > fColorScales
 

Static Private Attributes

static const int kMAX_FGBG = 6
 

Detailed Description

Definition at line 21 of file Colors.h.

Constructor & Destructor Documentation

evdb::Colors::Colors ( fhicl::ParameterSet const &  p)

Definition at line 14 of file Colors_service.cc.

References reconfigure().

14  : Reconfigurable{p}
15  {
16  this->reconfigure(p);
17  }
Reconfigurable(fhicl::ParameterSet const &ps)
const char * p
Definition: xmltok.h:285
void reconfigure(fhicl::ParameterSet const &p)
evdb::Colors::~Colors ( )

Definition at line 21 of file Colors_service.cc.

References fColorScales.

22  {
23  std::map<std::string,ColorScale*>::iterator itr(fColorScales.begin());
24  std::map<std::string,ColorScale*>::iterator itrEnd(fColorScales.end());
25  for (; itr!=itrEnd; ++itr) {
26  if (itr->second) { delete itr->second; itr->second = 0; }
27  }
28  }
std::map< std::string, ColorScale * > fColorScales
Definition: Colors.h:77

Member Function Documentation

int evdb::Colors::Background ( int  i = 0)

Return the background color

Parameters
i: 0 is highest contrast to foreground color, 5 is least

Definition at line 136 of file Colors_service.cc.

References fBG, MECModelEnuComparisons::i, kMAX_FGBG, std::max(), and std::min().

Referenced by evd::RawDataDrawer::HitColor(), and SetStyle().

137  {
138  i = std::max(0, i);
139  i = std::min(kMAX_FGBG-1,i);
140  return fBG[i];
141  }
T max(const caf::Proxy< T > &a, T b)
int fBG[kMAX_FGBG]
Definition: Colors.h:73
T min(const caf::Proxy< T > &a, T b)
static const int kMAX_FGBG
Definition: Colors.h:71
void evdb::Colors::BlackOnWhite ( )

Set foreground and background colors for black text on black background

Definition at line 114 of file Colors_service.cc.

References fBG, fFG, and SetStyle().

Referenced by reconfigure().

115  {
116  fFG[5] = fBG[0] = kWhite;
117  fFG[4] = fBG[1] = kGray;
118  fFG[3] = fBG[2] = kGray+1;
119  fFG[2] = fBG[3] = kGray+2;
120  fFG[1] = fBG[4] = kGray+3;
121  fFG[0] = fBG[5] = kBlack;
122  this->SetStyle();
123  }
int fFG[kMAX_FGBG]
Foreground colors.
Definition: Colors.h:72
int fBG[kMAX_FGBG]
Definition: Colors.h:73
void evdb::Reconfigurable::do_reconfigure ( fhicl::ParameterSet const &  pset)
inlineinherited

Definition at line 17 of file Reconfigurable.h.

17 { reconfigure(pset); }
virtual void reconfigure(fhicl::ParameterSet const &)=0
int evdb::Colors::Foreground ( int  i = 0)

Return the foreground color

Parameters
i: 0 is highest contrast to background color, 5 is least

Definition at line 127 of file Colors_service.cc.

References fFG, MECModelEnuComparisons::i, kMAX_FGBG, std::max(), and std::min().

Referenced by evd::GeometryDrawer::DetOutline3D(), evd::Style::FromPDG(), evd::RecoBaseDrawer::GetClusterColor(), evd::HeaderDrawer::Header(), evd::SimulationDrawer::MCTruthShortText(), and SetStyle().

128  {
129  i = std::max(0, i);
130  i = std::min(kMAX_FGBG-1,i);
131  return fFG[i];
132  }
T max(const caf::Proxy< T > &a, T b)
int fFG[kMAX_FGBG]
Foreground colors.
Definition: Colors.h:72
T min(const caf::Proxy< T > &a, T b)
static const int kMAX_FGBG
Definition: Colors.h:71
void evdb::Colors::reconfigure ( fhicl::ParameterSet const &  p)
virtual

Implements evdb::Reconfigurable.

Definition at line 32 of file Colors_service.cc.

References BlackOnWhite(), lem_server::cs, fhicl::ParameterSet::get(), MECModelEnuComparisons::i, UnpackColorScale(), and WhiteOnBlack().

Referenced by Colors().

33  {
34  int black_on_white = p.get<int>("BlackOnWhite.val");
35  if (black_on_white) this->BlackOnWhite();
36  else this->WhiteOnBlack();
37 
38  std::vector<std::string>
39  cs = p.get<std::vector<std::string> >("ColorScales.val");
40  for (unsigned int i=0; i<cs.size(); ++i) {
41  this->UnpackColorScale(p,cs[i]);
42  }
43  }
const char * p
Definition: xmltok.h:285
void UnpackColorScale(fhicl::ParameterSet const &p, const std::string &c)
ColorScale & evdb::Colors::Scale ( const std::string &  nm)

Look up a color scale by name

Definition at line 90 of file Colors_service.cc.

References lem_server::cs, fColorScales, and Munits::nm.

Referenced by evd::TQPad::BookHistogram(), evd::RecoBaseDrawer::CellHit2D(), evd::RecoBaseDrawer::DimOutOfTime(), evd::TQPad::Draw(), evd::RecoBaseDrawer::DrawHoughResults2D(), evd::RawDataDrawer::HitColor(), and evd::TQPad::RangeChanged().

91  {
92  ColorScale* cs = fColorScales[nm];
93  if (cs) return (*cs);
94 
95  static ColorScale gsDefaultCS(0,100);
96  return gsDefaultCS;
97  }
std::map< std::string, ColorScale * > fColorScales
Definition: Colors.h:77
static constexpr Double_t nm
Definition: Munits.h:133
void evdb::Colors::SetStyle ( )
private

Push the colors off to the ROOT style

Definition at line 145 of file Colors_service.cc.

References Background(), DEFINE_ART_SERVICE, and Foreground().

Referenced by BlackOnWhite(), and WhiteOnBlack().

146  {
147  int bgcolor = this->Background(0);
148  int fgcolor = this->Foreground(1);
149  gStyle->SetAxisColor(fgcolor,"XYZ");
150  gStyle->SetLabelColor(fgcolor,"XYZ");
151  gStyle->SetTitleColor(fgcolor,"XYZ");
152  gStyle->SetCanvasColor(bgcolor);
153  gStyle->SetLegendFillColor(bgcolor);
154  gStyle->SetPadColor(bgcolor);
155  gStyle->SetFuncColor(kRed);
156  gStyle->SetGridColor(fgcolor);
157  gStyle->SetFrameFillColor(bgcolor);
158  gStyle->SetFrameLineColor(bgcolor);
159  // Leave histogram fill color clear
160  // gStyle->SetHistFillColor(bgcolor);
161  gStyle->SetHistLineColor(fgcolor);
162  gStyle->SetStatColor(bgcolor);
163  gStyle->SetStatTextColor(fgcolor);
164  gStyle->SetTitleFillColor(bgcolor);
165  gStyle->SetTitleTextColor(fgcolor);
166 
167  // Force this style on all histograms
168  gROOT->ForceStyle();
169  }
int Background(int i=0)
int Foreground(int i=0)
void evdb::Colors::UnpackColorScale ( fhicl::ParameterSet const &  p,
const std::string &  c 
)
private

Unpack the parameters for a named color scale

Definition at line 47 of file Colors_service.cc.

References lem_server::cs, fColorScales, fhicl::ParameterSet::get(), getGoodRuns4SAM::n, Munits::nm, evdb::ColorScale::Palette(), r(), site_stats_from_log::reverse, scale, and evdb::ColorScale::Scale().

Referenced by reconfigure().

49  {
50  std::string palette_tag(nm); palette_tag += "_Palette.val";
51  std::string n_tag(nm); n_tag += "_N.val";
52  std::string r_tag(nm); r_tag += "_Range.val";
53  std::string scale_tag(nm); scale_tag += "_Scale.val";
54  std::string reverse_tag(nm); reverse_tag += "_Reverse.val";
55  std::string ofufc_tag(nm); ofufc_tag += "_UnderOverflowColors.val";
56  std::string hv_tag(nm); hv_tag += "_HVPairs.val";
57 
58  int n, reverse;
59  std::string palette, scale;
60  std::vector<float> r, hv;
61  std::vector<int> ofufc;
62  palette = p.get<std::string> (palette_tag);
63  n = p.get<int> (n_tag);
64  r = p.get<std::vector<float> >(r_tag);
65  scale = p.get<std::string> (scale_tag);
66  reverse = p.get<int> (reverse_tag);
67  ofufc = p.get<std::vector<int> > (ofufc_tag);
68  hv = p.get<std::vector<float> >(hv_tag);
69 
70  ColorScale* cs = new ColorScale(r[0],
71  r[1],
72  ColorScale::Palette(palette),
73  ColorScale::Scale(scale),
74  n,
75  hv[0],
76  hv[1],
77  hv[2],
78  hv[3]);
79  cs->SetUnderFlowColor(ofufc[0]);
80  cs->SetOverFlowColor(ofufc[1]);
81  if (reverse) cs->Reverse();
82  ColorScale* old = fColorScales[nm];
83  if (old) delete old;
84  fColorScales[nm] = cs;
85  }
std::map< std::string, ColorScale * > fColorScales
Definition: Colors.h:77
const char * p
Definition: xmltok.h:285
static constexpr Double_t nm
Definition: Munits.h:133
Double_t scale
Definition: plot.C:25
static int Palette(const std::string &nm)
Definition: ColorScale.cxx:17
static int Scale(const std::string &nm)
Definition: ColorScale.cxx:32
Find event vertex using a Hough transform.
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
TRandom3 r(0)
void evdb::Colors::WhiteOnBlack ( )

Set foreground and background colors for white text on black background

Definition at line 101 of file Colors_service.cc.

References fBG, fFG, and SetStyle().

Referenced by reconfigure().

102  {
103  fFG[0] = fBG[5] = kWhite;
104  fFG[1] = fBG[4] = kGray;
105  fFG[2] = fBG[3] = kGray+1;
106  fFG[3] = fBG[2] = kGray+2;
107  fFG[4] = fBG[1] = kGray+3;
108  fFG[5] = fBG[0] = kBlack;
109  this->SetStyle();
110  }
int fFG[kMAX_FGBG]
Foreground colors.
Definition: Colors.h:72
int fBG[kMAX_FGBG]
Definition: Colors.h:73

Member Data Documentation

int evdb::Colors::fBG[kMAX_FGBG]
private

Background colors

Definition at line 73 of file Colors.h.

Referenced by Background(), BlackOnWhite(), and WhiteOnBlack().

std::map<std::string,ColorScale*> evdb::Colors::fColorScales
private

Collection of color scales managed by this class

Definition at line 77 of file Colors.h.

Referenced by Scale(), UnpackColorScale(), and ~Colors().

int evdb::Colors::fFG[kMAX_FGBG]
private

Foreground colors.

Definition at line 72 of file Colors.h.

Referenced by BlackOnWhite(), Foreground(), and WhiteOnBlack().

const int evdb::Colors::kMAX_FGBG = 6
staticprivate

Definition at line 71 of file Colors.h.

Referenced by Background(), and Foreground().


The documentation for this class was generated from the following files: