Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
CompositeCalorimeter.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 //
27 // File: CompositeCalorimeter.cc
28 // Description: Main function for Geant4 application HCAL Test-BEAM H2-96
30 
32 #include "CCalActionInitializer.hh"
33 #include "CCalAnalysis.hh"
34 
35 #include "G4PhysListFactory.hh"
36 
37 #include "G4RunManager.hh"
38 #include "G4UImanager.hh"
39 
40 #ifdef G4VIS_USE
41  #include "G4VisExecutive.hh"
42 #endif
43 
44 #ifdef G4UI_USE
45  #include "G4UIExecutive.hh"
46 #endif
47 
48 
49 int main(int argc,char** argv) {
50 
51 #ifdef G4VIS_USE
52  G4VisManager *visManager = new G4VisExecutive;
53  visManager->Initialize();
54 #endif
55 
56  G4RunManager * runManager = new G4RunManager;
58 
59  G4PhysListFactory factory;
60  runManager->SetUserInitialization(factory.ReferencePhysList());
61 
63 
64  G4UImanager * UImanager = G4UImanager::GetUIpointer();
65  UImanager->ApplyCommand("/CCal/generator/verbose 2");
66  UImanager->ApplyCommand("/gun/position -1380. 0. 0. mm");
67  UImanager->ApplyCommand("/gun/direction 1. 0. 0.");
68  UImanager->ApplyCommand("/gun/energy 100 GeV");
69 
70  // Define (G)UI terminal for interactive mode
71  if (argc==1) { // No arguments - interactive assumed.
72 
73 #ifdef G4UI_USE
74  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
75  if (ui->IsGUI())
76  // Customize the menubar with a macro file :
77  UImanager->ApplyCommand("/control/execute gui.mac");
78  G4cout <<" Run initializing ..."<<G4endl;
79  UImanager->ApplyCommand("/process/verbose 0");
80  UImanager->ApplyCommand("/run/verbose 2");
81  UImanager->ApplyCommand("/run/initialize");
82 #ifdef G4VIS_USE
83  // Create empty scene
84  G4String visCommand = "/vis/scene/create";
85  UImanager->ApplyCommand(visCommand);
86 
87  // Choose one default viewer
88  // (the user can always change it later on)
89  // visCommand = "/vis/open DAWNFILE";
90  // visCommand = "/vis/open VRML2FILE";
91  visCommand = "/vis/open OGL";
92  UImanager->ApplyCommand(visCommand);
93 
94  visCommand = "/vis/viewer/flush";
95  UImanager->ApplyCommand(visCommand);
96  visCommand = "/tracking/storeTrajectory 1";
97  UImanager->ApplyCommand(visCommand);
98 #endif
99  G4cout <<"Now, please, apply beamOn command..."<<G4endl;
100  ui->SessionStart();
101  delete ui;
102 #endif
103 
104  } else {
105 
106  // Batch mode
107  G4String command = "/control/execute ";
108  G4String fileName = argv[1];
109  UImanager->ApplyCommand(command+fileName);
110 
111  }
112 
113  //Close-out analysis:
114  // Save histograms
115  G4AnalysisManager* man = G4AnalysisManager::Instance();
116  man->Write();
117  man->CloseFile();
118  // Complete clean-up
119  delete G4AnalysisManager::Instance();
120  delete runManager;
121 
122 #ifdef G4VIS_USE
123  delete visManager;
124 #endif
125 
126  return 0;
127 }
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
G4VModularPhysicsList * ReferencePhysList()
G4GLOB_DLL std::ostream G4cout
void Initialize()
G4bool IsGUI() const