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.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/lend/src/G4LENDManager.cc (Version 11.3.0) and /processes/hadronic/models/lend/src/G4LENDManager.cc (Version 8.0)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 // Class Description                              
 27 // Manager of LEND (Low Energy Nuclear Data) t    
 28 // LEND is Geant4 interface for GIDI (General     
 29 // which gives a discription of nuclear and at    
 30 //    Binary collision cross sections             
 31 //    Particle number multiplicity distributio    
 32 //    Energy and angular distributions of reac    
 33 //    Derived calculational constants             
 34 // GIDI is developped at Lawrence Livermore Na    
 35 // Class Description - End                        
 36                                                   
 37 // 071025 First implementation done by T. Koi     
 38 // 101118 Name modifications for release T. Ko    
 39                                                   
 40 #include "G4LENDManager.hh"                       
 41 #include "G4HadronicException.hh"                 
 42                                                   
 43 #include "G4Neutron.hh"                           
 44 #include "G4Gamma.hh"                             
 45 #include "G4Proton.hh"                            
 46 #include "G4Deuteron.hh"                          
 47 #include "G4Triton.hh"                            
 48 #include "G4He3.hh"                               
 49 #include "G4Alpha.hh"                             
 50                                                   
 51 #include <fstream>                                
 52                                                   
 53 G4LENDManager* G4LENDManager::lend_manager = N    
 54                                                   
 55                                                   
 56 G4LENDManager::G4LENDManager()                    
 57 :verboseLevel( 0 )                                
 58 {                                                 
 59                                                   
 60    //printBanner();                               
 61                                                   
 62    G4String xmcf;                                 
 63    G4String xmcf_gamma;                           
 64    G4String xmcf_p;                               
 65    G4String xmcf_d;                               
 66    G4String xmcf_t;                               
 67    G4String xmcf_he3;                             
 68    G4String xmcf_a;                               
 69    if( G4FindDataDir("G4LENDDATA") == NULL ) {    
 70       throw G4HadronicException(__FILE__, __LI    
 71    } else {                                       
 72       xmcf = G4FindDataDir("G4LENDDATA");         
 73       //xmcf += "/xmcf.n_1.map";                  
 74       xmcf += "/neutrons.map";                    
 75       xmcf_gamma = G4FindDataDir("G4LENDDATA")    
 76       xmcf_gamma += "/gammas.map";                
 77       xmcf_p = G4FindDataDir("G4LENDDATA");       
 78       xmcf_p += "/protons.map";                   
 79       xmcf_d = G4FindDataDir("G4LENDDATA");       
 80       xmcf_d += "/deuterons.map";                 
 81       xmcf_t = G4FindDataDir("G4LENDDATA");       
 82       xmcf_t += "/tritons.map";                   
 83       xmcf_he3 = G4FindDataDir("G4LENDDATA");     
 84       xmcf_he3 += "/He3s.map";                    
 85       xmcf_a = G4FindDataDir("G4LENDDATA");       
 86       xmcf_a += "/alphas.map";                    
 87    }                                              
 88                                                   
 89 //Example of xmcf.n_1.map                         
 90 //<map>                                           
 91 //<target schema="MonteCarlo" evaluation="ENDF    
 92 //</map>                                          
 93 //                                                
 94 // for neutron                                    
 95    proj_lend_map.insert ( std::pair < G4Partic    
 96 // for gamma                                      
 97    proj_lend_map.insert ( std::pair < G4Partic    
 98 //                                                
 99    std::ifstream aFile;                           
100    aFile.open( xmcf_p.c_str() );                  
101    if ( aFile.good() ) {                          
102       aFile.close();                              
103       proj_lend_map.insert ( std::pair < G4Par    
104    } else  {                                      
105       aFile.close();                              
106    }                                              
107    aFile.open( xmcf_d.c_str() );                  
108    if ( aFile.good() ) {                          
109       aFile.close();                              
110       proj_lend_map.insert ( std::pair < G4Par    
111    } else  {                                      
112       aFile.close();                              
113    }                                              
114    aFile.open( xmcf_t.c_str() );                  
115    if ( aFile.good() ) {                          
116       aFile.close();                              
117       proj_lend_map.insert ( std::pair < G4Par    
118    } else  {                                      
119       aFile.close();                              
120    }                                              
121    aFile.open( xmcf_he3.c_str() );                
122    if ( aFile.good() ) {                          
123       aFile.close();                              
124       proj_lend_map.insert ( std::pair < G4Par    
125    } else  {                                      
126       aFile.close();                              
127    }                                              
128    aFile.open( xmcf_a.c_str() );                  
129    if ( aFile.good() ) {                          
130       aFile.close();                              
131       proj_lend_map.insert ( std::pair < G4Par    
132    } else  {                                      
133       aFile.close();                              
134    }                                              
135                                                   
136                                                   
137                                                   
138 // proj_lend_map.insert ( std::pair < G4Partic    
139                                                   
140    v_lend_target.clear();                         
141                                                   
142    //ionTable = new G4IonTable();                 
143    ionTable = G4ParticleTable::GetParticleTabl    
144    nistElementBuilder = new G4NistElementBuild    
145                                                   
146    //Prepare table of excitation energy of exc    
147    G4int pdgCode;                                 
148    //              iZ        iA    iM ->Co58m1    
149    pdgCode= 10000 * 27 + 10 * 58 + 1;             
150    pdgCode = GetNucleusEncoding( 27 , 58 , 1 )    
151    mExcitationEnergy.insert(std::pair<G4int,G4    
152    pdgCode= 10000 * 47 + 10 * 110 + 1;            
153    pdgCode = GetNucleusEncoding( 47 , 110 , 1     
154    mExcitationEnergy.insert(std::pair<G4int,G4    
155    pdgCode= 10000 * 48 + 10 * 115 + 1;            
156    pdgCode = GetNucleusEncoding( 48 , 115 , 1     
157    mExcitationEnergy.insert(std::pair<G4int,G4    
158    pdgCode= 10000 * 52 + 10 * 127 + 1;            
159    pdgCode = GetNucleusEncoding( 52 , 127 , 1     
160    mExcitationEnergy.insert(std::pair<G4int,G4    
161    pdgCode= 10000 * 52 + 10 * 129 + 1;            
162    pdgCode = GetNucleusEncoding( 52 , 129 , 1     
163    mExcitationEnergy.insert(std::pair<G4int,G4    
164    pdgCode= 10000 * 61 + 10 * 148 + 1;            
165    pdgCode = GetNucleusEncoding( 61 , 148 , 1     
166    mExcitationEnergy.insert(std::pair<G4int,G4    
167    pdgCode= 10000 * 67 + 10 * 166 + 1;            
168    pdgCode = GetNucleusEncoding( 67 , 166 , 1     
169    mExcitationEnergy.insert(std::pair<G4int,G4    
170    pdgCode= 10000 * 95 + 10 * 242 + 1;            
171    pdgCode = GetNucleusEncoding( 95 , 242 , 1     
172    mExcitationEnergy.insert(std::pair<G4int,G4    
173    pdgCode= 10000 * 95 + 10 * 244 + 1;            
174    pdgCode = GetNucleusEncoding( 95 , 244 , 1     
175    mExcitationEnergy.insert(std::pair<G4int,G4    
176    pdgCode= 10000 * 99 + 10 * 254 + 1;            
177    pdgCode = GetNucleusEncoding( 99 , 254 , 1     
178    mExcitationEnergy.insert(std::pair<G4int,G4    
179                                                   
180 }                                                 
181                                                   
182                                                   
183                                                   
184 G4LENDManager::~G4LENDManager()                   
185 {                                                 
186                                                   
187 // deleting target                                
188    for ( auto it = v_lend_target.cbegin() ; it    
189    {                                              
190         (*it).lend->freeTarget( it->target );     
191    }                                              
192                                                   
193 // deleting lend                                  
194    for ( auto it = proj_lend_map.cbegin() ; it    
195    {                                              
196       delete it->second;                          
197    }                                              
198                                                   
199    //delete ionTable;                             
200    delete nistElementBuilder;                     
201                                                   
202 }                                                 
203                                                   
204                                                   
205                                                   
206 G4GIDI_target* G4LENDManager::GetLENDTarget( G    
207 {                                                 
208                                                   
209    G4GIDI_target* anLENDTarget = NULL;            
210                                                   
211    if ( iM > 9 ) {                                
212       throw G4HadronicException(__FILE__, __LI    
213    }                                              
214                                                   
215    G4int iTarg = GetNucleusEncoding( iZ , iA ,    
216                                                   
217    // Searching in current map                    
218    for ( auto it = v_lend_target.cbegin() ; it    
219    {                                              
220       if ( it->proj == proj && it->target_code    
221       {                                           
222          //find!                                  
223          return it->target;                       
224       }                                           
225    }                                              
226                                                   
227                                                   
228    if ( proj_lend_map.find ( proj ) == proj_le    
229       G4cout << proj->GetParticleName() << " i    
230       return anLENDTarget; // return NULL         
231    }                                              
232                                                   
233    G4GIDI* xlend = proj_lend_map.find ( proj )    
234                                                   
235    if ( xlend->isThisDataAvailable( evaluation    
236    {                                              
237                                                   
238       if ( verboseLevel > 1 ) {                   
239          G4cout << evaluation << " for " << io    
240                  << " with Isomer level of " <    
241       }                                           
242                                                   
243       anLENDTarget = xlend->readTarget( evalua    
244                                                   
245       lend_target new_target;                     
246       new_target.lend = xlend;                    
247       new_target.target = anLENDTarget;           
248       new_target.proj = proj;                     
249       new_target.evaluation = evaluation;         
250       new_target.target_code = iTarg;             
251                                                   
252       v_lend_target.push_back( std::move(new_t    
253                                                   
254 //    found EXACT                                 
255       return anLENDTarget;                        
256                                                   
257    }                                              
258    else                                           
259    {                                              
260 //    NO EXACT DATA (Evaluatino & Z,A,M)          
261                                                   
262       //Searching available evaluation and nat    
263       //                                          
264       if ( verboseLevel > 1 )                     
265          G4cout << evaluation << " for " << io    
266                 << " with Isomer level of " <<    
267                                                   
268       std::vector< std::string >* available =     
269       if ( available->size() > 0 ) {              
270 //       EXACT Z,A,M but Evaluation is differe    
271          if ( verboseLevel > 1 )                  
272          {                                        
273             G4cout << " However you can use fo    
274                                                   
275             for ( auto its = available->cbegin    
276                G4cout << *its << G4endl;          
277                                                   
278             G4cout << G4endl;                     
279          }                                        
280       } else if ( xlend->isThisDataAvailable(     
281 //                                                
282 //    checking natural abundance data for Z       
283 //                                                
284 //       EXACT natural abundance data for the     
285          if ( verboseLevel > 1 )                  
286             G4cout << " However you can use na    
287       }                                           
288       else                                        
289       {                                           
290          std::vector< std::string >* available    
291 //                                                
292          if ( available_nat->size() > 0 ) {       
293 //          EXACT natural abundance data for Z    
294             if ( verboseLevel > 1 ) {             
295                G4cout << " However you can use    
296                                                   
297                for ( auto its = available_nat-    
298                   G4cout << *its << G4endl;       
299                G4cout << G4endl;                  
300             }                                     
301          }                                        
302          delete available_nat;                    
303       }                                           
304       delete available;                           
305 //    return NULL if exact data is not availab    
306       return anLENDTarget; // return NULL         
307    }                                              
308                                                   
309    return anLENDTarget;                           
310 }                                                 
311                                                   
312                                                   
313 std::vector< G4String > G4LENDManager::IsLENDT    
314 {                                                 
315                                                   
316    std::vector< G4String > vEvaluation;           
317    if ( proj_lend_map.find ( proj ) == proj_le    
318    {                                              
319       G4cout << proj->GetParticleName() << " i    
320       return vEvaluation; // return empty         
321    }                                              
322                                                   
323    G4GIDI* xlend = proj_lend_map.find ( proj )    
324    std::vector< std::string >* available =  xl    
325                                                   
326    if ( available->size() > 0 ) {                 
327       for ( auto its = available->cbegin() ; i    
328          vEvaluation.push_back ( *its );          
329    }                                              
330    delete available;                              
331                                                   
332    return vEvaluation;                            
333 }                                                 
334                                                   
335                                                   
336                                                   
337 G4int G4LENDManager::GetNucleusEncoding ( G4in    
338 {                                                 
339    G4int value = ionTable->GetNucleusEncoding(    
340                                                   
341    value += iM;                                   
342    return value;                                  
343 }                                                 
344                                                   
345                                                   
346                                                   
347 void G4LENDManager::printBanner()                 
348 {                                                 
349    G4cout << " <<BEGIN-copyright>> " << G4endl    
350    G4cout << " Copyright (c) 2010, Lawrence Li    
351    G4cout << " Produced at the Lawrence Liverm    
352    G4cout << " Written by Bret R. Beck, beck6@    
353    G4cout << " CODE-461393 " << G4endl;           
354    G4cout << " All rights reserved.  " << G4en    
355    G4cout << "  " << G4endl;                      
356    G4cout << " This file is part of GIDI. For     
357    G4cout << " Please also read the \"Addition    
358    G4cout << " " << G4endl;                       
359    G4cout << " Redistribution and use in sourc    
360    G4cout << " are permitted provided that the    
361    G4cout << " " << G4endl;                       
362    G4cout << "      1) Redistributions of sour    
363    G4cout << "         this list of conditions    
364    G4cout << "      2) Redistributions in bina    
365    G4cout << "         this list of conditions    
366    G4cout << "          documentation and/or o    
367    G4cout << "      3) Neither the name of the    
368    G4cout << "         used to endorse or prom    
369    G4cout << "         specific prior written     
370    G4cout << " " << G4endl;                       
371    G4cout << " THIS SOFTWARE IS PROVIDED BY TH    
372    G4cout << " EXPRESS OR IMPLIED WARRANTIES,     
373    G4cout << " OF MERCHANTABILITY AND FITNESS     
374    G4cout << " SHALL LAWRENCE LIVERMORE NATION    
375    G4cout << " CONTRIBUTORS BE LIABLE FOR ANY     
376    G4cout << " CONSEQUENTIAL DAMAGES (INCLUDIN    
377    G4cout << " OR SERVICES;  LOSS OF USE, DATA    
378    G4cout << " AND ON  ANY THEORY OF LIABILITY    
379    G4cout << " (INCLUDING NEGLIGENCE OR OTHERW    
380    G4cout << " EVEN IF ADVISED OF THE POSSIBIL    
381    G4cout << " <<END-copyright>> " << G4endl;     
382 }                                                 
383                                                   
384                                                   
385 G4bool G4LENDManager::RequestChangeOfVerboseLe    
386 {                                                 
387    G4bool result=false;                           
388    if ( newValue >= verboseLevel)                 
389    {                                              
390       verboseLevel = newValue;                    
391       result=true;                                
392    }                                              
393    else                                           
394    {                                              
395       G4cout << "Since other LEND model or cro    
396    }                                              
397                                                   
398    return result;                                 
399 }                                                 
400                                                   
401 G4double G4LENDManager::GetExcitationEnergyOfE    
402 {                                                 
403    G4double EE = 0.0;                             
404    G4int nucCode = GetNucleusEncoding( iZ , iA    
405    auto it = mExcitationEnergy.find( nucCode )    
406    if ( it != mExcitationEnergy.cend() ) {        
407       EE = it->second;                            
408    } else {                                       
409       if ( iM == 0 ) {                            
410          G4cout << "G4LENDManager::GetExcitati    
411       } else {                                    
412          G4cout << "Can not find excitation en    
413       }                                           
414    }                                              
415    return EE;                                     
416 }                                                 
417