BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
|
Loader to read a specific sampler from a BDSIM ROOT output file. More...
#include <BDSPrimaryGeneratorFileSampler.hh>
Data Structures | |
struct | DisplacedVertex |
Public Member Functions | |
BDSPrimaryGeneratorFileSampler ()=delete | |
Do not require default constructor. | |
BDSPrimaryGeneratorFileSampler (const G4String &distrType, const G4String &fileNameIn, BDSBunchEventGenerator *bunchIn, G4bool loopFileIn, G4bool removeUnstableWithoutDecayIn=true, G4bool warnAboutSkippedParticlesIn=true) | |
virtual void | GeneratePrimaryVertex (G4Event *anEvent) |
Read the next non-empty sampler entry from the file. | |
virtual void | RecreateAdvanceToEvent (G4int eventOffset) |
Advance to the correct event number in the file for recreation. | |
void | SkipEvents (G4long nEventsToSkip) |
![]() | |
BDSPrimaryGeneratorFile (G4bool loopFileIn, BDSBunchEventGenerator *bunchIn) | |
G4bool | GeneratePrimaryVertexSafe (G4Event *event) |
Return false if not able to generate a primary vertex. | |
virtual void | RecreateAdvanceToEvent (G4int eventOffset)=0 |
Advance into the file as required. | |
G4long | NEventsInFile () const |
G4long | NEventsLeftInFile () const |
G4bool | OKToLoopFile () const |
G4long | NEventsReadThatPassedFilters () const |
Accessor. | |
G4long | NEventsSkipped () const |
Return the offset into the file if any. | |
G4bool | DistributionIsFinished () const |
Report whether the distribution is finished generating. | |
void | ThrowExceptionIfRecreateOffsetTooHigh (G4long eventOffset) const |
Protected Member Functions | |
void | ReadSingleEvent (G4long index, G4Event *anEvent) |
Read sampler hits and put into primary vertices if they pass filters. | |
void | ReadPrimaryParticlesFloat (G4long index) |
Conversion from HepMC::GenEvent to G4Event. | |
void | ReadPrimaryParticlesDouble (G4long index) |
![]() | |
G4bool | VertexInsideWorld (const G4ThreeVector &pos) const |
Utility function for derived classes to check a position is inside the world. | |
Private Attributes | |
BDSOutputLoaderSampler * | reader |
G4String | fileName |
G4String | samplerName |
G4bool | removeUnstableWithoutDecay |
G4bool | warnAboutSkippedParticles |
G4RotationMatrix | referenceBeamMomentumOffset |
std::vector< DisplacedVertex > | vertices |
Used for transiently loading information. | |
std::vector< G4PrimaryVertex * > | currentVertices |
Additional Inherited Members | |
![]() | |
static BDSPrimaryGeneratorFile * | ConstructGenerator (const GMAD::Beam &beam, BDSBunch *bunchIn, G4bool recreate, G4int eventOffset, G4bool batchMode) |
![]() | |
G4bool | loopFile |
BDSBunchEventGenerator * | bunch |
G4bool | endOfFileReached |
G4bool | vertexGeneratedSuccessfully |
G4long | currentFileEventIndex |
G4long | nEventsInFile |
G4long | nEventsReadThatPassedFilters |
G4long | nEventsSkipped |
G4VSolid * | worldSolid |
Loader to read a specific sampler from a BDSIM ROOT output file.
Definition at line 44 of file BDSPrimaryGeneratorFileSampler.hh.
BDSPrimaryGeneratorFileSampler::BDSPrimaryGeneratorFileSampler | ( | const G4String & | distrType, |
const G4String & | fileNameIn, | ||
BDSBunchEventGenerator * | bunchIn, | ||
G4bool | loopFileIn, | ||
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 45 of file BDSPrimaryGeneratorFileSampler.cc.
References BDSBunchEventGenerator::eventGeneratorNEventsSkip, BDSBunchEventGenerator::ReferenceBeamMomentumOffset(), SkipEvents(), and BDS::SplitOnColon().
|
virtual |
Definition at line 71 of file BDSPrimaryGeneratorFileSampler.cc.
|
virtual |
Read the next non-empty sampler entry from the file.
Definition at line 76 of file BDSPrimaryGeneratorFileSampler.cc.
References BDSPrimaryGeneratorFile::OKToLoopFile(), and ReadSingleEvent().
|
protected |
Definition at line 142 of file BDSPrimaryGeneratorFileSampler.cc.
|
protected |
Conversion from HepMC::GenEvent to G4Event.
Definition at line 120 of file BDSPrimaryGeneratorFileSampler.cc.
References vertices.
Referenced by ReadSingleEvent().
|
protected |
Read sampler hits and put into primary vertices if they pass filters.
Definition at line 164 of file BDSPrimaryGeneratorFileSampler.cc.
References BDSBunchEventGenerator::AcceptParticle(), BDSParticleCoords::AddOffset(), BDSBunch::ApplyTransform(), BDS::cOverGeV, BDSBunch::GetNextParticleLocal(), BDS::IsFinite(), ReadPrimaryParticlesFloat(), BDSParticleCoordsFull::s, BDSPrimaryGeneratorFile::VertexInsideWorld(), and vertices.
Referenced by GeneratePrimaryVertex().
|
virtual |
Advance to the correct event number in the file for recreation.
Implements BDSPrimaryGeneratorFile.
Definition at line 113 of file BDSPrimaryGeneratorFileSampler.cc.
References SkipEvents(), and BDSPrimaryGeneratorFile::ThrowExceptionIfRecreateOffsetTooHigh().
void BDSPrimaryGeneratorFileSampler::SkipEvents | ( | G4long | nEventsToSkip | ) |
Just advance to a different event index. Have a function to put the implementation in one place and be similar to BDSPrimaryGeneratorFileHEPMC.
Definition at line 282 of file BDSPrimaryGeneratorFileSampler.cc.
References BDSBunchFileBased::DistrFileLoopNTimes().
Referenced by BDSPrimaryGeneratorFileSampler(), and RecreateAdvanceToEvent().
|
private |
Definition at line 98 of file BDSPrimaryGeneratorFileSampler.hh.
|
private |
Definition at line 89 of file BDSPrimaryGeneratorFileSampler.hh.
|
private |
Definition at line 88 of file BDSPrimaryGeneratorFileSampler.hh.
|
private |
Definition at line 93 of file BDSPrimaryGeneratorFileSampler.hh.
|
private |
Definition at line 91 of file BDSPrimaryGeneratorFileSampler.hh.
|
private |
Definition at line 90 of file BDSPrimaryGeneratorFileSampler.hh.
|
private |
Used for transiently loading information.
Definition at line 96 of file BDSPrimaryGeneratorFileSampler.hh.
Referenced by ReadPrimaryParticlesFloat(), and ReadSingleEvent().
|
private |
Definition at line 92 of file BDSPrimaryGeneratorFileSampler.hh.