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