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. | |
virtual void | CloseFile () |
Write contents and close file. | |
virtual void | UpdateSamplers () |
Implementation for ROOT output. Only for link - not for regular use. | |
![]() | |
BDSOutput (const G4String &baseFileNameIn, const G4String &fileExtentionIn, G4int fileNumberOffset) | |
Constructor with base file name (without extension or number suffix). | |
virtual void | NewFile ()=0 |
Open a new file. This should call WriteHeader() in it. | |
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. | |
void | FillHeader () |
Fill the local structure header with information - updates time stamp. | |
void | FillParticleData (G4bool writeIons) |
Fill the local structure particle data with information. Also calls WriteParticleData(). | |
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. | |
void | CloseAndOpenNewFile () |
Close a file and open a new one. | |
void | FillRun (const BDSEventInfo *info, unsigned long long int nOriginalEventsIn, unsigned long long int nEventsRequestedIn, unsigned long long int nEventsInOriginalDistrFileIn, unsigned long long int nEventsDistrFileSkippedIn, unsigned int distrFileLoopNTimesIn) |
Copy run information to output structure. | |
Private Member Functions | |
virtual void | WriteHeader () |
Copy header and write to file. | |
virtual void | WriteHeaderEndOfFile () |
Overwrite contents of header in the file. | |
virtual void | WriteParticleData () |
Copy geant4 data to file. | |
virtual void | WriteBeam () |
Copy beam and write to file. | |
virtual void | WriteOptions () |
Copy options and write to file. | |
virtual void | WriteModel () |
Copy model and write to file. | |
virtual void | WriteFileEventLevel () |
virtual void | WriteFileRunLevel () |
void | Close () |
Private Attributes | |
G4int | compressionLevel |
ROOT compression level for files. | |
TFile * | theRootOutputFile |
Output file. | |
TTree * | theHeaderOutputTree |
Header Tree. | |
TTree * | theParticleDataTree |
Geant4 Data Tree. | |
TTree * | theBeamOutputTree |
Beam Tree. | |
TTree * | theOptionsOutputTree |
Options tree. | |
TTree * | theModelOutputTree |
Model tree. | |
TTree * | theEventOutputTree |
Event tree. | |
TTree * | theRunOutputTree |
Output histogram tree. | |
Additional Inherited Members | |
![]() | |
static G4bool | InvalidSamplerName (const G4String &samplerName) |
Test whether a sampler name is invalid or not. | |
static void | PrintProtectedNames (std::ostream &out) |
Feedback for protected names. | |
![]() | |
G4String | GetNextFileName () |
Get the next file name based on the base file name and the accrued number of files. | |
G4bool | CreateCollimatorOutputStructures () const |
Whether to create the collimator structures in the output or not. | |
![]() | |
BDSOutputStructures (const BDSGlobalConstants *globals) | |
void | InitialiseSamplers () |
Construct samplers. | |
void | InitialiseMaterialMap () |
Construct a map of material pointer to integer ID and name. | |
G4int | UpdateSamplerStructures () |
Interface to allow setting up samplers later for dynamic geometry construction a la SixTrack. Not for regular use. | |
void | PrepareCollimatorInformation () |
void | PrepareCavityInformation () |
Extract number of collimators and their names from beam line. | |
void | InitialiseCollimators () |
Construct collimators. | |
void | ClearStructuresParticleData () |
Clear the local particle data structure. | |
void | ClearStructuresHeader () |
Clear the local header structure. | |
void | ClearStructuresModel () |
Clear the local model structure. | |
void | ClearStructuresBeam () |
Clear the local beam structure. | |
void | ClearStructuresOptions () |
Clear the local options structure. | |
void | ClearStructuresEventLevel () |
Clear the local structures in this class in preparation for a new event. | |
void | ClearStructuresRunLevel () |
Clear the local structures in this class in preparation for a new run. | |
G4int | Create1DHistogram (G4String name, G4String title, G4int nbins, G4double xmin, G4double xmax) |
Create histograms for both evtHistos and runHistos. Return index from evtHistos. | |
G4int | Create1DHistogram (G4String name, G4String title, std::vector< double > &edges) |
Create histograms for both evtHistos and runHistos. Return index from evtHistos. | |
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. | |
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. | |
![]() | |
std::map< G4String, G4int > | blmCollectionNameToHistogramID |
G4bool | storeELoss |
Options for dynamic bits of output. | |
G4bool | storeELossTunnel |
Options for dynamic bits of output. | |
G4bool | storeELossVacuum |
Options for dynamic bits of output. | |
G4bool | storeELossWorld |
Options for dynamic bits of output. | |
G4bool | storeELossWorldContents |
Options for dynamic bits of output. | |
G4bool | storeApertureImpacts |
Options for dynamic bits of output. | |
G4bool | storeApertureImpactsHistograms |
Options for dynamic bits of output. | |
G4bool | storePrimaries |
Options for dynamic bits of output. | |
G4bool | storeTrajectory |
Options for dynamic bits of output. | |
![]() | |
BDSOutputROOTParticleData * | particleDataOutput |
Geant4 information / particle tables. | |
BDSOutputROOTEventHeader * | headerOutput |
Information about the file. | |
BDSOutputROOTEventBeam * | beamOutput |
Beam output. | |
BDSOutputROOTEventOptions * | optionsOutput |
Options output. | |
BDSOutputROOTEventModel * | modelOutput |
Model output. | |
BDSOutputROOTEventSampler< double > * | primary |
Primary sampler structure. | |
BDSOutputROOTEventSampler< float > * | primary |
BDSOutputROOTEventCoords * | primaryGlobal |
std::vector< BDSOutputROOTEventSampler< double > * > | samplerTrees |
Sampler structures. | |
std::vector< BDSOutputROOTEventSampler< float > * > | samplerTrees |
std::vector< std::string > | samplerNames |
Sampler names to use. | |
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. | |
BDSOutputROOTEventHistograms * | runHistos |
Run level histograms. | |
BDSOutputROOTEventLoss * | eLoss |
General energy deposition. | |
BDSOutputROOTEventLoss * | pFirstHit |
Primary hit point. | |
BDSOutputROOTEventLoss * | pLastHit |
Primary loss point. | |
BDSOutputROOTEventLoss * | eLossVacuum |
General energy deposition. | |
BDSOutputROOTEventLoss * | eLossTunnel |
Tunnel energy deposition. | |
BDSOutputROOTEventLossWorld * | eLossWorld |
World energy deposition. | |
BDSOutputROOTEventLossWorld * | eLossWorldExit |
World exit hits. | |
BDSOutputROOTEventLossWorld * | eLossWorldContents |
Externally supplied world contents hits. | |
BDSOutputROOTEventAperture * | apertureImpacts |
Impacts on the aperture. | |
BDSOutputROOTEventTrajectory * | traj |
Trajectories. | |
BDSOutputROOTEventHistograms * | evtHistos |
Event level histograms. | |
BDSOutputROOTEventInfo * | evtInfo |
Event information. | |
std::vector< BDSOutputROOTEventCollimator * > | collimators |
Collimator output structures. | |
std::vector< G4String > | collimatorNames |
Names of collimators in output structures. | |
G4int | nCollimators |
Number of collimators in beam line. | |
std::vector< G4int > | collimatorIndices |
Indices in beam line that are collimators. | |
std::map< G4String, G4int > | collimatorIndicesByName |
Indices mapped to their name. | |
std::vector< BDSOutputROOTEventCollimatorInfo > | collimatorInfo |
std::vector< std::pair< G4double, G4double > > | collimatorDifferences |
std::vector< G4String > | cavityNames |
Names of cavities in output structures. | |
G4int | nCavities |
Number of cavities in beam line. | |
std::vector< G4int > | cavityIndices |
Indices in beam line that are cavities. | |
std::map< G4String, G4int > | cavityIndicesByName |
Indices mapped to their name. | |
std::vector< BDSOutputROOTEventCavityInfo > | cavityInfo |
Cavity parameters. | |
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 237 of file BDSOutputROOT.cc.
References theRootOutputFile.
Referenced by CloseFile().
|
virtual |
Write contents and close file.
Implements BDSOutput.
Definition at line 232 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 253 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 197 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 212 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 219 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 |
Overwrite contents of header in the file.
Implements BDSOutput.
Definition at line 186 of file BDSOutputROOT.cc.
References theHeaderOutputTree.
|
privatevirtual |
Copy model and write to file.
Implements BDSOutput.
Definition at line 207 of file BDSOutputROOT.cc.
References theModelOutputTree.
|
privatevirtual |
Copy options and write to file.
Implements BDSOutput.
Definition at line 202 of file BDSOutputROOT.cc.
References theOptionsOutputTree.
|
privatevirtual |
Copy geant4 data to file.
Implements BDSOutput.
Definition at line 192 of file BDSOutputROOT.cc.
References theParticleDataTree.
|
private |
ROOT compression level for files.
Definition at line 86 of file BDSOutputROOT.hh.
Referenced by NewFile().
|
private |
Beam Tree.
Definition at line 90 of file BDSOutputROOT.hh.
Referenced by NewFile(), and WriteBeam().
|
private |
Event tree.
Definition at line 93 of file BDSOutputROOT.hh.
Referenced by NewFile(), UpdateSamplers(), and WriteFileEventLevel().
|
private |
Header Tree.
Definition at line 88 of file BDSOutputROOT.hh.
Referenced by NewFile(), WriteHeader(), and WriteHeaderEndOfFile().
|
private |
Model tree.
Definition at line 92 of file BDSOutputROOT.hh.
Referenced by NewFile(), and WriteModel().
|
private |
Options tree.
Definition at line 91 of file BDSOutputROOT.hh.
Referenced by NewFile(), and WriteOptions().
|
private |
Geant4 Data Tree.
Definition at line 89 of file BDSOutputROOT.hh.
Referenced by NewFile(), and WriteParticleData().
|
private |
Output file.
Definition at line 87 of file BDSOutputROOT.hh.
Referenced by Close(), NewFile(), WriteFileEventLevel(), and WriteFileRunLevel().
|
private |
Output histogram tree.
Definition at line 94 of file BDSOutputROOT.hh.
Referenced by NewFile(), and WriteFileRunLevel().