43 lines
1.3 KiB
C++
43 lines
1.3 KiB
C++
#include "GeneRunAction.hh"
|
|
|
|
#include "G4Run.hh"
|
|
#include "G4SystemOfUnits.hh"
|
|
#include "G4UImanager.hh"
|
|
#include "G4VVisManager.hh"
|
|
#include "G4ios.hh"
|
|
#include "GeneAnalysisManager.hh"
|
|
#include "GeneConst.hh"
|
|
|
|
static G4String RunNo() {
|
|
return std::to_string(int(fBeamEnergy * 1000)) + "kev_" + std::to_string(int(innerR)) + "mm_" +
|
|
std::to_string(int(outerR)) + "mm";
|
|
}
|
|
|
|
GeneRunAction::GeneRunAction() : G4UserRunAction() {}
|
|
|
|
GeneRunAction::~GeneRunAction() {}
|
|
|
|
void GeneRunAction::BeginOfRunAction(const G4Run*) {
|
|
// Prepare the visualization
|
|
if (G4VVisManager::GetConcreteInstance()) {
|
|
G4UImanager* UI = G4UImanager::GetUIpointer();
|
|
UI->ApplyCommand("/vis/scene/notifyHandlers");
|
|
}
|
|
|
|
GeneAnalysisManager* analysisManager = GeneAnalysisManager::GetInstance();
|
|
G4String sFileName = "Simulation_RunNo_" + RunNo() + ".root";
|
|
analysisManager->SetAnalysisFileName(sFileName);
|
|
// Open an output file
|
|
analysisManager->book();
|
|
}
|
|
|
|
void GeneRunAction::EndOfRunAction(const G4Run*) {
|
|
// Run ended, update the visualization
|
|
if (G4VVisManager::GetConcreteInstance()) {
|
|
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
|
|
}
|
|
|
|
GeneAnalysisManager* analysisManager = GeneAnalysisManager::GetInstance();
|
|
analysisManager->save();
|
|
}
|