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