Changeset 1340 for trunk/source/processes/electromagnetic/utils
- Timestamp:
- Nov 5, 2010, 3:45:55 PM (14 years ago)
- Location:
- trunk/source/processes/electromagnetic/utils
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/electromagnetic/utils/History
r1315 r1340 1 $Id: History,v 1.4 24 2010/06/04 15:36:39 vnivanch Exp $1 $Id: History,v 1.436 2010/11/04 12:55:09 vnivanch Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 17 17 * Reverse chronological order (last date on top), please * 18 18 ---------------------------------------------------------- 19 20 04 November 10: V.Ivant (emutils-V09-03-23) 21 - Fixed part of problems reported by the Coverity tool 22 (mainly initialisation) 23 24 25 October 10: V.Ivant (emutils-V09-03-22) 25 - Fixed problems reported by the Coverity tool (mainly initialisation) 26 27 15 October 10: V.Ivant (emutils-V09-03-21) 28 - G4VEmAngularDistribution - new general interface 29 - G4VBremAngularDistribution moved from lowenergy 30 - G4VEmModel - G4VEmAngularDistribution added and Get/Set methods 31 - G4VEnergyLossProcess - fixed bug #1141 (L.Pandola) 32 33 07 September 10: V.Ivant (emutils-V09-03-20) 34 - G4VMscModel - in computation of the displacement added 35 a protection limited displacement to be incide current 36 volume (address bug #1128) 37 - G4LossTableManager - a little cleanup of interfaces 38 - G4ElectronIonPair - added method SampleNumberOfIonsAlongStep 39 - G4EmCalculator - return back tag 18 40 41 23 August 10: V.Ivant (emutils-V09-03-19) 42 G4VEnergyLossProcess - minor optimisation of PostStepDoIt (in some cases 43 one call to the log of random number less) 44 45 17 August 10: V.Ivant (emutils-V09-03-18) 46 G4VEmProcess, G4VEnergyLossProcess, G4VMultipleScattering, G4VEmModel, 47 G4EmMultiModel - substituted obsolete method GetDefinition() of the class 48 G4DynamicParticle by the new one GetParticleDefinition() 49 50 29 July 10: V.Ivant (emutils-V09-03-17) 51 G4EmMultiModel - fixed and cleaned up 52 G4VMultipleScattering - added more detailed printout for kaon+ 53 G4LossTableManager - added pointer and access method to G4ElectronIonPair 19 54 20 55 4 June 10: V.Ivant (emutils-V09-03-16) -
trunk/source/processes/electromagnetic/utils/include/G4ElectronIonPair.hh
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4ElectronIonPair.hh,v 1. 2 2008/10/17 14:46:16vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4ElectronIonPair.hh,v 1.5 2010/10/25 17:23:01 vnivanch Exp $ 27 // GEANT4 tag $Name: emutils-V09-03-23 $ 28 28 // 29 29 // … … 62 62 #include "G4ParticleDefinition.hh" 63 63 #include "G4ThreeVector.hh" 64 #include "G4TrackVector.hh"65 64 #include "G4VProcess.hh" 66 65 #include <vector> … … 86 85 inline G4double MeanNumberOfIonsAlongStep(const G4Step*); 87 86 87 inline G4int SampleNumberOfIonsAlongStep(const G4Step*); 88 88 89 // returns pointer to the new vector of positions of 89 90 // ionisation points in the World coordinate system 90 std::vector<G4ThreeVector>*91 SampleIonsAlongStep(const G4ThreeVector& prePosition,92 const G4ThreeVector& postPosition,93 G4double numberOfIonisations);94 95 91 std::vector<G4ThreeVector>* SampleIonsAlongStep(const G4Step*); 96 92 … … 115 111 private: 116 112 113 void Initialise(); 114 115 G4double FindMeanEnergyPerIonPair(const G4Material*); 116 117 117 // hide assignment operator 118 118 G4ElectronIonPair & operator=(const G4ElectronIonPair &right); 119 119 G4ElectronIonPair(const G4ElectronIonPair&); 120 120 121 G4double FindMeanEnergyPerIonPair(const G4Material*); 121 // cash 122 const G4Material* curMaterial; 123 G4double curMeanEnergy; 122 124 123 void Initialise(); 124 125 const G4ParticleDefinition* gamma; 126 127 // cash 128 const G4Material* curMaterial; 129 G4double curMeanEnergy; 130 125 G4double FanoFactor; 126 131 127 G4int verbose; 132 128 G4int nMaterials; 133 129 134 130 // list of G4 NIST materials with mean energy per ion defined 135 std::vector<G4double> g4MatData; 136 std::vector<G4String> g4MatNames; 137 131 std::vector<G4double> g4MatData; 132 std::vector<G4String> g4MatNames; 138 133 }; 139 134 … … 141 136 G4ElectronIonPair::MeanNumberOfIonsAlongStep(const G4Step* step) 142 137 { 143 return MeanNumberOfIonsAlongStep(step->GetTrack()->Get Definition(),138 return MeanNumberOfIonsAlongStep(step->GetTrack()->GetParticleDefinition(), 144 139 step->GetPreStepPoint()->GetMaterial(), 145 140 step->GetTotalEnergyDeposit(), … … 147 142 } 148 143 149 inline std::vector<G4ThreeVector>*150 G4 ElectronIonPair::SampleIonsAlongStep(const G4Step* step)144 inline 145 G4int G4ElectronIonPair::SampleNumberOfIonsAlongStep(const G4Step* step) 151 146 { 152 return SampleIonsAlongStep(step->GetPreStepPoint()->GetPosition(), 153 step->GetPostStepPoint()->GetPosition(), 154 MeanNumberOfIonsAlongStep(step)); 155 } 147 G4double meanion = MeanNumberOfIonsAlongStep(step); 148 G4double sig = FanoFactor*std::sqrt(meanion); 149 G4int nion = G4int(G4RandGauss::shoot(meanion,sig) + 0.5); 150 return nion; 151 } 156 152 157 153 inline … … 160 156 G4int subtype = -1; 161 157 const G4VProcess* proc = step->GetPostStepPoint()->GetProcessDefinedStep(); 162 if(proc) subtype = proc->GetProcessSubType();163 return ResidualeChargePostStep(step->GetTrack()->Get Definition(),158 if(proc) { subtype = proc->GetProcessSubType(); } 159 return ResidualeChargePostStep(step->GetTrack()->GetParticleDefinition(), 164 160 step->GetSecondary(), 165 161 subtype); -
trunk/source/processes/electromagnetic/utils/include/G4EmMultiModel.hh
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4EmMultiModel.hh,v 1. 6 2007/05/22 17:31:57vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4EmMultiModel.hh,v 1.7 2010/07/04 17:51:09 vnivanch Exp $ 27 // GEANT4 tag $Name: emutils-V09-03-23 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 40 40 // Modifications: 41 41 // 15-04-05 optimize internal interface (V.Ivanchenko) 42 // 04-07-10 updated interfaces according to g4 9.4 (V.Ivanchenko) 42 43 // 43 44 // Class Description: 44 45 // 45 // E nergy loss model using several G4VEmModels46 // EM model using several G4VEmModels for the same energy interval 46 47 47 48 // ------------------------------------------------------------------- … … 55 56 #include <vector> 56 57 57 class G4Region;58 class G4PhysicsTable;59 58 class G4DynamicParticle; 60 59 … … 68 67 virtual ~G4EmMultiModel(); 69 68 70 void Initialise(const G4ParticleDefinition*, const G4DataVector&);69 void AddModel(G4VEmModel*); 71 70 72 G4double MinEnergyCut(const G4ParticleDefinition*,73 const G4MaterialCutsCouple*);71 virtual void Initialise(const G4ParticleDefinition*, 72 const G4DataVector&); 74 73 74 virtual G4double ComputeDEDX(const G4MaterialCutsCouple*, 75 const G4ParticleDefinition*, 76 G4double kineticEnergy, 77 G4double cutEnergy); 75 78 76 G4double ComputeDEDX(const G4MaterialCutsCouple*, 77 const G4ParticleDefinition*, 78 G4double kineticEnergy, 79 G4double cutEnergy); 79 // main method to compute cross section per atom 80 virtual 81 G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*, 82 G4double kinEnergy, 83 G4double Z, 84 G4double A = 0., /* amu */ 85 G4double cutEnergy = 0.0, 86 G4double maxEnergy = DBL_MAX); 80 87 81 G4double CrossSection(const G4MaterialCutsCouple*, 82 const G4ParticleDefinition*, 83 G4double kineticEnergy, 84 G4double cutEnergy, 85 G4double maxEnergy); 86 87 void SampleSecondaries(std::vector<G4DynamicParticle*>*, 88 const G4MaterialCutsCouple*, 89 const G4DynamicParticle*, 90 G4double tmin, 91 G4double tmax); 92 93 void DefineForRegion(const G4Region*); 94 95 void AddModel(G4VEmModel*, G4double tmin, G4double tmax); 96 97 protected: 98 99 G4double MaxSecondaryEnergy(const G4ParticleDefinition*, 100 G4double kineticEnergy); 88 virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*, 89 const G4MaterialCutsCouple*, 90 const G4DynamicParticle*, 91 G4double tmin, 92 G4double tmax); 101 93 102 94 private: … … 108 100 G4int nModels; 109 101 std::vector<G4VEmModel*> model; 110 G4DataVector tsecmin; 111 G4DataVector cross_section; 102 std::vector<G4double> cross_section; 112 103 113 104 }; -
trunk/source/processes/electromagnetic/utils/include/G4EmSaturation.hh
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4EmSaturation.hh,v 1. 7 2009/09/25 09:16:40vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4EmSaturation.hh,v 1.8 2010/08/17 17:36:58 vnivanch Exp $ 27 // GEANT4 tag $Name: emutils-V09-03-23 $ 28 28 // 29 29 // … … 140 140 { 141 141 G4Track* track = step->GetTrack(); 142 return VisibleEnergyDeposition(track->Get Definition(),142 return VisibleEnergyDeposition(track->GetParticleDefinition(), 143 143 track->GetMaterialCutsCouple(), 144 144 step->GetStepLength(), -
trunk/source/processes/electromagnetic/utils/include/G4LossTableManager.hh
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4LossTableManager.hh,v 1. 58 2010/04/27 16:59:52vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4LossTableManager.hh,v 1.61 2010/09/03 10:09:45 vnivanch Exp $ 27 // GEANT4 tag $Name: emutils-V09-03-23 $ 28 28 // 29 29 // … … 93 93 class G4EmSaturation; 94 94 class G4EmConfigurator; 95 class G4ElectronIonPair; 95 96 class G4LossTableBuilder; 97 class G4VAtomDeexcitation; 96 98 class G4Region; 97 99 … … 259 261 const std::vector<G4VMultipleScattering*>& GetMultipleScatteringVector(); 260 262 261 inline G4VEnergyLossProcess* GetEnergyLossProcess(const G4ParticleDefinition*); 263 inline 264 G4VEnergyLossProcess* GetEnergyLossProcess(const G4ParticleDefinition*); 262 265 263 266 G4EmCorrections* EmCorrections(); … … 266 269 267 270 G4EmConfigurator* EmConfigurator(); 271 272 G4ElectronIonPair* ElectronIonPair(); 273 274 G4VAtomDeexcitation* AtomDeexcitation(); 275 276 void SetAtomDeexcitation(G4VAtomDeexcitation*); 268 277 269 278 private: … … 345 354 G4EmSaturation* emSaturation; 346 355 G4EmConfigurator* emConfigurator; 356 G4ElectronIonPair* emElectronIonPair; 357 G4VAtomDeexcitation* atomDeexcitation; 347 358 348 359 G4int nbinsLambda; … … 464 475 G4double& length) 465 476 { 466 const G4ParticleDefinition* aParticle = dp->Get Definition();477 const G4ParticleDefinition* aParticle = dp->GetParticleDefinition(); 467 478 if(aParticle != currentParticle) { 468 479 std::map<PD,G4VEnergyLossProcess*,std::less<PD> >::const_iterator pos; -
trunk/source/processes/electromagnetic/utils/include/G4VAtomDeexcitation.hh
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VAtomDeexcitation.hh,v 1. 3 2010/03/30 09:19:56vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4VAtomDeexcitation.hh,v 1.5 2010/10/14 16:27:35 vnivanch Exp $ 27 // GEANT4 tag $Name: emutils-V09-03-23 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 51 51 52 52 #include "globals.hh" 53 #include "G4AtomicShell.hh" 54 #include "G4ProductionCutsTable.hh" 55 #include "G4Track.hh" 53 56 #include <vector> 54 57 55 class G4AtomicShell;56 58 class G4ParticleDefinition; 57 59 class G4DynamicParticle; 60 class G4MaterialCutsCouple; 61 class G4VParticleChange; 62 63 enum G4AtomicShellEnumerator 64 { 65 fKShell = 0, 66 fL1Shell, 67 fL2Shell, 68 fL3Shell, 69 fM1Shell, 70 fM2Shell, 71 fM3Shell, 72 fM4Shell, 73 fM5Shell 74 }; 58 75 59 76 class G4VAtomDeexcitation { 60 61 G4VAtomDeexcitation(const G4String& pname = ""); 77 public: 78 79 G4VAtomDeexcitation(const G4String& modname = "Deexcitation", 80 const G4String& pixename = ""); 62 81 63 82 virtual ~G4VAtomDeexcitation(); … … 65 84 //========== initialization ========== 66 85 67 virtual void PreparePhysicsTable(const G4ParticleDefinition&); 68 virtual void BuildPhysicsTable(const G4ParticleDefinition&); 86 // Overall initialisation before new run 87 void InitialiseAtomicDeexcitation(); 88 89 // Initialisation of deexcitation at the beginning of run 90 virtual void InitialiseForNewRun() = 0; 91 92 // Initialisation for a concrete atom 93 // May be called at run time 94 virtual void InitialiseForExtraAtom(G4int Z) = 0; 95 96 // Activation of deexcitation per detector region 97 void SetDeexcitationActiveRegion(const G4String& rname = ""); 98 99 // Activation of Auger electron production 100 inline void SetAugerActive(G4bool); 101 inline G4bool IsAugerActive() const; 102 103 // Activation of PIXE simulation 104 inline void SetPIXEActive(G4bool); 105 inline G4bool IsPIXEActive() const; 106 107 // Deexcitation model name 108 inline const G4String& GetName() const; 69 109 70 110 // PIXE model name … … 72 112 inline const G4String& PIXECrossSectionModel() const; 73 113 74 // Activation of deexcitation per detector region 75 void SetFluorescenceActiveRegion(const G4Region* region = 0); 76 void SetAugerActiveRegion(const G4Region* region = 0); 77 void SetPIXECrossSectionActiveRegion(const G4Region* region = 0); 78 79 void SetFluorescenceActiveRegion(const G4String& rname = ""); 80 void SetAugerActiveRegion(const G4String& rname = ""); 81 void SetPIXECrossSectionActiveRegion(const G4String& rname = ""); 114 // Access to the list of atoms active for deexcitation 115 inline const std::vector<G4bool>& GetListOfActiveAtoms() const; 116 117 // Verbosity level 118 inline void SetVerboseLevel(G4int); 119 inline G4int GetVerboseLevel() const; 82 120 83 121 //========== Run time methods ========== 84 122 85 123 // Check if deexcitation is active for a given geometry volume 86 G4bool CheckFluorescenceActiveRegion(G4int coupleIndex); 87 88 // Check if deexcitation is active for a given geometry volume 89 G4bool CheckPIXEActiveRegion(G4int coupleIndex); 124 inline G4bool CheckDeexcitationActiveRegion(G4int coupleIndex); 90 125 91 126 // Get atomic shell by shell index, used by discrete processes 92 127 // (for example, photoelectric), when shell vacancy sampled by the model 93 const G4AtomicShell* GetAtomicShell(G4int Z, G4int ShellIndex); 94 95 // selection of random shell for ionisation process 96 virtual const G4AtomicShell* SelectRandomShell(const G4DynamicParticle*, 97 G4int Z); 128 virtual 129 const G4AtomicShell* GetAtomicShell(G4int Z, 130 G4AtomicShellEnumerator shell) = 0; 98 131 99 132 // generation of deexcitation for given atom and shell vacancy 100 virtual void GenerateParticles(std::vector<G4DynamicParticle*>*, 101 const G4AtomicShell*, G4int Z) = 0; 133 inline void GenerateParticles(std::vector<G4DynamicParticle*>* secVect, 134 const G4AtomicShell*, 135 G4int Z, 136 G4int coupleIndex); 137 138 // generation of deexcitation for given atom and shell vacancy 139 virtual void GenerateParticles(std::vector<G4DynamicParticle*>* secVect, 140 const G4AtomicShell*, 141 G4int Z, 142 G4double gammaCut, 143 G4double eCut) = 0; 102 144 103 145 // access or compute PIXE cross section 104 virtual G4double GetPIXECrossSection (const G4ParticleDefinition*, 105 G4int Z, G4double kinE) = 0; 106 107 // calculate PIXE cross section from the models 108 virtual G4double CalculatePIXECrossSection(const G4ParticleDefinition*, 109 G4int Z, G4double kinE) = 0; 146 virtual G4double 147 GetShellIonisationCrossSectionPerAtom(const G4ParticleDefinition*, 148 G4int Z, 149 G4AtomicShellEnumerator shell, 150 G4double kinE) = 0; 151 152 // access or compute PIXE cross section 153 virtual G4double 154 ComputeShellIonisationCrossSectionPerAtom(const G4ParticleDefinition*, 155 G4int Z, 156 G4AtomicShellEnumerator shell, 157 G4double kinE) = 0; 110 158 111 159 // Sampling of PIXE for ionisation processes 112 virtual void 113 AlongStepDeexcitation(std::vector<G4DynamicParticle*>* secVect, 114 const G4DynamicParticle* icidentParticle, 115 const G4MaterialCutsCouple*, 116 G4double trueStepLenght, 117 G4double eLoss) = 0; 118 119 160 void AlongStepDeexcitation(G4VParticleChange* pParticleChange, 161 const G4Step& step, 162 G4double& eLoss, 163 G4int coupleIndex); 120 164 121 165 private: … … 125 169 G4VAtomDeexcitation & operator=(const G4VAtomDeexcitation &right); 126 170 171 G4ProductionCutsTable* theCoupleTable; 172 G4int verbose; 173 G4String name; 127 174 G4String namePIXE; 128 175 G4bool flagAuger; 176 G4bool flagPIXE; 177 std::vector<G4bool> activeZ; 178 std::vector<G4bool> activeDeexcitationMedia; 179 std::vector<G4String> activeRegions; 180 std::vector<G4DynamicParticle*> vdyn; 181 std::vector<G4Track*> secVect; 129 182 }; 183 184 inline void G4VAtomDeexcitation::SetAugerActive(G4bool val) 185 { 186 flagAuger = val; 187 } 188 189 inline G4bool G4VAtomDeexcitation::IsAugerActive() const 190 { 191 return flagAuger; 192 } 193 194 inline void G4VAtomDeexcitation::SetPIXEActive(G4bool val) 195 { 196 flagPIXE = val; 197 } 198 199 inline G4bool G4VAtomDeexcitation::IsPIXEActive() const 200 { 201 return flagPIXE; 202 } 203 204 inline const G4String& G4VAtomDeexcitation::GetName() const 205 { 206 return name; 207 } 130 208 131 209 inline … … 141 219 } 142 220 221 inline const std::vector<G4bool>& 222 G4VAtomDeexcitation::GetListOfActiveAtoms() const 223 { 224 return activeZ; 225 } 226 227 inline void G4VAtomDeexcitation::SetVerboseLevel(G4int val) 228 { 229 verbose = val; 230 } 231 232 inline G4int G4VAtomDeexcitation::GetVerboseLevel() const 233 { 234 return verbose; 235 } 236 237 inline G4bool 238 G4VAtomDeexcitation::CheckDeexcitationActiveRegion(G4int coupleIndex) 239 { 240 return activeDeexcitationMedia[coupleIndex]; 241 } 242 243 inline void 244 G4VAtomDeexcitation::GenerateParticles(std::vector<G4DynamicParticle*>* v, 245 const G4AtomicShell* as, 246 G4int Z, 247 G4int idx) 248 { 249 G4double gCut = (*theCoupleTable->GetEnergyCutsVector(idx))[0]; 250 if(gCut < as->BindingEnergy()) { 251 GenerateParticles(v, as, Z, gCut, 252 (*theCoupleTable->GetEnergyCutsVector(idx))[1]); 253 } 254 } 255 143 256 #endif 144 257 -
trunk/source/processes/electromagnetic/utils/include/G4VEmModel.hh
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VEmModel.hh,v 1.7 5 2010/05/26 10:41:34vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4VEmModel.hh,v 1.77 2010/10/14 16:27:35 vnivanch Exp $ 27 // GEANT4 tag $Name: emutils-V09-03-23 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 67 67 // 16-02-09 Moved implementations of virtual methods to source (VI) 68 68 // 07-04-09 Moved msc methods from G4VEmModel to G4VMscModel (VI) 69 // 13-10-10 Added G4VEmAngularDistribution (VI) 69 70 // 70 71 // Class Description: … … 87 88 #include "G4DataVector.hh" 88 89 #include "G4VEmFluctuationModel.hh" 90 #include "G4VEmAngularDistribution.hh" 89 91 #include "G4EmElementSelector.hh" 90 92 #include "Randomize.hh" … … 146 148 147 149 // min cut in kinetic energy allowed by the model 150 // obsolete method will be removed 148 151 virtual G4double MinEnergyCut(const G4ParticleDefinition*, 149 152 const G4MaterialCutsCouple*); … … 252 255 //------------------------------------------------------------------------ 253 256 257 void SetParticleChange(G4VParticleChange*, G4VEmFluctuationModel* f=0); 258 254 259 inline G4VEmFluctuationModel* GetModelOfFluctuations(); 255 260 261 inline G4VEmAngularDistribution* GetAngularDistribution(); 262 263 inline void SetAngularDistribution(G4VEmAngularDistribution*); 264 256 265 inline G4double HighEnergyLimit() const; 257 266 … … 284 293 inline void SetDeexcitationFlag(G4bool val); 285 294 286 inline void ActivateNuclearStopping(G4bool);287 288 295 inline G4double MaxSecondaryKinEnergy(const G4DynamicParticle* dynParticle); 289 296 290 297 inline const G4String& GetName() const; 291 292 inline void SetParticleChange(G4VParticleChange*, G4VEmFluctuationModel*);293 298 294 299 inline void SetCurrentCouple(const G4MaterialCutsCouple*); … … 310 315 // ======== Parameters of the class fixed at construction ========= 311 316 312 G4VEmFluctuationModel* fluc; 317 G4VEmFluctuationModel* flucModel; 318 G4VEmAngularDistribution* anglModel; 313 319 const G4String name; 314 320 … … 329 335 330 336 G4VParticleChange* pParticleChange; 331 G4bool nuclearStopping;337 // G4bool nuclearStopping; 332 338 333 339 // ======== Cashed values - may be state dependent ================ … … 377 383 G4double G4VEmModel::MaxSecondaryKinEnergy(const G4DynamicParticle* dynPart) 378 384 { 379 return MaxSecondaryEnergy(dynPart->Get Definition(),385 return MaxSecondaryEnergy(dynPart->GetParticleDefinition(), 380 386 dynPart->GetKineticEnergy()); 381 387 } … … 479 485 inline G4VEmFluctuationModel* G4VEmModel::GetModelOfFluctuations() 480 486 { 481 return fluc; 487 return flucModel; 488 } 489 490 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 491 492 inline G4VEmAngularDistribution* G4VEmModel::GetAngularDistribution() 493 { 494 return anglModel; 495 } 496 497 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 498 499 inline void G4VEmModel::SetAngularDistribution(G4VEmAngularDistribution* p) 500 { 501 anglModel = p; 482 502 } 483 503 … … 587 607 } 588 608 589 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....590 591 inline void G4VEmModel::ActivateNuclearStopping(G4bool val)592 {593 nuclearStopping = val;594 }595 596 609 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 597 610 … … 603 616 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 604 617 605 inline void G4VEmModel::SetParticleChange(G4VParticleChange* p,606 G4VEmFluctuationModel* f = 0)607 {608 if(p && pParticleChange != p) { pParticleChange = p; }609 fluc = f;610 }611 612 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......613 614 618 #endif 615 619 -
trunk/source/processes/electromagnetic/utils/include/G4VEmProcess.hh
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VEmProcess.hh,v 1.6 0 2010/04/28 14:43:13vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4VEmProcess.hh,v 1.61 2010/08/17 17:36:59 vnivanch Exp $ 27 // GEANT4 tag $Name: emutils-V09-03-23 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 413 413 inline void G4VEmProcess::InitialiseStep(const G4Track& track) 414 414 { 415 currentParticle = track.Get Definition();415 currentParticle = track.GetParticleDefinition(); 416 416 preStepKinEnergy = track.GetKineticEnergy(); 417 417 DefineMaterial(track.GetMaterialCutsCouple()); -
trunk/source/processes/electromagnetic/utils/include/G4VEnergyLossProcess.hh
r1315 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VEnergyLossProcess.hh,v 1.9 2 2010/04/28 14:43:13vnivanch Exp $26 // $Id: G4VEnergyLossProcess.hh,v 1.93 2010/10/14 16:27:35 vnivanch Exp $ 27 27 // GEANT4 tag $Name: 28 28 // … … 114 114 class G4Region; 115 115 class G4SafetyHelper; 116 class G4VAtomDeexcitation; 116 117 117 118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... … … 466 467 std::vector<G4VEmModel*> emModels; 467 468 G4VEmFluctuationModel* fluctModel; 469 G4VAtomDeexcitation* atomDeexcitation; 468 470 std::vector<const G4Region*> scoffRegions; 469 471 std::vector<const G4Region*> deRegions; -
trunk/source/processes/electromagnetic/utils/include/G4VMscModel.hh
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VMscModel.hh,v 1. 9 2009/04/07 18:39:47vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4VMscModel.hh,v 1.10 2010/09/07 16:05:33 vnivanch Exp $ 27 // GEANT4 tag $Name: emutils-V09-03-23 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 140 140 G4double dtrl; 141 141 G4double lambdalimit; 142 G4double geommax; 142 G4double geomMin; 143 G4double geomMax; 143 144 144 145 G4MscStepLimitType steppingAlgorithm; … … 206 207 G4double limit) 207 208 { 208 G4double res = geom max;209 G4double res = geomMax; 209 210 if(track.GetVolume() != safetyHelper->GetWorldVolume()) { 210 211 res = safetyHelper->CheckNextStep( -
trunk/source/processes/electromagnetic/utils/src/G4ElectronIonPair.cc
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4ElectronIonPair.cc,v 1. 2 2008/10/17 14:46:16vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4ElectronIonPair.cc,v 1.5 2010/10/25 17:23:01 vnivanch Exp $ 27 // GEANT4 tag $Name: emutils-V09-03-23 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 46 46 47 47 #include "G4ElectronIonPair.hh" 48 #include "G4Gamma.hh"49 48 #include "G4Material.hh" 50 49 #include "G4MaterialTable.hh" … … 63 62 curMeanEnergy = 0.0; 64 63 nMaterials = 0; 64 FanoFactor = 0.2; 65 65 Initialise(); 66 66 } … … 97 97 } 98 98 } 99 if(curMeanEnergy > 0.0) nion = (edep - niel)/curMeanEnergy;99 if(curMeanEnergy > 0.0) { nion = (edep - niel)/curMeanEnergy; } 100 100 } 101 101 } … … 106 106 107 107 std::vector<G4ThreeVector>* 108 G4ElectronIonPair::SampleIonsAlongStep(const G4ThreeVector& prePos, 109 const G4ThreeVector& postPos, 110 G4double meanion) 111 { 112 std::vector<G4ThreeVector>* v = new std::vector<G4ThreeVector>; 113 114 G4double sig = 0.2*std::sqrt(meanion); 115 G4int nion = G4int(G4RandGauss::shoot(meanion,sig) + 0.5); 108 G4ElectronIonPair::SampleIonsAlongStep(const G4Step* step) 109 { 110 std::vector<G4ThreeVector>* v = 0; 111 112 G4int nion = SampleNumberOfIonsAlongStep(step); 116 113 117 114 // sample ionisation along step 118 115 if(nion > 0) { 119 116 120 G4ThreeVector deltaPos = postPos - prePos; 121 for(G4int i=0; i<nion; i++) { 117 v = new std::vector<G4ThreeVector>; 118 G4ThreeVector prePos = step->GetPreStepPoint()->GetPosition(); 119 G4ThreeVector deltaPos = step->GetPostStepPoint()->GetPosition() - prePos; 120 for(G4int i=0; i<nion; ++i) { 122 121 v->push_back( prePos + deltaPos*G4UniformRand() ); 123 122 } … … 138 137 G4int nholes = 0; 139 138 140 if(2 == subType || 12 == subType || 13 == subType) nholes = 1;139 if(2 == subType || 12 == subType || 13 == subType) { nholes = 1; } 141 140 return nholes; 142 141 } … … 173 172 if(nmat > 0) { 174 173 G4cout << "### G4ElectronIonPair: mean energy per ion pair avalable:" << G4endl; 175 for(G4int i=0; i<nmat; i++) {174 for(G4int i=0; i<nmat; ++i) { 176 175 const G4Material* mat = (*mtable)[i]; 177 176 G4double x = mat->GetIonisation()->GetMeanEnergyPerIonPair(); … … 191 190 G4cout << "### G4ElectronIonPair: mean energy per ion pair " 192 191 << " for Geant4 materials" << G4endl; 193 for(G4int i=0; i<nMaterials; i++) {192 for(G4int i=0; i<nMaterials; ++i) { 194 193 G4cout << " " << g4MatNames[i] << " Epair= " 195 194 << g4MatData[i]/eV << " eV" << G4endl; -
trunk/source/processes/electromagnetic/utils/src/G4EmCalculator.cc
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4EmCalculator.cc,v 1.5 3 2010/04/13 10:58:03vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4EmCalculator.cc,v 1.57 2010/11/04 12:55:09 vnivanch Exp $ 27 // GEANT4 tag $Name: emutils-V09-03-23 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 98 98 currentLambda = 0; 99 99 currentModel = 0; 100 currentProcess = 0; 100 101 loweModel = 0; 101 102 chargeSquare = 1.0; 102 103 massRatio = 1.0; 104 mass = 0.0; 105 currentCut = 0.0; 103 106 currentParticleName= ""; 104 107 currentMaterialName= ""; -
trunk/source/processes/electromagnetic/utils/src/G4EmConfigurator.cc
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4EmConfigurator.cc,v 1. 8 2010/06/04 15:33:56vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4EmConfigurator.cc,v 1.9 2010/07/29 11:13:28 vnivanch Exp $ 27 // GEANT4 tag $Name: emutils-V09-03-23 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 172 172 173 173 G4VProcess* proc = 0; 174 for(G4int i=0; i<np; i++) {174 for(G4int i=0; i<np; ++i) { 175 175 if(processName == (*plist)[i]->GetProcessName()) { 176 176 proc = (*plist)[i]; … … 182 182 << processName << "> for " << particleName << G4endl; 183 183 return; 184 185 184 } 186 185 187 186 if(mod) { 188 if(!UpdateModelEnergyRange(mod, emin, emax)) { return; }187 if(!UpdateModelEnergyRange(mod, emin, emax)) { return; } 189 188 } 190 189 // classify process -
trunk/source/processes/electromagnetic/utils/src/G4EmModelManager.cc
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4EmModelManager.cc,v 1.6 0 2010/04/12 18:28:40vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4EmModelManager.cc,v 1.63 2010/10/15 10:22:13 vnivanch Exp $ 27 // GEANT4 tag $Name: emutils-V09-03-23 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 463 463 } 464 464 } 465 /*466 G4int nm = setOfRegionModels[reg]->NumberOfModels();467 for(G4int j=0; j<nm; ++j) {468 469 G4VEmModel* model = models[setOfRegionModels[reg]->ModelIndex(j)];470 G4double tcutmin = model->MinEnergyCut(particle, couple);471 472 if(cut < tcutmin) { cut = tcutmin; }473 if(subcut < tcutmin) { subcut = tcutmin; }474 if(1 < verboseLevel) {475 G4cout << "The model # " << j476 << "; tcutmin(MeV)= " << tcutmin/MeV477 << "; tcut(MeV)= " << cut/MeV478 << "; tsubcut(MeV)= " << subcut/MeV479 << " for " << particle->GetParticleName()480 << G4endl;481 }482 }483 */484 465 theCuts[i] = cut; 485 466 if(minSubRange < 1.0) { theSubCuts[i] = subcut; } … … 656 637 void G4EmModelManager::DumpModelList(G4int verb) 657 638 { 658 if(verb == 0) return;639 if(verb == 0) { return; } 659 640 for(G4int i=0; i<nRegions; ++i) { 660 641 G4RegionModels* r = setOfRegionModels[i]; … … 665 646 << " ======" << G4endl;; 666 647 for(G4int j=0; j<n; ++j) { 667 constG4VEmModel* m = models[r->ModelIndex(j)];648 G4VEmModel* m = models[r->ModelIndex(j)]; 668 649 G4cout << std::setw(20); 669 G4cout << m->GetName() << " : Emin= " 670 << std::setw(10) << G4BestUnit(r->LowEdgeEnergy(j),"Energy") 671 << " Emax= " 672 << G4BestUnit(r->LowEdgeEnergy(j+1),"Energy") 673 << G4endl; 650 G4cout << m->GetName() << " : Emin= " 651 << std::setw(8) << G4BestUnit(r->LowEdgeEnergy(j),"Energy") 652 << " Emax= " 653 << std::setw(8) << G4BestUnit(r->LowEdgeEnergy(j+1),"Energy"); 654 G4VEmAngularDistribution* an = m->GetAngularDistribution(); 655 if(an) { G4cout << " " << an->GetName(); } 656 G4cout << G4endl; 674 657 } 675 658 } -
trunk/source/processes/electromagnetic/utils/src/G4EmMultiModel.cc
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4EmMultiModel.cc,v 1. 6 2007/05/22 17:31:58vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4EmMultiModel.cc,v 1.8 2010/08/17 17:36:59 vnivanch Exp $ 27 // GEANT4 tag $Name: emutils-V09-03-23 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 40 40 // Modifications: 41 41 // 15-04-05 optimize internal interface (V.Ivanchenko) 42 // 43 44 // Class Description: 45 // 46 // Energy loss model using several G4VEmModels 47 48 // ------------------------------------------------------------------- 42 // 04-07-10 updated interfaces according to g4 9.4 (V.Ivanchenko) 49 43 // 50 44 … … 59 53 60 54 G4EmMultiModel::G4EmMultiModel(const G4String& nam) 61 : G4VEmModel(nam), 62 nModels(0) 55 : G4VEmModel(nam), nModels(0) 63 56 { 64 57 model.clear(); 65 tsecmin.clear();66 58 cross_section.clear(); 67 59 } … … 70 62 71 63 G4EmMultiModel::~G4EmMultiModel() 64 {} 65 66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 67 68 void G4EmMultiModel::AddModel(G4VEmModel* p) 72 69 { 73 if(nModels) { 74 for(G4int i=0; i<nModels; i++) { 75 delete model[i]; 76 } 77 } 70 cross_section.push_back(0.0); 71 model.push_back(p); 72 ++nModels; 78 73 } 79 74 … … 83 78 const G4DataVector& cuts) 84 79 { 85 if(nModels) { 86 for(G4int i=0; i<nModels; i++) { 80 if(nModels > 0) { 81 G4cout << "### Initialisation of EM MultiModel " << GetName() 82 << " including following list of models:" << G4endl; 83 for(G4int i=0; i<nModels; ++i) { 84 G4cout << " " << (model[i])->GetName(); 85 (model[i])->SetParticleChange(pParticleChange, GetModelOfFluctuations()); 87 86 (model[i])->Initialise(p, cuts); 88 87 } 88 G4cout << G4endl; 89 89 } 90 }91 92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....93 94 G4double G4EmMultiModel::MinEnergyCut(const G4ParticleDefinition* p,95 const G4MaterialCutsCouple* couple)96 {97 G4double cut = DBL_MAX;98 if(nModels) {99 cut = (model[0])->MinEnergyCut(p, couple);100 }101 return cut;102 90 } 103 91 … … 106 94 G4double G4EmMultiModel::ComputeDEDX(const G4MaterialCutsCouple* couple, 107 95 const G4ParticleDefinition* p, 108 109 96 G4double kineticEnergy, 97 G4double cutEnergy) 110 98 { 111 G4double dedx = 0.0; 99 SetCurrentCouple(couple); 100 G4double dedx = 0.0; 112 101 113 if(nModels) { 114 dedx = (model[0])->ComputeDEDX(couple, p, cutEnergy, kineticEnergy); 102 if(nModels > 0) { 103 for(G4int i=0; i<nModels; i++) { 104 dedx += (model[i])->ComputeDEDX(couple, p, cutEnergy, kineticEnergy); 105 } 115 106 } 116 107 … … 120 111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 121 112 122 G4double G4EmMultiModel::CrossSection(const G4MaterialCutsCouple* couple, 123 const G4ParticleDefinition* p, 124 G4double kineticEnergy, 125 G4double cutEnergy, 126 G4double maxKinEnergy) 113 G4double G4EmMultiModel::ComputeCrossSectionPerAtom(const G4ParticleDefinition* p, 114 G4double kinEnergy, 115 G4double Z, 116 G4double A, 117 G4double cutEnergy, 118 G4double maxEnergy) 127 119 { 128 G4double cross = 0.0; 129 G4double t1 = cutEnergy; 130 G4double t2 = cutEnergy; 131 if(nModels) { 132 for(G4int i=0; i<nModels; i++) { 133 t1 = std::max(t2, tsecmin[i]); 134 t2 = std::min(maxKinEnergy, tsecmin[i+1]); 135 cross += (model[i])->CrossSection(couple, p, kineticEnergy, t1, t2); 120 G4double cross = 0.0; 121 if(nModels>0) { 122 for(G4int i=0; i<nModels; ++i) { 123 (model[i])->SetCurrentCouple(CurrentCouple()); 124 cross += (model[i])->ComputeCrossSectionPerAtom(p, kinEnergy, Z, A, 125 cutEnergy, maxEnergy); 136 126 } 137 127 } … … 144 134 const G4MaterialCutsCouple* couple, 145 135 const G4DynamicParticle* dp, 146 G4double tmin,136 G4double minEnergy, 147 137 G4double maxEnergy) 148 138 { 139 SetCurrentCouple(couple); 149 140 if(nModels > 0) { 150 141 G4int i; 151 142 G4double cross = 0.0; 152 G4double t1 = tmin; 153 G4double t2 = tmin; 154 for(i=0; i<nModels; i++) { 155 t1 = std::max(t2, tsecmin[i]); 156 t2 = std::min(maxEnergy, tsecmin[i+1]); 157 cross += (model[i])->CrossSection(couple, dp->GetDefinition(), 158 dp->GetKineticEnergy(), t1, t2); 143 for(i=0; i<nModels; ++i) { 144 cross += (model[i])->CrossSection(couple, dp->GetParticleDefinition(), 145 dp->GetKineticEnergy(), minEnergy, maxEnergy); 159 146 cross_section[i] = cross; 160 147 } 161 148 162 149 cross *= G4UniformRand(); 163 t2 = tmin;164 150 165 for(i=0; i<nModels; i++) { 166 t1 = std::max(t2, tsecmin[i]); 167 t2 = std::min(maxEnergy, tsecmin[i+1]); 151 for(i=0; i<nModels; ++i) { 168 152 if(cross <= cross_section[i]) { 169 (model[i])->SampleSecondaries(vdp, couple, dp, t1, t2);170 break;153 (model[i])->SampleSecondaries(vdp, couple, dp, minEnergy, maxEnergy); 154 return; 171 155 } 172 156 } … … 176 160 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 177 161 178 G4double G4EmMultiModel:: MaxSecondaryEnergy(const G4ParticleDefinition*,179 G4double kinEnergy)180 {181 G4cout << "Warning! G4EmMultiModel::"182 << "MaxSecondaryEnergy(const G4ParticleDefinition*,G4double kinEnergy)"183 << " should not be used!" << G4endl;184 return kinEnergy;185 }186 187 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....188 189 void G4EmMultiModel::DefineForRegion(const G4Region* r)190 {191 if(nModels) {192 for(G4int i=0; i<nModels; i++) {(model[i])->DefineForRegion(r);}193 }194 }195 196 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....197 198 void G4EmMultiModel::AddModel(G4VEmModel* p, G4double tmin, G4double tmax)199 {200 if(tmin < tmax && 0.0 < tmin) {201 202 if(nModels == 0) {203 tsecmin.push_back(tmin);204 tsecmin.push_back(tmax);205 cross_section.push_back(0.0);206 model.push_back(p);207 nModels++;208 209 } else {210 G4int i, j;211 G4bool increment = false;212 for(i=0; i<nModels; i++) {213 214 if(tmin < tsecmin[i]) {215 G4double t2 = std::min(tsecmin[i+1],tmax);216 if(tmin < t2) {217 tsecmin.push_back(0.0);218 cross_section.push_back(0.0);219 model.push_back(0);220 for(j=nModels; j>i; j--) {221 model[j] = model[j-1];222 tsecmin[j+1] = tsecmin[j];223 }224 model[i] = p;225 tsecmin[i+1] = t2;226 tsecmin[i] = tmin;227 increment = true;228 }229 } else if(i == nModels-1) {230 G4double t1 = std::min(tsecmin[i+1],tmin);231 G4double t2 = std::max(tsecmin[i+1],tmax);232 if(t1 < t2) {233 tsecmin.push_back(t2);234 cross_section.push_back(0.0);235 model.push_back(p);236 increment = true;237 }238 }239 }240 if(increment) nModels++;241 }242 }243 }244 245 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....246 -
trunk/source/processes/electromagnetic/utils/src/G4EmSaturation.cc
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4EmSaturation.cc,v 1.1 0 2009/09/25 09:16:40vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4EmSaturation.cc,v 1.11 2010/10/25 17:23:01 vnivanch Exp $ 27 // GEANT4 tag $Name: emutils-V09-03-23 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 59 59 verbose = 1; 60 60 manager = 0; 61 61 62 curMaterial = 0; 62 curBirks = 0.0;63 curRatio = 1.0;63 curBirks = 0.0; 64 curRatio = 1.0; 64 65 curChargeSq = 1.0; 65 nMaterials = 0; 66 nMaterials = 0; 67 66 68 electron = 0; 69 proton = 0; 70 nist = G4NistManager::Instance(); 71 67 72 Initialise(); 68 73 } … … 82 87 G4double niel) 83 88 { 84 if(edep <= 0.0) return 0.0;89 if(edep <= 0.0) { return 0.0; } 85 90 86 91 G4double evis = edep; … … 109 114 110 115 // continues energy loss 111 if(eloss > 0.0) eloss /= (1.0 + bfactor*eloss/length);116 if(eloss > 0.0) { eloss /= (1.0 + bfactor*eloss/length); } 112 117 113 118 // non-ionizing energy loss 114 119 if(nloss > 0.0) { 115 if(!proton) { proton = G4Proton::Proton();}120 if(!proton) { proton = G4Proton::Proton(); } 116 121 G4double escaled = nloss*curRatio; 117 122 G4double s = manager->GetRange(proton,escaled,couple)/curChargeSq; … … 133 138 // is this material in the vector? 134 139 135 for(G4int j=0; j<nG4Birks; j++) {140 for(G4int j=0; j<nG4Birks; ++j) { 136 141 if(name == g4MatNames[j]) { 137 142 if(verbose > 0) … … 152 157 if(!manager) { 153 158 manager = G4LossTableManager::Instance(); 154 nist = G4NistManager::Instance();155 159 electron= G4Electron::Electron(); 156 proton = 0; 157 } 158 159 if(mat == curMaterial) return curBirks; 160 } 161 162 if(mat == curMaterial) { return curBirks; } 160 163 161 164 curMaterial = mat; … … 165 168 166 169 // seach in the run-time list 167 for(G4int i=0; i<nMaterials; i++) {170 for(G4int i=0; i<nMaterials; ++i) { 168 171 if(mat == matPointers[i]) { 169 172 curBirks = mat->GetIonisation()->GetBirksConstant(); … … 180 183 // seach in the Geant4 list 181 184 if(curBirks == 0.0) { 182 for(G4int j=0; j<nG4Birks; j++) {185 for(G4int j=0; j<nG4Birks; ++j) { 183 186 if(name == g4MatNames[j]) { 184 187 mat->GetIonisation()->SetBirksConstant(g4MatData[j]); … … 201 204 const G4double* theAtomNumDensityVector = mat->GetVecNbOfAtomsPerVolume(); 202 205 size_t nelm = mat->GetNumberOfElements(); 203 for (size_t i=0; i<nelm; i++) {206 for (size_t i=0; i<nelm; ++i) { 204 207 const G4Element* elm = (*theElementVector)[i]; 205 208 G4double Z = elm->GetZ(); … … 231 234 if(nMaterials > 0) { 232 235 G4cout << "### Birks coeffitients used in run time" << G4endl; 233 for(G4int i=0; i<nMaterials; i++) {236 for(G4int i=0; i<nMaterials; ++i) { 234 237 G4double br = matPointers[i]->GetIonisation()->GetBirksConstant(); 235 238 G4cout << " " << matNames[i] << " " … … 248 251 if(nG4Birks > 0) { 249 252 G4cout << "### Birks coeffitients for Geant4 materials" << G4endl; 250 for(G4int i=0; i<nG4Birks; i++) {253 for(G4int i=0; i<nG4Birks; ++i) { 251 254 G4cout << " " << g4MatNames[i] << " " 252 255 << g4MatData[i]*MeV/mm << " mm/MeV" << G4endl; -
trunk/source/processes/electromagnetic/utils/src/G4LossTableManager.cc
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4LossTableManager.cc,v 1.10 1 2010/06/04 15:33:56vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4LossTableManager.cc,v 1.105 2010/11/04 12:55:09 vnivanch Exp $ 27 // GEANT4 tag $Name: emutils-V09-03-23 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 95 95 #include "G4EmSaturation.hh" 96 96 #include "G4EmConfigurator.hh" 97 #include "G4ElectronIonPair.hh" 97 98 #include "G4EmTableType.hh" 98 99 #include "G4LossTableBuilder.hh" 100 #include "G4VAtomDeexcitation.hh" 99 101 #include "G4Region.hh" 100 102 … … 140 142 delete emCorrections; 141 143 delete emSaturation; 144 delete emConfigurator; 145 delete emElectronIonPair; 146 delete atomDeexcitation; 142 147 } 143 148 … … 182 187 emSaturation = new G4EmSaturation(); 183 188 emConfigurator = new G4EmConfigurator(verbose); 189 emElectronIonPair = new G4ElectronIonPair(); 184 190 tableBuilder->SetSplineFlag(splineFlag); 191 atomDeexcitation = 0; 185 192 } 186 193 … … 438 445 emConfigurator->Clear(); 439 446 firstParticle = aParticle; 447 } 448 if(startInitialisation && atomDeexcitation) { 449 atomDeexcitation->InitialiseAtomicDeexcitation(); 440 450 } 441 451 startInitialisation = false; … … 590 600 591 601 G4int n_dedx = t_list.size(); 592 if ( !n_dedx) {602 if (0 == n_dedx || !em) { 593 603 G4cout << "G4LossTableManager WARNING: no DEDX processes for " 594 604 << aParticle->GetParticleName() << G4endl; … … 896 906 //emCorrections->SetVerbose(val); 897 907 emSaturation->SetVerbose(val); 908 emElectronIonPair->SetVerbose(val); 909 if(atomDeexcitation) { atomDeexcitation->SetVerboseLevel(val); } 898 910 } 899 911 … … 1044 1056 } 1045 1057 1058 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 1059 1060 G4ElectronIonPair* G4LossTableManager::ElectronIonPair() 1061 { 1062 return emElectronIonPair; 1063 } 1064 1046 1065 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1066 1067 G4VAtomDeexcitation* G4LossTableManager::AtomDeexcitation() 1068 { 1069 return atomDeexcitation; 1070 } 1071 1072 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1073 1074 void G4LossTableManager::SetAtomDeexcitation(G4VAtomDeexcitation* p) 1075 { 1076 atomDeexcitation = p; 1077 } 1078 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... -
trunk/source/processes/electromagnetic/utils/src/G4VEmModel.cc
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VEmModel.cc,v 1.3 5 2010/05/26 18:06:25 vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4VEmModel.cc,v 1.37 2010/10/14 16:27:35 vnivanch Exp $ 27 // GEANT4 tag $Name: emutils-V09-03-23 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 61 61 62 62 G4VEmModel::G4VEmModel(const G4String& nam): 63 fluc (0), name(nam), lowLimit(0.1*keV), highLimit(100.0*TeV),63 flucModel(0),anglModel(0), name(nam), lowLimit(0.1*keV), highLimit(100.0*TeV), 64 64 eMinActive(0.0),eMaxActive(DBL_MAX), 65 65 polarAngleLimit(0.0),secondaryThreshold(DBL_MAX),theLPMflag(false), 66 pParticleChange(0), nuclearStopping(false),66 pParticleChange(0),/*nuclearStopping(false),*/ 67 67 currentCouple(0),currentElement(0), 68 68 nsec(5),flagDeexcitation(false) … … 84 84 } 85 85 } 86 delete anglModel; 86 87 } 87 88 … … 246 247 G4double G4VEmModel::ChargeSquareRatio(const G4Track& track) 247 248 { 248 return GetChargeSquareRatio(track.Get Definition(),249 return GetChargeSquareRatio(track.GetParticleDefinition(), 249 250 track.GetMaterial(), track.GetKineticEnergy()); 250 251 } … … 296 297 297 298 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 299 300 void 301 G4VEmModel::SetParticleChange(G4VParticleChange* p, G4VEmFluctuationModel* f) 302 { 303 if(p && pParticleChange != p) { pParticleChange = p; } 304 flucModel = f; 305 } 306 307 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -
trunk/source/processes/electromagnetic/utils/src/G4VEmProcess.cc
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VEmProcess.cc,v 1.8 7 2010/05/10 13:35:32vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4VEmProcess.cc,v 1.88 2010/08/17 17:36:59 vnivanch Exp $ 27 // GEANT4 tag $Name: emutils-V09-03-23 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 516 516 for (G4int i=0; i<num; ++i) { 517 517 G4DynamicParticle* dp = secParticles[i]; 518 const G4ParticleDefinition* p = dp->Get Definition();518 const G4ParticleDefinition* p = dp->GetParticleDefinition(); 519 519 G4double e = dp->GetKineticEnergy(); 520 520 G4bool good = true; -
trunk/source/processes/electromagnetic/utils/src/G4VEnergyLossProcess.cc
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VEnergyLossProcess.cc,v 1.1 67 2010/05/26 10:41:34vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4VEnergyLossProcess.cc,v 1.171 2010/10/15 10:22:13 vnivanch Exp $ 27 // GEANT4 tag $Name: emutils-V09-03-23 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 108 108 // 27-10-07 Virtual functions moved to source (V.Ivanchenko) 109 109 // 24-06-09 Removed hidden bin in G4PhysicsVector (V.Ivanchenko) 110 // 15-10-10 Fixed 4-momentum balance if deexcitation is active (L.Pandola) 110 111 // 111 112 // Class Description: … … 144 145 #include "G4TransportationManager.hh" 145 146 #include "G4EmConfigurator.hh" 147 #include "G4VAtomDeexcitation.hh" 146 148 147 149 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... … … 222 224 (G4LossTableManager::Instance())->Register(this); 223 225 fluctModel = 0; 226 atomDeexcitation = 0; 224 227 225 228 scTracks.reserve(5); … … 570 573 571 574 // Added tracking cut to avoid tracking artifacts 572 if(isIonisation) { fParticleChange.SetLowEnergyLimit(lowestKinEnergy); } 575 if(isIonisation) { 576 fParticleChange.SetLowEnergyLimit(lowestKinEnergy); 577 atomDeexcitation = G4LossTableManager::Instance()->AtomDeexcitation(); 578 if(atomDeexcitation) { useDeexcitation = true; } 579 } 573 580 574 581 if(1 < verboseLevel) { … … 852 859 for (G4int i=0; i<nDERegions; ++i) { 853 860 if (reg == deRegions[i]) { 854 if(!val) deRegions[i] = 0;861 if(!val) { deRegions[i] = 0; } 855 862 return; 856 863 } … … 911 918 DefineMaterial(track.GetMaterialCutsCouple()); 912 919 913 const G4ParticleDefinition* currPart = track.Get Definition();920 const G4ParticleDefinition* currPart = track.GetParticleDefinition(); 914 921 if(theGenericIon == particle) { 915 922 massRatio = proton_mass_c2/currPart->GetPDGMass(); … … 999 1006 /* 1000 1007 if(-1 < verboseLevel) { 1001 const G4ParticleDefinition* d = track.Get Definition();1008 const G4ParticleDefinition* d = track.GetParticleDefinition(); 1002 1009 G4cout << "AlongStepDoIt for " 1003 1010 << GetProcessName() << " and particle " … … 1019 1026 eloss = preStepKinEnergy; 1020 1027 if (useDeexcitation) { 1021 if(idxDERegions[currentMaterialIndex]) { 1028 if(atomDeexcitation) { 1029 atomDeexcitation->AlongStepDeexcitation(&fParticleChange, step, 1030 eloss, currentMaterialIndex); 1031 } else if(idxDERegions[currentMaterialIndex]) { 1022 1032 currentModel->SampleDeexcitationAlongStep(currentMaterial, track, eloss); 1023 if(eloss < 0.0) eloss = 0.0; 1024 }1033 } 1034 if(eloss < 0.0) { eloss = 0.0; } 1025 1035 } 1026 1036 fParticleChange.SetProposedKineticEnergy(0.0); … … 1128 1138 G4Track* t = scTracks[i]; 1129 1139 G4double e = t->GetKineticEnergy(); 1130 if (t->GetDefinition() == thePositron) { e += 2.0*electron_mass_c2; } 1140 if (t->GetParticleDefinition() == thePositron) { 1141 e += 2.0*electron_mass_c2; 1142 } 1131 1143 esec += e; 1132 1144 pParticleChange->AddSecondary(t); … … 1169 1181 // deexcitation 1170 1182 if (useDeexcitation) { 1171 if(idxDERegions[currentMaterialIndex] && eloss > 0.0) { 1183 G4double eloss_before = eloss; 1184 if(atomDeexcitation) { 1185 atomDeexcitation->AlongStepDeexcitation(&fParticleChange, step, 1186 eloss, currentMaterialIndex); 1187 } else if(idxDERegions[currentMaterialIndex] && eloss > 0.0) { 1172 1188 currentModel->SampleDeexcitationAlongStep(currentMaterial, track, eloss); 1173 if(eloss < 0.0) { eloss = 0.0;}1174 }1189 } 1190 esec += eloss_before - eloss; 1175 1191 } 1176 1192 … … 1178 1194 G4double finalT = preStepKinEnergy - eloss - esec; 1179 1195 if (finalT <= lowestKinEnergy) { 1180 eloss = preStepKinEnergy - esec;1196 eloss += finalT; 1181 1197 finalT = 0.0; 1182 1198 } else if(isIon) { 1183 1199 fParticleChange.SetProposedCharge( 1184 currentModel->GetParticleCharge(track.GetDefinition(),currentMaterial,finalT)); 1185 } 1186 1200 currentModel->GetParticleCharge(track.GetParticleDefinition(), 1201 currentMaterial,finalT)); 1202 } 1203 1204 if(eloss < 0.0) { eloss = 0.0; } 1187 1205 fParticleChange.SetProposedKineticEnergy(finalT); 1188 1206 fParticleChange.ProposeLocalEnergyDeposit(eloss); … … 1260 1278 /* 1261 1279 // do not track very low-energy delta-electrons 1262 if(theSecondaryRangeTable && (*it)->Get Definition() == theElectron) {1280 if(theSecondaryRangeTable && (*it)->GetParticleDefinition() == theElectron) { 1263 1281 G4double ekin = (*it)->GetKineticEnergy(); 1264 1282 G4double rg = ((*theSecondaryRangeTable)[idx]->Value(ekin)); … … 1278 1296 /* 1279 1297 if(-1 < verboseLevel) 1280 G4cout << "New track " << t->Get Definition()->GetParticleName()1298 G4cout << "New track " << t->GetParticleDefinition()->GetParticleName() 1281 1299 << " e(keV)= " << t->GetKineticEnergy()/keV 1282 1300 << " fragment= " << fragment … … 1293 1311 const G4Step&) 1294 1312 { 1313 // In all cases clear number of interaction lengths 1314 theNumberOfInteractionLengthLeft = -1.0; 1315 1295 1316 fParticleChange.InitializeForPostStep(track); 1296 1317 G4double finalT = track.GetKineticEnergy(); 1297 if(finalT <= lowestKinEnergy) return &fParticleChange;1318 if(finalT <= lowestKinEnergy) { return &fParticleChange; } 1298 1319 1299 1320 G4double postStepScaledEnergy = finalT*massRatio; … … 1321 1342 } 1322 1343 */ 1323 if(preStepLambda*G4UniformRand() > lx) { 1324 ClearNumberOfInteractionLengthLeft(); 1344 if(lx <= 0.0) { 1345 return &fParticleChange; 1346 } else if(preStepLambda*G4UniformRand() > lx) { 1325 1347 return &fParticleChange; 1326 1348 } … … 1360 1382 } 1361 1383 */ 1362 ClearNumberOfInteractionLengthLeft();1363 1384 return &fParticleChange; 1364 1385 } -
trunk/source/processes/electromagnetic/utils/src/G4VMscModel.cc
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VMscModel.cc,v 1.1 6 2010/04/06 09:24:46vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4VMscModel.cc,v 1.18 2010/09/07 16:05:33 vnivanch Exp $ 27 // GEANT4 tag $Name: emutils-V09-03-23 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 64 64 dtrl(0.05), 65 65 lambdalimit(mm), 66 geommax(1.e50*mm), 66 geomMin(1.e-6*CLHEP::mm), 67 geomMax(1.e50*CLHEP::mm), 67 68 steppingAlgorithm(fUseSafety), 68 69 samplez(false), … … 106 107 G4double postsafety) 107 108 { 109 if(displacement <= geomMin) { return; } 108 110 const G4ThreeVector* pos = fParticleChange->GetProposedPosition(); 109 G4double r = displacement; 110 if(r > postsafety) { 111 G4double newsafety = safetyHelper->ComputeSafety(*pos); 112 if(r > newsafety) r = newsafety; 111 112 // displaced point is definitely within the volume 113 if(displacement < postsafety) { 114 115 // compute new endpoint of the Step 116 G4ThreeVector newPosition = *pos + displacement*dir; 117 safetyHelper->ReLocateWithinVolume(newPosition); 118 fParticleChange->ProposePosition(newPosition); 119 return; 113 120 } 114 if(r > 0.) { 121 122 // displaced point may be outside the volume 123 G4double newsafety = safetyHelper->ComputeSafety(*pos); 124 125 // add a factor which ensure numerical stability 126 G4double r = std::min(displacement, newsafety*0.99); 127 128 if(r > geomMin) { 115 129 116 130 // compute new endpoint of the Step 117 131 G4ThreeVector newPosition = *pos + r*dir; 118 119 // definitely not on boundary 120 if(displacement == r) { 121 safetyHelper->ReLocateWithinVolume(newPosition); 122 123 } else { 124 // check safety after displacement 125 G4double postsafety = safetyHelper->ComputeSafety(newPosition); 126 127 // displacement to boundary 128 if(postsafety <= 0.0) { 129 safetyHelper->Locate(newPosition, 130 *fParticleChange->GetProposedMomentumDirection()); 131 132 // not on the boundary 133 } else { 134 safetyHelper->ReLocateWithinVolume(newPosition); 135 } 136 } 132 safetyHelper->ReLocateWithinVolume(newPosition); 137 133 fParticleChange->ProposePosition(newPosition); 138 134 } -
trunk/source/processes/electromagnetic/utils/src/G4VMultipleScattering.cc
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VMultipleScattering.cc,v 1.8 2 2010/04/12 11:45:03vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4VMultipleScattering.cc,v 1.86 2010/10/26 11:30:46 vnivanch Exp $ 27 // GEANT4 tag $Name: emutils-V09-03-23 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 294 294 if(verboseLevel>0 && ( num == "e-" || num == "mu+" || 295 295 num == "proton" || num == "pi-" || 296 num == " GenericIon")) {296 num == "kaon+" || num == "GenericIon")) { 297 297 PrintInfoDefinition(); 298 298 if(2 < verboseLevel && theLambdaTable) G4cout << *theLambdaTable << G4endl; … … 348 348 DefineMaterial(track.GetMaterialCutsCouple()); 349 349 G4double ekin = track.GetKineticEnergy(); 350 if(isIon) { ekin *= proton_mass_c2/track.Get Definition()->GetPDGMass(); }350 if(isIon) { ekin *= proton_mass_c2/track.GetParticleDefinition()->GetPDGMass(); } 351 351 currentModel = static_cast<G4VMscModel*>(SelectModel(ekin)); 352 352 if(x > 0.0 && ekin > 0.0 && currentModel->IsActive(ekin)) { 353 353 G4double tPathLength = 354 354 currentModel->ComputeTruePathLengthLimit(track, theLambdaTable, x); 355 if (tPathLength < x) *selection = CandidateForSelection;355 if (tPathLength < x) { *selection = CandidateForSelection; } 356 356 x = currentModel->ComputeGeomPathLength(tPathLength); 357 357 // G4cout << "tPathLength= " << tPathLength … … 404 404 G4double& currentSafety) 405 405 { 406 G4GPILSelection* selection = 0; 407 return AlongStepGetPhysicalInteractionLength(track,previousStepSize,currentMinimalStep, 408 currentSafety, selection); 406 G4GPILSelection selection = NotCandidateForSelection; 407 G4double x = AlongStepGetPhysicalInteractionLength(track,previousStepSize, 408 currentMinimalStep, 409 currentSafety, &selection); 410 return x; 409 411 } 410 412
Note: See TracChangeset
for help on using the changeset viewer.