#include "GDMLDetectorConstruction.hh" #include "PhysicsList.hh" #include "PrimaryGeneratorAction.hh" #include "RunAction.hh" #include "EventAction.hh" #include "SteppingAction.hh" //#include "SteppingVerbose.hh" #include "ACDSD.hh" #include "ACDHit.hh" #ifdef G4MULTITHREADED #include "G4MTRunManager.hh" #else #include "G4RunManager.hh" #endif #include "G4UImanager.hh" #include "G4UIterminal.hh" #include "G4UIExecutive.hh" #include "G4UItcsh.hh" #include "G4GDMLParser.hh" #include #ifdef G4VIS_USE #include "G4VisExecutive.hh" #endif //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... int main(int argc,char** argv) { // //GDMLParser initialization // G4cout << G4endl; G4cout << "Usage: athena " << G4endl; G4cout << G4endl; if (argc<2) { G4cout << "Error! Mandatory input file is not specified!" << G4endl; G4cout << G4endl; return -1; } // Detect interactive mode (if only one argument) and define UI session // G4UIExecutive* ui = 0; if ( argc == 2 ) { ui = new G4UIExecutive(argc, argv); } G4GDMLParser parser; parser.Read(argv[1]); // // // CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine); // User Verbose output class // CLHEP::HepRandom::setTheSeed(117); // Run manager // G4RunManager * runManager = new G4RunManager; // User Initialization classes (mandatory) // //DetectorConstruction* detector = new DetectorConstruction; //Removed from gdml version runManager->SetUserInitialization(new GDMLDetectorConstruction(parser)); // G4cout << "########## Starting Physics List ########" << G4endl; runManager->SetUserInitialization(new PhysicsList()); // User Action classes // G4cout << "########## Starting Primary Generator Action ########" << G4endl; G4VUserPrimaryGeneratorAction* gen_action = new PrimaryGeneratorAction; runManager->SetUserAction(gen_action); // G4UserRunAction* run_action = new RunAction; runManager->SetUserAction(run_action); // G4UserEventAction* event_action = new EventAction; runManager->SetUserAction(event_action); // G4UserSteppingAction* stepping_action = new SteppingAction; runManager->SetUserAction(stepping_action); G4cout << "########### ENDING ACTION INITIALIZATION ############" << G4endl; // Initialize G4 kernel // runManager->Initialize(); // Get the pointer to the User Interface manager // G4UImanager * UI = G4UImanager::GetUIpointer(); if (argc!=1) // batch mode { G4String command = "/control/execute "; G4String fileName = argv[1]; UI->ApplyCommand(command+fileName); } else // interactive mode : define visualization and UI terminal { #ifdef G4VIS_USE G4VisManager* visManager = new G4VisExecutive; visManager->Initialize(); #endif G4UIsession * session = 0; #ifdef G4UI_USE_TCSH session = new G4UIterminal(new G4UItcsh); #else session = new G4UIterminal(); #endif UI->ApplyCommand("/control/execute try.mac"); session->SessionStart(); delete session; #ifdef G4VIS_USE delete visManager; #endif } // Free the store: user actions, physics_list and detector_description are // owned and deleted by the run manager, so they should not // be deleted in the main() program ! delete runManager; // delete verbosity; return 0; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......