BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSEventInfo.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2022.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#ifndef BDSEVENTINFO_H
20#define BDSEVENTINFO_H
21
22#include "BDSOutputROOTEventInfo.hh"
23
24#include "globals.hh" // geant4 types / globals
25#include "G4VUserEventInformation.hh"
26
27#include <ctime>
28
41class BDSEventInfo: public G4VUserEventInformation
42{
43public:
45 virtual ~BDSEventInfo();
46
47 virtual void Print() const;
48
50 inline void SetStartTime(const time_t& startTimeIn) {info->startTime = startTimeIn;}
51 inline void SetStopTime(const time_t& stopTimeIn) {info->stopTime = stopTimeIn;}
52 inline void SetDurationWall(G4float durationWallIn) {info->durationWall = (float)durationWallIn;}
53 inline void SetDurationCPU(G4float durationCPUIn) {info->durationCPU = (float)durationCPUIn;}
54 inline void SetSeedStateAtStart(const G4String& seedStateAtStartIn) {info->seedStateAtStart = (std::string)seedStateAtStartIn;}
55 inline void SetIndex(G4int indexIn) {info->index = (int)indexIn;}
56 inline void SetAborted(G4bool abortedIn) {info->aborted = (bool)abortedIn;}
57 inline void SetPrimaryHitMachine(G4bool hitIn) {info->primaryHitMachine = (bool)hitIn;}
58 inline void SetMemoryUsage(G4double memoryUsageMbIn) {info->memoryUsageMb = (double)memoryUsageMbIn;}
59 inline void SetPrimaryAbsorbedInCollimator(G4bool absorbed) {info->primaryAbsorbedInCollimator = absorbed;}
60 inline void SetNTracks(long long int nTracks) {info->nTracks = nTracks;}
62
64 inline const BDSOutputROOTEventInfo* GetInfo() const {return info;}
65
66 virtual void Flush() {info->Flush();}
67
68protected:
71};
72
73#endif
Interface to store event information use G4 hooks.
Definition: BDSEventInfo.hh:42
void SetPrimaryAbsorbedInCollimator(G4bool absorbed)
Setters.
Definition: BDSEventInfo.hh:59
void SetNTracks(long long int nTracks)
Setters.
Definition: BDSEventInfo.hh:60
void SetStopTime(const time_t &stopTimeIn)
Setters.
Definition: BDSEventInfo.hh:51
BDSOutputROOTEventInfo * info
Instance of info.
Definition: BDSEventInfo.hh:70
void SetMemoryUsage(G4double memoryUsageMbIn)
Setters.
Definition: BDSEventInfo.hh:58
void SetPrimaryHitMachine(G4bool hitIn)
Setters.
Definition: BDSEventInfo.hh:57
void SetStartTime(const time_t &startTimeIn)
Setters.
Definition: BDSEventInfo.hh:50
void SetIndex(G4int indexIn)
Setters.
Definition: BDSEventInfo.hh:55
const BDSOutputROOTEventInfo * GetInfo() const
Accessor.
Definition: BDSEventInfo.hh:64
void SetAborted(G4bool abortedIn)
Setters.
Definition: BDSEventInfo.hh:56
void SetDurationCPU(G4float durationCPUIn)
Setters.
Definition: BDSEventInfo.hh:53
void SetSeedStateAtStart(const G4String &seedStateAtStartIn)
Setters.
Definition: BDSEventInfo.hh:54
void SetDurationWall(G4float durationWallIn)
Setters.
Definition: BDSEventInfo.hh:52
Information pertaining to an individual event.
double memoryUsageMb
Memory usage (rusage.ru_maxrss).
bool aborted
Whether the event was aborted or not.
int index
Number of this event or run.
long long int nTracks
Number of tracks in the event.
float durationWall
Number of seconds event took (wall time) to complete simulation (not writing out).
time_t startTime
Time stamp at start of event.
bool primaryHitMachine
Wether the primary particle hit the accelerator or not.
float durationCPU
Number of seconds event took (CPU time).
time_t stopTime
Time stamp at end of event.
std::string seedStateAtStart
Seed state at the start of the event.
bool primaryAbsorbedInCollimator
Whether the primary stopped in a collimator.