GEMC  2.3
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  vector<string> materialName;
53  vector<int> processID;
54 
55  vector<detector> Detectors;
56 
57  vector<identifier> identity;
58  sensitiveID SID;
59 
60  vector<double> signalT;
61  vector<double> signalV;
62 
63  vector<int> quantumT;
64  vector<int> quantumQ;
65  vector<int> quantumTR;
66 
67  int hasTrigger;
68 
69  public:
70  // infos filled in Sensitive Detector
71  inline void SetPos(G4ThreeVector xyz) { pos.push_back(xyz); }
72  inline vector<G4ThreeVector> GetPos() { return pos; }
73  inline G4ThreeVector GetLastPos() { if(pos.size()) return pos[pos.size()-1]; else return G4ThreeVector(0,0,0); }
74 
75  inline void SetLPos(G4ThreeVector xyz) { Lpos.push_back(xyz); }
76  inline vector<G4ThreeVector> GetLPos() { return Lpos; }
77 
78  inline void SetVert(G4ThreeVector ver) { vert.push_back(ver); }
79  inline G4ThreeVector GetVert() { return vert[0]; }
80  inline vector<G4ThreeVector> GetVerts() { return vert; }
81 
82  inline void SetEdep(double depe) { edep.push_back(depe); }
83  inline vector<double> GetEdep() { return edep; }
84 
85  inline void SetDx(double Dx) { dx.push_back(Dx); }
86  inline vector<double> GetDx() { return dx; }
87 
88  inline void SetTime(double ctime) { time.push_back(ctime); }
89  inline vector<double> GetTime() { return time; }
90 
91  inline void SetMom(G4ThreeVector pxyz) { mom.push_back(pxyz); }
92  inline G4ThreeVector GetMom() { return mom[0]; }
93  inline vector<G4ThreeVector> GetMoms() { return mom; }
94 
95  inline void SetE(double ene) { E.push_back(ene); }
96  inline double GetE() { return E[0]; }
97  inline vector<double> GetEs() { return E; }
98 
99  inline void SetTrackId(int tid) { trackID.push_back(tid); }
100  inline int GetTId() { return trackID[0]; }
101  inline vector<int> GetTIds() { return trackID; }
102 
103  inline vector<identifier> GetId() { return identity; }
104  inline void SetId(vector<identifier> iden) { identity = iden; }
105 
106  inline void SetDetector(detector det) {Detectors.push_back(det);}
107  inline vector<detector> GetDetectors() {return Detectors;}
108  inline detector GetDetector() {return Detectors[0];}
109 
110  inline void SetPID(int pid) { PID.push_back(pid); }
111  inline int GetPID() { return PID[0]; }
112  inline vector<int> GetPIDs() { return PID; }
113 
114  inline void SetCharge(int Q) { q.push_back(Q); }
115  inline int GetCharge() { return q[0]; }
116  inline vector<int> GetCharges() { return q; }
117 
118  // infos filled in MEvent Action
119  inline void SetmTrackId(int tid) { mtrackID.push_back(tid); }
120  inline void SetmTrackIds(vector<int> tid) { mtrackID = tid; }
121  inline int GetmTrackId() { return mtrackID[0]; }
122  inline vector<int> GetmTrackIds() { return mtrackID; }
123 
124  inline void SetoTrackId(int tid) { otrackID.push_back(tid); }
125  inline void SetoTrackIds(vector<int> tid) { otrackID = tid; }
126  inline int GetoTrackId() { return otrackID[0]; }
127  inline vector<int> GetoTrackIds() { return otrackID; }
128 
129  inline void SetmPID(int mpid) { mPID.push_back(mpid); }
130  inline void SetmPIDs(vector<int> mpid) { mPID = mpid; }
131  inline int GetmPID() { return mPID[0]; }
132  inline vector<int> GetmPIDs() { return mPID; }
133 
134  inline void SetmVert(G4ThreeVector ver) { mvert.push_back(ver); }
135  inline void SetmVerts(vector<G4ThreeVector> ver) { mvert = ver; }
136  inline G4ThreeVector GetmVert() { return mvert[0]; }
137  inline vector<G4ThreeVector> GetmVerts() { return mvert; }
138 
139  inline void SetMatName(string mname) { materialName.push_back(mname); }
140  inline void SetMatNames(vector<string> mnames) { materialName = mnames; }
141  inline string GetMatName() { return materialName[0]; }
142  inline vector<string> GetMatNames() { return materialName; }
143 
144  inline void SetProcID(int procID) { processID.push_back(procID); }
145  inline void SetProcID(vector<int> procIDs) { processID = procIDs; }
146  inline int GetProcID() { return processID[0]; }
147  inline vector<int> GetProcIDs() { return processID; }
148 
149  inline void SetSDID(sensitiveID s) { SID = s; }
150  inline sensitiveID GetSDID() { return SID; }
151 
152 
153  inline void setSignal(map< double, double > VT)
154  {
155  signalT.clear();
156  signalV.clear();
157 
158  for(map< double, double >::iterator it = VT.begin(); it!=VT.end(); it++)
159  {
160  signalT.push_back(it->first);
161  signalV.push_back(it->second);
162  }
163  }
164 
165  inline vector<double> getSignalT(){return signalT;}
166  inline vector<double> getSignalV(){return signalV;}
167 
168  inline void setQuantum(map< int, int > QS)
169  {
170  quantumT.clear();
171  quantumQ.clear();
172 
173  for(map< int, int >::iterator it = QS.begin(); it!=QS.end(); it++)
174  {
175  quantumT.push_back(it->first);
176  quantumQ.push_back(it->second);
177  }
178  }
179 
180  inline vector<int> getQuantumT() {return quantumT;}
181  inline vector<int> getQuantumQ() {return quantumQ;}
182  inline vector<int> getQuantumTR(){return quantumTR;}
183  inline void setQuantumTR(vector<int> t) { quantumTR = t; }
184 
185  // trigger
186  inline void passedTrigger(){hasTrigger = 1;}
187  inline int diditpassTrigger(){return hasTrigger;}
188 
189 
190 };
191 
192 
193 #include "G4THitsCollection.hh"
194 typedef G4THitsCollection<MHit> MHitCollection;
195 
196 #endif
197 
198 
199 
200 
201 
202 
203 
204 
205 
206 
207 
208 
void setSignal(map< double, double > VT)
Definition: Hit.h:153
G4Colour colour_touch
Definition: Hit.h:32
void SetMatNames(vector< string > mnames)
Definition: Hit.h:140
void setQuantum(map< int, int > QS)
Definition: Hit.h:168
int GetoTrackId()
Definition: Hit.h:126
int GetProcID()
Definition: Hit.h:146
void SetmPIDs(vector< int > mpid)
Definition: Hit.h:130
G4ThreeVector GetVert()
Definition: Hit.h:79
int GetPID()
Definition: Hit.h:111
int GetmPID()
Definition: Hit.h:131
STL namespace.
void SetmTrackIds(vector< int > tid)
Definition: Hit.h:120
vector< double > getSignalT()
Definition: Hit.h:165
vector< G4ThreeVector > GetMoms()
Definition: Hit.h:93
void SetPos(G4ThreeVector xyz)
Definition: Hit.h:71
vector< identifier > GetId()
Definition: Hit.h:103
sensitiveID GetSDID()
Definition: Hit.h:150
string GetMatName()
Definition: Hit.h:141
vector< double > getSignalV()
Definition: Hit.h:166
G4ThreeVector GetmVert()
Definition: Hit.h:136
vector< detector > GetDetectors()
Definition: Hit.h:107
void SetDetector(detector det)
Definition: Hit.h:106
vector< int > GetmTrackIds()
Definition: Hit.h:122
int diditpassTrigger()
Definition: Hit.h:187
void SetTrackId(int tid)
Definition: Hit.h:99
void setQuantumTR(vector< int > t)
Definition: Hit.h:183
vector< int > getQuantumTR()
Definition: Hit.h:182
void SetEdep(double depe)
Definition: Hit.h:82
vector< G4ThreeVector > GetLPos()
Definition: Hit.h:76
void SetPID(int pid)
Definition: Hit.h:110
void SetMom(G4ThreeVector pxyz)
Definition: Hit.h:91
vector< int > GetmPIDs()
Definition: Hit.h:132
double GetE()
Definition: Hit.h:96
void SetDx(double Dx)
Definition: Hit.h:85
vector< G4ThreeVector > GetPos()
Definition: Hit.h:72
void SetProcID(int procID)
Definition: Hit.h:144
vector< int > getQuantumT()
Definition: Hit.h:180
vector< int > GetProcIDs()
Definition: Hit.h:147
vector< G4ThreeVector > GetmVerts()
Definition: Hit.h:137
void SetmPID(int mpid)
Definition: Hit.h:129
void SetE(double ene)
Definition: Hit.h:95
G4THitsCollection< MHit > MHitCollection
Definition: Hit.h:194
G4ThreeVector GetMom()
Definition: Hit.h:92
void SetId(vector< identifier > iden)
Definition: Hit.h:104
void SetoTrackIds(vector< int > tid)
Definition: Hit.h:125
Definition: Hit.h:22
vector< double > GetEs()
Definition: Hit.h:97
vector< int > getQuantumQ()
Definition: Hit.h:181
vector< double > GetTime()
Definition: Hit.h:89
void SetCharge(int Q)
Definition: Hit.h:114
void passedTrigger()
Definition: Hit.h:186
void SetmVert(G4ThreeVector ver)
Definition: Hit.h:134
const MHit & operator=(const MHit &)
Definition: Hit.h:28
vector< int > GetTIds()
Definition: Hit.h:101
vector< int > GetPIDs()
Definition: Hit.h:112
void SetProcID(vector< int > procIDs)
Definition: Hit.h:145
void SetSDID(sensitiveID s)
Definition: Hit.h:149
vector< string > GetMatNames()
Definition: Hit.h:142
void SetLPos(G4ThreeVector xyz)
Definition: Hit.h:75
void SetMatName(string mname)
Definition: Hit.h:139
G4ThreeVector GetLastPos()
Definition: Hit.h:73
void SetTime(double ctime)
Definition: Hit.h:88
vector< double > GetEdep()
Definition: Hit.h:83
void SetmVerts(vector< G4ThreeVector > ver)
Definition: Hit.h:135
int GetTId()
Definition: Hit.h:100
vector< int > GetoTrackIds()
Definition: Hit.h:127
vector< G4ThreeVector > GetVerts()
Definition: Hit.h:80
detector GetDetector()
Definition: Hit.h:108
void SetVert(G4ThreeVector ver)
Definition: Hit.h:78
int GetCharge()
Definition: Hit.h:115
vector< int > GetCharges()
Definition: Hit.h:116
vector< double > GetDx()
Definition: Hit.h:86
int GetmTrackId()
Definition: Hit.h:121
void SetoTrackId(int tid)
Definition: Hit.h:124
void SetmTrackId(int tid)
Definition: Hit.h:119