File indexing completed on 2026-05-04 08:06:13
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 B5DriftChamberHit_h
0030 #define B5DriftChamberHit_h 1
0031
0032 #include "G4VHit.hh"
0033
0034 #include "G4Allocator.hh"
0035 #include "G4THitsCollection.hh"
0036 #include "G4Threading.hh"
0037 #include "G4ThreeVector.hh"
0038 #include "globals.hh"
0039
0040 #include <map>
0041 #include <vector>
0042
0043 class G4AttDef;
0044 class G4AttValue;
0045
0046 namespace B5
0047 {
0048
0049
0050
0051
0052
0053
0054
0055
0056 class DriftChamberHit : public G4VHit
0057 {
0058 public:
0059 DriftChamberHit() = default;
0060 DriftChamberHit(G4int layerID);
0061 DriftChamberHit(const DriftChamberHit& right) = default;
0062 ~DriftChamberHit() override = default;
0063
0064 DriftChamberHit& operator=(const DriftChamberHit& right) = default;
0065 G4bool operator==(const DriftChamberHit& right) const;
0066
0067 inline void* operator new(size_t);
0068 inline void operator delete(void* aHit);
0069
0070 void Draw() override;
0071 const std::map<G4String, G4AttDef>* GetAttDefs() const override;
0072 std::vector<G4AttValue>* CreateAttValues() const override;
0073 void Print() override;
0074
0075 void SetLayerID(G4int z) { fLayerID = z; }
0076 G4int GetLayerID() const { return fLayerID; }
0077
0078 void SetTime(G4double t) { fTime = t; }
0079 G4double GetTime() const { return fTime; }
0080
0081 void SetLocalPos(G4ThreeVector xyz) { fLocalPos = xyz; }
0082 G4ThreeVector GetLocalPos() const { return fLocalPos; }
0083
0084 void SetWorldPos(G4ThreeVector xyz) { fWorldPos = xyz; }
0085 G4ThreeVector GetWorldPos() const { return fWorldPos; }
0086
0087 private:
0088 G4int fLayerID = -1;
0089 G4double fTime = 0.;
0090 G4ThreeVector fLocalPos;
0091 G4ThreeVector fWorldPos;
0092 };
0093
0094 using DriftChamberHitsCollection = G4THitsCollection<DriftChamberHit>;
0095
0096 extern G4ThreadLocal G4Allocator<DriftChamberHit>* DriftChamberHitAllocator;
0097
0098 inline void* DriftChamberHit::operator new(size_t)
0099 {
0100 if (!DriftChamberHitAllocator) {
0101 DriftChamberHitAllocator = new G4Allocator<DriftChamberHit>;
0102 }
0103 return (void*)DriftChamberHitAllocator->MallocSingle();
0104 }
0105
0106 inline void DriftChamberHit::operator delete(void* aHit)
0107 {
0108 DriftChamberHitAllocator->FreeSingle((DriftChamberHit*)aHit);
0109 }
0110
0111 }
0112
0113
0114
0115 #endif