00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // 00030 //--------------------------------------------------------------- 00031 // 00032 // G4Track.hh 00033 // 00034 // Class Description: 00035 // This class represents the partilce under tracking. 00036 // It includes information related to tracking for examples: 00037 // 1) current position/time of the particle, 00038 // 2) static particle information, 00039 // 3) the pointer to the physical volume where currently 00040 // the particle exists 00041 // 00042 //--------------------------------------------------------------- 00043 // Modification for G4TouchableHandle 22 Oct. 2001 R.Chytracek 00044 // Add MaterialCutCouple 08 Oct. 2002 H.Kurashige 00045 // Add SetVelocityTableProperties 02 Apr. 2011 H.Kurashige 00046 // Add fVelocity and Set/GetVelocity 29 Apr. 2011 H.Kurashige 00047 // Use G4VelocityTable 17 AUg. 2011 H.Kurashige 00048 00049 #ifndef G4Track_h 00050 #define G4Track_h 1 00051 00052 #include "globals.hh" // Include from 'global' 00053 #include <cmath> // Include from 'system' 00054 #include "G4ThreeVector.hh" // Include from 'geometry' 00055 #include "G4LogicalVolume.hh" // Include from 'geometry' 00056 #include "G4VPhysicalVolume.hh" // Include from 'geometry' 00057 #include "G4Allocator.hh" // Include from 'particle+matter' 00058 #include "G4DynamicParticle.hh" // Include from 'particle+matter' 00059 #include "G4TrackStatus.hh" // Include from 'tracking' 00060 #include "G4TouchableHandle.hh" // Include from 'geometry' 00061 #include "G4VUserTrackInformation.hh" 00062 00063 #include "G4Material.hh" 00064 00065 class G4Step; // Forward declaration 00066 class G4MaterialCutsCouple; 00067 class G4VelocityTable; 00068 00070 class G4Track 00072 { 00073 00074 //-------- 00075 public: // With description 00076 00077 // Constructor 00078 G4Track(); 00079 G4Track(G4DynamicParticle* apValueDynamicParticle, 00080 G4double aValueTime, 00081 const G4ThreeVector& aValuePosition); 00082 // aValueTime is a global time 00083 G4Track(const G4Track&); 00084 // Copy Constructor copys members other than tracking information 00085 00086 private: 00087 // Hide assignment operator as private 00088 G4Track& operator=(const G4Track&); 00089 00090 //-------- 00091 public: // With description 00092 00093 // Destrcutor 00094 ~G4Track(); 00095 00096 // Operators 00097 inline void *operator new(size_t); 00098 // Override "new" for "G4Allocator". 00099 inline void operator delete(void *aTrack); 00100 // Override "delete" for "G4Allocator". 00101 00102 G4bool operator==( const G4Track& ); 00103 00104 //-------- 00105 public: // With description 00106 // Copy information of the track (w/o tracking information) 00107 void CopyTrackInfo(const G4Track&); 00108 00109 // Get/Set functions 00110 // track ID 00111 G4int GetTrackID() const; 00112 void SetTrackID(const G4int aValue); 00113 00114 G4int GetParentID() const; 00115 void SetParentID(const G4int aValue); 00116 00117 // dynamic particle 00118 const G4DynamicParticle* GetDynamicParticle() const; 00119 00120 // particle definition 00121 const G4ParticleDefinition* GetParticleDefinition() const; 00122 // following method of GetDefinition remains 00123 // because of backward compatiblity. It will be removed in future 00124 G4ParticleDefinition* GetDefinition() const; 00125 00126 // position, time 00127 const G4ThreeVector& GetPosition() const; 00128 void SetPosition(const G4ThreeVector& aValue); 00129 00130 G4double GetGlobalTime() const; 00131 void SetGlobalTime(const G4double aValue); 00132 // Time since the event in which the track belongs is created. 00133 00134 G4double GetLocalTime() const; 00135 void SetLocalTime(const G4double aValue); 00136 // Time since the current track is created. 00137 00138 G4double GetProperTime() const; 00139 void SetProperTime(const G4double aValue); 00140 // Proper time of the current track 00141 00142 // volume, material, touchable 00143 G4VPhysicalVolume* GetVolume() const; 00144 G4VPhysicalVolume* GetNextVolume() const; 00145 00146 G4Material* GetMaterial() const; 00147 G4Material* GetNextMaterial() const; 00148 00149 const G4MaterialCutsCouple* GetMaterialCutsCouple() const; 00150 const G4MaterialCutsCouple* GetNextMaterialCutsCouple() const; 00151 00152 const G4VTouchable* GetTouchable() const; 00153 const G4TouchableHandle& GetTouchableHandle() const; 00154 void SetTouchableHandle( const G4TouchableHandle& apValue); 00155 00156 const G4VTouchable* GetNextTouchable() const; 00157 const G4TouchableHandle& GetNextTouchableHandle() const; 00158 void SetNextTouchableHandle( const G4TouchableHandle& apValue); 00159 00160 const G4VTouchable* GetOriginTouchable() const; 00161 const G4TouchableHandle& GetOriginTouchableHandle() const; 00162 void SetOriginTouchableHandle( const G4TouchableHandle& apValue); 00163 00164 // energy 00165 G4double GetKineticEnergy() const; 00166 void SetKineticEnergy(const G4double aValue); 00167 00168 G4double GetTotalEnergy() const; 00169 00170 00171 // moemtnum 00172 const G4ThreeVector& GetMomentumDirection() const; 00173 void SetMomentumDirection(const G4ThreeVector& aValue); 00174 00175 G4ThreeVector GetMomentum() const; 00176 00177 // velocity 00178 G4double GetVelocity() const; 00179 void SetVelocity(G4double val); 00180 00181 G4double CalculateVelocity() const; 00182 G4double CalculateVelocityForOpticalPhoton() const; 00183 00184 G4bool UseGivenVelocity() const; 00185 void UseGivenVelocity(G4bool val); 00186 00187 // polarization 00188 const G4ThreeVector& GetPolarization() const; 00189 void SetPolarization(const G4ThreeVector& aValue); 00190 00191 // track status, flags for tracking 00192 G4TrackStatus GetTrackStatus() const; 00193 void SetTrackStatus(const G4TrackStatus aTrackStatus); 00194 00195 G4bool IsBelowThreshold() const; 00196 void SetBelowThresholdFlag(G4bool value = true); 00197 // The flag of "BelowThreshold" is set to true 00198 // if this track energy is below threshold energy 00199 // in this material determined by the range cut value 00200 00201 G4bool IsGoodForTracking() const; 00202 void SetGoodForTrackingFlag(G4bool value = true); 00203 // The flag of "GoodForTracking" is set by processes 00204 // if this track should be tracked 00205 // even if the energy is below threshold 00206 00207 // track length 00208 G4double GetTrackLength() const; 00209 void AddTrackLength(const G4double aValue); 00210 // Accumulated the track length 00211 00212 // step information 00213 const G4Step* GetStep() const; 00214 void SetStep(const G4Step* aValue); 00215 00216 G4int GetCurrentStepNumber() const; 00217 void IncrementCurrentStepNumber(); 00218 00219 G4double GetStepLength() const; 00220 void SetStepLength(G4double value); 00221 // Before the end of the AlongStepDoIt loop,StepLength keeps 00222 // the initial value which is determined by the shortest geometrical Step 00223 // proposed by a physics process. After finishing the AlongStepDoIt, 00224 // it will be set equal to 'StepLength' in G4Step. 00225 00226 // vertex (,where this track was created) information 00227 const G4ThreeVector& GetVertexPosition() const; 00228 void SetVertexPosition(const G4ThreeVector& aValue); 00229 00230 const G4ThreeVector& GetVertexMomentumDirection() const; 00231 void SetVertexMomentumDirection(const G4ThreeVector& aValue); 00232 00233 G4double GetVertexKineticEnergy() const; 00234 void SetVertexKineticEnergy(const G4double aValue); 00235 00236 const G4LogicalVolume* GetLogicalVolumeAtVertex() const; 00237 void SetLogicalVolumeAtVertex(const G4LogicalVolume* ); 00238 00239 const G4VProcess* GetCreatorProcess() const; 00240 void SetCreatorProcess(const G4VProcess* aValue); 00241 00242 // track weight 00243 // These are methods for manipulating a weight for this track. 00244 G4double GetWeight() const; 00245 void SetWeight(G4double aValue); 00246 00247 // User information 00248 G4VUserTrackInformation* GetUserInformation() const; 00249 void SetUserInformation(G4VUserTrackInformation* aValue); 00250 00251 // Velocity table 00252 static void SetVelocityTableProperties(G4double t_max, G4double t_min, G4int nbin); 00253 static G4double GetMaxTOfVelocityTable(); 00254 static G4double GetMinTOfVelocityTable(); 00255 static G4int GetNbinOfVelocityTable(); 00256 00257 //--------- 00258 private: 00259 //--------- 00260 // Member data 00261 G4int fCurrentStepNumber; // Total steps number up to now 00262 G4ThreeVector fPosition; // Current positon 00263 G4double fGlobalTime; // Time since the event is created 00264 G4double fLocalTime; // Time since the track is created 00265 G4double fTrackLength; // Accumulated track length 00266 G4int fParentID; 00267 G4int fTrackID; 00268 G4double fVelocity; 00269 00270 G4TouchableHandle fpTouchable; 00271 G4TouchableHandle fpNextTouchable; 00272 G4TouchableHandle fpOriginTouchable; 00273 // Touchable Handle 00274 00275 G4DynamicParticle* fpDynamicParticle; 00276 G4TrackStatus fTrackStatus; 00277 00278 G4bool fBelowThreshold; 00279 // This flag is set to true if this track energy is below 00280 // threshold energy in this material determined by the range cut value 00281 G4bool fGoodForTracking; 00282 // This flag is set by processes if this track should be tracked 00283 // even if the energy is below threshold 00284 00285 G4double fStepLength; 00286 // Before the end of the AlongStepDoIt loop, this keeps the initial 00287 // Step length which is determined by the shortest geometrical Step 00288 // proposed by a physics process. After finishing the AlongStepDoIt, 00289 // this will be set equal to 'StepLength' in G4Step. 00290 00291 G4double fWeight; 00292 // This is a weight for this track 00293 00294 const G4Step* fpStep; 00295 00296 G4ThreeVector fVtxPosition; // (x,y,z) of the vertex 00297 G4ThreeVector fVtxMomentumDirection; // Momentum direction at the vertex 00298 G4double fVtxKineticEnergy; // Kinetic energy at the vertex 00299 const G4LogicalVolume* fpLVAtVertex; //Logical Volume at the vertex 00300 const G4VProcess* fpCreatorProcess; // Process which created the track 00301 00302 G4VUserTrackInformation* fpUserInformation; 00303 00304 // cached values for CalculateVelocity 00305 mutable G4Material* prev_mat; 00306 mutable G4MaterialPropertyVector* groupvel; 00307 mutable G4double prev_velocity; 00308 mutable G4double prev_momentum; 00309 00310 G4bool is_OpticalPhoton; 00311 static G4VelocityTable* velTable; 00312 00313 G4bool useGivenVelocity; 00314 // do not calclulate velocity and just use current fVelocity 00315 // if this flag is set 00316 00317 }; 00318 00319 #include "G4Track.icc" 00320 00321 #endif 00322 00323 00324 00325 00326 00327 00328 00329 00330 00331 00332 00333 00334 00335 00336