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.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/G4WendtFissionFragmentGenerator.cc (Version 11.3.0) and /processes/hadronic/models/particle_hp/src/G4WendtFissionFragmentGenerator.cc (Version 10.2.p1)


  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 /*                                                 26 /*
 27  * File:   G4WendtFissionFragmentGenerator.hh      27  * File:   G4WendtFissionFragmentGenerator.hh
 28  * Author: B. Wendt (wendbryc@isu.edu)             28  * Author: B. Wendt (wendbryc@isu.edu)
 29  *                                                 29  *
 30  * Created on June 21, 2013, 13:58 MST             30  * Created on June 21, 2013, 13:58 MST
 31  */                                                31  */
 32                                                    32 
 33 #include "G4WendtFissionFragmentGenerator.hh"  <<  33 #include "G4ParticleHPManager.hh"
 34                                                    34 
 35 #include "G4FFGDebuggingMacros.hh"                 35 #include "G4FFGDebuggingMacros.hh"
 36 #include "G4ParticleHPManager.hh"              <<  36 #include "G4WendtFissionFragmentGenerator.hh"
 37 #include "G4PhysicsModelCatalog.hh"            << 
 38                                                    37 
 39 G4ThreadLocal G4WendtFissionFragmentGenerator* <<  38 G4ThreadLocal G4WendtFissionFragmentGenerator* G4WendtFissionFragmentGenerator::instance = NULL;
 40                                                    39 
 41 G4WendtFissionFragmentGenerator::G4WendtFissio <<  40 G4WendtFissionFragmentGenerator::
                                                   >>  41 G4WendtFissionFragmentGenerator()
 42 {                                                  42 {
 43   // Set the default verbosity                 <<  43     // Set the default verbosity
 44   Verbosity_ = G4FFGDefaultValues::Verbosity;  <<  44     Verbosity_ = G4FFGDefaultValues::Verbosity;
 45                                                << 
 46   // Set the creator model ID                  << 
 47   secID = G4PhysicsModelCatalog::GetModelID("m << 
 48 }                                                  45 }
 49 /*                                                 46 /*
 50 G4WendtFissionFragmentGenerator* G4WendtFissio     47 G4WendtFissionFragmentGenerator* G4WendtFissionFragmentGenerator::
 51 GetInstance()                                      48 GetInstance()
 52 {                                                  49 {
 53     //static G4WendtFissionFragmentGenerator n     50     //static G4WendtFissionFragmentGenerator newMe;
 54     //                                             51     //
 55     //return &newMe;                               52     //return &newMe;
 56                                                    53 
 57     if ( instance == NULL) instance = new G4We     54     if ( instance == NULL) instance = new G4WendtFissionFragmentGenerator();
 58                                                    55 
 59     return instance;                               56     return instance;
 60 }                                                  57 }
 61 */                                                 58 */
 62 G4HadFinalState* G4WendtFissionFragmentGenerat <<  59 G4HadFinalState* G4WendtFissionFragmentGenerator::
 63                                                <<  60 ApplyYourself(const G4HadProjectile& projectile, G4int Z, G4int A)
 64 {                                                  61 {
 65   G4FFG_FUNCTIONENTER__                        <<  62 G4FFG_FUNCTIONENTER__
 66                                                    63 
 67   G4HadFinalState* finalState = nullptr;       <<  64     G4HadFinalState* finalState = NULL;
 68   G4DynamicParticleVector* finalParticles = nu <<  65     G4DynamicParticleVector* finalParticles = NULL;
 69   G4int isotope;                               <<  66     G4int isotope;
 70   std::map<const G4int, G4FissionFragmentGener <<  67     std::map< const G4int, G4FissionFragmentGenerator* >::iterator fissionGenerator;
 71                                                << 
 72   // Look for the first available isomer since << 
 73   for (unsigned int M = 0; M < 10; ++M) {      << 
 74     isotope = G4FissionFragmentGenerator::G4Ma << 
 75     fissionGenerator = fissionIsotopes.find(is << 
 76                                                << 
 77     if (fissionGenerator != fissionIsotopes.en << 
 78       // Only generate particles if the genera << 
 79       if (fissionGenerator->second != nullptr) << 
 80         finalParticles = fissionGenerator->sec << 
 81       }                                        << 
 82                                                    68 
 83       break;                                   <<  69     // Look for the first available isomer since no M is provided for ApplyYourself()
                                                   >>  70     for(unsigned int M = 0; M < 10; ++M)
                                                   >>  71     {
                                                   >>  72         isotope = G4FissionFragmentGenerator::G4MakeIsotopeCode(Z, A, M);
                                                   >>  73         fissionGenerator = fissionIsotopes.find(isotope);
                                                   >>  74 
                                                   >>  75         if(fissionGenerator != fissionIsotopes.end())
                                                   >>  76         {
                                                   >>  77             // Only generate particles if the generator was constructed
                                                   >>  78             if(fissionGenerator->second)
                                                   >>  79             {
                                                   >>  80                 finalParticles = fissionGenerator->second->G4GenerateFission(projectile);
                                                   >>  81             }
                                                   >>  82 
                                                   >>  83             break;
                                                   >>  84         }
 84     }                                              85     }
 85   }                                            << 
 86                                                    86 
 87   if (finalParticles != nullptr) {             <<  87     if(finalParticles)
 88     finalState = new G4HadFinalState();        <<  88     {
                                                   >>  89         finalState = new G4HadFinalState();
 89                                                    90 
 90     for (auto& finalParticle : *finalParticles <<  91         for(unsigned int i = 0; i < finalParticles->size(); ++i)
 91       finalState->AddSecondary(finalParticle,  <<  92         {
                                                   >>  93             finalState->AddSecondary((*finalParticles)[i]);
                                                   >>  94         }
 92     }                                              95     }
 93   }                                            << 
 94                                                    96 
 95   // TK modified 131108 add next line          <<  97     //TK modified 131108 add next line 
 96   // TK 160112 fix for coverity #53481         <<  98     //TK 160112 fix for coverity #53481
 97   if (finalState != nullptr) finalState->SetSt <<  99     if ( finalState != NULL ) finalState->SetStatusChange(stopAndKill);
 98   G4FFG_FUNCTIONLEAVE__                        << 100 G4FFG_FUNCTIONLEAVE__
 99   return finalState;                           << 101     return finalState;
100 }                                                 102 }
101                                                   103 
102 void G4WendtFissionFragmentGenerator::Initiali << 104 void G4WendtFissionFragmentGenerator::
103                                                << 105 InitializeANucleus(const G4int A, const G4int Z, const G4int M, const G4String& dataDirectory)
104                                                << 
105 {                                                 106 {
106   // G4FFG_FUNCTIONENTER__                     << 107 //G4FFG_FUNCTIONENTER__
107                                                   108 
108   const G4int isotope = G4FissionFragmentGener << 109     const G4int isotope = G4FissionFragmentGenerator::G4MakeIsotopeCode(Z, A, M);
109   G4FFGEnumerations::MetaState metaState;      << 110     G4FFGEnumerations::MetaState metaState;
110   std::pair<std::map<const G4int, G4FissionFra << 111     std::pair< std::map< const G4int, G4FissionFragmentGenerator* >::iterator, bool > newIsotope;
111                                                << 
112   // Check to see if the isotope/isomer alread << 
113   newIsotope =                                 << 
114     fissionIsotopes.insert(std::make_pair(isot << 
115                                                << 
116   if (newIsotope.second || newIsotope.first->s << 
117     // Get the data file                       << 
118     G4bool flag;                               << 
119     G4ParticleHPDataUsed dataFile = fileNames. << 
120     G4String dataFileName = dataFile.GetName() << 
121                                                << 
122     // Check if the file exists, and do not cr << 
123     // G4cout << "*** Z = " << Z << "\tA = " < << 
124     // FILE: " << dataFileName << G4endl;      << 
125     std::istringstream dataStream(std::ios::in << 
126     G4ParticleHPManager::GetInstance()->GetDat << 
127     if (!dataStream) {                         << 
128       // G4FFG_FUNCTIONLEAVE__                 << 
129       //  G4cerr << "*** Stream error" << G4en << 
130       return;                                  << 
131     }                                          << 
132                                                   112 
133     // Check the data file parameters          << 113     // Check to see if the isotope/isomer alread exists in the table
134     if (!flag                                  << 114     newIsotope = fissionIsotopes.insert(std::make_pair(isotope, (G4FissionFragmentGenerator*)NULL));
135         || (Z < 2.5                            << 
136             && ((G4double)abs(dataFile.GetZ()  << 
137                 || (G4double)abs((G4int)dataFi << 
138     {                                          << 
139       // G4cerr << "*** Something wrong with t << 
140       // G4FFG_FUNCTIONLEAVE__                 << 
141       return;                                  << 
142     }                                          << 
143                                                   115 
144     auto const fissionGenerator = new G4Fissio << 116     if(newIsotope.second || newIsotope.first->second == NULL)
145     newIsotope.first->second = fissionGenerato << 117     {
146                                                << 118         // Get the data file
147     switch (M) {                               << 119         G4bool flag;
148       case 1:                                  << 120         G4ParticleHPDataUsed dataFile = fileNames.GetName(A, Z, M, dataDirectory, "FF", flag);
149         metaState = G4FFGEnumerations::META_1; << 121         G4String dataFileName = dataFile.GetName();
150         break;                                 << 122 
151                                                << 123         // Check if the file exists, and do not create a fission object if it doesn't
152       case 2:                                  << 124         // G4cout << "*** Z = " << Z << "\tA = " << A << "\t\t\t Directory: "<< dataDirectory << " DATA FILE: " << dataFileName << G4endl;
153         metaState = G4FFGEnumerations::META_2; << 125         std::istringstream dataStream(std::ios::in);
154         break;                                 << 126         G4ParticleHPManager::GetInstance()->GetDataStream(dataFileName, dataStream);
155                                                << 127         if(!dataStream)
156       default:                                 << 128         {
157         // TODO Display a warning message here << 129             //G4FFG_FUNCTIONLEAVE__
158         // Fall through to the ground state by << 130             // G4cerr << "*** Stream error" << G4endl;
159       case 0:                                  << 131             return;
160         metaState = G4FFGEnumerations::GROUND_ << 132         }
161         break;                                 << 133 
162     }                                          << 134         // Check the data file parameters
163                                                << 135         if(!flag
164     fissionGenerator->G4SetIsotope(isotope);   << 136            || ( Z < 2.5 && ( (G4double)abs( dataFile.GetZ() - Z ) > 0.001 || (G4double)abs( (G4int)dataFile.GetA() - A ) > 0.0001 ) ) )
165     fissionGenerator->G4SetMetaState(metaState << 137         {
166     fissionGenerator->G4SetCause(G4FFGEnumerat << 138             //G4cerr << "*** Something wrong with the data request.\tFlag :" << flag << G4endl;
167     // TODO Load all the fission data and use  << 139             //G4FFG_FUNCTIONLEAVE__
168     fissionGenerator->G4SetIncidentEnergy(G4FF << 140             return;
169     fissionGenerator->G4SetYieldType(G4FFGEnum << 141         }
170     fissionGenerator->G4SetSamplingScheme(G4FF << 142 
171                                                << 143         G4FissionFragmentGenerator* const fissionGenerator = new G4FissionFragmentGenerator();
172     // TODO Remove the need for forcing a load << 144         newIsotope.first->second = fissionGenerator;
173     //      i.e. remove the ability to dynamic << 145 
174     //      that cause reload because a G4Fiss << 146         switch(M)
175     //      each isotope should be loaded in t << 147         {
176     if (!fissionGenerator->InitializeFissionPr << 148         case 1:
177       // Delete if the initialization fails    << 149             metaState = G4FFGEnumerations::META_1;
178       delete fissionGenerator;                 << 150             break;
                                                   >> 151 
                                                   >> 152         case 2:
                                                   >> 153             metaState = G4FFGEnumerations::META_2;
                                                   >> 154             break;
                                                   >> 155 
                                                   >> 156         default:
                                                   >> 157             // TODO Display a warning message here indicating that an invalid metastate was passed in
                                                   >> 158             // Fall through to the ground state by default
                                                   >> 159         case 0:
                                                   >> 160             metaState = G4FFGEnumerations::GROUND_STATE;
                                                   >> 161             break;
                                                   >> 162         }
                                                   >> 163 
                                                   >> 164         fissionGenerator->G4SetIsotope(isotope);
                                                   >> 165         fissionGenerator->G4SetMetaState(metaState);
                                                   >> 166         fissionGenerator->G4SetCause(G4FFGEnumerations::NEUTRON_INDUCED);
                                                   >> 167         // TODO Load all the fission data and use the projectile energy instead
                                                   >> 168         fissionGenerator->G4SetIncidentEnergy(G4FFGDefaultValues::ThermalNeutronEnergy);
                                                   >> 169         fissionGenerator->G4SetYieldType(G4FFGEnumerations::INDEPENDENT);
                                                   >> 170         fissionGenerator->G4SetSamplingScheme(G4FFGEnumerations::NORMAL);
                                                   >> 171 
                                                   >> 172 
                                                   >> 173         // TODO Remove the need for forcing a load in the initialization phase,
                                                   >> 174         //      i.e. remove the ability to dynamically change the fission parameters
                                                   >> 175         //      that cause reload because a G4FissionFragmentGenerator class for
                                                   >> 176         //      each isotope should be loaded in the initialization phase
                                                   >> 177         if(!fissionGenerator->InitializeFissionProductYieldClass(dataStream))
                                                   >> 178         {
                                                   >> 179             // Delete if the initialization fails
                                                   >> 180             delete fissionGenerator;
179                                                   181 
180       fissionIsotopes.erase(newIsotope.first); << 182             fissionIsotopes.erase(newIsotope.first);
                                                   >> 183         }
181     }                                             184     }
182   }                                            << 
183                                                   185 
184   // G4FFG_FUNCTIONLEAVE__                     << 186 //G4FFG_FUNCTIONLEAVE__
185 }                                                 187 }
186                                                   188 
187 G4WendtFissionFragmentGenerator::~G4WendtFissi << 189 G4WendtFissionFragmentGenerator::
                                                   >> 190 ~G4WendtFissionFragmentGenerator()
188 {                                                 191 {
189   std::map<const G4int, G4FissionFragmentGener << 192     std::map< const G4int, G4FissionFragmentGenerator* >::iterator fissionGenerator;
190                                                   193 
191   for (fissionGenerator = fissionIsotopes.begi << 194     for(fissionGenerator = fissionIsotopes.begin(); fissionGenerator != fissionIsotopes.end(); ++fissionGenerator)
192        ++fissionGenerator)                     << 195     {
193   {                                            << 196         delete fissionGenerator->second;
194     delete fissionGenerator->second;           << 197     }
195   }                                            << 
196 }                                                 198 }
197                                                   199