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 B5DriftChamberHit_h
0031 #define B5DriftChamberHit_h 1
0032
0033 #include "G4VHit.hh"
0034
0035 #include "G4Allocator.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
0047 namespace B5
0048 {
0049
0050
0051
0052
0053
0054
0055
0056
0057 class DriftChamberHit : public G4VHit
0058 {
0059 public:
0060 DriftChamberHit() = default;
0061 DriftChamberHit(G4int layerID);
0062 DriftChamberHit(const DriftChamberHit& right) = default;
0063 ~DriftChamberHit() override = default;
0064
0065 DriftChamberHit& operator=(const DriftChamberHit& right) = default;
0066 G4bool operator==(const DriftChamberHit& 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 void SetLayerID(G4int z) { fLayerID = z; }
0077 G4int GetLayerID() const { return fLayerID; }
0078
0079 void SetTime(G4double t) { fTime = t; }
0080 G4double GetTime() const { return fTime; }
0081
0082 void SetLocalPos(G4ThreeVector xyz) { fLocalPos = xyz; }
0083 G4ThreeVector GetLocalPos() const { return fLocalPos; }
0084
0085 void SetWorldPos(G4ThreeVector xyz) { fWorldPos = xyz; }
0086 G4ThreeVector GetWorldPos() const { return fWorldPos; }
0087
0088 private:
0089 G4int fLayerID = -1;
0090 G4double fTime = 0.;
0091 G4ThreeVector fLocalPos;
0092 G4ThreeVector fWorldPos;
0093 };
0094
0095 using DriftChamberHitsCollection = G4THitsCollection<DriftChamberHit>;
0096
0097 extern G4ThreadLocal G4Allocator<DriftChamberHit>* DriftChamberHitAllocator;
0098
0099 inline void* DriftChamberHit::operator new(size_t)
0100 {
0101 if (!DriftChamberHitAllocator) {
0102 DriftChamberHitAllocator = new G4Allocator<DriftChamberHit>;
0103 }
0104 return (void*)DriftChamberHitAllocator->MallocSingle();
0105 }
0106
0107 inline void DriftChamberHit::operator delete(void* aHit)
0108 {
0109 DriftChamberHitAllocator->FreeSingle((DriftChamberHit*)aHit);
0110 }
0111
0112 }
0113
0114
0115
0116 #endif