1 | #ifndef ELYSETrackInformation_h |
---|
2 | #define ELYSETrackInformation_h 1 |
---|
3 | |
---|
4 | |
---|
5 | #include "globals.hh" |
---|
6 | #include "G4Track.hh" |
---|
7 | #include "G4Allocator.hh" |
---|
8 | #include "G4VUserTrackInformation.hh" |
---|
9 | |
---|
10 | namespace ELYSE { |
---|
11 | |
---|
12 | enum TrackStatus { active=1, hitProduced=2, absorbed=4, boundaryAbsorbed=8, |
---|
13 | inactive=14}; |
---|
14 | |
---|
15 | /* |
---|
16 | TrackStatus: |
---|
17 | active: still being tracked |
---|
18 | hitProduced: being detected in the Tyvek |
---|
19 | absorbed: stopped by being absorbed with G4OpAbsorbtion |
---|
20 | boundaryAbsorbed: stopped by being aborbed with G4OpAbsorbtion |
---|
21 | inactive: track is stopped for some reason |
---|
22 | -This is the sum of all stopped flags so can be used to remove stopped flags |
---|
23 | |
---|
24 | JEC 13/2/07: see if "absorbed" and "boundaryAbsorbed" are similar? see LXe example |
---|
25 | */ |
---|
26 | |
---|
27 | class TrackInformation : public G4VUserTrackInformation { |
---|
28 | |
---|
29 | public: |
---|
30 | TrackInformation(): saveit(false), drawit(false), status(active) {} |
---|
31 | TrackInformation(const G4Track*); |
---|
32 | virtual ~TrackInformation() {} |
---|
33 | |
---|
34 | inline void *operator new(size_t); |
---|
35 | inline void operator delete(void *aTrackInfo); |
---|
36 | inline int operator ==(const TrackInformation& right) const |
---|
37 | {return (this==&right);} |
---|
38 | |
---|
39 | |
---|
40 | //Sets the track status to s (does not check validity of flags) |
---|
41 | void SetTrackStatusFlags(G4int s){status=s;} |
---|
42 | //Does a smart add of track status flags (disabling old flags that conflict) |
---|
43 | //If s conflicts with itself it will not be detected |
---|
44 | void AddTrackStatusFlag(G4int s); |
---|
45 | int GetTrackStatus() {return status;} |
---|
46 | |
---|
47 | void SetDrawOption(G4bool b) {drawit = b;} |
---|
48 | G4bool GetDrawOption() {return drawit;} |
---|
49 | |
---|
50 | void SetSaveOption(G4bool b) {saveit = b;} |
---|
51 | G4bool GetSaveOption() {return saveit;} |
---|
52 | |
---|
53 | void Print() const; |
---|
54 | |
---|
55 | |
---|
56 | private: |
---|
57 | G4bool saveit; |
---|
58 | G4bool drawit; |
---|
59 | G4int status; |
---|
60 | |
---|
61 | }; |
---|
62 | } |
---|
63 | |
---|
64 | namespace ELYSE { |
---|
65 | extern G4Allocator<TrackInformation> aTrackInfoAllocator; |
---|
66 | } |
---|
67 | |
---|
68 | inline void* ELYSE::TrackInformation::operator new(size_t) { |
---|
69 | void* aTrackInfo; |
---|
70 | aTrackInfo = (void*)ELYSE::aTrackInfoAllocator.MallocSingle(); |
---|
71 | return aTrackInfo; |
---|
72 | } |
---|
73 | |
---|
74 | inline void ELYSE::TrackInformation::operator delete(void *aTrackInfo){ |
---|
75 | ELYSE::aTrackInfoAllocator.FreeSingle((ELYSE::TrackInformation*)aTrackInfo); |
---|
76 | } |
---|
77 | |
---|
78 | |
---|
79 | #endif |
---|