Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 77651 2013-11-27 08:47:55Z 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 
52 G4ThreadLocal G4UImanager * G4UImanager::fUImanager = 0;
53 G4ThreadLocal G4bool G4UImanager::fUImanagerHasBeenKilled = false;
54 G4UImanager * G4UImanager::fMasterUImanager = 0;
55 
56 G4int G4UImanager::igThreadID = -1;
57 
59 {
60  if(!fUImanager)
61  {
62  if(!fUImanagerHasBeenKilled)
63  {
64  fUImanager = new G4UImanager;
65  fUImanager->CreateMessenger();
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("/");
83  aliasList = new G4UIaliasList;
84  G4String nullString;
85  savedParameters = nullString;
86  verboseLevel = 0;
87  saveHistory = false;
88  session = NULL;
89  g4UIWindow = NULL;
90  SetCoutDestination(session);
91  pauseAtBeginOfEvent = false;
92  pauseAtEndOfEvent = false;
93  maxHistSize = 20;
94  searchPath="";
95  commandStack = new std::vector<G4String>;
96 }
97 
98 void G4UImanager::CreateMessenger()
99 {
100  UImessenger = new G4UIcontrolMessenger;
101  UnitsMessenger = new G4UnitsMessenger;
102  CoutMessenger = new G4LocalThreadCoutMessenger;
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;
122  fUImanagerHasBeenKilled = true;
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 {
140  UImessenger = ui.UImessenger;
141  UnitsMessenger = ui.UnitsMessenger;
142  aliasList = ui.aliasList;
143  g4UIWindow = ui.g4UIWindow;
144  savedCommand= ui.savedCommand;
145  session = ui.session;
146  treeTop = ui.treeTop;
147 }
148 
149 const G4UImanager & G4UImanager::operator=(const G4UImanager &right)
150 { return right; }
151 G4int G4UImanager::operator==(const G4UImanager &right) const
152 { return (this==&right); }
153 G4int G4UImanager::operator!=(const G4UImanager &right) const
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 ==
200  savedCommand->GetParameter(i)->GetParameterName() )
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 );
257  if(fMasterUImanager!=0&&G4Threading::G4GetThreadId()==0)
258  { fMasterUImanager->AddWorkerCommand(newCommand); }
259 }
260 
261 void G4UImanager::AddWorkerCommand(G4UIcommand * newCommand)
262 {
263  treeTop->AddNewCommand( newCommand, true );
264 }
265 
267 {
268  treeTop->RemoveCommand( aCommand );
269  if(fMasterUImanager!=0&&G4Threading::G4GetThreadId()==0)
270  { fMasterUImanager->RemoveWorkerCommand(aCommand); }
271 }
272 
273 void G4UImanager::RemoveWorkerCommand(G4UIcommand * aCommand)
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  Foreach(mf,vn,c1);
345 }
346 
347 void G4UImanager::Foreach(const char * macroFile,const char * variableName,
348  const char * candidates)
349 {
350  G4String candidatesString = candidates;
351  G4Tokenizer parameterToken( candidatesString );
352  G4String cd;
353  while(!((cd=parameterToken()).isNull()))
354  {
355  G4String vl = variableName;
356  vl += " ";
357  vl += cd;
358  SetAlias(vl);
359  ExecuteMacroFile(macroFile);
360  }
361 }
362 
363 
365 {
366  G4String aCommand = aCmd;
367  G4int ia = aCommand.index("{");
368  G4int iz = aCommand.index("#");
369  while((ia != G4int(std::string::npos))&&((iz==G4int(std::string::npos))||(ia<iz)))
370  {
371  G4int ibx = -1;
372  while(ibx<0)
373  {
374  G4int ib = aCommand.index("}");
375  if( ib == G4int(std::string::npos) )
376  {
377  G4cerr << aCommand << G4endl;
378  for(G4int i=0;i<ia;i++) G4cerr << " ";
379  G4cerr << "^" << G4endl;
380  G4cerr << "Unmatched alias parenthis -- command ignored" << G4endl;
381  G4String nullStr;
382  return nullStr;
383  }
384  G4String ps = aCommand(ia+1,aCommand.length()-(ia+1));
385  G4int ic = ps.index("{");
386  G4int id = ps.index("}");
387  if(ic!=G4int(std::string::npos) && ic < id)
388  { ia+=ic+1; }
389  else
390  { ibx = ib; }
391  }
392  //--- Here ia represents the position of innermost "{"
393  //--- and ibx represents corresponding "}"
394  G4String subs;
395  if(ia>0) subs = aCommand(0,ia);
396  G4String alis = aCommand(ia+1,ibx-ia-1);
397  G4String rems = aCommand(ibx+1,aCommand.length()-ibx);
398  // G4cout << "<" << subs << "> <" << alis << "> <" << rems << ">" << G4endl;
399  G4String* alVal = aliasList->FindAlias(alis);
400  if(!alVal)
401  {
402  G4cerr << "Alias <" << alis << "> not found -- command ignored" << G4endl;
403  G4String nullStr;
404  return nullStr;
405  }
406  aCommand = subs+(*alVal)+rems;
407  ia = aCommand.index("{");
408  }
409  return aCommand;
410 }
411 
413 {
414  return ApplyCommand(aCmd.data());
415 }
416 
417 #include "G4Threading.hh"
418 
420 {
421  G4String aCommand = SolveAlias(aCmd);
422  if(aCommand.isNull()) return fAliasNotFound;
423  if(verboseLevel) G4cout << aCommand << G4endl;
424  G4String commandString;
425  G4String commandParameter;
426 
427  G4int i = aCommand.index(" ");
428  if( i != G4int(std::string::npos) )
429  {
430  commandString = aCommand(0,i);
431  commandParameter = aCommand(i+1,aCommand.length()-(i+1));
432  }
433  else
434  {
435  commandString = aCommand;
436  }
437 
438  // remove doubled slash
439  G4int len = commandString.length();
440  G4int ll = 0;
441  G4String a1;
442  G4String a2;
443  while(ll<len-1)
444  {
445  if(commandString(ll,2)=="//")
446  {
447  if(ll==0)
448  { commandString.remove(ll,1); }
449  else
450  {
451  a1 = commandString(0,ll);
452  a2 = commandString(ll+1,len-ll-1);
453  commandString = a1+a2;
454  }
455  len--;
456  }
457  else
458  { ll++; }
459  }
460 
461  if(isMaster&&bridges)
462  {
463  std::vector<G4UIbridge*>::iterator itr = bridges->begin();
464  for(;itr!=bridges->end();itr++)
465  {
466  G4int leng = (*itr)->DirLength();
467  if(commandString(0,leng)==(*itr)->DirName())
468  { return (*itr)->LocalUI()->ApplyCommand(commandString+" "+commandParameter); }
469  }
470  }
471 
472  G4UIcommand * targetCommand = treeTop->FindPath( commandString );
473  if( targetCommand == NULL )
474  {
475  if(ignoreCmdNotFound)
476  {
477  if(stackCommandsForBroadcast)
478  { commandStack->push_back(commandString+" "+commandParameter); }
479  return fCommandSucceeded;
480  }
481  else
482  { return fCommandNotFound; }
483  }
484 
485  if(stackCommandsForBroadcast && targetCommand->ToBeBroadcasted())
486  { commandStack->push_back(commandString+" "+commandParameter); }
487 
488  if(!(targetCommand->IsAvailable()))
489  { return fIllegalApplicationState; }
490 
491  if(saveHistory) historyFile << aCommand << G4endl;
492  if( G4int(histVec.size()) >= maxHistSize )
493  { histVec.erase(histVec.begin()); }
494  histVec.push_back(aCommand);
495 
496  return targetCommand->DoIt( commandParameter );
497 }
498 
499 void G4UImanager::StoreHistory(const char* fileName)
500 { StoreHistory(true,fileName); }
501 
502 void G4UImanager::StoreHistory(G4bool historySwitch,const char* fileName)
503 {
504  if(historySwitch)
505  {
506  if(saveHistory)
507  { historyFile.close(); }
508  historyFile.open((char*)fileName);
509  saveHistory = true;
510  }
511  else
512  {
513  historyFile.close();
514  saveHistory = false;
515  }
516  saveHistory = historySwitch;
517 }
518 
519 void G4UImanager::PauseSession(const char* msg)
520 {
521  if(session) session->PauseSessionStart(msg);
522 }
523 
524 void G4UImanager::ListCommands(const char* direct)
525 {
526  G4UIcommandTree* comTree = FindDirectory(direct);
527  if(comTree)
528  { comTree->List(); }
529  else
530  { G4cout << direct << " is not found." << G4endl; }
531 }
532 
533 G4UIcommandTree* G4UImanager::FindDirectory(const char* dirName)
534 {
535  G4String aDirName = dirName;
536  G4String targetDir = aDirName.strip(G4String::both);
537  if( targetDir( targetDir.length()-1 ) != '/' )
538  { targetDir += "/"; }
539  G4UIcommandTree* comTree = treeTop;
540  if( targetDir == "/" )
541  { return comTree; }
542  G4int idx = 1;
543  while( idx < G4int(targetDir.length())-1 )
544  {
545  G4int i = targetDir.index("/",idx);
546  G4String targetDirString = targetDir(0,i+1);
547  comTree = comTree->GetTree(targetDirString);
548  if( comTree == NULL )
549  { return NULL; }
550  idx = i+1;
551  }
552  return comTree;
553 }
554 
556 {
557  //G4cout << G4StateManager::GetStateManager()->GetStateString(requestedState) << " <--- " << G4StateManager::GetStateManager()->GetStateString(G4StateManager::GetStateManager()->GetPreviousState()) << G4endl;
558  if(pauseAtBeginOfEvent)
559  {
560  if(requestedState==G4State_EventProc &&
562  { PauseSession("BeginOfEvent"); }
563  }
564  if(pauseAtEndOfEvent)
565  {
566  if(requestedState==G4State_GeomClosed &&
567  G4StateManager::GetStateManager()->GetPreviousState()==G4State_EventProc)
568  { PauseSession("EndOfEvent"); }
569  }
570  return true;
571 }
572 
573 //void G4UImanager::Interact()
574 //{
575 // Interact(G4String("G4> "));
576 //}
577 
578 //void G4UImanager::Interact(const char * pC)
579 //{
580 // G4cerr << "G4UImanager::Interact() is out of date and is not used anymore." << G4endl;
581 // G4cerr << "This method will be removed shortly!!!" << G4endl;
582 // G4cerr << "In case of main() use" << G4endl;
583 // G4cerr << " G4UIsession * session = new G4UIterminal;" << G4endl;
584 // G4cerr << " session->SessionStart();" << G4endl;
585 // G4cerr << "In other cases use" << G4endl;
586 // G4cerr << " G4StateManager::GetStateManager()->Pause();" << G4endl;
587 //}
588 
589 
590 
592 {
593  G4coutbuf.SetDestination(value);
594  G4cerrbuf.SetDestination(value);
595 }
596 
597 void G4UImanager::SetAlias(const char * aliasLine)
598 {
599  G4String aLine = aliasLine;
600  G4int i = aLine.index(" ");
601  G4String aliasName = aLine(0,i);
602  G4String aliasValue = aLine(i+1,aLine.length()-(i+1));
603  if(aliasValue(0)=='"')
604  {
605  G4String strippedValue;
606  if(aliasValue(aliasValue.length()-1)=='"')
607  { strippedValue = aliasValue(1,aliasValue.length()-2); }
608  else
609  { strippedValue = aliasValue(1,aliasValue.length()-1); }
610  aliasValue = strippedValue;
611  }
612 
613  aliasList->ChangeAlias(aliasName,aliasValue);
614 }
615 
616 void G4UImanager::RemoveAlias(const char * aliasName)
617 {
618  G4String aL = aliasName;
619  G4String targetAlias = aL.strip(G4String::both);
620  aliasList->RemoveAlias(targetAlias);
621 }
622 
624 {
625  aliasList->List();
626 }
627 
628 void G4UImanager::CreateHTML(const char* dir)
629 {
630  G4UIcommandTree* tr = FindDirectory(dir);
631  if(tr!=0)
632  { tr->CreateHTML(); }
633  else
634  { G4cerr << "Directory <" << dir << "> is not found." << G4endl; }
635 }
636 
638 {
639  searchDirs.clear();
640 
641  size_t idxfirst = 0;
642  size_t idxend = 0;
643  G4String pathstring = "";
644  while( (idxend = searchPath.index(':', idxfirst)) != G4String::npos) {
645  pathstring = searchPath.substr(idxfirst, idxend-idxfirst);
646  if(pathstring.size() != 0) searchDirs.push_back(pathstring);
647  idxfirst = idxend + 1;
648  }
649 
650  pathstring = searchPath.substr(idxfirst, searchPath.size()-idxfirst);
651  if(pathstring.size() != 0) searchDirs.push_back(pathstring);
652 }
653 
654 
655 static G4bool FileFound(const G4String& fname)
656 {
657  G4bool qopen = false;
658  std::ifstream fs;
659  fs.open(fname.c_str(), std::ios::in);
660  if(fs.good()) {
661  fs.close();
662  qopen = true;
663  }
664  return qopen;
665 }
666 
668 {
669  G4String macrofile = fname;
670 
671  for (size_t i = 0; i < searchDirs.size(); i++) {
672  G4String fullpath = searchDirs[i] + "/" + fname;
673  if ( FileFound(fullpath) ) {
674  macrofile = fullpath;
675  break;
676  }
677  }
678 
679  return macrofile;
680 }
681 
682 std::vector<G4String>* G4UImanager::GetCommandStack()
683 {
684  std::vector<G4String>* returnValue = commandStack;
685  commandStack = new std::vector<G4String>;
686  return returnValue;
687 }
688 
690 {
691  if(brg->LocalUI()==this)
692  {
693  G4Exception("G4UImanager::RegisterBridge()","UI7002",FatalException,
694  "G4UIBridge cannot bridge between same object.");
695  }
696  else
697  { bridges->push_back(brg); }
698 }
699 
701 {
702  threadID = tId;
704  threadCout = new G4MTcoutDestination(threadID);
705  threadCout->SetIgnoreCout(igThreadID);
706 }
707 
708 void G4UImanager::SetCoutFileName(const G4String& fileN, G4bool ifAppend)
709 {
710  // for sequential mode, ignore this method.
711  if(threadID<0) return;
712 
713  if(fileN == "**Screen**")
714  { threadCout->SetCoutFileName(fileN,ifAppend); }
715  else
716  {
717  std::stringstream fn;
718  fn<<"G4W_"<<threadID<<"_"<<fileN;
719  threadCout->SetCoutFileName(fn.str(),ifAppend);
720  }
721 }
722 
723 void G4UImanager::SetCerrFileName(const G4String& fileN, G4bool ifAppend)
724 {
725  // for sequential mode, ignore this method.
726  if(threadID<0) return;
727 
728  if(fileN == "**Screen**")
729  { threadCout->SetCerrFileName(fileN,ifAppend); }
730  else
731  {
732  std::stringstream fn;
733  fn<<"G4W_"<<threadID<<"_"<<fileN;
734  threadCout->SetCerrFileName(fn.str(),ifAppend);
735  }
736 }
737 
739 {
740  // for sequential mode, ignore this method.
741  if(threadID<0) return;
742  threadCout->SetPrefixString(s);
743 }
744 
746 {
747  // for sequential mode, ignore this method.
748  if(threadID<0) return;
749  threadCout->EnableBuffering(flg);
750 }
751 
753 {
754  // for sequential mode, ignore this method.
755  if(threadID<0)
756  {
757  igThreadID = tid;
758  return;
759  }
760  threadCout->SetIgnoreCout(tid);
761 }
762 
void ForeachS(const char *valueList)
Definition: G4UImanager.cc:331
void ExecuteMacroFile(const char *fileName)
Definition: G4UImanager.cc:278
void Foreach(const char *macroFile, const char *variableName, const char *candidates)
Definition: G4UImanager.cc:347
void RemoveAlias(const char *aliasName)
Definition: G4UImanager.cc:616
void SetThreadPrefixString(const G4String &s="W")
Definition: G4UImanager.cc:738
void SetAlias(const char *aliasLine)
Definition: G4UImanager.cc:597
G4bool IsAvailable()
Definition: G4UIcommand.cc:275
void SetUpForAThread(G4int tId)
Definition: G4UImanager.cc:700
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:708
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:689
G4UIcommand * FindPath(const char *commandPath) const
const XML_Char * s
G4String strip(G4int strip_Type=trailing, char c=' ')
G4String GetParameterName() const
void SetThreadUseBuffer(G4bool flg=true)
Definition: G4UImanager.cc:745
virtual G4UIsession * SessionStart()
Definition: G4UIsession.cc:38
#define G4ThreadLocal
Definition: tls.hh:52
int G4int
Definition: G4Types.hh:78
std::vector< G4String > * GetCommandStack()
Definition: G4UImanager.cc:682
void SetCerrFileName(const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)
Definition: G4UImanager.cc:723
void SetPrefixString(const G4String &wd="G4WT")
void SetCoutFileName(const G4String &fileN="G4cout.txt", G4bool ifAppend=true)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void ParseMacroSearchPath()
Definition: G4UImanager.cc:637
static G4StateManager * GetStateManager()
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
G4double iz
Definition: TRTMaterials.hh:39
G4UIparameter * GetParameter(G4int i) const
Definition: G4UIcommand.hh:145
void EnableBuffering(G4bool flag=true)
void RemoveCommand(G4UIcommand *aCommand)
Definition: G4UImanager.cc:266
void RemoveCommand(G4UIcommand *aCommand, G4bool workerThreadOnly=false)
G4int GetCurrentIntValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
Definition: G4UImanager.cc:218
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:524
void SetDestination(G4coutDestination *dest)
void AddNewCommand(G4UIcommand *newCommand, G4bool workerThreadOnly=false)
void AddNewCommand(G4UIcommand *newCommand)
Definition: G4UImanager.cc:254
G4String & append(const G4String &)
void SetCoutDestination(G4UIsession *const value)
Definition: G4UImanager.cc:591
void G4iosInitialization()
Definition: G4ios.cc:85
tuple t1
Definition: plottest35.py:33
G4String SolveAlias(const char *aCmd)
Definition: G4UImanager.cc:364
void ListAlias()
Definition: G4UImanager.cc:623
const XML_Char int const XML_Char * value
const XML_Char int len
#define G4endl
Definition: G4ios.hh:61
void LoopS(const char *valueList)
Definition: G4UImanager.cc:287
virtual G4bool Notify(G4ApplicationState requestedState)
Definition: G4UImanager.cc:555
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 SetThreadIgnore(G4int tid=0)
Definition: G4UImanager.cc:752
void CreateHTML(const char *dir="/")
Definition: G4UImanager.cc:628
G4strstreambuf G4cerrbuf
Definition: G4ios.cc:83
void StoreHistory(const char *fileName="G4history.macro")
Definition: G4UImanager.cc:499
G4int GetParameterEntries() const
Definition: G4UIcommand.hh:143
G4String FindMacroPath(const G4String &fname) const
Definition: G4UImanager.cc:667
G4bool isNull() const
virtual G4int DoIt(G4String parameterList)
Definition: G4UIcommand.cc:108
G4ApplicationState
G4int G4GetThreadId()
Definition: G4Threading.cc:103
tuple c1
Definition: plottest35.py:14
void List() const
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
G4String GetCurrentValue()
Definition: G4UIcommand.cc:220
G4GLOB_DLL std::ostream G4cerr
void RemoveAlias(const char *aliasName)