File indexing completed on 2025-01-31 09:22:53
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 #ifndef B5HodoscopeHit_h
0031 #define B5HodoscopeHit_h 1
0032
0033 #include "G4VHit.hh"
0034
0035 #include "G4Allocator.hh"
0036 #include "G4RotationMatrix.hh"
0037 #include "G4THitsCollection.hh"
0038 #include "G4Threading.hh"
0039 #include "G4ThreeVector.hh"
0040 #include "globals.hh"
0041
0042 #include <map>
0043 #include <vector>
0044
0045 class G4AttDef;
0046 class G4AttValue;
0047 class G4LogicalVolume;
0048
0049 namespace B5
0050 {
0051
0052
0053
0054
0055
0056
0057
0058
0059 class HodoscopeHit : public G4VHit
0060 {
0061 public:
0062 HodoscopeHit(G4int i, G4double t);
0063 HodoscopeHit(const HodoscopeHit& right) = default;
0064 ~HodoscopeHit() override = default;
0065
0066 HodoscopeHit& operator=(const HodoscopeHit& right) = default;
0067 G4bool operator==(const HodoscopeHit& right) const;
0068
0069 inline void* operator new(size_t);
0070 inline void operator delete(void* aHit);
0071
0072 void Draw() override;
0073 const std::map<G4String, G4AttDef>* GetAttDefs() const override;
0074 std::vector<G4AttValue>* CreateAttValues() const override;
0075 void Print() override;
0076
0077 G4int GetID() const { return fId; }
0078
0079 void SetTime(G4double val) { fTime = val; }
0080 G4double GetTime() const { return fTime; }
0081
0082 void SetPos(G4ThreeVector xyz) { fPos = xyz; }
0083 G4ThreeVector GetPos() const { return fPos; }
0084
0085 void SetRot(G4RotationMatrix rmat) { fRot = rmat; }
0086 G4RotationMatrix GetRot() const { return fRot; }
0087
0088 void SetLogV(G4LogicalVolume* val) { fPLogV = val; }
0089 const G4LogicalVolume* GetLogV() const { return fPLogV; }
0090
0091 private:
0092 G4int fId = -1;
0093 G4double fTime = 0.;
0094 G4ThreeVector fPos;
0095 G4RotationMatrix fRot;
0096 const G4LogicalVolume* fPLogV = nullptr;
0097 };
0098
0099 using HodoscopeHitsCollection = G4THitsCollection<HodoscopeHit>;
0100
0101 extern G4ThreadLocal G4Allocator<HodoscopeHit>* HodoscopeHitAllocator;
0102
0103 inline void* HodoscopeHit::operator new(size_t)
0104 {
0105 if (!HodoscopeHitAllocator) {
0106 HodoscopeHitAllocator = new G4Allocator<HodoscopeHit>;
0107 }
0108 return (void*)HodoscopeHitAllocator->MallocSingle();
0109 }
0110
0111 inline void HodoscopeHit::operator delete(void* aHit)
0112 {
0113 HodoscopeHitAllocator->FreeSingle((HodoscopeHit*)aHit);
0114 }
0115
0116 }
0117
0118
0119
0120 #endif