Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4VScoreColorMap Class Referenceabstract

#include <G4VScoreColorMap.hh>

Inheritance diagram for G4VScoreColorMap:
Collaboration diagram for G4VScoreColorMap:

Public Member Functions

 G4VScoreColorMap (G4String mName)
 
virtual ~G4VScoreColorMap ()
 
virtual void GetMapColor (G4double val, G4double color[4])=0
 
G4String GetName () const
 
void SetFloatingMinMax (G4bool vl=true)
 
G4bool IfFloatMinMax () const
 
void SetMinMax (G4double minVal, G4double maxVal)
 
G4double GetMin () const
 
G4double GetMax () const
 
virtual void DrawColorChart (G4int nPoint=5)
 
virtual void DrawColorChartBar (G4int nPoint)
 
virtual void DrawColorChartText (G4int nPoint)
 
void SetPSUnit (G4String &unit)
 
void SetPSName (G4String &psName)
 

Protected Attributes

G4String fName
 
G4bool ifFloat
 
G4double fMinVal
 
G4double fMaxVal
 
G4VVisManagerfVisManager
 
G4String fPSUnit
 
G4String fPSName
 

Detailed Description

Definition at line 37 of file G4VScoreColorMap.hh.

Constructor & Destructor Documentation

G4VScoreColorMap::G4VScoreColorMap ( G4String  mName)

Definition at line 43 of file G4VScoreColorMap.cc.

44 :fName(mName),ifFloat(true),fMinVal(0.),fMaxVal(DBL_MAX),fVisManager(nullptr)
45 {;}
G4VVisManager * fVisManager
#define DBL_MAX
Definition: templates.hh:83
G4VScoreColorMap::~G4VScoreColorMap ( )
virtual

Definition at line 47 of file G4VScoreColorMap.cc.

48 {;}

Member Function Documentation

void G4VScoreColorMap::DrawColorChart ( G4int  nPoint = 5)
virtual

Definition at line 50 of file G4VScoreColorMap.cc.

50  {
51 
53  if(!fVisManager) {
54  G4cerr << "G4VScoringMesh::DrawColorChart(): no visualization system" << G4endl;
55  return;
56  }
57 
58  DrawColorChartBar(_nPoint);
59  DrawColorChartText(_nPoint);
60 }
virtual void DrawColorChartText(G4int nPoint)
static G4VVisManager * GetConcreteInstance()
G4VVisManager * fVisManager
virtual void DrawColorChartBar(G4int nPoint)
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

Here is the caller graph for this function:

void G4VScoreColorMap::DrawColorChartBar ( G4int  nPoint)
virtual

Reimplemented in G4ScoreLogColorMap.

Definition at line 62 of file G4VScoreColorMap.cc.

62  {
63 
64  G4double min = this->GetMin();
65  G4double max = this->GetMax();
66  G4double smin = -0.89, smax = smin + 0.05*(_nPoint)*0.83, step=0.001;
67  G4double c[4];
68 
70 
71  for(G4double y = smin; y < smax; y+=step) {
72  G4double ra = (y-smin)/(smax-smin), rb = 1.-ra;
73  G4Polyline line;
74  line.push_back(G4Point3D(-0.96, y, 0.));
75  line.push_back(G4Point3D(-0.91, y, 0.));
76  this->GetMapColor((ra*max+rb*min)/(ra+rb), c);
77  G4Colour col(c[0], c[1], c[2]);
78  G4VisAttributes att(col);
79  line.SetVisAttributes(&att);
80  fVisManager->Draw2D(line);
81  }
82 
84 }
G4VVisManager * fVisManager
virtual void GetMapColor(G4double val, G4double color[4])=0
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:35
G4double GetMax() const
virtual void EndDraw2D()=0
virtual void BeginDraw2D(const G4Transform3D &objectTransformation=G4Transform3D())=0
void SetVisAttributes(const G4VisAttributes *)
Definition: G4Visible.cc:80
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
double G4double
Definition: G4Types.hh:76
virtual void Draw2D(const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())=0
G4double GetMin() const

Here is the call graph for this function:

Here is the caller graph for this function:

void G4VScoreColorMap::DrawColorChartText ( G4int  nPoint)
virtual

Reimplemented in G4ScoreLogColorMap.

Definition at line 86 of file G4VScoreColorMap.cc.

86  {
87 
88  G4double min = this->GetMin();
89  G4double max = this->GetMax();
90  G4double c[4];
91  G4Colour black(0.1, 0.1, 0.1, 0.8);
92 
94 
95  for(int n = 0; n < _nPoint; n++) {
96  G4double a = n/(_nPoint-1.), b = 1.-a;
97  G4double v = (a*max + b*min)/(a+b);
98  // background color
99 
100  for(int l = 0; l < 21; l++) {
101  G4Polyline line;
102  line.push_back(G4Point3D(-0.9, -0.905+0.05*n+0.002*l, 0.));
103  line.push_back(G4Point3D(-0.75, -0.905+0.05*n+0.002*l, 0.));
104  G4VisAttributes attblack(black);
105  line.SetVisAttributes(&attblack);
106  fVisManager->Draw2D(line);
107  }
108 
109  // text
110  //char cstring[80];
111  //std::sprintf(cstring, "%8.2e", v);
112  //G4String value(cstring);
113  std::ostringstream oss;
114  oss << std::setw(8) << std::setprecision(1) << std::scientific << v;
115  std::string str = oss.str();
116  G4String value = str;//.c_str());
117 
118 
119  G4Text text(value, G4Point3D(-0.9, -0.9+0.05*n, 0.4));
120  G4double size = 12.;
121  text.SetScreenSize(size);
122  this->GetMapColor(v, c);
123  G4Colour color(c[0], c[1], c[2], 1.);
124  G4VisAttributes att(color);
125  text.SetVisAttributes(&att);
126 
127  fVisManager->Draw2D(text);
128  }
129 
130  // draw ps name
131  // background
132  G4double lpsname = 2.+fPSName.size()*0.95;
133  if(lpsname > 0) {
134  for(int l = 0; l < 22; l++) {
135  G4Polyline line;
136  line.push_back(G4Point3D(-0.92, -0.965+0.002*l, 0.));
137  line.push_back(G4Point3D(-0.92+0.025*lpsname, -0.965+0.002*l, 0.));
138  G4VisAttributes attblack(black);
139  //G4VisAttributes attblack(G4Colour(.5, .5, 1.));
140  line.SetVisAttributes(&attblack);
141  fVisManager->Draw2D(line);
142  }
143 
144  // ps name
145  G4Text txtpsname(fPSName, G4Point3D(-0.9, -0.96, 0.1));
146  G4double size = 12.;
147  txtpsname.SetScreenSize(size);
148  G4Colour color(1., 1., 1.);
149  G4VisAttributes att(color);
150  txtpsname.SetVisAttributes(&att);
151  fVisManager->Draw2D(txtpsname);
152 
153  }
154 
155  // draw unit
156  // background
157  G4double len = 2.+fPSUnit.size();
158  if(len > 0) {
159  for(int l = 0; l < 21; l++) {
160  G4Polyline line;
161  line.push_back(G4Point3D(-0.7, -0.9+0.002*l, 0.));
162  line.push_back(G4Point3D(-0.7+0.025*len, -0.9+0.002*l, 0.));
163  G4VisAttributes attblack(black);
164  //G4VisAttributes attblack(G4Colour(.5, .5, .5));
165  line.SetVisAttributes(&attblack);
166  fVisManager->Draw2D(line);
167  }
168 
169  // unit
170  G4String psunit = "[" + fPSUnit + "]";
171  G4Text txtunit(psunit, G4Point3D(-0.69, -0.9, 0.1));
172  G4double size = 12.;
173  txtunit.SetScreenSize(size);
174  G4Colour color(1., 1., 1.);
175  G4VisAttributes att(color);
176  txtunit.SetVisAttributes(&att);
177  fVisManager->Draw2D(txtunit);
178  }
179 
181 }
const XML_Char int len
Definition: expat.h:262
Definition: G4Text.hh:73
G4VVisManager * fVisManager
virtual void GetMapColor(G4double val, G4double color[4])=0
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:35
G4double GetMax() const
virtual void EndDraw2D()=0
const XML_Char int const XML_Char * value
Definition: expat.h:331
virtual void BeginDraw2D(const G4Transform3D &objectTransformation=G4Transform3D())=0
void SetVisAttributes(const G4VisAttributes *)
Definition: G4Visible.cc:80
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
double G4double
Definition: G4Types.hh:76
virtual void Draw2D(const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())=0
G4double GetMin() const

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void G4VScoreColorMap::GetMapColor ( G4double  val,
G4double  color[4] 
)
pure virtual

Implemented in G4DefaultLinearColorMap, and G4ScoreLogColorMap.

Here is the caller graph for this function:

G4double G4VScoreColorMap::GetMax ( ) const
inline

Definition at line 66 of file G4VScoreColorMap.hh.

67  { return fMaxVal; }

Here is the caller graph for this function:

G4double G4VScoreColorMap::GetMin ( ) const
inline

Definition at line 64 of file G4VScoreColorMap.hh.

65  { return fMinVal; }

Here is the caller graph for this function:

G4String G4VScoreColorMap::GetName ( ) const
inline

Definition at line 47 of file G4VScoreColorMap.hh.

48  { return fName; }

Here is the caller graph for this function:

G4bool G4VScoreColorMap::IfFloatMinMax ( ) const
inline

Definition at line 51 of file G4VScoreColorMap.hh.

52  { return ifFloat; }

Here is the caller graph for this function:

void G4VScoreColorMap::SetFloatingMinMax ( G4bool  vl = true)
inline

Definition at line 49 of file G4VScoreColorMap.hh.

50  { ifFloat = vl; }

Here is the caller graph for this function:

void G4VScoreColorMap::SetMinMax ( G4double  minVal,
G4double  maxVal 
)
inline

Definition at line 53 of file G4VScoreColorMap.hh.

54  {
55  if(minVal >= maxVal)
56  { G4cerr << "WARNING: G4VScoreColoMap::SetMinMax() : minimum is larger than or equal to maximum. Verify values you set, ["
57  << minVal << ", " << maxVal << "]" << G4endl;
58  fMinVal = maxVal; fMaxVal = minVal;
59  }
60  else {
61  fMinVal = minVal; fMaxVal = maxVal;
62  }
63  }
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the caller graph for this function:

void G4VScoreColorMap::SetPSName ( G4String psName)
inline

Definition at line 78 of file G4VScoreColorMap.hh.

78 {fPSName = psName;}

Here is the caller graph for this function:

void G4VScoreColorMap::SetPSUnit ( G4String unit)
inline

Definition at line 77 of file G4VScoreColorMap.hh.

77 {fPSUnit = unit;}

Here is the caller graph for this function:

Member Data Documentation

G4double G4VScoreColorMap::fMaxVal
protected

Definition at line 84 of file G4VScoreColorMap.hh.

G4double G4VScoreColorMap::fMinVal
protected

Definition at line 83 of file G4VScoreColorMap.hh.

G4String G4VScoreColorMap::fName
protected

Definition at line 81 of file G4VScoreColorMap.hh.

G4String G4VScoreColorMap::fPSName
protected

Definition at line 87 of file G4VScoreColorMap.hh.

G4String G4VScoreColorMap::fPSUnit
protected

Definition at line 86 of file G4VScoreColorMap.hh.

G4VVisManager* G4VScoreColorMap::fVisManager
protected

Definition at line 85 of file G4VScoreColorMap.hh.

G4bool G4VScoreColorMap::ifFloat
protected

Definition at line 82 of file G4VScoreColorMap.hh.


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