CMS 3D CMS Logo

fwPaletteExtra.cc
Go to the documentation of this file.
2 
3 #include "TROOT.h"
4 #include "TColor.h"
5 #include "TMath.h"
6 
7 namespace fireworks {
8 
9  //static unsigned int rSize = 17;
10 
12  float (*colVals)[3];
13  bool whiteBg;
15  PaletteExtraTopBottomIndices(float (*iColors)[3], bool iIsWhiteBg, FWColorManager::EPalette iId)
16  : colVals(iColors), whiteBg(iIsWhiteBg), id(iId){};
17 
18  void set(int i, Color_t cidx) {
19  if (whiteBg) {
20  //if (id == FWColorManager::kFall || id == FWColorManager::kArctic)
21  const TColor* c = gROOT->GetColor(cidx);
22  colVals[i][0] = c->GetRed();
23  colVals[i][1] = c->GetGreen();
24  colVals[i][2] = c->GetBlue();
25  if (id != FWColorManager::kPurple)
26  TColor::HLStoRGB(
27  c->GetHue(), 1.2 * c->GetLight(), c->GetSaturation(), colVals[i][0], colVals[i][1], colVals[i][2]);
28 
29  /*
30 
31  cidx = TColor::GetColorBright(cidx);
32  TColor* cb = gROOT->GetColor(cidx);
33  colVals[i+rSize][0] = cb->GetRed();
34  colVals[i+rSize][1] = cb->GetGreen();
35  colVals[i+rSize][2] = cb->GetBlue();
36  */
37 
38  } else {
39  const TColor* c = gROOT->GetColor(cidx);
40  colVals[i][0] = c->GetRed();
41  colVals[i][1] = c->GetGreen();
42  colVals[i][2] = c->GetBlue();
43  /*
44  cidx = TColor::GetColorDark(cidx);
45  const TColor * cd = gROOT->GetColor(cidx);
46  colVals[i+rSize][0] = cd->GetRed();
47  colVals[i+rSize][1] = cd->GetGreen();
48  colVals[i+rSize][2] = cd->GetBlue();
49  */
50  }
51  }
52 
53  //______________________________________________________________________________
54 
55  void InitArctic() {
56  // set muon geometry gray
57  set(0, kYellow + 2);
58  set(1, kMagenta - 3);
59  set(2, kCyan + 3);
60  set(3, kAzure + 7);
61  set(4, kAzure + 8);
62 
63  set(5, kAzure + 3); // jets, met
64  set(6, kAzure - 3);
65  set(7, kOrange + 7);
66  set(8, kAzure); // jets, met
67  set(9, kBlue - 1);
68  set(10, kBlue - 7);
69  set(11, kTeal - 1);
70  set(12, kTeal - 7);
71  set(13, kCyan - 7);
72  set(14, kAzure + 10);
73  // set(16, kOrange);
74  }
75 
76  //______________________________________________________________________________
77 
78  void InitFall() {
79  set(0, kYellow - 4); //vertices, jets
80  set(1, kRed + 1);
81  set(2, kMagenta + 3);
82  set(3, kGreen + 2);
83  set(4, kBlue + 2);
84  set(5, kOrange - 5); //hcal
85  set(6, kOrange - 8);
86  set(7, kMagenta - 1);
87  set(8, kRed - 2); // muon, ecal, met
88  set(9, kCyan + 2); // tracks
89 
90  int j = 2;
91  for (int i = 10; i < 15; ++i) {
92  set(i, kRed - j);
93  j++;
94  }
95  }
96 
97  void InitSpring() {
98  set(0, kRed); // jet
99  set(1, kOrange - 2);
100  set(2, kRed - 7);
101  set(3, kPink + 2);
102  set(4, kOrange - 7);
103  set(5, kSpring + 5); //hcal
104 
105  set(6, kSpring);
106  set(7, kMagenta); // electrons
107  set(8, kSpring + 4); //ecal, muons
108  set(9, kGreen + 2);
109  set(10, kSpring + 3);
110  set(11, kGreen - 5);
111  set(12, kGreen - 6);
112  set(13, kGreen - 7);
113  set(14, kTeal - 5);
114  }
115 
116  void InitPurple() {
117  set(0, kGreen - 7);
118  set(1, kRed + 1);
119  set(2, kMagenta + 3);
120  set(3, kCyan + 2);
121  set(4, kBlue + 2);
122  set(5, kViolet - 5);
123  set(6, kViolet - 6);
124  set(7, kViolet - 7);
125  set(8, kGray + 1); //ecal, muo
126  set(9, kPink - 8); //tracks
127  set(10, kBlue - 8);
128  set(11, kBlue - 4);
129  set(12, kBlue - 2);
130  set(13, kViolet + 8);
131  set(14, kViolet + 10);
132  }
133  };
134 
135  void GetColorValuesForPaletteExtra(float (*iColors)[3],
136  unsigned int iSize,
138  bool isWhiteBg) {
139  PaletteExtraTopBottomIndices p(iColors, isWhiteBg, id);
140  switch (id) {
142  p.InitArctic();
143  break;
145  p.InitFall();
146  break;
148  p.InitSpring();
149  break;
150 
152  p.InitPurple();
153  break;
154  default:
155  break;
156  }
157 
158  iSize = iSize / 2;
159  unsigned int lastIdx = iSize - 2;
160  if (isWhiteBg) {
161  for (unsigned int i = 0; i < lastIdx; ++i) {
162  float s = 1.2;
163  float r = TMath::Min(1.f, s * iColors[i][0]);
164  float g = TMath::Min(1.f, s * iColors[i][1]);
165  float b = TMath::Min(1.f, s * iColors[i][2]);
166 
167  iColors[i][0] = r;
168  iColors[i][1] = g;
169  iColors[i][2] = b;
170 
171  float value = 1.7;
172  r = TMath::Power(r, (2.5 - value) / 2.5);
173  g = TMath::Power(g, (2.5 - value) / 2.5);
174  b = TMath::Power(b, (2.5 - value) / 2.5);
175  /*
176  s = 1.2;
177  r = TMath::Min(1.f,s* iColors[i][0]);
178  g = TMath::Min(1.f,s *iColors[i][1]);
179  b = TMath::Min(1.f,s *iColors[i][2]);
180  */
181 
182  r = TMath::Min(1.f, r);
183  g = TMath::Min(1.f, g);
184  b = TMath::Min(1.f, b);
185 
186  iColors[i + iSize][0] = r;
187  iColors[i + iSize][1] = g;
188  iColors[i + iSize][2] = b;
189  }
190  } else {
191  for (unsigned int i = 0; i < lastIdx; ++i) {
192  // TColor* c = gROOT->GetColor(i);
193  float s = 0.4;
194  float r = s * iColors[i][0];
195  float g = s * iColors[i][1];
196  float b = s * iColors[i][2];
197 
198  // printf("[%d] (%.1f, %.1f, %.1f) => ", i, r, g, b);
199  float value = -0.5;
200  r = TMath::Power(r, (2.5 - value) / 2.5);
201  g = TMath::Power(g, (2.5 - value) / 2.5);
202  b = TMath::Power(b, (2.5 - value) / 2.5);
203 
204  // printf(" (%.1f, %.1f, %.1f) \n", r, g, b);
205  //TColor::HLStoRGB(c->GetHue(), c->GetSaturation(), c->GetLight()*0.8, r, g, b);
206  iColors[i + iSize][0] = r;
207  iColors[i + iSize][1] = g;
208  iColors[i + iSize][2] = b;
209  }
210  }
211  }
212 
213 } // namespace fireworks
mps_fire.i
i
Definition: mps_fire.py:428
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
fireworks::PaletteExtraTopBottomIndices::whiteBg
bool whiteBg
Definition: fwPaletteExtra.cc:13
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
fireworks::PaletteExtraTopBottomIndices
Definition: fwPaletteExtra.cc:11
FWColorManager::kPurple
Definition: FWColorManager.h:47
fireworks::PaletteExtraTopBottomIndices::id
FWColorManager::EPalette id
Definition: fwPaletteExtra.cc:14
FWColorManager::kSpring
Definition: FWColorManager.h:47
alignCSCRings.s
s
Definition: alignCSCRings.py:92
fireworks::PaletteExtraTopBottomIndices::InitArctic
void InitArctic()
Definition: fwPaletteExtra.cc:55
fireworks::PaletteExtraTopBottomIndices::InitFall
void InitFall()
Definition: fwPaletteExtra.cc:78
fwPaletteExtra.h
b
double b
Definition: hdecay.h:118
fireworks::PaletteExtraTopBottomIndices::PaletteExtraTopBottomIndices
PaletteExtraTopBottomIndices(float(*iColors)[3], bool iIsWhiteBg, FWColorManager::EPalette iId)
Definition: fwPaletteExtra.cc:15
FWColorManager::EPalette
EPalette
Definition: FWColorManager.h:47
FWColorManager::kArctic
Definition: FWColorManager.h:47
fireworks::PaletteExtraTopBottomIndices::colVals
float(* colVals)[3]
Definition: fwPaletteExtra.cc:12
value
Definition: value.py:1
fireworks::PaletteExtraTopBottomIndices::InitSpring
void InitSpring()
Definition: fwPaletteExtra.cc:97
alignCSCRings.r
r
Definition: alignCSCRings.py:93
FWColorManager::kFall
Definition: FWColorManager.h:47
fireworks::PaletteExtraTopBottomIndices::InitPurple
void InitPurple()
Definition: fwPaletteExtra.cc:116
fireworks::PaletteExtraTopBottomIndices::set
void set(int i, Color_t cidx)
Definition: fwPaletteExtra.cc:18
fireworks
Definition: FWTauProxyBuilderBase.h:35
fireworks::GetColorValuesForPaletteExtra
void GetColorValuesForPaletteExtra(float(*iColors)[3], unsigned int iSize, FWColorManager::EPalette id, bool isWhiteBg)
Definition: fwPaletteExtra.cc:135
Min
T Min(T a, T b)
Definition: MathUtil.h:39
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
g
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4