Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
DMX.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 //
26 //
27 // --------------------------------------------------------------
28 // GEANT 4 - Underground Dark Matter Detector Advanced Example
29 //
30 // For information related to this code contact: Alex Howard
31 // e-mail: alexander.howard@cern.ch
32 // --------------------------------------------------------------
33 // Comments
34 //
35 // Underground Advanced example main program
36 // by A. Howard and H. Araujo
37 // (27th November 2001)
38 //
39 // main program
40 // --------------------------------------------------------------
41 
42 #include "G4Types.hh"
43 
44 #ifdef G4MULTITHREADED
45 #include "G4MTRunManager.hh"
46 #else
47 #include "G4RunManager.hh"
48 #endif
49 
50 #include "G4UImanager.hh"
51 #include "Randomize.hh"
52 
53 #ifdef G4VIS_USE
54 #include "G4VisExecutive.hh"
55 #endif
56 
57 #ifdef G4UI_USE
58 #include "G4UIExecutive.hh"
59 #endif
60 
61 #include "DMXAnalysisManager.hh"
63 #include "DMXPhysicsList.hh"
64 #include "DMXActionInitializer.hh"
65 
66 int main(int argc,char** argv) {
67 
68  // choose the Random engine
69  G4Random::setTheEngine(new CLHEP::RanecuEngine);
70 
71  // Construct the default run manager
72 #ifdef G4MULTITHREADED
73  G4MTRunManager* runManager = new G4MTRunManager;
74  //runManager->SetNumberOfThreads(2);
75 #else
76  G4RunManager* runManager = new G4RunManager;
77 #endif
78 
79  // set mandatory initialization classes
81  runManager->SetUserInitialization(new DMXPhysicsList);
83 
84 #ifdef G4VIS_USE
85  // visualization manager
86  G4VisManager* visManager = new G4VisExecutive;
87  visManager->Initialize();
88 #endif
89 
90 
91 #ifdef DMXENV_GPS_USE
92  G4cout << " Using GPS and not DMX gun " << G4endl;
93 #else
94  G4cout << " Using the DMX gun " << G4endl;
95 #endif
96 
97 
98  //Initialize G4 kernel
99  runManager->Initialize();
100 
101  // get the pointer to the User Interface manager
102  G4UImanager* UImanager = G4UImanager::GetUIpointer();
103 
104  // Define UI session for interactive mode.
105  if(argc == 1)
106  {
107 #ifdef G4UI_USE
108  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
109 #ifdef G4VIS_USE
110  UImanager->ApplyCommand("/control/execute initInter.mac");
111 #endif
112  ui->SessionStart();
113  delete ui;
114 #endif
115  }
116  // Batch mode
117  else
118  {
119  G4String command = "/control/execute ";
120  G4String fileName = argv[1];
121  UImanager->ApplyCommand(command+fileName);
122  }
123 
124  //Close-out analysis:
125  // Save histograms
126  G4AnalysisManager* man = G4AnalysisManager::Instance();
127  man->Write();
128  man->CloseFile();
129  // Complete clean-up
130  delete G4AnalysisManager::Instance();
131 
132 #ifdef G4VIS_USE
133  if(visManager) delete visManager;
134 #endif
135  delete runManager;
136 
137  return 0;
138 }
139 
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:466
#define G4endl
Definition: G4ios.hh:61
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:73
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
int main(int argc, char **argv)
Definition: genwindef.cc:359
G4GLOB_DLL std::ostream G4cout
void Initialize()
virtual void Initialize()