BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSOutputROOTEventHeader.cc
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) BDSIM Collaboration, 2001 - 2026.
3
4This file is part of BDSIM.
5
6BDSIM is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation version 3 of the License.
9
10BDSIM is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along 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
34
35BDSOutputROOTEventHeader::BDSOutputROOTEventHeader()
36{
37 FlushLocal();
38}
39
40BDSOutputROOTEventHeader::~BDSOutputROOTEventHeader()
41{;}
42
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;
60 nEventsInFile = 0;
62
63#ifndef __ROOTDOUBLE__
65#else
67#endif
68}
69
70void 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__
80#endif
81}
82
83#ifndef __ROOTBUILD__
85{
86 for (int i = 0; i < nTrajectoryFilters; i++)
87 {trajectoryFilters.push_back(BDS::BDSTrajectoryFilterEnumOfIndex(i).ToString());}
88}
89#endif
Information about the software and the file.
unsigned long long int nEventsRequested
Number of events requested to be simulated from the file.
unsigned int distrFileLoopNTimes
Number of times a distribution file was replayed.
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.
unsigned long long int nEventsInFileSkipped
Number of events from distribution file that were skipped due to filters.
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 >())
unsigned long long int nEventsInFile
Number of events in the input distribution file irrespective of filters.
void FillGeant4Side()
Fill with information from Geant4 side of things.