Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nptool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Gitlab has been updated. More info
here
.
Show more breadcrumbs
np
nptool
Commits
716512bd
Commit
716512bd
authored
14 years ago
by
matta
Browse files
Options
Downloads
Patches
Plain Diff
* Add NPOption Manager to NPS
parent
7f028ebf
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
NPSimulation/Simulation.cc
+88
-91
88 additions, 91 deletions
NPSimulation/Simulation.cc
with
88 additions
and
91 deletions
NPSimulation/Simulation.cc
+
88
−
91
View file @
716512bd
...
...
@@ -13,103 +13,100 @@
#ifdef G4VIS_USE
#include
"G4VisExecutive.hh"
#endif
// NPS
Source
// NPS
headers
#include
"EventAction.hh"
#include
"VDetector.hh"
//NPL headers
#include
"NPOptionManager.h"
#include
"RootOutput.h"
// ROOT
Source
// ROOT
headers
#include
"TTree.h"
#include
"TFile.h"
// STL
#include
<vector>
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
!=
3
)
{
cout
<<
"you need to specify both a Reaction file and a Detector file such as : Simulation myReaction.reaction myDetector.detector"
<<
endl
;
return
0
;
}
// Getting arguments
G4String
EventGeneratorFileName
=
argv
[
1
];
G4String
DetectorFileName
=
argv
[
2
];
//my Verbose output class
G4VSteppingVerbose
::
SetInstance
(
new
SteppingVerbose
);
//Construct the default run manager
G4RunManager
*
runManager
=
new
G4RunManager
;
//set mandatory initialization classes
DetectorConstruction
*
detector
=
new
DetectorConstruction
();
runManager
->
SetUserInitialization
(
detector
);
PhysicsList
*
physics
=
new
PhysicsList
();
runManager
->
SetUserInitialization
(
physics
);
PrimaryGeneratorAction
*
primary
=
new
PrimaryGeneratorAction
(
detector
);
//Initialize Geant4 kernel
runManager
->
Initialize
();
physics
->
MyOwnConstruction
();
///////////////////////////////////////////////////////////////
///////////////// Initializing the Root Output ////////////////
///////////////////////////////////////////////////////////////
RootOutput
::
getInstance
(
"Simulation/mySimul"
);
///////////////////////////////////////////////////////////////
////////////// Reading Detector Configuration /////////////////
///////////////////////////////////////////////////////////////
detector
->
ReadConfigurationFile
(
DetectorFileName
);
///////////////////////////////////////////////////////////////
////////////////////// Reading Reaction ///////////////////////
///////////////////////////////////////////////////////////////
primary
->
ReadEventGeneratorFile
(
EventGeneratorFileName
);
runManager
->
SetUserAction
(
primary
);
///////////////////////////////////////////////////////////////
////////////////// Starting the Event Action //////////////////
///////////////////////////////////////////////////////////////
EventAction
*
event_action
=
new
EventAction
()
;
event_action
->
SetDetector
(
detector
)
;
runManager
->
SetUserAction
(
event_action
)
;
///////////////////////////////////////////////////////////////
/////// Get the pointer to the User Interface manager ////////
///////////////////////////////////////////////////////////////
G4UImanager
*
UI
=
G4UImanager
::
GetUIpointer
();
///////////////////////////////////////////////////////////////
/////////// Define UI terminal for interactive mode ///////////
///////////////////////////////////////////////////////////////
#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 vis.mac"
);
session
->
SessionStart
();
delete
session
;
#ifdef G4VIS_USE
delete
visManager
;
#endif
///////////////////////////////////////////////////////////////
////////////////////// Job termination ////////////////////////
///////////////////////////////////////////////////////////////
RootOutput
::
getInstance
()
->
Destroy
();
delete
runManager
;
return
0
;
}
{
NPOptionManager
*
OptionManager
=
NPOptionManager
::
getInstance
(
argc
,
argv
);
G4String
EventGeneratorFileName
=
OptionManager
->
GetReactionFilePath
();
G4String
DetectorFileName
=
OptionManager
->
GetDetectorFilePath
();
//my Verbose output class
G4VSteppingVerbose
::
SetInstance
(
new
SteppingVerbose
);
//Construct the default run manager
G4RunManager
*
runManager
=
new
G4RunManager
;
//set mandatory initialization classes
DetectorConstruction
*
detector
=
new
DetectorConstruction
();
runManager
->
SetUserInitialization
(
detector
);
PhysicsList
*
physics
=
new
PhysicsList
();
runManager
->
SetUserInitialization
(
physics
);
PrimaryGeneratorAction
*
primary
=
new
PrimaryGeneratorAction
(
detector
);
//Initialize Geant4 kernel
runManager
->
Initialize
();
physics
->
MyOwnConstruction
();
///////////////////////////////////////////////////////////////
///////////////// Initializing the Root Output ////////////////
///////////////////////////////////////////////////////////////
RootOutput
::
getInstance
(
"Simulation/"
+
OptionManager
->
GetOutputFilePath
());
///////////////////////////////////////////////////////////////
////////////// Reading Detector Configuration /////////////////
///////////////////////////////////////////////////////////////
detector
->
ReadConfigurationFile
(
DetectorFileName
);
///////////////////////////////////////////////////////////////
////////////////////// Reading Reaction ///////////////////////
///////////////////////////////////////////////////////////////
primary
->
ReadEventGeneratorFile
(
EventGeneratorFileName
);
runManager
->
SetUserAction
(
primary
);
///////////////////////////////////////////////////////////////
////////////////// Starting the Event Action //////////////////
///////////////////////////////////////////////////////////////
EventAction
*
event_action
=
new
EventAction
()
;
event_action
->
SetDetector
(
detector
)
;
runManager
->
SetUserAction
(
event_action
)
;
///////////////////////////////////////////////////////////////
/////// Get the pointer to the User Interface manager ////////
///////////////////////////////////////////////////////////////
G4UImanager
*
UI
=
G4UImanager
::
GetUIpointer
();
///////////////////////////////////////////////////////////////
/////////// Define UI terminal for interactive mode ///////////
///////////////////////////////////////////////////////////////
#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 vis.mac"
);
session
->
SessionStart
();
delete
session
;
#ifdef G4VIS_USE
delete
visManager
;
#endif
///////////////////////////////////////////////////////////////
////////////////////// Job termination ////////////////////////
///////////////////////////////////////////////////////////////
RootOutput
::
getInstance
()
->
Destroy
();
delete
runManager
;
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment