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

#include <CexmcScenePrimitivesMessenger.hh>

Inheritance diagram for CexmcScenePrimitivesMessenger:
Collaboration diagram for CexmcScenePrimitivesMessenger:

Public Member Functions

 CexmcScenePrimitivesMessenger (CexmcScenePrimitives *scenePrimitives)
 
 ~CexmcScenePrimitivesMessenger ()
 
void SetNewValue (G4UIcommand *cmd, G4String value)
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
G4bool commandsShouldBeInMaster
 

Detailed Description

Definition at line 56 of file CexmcScenePrimitivesMessenger.hh.

Constructor & Destructor Documentation

CexmcScenePrimitivesMessenger::CexmcScenePrimitivesMessenger ( CexmcScenePrimitives scenePrimitives)
explicit

Definition at line 57 of file CexmcScenePrimitivesMessenger.cc.

58  :
59  scenePrimitives( scenePrimitives ), drawRadialLine( NULL ),
60  clearRadialLines( NULL ), markTargetCenter( NULL ),
61  highlightInnerCrystals( NULL ), setColour( NULL )
62 {
63  drawRadialLine = new G4UIcmdWith3Vector(
64  ( CexmcMessenger::visDirName + "drawRadialLine" ).c_str(), this );
65  drawRadialLine->SetGuidance( "Draw radial line with specified theta, phi "
66  "(both in deg!)\n and length (in cm!)" );
67  drawRadialLine->SetParameterName( "RadialLineTheta", "RadialLinePhi",
68  "RadialLineLength", true );
69  drawRadialLine->SetRange( "RadialLineLength >= 0." );
70  drawRadialLine->SetDefaultValue( G4ThreeVector( 0., 0., 100. ) );
72 
73  clearRadialLines = new G4UIcmdWithoutParameter(
74  ( CexmcMessenger::visDirName + "clearRadialLines" ).c_str(), this );
75  clearRadialLines->SetGuidance( "Clear all existing radial lines" );
76  clearRadialLines->AvailableForStates( G4State_PreInit, G4State_Idle );
77 
78  markTargetCenter = new G4UIcmdWithABool(
79  ( CexmcMessenger::visDirName + "markTargetCenter" ).c_str(), this );
80  markTargetCenter->SetGuidance( "Mark/unmark target center" );
81  markTargetCenter->SetParameterName( "MarkTargetCenter", true );
82  markTargetCenter->SetDefaultValue( true );
83  markTargetCenter->AvailableForStates( G4State_PreInit, G4State_Idle );
84 
85  highlightInnerCrystals = new G4UIcmdWithABool(
86  ( CexmcMessenger::visDirName + "hlIC" ).c_str(), this );
87  highlightInnerCrystals->SetGuidance( "Highlight inner crystals in "
88  "calorimeters on/off" );
89  highlightInnerCrystals->SetParameterName( "HighlightInnerCrystals", true );
90  highlightInnerCrystals->SetDefaultValue( true );
91  highlightInnerCrystals->AvailableForStates( G4State_PreInit, G4State_Idle );
92 
93  setColour = new G4UIcommand(
94  ( CexmcMessenger::visDirName + "setColour" ).c_str(), this );
95  setColour->SetGuidance( "Set colour of specified scene primitive" );
96  G4UIparameter * parameter( new G4UIparameter( "ScenePrimitive", 's',
97  false ) );
98  parameter->SetGuidance( "Scene primitive, possible values:\n"
99  " tc - target center mark,\n"
100  " rl - radial lines,\n"
101  " ic - inner crystal highlights" );
102  parameter->SetParameterCandidates( "tc rl ic" );
103  setColour->SetParameter( parameter );
104  parameter = new G4UIparameter( "red", 's', true );
105  parameter->SetGuidance( "Red component or string, e.g. \"blue\", in which "
106  "case succeeding colour\n components are ignored" );
107  parameter->SetDefaultValue( "1.0" );
108  setColour->SetParameter( parameter );
109  parameter = new G4UIparameter( "green", 'd', true );
110  parameter->SetGuidance( "Green component" );
111  parameter->SetDefaultValue( 1.0 );
112  setColour->SetParameter( parameter );
113  parameter = new G4UIparameter( "blue", 'd', true );
114  parameter->SetGuidance( "Blue component" );
115  parameter->SetDefaultValue( 1.0 );
116  setColour->SetParameter( parameter );
117  parameter = new G4UIparameter( "opacity", 'd', true );
118  parameter->SetGuidance( "Opacity" );
119  parameter->SetDefaultValue( 1.0 );
120  setColour->SetParameter( parameter );
122 }
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
CLHEP::Hep3Vector G4ThreeVector
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4bool defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:240
static G4String visDirName
void SetDefaultValue(G4ThreeVector defVal)

Here is the call graph for this function:

CexmcScenePrimitivesMessenger::~CexmcScenePrimitivesMessenger ( )

Definition at line 125 of file CexmcScenePrimitivesMessenger.cc.

126 {
127  delete drawRadialLine;
128  delete clearRadialLines;
129  delete markTargetCenter;
130  delete highlightInnerCrystals;
131  delete setColour;
132 }

Member Function Documentation

void CexmcScenePrimitivesMessenger::SetNewValue ( G4UIcommand cmd,
G4String  value 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 135 of file CexmcScenePrimitivesMessenger.cc.

137 {
138  do
139  {
140  if ( cmd == drawRadialLine )
141  {
143  value ) );
144  scenePrimitives->DrawRadialLine( line );
145  break;
146  }
147  if ( cmd == clearRadialLines )
148  {
149  scenePrimitives->ClearRadialLines();
150  break;
151  }
152  if ( cmd == markTargetCenter )
153  {
154  scenePrimitives->MarkTargetCenter(
156  break;
157  }
158  if ( cmd == highlightInnerCrystals )
159  {
160  scenePrimitives->HighlightInnerCrystals(
162  break;
163  }
164  if ( cmd == setColour )
165  {
166  G4String name;
167  G4String redOrString;
168  G4double green( 1 );
169  G4double blue( 1 );
170  G4double opacity( 1 );
171  G4Colour colour( 1, green, blue, opacity );
172  std::istringstream iss( value );
173 
174  iss >> name >> redOrString >> green >> blue >> opacity;
175 
176  if ( std::isalpha( redOrString[ size_t( 0 ) ] ) )
177  {
178  G4Colour::GetColour( redOrString, colour );
179  }
180  else
181  {
182  colour = G4Colour( G4UIcommand::ConvertToDouble( redOrString ),
183  green, blue );
184  }
185  colour = G4Colour( colour.GetRed(), colour.GetGreen(),
186  colour.GetBlue(), opacity );
187 
189  do
190  {
191  if ( name == "tc" )
192  {
193  primitive = CexmcTargetCenterMark_SP;
194  break;
195  }
196  if ( name == "rl" )
197  {
198  primitive = CexmcRadialLine_SP;
199  break;
200  }
201  if ( name == "ic" )
202  {
203  primitive = CexmcInnerCrystalsHl_SP;
204  break;
205  }
206  return;
207  } while ( false );
208 
209  scenePrimitives->SetColour( primitive, colour );
210  break;
211  }
212  } while ( false );
213 }
const XML_Char * name
Definition: expat.h:151
void SetColour(CexmcSPType primitive, const G4Colour &colour)
static G4bool GetColour(const G4String &key, G4Colour &result)
Definition: G4Colour.cc:126
void MarkTargetCenter(G4bool on=true)
Definition: test07.cc:36
static G4bool GetNewBoolValue(const char *paramString)
static G4ThreeVector GetNew3VectorValue(const char *paramString)
static G4double ConvertToDouble(const char *st)
Definition: G4UIcommand.cc:455
double G4double
Definition: G4Types.hh:76
void HighlightInnerCrystals(G4bool=true)
void DrawRadialLine(const G4ThreeVector &line)

Here is the call graph for this function:


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