Geant4
9.6.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4_9_6_p02
examples
extended
hadronic
Hadr02
src
EventAction.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
//
28
//
29
// $Id$
30
//
32
//
33
// EventAction
34
//
35
// Created: 31.04.2006 V.Ivanchenko
36
//
37
// Modified:
38
// 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
39
//
41
//
42
43
#include "EventAction.hh"
44
#include "
G4Event.hh
"
45
#include "HistoManager.hh"
46
#include "EventActionMessenger.hh"
47
48
#include "
G4UImanager.hh
"
49
#include "
G4ios.hh
"
50
51
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
52
53
EventAction::EventAction
():
54
printModulo(100),
55
nSelected(0),
56
drawFlag(
"all"
),
57
debugStarted(false)
58
{
59
eventMessenger =
new
EventActionMessenger
(
this
);
60
UI =
G4UImanager::GetUIpointer
();
61
selectedEvents.clear();
62
}
63
64
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
65
66
EventAction::~EventAction
()
67
{
68
delete
eventMessenger;
69
}
70
71
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
72
73
void
EventAction::BeginOfEventAction
(
const
G4Event
* evt)
74
{
75
// New event
76
G4int
nEvt = evt->
GetEventID
();
77
78
if
(nSelected>0) {
79
for
(
G4int
i=0; i<nSelected; i++) {
80
if
(nEvt == selectedEvents[i]) {
81
UI->
ApplyCommand
(
"/random/saveThisEvent"
);
82
UI->
ApplyCommand
(
"/tracking/verbose 2"
);
83
debugStarted =
true
;
84
break
;
85
}
86
}
87
}
88
89
// Initialize user actions
90
HistoManager
* man =
HistoManager::GetPointer
();
91
man->
BeginOfEvent
();
92
if
(man->
GetVerbose
() > 0 ||
G4int
(nEvt/printModulo)*printModulo == nEvt)
93
G4cout <<
"EventAction: Event # "
94
<< nEvt <<
" started"
<<
G4endl
;
95
96
}
97
98
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
99
100
void
EventAction::EndOfEventAction
(
const
G4Event
*)
101
{
102
if
(debugStarted) {
103
UI->
ApplyCommand
(
"/tracking/verbose 0"
);
104
debugStarted =
false
;
105
}
106
107
HistoManager
* man =
HistoManager::GetPointer
();
108
man->
EndOfEvent
();
109
if
(man->
GetVerbose
() > 1)
110
G4cout <<
"EventAction: Event ended"
<<
G4endl
;
111
}
112
113
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Generated on Sat May 25 2013 14:32:04 for Geant4 by
1.8.4