add detector as argumento of Action Initialization

parent dedf6f49
...@@ -59,7 +59,7 @@ int main(int argc,char** argv) ...@@ -59,7 +59,7 @@ int main(int argc,char** argv)
// Choose the Random engine // Choose the Random engine
G4Random::setTheEngine(new CLHEP::RanecuEngine); G4Random::setTheEngine(new CLHEP::RanecuEngine);
// Construct the default run manager // Construct the default run manager
// //
#ifdef G4MULTITHREADED #ifdef G4MULTITHREADED
...@@ -71,17 +71,18 @@ int main(int argc,char** argv) ...@@ -71,17 +71,18 @@ int main(int argc,char** argv)
// Set mandatory initialization classes // Set mandatory initialization classes
// //
// Detector construction // Detector construction
runManager->SetUserInitialization(new B1DetectorConstruction()); B1DetectorConstruction* detector = new B1DetectorConstruction();
runManager->SetUserInitialization(detector);
// Physics list - FTFP_BERT - p/shower // Physics list - FTFP_BERT - p/shower
// added verbose to the physics list // added verbose to the physics list
G4int verbose = 0; G4int verbose = 0;
G4VModularPhysicsList* physicsList = new FTFP_BERT; G4VModularPhysicsList* physicsList = new FTFP_BERT;
runManager->SetUserInitialization(physicsList); runManager->SetUserInitialization(physicsList);
// User action initialization // User action initialization
runManager->SetUserInitialization(new B1ActionInitialization()); runManager->SetUserInitialization(new B1ActionInitialization(detector));
// Initialize visualization // Initialize visualization
// (if you don't want the image, just delete the G4VisManager objetc and everything that concerns it) // (if you don't want the image, just delete the G4VisManager objetc and everything that concerns it)
G4VisManager* visManager = new G4VisExecutive; G4VisManager* visManager = new G4VisExecutive;
...@@ -94,13 +95,13 @@ int main(int argc,char** argv) ...@@ -94,13 +95,13 @@ int main(int argc,char** argv)
// Process macro or start UI session // Process macro or start UI session
// (you can delete this if-clause too.) // (you can delete this if-clause too.)
if ( ! ui ) { if ( ! ui ) {
// batch mode // batch mode
G4String command = "/control/execute "; G4String command = "/control/execute ";
G4String fileName = argv[1]; G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName); UImanager->ApplyCommand(command+fileName);
} }
else { else {
// interactive mode // interactive mode
UImanager->ApplyCommand("/control/execute init_vis.mac"); UImanager->ApplyCommand("/control/execute init_vis.mac");
ui->SessionStart(); ui->SessionStart();
...@@ -109,9 +110,9 @@ int main(int argc,char** argv) ...@@ -109,9 +110,9 @@ int main(int argc,char** argv)
// Job termination // Job termination
// Free the store: user actions, physics_list and detector_description are // 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 ! // in the main() program !
delete visManager; //(delete this line too if you don't want image). delete visManager; //(delete this line too if you don't want image).
delete runManager; 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