SLIC  6.1.1
Simulation for the Linear Collider (SLIC) - Geant4 simulation application
TrackSummary.hh
Go to the documentation of this file.
1 #ifndef SLIC_TRACKSUMMARY_HH_
2 #define SLIC_TRACKSUMMARY_HH_ 1
3 
4 // LCIO
5 #include "lcio.h"
6 #include "IMPL/MCParticleImpl.h"
7 
8 // Geant4
9 #include "globals.hh"
10 #include "G4ThreeVector.hh"
11 #include "G4Allocator.hh"
12 
13 // STL
14 #include <vector>
15 #include <bitset>
16 
17 using IMPL::MCParticleImpl;
18 
19 class G4Track;
20 
21 namespace slic {
22 
23 class TrackSummary;
24 class TrackManager;
25 
26 typedef std::vector<TrackSummary*> TrackSummaryVector;
27 typedef std::map<G4int, TrackSummary*> TrackSummaryMap;
28 
33 class TrackSummary {
34 
35  public:
36 
40  TrackSummary(const G4Track* track, G4bool toBeSaved, G4bool backScattering = false);
41 
45  virtual ~TrackSummary() {
46  }
47 
51  inline void *operator new(size_t);
52 
56  inline void operator delete(void *);
57 
62  void update(const G4Track* track);
63 
68  G4double getCharge() const {
69  return _charge;
70  }
71 
76  G4ThreeVector getEndPoint() const {
77  return _endPoint;
78  }
79 
84  G4double getEnergy() const {
85  return sqrt(_momentum[0] * _momentum[0] + _momentum[1] * _momentum[1] + _momentum[2] * _momentum[2] + _mass * _mass);
86  }
87 
92  G4double getMass() const {
93  return _mass;
94  }
95 
101  G4int getHepEvtStatus() const {
102  return _hepEvtStatus;
103  }
104 
109  G4int getSimulatorStatus() const {
110  return _simstatus.to_ulong();
111  }
112 
117  G4ThreeVector getMomentum() const {
118  return _momentum;
119  }
120 
126  return _parent;
127  }
128 
133  G4int getPDG() const {
134  return _PDG;
135  }
136 
141  const G4ThreeVector& getVertex() const {
142  return _vertex;
143  }
144 
149  G4int getTrackID() const {
150  return _trackID;
151  }
152 
157  G4int getParentID() const {
158  return _parentTrackID;
159  }
160 
165  G4double getTrackLength() const {
166  return _trackLength;
167  }
168 
173  G4bool getToBeSaved() const {
174  return _toBeSaved;
175  }
176 
180  void setToBeSaved() {
181  _toBeSaved = true;
182  }
183 
188  G4bool getBackScattering() const {
189  return _backScattering;
190  }
191 
196  _backScattering = true;
197  }
198 
202  void setParentToBeSaved();
203 
208  MCParticleImpl* getMCParticle() {
209  return _mcparticle;
210  }
211 
216  void setMCParticle(MCParticleImpl* mcp) {
217  _mcparticle = mcp;
218  }
219 
224  _hasTrackerHit = true;
225  }
226 
230  void buildMCParticle();
231 
236  TrackSummary* findParent() const;
237 
238  private:
239 
240 // Member data
241 
242  G4double _charge;
243  G4ThreeVector _endPoint;
244  G4double _energy;
245  G4double _mass;
247  std::bitset<32> _simstatus;
248  G4ThreeVector _momentum;
249  G4ThreeVector _momentumAtEndpoint;
251  G4int _PDG;
252  G4ThreeVector _vertex;
253  G4double _globalTime;
254 
255  G4bool _toBeSaved;
256 
258  G4int _trackID;
260  G4double _trackLength;
261 
262  MCParticleImpl* _mcparticle;
264 
266 
268 };
269 
270 extern G4Allocator<TrackSummary> TrackSummaryAllocator;
271 
272 inline void* TrackSummary::operator new(size_t) {
273  void *aTrackSummary;
274  aTrackSummary = (void*) TrackSummaryAllocator.MallocSingle();
275  return aTrackSummary;
276 }
277 
278 inline void TrackSummary::operator delete(void* aTrackSummary) {
279  TrackSummaryAllocator.FreeSingle((TrackSummary*) aTrackSummary);
280 }
281 
282 }
283 
284 #endif
Manages access to stored track information used for MCParticle output.
Definition: TrackManager.hh:23
Container for all information from G4Track that may be persisted to MCParticle output collection.
Definition: TrackSummary.hh:33
virtual ~TrackSummary()
Definition: TrackSummary.hh:45
G4int getPDG() const
G4double getCharge() const
Definition: TrackSummary.hh:68
G4int getSimulatorStatus() const
void update(const G4Track *track)
Definition: TrackSummary.cc:44
MCParticleImpl * getMCParticle()
TrackSummary(const G4Track *track, G4bool toBeSaved, G4bool backScattering=false)
Definition: TrackSummary.cc:25
void setMCParticle(MCParticleImpl *mcp)
G4bool _mcParticleIsUpToDate
G4ThreeVector getEndPoint() const
Definition: TrackSummary.hh:76
G4double getMass() const
Definition: TrackSummary.hh:92
G4ThreeVector _momentumAtEndpoint
G4int getParentID() const
G4double getEnergy() const
Definition: TrackSummary.hh:84
std::bitset< 32 > _simstatus
G4ThreeVector _momentum
G4bool getToBeSaved() const
const G4ThreeVector & getVertex() const
G4ThreeVector getMomentum() const
TrackSummary * getParent() const
G4ThreeVector _endPoint
static TrackManager * m_trackManager
TrackSummary * findParent() const
MCParticleImpl * _mcparticle
G4bool getBackScattering() const
G4int getTrackID() const
TrackSummary * _parent
G4double getTrackLength() const
G4int getHepEvtStatus() const
G4ThreeVector _vertex
std::vector< TrackSummary * > TrackSummaryVector
Definition: TrackSummary.hh:24
G4Allocator< TrackSummary > TrackSummaryAllocator
Definition: TrackSummary.cc:21
std::map< G4int, TrackSummary * > TrackSummaryMap
Definition: TrackSummary.hh:27