Geant4  10.01
G4UImanager.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4UImanager.cc 85249 2014-10-27 08:28:57Z gcosmo $
28 //
29 //
30 // ---------------------------------------------------------------------
31 
32 #include "G4UImanager.hh"
33 #include "G4UIcommandTree.hh"
34 #include "G4UIcommand.hh"
35 #include "G4UIsession.hh"
36 #include "G4UIbatch.hh"
37 #include "G4UIcontrolMessenger.hh"
38 #include "G4UnitsMessenger.hh"
40 #include "G4ios.hh"
41 #include "G4strstreambuf.hh"
42 #include "G4StateManager.hh"
43 #include "G4UIaliasList.hh"
44 #include "G4Tokenizer.hh"
45 #include "G4MTcoutDestination.hh"
46 #include "G4UIbridge.hh"
47 #include "G4Threading.hh"
48 
49 #include <sstream>
50 #include <fstream>
51 
55 
57 
59 {
60  if(!fUImanager)
61  {
63  {
64  fUImanager = new G4UImanager;
66  }
67  }
68  return fUImanager;
69 }
70 
72 { return fMasterUImanager; }
73 
75  : G4VStateDependent(true),
76  UImessenger(0), UnitsMessenger(0), CoutMessenger(0),
77  isMaster(false),bridges(0),
78  ignoreCmdNotFound(false), stackCommandsForBroadcast(false),
79  threadID(-1), threadCout(0)
80 {
81  savedCommand = 0;
82  treeTop = new G4UIcommandTree("/");
84  G4String nullString;
85  savedParameters = nullString;
86  verboseLevel = 0;
87  saveHistory = false;
88  session = NULL;
89  g4UIWindow = NULL;
91  pauseAtBeginOfEvent = false;
92  pauseAtEndOfEvent = false;
93  maxHistSize = 20;
94  searchPath="";
95  commandStack = new std::vector<G4String>;
96 }
97 
99 {
103 }
104 
106 {
107  if(bridges)
108  {
109  std::vector<G4UIbridge*>::iterator itr = bridges->begin();
110  for(;itr!=bridges->end();itr++)
111  { delete *itr; }
112  delete bridges;
113  }
114  SetCoutDestination(NULL);
115  histVec.clear();
116  if(saveHistory) historyFile.close();
117  delete CoutMessenger;
118  delete UnitsMessenger;
119  delete UImessenger;
120  delete treeTop;
121  delete aliasList;
123  fUImanager = NULL;
124  if(commandStack)
125  {
126  commandStack->clear();
127  delete commandStack;
128  }
129  if(threadID >= 0)
130  {
131  if(threadCout) delete threadCout;
133  threadID = -1;
134  }
135 }
136 
138  : G4VStateDependent(true)
139 {
142  aliasList = ui.aliasList;
143  g4UIWindow = ui.g4UIWindow;
145  session = ui.session;
146  treeTop = ui.treeTop;
147 }
148 
150 { return right; }
152 { return (this==&right); }
154 { return (this!=&right); }
155 
157 {
158  G4String theCommand = aCommand;
159  savedCommand = treeTop->FindPath( theCommand );
160  if( savedCommand == NULL )
161  {
162  G4cerr << "command not found" << G4endl;
163  return G4String();
164  }
165  return savedCommand->GetCurrentValue();
166 }
167 
169 G4int parameterNumber, G4bool reGet)
170 {
171  if(reGet || savedCommand == NULL)
172  {
173  savedParameters = GetCurrentValues( aCommand );
174  }
175  G4Tokenizer savedToken( savedParameters );
176  G4String token;
177  for(G4int i_thParameter=0;i_thParameter<parameterNumber;i_thParameter++)
178  {
179  token = savedToken();
180  if( token.isNull() ) return G4String();
181  if( token[(size_t)0] == '"' )
182  {
183  token.append(" ");
184  token.append(savedToken("\""));
185  }
186  }
187  return token;
188 }
189 
191 const char * aParameterName, G4bool reGet)
192 {
193  if(reGet || savedCommand == NULL)
194  {
195  G4String parameterValues = GetCurrentValues( aCommand );
196  }
197  for(G4int i=0;i<savedCommand->GetParameterEntries();i++)
198  {
199  if( aParameterName ==
201  return GetCurrentStringValue(aCommand,i+1,false);
202  }
203  return G4String();
204 }
205 
207 const char * aParameterName, G4bool reGet)
208 {
209  G4String targetParameter =
210  GetCurrentStringValue( aCommand, aParameterName, reGet );
211  G4int value;
212  const char* t = targetParameter;
213  std::istringstream is(t);
214  is >> value;
215  return value;
216 }
217 
219 G4int parameterNumber, G4bool reGet)
220 {
221  G4String targetParameter =
222  GetCurrentStringValue( aCommand, parameterNumber, reGet );
223  G4int value;
224  const char* t = targetParameter;
225  std::istringstream is(t);
226  is >> value;
227  return value;
228 }
229 
231 const char * aParameterName, G4bool reGet)
232 {
233  G4String targetParameter =
234  GetCurrentStringValue( aCommand, aParameterName, reGet );
235  G4double value;
236  const char* t = targetParameter;
237  std::istringstream is(t);
238  is >> value;
239  return value;
240 }
241 
243 G4int parameterNumber, G4bool reGet)
244 {
245  G4String targetParameter =
246  GetCurrentStringValue( aCommand, parameterNumber, reGet );
247  G4double value;
248  const char* t = targetParameter;
249  std::istringstream is(t);
250  is >> value;
251  return value;
252 }
253 
255 {
256  treeTop->AddNewCommand( newCommand );
258  { fMasterUImanager->AddWorkerCommand(newCommand); }
259 }
260 
262 {
263  treeTop->AddNewCommand( newCommand, true );
264 }
265 
267 {
268  treeTop->RemoveCommand( aCommand );
270  { fMasterUImanager->RemoveWorkerCommand(aCommand); }
271 }
272 
274 {
275  treeTop->RemoveCommand( aCommand, true );
276 }
277 
278 void G4UImanager::ExecuteMacroFile(const char * fileName)
279 {
280  G4UIsession* batchSession = new G4UIbatch(fileName,session);
281  session = batchSession;
282  G4UIsession* previousSession = session->SessionStart();
283  delete session;
284  session = previousSession;
285 }
286 
287 void G4UImanager::LoopS(const char* valueList)
288 {
289  G4String vl = valueList;
290  G4Tokenizer parameterToken(vl);
291  G4String mf = parameterToken();
292  G4String vn = parameterToken();
293  G4String c1 = parameterToken();
294  c1 += " ";
295  c1 += parameterToken();
296  c1 += " ";
297  c1 += parameterToken();
298  const char* t1 = c1;
299  std::istringstream is(t1);
300  G4double d1;
301  G4double d2;
302  G4double d3;
303  is >> d1 >> d2 >> d3;
304  Loop(mf,vn,d1,d2,d3);
305 }
306 
307 void G4UImanager::Loop(const char * macroFile,const char * variableName,
308  G4double initialValue,G4double finalValue,G4double stepSize)
309 {
310  G4String cd;
311  if (stepSize > 0) {
312  for(G4double d=initialValue;d<=finalValue;d+=stepSize)
313  {
314  std::ostringstream os;
315  os << d;
316  cd += os.str();
317  cd += " ";
318  }
319  } else {
320  for(G4double d=initialValue;d>=finalValue;d+=stepSize)
321  {
322  std::ostringstream os;
323  os << d;
324  cd += os.str();
325  cd += " ";
326  }
327  }
328  Foreach(macroFile,variableName,cd);
329 }
330 
331 void G4UImanager::ForeachS(const char* valueList)
332 {
333  G4String vl = valueList;
334  G4Tokenizer parameterToken(vl);
335  G4String mf = parameterToken();
336  G4String vn = parameterToken();
337  G4String c1 = parameterToken();
338  G4String ca;
339  while(!((ca=parameterToken()).isNull()))
340  {
341  c1 += " ";
342  c1 += ca;
343  }
344 
345  G4String aliasValue = c1;
346  if(aliasValue(0)=='"')
347  {
348  G4String strippedValue;
349  if(aliasValue(aliasValue.length()-1)=='"')
350  { strippedValue = aliasValue(1,aliasValue.length()-2); }
351  else
352  { strippedValue = aliasValue(1,aliasValue.length()-1); }
353  aliasValue = strippedValue;
354  }
355 
356 // Foreach(mf,vn,c1);
357  Foreach(mf,vn,aliasValue);
358 }
359 
360 void G4UImanager::Foreach(const char * macroFile,const char * variableName,
361  const char * candidates)
362 {
363  G4String candidatesString = candidates;
364  G4Tokenizer parameterToken( candidatesString );
365  G4String cd;
366  while(!((cd=parameterToken()).isNull()))
367  {
368  G4String vl = variableName;
369  vl += " ";
370  vl += cd;
371  SetAlias(vl);
372  ExecuteMacroFile(FindMacroPath(macroFile));
373  }
374 }
375 
376 
378 {
379  G4String aCommand = aCmd;
380  G4int ia = aCommand.index("{");
381  G4int iz = aCommand.index("#");
382  while((ia != G4int(std::string::npos))&&((iz==G4int(std::string::npos))||(ia<iz)))
383  {
384  G4int ibx = -1;
385  while(ibx<0)
386  {
387  G4int ib = aCommand.index("}");
388  if( ib == G4int(std::string::npos) )
389  {
390  G4cerr << aCommand << G4endl;
391  for(G4int i=0;i<ia;i++) G4cerr << " ";
392  G4cerr << "^" << G4endl;
393  G4cerr << "Unmatched alias parenthis -- command ignored" << G4endl;
394  G4String nullStr;
395  return nullStr;
396  }
397  G4String ps = aCommand(ia+1,aCommand.length()-(ia+1));
398  G4int ic = ps.index("{");
399  G4int id = ps.index("}");
400  if(ic!=G4int(std::string::npos) && ic < id)
401  { ia+=ic+1; }
402  else
403  { ibx = ib; }
404  }
405  //--- Here ia represents the position of innermost "{"
406  //--- and ibx represents corresponding "}"
407  G4String subs;
408  if(ia>0) subs = aCommand(0,ia);
409  G4String alis = aCommand(ia+1,ibx-ia-1);
410  G4String rems = aCommand(ibx+1,aCommand.length()-ibx);
411  // G4cout << "<" << subs << "> <" << alis << "> <" << rems << ">" << G4endl;
412  G4String* alVal = aliasList->FindAlias(alis);
413  if(!alVal)
414  {
415  G4cerr << "Alias <" << alis << "> not found -- command ignored" << G4endl;
416  G4String nullStr;
417  return nullStr;
418  }
419  aCommand = subs+(*alVal)+rems;
420  ia = aCommand.index("{");
421  }
422  return aCommand;
423 }
424 
426 {
427  return ApplyCommand(aCmd.data());
428 }
429 
430 #include "G4Threading.hh"
431 
433 {
434  G4String aCommand = SolveAlias(aCmd);
435  if(aCommand.isNull()) return fAliasNotFound;
436  if(verboseLevel) G4cout << aCommand << G4endl;
437  G4String commandString;
438  G4String commandParameter;
439 
440  G4int i = aCommand.index(" ");
441  if( i != G4int(std::string::npos) )
442  {
443  commandString = aCommand(0,i);
444  commandParameter = aCommand(i+1,aCommand.length()-(i+1));
445  }
446  else
447  {
448  commandString = aCommand;
449  }
450 
451  // remove doubled slash
452  G4int len = commandString.length();
453  G4int ll = 0;
454  G4String a1;
455  G4String a2;
456  while(ll<len-1)
457  {
458  if(commandString(ll,2)=="//")
459  {
460  if(ll==0)
461  { commandString.remove(ll,1); }
462  else
463  {
464  a1 = commandString(0,ll);
465  a2 = commandString(ll+1,len-ll-1);
466  commandString = a1+a2;
467  }
468  len--;
469  }
470  else
471  { ll++; }
472  }
473 
474  if(isMaster&&bridges)
475  {
476  std::vector<G4UIbridge*>::iterator itr = bridges->begin();
477  for(;itr!=bridges->end();itr++)
478  {
479  G4int leng = (*itr)->DirLength();
480  if(commandString(0,leng)==(*itr)->DirName())
481  { return (*itr)->LocalUI()->ApplyCommand(commandString+" "+commandParameter); }
482  }
483  }
484 
485  G4UIcommand * targetCommand = treeTop->FindPath( commandString );
486  if( targetCommand == NULL )
487  {
489  {
491  { commandStack->push_back(commandString+" "+commandParameter); }
492  return fCommandSucceeded;
493  }
494  else
495  { return fCommandNotFound; }
496  }
497 
498  if(stackCommandsForBroadcast && targetCommand->ToBeBroadcasted())
499  { commandStack->push_back(commandString+" "+commandParameter); }
500 
501  if(!(targetCommand->IsAvailable()))
502  { return fIllegalApplicationState; }
503 
504  if(saveHistory) historyFile << aCommand << G4endl;
505  if( G4int(histVec.size()) >= maxHistSize )
506  { histVec.erase(histVec.begin()); }
507  histVec.push_back(aCommand);
508 
509  return targetCommand->DoIt( commandParameter );
510 }
511 
512 void G4UImanager::StoreHistory(const char* fileName)
513 { StoreHistory(true,fileName); }
514 
515 void G4UImanager::StoreHistory(G4bool historySwitch,const char* fileName)
516 {
517  if(historySwitch)
518  {
519  if(saveHistory)
520  { historyFile.close(); }
521  historyFile.open((char*)fileName);
522  saveHistory = true;
523  }
524  else
525  {
526  historyFile.close();
527  saveHistory = false;
528  }
529  saveHistory = historySwitch;
530 }
531 
532 void G4UImanager::PauseSession(const char* msg)
533 {
535 }
536 
537 void G4UImanager::ListCommands(const char* direct)
538 {
539  G4UIcommandTree* comTree = FindDirectory(direct);
540  if(comTree)
541  { comTree->List(); }
542  else
543  { G4cout << direct << " is not found." << G4endl; }
544 }
545 
547 {
548  G4String aDirName = dirName;
549  G4String targetDir = aDirName.strip(G4String::both);
550  if( targetDir( targetDir.length()-1 ) != '/' )
551  { targetDir += "/"; }
552  G4UIcommandTree* comTree = treeTop;
553  if( targetDir == "/" )
554  { return comTree; }
555  G4int idx = 1;
556  while( idx < G4int(targetDir.length())-1 )
557  {
558  G4int i = targetDir.index("/",idx);
559  G4String targetDirString = targetDir(0,i+1);
560  comTree = comTree->GetTree(targetDirString);
561  if( comTree == NULL )
562  { return NULL; }
563  idx = i+1;
564  }
565  return comTree;
566 }
567 
569 {
570  //G4cout << G4StateManager::GetStateManager()->GetStateString(requestedState) << " <--- " << G4StateManager::GetStateManager()->GetStateString(G4StateManager::GetStateManager()->GetPreviousState()) << G4endl;
572  {
573  if(requestedState==G4State_EventProc &&
575  { PauseSession("BeginOfEvent"); }
576  }
578  {
579  if(requestedState==G4State_GeomClosed &&
580  G4StateManager::GetStateManager()->GetPreviousState()==G4State_EventProc)
581  { PauseSession("EndOfEvent"); }
582  }
583  return true;
584 }
585 
586 //void G4UImanager::Interact()
587 //{
588 // Interact(G4String("G4> "));
589 //}
590 
591 //void G4UImanager::Interact(const char * pC)
592 //{
593 // G4cerr << "G4UImanager::Interact() is out of date and is not used anymore." << G4endl;
594 // G4cerr << "This method will be removed shortly!!!" << G4endl;
595 // G4cerr << "In case of main() use" << G4endl;
596 // G4cerr << " G4UIsession * session = new G4UIterminal;" << G4endl;
597 // G4cerr << " session->SessionStart();" << G4endl;
598 // G4cerr << "In other cases use" << G4endl;
599 // G4cerr << " G4StateManager::GetStateManager()->Pause();" << G4endl;
600 //}
601 
602 
603 
605 {
606  G4coutbuf.SetDestination(value);
607  G4cerrbuf.SetDestination(value);
608 }
609 
610 void G4UImanager::SetAlias(const char * aliasLine)
611 {
612  G4String aLine = aliasLine;
613  G4int i = aLine.index(" ");
614  G4String aliasName = aLine(0,i);
615  G4String aliasValue = aLine(i+1,aLine.length()-(i+1));
616  if(aliasValue(0)=='"')
617  {
618  G4String strippedValue;
619  if(aliasValue(aliasValue.length()-1)=='"')
620  { strippedValue = aliasValue(1,aliasValue.length()-2); }
621  else
622  { strippedValue = aliasValue(1,aliasValue.length()-1); }
623  aliasValue = strippedValue;
624  }
625 
626  aliasList->ChangeAlias(aliasName,aliasValue);
627 }
628 
629 void G4UImanager::RemoveAlias(const char * aliasName)
630 {
631  G4String aL = aliasName;
632  G4String targetAlias = aL.strip(G4String::both);
633  aliasList->RemoveAlias(targetAlias);
634 }
635 
637 {
638  aliasList->List();
639 }
640 
641 void G4UImanager::CreateHTML(const char* dir)
642 {
643  G4UIcommandTree* tr = FindDirectory(dir);
644  if(tr!=0)
645  { tr->CreateHTML(); }
646  else
647  { G4cerr << "Directory <" << dir << "> is not found." << G4endl; }
648 }
649 
651 {
652  searchDirs.clear();
653 
654  size_t idxfirst = 0;
655  size_t idxend = 0;
656  G4String pathstring = "";
657  while( (idxend = searchPath.index(':', idxfirst)) != G4String::npos) {
658  pathstring = searchPath.substr(idxfirst, idxend-idxfirst);
659  if(pathstring.size() != 0) searchDirs.push_back(pathstring);
660  idxfirst = idxend + 1;
661  }
662 
663  pathstring = searchPath.substr(idxfirst, searchPath.size()-idxfirst);
664  if(pathstring.size() != 0) searchDirs.push_back(pathstring);
665 }
666 
667 
668 static G4bool FileFound(const G4String& fname)
669 {
670  G4bool qopen = false;
671  std::ifstream fs;
672  fs.open(fname.c_str(), std::ios::in);
673  if(fs.good()) {
674  fs.close();
675  qopen = true;
676  }
677  return qopen;
678 }
679 
681 {
682  G4String macrofile = fname;
683 
684  for (size_t i = 0; i < searchDirs.size(); i++) {
685  G4String fullpath = searchDirs[i] + "/" + fname;
686  if ( FileFound(fullpath) ) {
687  macrofile = fullpath;
688  break;
689  }
690  }
691 
692  return macrofile;
693 }
694 
695 std::vector<G4String>* G4UImanager::GetCommandStack()
696 {
697  std::vector<G4String>* returnValue = commandStack;
698  commandStack = new std::vector<G4String>;
699  return returnValue;
700 }
701 
703 {
704  if(brg->LocalUI()==this)
705  {
706  G4Exception("G4UImanager::RegisterBridge()","UI7002",FatalException,
707  "G4UIBridge cannot bridge between same object.");
708  }
709  else
710  { bridges->push_back(brg); }
711 }
712 
714 {
715  threadID = tId;
719 }
720 
722 {
729 }
730 
731 void G4UImanager::SetCoutFileName(const G4String& fileN, G4bool ifAppend)
732 {
733  // for sequential mode, ignore this method.
734  if(threadID<0) return;
735 
736  if(fileN == "**Screen**")
737  { threadCout->SetCoutFileName(fileN,ifAppend); }
738  else
739  {
740  std::stringstream fn;
741  fn<<"G4W_"<<threadID<<"_"<<fileN;
742  threadCout->SetCoutFileName(fn.str(),ifAppend);
743  }
744 }
745 
746 void G4UImanager::SetCerrFileName(const G4String& fileN, G4bool ifAppend)
747 {
748  // for sequential mode, ignore this method.
749  if(threadID<0) return;
750 
751  if(fileN == "**Screen**")
752  { threadCout->SetCerrFileName(fileN,ifAppend); }
753  else
754  {
755  std::stringstream fn;
756  fn<<"G4W_"<<threadID<<"_"<<fileN;
757  threadCout->SetCerrFileName(fn.str(),ifAppend);
758  }
759 }
760 
762 {
763  // for sequential mode, ignore this method.
764  if(threadID<0) return;
766 }
767 
769 {
770  // for sequential mode, ignore this method.
771  if(threadID<0) return;
773 }
774 
776 {
777  // for sequential mode, ignore this method.
778  if(threadID<0)
779  {
780  igThreadID = tid;
781  return;
782  }
784 }
785 
787 {
788  // for sequential mode, ignore this method.
789  if(threadID<0) { return; }
791 }
792 
static const G4double d3
void ForeachS(const char *valueList)
Definition: G4UImanager.cc:331
void ExecuteMacroFile(const char *fileName)
Definition: G4UImanager.cc:278
static G4int igThreadID
Definition: G4UImanager.hh:285
void Foreach(const char *macroFile, const char *variableName, const char *candidates)
Definition: G4UImanager.cc:360
void RemoveAlias(const char *aliasName)
Definition: G4UImanager.cc:629
G4int operator==(const G4UImanager &right) const
Definition: G4UImanager.cc:151
static G4ThreadLocal G4UImanager * fUImanager
Definition: G4UImanager.hh:148
void SetThreadPrefixString(const G4String &s="W")
Definition: G4UImanager.cc:761
static const G4double d1
void SetAlias(const char *aliasLine)
Definition: G4UImanager.cc:610
G4bool IsAvailable()
Definition: G4UIcommand.cc:289
G4UIcommand * savedCommand
Definition: G4UImanager.hh:158
void SetUpForAThread(G4int tId)
Definition: G4UImanager.cc:713
G4bool isMaster
Definition: G4UImanager.hh:251
G4LocalThreadCoutMessenger * CoutMessenger
Definition: G4UImanager.hh:156
virtual void PauseSessionStart(const G4String &Prompt)
Definition: G4UIsession.cc:40
G4String GetCurrentStringValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
Definition: G4UImanager.cc:168
void SetCoutFileName(const G4String &fileN="G4cout.txt", G4bool ifAppend=true)
Definition: G4UImanager.cc:731
void SetCerrFileName(const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)
static G4UImanager * GetMasterUIpointer()
Definition: G4UImanager.cc:71
G4String & remove(str_size)
void RegisterBridge(G4UIbridge *brg)
Definition: G4UImanager.cc:702
G4int verboseLevel
Definition: G4UImanager.hh:159
G4UIcontrolMessenger * UImessenger
Definition: G4UImanager.hh:154
void CreateMessenger()
Definition: G4UImanager.cc:98
G4UIcommand * FindPath(const char *commandPath) const
G4String savedParameters
Definition: G4UImanager.hh:157
G4String strip(G4int strip_Type=trailing, char c=' ')
G4UIcommandTree * treeTop
Definition: G4UImanager.hh:151
static const G4double a1
G4String GetParameterName() const
void G4SetThreadId(G4int aNewValue)
Definition: G4Threading.cc:129
static G4bool FileFound(const G4String &fname)
Definition: G4UImanager.cc:668
std::ofstream historyFile
Definition: G4UImanager.hh:160
static G4UImanager * fMasterUImanager
Definition: G4UImanager.hh:150
static const G4double cd
void SetThreadUseBuffer(G4bool flg=true)
Definition: G4UImanager.cc:768
virtual G4UIsession * SessionStart()
Definition: G4UIsession.cc:38
G4int maxHistSize
Definition: G4UImanager.hh:164
G4bool stackCommandsForBroadcast
Definition: G4UImanager.hh:254
#define G4ThreadLocal
Definition: tls.hh:84
void RemoveWorkerCommand(G4UIcommand *aCommand)
Definition: G4UImanager.cc:273
int G4int
Definition: G4Types.hh:78
std::vector< G4String > * GetCommandStack()
Definition: G4UImanager.cc:695
G4bool saveHistory
Definition: G4UImanager.hh:161
void SetCerrFileName(const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)
Definition: G4UImanager.cc:746
void SetPrefixString(const G4String &wd="G4WT")
void SetCoutFileName(const G4String &fileN="G4cout.txt", G4bool ifAppend=true)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void SetIgnoreInit(G4bool val=true)
void ParseMacroSearchPath()
Definition: G4UImanager.cc:650
static const double s
Definition: G4SIunits.hh:150
static G4StateManager * GetStateManager()
std::vector< G4String > searchDirs
Definition: G4UImanager.hh:168
void SetThreadIgnoreInit(G4bool flg=true)
Definition: G4UImanager.cc:786
G4UIaliasList * aliasList
Definition: G4UImanager.hh:163
G4bool ToBeBroadcasted() const
Definition: G4UIcommand.hh:186
G4GLOB_DLL std::ostream G4cout
str_size index(const char *, G4int pos=0) const
G4UIcommandTree * GetTree(G4int i)
void ChangeAlias(const char *aliasName, const char *aliasValue)
G4strstreambuf G4coutbuf
Definition: G4ios.cc:82
void Loop(const char *macroFile, const char *variableName, G4double initialValue, G4double finalValue, G4double stepSize=1.0)
Definition: G4UImanager.cc:307
bool G4bool
Definition: G4Types.hh:79
G4MTcoutDestination * threadCout
Definition: G4UImanager.hh:284
G4double iz
Definition: TRTMaterials.hh:39
G4UIparameter * GetParameter(G4int i) const
Definition: G4UIcommand.hh:145
std::vector< G4UIbridge * > * bridges
Definition: G4UImanager.hh:252
void EnableBuffering(G4bool flag=true)
void RemoveCommand(G4UIcommand *aCommand)
Definition: G4UImanager.cc:266
void RemoveCommand(G4UIcommand *aCommand, G4bool workerThreadOnly=false)
static const G4double c1
G4UIsession * g4UIWindow
Definition: G4UImanager.hh:153
G4int GetCurrentIntValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
Definition: G4UImanager.cc:218
G4UnitsMessenger * UnitsMessenger
Definition: G4UImanager.hh:155
G4String * FindAlias(const char *aliasName)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void SetIgnoreCout(G4int tid=0)
G4String GetCurrentValues(const char *aCommand)
Definition: G4UImanager.cc:156
const char * data() const
void ListCommands(const char *direc)
Definition: G4UImanager.cc:537
void PauseSession(const char *msg)
Definition: G4UImanager.cc:532
std::vector< G4String > histVec
Definition: G4UImanager.hh:162
G4int threadID
Definition: G4UImanager.hh:283
G4bool pauseAtEndOfEvent
Definition: G4UImanager.hh:166
void SetDestination(G4coutDestination *dest)
G4bool ignoreCmdNotFound
Definition: G4UImanager.hh:253
void AddNewCommand(G4UIcommand *newCommand, G4bool workerThreadOnly=false)
std::vector< G4String > * commandStack
Definition: G4UImanager.hh:255
void AddNewCommand(G4UIcommand *newCommand)
Definition: G4UImanager.cc:254
G4String & append(const G4String &)
G4String searchPath
Definition: G4UImanager.hh:167
void SetCoutDestination(G4UIsession *const value)
Definition: G4UImanager.cc:604
void G4iosInitialization()
Definition: G4ios.cc:85
G4String SolveAlias(const char *aCmd)
Definition: G4UImanager.cc:377
G4UIsession * session
Definition: G4UImanager.hh:152
void ListAlias()
Definition: G4UImanager.cc:636
static G4ThreadLocal G4bool fUImanagerHasBeenKilled
Definition: G4UImanager.hh:149
#define G4endl
Definition: G4ios.hh:61
void LoopS(const char *valueList)
Definition: G4UImanager.cc:287
const G4UImanager & operator=(const G4UImanager &right)
Definition: G4UImanager.cc:149
virtual G4bool Notify(G4ApplicationState requestedState)
Definition: G4UImanager.cc:568
void AddWorkerCommand(G4UIcommand *newCommand)
Definition: G4UImanager.cc:261
G4double GetCurrentDoubleValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
Definition: G4UImanager.cc:242
G4UImanager * LocalUI() const
Definition: G4UIbridge.hh:72
void G4iosFinalization()
Definition: G4ios.cc:86
double G4double
Definition: G4Types.hh:76
void SetUpForSpecialThread(G4String aPrefix)
Definition: G4UImanager.cc:721
void SetThreadIgnore(G4int tid=0)
Definition: G4UImanager.cc:775
void CreateHTML(const char *dir="/")
Definition: G4UImanager.cc:641
G4strstreambuf G4cerrbuf
Definition: G4ios.cc:83
static const G4double d2
void StoreHistory(const char *fileName="G4history.macro")
Definition: G4UImanager.cc:512
G4int GetParameterEntries() const
Definition: G4UIcommand.hh:143
G4String FindMacroPath(const G4String &fname) const
Definition: G4UImanager.cc:680
G4bool pauseAtBeginOfEvent
Definition: G4UImanager.hh:165
G4bool isNull() const
virtual G4int DoIt(G4String parameterList)
Definition: G4UIcommand.cc:122
G4ApplicationState
static const G4double a2
G4int G4GetThreadId()
Definition: G4Threading.cc:127
G4UIcommandTree * FindDirectory(const char *dirName)
Definition: G4UImanager.cc:546
void List() const
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:432
G4String GetCurrentValue()
Definition: G4UIcommand.cc:234
G4GLOB_DLL std::ostream G4cerr
G4int operator!=(const G4UImanager &right) const
Definition: G4UImanager.cc:153
void RemoveAlias(const char *aliasName)