Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
exampleRMC01.cc File Reference

Main program of the biasing/ReverseMC01 example. More...

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "G4AdjointSimManager.hh"
#include "RMC01DetectorConstruction.hh"
#include "RMC01PrimaryGeneratorAction.hh"
#include "RMC01EventAction.hh"
#include "RMC01RunAction.hh"
#include "G4AdjointPhysicsList.hh"
#include "RMC01AdjointEventAction.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the biasing/ReverseMC01 example.

Definition in file exampleRMC01.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 73 of file exampleRMC01.cc.

References G4UImanager::ApplyCommand(), G4AdjointSimManager::GetInstance(), G4UImanager::GetUIpointer(), G4VisManager::Initialize(), G4UIExecutive::SessionStart(), G4AdjointSimManager::SetAdjointEventAction(), G4AdjointSimManager::SetAdjointRunAction(), G4RunManager::SetUserAction(), and G4RunManager::SetUserInitialization().

73  {
74 
75 
76 
77  // Construct the default run manager
78  G4RunManager * theRunManager = new G4RunManager;
79 
80 
82 
83  //Physics and geometry are declared as in a normal G4 application
84  //--------------------------------------------
85  theRunManager->SetUserInitialization(detector);
86  theRunManager->SetUserInitialization(new G4AdjointPhysicsList);
87 
88 
89 
90  theRunManager->SetUserAction(new RMC01PrimaryGeneratorAction);
91  theRunManager->SetUserAction(new RMC01EventAction);
92  RMC01RunAction* theRunAction = new RMC01RunAction;
93  theRunManager->SetUserAction(theRunAction);
94 
95 
96  //The adjoint simulation manager will control the Reverse MC mode
97  //---------------------------------------------------------------
98 
99  G4AdjointSimManager* theAdjointSimManager = G4AdjointSimManager::GetInstance();
100 
101  //It is possible to define action that will be used during
102  // the adjoint tracking phase
103 
104  theAdjointSimManager->SetAdjointRunAction(theRunAction);
105  //theAdjointSimManager->SetAdjointEventAction(new RMC01AdjointEventAction);
106  theAdjointSimManager->SetAdjointEventAction(new RMC01EventAction);
107 
108 #ifdef G4VIS_USE
109  // visualization manager
110  G4VisManager* visManager = new G4VisExecutive;
111  visManager->Initialize();
112 
113 #endif
114 
115  // get the pointer to the User Interface manager
116  G4UImanager* UImanager = G4UImanager::GetUIpointer();
117 
118  if (argc!=1) // batch mode
119  {
120  G4String command = "/control/execute ";
121  G4String fileName = argv[1];
122  UImanager->ApplyCommand(command+fileName);
123  }
124  else
125  { // interactive mode : define UI session
126 #ifdef G4UI_USE
127  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
128  ui->SessionStart();
129  delete ui;
130 #endif
131  }
132 
133  // job termination
134 #ifdef G4VIS_USE
135  delete visManager;
136 #endif
137  delete theRunManager;
138 
139  return 0;
140 }
static G4AdjointSimManager * GetInstance()
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
void SetAdjointRunAction(G4UserRunAction *anAction)
void SetAdjointEventAction(G4UserEventAction *anAction)
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
virtual void SetUserAction(G4UserRunAction *userAction)