Geant4  10.00.p02
TestEm10.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 //
28 //
29 //
30 // $Id: TestEm10.cc 73033 2013-08-15 09:24:45Z gcosmo $
31 //
32 //
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35 
36 #include "G4RunManager.hh"
37 #include "G4UImanager.hh"
38 #include "Randomize.hh"
39 
41 // #include "ALICEDetectorConstruction.hh"
42 #include "Em10PhysicsList.hh"
44 #include "Em10RunAction.hh"
45 #include "Em10EventAction.hh"
46 #include "Em10SteppingAction.hh"
47 #include "Em10SteppingVerbose.hh"
48 #include "Em10TrackingAction.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 
63  //choose the Random engine
64 
65  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
66 
67  //my Verbose output class
68 
70 
71  // Construct the default run manager
72 
73  G4RunManager * runManager = new G4RunManager;
74 
75  // set mandatory initialization classes
76 
77  Em10DetectorConstruction* detector;
78  detector = new Em10DetectorConstruction;
79 
80  // ALICEDetectorConstruction* detector;
81  // detector = new ALICEDetectorConstruction;
82 
83  runManager->SetUserInitialization(detector);
84  runManager->SetUserInitialization(new Em10PhysicsList(detector));
85 
86  // set user action classes
87  runManager->SetUserAction(new Em10PrimaryGeneratorAction(detector));
88 
89  Em10RunAction* runAction = new Em10RunAction;
90 
91  runManager->SetUserAction(runAction);
92 
93  Em10EventAction* eventAction = new Em10EventAction(runAction);
94 
95  runManager->SetUserAction(eventAction);
96 
97  Em10SteppingAction* steppingAction = new Em10SteppingAction(eventAction,
98  runAction);
99  runManager->SetUserAction(steppingAction);
100 
101 
102  runManager->SetUserAction( new Em10TrackingAction );
103 
104 
106 
107  if (argc!=1) // batch mode
108  {
109  G4String command = "/control/execute ";
110  G4String fileName = argv[1];
111  UI->ApplyCommand(command+fileName);
112  }
113 
114  else //define visualization and UI terminal for interactive mode
115  {
116 #ifdef G4VIS_USE
117  G4VisManager* visManager = new G4VisExecutive;
118  visManager->Initialize();
119 #endif
120 
121 #ifdef G4UI_USE
122  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
123  ui->SessionStart();
124  delete ui;
125 #endif
126 
127 #ifdef G4VIS_USE
128  delete visManager;
129 #endif
130  }
131 
132  // job termination
133  //
134  delete runManager;
135 
136  return 0;
137 }
138 
139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
Definition of the Em10EventAction class.
Definition of the Em10RunAction class.
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
Definition of the Em10PrimaryGeneratorAction class.
Definition of the Em10TrackingAction class.
Definition of the Em10SteppingVerbose class.
int main(int argc, char **argv)
Definition: TestEm10.cc:60
void Initialize()
static void SetInstance(G4VSteppingVerbose *Instance)
Definition of the Em10SteppingAction class.
Definition of the Em10DetectorConstruction class.
Definition of the Em10PhysicsList class.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:432
virtual void SetUserAction(G4UserRunAction *userAction)