source: trunk/examples/extended/medical/GammaTherapy/src/EventAction.cc

Last change on this file was 1337, checked in by garnier, 14 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 4.1 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//
29//      ---------- EventAction -------------
30//
31//  Modified: 05.04.01 Vladimir Ivanchenko new design of IBREM
32//
33// -------------------------------------------------------------
34
35//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
36//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
37
38#include "EventAction.hh"
39#include "Histo.hh"
40#include "EventActionMessenger.hh"
41
42#include "G4UImanager.hh"
43#include "G4ios.hh"
44
45//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
46
47EventAction::EventAction():
48  nEvt(0),
49  verbose(0),
50  printModulo(100),
51  nSelected(0),
52  //  drawFlag("all")
53  drawFlag("charged")
54  // drawFlag("neutral")
55{
56  // drawFlags = all, charged, neutral, charged+n
57  eventMessenger = new EventActionMessenger(this);
58  UI = G4UImanager::GetUIpointer();
59  selectedEvents.clear();
60}
61
62//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
63
64EventAction::~EventAction()
65{}
66
67//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
68
69void EventAction::BeginOfEventAction(const G4Event*)
70{
71  // New event
72  nEvt++;
73  (Histo::GetPointer())->AddEvent();
74
75  if(nSelected>0) {
76    for(G4int i=0; i<nSelected; i++) {
77      if(nEvt == selectedEvents[i]) {
78        UI->ApplyCommand("/random/saveThisEvent");
79      }
80    }
81  }
82
83  // Switch on verbose mode
84  /*
85  if(hi->GetFirstEventToDebug() == nEvt) {
86    verbose = 2;
87    hi->SetVerbose(2);
88    (G4UImanager::GetUIpointer())->ApplyCommand("/tracking/verbose 2");
89
90    const G4ProcessManager* pm = G4Gamma::Gamma()->GetProcessManager();
91    const G4ProcessVector* pv = pm->GetProcessList();
92    G4int np = pm->GetProcessListLength();
93    for(G4int i=0; i<np; i++) {
94     ((*pv)[i])->SetVerboseLevel(2);
95    }
96
97  }
98
99  // Switch off verbose mode
100  if(hi->GetLastEventToDebug() == nEvt-1) {
101    verbose = 0;
102    hi->SetVerbose(0);
103    (G4UImanager::GetUIpointer())->ApplyCommand("/tracking/verbose 0");
104  }
105  */
106
107  // Initialize user actions
108  if(verbose > 0) {
109    G4cout << "EventAction: Event # "
110           << nEvt << " started" << G4endl;
111  }
112
113}
114
115//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
116
117void EventAction::EndOfEventAction(const G4Event*)
118{
119  (Histo::GetPointer())->SaveEvent();
120
121  if(verbose > 0) {
122    G4cout << "EventAction: Event # "
123           << nEvt << " ended" << G4endl;
124  }
125}
126
127//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Note: See TracBrowser for help on using the repository browser.