Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WLSTrajectoryPoint.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 //
31 
32 #include "WLSTrajectoryPoint.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 
53  : fTime(0.), fMomentum(0.,0.,0.),
54  fStepStatus(fUndefined), fVolumeName("") { }
55 
57  : G4TrajectoryPoint(aStep->GetPostStepPoint()->GetPosition())
58 {
59  fTime = aStep->GetPostStepPoint()->GetGlobalTime();
60  fMomentum = aStep->GetPostStepPoint()->GetMomentum();
61  fStepStatus = aStep->GetPostStepPoint()->GetStepStatus();
62  if (aStep->GetPostStepPoint()->GetPhysicalVolume())
63  {
64  fVolumeName = aStep->GetPostStepPoint()->
65  GetPhysicalVolume()->GetName();
66  } else {
67  fVolumeName = " ";
68  }
69 }
70 
72  : G4TrajectoryPoint(aTrack->GetPosition())
73 {
74  fTime = aTrack->GetGlobalTime();
75  fMomentum = aTrack->GetMomentum();
76  fStepStatus = fUndefined;
77  fVolumeName = aTrack->GetVolume()->GetName();
78 }
79 
81  : G4TrajectoryPoint(right)
82 {
83  fTime = right.fTime;
84  fMomentum = right.fMomentum;
85  fStepStatus = right.fStepStatus;
86  fVolumeName = right.fVolumeName;
87 }
88 
90 
91 const std::map<G4String,G4AttDef>* WLSTrajectoryPoint::GetAttDefs() const
92 {
93  G4bool isNew;
94  std::map<G4String,G4AttDef>* store
95  = G4AttDefStore::GetInstance("TrajectoryPoint",isNew);
96  if (isNew) {
97  G4String Pos("Pos");
98  (*store)[Pos] =
99  G4AttDef(Pos, "Position", "Physics","G4BestUnit","G4ThreeVector");
100 
101  G4String Time("Time");
102  (*store)[Time] =
103  G4AttDef(Time, "Time", "Physics","G4BestUnit","G4double");
104 
105  G4String Momentum("Momentum");
106  (*store)[Momentum] =
107  G4AttDef(Momentum, "Momentum", "Physics","G4BestUnit","G4ThreeVector");
108 
109  G4String StepStatus("StepStatus");
110  (*store)[StepStatus] =
111  G4AttDef(StepStatus, "StepStatus", "Physics", "", "G4StepStatus");
112 
113  G4String VolumeName("VolumeName");
114  (*store)[VolumeName] =
115  G4AttDef(VolumeName, "VolumeName", "Physics", "", "G4String");
116 
117  }
118  return store;
119 }
120 
121 std::vector<G4AttValue>* WLSTrajectoryPoint::CreateAttValues() const
122 {
123  std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
124 
125  values->push_back(G4AttValue("Time",G4BestUnit(fTime,"Time"),""));
126 
127  values->push_back(G4AttValue("Momentum",G4BestUnit(fMomentum,"Momentum"),""));
128 
129  values->push_back(G4AttValue("StepStatus",fStepStatus,""));
130 
131  values->push_back(G4AttValue("VolumeName",fVolumeName,""));
132 
133 #ifdef G4ATTDEBUG
134  G4cout << G4AttCheck(values,GetAttDefs());
135 #endif
136 
137  return values;
138 }