Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4SmoothTrajectory.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 //
27 // $Id: G4SmoothTrajectory.cc 110262 2018-05-17 14:25:55Z gcosmo $
28 //
29 //
30 // ---------------------------------------------------------------
31 //
32 // G4SmoothTrajectory.cc
33 //
34 // Contact:
35 // Questions and comments to this code should be sent to
36 // Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
37 // Makoto Asai (e-mail: asai@kekvax.kek.jp)
38 // Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
39 //
40 // ---------------------------------------------------------------
41 
42 #include "G4SmoothTrajectory.hh"
44 #include "G4ParticleTable.hh"
45 #include "G4AttDefStore.hh"
46 #include "G4AttDef.hh"
47 #include "G4AttValue.hh"
48 #include "G4UIcommand.hh"
49 #include "G4UnitsTable.hh"
50 
51 //#define G4ATTDEBUG
52 #ifdef G4ATTDEBUG
53 #include "G4AttCheck.hh"
54 #endif
55 
57 {
59  return _instance;
60 }
61 
63 : positionRecord(0), fTrackID(0), fParentID(0),
64  PDGEncoding( 0 ), PDGCharge(0.0), ParticleName(""),
65  initialKineticEnergy( 0. ), initialMomentum( G4ThreeVector() )
66 {;}
67 
69 {
70  G4ParticleDefinition * fpParticleDefinition = aTrack->GetDefinition();
71  ParticleName = fpParticleDefinition->GetParticleName();
72  PDGCharge = fpParticleDefinition->GetPDGCharge();
73  PDGEncoding = fpParticleDefinition->GetPDGEncoding();
74  fTrackID = aTrack->GetTrackID();
75  fParentID = aTrack->GetParentID();
77  initialMomentum = aTrack->GetMomentum();
79  // Following is for the first trajectory point
80  positionRecord->push_back(new G4SmoothTrajectoryPoint(aTrack->GetPosition()));
81 
82  // The first point has no auxiliary points, so set the auxiliary
83  // points vector to NULL
84  positionRecord->push_back(new G4SmoothTrajectoryPoint(aTrack->GetPosition(), 0));
85 }
86 
88 {
89  ParticleName = right.ParticleName;
90  PDGCharge = right.PDGCharge;
91  PDGEncoding = right.PDGEncoding;
92  fTrackID = right.fTrackID;
93  fParentID = right.fParentID;
97 
98  for(size_t i=0;i<right.positionRecord->size();i++)
99  {
100  G4SmoothTrajectoryPoint* rightPoint = (G4SmoothTrajectoryPoint*)((*(right.positionRecord))[i]);
101  positionRecord->push_back(new G4SmoothTrajectoryPoint(*rightPoint));
102  }
103 }
104 
106 {
107  if (positionRecord)
108  {
109  size_t i;
110  for(i=0;i<positionRecord->size();i++)
111  {
112  delete (*positionRecord)[i];
113  }
114  positionRecord->clear();
115  delete positionRecord;
116  }
117 }
118 
119 void G4SmoothTrajectory::ShowTrajectory(std::ostream& os) const
120 {
121  // Invoke the default implementation in G4VTrajectory...
123  // ... or override with your own code here.
124 }
125 
127 {
128  // Invoke the default implementation in G4VTrajectory...
130  // ... or override with your own code here.
131 }
132 
133 const std::map<G4String,G4AttDef>* G4SmoothTrajectory::GetAttDefs() const
134 {
135  G4bool isNew;
136  std::map<G4String,G4AttDef>* store
137  = G4AttDefStore::GetInstance("G4SmoothTrajectory",isNew);
138  if (isNew) {
139 
140  G4String ID("ID");
141  (*store)[ID] = G4AttDef(ID,"Track ID","Physics","","G4int");
142 
143  G4String PID("PID");
144  (*store)[PID] = G4AttDef(PID,"Parent ID","Physics","","G4int");
145 
146  G4String PN("PN");
147  (*store)[PN] = G4AttDef(PN,"Particle Name","Physics","","G4String");
148 
149  G4String Ch("Ch");
150  (*store)[Ch] = G4AttDef(Ch,"Charge","Physics","e+","G4double");
151 
152  G4String PDG("PDG");
153  (*store)[PDG] = G4AttDef(PDG,"PDG Encoding","Physics","","G4int");
154 
155  G4String IKE("IKE");
156  (*store)[IKE] =
157  G4AttDef(IKE, "Initial kinetic energy",
158  "Physics","G4BestUnit","G4double");
159 
160  G4String IMom("IMom");
161  (*store)[IMom] = G4AttDef(IMom, "Initial momentum",
162  "Physics","G4BestUnit","G4ThreeVector");
163 
164  G4String IMag("IMag");
165  (*store)[IMag] = G4AttDef
166  (IMag, "Initial momentum magnitude",
167  "Physics","G4BestUnit","G4double");
168 
169  G4String NTP("NTP");
170  (*store)[NTP] = G4AttDef(NTP,"No. of points","Physics","","G4int");
171 
172  }
173  return store;
174 }
175 
176 
177 std::vector<G4AttValue>* G4SmoothTrajectory::CreateAttValues() const
178 {
179  std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
180 
181  values->push_back
183 
184  values->push_back
186 
187  values->push_back(G4AttValue("PN",ParticleName,""));
188 
189  values->push_back
191 
192  values->push_back
194 
195  values->push_back
196  (G4AttValue("IKE",G4BestUnit(initialKineticEnergy,"Energy"),""));
197 
198  values->push_back
199  (G4AttValue("IMom",G4BestUnit(initialMomentum,"Energy"),""));
200 
201  values->push_back
202  (G4AttValue("IMag",G4BestUnit(initialMomentum.mag(),"Energy"),""));
203 
204  values->push_back
206 
207 #ifdef G4ATTDEBUG
208  G4cout << G4AttCheck(values,GetAttDefs());
209 #endif
210 
211  return values;
212 }
213 
215 {
216  positionRecord->push_back(
219 }
220 
222 {
223  return (G4ParticleTable::GetParticleTable()->FindParticle(ParticleName));
224 }
225 
227 {
228  if(!secondTrajectory) return;
229 
230  G4SmoothTrajectory* seco = (G4SmoothTrajectory*)secondTrajectory;
231  G4int ent = seco->GetPointEntries();
232  for(G4int i=1;i<ent;i++) // initial point of the second trajectory should not be merged
233  {
234  positionRecord->push_back((*(seco->positionRecord))[i]);
235  }
236  delete (*seco->positionRecord)[0];
237  seco->positionRecord->clear();
238 }
G4double GetKineticEnergy() const
static G4ParticleTable * GetParticleTable()
G4ThreeVector initialMomentum
virtual void MergeTrajectory(G4VTrajectory *secondTrajectory)
const G4String & GetParticleName() const
G4int GetTrackID() const
TrajectoryPointContainer * positionRecord
virtual void ShowTrajectory(std::ostream &os=G4cout) const
G4double GetPDGCharge() const
G4ParticleDefinition * GetDefinition() const
#define G4ThreadLocalStatic
Definition: tls.hh:68
virtual void AppendStep(const G4Step *aStep)
G4TRACKING_DLL G4Allocator< G4SmoothTrajectory > *& aSmoothTrajectoryAllocator()
G4ThreeVector GetMomentum() const
bool G4bool
Definition: G4Types.hh:79
const G4ThreeVector & GetPosition() const
virtual void ShowTrajectory(std::ostream &os=G4cout) const
virtual int GetPointEntries() const
G4ParticleDefinition * GetParticleDefinition()
const G4ThreeVector & GetPosition() const
virtual void DrawTrajectory() const
Definition: G4Step.hh:76
G4StepPoint * GetPostStepPoint() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual std::vector< G4AttValue > * CreateAttValues() const
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:374
std::map< G4String, G4AttDef > * GetInstance(const G4String &storeKey, G4bool &isNew)
double mag() const
int G4int
Definition: G4Types.hh:78
virtual void DrawTrajectory() const
G4GLOB_DLL std::ostream G4cout
std::vector< G4ThreeVector > * GetPointerToVectorOfAuxiliaryPoints() const
Definition: G4Step.hh:242
std::vector< G4VTrajectoryPoint * > TrajectoryPointContainer
G4int GetParentID() const