Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
F04TrajectoryPoint.cc
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 //
28 //
29 //
30 #include "F04TrajectoryPoint.hh"
31 
32 #include "G4Step.hh"
33 #include "G4Track.hh"
34 #include "G4VProcess.hh"
35 #include "G4StepStatus.hh"
36 
37 #include "G4AttDef.hh"
38 #include "G4AttValue.hh"
39 #include "G4AttDefStore.hh"
40 
41 #include "G4UnitsTable.hh"
42 
43 //#define G4ATTDEBUG
44 #ifdef G4ATTDEBUG
45 #include "G4AttCheck.hh"
46 #endif
47 
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51 
53  : fTime(0.), fMomentum(0.,0.,0.),
54  fStepStatus(fUndefined), fVolumeName("") {}
55 
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57 
59  : G4TrajectoryPoint(aStep->GetPostStepPoint()->GetPosition())
60 {
61  fTime = aStep->GetPostStepPoint()->GetGlobalTime();
62  fMomentum = aStep->GetPostStepPoint()->GetMomentum();
63  fStepStatus = aStep->GetPostStepPoint()->GetStepStatus();
64  if (aStep->GetPostStepPoint()->GetPhysicalVolume())
65  {
66  fVolumeName = aStep->GetPostStepPoint()->
67  GetPhysicalVolume()->GetName();
68  } else {
69  fVolumeName = " ";
70  }
71 }
72 
73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
74 
76  : G4TrajectoryPoint(aTrack->GetPosition())
77 {
78  fTime = aTrack->GetGlobalTime();
79  fMomentum = aTrack->GetMomentum();
80  fStepStatus = fUndefined;
81  fVolumeName = aTrack->GetVolume()->GetName();
82 }
83 
84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85 
87  : G4TrajectoryPoint(right)
88 {
89  fTime = right.fTime;
90  fMomentum = right.fMomentum;
91  fStepStatus = right.fStepStatus;
92  fVolumeName = right.fVolumeName;
93 }
94 
95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
96 
98 
99 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
100 
101 const std::map<G4String,G4AttDef>* F04TrajectoryPoint::GetAttDefs() const
102 {
103  G4bool isNew;
104  std::map<G4String,G4AttDef>* store
105  = G4AttDefStore::GetInstance("TrajectoryPoint",isNew);
106  if (isNew) {
107  G4String Pos("Pos");
108  (*store)[Pos] =
109  G4AttDef(Pos, "Position", "Physics","G4BestUnit","G4ThreeVector");
110 
111  G4String Time("Time");
112  (*store)[Time] =
113  G4AttDef(Time, "Time", "Physics","G4BestUnit","G4double");
114 
115  G4String Momentum("Momentum");
116  (*store)[Momentum] =
117  G4AttDef(Momentum, "Momentum", "Physics","G4BestUnit","G4ThreeVector");
118 
119  G4String StepStatus("StepStatus");
120  (*store)[StepStatus] =
121  G4AttDef(StepStatus, "StepStatus", "Physics", "", "G4StepStatus");
122 
123  G4String VolumeName("VolumeName");
124  (*store)[VolumeName] =
125  G4AttDef(VolumeName, "VolumeName", "Physics", "", "G4String");
126 
127  }
128  return store;
129 }
130 
131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
132 
133 std::vector<G4AttValue>* F04TrajectoryPoint::CreateAttValues() const
134 {
135  std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
136 
137  values->push_back(G4AttValue("Time",G4BestUnit(fTime,"Time"),""));
138 
139  values->push_back(G4AttValue("Momentum",G4BestUnit(fMomentum,"Momentum"),""));
140 
141  values->push_back(G4AttValue("StepStatus",fStepStatus,""));
142 
143  values->push_back(G4AttValue("VolumeName",fVolumeName,""));
144 
145 #ifdef G4ATTDEBUG
146  G4cout << G4AttCheck(values,GetAttDefs());
147 #endif
148 
149  return values;
150 }