Geant4  10.00.p03
GammaRayTelRunAction.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 //
26 //
27 // $Id: GammaRayTelRunAction.cc 68794 2013-04-05 13:23:26Z gcosmo $
28 // ------------------------------------------------------------
29 // GEANT 4 class implementation file
30 // CERN Geneva Switzerland
31 //
32 //
33 // ------------ GammaRayTelRunAction ------
34 // by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
35 // 18.11.2001 G.Santin
36 // - Modified the analysis management according to the new design
37 //
38 // ************************************************************
39 
40 
41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
43 
44 #include "GammaRayTelRunAction.hh"
45 
46 #ifdef G4ANALYSIS_USE
47 #include "GammaRayTelAnalysis.hh"
48 #endif
49 
50 #include <stdlib.h>
51 #include "G4Run.hh"
52 #include "G4UImanager.hh"
53 #include "G4VVisManager.hh"
54 #include "G4ios.hh"
55 
56 extern std::ofstream outFile;
57 
59 {
60 }
61 
62 
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
64 
66 {
67 }
68 
69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
70 
72 {
73 
74  // Open the file for the tracks of this run
75 
76  char name[15];
77  sprintf(name,"Tracks_%d.dat", aRun->GetRunID());
78 
79 #ifdef G4STORE_DATA
80  outFile.open(name);
81 #endif
82 
83  // Prepare the visualization
85  {
87  UI->ApplyCommand("/vis/scene/notifyHandlers");
88  }
89 
90  // If analysis is used reset the histograms
91 #ifdef G4ANALYSIS_USE
92  GammaRayTelAnalysis* analysis = GammaRayTelAnalysis::getInstance();
93  // analysis->BeginOfRun(aRun->GetRunID());
94  analysis->BeginOfRun();
95 #endif
96 }
97 
98 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
99 
101 {
102  char name[15];
103  sprintf(name,"Tracks_%d.dat", aRun->GetRunID());
104  G4cout << "End of Run " << G4endl;
105  G4cout << "File " << name << G4endl;
106 
107 /*
108  // Run ended, update the visualization
109  if (G4VVisManager::GetConcreteInstance()) {
110  G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
111  }
112 */
113 
114  // Close the file with the hits information
115 #ifdef G4STORE_DATA
116  outFile.close();
117 #endif
118 
119  // If analysis is used, print out the histograms
120 #ifdef G4ANALYSIS_USE
121  GammaRayTelAnalysis* analysis = GammaRayTelAnalysis::getInstance();
122  analysis->EndOfRun();
123 #endif
124 }
125 
126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
127 
128 
129 
130 
131 
132 
133 
134 
static G4VVisManager * GetConcreteInstance()
G4String name
Definition: TRTMaterials.hh:40
void BeginOfRunAction(const G4Run *)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
G4GLOB_DLL std::ostream G4cout
std::ofstream outFile
Definition: GammaRayTel.cc:68
void EndOfRunAction(const G4Run *)
G4int GetRunID() const
Definition: G4Run.hh:76
Definition: G4Run.hh:46
#define G4endl
Definition: G4ios.hh:61
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:432