73 for (
G4int i = 0; i < nSecondaries; ++i) {
76 max_SecZ = std::max(max_SecZ, ptr->GetAtomicNumber());
77 sum_A += ptr->GetAtomicMass();
78 max_SecA = std::max(max_SecA, ptr->GetAtomicMass());
79 if (ptr->GetAtomicMass() == max_SecA)
83 G4cout <<
"G4ParticleHPFinalState::adjust_final_stat SECO " << i <<
" "
84 << ptr->GetParticleName() <<
G4endl;
118 G4cout <<
"G4ParticleHPFinalState::adjust_final_stat BaseZ " << baseZNew <<
" BaseA "
119 << baseANew <<
" sum_Z " << sum_Z <<
" sum_A " << sum_A <<
G4endl;
122 G4bool needOneMoreSec =
false;
124 if (baseZNew == sum_Z && baseANew == sum_A) {
129 if (max_SecA >= baseANew - sum_A) {
132 needOneMoreSec =
true;
136 resi_pd =
ionTable->
GetIon(baseZNew - sum_Z, baseANew - sum_A, 0.0);
139 if (needOneMoreSec) {
140 if (baseZNew == sum_Z && baseANew == sum_A) {
142 if (baseANew - sum_A > 1)
143 G4cout <<
"More than one neutron is required for the balance of baryon number!"
150 G4cout <<
this <<
"G4ParticleHPFinalState oneMoreSec_pd Z "
151 << baseZNew <<
" - " << sum_Z
152 <<
" A " << baseANew <<
" - " << sum_A <<
" projectile "
157 if (oneMoreSec_pd ==
nullptr) {
159 ed <<
"G4ParticleHPFinalState oneMoreSec_pd Z=" << baseZNew <<
" - " << sum_Z
160 <<
" A=" << baseANew <<
" - " << sum_A <<
" projectile "
163 ed,
"No adjustment will be done!");
169 if (resi_pd ==
nullptr) {
197 if (ndlZNew == sum_Z && ndlANew == sum_A) {
200 resi_pd =
ionTable->
GetIon(max_SecZ - dif_Z, max_SecA - dif_A, 0.0);
201 if (resi_pd ==
nullptr) {
203 ed <<
"resi_pd Z=" << max_SecZ <<
" - " << dif_Z <<
" A="
204 << max_SecA <<
" - " << dif_A <<
" projectile "
207 ed,
"No adjustment will be done!");
211 for (
G4int i = 0; i < nSecondaries; ++i) {
213 if (ptr->GetDefinition()->GetAtomicNumber() == max_SecZ &&
214 ptr->GetDefinition()->GetAtomicMass() == max_SecA)
218 ptr->SetDefinition(resi_pd);
235 for (
G4int i = 0; i < n_sec; ++i) {
237 secs_4p_lab += ptr->Get4Momentum();
241 beta = ptr->Get4Momentum().beta();
247 if (ptr->GetDefinition() == resi_pd) ires = i;
249 if (slow > beta && beta != 0) {
261 G4double e = ptr->Get4Momentum().e();
281 p4 = res->Get4Momentum();
282 if (slow > p4.
beta()) {
286 dif_4p = init_4p_lab - (secs_4p_lab + p4);
289 if (needOneMoreSec && oneMoreSec_pd !=
nullptr)
300 p4 = one->Get4Momentum();
301 if (slow > p4.
beta()) {
303 islow = nSecondaries - 1;
305 dif_4p = init_4p_lab - (secs_4p_lab + p4);
310 if (dif_4p.
v().
mag() < std::abs(dif_4p.
e())) {
312 if (minimum_energy < dif_4p.
v().
mag() && dif_4p.
v().
mag() < 1 * MeV) {
323 dif_4p = init_4p_lab -
324 (secs_4p_lab - p4 +
theResult.
Get()->GetSecondary(ires)->GetParticle()->Get4Momentum());
327 G4double dif_e = dif_4p.
e() - (dif_4p.
v()).mag();
335 if (minimum_energy < e1) {
349 if (ke0 + dif_e > 0) {
350 ptr->SetKineticEnergy(ke0 + dif_e);
G4ParticleDefinition * GetDefinition() const
G4LorentzVector Get4Momentum() const
G4double GetKineticEnergy() const
void SetMomentum(const G4ThreeVector &momentum)
G4ThreeVector GetMomentum() const
G4int GetAtomicNumber() const
G4double GetPDGMass() const
const G4String & GetParticleName() const
G4ParticleHPManager * fManager
G4ParticleDefinition * theProjectile
G4Cache< G4HadFinalState * > theResult
virtual ~G4ParticleHPFinalState()
void adjust_final_state(G4LorentzVector)
static G4ParticleHPManager * GetInstance()
G4bool GetDoNotAdjustFinalState() const