CMS 3D CMS Logo

CustomParticleFactory.h
Go to the documentation of this file.
1 #ifndef SimG4Core_CustomPhysics_CustomParticleFactory_h
2 #define SimG4Core_CustomPhysics_CustomParticleFactory_h 1
3 
4 #include "G4Threading.hh"
5 #include <vector>
6 #include <string>
7 #include <fstream>
8 
9 class G4DecayTable;
10 class G4ParticleDefinition;
11 
13 public:
14  explicit CustomParticleFactory();
15  ~CustomParticleFactory() = default;
16 
18  const std::vector<G4ParticleDefinition *> &getCustomParticles();
19 
20 private:
21  void addCustomParticle(int pdgCode, double mass, const std::string &name);
22  void getMassTable(std::ifstream *configFile);
23  G4DecayTable *getDecayTable(std::ifstream *configFile, int pdgId);
24  G4DecayTable *getAntiDecayTable(int pdgId, G4DecayTable *theDecayTable);
26 
27  static bool loaded;
28  static std::vector<G4ParticleDefinition *> m_particles;
29 #ifdef G4MULTITHREADED
30  static G4Mutex customParticleFactoryMutex;
31 #endif
32 };
33 
34 #endif
void loadCustomParticles(const std::string &filePath)
static std::vector< G4ParticleDefinition * > m_particles
std::string ToLower(std::string str)
void getMassTable(std::ifstream *configFile)
G4DecayTable * getDecayTable(std::ifstream *configFile, int pdgId)
void addCustomParticle(int pdgCode, double mass, const std::string &name)
~CustomParticleFactory()=default
G4DecayTable * getAntiDecayTable(int pdgId, G4DecayTable *theDecayTable)
const std::vector< G4ParticleDefinition * > & getCustomParticles()
#define str(s)