Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes
G4NeutronHPFinalState Class Referenceabstract

#include <G4NeutronHPFinalState.hh>

Inheritance diagram for G4NeutronHPFinalState:
G4FissionLibrary G4NeutronHPCaptureFS G4NeutronHPElasticFS G4NeutronHPFissionBaseFS G4NeutronHPFissionFS G4NeutronHPFSFissionFS G4NeutronHPInelasticBaseFS G4NeutronHPInelasticCompFS

Public Member Functions

 G4NeutronHPFinalState ()
 
virtual ~G4NeutronHPFinalState ()
 
void Init (G4double A, G4double Z, G4String &dirName, G4String &aFSType)
 
virtual void Init (G4double A, G4double Z, G4int M, G4String &dirName, G4String &aFSType)=0
 
virtual G4HadFinalStateApplyYourself (const G4HadProjectile &)
 
virtual G4NeutronHPFinalStateNew ()=0
 
G4bool HasXsec ()
 
G4bool HasFSData ()
 
G4bool HasAnyData ()
 
virtual G4double GetXsec (G4double)
 
virtual G4NeutronHPVectorGetXsec ()
 
void SetA_Z (G4double anA, G4double aZ, G4int aM=0)
 
G4double GetZ ()
 
G4double GetN ()
 
G4int GetM ()
 

Protected Member Functions

void SetAZMs (G4double anA, G4double aZ, G4int aM, G4NeutronHPDataUsed used)
 
void adjust_final_state (G4LorentzVector)
 
G4bool DoNotAdjustFinalState ()
 

Protected Attributes

G4bool hasXsec
 
G4bool hasFSData
 
G4bool hasAnyData
 
G4NeutronHPNames theNames
 
G4HadFinalState theResult
 
G4double theBaseA
 
G4double theBaseZ
 
G4int theBaseM
 
G4int theNDLDataZ
 
G4int theNDLDataA
 
G4int theNDLDataM
 

Detailed Description

Definition at line 41 of file G4NeutronHPFinalState.hh.

Constructor & Destructor Documentation

G4NeutronHPFinalState::G4NeutronHPFinalState ( )
inline

Definition at line 45 of file G4NeutronHPFinalState.hh.

References hasAnyData, hasFSData, hasXsec, theBaseA, theBaseM, theBaseZ, theNDLDataA, and theNDLDataZ.

46  {
47  hasFSData = true;
48  hasXsec = true;
49  hasAnyData = true;
50  theBaseZ = 0;
51  theBaseA = 0;
52  theBaseM = 0;
53 
54  theNDLDataZ = 0;
55  theNDLDataA = 0;
56 
57  adjustResult = true;
58  if ( getenv( "G4NEUTRONHP_DO_NOT_ADJUST_FINAL_STATE" ) ) adjustResult = false;
59 
60  };
virtual G4NeutronHPFinalState::~G4NeutronHPFinalState ( )
inlinevirtual

Definition at line 62 of file G4NeutronHPFinalState.hh.

62 {};

Member Function Documentation

void G4NeutronHPFinalState::adjust_final_state ( G4LorentzVector  init_4p_lab)
protected

Definition at line 38 of file G4NeutronHPFinalState.cc.

References G4HadFinalState::AddSecondary(), CLHEP::HepLorentzVector::beta(), CLHEP::HepLorentzVector::e(), G4cout, G4endl, G4UniformRand, G4Gamma::Gamma(), G4DynamicParticle::Get4Momentum(), G4ParticleDefinition::GetAtomicMass(), G4ParticleDefinition::GetAtomicNumber(), G4DynamicParticle::GetDefinition(), G4IonTable::GetIon(), G4IonTable::GetIonTable(), G4DynamicParticle::GetKineticEnergy(), G4DynamicParticle::GetMomentum(), G4HadFinalState::GetNumberOfSecondaries(), G4HadSecondary::GetParticle(), G4ParticleDefinition::GetPDGMass(), G4HadFinalState::GetSecondary(), int(), python.hepunit::keV, CLHEP::Hep3Vector::mag(), G4INCL::Math::max(), python.hepunit::MeV, G4Neutron::Neutron(), G4DynamicParticle::SetDefinition(), G4DynamicParticle::SetKineticEnergy(), G4DynamicParticle::SetMomentum(), theBaseA, theBaseZ, theNDLDataA, theNDLDataZ, theResult, python.hepunit::twopi, and CLHEP::HepLorentzVector::v().

Referenced by G4NeutronHPInelasticBaseFS::BaseApply(), and G4NeutronHPInelasticCompFS::CompositeApply().

39 {
40 
41  G4double minimum_energy = 1*keV;
42 
43  if ( adjustResult != true ) return;
44 
45  G4int nSecondaries = theResult.GetNumberOfSecondaries();
46 
47  G4int sum_Z = 0;
48  G4int sum_A = 0;
49  G4int max_SecZ = 0;
50  G4int max_SecA = 0;
51  G4int imaxA = -1;
52  for ( int i = 0 ; i < nSecondaries ; i++ )
53  {
55  max_SecZ = std::max ( max_SecZ , theResult.GetSecondary( i )->GetParticle()->GetDefinition()->GetAtomicNumber() );
57  max_SecA = std::max ( max_SecA , theResult.GetSecondary( i )->GetParticle()->GetDefinition()->GetAtomicMass() );
58  if ( theResult.GetSecondary( i )->GetParticle()->GetDefinition()->GetAtomicMass() == max_SecA ) imaxA = i;
59  }
60 
61  G4ParticleDefinition* resi_pd = NULL;
62  G4bool needOneMoreSec = false;
63  G4ParticleDefinition* oneMoreSec_pd = NULL;
64  if ( (int)(theBaseZ - sum_Z) == 0 && (int)(theBaseA + 1 - sum_A) == 0 )
65  {
66  //All secondaries are already created;
67  resi_pd = theResult.GetSecondary( imaxA )->GetParticle()->GetDefinition();
68  }
69  else
70  {
71  if ( max_SecA > int(theBaseA + 1 - sum_A) )
72  {
73  //Most heavy secondary is interpreted as residual
74  resi_pd = theResult.GetSecondary( imaxA )->GetParticle()->GetDefinition();
75  needOneMoreSec = true;
76  }
77  else
78  {
79  //creation of residual is requierd
80  resi_pd = G4IonTable::GetIonTable()->GetIon ( int(theBaseZ - sum_Z) , (int)(theBaseA + 1 - sum_A) , 0.0 );
81  }
82 
83  if ( needOneMoreSec )
84  {
85  if ( int(theBaseZ - sum_Z) == 0 && (int)(theBaseA + 1 - sum_A) > 0 )
86  {
87  if ( int(theBaseA + 1 - sum_A) > 1 ) G4cout << "More than one neutron is required for the balance of baryon number!" << G4endl;
88  oneMoreSec_pd = G4Neutron::Neutron();
89  }
90  else
91  {
92  oneMoreSec_pd = G4IonTable::GetIonTable()->GetIon ( int(theBaseZ - sum_Z) , (int)(theBaseA + 1 - sum_A) , 0.0 );
93  }
94  }
95 
96  if ( resi_pd == NULL )
97  {
98  // theNDLDataZ,A has the Z and A of used NDL file
99  if ( (int)(theNDLDataZ - sum_Z) == 0 && (int)(theNDLDataA + 1 - sum_A) == 0 )
100  {
101  G4int dif_Z = ( int ) ( theNDLDataZ - theBaseZ );
102  G4int dif_A = ( int ) ( theNDLDataA - theBaseA );
103  resi_pd = G4IonTable::GetIonTable()->GetIon ( max_SecZ - dif_Z , max_SecA - dif_A , 0.0 );
104  for ( int i = 0 ; i < nSecondaries ; i++ )
105  {
106  if ( theResult.GetSecondary( i )->GetParticle()->GetDefinition()->GetAtomicNumber() == max_SecZ
107  && theResult.GetSecondary( i )->GetParticle()->GetDefinition()->GetAtomicMass() == max_SecA )
108  {
110  p = p * resi_pd->GetPDGMass()/ G4IonTable::GetIonTable()->GetIon ( max_SecZ , max_SecA , 0.0 )->GetPDGMass();
111  theResult.GetSecondary( i )->GetParticle()->SetDefinition( resi_pd );
113  }
114  }
115  }
116  }
117  }
118 
119 
120  G4LorentzVector secs_4p_lab( 0.0 );
121 
123  G4double fast = 0;
124  G4double slow = 1;
125  G4int ifast = 0;
126  G4int islow = 0;
127  G4int ires = -1;
128 
129  for ( G4int i = 0 ; i < n_sec ; i++ )
130  {
131 
132  //G4cout << "HP_DB " << i
133  // << " " << theResult.GetSecondary( i )->GetParticle()->GetDefinition()->GetParticleName()
134  // << " 4p " << theResult.GetSecondary( i )->GetParticle()->Get4Momentum()
135  // << " ke " << theResult.GetSecondary( i )->GetParticle()->Get4Momentum().e() - theResult.GetSecondary( i )->GetParticle()->GetDefinition()->GetPDGMass()
136  // << G4endl;
137 
138  secs_4p_lab += theResult.GetSecondary( i )->GetParticle()->Get4Momentum();
139 
140  G4double beta = 0;
142  {
143  beta = theResult.GetSecondary( i )->GetParticle()->Get4Momentum().beta();
144  }
145  else
146  {
147  beta = 1;
148  }
149 
150  if ( theResult.GetSecondary( i )->GetParticle()->GetDefinition() == resi_pd ) ires = i;
151 
152  if ( slow > beta && beta != 0 )
153  {
154  slow = beta;
155  islow = i;
156  }
157 
158  if ( fast <= beta )
159  {
160  if ( fast != 1 )
161  {
162  fast = beta;
163  ifast = i;
164  }
165  else
166  {
167 // fast is already photon then check E
169  if ( e > theResult.GetSecondary( ifast )->GetParticle()->Get4Momentum().e() )
170  {
171 // among photons, the highest E becomes the fastest
172  ifast = i;
173  }
174  }
175  }
176  }
177 
178 
179  G4LorentzVector dif_4p = init_4p_lab - secs_4p_lab;
180 
181  //G4cout << "HP_DB dif_4p " << init_4p_lab - secs_4p_lab << G4endl;
182  //G4cout << "HP_DB dif_3p mag " << ( dif_4p.v() ).mag() << G4endl;
183  //G4cout << "HP_DB dif_e " << dif_4p.e() - ( dif_4p.v() ).mag()<< G4endl;
184 
185  G4LorentzVector p4(0);
186  if ( ires == -1 )
187  {
188 // Create and Add Residual Nucleus
189  ires = nSecondaries;
190  nSecondaries += 1;
191 
192  G4DynamicParticle* res = new G4DynamicParticle ( resi_pd , dif_4p.v() );
193  theResult.AddSecondary ( res );
194 
195  p4 = res->Get4Momentum();
196  if ( slow > p4.beta() )
197  {
198  slow = p4.beta();
199  islow = ires;
200  }
201  dif_4p = init_4p_lab - ( secs_4p_lab + p4 );
202  }
203 
204  if ( needOneMoreSec )
205  {
206  nSecondaries += 1;
207  G4DynamicParticle* one = new G4DynamicParticle ( oneMoreSec_pd , dif_4p.v() );
208  theResult.AddSecondary ( one );
209  p4 = one->Get4Momentum();
210  if ( slow > p4.beta() )
211  {
212  slow = p4.beta();
213  islow = nSecondaries-1; //Because the first is 0th, so the last becomes "nSecondaries-1"
214  }
215  dif_4p = init_4p_lab - ( secs_4p_lab + p4 );
216  }
217 
218  //Which is bigger dif_p or dif_e
219 
220  if ( dif_4p.v().mag() < std::abs( dif_4p.e() ) )
221  {
222 
223  // Adjust p
224  //if ( dif_4p.v().mag() < 1*MeV )
225  if ( minimum_energy < dif_4p.v().mag() && dif_4p.v().mag() < 1*MeV )
226  {
227 
228  nSecondaries += 1;
229  theResult.AddSecondary ( new G4DynamicParticle ( G4Gamma::Gamma() , dif_4p.v() ) );
230 
231  }
232  else
233  {
234  //G4cout << "HP_DB Difference in dif_p is too large (>1MeV) or too small(<1keV) to adjust, so that give up tuning" << G4endl;
235  }
236 
237  }
238  else
239  {
240 
241  // dif_p > dif_e
242  // at first momentum
243  // Move residual momentum
244 
245  p4 = theResult.GetSecondary( ires )->GetParticle()->Get4Momentum();
246  theResult.GetSecondary( ires )->GetParticle()->SetMomentum( p4.v() + dif_4p.v() );
247  dif_4p = init_4p_lab - ( secs_4p_lab - p4 + theResult.GetSecondary( ires )->GetParticle()->Get4Momentum() );
248 
249  //G4cout << "HP_DB new residual kinetic energy " << theResult.GetSecondary( ires )->GetParticle()->GetKineticEnergy() << G4endl;
250 
251  }
252 
253  G4double dif_e = dif_4p.e() - ( dif_4p.v() ).mag();
254  //G4cout << "HP_DB dif_e " << dif_e << G4endl;
255 
256  if ( dif_e > 0 )
257  {
258 
259 // create 2 gamma
260 
261  nSecondaries += 2;
262  G4double e1 = ( dif_4p.e() -dif_4p.v().mag() ) / 2;
263 
264  if ( minimum_energy < e1 )
265  {
266  G4double costh = 2.*G4UniformRand()-1.;
267  G4double phi = twopi*G4UniformRand();
268  G4ThreeVector dir( std::sin(std::acos(costh))*std::cos(phi),
269  std::sin(std::acos(costh))*std::sin(phi),
270  costh);
271  theResult.AddSecondary ( new G4DynamicParticle ( G4Gamma::Gamma() , e1*dir ) );
272  theResult.AddSecondary ( new G4DynamicParticle ( G4Gamma::Gamma() , -e1*dir ) );
273  }
274  else
275  {
276  //G4cout << "HP_DB Difference is too small(<1keV) to adjust, so that neglect it" << G4endl;
277  }
278 
279  }
280  else //dif_e < 0
281  {
282 
283 // At first reduce KE of the fastest secondary;
286  G4ThreeVector dir = ( theResult.GetSecondary( ifast )->GetParticle()->GetMomentum() ).unit();
287 
288  //G4cout << "HP_DB ifast " << ifast << " ke0 " << ke0 << G4endl;
289 
290  if ( ke0 + dif_e > 0 )
291  {
292  theResult.GetSecondary( ifast )->GetParticle()->SetKineticEnergy( ke0 + dif_e );
293  G4ThreeVector dp = p0 - theResult.GetSecondary( ifast )->GetParticle()->GetMomentum();
294 
296  //theResult.GetSecondary( islow )->GetParticle()->SetMomentum( p - dif_e*dir );
297  theResult.GetSecondary( islow )->GetParticle()->SetMomentum( p + dp );
298  }
299  else
300  {
301  //G4cout << "HP_DB Difference in dif_e too large ( <0MeV ) to adjust, so that give up tuning" << G4endl;
302  }
303 
304  }
305 
306 }
void SetMomentum(const G4ThreeVector &momentum)
G4HadSecondary * GetSecondary(size_t i)
G4double GetKineticEnergy() const
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
const char * p
Definition: xmltok.h:285
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
Definition: G4IonTable.cc:449
Hep3Vector v() const
G4ParticleDefinition * GetDefinition() const
int G4int
Definition: G4Types.hh:78
G4int GetAtomicNumber() const
#define G4UniformRand()
Definition: Randomize.hh:87
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
G4int GetAtomicMass() const
void SetKineticEnergy(G4double aEnergy)
G4LorentzVector Get4Momentum() const
static G4IonTable * GetIonTable()
Definition: G4IonTable.hh:80
G4double GetPDGMass() const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4DynamicParticle * GetParticle()
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
double mag() const
G4int GetNumberOfSecondaries() const
void AddSecondary(G4DynamicParticle *aP)
G4ThreeVector GetMomentum() const
virtual G4HadFinalState* G4NeutronHPFinalState::ApplyYourself ( const G4HadProjectile )
inlinevirtual
G4bool G4NeutronHPFinalState::DoNotAdjustFinalState ( )
inlineprotected

Definition at line 110 of file G4NeutronHPFinalState.hh.

Referenced by G4NeutronHPCaptureFS::ApplyYourself().

110 { return adjustResult; };
G4int G4NeutronHPFinalState::GetM ( )
inline

Definition at line 88 of file G4NeutronHPFinalState.hh.

References theBaseM.

Referenced by G4NeutronHPChannel::GetM().

88 { return theBaseM; };
G4double G4NeutronHPFinalState::GetN ( )
inline

Definition at line 87 of file G4NeutronHPFinalState.hh.

References theBaseA.

Referenced by G4NeutronHPChannel::ApplyYourself(), and G4NeutronHPChannel::GetN().

87 { return theBaseA; };
virtual G4double G4NeutronHPFinalState::GetXsec ( G4double  )
inlinevirtual
virtual G4NeutronHPVector* G4NeutronHPFinalState::GetXsec ( )
inlinevirtual

Reimplemented in G4NeutronHPInelasticCompFS, G4NeutronHPInelasticBaseFS, and G4NeutronHPFissionBaseFS.

Definition at line 83 of file G4NeutronHPFinalState.hh.

83 { return 0; };
G4double G4NeutronHPFinalState::GetZ ( void  )
inline

Definition at line 86 of file G4NeutronHPFinalState.hh.

References theBaseZ.

Referenced by G4NeutronHPChannel::ApplyYourself(), and G4NeutronHPChannel::GetZ().

86 { return theBaseZ; };
G4bool G4NeutronHPFinalState::HasAnyData ( )
inline

Definition at line 80 of file G4NeutronHPFinalState.hh.

References hasAnyData.

Referenced by G4NeutronHPChannel::HasAnyData().

80 {return hasAnyData;};
G4bool G4NeutronHPFinalState::HasFSData ( )
inline
G4bool G4NeutronHPFinalState::HasXsec ( )
inline

Definition at line 78 of file G4NeutronHPFinalState.hh.

References hasXsec.

78 {return hasXsec;};
void G4NeutronHPFinalState::Init ( G4double  A,
G4double  Z,
G4String dirName,
G4String aFSType 
)
inline

Definition at line 65 of file G4NeutronHPFinalState.hh.

References Init().

Referenced by Init(), and G4NeutronHPChannel::UpdateData().

65 { G4int M = 0; Init ( A, Z, M, dirName, aFSType); };
int G4int
Definition: G4Types.hh:78
void Init(G4double A, G4double Z, G4String &dirName, G4String &aFSType)
virtual void G4NeutronHPFinalState::Init ( G4double  A,
G4double  Z,
G4int  M,
G4String dirName,
G4String aFSType 
)
pure virtual
virtual G4NeutronHPFinalState* G4NeutronHPFinalState::New ( )
pure virtual
void G4NeutronHPFinalState::SetA_Z ( G4double  anA,
G4double  aZ,
G4int  aM = 0 
)
inline
void G4NeutronHPFinalState::SetAZMs ( G4double  anA,
G4double  aZ,
G4int  aM,
G4NeutronHPDataUsed  used 
)
inlineprotected

Field Documentation

G4bool G4NeutronHPFinalState::hasAnyData
protected
G4bool G4NeutronHPFinalState::hasFSData
protected
G4bool G4NeutronHPFinalState::hasXsec
protected
G4double G4NeutronHPFinalState::theBaseA
protected
G4int G4NeutronHPFinalState::theBaseM
protected

Definition at line 104 of file G4NeutronHPFinalState.hh.

Referenced by G4NeutronHPFinalState(), GetM(), SetA_Z(), and SetAZMs().

G4double G4NeutronHPFinalState::theBaseZ
protected
G4NeutronHPNames G4NeutronHPFinalState::theNames
protected
G4int G4NeutronHPFinalState::theNDLDataA
protected
G4int G4NeutronHPFinalState::theNDLDataM
protected

Definition at line 113 of file G4NeutronHPFinalState.hh.

G4int G4NeutronHPFinalState::theNDLDataZ
protected
G4HadFinalState G4NeutronHPFinalState::theResult
protected

Definition at line 100 of file G4NeutronHPFinalState.hh.

Referenced by adjust_final_state(), G4NeutronHPD2AInelasticFS::ApplyYourself(), G4NeutronHPT2AInelasticFS::ApplyYourself(), G4NeutronHPPTInelasticFS::ApplyYourself(), G4NeutronHPPInelasticFS::ApplyYourself(), G4NeutronHPPDInelasticFS::ApplyYourself(), G4NeutronHP2NAInelasticFS::ApplyYourself(), G4NeutronHPNXInelasticFS::ApplyYourself(), G4NeutronHPNTInelasticFS::ApplyYourself(), G4NeutronHPNT2AInelasticFS::ApplyYourself(), G4NeutronHPNPInelasticFS::ApplyYourself(), G4NeutronHP2PInelasticFS::ApplyYourself(), G4NeutronHPNInelasticFS::ApplyYourself(), G4NeutronHPNHe3InelasticFS::ApplyYourself(), G4NeutronHPNPAInelasticFS::ApplyYourself(), G4NeutronHPND2AInelasticFS::ApplyYourself(), G4NeutronHPNAInelasticFS::ApplyYourself(), G4NeutronHPN3AInelasticFS::ApplyYourself(), G4NeutronHPN2PInelasticFS::ApplyYourself(), G4NeutronHPN2AInelasticFS::ApplyYourself(), G4NeutronHPDAInelasticFS::ApplyYourself(), G4NeutronHP3AInelasticFS::ApplyYourself(), G4NeutronHPHe3InelasticFS::ApplyYourself(), G4NeutronHP2NDInelasticFS::ApplyYourself(), G4NeutronHP3NAInelasticFS::ApplyYourself(), G4NeutronHPDInelasticFS::ApplyYourself(), G4NeutronHPPAInelasticFS::ApplyYourself(), G4NeutronHPTInelasticFS::ApplyYourself(), G4NeutronHP2AInelasticFS::ApplyYourself(), G4NeutronHPNDInelasticFS::ApplyYourself(), G4NeutronHPAInelasticFS::ApplyYourself(), G4NeutronHP4NInelasticFS::ApplyYourself(), G4NeutronHP3NPInelasticFS::ApplyYourself(), G4NeutronHP3NInelasticFS::ApplyYourself(), G4NeutronHP2N2AInelasticFS::ApplyYourself(), G4NeutronHP2NInelasticFS::ApplyYourself(), G4NeutronHP2NPInelasticFS::ApplyYourself(), G4NeutronHPFissionFS::ApplyYourself(), G4NeutronHPCaptureFS::ApplyYourself(), G4NeutronHPElasticFS::ApplyYourself(), G4FissionLibrary::ApplyYourself(), G4NeutronHPInelasticBaseFS::BaseApply(), and G4NeutronHPInelasticCompFS::CompositeApply().


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