source: trunk/examples/advanced/gammaray_telescope/src/GammaRayTelRunAction.cc @ 1282

Last change on this file since 1282 was 1230, checked in by garnier, 14 years ago

update to geant4.9.3

File size: 4.2 KB
Line 
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,v 1.11 2006/06/29 15:57:04 gunter Exp $
28// GEANT4 tag $Name: geant4-09-03-cand-01 $
29// ------------------------------------------------------------
30//      GEANT 4 class implementation file
31//      CERN Geneva Switzerland
32//
33//
34//      ------------ GammaRayTelRunAction  ------
35//           by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
36// 18.11.2001 G.Santin
37// - Modified the analysis management according to the new design
38//
39// ************************************************************
40
41
42//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
43//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
44
45#include "GammaRayTelRunAction.hh"
46
47#ifdef  G4ANALYSIS_USE
48#include "GammaRayTelAnalysis.hh"
49#endif
50
51#include <stdlib.h>
52#include "G4Run.hh"
53#include "G4UImanager.hh"
54#include "G4VVisManager.hh"
55#include "G4ios.hh"
56
57extern std::ofstream outFile;
58
59GammaRayTelRunAction::GammaRayTelRunAction()
60{
61}
62
63
64//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
65
66GammaRayTelRunAction::~GammaRayTelRunAction()
67{
68}
69
70//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
71
72void GammaRayTelRunAction::BeginOfRunAction(const G4Run* aRun)
73{ 
74
75  // Open the file for the tracks of this run
76
77  char name[15];
78  sprintf(name,"Tracks_%d.dat", aRun->GetRunID());
79
80#ifdef G4STORE_DATA
81  outFile.open(name);
82#endif
83
84  // Prepare the visualization
85  if (G4VVisManager::GetConcreteInstance())
86    {
87      G4UImanager* UI = G4UImanager::GetUIpointer(); 
88      UI->ApplyCommand("/vis/scene/notifyHandlers");
89    } 
90
91  // If analysis is used reset the histograms
92#ifdef G4ANALYSIS_USE
93  GammaRayTelAnalysis* analysis = GammaRayTelAnalysis::getInstance();
94  //  analysis->BeginOfRun(aRun->GetRunID());
95  analysis->BeginOfRun();
96#endif
97}
98
99//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
100
101void GammaRayTelRunAction::EndOfRunAction(const G4Run* aRun)
102{
103  char name[15];
104  sprintf(name,"Tracks_%d.dat", aRun->GetRunID());
105  G4cout << "End of Run " << G4endl;
106  G4cout << "File " << name << G4endl;
107
108  // Run ended, update the visualization
109  if (G4VVisManager::GetConcreteInstance()) {
110     G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
111  }
112
113  // Close the file with the hits information
114#ifdef G4STORE_DATA
115  outFile.close();
116#endif
117
118  // If analysis is used, print out the histograms
119#ifdef G4ANALYSIS_USE
120  GammaRayTelAnalysis* analysis = GammaRayTelAnalysis::getInstance();
121  analysis->EndOfRun(aRun->GetRunID());
122#endif
123}
124
125//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
126
127
128
129
130
131
132
133
Note: See TracBrowser for help on using the repository browser.