Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
monopole.cc File Reference

Main program of the exoticphysics/monopole example. More...

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "globals.hh"
#include "DetectorConstruction.hh"
#include "G4MonopolePhysics.hh"
#include "G4PhysListFactory.hh"
#include "G4VModularPhysicsList.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "TrackingAction.hh"
#include "SteppingAction.hh"
Include dependency graph for monopole.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the exoticphysics/monopole example.

Definition in file monopole.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 59 of file monopole.cc.

59  {
60 
61  //choose the Random engine
62  //CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
63  //CLHEP::HepRandom::setTheEngine(new CLHEP::Ranlux64Engine);
65 
66  //Construct the default run manager
67  G4RunManager * runManager = new G4RunManager;
68 
69  //create physicsList
70  // Physics List is defined via environment variable PHYSLIST
71  G4PhysListFactory factory;
72  G4VModularPhysicsList* phys = factory.ReferencePhysList();
73 
74  // monopole physics is added
75  G4MonopolePhysics * theMonopole = new G4MonopolePhysics();
76  phys->RegisterPhysics(theMonopole);
77 
78  // visualization manager
79 #ifdef G4VIS_USE
80  G4VisManager* visManager = 0;
81 #endif
82 
83  //get the pointer to the User Interface manager
85 
86  // Setup monopole
87  G4String s = "";
88  if(argc > 2) { s = argv[2]; }
89  UImanager->ApplyCommand("/control/verbose 1");
90  UImanager->ApplyCommand("/monopole/setup "+s);
91 
92  // mandator user classes
94 
95  runManager->SetUserInitialization(det);
96  runManager->SetUserInitialization(phys);
97 
99  runManager->SetUserAction(kin);
100 
101  //user action classes
102  RunAction* run;
103 
104  runManager->SetUserAction(run = new RunAction(det, kin));
105  runManager->SetUserAction(new TrackingAction(run));
106  runManager->SetUserAction(new SteppingAction(run));
107 
108  if (argc!=1) // batch mode
109  {
110  G4String command = "/control/execute ";
111  G4String fileName = argv[1];
112  UImanager->ApplyCommand(command+fileName);
113  }
114  else
115  { // interactive mode : define UI session
116 #ifdef G4VIS_USE
117  //visualization manager
118  visManager = new G4VisExecutive;
119  visManager->Initialize();
120 #endif
121 #ifdef G4UI_USE
122  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
123  ui->SessionStart();
124  delete ui;
125 #endif
126  }
127 
128  //job termination
129 #ifdef G4VIS_USE
130  delete visManager;
131 #endif
132 
133  delete runManager;
134 
135  return 0;
136 }
The primary generator action class with particle gun.
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void RegisterPhysics(G4VPhysicsConstructor *)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
const XML_Char * s
Definition: expat.h:262
void Initialize()
Detector construction class to define materials and geometry.
static void setTheEngine(HepRandomEngine *theNewEngine)
Definition: Random.cc:270
G4VModularPhysicsList * ReferencePhysList()
Run action class.
Definition: RunAction.hh:45
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447
virtual void SetUserAction(G4UserRunAction *userAction)

Here is the call graph for this function: