Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4SmoothTrajectory.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// G4SmoothTrajectory
27//
28// Class description:
29//
30// This class represents the trajectory of a particle tracked.
31// It includes information of
32// 1) List of trajectory points which compose the trajectory,
33// 2) static information of particle which generates the
34// trajectory,
35// 3) trackID and parent particle ID of the trajectory,
36// 4) Auxiliary points will be associated to G4SmoothTrajectoryPoint
37// to assist drawing smoothly curved trajectory.
38
39// Contact:
40// Questions and comments to this code should be sent to
41// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
42// Makoto Asai (e-mail: asai@slac.stanford.edu)
43// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
44// --------------------------------------------------------------------
45#ifndef G4SmoothTrajectory_hh
46#define G4SmoothTrajectory_hh 1
47
48#include <stdlib.h> // Include from 'system'
49#include <vector>
50
51#include "trkgdefs.hh"
52#include "G4VTrajectory.hh"
53#include "G4Allocator.hh"
54#include "G4ios.hh" // Include from 'system'
55#include "globals.hh" // Include from 'global'
56#include "G4ParticleDefinition.hh" // Include from 'particle+matter'
57#include "G4SmoothTrajectoryPoint.hh" // Include from 'tracking'
58#include "G4Track.hh"
59#include "G4Step.hh"
60
61class G4Polyline;
62
64{
65 using G4TrajectoryPointContainer = std::vector<G4VTrajectoryPoint*>;
66
67 public:
68
69 // Constructors/Destructor
70 //
72 G4SmoothTrajectory(const G4Track* aTrack);
74 virtual ~G4SmoothTrajectory();
75
76 // Operators
77 //
79 inline G4int operator == (const G4SmoothTrajectory& r) const;
80 inline void* operator new(size_t);
81 inline void operator delete(void*);
82
83 // Get/Set functions
84 //
85 inline G4int GetTrackID() const
86 { return fTrackID; }
87 inline G4int GetParentID() const
88 { return fParentID; }
90 { return ParticleName; }
91 inline G4double GetCharge() const
92 { return PDGCharge; }
93 inline G4int GetPDGEncoding() const
94 { return PDGEncoding; }
96 { return initialKineticEnergy; }
98 { return initialMomentum; }
99
100 // Other member functions
101 //
102 virtual void ShowTrajectory(std::ostream& os=G4cout) const;
103 virtual void DrawTrajectory() const;
104 virtual void AppendStep(const G4Step* aStep);
105 virtual G4int GetPointEntries() const
106 { return (G4int)positionRecord->size(); }
108 { return (*positionRecord)[i]; }
109 virtual void MergeTrajectory(G4VTrajectory* secondTrajectory);
110
112
113 // Get method for HEPRep style attributes
114 //
115 virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
116 virtual std::vector<G4AttValue>* CreateAttValues() const;
117
118 private:
119
120 G4TrajectoryPointContainer* positionRecord = nullptr;
121 G4int fTrackID = 0;
122 G4int fParentID = 0;
123 G4int PDGEncoding = 0;
124 G4double PDGCharge = 0.0;
125 G4String ParticleName = "";
126 G4double initialKineticEnergy = 0.0;
127 G4ThreeVector initialMomentum;
128};
129
130extern G4TRACKING_DLL
132
133inline void* G4SmoothTrajectory::operator new(size_t)
134{
135 if (aSmoothTrajectoryAllocator() == nullptr)
136 {
138 }
139 return (void*)aSmoothTrajectoryAllocator()->MallocSingle();
140}
141
142inline void G4SmoothTrajectory::operator delete(void* aTrajectory)
143{
144 aSmoothTrajectoryAllocator()->FreeSingle((G4SmoothTrajectory*)aTrajectory);
145}
146
148{
149 return (this==&r);
150}
151
152#endif
G4TRACKING_DLL G4Allocator< G4SmoothTrajectory > *& aSmoothTrajectoryAllocator()
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
G4GLOB_DLL std::ostream G4cout
G4int GetPDGEncoding() const
virtual void DrawTrajectory() const
virtual G4int GetPointEntries() const
G4String GetParticleName() const
G4int operator==(const G4SmoothTrajectory &r) const
G4int GetParentID() const
G4ThreeVector GetInitialMomentum() const
G4int GetTrackID() const
virtual G4VTrajectoryPoint * GetPoint(G4int i) const
G4double GetInitialKineticEnergy() const
virtual void AppendStep(const G4Step *aStep)
G4ParticleDefinition * GetParticleDefinition()
virtual void MergeTrajectory(G4VTrajectory *secondTrajectory)
G4SmoothTrajectory & operator=(const G4SmoothTrajectory &)=delete
virtual std::vector< G4AttValue > * CreateAttValues() const
G4double GetCharge() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual void ShowTrajectory(std::ostream &os=G4cout) const
Definition: G4Step.hh:62
#define G4TRACKING_DLL
Definition: trkgdefs.hh:45