// -------------------------------------------------------------- // GEANT 4 - exampleR04 // -------------------------------------------------------------- // 29-Sep-2000 Bill Seligman // This is the main program of a sample package to show how to use // the RecorderBase class, Geant4 hits, and ROOT all together. #include "ExN02DetectorConstruction.hh" #include "ExN02PhysicsList.hh" #include "ExR04RunAction.hh" #include "ExN02PrimaryGeneratorAction.hh" #include "ExR04EventAction.hh" #include "ExR04SteppingAction.hh" #include "ExN02SteppingVerbose.hh" #include "ExR04Histograms.hh" #include "RecorderBase.hh" #include "G4UImanager.hh" #include "G4UIterminal.hh" #include "G4UItcsh.hh" #include "G4RunManager.hh" #ifdef G4VIS_USE #include "ExN02VisManager.hh" #endif #include "G4ios.hh" int main(int argc,char** argv) { //my Verbose output class G4VSteppingVerbose::SetInstance(new ExN02SteppingVerbose); // Create the RecorderBase object (which in this example will // make histograms). RecorderBase * myRecords = new ExR04Histograms; // Run manager G4RunManager * runManager = new G4RunManager; // UserInitialization classes ExN02DetectorConstruction* ExN02detector = new ExN02DetectorConstruction; runManager->SetUserInitialization(ExN02detector); runManager->SetUserInitialization(new ExN02PhysicsList); #ifdef G4VIS_USE // Visualization, if you choose to have it! G4VisManager* visManager = new ExN02VisManager; visManager->Initialize(); #endif // UserAction classes runManager->SetUserAction(new ExR04RunAction(myRecords)); runManager->SetUserAction(new ExN02PrimaryGeneratorAction(ExN02detector)); ExR04EventAction* eventAction = new ExR04EventAction(myRecords); runManager->SetUserAction(eventAction); runManager->SetUserAction(new ExR04SteppingAction(ExN02detector,eventAction,myRecords)); // User interactions G4UImanager * UI = G4UImanager::GetUIpointer(); if(argc==1) // Define (G)UI terminal for interactive mode { // G4UIterminal is a terminal with tcsh-like edit and history features. G4UIsession * session = new G4UIterminal(new G4UItcsh); UI->ApplyCommand("/control/execute prerun.g4mac"); session->SessionStart(); delete session; } else // Batch mode { G4String command = "/control/execute "; G4String fileName = argv[1]; UI->ApplyCommand(command+fileName); } #ifdef G4VIS_USE delete visManager; #endif delete runManager; delete myRecords; return 0; }