20#include "BDSException.hh"
21#include "BDSGlobalConstants.hh"
22#include "BDSOutputROOT.hh"
23#include "BDSOutputROOTEventAperture.hh"
24#include "BDSOutputROOTEventBeam.hh"
25#include "BDSOutputROOTEventCollimator.hh"
26#include "BDSOutputROOTEventCoords.hh"
27#include "BDSOutputROOTEventLossWorld.hh"
28#include "BDSOutputROOTEventHeader.hh"
29#include "BDSOutputROOTEventHistograms.hh"
30#include "BDSOutputROOTEventInfo.hh"
31#include "BDSOutputROOTEventLoss.hh"
32#include "BDSOutputROOTEventModel.hh"
33#include "BDSOutputROOTEventOptions.hh"
34#include "BDSOutputROOTEventRunInfo.hh"
35#include "BDSOutputROOTEventSampler.hh"
36#include "BDSOutputROOTEventSamplerC.hh"
37#include "BDSOutputROOTEventSamplerS.hh"
38#include "BDSOutputROOTEventTrajectory.hh"
39#include "BDSOutputROOTParticleData.hh"
41#include "parser/options.h"
48 G4int fileNumberOffset,
49 G4int compressionLevelIn):
50 BDSOutput(fileName,
".root", fileNumberOffset),
51 compressionLevel(compressionLevelIn),
52 theRootOutputFile(nullptr),
53 theHeaderOutputTree(nullptr),
54 theParticleDataTree(nullptr),
55 theBeamOutputTree(nullptr),
56 theOptionsOutputTree(nullptr),
57 theModelOutputTree(nullptr),
58 theEventOutputTree(nullptr),
59 theRunOutputTree(nullptr)
62BDSOutputROOT::~BDSOutputROOT()
74 {
throw BDSException(__METHOD_NAME__,
"Unable to open output file: \"" + newFileName +
"\"");}
109 theEventOutputTree->Branch(
"PrimaryGlobal.",
"BDSOutputROOTEventCoords", primaryGlobal, 3200, 1);
144 "BDSOutputROOTEventSampler",
145 samplerTreeLocal, 32000, globals->SamplersSplitLevel());
147 for (G4int i = 0; i < (G4int)samplerCTrees.size(); ++i)
149 auto samplerTreeLocal = samplerCTrees.at(i);
150 auto samplerName = samplerCNames.at(i);
152 "BDSOutputROOTEventSamplerC",
153 samplerTreeLocal, 32000, globals->SamplersSplitLevel());
155 for (G4int i = 0; i < (G4int)samplerSTrees.size(); ++i)
157 auto samplerTreeLocal = samplerSTrees.at(i);
158 auto samplerName = samplerSNames.at(i);
160 "BDSOutputROOTEventSamplerS",
161 samplerTreeLocal, 32000, globals->SamplersSplitLevel());
167 for (G4int i = 0; i < (G4int)
collimators.size(); ++i)
173 "BDSOutputROOTEventCollimator",
174 collimatorLocal, 32000, globals->SamplersSplitLevel());
245 G4cout << __METHOD_NAME__ <<
"Data written to file: " <<
theRootOutputFile->GetName() << G4endl;
257 for (G4int i = nSamplers - nNewSamplers; i < nSamplers; ++i)
263 "BDSOutputROOTEventSampler",
264 samplerTreeLocal,32000,0);
General exception with possible name of object and message.
A class that holds global options and constants.
static BDSGlobalConstants * Instance()
Access method.
G4int compressionLevel
ROOT compression level for files.
virtual void WriteModel()
Copy model and write to file.
virtual void WriteHeader()
Copy header and write to file.
virtual void WriteHeaderEndOfFile()
Overwrite contents of header in the file.
virtual void WriteFileRunLevel()
virtual void WriteParticleData()
Copy geant4 data to file.
TTree * theBeamOutputTree
Beam Tree.
virtual void UpdateSamplers()
Implementation for ROOT output. Only for link - not for regular use.
TTree * theParticleDataTree
Geant4 Data Tree.
TTree * theOptionsOutputTree
Options tree.
virtual void WriteOptions()
Copy options and write to file.
virtual void WriteBeam()
Copy beam and write to file.
TTree * theEventOutputTree
Event tree.
TTree * theModelOutputTree
Model tree.
virtual void CloseFile()
Write contents and close file.
virtual void NewFile()
Open a new file.
TTree * theRunOutputTree
Output histogram tree.
virtual void WriteFileEventLevel()
TTree * theHeaderOutputTree
Header Tree.
BDSOutputROOT()=delete
No default constructor.
TFile * theRootOutputFile
Output file.
BDSOutputROOTEventModel * modelOutput
Model output.
std::vector< G4String > collimatorNames
Names of collimators in output structures.
std::vector< BDSOutputROOTEventCollimator * > collimators
Collimator output structures.
std::vector< std::string > samplerNames
Sampler names to use.
BDSOutputROOTEventSampler< double > * primary
Primary sampler structure.
BDSOutputROOTEventRunInfo * runInfo
Run information.
BDSOutputROOTEventHistograms * runHistos
Run level histograms.
BDSOutputROOTEventLossWorld * eLossWorldExit
World exit hits.
BDSOutputROOTEventLossWorld * eLossWorldContents
Externally supplied world contents hits.
std::vector< BDSOutputROOTEventSampler< double > * > samplerTrees
Sampler structures.
BDSOutputROOTEventHeader * headerOutput
Information about the file.
BDSOutputROOTEventLossWorld * eLossWorld
World energy deposition.
BDSOutputROOTEventLoss * eLossVacuum
General energy deposition.
BDSOutputROOTEventInfo * evtInfo
Event information.
BDSOutputROOTEventLoss * pLastHit
Primary loss point.
BDSOutputROOTEventHistograms * evtHistos
Event level histograms.
BDSOutputROOTEventLoss * eLossTunnel
Tunnel energy deposition.
G4int UpdateSamplerStructures()
Interface to allow setting up samplers later for dynamic geometry construction a la SixTrack....
BDSOutputROOTEventLoss * pFirstHit
Primary hit point.
BDSOutputROOTEventTrajectory * traj
Trajectories.
BDSOutputROOTEventBeam * beamOutput
Beam output.
BDSOutputROOTEventLoss * eLoss
General energy deposition.
BDSOutputROOTEventAperture * apertureImpacts
Impacts on the aperture.
BDSOutputROOTParticleData * particleDataOutput
Geant4 information / particle tables.
BDSOutputROOTEventOptions * optionsOutput
Options output.
Output base class that defines interface for all output types.
G4bool CreateCollimatorOutputStructures() const
Whether to create the collimator structures in the output or not.
G4bool storePrimaries
Options for dynamic bits of output.
G4bool storeTrajectory
Options for dynamic bits of output.
G4String GetNextFileName()
Get the next file name based on the base file name and the accrued number of files.
G4bool storeELoss
Options for dynamic bits of output.
G4bool storeELossWorldContents
Options for dynamic bits of output.
void FillHeader()
Fill the local structure header with information - updates time stamp.
G4bool storeELossWorld
Options for dynamic bits of output.
G4bool storeELossVacuum
Options for dynamic bits of output.
G4bool storeELossTunnel
Options for dynamic bits of output.
G4bool storeApertureImpacts
Options for dynamic bits of output.