Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RE04Trajectory.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 /// \file runAndEvent/RE04/include/RE04Trajectory.hh
27 /// \brief Definition of the RE04Trajectory class
28 //
29 // $Id: $
30 //
31 #ifndef RE04Trajectory_h
32 #define RE04Trajectory_h 1
33 
34 #include "G4VTrajectory.hh"
35 #include "G4Allocator.hh"
36 #include <stdlib.h> // Include from 'system'
37 #include "G4ios.hh" // Include from 'system'
38 #include <vector> // G4RWTValOrderedVector
39 #include "globals.hh" // Include from 'global'
40 #include "G4ParticleDefinition.hh" // Include from 'particle+matter'
41 #include "RE04TrajectoryPoint.hh" // Include from 'tracking'
42 #include "G4Track.hh"
43 #include "G4Step.hh"
44 
45 class G4Polyline; // Forward declaration.
46 
47 typedef std::vector<G4VTrajectoryPoint*> TrajectoryPointContainer;
48 
49 //
50 /// User trajectory class
51 ///
52 /// - new, delete and "==" operators are overwritten
53 ///
54 /// - get functions
55 /// G4int GetTrackID() const, G4int GetParentID() const,
56 /// G4String GetParticleName() const, G4double GetCharge() const,
57 /// G4int GetPDGEncoding() const, G4double GetInitialKineticEnergy() const
58 /// and G4ThreeVector GetInitialMomentum() const
59 ///
60 /// - void ShowTrajectory(std::ostream& os=G4cout) const
61 /// invokes the default implementation
62 ///
63 /// - void DrawTrajectory() const
64 /// invokes the default implementation
65 ///
66 /// - void AppendStep(const G4Step* aStep)
67 /// adds a user trajectory point object, RE04TrajectoryPoint
68 ///
69 /// - int GetPointEntries() const
70 /// returns the number of point entries
71 ///
72 /// - G4VTrajectoryPoint* GetPoint(G4int i) const
73 /// gets the i-th trajectory point
74 ///
75 /// - void MergeTrajectory(G4VTrajectory* secondTrajectory)
76 /// adds a trajectory to a TrajectoryPointContainer, fPositionRecord
77 ///
78 /// - G4ParticleDefinition* GetParticleDefinition()
79 /// get a particle definition from G4ParticleTable
80 ///
81 /// - const std::map<G4String,G4AttDef>* GetAttDefs() const
82 /// defines the track ID, the parent ID, the particle name, the charge,
83 /// the PDG encoding, the initial kinetic energy, the initial momentum,
84 /// the initial momentum magnitude and the number of points as attiributes
85 ///
86 /// - std::vector<G4AttValue>* CreateAttValues() const
87 /// sets and returns the attributes
88 //
89 ///////////////////
91 ///////////////////
92 {
93 
94 //--------
95 public:
96 //--------
97 
98 // Constructor/Destrcutor
99 
100  RE04Trajectory();
101 
102  RE04Trajectory(const G4Track* aTrack);
104  virtual ~RE04Trajectory();
105 
106 // Operators
107  inline void* operator new(size_t);
108  inline void operator delete(void*);
109  inline int operator == (const RE04Trajectory& right) const
110  {return (this==&right);}
111 
112 // Get/Set functions
113  inline virtual G4int GetTrackID() const
114  { return fTrackID; }
115  inline virtual G4int GetParentID() const
116  { return fParentID; }
117  inline virtual G4String GetParticleName() const
118  { return fParticleName; }
119  inline virtual G4double GetCharge() const
120  { return fPDGCharge; }
121  inline virtual G4int GetPDGEncoding() const
122  { return fPDGEncoding; }
123  inline virtual G4double GetInitialKineticEnergy() const
124  { return fInitialKineticEnergy; }
125  inline virtual G4ThreeVector GetInitialMomentum() const
126  { return fInitialMomentum; }
127 
128 // Other member functions
129  virtual void ShowTrajectory(std::ostream& os=G4cout) const;
130  //virtual void DrawTrajectory() const;
131  virtual void DrawTrajectory() const;
132  virtual void AppendStep(const G4Step* aStep);
133  virtual int GetPointEntries() const { return fPositionRecord->size(); }
134  virtual G4VTrajectoryPoint* GetPoint(G4int i) const
135  { return (*fPositionRecord)[i]; }
136  virtual void MergeTrajectory(G4VTrajectory* secondTrajectory);
137 
139 
140  virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
141  virtual std::vector<G4AttValue>* CreateAttValues() const;
142 
143 //---------
144  private:
145 //---------
146 
147  TrajectoryPointContainer* fPositionRecord;
148  G4int fTrackID;
149  G4int fParentID;
150  G4int fPDGEncoding;
151  G4double fPDGCharge;
152  G4String fParticleName;
153  G4double fInitialKineticEnergy;
154  G4ThreeVector fInitialMomentum;
155 
156 };
157 
159 
160 inline void* RE04Trajectory::operator new(size_t)
161 {
163  return (void*)faTrajAllocator->MallocSingle();
164 }
165 
166 inline void RE04Trajectory::operator delete(void* aTrajectory)
167 {
168  faTrajAllocator->FreeSingle((RE04Trajectory*)aTrajectory);
169 }
170 
171 #endif
172 
virtual ~RE04Trajectory()
virtual G4VTrajectoryPoint * GetPoint(G4int i) const
std::vector< G4VTrajectoryPoint * > TrajectoryPointContainer
virtual G4double GetCharge() const
std::vector< G4VTrajectoryPoint * > TrajectoryPointContainer
virtual G4ThreeVector GetInitialMomentum() const
Definition of the RE04TrajectoryPoint class.
#define G4ThreadLocal
Definition: tls.hh:52
int G4int
Definition: G4Types.hh:78
virtual void ShowTrajectory(std::ostream &os=G4cout) const
virtual G4String GetParticleName() const
G4GLOB_DLL std::ostream G4cout
G4ParticleDefinition * GetParticleDefinition()
virtual void DrawTrajectory() const
Definition: G4Step.hh:76
virtual int GetPointEntries() const
virtual G4double GetInitialKineticEnergy() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
G4ThreadLocal G4Allocator< RE04Trajectory > * faTrajAllocator
virtual void MergeTrajectory(G4VTrajectory *secondTrajectory)
virtual void AppendStep(const G4Step *aStep)
double G4double
Definition: G4Types.hh:76
virtual G4int GetParentID() const
int operator==(const RE04Trajectory &right) const
virtual std::vector< G4AttValue > * CreateAttValues() const
virtual G4int GetTrackID() const
virtual G4int GetPDGEncoding() const