Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/hadronic/models/particle_hp/src/G4ParticleHPChannel.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/hadronic/models/particle_hp/src/G4ParticleHPChannel.cc (Version 11.3.0) and /processes/hadronic/models/particle_hp/src/G4ParticleHPChannel.cc (Version 11.2.2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // neutron_hp -- source file                       26 // neutron_hp -- source file
 27 // J.P. Wellisch, Nov-1996                         27 // J.P. Wellisch, Nov-1996
 28 // A prototype of the low energy neutron trans     28 // A prototype of the low energy neutron transport model.
 29 //                                                 29 //
 30 // 070523 bug fix for G4FPE_DEBUG on by A. How     30 // 070523 bug fix for G4FPE_DEBUG on by A. Howard ( and T. Koi)
 31 // 071031 bug fix T. Koi on behalf of A. Howar     31 // 071031 bug fix T. Koi on behalf of A. Howard
 32 // 081203 bug fix in Register method by T. Koi     32 // 081203 bug fix in Register method by T. Koi
 33 //                                                 33 //
 34 // P. Arce, June-2014 Conversion neutron_hp to     34 // P. Arce, June-2014 Conversion neutron_hp to particle_hp
 35 //                                                 35 //
 36 // June-2019 - E. Mendoza --> Modification to      36 // June-2019 - E. Mendoza --> Modification to allow using an incomplete
 37 //   data library if the G4NEUTRONHP_SKIP_MISS     37 //   data library if the G4NEUTRONHP_SKIP_MISSING_ISOTOPES environmental
 38 //   flag is defined. The missing XS are set t     38 //   flag is defined. The missing XS are set to 0.
 39                                                    39 
 40 #include "G4ParticleHPChannel.hh"                  40 #include "G4ParticleHPChannel.hh"
 41                                                    41 
 42 #include "G4HadTmpUtil.hh"                         42 #include "G4HadTmpUtil.hh"
 43 #include "G4ParticleHPElasticFS.hh"                43 #include "G4ParticleHPElasticFS.hh"
 44 #include "G4ParticleHPFinalState.hh"               44 #include "G4ParticleHPFinalState.hh"
 45 #include "G4ParticleHPReactionWhiteBoard.hh"       45 #include "G4ParticleHPReactionWhiteBoard.hh"
 46 #include "G4ParticleHPThermalBoost.hh"             46 #include "G4ParticleHPThermalBoost.hh"
 47 #include "G4SystemOfUnits.hh"                      47 #include "G4SystemOfUnits.hh"
 48 #include "globals.hh"                              48 #include "globals.hh"
 49                                                    49 
 50 #include <cstdlib>                                 50 #include <cstdlib>
 51                                                    51 
 52 G4ParticleHPChannel::G4ParticleHPChannel(G4Par     52 G4ParticleHPChannel::G4ParticleHPChannel(G4ParticleDefinition* p)
 53 {                                                  53 {
 54   fManager = G4ParticleHPManager::GetInstance(     54   fManager = G4ParticleHPManager::GetInstance();
 55   if (fManager->GetUseWendtFissionModel()) {       55   if (fManager->GetUseWendtFissionModel()) {
 56     wendtFissionGenerator = G4WendtFissionFrag     56     wendtFissionGenerator = G4WendtFissionFragmentGenerator::GetInstance();
 57     // Make sure both fission fragment models      57     // Make sure both fission fragment models are not active at same time
 58     fManager->SetProduceFissionFragments(false     58     fManager->SetProduceFissionFragments(false);
 59   }                                                59   }
 60   theProjectile = (nullptr == p) ? G4Neutron::     60   theProjectile = (nullptr == p) ? G4Neutron::Neutron() : p;
 61   theChannelData = new G4ParticleHPVector;         61   theChannelData = new G4ParticleHPVector;
 62 }                                                  62 }
 63                                                    63 
 64 G4ParticleHPChannel::~G4ParticleHPChannel()        64 G4ParticleHPChannel::~G4ParticleHPChannel()
 65 {                                                  65 {
 66   delete theChannelData;                           66   delete theChannelData;
 67   // Following statement disabled to avoid SEG     67   // Following statement disabled to avoid SEGV
 68   // theBuffer is also deleted as "theChannelD     68   // theBuffer is also deleted as "theChannelData" in
 69   delete[] theIsotopeWiseData;                     69   delete[] theIsotopeWiseData;
 70   if (theFinalStates != nullptr) {                 70   if (theFinalStates != nullptr) {
 71     for (G4int i = 0; i < niso; i++) {             71     for (G4int i = 0; i < niso; i++) {
 72       delete theFinalStates[i];                    72       delete theFinalStates[i];
 73     }                                              73     }
 74     delete[] theFinalStates;                       74     delete[] theFinalStates;
 75   }                                                75   }
 76   delete[] active;                                 76   delete[] active;
 77 }                                                  77 }
 78                                                    78 
 79 G4double G4ParticleHPChannel::GetXsec(G4double <<  79 G4double G4ParticleHPChannel::GetXsec(G4double energy)
 80 {                                                  80 {
 81   return std::max(0., theChannelData->GetXsec(     81   return std::max(0., theChannelData->GetXsec(energy));
 82 }                                                  82 }
 83                                                    83 
 84 G4double G4ParticleHPChannel::GetWeightedXsec(     84 G4double G4ParticleHPChannel::GetWeightedXsec(G4double energy,
 85                 G4int isoNumber) const         <<  85                 G4int isoNumber)
 86 {                                                  86 {
 87   return theIsotopeWiseData[isoNumber].GetXsec     87   return theIsotopeWiseData[isoNumber].GetXsec(energy);
 88 }                                                  88 }
 89                                                    89 
 90 G4double G4ParticleHPChannel::GetFSCrossSectio     90 G4double G4ParticleHPChannel::GetFSCrossSection(G4double energy,
 91             G4int isoNumber) const             <<  91             G4int isoNumber)
 92 {                                                  92 {
 93   return theFinalStates[isoNumber]->GetXsec(en     93   return theFinalStates[isoNumber]->GetXsec(energy);
 94 }                                                  94 }
 95                                                    95 
 96 void G4ParticleHPChannel::Init(G4Element* anEl     96 void G4ParticleHPChannel::Init(G4Element* anElement, 
 97              const G4String& dirName, const G4     97              const G4String& dirName, const G4String& aFSType)
 98 {                                                  98 {
 99   theFSType = aFSType;                             99   theFSType = aFSType;
100   Init(anElement, dirName);                       100   Init(anElement, dirName);
101 }                                                 101 }
102                                                   102 
103 void G4ParticleHPChannel::Init(G4Element* anEl    103 void G4ParticleHPChannel::Init(G4Element* anElement, const G4String& dirName)
104 {                                                 104 {
105   theDir = dirName;                               105   theDir = dirName;
106   theElement = anElement;                         106   theElement = anElement;
107 }                                                 107 }
108                                                   108 
109 G4bool G4ParticleHPChannel::Register(G4Particl    109 G4bool G4ParticleHPChannel::Register(G4ParticleHPFinalState* theFS)
110 {                                                 110 {
111   ++registerCount;                                111   ++registerCount;
112   G4int Z = theElement->GetZasInt();              112   G4int Z = theElement->GetZasInt();
113                                                   113 
114   niso = (G4int)theElement->GetNumberOfIsotope    114   niso = (G4int)theElement->GetNumberOfIsotopes();
115   const std::size_t nsize = niso > 0 ? niso :     115   const std::size_t nsize = niso > 0 ? niso : 1;
116                                                   116 
117   delete[] theIsotopeWiseData;                    117   delete[] theIsotopeWiseData;
118   theIsotopeWiseData = new G4ParticleHPIsoData    118   theIsotopeWiseData = new G4ParticleHPIsoData[nsize];
119   delete[] active;                                119   delete[] active;
120   active = new G4bool[nsize];                     120   active = new G4bool[nsize];
121                                                   121 
122   delete[] theFinalStates;                        122   delete[] theFinalStates;
123   theFinalStates = new G4ParticleHPFinalState*    123   theFinalStates = new G4ParticleHPFinalState*[nsize];
124   delete theChannelData;                          124   delete theChannelData;
125   theChannelData = new G4ParticleHPVector;        125   theChannelData = new G4ParticleHPVector;
126   for (G4int i = 0; i < niso; ++i) {              126   for (G4int i = 0; i < niso; ++i) {
127     theFinalStates[i] = theFS->New();             127     theFinalStates[i] = theFS->New();
128     theFinalStates[i]->SetProjectile(theProjec    128     theFinalStates[i]->SetProjectile(theProjectile);
129   }                                               129   }
130   if (niso != 0 && registerCount == 0) {          130   if (niso != 0 && registerCount == 0) {
131     for (G4int i1 = 0; i1 < niso; ++i1) {         131     for (G4int i1 = 0; i1 < niso; ++i1) {
132       G4int A = theElement->GetIsotope(i1)->Ge    132       G4int A = theElement->GetIsotope(i1)->GetN();
133       G4int M = theElement->GetIsotope(i1)->Ge    133       G4int M = theElement->GetIsotope(i1)->Getm();
134       //G4cout <<" Init: normal case i=" << i1    134       //G4cout <<" Init: normal case i=" << i1 
135       //     << " Z=" << Z << " A=" << A << G4    135       //     << " Z=" << Z << " A=" << A << G4endl;
136       G4double frac = theElement->GetRelativeA    136       G4double frac = theElement->GetRelativeAbundanceVector()[i1] / perCent;
137       theFinalStates[i1]->SetA_Z(A, Z, M);        137       theFinalStates[i1]->SetA_Z(A, Z, M);
138       UpdateData(A, Z, M, i1, frac, theProject    138       UpdateData(A, Z, M, i1, frac, theProjectile);
139     }                                             139     }
140   }                                               140   }
141   G4bool result = HasDataInAnyFinalState();       141   G4bool result = HasDataInAnyFinalState();
142                                                   142 
143   // To avoid issuing hash by worker threads      143   // To avoid issuing hash by worker threads
144   if (result) theChannelData->Hash();             144   if (result) theChannelData->Hash();
145                                                   145 
146   return result;                                  146   return result;
147 }                                                 147 }
148                                                   148 
149 void G4ParticleHPChannel::UpdateData(G4int A,     149 void G4ParticleHPChannel::UpdateData(G4int A, G4int Z, G4int M, G4int index,
150                                      G4double     150                                      G4double abundance,
151                                      G4Particl    151                                      G4ParticleDefinition* projectile)
152 {                                                 152 {
153   // Initialze the G4FissionFragment generator    153   // Initialze the G4FissionFragment generator for this isomer if needed
154   if (wendtFissionGenerator != nullptr) {         154   if (wendtFissionGenerator != nullptr) {
155     wendtFissionGenerator->InitializeANucleus(    155     wendtFissionGenerator->InitializeANucleus(A, Z, M, theDir);
156   }                                               156   }
157                                                   157 
158   theFinalStates[index]->Init(A, Z, M, theDir,    158   theFinalStates[index]->Init(A, Z, M, theDir, theFSType, projectile);
159   if (!theFinalStates[index]->HasAnyData()) re    159   if (!theFinalStates[index]->HasAnyData()) return;
160   // nothing there for exactly this isotope.      160   // nothing there for exactly this isotope.
161                                                   161 
162   // the above has put the X-sec into the FS      162   // the above has put the X-sec into the FS
163   theBuffer = nullptr;                            163   theBuffer = nullptr;
164   if (theFinalStates[index]->HasXsec()) {         164   if (theFinalStates[index]->HasXsec()) {
165     theBuffer = theFinalStates[index]->GetXsec    165     theBuffer = theFinalStates[index]->GetXsec();
166     theBuffer->Times(abundance / 100.);           166     theBuffer->Times(abundance / 100.);
167     theIsotopeWiseData[index].FillChannelData(    167     theIsotopeWiseData[index].FillChannelData(theBuffer);
168   }                                               168   }
169   else  // get data from CrossSection director    169   else  // get data from CrossSection directory
170   {                                               170   {
171     const G4String& tString = "/CrossSection"; << 171     G4String tString = "/CrossSection";
172     active[index] = theIsotopeWiseData[index].    172     active[index] = theIsotopeWiseData[index].Init(A, Z, M, abundance,
173                                                   173                                                    theDir, tString);
174     if (active[index]) theBuffer = theIsotopeW    174     if (active[index]) theBuffer = theIsotopeWiseData[index].MakeChannelData();
175   }                                               175   }
176   if (theBuffer != nullptr) Harmonise(theChann    176   if (theBuffer != nullptr) Harmonise(theChannelData, theBuffer);
177 }                                                 177 }
178                                                   178 
179 void G4ParticleHPChannel::Harmonise(G4Particle    179 void G4ParticleHPChannel::Harmonise(G4ParticleHPVector*& theStore,
180                                     G4Particle    180                                     G4ParticleHPVector* theNew)
181 {                                                 181 {
182   G4int s_tmp = 0, n = 0, m_tmp = 0;              182   G4int s_tmp = 0, n = 0, m_tmp = 0;
183   auto theMerge = new G4ParticleHPVector;         183   auto theMerge = new G4ParticleHPVector;
184   G4ParticleHPVector* anActive = theStore;        184   G4ParticleHPVector* anActive = theStore;
185   G4ParticleHPVector* aPassive = theNew;          185   G4ParticleHPVector* aPassive = theNew;
186   G4ParticleHPVector* tmp;                        186   G4ParticleHPVector* tmp;
187   G4int a = s_tmp, p = n, t;                      187   G4int a = s_tmp, p = n, t;
188   while (a < anActive->GetVectorLength() && p     188   while (a < anActive->GetVectorLength() && p < aPassive->GetVectorLength())
189     // Loop checking, 11.05.2015, T. Koi          189     // Loop checking, 11.05.2015, T. Koi
190   {                                               190   {
191     if (anActive->GetEnergy(a) <= aPassive->Ge    191     if (anActive->GetEnergy(a) <= aPassive->GetEnergy(p)) {
192       G4double xa = anActive->GetEnergy(a);       192       G4double xa = anActive->GetEnergy(a);
193       theMerge->SetData(m_tmp, xa, anActive->G    193       theMerge->SetData(m_tmp, xa, anActive->GetXsec(a) + std::max(0., aPassive->GetXsec(xa)));
194       m_tmp++;                                    194       m_tmp++;
195       a++;                                        195       a++;
196       G4double xp = aPassive->GetEnergy(p);       196       G4double xp = aPassive->GetEnergy(p);
197       if (std::abs(std::abs(xp - xa) / xa) < 0    197       if (std::abs(std::abs(xp - xa) / xa) < 0.001) {
198         ++p;                                      198         ++p;
199       }                                           199       }
200     }                                             200     }
201     else {                                        201     else {
202       tmp = anActive;                             202       tmp = anActive;
203       t = a;                                      203       t = a;
204       anActive = aPassive;                        204       anActive = aPassive;
205       a = p;                                      205       a = p;
206       aPassive = tmp;                             206       aPassive = tmp;
207       p = t;                                      207       p = t;
208     }                                             208     }
209   }                                               209   }
210   while (a != anActive->GetVectorLength())  //    210   while (a != anActive->GetVectorLength())  // Loop checking, 11.05.2015, T. Koi
211   {                                               211   {
212     theMerge->SetData(m_tmp++, anActive->GetEn    212     theMerge->SetData(m_tmp++, anActive->GetEnergy(a), anActive->GetXsec(a));
213     ++a;                                          213     ++a;
214   }                                               214   }
215   while (p != aPassive->GetVectorLength())  //    215   while (p != aPassive->GetVectorLength())  // Loop checking, 11.05.2015, T. Koi
216   {                                               216   {
217     if (std::abs(theMerge->GetEnergy(std::max(    217     if (std::abs(theMerge->GetEnergy(std::max(0, m_tmp - 1)) -
218      aPassive->GetEnergy(p)) / aPassive->GetEn    218      aPassive->GetEnergy(p)) / aPassive->GetEnergy(p) > 0.001)
219       theMerge->SetData(m_tmp++, aPassive->Get    219       theMerge->SetData(m_tmp++, aPassive->GetEnergy(p), aPassive->GetXsec(p));
220     ++p;                                          220     ++p;
221   }                                               221   }
222   delete theStore;                                222   delete theStore;
223   theStore = theMerge;                            223   theStore = theMerge;
224 }                                                 224 }
225                                                   225 
226 G4WendtFissionFragmentGenerator* G4ParticleHPC << 
227   if ( wendtFissionGenerator ) return wendtFis << 
228   else                         return nullptr; << 
229 }                                              << 
230                                                << 
231 G4HadFinalState*                                  226 G4HadFinalState*
232 G4ParticleHPChannel::ApplyYourself(const G4Had    227 G4ParticleHPChannel::ApplyYourself(const G4HadProjectile& theTrack,
233            G4int anIsotope, G4bool isElastic)     228            G4int anIsotope, G4bool isElastic)
234 {                                                 229 {
235   //G4cout << "G4ParticleHPChannel::ApplyYours    230   //G4cout << "G4ParticleHPChannel::ApplyYourself niso=" << niso
236   //   << " ni=" << anIsotope << " isElastic="    231   //   << " ni=" << anIsotope << " isElastic=" << isElastic <<G4endl;
237   if (anIsotope != -1 && anIsotope != -2) {       232   if (anIsotope != -1 && anIsotope != -2) {
238     // Inelastic Case                             233     // Inelastic Case
239     //G4cout << "G4ParticleHPChannel Inelastic    234     //G4cout << "G4ParticleHPChannel Inelastic Case"
240     //<< " Z= " << GetZ(anIsotope) << " A = "     235     //<< " Z= " << GetZ(anIsotope) << " A = " << GetN(anIsotope) << G4endl;
241     fManager->GetReactionWhiteBoard()->SetTarg    236     fManager->GetReactionWhiteBoard()->SetTargA((G4int)GetN(anIsotope));
242     fManager->GetReactionWhiteBoard()->SetTarg    237     fManager->GetReactionWhiteBoard()->SetTargZ((G4int)GetZ(anIsotope));
243     return theFinalStates[anIsotope]->ApplyYou    238     return theFinalStates[anIsotope]->ApplyYourself(theTrack);
244   }                                               239   }
245   G4double sum = 0;                               240   G4double sum = 0;
246   G4int it = 0;                                   241   G4int it = 0;
247   auto xsec = new G4double[niso];                 242   auto xsec = new G4double[niso];
248   G4ParticleHPThermalBoost aThermalE;             243   G4ParticleHPThermalBoost aThermalE;
249   for (G4int i = 0; i < niso; i++) {              244   for (G4int i = 0; i < niso; i++) {
250     if (theFinalStates[i]->HasAnyData()) {        245     if (theFinalStates[i]->HasAnyData()) {
251       /*                                          246       /*
252       G4cout << "FS: " << i << theTrack.GetDef    247       G4cout << "FS: " << i << theTrack.GetDefinition()->GetParticleName()
253        << " Z=" << theFinalStates[i]->GetZ()      248        << " Z=" << theFinalStates[i]->GetZ() 
254        << " A=" << theFinalStates[i]->GetN()      249        << " A=" << theFinalStates[i]->GetN() 
255        << G4endl;                                 250        << G4endl;
256       */                                          251       */
257       xsec[i] = theIsotopeWiseData[i].GetXsec(    252       xsec[i] = theIsotopeWiseData[i].GetXsec(
258         aThermalE.GetThermalEnergy(theTrack, t    253         aThermalE.GetThermalEnergy(theTrack, theFinalStates[i]->GetN(),
259                                    theFinalSta    254                                    theFinalStates[i]->GetZ(),
260                                    theTrack.Ge    255                                    theTrack.GetMaterial()->GetTemperature()));
261       sum += xsec[i];                             256       sum += xsec[i];
262     }                                             257     }
263     else {                                        258     else {
264       xsec[i] = 0;                                259       xsec[i] = 0;
265     }                                             260     }
266   }                                               261   }
267   if (sum == 0) {                                 262   if (sum == 0) {
268     it = G4lrint(niso * G4UniformRand());         263     it = G4lrint(niso * G4UniformRand());
269   }                                               264   }
270   else {                                          265   else {
271     G4double random = G4UniformRand();            266     G4double random = G4UniformRand();
272     G4double running = 0;                         267     G4double running = 0;
273     for (G4int ix = 0; ix < niso; ix++) {         268     for (G4int ix = 0; ix < niso; ix++) {
274       running += xsec[ix];                        269       running += xsec[ix];
275       if (sum == 0 || random <= running / sum)    270       if (sum == 0 || random <= running / sum) {
276         it = ix;                                  271         it = ix;
277         break;                                    272         break;
278       }                                           273       }
279     }                                             274     }
280     if (it == niso) it--;                         275     if (it == niso) it--;
281   }                                               276   }
282   delete[] xsec;                                  277   delete[] xsec;
283   G4HadFinalState* theFinalState = nullptr;       278   G4HadFinalState* theFinalState = nullptr;
284   const auto A = (G4int)this->GetN(it);           279   const auto A = (G4int)this->GetN(it);
285   const auto Z = (G4int)this->GetZ(it);           280   const auto Z = (G4int)this->GetZ(it);
286   const auto M = (G4int)this->GetM(it);           281   const auto M = (G4int)this->GetM(it);
287                                                   282 
288   //-2:Marker for Fission                         283   //-2:Marker for Fission
289   if ((wendtFissionGenerator != nullptr) && an    284   if ((wendtFissionGenerator != nullptr) && anIsotope == -2) {
290     theFinalState = wendtFissionGenerator->App    285     theFinalState = wendtFissionGenerator->ApplyYourself(theTrack, Z, A);
291   }                                               286   }
292                                                   287 
293   // Use the standard procedure if the G4Fissi    288   // Use the standard procedure if the G4FissionFragmentGenerator model fails
294   if (theFinalState == nullptr) {                 289   if (theFinalState == nullptr) {
295     G4int icounter = 0;                           290     G4int icounter = 0;
296     G4int icounter_max = 1024;                    291     G4int icounter_max = 1024;
297     while (theFinalState == nullptr)  // Loop     292     while (theFinalState == nullptr)  // Loop checking, 11.05.2015, T. Koi
298     {                                             293     {
299       icounter++;                                 294       icounter++;
300       if (icounter > icounter_max) {              295       if (icounter > icounter_max) {
301         G4cout << "Loop-counter exceeded the t    296         G4cout << "Loop-counter exceeded the threshold value at " 
302                << __LINE__ << "th line of " <<    297                << __LINE__ << "th line of " << __FILE__ << "." << G4endl;
303         break;                                    298         break;
304       }                                           299       }
305       if (isElastic) {                            300       if (isElastic) {
306         // Register 0 K cross-section for DBRC    301         // Register 0 K cross-section for DBRC for Doppler broadened elastic scattering kernel
307         G4ParticleHPVector* xsforFS = theIsoto    302         G4ParticleHPVector* xsforFS = theIsotopeWiseData[it].MakeChannelData();
308         // Only G4ParticleHPElasticFS has the     303         // Only G4ParticleHPElasticFS has the RegisterCrossSection method
309         static_cast<G4ParticleHPElasticFS*>(th    304         static_cast<G4ParticleHPElasticFS*>(theFinalStates[it])->RegisterCrossSection(xsforFS);
310       }                                           305       }
311       theFinalState = theFinalStates[it]->Appl    306       theFinalState = theFinalStates[it]->ApplyYourself(theTrack);
312     }                                             307     }
313   }                                               308   }
314                                                   309 
315   // G4cout <<"THE IMPORTANT RETURN"<<G4endl;     310   // G4cout <<"THE IMPORTANT RETURN"<<G4endl;
316   // G4cout << "TK G4ParticleHPChannel Elastic    311   // G4cout << "TK G4ParticleHPChannel Elastic, Capture and Fission Cases "
317   //<< " Z= " << this->GetZ(it) << " A = " <<     312   //<< " Z= " << this->GetZ(it) << " A = " << this->GetN(it) << G4endl;
318   fManager->GetReactionWhiteBoard()->SetTargA(    313   fManager->GetReactionWhiteBoard()->SetTargA(A);
319   fManager->GetReactionWhiteBoard()->SetTargZ(    314   fManager->GetReactionWhiteBoard()->SetTargZ(Z);
320   fManager->GetReactionWhiteBoard()->SetTargM(    315   fManager->GetReactionWhiteBoard()->SetTargM(M);
321                                                   316 
322   return theFinalState;                           317   return theFinalState;
323 }                                                 318 }
324                                                   319 
325 void G4ParticleHPChannel::DumpInfo() const     << 320 void G4ParticleHPChannel::DumpInfo()
326 {                                                 321 {
327   G4cout << " Element: " << theElement->GetNam    322   G4cout << " Element: " << theElement->GetName() << G4endl;
328   G4cout << " Directory name: " << theDir << G    323   G4cout << " Directory name: " << theDir << G4endl;
329   G4cout << " FS name: " << theFSType << G4end    324   G4cout << " FS name: " << theFSType << G4endl;
330   G4cout << " Number of Isotopes: " << niso <<    325   G4cout << " Number of Isotopes: " << niso << G4endl;
331   G4cout << " Have cross sections: " << G4endl    326   G4cout << " Have cross sections: " << G4endl;
332   for (int i = 0; i < niso; i++) {                327   for (int i = 0; i < niso; i++) {
333     G4cout << theFinalStates[i]->HasXsec() <<     328     G4cout << theFinalStates[i]->HasXsec() << "  ";
334   }                                               329   }
335   G4cout << G4endl;                               330   G4cout << G4endl;
336   if (theChannelData != nullptr) {                331   if (theChannelData != nullptr) {
337     G4cout << " Cross Section (total for this     332     G4cout << " Cross Section (total for this channel):" << G4endl;
338     int np = theChannelData->GetVectorLength()    333     int np = theChannelData->GetVectorLength();
339     G4cout << np << G4endl;                       334     G4cout << np << G4endl;
340     for (int i = 0; i < np; i++) {                335     for (int i = 0; i < np; i++) {
341       G4cout << theChannelData->GetEnergy(i) /    336       G4cout << theChannelData->GetEnergy(i) / eV << "  " << theChannelData->GetXsec(i) << G4endl;
342     }                                             337     }
343   }                                               338   }
344 }                                                 339 }
345                                                   340