Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4NeutronHPChannel Class Reference

#include <G4NeutronHPChannel.hh>

Public Member Functions

 G4NeutronHPChannel ()
 
 ~G4NeutronHPChannel ()
 
G4double GetXsec (G4double energy)
 
G4double GetWeightedXsec (G4double energy, G4int isoNumber)
 
G4double GetFSCrossSection (G4double energy, G4int isoNumber)
 
G4bool IsActive (G4int isoNumber)
 
G4bool HasFSData (G4int isoNumber)
 
G4bool HasAnyData (G4int isoNumber)
 
G4bool Register (G4NeutronHPFinalState *theFS)
 
void Init (G4Element *theElement, const G4String dirName)
 
void Init (G4Element *theElement, const G4String dirName, const G4String fsType)
 
void UpdateData (G4int A, G4int Z, G4int index, G4double abundance)
 
void UpdateData (G4int A, G4int Z, G4int M, G4int index, G4double abundance)
 
void Harmonise (G4NeutronHPVector *&theStore, G4NeutronHPVector *theNew)
 
G4HadFinalStateApplyYourself (const G4HadProjectile &theTrack, G4int isoNumber=-1)
 
G4int GetNiso ()
 
G4double GetN (G4int i)
 
G4double GetZ (G4int i)
 
G4double GetM (G4int i)
 
G4bool HasDataInAnyFinalState ()
 

Detailed Description

Definition at line 54 of file G4NeutronHPChannel.hh.

Constructor & Destructor Documentation

G4NeutronHPChannel::G4NeutronHPChannel ( )
inline

Definition at line 58 of file G4NeutronHPChannel.hh.

59  : wendtFissionGenerator(getenv("G4NEUTRON_HP_USE_WENDT_FISSION_MODEL") == NULL ? NULL : G4WendtFissionFragmentGenerator::GetInstance())
60  {
61  theChannelData = new G4NeutronHPVector;
62  theBuffer = 0;
63  theIsotopeWiseData = 0;
64  theFinalStates = 0;
65  active = 0;
66  registerCount = -1;
67  }
static G4WendtFissionFragmentGenerator * GetInstance()
G4NeutronHPChannel::~G4NeutronHPChannel ( )
inline

Definition at line 69 of file G4NeutronHPChannel.hh.

70  {
71  delete theChannelData;
72  // Following statement disabled to avoid SEGV
73  // theBuffer is also deleted as "theChannelData" in
74  // ~G4NeutronHPIsoData. FWJ 06-Jul-1999
75  //if(theBuffer != 0) delete theBuffer;
76  if(theIsotopeWiseData != 0) delete [] theIsotopeWiseData;
77  // Deletion of FinalStates disabled to avoid endless looping
78  // in the destructor heirarchy. FWJ 06-Jul-1999
79  //if(theFinalStates != 0)
80  //{
81  // for(i=0; i<niso; i++)
82  // {
83  // delete theFinalStates[i];
84  // }
85  // delete [] theFinalStates;
86  //}
87  // FWJ experiment
88  //if(active!=0) delete [] active;
89 // T.K.
90  if ( theFinalStates != 0 )
91  {
92  for ( G4int i = 0 ; i < niso ; i++ )
93  {
94  delete theFinalStates[i];
95  }
96  delete [] theFinalStates;
97  }
98  if ( active != 0 ) delete [] active;
99 
100  }
int G4int
Definition: G4Types.hh:78

Member Function Documentation

G4HadFinalState * G4NeutronHPChannel::ApplyYourself ( const G4HadProjectile theTrack,
G4int  isoNumber = -1 
)

Definition at line 218 of file G4NeutronHPChannel.cc.

References G4WendtFissionFragmentGenerator::ApplyYourself(), G4NeutronHPFinalState::ApplyYourself(), G4UniformRand, G4NeutronHPManager::GetInstance(), GetM(), G4HadProjectile::GetMaterial(), G4NeutronHPFinalState::GetN(), GetN(), G4NeutronHPManager::GetReactionWhiteBoard(), G4Material::GetTemperature(), G4NeutronHPThermalBoost::GetThermalEnergy(), G4NeutronHPIsoData::GetXsec(), G4NeutronHPFinalState::GetZ(), GetZ(), HasAnyData(), G4NeutronHPReactionWhiteBoard::SetTargA(), G4NeutronHPReactionWhiteBoard::SetTargM(), and G4NeutronHPReactionWhiteBoard::SetTargZ().

Referenced by G4NeutronHPChannelList::ApplyYourself(), and G4FissLib::ApplyYourself().

219  {
220 // G4cout << "G4NeutronHPChannel::ApplyYourself+"<<niso<<G4endl;
221  if ( anIsotope != -1 && anIsotope != -2 )
222  {
223  //Inelastic Case
224  //G4cout << "G4NeutronHPChannel Inelastic Case"
225  //<< " Z= " << this->GetZ(it) << " A = " << this->GetN(it) << G4endl;
228  return theFinalStates[anIsotope]->ApplyYourself(theTrack);
229  }
230  G4double sum=0;
231  G4int it=0;
232  G4double * xsec = new G4double[niso];
233  G4NeutronHPThermalBoost aThermalE;
234  for (G4int i=0; i<niso; i++)
235  {
236  if(theFinalStates[i]->HasAnyData())
237  {
238  xsec[i] = theIsotopeWiseData[i].GetXsec(aThermalE.GetThermalEnergy(theTrack,
239  theFinalStates[i]->GetN(),
240  theFinalStates[i]->GetZ(),
241  theTrack.GetMaterial()->GetTemperature()));
242  sum += xsec[i];
243  }
244  else
245  {
246  xsec[i]=0;
247  }
248  }
249  if(sum == 0)
250  {
251 // G4cout << "G4NeutronHPChannel::ApplyYourself theFinalState->Initialize+"<<G4endl;
252 // G4cout << "G4NeutronHPChannel::ApplyYourself theFinalState->Initialize-"<<G4endl;
253  it = static_cast<G4int>(niso*G4UniformRand());
254  }
255  else
256  {
257 // G4cout << "Are we still here? "<<sum<<G4endl;
258 // G4cout << "TESTHP 23 NISO="<<niso<<G4endl;
259  G4double random = G4UniformRand();
260  G4double running=0;
261 // G4cout << "G4NeutronHPChannel::ApplyYourself Done the sum"<<niso<<G4endl;
262 // G4cout << "TESTHP 24 NISO="<<niso<<G4endl;
263  for (G4int ix=0; ix<niso; ix++)
264  {
265  running += xsec[ix];
266  //if(random<=running/sum)
267  if( sum == 0 || random <= running/sum )
268  {
269  it = ix;
270  break;
271  }
272  }
273  if(it==niso) it--;
274  }
275  delete [] xsec;
276  G4HadFinalState * theFinalState=0;
277  const G4int A = (G4int)this->GetN(it);
278  const G4int Z = (G4int)this->GetZ(it);
279  const G4int M = (G4int)this->GetM(it);
280 
281  //-2:Marker for Fission
282  if(wendtFissionGenerator&&anIsotope==-2)
283  {
284  theFinalState = wendtFissionGenerator->ApplyYourself(theTrack, Z, A);
285  }
286 
287  // Use the standard procedure if the G4FissionFragmentGenerator model fails
288  if (!theFinalState)
289  {
290  while(theFinalState==0)
291  {
292 // G4cout << "TESTHP 24 it="<<it<<G4endl;
293  theFinalState = theFinalStates[it]->ApplyYourself(theTrack);
294  }
295  }
296 
297  //G4cout <<"THE IMPORTANT RETURN"<<G4endl;
298  //G4cout << "TK G4NeutronHPChannel Elastic, Capture and Fission Cases "
299  //<< " Z= " << this->GetZ(it) << " A = " << this->GetN(it) << G4endl;
303 
304  return theFinalState;
305  }
G4HadFinalState * ApplyYourself(const G4HadProjectile &projectile, G4int Z, G4int A)
G4double GetZ(G4int i)
static G4NeutronHPManager * GetInstance()
G4NeutronHPReactionWhiteBoard * GetReactionWhiteBoard()
int G4int
Definition: G4Types.hh:78
G4double GetN(G4int i)
#define G4UniformRand()
Definition: Randomize.hh:87
G4double GetXsec(G4double energy)
G4double GetThermalEnergy(const G4HadProjectile &aP, const G4Element *anE, G4double aT)
virtual G4HadFinalState * ApplyYourself(const G4HadProjectile &)
G4bool HasAnyData(G4int isoNumber)
G4double GetM(G4int i)
G4double GetTemperature() const
Definition: G4Material.hh:180
const G4Material * GetMaterial() const
double G4double
Definition: G4Types.hh:76
G4double G4NeutronHPChannel::GetFSCrossSection ( G4double  energy,
G4int  isoNumber 
)

Definition at line 55 of file G4NeutronHPChannel.cc.

References G4NeutronHPFinalState::GetXsec().

Referenced by G4NeutronHPChannelList::ApplyYourself().

56  {
57  return theFinalStates[isoNumber]->GetXsec(energy);
58  }
double precision function energy(A, Z)
Definition: dpm25nuc6.f:4106
virtual G4double GetXsec(G4double)
G4double G4NeutronHPChannel::GetM ( G4int  i)
inline

Definition at line 132 of file G4NeutronHPChannel.hh.

References G4NeutronHPFinalState::GetM().

Referenced by ApplyYourself().

132 {return theFinalStates[i]->GetM();}
G4double G4NeutronHPChannel::GetN ( G4int  i)
inline

Definition at line 130 of file G4NeutronHPChannel.hh.

References G4NeutronHPFinalState::GetN().

Referenced by G4NeutronHPChannelList::ApplyYourself(), and ApplyYourself().

130 {return theFinalStates[i]->GetN();}
G4int G4NeutronHPChannel::GetNiso ( )
inline

Definition at line 128 of file G4NeutronHPChannel.hh.

Referenced by G4NeutronHPChannelList::ApplyYourself().

128 {return niso;}
G4double G4NeutronHPChannel::GetWeightedXsec ( G4double  energy,
G4int  isoNumber 
)

Definition at line 50 of file G4NeutronHPChannel.cc.

References G4NeutronHPIsoData::GetXsec().

Referenced by G4NeutronHPChannelList::ApplyYourself().

51  {
52  return theIsotopeWiseData[isoNumber].GetXsec(energy);
53  }
double precision function energy(A, Z)
Definition: dpm25nuc6.f:4106
G4double GetXsec(G4double energy)
G4double G4NeutronHPChannel::GetXsec ( G4double  energy)

Definition at line 45 of file G4NeutronHPChannel.cc.

References G4NeutronHPVector::GetXsec(), and G4INCL::Math::max().

Referenced by G4FissLib::ApplyYourself().

46  {
47  return std::max(0., theChannelData->GetXsec(energy));
48  }
double precision function energy(A, Z)
Definition: dpm25nuc6.f:4106
G4double GetXsec(G4int i)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double G4NeutronHPChannel::GetZ ( G4int  i)
inline

Definition at line 131 of file G4NeutronHPChannel.hh.

References G4NeutronHPFinalState::GetZ().

Referenced by G4NeutronHPChannelList::ApplyYourself(), ApplyYourself(), and Register().

131 {return theFinalStates[i]->GetZ();}
void G4NeutronHPChannel::Harmonise ( G4NeutronHPVector *&  theStore,
G4NeutronHPVector theNew 
)

Definition at line 173 of file G4NeutronHPChannel.cc.

References test::a, G4NeutronHPVector::GetEnergy(), G4NeutronHPVector::GetVectorLength(), G4NeutronHPVector::GetXsec(), G4INCL::Math::max(), n, and G4NeutronHPVector::SetData().

Referenced by UpdateData().

174  {
175  G4int s_tmp = 0, n=0, m_tmp=0;
176  G4NeutronHPVector * theMerge = new G4NeutronHPVector;
177  G4NeutronHPVector * anActive = theStore;
178  G4NeutronHPVector * aPassive = theNew;
179  G4NeutronHPVector * tmp;
180  G4int a = s_tmp, p = n, t;
181  while (a<anActive->GetVectorLength()&&p<aPassive->GetVectorLength())
182  {
183  if(anActive->GetEnergy(a) <= aPassive->GetEnergy(p))
184  {
185  G4double xa = anActive->GetEnergy(a);
186  theMerge->SetData(m_tmp, xa, anActive->GetXsec(a)+std::max(0., aPassive->GetXsec(xa)) );
187  m_tmp++;
188  a++;
189  G4double xp = aPassive->GetEnergy(p);
190  if( std::abs(std::abs(xp-xa)/xa)<0.001 )
191  {
192  p++;
193  }
194  } else {
195  tmp = anActive; t=a;
196  anActive = aPassive; a=p;
197  aPassive = tmp; p=t;
198  }
199  }
200  while (a!=anActive->GetVectorLength())
201  {
202  theMerge->SetData(m_tmp++, anActive->GetEnergy(a), anActive->GetXsec(a));
203  a++;
204  }
205  while (p!=aPassive->GetVectorLength())
206  {
207  if(std::abs(theMerge->GetEnergy(std::max(0,m_tmp-1))-aPassive->GetEnergy(p))/aPassive->GetEnergy(p)>0.001)
208  theMerge->SetData(m_tmp++, aPassive->GetEnergy(p), aPassive->GetXsec(p));
209  p++;
210  }
211  delete theStore;
212  theStore = theMerge;
213  }
G4double GetEnergy(G4int i) const
G4int GetVectorLength() const
const char * p
Definition: xmltok.h:285
void SetData(G4int i, G4double x, G4double y)
int G4int
Definition: G4Types.hh:78
const G4int n
G4double GetXsec(G4int i)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
double G4double
Definition: G4Types.hh:76
G4bool G4NeutronHPChannel::HasAnyData ( G4int  isoNumber)
inline

Definition at line 112 of file G4NeutronHPChannel.hh.

References G4NeutronHPFinalState::HasAnyData().

Referenced by ApplyYourself(), HasDataInAnyFinalState(), and UpdateData().

112 { return theFinalStates[isoNumber]->HasAnyData(); }
G4bool G4NeutronHPChannel::HasDataInAnyFinalState ( )
inline

Definition at line 134 of file G4NeutronHPChannel.hh.

References HasAnyData().

Referenced by Register().

135  {
136  G4bool result = false;
137  G4int i;
138  for(i=0; i<niso; i++)
139  {
140  if(theFinalStates[i]->HasAnyData()) result = true;
141  }
142  return result;
143  }
int G4int
Definition: G4Types.hh:78
bool G4bool
Definition: G4Types.hh:79
G4bool HasAnyData(G4int isoNumber)
G4bool G4NeutronHPChannel::HasFSData ( G4int  isoNumber)
inline

Definition at line 110 of file G4NeutronHPChannel.hh.

References G4NeutronHPFinalState::HasFSData().

110 { return theFinalStates[isoNumber]->HasFSData(); }
void G4NeutronHPChannel::Init ( G4Element theElement,
const G4String  dirName 
)

Definition at line 67 of file G4NeutronHPChannel.cc.

Referenced by G4FissLib::G4FissLib(), Init(), and G4NeutronHPChannelList::Register().

68  {
69  theDir = dirName;
70  theElement = anElement;
71  }
void G4NeutronHPChannel::Init ( G4Element theElement,
const G4String  dirName,
const G4String  fsType 
)

Definition at line 61 of file G4NeutronHPChannel.cc.

References Init().

62  {
63  theFSType = aFSType;
64  Init(anElement, dirName);
65  }
void Init(G4Element *theElement, const G4String dirName)
G4bool G4NeutronHPChannel::IsActive ( G4int  isoNumber)
inline

Definition at line 108 of file G4NeutronHPChannel.hh.

108 { return active[isoNumber]; }
G4bool G4NeutronHPChannel::Register ( G4NeutronHPFinalState theFS)

Definition at line 73 of file G4NeutronHPChannel.cc.

References G4lrint(), G4StableIsotopes::GetAbundance(), G4StableIsotopes::GetFirstIsotope(), G4Element::GetIsotope(), G4StableIsotopes::GetIsotopeNucleonCount(), G4Isotope::Getm(), G4Isotope::GetN(), G4StableIsotopes::GetNumberOfIsotopes(), G4Element::GetNumberOfIsotopes(), G4Element::GetRelativeAbundanceVector(), G4Element::GetZ(), GetZ(), HasDataInAnyFinalState(), G4NeutronHPFinalState::New(), python.hepunit::perCent, G4NeutronHPFinalState::SetA_Z(), and UpdateData().

Referenced by G4FissLib::G4FissLib(), and G4NeutronHPChannelList::Register().

74  {
75  registerCount++;
76  G4int Z = G4lrint(theElement->GetZ());
77 
78  Z = Z-registerCount;
79  if ( registerCount > 5 ) throw G4HadronicException(__FILE__, __LINE__, "Channel: Do not know what to do with this material"); // for Elastic, Capture, Fission case
80  if ( Z < 1 ) return false;
81 /*
82  if(registerCount<5)
83  {
84  Z = Z-registerCount;
85  }
86 */
87  //if(Z=theElement->GetZ()-5) throw G4HadronicException(__FILE__, __LINE__, "Channel: Do not know what to do with this material");
88  // Bug fix by TK on behalf of AH
89  if ( Z <=theElement->GetZ()-5 ) throw G4HadronicException(__FILE__, __LINE__, "Channel: Do not know what to do with this material");
90  G4int count = 0;
91  if(registerCount==0) count = theElement->GetNumberOfIsotopes();
92  if(count == 0||registerCount!=0) count +=
93  theStableOnes.GetNumberOfIsotopes(Z);
94  niso = count;
95  delete [] theIsotopeWiseData;
96  theIsotopeWiseData = new G4NeutronHPIsoData [niso];
97  delete [] active;
98  active = new G4bool[niso];
99 
100  delete [] theFinalStates;
101  theFinalStates = new G4NeutronHPFinalState * [niso];
102  delete theChannelData;
103  theChannelData = new G4NeutronHPVector;
104  for(G4int i=0; i<niso; i++)
105  {
106  theFinalStates[i] = theFS->New();
107  }
108  count = 0;
109  G4int nIsos = niso;
110  if(theElement->GetNumberOfIsotopes()!=0&&registerCount==0)
111  {
112  for (G4int i1=0; i1<nIsos; i1++)
113  {
114  // G4cout <<" Init: normal case"<<G4endl;
115  G4int A = theElement->GetIsotope(i1)->GetN();
116  G4int M = theElement->GetIsotope(i1)->Getm();
117  G4double frac = theElement->GetRelativeAbundanceVector()[i1]/perCent;
118  //theFinalStates[i1]->SetA_Z(A, Z);
119  //UpdateData(A, Z, count++, frac);
120  theFinalStates[i1]->SetA_Z(A, Z, M);
121  UpdateData(A, Z, M, count++, frac);
122  }
123  } else {
124  //G4cout <<" Init: mean case: "
125  // <<theStableOnes.GetNumberOfIsotopes(Z)<<" "
126  // <<Z<<" "<<theElement
127  // << G4endl;
128  G4int first = theStableOnes.GetFirstIsotope(Z);
129  for(G4int i1=0;
130  i1<theStableOnes.GetNumberOfIsotopes(Z);
131  i1++)
132  {
133  G4int A = theStableOnes.GetIsotopeNucleonCount(first+i1);
134  G4double frac = theStableOnes.GetAbundance(first+i1);
135  theFinalStates[i1]->SetA_Z(A, Z);
136  UpdateData(A, Z, count++, frac);
137  }
138  }
139  G4bool result = HasDataInAnyFinalState();
140  return result;
141  }
size_t GetNumberOfIsotopes() const
Definition: G4Element.hh:158
virtual G4NeutronHPFinalState * New()=0
G4double GetZ(G4int i)
G4int GetFirstIsotope(G4int Z)
G4double GetZ() const
Definition: G4Element.hh:131
int G4int
Definition: G4Types.hh:78
G4int GetN() const
Definition: G4Isotope.hh:94
G4int Getm() const
Definition: G4Isotope.hh:100
bool G4bool
Definition: G4Types.hh:79
void UpdateData(G4int A, G4int Z, G4int index, G4double abundance)
G4double * GetRelativeAbundanceVector() const
Definition: G4Element.hh:166
void SetA_Z(G4double anA, G4double aZ, G4int aM=0)
G4int GetNumberOfIsotopes(G4int Z)
G4int GetIsotopeNucleonCount(G4int number)
int G4lrint(double ad)
Definition: templates.hh:163
const G4Isotope * GetIsotope(G4int iso) const
Definition: G4Element.hh:169
float perCent
Definition: hepunit.py:239
G4double GetAbundance(G4int number)
double G4double
Definition: G4Types.hh:76
void G4NeutronHPChannel::UpdateData ( G4int  A,
G4int  Z,
G4int  index,
G4double  abundance 
)
inline

Definition at line 121 of file G4NeutronHPChannel.hh.

References UpdateData().

Referenced by Register(), and UpdateData().

121 { G4int M = 0; UpdateData( A, Z, M, index, abundance); };
int G4int
Definition: G4Types.hh:78
void UpdateData(G4int A, G4int Z, G4int index, G4double abundance)
void G4NeutronHPChannel::UpdateData ( G4int  A,
G4int  Z,
G4int  M,
G4int  index,
G4double  abundance 
)

Definition at line 144 of file G4NeutronHPChannel.cc.

References G4NeutronHPIsoData::FillChannelData(), G4NeutronHPFinalState::GetXsec(), Harmonise(), HasAnyData(), G4NeutronHPIsoData::Init(), G4NeutronHPFinalState::Init(), G4WendtFissionFragmentGenerator::InitializeANucleus(), G4NeutronHPIsoData::MakeChannelData(), and G4NeutronHPVector::Times().

145  {
146  // Initialze the G4FissionFragment generator for this isomer if needed
147  if(wendtFissionGenerator)
148  {
149  wendtFissionGenerator->InitializeANucleus(A, Z, M, theDir);
150  }
151 
152  theFinalStates[index]->Init(A, Z, M, theDir, theFSType);
153  if(!theFinalStates[index]->HasAnyData()) return; // nothing there for exactly this isotope.
154 
155  // the above has put the X-sec into the FS
156  theBuffer = 0;
157  if(theFinalStates[index]->HasXsec())
158  {
159  theBuffer = theFinalStates[index]->GetXsec();
160  theBuffer->Times(abundance/100.);
161  theIsotopeWiseData[index].FillChannelData(theBuffer);
162  }
163  else // get data from CrossSection directory
164  {
165  G4String tString = "/CrossSection";
166  //active[index] = theIsotopeWiseData[index].Init(A, Z, abundance, theDir, tString);
167  active[index] = theIsotopeWiseData[index].Init(A, Z, M, abundance, theDir, tString);
168  if(active[index]) theBuffer = theIsotopeWiseData[index].MakeChannelData();
169  }
170  if(theBuffer != 0) Harmonise(theChannelData, theBuffer);
171  }
void Harmonise(G4NeutronHPVector *&theStore, G4NeutronHPVector *theNew)
void Times(G4double factor)
G4bool Init(G4int A, G4int Z, G4double abun, G4String dirName, G4String aFSType)
void InitializeANucleus(const G4int A, const G4int Z, const G4int M, const G4String &dataDirectory)
void FillChannelData(G4NeutronHPVector *aBuffer)
void Init(G4double A, G4double Z, G4String &dirName, G4String &aFSType)
G4bool HasAnyData(G4int isoNumber)
virtual G4double GetXsec(G4double)
G4NeutronHPVector * MakeChannelData()

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