Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
F04Trajectory.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 // $Id: F04Trajectory.cc 90239 2015-05-21 09:07:05Z gcosmo $
27 //
30 //
31 
32 #include "G4AttDef.hh"
33 #include "G4AttValue.hh"
34 #include "G4AttDefStore.hh"
35 
36 #include "G4UIcommand.hh"
37 #include "G4UnitsTable.hh"
38 
39 #include "F04Trajectory.hh"
40 #include "F04TrajectoryPoint.hh"
41 #include "G4ParticleTable.hh"
42 
43 //#define G4ATTDEBUG
44 #ifdef G4ATTDEBUG
45 #include "G4AttCheck.hh"
46 #endif
47 
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51 
53  : fpPointsContainer(0), fTrackID(0), fParentID(0),
54  fPDGCharge(0.0), fPDGEncoding(0), fParticleName(""),
55  fInitialMomentum(G4ThreeVector()) {;}
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 
60 {
61  G4ParticleDefinition * particleDefinition = aTrack->GetDefinition();
62  fParticleName = particleDefinition->GetParticleName();
63  fPDGCharge = particleDefinition->GetPDGCharge();
64  fPDGEncoding = particleDefinition->GetPDGEncoding();
65  fTrackID = aTrack->GetTrackID();
66  fParentID = aTrack->GetParentID();
67  fInitialMomentum = aTrack->GetMomentum();
69  // Following is for the first trajectory point
70  fpPointsContainer->push_back(new F04TrajectoryPoint(aTrack));
71 }
72 
73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
74 
76 {
78  fPDGCharge = right.fPDGCharge;
79  fPDGEncoding = right.fPDGEncoding;
80  fTrackID = right.fTrackID;
81  fParentID = right.fParentID;
84 
85  for(size_t i=0;i<right.fpPointsContainer->size();++i) {
86  F04TrajectoryPoint* rightPoint
87  = (F04TrajectoryPoint*)((*(right.fpPointsContainer))[i]);
88  fpPointsContainer->push_back(new F04TrajectoryPoint(*rightPoint));
89  }
90 }
91 
92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
93 
95 {
96  for(size_t i=0;i<fpPointsContainer->size();++i){
97  delete (*fpPointsContainer)[i];
98  }
99  fpPointsContainer->clear();
100 
101  delete fpPointsContainer;
102 }
103 
104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
105 
106 void F04Trajectory::ShowTrajectory(std::ostream& os) const
107 {
108  // Invoke the default implementation in G4VTrajectory...
110  // ... or override with your own code here.
111 }
112 
113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
114 
116 {
117  fpPointsContainer->push_back(new F04TrajectoryPoint(aStep));
118 }
119 
120 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
121 
123 {
124  return (G4ParticleTable::GetParticleTable()->FindParticle(fParticleName));
125 }
126 
127 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
128 
130 {
131  if(!secondTrajectory) return;
132 
133  F04Trajectory* second = (F04Trajectory*)secondTrajectory;
134  G4int ent = second->GetPointEntries();
135  // initial point of the second trajectory should not be merged
136  for(G4int i=1; i<ent; ++i) {
137  fpPointsContainer->push_back((*(second->fpPointsContainer))[i]);
138  }
139  delete (*second->fpPointsContainer)[0];
140  second->fpPointsContainer->clear();
141 }
142 
143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
144 
145 const std::map<G4String,G4AttDef>* F04Trajectory::GetAttDefs() const
146 {
147  G4bool isNew;
148  std::map<G4String,G4AttDef>* store
149  = G4AttDefStore::GetInstance("Trajectory",isNew);
150 
151  if (isNew) {
152 
153  G4String ID("ID");
154  (*store)[ID] = G4AttDef(ID,"Track ID","Bookkeeping","","G4int");
155 
156  G4String PID("PID");
157  (*store)[PID] = G4AttDef(PID,"Parent ID","Bookkeeping","","G4int");
158 
159  G4String PN("PN");
160  (*store)[PN] = G4AttDef(PN,"Particle Name","Physics","","G4String");
161 
162  G4String Ch("Ch");
163  (*store)[Ch] = G4AttDef(Ch,"Charge","Physics","e+","G4double");
164 
165  G4String PDG("PDG");
166  (*store)[PDG] = G4AttDef(PDG,"PDG Encoding","Physics","","G4int");
167 
168  G4String IMom("IMom");
169  (*store)[IMom] = G4AttDef(IMom,
170  "Momentum of track at start of trajectory",
171  "Physics","G4BestUnit","G4ThreeVector");
172 
173  G4String IMag("IMag");
174  (*store)[IMag] = G4AttDef(IMag,
175  "Magnitude of momentum of track at start of trajectory",
176  "Physics","G4BestUnit","G4double");
177 
178  G4String NTP("NTP");
179  (*store)[NTP] = G4AttDef(NTP,"No. of points","Bookkeeping","","G4int");
180 
181  }
182  return store;
183 }
184 
185 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
186 
187 std::vector<G4AttValue>* F04Trajectory::CreateAttValues() const
188 {
189  std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
190 
191  values->push_back
193 
194  values->push_back
196 
197  values->push_back(G4AttValue("PN",fParticleName,""));
198 
199  values->push_back
201 
202  values->push_back
204 
205  values->push_back
206  (G4AttValue("IMom",G4BestUnit(fInitialMomentum,"Energy"),""));
207 
208  values->push_back
209  (G4AttValue("IMag",G4BestUnit(fInitialMomentum.mag(),"Energy"),""));
210 
211  values->push_back
213 
214 #ifdef G4ATTDEBUG
215  G4cout << G4AttCheck(values,GetAttDefs());
216 #endif
217  return values;
218 }
Definition of the F04Trajectory class.
static G4ParticleTable * GetParticleTable()
virtual ~F04Trajectory()
virtual void MergeTrajectory(G4VTrajectory *secondTrajectory)
const G4String & GetParticleName() const
virtual std::vector< G4AttValue > * CreateAttValues() const
G4int GetTrackID() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual void ShowTrajectory(std::ostream &os=G4cout) const
G4double GetPDGCharge() const
static constexpr double second
Definition: G4SIunits.hh:157
#define G4ThreadLocal
Definition: tls.hh:69
G4ParticleDefinition * GetDefinition() const
virtual void ShowTrajectory(std::ostream &os=G4cout) const
virtual int GetPointEntries() const
G4ThreeVector GetMomentum() const
bool G4bool
Definition: G4Types.hh:79
G4ThreadLocal G4Allocator< F04Trajectory > * F04TrajectoryAllocator
virtual void AppendStep(const G4Step *aStep)
Definition: G4Step.hh:76
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4String fParticleName
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
G4ThreeVector fInitialMomentum
Definition of the F04TrajectoryPoint class.
G4double fPDGCharge
TrajectoryPointContainer * fpPointsContainer
G4GLOB_DLL std::ostream G4cout
std::vector< G4VTrajectoryPoint * > TrajectoryPointContainer
G4int GetParentID() const
G4ParticleDefinition * GetParticleDefinition()