Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4TrackingManager.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: G4TrackingManager.cc 77241 2013-11-22 09:55:47Z gcosmo $
28 //
29 //---------------------------------------------------------------
30 //
31 // G4TrackingManager.cc
32 //
33 // Contact:
34 // Questions and comments to this code should be sent to
35 // Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
36 // Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
37 //
38 //---------------------------------------------------------------
39 
40 #include "G4TrackingManager.hh"
41 #include "G4Trajectory.hh"
42 #include "G4SmoothTrajectory.hh"
43 #include "G4RichTrajectory.hh"
44 #include "G4ios.hh"
45 class G4VSteppingVerbose;
46 
50  : fpUserTrackingAction(0), fpTrajectory(0),
51  StoreTrajectory(0), verboseLevel(0), EventIsAborted(false)
52 {
54  messenger = new G4TrackingMessenger(this);
55 }
56 
60 {
61  delete messenger;
62  delete fpSteppingManager;
64 }
65 
69 {
70 
71  // Receiving a G4Track from the EventManager, this funciton has the
72  // responsibility to trace the track till it stops.
73  fpTrack = apValueG4Track;
74  EventIsAborted = false;
75 
76  // Clear 2ndary particle vector
77  // GimmeSecondaries()->clearAndDestroy();
78  // std::vector<G4Track*>::iterator itr;
79  size_t itr;
80  // for(itr=GimmeSecondaries()->begin();itr=GimmeSecondaries()->end();itr++){
81  for(itr=0;itr<GimmeSecondaries()->size();itr++){
82  delete (*GimmeSecondaries())[itr];
83  }
84  GimmeSecondaries()->clear();
85 
87 
88  // Give SteppingManger the pointer to the track which will be tracked
90 
91  // Pre tracking user intervention process.
92  fpTrajectory = 0;
93  if( fpUserTrackingAction != 0 ) {
95  }
96 #ifdef G4_STORE_TRAJECTORY
97  // Construct a trajectory if it is requested
98  if(StoreTrajectory&&(!fpTrajectory)) {
99  // default trajectory concrete class object
100  switch (StoreTrajectory) {
101  default:
102  case 1: fpTrajectory = new G4Trajectory(fpTrack); break;
103  case 2: fpTrajectory = new G4SmoothTrajectory(fpTrack); break;
104  case 3: fpTrajectory = new G4RichTrajectory(fpTrack); break;
105  case 4: fpTrajectory = new G4RichTrajectory(fpTrack); break;
106  }
107  }
108 #endif
109 
110  // Give SteppingManger the maxmimum number of processes
112 
113  // Give track the pointer to the Step
115 
116  // Inform beginning of tracking to physics processes
118 
119  // Track the particle Step-by-Step while it is alive
120  // G4StepStatus stepStatus;
121 
122  while( (fpTrack->GetTrackStatus() == fAlive) ||
124 
127 #ifdef G4_STORE_TRAJECTORY
129  AppendStep(fpSteppingManager->GetStep());
130 #endif
131  if(EventIsAborted) {
133  }
134  }
135  // Inform end of tracking to physics processes
137 
138  // Post tracking user intervention process.
139  if( fpUserTrackingAction != 0 ) {
141  }
142 
143  // Destruct the trajectory if it was created
144 #ifdef G4VERBOSE
146 #endif
147  if( (!StoreTrajectory)&&fpTrajectory ) {
148  delete fpTrajectory;
149  fpTrajectory = 0;
150  }
151 }
152 
154 {
155 #ifndef G4_STORE_TRAJECTORY
156  G4Exception("G4TrackingManager::SetTrajectory()",
157  "Tracking0015", FatalException,
158  "Invoked without G4_STORE_TRAJECTORY option set!");
159 #endif
160  fpTrajectory = aTrajectory;
161 }
162 
166 {
168  EventIsAborted = true;
169 }
170 
171 
173 {
174  G4cout << G4endl;
175  G4cout << "*******************************************************"
176  << "**************************************************"
177  << G4endl;
178  G4cout << "* G4Track Information: "
179  << " Particle = " << fpTrack->GetDefinition()->GetParticleName()
180  << ","
181  << " Track ID = " << fpTrack->GetTrackID()
182  << ","
183  << " Parent ID = " << fpTrack->GetParentID()
184  << G4endl;
185  G4cout << "*******************************************************"
186  << "**************************************************"
187  << G4endl;
188  G4cout << G4endl;
189 }
190 
191 
192 
193 
194 
195 
196 
#define G4endl
Definition: G4ios.hh:61
const G4String & GetParticleName() const
G4int GetTrackID() const
virtual void ShowTrajectory(std::ostream &os=G4cout) const
virtual void PostUserTrackingAction(const G4Track *)
G4Step * GetStep() const
G4ParticleDefinition * GetDefinition() const
void SetInitialStep(G4Track *valueTrack)
G4SteppingManager * fpSteppingManager
G4TrackVector * GimmeSecondaries() const
virtual void PreUserTrackingAction(const G4Track *)
G4TrackingMessenger * messenger
G4UserTrackingAction * fpUserTrackingAction
static G4int GetSilent()
G4StepStatus Stepping()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.hh:65
G4ProcessManager * GetProcessManager() const
void StartTracking(G4Track *aTrack=0)
G4GLOB_DLL std::ostream G4cout
void SetTrajectory(G4VTrajectory *aTrajectory)
G4VTrajectory * fpTrajectory
void SetTrackStatus(const G4TrackStatus aTrackStatus)
void SetStep(const G4Step *aValue)
G4TrackStatus GetTrackStatus() const
void ProcessOneTrack(G4Track *apValueG4Track)
G4int GetParentID() const
void IncrementCurrentStepNumber()