#include #include #include "G4RunManager.hh" #include "G4UImanager.hh" #include "G4VisManager.hh" #include "G4VisExecutive.hh" #include "G4UIExecutive.hh" #include "DetectorConstruction.hh" #include "PhysicsList.hh" #include "ActionInitialization.hh" //#include "PrimaryGeneratorAction.hh" #include "SteppingAction.hh" int main(int argc, char** argv) { G4RunManager* runManager = new G4RunManager(); runManager->SetUserInitialization(new DetectorConstruction()); runManager->SetUserInitialization(new PhysicsList()); //runManager->SetUserInitialization(new ActionInitialization()); ActionInitialization* actionInitialization = new ActionInitialization(); runManager->SetUserInitialization(actionInitialization); runManager->Initialize(); G4UIExecutive* ui = new G4UIExecutive(argc, argv); G4VisManager* visManager = new G4VisExecutive(); visManager->Initialize(); G4UImanager* UImanager = G4UImanager::GetUIpointer(); UImanager->ApplyCommand("/vis/open OGL"); //UImanager->ApplyCommand("/vis/open VRML2FILE"); UImanager->ApplyCommand("/vis/viewer/set/viewpointVector 1 1 1"); UImanager->ApplyCommand("/vis/drawVolume"); UImanager->ApplyCommand("/vis/viewer/set/autoRefresh true"); UImanager->ApplyCommand("/vis/scene/add/trajectories smooth"); UImanager->ApplyCommand("/vis/scene/endOfEventAction accumulate 100000"); // to see all runs together here we want to accumulate 1000 photons only ui->SessionStart(); // Output the number of gamma photons reaching the detector std::ofstream outFile("output.txt"); outFile << "Number of gamma photons reaching the detector: " << actionInitialization->GetSteppingAction()->GetNumGammaPhotons() << std::endl; outFile.close(); return 0; }