Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
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 "EventAction.hh"
#include "TrackingAction.hh"
#include "SteppingAction.hh"

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 60 of file monopole.cc.

References G4UImanager::ApplyCommand(), G4UImanager::GetUIpointer(), G4VisManager::Initialize(), G4PhysListFactory::ReferencePhysList(), G4VModularPhysicsList::RegisterPhysics(), G4UIExecutive::SessionStart(), CLHEP::HepRandom::setTheEngine(), G4RunManager::SetUserAction(), and G4RunManager::SetUserInitialization().

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