Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ParticleHPCaptureFS Class Reference

#include <G4ParticleHPCaptureFS.hh>

+ Inheritance diagram for G4ParticleHPCaptureFS:

Public Member Functions

 G4ParticleHPCaptureFS ()
 
 ~G4ParticleHPCaptureFS ()
 
void Init (G4double A, G4double Z, G4int M, G4String &dirName, G4String &aFSType, G4ParticleDefinition *)
 
G4HadFinalStateApplyYourself (const G4HadProjectile &theTrack)
 
G4ParticleHPFinalStateNew ()
 
- Public Member Functions inherited from G4ParticleHPFinalState
 G4ParticleHPFinalState ()
 
virtual ~G4ParticleHPFinalState ()
 
void Init (G4double A, G4double Z, G4String &dirName, G4String &aFSType, G4ParticleDefinition *projectile)
 
virtual void Init (G4double A, G4double Z, G4int M, G4String &dirName, G4String &aFSType, G4ParticleDefinition *)=0
 
virtual G4HadFinalStateApplyYourself (const G4HadProjectile &)
 
virtual G4ParticleHPFinalStateNew ()=0
 
G4bool HasXsec ()
 
G4bool HasFSData ()
 
G4bool HasAnyData ()
 
virtual G4double GetXsec (G4double)
 
virtual G4ParticleHPVectorGetXsec ()
 
void SetA_Z (G4double anA, G4double aZ, G4int aM=0)
 
G4double GetZ ()
 
G4double GetN ()
 
G4double GetA ()
 
G4int GetM ()
 
void SetAZMs (G4double anA, G4double aZ, G4int aM, G4ParticleHPDataUsed used)
 
void SetProjectile (G4ParticleDefinition *projectile)
 

Additional Inherited Members

- Protected Member Functions inherited from G4ParticleHPFinalState
void adjust_final_state (G4LorentzVector)
 
G4bool DoNotAdjustFinalState ()
 
- Protected Attributes inherited from G4ParticleHPFinalState
G4bool hasXsec
 
G4bool hasFSData
 
G4bool hasAnyData
 
G4ParticleHPNames theNames
 
G4Cache< G4HadFinalState * > theResult
 
G4ParticleDefinitiontheProjectile
 
G4double theBaseA
 
G4double theBaseZ
 
G4int theBaseM
 
G4int theNDLDataZ
 
G4int theNDLDataA
 
G4int theNDLDataM
 

Detailed Description

Definition at line 42 of file G4ParticleHPCaptureFS.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPCaptureFS()

G4ParticleHPCaptureFS::G4ParticleHPCaptureFS ( )
inline

Definition at line 46 of file G4ParticleHPCaptureFS.hh.

47 {
48 hasXsec = false;
49 hasExactMF6 = false;
50 targetMass = 0;
51 }

Referenced by New().

◆ ~G4ParticleHPCaptureFS()

G4ParticleHPCaptureFS::~G4ParticleHPCaptureFS ( )
inline

Definition at line 53 of file G4ParticleHPCaptureFS.hh.

54 {
55 }

Member Function Documentation

◆ ApplyYourself()

G4HadFinalState * G4ParticleHPCaptureFS::ApplyYourself ( const G4HadProjectile theTrack)
virtual

Reimplemented from G4ParticleHPFinalState.

Definition at line 50 of file G4ParticleHPCaptureFS.cc.

51 {
52
53 if ( theResult.Get() == NULL ) theResult.Put( new G4HadFinalState );
54 theResult.Get()->Clear();
55
56 G4int i;
57
58// prepare neutron
59 G4double eKinetic = theTrack.GetKineticEnergy();
60 const G4HadProjectile *incidentParticle = &theTrack;
61 G4ReactionProduct theNeutron( const_cast<G4ParticleDefinition *>(incidentParticle->GetDefinition() ) );
62 theNeutron.SetMomentum( incidentParticle->Get4Momentum().vect() );
63 theNeutron.SetKineticEnergy( eKinetic );
64
65 // Prepare target
66 G4ReactionProduct theTarget;
67 G4Nucleus aNucleus;
68 G4double eps = 0.0001;
69 if (targetMass < 500*MeV) targetMass =
70 (G4NucleiProperties::GetNuclearMass(static_cast<G4int>(theBaseA+eps), static_cast<G4int>(theBaseZ+eps) )) /
72 G4ThreeVector neutronVelocity = 1./G4Neutron::Neutron()->GetPDGMass()*theNeutron.GetMomentum();
73 G4double temperature = theTrack.GetMaterial()->GetTemperature();
74 theTarget = aNucleus.GetBiasedThermalNucleus(targetMass, neutronVelocity, temperature);
76
77 // Put neutron in nucleus rest system
78 theNeutron.Lorentz(theNeutron, theTarget);
79 eKinetic = theNeutron.GetKineticEnergy();
80
81 // Sample the photons
82 G4ReactionProductVector * thePhotons = 0;
83 if ( HasFSData() && !G4ParticleHPManager::GetInstance()->GetUseOnlyPhotoEvaporation() )
84 {
85 //NDL has final state data
86 if ( hasExactMF6 ) {
87 theMF6FinalState.SetTarget(theTarget);
88 theMF6FinalState.SetProjectileRP(theNeutron);
89 thePhotons = theMF6FinalState.Sample( eKinetic );
90 } else {
91 thePhotons = theFinalStatePhotons.GetPhotons(eKinetic);
92 }
93 if ( thePhotons == NULL ) {
94 throw G4HadronicException(__FILE__, __LINE__, "Final state data for photon is not properly allocated");
95 }
96 }
97 else
98 {
99 //NDL does not have final state data or forced to use PhotoEvaporation model
100 G4ThreeVector aCMSMomentum = theNeutron.GetMomentum()+theTarget.GetMomentum();
101 G4LorentzVector p4(aCMSMomentum, theTarget.GetTotalEnergy() + theNeutron.GetTotalEnergy());
102 G4Fragment nucleus(static_cast<G4int>(theBaseA+1), static_cast<G4int>(theBaseZ) ,p4);
103 G4PhotonEvaporation photonEvaporation;
104 // T. K. add
105 photonEvaporation.SetICM( TRUE );
106 G4FragmentVector* products = photonEvaporation.BreakItUp(nucleus);
107 G4FragmentVector::iterator it;
108 thePhotons = new G4ReactionProductVector;
109 for(it=products->begin(); it!=products->end(); it++)
110 {
112 // T. K. add
113 if ( (*it)->GetParticleDefinition() != 0 )
114 theOne->SetDefinition( (*it)->GetParticleDefinition() );
115 else
116 theOne->SetDefinition( G4Gamma::Gamma() ); // this definiion will be over writen
117
118 // T. K. comment out below line
119 //theOne->SetDefinition( G4Gamma::Gamma() );
121 if ( (*it)->GetMomentum().mag() > 10*MeV)
122 theOne->SetDefinition(theTable->GetIon(static_cast<G4int>(theBaseZ), static_cast<G4int>(theBaseA+1), 0) );
123
124 if ( (*it)->GetExcitationEnergy() > 1.0e-2*eV) {
125 G4double ex = (*it)->GetExcitationEnergy();
127 aPhoton->SetDefinition( G4Gamma::Gamma() );
128 aPhoton->SetMomentum( (*it)->GetMomentum().vect().unit() * ex );
129 //aPhoton->SetTotalEnergy( ex ); //will be calculated from momentum
130 thePhotons->push_back(aPhoton);
131 }
132
133 theOne->SetMomentum( (*it)->GetMomentum().vect() * ( (*it)->GetMomentum().t() - (*it)->GetExcitationEnergy() ) / (*it)->GetMomentum().t() ) ;
134 thePhotons->push_back(theOne);
135 delete *it;
136 }
137 delete products;
138 }
139
140 // Add them to the final state
141 G4int nPhotons = 0;
142 nPhotons=thePhotons->size();
143
144///*
145 if ( DoNotAdjustFinalState() ) {
146//Make at least one photon
147//101203 TK
148 if ( nPhotons == 0 )
149 {
151 theOne->SetDefinition( G4Gamma::Gamma() );
152 // Bug #1745 DHW G4double theta = pi*G4UniformRand();
153 G4double costheta = 2.*G4UniformRand()-1.;
154 G4double theta = std::acos(costheta);
155 G4double phi = twopi*G4UniformRand();
156 G4double sinth = std::sin(theta);
157 G4ThreeVector direction(sinth*std::cos(phi), sinth*std::sin(phi), costheta);
158 theOne->SetMomentum(direction);
159 thePhotons->push_back(theOne);
160 nPhotons++; // 0 -> 1
161 }
162//One photon case: energy set to Q-value
163//101203 TK
164 //if ( nPhotons == 1 )
165 if ( nPhotons == 1 && thePhotons->operator[](0)->GetDefinition()->GetBaryonNumber() == 0 )
166 {
167 G4ThreeVector direction = thePhotons->operator[](0)->GetMomentum().unit();
168
170 - G4IonTable::GetIonTable()->GetIonMass(static_cast<G4int>(theBaseZ), static_cast<G4int>(theBaseA+1), 0);
171
172 thePhotons->operator[](0)->SetMomentum( Q*direction );
173 }
174//
175 }
176
177 // back to lab system
178 for(i=0; i<nPhotons; i++)
179 {
180 thePhotons->operator[](i)->Lorentz(*(thePhotons->operator[](i)), -1*theTarget);
181 }
182
183 // Recoil, if only one gamma
184 //if (1==nPhotons)
185 if ( nPhotons == 1 && thePhotons->operator[](0)->GetDefinition()->GetBaryonNumber() == 0 )
186 {
189 ->GetIon(static_cast<G4int>(theBaseZ), static_cast<G4int>(theBaseA+1), 0);
190 theOne->SetDefinition(aRecoil);
191 // Now energy;
192 // Can be done slightly better @
193 G4ThreeVector aMomentum = theTrack.Get4Momentum().vect()
194 +theTarget.GetMomentum()
195 -thePhotons->operator[](0)->GetMomentum();
196
197 //TKDB 140520
198 //G4ThreeVector theMomUnit = aMomentum.unit();
199 //G4double aKinEnergy = theTrack.GetKineticEnergy()
200 // +theTarget.GetKineticEnergy(); // gammas come from Q-value
201 //G4double theResMass = aRecoil->GetPDGMass();
202 //G4double theResE = aRecoil->GetPDGMass()+aKinEnergy;
203 //G4double theAbsMom = std::sqrt(theResE*theResE - theResMass*theResMass);
204 //G4ThreeVector theMomentum = theAbsMom*theMomUnit;
205 //theOne->SetMomentum(theMomentum);
206
207 theOne->SetMomentum(aMomentum);
208 theResult.Get()->AddSecondary(theOne);
209 }
210
211 // Now fill in the gammas.
212 for(i=0; i<nPhotons; i++)
213 {
214 // back to lab system
216 theOne->SetDefinition(thePhotons->operator[](i)->GetDefinition());
217 theOne->SetMomentum(thePhotons->operator[](i)->GetMomentum());
218 theResult.Get()->AddSecondary(theOne);
219 delete thePhotons->operator[](i);
220 }
221 delete thePhotons;
222
223//101203TK
224 G4bool residual = false;
226 ->GetIon(static_cast<G4int>(theBaseZ), static_cast<G4int>(theBaseA+1), 0);
227 for ( std::size_t j = 0 ; j != theResult.Get()->GetNumberOfSecondaries() ; j++ )
228 {
229 if ( theResult.Get()->GetSecondary(j)->GetParticle()->GetDefinition() == aRecoil ) residual = true;
230 }
231
232 if ( residual == false )
233 {
234 G4int nNonZero = 0;
235 G4LorentzVector p_photons(0,0,0,0);
236 for ( std::size_t j = 0 ; j != theResult.Get()->GetNumberOfSecondaries() ; j++ )
237 {
238 p_photons += theResult.Get()->GetSecondary(j)->GetParticle()->Get4Momentum();
239 // To many 0 momentum photons -> Check PhotonDist
240 if ( theResult.Get()->GetSecondary(j)->GetParticle()->Get4Momentum().e() > 0 ) nNonZero++;
241 }
242
243 // Can we include kinetic energy here?
244 G4double deltaE = ( theTrack.Get4Momentum().e() + theTarget.GetTotalEnergy() )
245 - ( p_photons.e() + aRecoil->GetPDGMass() );
246
247//Add photons
248 if ( nPhotons - nNonZero > 0 )
249 {
250 //G4cout << "TKDB G4ParticleHPCaptureFS::ApplyYourself we will create additional " << nPhotons - nNonZero << " photons" << G4endl;
251 std::vector<G4double> vRand;
252 vRand.push_back( 0.0 );
253 for ( G4int j = 0 ; j != nPhotons - nNonZero - 1 ; j++ )
254 {
255 vRand.push_back( G4UniformRand() );
256 }
257 vRand.push_back( 1.0 );
258 std::sort( vRand.begin(), vRand.end() );
259
260 std::vector<G4double> vEPhoton;
261 for ( G4int j = 0 ; j < (G4int)vRand.size() - 1 ; j++ )
262 {
263 vEPhoton.push_back( deltaE * ( vRand[j+1] - vRand[j] ) );
264 }
265 std::sort( vEPhoton.begin(), vEPhoton.end() );
266
267 for ( G4int j = 0 ; j < nPhotons - nNonZero - 1 ; j++ )
268 {
269 //Isotopic in LAB OK?
270 // Bug # 1745 DHW G4double theta = pi*G4UniformRand();
271 G4double costheta = 2.*G4UniformRand()-1.;
272 G4double theta = std::acos(costheta);
273 G4double phi = twopi*G4UniformRand();
274 G4double sinth = std::sin(theta);
275 G4double en = vEPhoton[j];
276 G4ThreeVector tempVector(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*costheta);
277
278 p_photons += G4LorentzVector ( tempVector, tempVector.mag() );
280 theOne->SetDefinition( G4Gamma::Gamma() );
281 theOne->SetMomentum( tempVector );
282 theResult.Get()->AddSecondary(theOne);
283 }
284
285// Add last photon
287 theOne->SetDefinition( G4Gamma::Gamma() );
288// For better momentum conservation
289 G4ThreeVector lastPhoton = -p_photons.vect().unit()*vEPhoton.back();
290 p_photons += G4LorentzVector( lastPhoton , lastPhoton.mag() );
291 theOne->SetMomentum( lastPhoton );
292 theResult.Get()->AddSecondary(theOne);
293 }
294
295//Add residual
297 G4ThreeVector aMomentum = theTrack.Get4Momentum().vect() + theTarget.GetMomentum()
298 - p_photons.vect();
299 theOne->SetDefinition(aRecoil);
300 theOne->SetMomentum( aMomentum );
301 theResult.Get()->AddSecondary(theOne);
302
303 }
304//101203TK END
305
306// clean up the primary neutron
308 return theResult.Get();
309 }
std::vector< G4Fragment * > G4FragmentVector
Definition: G4Fragment.hh:63
@ stopAndKill
CLHEP::HepLorentzVector G4LorentzVector
std::vector< G4ReactionProduct * > G4ReactionProductVector
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
#define TRUE
Definition: Globals.hh:27
#define G4UniformRand()
Definition: Randomize.hh:52
Hep3Vector unit() const
double mag() const
Hep3Vector vect() const
value_type & Get() const
Definition: G4Cache.hh:315
void Put(const value_type &val) const
Definition: G4Cache.hh:321
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
G4ParticleDefinition * GetDefinition() const
G4LorentzVector Get4Momentum() const
void SetMomentum(const G4ThreeVector &momentum)
static G4Gamma * Gamma()
Definition: G4Gamma.cc:85
void SetStatusChange(G4HadFinalStateStatus aS)
void AddSecondary(G4DynamicParticle *aP, G4int mod=-1)
G4HadSecondary * GetSecondary(size_t i)
const G4Material * GetMaterial() const
const G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
const G4LorentzVector & Get4Momentum() const
G4DynamicParticle * GetParticle()
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
Definition: G4IonTable.cc:522
G4double GetIonMass(G4int Z, G4int A, G4int L=0, G4int lvl=0) const
Definition: G4IonTable.cc:1517
static G4IonTable * GetIonTable()
Definition: G4IonTable.cc:170
G4double GetTemperature() const
Definition: G4Material.hh:180
static G4Neutron * Neutron()
Definition: G4Neutron.cc:103
static G4double GetNuclearMass(const G4double A, const G4double Z)
G4ReactionProduct GetBiasedThermalNucleus(G4double aMass, G4ThreeVector aVelocity, G4double temp=-1) const
Definition: G4Nucleus.cc:113
void SetProjectileRP(G4ReactionProduct &aIncidentPart)
void SetTarget(G4ReactionProduct &aTarget)
G4ReactionProductVector * Sample(G4double anEnergy)
G4Cache< G4HadFinalState * > theResult
static G4ParticleHPManager * GetInstance()
G4ReactionProductVector * GetPhotons(G4double anEnergy)
virtual void SetICM(G4bool)
G4FragmentVector * BreakItUp(const G4Fragment &theNucleus)
void SetMomentum(const G4double x, const G4double y, const G4double z)
G4double GetTotalEnergy() const
G4ThreeVector GetMomentum() const
void SetDefinitionAndUpdateE(const G4ParticleDefinition *aParticleDefinition)
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)

◆ Init()

void G4ParticleHPCaptureFS::Init ( G4double  A,
G4double  Z,
G4int  M,
G4String dirName,
G4String aFSType,
G4ParticleDefinition  
)
virtual

Implements G4ParticleHPFinalState.

Definition at line 312 of file G4ParticleHPCaptureFS.cc.

313 {
314
315 //TK110430 BEGIN
316 std::stringstream ss;
317 ss << static_cast<G4int>(Z);
318 G4String sZ;
319 ss >> sZ;
320 ss.clear();
321 ss << static_cast<G4int>(A);
322 G4String sA;
323 ss >> sA;
324
325 ss.clear();
326 G4String sM;
327 if ( M > 0 )
328 {
329 ss << "m";
330 ss << M;
331 ss >> sM;
332 ss.clear();
333 }
334
335 G4String element_name = theNames.GetName( static_cast<G4int>(Z)-1 );
336 G4String filenameMF6 = dirName+"/FSMF6/"+sZ+"_"+sA+sM+"_"+element_name;
337 //std::ifstream dummyIFS(filenameMF6, std::ios::in);
338 //if ( dummyIFS.good() == true ) hasExactMF6=true;
339 std::istringstream theData(std::ios::in);
340 G4ParticleHPManager::GetInstance()->GetDataStream(filenameMF6,theData);
341
342 //TK110430 Only use MF6MT102 which has exactly same A and Z
343 //Even _nat_ do not select and there is no _nat_ case in ENDF-VII.0
344 if ( theData.good() == true ) {
345 hasExactMF6=true;
346 theMF6FinalState.Init(theData);
347 //theData.close();
348 return;
349 }
350 //TK110430 END
351
352
353 G4String tString = "/FS";
354 G4bool dbool;
355 G4ParticleHPDataUsed aFile = theNames.GetName(static_cast<G4int>(A), static_cast<G4int>(Z), M, dirName, tString, dbool);
356
357 G4String filename = aFile.GetName();
358 SetAZMs( A, Z, M, aFile );
359 //theBaseA = A;
360 //theBaseZ = G4int(Z+.5);
361 if(!dbool || ( Z<2.5 && ( std::abs(theBaseZ - Z)>0.0001 || std::abs(theBaseA - A)>0.0001)))
362 {
363 hasAnyData = false;
364 hasFSData = false;
365 hasXsec = false;
366 return;
367 }
368 //std::ifstream theData(filename, std::ios::in);
369 //std::istringstream theData(std::ios::in);
370 theData.clear();
372 hasFSData = theFinalStatePhotons.InitMean(theData);
373 if(hasFSData)
374 {
375 targetMass = theFinalStatePhotons.GetTargetMass();
376 theFinalStatePhotons.InitAngular(theData);
377 theFinalStatePhotons.InitEnergies(theData);
378 }
379 //theData.close();
380 }
void Init(std::istream &aDataFile)
void SetAZMs(G4double anA, G4double aZ, G4int aM, G4ParticleHPDataUsed used)
void GetDataStream(G4String, std::istringstream &iss)
G4ParticleHPDataUsed GetName(G4int A, G4int Z, G4String base, G4String rest, G4bool &active)
void InitEnergies(std::istream &aDataFile)
void InitAngular(std::istream &aDataFile)
G4bool InitMean(std::istream &aDataFile)

◆ New()

G4ParticleHPFinalState * G4ParticleHPCaptureFS::New ( )
inlinevirtual

Implements G4ParticleHPFinalState.

Definition at line 59 of file G4ParticleHPCaptureFS.hh.


The documentation for this class was generated from the following files: