SToGS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
SToGS_G4_TrackerHit.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 
27 #ifndef SToGS_TrackerHit_h
28 #define SToGS_TrackerHit_h 1
29 
30 #include "G4VHit.hh"
31 #include "G4THitsCollection.hh"
32 #include "G4Allocator.hh"
33 #include "G4ThreeVector.hh"
34 #include "G4Types.hh"
35 
36 #ifndef G4MULTITHREADED
37 #define G4ThreadLocal
38 #endif
39 
41 namespace SToGS {
43 
72  class TrackerHit : public G4VHit
73  {
74  public:
75  TrackerHit();
76  virtual ~TrackerHit();
77  TrackerHit(const TrackerHit &right);
78 
79  const TrackerHit& operator=(const TrackerHit &right);
80  G4int operator==(const TrackerHit &right) const;
81 
82  inline void *operator new(size_t);
83  inline void operator delete(void *aHit);
84 
85  public:
86 // setters
87  void SetTrackID(G4int id)
88  {
89  trackID = id;
90  }
91  void SetParentID(G4int id)
92  {
93  parentID = id;
94  }
95  void SetPrimaryID(G4int id)
96  {
97  primaryID = id;
98  }
99 
100  void SetDetID (G4int id)
101  {
102  detID = id;
103  }
104  void SetMotherID(G4int id)
105  {
106  motherID = id;
107  }
108  void SetEdep(G4double de)
109  {
110  edep = de;
111  }
112  void SetToF (G4double tf)
113  {
114  ToF = tf;
115  }
116  void SetPos(G4ThreeVector xyz)
117  {
118  pos = xyz;
119  }
120  void SetProcessName(G4String name)
121  {
122  processName = name;
123  }
124  void SetParticleName(G4String name)
125  {
126  particleName = name;
127  }
128  void SetDetName(G4String name)
129  {
130  detName = name;
131  }
132  void SetMotherDetName(G4String name)
133  {
134  motherDetName = name;
135  }
136  void SetPDGcode(G4int code)
137  {
138  PDGcode = code;
139  }
140  // getters
141  G4int GetTrackID()
142  {
143  return trackID;
144  }
145  G4int GetParentID()
146  {
147  return parentID;
148  }
149  G4int GetPrimaryID()
150  {
151  return primaryID;
152  }
153  G4int GetDetID()
154  {
155  return detID;
156  }
157  G4int GetMotherID()
158  {
159  return motherID;
160  }
161  G4double GetEdep()
162  {
163  return edep;
164  }
165  G4double GetToF()
166  {
167  return ToF;
168  }
169  G4int GetPDGcode()
170  {
171  return PDGcode;
172  }
173  G4ThreeVector &GetPos()
174  {
175  return pos;
176  }
177  G4String &GetProcessName()
178  {
179  return processName;
180  }
181  G4String &GetParticleName()
182  {
183  return particleName;
184  }
185  G4String &GetDetName()
186  {
187  return detName;
188  }
189  G4String &GetMotherDetName()
190  {
191  return motherDetName;
192  }
193 
194 // others
195  void Draw();
196  void Print();
197 
198  private:
199  G4int trackID; // current track ID to which this hit belongs
200  G4int parentID; // parent track ID to which this hit belongs
201  G4int primaryID; // primary track ID to which this hit belongs
202 
203  G4int detID;
204  G4int motherID;
205 
206  G4double edep;
207  G4double ToF;
208 
209  G4ThreeVector pos;
210 
211  G4String processName;
212  G4String particleName;
213  G4String detName;
214  G4String motherDetName;
215 
216 
217  G4int PDGcode; // PDGcode of particle which hit the detector
218  };
219 
220  typedef G4THitsCollection<TrackerHit> TrackerHitsCollection;
221  extern G4ThreadLocal G4Allocator<TrackerHit> *TrackerHitAllocator;
222 
223  inline void* TrackerHit::operator new(size_t)
224  {
225  if( !TrackerHitAllocator )
226  TrackerHitAllocator = new G4Allocator<TrackerHit>;
227  return TrackerHitAllocator->MallocSingle();
228  }
229 
230  inline void TrackerHit::operator delete(void *aHit)
231  {
232  TrackerHitAllocator->FreeSingle((TrackerHit*) aHit);
233  }
234 } // SToGS Namespace
235 
236 #endif
G4THitsCollection< TrackerHit > TrackerHitsCollection
void SetParticleName(G4String name)
G4int operator==(const TrackerHit &right) const
const TrackerHit & operator=(const TrackerHit &right)
G4ThreeVector & GetPos()
void SetPos(G4ThreeVector xyz)
void SetMotherID(G4int id)
void SetEdep(G4double de)
void SetMotherDetName(G4String name)
void SetPDGcode(G4int code)
G4String & GetMotherDetName()
void SetTrackID(G4int id)
void SetParentID(G4int id)
G4String & GetParticleName()
#define G4ThreadLocal
G4ThreadLocal G4Allocator< TrackerHit > * TrackerHitAllocator
void SetToF(G4double tf)
void SetDetName(G4String name)
Informations to be kept at each step if a positive energy is deposited in a sensitive detector...
void SetPrimaryID(G4int id)
void SetProcessName(G4String name)