Download
|
User Forum
|
Contact Us
|
Bug Reports
Home
>
Examples
Loading...
Searching...
No Matches
basic
B4
B4b
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
//
26
//
27
/// \file B4/B4b/src/EventAction.cc
28
/// \brief Implementation of the B4b::EventAction class
29
30
#include "EventAction.hh"
31
#include "
RunData.hh
"
32
33
#include "G4RunManager.hh"
34
#include "G4Event.hh"
35
#include "G4UnitsTable.hh"
36
37
#include "Randomize.hh"
38
#include <iomanip>
39
40
namespace
B4b
41
{
42
43
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44
45
void
EventAction::PrintEventStatistics
(
46
G4double absoEdep, G4double absoTrackLength,
47
G4double gapEdep, G4double gapTrackLength)
const
48
{
49
// print event statistics
50
G4cout
51
<<
" Absorber: total energy: "
52
<< std::setw(7) <<
G4BestUnit
(absoEdep,
"Energy"
)
53
<<
" total track length: "
54
<< std::setw(7) <<
G4BestUnit
(absoTrackLength,
"Length"
)
55
<< G4endl
56
<<
" Gap: total energy: "
57
<< std::setw(7) <<
G4BestUnit
(gapEdep,
"Energy"
)
58
<<
" total track length: "
59
<< std::setw(7) <<
G4BestUnit
(gapTrackLength,
"Length"
)
60
<< G4endl;
61
}
62
63
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64
65
void
EventAction::BeginOfEventAction
(
const
G4Event
*
/*event*/
)
66
{
67
auto
runData
68
=
static_cast<
RunData
*
>
(
69
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
70
runData->
Reset
();
71
}
72
73
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
74
75
void
EventAction::EndOfEventAction
(
const
G4Event
* event)
76
{
77
auto
runData
78
=
static_cast<
RunData
*
>
(
79
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
80
runData->
FillPerEvent
();
81
82
//print per event (modulo n)
83
//
84
auto
eventID =
event
->GetEventID();
85
auto
printModulo = G4RunManager::GetRunManager()->GetPrintProgress();
86
if
( ( printModulo > 0 ) && ( eventID % printModulo == 0 ) ) {
87
PrintEventStatistics
(
88
runData->GetEdep(
kAbs
),
89
runData->GetTrackLength(
kAbs
),
90
runData->GetEdep(
kGap
),
91
runData->GetTrackLength(
kGap
));
92
G4cout <<
"--> End of event "
<< eventID <<
"\n"
<< G4endl;
93
}
94
}
95
96
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
97
98
}
RunData.hh
Definition of the B4b::RunData class.
B4b::EventAction::EndOfEventAction
void EndOfEventAction(const G4Event *event) override
Definition
EventAction.cc:75
B4b::EventAction::BeginOfEventAction
void BeginOfEventAction(const G4Event *event) override
Definition
EventAction.cc:65
B4b::EventAction::PrintEventStatistics
void PrintEventStatistics(G4double absoEdep, G4double absoTrackLength, G4double gapEdep, G4double gapTrackLength) const
Definition
EventAction.cc:45
B4b::RunData
Run data class.
Definition
Doxymodules_basic.h:143
B4b::RunData::FillPerEvent
void FillPerEvent()
Definition
RunData.cc:41
B4b::RunData::Reset
void Reset()
Definition
RunData.cc:63
G4BestUnit
G4Event
B4b
Definition
ActionInitialization.hh:42
B4b::kGap
const G4int kGap
Definition
RunData.hh:44
B4b::kAbs
const G4int kAbs
Definition
RunData.hh:43
Generated on Tue Jan 30 2024 12:18:44 for Geant4 examples by
1.9.8
Applications
|
User Support
|
Publications
|
Collaboration