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