Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CCalVisualisable Class Reference

#include <CCalVisualisable.hh>

Public Types

enum  visType {
  Sensitive =0, Electronics =1, Support =2, Cable =3,
  Absorber =4, OtherServices =5, PseudoVolumes =6, TotalVisTypes =7,
  Undefined =-1
}
 

Public Member Functions

 CCalVisualisable (G4String file)
 
virtual ~CCalVisualisable ()
 
bool readFile (G4String file)
 
void setDefault ()
 
bool isVisible (visType v) const
 
void setVisible (visType v, bool flag=true)
 
double colorRed (visType v) const
 
double colorGreen (visType v) const
 
double colorBlue (visType v) const
 
void setColorRed (visType v, double r)
 
void setColorGreen (visType v, double g)
 
void setColorBlue (visType v, double b)
 
void setColor (visType v, double r, double g, double b)
 
bool isWireFrame (visType v) const
 
void setWireFrame (visType v, bool wf=true)
 

Protected Member Functions

bool readFile ()
 

Static Protected Member Functions

static void setPath ()
 

Detailed Description

Definition at line 39 of file CCalVisualisable.hh.

Member Enumeration Documentation

Constructor & Destructor Documentation

CCalVisualisable::CCalVisualisable ( G4String  file)

Definition at line 41 of file CCalVisualisable.cc.

41  :visFile(file) {
42  if (!pathName)
43  setPath();
44  setDefault();
45  readFile();
46 }
static void setPath()

Here is the call graph for this function:

virtual CCalVisualisable::~CCalVisualisable ( )
inlinevirtual

Definition at line 71 of file CCalVisualisable.hh.

71 {}

Member Function Documentation

double CCalVisualisable::colorBlue ( visType  v) const
inline

Definition at line 85 of file CCalVisualisable.hh.

85 {return theParameters[v].bColor;}
tuple v
Definition: test.py:18

Here is the caller graph for this function:

double CCalVisualisable::colorGreen ( visType  v) const
inline

Definition at line 84 of file CCalVisualisable.hh.

84 {return theParameters[v].gColor;}
tuple v
Definition: test.py:18

Here is the caller graph for this function:

double CCalVisualisable::colorRed ( visType  v) const
inline

Definition at line 83 of file CCalVisualisable.hh.

83 {return theParameters[v].rColor;}
tuple v
Definition: test.py:18

Here is the caller graph for this function:

bool CCalVisualisable::isVisible ( visType  v) const
inline

Definition at line 80 of file CCalVisualisable.hh.

80 {return theParameters[v].visibility;}
tuple v
Definition: test.py:18

Here is the caller graph for this function:

bool CCalVisualisable::isWireFrame ( visType  v) const
inline

Definition at line 91 of file CCalVisualisable.hh.

91 {return theParameters[v].wireframe;}
tuple v
Definition: test.py:18

Here is the caller graph for this function:

bool CCalVisualisable::readFile ( G4String  file)

Definition at line 48 of file CCalVisualisable.cc.

48  {
49  visFile=file;
50  return readFile();
51 }

Here is the call graph for this function:

bool CCalVisualisable::readFile ( )
protected

Definition at line 80 of file CCalVisualisable.cc.

80  {
81  if (visFile=="") {
82  G4cerr << "ERROR: No file was specified from which to read Visualisation parameters"
83  << G4endl;
84  return false;
85  }
86 
88  //Let's open the file
89  G4cout << " ==> Opening file " << visFile
90  << " to read visualisation parameters..."
91  << G4endl;
92 
93  G4String pathname(pathName);
94  std::ifstream is;
95 #ifdef debug
96  G4cout << "Viualisable : Path " << pathname << " FIle " << visFile << G4endl;
97 #endif
98  bool ok = openGeomFile(is, pathname, visFile);
99  if (!ok) {
100  G4cout << "WARNING: Could not read " << visFile << G4endl;
101  G4cout << " Default visualization parameters will be used." << G4endl;
102  return false;
103  }
104 
105  while (is) {
106  G4String viewvol;
107  readName(is,viewvol);
108 
109  visType vt = Undefined;
110  if (viewvol=="Sensitive")
111  vt=Sensitive;
112  else if (viewvol=="Electronics")
113  vt=Electronics;
114  else if (viewvol=="Support")
115  vt=Support;
116  else if (viewvol=="Absorber")
117  vt=Absorber;
118  else if (viewvol=="Cable")
119  vt=Cable;
120  else if (viewvol=="OtherServices")
121  vt=OtherServices;
122  else if (viewvol=="PseudoVolumes")
123  vt=PseudoVolumes;
124  else {
125  vt=Undefined;
126  G4cerr << "WARNING: Unknown type of visualisable object \"" << viewvol
127  << "\"." << G4endl;
128  }
129 
130 
131  int isvisible, wireframe;
132  double r, g, b;
133 
134  is >> isvisible >> r >> g >> b >> wireframe >> jump;
135 
136  r=checkColorRange(r,'R');
137  g=checkColorRange(g,'G');
138  b=checkColorRange(b,'B');
139 
140  if (vt!=Undefined) {
141 #ifdef debug
142  G4cout << tab << viewvol << tab << isvisible << tab
143  << r << " " << g << " "<< b << tab
144  << wireframe << G4endl;
145 #endif
146  theParameters[vt]=visParameters(isvisible, r, g, b, wireframe);
147  }
148 
149  }
150 
152  // Close the file
153  G4cout << " ==> Closing file " << visFile << G4endl;
154  is.close();
155 
156  return true;
157 }
bool openGeomFile(std::ifstream &is, const G4String &pathname, const G4String &filename)
Definition: CCalutils.cc:116
std::istream & jump(std::istream &)
Definition: CCalutils.cc:95
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
tuple b
Definition: test.py:12
std::ifstream & readName(std::ifstream &, G4String &)
Definition: CCalutils.cc:53
G4GLOB_DLL std::ostream G4cout
std::ostream & tab(std::ostream &)
Definition: CCalutils.cc:89
#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 CCalVisualisable::setColor ( visType  v,
double  r,
double  g,
double  b 
)

Definition at line 62 of file CCalVisualisable.cc.

62  {
63  theParameters[v].rColor=r;
64  theParameters[v].gColor=g;
65  theParameters[v].bColor=b;
66 }
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
tuple b
Definition: test.py:12
tuple v
Definition: test.py:18

Here is the call graph for this function:

void CCalVisualisable::setColorBlue ( visType  v,
double  b 
)
inline

Definition at line 88 of file CCalVisualisable.hh.

88 {theParameters[v].bColor=b;}
tuple b
Definition: test.py:12
tuple v
Definition: test.py:18
void CCalVisualisable::setColorGreen ( visType  v,
double  g 
)
inline

Definition at line 87 of file CCalVisualisable.hh.

87 {theParameters[v].gColor=g;}
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
tuple v
Definition: test.py:18

Here is the call graph for this function:

void CCalVisualisable::setColorRed ( visType  v,
double  r 
)
inline

Definition at line 86 of file CCalVisualisable.hh.

86 {theParameters[v].rColor=r;}
tuple v
Definition: test.py:18
void CCalVisualisable::setDefault ( )

Definition at line 53 of file CCalVisualisable.cc.

53  {
54  theParameters[Sensitive] = visParameters(true);
55  theParameters[Electronics] = visParameters(false);
56  theParameters[Support] = visParameters(false);
57  theParameters[Cable] = visParameters(false);
58  theParameters[OtherServices] = visParameters(false);
59  theParameters[PseudoVolumes] = visParameters(false);
60 }

Here is the caller graph for this function:

void CCalVisualisable::setPath ( )
staticprotected

Definition at line 68 of file CCalVisualisable.cc.

68  {
69  pathName = getenv(visEnvName);
70  if (!pathName) {
72  ed << "ERROR: " << visEnvName << " environmental variable not set!"
73  << G4endl;
74  ed << " Set it and restart." << G4endl;
75  G4Exception("CCalVisualisable::setPath()","ccal007",
76  FatalException,ed);
77  }
78 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const char * visEnvName
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

void CCalVisualisable::setVisible ( visType  v,
bool  flag = true 
)
inline

Definition at line 81 of file CCalVisualisable.hh.

81 {theParameters[v].visibility=flag;}
tuple v
Definition: test.py:18
void CCalVisualisable::setWireFrame ( visType  v,
bool  wf = true 
)
inline

Definition at line 92 of file CCalVisualisable.hh.

92 {theParameters[v].wireframe=wf;}
tuple v
Definition: test.py:18

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