File indexing completed on 2025-01-18 09:55:24
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef DDG4_GEANT4PARTICLEINFORMATION_H
0014 #define DDG4_GEANT4PARTICLEINFORMATION_H
0015
0016
0017 #include <DDG4/Geant4Particle.h>
0018
0019
0020 #include <G4VUserTrackInformation.hh>
0021
0022
0023 #include <string>
0024 #include <memory>
0025
0026
0027
0028 namespace dd4hep {
0029
0030
0031 namespace sim {
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 class Geant4ParticleInformation : public G4VUserTrackInformation {
0049
0050 std::unique_ptr<ParticleExtension> extension;
0051
0052 public:
0053
0054 Geant4ParticleInformation() = default;
0055
0056 template <typename EXTENSION_TYPE>
0057 Geant4ParticleInformation(EXTENSION_TYPE* data);
0058
0059 template <typename EXTENSION_TYPE>
0060 Geant4ParticleInformation(std::unique_ptr<EXTENSION_TYPE>&& data);
0061
0062 Geant4ParticleInformation(Geant4ParticleInformation&& copy) = default;
0063
0064 Geant4ParticleInformation(const Geant4ParticleInformation& copy) = delete;
0065
0066 Geant4ParticleInformation& operator=(Geant4ParticleInformation&& copy) = default;
0067
0068 Geant4ParticleInformation& operator=(const Geant4ParticleInformation& copy) = delete;
0069
0070 virtual ~Geant4ParticleInformation() = default;
0071
0072
0073 void set(ParticleExtension* data) {
0074 this->extension.reset(data);
0075 }
0076
0077 template <typename EXTENSION_TYPE> void set(std::unique_ptr<EXTENSION_TYPE>&& data) {
0078 this->extension = std::move(data);
0079 }
0080 template <typename EXTENSION_TYPE> EXTENSION_TYPE* get() {
0081 return dynamic_cast<EXTENSION_TYPE*>(this->extension.get());
0082 }
0083 ParticleExtension* get() {
0084 return this->extension.get();
0085 }
0086 ParticleExtension* release() {
0087 return this->extension.release();
0088 }
0089 };
0090
0091
0092 template <typename EXTENSION_TYPE> inline
0093 Geant4ParticleInformation::Geant4ParticleInformation(std::unique_ptr<EXTENSION_TYPE>&& data)
0094 : extension(std::move(data))
0095 {
0096 }
0097
0098
0099 template <typename EXTENSION_TYPE> inline
0100 Geant4ParticleInformation::Geant4ParticleInformation(EXTENSION_TYPE* data)
0101 : extension(data)
0102 {
0103 }
0104
0105 }
0106 }
0107 #endif