Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
monopole.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 /// \file exoticphysics/monopole/monopole.cc
27 /// \brief Main program of the exoticphysics/monopole example
28 //
29 // $Id: monopole.cc 66817 2013-01-12 16:16:08Z gcosmo $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "G4RunManager.hh"
35 #include "G4UImanager.hh"
36 #include "Randomize.hh"
37 #include "globals.hh"
38 
39 #include "DetectorConstruction.hh"
40 #include "G4MonopolePhysics.hh"
41 #include "G4PhysListFactory.hh"
42 #include "G4VModularPhysicsList.hh"
43 #include "PrimaryGeneratorAction.hh"
44 
45 #include "RunAction.hh"
46 #include "EventAction.hh"
47 #include "TrackingAction.hh"
48 #include "SteppingAction.hh"
49 
50 #ifdef G4VIS_USE
51 #include "G4VisExecutive.hh"
52 #endif
53 
54 #ifdef G4UI_USE
55 #include "G4UIExecutive.hh"
56 #endif
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59 
60 int main(int argc,char** argv) {
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 }
139 
140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void RegisterPhysics(G4VPhysicsConstructor *)
const XML_Char * s
int main(int argc, char **argv)
Definition: monopole.cc:60
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
Definition of the G4MonopolePhysics class.
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)