1 | #ifndef ELYSETrappVolHit_h |
---|
2 | #define ELYSETrappVolHit_h 1 |
---|
3 | |
---|
4 | //Geant4 |
---|
5 | #include "G4VHit.hh" |
---|
6 | #include "G4THitsCollection.hh" |
---|
7 | #include "G4Allocator.hh" |
---|
8 | #include "G4ThreeVector.hh" |
---|
9 | #include "G4ios.hh" |
---|
10 | |
---|
11 | class G4VSolid; |
---|
12 | |
---|
13 | namespace ELYSE { |
---|
14 | |
---|
15 | class TrappVolHit : public G4VHit { |
---|
16 | public: |
---|
17 | |
---|
18 | TrappVolHit(); |
---|
19 | virtual ~TrappVolHit(); |
---|
20 | |
---|
21 | inline void* operator new(size_t); |
---|
22 | inline void operator delete(void*); |
---|
23 | |
---|
24 | //dump |
---|
25 | void Print(); |
---|
26 | |
---|
27 | //Used by GB for visualisation |
---|
28 | virtual const std::map<G4String,G4AttDef>* GetAttDefs() const; |
---|
29 | virtual std::vector<G4AttValue>* CreateAttValues() const; |
---|
30 | |
---|
31 | public: |
---|
32 | |
---|
33 | void SetTime(G4double hitTime) { time = hitTime; } |
---|
34 | void SetEtot(G4double hitEnergy) { eTot = hitEnergy; } |
---|
35 | void SetCoordinates(const G4ThreeVector& hitPosition) { position = hitPosition;} |
---|
36 | void SetTrkId(G4int trackID) { trkId = trackID; } |
---|
37 | void SetParentId(G4int trackParentID) { parentId = trackParentID; } |
---|
38 | void SetPDGEncoding(G4int trackPDGcode) { pdg = trackPDGcode; } |
---|
39 | void SetEdep(G4double energyDeposition) { edep = energyDeposition; } |
---|
40 | |
---|
41 | G4double GetTime() const { return time; } |
---|
42 | G4double GetEtot() const { return eTot; } |
---|
43 | const G4ThreeVector& GetCoordinates() const { return position; } |
---|
44 | G4int GetTrkId() const { return trkId; } |
---|
45 | G4int GetParentId() const { return parentId; } |
---|
46 | G4int GetPDGEncoding() const { return pdg; } |
---|
47 | G4double GetEdep() const { return edep; } |
---|
48 | |
---|
49 | private: |
---|
50 | //forbid copy & assignment |
---|
51 | TrappVolHit(const TrappVolHit&); |
---|
52 | const TrappVolHit& operator=(const TrappVolHit&); |
---|
53 | |
---|
54 | private: |
---|
55 | |
---|
56 | //for visualisation |
---|
57 | G4VSolid* virtualSolid; //a Box to represent the hit |
---|
58 | //data |
---|
59 | G4double time; //time of hit creation |
---|
60 | G4double eTot; //Total energy of the particle creating the hit |
---|
61 | G4ThreeVector position; //position of the hit |
---|
62 | G4int trkId; //Id of the particle |
---|
63 | G4int parentId; //Id of the parent of the particle |
---|
64 | G4int pdg; //PDG code of the particle |
---|
65 | G4double edep; //Energy deposit |
---|
66 | |
---|
67 | |
---|
68 | }; |
---|
69 | } |
---|
70 | |
---|
71 | //---------------------------------------------------------------- |
---|
72 | |
---|
73 | //JEC 10/1/06 introduce ELYSE |
---|
74 | namespace ELYSE { |
---|
75 | typedef G4THitsCollection<TrappVolHit> TrappVolHitsCollection; |
---|
76 | extern G4Allocator<TrappVolHit> TrappVolHitAllocator; |
---|
77 | } |
---|
78 | |
---|
79 | inline void* ELYSE::TrappVolHit::operator new(size_t) { |
---|
80 | void *aHit; |
---|
81 | aHit = (void *) ELYSE::TrappVolHitAllocator.MallocSingle(); |
---|
82 | return aHit; |
---|
83 | } |
---|
84 | |
---|
85 | inline void ELYSE::TrappVolHit::operator delete(void *aHit) { |
---|
86 | ELYSE::TrappVolHitAllocator.FreeSingle((ELYSE::TrappVolHit*) aHit); |
---|
87 | } |
---|
88 | |
---|
89 | #endif |
---|