source: trunk/examples/extended/parallel/ExDiane/src/BrachyRunAction.cc@ 1357

Last change on this file since 1357 was 1337, checked in by garnier, 15 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 3.9 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// --------------------------------------------------------------
28// GEANT 4 - Brachytherapy example
29// --------------------------------------------------------------
30//
31// Code developed by:
32// S.Guatelli
33//
34//
35// *******************************
36// * *
37// * BrachyRunAction.cc *
38// * *
39// *******************************
40//
41// $Id: BrachyRunAction.cc,v 1.4 2010/06/06 05:06:03 perl Exp $
42// GEANT4 tag $Name: geant4-09-04-beta-01 $
43//
44
45#include "BrachyRunAction.hh"
46
47#ifdef G4ANALYSIS_USE
48#include "BrachyAnalysisManager.hh"
49#endif
50
51#include "G4Run.hh"
52#include "G4RunManager.hh"
53#include "G4UImanager.hh"
54#include "G4ios.hh"
55#include "BrachyDetectorConstruction.hh"
56#include "BrachyRunMessenger.hh"
57#include "G4SDManager.hh"
58#include "G4Timer.hh"
59#include "BrachyFactoryIr.hh"
60#include "BrachyFactoryI.hh"
61#include "BrachyFactory.hh"
62#include "BrachyRunAction.hh"
63
64BrachyRunAction::BrachyRunAction()
65{
66 runMessenger = new BrachyRunMessenger(this);
67}
68
69BrachyRunAction::~BrachyRunAction()
70{
71 delete runMessenger;
72}
73void BrachyRunAction::BeginOfRunAction(const G4Run*)
74{
75#ifdef G4ANALYSIS_USE
76 BrachyAnalysisManager* analysis = BrachyAnalysisManager::getInstance();
77 analysis -> book();
78#endif
79 G4RunManager* runManager = G4RunManager::GetRunManager();
80
81 if(runManager)
82 { switch(sourceChoice)
83 {
84 case 1:
85 factory = new BrachyFactoryI;
86 break;
87 default:
88 factory = new BrachyFactoryIr;
89 }
90 G4VUserPrimaryGeneratorAction* sourcePrimaryParicle =
91 factory -> CreatePrimaryGeneratorAction();
92
93 if(sourcePrimaryParicle) runManager -> SetUserAction(sourcePrimaryParicle);
94 }
95}
96
97void BrachyRunAction::SelectEnergy(G4int choice)
98{
99 sourceChoice = choice;
100 if (sourceChoice == 1) factory = new BrachyFactoryI;
101 else factory = new BrachyFactoryIr;
102}
103
104void BrachyRunAction::EndOfRunAction(const G4Run* aRun)
105{
106#ifdef G4ANALYSIS_USE
107 BrachyAnalysisManager* analysis = BrachyAnalysisManager::getInstance();
108#endif
109 G4cout << "number of event = " << aRun -> GetNumberOfEvent() << G4endl;
110
111#ifdef G4ANALYSIS_USE
112 analysis -> finish();
113#endif
114
115 delete factory;
116}
117
118
119
120
Note: See TracBrowser for help on using the repository browser.