Changeset 1315 for trunk/source/processes/hadronic/models/de_excitation/photon_evaporation/src/G4VGammaDeexcitation.cc
- Timestamp:
- Jun 18, 2010, 11:42:07 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/hadronic/models/de_excitation/photon_evaporation/src/G4VGammaDeexcitation.cc
r819 r1315 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VGammaDeexcitation.cc,v 1.17 2010/05/09 17:31:23 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 26 28 // 27 29 // ------------------------------------------------------------------- … … 45 47 // Added creation time evaluation for products of evaporation 46 48 // 49 // 19 April 2010, J. M. Quesada calculations in CM system 50 // pending final boost to lab system (not critical) 51 // 52 // 23 April 2010, V.Ivanchenko rewite kinematic part using PDG formula 53 // for 2-body decay 47 54 // 48 55 // ------------------------------------------------------------------- … … 64 71 #include "G4DiscreteGammaTransition.hh" 65 72 73 66 74 G4VGammaDeexcitation::G4VGammaDeexcitation(): _transition(0), _verbose(0), 67 75 _electronO (0), _vSN(-1) 68 76 { } 69 77 70 71 78 G4VGammaDeexcitation::~G4VGammaDeexcitation() 72 79 { 73 // if (_transition != 0) delete _transition; 74 } 75 80 if (_transition != 0) { delete _transition; } 81 } 76 82 77 83 G4FragmentVector* G4VGammaDeexcitation::DoTransition() 78 84 { 79 // Template method 80 81 Initialize(); 82 G4FragmentVector* products = new G4FragmentVector; 83 85 Initialize(); 86 G4FragmentVector* products = new G4FragmentVector(); 87 84 88 if (CanDoTransition()) 85 89 { 86 G4Fragment* gamma = GenerateGamma(); 87 if (gamma != 0) 88 { 89 products->push_back(gamma); 90 UpdateNucleus(gamma); 91 Update(); 92 } 93 } 94 95 if (_verbose > 1) 90 G4Fragment* gamma = GenerateGamma(); 91 if (gamma != 0) { products->push_back(gamma); } 92 } 93 94 if (_verbose > 1) { 96 95 G4cout << "G4VGammaDeexcitation::DoTransition - Transition deleted " << G4endl; 97 98 if (_transition != 0) delete _transition; 99 96 } 97 100 98 return products; 101 99 } … … 103 101 G4FragmentVector* G4VGammaDeexcitation::DoChain() 104 102 { 103 if (_verbose > 1) { G4cout << "G4VGammaDeexcitation::DoChain" << G4endl; } 104 const G4double tolerance = CLHEP::keV; 105 105 106 Initialize(); 106 G4FragmentVector* products = new G4FragmentVector ;107 107 G4FragmentVector* products = new G4FragmentVector(); 108 108 109 while (CanDoTransition()) 109 { 110 if (_verbose > 5) G4cout << "G4VGammaDeexcitation::DoChain - Looping" << G4endl; 111 110 { 111 _transition->SetEnergyFrom(_nucleus->GetExcitationEnergy()); 112 112 G4Fragment* gamma = GenerateGamma(); 113 113 if (gamma != 0) 114 114 { 115 115 products->push_back(gamma); 116 UpdateNucleus(gamma); 117 UpdateElectrons (); 116 //G4cout << "Eex(keV)= " << _nucleus->GetExcitationEnergy()/keV << G4endl; 117 if(_nucleus->GetExcitationEnergy() <= tolerance) { break; } 118 Update(); 118 119 } 119 Update();120 120 } 121 122 if (_verbose > 1) 123 G4cout << "G4VGammaDeexcitation::DoChain - Transition deleted, end of chain " << G4endl; 124 125 if (_transition != 0) delete _transition; 121 122 if (_verbose > 1) { 123 G4cout << "G4VGammaDeexcitation::DoChain - Transition deleted, end of chain " << G4endl; 124 } 126 125 127 126 return products; 128 127 } 129 128 130 131 const G4Fragment& G4VGammaDeexcitation::GetNucleus() const132 {133 return _nucleus;134 }135 136 137 void G4VGammaDeexcitation::SetNucleus(const G4Fragment& nucleus)138 {139 _nucleus = G4Fragment(nucleus);140 }141 142 143 129 G4Fragment* G4VGammaDeexcitation::GenerateGamma() 144 130 { 131 // 23/04/10 V.Ivanchenko rewrite complitely 145 132 G4double eGamma = 0.; 146 133 147 134 if (_transition != 0) { 148 135 _transition->SelectGamma(); // it can be conversion electron too 149 136 eGamma = _transition->GetGammaEnergy(); 150 } 137 if(eGamma <= 0.0) { return 0; } 138 } 139 G4double excitation = _nucleus->GetExcitationEnergy() - eGamma; 140 if(excitation < 0.0) { excitation = 0.0; } 151 141 if (_verbose > 1 && _transition != 0 ) 152 142 { 153 G4cout << "G4VGammaDeexcitation::GenerateGamma - Gamma energy" << eGamma154 << " ** New excitation " << _nucleus.GetExcitationEnergy() - eGamma143 G4cout << "G4VGammaDeexcitation::GenerateGamma - Edeexc(MeV)= " << eGamma 144 << " ** left Eexc(MeV)= " << excitation 155 145 << G4endl; 156 146 } 157 147 158 // Photon momentum isotropically generated 159 // the same for electron 160 161 if (eGamma > 0.) 162 { 163 G4double cosTheta = 1. - 2. * G4UniformRand(); 164 G4double sinTheta = std::sqrt(1. - cosTheta * cosTheta); 165 G4double phi = twopi * G4UniformRand(); 166 G4double pM = eGamma; 167 G4DiscreteGammaTransition* dtransition = 0; 168 dtransition = dynamic_cast <G4DiscreteGammaTransition*> (_transition); 169 if ( dtransition && !( dtransition->IsAGamma()) ) { 170 G4double eMass = G4Electron::ElectronDefinition()->GetPDGMass(); 171 pM =std::sqrt(eGamma*(eGamma + 2.0*eMass)); 172 eGamma = eGamma + eMass; 173 } 174 G4ThreeVector pGamma( pM * sinTheta * std::cos(phi), 175 pM * sinTheta * std::sin(phi), 176 pM * cosTheta ); 177 G4LorentzVector gamma(pGamma, eGamma); 178 // gamma.boost(_nucleus.GetMomentum().boostVector() ); 179 G4Fragment* gammaFragment ; 180 if ( dtransition && !(dtransition->IsAGamma()) ){ 181 gammaFragment = new G4Fragment(gamma,G4Electron::ElectronDefinition()); 182 } else { 183 gammaFragment = new G4Fragment(gamma,G4Gamma::GammaDefinition()); 184 } 185 G4double gammaTime = _transition->GetGammaCreationTime(); 186 gammaTime += _nucleus.GetCreationTime(); 187 gammaFragment->SetCreationTime(gammaTime); 188 189 if (_verbose > 1 && dtransition ) 190 G4cout << "G4VGammaDeexcitation::GenerateGamma - Gamma fragment generated: " 191 << (dtransition->IsAGamma() ? " Gamma" : " Electron" ) << G4endl; 192 return gammaFragment; 193 } 194 else 195 { 196 return 0; 197 } 198 } 199 200 void G4VGammaDeexcitation::UpdateNucleus(const G4Fragment* gamma) 201 { 202 G4LorentzVector p4Gamma = gamma->GetMomentum(); 203 G4ThreeVector pGamma(p4Gamma.vect()); 204 205 G4double eGamma = 0.; 206 if (_transition != 0) 207 eGamma = _transition->GetGammaEnergy(); 148 // Do complete Lorentz computation 149 150 G4LorentzVector lv = _nucleus->GetMomentum(); 151 G4double Mass = _nucleus->GetGroundStateMass() + excitation; 152 153 // select secondary 154 G4ParticleDefinition* gamma = G4Gamma::Gamma(); 155 208 156 G4DiscreteGammaTransition* dtransition = 0; 209 157 dtransition = dynamic_cast <G4DiscreteGammaTransition*> (_transition); 210 if (dtransition && !(dtransition->IsAGamma()) ) 211 eGamma += dtransition->GetBondEnergy(); 212 213 G4LorentzVector p4Nucleus(_nucleus.GetMomentum() ); 214 215 // New tetravector calculation: 216 217 // G4double Mass = G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(_nucleus.GetZ(),_nucleus.GetA()); 218 G4double m1 = G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(static_cast<G4int>(_nucleus.GetZ()), 219 static_cast<G4int>(_nucleus.GetA())); 220 G4double m2 = _nucleus.GetZ() * G4Proton::Proton()->GetPDGMass() + 221 (_nucleus.GetA()- _nucleus.GetZ())*G4Neutron::Neutron()->GetPDGMass(); 222 223 G4double Mass = std::min(m1,m2); 224 225 226 G4double newExcitation = p4Nucleus.mag() - Mass - eGamma; 227 if(newExcitation < 0) 228 newExcitation = 0; 229 230 G4ThreeVector p3Residual(p4Nucleus.vect() - pGamma); 231 G4double newEnergy = std::sqrt(p3Residual * p3Residual + 232 (Mass + newExcitation) * (Mass + newExcitation)); 233 G4LorentzVector p4Residual(p3Residual, newEnergy); 234 235 // G4LorentzVector p4Residual(-pGamma, p4Nucleus.e() - eGamma); 236 // p4Residual.boost( _nucleus.GetMomentum().boostVector() ); 237 238 // Update excited nucleus parameters 239 240 _nucleus.SetMomentum(p4Residual); 241 _nucleus.SetCreationTime(gamma->GetCreationTime()); 242 243 // if (_transition != 0) 244 // { 245 // G4double excitation =_transition->GetEnergyTo(); 246 // if (excitation < 0.) excitation = 0.0; 247 // _nucleus.SetExcitationEnergy(excitation); 248 // } 249 250 return; 251 } 252 253 void G4VGammaDeexcitation::UpdateElectrons( ) 254 { 255 G4DiscreteGammaTransition* dtransition = 0; 256 dtransition = dynamic_cast <G4DiscreteGammaTransition*> (_transition); 257 if (dtransition && !(dtransition->IsAGamma()) ) { 258 158 if ( dtransition && !( dtransition->IsAGamma()) ) { 159 gamma = G4Electron::Electron(); 259 160 _vSN = dtransition->GetOrbitNumber(); 260 161 _electronO.RemoveElectron(_vSN); 261 } 262 return; 162 lv += G4LorentzVector(0.0,0.0,0.0,CLHEP::electron_mass_c2 - dtransition->GetBondEnergy()); 163 } 164 165 // check consistency 166 G4double eMass = gamma->GetPDGMass(); 167 168 G4double Ecm = lv.mag(); 169 G4ThreeVector bst = lv.boostVector(); 170 171 G4double GammaEnergy = 0.5*((Ecm - Mass)*(Ecm + Mass) + eMass*eMass)/Ecm; 172 if(GammaEnergy <= eMass) { return 0; } 173 174 G4double cosTheta = 1. - 2. * G4UniformRand(); 175 G4double sinTheta = std::sqrt(1. - cosTheta * cosTheta); 176 G4double phi = twopi * G4UniformRand(); 177 G4double mom = sqrt((GammaEnergy - eMass)*(GammaEnergy + eMass)); 178 G4LorentzVector Gamma4P(mom * sinTheta * std::cos(phi), 179 mom * sinTheta * std::sin(phi), 180 mom * cosTheta, 181 GammaEnergy); 182 Gamma4P.boost(bst); 183 G4Fragment * thePhoton = new G4Fragment(Gamma4P,gamma); 184 185 G4double gammaTime = _nucleus->GetCreationTime() + _transition->GetGammaCreationTime(); 186 thePhoton->SetCreationTime(gammaTime); 187 188 lv -= Gamma4P; 189 _nucleus->SetMomentum(lv); 190 _nucleus->SetCreationTime(gammaTime); 191 192 //G4cout << "G4VGammaDeexcitation::GenerateGamma left nucleus: " << _nucleus << G4endl; 193 return thePhoton; 263 194 } 264 195 … … 269 200 delete _transition; 270 201 _transition = 0; 271 if (_verbose > 1) 202 if (_verbose > 1) { 272 203 G4cout << "G4VGammaDeexcitation::Update - Transition deleted " << G4endl; 273 } 274 204 } 205 } 206 275 207 _transition = CreateTransition(); 276 208 if (_transition != 0) 277 209 { 278 _transition->SetEnergyFrom(_nucleus .GetExcitationEnergy());279 // 210 _transition->SetEnergyFrom(_nucleus->GetExcitationEnergy()); 211 // if ( _vSN != -1) (dynamic_cast <G4DiscreteGammaTransition*> (_transition))->SetICM(false); 280 212 // the above line is commented out for bug fix #952. It was intruduced for reason that 281 213 // the k-shell electron is most likely one to be kicked out and there is no time for … … 283 215 // reported in #952 284 216 } 285 217 286 218 return; 287 219 } 288 289 290 void G4VGammaDeexcitation::Initialize()291 {292 _transition = CreateTransition();293 if (_transition != 0) {294 _transition->SetEnergyFrom(_nucleus.GetExcitationEnergy());295 }296 return;297 }298 299 300 void G4VGammaDeexcitation::SetVerboseLevel(G4int verbose)301 {302 _verbose = verbose;303 return;304 }305 306 307 308 309 310
Note: See TracChangeset
for help on using the changeset viewer.