File indexing completed on 2025-08-02 08:28:24
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 #ifndef G4ClonedRichTrajectory_HH
0039 #define G4ClonedRichTrajectory_HH 1
0040
0041 #include "G4TouchableHandle.hh"
0042 #include "G4VTrajectory.hh"
0043 #include "G4ParticleDefinition.hh" // Include from 'particle+matter'
0044 #include "G4Step.hh"
0045 #include "G4Track.hh"
0046 #include "G4ClonedRichTrajectoryPoint.hh" // Include from 'tracking'
0047 #include "G4ios.hh" // Include from 'system'
0048 #include "globals.hh" // Include from 'global'
0049
0050 #include "trkgdefs.hh"
0051 #include <stdlib.h> // Include from 'system'
0052
0053 #include <vector>
0054
0055 class G4Polyline;
0056 class G4RichTrajectory;
0057
0058 class G4ClonedRichTrajectory : public G4VTrajectory
0059 {
0060 using G4TrajectoryPointContainer = std::vector<G4VTrajectoryPoint*>;
0061
0062 public:
0063
0064
0065 G4ClonedRichTrajectory() = default;
0066 ~G4ClonedRichTrajectory() override;
0067 G4ClonedRichTrajectory(const G4RichTrajectory&);
0068 G4ClonedRichTrajectory& operator=(const G4ClonedRichTrajectory&) = delete;
0069
0070
0071
0072 G4bool operator==(const G4ClonedRichTrajectory& r) const { return (this == &r); }
0073
0074 inline void* operator new(size_t);
0075 inline void operator delete(void*);
0076
0077
0078
0079 inline G4int GetTrackID() const override { return fTrackID; }
0080 inline G4int GetParentID() const override { return fParentID; }
0081 inline G4String GetParticleName() const override { return ParticleName; }
0082 inline G4double GetCharge() const override { return PDGCharge; }
0083 inline G4int GetPDGEncoding() const override { return PDGEncoding; }
0084 inline G4double GetInitialKineticEnergy() const { return initialKineticEnergy; }
0085 inline G4ThreeVector GetInitialMomentum() const override { return initialMomentum; }
0086
0087
0088
0089 void ShowTrajectory(std::ostream& os = G4cout) const override;
0090 void DrawTrajectory() const override;
0091 void AppendStep(const G4Step* aStep) override;
0092 void MergeTrajectory(G4VTrajectory* secondTrajectory) override;
0093 inline G4int GetPointEntries() const override;
0094 inline G4VTrajectoryPoint* GetPoint(G4int i) const override;
0095
0096 G4ParticleDefinition* GetParticleDefinition();
0097
0098
0099
0100 const std::map<G4String, G4AttDef>* GetAttDefs() const override;
0101 std::vector<G4AttValue>* CreateAttValues() const override;
0102
0103 private:
0104
0105 G4int fTrackID = 0;
0106 G4int fParentID = 0;
0107 G4int PDGEncoding = 0;
0108 G4double PDGCharge = 0.0;
0109 G4String ParticleName = "dummy";
0110 G4double initialKineticEnergy = 0.0;
0111 G4ThreeVector initialMomentum;
0112
0113
0114
0115 G4TrajectoryPointContainer* fpRichPointContainer = nullptr;
0116 G4TouchableHandle fpInitialVolume;
0117 G4TouchableHandle fpInitialNextVolume;
0118 const G4VProcess* fpCreatorProcess = nullptr;
0119 G4int fCreatorModelID = 0;
0120 G4TouchableHandle fpFinalVolume;
0121 G4TouchableHandle fpFinalNextVolume;
0122 const G4VProcess* fpEndingProcess = nullptr;
0123 G4double fFinalKineticEnergy = 0.0;
0124 };
0125
0126 extern G4TRACKING_DLL G4Allocator<G4ClonedRichTrajectory>*& aClonedRichTrajectoryAllocator();
0127
0128 inline void* G4ClonedRichTrajectory::operator new(size_t)
0129 {
0130 if (aClonedRichTrajectoryAllocator() == nullptr) {
0131 aClonedRichTrajectoryAllocator() = new G4Allocator<G4ClonedRichTrajectory>;
0132 }
0133 return (void*)aClonedRichTrajectoryAllocator()->MallocSingle();
0134 }
0135
0136 inline void G4ClonedRichTrajectory::operator delete(void* aRichTrajectory)
0137 {
0138 aClonedRichTrajectoryAllocator()->FreeSingle((G4ClonedRichTrajectory*)aRichTrajectory);
0139 }
0140
0141 inline G4int G4ClonedRichTrajectory::GetPointEntries() const
0142 {
0143 return G4int(fpRichPointContainer->size());
0144 }
0145
0146 inline G4VTrajectoryPoint* G4ClonedRichTrajectory::GetPoint(G4int i) const
0147 {
0148 return (*fpRichPointContainer)[i];
0149 }
0150
0151 #endif