Import Geant4 1.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:28:20 +02:00
parent aaa409b6ee
commit ca1c8cb059
2995 changed files with 106830 additions and 299600 deletions
+44 -12
View File
@@ -1,19 +1,20 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// 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: G4UIWin32.hh,v 1.3 1999/05/06 15:20:37 barrand Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4UIWin32.hh,v 1.7.4.1 1999/12/07 20:49:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#ifndef G4UIWin32_h
#define G4UIWin32_h
#if defined(G4UI_BUILD_WIN32_SESSION) || defined(G4UI_USE_WIN32)
#include <rw/tvhdict.h>
#include "g4std/map"
#include "g4std/vector"
#include "G4VBasicShell.hh"
#include "G4VInteractiveSession.hh"
@@ -22,19 +23,50 @@
class G4VInteractorManager;
class G4UIWin32 : public G4VBasicShell, public G4VInteractiveSession {
public:
G4UIWin32 (HINSTANCE,HINSTANCE,LPSTR,int);
~G4UIWin32 ();
// Class description :
//
// G4UIWin32 : class to handle a Windows interactive session.
// G4UIWin32 is the Windows version of G4UIterminal.
//
// A command box is at disposal for entering/recalling Geant4 commands.
// A menubar could be customized through the AddMenu, AddButton methods.
// 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"
//
// Command completion, by typing "tab" key, is available on the
// command line.
//
// Class description - end :
class G4UIWin32 : public G4VBasicShell, public G4VInteractiveSession {
public: // With description
G4UIWin32 (HINSTANCE,HINSTANCE,LPSTR,int);
// The WinMain arguments have to be given.
G4UIsession* SessionStart ();
// To enter interactive Win32 loop ; waiting/executing command,...
void AddMenu (const char*,const char*);
// To add a pulldown menu in the menu bar.
// First argument is the name of the menu.
// Second argument is the label of the cascade button.
// Ex : AddMenu("my_menu","My menu")
void AddButton (const char*,const char*,const char*);
// To add a push button in a pulldown menu.
// First argument is the name of the menu.
// Second argument is the label of the button.
// Third argument is the Geant4 command executed when the button is fired.
// Ex : AddButton("my_menu","Run","/run/beamOn 1");
public:
~G4UIWin32 ();
void Prompt (G4String);
void SessionTerminate ();
void PauseSessionStart (G4String);
G4int ReceiveG4cout(G4String);
G4int ReceiveG4cerr(G4String);
void AddMenu (const char*,const char*);
void AddButton (const char*,const char*,const char*);
G4String GetCommand (int);
void TextAppendString(char*);
private:
@@ -46,7 +78,7 @@ private:
HWND mainWindow;
HWND textWindow,editWindow;
HMENU menuBar,defaultMenu;
RWTValHashDictionary<int,G4String> commands;
G4std::map<int,G4String, G4std::less<int> > commands;
void* textBuffer;
int textRows,textCols;
static LRESULT CALLBACK MainWindowProc(HWND,UINT,WPARAM,LPARAM);
@@ -54,7 +86,7 @@ private:
static LRESULT CALLBACK EditWindowProc(HWND,UINT,WPARAM,LPARAM);
G4bool fHelp;
G4int fHelpChoice;
RWTValOrderedVector<G4String> fHistory;
G4std::vector<G4String> fHistory;
int fHistoryPos;
};
+16 -3
View File
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// 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: G4UIXaw.hh,v 1.2 1999/04/13 01:26:24 yhajime Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4UIXaw.hh,v 1.3.4.1 1999/12/07 20:49:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#ifndef G4UIXaw_h
#define G4UIXaw_h
@@ -20,6 +20,19 @@
class G4UIsession;
class G4UImanager;
// Class description :
//
// G4UIXaw : class to handle an interactive session.
// G4UIXaw is the "Athena" version of G4UIterminal.
// It has been provided at a time where no free Motif
// where available. Now that some exists (lesstif),
// G4UIXm should be prefered. The look and feel of
// G4UIXaw is hugly...
//
// No command completion is available.
//
// Class description - end :
class G4UIXaw : public G4VBasicShell {
public:
G4UIXaw(int,char**);
+41 -9
View File
@@ -1,19 +1,19 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// 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: G4UIXm.hh,v 1.4 1999/05/11 13:26:29 barrand Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4UIXm.hh,v 1.8.4.1 1999/12/07 20:49:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#ifndef G4UIXm_h
#define G4UIXm_h
#if defined(G4UI_BUILD_XM_SESSION) || defined(G4UI_USE_XM)
#include <rw/tvhdict.h>
#include "g4std/map"
#include <X11/Intrinsic.h>
@@ -22,18 +22,50 @@
class G4UIsession;
// Class description :
//
// G4UIXm : class to handle a Motif interactive session.
// G4UIXm is the Motif version of G4UIterminal.
//
// A command box is at disposal for entering/recalling Geant4 commands.
// A menubar could be customized through the AddMenu, AddButton methods.
// 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"
//
// Command completion, by typing "tab" key, is available on the
// command line.
//
// Class description - end :
class G4UIXm : public G4VBasicShell, public G4VInteractiveSession {
public:
public: // With description
G4UIXm(int,char**);
~G4UIXm();
// (argv, argc) or (0, NULL) had to be given.
G4UIsession* SessionStart();
// To enter interactive X loop ; waiting/executing command,...
void AddMenu(const char*,const char*);
// To add a pulldown menu in the menu bar.
// First argument is the name of the menu.
// Second argument is the label of the cascade button.
// Ex : AddMenu("my_menu","My menu")
void AddButton(const char*,const char*,const char*);
// To add a push button in a pulldown menu.
// First argument is the name of the menu.
// Second argument is the label of the button.
// Third argument is the Geant4 command executed when the button is fired.
// Ex : AddButton("my_menu","Run","/run/beamOn 1");
public:
~G4UIXm();
void Prompt(G4String);
void SessionTerminate();
void PauseSessionStart(G4String);
G4int ReceiveG4cout(G4String);
G4int ReceiveG4cerr(G4String);
void AddMenu(const char*,const char*);
void AddButton(const char*,const char*,const char*);
G4String GetCommand(Widget);
private:
void SecondaryLoop(G4String);
@@ -41,7 +73,7 @@ private:
void ExitHelp();
private:
Widget form,shell,command,menuBar,text;
RWTValHashDictionary<Widget,G4String> commands;
G4std::map<Widget,G4String, G4std::less<Widget> > commands;
static void commandEnteredCallback(Widget,XtPointer,XtPointer);
static void keyHandler(Widget,XtPointer,XEvent*,Boolean*);
G4bool fHelp;
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// 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: G4UIterminal.hh,v 1.2 1999/04/13 01:26:25 yhajime Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4UIterminal.hh,v 1.3.4.1 1999/12/07 20:49:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#ifndef G4UIterminal_h
@@ -16,17 +16,31 @@
#include "G4UImanager.hh"
#include <fstream.h>
// class description:
//
// This class inherits the class G4UIsession.
// This is the class to use a character-terminal sesion.
class G4UIterminal : public G4VBasicShell
{
public:
public: // with description
G4UIterminal();
~G4UIterminal();
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;
+8 -12
View File
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// 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: G4UIWin32.cc,v 1.4 1999/05/06 15:21:00 barrand Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4UIWin32.cc,v 1.5.4.1 1999/12/07 20:49:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// G.Barrand
@@ -131,9 +131,6 @@ static G4bool ConvertStringToInt(const char*,int&);
static int actionIdentifier = 0;
static unsigned CommandsHashFun(const int& identifier) {
return (unsigned)identifier;
}
/***************************************************************************/
G4UIWin32::G4UIWin32 (
HINSTANCE a_hInstance
@@ -145,7 +142,6 @@ G4UIWin32::G4UIWin32 (
,textWindow(NULL)
,editWindow(NULL)
,menuBar(NULL)
,commands(CommandsHashFun)
,textBuffer(NULL)
,textCols(80)
,textRows(12)
@@ -575,7 +571,7 @@ LRESULT CALLBACK G4UIWin32::EditWindowProc (
exitHelp = true;
This->fHelp = ConvertStringToInt(command.data(),This->fHelpChoice);
} else {
This->fHistory.insert(command);
This->fHistory.push_back(command);
This->fHistoryPos = -1;
This->ApplyShellCommand (command,exitSession,exitPause);
}
@@ -605,8 +601,8 @@ LRESULT CALLBACK G4UIWin32::EditWindowProc (
GetParent(a_window),GWL_USERDATA);
if(This!=NULL) {
int pos = This->fHistoryPos== -1 ?
This->fHistory.entries()-1 : This->fHistoryPos-1;
if((pos>=0)&&(pos<This->fHistory.entries())) {
This->fHistory.size()-1 : This->fHistoryPos-1;
if((pos>=0)&&(pos<This->fHistory.size())) {
G4String command = This->fHistory[pos];
const char* d = command.data();
int l = strlen(d);
@@ -622,7 +618,7 @@ LRESULT CALLBACK G4UIWin32::EditWindowProc (
GetParent(a_window),GWL_USERDATA);
if(This!=NULL) {
int pos = This->fHistoryPos + 1;
if((pos>=0)&&(pos<This->fHistory.entries())) {
if((pos>=0)&&(pos<This->fHistory.size())) {
G4String command = This->fHistory[pos];
const char* d = command.data();
int l = strlen(d);
@@ -630,7 +626,7 @@ LRESULT CALLBACK G4UIWin32::EditWindowProc (
Edit_SetSel(a_window,l,l);
//
This->fHistoryPos = pos;
} else if(pos>=This->fHistory.entries()) {
} else if(pos>=This->fHistory.size()) {
Edit_SetText(a_window,"");
Edit_SetSel(a_window,0,0);
//
+3 -3
View File
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// 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: G4UIXaw.cc,v 1.2 1999/04/13 01:26:27 yhajime Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4UIXaw.cc,v 1.2.8.1 1999/12/07 20:49:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// G.Barrand
+3 -8
View File
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// 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: G4UIXm.cc,v 1.4 1999/05/11 13:26:31 barrand Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4UIXm.cc,v 1.5.4.1 1999/12/07 20:49:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// G.Barrand
@@ -52,10 +52,6 @@ static void ExecuteChangeSizeFunction(Widget);
static G4bool exitSession = true;
static G4bool exitPause = true;
static G4bool exitHelp = true;
static unsigned CommandsHashFun (const Widget& interactor) {
// Is it correct to return a pointer ?
return (unsigned)(unsigned long)interactor;
}
/***************************************************************************/
G4UIXm::G4UIXm (
int argc
@@ -65,7 +61,6 @@ G4UIXm::G4UIXm (
,command(NULL)
,menuBar(NULL)
,text(NULL)
,commands(CommandsHashFun)
,fHelp(false)
,fHelpChoice(0)
/***************************************************************************/
+65 -56
View File
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// 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: G4UIterminal.cc,v 1.2 1999/04/13 01:26:28 yhajime Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4UIterminal.cc,v 1.4.4.1.2.1 1999/12/07 20:49:09 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#include "G4UIterminal.hh"
@@ -86,7 +86,9 @@ G4int G4UIterminal::ReceiveG4cerr(G4String cerrString)
void G4UIterminal::ExecuteCommand(G4String aCommand)
{
if(aCommand.length()<2) return;
int commandStatus = UI->ApplyCommand(aCommand);
switch(commandStatus)
{
@@ -94,7 +96,7 @@ void G4UIterminal::ExecuteCommand(G4String aCommand)
break;
case fCommandNotFound:
G4cerr << "command <" << aCommand << "> not found" << endl;
if ( aCommand.index("@@") != RW_NPOS) {
if ( aCommand.index("@@") != G4std::string::npos) {
G4cout << "@@G4UIterminal" << endl;
}
break;
@@ -116,8 +118,11 @@ G4String G4UIterminal::GetCommand()
{
G4cout << promptCharacter;
G4cout.flush();
newCommand.readLine( cin );
newCommand.readLine( cin, FALSE );
if (!cin.good()) { cin.clear(); newCommand = nullString; iExit=false; break; }
newCommand = newCommand.strip(G4String::leading);
if( newCommand.length() < 1 ) { break; }
while( newCommand(newCommand.length()-1) == '_' )
{
G4String newLine;
@@ -128,72 +133,76 @@ G4String G4UIterminal::GetCommand()
}
G4String nC = newCommand.strip(G4String::leading);
// -------------------- nC.toUpper();
if( nC.length() < 1 ){ break; }
if( nC(0) == '#' )
{ G4cout << nC << endl; }
{ G4cout << nC << endl; }
else if( nC == "ls" || nC(0,3) == "ls " )
{ ListDirectory( nC ); }
{ ListDirectory( nC ); }
else if( nC == "pwd" )
{
G4cout << "Current Working Directory : "
<< GetCurrentWorkingDirectory() << endl;
}
{
G4cout << "Current Working Directory : "
<< GetCurrentWorkingDirectory() << endl;
}
else if( nC == "cd" || nC(0,3) == "cd " )
{ ChangeDirectoryCommand( nC ); }
{ ChangeDirectoryCommand( nC ); }
else if( nC == "help" || nC(0,5) == "help " )
{ TerminalHelp( nC ); }
{ TerminalHelp( nC ); }
else if( nC(0) == '?' )
{ ShowCurrent( nC ); }
{ ShowCurrent( nC ); }
else if( nC == "hist" || nC == "history" )
{
G4int nh = UI->GetNumberOfHistory();
for(int i=0;i<nh;i++)
{ G4cout << i << ": " << UI->GetPreviousCommand(i) << endl; }
}
{
G4int nh = UI->GetNumberOfHistory();
for(int i=0;i<nh;i++)
{ G4cout << i << ": " << UI->GetPreviousCommand(i) << endl; }
}
else if( nC(0) == '!' )
{
G4String ss = nC(1,nC.length()-1);
G4int vl;
const char* tt = ss;
istrstream is((char*)tt);
is >> vl;
G4int nh = UI->GetNumberOfHistory();
if(vl>=0 && vl<nh)
{
newCommand = UI->GetPreviousCommand(vl);
G4cout << newCommand << endl;
break;
}
else
{ G4cerr << "history " << vl << " is not found." << endl; }
}
{
G4String ss = nC(1,nC.length()-1);
G4int vl;
const char* tt = ss;
istrstream is((char*)tt);
is >> vl;
G4int nh = UI->GetNumberOfHistory();
if(vl>=0 && vl<nh)
{
newCommand = UI->GetPreviousCommand(vl);
G4cout << newCommand << endl;
break;
}
else
{ G4cerr << "history " << vl << " is not found." << endl; }
}
else if( nC == "exit" )
{
if( iCont )
{
G4cout << "You are now processing RUN." << endl;
G4cout << "Please abort it using \"/run/abort\" command first" << endl;
G4cout << " and use \"continue\" command until the application" << endl;
G4cout << " becomes to Idle." << endl;
}
else
{
iExit = false;
newCommand = nullString;
break;
}
}
{
if( iCont )
{
G4cout << "You are now processing RUN." << endl;
G4cout << "Please abort it using \"/run/abort\" command first" << endl;
G4cout << " and use \"continue\" command until the application" << endl;
G4cout << " becomes to Idle." << endl;
}
else
{
iExit = false;
newCommand = nullString;
break;
}
}
else if( nC == "cont" || nC == "continue" )
{
iCont = false;
newCommand = nullString;
break;
}
{
iCont = false;
newCommand = nullString;
break;
}
else
{ break; }
{ break; }
}
return ModifyToFullPathCommand(newCommand);
}
G4bool G4UIterminal::GetHelpChoice(G4int& aInt){
cin >> aInt;
if(!cin.good()){