22#include "BDSHistBinMapper.hh"
23#include "BDSOutputStructures.hh"
24#include "BDSTrajectoryOptions.hh"
77 const G4String& fileExtentionIn,
78 G4int fileNumberOffset);
123 const G4PrimaryVertex* vertex,
124 const std::vector<BDSHitsCollectionSampler*>& samplerHitsPlane,
125 const std::vector<BDSHitsCollectionSamplerCylinder*>& samplerHitsCylinder,
126 const std::vector<BDSHitsCollectionSamplerSphere*>& samplerHitsSphere,
135 const std::vector<const BDSTrajectoryPointHit*>& primaryHits,
136 const std::vector<const BDSTrajectoryPointHit*>& primaryLosses,
141 const G4int turnsTaken);
148 unsigned long long int nOriginalEventsIn,
149 unsigned long long int nEventsRequestedIn,
150 unsigned long long int nEventsInOriginalDistrFileIn,
151 unsigned long long int nEventsDistrFileSkippedIn,
152 unsigned int distrFileLoopNTimesIn);
187 enum class LossType {energy, vacuum, tunnel, world, worldexit, worldcontents};
224 const G4int turnsTaken);
231 void FillSamplerCylinderHitsVector(
const std::vector<BDSHitsCollectionSamplerCylinder*>& hits);
232 void FillSamplerSphereHitsVector(
const std::vector<BDSHitsCollectionSamplerSphere*>& hits);
241 void FillPrimaryHit(
const std::vector<const BDSTrajectoryPointHit*>& primaryHits);
255 void FillPrimaryLoss(
const std::vector<const BDSTrajectoryPointHit*>& primaryLosses);
262 const std::vector<const BDSTrajectoryPointHit*>& primaryLossPoints);
274 void FillScorerHitsIndividualBLM(
const G4String& histogramDefName,
280 unsigned long long int nOriginalEventsIn,
281 unsigned long long int nEventsRequestedIn,
282 unsigned long long int nEventsInOriginalDistrFileIn,
283 unsigned long long int nEventsDistrFileSkippedIn,
284 unsigned int distrFileLoopNTimesIn);
289 const G4String& destinationName,
290 const std::vector<G4int>& indices);
363 std::map<G4int, G4double> histIndexToUnits3D;
364 std::map<G4int, G4double> histIndexToUnits4D;
Interface to store event information use G4 hooks.
Snapshot of information for particle passing through a collimator.
Snapshot of information for particle passing through a collimator.
Information recorded for a step leaving a volume.
Information recorded for a single piece of energy deposition.
The information recorded from a particle impacting a sampler.
The information recorded from a particle impacting a link sampler.
The information recorded from a particle impacting a sampler.
The information recorded from a particle impacting a sampler.
Holder for output information.
G4int UpdateSamplerStructures()
Interface to allow setting up samplers later for dynamic geometry construction a la SixTrack....
Output base class that defines interface for all output types.
virtual void WriteModel()=0
Write a representation of the samplers and beamline.
G4bool CreateCollimatorOutputStructures() const
Whether to create the collimator structures in the output or not.
void FillEnergyLoss(const BDSHitsCollectionEnergyDeposition *loss, const LossType type)
Fill a collection of energy hits into the appropriate output structure.
G4double energyDepositedVacuum
Integral when filling hit.
virtual void WriteParticleData()=0
Write the geant4 information.
G4bool createCollimatorOutputStructures
virtual void WriteBeam()=0
Write the beam.
virtual void NewFile()=0
Open a new file. This should call WriteHeader() in it.
G4bool storeCollimatorHitsIons
Storage option.
G4bool storeSamplerCharge
Storage option.
G4bool storeSamplerRigidity
Storage option.
virtual void WriteFileEventLevel()=0
BDSOutput()=delete
No default constructor.
G4bool storeCollimatorHitsLinks
Storage option.
G4bool storeELossHistograms
Storage option.
G4bool storePrimaryHistograms
Storage option.
G4double energyDepositedTunnel
Integral when filling hit.
G4bool storeSamplerKineticEnergy
Storage option.
void CloseAndOpenNewFile()
Close a file and open a new one.
void FillEventInfo(const BDSEventInfo *info)
Fill event summary information.
virtual void WriteOptions()=0
Write the options.
G4bool storeCavityInfo
Storage option.
std::map< G4String, G4int > blmCollectionNameToHistogramID
std::map< G4int, G4double > histIndexToUnits1D
G4bool storePrimaries
Options for dynamic bits of output.
G4bool storeSamplerPolarCoords
Storage option.
void FillScorerHitsIndividual(const G4String &hsitogramDefName, const G4THitsMap< G4double > *hitMap)
Fill an individual scorer hits map into a particular output histogram.
const G4String baseFileName
Base file name.
void FillSamplerHitsVector(const std::vector< BDSHitsCollectionSampler * > &hits)
Fill sampler hits from a vector<sampler hits collection>.
G4bool storeTrajectory
Options for dynamic bits of output.
void FillSamplerHitsLink(const BDSHitsCollectionSamplerLink *hits)
Fill sampler link hits into output structures.
G4int nbins
Number of bins for each histogram required.
G4bool useScoringMap
Whether the single 3D histogram will be built.
void CopyFromHistToHist1D(const G4String &sourceName, const G4String &destinationName, const std::vector< G4int > &indices)
G4String GetNextFileName()
Get the next file name based on the base file name and the accrued number of files.
virtual void InitialiseGeometryDependent()
void FillPrimary(const G4PrimaryVertex *vertex, const G4int turnsTaken)
G4double energyDepositedWorldContents
Integral when filling hit.
const G4String fileExtension
File extension to add to each file.
G4bool storeSamplerIon
Storage option.
G4bool storeModel
Storage option.
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.
G4double energyWorldExitKinetic
Integral when filling hit.
std::map< G4String, G4int > histIndices1D
Map of histogram name (short) to index of histogram in output.
void FillTrajectories(const BDSTrajectoriesToStore *trajectories)
Copy a set of trajectories to the output structure.
G4bool storeELoss
Options for dynamic bits of output.
void FillParticleData(G4bool writeIons)
Fill the local structure particle data with information. Also calls WriteParticleData().
G4bool storeParticleData
Storage option.
G4bool storeApertureImpactsHistograms
Options for dynamic bits of output.
G4double energyImpactingApertureKinetic
Integral when filling hit.
G4double energyImpactingAperture
Integral when filling hit.
void FillEventPrimaryOnly(const BDSParticleCoordsFullGlobal &coords, const BDSParticleDefinition *particle)
G4bool storeELossWorldContents
Options for dynamic bits of output.
G4bool storeCollimatorInfo
Storage option.
virtual void WriteFileRunLevel()=0
void FillBeam(const GMAD::BeamBase *beam)
virtual void WriteHeaderEndOfFile()=0
Overwrite and update header in the output.
void FillHeader()
Fill the local structure header with information - updates time stamp.
void FillPrimaryLoss(const std::vector< const BDSTrajectoryPointHit * > &primaryLosses)
Fill a collection volume exit hits into the appropriate output structure.
static void PrintProtectedNames(std::ostream &out)
Feedback for protected names.
std::map< G4String, G4int > histIndices4D
Map of histogram name (short) to index of histogram in output.
void FillPrimaryHit(const std::vector< const BDSTrajectoryPointHit * > &primaryHits)
Fill the hit where the primary particle impact.
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)
G4int outputFileNumber
Number of output file.
void FillApertureImpacts(const BDSHitsCollectionApertureImpacts *hits)
Fill aperture impact hits.
void FillSamplerHits(const BDSHitsCollectionSampler *hits)
Fill sampler hits into output structures.
G4bool storeELossWorld
Options for dynamic bits of output.
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 CreateHistograms()
Create histograms.
G4int storeTrajectoryStepPoints
Storage option.
G4bool storeTrajectoryStepPointLast
Storage option.
G4bool storeELossVacuum
Options for dynamic bits of output.
std::map< G4String, BDSHistBinMapper > scorerCoordinateMaps
Map of histogram name (short) to index of histogram in output.
G4bool storeSamplerMass
Storage option.
G4double energyWorldExit
Integral when filling hit.
G4int nCollimatorsInteracted
Integral when filling hit.
void FillOptions(const GMAD::OptionsBase *options)
G4bool storeELossVacuumHistograms
Storage option.
LossType
Enum for different types of energy loss that can be written out.
void CalculateHistogramParameters()
Calculate the number of bins and required maximum s.
G4bool storeELossTunnel
Options for dynamic bits of output.
G4double energyDeposited
Integral when filling hit.
static const std::set< G4String > protectedNames
Invalid names for samplers - kept here as this is where the output structures are created.
G4int numberEventPerFile
Number of events stored per file.
G4double energyDepositedWorld
Integral when filling hit.
virtual void UpdateSamplers()
Interface to allow updating samplers with dynamic construction. Only for link - not for regular use.
G4bool storeCollimatorHits
Storage option.
void FillScorerHits(const std::map< G4String, G4THitsMap< G4double > * > &scorerHitsMap)
Fill a map of scorer hits into the output.
static G4bool InvalidSamplerName(const G4String &samplerName)
Test whether a sampler name is invalid or not.
void FillCollimatorHits(const BDSHitsCollectionCollimator *hits, const std::vector< const BDSTrajectoryPointHit * > &primaryLossPoints)
Fill collimator hits.
BDS::TrajectoryOptions storeTrajectoryOptions
Storage option.
std::map< G4String, G4int > histIndices3D
Map of histogram name (short) to index of histogram in output.
G4bool storeApertureImpacts
Options for dynamic bits of output.
virtual void CloseFile()=0
G4bool storeELossTunnelHistograms
Storage option.
virtual void WriteHeader()=0
Write the header.
A set of particle coordinates in both local and global.
Wrapper for particle definition.
Double map of trajectories to bitset of which filters matched whether to store them.
A summary trajectory object of a loss point.
Trajectory information from track including last scatter etc.
Options for a beam distribution.
Basic options class independent of Geant4.
Parser namespace for GMAD language. Combination of Geant4 and MAD.