BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
|
Loader to use any HepMC3 compatible file. More...
#include <BDSHepMC3Reader.hh>
Public Member Functions | |
BDSHepMC3Reader ()=delete | |
Do not require default constructor. | |
BDSHepMC3Reader (const G4String &distrType, const G4String &fileNameIn, BDSBunchEventGenerator *bunchIn, G4bool removeUnstableWithoutDecayIn=true, G4bool warnAboutSkippedParticlesIn=true) | |
HepMC3::GenEvent * | GetHepMCGenEvent () const |
Accessor. More... | |
virtual void | GeneratePrimaryVertex (G4Event *anEvent) |
virtual void | RecreateAdvanceToEvent (G4int eventOffset) |
Advance to the correct event number in the file for recreation. More... | |
Protected Member Functions | |
void | OpenFile () |
Construct the member "reader" and open the file for reading. More... | |
void | CloseFile () |
void | ReadSingleEvent () |
Clear the hepmcEvent object, reallocate and read a single event and fill that member. More... | |
void | HepMC2G4 (const HepMC3::GenEvent *hepmcevt, G4Event *g4event) |
Conversion from HepMC::GenEvent to G4Event. More... | |
virtual G4bool | VertexInsideWorld (const G4ThreeVector &pos) const |
Protected Attributes | |
HepMC3::GenEvent * | hepmcEvent |
Private Attributes | |
HepMC3::Reader * | reader |
G4String | fileName |
BDSBunchEventGenerator * | bunch |
G4bool | removeUnstableWithoutDecay |
G4bool | warnAboutSkippedParticles |
BDSEventGeneratorFileType | fileType |
G4RotationMatrix | referenceBeamMomentumOffset |
G4VSolid * | worldSolid |
Loader to use any HepMC3 compatible file.
Interface to use HepMC3 library to load a variety of files.
This is largely based on Geant4's example examples/extended/eventgenerator/HepMC/HepMCEx01, however it has been rewritten to use HepMC3 library rather than HepMC2. Additionally, the interface has been written based on HepMC3 example "convert_example" to use multiple reader classes.
Definition at line 55 of file BDSHepMC3Reader.hh.
BDSHepMC3Reader::BDSHepMC3Reader | ( | 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 62 of file BDSHepMC3Reader.cc.
References BDS::DetermineEventGeneratorFileType(), OpenFile(), BDSBunchEventGenerator::ReferenceBeamMomentumOffset(), and BDS::SplitOnColon().
|
virtual |
Definition at line 82 of file BDSHepMC3Reader.cc.
|
protected |
Close and delete reader. Have to delete as HepMC3 readers have no iteration or ability to loop back to the beginning.
Definition at line 135 of file BDSHepMC3Reader.cc.
Referenced by ReadSingleEvent().
|
virtual |
Definition at line 88 of file BDSHepMC3Reader.cc.
|
inline |
Accessor.
Definition at line 72 of file BDSHepMC3Reader.hh.
|
protected |
Conversion from HepMC::GenEvent to G4Event.
Definition at line 163 of file BDSHepMC3Reader.cc.
References BDSBunchEventGenerator::AcceptParticle(), BDSBunch::ApplyTransform(), BDS::cOverGeV, BDSBunch::GetNextParticleLocal(), BDS::IsFinite(), and BDSParticleCoordsFull::s.
|
protected |
Construct the member "reader" and open the file for reading.
Definition at line 104 of file BDSHepMC3Reader.cc.
References BDSTypeSafeEnum< def, inner >::underlying().
Referenced by BDSHepMC3Reader(), and ReadSingleEvent().
|
protected |
Clear the hepmcEvent object, reallocate and read a single event and fill that member.
Definition at line 142 of file BDSHepMC3Reader.cc.
References CloseFile(), and OpenFile().
Referenced by RecreateAdvanceToEvent().
|
virtual |
Advance to the correct event number in the file for recreation.
Definition at line 97 of file BDSHepMC3Reader.cc.
References ReadSingleEvent().
Referenced by BDSPrimaryGeneratorAction::BDSPrimaryGeneratorAction().
|
protectedvirtual |
Definition at line 277 of file BDSHepMC3Reader.cc.
|
private |
Definition at line 107 of file BDSHepMC3Reader.hh.
|
private |
Definition at line 106 of file BDSHepMC3Reader.hh.
|
private |
Definition at line 110 of file BDSHepMC3Reader.hh.
|
protected |
Definition at line 102 of file BDSHepMC3Reader.hh.
|
private |
Definition at line 105 of file BDSHepMC3Reader.hh.
|
private |
Definition at line 111 of file BDSHepMC3Reader.hh.
|
private |
Definition at line 108 of file BDSHepMC3Reader.hh.
|
private |
Definition at line 109 of file BDSHepMC3Reader.hh.
|
mutableprivate |
Definition at line 112 of file BDSHepMC3Reader.hh.