#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-variable" #include #include #include #include "global.hh" #include "read_config.hh" #include "G4IDSDetectorConstruction.hh" #include "G4PhysListFactory.hh" #include "G4VModularPhysicsList.hh" #include "PhysicsList.hh" #include "PhysicsListMessenger.hh" #include "G4IDSEventAction.hh" #include "G4IDSPrimaryGeneratorAction.hh" #include "G4IDSSteppingAction.hh" #include "G4RunManager.hh" #include "G4UImanager.hh" #include "G4UIterminal.hh" #include "G4UItcsh.hh" #include "Randomize.hh" #include "time.h" #ifdef G4VIS_USE #include "G4VisExecutive.hh" #endif #ifdef G4UI_USE #include "G4UIExecutive.hh" #endif #include "G4ios.hh" #include #include using namespace std; void PrintUsage() { G4cerr << " Usage: " << G4endl; //G4cerr << " exampleB4d [-m macro ] [-u UIsession] [-c configfile] [-f OutputFileName] [-s seed]" << G4endl; G4cerr << " exampleB4d [-m macro ] [-c configfile] [-f OutputFileName]" << G4endl; // G4cerr << " note: -t option is not available for the moment (multi-threaded mode)" // << G4endl; } int main(int argc,char** argv) { clock_t t1,t2; t1=clock(); // Evaluate arguments // if ( argc > 7 ) { PrintUsage(); return 1; } G4String macro; G4String session; G4String fFileName = "../../rootfiles/test.root"; //C. Sotty - rootfiles outside the G4IDS folder G4String cFileName = "../configfiles/config_ROSPHERE.dat"; long pseed = 9876; for ( G4int i=1; i> here's your detector...... G4VUserDetectorConstruction* detector = new G4IDSDetectorConstruction; runManager->SetUserInitialization(detector); G4cout << "\n\t Detectors DONE.....\n" << flush; // -->> here's your physics G4PhysListFactory factory; G4VModularPhysicsList* phys = 0; PhysicsListMessenger* mess = 0; G4String physName = ""; // Physics List name defined via 2nd argument if (argc==3) { physName = argv[2]; } // Physics List name defined via environment variable char* path = getenv("PHYSLIST"); if (path) { physName = G4String(path); } physName = "FTFP_BERT_EMY"; // reference PhysicsList via its name if(factory.IsReferencePhysList(physName)) { cout<<"\n\n\n\n\n BDABOOOOOUMMMMM !!!!!! \n\n\n\n"; phys = factory.GetReferencePhysList(physName); mess = new PhysicsListMessenger(); } // local Physics List if(!phys) { phys = new PhysicsList(); } // define physics runManager->SetUserInitialization(phys); G4cout << "\n\t\t Physics DONE.....\n" << flush; G4VUserPrimaryGeneratorAction* gen_action = new G4IDSPrimaryGeneratorAction(fFileName); runManager->SetUserAction(gen_action); G4IDSEventAction* event_action = new G4IDSEventAction((G4IDSDetectorConstruction*)detector, fFileName); runManager->SetUserAction(event_action); //G4IDSSteppingAction* step_action = new G4IDSSteppingAction((G4IDSDetectorConstruction*)detector, (G4IDSEventAction*)event_action); //G4IDSSteppingAction* step_action = new G4IDSSteppingAction( (G4IDSEventAction*)event_action); G4IDSSteppingAction* step_action = new G4IDSSteppingAction(); //event_action->SetSteppingAction(step_action); runManager->SetUserAction(step_action); //Taken from Geant4.10 example B4 //Initialize G4 kernel runManager->Initialize(); G4cout << "\n\t\t\t RunManager launched.....\n" << flush; #ifdef G4VIS_USE // Initialize visualization G4VisManager* visManager = new G4VisExecutive; // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance. // G4VisManager* visManager = new G4VisExecutive("Quiet"); visManager->Initialize(); #endif // Get the pointer to the User Interface manager G4UImanager* UImanager = G4UImanager::GetUIpointer(); if ( macro.size() ) { // batch mode G4String command = "/control/execute "; UImanager->ApplyCommand(command+macro); } else { // interactive mode : define UI session #ifdef G4UI_USE G4UIExecutive* ui = new G4UIExecutive(argc, argv, session); #ifdef G4VIS_USE UImanager->ApplyCommand("/control/execute init_vis.mac"); #else UImanager->ApplyCommand("/control/execute init.mac"); #endif if (ui->IsGUI()) UImanager->ApplyCommand("/control/execute gui.mac"); //UImanager->ApplyCommand("/control/execute vrml.mac"); ui->SessionStart(); delete ui; #endif } // Job termination // 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 ! #ifdef G4VIS_USE G4cout <<"\n\n"; delete visManager; #endif delete runManager; //t2=clock(); //float runningTime ((float)t2-(float)t1); //G4cout<<"\nRunning Time: "<