Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/hadronic/models/particle_hp/src/G4ParticleHPNames.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/G4ParticleHPNames.cc (Version 11.3.0) and /processes/hadronic/models/particle_hp/src/G4ParticleHPNames.cc (Version 10.4.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 // 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 // 24-Jan-07 Enable to use exact data only and     30 // 24-Jan-07 Enable to use exact data only and add warnig when substitute file is used T. Koi
 31 // 30-Jan-07 Modified method of searching subs     31 // 30-Jan-07 Modified method of searching substitute isotope data by T. Koi
 32 // 07-06-12 fix memory leaking by T. Koi           32 // 07-06-12 fix memory leaking by T. Koi
 33 // 07-06-25 Change data selection logic when G     33 // 07-06-25 Change data selection logic when G4NEUTRONHP_SKIP_MISSING_ISOTOPES is turn on
 34 //          Natural Abundance data are allowed     34 //          Natural Abundance data are allowed. by T. Koi
 35 // 07-07-06 Allow _nat_ final state even for i     35 // 07-07-06 Allow _nat_ final state even for isotoped cross sections by T. Koi
 36 // 08-09-01 Add protection that deuteron data      36 // 08-09-01 Add protection that deuteron data do not selected for hydrogen and so on by T. Koi
 37 //                                                 37 //
 38 // P. Arce, June-2014 Conversion neutron_hp to     38 // P. Arce, June-2014 Conversion neutron_hp to particle_hp
 39 // June-2019 - E. Mendoza --> Modification to  << 
 40 // G4NEUTRONHP_SKIP_MISSING_ISOTOPES environme << 
 41 // Oct-2019 - E. Mendoza --> remove restrictio << 
 42 //                                                 39 //
 43 // V. Ivanchenko, July-2023 Basic revision of  << 
 44                                                << 
 45 #include "G4ParticleHPNames.hh"                    40 #include "G4ParticleHPNames.hh"
 46                                                << 
 47 #include "G4HadronicException.hh"              << 
 48 #include "G4HadronicParameters.hh"             << 
 49 #include "G4ParticleHPManager.hh"                  41 #include "G4ParticleHPManager.hh"
 50 #include "G4SandiaTable.hh"                        42 #include "G4SandiaTable.hh"
 51 #include "G4ios.hh"                            <<  43 #include "G4HadronicException.hh"
 52                                                << 
 53 #include <fstream>                                 44 #include <fstream>
 54                                                    45 
 55 const G4String G4ParticleHPNames::theString[10 <<  46   const G4String G4ParticleHPNames::theString[100] = {"Hydrogen", "Helium",
 56   "Hydrogen",     "Helium",      "Lithium",    <<  47  "Lithium", "Berylium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine",
 57   "Nitrogen",     "Oxygen",      "Fluorine",   <<  48  "Neon", "Sodium", "Magnesium", "Aluminum", "Silicon", "Phosphorous", 
 58   "Aluminum",     "Silicon",     "Phosphorous" <<  49  "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium",
 59   "Potassium",    "Calcium",     "Scandium",   <<  50  "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel",
 60   "Manganese",    "Iron",        "Cobalt",     <<  51  "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine",
 61   "Gallium",      "Germanium",   "Arsenic",    <<  52  "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium",
 62   "Rubidium",     "Strontium",   "Yttrium",    <<  53  "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver",
 63   "Technetium",   "Ruthenium",   "Rhodium",    <<  54  "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon",
 64   "Indium",       "Tin",         "Antimony",   <<  55  "Cesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium",
 65   "Cesium",       "Barium",      "Lanthanum",  <<  56  "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium",
 66   "Promethium",   "Samarium",    "Europium",   <<  57  "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium",
 67   "Holmium",      "Erbium",      "Thulium",    <<  58  "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinium", "Gold",
 68   "Tantalum",     "Tungsten",    "Rhenium",    <<  59  "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", 
 69   "Gold",         "Mercury",     "Thallium",   <<  60  "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", 
 70   "Astatine",     "Radon",       "Francium",   <<  61  "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium",
 71   "Protactinium", "Uranium",     "Neptunium",  <<  62  "Einsteinium","Fermium"};
 72   "Berkelium",    "Californium", "Einsteinium" << 
 73                                                    63 
 74 G4ParticleHPNames::G4ParticleHPNames(G4int max << 
 75 {                                              << 
 76   fManager = G4ParticleHPManager::GetInstance( << 
 77 }                                              << 
 78                                                    64 
 79 G4String G4ParticleHPNames::GetName(G4int i) c <<  65   G4String G4ParticleHPNames::GetName(G4int i) { return theString[i]; }
 80 {                                              << 
 81   return (i > 0 && i < 100) ? theString[i] : G << 
 82 }                                              << 
 83                                                    66 
 84 G4String G4ParticleHPNames::itoa(G4int current <<  67 //G4ParticleHPDataUsed G4ParticleHPNames::GetName(G4int A, G4int Z, G4String base, G4String rest, G4bool & aFlag)
                                                   >>  68 G4ParticleHPDataUsed G4ParticleHPNames::GetName(G4int A, G4int Z, G4int M, G4String base, G4String rest, G4bool & aFlag)
 85 {                                                  69 {
 86   const char theDigits[11] = "0123456789";     << 
 87   G4String result;                             << 
 88   G4int digit;                                 << 
 89   do {                                         << 
 90     digit = current - 10 * (current / 10);     << 
 91     result = theDigits[digit] + result;        << 
 92     current /= 10;                             << 
 93   } while (current != 0);  // Loop checking, 1 << 
 94   return result;                               << 
 95 }                                              << 
 96                                                    70 
 97 G4ParticleHPDataUsed G4ParticleHPNames::GetNam <<  71    G4int verboseLevel = G4ParticleHPManager::GetInstance()->GetVerboseLevel();
 98                                                << 
 99 {                                              << 
100   // G4cout << Z << " " << A << " " << M << "  << 
101                                                    72 
102   // Excited isomer indicator                  <<  73    //G4cout << Z << " " << A << " " << M << " " << base << " " << rest << G4endl;
103   std::stringstream ss;                        << 
104   G4String sM;                                 << 
105   if (M > 0) {                                 << 
106     ss << "m";                                 << 
107     ss << M;                                   << 
108     ss >> sM;                                  << 
109     ss.clear();                                << 
110   }                                            << 
111                                                    74 
112   G4ParticleHPDataUsed result;                 <<  75    //Excited isomer indicator
113   aFlag = true;                                <<  76    std::stringstream ss;
                                                   >>  77    G4String sM;
                                                   >>  78    if ( M > 0 ) 
                                                   >>  79    {
                                                   >>  80       ss << "m";
                                                   >>  81       ss << M;
                                                   >>  82       ss >> sM;
                                                   >>  83       ss.clear();
                                                   >>  84    }
                                                   >>  85 
                                                   >>  86    G4ParticleHPDataUsed result;
                                                   >>  87    aFlag = true;
                                                   >>  88 if(getenv("NeutronHPNames")) G4cout << "Names::GetName entered for Z = " << Z << ", A = " << A <<G4endl;
                                                   >>  89 
                                                   >>  90     G4int myA = A;
                                                   >>  91     G4int myZ = Z;
                                                   >>  92 
                                                   >>  93     if(Z>92.5&&!getenv("AllowForHeavyElements") ) 
                                                   >>  94     {
                                                   >>  95       //G4cerr << "Please contact Hans-Peter.Wellisch@cern.ch"<<G4endl;
                                                   >>  96       G4cerr << "Please contact Geant4 Hadron Group Coordinator"<<G4endl;
                                                   >>  97       throw G4HadronicException(__FILE__, __LINE__, "G4ParticleHPNames::GetName - data with Z>92 are not provided");
                                                   >>  98     }
114                                                    99 
115 #ifdef G4VERBOSE                               << 100     G4String * theName = 0;
116   if (fManager->GetDEBUG())                    << 101     G4String theFileName("");
117     G4cout << "Names::GetName entered for Z =  << 
118 #endif                                         << 
119                                                   102 
120   G4int myA = A;                               << 103 //    G4int inc = 1;
121   G4int myZ = Z;                               << 
122                                                   104 
123   G4String* theName = nullptr;                 << 105     G4int flip_Z = 1;
124   G4String theFileName("");                    << 106     G4int delta_Z = 0;
125                                                   107 
126   // G4int inc = 1;                            << 108     G4int flip_A = 1;
                                                   >> 109     G4int delta_A = 0;
                                                   >> 110     
                                                   >> 111     //std::ifstream * check = new std::ifstream(".dummy");
                                                   >> 112     std::istringstream* check = NULL;
                                                   >> 113     G4bool first = true;
                                                   >> 114 if(getenv("NeutronHPNames"))  G4cout << "entered GetName!!!"<<G4endl;
                                                   >> 115     do   
                                                   >> 116     {
                                                   >> 117        aFlag = true;
                                                   >> 118        G4String * biff = new G4String(); // delete here as theName
                                                   >> 119        *biff = base+"/CrossSection/"+itoa(myZ)+"_"+itoa(myA)+sM+"_"+theString[myZ-1];
                                                   >> 120       
                                                   >> 121        if(theName!=0) delete theName;
                                                   >> 122        theName = biff;
                                                   >> 123        result.SetName(*theName);
                                                   >> 124        result.SetA(myA);
                                                   >> 125        result.SetZ(myZ);
                                                   >> 126        result.SetM(M);
                                                   >> 127 if(getenv("NeutronHPNames")) G4cout <<"HPWD 1 "<<*theName<<G4endl;
                                                   >> 128 
                                                   >> 129      // T.K. debug for memory leak
                                                   >> 130      if ( check != NULL ) {
                                                   >> 131         //check->close();
                                                   >> 132         delete check;
                                                   >> 133      } 
                                                   >> 134 
                                                   >> 135        //check = new std::ifstream(*theName);
                                                   >> 136        check = new std::istringstream(std::ios::in);
                                                   >> 137        G4ParticleHPManager::GetInstance()->GetDataStream2(*theName,*check);
                                                   >> 138        if ( !(*check) ) 
                                                   >> 139        {
                                                   >> 140     //check->close();
                                                   >> 141     delete check;
                                                   >> 142           check = 0;
                                                   >> 143           aFlag = false;
                                                   >> 144           if ( first )
                                                   >> 145           {
                                                   >> 146              aFlag = true;
                                                   >> 147              first = false;
                                                   >> 148              biff = new G4String(); // delete here as theName
                                                   >> 149              *biff = base+"/CrossSection/"+itoa(myZ)+"_"+"nat"+"_"+theString[myZ-1];
                                                   >> 150              delete theName;
                                                   >> 151              theName = biff;
                                                   >> 152 if(getenv("NeutronHPNames"))    G4cout <<"HPWD 2 "<<*theName<<G4endl;
                                                   >> 153              result.SetName(*theName);
                                                   >> 154              G4double natA = myZ/G4SandiaTable::GetZtoA(myZ);
                                                   >> 155              result.SetA(natA);
                                                   >> 156              result.SetZ(myZ);
                                                   >> 157              result.SetM(M);
                                                   >> 158              //check = new std::ifstream(*theName);
                                                   >> 159              check = new std::istringstream(std::ios::in);
                                                   >> 160              G4ParticleHPManager::GetInstance()->GetDataStream2(*theName,*check);
                                                   >> 161              if ( !(*check) ) 
                                                   >> 162              {
                                                   >> 163                 //check->close();
                                                   >> 164           delete check;
                                                   >> 165                 check = 0;
                                                   >> 166                 aFlag = false;
                                                   >> 167              }
                                                   >> 168              else
                                                   >> 169              {
                                                   >> 170                 biff = new G4String(); // delete here as theName
                                                   >> 171                 *biff = base+"/"+rest+"/"+itoa(myZ)+"_"+"nat"+"_"+theString[myZ-1];  
                                                   >> 172                 if ( rest=="/CrossSection" ) *biff = base+rest+"/"+itoa(myZ)+"_"+"nat"+"_"+theString[myZ-1];  
                                                   >> 173                 delete theName;
                                                   >> 174                 theName = biff;
                                                   >> 175 if(getenv("NeutronHPNames"))    G4cout <<"HPWD 3 "<<*theName<<G4endl;
                                                   >> 176                 result.SetName(*theName);
                                                   >> 177                 natA = myZ/G4SandiaTable::GetZtoA(myZ);
                                                   >> 178                 result.SetA(natA);
                                                   >> 179                 result.SetZ(myZ);
                                                   >> 180                 result.SetM(M);
                                                   >> 181                 result.SetNaturalAbundanceFlag();
                                                   >> 182              }
                                                   >> 183           }
                                                   >> 184        }
                                                   >> 185        else
                                                   >> 186        {
                                                   >> 187 // 070706 T. Koi Modified 
                                                   >> 188 /*
                                                   >> 189           biff = new G4String(); // delete here as theName
                                                   >> 190           *biff = base+"/"+rest+itoa(myZ)+"_"+itoa(myA)+"_"+theString[myZ-1];  
                                                   >> 191           if(theName!=0) delete theName;
                                                   >> 192           theName = biff;
                                                   >> 193 if(getenv("NeutronHPNames"))    G4cout <<"HPWD 4 "<<*theName<<G4endl;
                                                   >> 194           result.SetName(*theName);
                                                   >> 195           result.SetA(myA);
                                                   >> 196           result.SetZ(myZ);
                                                   >> 197 */
127                                                   198 
128   G4int flip_Z = 1;                            << 199           G4double tmpA = myA;
129   G4int delta_Z = 0;                           << 200           //std::ifstream* file = NULL;
                                                   >> 201           std::istringstream* file = NULL;
                                                   >> 202           G4String fileName;
                                                   >> 203 
                                                   >> 204           if ( rest == "/CrossSection" )
                                                   >> 205           {
                                                   >> 206 
                                                   >> 207              //fileName = base+"/"+rest+"/"+itoa(myZ)+"_"+itoa(myA)+sM+"_"+theString[myZ-1];
                                                   >> 208              fileName = base+rest+"/"+itoa(myZ)+"_"+itoa(myA)+sM+"_"+theString[myZ-1];
                                                   >> 209 if(getenv("NeutronHPNames"))    G4cout <<"HPWD 4a "<<*theName<<G4endl;
130                                                   210 
131   G4int flip_A = 1;                            << 211           }
132   G4int delta_A = 0;                           << 212           else
                                                   >> 213           {
133                                                   214 
134   std::istringstream* check = nullptr;         << 215 // For FS
135   G4bool first = true;                         << 216              fileName = base+"/"+rest+"/"+itoa(myZ)+"_"+itoa(myA)+sM+"_"+theString[myZ-1];
                                                   >> 217              //file = new std::ifstream(fileName);
                                                   >> 218              file = new std::istringstream(std::ios::in);
                                                   >> 219              G4ParticleHPManager::GetInstance()->GetDataStream2(fileName,*file);
                                                   >> 220 
                                                   >> 221              if ( *file )
                                                   >> 222              {
                                                   >> 223 
                                                   >> 224 // isotope FS
                                                   >> 225 if(getenv("NeutronHPNames"))    G4cout <<"HPWD 4b1 "<<*theName<<G4endl;
                                                   >> 226              }
                                                   >> 227              else
                                                   >> 228              {
                                                   >> 229 
                                                   >> 230 // _nat_ FS
                                                   >> 231                 fileName  = base+"/"+rest+"/"+itoa(myZ)+"_"+"nat"+"_"+theString[myZ-1];
                                                   >> 232 
                                                   >> 233                 delete file;
                                                   >> 234                 //file = new std::ifstream(fileName);
                                                   >> 235                 file = new std::istringstream(std::ios::in);
                                                   >> 236                 G4ParticleHPManager::GetInstance()->GetDataStream2(fileName,*file);
                                                   >> 237                 if ( *file )
                                                   >> 238                 {
                                                   >> 239 
                                                   >> 240 // FS neither isotope nor _nat_
                                                   >> 241 if(getenv("NeutronHPNames"))    G4cout <<"HPWD 4b2a "<<*theName<<G4endl;
                                                   >> 242                    G4double natA = myZ/G4SandiaTable::GetZtoA(myZ);
                                                   >> 243                    tmpA = natA;
                                                   >> 244                 }
                                                   >> 245                 else
                                                   >> 246                 {
                                                   >> 247 if(getenv("NeutronHPNames"))    G4cout <<"HPWD 4b2c "<<*theName<<G4endl;
                                                   >> 248                    fileName="INVALID";
                                                   >> 249                 }
                                                   >> 250              }
136                                                   251 
137 #ifdef G4VERBOSE                               << 252              delete file;
138   if (fManager->GetDEBUG())                    << 
139     G4cout << "entered GetName!!!" << G4endl;  << 
140 #endif                                         << 
141                                                   253 
142   do {                                         << 254           }
143     aFlag = true;                              << 
144     auto biff = new G4String();  // delete her << 
145     *biff = base + "/CrossSection/" + itoa(myZ << 
146                                                   255 
147     delete theName;                            << 256           result.SetName(fileName);
148     theName = biff;                            << 257           result.SetA(tmpA);
149     result.SetName(*theName);                  << 
150     result.SetA(myA);                          << 
151     result.SetZ(myZ);                          << 
152     result.SetM(M);                            << 
153     delete check;                              << 
154                                                << 
155     check = new std::istringstream(std::ios::i << 
156     fManager->GetDataStream2(*theName, *check) << 
157     if (!(*check)) {                           << 
158       delete check;                            << 
159       check = nullptr;                         << 
160       aFlag = false;                           << 
161       if (first) {                             << 
162         aFlag = true;                          << 
163         first = false;                         << 
164         biff = new G4String();  // delete here << 
165         *biff = base + "/CrossSection/" + itoa << 
166         delete theName;                        << 
167         theName = biff;                        << 
168         result.SetName(*theName);              << 
169         G4double natA = myZ / G4SandiaTable::G << 
170         result.SetA(natA);                     << 
171         result.SetZ(myZ);                      << 
172         result.SetM(M);                        << 
173         // check = new std::ifstream(*theName) << 
174         check = new std::istringstream(std::io << 
175         fManager->GetDataStream2(*theName, *ch << 
176         if (!(*check)) {                       << 
177           // check->close();                   << 
178           delete check;                        << 
179           check = nullptr;                     << 
180           aFlag = false;                       << 
181         }                                      << 
182         else {                                 << 
183           biff = new G4String();  // delete he << 
184           *biff = base + "/" + rest + "/" + it << 
185           if (rest == "/CrossSection")         << 
186             *biff = base + rest + "/" + itoa(m << 
187           delete theName;                      << 
188           theName = biff;                      << 
189           result.SetName(*theName);            << 
190           natA = myZ / G4SandiaTable::GetZtoA( << 
191           result.SetA(natA);                   << 
192           result.SetZ(myZ);                       258           result.SetZ(myZ);
193           result.SetM(M);                         259           result.SetM(M);
194           result.SetNaturalAbundanceFlag();    << 260 
195         }                                      << 261        }
196       }                                        << 262 
197     }                                          << 263        do 
198     else {                                     << 264        {
199       G4double tmpA = myA;                     << 265 //        if (std::abs(myZ-Z)>theMaxOffSet||myZ==0||myA==0)
200       std::istringstream* file = nullptr;      << 266           if ( delta_Z > theMaxOffSet )
201       G4String fileName;                       << 267           { 
202                                                << 268              //if ( inc > 0 )
203       if (rest == "/CrossSection") {           << 269              //{
204         fileName = base + rest + "/" + itoa(my << 270              //   inc*= -1;
205         // if(fManager->GetDEBUG()) G4cout <<" << 271              //   myZ = Z;
206       }                                        << 272              //   myA = A;
207       else {                                   << 273              //}
208         // For FS                              << 274              //else
209         fileName =                             << 275              //{
210           base + "/" + rest + "/" + itoa(myZ)  << 276                 G4cout <<"G4ParticleHPNames: Sorry, this material does not come near to any data."<<G4endl;
211         file = new std::istringstream(std::ios << 277                 G4cout <<"G4ParticleHPNames: Please make sure G4NEUTRONHPDATA points to the" << G4endl;
212         fManager->GetDataStream2(fileName, *fi << 278                 G4cout <<"                  directory, the neutron scattering data are located in." << G4endl;
213                                                << 279                 G4cout << "G4ParticleHPNames: The material was: A="<<A<<", Z="<<Z<<G4endl;
214         if (*file) {                           << 280                 //throw G4HadronicException(__FILE__, __LINE__, "In case the data sets are at present not available in the neutron data library, please contact Hans-Peter.Wellisch@cern.ch");
215           // isotope FS                        << 281                 throw G4HadronicException(__FILE__, __LINE__, "In case the data sets are at present not available in the neutron data library, please contact Hadron Group Coordinator");
216           // if(fManager->GetDEBUG()) G4cout < << 282 /*
217         }                                      << 283 160910 TK makes commented out sructurally dead code
218         else {                                 << 284                 delete theName;
219           // _nat_ FS                          << 285                 theFileName = "";
220           fileName = base + "/" + rest + "/" + << 286                 return result;
221                                                << 287 */
222           delete file;                         << 288              //}
223           file = new std::istringstream(std::i << 
224           G4ParticleHPManager::GetInstance()-> << 
225           if (*file) {                         << 
226             // FS neither isotope nor _nat_    << 
227             // if(fManager->GetDEBUG()) G4cout << 
228             G4double natA = myZ / G4SandiaTabl << 
229             tmpA = natA;                       << 
230           }                                       289           }
231           else {                               << 290 
232             // if(fManager->GetDEBUG()) G4cout << 291           //if ( std::abs( myA - A ) > theMaxOffSet )
233             fileName = "INVALID";              << 292           if ( delta_A > 2*theMaxOffSet )
                                                   >> 293           {
                                                   >> 294              delta_A = 0;
                                                   >> 295              flip_A = 1;
                                                   >> 296 
                                                   >> 297              first = true;
                                                   >> 298 
                                                   >> 299              if ( flip_Z > 0 ) 
                                                   >> 300              {
                                                   >> 301                 delta_Z +=1; 
                                                   >> 302              }
                                                   >> 303              myZ = Z + flip_Z * delta_Z;
                                                   >> 304              flip_Z *= -1;
                                                   >> 305              
                                                   >> 306              myA = A;
                                                   >> 307              if ( myZ > 100 ) 
                                                   >> 308              {
                                                   >> 309                 myZ = 100;
                                                   >> 310              }
                                                   >> 311              if ( myZ < 1 ) 
                                                   >> 312              {
                                                   >> 313                 myZ = 1;
                                                   >> 314              }
                                                   >> 315               
                                                   >> 316 //             myZ += inc;
                                                   >> 317           }
                                                   >> 318           else
                                                   >> 319           {
                                                   >> 320              if ( flip_A > 0 )
                                                   >> 321              {
                                                   >> 322                 delta_A += 1;
                                                   >> 323              }
                                                   >> 324              myA = A + flip_A * delta_A; 
                                                   >> 325              flip_A *= -1;
                                                   >> 326 
                                                   >> 327              if ( myA < 1 ) 
                                                   >> 328              {
                                                   >> 329                 myA = 1;
                                                   >> 330              }
                                                   >> 331               
                                                   >> 332 //             myA += inc;
234           }                                       333           }
235         }                                      << 334 
236         delete file;                           << 335        }
237       }                                        << 336        while( myZ == 0 || myA == 0 );  // No meaning // Loop checking, 11.05.2015, T. Koi
238                                                << 337 
239       result.SetName(fileName);                << 
240       result.SetA(tmpA);                       << 
241       result.SetZ(myZ);                        << 
242       result.SetM(M);                          << 
243     }                                             338     }
                                                   >> 339     while((!check) || (!(*check))); // Loop checking, 11.05.2015, T. Koi
244                                                   340 
245     do {                                       << 341     if(getenv("NeutronHPNamesLogging") || getenv("NeutronHPNames")) 
246       if (delta_Z > theMaxOffSet) {            << 342     {
247         if (!fManager->GetSkipMissingIsotopes( << 343       G4cout << "Names::GetName: last theName proposal = "<< G4endl;
248 #ifdef G4VERBOSE                               << 344       G4cout << *theName <<" "<<A<<" "<<Z<<" "<<result.GetName()<<G4endl;
249           if (fManager->GetVerboseLevel() > 0) << 345     }
250             G4cout << "G4ParticleHPNames: Ther << 
251                       "material "              << 
252                    << G4endl;                  << 
253             G4cout << "G4ParticleHPNames: nor  << 
254             G4cout << "G4ParticleHPNames: Plea << 
255                    << G4endl;                  << 
256             G4cout << "G4ParticleHPNames: in w << 
257                    << G4endl;                  << 
258             G4cout << "G4ParticleHPNames: The  << 
259           }                                    << 
260 #endif                                         << 
261     G4ExceptionDescription ed;                 << 
262     ed << "Data for Z=" << Z << " A=" << A <<  << 
263     G4Exception("G4ParticleHPName::Init(...)", << 
264           JustWarning, ed, "");                << 
265         }                                      << 
266         check = new std::istringstream(std::io << 
267         break;                                 << 
268       }                                        << 
269       if (delta_A > 2 * theMaxOffSet) {        << 
270         delta_A = 0;                           << 
271         flip_A = 1;                            << 
272                                                << 
273         first = true;                          << 
274                                                << 
275         if (flip_Z > 0) {                      << 
276           delta_Z += 1;                        << 
277         }                                      << 
278         myZ = Z + flip_Z * delta_Z;            << 
279         flip_Z *= -1;                          << 
280                                                << 
281         myA = A;                               << 
282         if (myZ > 100) {                       << 
283           myZ = 100;                           << 
284         }                                      << 
285         if (myZ < 1) {                         << 
286           myZ = 1;                             << 
287         }                                      << 
288                                                << 
289         // myZ += inc;                         << 
290       }                                        << 
291       else {                                   << 
292         if (flip_A > 0) {                      << 
293           delta_A += 1;                        << 
294         }                                      << 
295         myA = A + flip_A * delta_A;            << 
296         flip_A *= -1;                          << 
297                                                << 
298         if (myA < 1) {                         << 
299           myA = 1;                             << 
300         }                                      << 
301                                                << 
302         // myA += inc;                         << 
303       }                                        << 
304                                                << 
305     } while (myZ == 0 || myA == 0);  // No mea << 
306                                                << 
307   } while ((check == nullptr) || (!(*check))); << 
308                                                << 
309 #ifdef G4VERBOSE                               << 
310   if (fManager->GetDEBUG())                    << 
311   {                                            << 
312     G4cout << "Names::GetName: last theName pr << 
313     G4cout << *theName << " " << A << " " << Z << 
314   }                                            << 
315 #endif                                         << 
316                                                   346 
317   // administration and anouncement for lackin << 347 // administration and anouncement for lacking of exact data in NDL 
318   if (Z != result.GetZ() || A != result.GetA() << 348     if ( Z != result.GetZ() || A != result.GetA() )
319     if (rest == "/CrossSection") {             << 349     {
320       G4String reac = base;                    << 350        if ( rest == "/CrossSection" )
321       const G4String& dir = fManager->GetNeutr << 351        {
322       reac.erase(0, dir.length());             << 352           G4String reac = base;
323       if (fManager->GetSkipMissingIsotopes()   << 353           G4String dir = getenv("G4NEUTRONHPDATA"); 
324           && (Z != result.GetZ() || !result.Is << 354           reac.erase ( 0 , dir.length() );
325       {                                        << 355           if ( G4ParticleHPManager::GetInstance()->GetSkipMissingIsotopes() && !( Z == result.GetZ() && result.IsThisNaturalAbundance() ) )
326 #ifdef G4VERBOSE                               << 356           {
327         if (fManager->GetVerboseLevel() > 0) { << 357              if ( verboseLevel > 0 ) {
328           G4cout << "NeutronHP: " << reac << " << 358                 G4cout << "NeutronHP: " << reac << " file for Z = " << Z << ", A = " << A << " is not found and CrossSection set to 0." << G4endl;
329                  << " is not found and CrossSe << 359              }
330         }                                      << 360              G4String new_name = base+"/"+rest+"/"+"0_0_Zero";  
331 #endif                                         << 361              result.SetName( new_name );
332         const G4String& new_name = base + "/"  << 362           }
333         result.SetName(new_name);              << 363           else
334       }                                        << 364           { 
335       else {                                   << 365              //080901 Add protection that deuteron data do not selected for hydrogen and so on by T. Koi
336         // 080901 Add protection that deuteron << 366              //160216 Increase protencted isotopes for fixing problem on charged particle HP
337         // 160216 Increase protencted isotopes << 367              if ( ( reac.find("Inelastic") != reac.size() && ( (Z == 1 && A == 1) || (Z == 1 && A == 2) || (Z == 1 && A == 3) || (Z == 2 && A == 3) || (Z == 2 && A == 4) ) ) 
338         if ((reac.find("Inelastic") != reac.si << 368                || ( reac.find("Capture")   != reac.size() && ( (Z == 1 && A == 3) || (Z == 2 && A == 4) ) )  
339              && ((Z == 1 && A == 1) || (Z == 1 << 369                || ( reac.find("Fission")   != reac.size() && ( (Z == 88 && A == 224) || (Z == 88 && A == 225) || (Z == 89 && A == 225) || (Z == 88 && A == 226) ) ) ) 
340                  || (Z == 2 && A == 3) || (Z = << 370                    
341             || (reac.find("Capture") != reac.s << 371              {
342             || (reac.find("Fission") != reac.s << 372                 G4String new_name = base+"/"+rest+"/"+"0_0_Zero";
343                 && ((Z == 88 && A == 224) || ( << 373                 result.SetName( new_name );
344                     || (Z == 88 && A == 226))) << 374              }
345                                                << 375              else
346         {                                      << 376              {
347           const G4String& new_name = base + "/ << 377                 if ( verboseLevel > 0 ) {
348           result.SetName(new_name);            << 378                    G4cout << "NeutronHP: " << reac << " file for Z = " << Z << ", A = " << A << " is not found and NeutronHP will use " << result.GetName() << G4endl;
349         }                                      << 379                 }
350         else {                                 << 380              }
351 #ifdef G4VERBOSE                               << 
352           if (fManager->GetVerboseLevel() > 0) << 
353             G4cout << "NeutronHP: " << reac << << 
354                    << " is not found and Neutr << 
355           }                                       381           }
356 #endif                                         << 382        }
357         }                                      << 
358       }                                        << 
359     }                                             383     }
360   }                                            << 
361                                                << 
362   delete theName;                              << 
363   delete check;                                << 
364                                                   384 
365   return result;                               << 385     delete theName;
366 }                                              << 386     if(aFlag)
                                                   >> 387     {
                                                   >> 388       //check->close();
                                                   >> 389       delete check;
                                                   >> 390       check = NULL;
                                                   >> 391     }
                                                   >> 392     return result;
                                                   >> 393   }
367                                                   394