Geant4  10.02.p02
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 94366 2015-11-13 08:15:49Z 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;
149  CoutMessenger = 0;
153  isMaster = ui.isMaster;
154  bridges = ui.bridges;
158  threadID = ui.threadID;
159  threadCout = ui.threadCout;
160  CreateMessenger();
161 }
162 
164 { return right; }
166 { return (this==&right); }
168 { return (this!=&right); }
169 
171 {
172  G4String theCommand = aCommand;
173  savedCommand = treeTop->FindPath( theCommand );
174  if( savedCommand == NULL )
175  {
176  G4cerr << "command not found" << G4endl;
177  return G4String();
178  }
179  return savedCommand->GetCurrentValue();
180 }
181 
183 G4int parameterNumber, G4bool reGet)
184 {
185  if(reGet || savedCommand == NULL)
186  {
187  savedParameters = GetCurrentValues( aCommand );
188  }
189  G4Tokenizer savedToken( savedParameters );
190  G4String token;
191  for(G4int i_thParameter=0;i_thParameter<parameterNumber;i_thParameter++)
192  {
193  token = savedToken();
194  if( token.isNull() ) return G4String();
195  if( token[(size_t)0] == '"' )
196  {
197  token.append(" ");
198  token.append(savedToken("\""));
199  }
200  }
201  return token;
202 }
203 
205 const char * aParameterName, G4bool reGet)
206 {
207  if(reGet || savedCommand == NULL)
208  {
209  G4String parameterValues = GetCurrentValues( aCommand );
210  }
211  for(G4int i=0;i<savedCommand->GetParameterEntries();i++)
212  {
213  if( aParameterName ==
215  return GetCurrentStringValue(aCommand,i+1,false);
216  }
217  return G4String();
218 }
219 
221 const char * aParameterName, G4bool reGet)
222 {
223  G4String targetParameter =
224  GetCurrentStringValue( aCommand, aParameterName, reGet );
225  G4int value;
226  const char* t = targetParameter;
227  std::istringstream is(t);
228  is >> value;
229  return value;
230 }
231 
233 G4int parameterNumber, G4bool reGet)
234 {
235  G4String targetParameter =
236  GetCurrentStringValue( aCommand, parameterNumber, reGet );
237  G4int value;
238  const char* t = targetParameter;
239  std::istringstream is(t);
240  is >> value;
241  return value;
242 }
243 
245 const char * aParameterName, G4bool reGet)
246 {
247  G4String targetParameter =
248  GetCurrentStringValue( aCommand, aParameterName, reGet );
249  G4double value;
250  const char* t = targetParameter;
251  std::istringstream is(t);
252  is >> value;
253  return value;
254 }
255 
257 G4int parameterNumber, G4bool reGet)
258 {
259  G4String targetParameter =
260  GetCurrentStringValue( aCommand, parameterNumber, reGet );
261  G4double value;
262  const char* t = targetParameter;
263  std::istringstream is(t);
264  is >> value;
265  return value;
266 }
267 
269 {
270  treeTop->AddNewCommand( newCommand );
272  { fMasterUImanager->AddWorkerCommand(newCommand); }
273 }
274 
276 {
277  treeTop->AddNewCommand( newCommand, true );
278 }
279 
281 {
282  treeTop->RemoveCommand( aCommand );
284  { fMasterUImanager->RemoveWorkerCommand(aCommand); }
285 }
286 
288 {
289  treeTop->RemoveCommand( aCommand, true );
290 }
291 
292 void G4UImanager::ExecuteMacroFile(const char * fileName)
293 {
294  G4UIsession* batchSession = new G4UIbatch(fileName,session);
295  session = batchSession;
296  G4UIsession* previousSession = session->SessionStart();
297  delete session;
298  session = previousSession;
299 }
300 
301 void G4UImanager::LoopS(const char* valueList)
302 {
303  G4String vl = valueList;
304  G4Tokenizer parameterToken(vl);
305  G4String mf = parameterToken();
306  G4String vn = parameterToken();
307  G4String c1 = parameterToken();
308  c1 += " ";
309  c1 += parameterToken();
310  c1 += " ";
311  c1 += parameterToken();
312  const char* t1 = c1;
313  std::istringstream is(t1);
314  G4double d1;
315  G4double d2;
316  G4double d3;
317  is >> d1 >> d2 >> d3;
318  Loop(mf,vn,d1,d2,d3);
319 }
320 
321 void G4UImanager::Loop(const char * macroFile,const char * variableName,
322  G4double initialValue,G4double finalValue,G4double stepSize)
323 {
324  G4String cd;
325  if (stepSize > 0) {
326  for(G4double d=initialValue;d<=finalValue;d+=stepSize)
327  {
328  std::ostringstream os;
329  os << d;
330  cd += os.str();
331  cd += " ";
332  }
333  } else {
334  for(G4double d=initialValue;d>=finalValue;d+=stepSize)
335  {
336  std::ostringstream os;
337  os << d;
338  cd += os.str();
339  cd += " ";
340  }
341  }
342  Foreach(macroFile,variableName,cd);
343 }
344 
345 void G4UImanager::ForeachS(const char* valueList)
346 {
347  G4String vl = valueList;
348  G4Tokenizer parameterToken(vl);
349  G4String mf = parameterToken();
350  G4String vn = parameterToken();
351  G4String c1 = parameterToken();
352  G4String ca;
353  while(!((ca=parameterToken()).isNull()))
354  {
355  c1 += " ";
356  c1 += ca;
357  }
358 
359  G4String aliasValue = c1;
360  if(aliasValue(0)=='"')
361  {
362  G4String strippedValue;
363  if(aliasValue(aliasValue.length()-1)=='"')
364  { strippedValue = aliasValue(1,aliasValue.length()-2); }
365  else
366  { strippedValue = aliasValue(1,aliasValue.length()-1); }
367  aliasValue = strippedValue;
368  }
369 
370 // Foreach(mf,vn,c1);
371  Foreach(mf,vn,aliasValue);
372 }
373 
374 void G4UImanager::Foreach(const char * macroFile,const char * variableName,
375  const char * candidates)
376 {
377  G4String candidatesString = candidates;
378  G4Tokenizer parameterToken( candidatesString );
379  G4String cd;
380  while(!((cd=parameterToken()).isNull()))
381  {
382  G4String vl = variableName;
383  vl += " ";
384  vl += cd;
385  SetAlias(vl);
386  ExecuteMacroFile(FindMacroPath(macroFile));
387  }
388 }
389 
390 
392 {
393  G4String aCommand = aCmd;
394  G4int ia = aCommand.index("{");
395  G4int iz = aCommand.index("#");
396  while((ia != G4int(std::string::npos))&&((iz==G4int(std::string::npos))||(ia<iz)))
397  {
398  G4int ibx = -1;
399  while(ibx<0)
400  {
401  G4int ib = aCommand.index("}");
402  if( ib == G4int(std::string::npos) )
403  {
404  G4cerr << aCommand << G4endl;
405  for(G4int i=0;i<ia;i++) G4cerr << " ";
406  G4cerr << "^" << G4endl;
407  G4cerr << "Unmatched alias parenthis -- command ignored" << G4endl;
408  G4String nullStr;
409  return nullStr;
410  }
411  G4String ps = aCommand(ia+1,aCommand.length()-(ia+1));
412  G4int ic = ps.index("{");
413  G4int id = ps.index("}");
414  if(ic!=G4int(std::string::npos) && ic < id)
415  { ia+=ic+1; }
416  else
417  { ibx = ib; }
418  }
419  //--- Here ia represents the position of innermost "{"
420  //--- and ibx represents corresponding "}"
421  G4String subs;
422  if(ia>0) subs = aCommand(0,ia);
423  G4String alis = aCommand(ia+1,ibx-ia-1);
424  G4String rems = aCommand(ibx+1,aCommand.length()-ibx);
425  // G4cout << "<" << subs << "> <" << alis << "> <" << rems << ">" << G4endl;
426  G4String* alVal = aliasList->FindAlias(alis);
427  if(!alVal)
428  {
429  G4cerr << "Alias <" << alis << "> not found -- command ignored" << G4endl;
430  G4String nullStr;
431  return nullStr;
432  }
433  aCommand = subs+(*alVal)+rems;
434  ia = aCommand.index("{");
435  }
436  return aCommand;
437 }
438 
440 {
441  return ApplyCommand(aCmd.data());
442 }
443 
444 #include "G4Threading.hh"
445 
447 {
448  G4String aCommand = SolveAlias(aCmd);
449  if(aCommand.isNull()) return fAliasNotFound;
450  if(verboseLevel) G4cout << aCommand << G4endl;
451  G4String commandString;
452  G4String commandParameter;
453 
454  G4int i = aCommand.index(" ");
455  if( i != G4int(std::string::npos) )
456  {
457  commandString = aCommand(0,i);
458  commandParameter = aCommand(i+1,aCommand.length()-(i+1));
459  }
460  else
461  {
462  commandString = aCommand;
463  }
464 
465  // remove doubled slash
466  G4int len = commandString.length();
467  G4int ll = 0;
468  G4String a1;
469  G4String a2;
470  while(ll<len-1)
471  {
472  if(commandString(ll,2)=="//")
473  {
474  if(ll==0)
475  { commandString.remove(ll,1); }
476  else
477  {
478  a1 = commandString(0,ll);
479  a2 = commandString(ll+1,len-ll-1);
480  commandString = a1+a2;
481  }
482  len--;
483  }
484  else
485  { ll++; }
486  }
487 
488  if(isMaster&&bridges)
489  {
490  std::vector<G4UIbridge*>::iterator itr = bridges->begin();
491  for(;itr!=bridges->end();itr++)
492  {
493  G4int leng = (*itr)->DirLength();
494  if(commandString(0,leng)==(*itr)->DirName())
495  { return (*itr)->LocalUI()->ApplyCommand(commandString+" "+commandParameter); }
496  }
497  }
498 
499  G4UIcommand * targetCommand = treeTop->FindPath( commandString );
500  if( targetCommand == NULL )
501  {
503  {
505  { commandStack->push_back(commandString+" "+commandParameter); }
506  return fCommandSucceeded;
507  }
508  else
509  { return fCommandNotFound; }
510  }
511 
512  if(stackCommandsForBroadcast && targetCommand->ToBeBroadcasted())
513  { commandStack->push_back(commandString+" "+commandParameter); }
514 
515  if(!(targetCommand->IsAvailable()))
516  { return fIllegalApplicationState; }
517 
518  if(saveHistory) historyFile << aCommand << G4endl;
519  if( G4int(histVec.size()) >= maxHistSize )
520  { histVec.erase(histVec.begin()); }
521  histVec.push_back(aCommand);
522 
523  return targetCommand->DoIt( commandParameter );
524 }
525 
526 void G4UImanager::StoreHistory(const char* fileName)
527 { StoreHistory(true,fileName); }
528 
529 void G4UImanager::StoreHistory(G4bool historySwitch,const char* fileName)
530 {
531  if(historySwitch)
532  {
533  if(saveHistory)
534  { historyFile.close(); }
535  historyFile.open((char*)fileName);
536  saveHistory = true;
537  }
538  else
539  {
540  historyFile.close();
541  saveHistory = false;
542  }
543  saveHistory = historySwitch;
544 }
545 
546 void G4UImanager::PauseSession(const char* msg)
547 {
549 }
550 
551 void G4UImanager::ListCommands(const char* direct)
552 {
553  G4UIcommandTree* comTree = FindDirectory(direct);
554  if(comTree)
555  { comTree->List(); }
556  else
557  { G4cout << direct << " is not found." << G4endl; }
558 }
559 
561 {
562  G4String aDirName = dirName;
563  G4String targetDir = aDirName.strip(G4String::both);
564  if( targetDir( targetDir.length()-1 ) != '/' )
565  { targetDir += "/"; }
566  G4UIcommandTree* comTree = treeTop;
567  if( targetDir == "/" )
568  { return comTree; }
569  G4int idx = 1;
570  while( idx < G4int(targetDir.length())-1 )
571  {
572  G4int i = targetDir.index("/",idx);
573  G4String targetDirString = targetDir(0,i+1);
574  comTree = comTree->GetTree(targetDirString);
575  if( comTree == NULL )
576  { return NULL; }
577  idx = i+1;
578  }
579  return comTree;
580 }
581 
583 {
584  //G4cout << G4StateManager::GetStateManager()->GetStateString(requestedState) << " <--- " << G4StateManager::GetStateManager()->GetStateString(G4StateManager::GetStateManager()->GetPreviousState()) << G4endl;
586  {
587  if(requestedState==G4State_EventProc &&
589  { PauseSession("BeginOfEvent"); }
590  }
592  {
593  if(requestedState==G4State_GeomClosed &&
594  G4StateManager::GetStateManager()->GetPreviousState()==G4State_EventProc)
595  { PauseSession("EndOfEvent"); }
596  }
597  return true;
598 }
599 
600 //void G4UImanager::Interact()
601 //{
602 // Interact(G4String("G4> "));
603 //}
604 
605 //void G4UImanager::Interact(const char * pC)
606 //{
607 // G4cerr << "G4UImanager::Interact() is out of date and is not used anymore." << G4endl;
608 // G4cerr << "This method will be removed shortly!!!" << G4endl;
609 // G4cerr << "In case of main() use" << G4endl;
610 // G4cerr << " G4UIsession * session = new G4UIterminal;" << G4endl;
611 // G4cerr << " session->SessionStart();" << G4endl;
612 // G4cerr << "In other cases use" << G4endl;
613 // G4cerr << " G4StateManager::GetStateManager()->Pause();" << G4endl;
614 //}
615 
616 
617 
619 {
620  G4coutbuf.SetDestination(value);
621  G4cerrbuf.SetDestination(value);
622 }
623 
624 void G4UImanager::SetAlias(const char * aliasLine)
625 {
626  G4String aLine = aliasLine;
627  G4int i = aLine.index(" ");
628  G4String aliasName = aLine(0,i);
629  G4String aliasValue = aLine(i+1,aLine.length()-(i+1));
630  if(aliasValue(0)=='"')
631  {
632  G4String strippedValue;
633  if(aliasValue(aliasValue.length()-1)=='"')
634  { strippedValue = aliasValue(1,aliasValue.length()-2); }
635  else
636  { strippedValue = aliasValue(1,aliasValue.length()-1); }
637  aliasValue = strippedValue;
638  }
639 
640  aliasList->ChangeAlias(aliasName,aliasValue);
641 }
642 
643 void G4UImanager::RemoveAlias(const char * aliasName)
644 {
645  G4String aL = aliasName;
646  G4String targetAlias = aL.strip(G4String::both);
647  aliasList->RemoveAlias(targetAlias);
648 }
649 
651 {
652  aliasList->List();
653 }
654 
655 void G4UImanager::CreateHTML(const char* dir)
656 {
657  G4UIcommandTree* tr = FindDirectory(dir);
658  if(tr!=0)
659  { tr->CreateHTML(); }
660  else
661  { G4cerr << "Directory <" << dir << "> is not found." << G4endl; }
662 }
663 
665 {
666  searchDirs.clear();
667 
668  size_t idxfirst = 0;
669  size_t idxend = 0;
670  G4String pathstring = "";
671  while( (idxend = searchPath.index(':', idxfirst)) != G4String::npos) {
672  pathstring = searchPath.substr(idxfirst, idxend-idxfirst);
673  if(pathstring.size() != 0) searchDirs.push_back(pathstring);
674  idxfirst = idxend + 1;
675  }
676 
677  pathstring = searchPath.substr(idxfirst, searchPath.size()-idxfirst);
678  if(pathstring.size() != 0) searchDirs.push_back(pathstring);
679 }
680 
681 
682 static G4bool FileFound(const G4String& fname)
683 {
684  G4bool qopen = false;
685  std::ifstream fs;
686  fs.open(fname.c_str(), std::ios::in);
687  if(fs.good()) {
688  fs.close();
689  qopen = true;
690  }
691  return qopen;
692 }
693 
695 {
696  G4String macrofile = fname;
697 
698  for (size_t i = 0; i < searchDirs.size(); i++) {
699  G4String fullpath = searchDirs[i] + "/" + fname;
700  if ( FileFound(fullpath) ) {
701  macrofile = fullpath;
702  break;
703  }
704  }
705 
706  return macrofile;
707 }
708 
709 std::vector<G4String>* G4UImanager::GetCommandStack()
710 {
711  std::vector<G4String>* returnValue = commandStack;
712  commandStack = new std::vector<G4String>;
713  return returnValue;
714 }
715 
717 {
718  if(brg->LocalUI()==this)
719  {
720  G4Exception("G4UImanager::RegisterBridge()","UI7002",FatalException,
721  "G4UIBridge cannot bridge between same object.");
722  }
723  else
724  { bridges->push_back(brg); }
725 }
726 
728 {
729  threadID = tId;
733 }
734 
736 {
743 }
744 
745 void G4UImanager::SetCoutFileName(const G4String& fileN, G4bool ifAppend)
746 {
747  // for sequential mode, ignore this method.
748  if(threadID<0) return;
749 
750  if(fileN == "**Screen**")
751  { threadCout->SetCoutFileName(fileN,ifAppend); }
752  else
753  {
754  std::stringstream fn;
755  fn<<"G4W_"<<threadID<<"_"<<fileN;
756  threadCout->SetCoutFileName(fn.str(),ifAppend);
757  }
758 }
759 
760 void G4UImanager::SetCerrFileName(const G4String& fileN, G4bool ifAppend)
761 {
762  // for sequential mode, ignore this method.
763  if(threadID<0) return;
764 
765  if(fileN == "**Screen**")
766  { threadCout->SetCerrFileName(fileN,ifAppend); }
767  else
768  {
769  std::stringstream fn;
770  fn<<"G4W_"<<threadID<<"_"<<fileN;
771  threadCout->SetCerrFileName(fn.str(),ifAppend);
772  }
773 }
774 
776 {
777  // for sequential mode, ignore this method.
778  if(threadID<0) return;
780 }
781 
783 {
784  // for sequential mode, ignore this method.
785  if(threadID<0) return;
787 }
788 
790 {
791  // for sequential mode, ignore this method.
792  if(threadID<0)
793  {
794  igThreadID = tid;
795  return;
796  }
798 }
799 
801 {
802  // for sequential mode, ignore this method.
803  if(threadID<0) { return; }
805 }
806 
static const G4double d3
void ForeachS(const char *valueList)
Definition: G4UImanager.cc:345
void ExecuteMacroFile(const char *fileName)
Definition: G4UImanager.cc:292
static G4int igThreadID
Definition: G4UImanager.hh:285
void Foreach(const char *macroFile, const char *variableName, const char *candidates)
Definition: G4UImanager.cc:374
void RemoveAlias(const char *aliasName)
Definition: G4UImanager.cc:643
G4int operator==(const G4UImanager &right) const
Definition: G4UImanager.cc:165
static G4ThreadLocal G4UImanager * fUImanager
Definition: G4UImanager.hh:148
void SetThreadPrefixString(const G4String &s="W")
Definition: G4UImanager.cc:775
static const G4double d1
void SetAlias(const char *aliasLine)
Definition: G4UImanager.cc:624
G4bool IsAvailable()
Definition: G4UIcommand.cc:289
G4UIcommand * savedCommand
Definition: G4UImanager.hh:158
void SetUpForAThread(G4int tId)
Definition: G4UImanager.cc:727
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:182
void SetCoutFileName(const G4String &fileN="G4cout.txt", G4bool ifAppend=true)
Definition: G4UImanager.cc:745
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:716
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:131
static G4bool FileFound(const G4String &fname)
Definition: G4UImanager.cc:682
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:782
virtual G4UIsession * SessionStart()
Definition: G4UIsession.cc:38
G4int maxHistSize
Definition: G4UImanager.hh:164
G4bool stackCommandsForBroadcast
Definition: G4UImanager.hh:254
#define G4ThreadLocal
Definition: tls.hh:89
void RemoveWorkerCommand(G4UIcommand *aCommand)
Definition: G4UImanager.cc:287
int G4int
Definition: G4Types.hh:78
std::vector< G4String > * GetCommandStack()
Definition: G4UImanager.cc:709
G4bool saveHistory
Definition: G4UImanager.hh:161
void SetCerrFileName(const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)
Definition: G4UImanager.cc:760
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:664
static const double s
Definition: G4SIunits.hh:168
static G4StateManager * GetStateManager()
std::vector< G4String > searchDirs
Definition: G4UImanager.hh:168
void SetThreadIgnoreInit(G4bool flg=true)
Definition: G4UImanager.cc:800
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:321
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:280
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:232
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:170
const char * data() const
void ListCommands(const char *direc)
Definition: G4UImanager.cc:551
void PauseSession(const char *msg)
Definition: G4UImanager.cc:546
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:268
G4String & append(const G4String &)
G4String searchPath
Definition: G4UImanager.hh:167
void SetCoutDestination(G4UIsession *const value)
Definition: G4UImanager.cc:618
void G4iosInitialization()
Definition: G4ios.cc:85
G4String SolveAlias(const char *aCmd)
Definition: G4UImanager.cc:391
G4UIsession * session
Definition: G4UImanager.hh:152
void ListAlias()
Definition: G4UImanager.cc:650
static G4ThreadLocal G4bool fUImanagerHasBeenKilled
Definition: G4UImanager.hh:149
#define G4endl
Definition: G4ios.hh:61
void LoopS(const char *valueList)
Definition: G4UImanager.cc:301
const G4UImanager & operator=(const G4UImanager &right)
Definition: G4UImanager.cc:163
virtual G4bool Notify(G4ApplicationState requestedState)
Definition: G4UImanager.cc:582
void AddWorkerCommand(G4UIcommand *newCommand)
Definition: G4UImanager.cc:275
G4double GetCurrentDoubleValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
Definition: G4UImanager.cc:256
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:735
void SetThreadIgnore(G4int tid=0)
Definition: G4UImanager.cc:789
void CreateHTML(const char *dir="/")
Definition: G4UImanager.cc:655
G4strstreambuf G4cerrbuf
Definition: G4ios.cc:83
static const G4double d2
void StoreHistory(const char *fileName="G4history.macro")
Definition: G4UImanager.cc:526
G4int GetParameterEntries() const
Definition: G4UIcommand.hh:143
G4String FindMacroPath(const G4String &fname) const
Definition: G4UImanager.cc:694
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:128
G4UIcommandTree * FindDirectory(const char *dirName)
Definition: G4UImanager.cc:560
void List() const
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:446
G4String GetCurrentValue()
Definition: G4UIcommand.cc:234
G4GLOB_DLL std::ostream G4cerr
G4int operator!=(const G4UImanager &right) const
Definition: G4UImanager.cc:167
void RemoveAlias(const char *aliasName)