Geant4-11
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// G4UImanager
27//
28// Author: Makoto Asai, 1997
29// --------------------------------------------------------------------
30
31#include "G4UImanager.hh"
32#include "G4UIcommandTree.hh"
33#include "G4UIcommand.hh"
34#include "G4UIsession.hh"
35#include "G4UIbatch.hh"
37#include "G4UnitsMessenger.hh"
40#include "G4ios.hh"
41#include "G4strstreambuf.hh"
42#include "G4StateManager.hh"
43#include "G4UIaliasList.hh"
44#include "G4Tokenizer.hh"
46#include "G4UIbridge.hh"
47#include "G4Threading.hh"
48
49#include <sstream>
50#include <fstream>
51
54
55// --------------------------------------------------------------------
57{
58 G4ThreadLocalStatic G4UImanager* _instance = nullptr;
59 return _instance;
60}
61
62// --------------------------------------------------------------------
64{
65 G4ThreadLocalStatic G4bool _instance = false;
66 return _instance;
67}
68
69// --------------------------------------------------------------------
71{
72 static G4UImanager* _instance = nullptr;
73 return _instance;
74}
75
76// --------------------------------------------------------------------
78{
79 if(fUImanager() == nullptr)
80 {
82 {
83 fUImanager() = new G4UImanager;
85 }
86 }
87 return fUImanager();
88}
89
90// --------------------------------------------------------------------
92{
93 return fMasterUImanager();
94}
95
96// --------------------------------------------------------------------
98 : G4VStateDependent(true)
99{
100 treeTop = new G4UIcommandTree("/");
103 commandStack = new std::vector<G4String>;
104}
105
106// --------------------------------------------------------------------
108{
113}
114
115// --------------------------------------------------------------------
117{
118 if(bridges != nullptr)
119 {
120 for(auto itr = bridges->cbegin(); itr != bridges->cend(); ++itr)
121 {
122 delete *itr;
123 }
124 delete bridges;
125 }
126 SetCoutDestination(nullptr);
127 histVec.clear();
128 if(saveHistory)
129 historyFile.close();
130 delete CoutMessenger;
131 delete ProfileMessenger;
132 delete UnitsMessenger;
133 delete UImessenger;
134 delete treeTop;
135 delete aliasList;
137 fUImanager() = nullptr;
138 if(commandStack != nullptr)
139 {
140 commandStack->clear();
141 delete commandStack;
142 }
143 if(threadID >= 0)
144 {
145 delete threadCout;
147 threadID = -1;
148 }
149}
150
151// --------------------------------------------------------------------
153{
154 doublePrecisionStr = val;
155}
156
157// --------------------------------------------------------------------
159{
160 return doublePrecisionStr;
161}
162
163// --------------------------------------------------------------------
165{
166 G4String theCommand = aCommand;
167 savedCommand = treeTop->FindPath(theCommand);
168 if(savedCommand == nullptr)
169 {
170 G4cerr << "command not found" << G4endl;
171 return G4String();
172 }
174}
175
176// --------------------------------------------------------------------
178 G4int parameterNumber, G4bool reGet)
179{
180 if(reGet || savedCommand == nullptr)
181 {
183 }
184 G4Tokenizer savedToken(savedParameters);
185 G4String token;
186 for(G4int i_thParameter = 0; i_thParameter < parameterNumber; ++i_thParameter)
187 {
188 token = savedToken();
189 if(token.empty())
190 return G4String();
191 if(token[(size_t) 0] == '"')
192 {
193 token.append(" ");
194 token.append(savedToken("\""));
195 }
196 }
197 return token;
198}
199
200// --------------------------------------------------------------------
202 const char* aParameterName,
203 G4bool reGet)
204{
205 if(reGet || savedCommand == nullptr)
206 {
207 G4String parameterValues = GetCurrentValues(aCommand);
208 }
209 for(std::size_t i = 0; i < savedCommand->GetParameterEntries(); ++i)
210 {
211 if(aParameterName == savedCommand->GetParameter(i)->GetParameterName())
212 return GetCurrentStringValue(aCommand, i + 1, false);
213 }
214 return G4String();
215}
216
217// --------------------------------------------------------------------
219 const char* aParameterName, G4bool reGet)
220{
221 G4String targetParameter =
222 GetCurrentStringValue(aCommand, aParameterName, reGet);
223 G4int value;
224 const char* t = targetParameter;
225 std::istringstream is(t);
226 is >> value;
227 return value;
228}
229
230// --------------------------------------------------------------------
232 G4int parameterNumber, G4bool reGet)
233{
234 G4String targetParameter =
235 GetCurrentStringValue(aCommand, parameterNumber, reGet);
236 G4int value;
237 const char* t = targetParameter;
238 std::istringstream is(t);
239 is >> value;
240 return value;
241}
242
243// --------------------------------------------------------------------
245 const char* aParameterName,
246 G4bool reGet)
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}
256
257// --------------------------------------------------------------------
259 G4int parameterNumber, G4bool reGet)
260{
261 G4String targetParameter =
262 GetCurrentStringValue(aCommand, parameterNumber, reGet);
263 G4double value;
264 const char* t = targetParameter;
265 std::istringstream is(t);
266 is >> value;
267 return value;
268}
269
270// --------------------------------------------------------------------
272{
273 treeTop->AddNewCommand(newCommand);
274 if(fMasterUImanager() != nullptr && G4Threading::G4GetThreadId() == 0)
275 {
276 fMasterUImanager()->AddWorkerCommand(newCommand);
277 }
278}
279
280// --------------------------------------------------------------------
282{
283 treeTop->AddNewCommand(newCommand, true);
284}
285
286// --------------------------------------------------------------------
288{
289 treeTop->RemoveCommand(aCommand);
290 if(fMasterUImanager() != nullptr && G4Threading::G4GetThreadId() == 0)
291 {
293 }
294}
295
296// --------------------------------------------------------------------
298{
299 treeTop->RemoveCommand(aCommand, true);
300}
301
302// --------------------------------------------------------------------
303void G4UImanager::ExecuteMacroFile(const char* fileName)
304{
305 G4UIsession* batchSession = new G4UIbatch(fileName, session);
306 session = batchSession;
307 lastRC = 0;
308 G4UIsession* previousSession = session->SessionStart();
309 lastRC = session->GetLastReturnCode();
310 delete session;
311 session = previousSession;
312}
313
314// --------------------------------------------------------------------
315void G4UImanager::LoopS(const char* valueList)
316{
317 G4String vl = valueList;
318 G4Tokenizer parameterToken(vl);
319 G4String mf = parameterToken();
320 G4String vn = parameterToken();
321 G4String c1 = parameterToken();
322 c1 += " ";
323 c1 += parameterToken();
324 c1 += " ";
325 c1 += parameterToken();
326 const char* t1 = c1;
327 std::istringstream is(t1);
328 G4double d1;
329 G4double d2;
330 G4double d3;
331 is >> d1 >> d2 >> d3;
332 Loop(mf, vn, d1, d2, d3);
333}
334
335// --------------------------------------------------------------------
336void G4UImanager::Loop(const char* macroFile, const char* variableName,
337 G4double initialValue, G4double finalValue,
338 G4double stepSize)
339{
340 G4String cd;
341 if(stepSize > 0)
342 {
343 for(G4double d = initialValue; d <= finalValue; d += stepSize)
344 {
345 std::ostringstream os;
346 os << d;
347 cd += os.str();
348 cd += " ";
349 }
350 }
351 else
352 {
353 for(G4double d = initialValue; d >= finalValue; d += stepSize)
354 {
355 std::ostringstream os;
356 os << d;
357 cd += os.str();
358 cd += " ";
359 }
360 }
361 Foreach(macroFile, variableName, cd);
362}
363
364// --------------------------------------------------------------------
365void G4UImanager::ForeachS(const char* valueList)
366{
367 G4String vl = valueList;
368 G4Tokenizer parameterToken(vl);
369 G4String mf = parameterToken();
370 G4String vn = parameterToken();
371 G4String c1 = parameterToken();
372 G4String ca;
373 while(!((ca = parameterToken()).empty()))
374 {
375 c1 += " ";
376 c1 += ca;
377 }
378
379 G4String aliasValue = c1;
380 if(aliasValue[0] == '"')
381 {
382 G4String strippedValue;
383 if(aliasValue.back() == '"')
384 {
385 strippedValue = aliasValue.substr(1, aliasValue.length() - 2);
386 }
387 else
388 {
389 strippedValue = aliasValue.substr(1, aliasValue.length() - 1);
390 }
391 aliasValue = strippedValue;
392 }
393
394 // Foreach(mf,vn,c1);
395 Foreach(mf, vn, aliasValue);
396}
397
398// --------------------------------------------------------------------
399void G4UImanager::Foreach(const char* macroFile, const char* variableName,
400 const char* candidates)
401{
402 G4String candidatesString = candidates;
403 G4Tokenizer parameterToken(candidatesString);
404 G4String cd;
405 while(!((cd = parameterToken()).empty()))
406 {
407 G4String vl = variableName;
408 vl += " ";
409 vl += cd;
410 SetAlias(vl);
412 if(lastRC != 0)
413 {
415 ed << "Loop aborted due to a command execution error - "
416 << "error code " << lastRC;
417 G4Exception("G4UImanager::Foreach", "UIMAN0201", JustWarning, ed);
418 break;
419 }
420 }
421}
422
423// --------------------------------------------------------------------
425{
426 G4String aCommand = aCmd;
427 G4int ia = aCommand.find("{");
428 G4int iz = aCommand.find("#");
429 while((ia != G4int(std::string::npos)) &&
430 ((iz == G4int(std::string::npos)) || (ia < iz)))
431 {
432 G4int ibx = -1;
433 while(ibx < 0)
434 {
435 G4int ib = aCommand.find("}");
436 if(ib == G4int(std::string::npos))
437 {
438 G4cerr << aCommand << G4endl;
439 for(G4int i = 0; i < ia; ++i)
440 G4cerr << " ";
441 G4cerr << "^" << G4endl;
442 G4cerr << "Unmatched alias parenthesis -- command ignored" << G4endl;
443 G4String nullStr;
444 return nullStr;
445 }
446 G4String ps = aCommand.substr(ia + 1, aCommand.length() - (ia + 1));
447 G4int ic = ps.find("{");
448 G4int id = ps.find("}");
449 if(ic != G4int(std::string::npos) && ic < id)
450 {
451 ia += ic + 1;
452 }
453 else
454 {
455 ibx = ib;
456 }
457 }
458 //--- Here ia represents the position of innermost "{"
459 //--- and ibx represents corresponding "}"
460 G4String subs;
461 if(ia > 0)
462 subs = aCommand.substr(0, ia);
463 G4String alis = aCommand.substr(ia + 1, ibx - ia - 1);
464 G4String rems = aCommand.substr(ibx + 1, aCommand.length() - ibx);
465 G4String* alVal = aliasList->FindAlias(alis);
466 if(!alVal)
467 {
468 G4cerr << "Alias <" << alis << "> not found -- command ignored" << G4endl;
469 G4String nullStr;
470 return nullStr;
471 }
472 aCommand = subs + (*alVal) + rems;
473 ia = aCommand.find("{");
474 }
475 return aCommand;
476}
477
478// --------------------------------------------------------------------
480{
481 return ApplyCommand(aCmd.data());
482}
483
484// --------------------------------------------------------------------
486{
487 G4String aCommand = SolveAlias(aCmd);
488 if(aCommand.empty())
489 return fAliasNotFound;
490 if(verboseLevel) {
492 G4cout << aCommand << G4endl;
493 }
494 G4String commandString;
495 G4String commandParameter;
496
497 std::size_t i = aCommand.find(" ");
498 if(i != std::string::npos)
499 {
500 commandString = aCommand.substr(0, i);
501 commandParameter = aCommand.substr(i + 1, aCommand.length() - (i + 1));
502 }
503 else
504 {
505 commandString = aCommand;
506 }
507
508 // remove doubled slash
509 G4int len = commandString.length();
510 G4int ll = 0;
511 G4String a1;
512 G4String a2;
513 while(ll < len - 1)
514 {
515 if(commandString.substr(ll, 2) == "//")
516 {
517 if(ll == 0)
518 {
519 // Safe because index argument always 0
520 commandString.erase(ll, 1);
521 }
522 else
523 {
524 a1 = commandString.substr(0, ll);
525 a2 = commandString.substr(ll + 1, len - ll - 1);
526 commandString = a1 + a2;
527 }
528 --len;
529 }
530 else
531 {
532 ++ll;
533 }
534 }
535
536 if(isMaster && bridges != nullptr)
537 {
538 for(auto itr = bridges->cbegin(); itr != bridges->cend(); ++itr)
539 {
540 G4int leng = (*itr)->DirLength();
541 if(commandString.substr(0, leng) == (*itr)->DirName())
542 {
543 return (*itr)->LocalUI()->ApplyCommand(commandString + " " +
544 commandParameter);
545 }
546 }
547 }
548
549 G4UIcommand* targetCommand = treeTop->FindPath(commandString);
550 if(targetCommand == nullptr)
551 {
553 {
555 {
556 commandStack->push_back(commandString + " " + commandParameter);
557 }
558 return fCommandSucceeded;
559 }
560 else
561 {
562 return fCommandNotFound;
563 }
564 }
565
566 if(stackCommandsForBroadcast && targetCommand->ToBeBroadcasted())
567 {
568 commandStack->push_back(commandString + " " + commandParameter);
569 }
570
571 if(!(targetCommand->IsAvailable()))
572 {
574 }
575
576 if(saveHistory)
577 historyFile << aCommand << G4endl;
578 if(G4int(histVec.size()) >= maxHistSize)
579 {
580 histVec.erase(histVec.begin());
581 }
582 histVec.push_back(aCommand);
583
584 targetCommand->ResetFailure();
585 G4int commandFailureCode = targetCommand->DoIt(commandParameter);
586 if(commandFailureCode == 0)
587 {
588 G4int additionalFailureCode = targetCommand->IfCommandFailed();
589 if(additionalFailureCode > 0)
590 {
592 msg << targetCommand->GetFailureDescription() << "\n"
593 << "Error code : " << additionalFailureCode;
594 G4Exception("G4UImanager::ApplyCommand", "UIMAN0123", JustWarning, msg);
595 commandFailureCode += additionalFailureCode;
596 }
597 }
598 return commandFailureCode;
599}
600
601
602// --------------------------------------------------------------------
604{
605 return FindCommand(aCmd.data());
606}
607
608// --------------------------------------------------------------------
610{
611 G4String aCommand = SolveAlias(aCmd);
612 if(aCommand.empty())
613 { return nullptr; }
614
615 G4String commandString;
616
617 std::size_t i = aCommand.find(" ");
618 if(i != std::string::npos)
619 { commandString = aCommand.substr(0, i); }
620 else
621 { commandString = aCommand; }
622
623 return treeTop->FindPath(commandString);
624}
625
626// --------------------------------------------------------------------
627void G4UImanager::StoreHistory(const char* fileName)
628{
629 StoreHistory(true, fileName);
630}
631
632// --------------------------------------------------------------------
633void G4UImanager::StoreHistory(G4bool historySwitch, const char* fileName)
634{
635 if(historySwitch)
636 {
637 if(saveHistory)
638 {
639 historyFile.close();
640 }
641 historyFile.open((char*) fileName);
642 saveHistory = true;
643 }
644 else
645 {
646 historyFile.close();
647 saveHistory = false;
648 }
649 saveHistory = historySwitch;
650}
651
652// --------------------------------------------------------------------
653void G4UImanager::PauseSession(const char* msg)
654{
655 if(session)
656 session->PauseSessionStart(msg);
657}
658
659// --------------------------------------------------------------------
660void G4UImanager::ListCommands(const char* direct)
661{
662 G4UIcommandTree* comTree = FindDirectory(direct);
663 if(comTree != nullptr)
664 {
665 comTree->List();
666 }
667 else
668 {
669 G4cout << direct << " is not found." << G4endl;
670 }
671}
672
673// --------------------------------------------------------------------
675{
676 G4String aDirName = dirName;
677 G4String targetDir = G4StrUtil::strip_copy(aDirName);
678 if(targetDir.back() != '/')
679 {
680 targetDir += "/";
681 }
682 G4UIcommandTree* comTree = treeTop;
683 if(targetDir == "/")
684 {
685 return comTree;
686 }
687 G4int idx = 1;
688 while(idx < G4int(targetDir.length()) - 1)
689 {
690 G4int i = targetDir.find("/", idx);
691 G4String targetDirString = targetDir.substr(0, i + 1);
692 comTree = comTree->GetTree(targetDirString);
693 if(comTree == nullptr)
694 {
695 return nullptr;
696 }
697 idx = i + 1;
698 }
699 return comTree;
700}
701
702// --------------------------------------------------------------------
704{
706 {
707 if(requestedState == G4State_EventProc &&
708 G4StateManager::GetStateManager()->GetPreviousState() ==
710 {
711 PauseSession("BeginOfEvent");
712 }
713 }
715 {
716 if(requestedState == G4State_GeomClosed &&
717 G4StateManager::GetStateManager()->GetPreviousState() ==
719 {
720 PauseSession("EndOfEvent");
721 }
722 }
723 return true;
724}
725
726// --------------------------------------------------------------------
728{
731}
732
733// --------------------------------------------------------------------
734void G4UImanager::SetAlias(const char* aliasLine)
735{
736 G4String aLine = aliasLine;
737 G4int i = aLine.find(" ");
738 G4String aliasName = aLine.substr(0, i);
739 G4String aliasValue = aLine.substr(i + 1, aLine.length() - (i + 1));
740 if(aliasValue[0] == '"')
741 {
742 G4String strippedValue;
743 if(aliasValue.back() == '"')
744 {
745 strippedValue = aliasValue.substr(1, aliasValue.length() - 2);
746 }
747 else
748 {
749 strippedValue = aliasValue.substr(1, aliasValue.length() - 1);
750 }
751 aliasValue = strippedValue;
752 }
753
754 aliasList->ChangeAlias(aliasName, aliasValue);
755}
756
757// --------------------------------------------------------------------
758void G4UImanager::RemoveAlias(const char* aliasName)
759{
760 G4String aL = aliasName;
761 G4String targetAlias = G4StrUtil::strip_copy(aL);
762 aliasList->RemoveAlias(targetAlias);
763}
764
765// --------------------------------------------------------------------
767{
768 aliasList->List();
769}
770
771// --------------------------------------------------------------------
772void G4UImanager::CreateHTML(const char* dir)
773{
775 if(tr != nullptr)
776 {
777 tr->CreateHTML();
778 }
779 else
780 {
781 G4cerr << "Directory <" << dir << "> is not found." << G4endl;
782 }
783}
784
785// --------------------------------------------------------------------
787{
788 searchDirs.clear();
789
790 std::size_t idxfirst = 0;
791 std::size_t idxend = 0;
792 G4String pathstring = "";
793 while((idxend = searchPath.find(':', idxfirst)) != G4String::npos)
794 {
795 pathstring = searchPath.substr(idxfirst, idxend - idxfirst);
796 if(pathstring.size() != 0)
797 searchDirs.push_back(pathstring);
798 idxfirst = idxend + 1;
799 }
800
801 pathstring = searchPath.substr(idxfirst, searchPath.size() - idxfirst);
802 if(pathstring.size() != 0)
803 searchDirs.push_back(pathstring);
804}
805
806// --------------------------------------------------------------------
808{
809 G4bool qopen = false;
810 std::ifstream fs;
811 fs.open(fname.c_str(), std::ios::in);
812 if(fs.good())
813 {
814 fs.close();
815 qopen = true;
816 }
817 return qopen;
818}
819
820// --------------------------------------------------------------------
822{
823 G4String macrofile = fname;
824
825 for(std::size_t i = 0; i < searchDirs.size(); ++i)
826 {
827 G4String fullpath = searchDirs[i] + "/" + fname;
828 if(FileFound(fullpath))
829 {
830 macrofile = fullpath;
831 break;
832 }
833 }
834 return macrofile;
835}
836
837// --------------------------------------------------------------------
838std::vector<G4String>* G4UImanager::GetCommandStack()
839{
840 std::vector<G4String>* returnValue = commandStack;
841 commandStack = new std::vector<G4String>;
842 return returnValue;
843}
844
845// --------------------------------------------------------------------
847{
848 if(brg->LocalUI() == this)
849 {
850 G4Exception("G4UImanager::RegisterBridge()", "UI7002", FatalException,
851 "G4UIBridge cannot bridge between same object.");
852 }
853 else
854 {
855 bridges->push_back(brg);
856 }
857}
858
859// --------------------------------------------------------------------
861{
862 threadID = tId;
866}
867
868// --------------------------------------------------------------------
870{
877}
878
879// --------------------------------------------------------------------
880void G4UImanager::SetCoutFileName(const G4String& fileN, G4bool ifAppend)
881{
882 // for sequential mode, ignore this method.
883 if(threadID < 0)
884 return;
885
886 if(fileN == "**Screen**")
887 {
888 threadCout->SetCoutFileName(fileN, ifAppend);
889 }
890 else
891 {
892 std::stringstream fn;
893 fn << "G4W_" << threadID << "_" << fileN;
894 threadCout->SetCoutFileName(fn.str(), ifAppend);
895 }
896}
897
898// --------------------------------------------------------------------
899void G4UImanager::SetCerrFileName(const G4String& fileN, G4bool ifAppend)
900{
901 // for sequential mode, ignore this method.
902 if(threadID < 0)
903 return;
904
905 if(fileN == "**Screen**")
906 {
907 threadCout->SetCerrFileName(fileN, ifAppend);
908 }
909 else
910 {
911 std::stringstream fn;
912 fn << "G4W_" << threadID << "_" << fileN;
913 threadCout->SetCerrFileName(fn.str(), ifAppend);
914 }
915}
916
917// --------------------------------------------------------------------
919{
920 // for sequential mode, ignore this method.
921 if(threadID < 0)
922 return;
924}
925
926// --------------------------------------------------------------------
928{
929 // for sequential mode, ignore this method.
930 if(threadID < 0)
931 return;
933}
934
935// --------------------------------------------------------------------
937{
938 // for sequential mode, ignore this method.
939 if(threadID < 0)
940 {
941 igThreadID = tid;
942 return;
943 }
945}
946
947// --------------------------------------------------------------------
949{
950 // for sequential mode, ignore this method.
951 if(threadID < 0)
952 {
953 return;
954 }
956}
G4ApplicationState
@ G4State_EventProc
@ G4State_GeomClosed
static const G4double d1
static const G4double cd
static const G4double d2
@ JustWarning
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
static constexpr double s
Definition: G4SIunits.hh:154
static constexpr double ps
Definition: G4SIunits.hh:157
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
@ fCommandNotFound
@ fAliasNotFound
@ fIllegalApplicationState
@ fCommandSucceeded
static G4bool FileFound(const G4String &fname)
Definition: G4UImanager.cc:807
void G4iosFinalization()
Definition: G4ios.cc:112
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
void G4iosInitialization()
Definition: G4ios.cc:111
G4GLOB_DLL G4strstreambuf G4coutbuf
Definition: G4ios.cc:108
G4GLOB_DLL G4strstreambuf G4cerrbuf
Definition: G4ios.cc:109
void SetPrefixString(const G4String &wd="G4WT")
void EnableBuffering(G4bool flag=true)
void SetCoutFileName(const G4String &fileN="G4cout.txt", G4bool ifAppend=true)
void SetIgnoreInit(G4bool val=true)
void SetIgnoreCout(G4int tid=0)
void SetCerrFileName(const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)
static G4StateManager * GetStateManager()
G4String * FindAlias(const char *aliasName)
void ChangeAlias(const char *aliasName, const char *aliasValue)
void RemoveAlias(const char *aliasName)
G4UImanager * LocalUI() const
Definition: G4UIbridge.hh:55
G4UIcommandTree * GetTree(G4int i)
void List() const
void AddNewCommand(G4UIcommand *newCommand, G4bool workerThreadOnly=false)
G4UIcommand * FindPath(const char *commandPath) const
void CreateHTML(G4String="")
void RemoveCommand(G4UIcommand *aCommand, G4bool workerThreadOnly=false)
std::size_t GetParameterEntries() const
Definition: G4UIcommand.hh:138
G4UIparameter * GetParameter(G4int i) const
Definition: G4UIcommand.hh:139
G4bool ToBeBroadcasted() const
Definition: G4UIcommand.hh:173
G4int IfCommandFailed()
Definition: G4UIcommand.hh:189
virtual G4int DoIt(G4String parameterList)
Definition: G4UIcommand.cc:151
void ResetFailure()
Definition: G4UIcommand.hh:191
G4bool IsAvailable()
Definition: G4UIcommand.cc:343
const G4String & GetFailureDescription()
Definition: G4UIcommand.hh:190
G4String GetCurrentValue()
Definition: G4UIcommand.cc:282
static G4bool DoublePrecisionStr()
Definition: G4UImanager.cc:158
G4ProfilerMessenger * ProfileMessenger
Definition: G4UImanager.hh:283
G4int verboseLevel
Definition: G4UImanager.hh:286
void RemoveWorkerCommand(G4UIcommand *aCommand)
Definition: G4UImanager.cc:297
void SetCerrFileName(const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)
Definition: G4UImanager.cc:899
void SetCoutDestination(G4UIsession *const value)
Definition: G4UImanager.cc:727
static void UseDoublePrecisionStr(G4bool val)
Definition: G4UImanager.cc:152
G4bool ignoreCmdNotFound
Definition: G4UImanager.hh:299
G4UIaliasList * aliasList
Definition: G4UImanager.hh:290
static G4ICOMS_DLL G4int igThreadID
Definition: G4UImanager.hh:305
G4bool fLastCommandOutputTreated
Definition: G4UImanager.hh:311
void ForeachS(const char *valueList)
Definition: G4UImanager.cc:365
void SetUpForAThread(G4int tId)
Definition: G4UImanager.cc:860
std::vector< G4String > * GetCommandStack()
Definition: G4UImanager.cc:838
void Foreach(const char *macroFile, const char *variableName, const char *candidates)
Definition: G4UImanager.cc:399
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:485
static G4ICOMS_DLL G4UImanager *& fMasterUImanager()
Definition: G4UImanager.cc:70
void SetThreadIgnoreInit(G4bool flg=true)
Definition: G4UImanager.cc:948
G4bool pauseAtEndOfEvent
Definition: G4UImanager.hh:293
void CreateHTML(const char *dir="/")
Definition: G4UImanager.cc:772
void AddWorkerCommand(G4UIcommand *newCommand)
Definition: G4UImanager.cc:281
void Loop(const char *macroFile, const char *variableName, G4double initialValue, G4double finalValue, G4double stepSize=1.0)
Definition: G4UImanager.cc:336
std::vector< G4String > * commandStack
Definition: G4UImanager.hh:301
void CreateMessenger()
Definition: G4UImanager.cc:107
G4int GetCurrentIntValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
Definition: G4UImanager.cc:231
std::vector< G4String > searchDirs
Definition: G4UImanager.hh:295
void SetThreadPrefixString(const G4String &prefix="W")
Definition: G4UImanager.cc:918
void LoopS(const char *valueList)
Definition: G4UImanager.cc:315
G4UIcommandTree * treeTop
Definition: G4UImanager.hh:277
void StoreHistory(const char *fileName="G4history.macro")
Definition: G4UImanager.cc:627
G4int maxHistSize
Definition: G4UImanager.hh:291
void ListCommands(const char *direc)
Definition: G4UImanager.cc:660
G4bool isMaster
Definition: G4UImanager.hh:297
G4double GetCurrentDoubleValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
Definition: G4UImanager.cc:258
void PauseSession(const char *msg)
Definition: G4UImanager.cc:653
G4UIcommand * savedCommand
Definition: G4UImanager.hh:285
void ExecuteMacroFile(const char *fileName)
Definition: G4UImanager.cc:303
void SetCoutFileName(const G4String &fileN="G4cout.txt", G4bool ifAppend=true)
Definition: G4UImanager.cc:880
G4UnitsMessenger * UnitsMessenger
Definition: G4UImanager.hh:281
std::vector< G4UIbridge * > * bridges
Definition: G4UImanager.hh:298
static G4UImanager * GetMasterUIpointer()
Definition: G4UImanager.cc:91
G4String savedParameters
Definition: G4UImanager.hh:284
std::ofstream historyFile
Definition: G4UImanager.hh:287
G4String GetCurrentStringValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
Definition: G4UImanager.cc:177
void SetUpForSpecialThread(G4String aPrefix)
Definition: G4UImanager.cc:869
void AddNewCommand(G4UIcommand *newCommand)
Definition: G4UImanager.cc:271
G4bool saveHistory
Definition: G4UImanager.hh:288
G4String GetCurrentValues(const char *aCommand)
Definition: G4UImanager.cc:164
virtual G4bool Notify(G4ApplicationState requestedState)
Definition: G4UImanager.cc:703
void SetThreadIgnore(G4int tid=0)
Definition: G4UImanager.cc:936
void SetAlias(const char *aliasLine)
Definition: G4UImanager.cc:734
std::vector< G4String > histVec
Definition: G4UImanager.hh:289
G4String FindMacroPath(const G4String &fname) const
Definition: G4UImanager.cc:821
G4int threadID
Definition: G4UImanager.hh:303
static G4ICOMS_DLL G4bool doublePrecisionStr
Definition: G4UImanager.hh:307
void RemoveAlias(const char *aliasName)
Definition: G4UImanager.cc:758
G4String SolveAlias(const char *aCmd)
Definition: G4UImanager.cc:424
static G4ICOMS_DLL G4UImanager *& fUImanager()
Definition: G4UImanager.cc:56
G4LocalThreadCoutMessenger * CoutMessenger
Definition: G4UImanager.hh:282
void ListAlias()
Definition: G4UImanager.cc:766
void RemoveCommand(G4UIcommand *aCommand)
Definition: G4UImanager.cc:287
G4UIcommandTree * FindDirectory(const char *dirName)
Definition: G4UImanager.cc:674
G4MTcoutDestination * threadCout
Definition: G4UImanager.hh:304
G4bool stackCommandsForBroadcast
Definition: G4UImanager.hh:300
G4UIcommand * FindCommand(const char *aCommand)
Definition: G4UImanager.cc:609
void ParseMacroSearchPath()
Definition: G4UImanager.cc:786
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
G4UIcontrolMessenger * UImessenger
Definition: G4UImanager.hh:280
void RegisterBridge(G4UIbridge *brg)
Definition: G4UImanager.cc:846
G4String searchPath
Definition: G4UImanager.hh:294
G4bool pauseAtBeginOfEvent
Definition: G4UImanager.hh:292
void SetThreadUseBuffer(G4bool flg=true)
Definition: G4UImanager.cc:927
static G4ICOMS_DLL G4bool & fUImanagerHasBeenKilled()
Definition: G4UImanager.cc:63
G4UIsession * session
Definition: G4UImanager.hh:278
const G4String & GetParameterName() const
void SetDestination(G4coutDestination *dest)
G4String strip_copy(G4String str, char c=' ')
Return copy of string with leading and trailing characters removed.
G4int G4GetThreadId()
Definition: G4Threading.cc:122
void G4SetThreadId(G4int aNewValue)
Definition: G4Threading.cc:125
string fname
Definition: test.py:308
#define G4ThreadLocalStatic
Definition: tls.hh:76