Warning, file /geant4/examples/basic/B2/B2a/include/TrackerHit.hh was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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 B2TrackerHit_h
0031 #define B2TrackerHit_h 1
0032
0033 #include "G4Allocator.hh"
0034 #include "G4THitsCollection.hh"
0035 #include "G4Threading.hh"
0036 #include "G4ThreeVector.hh"
0037 #include "G4VHit.hh"
0038
0039 namespace B2
0040 {
0041
0042
0043
0044
0045
0046
0047
0048 class TrackerHit : public G4VHit
0049 {
0050 public:
0051 TrackerHit() = default;
0052 TrackerHit(const TrackerHit&) = default;
0053 ~TrackerHit() override = default;
0054
0055
0056 TrackerHit& operator=(const TrackerHit&) = default;
0057 G4bool operator==(const TrackerHit&) const;
0058
0059 inline void* operator new(size_t);
0060 inline void operator delete(void*);
0061
0062
0063 void Draw() override;
0064 void Print() override;
0065
0066
0067 void SetTrackID(G4int track) { fTrackID = track; };
0068 void SetChamberNb(G4int chamb) { fChamberNb = chamb; };
0069 void SetEdep(G4double de) { fEdep = de; };
0070 void SetPos(G4ThreeVector xyz) { fPos = xyz; };
0071
0072
0073 G4int GetTrackID() const { return fTrackID; };
0074 G4int GetChamberNb() const { return fChamberNb; };
0075 G4double GetEdep() const { return fEdep; };
0076 G4ThreeVector GetPos() const { return fPos; };
0077
0078 private:
0079 G4int fTrackID = -1;
0080 G4int fChamberNb = -1;
0081 G4double fEdep = 0.;
0082 G4ThreeVector fPos;
0083 };
0084
0085
0086
0087 using TrackerHitsCollection = G4THitsCollection<TrackerHit>;
0088
0089 extern G4ThreadLocal G4Allocator<TrackerHit>* TrackerHitAllocator;
0090
0091
0092
0093 inline void* TrackerHit::operator new(size_t)
0094 {
0095 if (!TrackerHitAllocator) TrackerHitAllocator = new G4Allocator<TrackerHit>;
0096 return (void*)TrackerHitAllocator->MallocSingle();
0097 }
0098
0099
0100
0101 inline void TrackerHit::operator delete(void* hit)
0102 {
0103 TrackerHitAllocator->FreeSingle((TrackerHit*)hit);
0104 }
0105
0106
0107
0108 }
0109
0110 #endif