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 // GEANT 4 class header file 00032 // 00033 // 00034 // ------------------------------------------------------------ 00035 // Implemented for the new scheme 23 Mar. 1998 H.Kurahige 00036 // 00037 // Class Description 00038 // This class is the abstract class for ParticleChange. 00039 //- 00040 // The ParticleChange class ontains the results after invocation 00041 // of a physics process. This includes final states of parent 00042 // particle (momentum, energy, etc) and secondary particles generated 00043 // by the interaction. 00044 // The tracking assumes that all the values of energy and 00045 // momentum are in global reference system, therefore all the 00046 // needed Lorentz transformations must have been already Done 00047 // when filling the data-members of this class. 00048 //- 00049 //- 00050 // This abstract class has following four virtual methods 00051 // virtual G4Step* UpdateStepForAtRest(G4Step* Step); 00052 // virtual G4Step* UpdateStepForAlongStep(G4Step* Step); 00053 // virtual G4Step* UpdateStepForPostStep(G4Step* Step); 00054 // virtual void Initialize(const G4Track&); 00055 // The UpdateStep methods return the pointer to the G4Step 00056 // after updating the given Step information by using final state 00057 // information of the track given by a physics process. 00058 // User must add methods to keep the final state information 00059 // in his derived class as well as implement UpdateStep methods 00060 // which he want to use. 00061 //- 00062 // The Initialize methods is provided to refresh the final 00063 // state information and should be called by each process 00064 // at the beginning of DoIt. 00065 // 00066 // ------------------------------------------------------------ 00067 // Implement Event Biasing Scheme 9 Nov.,98 H.Kurashige 00068 // add CheckIt 13 Apr.,99 H.Kurashige 00069 // add accuracy leveles 5 May, 99 H.Kurashige 00070 // add check secondaries 11 June, 03 H.Kurashige 00071 // add new methods of ProposeXXX 08 May, 04 H.Kurashige 00072 // remove obsolete methods of SetXXX 19 Sep, 04 H.Kurashige 00073 // add flag for first/last step in volume 30 Oct. 2006 H.Kurashige 00074 // add nonIonizingEnergyLoss 26 Mar 2007 H.Kurashige 00075 // modify/fix bugs related to weight 17 Sep. 2011 H.Kurashige 00076 // fix bugs related to weight 29 Apr. 2012 H.Kurashige 00077 // 00078 00079 #ifndef G4VParticleChange_h 00080 #define G4VParticleChange_h 1 00081 00082 #include "globals.hh" 00083 #include "G4ios.hh" 00084 #include <cmath> 00085 00086 class G4Track; 00087 class G4Step; 00088 00089 #include "G4TrackFastVector.hh" 00090 #include "G4TrackStatus.hh" 00091 #include "G4SteppingControl.hh" 00092 00093 00094 class G4VParticleChange 00095 { 00096 public: 00097 // default constructor 00098 G4VParticleChange(); 00099 00100 // destructor 00101 virtual ~G4VParticleChange(); 00102 00103 // equal/unequal operator 00104 G4bool operator==(const G4VParticleChange &right) const; 00105 G4bool operator!=(const G4VParticleChange &right) const; 00106 // "equal" means that teo objects have the same pointer. 00107 00108 protected: 00109 // hide copy constructor and assignment operaor as protected 00110 G4VParticleChange(const G4VParticleChange &right); 00111 G4VParticleChange & operator=(const G4VParticleChange &right); 00112 00113 public: // with description 00114 // --- the following methods are for updating G4Step ----- 00115 virtual G4Step* UpdateStepForAtRest(G4Step* Step); 00116 virtual G4Step* UpdateStepForAlongStep(G4Step* Step); 00117 virtual G4Step* UpdateStepForPostStep(G4Step* Step); 00118 // Return the pointer to the G4Step after updating the Step information 00119 // by using final state information of the track given by a physics 00120 // process 00121 00122 protected: // with description 00123 G4Step* UpdateStepInfo(G4Step* Step); 00124 // Update the G4Step specific attributes 00125 // (i.e. SteppingControl, LocalEnergyDeposit, and TrueStepLength) 00126 00127 00128 public: // with description 00129 virtual void Initialize(const G4Track&); 00130 // This methods will be called by each process at the beginning of DoIt 00131 // if necessary. 00132 00133 protected: 00134 void InitializeTrueStepLength(const G4Track&); 00135 void InitializeLocalEnergyDeposit(const G4Track&); 00136 void InitializeSteppingControl(const G4Track&); 00137 void InitializeParentWeight(const G4Track&); 00138 void InitializeParentGlobalTime(const G4Track&); 00139 00140 void InitializeStatusChange(const G4Track&); 00141 void InitializeSecondaries(const G4Track&); 00142 void InitializeStepInVolumeFlags(const G4Track&); 00143 // ------------------------------------------------------ 00144 00145 public: // with description 00146 //---- the following methods are for TruePathLength ---- 00147 G4double GetTrueStepLength() const; 00148 void ProposeTrueStepLength(G4double truePathLength); 00149 // Get/Propose theTrueStepLength 00150 00151 //---- the following methods are for LocalEnergyDeposit ---- 00152 G4double GetLocalEnergyDeposit() const; 00153 void ProposeLocalEnergyDeposit(G4double anEnergyPart); 00154 // Get/Propose the locally deposited energy 00155 00156 //---- the following methods are for nonIonizingEnergyDeposit ---- 00157 G4double GetNonIonizingEnergyDeposit() const; 00158 void ProposeNonIonizingEnergyDeposit(G4double anEnergyPart); 00159 // Get/Propose the non-ionizing deposited energy 00160 00161 //---- the following methods are for TrackStatus ----- 00162 G4TrackStatus GetTrackStatus() const; 00163 void ProposeTrackStatus(G4TrackStatus status); 00164 // Get/Propose the final TrackStatus of the current particle. 00165 // ------------------------------------------------------ 00166 00167 //---- the following methods are for managements of SteppingControl -- 00168 G4SteppingControl GetSteppingControl() const; 00169 void ProposeSteppingControl(G4SteppingControl StepControlFlag); 00170 // Set/Propose a flag to control stepping manager behavier 00171 // ------------------------------------------------------ 00172 00173 //---- the following methods are for managements of initial/last step 00174 G4bool GetFirstStepInVolume() const; 00175 G4bool GetLastStepInVolume() const; 00176 void ProposeFirstStepInVolume(G4bool flag); 00177 void ProposeLastStepInVolume(G4bool flag); 00178 00179 //---- the following methods are for managements of secondaries -- 00180 void Clear(); 00181 // Clear the contents of this objects 00182 // This method should be called after the Tracking(Stepping) 00183 // manager removes all secondaries in theListOfSecondaries 00184 00185 void SetNumberOfSecondaries(G4int totSecondaries); 00186 // SetNumberOfSecondaries must be called just before AddSecondary() 00187 // in order to secure memory space for theListOfSecondaries 00188 // This method resets theNumberOfSecondaries to 0 00189 // (that will be incremented at every AddSecondary() call). 00190 00191 G4int GetNumberOfSecondaries() const; 00192 // Returns the number of secondaries current stored in 00193 // G4TrackFastVector. 00194 00195 G4Track* GetSecondary(G4int anIndex) const; 00196 // Returns the pointer to the generated secondary particle 00197 // which is specified by an Index. 00198 00199 void AddSecondary(G4Track* aSecondary); 00200 // Add a secondary particle to theListOfSecondaries. 00201 // ------------------------------------------------------ 00202 00203 G4double GetWeight() const; 00204 G4double GetParentWeight() const ; 00205 // Get weight of the parent (i.e. current) track 00206 void ProposeWeight(G4double finalWeight); 00207 void ProposeParentWeight(G4double finalWeight); 00208 // Propse new weight of the parent (i.e. current) track 00209 // As for AlongStepDoIt, the parent weight will be set 00210 // in accumulated manner 00211 // i.e.) If two processes propose weight of W1 and W2 respectively 00212 // for the track with initial weight of W0 00213 // the final weight is set to 00214 // (W1/W0) * (W2/W0) * W0 00215 00216 void SetSecondaryWeightByProcess(G4bool); 00217 G4bool IsSecondaryWeightSetByProcess() const; 00218 // In default (fSecondaryWeightByProcess flag is false), 00219 // the weight of secondary tracks will be set to 00220 // the parent weight 00221 // If fSecondaryWeightByProcess flag is true, 00222 // the weight of secondary tracks will not be changed 00223 // by the ParticleChange 00224 // (i.e. the process determine the secodary weight) 00225 // NOTE: 00226 // Make sure that only one processe in AlongStepDoIt 00227 // proposes the parent weight, 00228 // If several processes in AlongStepDoIt proposes 00229 // the parent weight and add secondaties with 00230 // fSecondaryWeightByProcess is set to false, 00231 // secondary weights may be wrong 00232 00233 void SetParentWeightByProcess(G4bool); 00234 G4bool IsParentWeightSetByProcess() const; 00235 // Obsolete 00236 00237 virtual void DumpInfo() const; 00238 // Print out information 00239 00240 void SetVerboseLevel(G4int vLevel); 00241 G4int GetVerboseLevel() const; 00242 00243 protected: 00244 00245 G4TrackFastVector* theListOfSecondaries; 00246 // The vector of secondaries. 00247 00248 G4int theNumberOfSecondaries; 00249 // The total number of secondaries produced by each process. 00250 00251 G4int theSizeOftheListOfSecondaries; 00252 // TheSizeOftheListOfSecondaries; 00253 00254 G4TrackStatus theStatusChange; 00255 // The changed (final) track status of a given particle. 00256 00257 G4SteppingControl theSteppingControlFlag; 00258 // a flag to control stepping manager behavior 00259 00260 G4double theLocalEnergyDeposit; 00261 // It represents the part of the energy lost for discrete 00262 // or semi-continuous processes which is due to secondaries 00263 // not generated because they would have been below their cut 00264 // threshold. 00265 // The sum of the locally deposited energy + the delta-energy 00266 // coming from the continuous processes gives the 00267 // total energy loss localized in the current Step. 00268 00269 G4double theNonIonizingEnergyDeposit; 00270 // non-ionizing energu deposit is defined as 00271 // a part of local energy deposit, which does not cause 00272 // ionization of atoms 00273 00274 G4double theTrueStepLength; 00275 // The value of "True" Step Length 00276 00277 00278 G4bool theFirstStepInVolume; 00279 G4bool theLastStepInVolume; 00280 // flag for initial/last step 00281 00282 G4double theParentWeight; 00283 // Weight ofparent track 00284 G4bool isParentWeightProposed; 00285 // flags for Weight ofparent track 00286 G4bool fSetSecondaryWeightByProcess; 00287 // flag for setting weight of secondaries 00288 00289 G4double theParentGlobalTime; 00290 // global time of the parent. 00291 // This is used only for checking 00292 00293 G4int verboseLevel; 00294 // The Verbose level 00295 00296 public: // with description 00297 // CheckIt method is provided for debug 00298 virtual G4bool CheckIt(const G4Track&); 00299 00300 // CheckIt method is activated 00301 // if debug flag is set and 'G4VERBOSE' is defined 00302 void ClearDebugFlag(); 00303 void SetDebugFlag(); 00304 G4bool GetDebugFlag() const; 00305 00306 protected: 00307 // CheckSecondary method is provided for debug 00308 G4bool CheckSecondary(G4Track&); 00309 00310 G4double GetAccuracyForWarning() const; 00311 G4double GetAccuracyForException() const; 00312 00313 protected: 00314 G4bool debugFlag; 00315 00316 // accuracy levels 00317 static const G4double accuracyForWarning; 00318 static const G4double accuracyForException; 00319 00320 00321 }; 00322 00323 #include "G4Step.hh" 00324 #include "G4Track.hh" 00325 #include "G4VParticleChange.icc" 00326 00327 #endif