Import Geant4 10.0.0 source tree
This commit is contained in:
@@ -40,83 +40,90 @@
|
||||
#include "UltraRunAction.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "UltraRunActionMessenger.hh"
|
||||
#include "Randomize.hh"
|
||||
#ifdef G4ANALYSIS_USE
|
||||
#include "UltraAnalysisManager.hh"
|
||||
#endif
|
||||
|
||||
#include <ctime>
|
||||
#include "Randomize.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
|
||||
// //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
UltraRunAction::UltraRunAction()
|
||||
{
|
||||
|
||||
G4int seed = 1; // RANLUX seed
|
||||
G4int luxury = 3; // RANLUX luxury level (3 is default)
|
||||
CLHEP::HepRandom::setTheSeed(seed,luxury);
|
||||
CLHEP::HepRandom::showEngineStatus();
|
||||
|
||||
theRunActMessenger = new UltraRunActionMessenger(this);
|
||||
seed = -1; // RANLUX seed
|
||||
luxury = 3; // RANLUX luxury level (3 is default)
|
||||
saveRndm = 1;
|
||||
}
|
||||
|
||||
// //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
UltraRunAction::~UltraRunAction()
|
||||
{
|
||||
delete theRunActMessenger;
|
||||
}
|
||||
{;}
|
||||
|
||||
// //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void UltraRunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
// Get/create analysis manager: need to do that in the master and in the workers
|
||||
G4AnalysisManager* man = G4AnalysisManager::Instance();
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
UltraAnalysisManager* analysis = UltraAnalysisManager::getInstance();
|
||||
analysis->book();
|
||||
#endif
|
||||
// Open an output file
|
||||
man->OpenFile("ultra");
|
||||
man->SetFirstHistoId(1);
|
||||
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start..." << G4endl;
|
||||
// Create histogram(s)
|
||||
man->CreateH1("1","Optical photons energy (eV)", //histoID,histo name
|
||||
500,0.,5.); //bins' number, xmin, xmax
|
||||
man->CreateH1("2","Number of Detected Photons",
|
||||
10,0.,10.); //bins' number, xmin, xmax
|
||||
|
||||
// save Rndm status
|
||||
if (saveRndm > 0)
|
||||
{ CLHEP::HepRandom::showEngineStatus();
|
||||
CLHEP::HepRandom::saveEngineStatus("beginOfRun.rndm");
|
||||
if (!IsMaster()) //it is a slave, do nothing else
|
||||
{
|
||||
G4cout << "ooo Run " << aRun->GetRunID() << " starts on slave." << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
//Master or sequential
|
||||
G4cout << "ooo Run " << aRun->GetRunID() << " starts (global)." << G4endl;
|
||||
if (seed<0) //not initialized by anybody else
|
||||
{
|
||||
seed=time(0);
|
||||
G4Random::setTheSeed(seed,luxury);
|
||||
G4Random::showEngineStatus();
|
||||
}
|
||||
|
||||
// save Rndm status
|
||||
if (saveRndm > 0)
|
||||
G4Random::saveEngineStatus("beginOfRun.rndm");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void UltraRunAction::EndOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
// Write histograms to file
|
||||
|
||||
|
||||
// save Rndm status
|
||||
if (saveRndm == 1)
|
||||
{ CLHEP::HepRandom::showEngineStatus();
|
||||
CLHEP::HepRandom::saveEngineStatus("endOfRun.rndm");
|
||||
// Save histograms
|
||||
G4AnalysisManager* man = G4AnalysisManager::Instance();
|
||||
man->Write();
|
||||
man->CloseFile();
|
||||
// Complete clean-up
|
||||
delete G4AnalysisManager::Instance();
|
||||
|
||||
if (!IsMaster())
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " (slave) ended." << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// Write histograms to file
|
||||
G4cout << "Close and Save Histograms" << G4endl;
|
||||
G4cout << "### Run " << aRun->GetRunID() << " ended." << G4endl;
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
UltraAnalysisManager* analysis = UltraAnalysisManager::getInstance();
|
||||
analysis->finish();
|
||||
#endif
|
||||
|
||||
G4cout << "### Run " << aRun->GetRunID() << " (global) ended." << G4endl;
|
||||
// save Rndm status
|
||||
if (saveRndm == 1)
|
||||
G4Random::saveEngineStatus("endOfRun.rndm");
|
||||
return;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void UltraRunAction::MySetRunID(G4int myrun)
|
||||
{
|
||||
runID = myrun ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user