GEMC  2.2
Geant4 Monte-Carlo Framework
Hit.h
Go to the documentation of this file.
1 
6 #ifndef MHit_H
7 #define MHit_H 1
8 
9 // G4 headers
10 #include "G4ThreeVector.hh"
11 #include "G4VHit.hh"
12 
13 // gemc headers
14 #include "detector.h"
15 #include "sensitiveID.h"
16 
17 // C++ headers
18 #include <iostream>
19 using namespace std;
20 
21 // Class definition
22 class MHit : public G4VHit
23 {
24 
25  public:
26  MHit();
27  virtual ~MHit();
28  const MHit& operator=(const MHit&){return *this;}
29 
30  void Draw();
31 
32  G4Colour colour_touch, colour_hit, colour_passby;
33 
34  private:
35  // all these infos are recorded
36  // in each step of the hit
37  vector<G4ThreeVector> pos;
38  vector<G4ThreeVector> Lpos;
39  vector<G4ThreeVector> vert;
40  vector<double> edep;
41  vector<double> dx;
42  vector<double> time;
43  vector<G4ThreeVector> mom;
44  vector<double> E;
45  vector<int> q;
46  vector<int> PID;
47  vector<int> mPID;
48  vector<int> trackID;
49  vector<int> mtrackID;
50  vector<int> otrackID;
51  vector<G4ThreeVector> mvert;
52 
53  vector<detector> Detectors;
54 
55  vector<identifier> identity;
56  sensitiveID SID;
57 
58  vector<double> signalT;
59  vector<double> signalV;
60 
61 
62  public:
63  // infos filled in Sensitive Detector
64  inline void SetPos(G4ThreeVector xyz) { pos.push_back(xyz); }
65  inline vector<G4ThreeVector> GetPos() { return pos; }
66  inline G4ThreeVector GetLastPos() { if(pos.size()) return pos[pos.size()-1]; else return G4ThreeVector(0,0,0); }
67 
68  inline void SetLPos(G4ThreeVector xyz) { Lpos.push_back(xyz); }
69  inline vector<G4ThreeVector> GetLPos() { return Lpos; }
70 
71  inline void SetVert(G4ThreeVector ver) { vert.push_back(ver); }
72  inline G4ThreeVector GetVert() { return vert[0]; }
73  inline vector<G4ThreeVector> GetVerts() { return vert; }
74 
75  inline void SetEdep(double depe) { edep.push_back(depe); }
76  inline vector<double> GetEdep() { return edep; }
77 
78  inline void SetDx(double Dx) { dx.push_back(Dx); }
79  inline vector<double> GetDx() { return dx; }
80 
81  inline void SetTime(double ctime) { time.push_back(ctime); }
82  inline vector<double> GetTime() { return time; }
83 
84  inline void SetMom(G4ThreeVector pxyz) { mom.push_back(pxyz); }
85  inline G4ThreeVector GetMom() { return mom[0]; }
86  inline vector<G4ThreeVector> GetMoms() { return mom; }
87 
88  inline void SetE(double ene) { E.push_back(ene); }
89  inline double GetE() { return E[0]; }
90  inline vector<double> GetEs() { return E; }
91 
92  inline void SetTrackId(int tid) { trackID.push_back(tid); }
93  inline int GetTId() { return trackID[0]; }
94  inline vector<int> GetTIds() { return trackID; }
95 
96  inline vector<identifier> GetId() { return identity; }
97  inline void SetId(vector<identifier> iden) { identity = iden; }
98 
99  inline void SetDetector(detector det) {Detectors.push_back(det);}
100  inline vector<detector> GetDetectors() {return Detectors;}
101  inline detector GetDetector() {return Detectors[0];}
102 
103  inline void SetPID(int pid) { PID.push_back(pid); }
104  inline int GetPID() { return PID[0]; }
105  inline vector<int> GetPIDs() { return PID; }
106 
107  inline void SetCharge(int Q) { q.push_back(Q); }
108  inline int GetCharge() { return q[0]; }
109  inline vector<int> GetCharges() { return q; }
110 
111  // infos filled in MEvent Action
112  inline void SetmTrackId(int tid) { mtrackID.push_back(tid); }
113  inline void SetmTrackIds(vector<int> tid) { mtrackID = tid; }
114  inline int GetmTrackId() { return mtrackID[0]; }
115  inline vector<int> GetmTrackIds() { return mtrackID; }
116 
117  inline void SetoTrackId(int tid) { otrackID.push_back(tid); }
118  inline void SetoTrackIds(vector<int> tid) { otrackID = tid; }
119  inline int GetoTrackId() { return otrackID[0]; }
120  inline vector<int> GetoTrackIds() { return otrackID; }
121 
122  inline void SetmPID(int mpid) { mPID.push_back(mpid); }
123  inline void SetmPIDs(vector<int> mpid) { mPID = mpid; }
124  inline int GetmPID() { return mPID[0]; }
125  inline vector<int> GetmPIDs() { return mPID; }
126 
127  inline void SetmVert(G4ThreeVector ver) { mvert.push_back(ver); }
128  inline void SetmVerts(vector<G4ThreeVector> ver) { mvert = ver; }
129  inline G4ThreeVector GetmVert() { return mvert[0]; }
130  inline vector<G4ThreeVector> GetmVerts() { return mvert; }
131 
132  inline void SetSDID(sensitiveID s) { SID = s; }
133  inline sensitiveID GetSDID() { return SID; }
134 
135 
136  inline void setSignal(map< double, double > VT)
137  {
138  signalT.clear();
139  signalV.clear();
140 
141  for(map< double, double >::iterator it = VT.begin(); it!=VT.end(); it++)
142  {
143  signalT.push_back(it->first);
144  signalV.push_back(it->second);
145  }
146  }
147 
148  inline vector<double> getSignalT(){return signalT;}
149  inline vector<double> getSignalV(){return signalV;}
150 
151 };
152 
153 
154 #include "G4THitsCollection.hh"
155 typedef G4THitsCollection<MHit> MHitCollection;
156 
157 #endif
158 
159 
160 
161 
162 
163 
164 
165 
166 
167 
168 
169 
void setSignal(map< double, double > VT)
Definition: Hit.h:136
G4Colour colour_touch
Definition: Hit.h:32
int GetoTrackId()
Definition: Hit.h:119
void SetmPIDs(vector< int > mpid)
Definition: Hit.h:123
G4ThreeVector GetVert()
Definition: Hit.h:72
int GetPID()
Definition: Hit.h:104
int GetmPID()
Definition: Hit.h:124
STL namespace.
void SetmTrackIds(vector< int > tid)
Definition: Hit.h:113
vector< double > getSignalT()
Definition: Hit.h:148
vector< G4ThreeVector > GetMoms()
Definition: Hit.h:86
void SetPos(G4ThreeVector xyz)
Definition: Hit.h:64
vector< identifier > GetId()
Definition: Hit.h:96
sensitiveID GetSDID()
Definition: Hit.h:133
vector< double > getSignalV()
Definition: Hit.h:149
G4ThreeVector GetmVert()
Definition: Hit.h:129
vector< detector > GetDetectors()
Definition: Hit.h:100
void SetDetector(detector det)
Definition: Hit.h:99
vector< int > GetmTrackIds()
Definition: Hit.h:115
void SetTrackId(int tid)
Definition: Hit.h:92
void SetEdep(double depe)
Definition: Hit.h:75
vector< G4ThreeVector > GetLPos()
Definition: Hit.h:69
void SetPID(int pid)
Definition: Hit.h:103
void SetMom(G4ThreeVector pxyz)
Definition: Hit.h:84
vector< int > GetmPIDs()
Definition: Hit.h:125
double GetE()
Definition: Hit.h:89
void SetDx(double Dx)
Definition: Hit.h:78
vector< G4ThreeVector > GetPos()
Definition: Hit.h:65
vector< G4ThreeVector > GetmVerts()
Definition: Hit.h:130
void SetmPID(int mpid)
Definition: Hit.h:122
void SetE(double ene)
Definition: Hit.h:88
G4THitsCollection< MHit > MHitCollection
Definition: Hit.h:155
G4ThreeVector GetMom()
Definition: Hit.h:85
void SetId(vector< identifier > iden)
Definition: Hit.h:97
void SetoTrackIds(vector< int > tid)
Definition: Hit.h:118
Definition: Hit.h:22
vector< double > GetEs()
Definition: Hit.h:90
vector< double > GetTime()
Definition: Hit.h:82
void SetCharge(int Q)
Definition: Hit.h:107
void SetmVert(G4ThreeVector ver)
Definition: Hit.h:127
const MHit & operator=(const MHit &)
Definition: Hit.h:28
vector< int > GetTIds()
Definition: Hit.h:94
vector< int > GetPIDs()
Definition: Hit.h:105
void SetSDID(sensitiveID s)
Definition: Hit.h:132
void SetLPos(G4ThreeVector xyz)
Definition: Hit.h:68
G4ThreeVector GetLastPos()
Definition: Hit.h:66
void SetTime(double ctime)
Definition: Hit.h:81
vector< double > GetEdep()
Definition: Hit.h:76
void SetmVerts(vector< G4ThreeVector > ver)
Definition: Hit.h:128
int GetTId()
Definition: Hit.h:93
vector< int > GetoTrackIds()
Definition: Hit.h:120
vector< G4ThreeVector > GetVerts()
Definition: Hit.h:73
detector GetDetector()
Definition: Hit.h:101
void SetVert(G4ThreeVector ver)
Definition: Hit.h:71
int GetCharge()
Definition: Hit.h:108
vector< int > GetCharges()
Definition: Hit.h:109
vector< double > GetDx()
Definition: Hit.h:79
int GetmTrackId()
Definition: Hit.h:114
void SetoTrackId(int tid)
Definition: Hit.h:117
void SetmTrackId(int tid)
Definition: Hit.h:112