File indexing completed on 2025-01-31 09:21:46
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
0039
0040
0041
0042
0043
0044 #pragma once
0045
0046 #include "G4VHit.hh"
0047 #include "G4THitsCollection.hh"
0048 #include "G4Allocator.hh"
0049
0050 class InteractionHit : public G4VHit
0051 {
0052 private:
0053 G4String fpname{ "" };
0054 G4double fpmom{ 0 };
0055 G4double fEkin{ 0 };
0056 G4double ftheta{ 0 };
0057 public:
0058 InteractionHit();
0059 InteractionHit(G4String n, G4double m, G4double e, G4double t);
0060 ~InteractionHit() = default;
0061 InteractionHit(const InteractionHit&);
0062 const InteractionHit& operator=(const InteractionHit&);
0063 G4int operator==(const InteractionHit&) const;
0064 inline void* operator new(size_t);
0065 inline void operator delete(void*);
0066 inline void Print() final
0067 {
0068 G4cout << "InteractionHit pname : " << fpname
0069 << " momentum [GeV]: " << fpmom << " kinetic Energy [GeV]" << fEkin
0070 << " theta: " << ftheta << G4endl;
0071 }
0072 inline void SetPname(G4String de) { fpname = de; };
0073 inline void SetPmom(G4double de) { fpmom = de; };
0074 inline void SetEkin(G4double de) { fEkin = de; };
0075 inline void SetTheta(G4double de) { ftheta = de; };
0076 inline G4String GetPname() { return fpname; };
0077 inline G4double GetPmom() { return fpmom; };
0078 inline G4double GetEkin() { return fEkin; };
0079 inline G4double GetTheta() { return ftheta; };
0080 };
0081
0082 using InteractionHitsCollection = G4THitsCollection<InteractionHit>;
0083 extern G4ThreadLocal G4Allocator<InteractionHit>* InteractionHitAllocator;
0084
0085 inline void* InteractionHit::operator new(size_t)
0086 {
0087 if(!InteractionHitAllocator)
0088 {
0089 InteractionHitAllocator = new G4Allocator<InteractionHit>;
0090 }
0091 return (void*) InteractionHitAllocator->MallocSingle();
0092 }
0093
0094 inline void InteractionHit::operator delete(void* aHit)
0095 {
0096 InteractionHitAllocator->FreeSingle((InteractionHit*) aHit);
0097 }