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 | // $Id: A01Trajectory.hh,v 1.6 2006/06/29 16:31:41 gunter Exp $ |
---|
27 | // -------------------------------------------------------------- |
---|
28 | // |
---|
29 | |
---|
30 | class A01Trajectory; |
---|
31 | |
---|
32 | #ifndef A01Trajectory_h |
---|
33 | #define A01Trajectory_h 1 |
---|
34 | |
---|
35 | #include "G4VTrajectory.hh" |
---|
36 | #include "G4Allocator.hh" |
---|
37 | #include <stdlib.h> // Include from 'system' |
---|
38 | #include "G4ios.hh" // Include from 'system' |
---|
39 | #include <vector> // |
---|
40 | #include <iostream> // |
---|
41 | #include "globals.hh" // Include from 'global' |
---|
42 | #include "G4ParticleDefinition.hh" // Include from 'particle+matter' |
---|
43 | #include "G4TrajectoryPoint.hh" // Include from 'tracking' |
---|
44 | #include "G4Track.hh" |
---|
45 | #include "G4Step.hh" |
---|
46 | |
---|
47 | typedef std::vector<G4VTrajectoryPoint*> A01TrajectoryPointContainer; |
---|
48 | |
---|
49 | class G4Polyline; // Forward declaration. |
---|
50 | |
---|
51 | /////////////////// |
---|
52 | class A01Trajectory : public G4VTrajectory |
---|
53 | /////////////////// |
---|
54 | { |
---|
55 | |
---|
56 | //-------- |
---|
57 | public: |
---|
58 | //-------- |
---|
59 | |
---|
60 | // Constructor/Destrcutor |
---|
61 | |
---|
62 | A01Trajectory(); |
---|
63 | |
---|
64 | A01Trajectory(const G4Track* aTrack); |
---|
65 | A01Trajectory(A01Trajectory &); |
---|
66 | virtual ~A01Trajectory(); |
---|
67 | |
---|
68 | // Operators |
---|
69 | inline void* operator new(size_t); |
---|
70 | inline void operator delete(void*); |
---|
71 | inline int operator == (const A01Trajectory& right) const |
---|
72 | {return (this==&right);} |
---|
73 | |
---|
74 | // Get/Set functions |
---|
75 | inline G4int GetTrackID() const |
---|
76 | { return fTrackID; } |
---|
77 | inline G4int GetParentID() const |
---|
78 | { return fParentID; } |
---|
79 | inline G4String GetParticleName() const |
---|
80 | { return ParticleName; } |
---|
81 | inline G4double GetCharge() const |
---|
82 | { return PDGCharge; } |
---|
83 | inline G4int GetPDGEncoding() const |
---|
84 | { return PDGEncoding; } |
---|
85 | inline G4ThreeVector GetInitialMomentum() const |
---|
86 | { return InitialMomentum; } |
---|
87 | |
---|
88 | // Other member functions |
---|
89 | virtual void ShowTrajectory() const; |
---|
90 | virtual void ShowTrajectory(std::ostream& o) const; |
---|
91 | virtual void DrawTrajectory(G4int i_mode=0) const; |
---|
92 | virtual void AppendStep(const G4Step* aStep); |
---|
93 | virtual void MergeTrajectory(G4VTrajectory* secondTrajectory); |
---|
94 | |
---|
95 | G4ParticleDefinition* GetParticleDefinition(); |
---|
96 | |
---|
97 | //--------- |
---|
98 | private: |
---|
99 | //--------- |
---|
100 | |
---|
101 | A01TrajectoryPointContainer* positionRecord; |
---|
102 | G4int fTrackID; |
---|
103 | G4int fParentID; |
---|
104 | G4ParticleDefinition* fpParticleDefinition; |
---|
105 | G4String ParticleName; |
---|
106 | G4double PDGCharge; |
---|
107 | G4int PDGEncoding; |
---|
108 | // FIXME not initialized !!! |
---|
109 | G4ThreeVector InitialMomentum; |
---|
110 | |
---|
111 | //--------- |
---|
112 | public: |
---|
113 | //--------- |
---|
114 | virtual int GetPointEntries() const |
---|
115 | { return positionRecord->size(); } |
---|
116 | virtual G4VTrajectoryPoint* GetPoint(G4int i) const |
---|
117 | { return (*positionRecord)[i]; } |
---|
118 | }; |
---|
119 | |
---|
120 | extern G4Allocator<A01Trajectory> myTrajectoryAllocator; |
---|
121 | |
---|
122 | inline void* A01Trajectory::operator new(size_t) |
---|
123 | { |
---|
124 | void* aTrajectory; |
---|
125 | aTrajectory = (void*)myTrajectoryAllocator.MallocSingle(); |
---|
126 | return aTrajectory; |
---|
127 | } |
---|
128 | |
---|
129 | inline void A01Trajectory::operator delete(void* aTrajectory) |
---|
130 | { |
---|
131 | myTrajectoryAllocator.FreeSingle((A01Trajectory*)aTrajectory); |
---|
132 | } |
---|
133 | |
---|
134 | #endif |
---|