BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
__w
bdsim
bdsim
src
BDSOutputROOTEventHeader.cc
1
/*
2
Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3
University of London 2001 - 2024.
4
5
This file is part of BDSIM.
6
7
BDSIM is free software: you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published
9
by the Free Software Foundation version 3 of the License.
10
11
BDSIM is distributed in the hope that it will be useful, but
12
WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License
17
along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
#include "BDSOutputROOTEventHeader.hh"
20
#include "BDSTrajectoryFilter.hh"
// no G4 types and for size of filters
21
#include "BDSVersion.hh"
22
#include "BDSVersionData.hh"
23
24
#include "G4Version.hh"
25
26
#include "TROOT.h"
27
28
#include "CLHEP/ClhepVersion.h"
29
30
#include <ctime>
31
#include <string>
32
#include <vector>
33
34
ClassImp(
BDSOutputROOTEventHeader
)
35
36
BDSOutputROOTEventHeader::BDSOutputROOTEventHeader()
37
{
38
FlushLocal
();
39
}
40
41
BDSOutputROOTEventHeader::~BDSOutputROOTEventHeader()
42
{;}
43
44
void
BDSOutputROOTEventHeader::FlushLocal
()
45
{
46
bdsimVersion = std::string(BDSIM_GIT_VERSION);
47
geant4Version = G4Version +
" "
+ G4Date +
" : v"
+ std::to_string(G4VERSION_NUMBER);
48
rootVersion = std::string(gROOT->GetVersion());
49
clhepVersion = CLHEP::Version::String();
50
timeStamp =
""
;
51
fileType =
"BDSIM"
;
52
dataVersion
= BDSIM_DATA_VERSION;
53
analysedFiles
.clear();
54
combinedFiles
.clear();
55
nTrajectoryFilters
= BDS::NTrajectoryFilters;
56
trajectoryFilters
.clear();
57
skimmedFile
=
false
;
58
nOriginalEvents
= 0;
59
nEventsRequested
= 0;
60
nEventsInFileSkipped
= 0;
61
nEventsInFile
= 0;
62
distrFileLoopNTimes
= 0;
63
64
#ifndef __ROOTDOUBLE__
65
doublePrecisionOutput
=
false
;
66
#else
67
doublePrecisionOutput
=
true
;
68
#endif
69
}
70
71
void
BDSOutputROOTEventHeader::Fill
(
const
std::vector<std::string>& analysedFilesIn,
72
const
std::vector<std::string>& combinedFilesIn)
73
{
74
time_t rawtime;
75
time(&rawtime);
76
timeStamp = std::string(ctime(&rawtime));
77
analysedFiles
= analysedFilesIn;
78
combinedFiles
= combinedFilesIn;
79
#ifndef __ROOTBUILD__
80
FillGeant4Side
();
81
#endif
82
}
83
84
#ifndef __ROOTBUILD__
85
void
BDSOutputROOTEventHeader::FillGeant4Side
()
86
{
87
for
(
int
i = 0; i <
nTrajectoryFilters
; i++)
88
{
trajectoryFilters
.push_back(BDS::BDSTrajectoryFilterEnumOfIndex(i).ToString());}
89
}
90
#endif
BDSOutputROOTEventHeader
Information about the software and the file.
Definition
BDSOutputROOTEventHeader.hh:35
BDSOutputROOTEventHeader::nEventsRequested
unsigned long long int nEventsRequested
Number of events requested to be simulated from the file.
Definition
BDSOutputROOTEventHeader.hh:59
BDSOutputROOTEventHeader::distrFileLoopNTimes
unsigned int distrFileLoopNTimes
Number of times a distribution file was replayed.
Definition
BDSOutputROOTEventHeader.hh:62
BDSOutputROOTEventHeader::nTrajectoryFilters
int nTrajectoryFilters
Length of bitset used for trajectory filtering - compile time info.
Definition
BDSOutputROOTEventHeader.hh:55
BDSOutputROOTEventHeader::dataVersion
int dataVersion
Our data format version.
Definition
BDSOutputROOTEventHeader.hh:51
BDSOutputROOTEventHeader::skimmedFile
bool skimmedFile
Whether this is a skimmed output file.
Definition
BDSOutputROOTEventHeader.hh:57
BDSOutputROOTEventHeader::analysedFiles
std::vector< std::string > analysedFiles
List of which files were analysed in case of a rebdsim output file.
Definition
BDSOutputROOTEventHeader.hh:53
BDSOutputROOTEventHeader::nEventsInFileSkipped
unsigned long long int nEventsInFileSkipped
Number of events from distribution file that were skipped due to filters.
Definition
BDSOutputROOTEventHeader.hh:61
BDSOutputROOTEventHeader::doublePrecisionOutput
bool doublePrecisionOutput
Whether using double precision output - assumed float if not.
Definition
BDSOutputROOTEventHeader.hh:52
BDSOutputROOTEventHeader::FlushLocal
void FlushLocal()
We have a non-virtual version as it's bad to call this from a constructor.
Definition
BDSOutputROOTEventHeader.cc:44
BDSOutputROOTEventHeader::nOriginalEvents
unsigned long long int nOriginalEvents
Number of original events if skimmed.
Definition
BDSOutputROOTEventHeader.hh:58
BDSOutputROOTEventHeader::combinedFiles
std::vector< std::string > combinedFiles
List of which files were combined in case of a rebdsimCombine output file.
Definition
BDSOutputROOTEventHeader.hh:54
BDSOutputROOTEventHeader::trajectoryFilters
std::vector< std::string > trajectoryFilters
Names of filters.
Definition
BDSOutputROOTEventHeader.hh:56
BDSOutputROOTEventHeader::Fill
void Fill(const std::vector< std::string > &analysedFilesIn=std::vector< std::string >(), const std::vector< std::string > &combinedFilesIn=std::vector< std::string >())
Definition
BDSOutputROOTEventHeader.cc:71
BDSOutputROOTEventHeader::nEventsInFile
unsigned long long int nEventsInFile
Number of events in the input distribution file irrespective of filters.
Definition
BDSOutputROOTEventHeader.hh:60
BDSOutputROOTEventHeader::FillGeant4Side
void FillGeant4Side()
Fill with information from Geant4 side of things.
Definition
BDSOutputROOTEventHeader.cc:85
Generated on Sat Oct 18 2025 18:31:05 for BDSIM by
1.9.8