BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSOutputROOTEventHeader.cc
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#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
35
36BDSOutputROOTEventHeader::BDSOutputROOTEventHeader()
37{
38 Flush();
39}
40
41BDSOutputROOTEventHeader::~BDSOutputROOTEventHeader()
42{;}
43
45{
46 bdsimVersion = std::string(BDSIM_GIT_VERSION);
47 geant4Version = G4Version;
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;
59
60#ifndef __ROOTDOUBLE__
62#else
64#endif
65}
66
67void BDSOutputROOTEventHeader::Fill(const std::vector<std::string>& analysedFilesIn,
68 const std::vector<std::string>& combinedFilesIn)
69{
70 time_t rawtime;
71 time(&rawtime);
72 timeStamp = std::string(ctime(&rawtime));
73 analysedFiles = analysedFilesIn;
74 combinedFiles = combinedFilesIn;
75#ifndef __ROOTBUILD__
77#endif
78}
79
80#ifndef __ROOTBUILD__
82{
83 for (int i = 0; i < nTrajectoryFilters; i++)
84 {trajectoryFilters.push_back(BDS::BDSTrajectoryFilterEnumOfIndex(i).ToString());}
85}
86#endif
Information about the software and the file.
int nTrajectoryFilters
Length of bitset used for trajectory filtering - compile time info.
int dataVersion
Our data format version.
bool skimmedFile
Whether this is a skimmed output file.
std::vector< std::string > analysedFiles
List of which files were analysed in case of a rebdsim output file.
bool doublePrecisionOutput
Whether using double precision output - assumed float if not.
void FlushLocal()
We have a non-virtual version as it's bad to call this from a constructor.
unsigned long long int nOriginalEvents
Number of original events if skimmed.
std::vector< std::string > combinedFiles
List of which files were combined in case of a rebdsimCombine output file.
std::vector< std::string > trajectoryFilters
Names of filters.
void Fill(const std::vector< std::string > &analysedFilesIn=std::vector< std::string >(), const std::vector< std::string > &combinedFilesIn=std::vector< std::string >())
void FillGeant4Side()
Fill with information from Geant4 side of things.