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

Last change on this file since 1170 was 807, checked in by garnier, 16 years ago

update

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