File indexing completed on 2025-01-31 09:22:04
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 #ifndef eRositaTrackerHit_h
0028 #define eRositaTrackerHit_h 1
0029
0030 #include <fstream>
0031 #include <iostream>
0032
0033 #include "G4Allocator.hh"
0034 #include "G4THitsCollection.hh"
0035 #include "G4ThreeVector.hh"
0036 #include "G4VHit.hh"
0037
0038 class eRositaTrackerHit : public G4VHit {
0039 public:
0040 explicit eRositaTrackerHit();
0041
0042 ~eRositaTrackerHit() override;
0043
0044 explicit eRositaTrackerHit(const eRositaTrackerHit& right);
0045
0046 auto operator=(const eRositaTrackerHit& right) -> const eRositaTrackerHit&;
0047
0048 auto operator==(const eRositaTrackerHit& right) const -> G4bool;
0049
0050 inline auto operator new(size_t) -> void*;
0051
0052 inline auto operator delete(void* hit) -> void;
0053
0054 void Draw() override;
0055
0056 void Print() override;
0057
0058 void PrintToFile() const;
0059
0060 void SetTrackIdentifier(const G4int &value) {
0061 trackIdentifier = value;
0062 };
0063
0064 void SetChamberNumber(const G4int &value) {
0065 chamberNumber = value;
0066 };
0067
0068 void SetDepositedEnergy(const G4double &value) {
0069 depositedEnergy = value;
0070 };
0071
0072 void SetPosition(const G4ThreeVector &value) {
0073 position = value;
0074 };
0075
0076 [[nodiscard]]
0077 auto GetTrackIdentifier() const -> G4int {
0078 return trackIdentifier;
0079 };
0080
0081 [[nodiscard]]
0082 auto GetChamberNumber() const -> G4int {
0083 return chamberNumber;
0084 };
0085
0086 [[nodiscard]]
0087 auto GetDepositedEnergy() const -> G4double {
0088 return depositedEnergy;
0089 };
0090
0091 [[nodiscard]]
0092 auto GetPosition() const -> G4ThreeVector {
0093 return position;
0094 };
0095
0096 private:
0097 G4int trackIdentifier;
0098
0099 G4int chamberNumber;
0100
0101 G4double depositedEnergy;
0102
0103 G4ThreeVector position;
0104 };
0105
0106 using eRositaTrackerHitsCollection = G4THitsCollection<eRositaTrackerHit>;
0107 extern G4ThreadLocal G4Allocator<eRositaTrackerHit>* trackerHitAllocator;
0108
0109 inline auto eRositaTrackerHit::operator new(size_t) -> void*
0110 {
0111 if (trackerHitAllocator == nullptr) {
0112 trackerHitAllocator = new G4Allocator<eRositaTrackerHit>;
0113 }
0114 return (void*) trackerHitAllocator->MallocSingle();
0115 }
0116
0117 inline auto eRositaTrackerHit::operator delete(void* hit) -> void
0118 {
0119 trackerHitAllocator->FreeSingle((eRositaTrackerHit*) hit);
0120 }
0121 #endif