ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
EventAction.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file EventAction.cc
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
//
31
//
32
// EventAction
33
//
34
// Created: 31.04.2006 V.Ivanchenko
35
//
36
// Modified:
37
// 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
38
//
40
//
41
42
#include "EventAction.hh"
43
#include "
G4Event.hh
"
44
#include "HistoManager.hh"
45
#include "EventActionMessenger.hh"
46
#include "
G4PhysicalConstants.hh
"
47
#include "
G4SystemOfUnits.hh
"
48
49
#include "
G4UImanager.hh
"
50
#include "
G4ios.hh
"
51
52
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
53
54
EventAction::EventAction
()
55
:
G4UserEventAction
(),
56
fEventMessenger(0),
57
fSelectedEvents(),
58
fNSelected(0),
59
fDebugStarted(
false
)
60
{
61
fEventMessenger
=
new
EventActionMessenger
(
this
);
62
}
63
64
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
65
66
EventAction::~EventAction
()
67
{
68
delete
fEventMessenger
;
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
(
fNSelected
>0) {
79
for
(
G4int
i=0; i<
fNSelected
; i++) {
80
if
(nEvt ==
fSelectedEvents
[i]) {
81
G4UImanager::GetUIpointer
()->
ApplyCommand
(
"/random/saveThisEvent"
);
82
G4UImanager::GetUIpointer
()->
ApplyCommand
(
"/tracking/verbose 2"
);
83
fDebugStarted
=
true
;
84
break
;
85
}
86
}
87
}
88
89
// Initialize user actions
90
HistoManager
* man =
HistoManager::GetPointer
();
91
man->
BeginOfEvent
();
92
if
( man->
GetVerbose
() > 0 ) {
93
G4cout
<<
"EventAction: Event # "
<< nEvt <<
" started"
<<
G4endl
;
94
}
95
}
96
97
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
98
99
void
EventAction::EndOfEventAction
(
const
G4Event
*)
100
{
101
if
(
fDebugStarted
) {
102
G4UImanager::GetUIpointer
()->
ApplyCommand
(
"/tracking/verbose 0"
);
103
fDebugStarted
=
false
;
104
}
105
106
HistoManager
* man =
HistoManager::GetPointer
();
107
man->
EndOfEvent
();
108
if
(man->
GetVerbose
() > 1)
109
G4cout <<
"EventAction: Event ended"
<<
G4endl
;
110
}
111
112
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
113
114
void
EventAction::AddEventToDebug
(
G4int
val)
115
{
116
fSelectedEvents
.push_back(val);
117
fNSelected++;
118
}
119
120
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
geant4
tree
geant4-10.6-release
examples
extended
hadronic
Hadr02
src
EventAction.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:54
using
1.8.2 with
ECCE GitHub integration