Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
ts_scorers.cc
이 파일의 문서화 페이지로 가기
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: ts_scorers.cc 93110 2015-11-05 08:37:42Z jmadsen $
31 //
32 //
42 //
43 //
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46 
47 #include "G4Types.hh"
48 
49 #ifdef G4MULTITHREADED
50  #include "G4MTRunManager.hh"
51  #include "G4Threading.hh"
52  typedef G4MTRunManager RunManager;
53 #else
54  #include "G4RunManager.hh"
56 #endif
57 
58 #include "Randomize.hh"
59 
60 // User Defined Classes
62 #include "TSPhysicsList.hh"
64 
65 #include "G4UImanager.hh"
66 #include "G4VisExecutive.hh"
67 #include "G4UIExecutive.hh"
68 #include "G4TiMemory.hh"
69 
70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
71 
72 void message(RunManager* runmanager)
73 {
74 #ifdef G4MULTITHREADED
75  runmanager->SetNumberOfThreads(G4Threading::G4GetNumberOfCores());
76  G4cout << "\n\n\t--> Running in multithreaded mode with "
77  << runmanager->GetNumberOfThreads()
78  << " threads\n\n" << G4endl;
79 #else
80  // get rid of unused variable warning
81  runmanager->SetVerboseLevel(runmanager->GetVerboseLevel());
82  G4cout << "\n\n\t--> Running in serial mode\n\n" << G4endl;
83 #endif
84 }
85 
86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
87 
88 int main(int argc, char** argv)
89 {
90 
91  // Detect interactive mode (if no arguments) and define UI session
92  //
93  G4UIExecutive* ui = 0;
94  if(argc == 1)
95  ui = new G4UIExecutive(argc, argv);
96 
97  // Set the random seed
99 
100  RunManager* runmanager = new RunManager();
101 
102  message(runmanager);
103 
105 
106  runmanager->SetUserInitialization(new TSPhysicsList);
107 
109 
110  runmanager->Initialize();
111 
112 
113  // Initialize visualization
114  //
115  G4VisManager* visManager = new G4VisExecutive;
116  // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
117  // G4VisManager* visManager = new G4VisExecutive("Quiet");
118  visManager->Initialize();
119 
120  // Get the pointer to the User Interface manager
121  G4UImanager* UImanager = G4UImanager::GetUIpointer();
122 
123  // Process macro or start UI session
124  //
125  if (!ui)
126  {
127  // batch mode
128  G4String command = "/control/execute ";
129  G4String fileName = argv[argc-1];
130  UImanager->ApplyCommand(command+fileName);
131  } else
132  {
133  // interactive mode
134  UImanager->ApplyCommand("/control/execute vis.mac");
135  ui->SessionStart();
136  delete ui;
137  }
138 
139 #ifdef GEANT4_USE_TIMEMORY
140  G4cout << "\nOutputting TiMemory results...\n" << G4endl;
141  tim::manager* manager = tim::manager::instance();
142  manager->write_report(std::cout, true);
143  std::string fname = argv[0];
144  std::string rfname = fname + ".txt";
145  std::string sfname = fname + ".json";
146  manager->write_report(rfname);
147  manager->write_serialization(sfname);
148 #endif
149 
150  // Job termination
151  // Free the store: user actions, physics_list and detector_description are
152  // owned and deleted by the run manager, so they should not be deleted
153  // in the main() program !
154  delete visManager;
155  delete runmanager;
156 
157  return 0;
158 }
static void setTheSeed(long seed, int lux=3)
Definition: Random.cc:231
G4RunManager RunManager
Definition: ts_scorers.cc:55
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:466
#define G4endl
Definition: G4ios.hh:61
void SetVerboseLevel(G4int vl)
void message(RunManager *runmanager)
Definition: ts_scorers.cc:72
Definition of the TSActionInitialization class.
G4int G4GetNumberOfCores()
Definition: G4Threading.cc:127
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:73
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
int main(int argc, char **argv)
Definition: genwindef.cc:359
Definition of the TSPhysicsList class.
G4int GetVerboseLevel() const
static MCTruthManager * instance
G4GLOB_DLL std::ostream G4cout
void Initialize()
Definition of the TSDetectorConstruction class.
virtual void Initialize()