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

Applications | User Support | Publications | Collaboration