Warning, file /geant4/examples/basic/B2/B2b/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 "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 namespace B2
0042 {
0043
0044
0045
0046
0047
0048
0049
0050 class TrackerHit : public G4VHit
0051 {
0052 public:
0053 TrackerHit() = default;
0054 TrackerHit(const TrackerHit&) = default;
0055 ~TrackerHit() override = default;
0056
0057
0058 TrackerHit& operator=(const TrackerHit&) = default;
0059 G4bool operator==(const TrackerHit&) const;
0060
0061 inline void* operator new(size_t);
0062 inline void operator delete(void*);
0063
0064
0065 void Draw() override;
0066 void Print() override;
0067
0068
0069 void SetTrackID(G4int track) { fTrackID = track; };
0070 void SetChamberNb(G4int chamb) { fChamberNb = chamb; };
0071 void SetEdep(G4double de) { fEdep = de; };
0072 void SetPos(G4ThreeVector xyz) { fPos = xyz; };
0073
0074
0075 G4int GetTrackID() const { return fTrackID; };
0076 G4int GetChamberNb() const { return fChamberNb; };
0077 G4double GetEdep() const { return fEdep; };
0078 G4ThreeVector GetPos() const { return fPos; };
0079
0080 private:
0081 G4int fTrackID = -1;
0082 G4int fChamberNb = -1;
0083 G4double fEdep = 0.;
0084 G4ThreeVector fPos;
0085 };
0086
0087
0088
0089 using TrackerHitsCollection = G4THitsCollection<TrackerHit>;
0090
0091 extern G4ThreadLocal G4Allocator<TrackerHit>* TrackerHitAllocator;
0092
0093
0094
0095 inline void* TrackerHit::operator new(size_t)
0096 {
0097 if (!TrackerHitAllocator) TrackerHitAllocator = new G4Allocator<TrackerHit>;
0098 return (void*)TrackerHitAllocator->MallocSingle();
0099 }
0100
0101
0102
0103 inline void TrackerHit::operator delete(void* hit)
0104 {
0105 TrackerHitAllocator->FreeSingle((TrackerHit*)hit);
0106 }
0107
0108
0109
0110 }
0111
0112 #endif