Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4ParticleHPInelasticBaseFS.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// particle_hp -- source file
27// J.P. Wellisch, Nov-1996
28// A prototype of the low energy neutron transport model.
29//
30// 080801 Give a warning message for irregular mass value in data file by T. Koi
31// Introduce theNDLDataA,Z which has A and Z of NDL data by T. Koi
32// 081024 G4NucleiPropertiesTable:: to G4NucleiProperties::
33// 101111 Add Special treatment for Be9(n,2n)Be8(2a) case by T. Koi
34//
35// P. Arce, June-2014 Conversion neutron_hp to particle_hp
36//
37// June-2019 - E. Mendoza --> Added protection against residual with Z<0 or A<Z + adjust_final_state is not applied when data is in MF=6 format (no correlated particle emission) + bug correction (add Q value info to G4ParticleHPNBodyPhaseSpace).
38
39
42#include "G4Nucleus.hh"
43#include "G4NucleiProperties.hh"
44#include "G4He3.hh"
45#include "G4Alpha.hh"
46#include "G4Electron.hh"
48#include "G4IonTable.hh"
49
51{
52 std::ostringstream ost;
53 ost <<gammaPath<<"z"<<ZR<<".a"<<AR;
54 G4String aName = ost.str();
55 std::ifstream from(aName, std::ios::in);
56
57 if(!from) return; // no data found for this isotope
58 std::ifstream theGammaData(aName, std::ios::in);
59
60 G4double eps = 0.001;
62 G4NucleiProperties::GetBindingEnergy(static_cast<G4int>(AR+eps),static_cast<G4int>(ZR+eps)) -
63 G4NucleiProperties::GetBindingEnergy(static_cast<G4int>(theBaseA+eps), static_cast<G4int>(theBaseZ+eps));
64 theGammas.Init(theGammaData);
65}
66
68{
69 gammaPath = "/Inelastic/Gammas/";
70 if(!G4FindDataDir("G4NEUTRONHPDATA"))
71 throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files where Inelastic/Gammas data is found.");
72 G4String tBase = G4FindDataDir("G4NEUTRONHPDATA");
73 gammaPath = tBase+gammaPath;
74 G4String tString = dirName;
75 G4bool dbool;
76 G4ParticleHPDataUsed aFile = theNames.GetName(static_cast<G4int>(A), static_cast<G4int>(Z), M,tString, bit, dbool);
77 G4String filename = aFile.GetName();
78#ifdef G4PHPDEBUG
79 if( std::getenv("G4ParticleHPDebug") ) G4cout << " G4ParticleHPInelasticBaseFS::Init FILE " << filename << G4endl;
80#endif
81 SetAZMs( A, Z, M, aFile);
82
83 if ( !dbool || ( Z<2.5 && ( std::abs(theNDLDataZ - Z)>0.0001 || std::abs(theNDLDataA - A)>0.0001)) )
84 {
85#ifdef G4PHPDEBUG
86 if(std::getenv("G4ParticleHPDebug_NamesLogging")) G4cout << "Skipped = "<< filename <<" "<<A<<" "<<Z<<G4endl;
87#endif
88 hasAnyData = false;
89 hasFSData = false;
90 hasXsec = false;
91 return;
92 }
93
94 std::istringstream theData(std::ios::in);
96
97 if(!theData) //"!" is a operator of ios
98 {
99 hasAnyData = false;
100 hasFSData = false;
101 hasXsec = false;
102 // theData.close();
103 return; // no data for exactly this isotope and FS
104 }
105 // here we go
106 G4int infoType, dataType, dummy=INT_MAX;
107 hasFSData = false;
108 while (theData >> infoType) // Loop checking, 11.05.2015, T. Koi
109 {
110 theData >> dataType;
111
112 if(dummy==INT_MAX) theData >> Qvalue >> dummy;
113 Qvalue*=CLHEP::eV;
114 // In G4NDL4.5 this value is the MT number (<1000),
115 // in others is que Q-value in eV
116
117 if(dataType==3)
118 {
119 G4int total;
120 theData >> total;
121 theXsection->Init(theData, total, CLHEP::eV);
122 }
123 else if(dataType==4)
124 {
127 hasFSData = true;
128 }
129 else if(dataType==5)
130 {
132 theEnergyDistribution->Init(theData);
133 hasFSData = true;
134 }
135 else if(dataType==6)
136 {
138 theEnergyAngData->Init(theData);
139 hasFSData = true;
140 }
141 else if(dataType==12)
142 {
145 hasFSData = true;
146 }
147 else if(dataType==13)
148 {
151 hasFSData = true;
152 }
153 else if(dataType==14)
154 {
156 hasFSData = true;
157 }
158 else if(dataType==15)
159 {
161 hasFSData = true;
162 }
163 else
164 {
165 throw G4HadronicException(__FILE__, __LINE__, "Data-type unknown to G4ParticleHPInelasticBaseFS");
166 }
167 }
168}
169
171 G4ParticleDefinition ** theDefs,
172 G4int nDef)
173{
174 // prepare neutron
175 if ( theResult.Get() == NULL ) theResult.Put( new G4HadFinalState );
176 theResult.Get()->Clear();
177 G4double eKinetic = theTrack.GetKineticEnergy();
178 const G4HadProjectile *hadProjectile = &theTrack;
179 G4ReactionProduct incidReactionProduct( const_cast<G4ParticleDefinition *>(hadProjectile->GetDefinition()) );
180 incidReactionProduct.SetMomentum( hadProjectile->Get4Momentum().vect() );
181 incidReactionProduct.SetKineticEnergy( eKinetic );
182
183 // prepare target
184 G4double targetMass;
185 G4double eps = 0.0001;
186 targetMass = ( G4NucleiProperties::GetNuclearMass(static_cast<G4int>(theBaseA+eps), static_cast<G4int>(theBaseZ+eps))) /
187 //theProjectile->GetPDGMass();
189
190 // give priority to ENDF vales for target mass
191 if(theEnergyAngData!=0)
192 { targetMass = theEnergyAngData->GetTargetMass(); }
194 { targetMass = theAngularDistribution->GetTargetMass(); }
195
196 // 110512 TKDB ENDF-VII.0 21Sc45 has trouble in MF4MT22 (n,np) targetMass is not properly recorded.
197 if ( targetMass == 0 )
198 {
199 //G4cout << "TKDB targetMass = 0; ENDF-VII.0 21Sc45 has trouble in MF4MT22 (n,np) targetMass is not properly recorded. This could be a similar situation." << G4endl;
200 //targetMass = ( G4NucleiProperties::GetNuclearMass(static_cast<G4int>(theBaseA+eps), static_cast<G4int>(theBaseZ+eps))) / theProjectile->GetPDGMass();
201 targetMass = ( G4NucleiProperties::GetNuclearMass(static_cast<G4int>(theBaseA+eps), static_cast<G4int>(theBaseZ+eps))) / G4Neutron::Neutron()->GetPDGMass();
202 }
203
204 G4Nucleus aNucleus;
205 G4ReactionProduct theTarget;
206
207 G4ThreeVector neuVelo = (1./G4Neutron::Neutron()->GetPDGMass())*incidReactionProduct.GetMomentum();
208 theTarget = aNucleus.GetBiasedThermalNucleus( targetMass, neuVelo, theTrack.GetMaterial()->GetTemperature());
209
211
212 // prepare energy in target rest frame
213 G4ReactionProduct boosted;
214 boosted.Lorentz(incidReactionProduct, theTarget);
215 eKinetic = boosted.GetKineticEnergy();
216 G4double orgMomentum = boosted.GetMomentum().mag();
217
218 // Take N-body phase-space distribution, if no other data present.
219 if(!HasFSData()) // adding the residual is trivial here @@@
220 {
221 G4ParticleHPNBodyPhaseSpace thePhaseSpaceDistribution;
222 G4double aPhaseMass=0;
223 G4int ii;
224 for(ii=0; ii<nDef; ++ii)
225 {
226 aPhaseMass+=theDefs[ii]->GetPDGMass();
227 }
228
229 //----------------------------------------------------------------------------
230 if(Qvalue<1.*CLHEP::keV && Qvalue>-1.*CLHEP::keV) {
231 // Not in the G4NDL lib or not calculated yet:
232
233 // Calculate residual:
234 G4int ResidualA=theBaseA;
235 G4int ResidualZ=theBaseZ;
236 for (ii = 0; ii < nDef; ++ii) {
237 ResidualZ -= theDefs[ii]->GetAtomicNumber();
238 ResidualA -= theDefs[ii]->GetBaryonNumber();
239 }
240
241 if (ResidualA > 0 && ResidualZ > 0) {
242 G4ParticleDefinition* resid = G4IonTable::GetIonTable()->GetIon(ResidualZ,ResidualA);
243 Qvalue = incidReactionProduct.GetMass()+theTarget.GetMass()-aPhaseMass-resid->GetPDGMass();
244 }
245
246 if (Qvalue > 400*CLHEP::MeV || Qvalue < -400*CLHEP::MeV) {
247 //Then Q value is probably too large ...
248 Qvalue = 1.1*CLHEP::keV;
249 }
250 }
251 //----------------------------------------------------------------------------
252
253 thePhaseSpaceDistribution.Init(aPhaseMass, nDef);
254 thePhaseSpaceDistribution.SetProjectileRP(&incidReactionProduct);
255 thePhaseSpaceDistribution.SetTarget(&theTarget);
256 thePhaseSpaceDistribution.SetQValue(Qvalue);
257
258 for(ii=0; ii<nDef; ++ii)
259 {
260 G4double massCode = 1000.*std::abs(theDefs[ii]->GetPDGCharge());
261 massCode += theDefs[ii]->GetBaryonNumber();
262 G4double dummy = 0;
263 G4ReactionProduct * aSec = thePhaseSpaceDistribution.Sample(eKinetic, massCode, dummy);
264 aSec->Lorentz(*aSec, -1.*theTarget);
265 G4DynamicParticle * aPart = new G4DynamicParticle();
266 aPart->SetDefinition(aSec->GetDefinition());
267 aPart->SetMomentum(aSec->GetMomentum());
268 delete aSec;
269 theResult.Get()->AddSecondary(aPart, secID);
270#ifdef G4PHPDEBUG
271 if( std::getenv("G4ParticleHPDebug"))
272 G4cout << this
273 << " G4ParticleHPInelasticBaseFS::BaseApply NoFSData add secondary "
275 << " E= " << aPart->GetKineticEnergy() << " NSECO "
277#endif
278 }
280 // Final momentum check should be done before return
282 G4LorentzVector targ_4p_lab ( theTarget.GetMomentum() , std::sqrt( targ_pd->GetPDGMass()*targ_pd->GetPDGMass() + theTarget.GetMomentum().mag2() ) );
283 G4LorentzVector proj_4p_lab = theTrack.Get4Momentum();
284 G4LorentzVector init_4p_lab = proj_4p_lab + targ_4p_lab;
285 adjust_final_state ( init_4p_lab );
286
287 return;
288 }
289
290 // set target and neutron in the relevant exit channel
292 {
294 theAngularDistribution->SetProjectileRP(incidReactionProduct);
295 }
296 else if(theEnergyAngData!=0)
297 {
298 theEnergyAngData->SetTarget(theTarget);
299 theEnergyAngData->SetProjectileRP(incidReactionProduct);
300 }
301
302 G4ReactionProductVector * tmpHadrons = 0;
303#ifdef G4PHPDEBUG
304 //To avoid compilation error around line 532.
305 G4int ii(0);
306#endif
307 G4int dummy;
308 std::size_t i;
309
310 if(theEnergyAngData != 0)
311 {
312 tmpHadrons = theEnergyAngData->Sample(eKinetic);
313
314 if ( ! G4ParticleHPManager::GetInstance()->GetDoNotAdjustFinalState() ) {
315 // Adjust A and Z in the case of miss much between selected data and target nucleus
316 if ( tmpHadrons != nullptr ) {
317 G4int sumA = 0;
318 G4int sumZ = 0;
319 G4int maxA = 0;
320 G4int jAtMaxA = 0;
321 for ( G4int j = 0 ; j != (G4int)tmpHadrons->size() ; ++j ) {
322 //G4cout << __FILE__ << " " << __LINE__ << "th line: tmpHadrons->at(j)->GetDefinition()->GetParticleName() = " << tmpHadrons->at(j)->GetDefinition()->GetParticleName() << G4endl;
323 if ( tmpHadrons->at(j)->GetDefinition()->GetBaryonNumber() > maxA ) {
324 maxA = tmpHadrons->at(j)->GetDefinition()->GetBaryonNumber();
325 jAtMaxA = j;
326 }
327 sumA += tmpHadrons->at(j)->GetDefinition()->GetBaryonNumber();
328 sumZ += G4int( tmpHadrons->at(j)->GetDefinition()->GetPDGCharge() + eps );
329 }
330 G4int dA = (G4int)theBaseA + hadProjectile->GetDefinition()->GetBaryonNumber() - sumA;
331 G4int dZ = (G4int)theBaseZ + G4int( hadProjectile->GetDefinition()->GetPDGCharge() + eps ) - sumZ;
332 if ( dA < 0 || dZ < 0 ) {
333 G4int newA = tmpHadrons->at(jAtMaxA)->GetDefinition()->GetBaryonNumber() + dA ;
334 G4int newZ = G4int( tmpHadrons->at(jAtMaxA)->GetDefinition()->GetPDGCharge() + eps ) + dZ;
335 if(newA>newZ && newZ>0){
336 G4ParticleDefinition* pd = G4IonTable::GetIonTable()->GetIon ( newZ , newA );
337 tmpHadrons->at( jAtMaxA )->SetDefinition( pd );
338 }
339 }
340 }
341 }
342 }
343 else if(theAngularDistribution!= 0)
344 {
345 G4bool * Done = new G4bool[nDef];
346 G4int i0;
347 for(i0=0; i0<nDef; ++i0) Done[i0] = false;
348
349 tmpHadrons = new G4ReactionProductVector;
350 G4ReactionProduct * aHadron;
351 G4double localMass = ( G4NucleiProperties::GetNuclearMass(static_cast<G4int>(theBaseA+eps), static_cast<G4int>(theBaseZ+eps)));
352 G4ThreeVector bufferedDirection(0,0,0);
353 for(i0=0; i0<nDef; ++i0)
354 {
355 if(!Done[i0])
356 {
357 aHadron = new G4ReactionProduct;
359 {
360 aHadron->SetDefinition(theDefs[i0]);
361 aHadron->SetKineticEnergy(theEnergyDistribution->Sample(eKinetic, dummy));
362 }
363 else if(nDef == 1)
364 {
365 aHadron->SetDefinition(theDefs[i0]);
366 aHadron->SetKineticEnergy(eKinetic);
367 }
368 else if(nDef == 2)
369 {
370 aHadron->SetDefinition(theDefs[i0]);
371 aHadron->SetKineticEnergy(50*CLHEP::MeV);
372 }
373 else
374 {
375 throw G4HadronicException(__FILE__, __LINE__, "No energy distribution to sample from in InelasticBaseFS::BaseApply");
376 }
378 if(theEnergyDistribution==0 && nDef == 2)
379 {
380 if(i0==0)
381 {
382 G4double mass1 = theDefs[0]->GetPDGMass();
383 G4double mass2 = theDefs[1]->GetPDGMass();
385 G4int z1 = static_cast<G4int>(theBaseZ+eps-theDefs[0]->GetPDGCharge()-theDefs[1]->GetPDGCharge());
386 G4int a1 = static_cast<G4int>(theBaseA+eps)-theDefs[0]->GetBaryonNumber()-theDefs[1]->GetBaryonNumber();
387 G4double concreteMass = G4NucleiProperties::GetNuclearMass(a1, z1);
388 G4double availableEnergy = eKinetic+massn+localMass-mass1-mass2-concreteMass;
389 // available kinetic energy in CMS (non relativistic)
390 G4double emin = availableEnergy+mass1+mass2 - std::sqrt((mass1+mass2)*(mass1+mass2)+orgMomentum*orgMomentum);
391 G4double p1=std::sqrt(2.*mass2*emin);
392 bufferedDirection = p1*aHadron->GetMomentum().unit();
393#ifdef G4PHPDEBUG
394 if(std::getenv("G4ParticleHPDebug")) // @@@@@ verify the nucleon counting...
395 {
396 G4cout << "G4ParticleHPInelasticBaseFS "<<z1<<" "<<theBaseZ<<" "<<a1<<" "<<theBaseA<<" "<<availableEnergy<<" "
397 << emin<<G4endl;
398 }
399#endif
400 }
401 else
402 {
403 bufferedDirection = -bufferedDirection;
404 }
405 // boost from cms to lab
406#ifdef G4PHPDEBUG
407 if(std::getenv("G4ParticleHPDebug"))
408 {
409 G4cout << " G4ParticleHPInelasticBaseFS "<<bufferedDirection.mag2()<<G4endl;
410 }
411#endif
412 aHadron->SetTotalEnergy( std::sqrt(aHadron->GetMass()*aHadron->GetMass()
413 +bufferedDirection.mag2()) );
414 aHadron->SetMomentum(bufferedDirection);
415 aHadron->Lorentz(*aHadron, -1.*(theTarget+incidReactionProduct));
416#ifdef G4PHPDEBUG
417 if(std::getenv("G4ParticleHPDebug"))
418 {
419 G4cout << " G4ParticleHPInelasticBaseFS "<<aHadron->GetTotalEnergy()<<" "<<aHadron->GetMomentum()<<G4endl;
420 }
421#endif
422 }
423 tmpHadrons->push_back(aHadron);
424#ifdef G4PHPDEBUG
425 if( std::getenv("G4ParticleHPDebug")) G4cout << " G4ParticleHPInelasticBaseFS::BaseApply FSData add secondary " << aHadron->GetDefinition()->GetParticleName() << " E= " << aHadron->GetKineticEnergy() << G4endl;
426#endif
427 }
428 }
429 delete [] Done;
430 }
431 else
432 {
433 throw G4HadronicException(__FILE__, __LINE__, "No data to create the neutrons in NInelasticFS");
434 }
435
436 G4ReactionProductVector * thePhotons = nullptr;
438 {
439 // the photon distributions are in the Nucleus rest frame.
440 G4ReactionProduct boosted_tmp;
441 boosted_tmp.Lorentz(incidReactionProduct, theTarget);
442 G4double anEnergy = boosted_tmp.GetKineticEnergy();
443 thePhotons = theFinalStatePhotons->GetPhotons(anEnergy);
444 if(thePhotons!=0)
445 {
446 for(i=0; i<thePhotons->size(); ++i)
447 {
448 // back to lab
449 thePhotons->operator[](i)->Lorentz(*(thePhotons->operator[](i)), -1.*theTarget);
450 }
451 }
452 }
453 else if(theEnergyAngData!=0)
454 {
455
456 // PA130927: do not create photons to adjust binding energy
457 G4bool bAdjustPhotons = true;
458#ifdef PHP_AS_HP
459 bAdjustPhotons = true;
460#else
462 bAdjustPhotons = false;
463#endif
464
465 if( bAdjustPhotons ) {
466 G4double theGammaEnergy = theEnergyAngData->GetTotalMeanEnergy();
467 G4double anEnergy = boosted.GetKineticEnergy();
468 theGammaEnergy = anEnergy-theGammaEnergy;
469 theGammaEnergy += theNuclearMassDifference;
470 G4double eBindProducts = 0;
471 G4double eBindN = 0;
472 G4double eBindP = 0;
477 G4int ia=0;
478 for(i=0; i<tmpHadrons->size(); i++)
479 {
480 if(tmpHadrons->operator[](i)->GetDefinition() == G4Neutron::Neutron())
481 {
482 eBindProducts+=eBindN;
483 }
484 else if(tmpHadrons->operator[](i)->GetDefinition() == G4Proton::Proton())
485 {
486 eBindProducts+=eBindP;
487 }
488 else if(tmpHadrons->operator[](i)->GetDefinition() == G4Deuteron::Deuteron())
489 {
490 eBindProducts+=eBindD;
491 }
492 else if(tmpHadrons->operator[](i)->GetDefinition() == G4Triton::Triton())
493 {
494 eBindProducts+=eBindT;
495 }
496 else if(tmpHadrons->operator[](i)->GetDefinition() == G4He3::He3())
497 {
498 eBindProducts+=eBindHe3;
499 }
500 else if(tmpHadrons->operator[](i)->GetDefinition() == G4Alpha::Alpha())
501 {
502 eBindProducts+=eBindA;
503 ia++;
504 }
505 }
506
507 theGammaEnergy += eBindProducts;
508
509#ifdef G4PHPDEBUG
510 if( std::getenv("G4ParticleHPDebug")) G4cout << " G4ParticleHPInelasticBaseFS::BaseApply gamma Energy " << theGammaEnergy << " eBindProducts " << eBindProducts << G4endl;
511#endif
512
513 // Special treatment for Be9 + n -> 2n + Be8 -> 2n + a + a
514 if ( (G4int)(theBaseZ+eps) == 4 && (G4int)(theBaseA+eps) == 9 )
515 {
516 // This only valid for G4NDL3.13,,,
517 if ( std::abs( theNuclearMassDifference -
519 G4NucleiProperties::GetBindingEnergy( 9 , 4 ) ) ) < 1*CLHEP::keV
520 && ia == 2 )
521 {
522 theGammaEnergy -= (2*eBindA);
523 }
524 }
525
526 G4ReactionProductVector * theOtherPhotons = nullptr;
527 G4int iLevel;
528 while(theGammaEnergy>=theGammas.GetLevelEnergy(0)) // Loop checking, 11.05.2015, T. Koi
529 {
530 for(iLevel=theGammas.GetNumberOfLevels()-1; iLevel>=0; --iLevel)
531 {
532 if(theGammas.GetLevelEnergy(iLevel)<theGammaEnergy) break;
533 }
534 if(iLevel==0||iLevel==theGammas.GetNumberOfLevels()-1)
535 {
536 theOtherPhotons = theGammas.GetDecayGammas(iLevel);
537#ifdef G4PHPDEBUG
538 if( std::getenv("G4ParticleHPDebug"))
539 G4cout << " G4ParticleHPInelasticBaseFS::BaseApply adding gamma from level "
540 << iLevel << " "
541 << theOtherPhotons->operator[](ii)->GetKineticEnergy(
542 ) << G4endl;
543#endif
544 }
545 else
546 {
547 G4double random = G4UniformRand();
548 G4double eLow = theGammas.GetLevelEnergy(iLevel);
549 G4double eHigh = theGammas.GetLevelEnergy(iLevel+1);
550 if(random > (eHigh-eLow)/(theGammaEnergy-eLow)) iLevel++;
551 theOtherPhotons = theGammas.GetDecayGammas(iLevel);
552 }
553 if(thePhotons==0) thePhotons = new G4ReactionProductVector;
554 if(theOtherPhotons != 0)
555 {
556 for(std::size_t iii=0; iii<theOtherPhotons->size(); ++iii)
557 {
558 thePhotons->push_back(theOtherPhotons->operator[](iii));
559#ifdef G4PHPDEBUG
560 if( std::getenv("G4ParticleHPDebug"))
561 G4cout << iii << " G4ParticleHPInelasticBaseFS::BaseApply adding gamma " << theOtherPhotons->operator[](iii)->GetKineticEnergy() << G4endl;
562#endif
563 }
564 delete theOtherPhotons;
565 }
566 theGammaEnergy -= theGammas.GetLevelEnergy(iLevel);
567 if(iLevel == -1) break;
568 }
569 }
570 }
571
572 // fill the result
573 std::size_t nSecondaries = tmpHadrons->size();
574 std::size_t nPhotons = 0;
575 if(thePhotons!=0) { nPhotons = thePhotons->size(); }
576 nSecondaries += nPhotons;
577 G4DynamicParticle * theSec;
578#ifdef G4PHPDEBUG
579 if( std::getenv("G4ParticleHPDebug"))
580 G4cout << " G4ParticleHPInelasticBaseFS::BaseApply N hadrons "
581 << nSecondaries-nPhotons << G4endl;
582#endif
583
584 for(i=0; i<nSecondaries-nPhotons; ++i)
585 {
586 theSec = new G4DynamicParticle;
587 theSec->SetDefinition(tmpHadrons->operator[](i)->GetDefinition());
588 theSec->SetMomentum(tmpHadrons->operator[](i)->GetMomentum());
589 theResult.Get()->AddSecondary(theSec, secID);
590#ifdef G4PHPDEBUG
591 if( std::getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticBaseFS::BaseApply add secondary2 " << theSec->GetParticleDefinition()->GetParticleName() << " E= " << theSec->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
592#endif
593 delete tmpHadrons->operator[](i);
594 }
595#ifdef G4PHPDEBUG
596 if( std::getenv("G4ParticleHPDebug")) G4cout << " G4ParticleHPInelasticBaseFS::BaseApply N photons " << nPhotons << G4endl;
597#endif
598 if(thePhotons != 0)
599 {
600 for(i=0; i<nPhotons; ++i)
601 {
602 theSec = new G4DynamicParticle;
603 theSec->SetDefinition(thePhotons->operator[](i)->GetDefinition());
604 theSec->SetMomentum(thePhotons->operator[](i)->GetMomentum());
605 theResult.Get()->AddSecondary(theSec, secID);
606#ifdef G4PHPDEBUG
607 if( std::getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticBaseFS::BaseApply add secondary3 " << theSec->GetParticleDefinition()->GetParticleName() << " E= " << theSec->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
608#endif
609 delete thePhotons->operator[](i);
610 }
611 }
612
613 // some garbage collection
614 delete thePhotons;
615 delete tmpHadrons;
616
618 G4LorentzVector targ_4p_lab ( theTarget.GetMomentum() , std::sqrt( targ_pd->GetPDGMass()*targ_pd->GetPDGMass() + theTarget.GetMomentum().mag2() ) );
619 G4LorentzVector proj_4p_lab = theTrack.Get4Momentum();
620 G4LorentzVector init_4p_lab = proj_4p_lab + targ_4p_lab;
621
622 //if data in MF=6 format (no correlated particle emission), then adjust_final_state can give severe errors:
623 if(theEnergyAngData==0){adjust_final_state ( init_4p_lab );}
624
625 // clean up the primary neutron
627}
const char * G4FindDataDir(const char *)
@ stopAndKill
#define M(row, col)
std::vector< G4ReactionProduct * > G4ReactionProductVector
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
const G4int Z[17]
const G4double A[17]
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
#define G4UniformRand()
Definition: Randomize.hh:52
Hep3Vector unit() const
double mag2() const
double mag() const
Hep3Vector vect() const
static G4Alpha * Alpha()
Definition: G4Alpha.cc:88
value_type & Get() const
Definition: G4Cache.hh:315
void Put(const value_type &val) const
Definition: G4Cache.hh:321
static G4Deuteron * Deuteron()
Definition: G4Deuteron.cc:93
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
const G4ParticleDefinition * GetParticleDefinition() const
G4double GetKineticEnergy() const
void SetMomentum(const G4ThreeVector &momentum)
void SetStatusChange(G4HadFinalStateStatus aS)
void AddSecondary(G4DynamicParticle *aP, G4int mod=-1)
std::size_t GetNumberOfSecondaries() const
const G4Material * GetMaterial() const
const G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
const G4LorentzVector & Get4Momentum() const
static G4He3 * He3()
Definition: G4He3.cc:93
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
Definition: G4IonTable.cc:522
static G4IonTable * GetIonTable()
Definition: G4IonTable.cc:170
G4double GetTemperature() const
Definition: G4Material.hh:177
static G4Neutron * Neutron()
Definition: G4Neutron.cc:103
static G4double GetBindingEnergy(const G4int A, const G4int Z)
static G4double GetNuclearMass(const G4double A, const G4double Z)
G4ReactionProduct GetBiasedThermalNucleus(G4double aMass, G4ThreeVector aVelocity, G4double temp=-1) const
Definition: G4Nucleus.cc:118
G4int GetAtomicNumber() const
G4double GetPDGCharge() const
const G4String & GetParticleName() const
void SetTarget(const G4ReactionProduct &aTarget)
void SetProjectileRP(const G4ReactionProduct &anIncidentParticleRP)
void Init(std::istream &aDataFile)
void SampleAndUpdate(G4ReactionProduct &anIncidentParticle)
G4ReactionProductVector * GetDecayGammas(G4int aLevel)
G4double GetLevelEnergy(G4int aLevel)
void Init(std::istream &aDataFile)
void Init(std::istream &aDataFile)
void SetProjectileRP(G4ReactionProduct &aIncidentPart)
void SetTarget(G4ReactionProduct &aTarget)
G4ReactionProductVector * Sample(G4double anEnergy)
G4double Sample(G4double anEnergy, G4int &it)
void SetAZMs(G4double anA, G4double aZ, G4int aM, G4ParticleHPDataUsed used)
G4ParticleDefinition * theProjectile
G4Cache< G4HadFinalState * > theResult
void adjust_final_state(G4LorentzVector)
void BaseApply(const G4HadProjectile &theTrack, G4ParticleDefinition **theDefs, G4int nDef)
void InitGammas(G4double AR, G4double ZR)
void Init(G4double A, G4double Z, G4int M, G4String &dirName, G4String &bit, G4ParticleDefinition *)
G4ParticleHPEnergyDistribution * theEnergyDistribution
G4ParticleHPPhotonDist * theFinalStatePhotons
G4ParticleHPAngular * theAngularDistribution
G4ParticleHPEnAngCorrelation * theEnergyAngData
static G4ParticleHPManager * GetInstance()
void GetDataStream(G4String, std::istringstream &iss)
G4ReactionProduct * Sample(G4double anEnergy, G4double massCode, G4double mass)
void Init(G4double aMass, G4int aCount)
G4ParticleHPDataUsed GetName(G4int A, G4int Z, G4String base, G4String rest, G4bool &active)
void InitEnergies(std::istream &aDataFile)
G4ReactionProductVector * GetPhotons(G4double anEnergy)
void InitAngular(std::istream &aDataFile)
void InitPartials(std::istream &aDataFile, G4ParticleHPVector *theXsec=0)
G4bool InitMean(std::istream &aDataFile)
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
static G4Proton * Proton()
Definition: G4Proton.cc:92
void SetMomentum(const G4double x, const G4double y, const G4double z)
void SetTotalEnergy(const G4double en)
G4double GetKineticEnergy() const
const G4ParticleDefinition * GetDefinition() const
G4double GetTotalEnergy() const
G4ThreeVector GetMomentum() const
void Lorentz(const G4ReactionProduct &p1, const G4ReactionProduct &p2)
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
void SetKineticEnergy(const G4double en)
G4double GetMass() const
static G4Triton * Triton()
Definition: G4Triton.cc:93
void SetProjectileRP(G4ReactionProduct *aIncidentParticleRP)
void SetTarget(G4ReactionProduct *aTarget)
#define INT_MAX
Definition: templates.hh:90