Import Geant4 3.0.0 source tree
This commit is contained in:
@@ -1,159 +0,0 @@
|
||||
// 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: G4StateManager.cc,v 1.3 2000/02/14 12:24:42 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD group
|
||||
// ---------------- G4StateManager ----------------
|
||||
// by Gabriele Cosmo, November 1996
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#include "G4StateManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
// Initialization of the static pointer of the single class instance
|
||||
G4StateManager* G4StateManager::theStateManager = 0;
|
||||
|
||||
G4StateManager::G4StateManager()
|
||||
:theCurrentState(PreInit),thePreviousState(PreInit) {;}
|
||||
|
||||
G4StateManager::~G4StateManager()
|
||||
{
|
||||
theDependentsList.clearAndDestroy();
|
||||
}
|
||||
|
||||
G4StateManager::G4StateManager(const G4StateManager &right)
|
||||
{
|
||||
*this = right;
|
||||
}
|
||||
|
||||
G4StateManager& G4StateManager::operator=(const G4StateManager &right)
|
||||
{
|
||||
*this = right;
|
||||
return *this;
|
||||
}
|
||||
|
||||
G4int G4StateManager::operator==(const G4StateManager &right) const
|
||||
{
|
||||
return (this == (G4StateManager *) &right);
|
||||
}
|
||||
|
||||
G4int G4StateManager::operator!=(const G4StateManager &right) const
|
||||
{
|
||||
return (this != (G4StateManager *) &right);
|
||||
}
|
||||
|
||||
|
||||
G4StateManager* G4StateManager::GetStateManager()
|
||||
{
|
||||
if (!theStateManager)
|
||||
{
|
||||
theStateManager = new G4StateManager;
|
||||
}
|
||||
return theStateManager;
|
||||
}
|
||||
|
||||
G4bool G4StateManager::RegisterDependent(G4VStateDependent* aDependent)
|
||||
{
|
||||
G4bool ack=true;
|
||||
theDependentsList.insert(aDependent);
|
||||
return ack;
|
||||
}
|
||||
|
||||
G4bool G4StateManager::DeregisterDependent(G4VStateDependent* aDependent)
|
||||
{
|
||||
G4VStateDependent* aD = theDependentsList.remove(aDependent);
|
||||
return (aD != NULL);
|
||||
}
|
||||
|
||||
G4ApplicationState G4StateManager::GetCurrentState()
|
||||
{
|
||||
return theCurrentState;
|
||||
}
|
||||
|
||||
G4ApplicationState G4StateManager::GetPreviousState()
|
||||
{
|
||||
return thePreviousState;
|
||||
}
|
||||
|
||||
G4bool G4StateManager::SetNewState(G4ApplicationState requestedState)
|
||||
{
|
||||
G4int i=0;
|
||||
G4bool ack = true;
|
||||
G4ApplicationState savedState = thePreviousState;
|
||||
thePreviousState = theCurrentState;
|
||||
theCurrentState = requestedState;
|
||||
while ((ack) && (i<theDependentsList.entries())) {
|
||||
ack = theDependentsList(i)->Notify(requestedState);
|
||||
i++;
|
||||
}
|
||||
|
||||
if(!ack)
|
||||
{
|
||||
theCurrentState = thePreviousState;
|
||||
thePreviousState = savedState;
|
||||
}
|
||||
return ack;
|
||||
}
|
||||
|
||||
G4VStateDependent* G4StateManager::RemoveDependent(const G4VStateDependent* aDependent)
|
||||
{
|
||||
return theDependentsList.remove(aDependent);
|
||||
}
|
||||
|
||||
G4String G4StateManager::GetStateString(G4ApplicationState aState)
|
||||
{
|
||||
G4String stateName;
|
||||
switch(aState)
|
||||
{
|
||||
case PreInit:
|
||||
stateName = "PreInit"; break;
|
||||
case Init:
|
||||
stateName = "Init"; break;
|
||||
case Idle:
|
||||
stateName = "Idle"; break;
|
||||
case GeomClosed:
|
||||
stateName = "GeomClosed"; break;
|
||||
case EventProc:
|
||||
stateName = "EventProc"; break;
|
||||
case Quit:
|
||||
stateName = "Quit"; break;
|
||||
default:
|
||||
stateName = "Unknown";
|
||||
}
|
||||
return stateName;
|
||||
}
|
||||
|
||||
void G4StateManager::Pause()
|
||||
{
|
||||
Pause("G4_pause> ");
|
||||
}
|
||||
|
||||
void G4StateManager::Pause(const char* msg)
|
||||
{
|
||||
G4String msgS = msg;
|
||||
Pause(msgS);
|
||||
}
|
||||
|
||||
void G4StateManager::Pause(G4String msg)
|
||||
{
|
||||
G4UImanager::GetUIpointer()->PauseSession(msg);
|
||||
// if(theCurrentState==EventProc)
|
||||
// {
|
||||
// G4ApplicationState savedState = thePreviousState;
|
||||
// SetNewState(Pause);
|
||||
// theCurrentState = thePreviousState;
|
||||
// thePreviousState = savedState;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIbatch.cc,v 1.2 1999/12/15 14:50:40 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
|
||||
#include "G4UIbatch.hh"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIcmdWith3Vector.cc,v 1.2 1999/12/15 14:50:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIcmdWith3VectorAndUnit.cc,v 1.2 1999/12/15 14:50:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIcmdWithABool.cc,v 1.2 1999/12/15 14:50:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIcmdWithADouble.cc,v 1.2 1999/12/15 14:50:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIcmdWithADoubleAndUnit.cc,v 1.2 1999/12/15 14:50:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIcmdWithAString.cc,v 1.2 1999/12/15 14:50:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIcmdWithAnInteger.cc,v 1.2 1999/12/15 14:50:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIcmdWithoutParameter.cc,v 1.2 1999/12/15 14:50:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIcommand.cc,v 1.5 1999/12/15 14:50:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIcommandTree.cc,v 1.4 2000/02/14 12:24:42 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
|
||||
#include "G4UIcommandTree.hh"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIcontrolMessenger.cc,v 1.2 1999/12/15 14:50:42 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
|
||||
#include "G4UIcontrolMessenger.hh"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIdirectory.cc,v 1.2 1999/12/15 14:50:42 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UImanager.cc,v 1.5 2000/02/14 08:41:25 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// $Id: G4UImanager.cc,v 1.6 2000/07/22 10:49:38 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "G4UnitsMessenger.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4strstreambuf.hh"
|
||||
#include "G4StateManager.hh"
|
||||
|
||||
#include "g4std/strstream"
|
||||
|
||||
@@ -40,8 +41,10 @@ G4UImanager * G4UImanager::GetUIpointer()
|
||||
return fUImanager;
|
||||
}
|
||||
|
||||
G4UImanager::G4UImanager():savedCommand(NULL)
|
||||
G4UImanager::G4UImanager()
|
||||
:G4VStateDependent(true)
|
||||
{
|
||||
savedCommand = 0;
|
||||
treeTop = new G4UIcommandTree("/");
|
||||
G4String nullString;
|
||||
savedParameters = nullString;
|
||||
@@ -49,6 +52,8 @@ G4UImanager::G4UImanager():savedCommand(NULL)
|
||||
saveHistory = false;
|
||||
session = NULL;
|
||||
SetCoutDestination(session);
|
||||
pauseAtBeginOfEvent = false;
|
||||
pauseAtEndOfEvent = false;
|
||||
}
|
||||
|
||||
void G4UImanager::CreateMessenger()
|
||||
@@ -288,6 +293,24 @@ G4UIcommandTree* G4UImanager::FindDirectory(const char* dirName)
|
||||
return comTree;
|
||||
}
|
||||
|
||||
G4bool G4UImanager::Notify(G4ApplicationState requestedState)
|
||||
{
|
||||
//G4cout << G4StateManager::GetStateManager()->GetStateString(requestedState) << " <--- " << G4StateManager::GetStateManager()->GetStateString(G4StateManager::GetStateManager()->GetPreviousState()) << G4endl;
|
||||
if(pauseAtBeginOfEvent)
|
||||
{
|
||||
if(requestedState==EventProc &&
|
||||
G4StateManager::GetStateManager()->GetPreviousState()==GeomClosed)
|
||||
{ PauseSession("BeginOfEvent"); }
|
||||
}
|
||||
if(pauseAtEndOfEvent)
|
||||
{
|
||||
if(requestedState==GeomClosed &&
|
||||
G4StateManager::GetStateManager()->GetPreviousState()==EventProc)
|
||||
{ PauseSession("EndOfEvent"); }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void G4UImanager::Interact()
|
||||
{
|
||||
Interact(G4String("G4> "));
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UImessenger.cc,v 1.2 1999/12/15 14:50:42 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIparameter.cc,v 1.4 1999/12/15 14:50:42 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
|
||||
#include "G4UIparameter.hh"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIsession.cc,v 1.3 1999/12/15 17:52:03 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UnitsMessenger.cc,v 1.2 1999/12/15 14:50:42 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VGlobalFastSimulationManager.cc,v 1.2 1999/12/15 14:50:42 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
// Abstract interface for GEANT4 Global Fast Simulation Manager.
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
// 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: G4VStateDependent.cc,v 1.2 1999/12/15 14:50:42 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD group
|
||||
// ---------------- G4VStateDependent ----------------
|
||||
// by Gabriele Cosmo, November 1996
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#include "G4VStateDependent.hh"
|
||||
#include "G4StateManager.hh"
|
||||
|
||||
G4VStateDependent::G4VStateDependent()
|
||||
{
|
||||
G4StateManager * stateManager = G4StateManager::GetStateManager();
|
||||
stateManager->RegisterDependent(this);
|
||||
}
|
||||
|
||||
G4VStateDependent::~G4VStateDependent()
|
||||
{
|
||||
G4StateManager * stateManager = G4StateManager::GetStateManager();
|
||||
stateManager->DeregisterDependent(this);
|
||||
}
|
||||
|
||||
G4VStateDependent::G4VStateDependent(const G4VStateDependent &right)
|
||||
{
|
||||
*this = right;
|
||||
}
|
||||
|
||||
G4VStateDependent& G4VStateDependent::operator=(const G4VStateDependent &right)
|
||||
{
|
||||
*this = right;
|
||||
return *this;
|
||||
}
|
||||
|
||||
G4int G4VStateDependent::operator==(const G4VStateDependent &right) const
|
||||
{
|
||||
return (this == (G4VStateDependent *) &right);
|
||||
}
|
||||
|
||||
G4int G4VStateDependent::operator!=(const G4VStateDependent &right) const
|
||||
{
|
||||
return (this != (G4VStateDependent *) &right);
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VVisManager.cc,v 1.3 1999/12/15 14:50:42 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
// Abstract interface for GEANT4 Visualization Manager.
|
||||
|
||||
Reference in New Issue
Block a user