BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
|
Output base class that defines interface for all output types. More...
#include <BDSOutput.hh>
Public Member Functions | |
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... | |
Static Public Member Functions | |
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... | |
Protected Member Functions | |
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... | |
Private Types | |
enum class | LossType { energy , vacuum , tunnel , world , worldexit , worldcontents } |
Enum for different types of energy loss that can be written out. More... | |
Private Member Functions | |
virtual void | WriteHeader ()=0 |
Write the header. More... | |
virtual void | WriteParticleData ()=0 |
Write the geant4 information. More... | |
virtual void | WriteBeam ()=0 |
Write the beam. More... | |
virtual void | WriteOptions ()=0 |
Write the options. More... | |
virtual void | WriteModel ()=0 |
Write a representation of the samplers and beamline. More... | |
virtual void | WriteFileEventLevel ()=0 |
virtual void | WriteFileRunLevel ()=0 |
void | CalculateHistogramParameters () |
Calculate the number of bins and required maximum s. More... | |
void | CreateHistograms () |
Create histograms. More... | |
void | FillPrimary (const G4PrimaryVertex *vertex, const G4int turnsTaken) |
void | FillEventInfo (const BDSEventInfo *info) |
Fill event summary information. More... | |
void | FillSamplerHitsVector (const std::vector< BDSHitsCollectionSampler * > &hits) |
Fill sampler hits from a vector<sampler hits collection>. More... | |
void | FillSamplerCylinderHitsVector (const std::vector< BDSHitsCollectionSamplerCylinder * > &hits) |
void | FillSamplerSphereHitsVector (const std::vector< BDSHitsCollectionSamplerSphere * > &hits) |
void | FillSamplerHits (const BDSHitsCollectionSampler *hits) |
Fill sampler hits into output structures. More... | |
void | FillSamplerHitsLink (const BDSHitsCollectionSamplerLink *hits) |
Fill sampler link hits into output structures. More... | |
void | FillPrimaryHit (const std::vector< const BDSTrajectoryPointHit * > &primaryHits) |
Fill the hit where the primary particle impact. More... | |
void | FillEnergyLoss (const BDSHitsCollectionEnergyDeposition *loss, const LossType type) |
Fill a collection of energy hits into the appropriate output structure. More... | |
void | FillEnergyLoss (const BDSHitsCollectionEnergyDepositionGlobal *loss, const LossType type) |
Fill a collection of energy hits in global coordinates into the appropriate output structure. More... | |
void | FillPrimaryLoss (const std::vector< const BDSTrajectoryPointHit * > &primaryLosses) |
Fill a collection volume exit hits into the appropriate output structure. More... | |
void | FillTrajectories (const BDSTrajectoriesToStore *trajectories) |
Copy a set of trajectories to the output structure. More... | |
void | FillCollimatorHits (const BDSHitsCollectionCollimator *hits, const std::vector< const BDSTrajectoryPointHit * > &primaryLossPoints) |
Fill collimator hits. More... | |
void | FillApertureImpacts (const BDSHitsCollectionApertureImpacts *hits) |
Fill aperture impact hits. More... | |
void | FillScorerHits (const std::map< G4String, G4THitsMap< G4double > * > &scorerHitsMap) |
Fill a map of scorer hits into the output. More... | |
void | FillScorerHitsIndividual (const G4String &hsitogramDefName, const G4THitsMap< G4double > *hitMap) |
Fill an individual scorer hits map into a particular output histogram. More... | |
void | FillScorerHitsIndividualBLM (const G4String &histogramDefName, const G4THitsMap< G4double > *hitMap) |
void | FillRunInfo (const BDSEventInfo *info) |
Fill run level summary information. More... | |
void | CopyFromHistToHist1D (const G4String &sourceName, const G4String &destinationName, const std::vector< G4int > &indices) |
BDSOutput ()=delete | |
No default constructor. | |
Private Attributes | |
const G4String | baseFileName |
Base file name. More... | |
const G4String | fileExtension |
File extension to add to each file. More... | |
G4int | numberEventPerFile |
Number of events stored per file. More... | |
G4int | outputFileNumber |
Number of output file. More... | |
G4bool | useScoringMap |
Whether the single 3D histogram will be built. More... | |
G4double | sMaxHistograms |
G4int | nbins |
Number of bins for each histogram required. More... | |
G4bool | createCollimatorOutputStructures |
std::map< G4int, G4double > | histIndexToUnits1D |
std::map< G4int, G4double > | histIndexToUnits3D |
std::map< G4int, G4double > | histIndexToUnits4D |
G4bool | storeCollimatorInfo |
Storage option. More... | |
G4bool | storeCollimatorHits |
Storage option. More... | |
G4bool | storeCollimatorHitsLinks |
Storage option. More... | |
G4bool | storeCollimatorHitsIons |
Storage option. More... | |
G4bool | storeELossHistograms |
Storage option. More... | |
G4bool | storeELossTunnelHistograms |
Storage option. More... | |
G4bool | storeELossVacuumHistograms |
Storage option. More... | |
G4bool | storeParticleData |
Storage option. More... | |
G4bool | storePrimaryHistograms |
Storage option. More... | |
G4bool | storeModel |
Storage option. More... | |
G4bool | storeSamplerPolarCoords |
Storage option. More... | |
G4bool | storeSamplerCharge |
Storage option. More... | |
G4bool | storeSamplerKineticEnergy |
Storage option. More... | |
G4bool | storeSamplerMass |
Storage option. More... | |
G4bool | storeSamplerRigidity |
Storage option. More... | |
G4bool | storeSamplerIon |
Storage option. More... | |
G4int | storeTrajectoryStepPoints |
Storage option. More... | |
G4bool | storeTrajectoryStepPointLast |
Storage option. More... | |
BDS::TrajectoryOptions | storeTrajectoryOptions |
Storage option. More... | |
G4double | energyDeposited |
Integral when filling hit. More... | |
G4double | energyDepositedVacuum |
Integral when filling hit. More... | |
G4double | energyDepositedWorld |
Integral when filling hit. More... | |
G4double | energyDepositedWorldContents |
Integral when filling hit. More... | |
G4double | energyDepositedTunnel |
Integral when filling hit. More... | |
G4double | energyImpactingAperture |
Integral when filling hit. More... | |
G4double | energyImpactingApertureKinetic |
Integral when filling hit. More... | |
G4double | energyWorldExit |
Integral when filling hit. More... | |
G4double | energyWorldExitKinetic |
Integral when filling hit. More... | |
G4int | nCollimatorsInteracted |
Integral when filling hit. More... | |
std::map< G4String, G4int > | histIndices1D |
Map of histogram name (short) to index of histogram in output. More... | |
std::map< G4String, G4int > | histIndices3D |
Map of histogram name (short) to index of histogram in output. More... | |
std::map< G4String, G4int > | histIndices4D |
Map of histogram name (short) to index of histogram in output. More... | |
std::map< G4String, BDSHistBinMapper > | scorerCoordinateMaps |
Map of histogram name (short) to index of histogram in output. More... | |
Static Private Attributes | |
static const std::set< G4String > | protectedNames |
Invalid names for samplers - kept here as this is where the output structures are created. More... | |
Output base class that defines interface for all output types.
Definition at line 72 of file BDSOutput.hh.
|
strongprivate |
Enum for different types of energy loss that can be written out.
Definition at line 182 of file BDSOutput.hh.
BDSOutput::BDSOutput | ( | const G4String & | baseFileNameIn, |
const G4String & | fileExtentionIn, | ||
G4int | fileNumberOffset | ||
) |
Constructor with base file name (without extension or number suffix).
Definition at line 96 of file BDSOutput.cc.
References createCollimatorOutputStructures, BDSGlobalConstants::Instance(), numberEventPerFile, storeApertureImpacts, storeApertureImpactsHistograms, storeCollimatorHits, storeCollimatorHitsIons, storeCollimatorHitsLinks, storeCollimatorInfo, storeELoss, storeELossHistograms, storeELossTunnel, storeELossTunnelHistograms, storeELossVacuum, storeELossVacuumHistograms, storeELossWorld, storeELossWorldContents, storeModel, storeParticleData, storePrimaries, storePrimaryHistograms, storeSamplerCharge, storeSamplerIon, storeSamplerKineticEnergy, storeSamplerMass, storeSamplerPolarCoords, storeSamplerRigidity, storeTrajectory, BDSGlobalConstants::StoreTrajectoryOptions(), storeTrajectoryOptions, storeTrajectoryStepPointLast, storeTrajectoryStepPoints, BDSGlobalConstants::UseImportanceSampling(), and useScoringMap.
|
inlinevirtual |
Definition at line 79 of file BDSOutput.hh.
|
private |
Calculate the number of bins and required maximum s.
Definition at line 424 of file BDSOutput.cc.
References BDSAcceleratorModel::BeamlineMain(), BDSBeamline::empty(), BDSBeamline::GetLastItem(), BDSBeamlineElement::GetSPositionEnd(), BDSGlobalConstants::Instance(), nbins, and sMaxHistograms.
Referenced by CreateHistograms().
void BDSOutput::CloseAndOpenNewFile | ( | ) |
Close a file and open a new one.
Definition at line 364 of file BDSOutput.cc.
References CloseFile(), InitialiseGeometryDependent(), and NewFile().
|
pure virtual |
Write any unwritten contents and close the currently open file. The instance should be safe to delete after calling this method.
Implemented in BDSOutputNone, and BDSOutputROOT.
Referenced by CloseAndOpenNewFile(), BDSIM::Initialise(), and BDSIMLink::~BDSIMLink().
|
private |
Utility function to copy out select bins from one histogram to another for 1D histograms only.
Definition at line 1193 of file BDSOutput.cc.
References BDSOutputStructures::evtHistos, BDSOutputROOTEventHistograms::Get1DHistogram(), histIndices1D, and BDSOutputStructures::runHistos.
Referenced by FillEnergyLoss(), FillPrimaryHit(), and FillPrimaryLoss().
|
inlineprotected |
Whether to create the collimator structures in the output or not.
Definition at line 160 of file BDSOutput.hh.
References createCollimatorOutputStructures.
Referenced by BDSOutputROOT::NewFile().
|
private |
Create histograms.
Definition at line 447 of file BDSOutput.cc.
References BDSAcceleratorModel::BeamlineMain(), blmCollectionNameToHistogramID, CalculateHistogramParameters(), BDSOutputStructures::Create1DHistogram(), BDSOutputStructures::Create3DHistogram(), BDSOutputStructures::Create4DHistogram(), BDSBeamline::GetEdgeSPositions(), histIndexToUnits1D, histIndices1D, histIndices3D, histIndices4D, BDSBLMRegistry::Instance(), BDSGlobalConstants::Instance(), BDS::IsFinite(), nbins, BDSOutputStructures::nCollimators, BDSSDManager::PrimitiveScorerNames(), BDSSDManager::PrimitiveScorerNamesComplete(), BDSSDManager::PrimitiveScorerUnits(), scorerCoordinateMaps, BDSAcceleratorModel::ScorerHistogramDefinitionsMap(), sMaxHistograms, storeApertureImpactsHistograms, storeCollimatorInfo, storeELossHistograms, storeELossTunnel, storeELossTunnelHistograms, storeELossVacuumHistograms, storePrimaryHistograms, BDS::StrContains(), BDSAcceleratorModel::TunnelBeamline(), and useScoringMap.
Referenced by InitialiseGeometryDependent().
|
private |
Fill aperture impact hits.
Definition at line 1072 of file BDSOutput.cc.
References BDSOutputStructures::apertureImpacts, energyImpactingAperture, energyImpactingApertureKinetic, BDSOutputStructures::evtHistos, histIndices1D, storeApertureImpacts, and storeApertureImpactsHistograms.
Referenced by FillEvent().
void BDSOutput::FillBeam | ( | const GMAD::BeamBase * | beam | ) |
Fill the local structure beam with the original ones from the parser. This also calls WriteBeam().
Definition at line 204 of file BDSOutput.cc.
References BDSOutputStructures::beamOutput, BDSOutputStructures::ClearStructuresBeam(), and WriteBeam().
Referenced by BDSIM::Initialise().
|
private |
Fill collimator hits.
Definition at line 1013 of file BDSOutput.cc.
References BDSOutputStructures::collimatorDifferences, BDSHitCollimator::collimatorIndex, BDSOutputStructures::collimatorIndices, BDSOutputStructures::collimatorInfo, BDSOutputStructures::collimators, BDSOutputStructures::evtHistos, histIndices1D, BDSOutputStructures::nCollimators, nCollimatorsInteracted, storeCollimatorHits, storeCollimatorHitsIons, and storeCollimatorHitsLinks.
Referenced by FillEvent().
|
private |
Fill a collection of energy hits into the appropriate output structure.
Definition at line 873 of file BDSOutput.cc.
References BDSOutputStructures::collimatorIndices, CopyFromHistToHist1D(), BDSOutputStructures::eLoss, BDSOutputStructures::eLossTunnel, BDSOutputStructures::eLossVacuum, energyDeposited, energyDepositedTunnel, energyDepositedVacuum, BDSOutputStructures::evtHistos, BDSOutputROOTEventLoss::Fill(), BDSHitEnergyDeposition::Getx(), BDSHitEnergyDeposition::Gety(), histIndices1D, histIndices3D, BDSOutputStructures::nCollimators, BDSOutputStructures::runHistos, storeCollimatorInfo, storeELoss, storeELossHistograms, storeELossTunnel, storeELossTunnelHistograms, storeELossVacuum, storeELossVacuumHistograms, and useScoringMap.
Referenced by FillEvent().
|
private |
Fill a collection of energy hits in global coordinates into the appropriate output structure.
Definition at line 816 of file BDSOutput.cc.
References BDSOutputStructures::eLossWorld, BDSOutputStructures::eLossWorldContents, BDSOutputStructures::eLossWorldExit, energyDepositedWorld, energyDepositedWorldContents, energyWorldExit, energyWorldExitKinetic, storeELossWorld, and storeELossWorldContents.
void BDSOutput::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.
Definition at line 289 of file BDSOutput.cc.
References BDSOutputStructures::apertureImpacts, BDSOutputStructures::ClearStructuresEventLevel(), energyDeposited, energyDepositedTunnel, energyDepositedVacuum, energyDepositedWorld, energyDepositedWorldContents, energyImpactingAperture, energyImpactingApertureKinetic, energyWorldExit, energyWorldExitKinetic, FillApertureImpacts(), FillCollimatorHits(), FillEnergyLoss(), FillEventInfo(), FillPrimary(), FillPrimaryHit(), FillPrimaryLoss(), FillSamplerHitsLink(), FillSamplerHitsVector(), FillScorerHits(), FillTrajectories(), nCollimatorsInteracted, storePrimaries, and WriteFileEventLevel().
|
private |
Fill event summary information.
Definition at line 666 of file BDSOutput.cc.
References energyDeposited, BDSOutputROOTEventInfo::energyDeposited, energyDepositedTunnel, BDSOutputROOTEventInfo::energyDepositedTunnel, energyDepositedVacuum, BDSOutputROOTEventInfo::energyDepositedVacuum, energyDepositedWorld, BDSOutputROOTEventInfo::energyDepositedWorld, energyDepositedWorldContents, BDSOutputROOTEventInfo::energyDepositedWorldContents, energyImpactingAperture, BDSOutputROOTEventInfo::energyImpactingAperture, energyImpactingApertureKinetic, BDSOutputROOTEventInfo::energyImpactingApertureKinetic, BDSOutputROOTEventInfo::energyKilled, BDSOutputROOTEventInfo::energyTotal, energyWorldExit, BDSOutputROOTEventInfo::energyWorldExit, energyWorldExitKinetic, BDSOutputROOTEventInfo::energyWorldExitKinetic, BDSOutputStructures::evtInfo, BDSEventInfo::GetInfo(), nCollimatorsInteracted, and BDSOutputROOTEventInfo::nCollimatorsInteracted.
Referenced by FillEvent().
void BDSOutput::FillEventPrimaryOnly | ( | const BDSParticleCoordsFullGlobal & | coords, |
const BDSParticleDefinition * | particle | ||
) |
Fill the local structure with primary vertex information. A unique interface for the case of generating primaries only. This fills the primary structure, and calls WriteFileEventLevel() and then clears the structures. It therefore should not be used in conjunction with FillEvent().
Definition at line 263 of file BDSOutput.cc.
References BDSIonDefinition::A(), BDSParticleDefinition::BRho(), BDSParticleDefinition::Charge(), BDSOutputStructures::ClearStructuresEventLevel(), BDSOutputROOTEventCoords::Fill(), BDSParticleDefinition::IonDefinition(), BDSParticleDefinition::IsAnIon(), BDSParticleDefinition::Mass(), BDSParticleDefinition::Momentum(), BDSParticleDefinition::NElectrons(), BDSParticleDefinition::PDGID(), BDSOutputStructures::primary, WriteFileEventLevel(), and BDSIonDefinition::Z().
Referenced by BDSIM::Initialise().
void BDSOutput::FillHeader | ( | ) |
Fill the local structure header with information - updates time stamp.
Definition at line 178 of file BDSOutput.cc.
References BDSOutputStructures::ClearStructuresHeader(), BDSOutputROOTEventHeader::Fill(), BDSOutputStructures::headerOutput, and WriteHeader().
Referenced by BDSOutputROOT::NewFile().
void BDSOutput::FillModel | ( | ) |
Fill the local structure model from the beam line and sampler registry. This also calls WriteModel(). After writing the model it clears the structure.
Definition at line 218 of file BDSOutput.cc.
References BDSOutputStructures::ClearStructuresModel(), BDSOutputStructures::collimatorIndices, BDSOutputStructures::collimatorIndicesByName, BDSOutputStructures::collimatorInfo, BDSOutputStructures::collimatorNames, BDSOutputROOTEventModel::Fill(), BDSOutputStructures::modelOutput, BDSAcceleratorModel::ScorerMeshPlacementsMap(), storeModel, storeTrajectory, and WriteModel().
void BDSOutput::FillOptions | ( | const GMAD::OptionsBase * | options | ) |
Fill the local structure options with the original ones from the parser. This also calls WriteOptions().
Definition at line 211 of file BDSOutput.cc.
References BDSOutputStructures::ClearStructuresOptions(), BDSOutputStructures::optionsOutput, and WriteOptions().
Referenced by BDSIM::Initialise().
void BDSOutput::FillParticleData | ( | G4bool | writeIons | ) |
Fill the local structure particle data with information. Also calls WriteParticleData().
Definition at line 186 of file BDSOutput.cc.
References BDSOutputROOTParticleData::Fill(), BDSOutputROOTParticleData::Flush(), BDSOutputStructures::particleDataOutput, storeParticleData, and WriteParticleData().
|
private |
Fill the local structure with primary vertex information. Utility function to translate from G4PrimaryVertex to simple numbers.
Definition at line 235 of file BDSOutput.cc.
References BDSOutputROOTEventCoords::Fill(), FillPrimary(), and BDSOutputStructures::primary.
Referenced by FillEvent(), and FillPrimary().
|
private |
Fill the hit where the primary particle impact.
Definition at line 965 of file BDSOutput.cc.
References BDSOutputStructures::collimatorIndices, CopyFromHistToHist1D(), BDSOutputStructures::evtHistos, BDSOutputROOTEventLoss::Fill(), histIndices1D, BDSOutputStructures::nCollimators, BDSOutputStructures::pFirstHit, BDSOutputStructures::runHistos, storeCollimatorInfo, and storePrimaryHistograms.
Referenced by FillEvent().
|
private |
Fill a collection volume exit hits into the appropriate output structure.
Fill the hit where the primary stopped being a primary.
Definition at line 986 of file BDSOutput.cc.
References BDSOutputStructures::collimatorIndices, CopyFromHistToHist1D(), BDSOutputStructures::evtHistos, BDSOutputROOTEventLoss::Fill(), histIndices1D, BDSOutputStructures::nCollimators, BDSOutputStructures::pLastHit, BDSOutputStructures::runHistos, storeCollimatorInfo, and storePrimaryHistograms.
Referenced by FillEvent().
void BDSOutput::FillRun | ( | const BDSEventInfo * | info | ) |
Copy run information to output structure.
Definition at line 371 of file BDSOutput.cc.
References BDSOutputStructures::ClearStructuresRunLevel(), FillRunInfo(), and WriteFileRunLevel().
|
private |
Fill run level summary information.
Definition at line 1187 of file BDSOutput.cc.
References BDSEventInfo::GetInfo(), and BDSOutputStructures::runInfo.
Referenced by FillRun().
|
private |
Definition at line 718 of file BDSOutput.cc.
|
private |
Fill sampler hits into output structures.
Definition at line 771 of file BDSOutput.cc.
References BDSOutputStructures::samplerTrees, storeSamplerCharge, storeSamplerIon, storeSamplerKineticEnergy, storeSamplerMass, storeSamplerPolarCoords, and storeSamplerRigidity.
|
private |
Fill sampler link hits into output structures.
Definition at line 793 of file BDSOutput.cc.
References BDSOutputStructures::samplerTrees, storeSamplerCharge, storeSamplerIon, storeSamplerKineticEnergy, storeSamplerMass, storeSamplerPolarCoords, and storeSamplerRigidity.
Referenced by FillEvent().
|
private |
Fill sampler hits from a vector<sampler hits collection>.
Definition at line 692 of file BDSOutput.cc.
References BDSOutputStructures::samplerTrees, storeSamplerCharge, storeSamplerIon, storeSamplerKineticEnergy, storeSamplerMass, storeSamplerPolarCoords, and storeSamplerRigidity.
Referenced by FillEvent().
|
private |
Definition at line 744 of file BDSOutput.cc.
|
private |
Fill a map of scorer hits into the output.
Definition at line 1101 of file BDSOutput.cc.
References FillScorerHitsIndividual().
Referenced by FillEvent().
|
private |
Fill an individual scorer hits map into a particular output histogram.
Definition at line 1119 of file BDSOutput.cc.
References BDSOutputROOTEventHistograms::AccumulateHistogram3D(), BDSOutputStructures::evtHistos, BDSOutputROOTEventHistograms::Get3DHistogram(), BDSOutputROOTEventHistograms::Get4DHistogram(), histIndices3D, histIndices4D, BDS::MapGetWithDefault(), BDSOutputStructures::runHistos, scorerCoordinateMaps, BDSOutputROOTEventHistograms::Set3DHistogramBinContent(), and BDS::StrContains().
Referenced by FillScorerHits().
|
private |
Definition at line 1168 of file BDSOutput.cc.
|
private |
Copy a set of trajectories to the output structure.
Definition at line 1007 of file BDSOutput.cc.
References storeTrajectory, storeTrajectoryOptions, storeTrajectoryStepPointLast, storeTrajectoryStepPoints, and BDSOutputStructures::traj.
Referenced by FillEvent().
|
protected |
Get the next file name based on the base file name and the accrued number of files.
Definition at line 390 of file BDSOutput.cc.
References baseFileName, BDS::FileExists(), fileExtension, BDSGlobalConstants::Instance(), numberEventPerFile, and outputFileNumber.
Referenced by BDSOutputROOT::NewFile().
|
virtual |
Setup any geometry dependent output structures in the output file - such as samplers. This is run after the geometry has been constructed and 'closed'. This also sets up histograms based along S now the beam line is known.
Definition at line 166 of file BDSOutput.cc.
References createCollimatorOutputStructures, CreateHistograms(), BDSOutputStructures::InitialiseCollimators(), BDSOutputStructures::InitialiseMaterialMap(), BDSOutputStructures::InitialiseSamplers(), and BDSOutputStructures::PrepareCollimatorInformation().
Referenced by CloseAndOpenNewFile(), and BDSIMLink::Initialise().
|
static |
Test whether a sampler name is invalid or not.
Definition at line 378 of file BDSOutput.cc.
References protectedNames.
Referenced by BDSBeamline::AddComponent(), and BDSParallelWorldSampler::Construct().
|
pure virtual |
Open a new file. This should call WriteHeader() in it.
Implemented in BDSOutputNone, and BDSOutputROOT.
Referenced by CloseAndOpenNewFile(), BDSIM::Initialise(), and BDSIMLink::Initialise().
|
static |
Feedback for protected names.
Definition at line 383 of file BDSOutput.cc.
References protectedNames.
Referenced by BDSBeamline::AddComponent(), and BDSParallelWorldSampler::Construct().
|
inlinevirtual |
Interface to allow updating samplers with dynamic construction. Only for link - not for regular use.
Reimplemented in BDSOutputROOT.
Definition at line 94 of file BDSOutput.hh.
References BDSOutputStructures::UpdateSamplerStructures().
Referenced by BDSIMLink::AddLinkCollimatorJaw().
|
privatepure virtual |
Write the beam.
Implemented in BDSOutputNone, and BDSOutputROOT.
Referenced by FillBeam().
|
privatepure virtual |
Copy from local event structures to the actual file. Only event level structures are copied.
Implemented in BDSOutputNone, and BDSOutputROOT.
Referenced by FillEvent(), and FillEventPrimaryOnly().
|
privatepure virtual |
Copy from local run structures to the actual file. Only run level structures are copied.
Implemented in BDSOutputNone, and BDSOutputROOT.
Referenced by FillRun().
|
privatepure virtual |
Write the header.
Implemented in BDSOutputNone, and BDSOutputROOT.
Referenced by FillHeader().
|
privatepure virtual |
Write a representation of the samplers and beamline.
Implemented in BDSOutputNone, and BDSOutputROOT.
Referenced by FillModel().
|
privatepure virtual |
Write the options.
Implemented in BDSOutputNone, and BDSOutputROOT.
Referenced by FillOptions().
|
privatepure virtual |
Write the geant4 information.
Implemented in BDSOutputNone, and BDSOutputROOT.
Referenced by FillParticleData().
|
private |
|
protected |
Mapping from complete collection name ("SD/PS") to histogram ID to fill. We have this because the same primitive scorer information may appear for BLMs in multiple SDs that each represent a unique combination of PSs. Ultimately though, there's one histogram per BLM scorer (for all BLMs).
Definition at line 178 of file BDSOutput.hh.
Referenced by CreateHistograms().
|
private |
Whether to create collimator output structures or not - based on several collimator storage options.
Definition at line 323 of file BDSOutput.hh.
Referenced by BDSOutput(), CreateCollimatorOutputStructures(), and InitialiseGeometryDependent().
|
private |
Integral when filling hit.
Definition at line 326 of file BDSOutput.hh.
Referenced by FillEnergyLoss(), FillEvent(), and FillEventInfo().
|
private |
Integral when filling hit.
Definition at line 330 of file BDSOutput.hh.
Referenced by FillEnergyLoss(), FillEvent(), and FillEventInfo().
|
private |
Integral when filling hit.
Definition at line 327 of file BDSOutput.hh.
Referenced by FillEnergyLoss(), FillEvent(), and FillEventInfo().
|
private |
Integral when filling hit.
Definition at line 328 of file BDSOutput.hh.
Referenced by FillEnergyLoss(), FillEvent(), and FillEventInfo().
|
private |
Integral when filling hit.
Definition at line 329 of file BDSOutput.hh.
Referenced by FillEnergyLoss(), FillEvent(), and FillEventInfo().
|
private |
Integral when filling hit.
Definition at line 331 of file BDSOutput.hh.
Referenced by FillApertureImpacts(), FillEvent(), and FillEventInfo().
|
private |
Integral when filling hit.
Definition at line 332 of file BDSOutput.hh.
Referenced by FillApertureImpacts(), FillEvent(), and FillEventInfo().
|
private |
Integral when filling hit.
Definition at line 333 of file BDSOutput.hh.
Referenced by FillEnergyLoss(), FillEvent(), and FillEventInfo().
|
private |
Integral when filling hit.
Definition at line 334 of file BDSOutput.hh.
Referenced by FillEnergyLoss(), FillEvent(), and FillEventInfo().
|
private |
File extension to add to each file.
Definition at line 282 of file BDSOutput.hh.
Referenced by GetNextFileName().
|
private |
Map containing some histogram units. Not all will be filled, so the utility function GetWithDef should be used.
Definition at line 347 of file BDSOutput.hh.
Referenced by CreateHistograms().
|
private |
Definition at line 348 of file BDSOutput.hh.
|
private |
Definition at line 349 of file BDSOutput.hh.
|
private |
Map of histogram name (short) to index of histogram in output.
Definition at line 339 of file BDSOutput.hh.
Referenced by CopyFromHistToHist1D(), CreateHistograms(), FillApertureImpacts(), FillCollimatorHits(), FillEnergyLoss(), FillPrimaryHit(), and FillPrimaryLoss().
|
private |
Map of histogram name (short) to index of histogram in output.
Definition at line 340 of file BDSOutput.hh.
Referenced by CreateHistograms(), FillEnergyLoss(), and FillScorerHitsIndividual().
|
private |
Map of histogram name (short) to index of histogram in output.
Definition at line 341 of file BDSOutput.hh.
Referenced by CreateHistograms(), and FillScorerHitsIndividual().
|
private |
Number of bins for each histogram required.
Definition at line 297 of file BDSOutput.hh.
Referenced by CalculateHistogramParameters(), and CreateHistograms().
|
private |
Integral when filling hit.
Definition at line 335 of file BDSOutput.hh.
Referenced by FillCollimatorHits(), FillEvent(), and FillEventInfo().
|
private |
Number of events stored per file.
Definition at line 283 of file BDSOutput.hh.
Referenced by BDSOutput(), and GetNextFileName().
|
private |
Number of output file.
Definition at line 284 of file BDSOutput.hh.
Referenced by GetNextFileName().
|
staticprivate |
Invalid names for samplers - kept here as this is where the output structures are created.
Definition at line 287 of file BDSOutput.hh.
Referenced by InvalidSamplerName(), and PrintProtectedNames().
|
private |
Map of histogram name (short) to index of histogram in output.
Definition at line 342 of file BDSOutput.hh.
Referenced by CreateHistograms(), and FillScorerHitsIndividual().
|
private |
The maximum s in mm such that there is an integer number of elossHistoBinWidths along the line. Used for histogramming purposes.
Definition at line 294 of file BDSOutput.hh.
Referenced by CalculateHistogramParameters(), and CreateHistograms().
|
protected |
Options for dynamic bits of output.
Definition at line 168 of file BDSOutput.hh.
Referenced by BDSOutput(), FillApertureImpacts(), and BDSOutputROOT::NewFile().
|
protected |
Options for dynamic bits of output.
Definition at line 169 of file BDSOutput.hh.
Referenced by BDSOutput(), CreateHistograms(), and FillApertureImpacts().
|
private |
Storage option.
Definition at line 301 of file BDSOutput.hh.
Referenced by BDSOutput(), and FillCollimatorHits().
|
private |
Storage option.
Definition at line 303 of file BDSOutput.hh.
Referenced by BDSOutput(), and FillCollimatorHits().
|
private |
Storage option.
Definition at line 302 of file BDSOutput.hh.
Referenced by BDSOutput(), and FillCollimatorHits().
|
private |
Storage option.
Definition at line 300 of file BDSOutput.hh.
Referenced by BDSOutput(), CreateHistograms(), FillEnergyLoss(), FillPrimaryHit(), and FillPrimaryLoss().
|
protected |
Options for dynamic bits of output.
Definition at line 163 of file BDSOutput.hh.
Referenced by BDSOutput(), FillEnergyLoss(), and BDSOutputROOT::NewFile().
|
private |
Storage option.
Definition at line 304 of file BDSOutput.hh.
Referenced by BDSOutput(), CreateHistograms(), and FillEnergyLoss().
|
protected |
Options for dynamic bits of output.
Definition at line 164 of file BDSOutput.hh.
Referenced by BDSOutput(), CreateHistograms(), FillEnergyLoss(), and BDSOutputROOT::NewFile().
|
private |
Storage option.
Definition at line 305 of file BDSOutput.hh.
Referenced by BDSOutput(), CreateHistograms(), and FillEnergyLoss().
|
protected |
Options for dynamic bits of output.
Definition at line 165 of file BDSOutput.hh.
Referenced by BDSOutput(), FillEnergyLoss(), and BDSOutputROOT::NewFile().
|
private |
Storage option.
Definition at line 306 of file BDSOutput.hh.
Referenced by BDSOutput(), CreateHistograms(), and FillEnergyLoss().
|
protected |
Options for dynamic bits of output.
Definition at line 166 of file BDSOutput.hh.
Referenced by BDSOutput(), FillEnergyLoss(), and BDSOutputROOT::NewFile().
|
protected |
Options for dynamic bits of output.
Definition at line 167 of file BDSOutput.hh.
Referenced by BDSOutput(), FillEnergyLoss(), and BDSOutputROOT::NewFile().
|
private |
Storage option.
Definition at line 309 of file BDSOutput.hh.
Referenced by BDSOutput(), and FillModel().
|
private |
Storage option.
Definition at line 307 of file BDSOutput.hh.
Referenced by BDSOutput(), and FillParticleData().
|
protected |
Options for dynamic bits of output.
Definition at line 170 of file BDSOutput.hh.
Referenced by BDSOutput(), FillEvent(), and BDSOutputROOT::NewFile().
|
private |
Storage option.
Definition at line 308 of file BDSOutput.hh.
Referenced by BDSOutput(), CreateHistograms(), FillPrimaryHit(), and FillPrimaryLoss().
|
private |
Storage option.
Definition at line 311 of file BDSOutput.hh.
Referenced by BDSOutput(), FillSamplerHits(), FillSamplerHitsLink(), and FillSamplerHitsVector().
|
private |
Storage option.
Definition at line 315 of file BDSOutput.hh.
Referenced by BDSOutput(), FillSamplerHits(), FillSamplerHitsLink(), and FillSamplerHitsVector().
|
private |
Storage option.
Definition at line 312 of file BDSOutput.hh.
Referenced by BDSOutput(), FillSamplerHits(), FillSamplerHitsLink(), and FillSamplerHitsVector().
|
private |
Storage option.
Definition at line 313 of file BDSOutput.hh.
Referenced by BDSOutput(), FillSamplerHits(), FillSamplerHitsLink(), and FillSamplerHitsVector().
|
private |
Storage option.
Definition at line 310 of file BDSOutput.hh.
Referenced by BDSOutput(), FillSamplerHits(), FillSamplerHitsLink(), and FillSamplerHitsVector().
|
private |
Storage option.
Definition at line 314 of file BDSOutput.hh.
Referenced by BDSOutput(), FillSamplerHits(), FillSamplerHitsLink(), and FillSamplerHitsVector().
|
protected |
Options for dynamic bits of output.
Definition at line 171 of file BDSOutput.hh.
Referenced by BDSOutput(), FillModel(), FillTrajectories(), and BDSOutputROOT::NewFile().
|
private |
Storage option.
Definition at line 318 of file BDSOutput.hh.
Referenced by BDSOutput(), and FillTrajectories().
|
private |
Storage option.
Definition at line 317 of file BDSOutput.hh.
Referenced by BDSOutput(), and FillTrajectories().
|
private |
Storage option.
Definition at line 316 of file BDSOutput.hh.
Referenced by BDSOutput(), and FillTrajectories().
|
private |
Whether the single 3D histogram will be built.
Definition at line 290 of file BDSOutput.hh.
Referenced by BDSOutput(), CreateHistograms(), and FillEnergyLoss().