Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4SmoothTrajectory Class Reference

#include <G4SmoothTrajectory.hh>

Inheritance diagram for G4SmoothTrajectory:
G4VTrajectory

Public Member Functions

 G4SmoothTrajectory ()
 
 G4SmoothTrajectory (const G4Track *aTrack)
 
 G4SmoothTrajectory (G4SmoothTrajectory &)
 
virtual ~G4SmoothTrajectory ()
 
voidoperator new (size_t)
 
void operator delete (void *)
 
int operator== (const G4SmoothTrajectory &right) const
 
G4int GetTrackID () const
 
G4int GetParentID () const
 
G4String GetParticleName () const
 
G4double GetCharge () const
 
G4int GetPDGEncoding () const
 
G4double GetInitialKineticEnergy () const
 
G4ThreeVector GetInitialMomentum () const
 
virtual void ShowTrajectory (std::ostream &os=G4cout) const
 
virtual void DrawTrajectory () const
 
virtual void AppendStep (const G4Step *aStep)
 
virtual int GetPointEntries () const
 
virtual G4VTrajectoryPointGetPoint (G4int i) const
 
virtual void MergeTrajectory (G4VTrajectory *secondTrajectory)
 
G4ParticleDefinitionGetParticleDefinition ()
 
virtual const std::map
< G4String, G4AttDef > * 
GetAttDefs () const
 
virtual std::vector< G4AttValue > * CreateAttValues () const
 
- Public Member Functions inherited from G4VTrajectory
 G4VTrajectory ()
 
virtual ~G4VTrajectory ()
 
G4bool operator== (const G4VTrajectory &right) const
 

Detailed Description

Definition at line 67 of file G4SmoothTrajectory.hh.

Constructor & Destructor Documentation

G4SmoothTrajectory::G4SmoothTrajectory ( )

Definition at line 58 of file G4SmoothTrajectory.cc.

59 : positionRecord(0), fTrackID(0), fParentID(0),
60  PDGEncoding( 0 ), PDGCharge(0.0), ParticleName(""),
61  initialKineticEnergy( 0. ), initialMomentum( G4ThreeVector() )
62 {;}
CLHEP::Hep3Vector G4ThreeVector
G4SmoothTrajectory::G4SmoothTrajectory ( const G4Track aTrack)

Definition at line 64 of file G4SmoothTrajectory.cc.

References G4Track::GetDefinition(), G4Track::GetKineticEnergy(), G4Track::GetMomentum(), G4Track::GetParentID(), G4ParticleDefinition::GetParticleName(), G4ParticleDefinition::GetPDGCharge(), G4ParticleDefinition::GetPDGEncoding(), G4Track::GetPosition(), and G4Track::GetTrackID().

65 {
66  G4ParticleDefinition * fpParticleDefinition = aTrack->GetDefinition();
67  ParticleName = fpParticleDefinition->GetParticleName();
68  PDGCharge = fpParticleDefinition->GetPDGCharge();
69  PDGEncoding = fpParticleDefinition->GetPDGEncoding();
70  fTrackID = aTrack->GetTrackID();
71  fParentID = aTrack->GetParentID();
72  initialKineticEnergy = aTrack->GetKineticEnergy();
73  initialMomentum = aTrack->GetMomentum();
74  positionRecord = new TrajectoryPointContainer();
75  // Following is for the first trajectory point
76  positionRecord->push_back(new G4SmoothTrajectoryPoint(aTrack->GetPosition()));
77 
78  // The first point has no auxiliary points, so set the auxiliary
79  // points vector to NULL
80  positionRecord->push_back(new G4SmoothTrajectoryPoint(aTrack->GetPosition(), 0));
81 }
G4ParticleDefinition * GetDefinition() const
G4int GetParentID() const
std::vector< G4VTrajectoryPoint * > TrajectoryPointContainer
const G4ThreeVector & GetPosition() const
const G4String & GetParticleName() const
G4double GetKineticEnergy() const
G4int GetTrackID() const
G4ThreeVector GetMomentum() const
G4double GetPDGCharge() const
G4SmoothTrajectory::G4SmoothTrajectory ( G4SmoothTrajectory right)

Definition at line 83 of file G4SmoothTrajectory.cc.

83  :G4VTrajectory()
84 {
85  ParticleName = right.ParticleName;
86  PDGCharge = right.PDGCharge;
87  PDGEncoding = right.PDGEncoding;
88  fTrackID = right.fTrackID;
89  fParentID = right.fParentID;
90  initialKineticEnergy = right.initialKineticEnergy;
91  initialMomentum = right.initialMomentum;
92  positionRecord = new TrajectoryPointContainer();
93 
94  for(size_t i=0;i<right.positionRecord->size();i++)
95  {
96  G4SmoothTrajectoryPoint* rightPoint = (G4SmoothTrajectoryPoint*)((*(right.positionRecord))[i]);
97  positionRecord->push_back(new G4SmoothTrajectoryPoint(*rightPoint));
98  }
99 }
std::vector< G4VTrajectoryPoint * > TrajectoryPointContainer
G4SmoothTrajectory::~G4SmoothTrajectory ( )
virtual

Definition at line 101 of file G4SmoothTrajectory.cc.

102 {
103  if (positionRecord)
104  {
105  size_t i;
106  for(i=0;i<positionRecord->size();i++)
107  {
108  delete (*positionRecord)[i];
109  }
110  positionRecord->clear();
111  delete positionRecord;
112  }
113 }

Member Function Documentation

void G4SmoothTrajectory::AppendStep ( const G4Step aStep)
virtual

Implements G4VTrajectory.

Definition at line 210 of file G4SmoothTrajectory.cc.

References G4Step::GetPointerToVectorOfAuxiliaryPoints(), G4StepPoint::GetPosition(), and G4Step::GetPostStepPoint().

211 {
212  positionRecord->push_back(
215 }
const G4ThreeVector & GetPosition() const
G4StepPoint * GetPostStepPoint() const
std::vector< G4ThreeVector > * GetPointerToVectorOfAuxiliaryPoints() const
Definition: G4Step.hh:240
std::vector< G4AttValue > * G4SmoothTrajectory::CreateAttValues ( ) const
virtual

Reimplemented from G4VTrajectory.

Definition at line 173 of file G4SmoothTrajectory.cc.

References G4UIcommand::ConvertToString(), G4BestUnit, G4cout, GetAttDefs(), GetPointEntries(), and CLHEP::Hep3Vector::mag().

174 {
175  std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
176 
177  values->push_back
178  (G4AttValue("ID",G4UIcommand::ConvertToString(fTrackID),""));
179 
180  values->push_back
181  (G4AttValue("PID",G4UIcommand::ConvertToString(fParentID),""));
182 
183  values->push_back(G4AttValue("PN",ParticleName,""));
184 
185  values->push_back
186  (G4AttValue("Ch",G4UIcommand::ConvertToString(PDGCharge),""));
187 
188  values->push_back
189  (G4AttValue("PDG",G4UIcommand::ConvertToString(PDGEncoding),""));
190 
191  values->push_back
192  (G4AttValue("IKE",G4BestUnit(initialKineticEnergy,"Energy"),""));
193 
194  values->push_back
195  (G4AttValue("IMom",G4BestUnit(initialMomentum,"Energy"),""));
196 
197  values->push_back
198  (G4AttValue("IMag",G4BestUnit(initialMomentum.mag(),"Energy"),""));
199 
200  values->push_back
202 
203 #ifdef G4ATTDEBUG
204  G4cout << G4AttCheck(values,GetAttDefs());
205 #endif
206 
207  return values;
208 }
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:357
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
G4GLOB_DLL std::ostream G4cout
virtual int GetPointEntries() const
double mag() const
void G4SmoothTrajectory::DrawTrajectory ( ) const
virtual

Reimplemented from G4VTrajectory.

Definition at line 122 of file G4SmoothTrajectory.cc.

References G4VTrajectory::DrawTrajectory().

123 {
124  // Invoke the default implementation in G4VTrajectory...
126  // ... or override with your own code here.
127 }
virtual void DrawTrajectory() const
const std::map< G4String, G4AttDef > * G4SmoothTrajectory::GetAttDefs ( ) const
virtual

Reimplemented from G4VTrajectory.

Definition at line 129 of file G4SmoothTrajectory.cc.

References G4AttDefStore::GetInstance().

Referenced by CreateAttValues(), G4VisCommandList::SetNewValue(), and G4VisCommandSceneAddTrajectories::SetNewValue().

130 {
131  G4bool isNew;
132  std::map<G4String,G4AttDef>* store
133  = G4AttDefStore::GetInstance("G4SmoothTrajectory",isNew);
134  if (isNew) {
135 
136  G4String ID("ID");
137  (*store)[ID] = G4AttDef(ID,"Track ID","Physics","","G4int");
138 
139  G4String PID("PID");
140  (*store)[PID] = G4AttDef(PID,"Parent ID","Physics","","G4int");
141 
142  G4String PN("PN");
143  (*store)[PN] = G4AttDef(PN,"Particle Name","Physics","","G4String");
144 
145  G4String Ch("Ch");
146  (*store)[Ch] = G4AttDef(Ch,"Charge","Physics","e+","G4double");
147 
148  G4String PDG("PDG");
149  (*store)[PDG] = G4AttDef(PDG,"PDG Encoding","Physics","","G4int");
150 
151  G4String IKE("IKE");
152  (*store)[IKE] =
153  G4AttDef(IKE, "Initial kinetic energy",
154  "Physics","G4BestUnit","G4double");
155 
156  G4String IMom("IMom");
157  (*store)[IMom] = G4AttDef(IMom, "Initial momentum",
158  "Physics","G4BestUnit","G4ThreeVector");
159 
160  G4String IMag("IMag");
161  (*store)[IMag] = G4AttDef
162  (IMag, "Initial momentum magnitude",
163  "Physics","G4BestUnit","G4double");
164 
165  G4String NTP("NTP");
166  (*store)[NTP] = G4AttDef(NTP,"No. of points","Physics","","G4int");
167 
168  }
169  return store;
170 }
bool G4bool
Definition: G4Types.hh:79
std::map< G4String, G4AttDef > * GetInstance(const G4String &storeKey, G4bool &isNew)
G4double G4SmoothTrajectory::GetCharge ( ) const
inlinevirtual

Implements G4VTrajectory.

Definition at line 99 of file G4SmoothTrajectory.hh.

100  { return PDGCharge; }
G4double G4SmoothTrajectory::GetInitialKineticEnergy ( ) const
inline

Definition at line 103 of file G4SmoothTrajectory.hh.

104  { return initialKineticEnergy; }
G4ThreeVector G4SmoothTrajectory::GetInitialMomentum ( ) const
inlinevirtual

Implements G4VTrajectory.

Definition at line 105 of file G4SmoothTrajectory.hh.

106  { return initialMomentum; }
G4int G4SmoothTrajectory::GetParentID ( ) const
inlinevirtual

Implements G4VTrajectory.

Definition at line 95 of file G4SmoothTrajectory.hh.

96  { return fParentID; }
G4ParticleDefinition * G4SmoothTrajectory::GetParticleDefinition ( void  )

Definition at line 217 of file G4SmoothTrajectory.cc.

References G4ParticleTable::GetParticleTable().

218 {
219  return (G4ParticleTable::GetParticleTable()->FindParticle(ParticleName));
220 }
static G4ParticleTable * GetParticleTable()
G4String G4SmoothTrajectory::GetParticleName ( ) const
inlinevirtual

Implements G4VTrajectory.

Definition at line 97 of file G4SmoothTrajectory.hh.

98  { return ParticleName; }
G4int G4SmoothTrajectory::GetPDGEncoding ( ) const
inlinevirtual

Implements G4VTrajectory.

Definition at line 101 of file G4SmoothTrajectory.hh.

102  { return PDGEncoding; }
virtual G4VTrajectoryPoint* G4SmoothTrajectory::GetPoint ( G4int  i) const
inlinevirtual

Implements G4VTrajectory.

Definition at line 113 of file G4SmoothTrajectory.hh.

114  { return (*positionRecord)[i]; }
virtual int G4SmoothTrajectory::GetPointEntries ( ) const
inlinevirtual

Implements G4VTrajectory.

Definition at line 112 of file G4SmoothTrajectory.hh.

Referenced by CreateAttValues(), and MergeTrajectory().

112 { return positionRecord->size(); }
G4int G4SmoothTrajectory::GetTrackID ( ) const
inlinevirtual

Implements G4VTrajectory.

Definition at line 93 of file G4SmoothTrajectory.hh.

94  { return fTrackID; }
void G4SmoothTrajectory::MergeTrajectory ( G4VTrajectory secondTrajectory)
virtual

Implements G4VTrajectory.

Definition at line 222 of file G4SmoothTrajectory.cc.

References GetPointEntries().

223 {
224  if(!secondTrajectory) return;
225 
226  G4SmoothTrajectory* seco = (G4SmoothTrajectory*)secondTrajectory;
227  G4int ent = seco->GetPointEntries();
228  for(G4int i=1;i<ent;i++) // initial point of the second trajectory should not be merged
229  {
230  positionRecord->push_back((*(seco->positionRecord))[i]);
231  }
232  delete (*seco->positionRecord)[0];
233  seco->positionRecord->clear();
234 }
int G4int
Definition: G4Types.hh:78
virtual int GetPointEntries() const
void G4SmoothTrajectory::operator delete ( void aTrajectory)
inline

Definition at line 148 of file G4SmoothTrajectory.hh.

References aSmoothTrajectoryAllocator.

149 {
150  aSmoothTrajectoryAllocator->FreeSingle((G4SmoothTrajectory*)aTrajectory);
151 }
G4TRACKING_DLL G4ThreadLocal G4Allocator< G4SmoothTrajectory > * aSmoothTrajectoryAllocator
void * G4SmoothTrajectory::operator new ( size_t  )
inline

Definition at line 141 of file G4SmoothTrajectory.hh.

References aSmoothTrajectoryAllocator.

142 {
145  return (void*)aSmoothTrajectoryAllocator->MallocSingle();
146 }
G4TRACKING_DLL G4ThreadLocal G4Allocator< G4SmoothTrajectory > * aSmoothTrajectoryAllocator
int G4SmoothTrajectory::operator== ( const G4SmoothTrajectory right) const
inline

Definition at line 89 of file G4SmoothTrajectory.hh.

90  {return (this==&right);}
void G4SmoothTrajectory::ShowTrajectory ( std::ostream &  os = G4cout) const
virtual

Reimplemented from G4VTrajectory.

Definition at line 115 of file G4SmoothTrajectory.cc.

References G4VTrajectory::ShowTrajectory().

116 {
117  // Invoke the default implementation in G4VTrajectory...
119  // ... or override with your own code here.
120 }
virtual void ShowTrajectory(std::ostream &os=G4cout) const

The documentation for this class was generated from the following files: