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

#include <G4ParticleHPChannel.hh>

Public Member Functions

 G4ParticleHPChannel (G4ParticleDefinition *projectile)
 
 G4ParticleHPChannel ()
 
 ~G4ParticleHPChannel ()
 
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 (G4ParticleHPFinalState *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, G4ParticleDefinition *projectile)
 
void UpdateData (G4int A, G4int Z, G4int M, G4int index, G4double abundance, G4ParticleDefinition *projectile)
 
void Harmonise (G4ParticleHPVector *&theStore, G4ParticleHPVector *theNew)
 
G4HadFinalStateApplyYourself (const G4HadProjectile &theTrack, G4int isoNumber=-1)
 
G4int GetNiso ()
 
G4double GetN (G4int i)
 
G4double GetZ (G4int i)
 
G4double GetM (G4int i)
 
G4bool HasDataInAnyFinalState ()
 
void DumpInfo ()
 
G4String GetFSType () const
 
G4ParticleHPFinalState ** GetFinalStates () const
 

Detailed Description

Definition at line 55 of file G4ParticleHPChannel.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPChannel() [1/2]

G4ParticleHPChannel::G4ParticleHPChannel ( G4ParticleDefinition projectile)
inline

Definition at line 59 of file G4ParticleHPChannel.hh.

59 :
60 wendtFissionGenerator( G4ParticleHPManager::GetInstance()->GetUseWendtFissionModel() ?
62 {
63 if ( G4ParticleHPManager::GetInstance()->GetUseWendtFissionModel() ) {
64 // Make sure both fission fragment models are not active at same time
66 }
67 theProjectile = const_cast<G4ParticleDefinition*>(projectile);
68 theChannelData = new G4ParticleHPVector;
69 theBuffer = 0;
70 theIsotopeWiseData = 0;
71 theFinalStates = 0;
72 active = 0;
73 registerCount = -1;
74 niso = -1;
75 theElement = NULL;
76 }
void SetProduceFissionFragments(G4bool val)
static G4ParticleHPManager * GetInstance()
static G4WendtFissionFragmentGenerator * GetInstance()

◆ G4ParticleHPChannel() [2/2]

G4ParticleHPChannel::G4ParticleHPChannel ( )
inline

Definition at line 78 of file G4ParticleHPChannel.hh.

78 : wendtFissionGenerator( G4ParticleHPManager::GetInstance()->GetUseWendtFissionModel() ?
80 {
81 if ( G4ParticleHPManager::GetInstance()->GetUseWendtFissionModel() ) {
82 // Make sure both fission fragment models are not active at same time
84 }
85 theProjectile = G4Neutron::Neutron();
86 theChannelData = new G4ParticleHPVector;
87 theBuffer = 0;
88 theIsotopeWiseData = 0;
89 theFinalStates = 0;
90 active = 0;
91 registerCount = -1;
92 niso = -1;
93 theElement = NULL;
94 }
static G4Neutron * Neutron()
Definition: G4Neutron.cc:103

◆ ~G4ParticleHPChannel()

G4ParticleHPChannel::~G4ParticleHPChannel ( )
inline

Definition at line 96 of file G4ParticleHPChannel.hh.

97 {
98 delete theChannelData;
99 // Following statement disabled to avoid SEGV
100 // theBuffer is also deleted as "theChannelData" in
101 // ~G4ParticleHPIsoData. FWJ 06-Jul-1999
102 //if(theBuffer != 0) delete theBuffer;
103 if(theIsotopeWiseData != 0) delete [] theIsotopeWiseData;
104 // Deletion of FinalStates disabled to avoid endless looping
105 // in the destructor heirarchy. FWJ 06-Jul-1999
106 //if(theFinalStates != 0)
107 //{
108 // for(i=0; i<niso; i++)
109 // {
110 // delete theFinalStates[i];
111 // }
112 // delete [] theFinalStates;
113 //}
114 // FWJ experiment
115 //if(active!=0) delete [] active;
116 // T.K.
117 if ( theFinalStates != 0 )
118 {
119 for ( G4int i = 0 ; i < niso ; i++ )
120 {
121 delete theFinalStates[i];
122 }
123 delete [] theFinalStates;
124 }
125 if ( active != 0 ) delete [] active;
126 }
int G4int
Definition: G4Types.hh:85

Member Function Documentation

◆ ApplyYourself()

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

Definition at line 223 of file G4ParticleHPChannel.cc.

225 {
226// G4cout << "G4ParticleHPChannel::ApplyYourself+"<<niso<<G4endl;
227 if ( anIsotope != -1 && anIsotope != -2 )
228 {
229 //Inelastic Case
230 //G4cout << "G4ParticleHPChannel Inelastic Case"
231 //<< " Z= " << this->GetZ(it) << " A = " << this->GetN(it) << G4endl;
234 return theFinalStates[anIsotope]->ApplyYourself(theTrack);
235 }
236 G4double sum=0;
237 G4int it=0;
238 G4double * xsec = new G4double[niso];
239 G4ParticleHPThermalBoost aThermalE;
240 for (G4int i=0; i<niso; i++)
241 {
242 if(theFinalStates[i]->HasAnyData())
243 {
244 xsec[i] = theIsotopeWiseData[i].GetXsec(aThermalE.GetThermalEnergy(theTrack,
245 theFinalStates[i]->GetN(),
246 theFinalStates[i]->GetZ(),
247 theTrack.GetMaterial()->GetTemperature()));
248 sum += xsec[i];
249 }
250 else
251 {
252 xsec[i]=0;
253 }
254 }
255 if(sum == 0)
256 {
257// G4cout << "G4ParticleHPChannel::ApplyYourself theFinalState->Initialize+"<<G4endl;
258// G4cout << "G4ParticleHPChannel::ApplyYourself theFinalState->Initialize-"<<G4endl;
259 it = static_cast<G4int>(niso*G4UniformRand());
260 }
261 else
262 {
263// G4cout << "Are we still here? "<<sum<<G4endl;
264// G4cout << "TESTHP 23 NISO="<<niso<<G4endl;
265 G4double random = G4UniformRand();
266 G4double running=0;
267// G4cout << "G4ParticleHPChannel::ApplyYourself Done the sum"<<niso<<G4endl;
268// G4cout << "TESTHP 24 NISO="<<niso<<G4endl;
269 for (G4int ix=0; ix<niso; ix++)
270 {
271 running += xsec[ix];
272 //if(random<=running/sum)
273 if( sum == 0 || random <= running/sum )
274 {
275 it = ix;
276 break;
277 }
278 }
279 if(it==niso) it--;
280 }
281 delete [] xsec;
282 G4HadFinalState * theFinalState=0;
283 const G4int A = (G4int)this->GetN(it);
284 const G4int Z = (G4int)this->GetZ(it);
285 const G4int M = (G4int)this->GetM(it);
286
287 //-2:Marker for Fission
288 if(wendtFissionGenerator&&anIsotope==-2)
289 {
290 theFinalState = wendtFissionGenerator->ApplyYourself(theTrack, Z, A);
291 }
292
293 // Use the standard procedure if the G4FissionFragmentGenerator model fails
294 if (!theFinalState)
295 {
296
297 G4int icounter=0;
298 G4int icounter_max=1024;
299 while(theFinalState==0) // Loop checking, 11.05.2015, T. Koi
300 {
301 icounter++;
302 if ( icounter > icounter_max ) {
303 G4cout << "Loop-counter exceeded the threshold value at " << __LINE__ << "th line of " << __FILE__ << "." << G4endl;
304 break;
305 }
306// G4cout << "TESTHP 24 it="<<it<<G4endl;
307 theFinalState = theFinalStates[it]->ApplyYourself(theTrack);
308 }
309 }
310
311 //G4cout <<"THE IMPORTANT RETURN"<<G4endl;
312 //G4cout << "TK G4ParticleHPChannel Elastic, Capture and Fission Cases "
313 //<< " Z= " << this->GetZ(it) << " A = " << this->GetN(it) << G4endl;
317
318 return theFinalState;
319 }
#define M(row, col)
double G4double
Definition: G4Types.hh:83
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
const G4Material * GetMaterial() const
G4double GetTemperature() const
Definition: G4Material.hh:177
G4bool HasAnyData(G4int isoNumber)
G4double GetM(G4int i)
G4double GetN(G4int i)
G4double GetZ(G4int i)
virtual G4HadFinalState * ApplyYourself(const G4HadProjectile &)
G4double GetXsec(G4double energy)
G4ParticleHPReactionWhiteBoard * GetReactionWhiteBoard()
G4double GetThermalEnergy(const G4HadProjectile &aP, const G4Element *anE, G4double aT)
G4HadFinalState * ApplyYourself(const G4HadProjectile &projectile, G4int Z, G4int A)

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

◆ DumpInfo()

void G4ParticleHPChannel::DumpInfo ( )

Definition at line 322 of file G4ParticleHPChannel.cc.

322 {
323
324 G4cout<<" Element: "<<theElement->GetName()<<G4endl;
325 G4cout<<" Directory name: "<<theDir<<G4endl;
326 G4cout<<" FS name: "<<theFSType<<G4endl;
327 G4cout<<" Number of Isotopes: "<<niso<<G4endl;
328 G4cout<<" Have cross sections: "<<G4endl;
329 for(int i=0;i<niso;i++){
330 G4cout<<theFinalStates[i]->HasXsec()<<" ";
331 }
332 G4cout<<G4endl;
333 if(theChannelData){
334 G4cout<<" Cross Section (total for this channel):"<<G4endl;
335 int np=theChannelData->GetVectorLength();
336 G4cout<<np<<G4endl;
337 for(int i=0;i<np;i++){
338 G4cout<<theChannelData->GetEnergy(i)/eV<<" "<<theChannelData->GetXsec(i)<<G4endl;
339 }
340 }
341
342}
const G4String & GetName() const
Definition: G4Element.hh:127
G4double GetXsec(G4int i)
G4double GetEnergy(G4int i) const
G4int GetVectorLength() const

Referenced by G4ParticleHPChannelList::DumpInfo().

◆ GetFinalStates()

G4ParticleHPFinalState ** G4ParticleHPChannel::GetFinalStates ( ) const
inline

Definition at line 177 of file G4ParticleHPChannel.hh.

177 {
178 return theFinalStates;
179 }

◆ GetFSCrossSection()

G4double G4ParticleHPChannel::GetFSCrossSection ( G4double  energy,
G4int  isoNumber 
)

Definition at line 61 of file G4ParticleHPChannel.cc.

62{
63 return theFinalStates[isoNumber]->GetXsec(energy);
64}
virtual G4double GetXsec(G4double)

Referenced by G4ParticleHPChannelList::ApplyYourself().

◆ GetFSType()

G4String G4ParticleHPChannel::GetFSType ( ) const
inline

Definition at line 173 of file G4ParticleHPChannel.hh.

173 {
174 return theFSType;
175 }

◆ GetM()

G4double G4ParticleHPChannel::GetM ( G4int  i)
inline

Definition at line 158 of file G4ParticleHPChannel.hh.

158{return theFinalStates[i]->GetM();}

Referenced by ApplyYourself().

◆ GetN()

G4double G4ParticleHPChannel::GetN ( G4int  i)
inline

Definition at line 156 of file G4ParticleHPChannel.hh.

156{return theFinalStates[i]->GetN();}

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

◆ GetNiso()

G4int G4ParticleHPChannel::GetNiso ( )
inline

Definition at line 154 of file G4ParticleHPChannel.hh.

154{return niso;}

Referenced by G4ParticleHPChannelList::ApplyYourself().

◆ GetWeightedXsec()

G4double G4ParticleHPChannel::GetWeightedXsec ( G4double  energy,
G4int  isoNumber 
)

Definition at line 56 of file G4ParticleHPChannel.cc.

57{
58 return theIsotopeWiseData[isoNumber].GetXsec(energy);
59}

Referenced by G4ParticleHPChannelList::ApplyYourself().

◆ GetXsec()

G4double G4ParticleHPChannel::GetXsec ( G4double  energy)

Definition at line 51 of file G4ParticleHPChannel.cc.

52{
53 return std::max(0., theChannelData->GetXsec(energy));
54}

Referenced by G4FissLib::ApplyYourself().

◆ GetZ()

G4double G4ParticleHPChannel::GetZ ( G4int  i)
inline

Definition at line 157 of file G4ParticleHPChannel.hh.

157{return theFinalStates[i]->GetZ();}

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

◆ Harmonise()

void G4ParticleHPChannel::Harmonise ( G4ParticleHPVector *&  theStore,
G4ParticleHPVector theNew 
)

Definition at line 181 of file G4ParticleHPChannel.cc.

182 {
183 G4int s_tmp = 0, n=0, m_tmp=0;
184 G4ParticleHPVector * theMerge = new G4ParticleHPVector;
185 G4ParticleHPVector * anActive = theStore;
186 G4ParticleHPVector * aPassive = theNew;
187 G4ParticleHPVector * tmp;
188 G4int a = s_tmp, p = n, t;
189 while (a<anActive->GetVectorLength()&&p<aPassive->GetVectorLength()) // Loop checking, 11.05.2015, T. Koi
190 {
191 if(anActive->GetEnergy(a) <= aPassive->GetEnergy(p))
192 {
193 G4double xa = anActive->GetEnergy(a);
194 theMerge->SetData(m_tmp, xa, anActive->GetXsec(a)+std::max(0., aPassive->GetXsec(xa)) );
195 m_tmp++;
196 a++;
197 G4double xp = aPassive->GetEnergy(p);
198 if( std::abs(std::abs(xp-xa)/xa)<0.001 )
199 {
200 ++p;
201 }
202 } else {
203 tmp = anActive; t=a;
204 anActive = aPassive; a=p;
205 aPassive = tmp; p=t;
206 }
207 }
208 while (a!=anActive->GetVectorLength()) // Loop checking, 11.05.2015, T. Koi
209 {
210 theMerge->SetData(m_tmp++, anActive->GetEnergy(a), anActive->GetXsec(a));
211 ++a;
212 }
213 while (p!=aPassive->GetVectorLength()) // Loop checking, 11.05.2015, T. Koi
214 {
215 if(std::abs(theMerge->GetEnergy(std::max(0,m_tmp-1))-aPassive->GetEnergy(p))/aPassive->GetEnergy(p)>0.001)
216 theMerge->SetData(m_tmp++, aPassive->GetEnergy(p), aPassive->GetXsec(p));
217 ++p;
218 }
219 delete theStore;
220 theStore = theMerge;
221 }
void SetData(G4int i, G4double x, G4double y)

Referenced by UpdateData().

◆ HasAnyData()

G4bool G4ParticleHPChannel::HasAnyData ( G4int  isoNumber)
inline

Definition at line 138 of file G4ParticleHPChannel.hh.

138{ return theFinalStates[isoNumber]->HasAnyData(); }

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

◆ HasDataInAnyFinalState()

G4bool G4ParticleHPChannel::HasDataInAnyFinalState ( )
inline

Definition at line 160 of file G4ParticleHPChannel.hh.

161 {
162 G4bool result = false;
163 G4int i;
164 for(i=0; i<niso; i++)
165 {
166 if(theFinalStates[i]->HasAnyData()) result = true;
167 }
168 return result;
169 }
bool G4bool
Definition: G4Types.hh:86

Referenced by Register().

◆ HasFSData()

G4bool G4ParticleHPChannel::HasFSData ( G4int  isoNumber)
inline

Definition at line 136 of file G4ParticleHPChannel.hh.

136{ return theFinalStates[isoNumber]->HasFSData(); }

◆ Init() [1/2]

void G4ParticleHPChannel::Init ( G4Element theElement,
const G4String  dirName 
)

Definition at line 73 of file G4ParticleHPChannel.cc.

74 {
75 theDir = dirName;
76 theElement = anElement;
77 }

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

◆ Init() [2/2]

void G4ParticleHPChannel::Init ( G4Element theElement,
const G4String  dirName,
const G4String  fsType 
)

Definition at line 66 of file G4ParticleHPChannel.cc.

68 {
69 theFSType = aFSType;
70 Init(anElement, dirName);
71 }
void Init(G4Element *theElement, const G4String dirName)

◆ IsActive()

G4bool G4ParticleHPChannel::IsActive ( G4int  isoNumber)
inline

Definition at line 134 of file G4ParticleHPChannel.hh.

134{ return active[isoNumber]; }

◆ Register()

G4bool G4ParticleHPChannel::Register ( G4ParticleHPFinalState theFS)

Definition at line 79 of file G4ParticleHPChannel.cc.

80 {
81 registerCount++;
82 G4int Z = G4lrint(theElement->GetZ());
83
84 Z = Z-registerCount;
85 if ( registerCount > 5 ) throw G4HadronicException(__FILE__, __LINE__, "Channel: Do not know what to do with this material"); // for Elastic, Capture, Fission case
86 if ( Z < 1 ) return false;
87/*
88 if(registerCount<5)
89 {
90 Z = Z-registerCount;
91 }
92*/
93 //if(Z=theElement->GetZ()-5) throw G4HadronicException(__FILE__, __LINE__, "Channel: Do not know what to do with this material");
94 // Bug fix by TK on behalf of AH
95 //if ( Z <=theElement->GetZ()-5 ) throw G4HadronicException(__FILE__, __LINE__, "Channel: Do not know what to do with this material");
96 G4int count = 0;
97 if(registerCount==0) count = (G4int)theElement->GetNumberOfIsotopes();
98 if(count == 0||registerCount!=0) count +=
99 theStableOnes.GetNumberOfIsotopes(Z);
100 niso = count;
101 delete [] theIsotopeWiseData;
102 theIsotopeWiseData = new G4ParticleHPIsoData [niso];
103 delete [] active;
104 active = new G4bool[niso];
105
106 delete [] theFinalStates;
107 theFinalStates = new G4ParticleHPFinalState * [niso];
108 delete theChannelData;
109 theChannelData = new G4ParticleHPVector;
110 for(G4int i=0; i<niso; ++i)
111 {
112 theFinalStates[i] = theFS->New();
113 theFinalStates[i]->SetProjectile(theProjectile);
114 }
115 count = 0;
116 G4int nIsos = niso;
117 if(theElement->GetNumberOfIsotopes()!=0&&registerCount==0)
118 {
119 for (G4int i1=0; i1<nIsos; ++i1)
120 {
121 // G4cout <<" Init: normal case"<<G4endl;
122 G4int A = theElement->GetIsotope(i1)->GetN();
123 G4int M = theElement->GetIsotope(i1)->Getm();
124 G4double frac = theElement->GetRelativeAbundanceVector()[i1]/perCent;
125 //theFinalStates[i1]->SetA_Z(A, Z);
126 //UpdateData(A, Z, count++, frac);
127 theFinalStates[i1]->SetA_Z(A, Z, M);
128 UpdateData(A, Z, M, count++, frac, theProjectile);
129 }
130 } else {
131 //G4cout <<" Init: mean case: "
132 // <<theStableOnes.GetNumberOfIsotopes(Z)<<" "
133 // <<Z<<" "<<theElement
134 // << G4endl;
135 G4int first = theStableOnes.GetFirstIsotope(Z);
136 for(G4int i1=0; i1<theStableOnes.GetNumberOfIsotopes(Z); ++i1)
137 {
138 G4int A = theStableOnes.GetIsotopeNucleonCount(first+i1);
139 G4double frac = theStableOnes.GetAbundance(first+i1);
140 theFinalStates[i1]->SetA_Z(A, Z);
141 UpdateData(A, Z, count++, frac, theProjectile);
142 }
143 }
145
146 //To avoid issuing hash by worker threads
147 if ( result ) theChannelData->Hash();
148
149 return result;
150 }
G4double * GetRelativeAbundanceVector() const
Definition: G4Element.hh:167
G4double GetZ() const
Definition: G4Element.hh:131
const G4Isotope * GetIsotope(G4int iso) const
Definition: G4Element.hh:170
size_t GetNumberOfIsotopes() const
Definition: G4Element.hh:159
G4int Getm() const
Definition: G4Isotope.hh:99
G4int GetN() const
Definition: G4Isotope.hh:93
void UpdateData(G4int A, G4int Z, G4int index, G4double abundance, G4ParticleDefinition *projectile)
void SetA_Z(G4double anA, G4double aZ, G4int aM=0)
virtual G4ParticleHPFinalState * New()=0
void SetProjectile(G4ParticleDefinition *projectile)
G4double GetAbundance(G4int number)
G4int GetFirstIsotope(G4int Z)
G4int GetNumberOfIsotopes(G4int Z)
G4int GetIsotopeNucleonCount(G4int number)
int G4lrint(double ad)
Definition: templates.hh:134

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

◆ UpdateData() [1/2]

void G4ParticleHPChannel::UpdateData ( G4int  A,
G4int  Z,
G4int  index,
G4double  abundance,
G4ParticleDefinition projectile 
)
inline

Definition at line 147 of file G4ParticleHPChannel.hh.

147{ G4int M = 0; UpdateData( A, Z, M, index, abundance, projectile); };

Referenced by Register(), and UpdateData().

◆ UpdateData() [2/2]

void G4ParticleHPChannel::UpdateData ( G4int  A,
G4int  Z,
G4int  M,
G4int  index,
G4double  abundance,
G4ParticleDefinition projectile 
)

Definition at line 152 of file G4ParticleHPChannel.cc.

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

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