GEMC  1.8
Geant4 Monte-Carlo Framework
MHit.h
Go to the documentation of this file.
1 
6 #ifndef MHit_H
7 #define MHit_H 1
8 
9 // %%%%%%%%%%
10 // G4 headers
11 // %%%%%%%%%%
12 #include "G4ThreeVector.hh"
13 #include "G4VHit.hh"
14 
15 // %%%%%%%%%%%%%
16 // gemc headers
17 // %%%%%%%%%%%%%
18 #include "detector.h"
19 
20 // %%%%%%%%%%%
21 // C++ headers
22 // %%%%%%%%%%%
23 #include <iostream>
24 using namespace std;
25 
26 // %%%%%%%%%%%%%%%%
27 // Class definition
28 // %%%%%%%%%%%%%%%%
29 class MHit : public G4VHit
30 {
31 
32  public:
33  MHit();
34  virtual ~MHit();
35  const MHit& operator=(const MHit&){return *this;}
36 
37  void Draw();
38 
39  private:
40  // all these infos are recorded
41  // in each step of the hit
42  vector<G4ThreeVector> pos;
43  vector<G4ThreeVector> Lpos;
44  vector<G4ThreeVector> vert;
45  vector<double> edep;
46  vector<double> dx;
47  vector<double> time;
48  vector<G4ThreeVector> mom;
49  vector<double> E;
50  vector<int> q;
51  vector<int> PID;
52  vector<int> mPID;
53  vector<int> trackID;
54  vector<int> mtrackID;
55  vector<G4ThreeVector> mvert;
56 
57  vector<detector> Detectors;
58 
59  vector<identifier> identity;
60  double minEdep;
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]; }
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 SetThreshold(double E) { minEdep = E; }
104  inline double GetThreshold() { return minEdep; }
105 
106  inline void SetPID(int pid) { PID.push_back(pid); }
107  inline int GetPID() { return PID[0]; }
108  inline vector<int> GetPIDs() { return PID; }
109 
110  inline void SetCharge(int Q) { q.push_back(Q); }
111  inline int GetCharge() { return q[0]; }
112  inline vector<int> GetCharges() { return q; }
113 
114  // infos filled in MEvent Action
115  inline void SetmTrackId(int tid) { mtrackID.push_back(tid); }
116  inline void SetmTrackIds(vector<int> tid) { mtrackID = tid; }
117  inline int GetmTrackId() { return mtrackID[0]; }
118  inline vector<int> GetmTrackIds() { return mtrackID; }
119 
120  inline void SetmPID(int mpid) { mPID.push_back(mpid); }
121  inline void SetmPIDs(vector<int> mpid) { mPID = mpid; }
122  inline int GetmPID() { return mPID[0]; }
123  inline vector<int> GetmPIDs() { return mPID; }
124 
125  inline void SetmVert(G4ThreeVector ver) { mvert.push_back(ver); }
126  inline void SetmVerts(vector<G4ThreeVector> ver) { mvert = ver; }
127  inline G4ThreeVector GetmVert() { return mvert[0]; }
128  inline vector<G4ThreeVector> GetmVerts() { return mvert; }
129 
130 };
131 
132 
133 #include "G4THitsCollection.hh"
134 typedef G4THitsCollection<MHit> MHitCollection;
135 
136 #endif
void SetmPIDs(vector< int > mpid)
Definition: MHit.h:121
double GetThreshold()
Definition: MHit.h:104
G4ThreeVector GetVert()
Definition: MHit.h:72
int GetPID()
Definition: MHit.h:107
int GetmPID()
Definition: MHit.h:122
STL namespace.
void SetmTrackIds(vector< int > tid)
Definition: MHit.h:116
vector< G4ThreeVector > GetMoms()
Definition: MHit.h:86
void SetPos(G4ThreeVector xyz)
Definition: MHit.h:64
vector< identifier > GetId()
Definition: MHit.h:96
G4ThreeVector GetmVert()
Definition: MHit.h:127
G4THitsCollection< MHit > MHitCollection
Definition: MHit.h:134
vector< detector > GetDetectors()
Definition: MHit.h:100
void SetDetector(detector det)
Definition: MHit.h:99
vector< int > GetmTrackIds()
Definition: MHit.h:118
void SetTrackId(int tid)
Definition: MHit.h:92
void SetEdep(double depe)
Definition: MHit.h:75
vector< G4ThreeVector > GetLPos()
Definition: MHit.h:69
void SetPID(int pid)
Definition: MHit.h:106
void SetMom(G4ThreeVector pxyz)
Definition: MHit.h:84
vector< int > GetmPIDs()
Definition: MHit.h:123
double GetE()
Definition: MHit.h:89
void SetDx(double Dx)
Definition: MHit.h:78
vector< G4ThreeVector > GetPos()
Definition: MHit.h:65
vector< G4ThreeVector > GetmVerts()
Definition: MHit.h:128
void SetmPID(int mpid)
Definition: MHit.h:120
void SetE(double ene)
Definition: MHit.h:88
G4ThreeVector GetMom()
Definition: MHit.h:85
void SetId(vector< identifier > iden)
Definition: MHit.h:97
Definition: MHit.h:29
vector< double > GetEs()
Definition: MHit.h:90
vector< double > GetTime()
Definition: MHit.h:82
void SetCharge(int Q)
Definition: MHit.h:110
void SetmVert(G4ThreeVector ver)
Definition: MHit.h:125
const MHit & operator=(const MHit &)
Definition: MHit.h:35
vector< int > GetTIds()
Definition: MHit.h:94
vector< int > GetPIDs()
Definition: MHit.h:108
void SetThreshold(double E)
Definition: MHit.h:103
void SetLPos(G4ThreeVector xyz)
Definition: MHit.h:68
G4ThreeVector GetLastPos()
Definition: MHit.h:66
void SetTime(double ctime)
Definition: MHit.h:81
vector< double > GetEdep()
Definition: MHit.h:76
void SetmVerts(vector< G4ThreeVector > ver)
Definition: MHit.h:126
int GetTId()
Definition: MHit.h:93
vector< G4ThreeVector > GetVerts()
Definition: MHit.h:73
detector GetDetector()
Definition: MHit.h:101
void SetVert(G4ThreeVector ver)
Definition: MHit.h:71
int GetCharge()
Definition: MHit.h:111
vector< int > GetCharges()
Definition: MHit.h:112
vector< double > GetDx()
Definition: MHit.h:79
int GetmTrackId()
Definition: MHit.h:117
void SetmTrackId(int tid)
Definition: MHit.h:115