Warning, file /geant4/examples/advanced/CaTS/include/MscHit.hh was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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 #include "G4ThreeVector.hh"
0050 #include <G4Types.hh>
0051 #include <G4ios.hh>
0052 #include <ostream>
0053 #include <tls.hh>
0054
0055 class MscHit : public G4VHit
0056 {
0057 public:
0058 MscHit();
0059 ~MscHit() = default;
0060 MscHit(const MscHit&);
0061 const MscHit& operator=(const MscHit&);
0062 G4bool operator==(const MscHit&) const;
0063 inline void* operator new(size_t);
0064 inline void operator delete(void*);
0065 void Draw() final;
0066 inline void Print() final
0067 {
0068 G4cout << "MscHit KinE: " << fkinE << " Px: " << fmomentum.getX()
0069 << " Py: " << fmomentum.getY() << " Pz: " << fmomentum.getZ()
0070 << G4endl;
0071 }
0072 MscHit(G4double kinE, G4ThreeVector momentum);
0073 inline void SetKinE(G4double kinE) { fkinE = kinE; };
0074 inline G4double GetKinE() const { return fkinE; };
0075 inline void SetMomentum(G4ThreeVector momentum) { fmomentum = momentum; };
0076 inline G4ThreeVector GetMomentum() const { return fmomentum; };
0077
0078 private:
0079 G4double fkinE{ 0 };
0080 G4ThreeVector fmomentum{ 0, 0, 0 };
0081 };
0082
0083 using MscHitsCollection = G4THitsCollection<MscHit>;
0084 extern G4ThreadLocal G4Allocator<MscHit>* MscHitAllocator;
0085
0086 inline void* MscHit::operator new(size_t)
0087 {
0088 if(!MscHitAllocator)
0089 {
0090 MscHitAllocator = new G4Allocator<MscHit>;
0091 }
0092 return (void*) MscHitAllocator->MallocSingle();
0093 }
0094
0095 inline void MscHit::operator delete(void* aHit)
0096 {
0097 MscHitAllocator->FreeSingle((MscHit*) aHit);
0098 }