LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
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 98276 2016-07-04 18:00:15Z 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 
40 #include "DetectorConstruction.hh"
41 #include "PhysicsList.hh"
43 #include "RunAction.hh"
44 #include "EventAction.hh"
45 #include "StackingAction.hh"
46 
47 #ifdef G4VIS_USE
48 #include "G4VisExecutive.hh"
49 #endif
50 
51 #ifdef G4UI_USE
52 #include "G4UIExecutive.hh"
53 #endif
54 
55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56 
57 int main(int argc,char** argv)
58 {
59 
60  //choose the Random engine
61 
62  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
63 
64  // Construct the default run manager
65 
66  G4RunManager * runManager = new G4RunManager;
67 
68  // set mandatory initialization classes
69 
70  DetectorConstruction* detector;
71  detector = new DetectorConstruction;
72 
73  // ALICEDetectorConstruction* detector;
74  // detector = new ALICEDetectorConstruction;
75 
76  runManager->SetUserInitialization(detector);
77  runManager->SetUserInitialization(new PhysicsList(detector));
78 
79  // set user action classes
80  runManager->SetUserAction(new PrimaryGeneratorAction());
81 
82  RunAction* runAction = new RunAction;
83  runManager->SetUserAction(runAction);
84 
85  EventAction* eventAction = new EventAction(runAction);
86  runManager->SetUserAction(eventAction);
87 
88  runManager->SetUserAction( new StackingAction );
89 
90 
91  G4UImanager* UI = G4UImanager::GetUIpointer();
92 
93  if (argc!=1) // batch mode
94  {
95  G4String command = "/control/execute ";
96  G4String fileName = argv[1];
97  UI->ApplyCommand(command+fileName);
98  }
99 
100  else //define visualization and UI terminal for interactive mode
101  {
102 #ifdef G4VIS_USE
103  G4VisManager* visManager = new G4VisExecutive;
104  visManager->Initialize();
105 #endif
106 
107 #ifdef G4UI_USE
108  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
109  ui->SessionStart();
110  delete ui;
111 #endif
112 
113 #ifdef G4VIS_USE
114  delete visManager;
115 #endif
116  }
117 
118  // job termination
119  //
120  delete runManager;
121 
122  return 0;
123 }
124 
125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
TConfigurablePhysicsList< ModularPhysicsList > PhysicsList
Definition: PhysicsList.h:86
int main(int argc, char **argv)
Definition: TestEm10.cc:57