Geant4  10.02.p01
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 //
26 // $Id: F04TrajectoryPoint.cc 76690 2013-11-14 08:45:07Z gcosmo $
27 //
30 //
31 
32 #include "F04TrajectoryPoint.hh"
33 
34 #include "G4Step.hh"
35 #include "G4Track.hh"
36 #include "G4VProcess.hh"
37 #include "G4StepStatus.hh"
38 
39 #include "G4AttDef.hh"
40 #include "G4AttValue.hh"
41 #include "G4AttDefStore.hh"
42 
43 #include "G4UnitsTable.hh"
44 
45 //#define G4ATTDEBUG
46 #ifdef G4ATTDEBUG
47 #include "G4AttCheck.hh"
48 #endif
49 
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53 
55  : fTime(0.), fMomentum(0.,0.,0.),
56  fStepStatus(fUndefined), fVolumeName("") {}
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59 
61  : G4TrajectoryPoint(aStep->GetPostStepPoint()->GetPosition())
62 {
63  fTime = aStep->GetPostStepPoint()->GetGlobalTime();
66  if (aStep->GetPostStepPoint()->GetPhysicalVolume())
67  {
68  fVolumeName = aStep->GetPostStepPoint()->
69  GetPhysicalVolume()->GetName();
70  } else {
71  fVolumeName = " ";
72  }
73 }
74 
75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
76 
78  : G4TrajectoryPoint(aTrack->GetPosition())
79 {
80  fTime = aTrack->GetGlobalTime();
81  fMomentum = aTrack->GetMomentum();
83  fVolumeName = aTrack->GetVolume()->GetName();
84 }
85 
86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
87 
89  : G4TrajectoryPoint(right)
90 {
91  fTime = right.fTime;
92  fMomentum = right.fMomentum;
93  fStepStatus = right.fStepStatus;
94  fVolumeName = right.fVolumeName;
95 }
96 
97 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
98 
100 
101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
102 
103 const std::map<G4String,G4AttDef>* F04TrajectoryPoint::GetAttDefs() const
104 {
105  G4bool isNew;
106  std::map<G4String,G4AttDef>* store
107  = G4AttDefStore::GetInstance("TrajectoryPoint",isNew);
108  if (isNew) {
109  G4String Pos("Pos");
110  (*store)[Pos] =
111  G4AttDef(Pos, "Position", "Physics","G4BestUnit","G4ThreeVector");
112 
113  G4String Time("Time");
114  (*store)[Time] =
115  G4AttDef(Time, "Time", "Physics","G4BestUnit","G4double");
116 
117  G4String Momentum("Momentum");
118  (*store)[Momentum] =
119  G4AttDef(Momentum, "Momentum", "Physics","G4BestUnit","G4ThreeVector");
120 
121  G4String StepStatus("StepStatus");
122  (*store)[StepStatus] =
123  G4AttDef(StepStatus, "StepStatus", "Physics", "", "G4StepStatus");
124 
125  G4String VolumeName("VolumeName");
126  (*store)[VolumeName] =
127  G4AttDef(VolumeName, "VolumeName", "Physics", "", "G4String");
128 
129  }
130  return store;
131 }
132 
133 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
134 
135 std::vector<G4AttValue>* F04TrajectoryPoint::CreateAttValues() const
136 {
137  std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
138 
139  values->push_back(G4AttValue("Time",G4BestUnit(fTime,"Time"),""));
140 
141  values->push_back(G4AttValue("Momentum",G4BestUnit(fMomentum,"Momentum"),""));
142 
143  values->push_back(G4AttValue("StepStatus",fStepStatus,""));
144 
145  values->push_back(G4AttValue("VolumeName",fVolumeName,""));
146 
147 #ifdef G4ATTDEBUG
148  G4cout << G4AttCheck(values,GetAttDefs());
149 #endif
150 
151  return values;
152 }
G4ThreadLocal G4Allocator< F04TrajectoryPoint > * F04TrajPointAllocator
virtual std::vector< G4AttValue > * CreateAttValues() const
G4StepStatus GetStepStatus() const
G4ThreeVector GetMomentum() const
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
Definition of the F04TrajectoryPoint class.
#define G4ThreadLocal
Definition: tls.hh:89
G4GLOB_DLL std::ostream G4cout
G4VPhysicalVolume * GetPhysicalVolume() const
const G4String & GetName() const
bool G4bool
Definition: G4Types.hh:79
Definition: G4Step.hh:76
G4double GetGlobalTime() const
G4ThreeVector GetMomentum() const
G4StepPoint * GetPostStepPoint() const
G4VPhysicalVolume * GetVolume() const
G4double GetGlobalTime() const
std::map< G4String, G4AttDef > * GetInstance(const G4String &storeKey, G4bool &isNew)
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const