add detector as argumento of Action Initialization

parent dedf6f49
......@@ -59,7 +59,7 @@ int main(int argc,char** argv)
// Choose the Random engine
G4Random::setTheEngine(new CLHEP::RanecuEngine);
// Construct the default run manager
//
#ifdef G4MULTITHREADED
......@@ -71,17 +71,18 @@ int main(int argc,char** argv)
// Set mandatory initialization classes
//
// Detector construction
runManager->SetUserInitialization(new B1DetectorConstruction());
B1DetectorConstruction* detector = new B1DetectorConstruction();
runManager->SetUserInitialization(detector);
// Physics list - FTFP_BERT - p/shower
// added verbose to the physics list
G4int verbose = 0;
G4VModularPhysicsList* physicsList = new FTFP_BERT;
runManager->SetUserInitialization(physicsList);
// User action initialization
runManager->SetUserInitialization(new B1ActionInitialization());
runManager->SetUserInitialization(new B1ActionInitialization(detector));
// Initialize visualization
// (if you don't want the image, just delete the G4VisManager objetc and everything that concerns it)
G4VisManager* visManager = new G4VisExecutive;
......@@ -94,13 +95,13 @@ int main(int argc,char** argv)
// Process macro or start UI session
// (you can delete this if-clause too.)
if ( ! ui ) {
if ( ! ui ) {
// batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
}
else {
else {
// interactive mode
UImanager->ApplyCommand("/control/execute init_vis.mac");
ui->SessionStart();
......@@ -109,9 +110,9 @@ int main(int argc,char** argv)
// 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
// owned and deleted by the run manager, so they should not be deleted
// in the main() program !
delete visManager; //(delete this line too if you don't want image).
delete runManager;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment