Import Geant4 2.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:42:07 +02:00
parent 103bda00c8
commit e7d7193284
3106 changed files with 171117 additions and 90550 deletions
@@ -0,0 +1,45 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIArrayString.hh,v 1.1 2000/03/26 23:02:33 asaim Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef G4UIArrayString_h
#define G4UIArrayString_h
#include "globals.hh"
//
// Description:
// This class is a utility class for listing commands like
// UNIX "ls" command.
//
class G4UIArrayString {
private:
G4String* stringArray;
G4int nElement;
G4int nColumn;
G4String* GetElement(G4int icol, G4int irow) const;
// #rows in a column
G4int GetNRow(G4int icol) const;
// max field width of a column
G4int GetNField(G4int icol) const;
// calculate total column width
G4int CalculateColumnWidth() const;
public:
G4UIArrayString(const G4String& stream);
~G4UIArrayString();
void Show(G4int ncol);
};
#endif
+6 -6
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIWin32.hh,v 1.7.4.1 1999/12/07 20:49:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UIWin32.hh,v 1.9 2000/05/26 14:58:29 barrand Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef G4UIWin32_h
#define G4UIWin32_h
@@ -33,10 +33,10 @@ class G4VInteractorManager;
// Note that there are corresponding Geant4 commands to add a
// menus in the menubar and add buttons in a menu.
// Ex :
// /interactor/addMenu test Test
// /interactor/addButton test Init /run/initialize
// /interactor/addButton test "Set gun" "/control/execute gun.g4m"
// /interactor/addButton test "Run one event" "/run/beamOn 1"
// /gui/addMenu test Test
// /gui/addButton test Init /run/initialize
// /gui/addButton test "Set gun" "/control/execute gun.g4m"
// /gui/addButton test "Run one event" "/run/beamOn 1"
//
// Command completion, by typing "tab" key, is available on the
// command line.
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIXaw.hh,v 1.3.4.1 1999/12/07 20:49:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UIXaw.hh,v 1.4 1999/12/15 14:50:46 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef G4UIXaw_h
#define G4UIXaw_h
+6 -6
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIXm.hh,v 1.8.4.1 1999/12/07 20:49:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UIXm.hh,v 1.10 2000/05/26 14:58:30 barrand Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef G4UIXm_h
#define G4UIXm_h
@@ -32,10 +32,10 @@ class G4UIsession;
// Note that there are corresponding Geant4 commands to add a
// menus in the menubar and add buttons in a menu.
// Ex :
// /interactor/addMenu test Test
// /interactor/addButton test Init /run/initialize
// /interactor/addButton test "Set gun" "/control/execute gun.g4m"
// /interactor/addButton test "Run one event" "/run/beamOn 1"
// /gui/addMenu test Test
// /gui/addButton test Init /run/initialize
// /gui/addButton test "Set gun" "/control/execute gun.g4m"
// /gui/addButton test "Run one event" "/run/beamOn 1"
//
// Command completion, by typing "tab" key, is available on the
// command line.
@@ -0,0 +1,34 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIcsh.hh,v 1.1 2000/03/26 23:03:46 asaim Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef G4UIcsh_h
#define G4UIcsh_h
#include "G4VUIshell.hh"
//
// Description:
// This class gives csh-like shell. (same as dumb terminal)
//
class G4UIcsh : public G4VUIshell {
protected:
public:
G4UIcsh(const G4String& prompt="%s> ");
~G4UIcsh();
virtual G4String GetCommandLine();
};
#endif
+126
View File
@@ -0,0 +1,126 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UItcsh.hh,v 1.1 2000/03/26 23:03:47 asaim Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef G4UItcsh_h
#define G4UItcsh_h 1
#ifndef WIN32
#include <termios.h>
#include "g4std/vector"
#include "G4VUIshell.hh"
#include "G4UIcommand.hh"
#include "G4UIcommandTree.hh"
//
// Description:
// This class gives tcsh-like shell.
//
// If your terminal supports color code, colored strings are available
// in ListCommand(). For activating color support,
// e.g.
// tcsh-> SetLsColor(GREEN, CYAN); // (dir, command) color
//
// [key binding]
// ^A ... move cursor to the top
// ^B ... backward cursor ([LEFT])
// ^D ... delete/exit/show matched list
// ^E ... move cursor to the end
// ^F ... forward cursor ([RIGHT])
// ^K ... clear after the cursor
// ^L ... clear screen (not implemented)
// ^N ... next command ([DOWN])
// ^P ... previous command ([UP])
// TAB... command completion
// DEL... backspace
// BS ... backspace
//
// [prompt string substitution]
// %s ... current application status
// %/ ... current working directory
// %h ... history# (different from G4 history#)
//
class G4UItcsh : public G4VUIshell {
protected:
virtual void MakePrompt();
G4int cursorPosition; // cursor position
G4String commandLine; // command line string;
G4String commandLineBuf; // temp. command line;
G4bool IsCursorLast() const;
// Is cursor position at the last of command line ?
void InitializeCommandLine();
G4String ReadLine();
void InsertCharacter(char cc); // insert character
void BackspaceCharacter(); // backspace character
void DeleteCharacter(); // delete character
void ClearLine(); // clear command line
void ClearAfterCursor(); // clear after the cursor
void ClearScreen(); // clear screen
void ForwardCursor(); // move cursor forward
void BackwardCursor(); // move cursor backward
void MoveCursorTop(); // move cursor to the top
void MoveCursorEnd(); // move cursor to the end
void NextCommand(); // next command
void PreviousCommand(); // previous command
void ListMatchedCommand(); // list matched commands
void CompleteCommand(); // complete command
// utilities...
G4String GetFirstMatchedString(const G4String& str1,
const G4String& str2) const;
// history functionality (history# is managed in itself)
G4std::vector<G4String> commandHistory;
G4int maxHistory; // max# of histories stored
G4int currentHistoryNo; // global
G4int relativeHistoryIndex; // local index relative to current history#
void StoreHistory(G4String aCommand);
G4String RestoreHistory(G4int index); // index is global history#
// (re)set termios
termios tios; // terminal mode (prestatus)
G4String clearString; // "clear code (^L)"
void SetTermToInputMode();
void RestoreTerm();
public:
G4UItcsh(const G4String& prompt="%s> ", G4int maxhist=100);
~G4UItcsh();
void SetLsColor(TermColorIndex dirColor, TermColorIndex cmdColor);
virtual G4String GetCommandLine();
};
inline G4bool G4UItcsh::IsCursorLast() const
{
if(cursorPosition == commandLine.length()+1) return TRUE;
else return FALSE;
}
inline void G4UItcsh::SetLsColor(TermColorIndex dirColor,
TermColorIndex cmdColor)
{
lsColorFlag= TRUE;
directoryColor= dirColor;
commandColor= cmdColor;
}
#endif
#endif
+65 -39
View File
@@ -5,57 +5,83 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIterminal.hh,v 1.3.4.1.2.2 1999/12/14 07:07:56 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UIterminal.hh,v 1.5 2000/03/26 23:03:48 asaim Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef G4UIterminal_h
#define G4UIterminal_h 1
#include "G4VBasicShell.hh"
#include "G4UImanager.hh"
#include "g4std/fstream"
#include "G4UImanager.hh"
#include "G4VBasicShell.hh"
#include "G4VUIshell.hh"
// class description:
//
// This class inherits the class G4UIsession.
// This is the class to use a character-terminal sesion.
// Description:
//
// This class inherits the class G4UIsession.
// This is the class to use a character-terminal sesion.
//
// Usage:
// G4UIsession* terminalSession = new G4UIterminal;
// or G4UIsession* terminalSession = new G4UIterminal(new your-shell);
//
// A character-terminal session "terminalSession" is instantiated.
// G4cout stream is redirected by default to the constructed instance.
//
// terminalSession-> SessionStart(); // "terminalSession" is started.
// delete terminalSession; // "terminalSession" is deleted.
//
//
// In default(no arguments are given), csh-like shell is instantiated.
// If you want to use another shell (e.g. tcsh-like), you can give
// your favorite shell in an argument of the constructor.
//
// Which shell? / How to define your own shell?
// Currently two kinds of shells,
// G4UIcsh / G4UItcsh
// , are presented.
// They inherit the abstract base class, G4VUIshell.
// In order to define your own shell,
// - Define your own shell class derived from G4VUIshell.
// - Implement GetCommandLine() method (pure virtual).
// - Add more functionality, if need.
//
// For more detail, see source codes.
//
class G4UIterminal : public G4VBasicShell
{
public: // with description
G4UIterminal();
~G4UIterminal();
class G4UIterminal : public G4VBasicShell {
private:
G4UImanager* UI;
// shell
G4VUIshell* shell;
G4UIsession * SessionStart();
// A character-terminal session "terminalSession" is instantiated.
// G4cout stream is redirected by default to the constructed instance.
// Usage: G4UIsession * terminalSession = new G4UIterminal;
// "terminalSession" is started.
// Usage: terminalSession->SessionStart();
// "terminalSession" is deleted.
// Usage: delete terminalSession;
//
void PauseSessionStart(G4String);
G4int ReceiveG4cout(G4String coutString);
G4int ReceiveG4cerr(G4String cerrString);
// These methods are implementation of corresponding virtual methods
// of G4UIsession class.
private:
G4UImanager * UI;
G4String promptCharacter;
G4bool iExit;
G4bool iCont;
// program states
G4bool iExit;
G4bool iCont;
public:
G4UIterminal(G4VUIshell* aShell=0);
~G4UIterminal();
void SetPrompt(const G4String& prompt);
private:
void ExecuteCommand(G4String aCommand);
G4String GetCommand();
G4bool GetHelpChoice(G4int& aInt);
void ExitHelp();
public:
// These methods are implementation of corresponding virtual methods
// of G4UIsession class.
virtual G4UIsession* SessionStart();
virtual void PauseSessionStart(G4String msg);
virtual G4int ReceiveG4cout(G4String coutString);
virtual G4int ReceiveG4cerr(G4String cerrString);
private:
void ExecuteCommand(G4String);
G4String GetCommand();
G4bool GetHelpChoice(G4int&);
void ExitHelp();
};
#endif
@@ -0,0 +1,102 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VUIshell.hh,v 1.1 2000/03/26 23:03:48 asaim Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef G4VUIshell_h
#define G4VUIshell_h 1
#include "globals.hh"
//
// Description:
// This class is the abstract base class for various UI shells.
//
// GetCommadLine() (virtual) returns a command string input from
// a commad line.
//
// Two pre-inplemented shell commands(still virtual) are also included,
// (somewhat differnt flavor from ones provided by G4VBasicShell)
// ShowCurrentDirectory() ... show current directory
// ListCommand() ... list commands
//
// [prompt string substitution] (default)
// %s ... current application status
// %/ ... current working directory
//
// terminal color index
enum TermColorIndex{ BLACK=0, RED, GREEN, YELLOW,
BLUE, PURPLE, CYAN, WHITE};
class G4UIcommandTree;
class G4VUIshell {
protected:
G4String promptString;
G4String promptSetting; // including %-directive
virtual void MakePrompt(); // make prompt string
G4int nColumn; // column size of terminal (default=80)
// color code support (effective if your terminal supports color code.)
// default setting is off.
G4bool lsColorFlag; // color flag for list command
TermColorIndex directoryColor;
TermColorIndex commandColor;
// for treating G4 command tree...
G4String currentCommandDir; // current command directory (absolute path)
// get tree node
G4UIcommandTree* GetCommandTree(const G4String& dir) const;
// absolute path name (ignore command)
G4String GetAbsCommandDirPath(const G4String& apath) const;
// tail of path ( xxx/xxx/zzz -> zzz, trancated //// -> /)
G4String GetCommandPathTail(const G4String& apath) const;
public:
G4VUIshell(const G4String& prompt="> ");
~G4VUIshell();
void SetNColumn(G4int ncol);
void SetPrompt(const G4String& prompt);
void SetCurrentDirectory(const G4String& ccd);
// shell commands
virtual void ShowCurrentDirectory() const;
virtual void ListCommand(const G4String& input,
const G4String& candidate="") const;
// "candidate" is specified with full path.
// get command string from a command line
virtual G4String GetCommandLine()= 0;
};
// inlines...
inline void G4VUIshell::SetNColumn(G4int ncol)
{
nColumn= ncol;
}
inline void G4VUIshell::SetPrompt(const G4String& prompt)
{
promptSetting= prompt;
}
inline void G4VUIshell::SetCurrentDirectory(const G4String& dir)
{
currentCommandDir= dir;
}
inline void G4VUIshell::ShowCurrentDirectory() const
{
G4cout << currentCommandDir << G4endl;
}
#endif