Import Geant4 1.0.0 source tree
This commit is contained in:
@@ -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: G4Run.cc,v 1.1 1999/01/07 16:14:17 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4Run.cc,v 1.1.10.1 1999/12/07 20:52:59 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#include "G4Run.hh"
|
||||
|
||||
@@ -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: G4RunManager.cc,v 1.5 1999/05/17 16:17:44 stesting Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4RunManager.cc,v 1.10.2.1 1999/12/07 20:52:59 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunMessenger.hh"
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
@@ -36,6 +37,12 @@
|
||||
#include "G4VVisManager.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
#ifdef WIN32
|
||||
# include <Strstrea.h>
|
||||
#else
|
||||
# include <strstream.h>
|
||||
#endif
|
||||
|
||||
|
||||
G4RunManager* G4RunManager::fRunManager = NULL;
|
||||
|
||||
@@ -44,12 +51,14 @@ G4RunManager* G4RunManager::GetRunManager()
|
||||
|
||||
G4RunManager::G4RunManager()
|
||||
:userDetector(NULL),physicsList(NULL),
|
||||
userRunAction(NULL),userPrimaryGeneratorAction(NULL),
|
||||
userRunAction(NULL),userPrimaryGeneratorAction(NULL),userEventAction(NULL),
|
||||
userStackingAction(NULL),userTrackingAction(NULL),userSteppingAction(NULL),
|
||||
currentRun(NULL),currentEvent(NULL),n_perviousEventsToBeStored(0),
|
||||
geometryInitialized(false),physicsInitialized(false),cutoffInitialized(false),
|
||||
geometryNeedsToBeClosed(true),initializedAtLeastOnce(false),
|
||||
runAborted(false),pauseAtBeginOfEvent(false),pauseAtEndOfEvent(false),
|
||||
geometryToBeOptimized(true),verboseLevel(0),DCtable(NULL),runIDCounter(0)
|
||||
geometryToBeOptimized(true),verboseLevel(0),DCtable(NULL),runIDCounter(0),
|
||||
storeRandomNumberStatus(0)
|
||||
{
|
||||
if(fRunManager)
|
||||
{ G4Exception("G4RunManager constructed twice."); }
|
||||
@@ -58,9 +67,15 @@ G4RunManager::G4RunManager()
|
||||
eventManager = new G4EventManager();
|
||||
timer = new G4Timer();
|
||||
runMessenger = new G4RunMessenger(this);
|
||||
previousEvents = new RWTPtrOrderedVector<G4Event>;
|
||||
previousEvents = new G4RWTPtrOrderedVector<G4Event>;
|
||||
G4ParticleTable::GetParticleTable()->CreateMessenger();
|
||||
G4ProcessTable::GetProcessTable()->CreateMessenger();
|
||||
G4cout
|
||||
<< "**********************************************" << endl
|
||||
<< " Geant4 version $Name: geant4-01-00 $" << endl
|
||||
<< " (07-Dec-99)" << endl
|
||||
<< " Copyright : Geant4 Collaboration" << endl
|
||||
<< "**********************************************" << endl;
|
||||
}
|
||||
|
||||
G4RunManager::~G4RunManager()
|
||||
@@ -188,6 +203,9 @@ void G4RunManager::RunInitialization()
|
||||
{ previousEvents->insert((G4Event*)NULL); }
|
||||
|
||||
runAborted = false;
|
||||
|
||||
if(storeRandomNumberStatus==1 || storeRandomNumberStatus==-1) StoreRandomNumberStatus();
|
||||
|
||||
if(verboseLevel>0) G4cout << "Start Run processing." << endl;
|
||||
}
|
||||
|
||||
@@ -212,6 +230,7 @@ void G4RunManager::DoEventLoop(G4int n_event,const char* macroFile,G4int n_selec
|
||||
for( i_event=0; i_event<n_event; i_event++ )
|
||||
{
|
||||
stateManager->SetNewState(EventProc);
|
||||
|
||||
if(pauseAtBeginOfEvent) stateManager->Pause("BeginOfEvent");
|
||||
|
||||
currentEvent = GenerateEvent(i_event);
|
||||
@@ -248,7 +267,11 @@ G4Event* G4RunManager::GenerateEvent(G4int i_event)
|
||||
G4Exception
|
||||
("G4RunManager::BeamOn - G4VUserPrimaryGeneratorAction is not defined.");
|
||||
}
|
||||
|
||||
G4Event* anEvent = new G4Event(i_event);
|
||||
|
||||
if(storeRandomNumberStatus==2 || storeRandomNumberStatus==-2) StoreRandomNumberStatus(anEvent->GetEventID());
|
||||
|
||||
userPrimaryGeneratorAction->GeneratePrimaries(anEvent);
|
||||
return anEvent;
|
||||
}
|
||||
@@ -376,7 +399,33 @@ void G4RunManager::DefineWorldVolume(G4VPhysicalVolume* worldVol)
|
||||
geometryNeedsToBeClosed = true;
|
||||
}
|
||||
|
||||
|
||||
void G4RunManager::StoreRandomNumberStatus(G4int eventID)
|
||||
{
|
||||
G4String fileN = "RandEngine";
|
||||
if(storeRandomNumberStatus>0 && currentRun != NULL)
|
||||
{
|
||||
char st[20];
|
||||
ostrstream os(st,20);
|
||||
os << currentRun->GetRunID() << '\0';
|
||||
fileN += "R";
|
||||
fileN += st;
|
||||
}
|
||||
if(storeRandomNumberStatus==2 && eventID>=0)
|
||||
{
|
||||
char st[20];
|
||||
ostrstream os(st,20);
|
||||
os << eventID << '\0';
|
||||
fileN += "E";
|
||||
fileN += st;
|
||||
}
|
||||
fileN += ".stat";
|
||||
HepRandom::saveEngineStatus(fileN);
|
||||
}
|
||||
|
||||
void G4RunManager::RestoreRandomNumberStatus(G4String fileN)
|
||||
{
|
||||
HepRandom::restoreEngineStatus(fileN);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,18 +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: G4RunMessenger.cc,v 1.1 1999/01/07 16:14:18 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4RunMessenger.cc,v 1.4.8.1 1999/12/07 20:52:59 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#include "G4RunMessenger.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
@@ -105,6 +106,36 @@ G4RunMessenger::G4RunMessenger(G4RunManager * runMgr)
|
||||
cutCmd->SetGuidance(" if cutoff value(s) have been modified after the");
|
||||
cutCmd->SetGuidance(" first initialization (or BeamOn).");
|
||||
cutCmd->AvailableForStates(PreInit,Idle);
|
||||
|
||||
storeRandCmd = new G4UIcmdWithAnInteger("/run/storeRandomNumberStatus",this);
|
||||
storeRandCmd->SetGuidance("Store the status of the random number engine to a file.");
|
||||
storeRandCmd->SetGuidance("See CLHEP manual for detail.");
|
||||
storeRandCmd->SetGuidance("Frequency : 0 - not stored");
|
||||
storeRandCmd->SetGuidance(" 1 - begining of each run");
|
||||
storeRandCmd->SetGuidance(" -1 - begining of each run (file overwritten)");
|
||||
storeRandCmd->SetGuidance(" 2 - begining of each event before generating primaries");
|
||||
storeRandCmd->SetGuidance(" -2 - begining of each event before generating primaries (file overwritten)");
|
||||
storeRandCmd->SetGuidance("Stored status can be restored by ");
|
||||
storeRandCmd->SetGuidance(" /run/restoreRandomNumberStatus command.");
|
||||
storeRandCmd->SetGuidance("In case Frequency is negative, a output file (file name RandEngine.stat)");
|
||||
storeRandCmd->SetGuidance(" is overwitten every time.");
|
||||
storeRandCmd->SetGuidance("In case Frequency is 1, file names are RandEngineRxxx.stat,");
|
||||
storeRandCmd->SetGuidance(" where xxx is the run number.");
|
||||
storeRandCmd->SetGuidance("In case Frequency is 2, file names are RandEngineRxxxEyyy.stat,");
|
||||
storeRandCmd->SetGuidance(" where xxx is the run number and yyy is the event number.");
|
||||
storeRandCmd->AvailableForStates(PreInit,Idle);
|
||||
storeRandCmd->SetParameterName("frequency",true);
|
||||
storeRandCmd->SetDefaultValue(1);
|
||||
storeRandCmd->SetRange("frequency >=-2 && frequency <=2");
|
||||
|
||||
restoreRandCmd = new G4UIcmdWithAString("/run/restoreRandomNumberStatus",this);
|
||||
restoreRandCmd->SetGuidance("Restore the status of the random number engine from a file.");
|
||||
restoreRandCmd->SetGuidance("See CLHEP manual for detail.");
|
||||
restoreRandCmd->SetGuidance("The engine status must be stored beforehand.");
|
||||
restoreRandCmd->SetParameterName("fileName",true);
|
||||
restoreRandCmd->SetDefaultValue("RandEngine.stat");
|
||||
restoreRandCmd->AvailableForStates(PreInit,Idle,GeomClosed);
|
||||
|
||||
}
|
||||
|
||||
G4RunMessenger::~G4RunMessenger()
|
||||
@@ -118,6 +149,8 @@ G4RunMessenger::~G4RunMessenger()
|
||||
delete initCmd;
|
||||
delete geomCmd;
|
||||
delete cutCmd;
|
||||
delete storeRandCmd;
|
||||
delete restoreRandCmd;
|
||||
delete runDirectory;
|
||||
}
|
||||
|
||||
@@ -151,6 +184,10 @@ void G4RunMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{ runManager->GeometryHasBeenModified(); }
|
||||
else if( command==cutCmd )
|
||||
{ runManager->CutOffHasBeenModified(); }
|
||||
else if( command==storeRandCmd )
|
||||
{ runManager->SetRandomNumberStore(storeRandCmd->GetNewIntValue(newValue)); }
|
||||
else if( command==restoreRandCmd )
|
||||
{ runManager->RestoreRandomNumberStatus(newValue); }
|
||||
}
|
||||
|
||||
G4String G4RunMessenger::GetCurrentValue(G4UIcommand * command)
|
||||
@@ -159,6 +196,8 @@ G4String G4RunMessenger::GetCurrentValue(G4UIcommand * command)
|
||||
|
||||
if( command==verboseCmd )
|
||||
{ cv = verboseCmd->ConvertToString(runManager->GetVerboseLevel()); }
|
||||
else if( command==storeRandCmd )
|
||||
{ cv = storeRandCmd->ConvertToString(runManager->GetRandomNumberStore()); }
|
||||
|
||||
return cv;
|
||||
}
|
||||
|
||||
@@ -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: G4UserPhysicsListMessenger.cc,v 1.2 1999/04/14 10:45:58 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4UserPhysicsListMessenger.cc,v 1.2.8.1 1999/12/07 20:52:59 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -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: G4UserRunAction.cc,v 1.2 1999/04/09 02:28:10 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4UserRunAction.cc,v 1.2.8.1 1999/12/07 20:53:00 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
|
||||
@@ -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: G4VPersistencyManager.cc,v 1.1 1999/01/07 16:14:19 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4VPersistencyManager.cc,v 1.1.10.1 1999/12/07 20:53:00 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#include "G4VPersistencyManager.hh"
|
||||
|
||||
@@ -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: G4VUserDetectorConstruction.cc,v 1.1 1999/01/07 16:14:19 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4VUserDetectorConstruction.cc,v 1.1.10.1 1999/12/07 20:53:00 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
|
||||
@@ -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: G4VUserPhysicsList.cc,v 1.7 1999/05/21 04:25:47 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4VUserPhysicsList.cc,v 1.7.8.1 1999/12/07 20:53:00 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -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: G4VUserPrimaryGeneratorAction.cc,v 1.1 1999/01/07 16:14:19 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4VUserPrimaryGeneratorAction.cc,v 1.1.10.1 1999/12/07 20:53:00 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
|
||||
Reference in New Issue
Block a user