BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Data Structures | Public Member Functions | Protected Member Functions | Private Attributes
BDSROOTSamplerReader Class Reference

Loader to read a specific sampler from a BDSIM ROOT output file. More...

#include <BDSROOTSamplerReader.hh>

Inheritance diagram for BDSROOTSamplerReader:
Inheritance graph
Collaboration diagram for BDSROOTSamplerReader:
Collaboration graph

Data Structures

struct  DisplacedVertex
 

Public Member Functions

 BDSROOTSamplerReader ()=delete
 Do not require default constructor.
 
 BDSROOTSamplerReader (const G4String &distrType, const G4String &fileNameIn, BDSBunchEventGenerator *bunchIn, G4bool removeUnstableWithoutDecayIn=true, G4bool warnAboutSkippedParticlesIn=true)
 
virtual void GeneratePrimaryVertex (G4Event *anEvent)
 Read the next non-empty sampler entry from the file. More...
 
virtual void RecreateAdvanceToEvent (G4int eventOffset)
 Advance to the correct event number in the file for recreation. More...
 

Protected Member Functions

void ReadSingleEvent (G4long index)
 Clear the hepmcEvent object, reallocate and read a single event and fill that member. More...
 
virtual G4bool VertexInsideWorld (const G4ThreeVector &pos) const
 Conversion from HepMC::GenEvent to G4Event. More...
 
void ReadPrimaryParticlesFloat (G4long index)
 
void ReadPrimaryParticlesDouble (G4long index)
 

Private Attributes

G4long currentFileEventIndex
 
G4long nEventsInFile
 
BDSOutputLoaderSamplerreader
 
G4String fileName
 
G4String samplerName
 
BDSBunchEventGeneratorbunch
 
G4bool removeUnstableWithoutDecay
 
G4bool warnAboutSkippedParticles
 
G4RotationMatrix referenceBeamMomentumOffset
 
G4VSolid * worldSolid
 
G4bool anyParticlesFoundAtAll
 
std::vector< DisplacedVertexvertices
 Used for transiently loading information. More...
 
std::vector< G4PrimaryVertex * > currentVertices
 

Detailed Description

Loader to read a specific sampler from a BDSIM ROOT output file.

Author
Laurie Nevay

Definition at line 42 of file BDSROOTSamplerReader.hh.

Constructor & Destructor Documentation

◆ BDSROOTSamplerReader()

BDSROOTSamplerReader::BDSROOTSamplerReader ( const G4String &  distrType,
const G4String &  fileNameIn,
BDSBunchEventGenerator bunchIn,
G4bool  removeUnstableWithoutDecayIn = true,
G4bool  warnAboutSkippedParticlesIn = true 
)

Constructor takes full distrType string including semicolon and eventgeneratorfile prefix. The filename is assumed to be correctly prefixed if a relative path already. The bunch definition is used for the reference coordinates and offset of the beam point.

Definition at line 46 of file BDSROOTSamplerReader.cc.

References BDSBunchEventGenerator::ReferenceBeamMomentumOffset(), and BDS::SplitOnColon().

Here is the call graph for this function:

◆ ~BDSROOTSamplerReader()

BDSROOTSamplerReader::~BDSROOTSamplerReader ( )
virtual

Definition at line 69 of file BDSROOTSamplerReader.cc.

Member Function Documentation

◆ GeneratePrimaryVertex()

void BDSROOTSamplerReader::GeneratePrimaryVertex ( G4Event *  anEvent)
virtual

Read the next non-empty sampler entry from the file.

Definition at line 74 of file BDSROOTSamplerReader.cc.

References anyParticlesFoundAtAll, and ReadSingleEvent().

Referenced by BDSPrimaryGeneratorAction::GeneratePrimaries(), and RecreateAdvanceToEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadPrimaryParticlesDouble()

void BDSROOTSamplerReader::ReadPrimaryParticlesDouble ( G4long  index)
protected

Definition at line 134 of file BDSROOTSamplerReader.cc.

◆ ReadPrimaryParticlesFloat()

void BDSROOTSamplerReader::ReadPrimaryParticlesFloat ( G4long  index)
protected

Definition at line 112 of file BDSROOTSamplerReader.cc.

◆ ReadSingleEvent()

void BDSROOTSamplerReader::ReadSingleEvent ( G4long  index)
protected

Clear the hepmcEvent object, reallocate and read a single event and fill that member.

Definition at line 156 of file BDSROOTSamplerReader.cc.

References BDSBunchEventGenerator::AcceptParticle(), BDSParticleCoords::AddOffset(), BDSBunch::ApplyTransform(), BDS::cOverGeV, BDSBunch::GetNextParticleLocal(), BDS::IsFinite(), BDSParticleCoordsFull::s, VertexInsideWorld(), and vertices.

Referenced by GeneratePrimaryVertex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RecreateAdvanceToEvent()

void BDSROOTSamplerReader::RecreateAdvanceToEvent ( G4int  eventOffset)
virtual

Advance to the correct event number in the file for recreation.

Definition at line 101 of file BDSROOTSamplerReader.cc.

References GeneratePrimaryVertex().

Here is the call graph for this function:

◆ VertexInsideWorld()

G4bool BDSROOTSamplerReader::VertexInsideWorld ( const G4ThreeVector &  pos) const
protectedvirtual

Conversion from HepMC::GenEvent to G4Event.

Definition at line 259 of file BDSROOTSamplerReader.cc.

Referenced by ReadSingleEvent().

Here is the caller graph for this function:

Field Documentation

◆ anyParticlesFoundAtAll

G4bool BDSROOTSamplerReader::anyParticlesFoundAtAll
private

We need to keep a note of if we find any particles at all when looping through a file so we can distinguish if the whole file had no particles, or say the last event doesn't before we loop through the file again.

Definition at line 99 of file BDSROOTSamplerReader.hh.

Referenced by GeneratePrimaryVertex().

◆ bunch

BDSBunchEventGenerator* BDSROOTSamplerReader::bunch
private

Definition at line 90 of file BDSROOTSamplerReader.hh.

◆ currentFileEventIndex

G4long BDSROOTSamplerReader::currentFileEventIndex
private

Definition at line 85 of file BDSROOTSamplerReader.hh.

◆ currentVertices

std::vector<G4PrimaryVertex*> BDSROOTSamplerReader::currentVertices
private

Definition at line 104 of file BDSROOTSamplerReader.hh.

◆ fileName

G4String BDSROOTSamplerReader::fileName
private

Definition at line 88 of file BDSROOTSamplerReader.hh.

◆ nEventsInFile

G4long BDSROOTSamplerReader::nEventsInFile
private

Definition at line 86 of file BDSROOTSamplerReader.hh.

◆ reader

BDSOutputLoaderSampler* BDSROOTSamplerReader::reader
private

Definition at line 87 of file BDSROOTSamplerReader.hh.

◆ referenceBeamMomentumOffset

G4RotationMatrix BDSROOTSamplerReader::referenceBeamMomentumOffset
private

Definition at line 93 of file BDSROOTSamplerReader.hh.

◆ removeUnstableWithoutDecay

G4bool BDSROOTSamplerReader::removeUnstableWithoutDecay
private

Definition at line 91 of file BDSROOTSamplerReader.hh.

◆ samplerName

G4String BDSROOTSamplerReader::samplerName
private

Definition at line 89 of file BDSROOTSamplerReader.hh.

◆ vertices

std::vector<DisplacedVertex> BDSROOTSamplerReader::vertices
private

Used for transiently loading information.

Definition at line 102 of file BDSROOTSamplerReader.hh.

Referenced by ReadSingleEvent().

◆ warnAboutSkippedParticles

G4bool BDSROOTSamplerReader::warnAboutSkippedParticles
private

Definition at line 92 of file BDSROOTSamplerReader.hh.

◆ worldSolid

G4VSolid* BDSROOTSamplerReader::worldSolid
mutableprivate

Definition at line 94 of file BDSROOTSamplerReader.hh.


The documentation for this class was generated from the following files: