MCPcopy Create free account
hub / github.com/Geant4/geant4 / DrawColorChartText

Method DrawColorChartText

source/digits_hits/utils/src/G4ScoreLogColorMap.cc:183–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181 }
182}
183void G4ScoreLogColorMap::DrawColorChartText(G4int _nPoint)
184{
185 G4bool lmin = true, lmax = true;
186 if(fMinVal <= 0.)
187 lmin = false;
188 if(fMaxVal <= 0.)
189 lmax = false;
190
191 G4double min = 0.;
192 if(lmin)
193 min = std::log10(fMinVal);
194
195 G4double max = 0.;
196 if(lmax)
197 max = std::log10(fMaxVal);
198
199 G4double c[4] = { 1., 1., 1., 1. };
200 G4Colour black(0., 0., 0.);
201 for(auto n = 0; n < _nPoint; ++n)
202 {
203 G4double a = n / (_nPoint - 1.), b = 1. - a;
204 G4double v = (a * max + b * min) / (a + b);
205
206 this->GetMapColor(std::pow(10., v), c);
207 if(c[0] == 0 && c[1] == 0 && c[2] == 0 && c[3] == 0)
208 return;
209 if(c[0] == 0 && c[1] == 0 && c[2] == 0 && c[3] == -1.)
210 continue;
211
212 // background color
213 for(auto l = 0; l < 21; ++l)
214 {
215 G4Polyline line;
216 line.push_back(G4Point3D(-0.908, -0.905 + 0.05 * n + 0.002 * l, 0.));
217 line.push_back(G4Point3D(-0.705, -0.905 + 0.05 * n + 0.002 * l, 0.));
218 G4VisAttributes attblack(black);
219 line.SetVisAttributes(&attblack);
220 fVisManager->Draw2D(line);
221 }
222 // text
223 std::ostringstream oss;
224 oss << std::setw(8) << std::setprecision(1) << std::scientific
225 << std::pow(10., v);
226 std::string str = oss.str();
227 G4String value(str);
228 G4Text text(value, G4Point3D(-0.9, -0.9 + 0.05 * n, 0));
229 G4double size = 12.;
230 text.SetScreenSize(size);
231 G4Colour color(1., 1., 1.);
232 G4VisAttributes att(color);
233 text.SetVisAttributes(&att);
234
235 fVisManager->Draw2D(text);
236 }
237
238 // draw ps name
239 // background
240 G4int lpsname = 20;

Callers

nothing calls this directly

Calls 5

GetMapColorMethod · 0.95
Draw2DMethod · 0.80
push_backMethod · 0.45
SetVisAttributesMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected