BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
|
ROOT Event output class. More...
#include <BDSOutputROOT.hh>
Public Member Functions | |
BDSOutputROOT ()=delete | |
No default constructor. | |
BDSOutputROOT (const G4String &fileName, G4int fileNumberOffset, G4int compressionLevelIn=-1) | |
virtual void | NewFile () |
Open a new file. More... | |
virtual void | CloseFile () |
Write contents and close file. More... | |
virtual void | UpdateSamplers () |
Implementation for ROOT output. Only for link - not for regular use. More... | |
![]() | |
BDSOutput (const G4String &baseFileNameIn, const G4String &fileExtentionIn, G4int fileNumberOffset) | |
Constructor with base file name (without extension or number suffix). More... | |
virtual void | NewFile ()=0 |
Open a new file. This should call WriteHeader() in it. More... | |
virtual void | CloseFile ()=0 |
virtual void | InitialiseGeometryDependent () |
virtual void | UpdateSamplers () |
Interface to allow updating samplers with dynamic construction. Only for link - not for regular use. More... | |
void | FillHeader () |
Fill the local structure header with information - updates time stamp. More... | |
void | FillParticleData (G4bool writeIons) |
Fill the local structure particle data with information. Also calls WriteParticleData(). More... | |
void | FillBeam (const GMAD::BeamBase *beam) |
void | FillOptions (const GMAD::OptionsBase *options) |
void | FillModel () |
void | FillEventPrimaryOnly (const BDSParticleCoordsFullGlobal &coords, const BDSParticleDefinition *particle) |
void | FillEvent (const BDSEventInfo *info, const G4PrimaryVertex *vertex, const std::vector< BDSHitsCollectionSampler * > &samplerHitsPlane, const std::vector< BDSHitsCollectionSamplerCylinder * > &samplerHitsCylinder, const std::vector< BDSHitsCollectionSamplerSphere * > &samplerHitsSphere, const BDSHitsCollectionSamplerLink *samplerHitsLink, const BDSHitsCollectionEnergyDeposition *energyLoss, const BDSHitsCollectionEnergyDeposition *energyLossFull, const BDSHitsCollectionEnergyDeposition *energyLossVacuum, const BDSHitsCollectionEnergyDeposition *energyLossTunnel, const BDSHitsCollectionEnergyDepositionGlobal *energyLossWorld, const BDSHitsCollectionEnergyDepositionGlobal *energyLossWorldContents, const BDSHitsCollectionEnergyDepositionGlobal *worldExitHits, const std::vector< const BDSTrajectoryPointHit * > &primaryHits, const std::vector< const BDSTrajectoryPointHit * > &primaryLosses, const BDSTrajectoriesToStore *trajectories, const BDSHitsCollectionCollimator *collimatorHits, const BDSHitsCollectionApertureImpacts *apertureImpactHits, const std::map< G4String, G4THitsMap< G4double > * > &scorerHitsMap, const G4int turnsTaken) |
Copy event information from Geant4 simulation structures to output structures. More... | |
void | CloseAndOpenNewFile () |
Close a file and open a new one. More... | |
void | FillRun (const BDSEventInfo *info) |
Copy run information to output structure. More... | |
Private Member Functions | |
virtual void | WriteHeader () |
Copy header and write to file. More... | |
virtual void | WriteParticleData () |
Copy geant4 data to file. More... | |
virtual void | WriteBeam () |
Copy beam and write to file. More... | |
virtual void | WriteOptions () |
Copy options and write to file. More... | |
virtual void | WriteModel () |
Copy model and write to file. More... | |
virtual void | WriteFileEventLevel () |
virtual void | WriteFileRunLevel () |
void | Close () |
Private Attributes | |
G4int | compressionLevel |
ROOT compression level for files. More... | |
TFile * | theRootOutputFile |
Output file. More... | |
TTree * | theHeaderOutputTree |
Header Tree. More... | |
TTree * | theParticleDataTree |
Geant4 Data Tree. More... | |
TTree * | theBeamOutputTree |
Beam Tree. More... | |
TTree * | theOptionsOutputTree |
Options tree. More... | |
TTree * | theModelOutputTree |
Model tree. More... | |
TTree * | theEventOutputTree |
Event tree. More... | |
TTree * | theRunOutputTree |
Output histogram tree. More... | |
Additional Inherited Members | |
![]() | |
static G4bool | InvalidSamplerName (const G4String &samplerName) |
Test whether a sampler name is invalid or not. More... | |
static void | PrintProtectedNames (std::ostream &out) |
Feedback for protected names. More... | |
![]() | |
G4String | GetNextFileName () |
Get the next file name based on the base file name and the accrued number of files. More... | |
G4bool | CreateCollimatorOutputStructures () const |
Whether to create the collimator structures in the output or not. More... | |
![]() | |
BDSOutputStructures (const BDSGlobalConstants *globals) | |
void | InitialiseSamplers () |
Construct samplers. More... | |
void | InitialiseMaterialMap () |
Construct a map of material pointer to integer ID and name. More... | |
G4int | UpdateSamplerStructures () |
Interface to allow setting up samplers later for dynamic geometry construction a la SixTrack. Not for regular use. More... | |
void | PrepareCollimatorInformation () |
void | InitialiseCollimators () |
Construct collimtors. More... | |
void | ClearStructuresParticleData () |
Clear the local particle data structure. More... | |
void | ClearStructuresHeader () |
Clear the local header structure. More... | |
void | ClearStructuresModel () |
Clear the local model structure. More... | |
void | ClearStructuresBeam () |
Clear the local beam structure. More... | |
void | ClearStructuresOptions () |
Clear the local options structure. More... | |
void | ClearStructuresEventLevel () |
Clear the local structures in this class in preparation for a new event. More... | |
void | ClearStructuresRunLevel () |
Clear the local structures in this class in preparation for a new run. More... | |
G4int | Create1DHistogram (G4String name, G4String title, G4int nbins, G4double xmin, G4double xmax) |
Create histograms for both evtHistos and runHistos. Return index from evtHistos. More... | |
G4int | Create1DHistogram (G4String name, G4String title, std::vector< double > &edges) |
Create histograms for both evtHistos and runHistos. Return index from evtHistos. More... | |
G4int | Create3DHistogram (G4String name, G4String title, G4int nBinsX, G4double xMin, G4double xMax, G4int nBinsY, G4double yMin, G4double yMax, G4int nBinsZ, G4double zMin, G4double zMax) |
Create histograms for both evtHistos and runHistos. Return index from evtHistos. More... | |
G4int | Create4DHistogram (const G4String &name, const G4String &title, const G4String &eScale, const std::vector< double > &eBinsEdges, G4int nBinsX, G4double xMin, G4double xMax, G4int nBinsY, G4double yMin, G4double yMax, G4int nBinsZ, G4double zMin, G4double zMax, G4int nBinsE, G4double eMin, G4double eMax) |
Create histograms for both evtHistos and runHistos. Return index from evtHistos. More... | |
![]() | |
std::map< G4String, G4int > | blmCollectionNameToHistogramID |
G4bool | storeELoss |
Options for dynamic bits of output. More... | |
G4bool | storeELossTunnel |
Options for dynamic bits of output. More... | |
G4bool | storeELossVacuum |
Options for dynamic bits of output. More... | |
G4bool | storeELossWorld |
Options for dynamic bits of output. More... | |
G4bool | storeELossWorldContents |
Options for dynamic bits of output. More... | |
G4bool | storeApertureImpacts |
Options for dynamic bits of output. More... | |
G4bool | storeApertureImpactsHistograms |
Options for dynamic bits of output. More... | |
G4bool | storePrimaries |
Options for dynamic bits of output. More... | |
G4bool | storeTrajectory |
Options for dynamic bits of output. More... | |
![]() | |
BDSOutputROOTParticleData * | particleDataOutput |
Geant4 information / particle tables. More... | |
BDSOutputROOTEventHeader * | headerOutput |
Information about the file. More... | |
BDSOutputROOTEventBeam * | beamOutput |
Beam output. More... | |
BDSOutputROOTEventOptions * | optionsOutput |
Options output. More... | |
BDSOutputROOTEventModel * | modelOutput |
Model output. More... | |
BDSOutputROOTEventSampler< double > * | primary |
Primary sampler structure. More... | |
BDSOutputROOTEventSampler< float > * | primary |
BDSOutputROOTEventCoords * | primaryGlobal |
std::vector< BDSOutputROOTEventSampler< double > * > | samplerTrees |
Sampler structures. More... | |
std::vector< BDSOutputROOTEventSampler< float > * > | samplerTrees |
std::vector< std::string > | samplerNames |
Sampler names to use. More... | |
std::vector< BDSOutputROOTEventSamplerC * > | samplerCTrees |
std::vector< BDSOutputROOTEventSamplerS * > | samplerSTrees |
std::vector< std::string > | samplerCNames |
std::vector< std::string > | samplerSNames |
std::map< G4int, G4int > | samplerIDToIndexPlane |
std::map< G4int, G4int > | samplerIDToIndexCylinder |
std::map< G4int, G4int > | samplerIDToIndexSphere |
BDSOutputROOTEventRunInfo * | runInfo |
Run information. More... | |
BDSOutputROOTEventHistograms * | runHistos |
Run level histograms. More... | |
BDSOutputROOTEventLoss * | eLoss |
General energy deposition. More... | |
BDSOutputROOTEventLoss * | pFirstHit |
Primary hit point. More... | |
BDSOutputROOTEventLoss * | pLastHit |
Primary loss point. More... | |
BDSOutputROOTEventLoss * | eLossVacuum |
General energy deposition. More... | |
BDSOutputROOTEventLoss * | eLossTunnel |
Tunnel energy deposition. More... | |
BDSOutputROOTEventLossWorld * | eLossWorld |
World energy deposition. More... | |
BDSOutputROOTEventLossWorld * | eLossWorldExit |
World exit hits. More... | |
BDSOutputROOTEventLossWorld * | eLossWorldContents |
Externally supplied world contents hits. More... | |
BDSOutputROOTEventAperture * | apertureImpacts |
Impacts on the aperture. More... | |
BDSOutputROOTEventTrajectory * | traj |
Trajectories. More... | |
BDSOutputROOTEventHistograms * | evtHistos |
Event level histograms. More... | |
BDSOutputROOTEventInfo * | evtInfo |
Event information. More... | |
std::vector< BDSOutputROOTEventCollimator * > | collimators |
Collimator output structures. More... | |
std::vector< G4String > | collimatorNames |
Names of collimators in output structures. More... | |
G4int | nCollimators |
Number of collimators in beam line. More... | |
std::vector< G4int > | collimatorIndices |
Indices in beam line that are collimators. More... | |
std::map< G4String, G4int > | collimatorIndicesByName |
Indices mapped to their name. More... | |
std::vector< BDSOutputROOTEventCollimatorInfo > | collimatorInfo |
std::vector< std::pair< G4double, G4double > > | collimatorDifferences |
std::map< G4Material *, short int > | materialToID |
std::map< short int, G4String > | materialIDToNameUnique |
ROOT Event output class.
Definition at line 37 of file BDSOutputROOT.hh.
BDSOutputROOT::BDSOutputROOT | ( | const G4String & | fileName, |
G4int | fileNumberOffset, | ||
G4int | compressionLevelIn = -1 |
||
) |
Constructor with default file name (without extension or number suffix). Also, file number offset to start counting suffix from.
Definition at line 47 of file BDSOutputROOT.cc.
|
virtual |
Definition at line 62 of file BDSOutputROOT.cc.
|
private |
An implementation only in this class. We need a non-virtual function to call in the class destructor.
Definition at line 231 of file BDSOutputROOT.cc.
References theRootOutputFile.
Referenced by CloseFile().
|
virtual |
Write contents and close file.
Implements BDSOutput.
Definition at line 226 of file BDSOutputROOT.cc.
References Close().
|
virtual |
Open a new file.
Implements BDSOutput.
Definition at line 67 of file BDSOutputROOT.cc.
References BDSOutputStructures::apertureImpacts, BDSOutputStructures::beamOutput, BDSOutputStructures::collimatorNames, BDSOutputStructures::collimators, compressionLevel, BDSOutput::CreateCollimatorOutputStructures(), BDSOutputStructures::eLoss, BDSOutputStructures::eLossTunnel, BDSOutputStructures::eLossVacuum, BDSOutputStructures::eLossWorld, BDSOutputStructures::eLossWorldContents, BDSOutputStructures::eLossWorldExit, BDSOutputStructures::evtHistos, BDSOutputStructures::evtInfo, BDSOutput::FillHeader(), BDSOutput::GetNextFileName(), BDSOutputStructures::headerOutput, BDSGlobalConstants::Instance(), BDSOutputStructures::modelOutput, BDSOutputStructures::optionsOutput, BDSOutputStructures::particleDataOutput, BDSOutputStructures::pFirstHit, BDSOutputStructures::pLastHit, BDSOutputStructures::primary, BDSOutputStructures::runHistos, BDSOutputStructures::runInfo, BDSOutputStructures::samplerNames, BDSOutputStructures::samplerTrees, BDSOutput::storeApertureImpacts, BDSOutput::storeELoss, BDSOutput::storeELossTunnel, BDSOutput::storeELossVacuum, BDSOutput::storeELossWorld, BDSOutput::storeELossWorldContents, BDSOutput::storePrimaries, BDSOutput::storeTrajectory, theBeamOutputTree, theEventOutputTree, theHeaderOutputTree, theModelOutputTree, theOptionsOutputTree, theParticleDataTree, theRootOutputFile, theRunOutputTree, and BDSOutputStructures::traj.
|
virtual |
Implementation for ROOT output. Only for link - not for regular use.
Reimplemented from BDSOutput.
Definition at line 247 of file BDSOutputROOT.cc.
References BDSOutputStructures::samplerNames, BDSOutputStructures::samplerTrees, theEventOutputTree, and BDSOutputStructures::UpdateSamplerStructures().
|
privatevirtual |
Copy beam and write to file.
Implements BDSOutput.
Definition at line 191 of file BDSOutputROOT.cc.
References theBeamOutputTree.
|
privatevirtual |
Copy from local event structures to the actual file. Ony event level structures are copied.
Implements BDSOutput.
Definition at line 206 of file BDSOutputROOT.cc.
References theEventOutputTree, and theRootOutputFile.
|
privatevirtual |
Copy from local run structures to the actual file. Only run level structures are copied.
Implements BDSOutput.
Definition at line 213 of file BDSOutputROOT.cc.
References theRootOutputFile, and theRunOutputTree.
|
privatevirtual |
Copy header and write to file.
Implements BDSOutput.
Definition at line 181 of file BDSOutputROOT.cc.
References theHeaderOutputTree.
|
privatevirtual |
Copy model and write to file.
Implements BDSOutput.
Definition at line 201 of file BDSOutputROOT.cc.
References theModelOutputTree.
|
privatevirtual |
Copy options and write to file.
Implements BDSOutput.
Definition at line 196 of file BDSOutputROOT.cc.
References theOptionsOutputTree.
|
privatevirtual |
Copy geant4 data to file.
Implements BDSOutput.
Definition at line 186 of file BDSOutputROOT.cc.
References theParticleDataTree.
|
private |
ROOT compression level for files.
Definition at line 83 of file BDSOutputROOT.hh.
Referenced by NewFile().
|
private |
Beam Tree.
Definition at line 87 of file BDSOutputROOT.hh.
Referenced by NewFile(), and WriteBeam().
|
private |
Event tree.
Definition at line 90 of file BDSOutputROOT.hh.
Referenced by NewFile(), UpdateSamplers(), and WriteFileEventLevel().
|
private |
Header Tree.
Definition at line 85 of file BDSOutputROOT.hh.
Referenced by NewFile(), and WriteHeader().
|
private |
Model tree.
Definition at line 89 of file BDSOutputROOT.hh.
Referenced by NewFile(), and WriteModel().
|
private |
Options tree.
Definition at line 88 of file BDSOutputROOT.hh.
Referenced by NewFile(), and WriteOptions().
|
private |
Geant4 Data Tree.
Definition at line 86 of file BDSOutputROOT.hh.
Referenced by NewFile(), and WriteParticleData().
|
private |
Output file.
Definition at line 84 of file BDSOutputROOT.hh.
Referenced by Close(), NewFile(), WriteFileEventLevel(), and WriteFileRunLevel().
|
private |
Output histogram tree.
Definition at line 91 of file BDSOutputROOT.hh.
Referenced by NewFile(), and WriteFileRunLevel().