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). | |
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. | |
Static Public Member Functions | |
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. | |
Protected Member Functions | |
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. | |
Protected Attributes | |
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 |
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. | |
virtual void | WriteHeaderEndOfFile ()=0 |
Overwrite and update header in the output. | |
virtual void | WriteParticleData ()=0 |
Write the geant4 information. | |
virtual void | WriteBeam ()=0 |
Write the beam. | |
virtual void | WriteOptions ()=0 |
Write the options. | |
virtual void | WriteModel ()=0 |
Write a representation of the samplers and beamline. | |
virtual void | WriteFileEventLevel ()=0 |
virtual void | WriteFileRunLevel ()=0 |
void | CalculateHistogramParameters () |
Calculate the number of bins and required maximum s. | |
void | CreateHistograms () |
Create histograms. | |
void | FillPrimary (const G4PrimaryVertex *vertex, const G4int turnsTaken) |
void | FillEventInfo (const BDSEventInfo *info) |
Fill event summary information. | |
void | FillSamplerHitsVector (const std::vector< BDSHitsCollectionSampler * > &hits) |
Fill sampler hits from a vector<sampler hits collection>. | |
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. | |
void | FillSamplerHitsLink (const BDSHitsCollectionSamplerLink *hits) |
Fill sampler link hits into output structures. | |
void | FillPrimaryHit (const std::vector< const BDSTrajectoryPointHit * > &primaryHits) |
Fill the hit where the primary particle impact. | |
void | FillEnergyLoss (const BDSHitsCollectionEnergyDeposition *loss, const LossType type) |
Fill a collection of energy hits into the appropriate output structure. | |
void | FillEnergyLoss (const BDSHitsCollectionEnergyDepositionGlobal *loss, const LossType type) |
Fill a collection of energy hits in global coordinates into the appropriate output structure. | |
void | FillPrimaryLoss (const std::vector< const BDSTrajectoryPointHit * > &primaryLosses) |
Fill a collection volume exit hits into the appropriate output structure. | |
void | FillTrajectories (const BDSTrajectoriesToStore *trajectories) |
Copy a set of trajectories to the output structure. | |
void | FillCollimatorHits (const BDSHitsCollectionCollimator *hits, const std::vector< const BDSTrajectoryPointHit * > &primaryLossPoints) |
Fill collimator hits. | |
void | FillApertureImpacts (const BDSHitsCollectionApertureImpacts *hits) |
Fill aperture impact hits. | |
void | FillScorerHits (const std::map< G4String, G4THitsMap< G4double > * > &scorerHitsMap) |
Fill a map of scorer hits into the output. | |
void | FillScorerHitsIndividual (const G4String &hsitogramDefName, const G4THitsMap< G4double > *hitMap) |
Fill an individual scorer hits map into a particular output histogram. | |
void | FillScorerHitsIndividualBLM (const G4String &histogramDefName, const G4THitsMap< G4double > *hitMap) |
void | FillRunInfoAndUpdateHeader (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) |
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. | |
const G4String | fileExtension |
File extension to add to each file. | |
G4int | numberEventPerFile |
Number of events stored per file. | |
G4int | outputFileNumber |
Number of output file. | |
G4bool | useScoringMap |
Whether the single 3D histogram will be built. | |
G4double | sMaxHistograms |
G4int | nbins |
Number of bins for each histogram required. | |
G4bool | createCollimatorOutputStructures |
std::map< G4int, G4double > | histIndexToUnits1D |
std::map< G4int, G4double > | histIndexToUnits3D |
std::map< G4int, G4double > | histIndexToUnits4D |
G4bool | storeCavityInfo |
Storage option. | |
G4bool | storeCollimatorInfo |
Storage option. | |
G4bool | storeCollimatorHits |
Storage option. | |
G4bool | storeCollimatorHitsLinks |
Storage option. | |
G4bool | storeCollimatorHitsIons |
Storage option. | |
G4bool | storeELossHistograms |
Storage option. | |
G4bool | storeELossTunnelHistograms |
Storage option. | |
G4bool | storeELossVacuumHistograms |
Storage option. | |
G4bool | storeParticleData |
Storage option. | |
G4bool | storePrimaryHistograms |
Storage option. | |
G4bool | storeModel |
Storage option. | |
G4bool | storeSamplerPolarCoords |
Storage option. | |
G4bool | storeSamplerCharge |
Storage option. | |
G4bool | storeSamplerKineticEnergy |
Storage option. | |
G4bool | storeSamplerMass |
Storage option. | |
G4bool | storeSamplerRigidity |
Storage option. | |
G4bool | storeSamplerIon |
Storage option. | |
G4int | storeTrajectoryStepPoints |
Storage option. | |
G4bool | storeTrajectoryStepPointLast |
Storage option. | |
BDS::TrajectoryOptions | storeTrajectoryOptions |
Storage option. | |
G4double | energyDeposited |
Integral when filling hit. | |
G4double | energyDepositedVacuum |
Integral when filling hit. | |
G4double | energyDepositedWorld |
Integral when filling hit. | |
G4double | energyDepositedWorldContents |
Integral when filling hit. | |
G4double | energyDepositedTunnel |
Integral when filling hit. | |
G4double | energyImpactingAperture |
Integral when filling hit. | |
G4double | energyImpactingApertureKinetic |
Integral when filling hit. | |
G4double | energyWorldExit |
Integral when filling hit. | |
G4double | energyWorldExitKinetic |
Integral when filling hit. | |
G4int | nCollimatorsInteracted |
Integral when filling hit. | |
std::map< G4String, G4int > | histIndices1D |
Map of histogram name (short) to index of histogram in output. | |
std::map< G4String, G4int > | histIndices3D |
Map of histogram name (short) to index of histogram in output. | |
std::map< G4String, G4int > | histIndices4D |
Map of histogram name (short) to index of histogram in output. | |
std::map< G4String, BDSHistBinMapper > | scorerCoordinateMaps |
Map of histogram name (short) to index of histogram in output. | |
Static Private Attributes | |
static const std::set< G4String > | protectedNames |
Invalid names for samplers - kept here as this is where the output structures are created. | |
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 187 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 97 of file BDSOutput.cc.
References createCollimatorOutputStructures, BDSGlobalConstants::Instance(), numberEventPerFile, storeApertureImpacts, storeApertureImpactsHistograms, storeCavityInfo, 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 439 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 372 of file BDSOutput.cc.
References BDSOutputStructures::ClearStructuresHeader(), 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::GeneratePrimariesOnly(), and BDSIMLink::~BDSIMLink().
|
private |
Utility function to copy out select bins from one histogram to another for 1D histograms only.
Definition at line 1220 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 165 of file BDSOutput.hh.
References createCollimatorOutputStructures.
Referenced by BDSOutputROOT::NewFile().
|
private |
Create histograms.
Definition at line 462 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 1087 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 208 of file BDSOutput.cc.
References BDSOutputStructures::beamOutput, BDSOutputStructures::ClearStructuresBeam(), and WriteBeam().
Referenced by BDSIM::GeneratePrimariesOnly().
|
private |
Fill collimator hits.
Definition at line 1028 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 888 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 831 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 297 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 681 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 271 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::GeneratePrimariesOnly().
void BDSOutput::FillHeader | ( | ) |
Fill the local structure header with information - updates time stamp.
Definition at line 182 of file BDSOutput.cc.
References 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 222 of file BDSOutput.cc.
References BDSOutputStructures::cavityIndices, BDSOutputStructures::cavityIndicesByName, BDSOutputStructures::cavityInfo, BDSOutputStructures::cavityNames, 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 215 of file BDSOutput.cc.
References BDSOutputStructures::ClearStructuresOptions(), BDSOutputStructures::optionsOutput, and WriteOptions().
Referenced by BDSIM::GeneratePrimariesOnly().
void BDSOutput::FillParticleData | ( | G4bool | writeIons | ) |
Fill the local structure particle data with information. Also calls WriteParticleData().
Definition at line 190 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 243 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 980 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 1001 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, |
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.
Definition at line 380 of file BDSOutput.cc.
References BDSOutputStructures::ClearStructuresRunLevel(), FillRunInfoAndUpdateHeader(), WriteFileRunLevel(), and WriteHeaderEndOfFile().
|
private |
Fill run level summary information. This also updates the header information for writing at the end of a file.
Definition at line 1202 of file BDSOutput.cc.
References BDSOutputROOTEventHeader::distrFileLoopNTimes, BDSEventInfo::GetInfo(), BDSOutputStructures::headerOutput, BDSOutputROOTEventHeader::nEventsInFile, BDSOutputROOTEventHeader::nEventsInFileSkipped, BDSOutputROOTEventHeader::nEventsRequested, BDSOutputROOTEventHeader::nOriginalEvents, and BDSOutputStructures::runInfo.
Referenced by FillRun().
|
private |
Definition at line 733 of file BDSOutput.cc.
|
private |
Fill sampler hits into output structures.
Definition at line 786 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 808 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 707 of file BDSOutput.cc.
References BDSOutputStructures::samplerTrees, storeSamplerCharge, storeSamplerIon, storeSamplerKineticEnergy, storeSamplerMass, storeSamplerPolarCoords, and storeSamplerRigidity.
Referenced by FillEvent().
|
private |
Definition at line 759 of file BDSOutput.cc.
|
private |
Fill a map of scorer hits into the output.
Definition at line 1116 of file BDSOutput.cc.
References FillScorerHitsIndividual().
Referenced by FillEvent().
|
private |
Fill an individual scorer hits map into a particular output histogram.
Definition at line 1134 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 1183 of file BDSOutput.cc.
|
private |
Copy a set of trajectories to the output structure.
Definition at line 1022 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 405 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 168 of file BDSOutput.cc.
References createCollimatorOutputStructures, CreateHistograms(), BDSOutputStructures::InitialiseCollimators(), BDSOutputStructures::InitialiseMaterialMap(), BDSOutputStructures::InitialiseSamplers(), BDSOutputStructures::PrepareCavityInformation(), BDSOutputStructures::PrepareCollimatorInformation(), and storeCavityInfo.
Referenced by CloseAndOpenNewFile(), and BDSIMLink::Initialise().
|
static |
Test whether a sampler name is invalid or not.
Definition at line 393 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::GeneratePrimariesOnly(), and BDSIMLink::Initialise().
|
static |
Feedback for protected names.
Definition at line 398 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 |
Overwrite and update header in the output.
Implemented in BDSOutputNone, and BDSOutputROOT.
Referenced by FillRun().
|
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 183 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 338 of file BDSOutput.hh.
Referenced by BDSOutput(), CreateCollimatorOutputStructures(), and InitialiseGeometryDependent().
|
private |
Integral when filling hit.
Definition at line 341 of file BDSOutput.hh.
Referenced by FillEnergyLoss(), FillEvent(), and FillEventInfo().
|
private |
Integral when filling hit.
Definition at line 345 of file BDSOutput.hh.
Referenced by FillEnergyLoss(), FillEvent(), and FillEventInfo().
|
private |
Integral when filling hit.
Definition at line 342 of file BDSOutput.hh.
Referenced by FillEnergyLoss(), FillEvent(), and FillEventInfo().
|
private |
Integral when filling hit.
Definition at line 343 of file BDSOutput.hh.
Referenced by FillEnergyLoss(), FillEvent(), and FillEventInfo().
|
private |
Integral when filling hit.
Definition at line 344 of file BDSOutput.hh.
Referenced by FillEnergyLoss(), FillEvent(), and FillEventInfo().
|
private |
Integral when filling hit.
Definition at line 346 of file BDSOutput.hh.
Referenced by FillApertureImpacts(), FillEvent(), and FillEventInfo().
|
private |
Integral when filling hit.
Definition at line 347 of file BDSOutput.hh.
Referenced by FillApertureImpacts(), FillEvent(), and FillEventInfo().
|
private |
Integral when filling hit.
Definition at line 348 of file BDSOutput.hh.
Referenced by FillEnergyLoss(), FillEvent(), and FillEventInfo().
|
private |
Integral when filling hit.
Definition at line 349 of file BDSOutput.hh.
Referenced by FillEnergyLoss(), FillEvent(), and FillEventInfo().
|
private |
File extension to add to each file.
Definition at line 296 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 362 of file BDSOutput.hh.
Referenced by CreateHistograms().
|
private |
Definition at line 363 of file BDSOutput.hh.
|
private |
Definition at line 364 of file BDSOutput.hh.
|
private |
Map of histogram name (short) to index of histogram in output.
Definition at line 354 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 355 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 356 of file BDSOutput.hh.
Referenced by CreateHistograms(), and FillScorerHitsIndividual().
|
private |
Number of bins for each histogram required.
Definition at line 311 of file BDSOutput.hh.
Referenced by CalculateHistogramParameters(), and CreateHistograms().
|
private |
Integral when filling hit.
Definition at line 350 of file BDSOutput.hh.
Referenced by FillCollimatorHits(), FillEvent(), and FillEventInfo().
|
private |
Number of events stored per file.
Definition at line 297 of file BDSOutput.hh.
Referenced by BDSOutput(), and GetNextFileName().
|
private |
Number of output file.
Definition at line 298 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 301 of file BDSOutput.hh.
Referenced by InvalidSamplerName(), and PrintProtectedNames().
|
private |
Map of histogram name (short) to index of histogram in output.
Definition at line 357 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 308 of file BDSOutput.hh.
Referenced by CalculateHistogramParameters(), and CreateHistograms().
|
protected |
Options for dynamic bits of output.
Definition at line 173 of file BDSOutput.hh.
Referenced by BDSOutput(), FillApertureImpacts(), and BDSOutputROOT::NewFile().
|
protected |
Options for dynamic bits of output.
Definition at line 174 of file BDSOutput.hh.
Referenced by BDSOutput(), CreateHistograms(), and FillApertureImpacts().
|
private |
Storage option.
Definition at line 314 of file BDSOutput.hh.
Referenced by BDSOutput(), and InitialiseGeometryDependent().
|
private |
Storage option.
Definition at line 316 of file BDSOutput.hh.
Referenced by BDSOutput(), and FillCollimatorHits().
|
private |
Storage option.
Definition at line 318 of file BDSOutput.hh.
Referenced by BDSOutput(), and FillCollimatorHits().
|
private |
Storage option.
Definition at line 317 of file BDSOutput.hh.
Referenced by BDSOutput(), and FillCollimatorHits().
|
private |
Storage option.
Definition at line 315 of file BDSOutput.hh.
Referenced by BDSOutput(), CreateHistograms(), FillEnergyLoss(), FillPrimaryHit(), and FillPrimaryLoss().
|
protected |
Options for dynamic bits of output.
Definition at line 168 of file BDSOutput.hh.
Referenced by BDSOutput(), FillEnergyLoss(), and BDSOutputROOT::NewFile().
|
private |
Storage option.
Definition at line 319 of file BDSOutput.hh.
Referenced by BDSOutput(), CreateHistograms(), and FillEnergyLoss().
|
protected |
Options for dynamic bits of output.
Definition at line 169 of file BDSOutput.hh.
Referenced by BDSOutput(), CreateHistograms(), FillEnergyLoss(), and BDSOutputROOT::NewFile().
|
private |
Storage option.
Definition at line 320 of file BDSOutput.hh.
Referenced by BDSOutput(), CreateHistograms(), and FillEnergyLoss().
|
protected |
Options for dynamic bits of output.
Definition at line 170 of file BDSOutput.hh.
Referenced by BDSOutput(), FillEnergyLoss(), and BDSOutputROOT::NewFile().
|
private |
Storage option.
Definition at line 321 of file BDSOutput.hh.
Referenced by BDSOutput(), CreateHistograms(), and FillEnergyLoss().
|
protected |
Options for dynamic bits of output.
Definition at line 171 of file BDSOutput.hh.
Referenced by BDSOutput(), FillEnergyLoss(), and BDSOutputROOT::NewFile().
|
protected |
Options for dynamic bits of output.
Definition at line 172 of file BDSOutput.hh.
Referenced by BDSOutput(), FillEnergyLoss(), and BDSOutputROOT::NewFile().
|
private |
Storage option.
Definition at line 324 of file BDSOutput.hh.
Referenced by BDSOutput(), and FillModel().
|
private |
Storage option.
Definition at line 322 of file BDSOutput.hh.
Referenced by BDSOutput(), and FillParticleData().
|
protected |
Options for dynamic bits of output.
Definition at line 175 of file BDSOutput.hh.
Referenced by BDSOutput(), FillEvent(), and BDSOutputROOT::NewFile().
|
private |
Storage option.
Definition at line 323 of file BDSOutput.hh.
Referenced by BDSOutput(), CreateHistograms(), FillPrimaryHit(), and FillPrimaryLoss().
|
private |
Storage option.
Definition at line 326 of file BDSOutput.hh.
Referenced by BDSOutput(), FillSamplerHits(), FillSamplerHitsLink(), and FillSamplerHitsVector().
|
private |
Storage option.
Definition at line 330 of file BDSOutput.hh.
Referenced by BDSOutput(), FillSamplerHits(), FillSamplerHitsLink(), and FillSamplerHitsVector().
|
private |
Storage option.
Definition at line 327 of file BDSOutput.hh.
Referenced by BDSOutput(), FillSamplerHits(), FillSamplerHitsLink(), and FillSamplerHitsVector().
|
private |
Storage option.
Definition at line 328 of file BDSOutput.hh.
Referenced by BDSOutput(), FillSamplerHits(), FillSamplerHitsLink(), and FillSamplerHitsVector().
|
private |
Storage option.
Definition at line 325 of file BDSOutput.hh.
Referenced by BDSOutput(), FillSamplerHits(), FillSamplerHitsLink(), and FillSamplerHitsVector().
|
private |
Storage option.
Definition at line 329 of file BDSOutput.hh.
Referenced by BDSOutput(), FillSamplerHits(), FillSamplerHitsLink(), and FillSamplerHitsVector().
|
protected |
Options for dynamic bits of output.
Definition at line 176 of file BDSOutput.hh.
Referenced by BDSOutput(), FillModel(), FillTrajectories(), and BDSOutputROOT::NewFile().
|
private |
Storage option.
Definition at line 333 of file BDSOutput.hh.
Referenced by BDSOutput(), and FillTrajectories().
|
private |
Storage option.
Definition at line 332 of file BDSOutput.hh.
Referenced by BDSOutput(), and FillTrajectories().
|
private |
Storage option.
Definition at line 331 of file BDSOutput.hh.
Referenced by BDSOutput(), and FillTrajectories().
|
private |
Whether the single 3D histogram will be built.
Definition at line 304 of file BDSOutput.hh.
Referenced by BDSOutput(), CreateHistograms(), and FillEnergyLoss().