47 lines
1.4 KiB
C++
47 lines
1.4 KiB
C++
#include "GeneRunAction.hh"
|
|
|
|
#include "G4Run.hh"
|
|
#include "G4SystemOfUnits.hh"
|
|
#include "G4UImanager.hh"
|
|
#include "G4VVisManager.hh"
|
|
#include "G4ios.hh"
|
|
#include "GeneAnalysisManager.hh"
|
|
#include "GeneRunActionMessenger.hh"
|
|
|
|
#define ANALYSIS_USE
|
|
GeneRunAction::GeneRunAction() : G4UserRunAction() {
|
|
RunNo = "00";
|
|
pMessenger = new GeneRunActionMessenger(this);
|
|
}
|
|
|
|
GeneRunAction::~GeneRunAction() { delete pMessenger; }
|
|
|
|
void GeneRunAction::BeginOfRunAction(const G4Run*) {
|
|
// Prepare the visualization
|
|
if (G4VVisManager::GetConcreteInstance()) {
|
|
G4UImanager* UI = G4UImanager::GetUIpointer();
|
|
UI->ApplyCommand("/vis/scene/notifyHandlers");
|
|
}
|
|
|
|
#ifdef ANALYSIS_USE
|
|
GeneAnalysisManager* analysisManager = GeneAnalysisManager::GetInstance();
|
|
G4String sFileName = "Simulation_RunNo" + RunNo + ".root";
|
|
analysisManager->SetAnalysisFileName(sFileName);
|
|
// Open an output file
|
|
analysisManager->book();
|
|
#endif
|
|
}
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|
|
|
void GeneRunAction::EndOfRunAction(const G4Run*) {
|
|
// Run ended, update the visualization
|
|
if (G4VVisManager::GetConcreteInstance()) {
|
|
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
|
|
}
|
|
|
|
#ifdef ANALYSIS_USE
|
|
GeneAnalysisManager* analysisManager = GeneAnalysisManager::GetInstance();
|
|
analysisManager->save();
|
|
#endif
|
|
}
|