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

#include <G4UImanager.hh>

Inheritance diagram for G4UImanager:
Collaboration diagram for G4UImanager:

Public Member Functions

 ~G4UImanager ()
 
G4String GetCurrentValues (const char *aCommand)
 
void AddNewCommand (G4UIcommand *newCommand)
 
void RemoveCommand (G4UIcommand *aCommand)
 
void ExecuteMacroFile (const char *fileName)
 
void Loop (const char *macroFile, const char *variableName, G4double initialValue, G4double finalValue, G4double stepSize=1.0)
 
void Foreach (const char *macroFile, const char *variableName, const char *candidates)
 
G4int ApplyCommand (const char *aCommand)
 
G4int ApplyCommand (const G4String &aCommand)
 
void StoreHistory (const char *fileName="G4history.macro")
 
void StoreHistory (G4bool historySwitch, const char *fileName="G4history.macro")
 
void ListCommands (const char *direc)
 
void SetAlias (const char *aliasLine)
 
void RemoveAlias (const char *aliasName)
 
void ListAlias ()
 
G4String SolveAlias (const char *aCmd)
 
void CreateHTML (const char *dir="/")
 
void LoopS (const char *valueList)
 
void ForeachS (const char *valueList)
 
virtual G4bool Notify (G4ApplicationState requestedState)
 
G4String GetCurrentStringValue (const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
 
G4int GetCurrentIntValue (const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
 
G4double GetCurrentDoubleValue (const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
 
G4String GetCurrentStringValue (const char *aCommand, const char *aParameterName, G4bool reGet=true)
 
G4int GetCurrentIntValue (const char *aCommand, const char *aParameterName, G4bool reGet=true)
 
G4double GetCurrentDoubleValue (const char *aCommand, const char *aParameterName, G4bool reGet=true)
 
void SetPauseAtBeginOfEvent (G4bool vl)
 
G4bool GetPauseAtBeginOfEvent () const
 
void SetPauseAtEndOfEvent (G4bool vl)
 
G4bool GetPauseAtEndOfEvent () const
 
G4UIcommandTreeGetTree () const
 
G4UIsessionGetSession () const
 
G4UIsessionGetG4UIWindow () const
 
void SetSession (G4UIsession *const value)
 
void SetG4UIWindow (G4UIsession *const value)
 
void SetCoutDestination (G4UIsession *const value)
 
void SetVerboseLevel (G4int val)
 
G4int GetVerboseLevel () const
 
G4int GetNumberOfHistory () const
 
G4String GetPreviousCommand (G4int i) const
 
void SetMaxHistSize (G4int mx)
 
G4int GetMaxHistSize () const
 
void SetMacroSearchPath (const G4String &path)
 
const G4StringGetMacroSearchPath () const
 
void ParseMacroSearchPath ()
 
G4String FindMacroPath (const G4String &fname) const
 
void SetMasterUIManager (G4bool val)
 
void SetIgnoreCmdNotFound (G4bool val)
 
std::vector< G4String > * GetCommandStack ()
 
void RegisterBridge (G4UIbridge *brg)
 
void SetUpForAThread (G4int tId)
 
void SetUpForSpecialThread (G4String aPrefix)
 
G4int GetThreadID () const
 
void SetCoutFileName (const G4String &fileN="G4cout.txt", G4bool ifAppend=true)
 
void SetCerrFileName (const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)
 
void SetThreadPrefixString (const G4String &s="W")
 
void SetThreadUseBuffer (G4bool flg=true)
 
void SetThreadIgnore (G4int tid=0)
 
void SetThreadIgnoreInit (G4bool flg=true)
 
G4MTcoutDestinationGetThreadCout ()
 
- Public Member Functions inherited from G4VStateDependent
 G4VStateDependent (G4bool bottom=false)
 
virtual ~G4VStateDependent ()
 
G4int operator== (const G4VStateDependent &right) const
 
G4int operator!= (const G4VStateDependent &right) const
 

Static Public Member Functions

static G4UImanagerGetUIpointer ()
 
static G4UImanagerGetMasterUIpointer ()
 
static void UseDoublePrecisionStr (G4bool val)
 
static G4bool DoublePrecisionStr ()
 

Protected Member Functions

 G4UImanager ()
 

Detailed Description

Definition at line 56 of file G4UImanager.hh.

Constructor & Destructor Documentation

G4UImanager::G4UImanager ( )
protected

Definition at line 75 of file G4UImanager.cc.

76  : G4VStateDependent(true),
77  UImessenger(0), UnitsMessenger(0), CoutMessenger(0),
78  isMaster(false),bridges(0),
79  ignoreCmdNotFound(false), stackCommandsForBroadcast(false),
80  threadID(-1), threadCout(0)
81 {
82  savedCommand = 0;
83  treeTop = new G4UIcommandTree("/");
84  aliasList = new G4UIaliasList;
85  G4String nullString;
86  savedParameters = nullString;
87  verboseLevel = 0;
88  saveHistory = false;
89  session = NULL;
90  g4UIWindow = NULL;
91  SetCoutDestination(session);
92  pauseAtBeginOfEvent = false;
93  pauseAtEndOfEvent = false;
94  maxHistSize = 20;
95  searchPath="";
96  commandStack = new std::vector<G4String>;
97 }
void SetCoutDestination(G4UIsession *const value)
Definition: G4UImanager.cc:619
G4VStateDependent(G4bool bottom=false)

Here is the call graph for this function:

Here is the caller graph for this function:

G4UImanager::~G4UImanager ( )

Definition at line 106 of file G4UImanager.cc.

107 {
108  if(bridges)
109  {
110  std::vector<G4UIbridge*>::iterator itr = bridges->begin();
111  for(;itr!=bridges->end();itr++)
112  { delete *itr; }
113  delete bridges;
114  }
115  SetCoutDestination(NULL);
116  histVec.clear();
117  if(saveHistory) historyFile.close();
118  delete CoutMessenger;
119  delete UnitsMessenger;
120  delete UImessenger;
121  delete treeTop;
122  delete aliasList;
123  fUImanagerHasBeenKilled = true;
124  fUImanager = NULL;
125  if(commandStack)
126  {
127  commandStack->clear();
128  delete commandStack;
129  }
130  if(threadID >= 0)
131  {
132  if(threadCout) delete threadCout;
134  threadID = -1;
135  }
136 }
void SetCoutDestination(G4UIsession *const value)
Definition: G4UImanager.cc:619
void G4iosFinalization()
Definition: G4ios.cc:86

Here is the call graph for this function:

Member Function Documentation

void G4UImanager::AddNewCommand ( G4UIcommand newCommand)

Definition at line 269 of file G4UImanager.cc.

270 {
271  treeTop->AddNewCommand( newCommand );
272  if(fMasterUImanager!=0&&G4Threading::G4GetThreadId()==0)
273  { fMasterUImanager->AddWorkerCommand(newCommand); }
274 }
void AddNewCommand(G4UIcommand *newCommand, G4bool workerThreadOnly=false)
G4int G4GetThreadId()
Definition: G4Threading.cc:144

Here is the call graph for this function:

G4int G4UImanager::ApplyCommand ( const char *  aCommand)

Definition at line 447 of file G4UImanager.cc.

448 {
449  G4String aCommand = SolveAlias(aCmd);
450  if(aCommand.isNull()) return fAliasNotFound;
451  if(verboseLevel) G4cout << aCommand << G4endl;
452  G4String commandString;
453  G4String commandParameter;
454 
455  G4int i = aCommand.index(" ");
456  if( i != G4int(std::string::npos) )
457  {
458  commandString = aCommand(0,i);
459  commandParameter = aCommand(i+1,aCommand.length()-(i+1));
460  }
461  else
462  {
463  commandString = aCommand;
464  }
465 
466  // remove doubled slash
467  G4int len = commandString.length();
468  G4int ll = 0;
469  G4String a1;
470  G4String a2;
471  while(ll<len-1)
472  {
473  if(commandString(ll,2)=="//")
474  {
475  if(ll==0)
476  { commandString.remove(ll,1); }
477  else
478  {
479  a1 = commandString(0,ll);
480  a2 = commandString(ll+1,len-ll-1);
481  commandString = a1+a2;
482  }
483  len--;
484  }
485  else
486  { ll++; }
487  }
488 
489  if(isMaster&&bridges)
490  {
491  std::vector<G4UIbridge*>::iterator itr = bridges->begin();
492  for(;itr!=bridges->end();itr++)
493  {
494  G4int leng = (*itr)->DirLength();
495  if(commandString(0,leng)==(*itr)->DirName())
496  { return (*itr)->LocalUI()->ApplyCommand(commandString+" "+commandParameter); }
497  }
498  }
499 
500  G4UIcommand * targetCommand = treeTop->FindPath( commandString );
501  if( targetCommand == NULL )
502  {
503  if(ignoreCmdNotFound)
504  {
505  if(stackCommandsForBroadcast)
506  { commandStack->push_back(commandString+" "+commandParameter); }
507  return fCommandSucceeded;
508  }
509  else
510  { return fCommandNotFound; }
511  }
512 
513  if(stackCommandsForBroadcast && targetCommand->ToBeBroadcasted())
514  { commandStack->push_back(commandString+" "+commandParameter); }
515 
516  if(!(targetCommand->IsAvailable()))
517  { return fIllegalApplicationState; }
518 
519  if(saveHistory) historyFile << aCommand << G4endl;
520  if( G4int(histVec.size()) >= maxHistSize )
521  { histVec.erase(histVec.begin()); }
522  histVec.push_back(aCommand);
523 
524  return targetCommand->DoIt( commandParameter );
525 }
const XML_Char int len
Definition: expat.h:262
G4bool IsAvailable()
Definition: G4UIcommand.cc:290
G4String & remove(str_size)
G4UIcommand * FindPath(const char *commandPath) const
int G4int
Definition: G4Types.hh:78
G4bool ToBeBroadcasted() const
Definition: G4UIcommand.hh:186
G4GLOB_DLL std::ostream G4cout
str_size index(const char *, G4int pos=0) const
G4String SolveAlias(const char *aCmd)
Definition: G4UImanager.cc:392
#define G4endl
Definition: G4ios.hh:61
G4bool isNull() const
virtual G4int DoIt(G4String parameterList)
Definition: G4UIcommand.cc:123

Here is the call graph for this function:

Here is the caller graph for this function:

G4int G4UImanager::ApplyCommand ( const G4String aCommand)

Definition at line 440 of file G4UImanager.cc.

441 {
442  return ApplyCommand(aCmd.data());
443 }
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447

Here is the call graph for this function:

void G4UImanager::CreateHTML ( const char *  dir = "/")

Definition at line 656 of file G4UImanager.cc.

657 {
658  G4UIcommandTree* tr = FindDirectory(dir);
659  if(tr!=0)
660  { tr->CreateHTML(); }
661  else
662  { G4cerr << "Directory <" << dir << "> is not found." << G4endl; }
663 }
#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:

static G4bool G4UImanager::DoublePrecisionStr ( )
inlinestatic

Definition at line 301 of file G4UImanager.hh.

301 { return doublePrecisionStr; }

Here is the caller graph for this function:

void G4UImanager::ExecuteMacroFile ( const char *  fileName)

Definition at line 293 of file G4UImanager.cc.

294 {
295  G4UIsession* batchSession = new G4UIbatch(fileName,session);
296  session = batchSession;
297  G4UIsession* previousSession = session->SessionStart();
298  delete session;
299  session = previousSession;
300 }
virtual G4UIsession * SessionStart()
Definition: G4UIsession.cc:46

Here is the call graph for this function:

Here is the caller graph for this function:

G4String G4UImanager::FindMacroPath ( const G4String fname) const

Definition at line 695 of file G4UImanager.cc.

696 {
697  G4String macrofile = fname;
698 
699  for (size_t i = 0; i < searchDirs.size(); i++) {
700  G4String fullpath = searchDirs[i] + "/" + fname;
701  if ( FileFound(fullpath) ) {
702  macrofile = fullpath;
703  break;
704  }
705  }
706 
707  return macrofile;
708 }
static G4bool FileFound(const G4String &fname)
Definition: G4UImanager.cc:683

Here is the call graph for this function:

Here is the caller graph for this function:

void G4UImanager::Foreach ( const char *  macroFile,
const char *  variableName,
const char *  candidates 
)

Definition at line 375 of file G4UImanager.cc.

377 {
378  G4String candidatesString = candidates;
379  G4Tokenizer parameterToken( candidatesString );
380  G4String cd;
381  while(!((cd=parameterToken()).isNull()))
382  {
383  G4String vl = variableName;
384  vl += " ";
385  vl += cd;
386  SetAlias(vl);
387  ExecuteMacroFile(FindMacroPath(macroFile));
388  }
389 }
void ExecuteMacroFile(const char *fileName)
Definition: G4UImanager.cc:293
void SetAlias(const char *aliasLine)
Definition: G4UImanager.cc:625
static const G4double cd
G4String FindMacroPath(const G4String &fname) const
Definition: G4UImanager.cc:695

Here is the call graph for this function:

Here is the caller graph for this function:

void G4UImanager::ForeachS ( const char *  valueList)

Definition at line 346 of file G4UImanager.cc.

347 {
348  G4String vl = valueList;
349  G4Tokenizer parameterToken(vl);
350  G4String mf = parameterToken();
351  G4String vn = parameterToken();
352  G4String c1 = parameterToken();
353  G4String ca;
354  while(!((ca=parameterToken()).isNull()))
355  {
356  c1 += " ";
357  c1 += ca;
358  }
359 
360  G4String aliasValue = c1;
361  if(aliasValue(0)=='"')
362  {
363  G4String strippedValue;
364  if(aliasValue(aliasValue.length()-1)=='"')
365  { strippedValue = aliasValue(1,aliasValue.length()-2); }
366  else
367  { strippedValue = aliasValue(1,aliasValue.length()-1); }
368  aliasValue = strippedValue;
369  }
370 
371 // Foreach(mf,vn,c1);
372  Foreach(mf,vn,aliasValue);
373 }
void Foreach(const char *macroFile, const char *variableName, const char *candidates)
Definition: G4UImanager.cc:375

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< G4String > * G4UImanager::GetCommandStack ( )

Definition at line 710 of file G4UImanager.cc.

711 {
712  std::vector<G4String>* returnValue = commandStack;
713  commandStack = new std::vector<G4String>;
714  return returnValue;
715 }

Here is the caller graph for this function:

G4double G4UImanager::GetCurrentDoubleValue ( const char *  aCommand,
G4int  parameterNumber = 1,
G4bool  reGet = true 
)

Definition at line 257 of file G4UImanager.cc.

259 {
260  G4String targetParameter =
261  GetCurrentStringValue( aCommand, parameterNumber, reGet );
262  G4double value;
263  const char* t = targetParameter;
264  std::istringstream is(t);
265  is >> value;
266  return value;
267 }
G4String GetCurrentStringValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
Definition: G4UImanager.cc:183
const XML_Char int const XML_Char * value
Definition: expat.h:331
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

G4double G4UImanager::GetCurrentDoubleValue ( const char *  aCommand,
const char *  aParameterName,
G4bool  reGet = true 
)

Definition at line 245 of file G4UImanager.cc.

247 {
248  G4String targetParameter =
249  GetCurrentStringValue( aCommand, aParameterName, reGet );
250  G4double value;
251  const char* t = targetParameter;
252  std::istringstream is(t);
253  is >> value;
254  return value;
255 }
G4String GetCurrentStringValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
Definition: G4UImanager.cc:183
const XML_Char int const XML_Char * value
Definition: expat.h:331
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

G4int G4UImanager::GetCurrentIntValue ( const char *  aCommand,
G4int  parameterNumber = 1,
G4bool  reGet = true 
)

Definition at line 233 of file G4UImanager.cc.

235 {
236  G4String targetParameter =
237  GetCurrentStringValue( aCommand, parameterNumber, reGet );
238  G4int value;
239  const char* t = targetParameter;
240  std::istringstream is(t);
241  is >> value;
242  return value;
243 }
G4String GetCurrentStringValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
Definition: G4UImanager.cc:183
int G4int
Definition: G4Types.hh:78
const XML_Char int const XML_Char * value
Definition: expat.h:331

Here is the call graph for this function:

Here is the caller graph for this function:

G4int G4UImanager::GetCurrentIntValue ( const char *  aCommand,
const char *  aParameterName,
G4bool  reGet = true 
)

Definition at line 221 of file G4UImanager.cc.

223 {
224  G4String targetParameter =
225  GetCurrentStringValue( aCommand, aParameterName, reGet );
226  G4int value;
227  const char* t = targetParameter;
228  std::istringstream is(t);
229  is >> value;
230  return value;
231 }
G4String GetCurrentStringValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
Definition: G4UImanager.cc:183
int G4int
Definition: G4Types.hh:78
const XML_Char int const XML_Char * value
Definition: expat.h:331

Here is the call graph for this function:

G4String G4UImanager::GetCurrentStringValue ( const char *  aCommand,
G4int  parameterNumber = 1,
G4bool  reGet = true 
)

Definition at line 183 of file G4UImanager.cc.

185 {
186  if(reGet || savedCommand == NULL)
187  {
188  savedParameters = GetCurrentValues( aCommand );
189  }
190  G4Tokenizer savedToken( savedParameters );
191  G4String token;
192  for(G4int i_thParameter=0;i_thParameter<parameterNumber;i_thParameter++)
193  {
194  token = savedToken();
195  if( token.isNull() ) return G4String();
196  if( token[(size_t)0] == '"' )
197  {
198  token.append(" ");
199  token.append(savedToken("\""));
200  }
201  }
202  return token;
203 }
int G4int
Definition: G4Types.hh:78
G4String GetCurrentValues(const char *aCommand)
Definition: G4UImanager.cc:171
G4String & append(const G4String &)
G4bool isNull() const

Here is the call graph for this function:

Here is the caller graph for this function:

G4String G4UImanager::GetCurrentStringValue ( const char *  aCommand,
const char *  aParameterName,
G4bool  reGet = true 
)

Definition at line 205 of file G4UImanager.cc.

207 {
208  if(reGet || savedCommand == NULL)
209  {
210  G4String parameterValues = GetCurrentValues( aCommand );
211  }
212  for(G4int i=0;i<savedCommand->GetParameterEntries();i++)
213  {
214  if( aParameterName ==
215  savedCommand->GetParameter(i)->GetParameterName() )
216  return GetCurrentStringValue(aCommand,i+1,false);
217  }
218  return G4String();
219 }
G4String GetCurrentStringValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
Definition: G4UImanager.cc:183
G4String GetParameterName() const
int G4int
Definition: G4Types.hh:78
G4UIparameter * GetParameter(G4int i) const
Definition: G4UIcommand.hh:145
G4String GetCurrentValues(const char *aCommand)
Definition: G4UImanager.cc:171
G4int GetParameterEntries() const
Definition: G4UIcommand.hh:143

Here is the call graph for this function:

G4String G4UImanager::GetCurrentValues ( const char *  aCommand)

Definition at line 171 of file G4UImanager.cc.

172 {
173  G4String theCommand = aCommand;
174  savedCommand = treeTop->FindPath( theCommand );
175  if( savedCommand == NULL )
176  {
177  G4cerr << "command not found" << G4endl;
178  return G4String();
179  }
180  return savedCommand->GetCurrentValue();
181 }
G4UIcommand * FindPath(const char *commandPath) const
#define G4endl
Definition: G4ios.hh:61
G4String GetCurrentValue()
Definition: G4UIcommand.cc:235
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

Here is the caller graph for this function:

G4UIsession* G4UImanager::GetG4UIWindow ( ) const
inline

Definition at line 210 of file G4UImanager.hh.

211  { return g4UIWindow; }
const G4String& G4UImanager::GetMacroSearchPath ( ) const
inline

Definition at line 245 of file G4UImanager.hh.

246  { return searchPath; }
G4UImanager * G4UImanager::GetMasterUIpointer ( )
static

Definition at line 72 of file G4UImanager.cc.

73 { return fMasterUImanager; }

Here is the caller graph for this function:

G4int G4UImanager::GetMaxHistSize ( ) const
inline

Definition at line 240 of file G4UImanager.hh.

241  { return maxHistSize; }

Here is the caller graph for this function:

G4int G4UImanager::GetNumberOfHistory ( ) const
inline

Definition at line 229 of file G4UImanager.hh.

230  { return histVec.size(); }

Here is the caller graph for this function:

G4bool G4UImanager::GetPauseAtBeginOfEvent ( ) const
inline

Definition at line 194 of file G4UImanager.hh.

195  { return pauseAtBeginOfEvent; }
G4bool G4UImanager::GetPauseAtEndOfEvent ( ) const
inline

Definition at line 198 of file G4UImanager.hh.

199  { return pauseAtEndOfEvent; }
G4String G4UImanager::GetPreviousCommand ( G4int  i) const
inline

Definition at line 231 of file G4UImanager.hh.

232  {
233  G4String st;
234  if(i>=0 && i<G4int(histVec.size()))
235  { st = histVec[i]; }
236  return st;
237  }
int G4int
Definition: G4Types.hh:78

Here is the caller graph for this function:

G4UIsession* G4UImanager::GetSession ( ) const
inline

Definition at line 208 of file G4UImanager.hh.

209  { return session; }

Here is the caller graph for this function:

G4MTcoutDestination* G4UImanager::GetThreadCout ( )
inline

Definition at line 294 of file G4UImanager.hh.

294 {return threadCout;};
G4int G4UImanager::GetThreadID ( ) const
inline

Definition at line 279 of file G4UImanager.hh.

280  { return threadID; }
G4UIcommandTree* G4UImanager::GetTree ( ) const
inline

Definition at line 206 of file G4UImanager.hh.

207  { return treeTop; }

Here is the caller graph for this function:

G4UImanager * G4UImanager::GetUIpointer ( )
static

Definition at line 59 of file G4UImanager.cc.

60 {
61  if(!fUImanager)
62  {
63  if(!fUImanagerHasBeenKilled)
64  {
65  fUImanager = new G4UImanager;
66  fUImanager->CreateMessenger();
67  }
68  }
69  return fUImanager;
70 }

Here is the call graph for this function:

G4int G4UImanager::GetVerboseLevel ( ) const
inline

Definition at line 227 of file G4UImanager.hh.

228  { return verboseLevel; }

Here is the caller graph for this function:

void G4UImanager::ListAlias ( )

Definition at line 651 of file G4UImanager.cc.

652 {
653  aliasList->List();
654 }

Here is the call graph for this function:

Here is the caller graph for this function:

void G4UImanager::ListCommands ( const char *  direc)

Definition at line 552 of file G4UImanager.cc.

553 {
554  G4UIcommandTree* comTree = FindDirectory(direct);
555  if(comTree)
556  { comTree->List(); }
557  else
558  { G4cout << direct << " is not found." << G4endl; }
559 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void List() const

Here is the call graph for this function:

Here is the caller graph for this function:

void G4UImanager::Loop ( const char *  macroFile,
const char *  variableName,
G4double  initialValue,
G4double  finalValue,
G4double  stepSize = 1.0 
)

Definition at line 322 of file G4UImanager.cc.

324 {
325  G4String cd;
326  if (stepSize > 0) {
327  for(G4double d=initialValue;d<=finalValue;d+=stepSize)
328  {
329  std::ostringstream os;
330  os << d;
331  cd += os.str();
332  cd += " ";
333  }
334  } else {
335  for(G4double d=initialValue;d>=finalValue;d+=stepSize)
336  {
337  std::ostringstream os;
338  os << d;
339  cd += os.str();
340  cd += " ";
341  }
342  }
343  Foreach(macroFile,variableName,cd);
344 }
void Foreach(const char *macroFile, const char *variableName, const char *candidates)
Definition: G4UImanager.cc:375
static const G4double cd
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

void G4UImanager::LoopS ( const char *  valueList)

Definition at line 302 of file G4UImanager.cc.

303 {
304  G4String vl = valueList;
305  G4Tokenizer parameterToken(vl);
306  G4String mf = parameterToken();
307  G4String vn = parameterToken();
308  G4String c1 = parameterToken();
309  c1 += " ";
310  c1 += parameterToken();
311  c1 += " ";
312  c1 += parameterToken();
313  const char* t1 = c1;
314  std::istringstream is(t1);
315  G4double d1;
316  G4double d2;
317  G4double d3;
318  is >> d1 >> d2 >> d3;
319  Loop(mf,vn,d1,d2,d3);
320 }
static const G4double d2
void Loop(const char *macroFile, const char *variableName, G4double initialValue, G4double finalValue, G4double stepSize=1.0)
Definition: G4UImanager.cc:322
static const G4double d1
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

G4bool G4UImanager::Notify ( G4ApplicationState  requestedState)
virtual

Implements G4VStateDependent.

Definition at line 583 of file G4UImanager.cc.

584 {
585  //G4cout << G4StateManager::GetStateManager()->GetStateString(requestedState) << " <--- " << G4StateManager::GetStateManager()->GetStateString(G4StateManager::GetStateManager()->GetPreviousState()) << G4endl;
586  if(pauseAtBeginOfEvent)
587  {
588  if(requestedState==G4State_EventProc &&
590  { PauseSession("BeginOfEvent"); }
591  }
592  if(pauseAtEndOfEvent)
593  {
594  if(requestedState==G4State_GeomClosed &&
595  G4StateManager::GetStateManager()->GetPreviousState()==G4State_EventProc)
596  { PauseSession("EndOfEvent"); }
597  }
598  return true;
599 }
static G4StateManager * GetStateManager()

Here is the call graph for this function:

void G4UImanager::ParseMacroSearchPath ( )

Definition at line 665 of file G4UImanager.cc.

666 {
667  searchDirs.clear();
668 
669  size_t idxfirst = 0;
670  size_t idxend = 0;
671  G4String pathstring = "";
672  while( (idxend = searchPath.index(':', idxfirst)) != G4String::npos) {
673  pathstring = searchPath.substr(idxfirst, idxend-idxfirst);
674  if(pathstring.size() != 0) searchDirs.push_back(pathstring);
675  idxfirst = idxend + 1;
676  }
677 
678  pathstring = searchPath.substr(idxfirst, searchPath.size()-idxfirst);
679  if(pathstring.size() != 0) searchDirs.push_back(pathstring);
680 }
str_size index(const char *, G4int pos=0) const

Here is the call graph for this function:

void G4UImanager::RegisterBridge ( G4UIbridge brg)

Definition at line 717 of file G4UImanager.cc.

718 {
719  if(brg->LocalUI()==this)
720  {
721  G4Exception("G4UImanager::RegisterBridge()","UI7002",FatalException,
722  "G4UIBridge cannot bridge between same object.");
723  }
724  else
725  { bridges->push_back(brg); }
726 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4UImanager * LocalUI() const
Definition: G4UIbridge.hh:72

Here is the call graph for this function:

Here is the caller graph for this function:

void G4UImanager::RemoveAlias ( const char *  aliasName)

Definition at line 644 of file G4UImanager.cc.

645 {
646  G4String aL = aliasName;
647  G4String targetAlias = aL.strip(G4String::both);
648  aliasList->RemoveAlias(targetAlias);
649 }
G4String strip(G4int strip_Type=trailing, char c=' ')
void RemoveAlias(const char *aliasName)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4UImanager::RemoveCommand ( G4UIcommand aCommand)

Definition at line 281 of file G4UImanager.cc.

282 {
283  treeTop->RemoveCommand( aCommand );
284  if(fMasterUImanager!=0&&G4Threading::G4GetThreadId()==0)
285  { fMasterUImanager->RemoveWorkerCommand(aCommand); }
286 }
void RemoveCommand(G4UIcommand *aCommand, G4bool workerThreadOnly=false)
G4int G4GetThreadId()
Definition: G4Threading.cc:144

Here is the call graph for this function:

Here is the caller graph for this function:

void G4UImanager::SetAlias ( const char *  aliasLine)

Definition at line 625 of file G4UImanager.cc.

626 {
627  G4String aLine = aliasLine;
628  G4int i = aLine.index(" ");
629  G4String aliasName = aLine(0,i);
630  G4String aliasValue = aLine(i+1,aLine.length()-(i+1));
631  if(aliasValue(0)=='"')
632  {
633  G4String strippedValue;
634  if(aliasValue(aliasValue.length()-1)=='"')
635  { strippedValue = aliasValue(1,aliasValue.length()-2); }
636  else
637  { strippedValue = aliasValue(1,aliasValue.length()-1); }
638  aliasValue = strippedValue;
639  }
640 
641  aliasList->ChangeAlias(aliasName,aliasValue);
642 }
int G4int
Definition: G4Types.hh:78
str_size index(const char *, G4int pos=0) const
void ChangeAlias(const char *aliasName, const char *aliasValue)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4UImanager::SetCerrFileName ( const G4String fileN = "G4cerr.txt",
G4bool  ifAppend = true 
)

Definition at line 761 of file G4UImanager.cc.

762 {
763  // for sequential mode, ignore this method.
764  if(threadID<0) return;
765 
766  if(fileN == "**Screen**")
767  { threadCout->SetCerrFileName(fileN,ifAppend); }
768  else
769  {
770  std::stringstream fn;
771  fn<<"G4W_"<<threadID<<"_"<<fileN;
772  threadCout->SetCerrFileName(fn.str(),ifAppend);
773  }
774 }
void SetCerrFileName(const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4UImanager::SetCoutDestination ( G4UIsession *const  value)

Definition at line 619 of file G4UImanager.cc.

620 {
621  G4coutbuf.SetDestination(value);
622  G4cerrbuf.SetDestination(value);
623 }
G4GLOB_DLL G4strstreambuf G4coutbuf
Definition: G4ios.cc:82
G4GLOB_DLL G4strstreambuf G4cerrbuf
Definition: G4ios.cc:83
void SetDestination(G4coutDestination *dest)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4UImanager::SetCoutFileName ( const G4String fileN = "G4cout.txt",
G4bool  ifAppend = true 
)

Definition at line 746 of file G4UImanager.cc.

747 {
748  // for sequential mode, ignore this method.
749  if(threadID<0) return;
750 
751  if(fileN == "**Screen**")
752  { threadCout->SetCoutFileName(fileN,ifAppend); }
753  else
754  {
755  std::stringstream fn;
756  fn<<"G4W_"<<threadID<<"_"<<fileN;
757  threadCout->SetCoutFileName(fn.str(),ifAppend);
758  }
759 }
void SetCoutFileName(const G4String &fileN="G4cout.txt", G4bool ifAppend=true)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4UImanager::SetG4UIWindow ( G4UIsession *const  value)
inline

Definition at line 215 of file G4UImanager.hh.

216  { g4UIWindow = value; }
const XML_Char int const XML_Char * value
Definition: expat.h:331
void G4UImanager::SetIgnoreCmdNotFound ( G4bool  val)
inline

Definition at line 269 of file G4UImanager.hh.

270  { ignoreCmdNotFound = val; }

Here is the caller graph for this function:

void G4UImanager::SetMacroSearchPath ( const G4String path)
inline

Definition at line 243 of file G4UImanager.hh.

244  { searchPath = path; }
void G4UImanager::SetMasterUIManager ( G4bool  val)
inline

Definition at line 258 of file G4UImanager.hh.

259  {
260  isMaster = val;
261  //ignoreCmdNotFound = val;
262  stackCommandsForBroadcast = val;
263  if(val&&!bridges)
264  {
265  bridges = new std::vector<G4UIbridge*>;
266  fMasterUImanager = this;
267  }
268  }

Here is the caller graph for this function:

void G4UImanager::SetMaxHistSize ( G4int  mx)
inline

Definition at line 238 of file G4UImanager.hh.

239  { maxHistSize = mx; }

Here is the caller graph for this function:

void G4UImanager::SetPauseAtBeginOfEvent ( G4bool  vl)
inline

Definition at line 192 of file G4UImanager.hh.

193  { pauseAtBeginOfEvent = vl; }

Here is the caller graph for this function:

void G4UImanager::SetPauseAtEndOfEvent ( G4bool  vl)
inline

Definition at line 196 of file G4UImanager.hh.

197  { pauseAtEndOfEvent = vl; }

Here is the caller graph for this function:

void G4UImanager::SetSession ( G4UIsession *const  value)
inline

Definition at line 213 of file G4UImanager.hh.

214  { session = value; }
const XML_Char int const XML_Char * value
Definition: expat.h:331

Here is the caller graph for this function:

void G4UImanager::SetThreadIgnore ( G4int  tid = 0)

Definition at line 790 of file G4UImanager.cc.

791 {
792  // for sequential mode, ignore this method.
793  if(threadID<0)
794  {
795  igThreadID = tid;
796  return;
797  }
798  threadCout->SetIgnoreCout(tid);
799 }
void SetIgnoreCout(G4int tid=0)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4UImanager::SetThreadIgnoreInit ( G4bool  flg = true)

Definition at line 801 of file G4UImanager.cc.

802 {
803  // for sequential mode, ignore this method.
804  if(threadID<0) { return; }
805  threadCout->SetIgnoreInit(flg);
806 }
void SetIgnoreInit(G4bool val=true)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4UImanager::SetThreadPrefixString ( const G4String s = "W")

Definition at line 776 of file G4UImanager.cc.

777 {
778  // for sequential mode, ignore this method.
779  if(threadID<0) return;
780  threadCout->SetPrefixString(s);
781 }
void SetPrefixString(const G4String &wd="G4WT")

Here is the call graph for this function:

Here is the caller graph for this function:

void G4UImanager::SetThreadUseBuffer ( G4bool  flg = true)

Definition at line 783 of file G4UImanager.cc.

784 {
785  // for sequential mode, ignore this method.
786  if(threadID<0) return;
787  threadCout->EnableBuffering(flg);
788 }
void EnableBuffering(G4bool flag=true)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4UImanager::SetUpForAThread ( G4int  tId)

Definition at line 728 of file G4UImanager.cc.

729 {
730  threadID = tId;
732  threadCout = new G4MTcoutDestination(threadID);
733  threadCout->SetIgnoreCout(igThreadID);
734 }
void SetIgnoreCout(G4int tid=0)
void G4iosInitialization()
Definition: G4ios.cc:85

Here is the call graph for this function:

Here is the caller graph for this function:

void G4UImanager::SetUpForSpecialThread ( G4String  aPrefix)

Definition at line 736 of file G4UImanager.cc.

737 {
739  G4Threading::G4SetThreadId(threadID);
741  threadCout = new G4MTcoutDestination(threadID);
742  threadCout->SetPrefixString(pref);
743  threadCout->SetIgnoreCout(igThreadID);
744 }
void G4SetThreadId(G4int aNewValue)
Definition: G4Threading.cc:147
void SetPrefixString(const G4String &wd="G4WT")
void SetIgnoreCout(G4int tid=0)
void G4iosInitialization()
Definition: G4ios.cc:85

Here is the call graph for this function:

void G4UImanager::SetVerboseLevel ( G4int  val)
inline

Definition at line 225 of file G4UImanager.hh.

226  { verboseLevel = val; }

Here is the caller graph for this function:

G4String G4UImanager::SolveAlias ( const char *  aCmd)

Definition at line 392 of file G4UImanager.cc.

393 {
394  G4String aCommand = aCmd;
395  G4int ia = aCommand.index("{");
396  G4int iz = aCommand.index("#");
397  while((ia != G4int(std::string::npos))&&((iz==G4int(std::string::npos))||(ia<iz)))
398  {
399  G4int ibx = -1;
400  while(ibx<0)
401  {
402  G4int ib = aCommand.index("}");
403  if( ib == G4int(std::string::npos) )
404  {
405  G4cerr << aCommand << G4endl;
406  for(G4int i=0;i<ia;i++) G4cerr << " ";
407  G4cerr << "^" << G4endl;
408  G4cerr << "Unmatched alias parenthis -- command ignored" << G4endl;
409  G4String nullStr;
410  return nullStr;
411  }
412  G4String ps = aCommand(ia+1,aCommand.length()-(ia+1));
413  G4int ic = ps.index("{");
414  G4int id = ps.index("}");
415  if(ic!=G4int(std::string::npos) && ic < id)
416  { ia+=ic+1; }
417  else
418  { ibx = ib; }
419  }
420  //--- Here ia represents the position of innermost "{"
421  //--- and ibx represents corresponding "}"
422  G4String subs;
423  if(ia>0) subs = aCommand(0,ia);
424  G4String alis = aCommand(ia+1,ibx-ia-1);
425  G4String rems = aCommand(ibx+1,aCommand.length()-ibx);
426  // G4cout << "<" << subs << "> <" << alis << "> <" << rems << ">" << G4endl;
427  G4String* alVal = aliasList->FindAlias(alis);
428  if(!alVal)
429  {
430  G4cerr << "Alias <" << alis << "> not found -- command ignored" << G4endl;
431  G4String nullStr;
432  return nullStr;
433  }
434  aCommand = subs+(*alVal)+rems;
435  ia = aCommand.index("{");
436  }
437  return aCommand;
438 }
int G4int
Definition: G4Types.hh:78
str_size index(const char *, G4int pos=0) const
G4String * FindAlias(const char *aliasName)
#define G4endl
Definition: G4ios.hh:61
static constexpr double ps
Definition: G4SIunits.hh:172
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

Here is the caller graph for this function:

void G4UImanager::StoreHistory ( const char *  fileName = "G4history.macro")

Definition at line 527 of file G4UImanager.cc.

528 { StoreHistory(true,fileName); }
void StoreHistory(const char *fileName="G4history.macro")
Definition: G4UImanager.cc:527

Here is the caller graph for this function:

void G4UImanager::StoreHistory ( G4bool  historySwitch,
const char *  fileName = "G4history.macro" 
)

Definition at line 530 of file G4UImanager.cc.

531 {
532  if(historySwitch)
533  {
534  if(saveHistory)
535  { historyFile.close(); }
536  historyFile.open((char*)fileName);
537  saveHistory = true;
538  }
539  else
540  {
541  historyFile.close();
542  saveHistory = false;
543  }
544  saveHistory = historySwitch;
545 }
static void G4UImanager::UseDoublePrecisionStr ( G4bool  val)
inlinestatic

Definition at line 300 of file G4UImanager.hh.

300 { doublePrecisionStr = val; }

Here is the caller graph for this function:


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