LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
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 71 of file exampleRMC01.cc.

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