Geant4  10.02.p03
G4LENDManager Class Reference

#include <G4LENDManager.hh>

Collaboration diagram for G4LENDManager:

Public Member Functions

G4GIDI_targetGetLENDTarget (G4ParticleDefinition *, G4String, G4int iZ, G4int iA, G4int iM=0)
 
std::vector< G4StringIsLENDTargetAvailable (G4ParticleDefinition *, G4int iZ, G4int iA, G4int iM=0)
 
G4int GetNucleusEncoding (G4int iZ, G4int iA, G4int iM)
 
G4NistElementBuilderGetNistElementBuilder ()
 
G4int GetVerboseLevel ()
 
G4bool RequestChangeOfVerboseLevel (G4int)
 

Static Public Member Functions

static G4LENDManagerGetInstance ()
 

Private Member Functions

 G4LENDManager ()
 
 G4LENDManager (const G4LENDManager &)
 
G4LENDManageroperator= (const G4LENDManager &)
 
 ~G4LENDManager ()
 
void printBanner ()
 

Private Attributes

G4int verboseLevel
 
std::vector< lend_targetv_lend_target
 
std::map< G4ParticleDefinition *, G4GIDI *> proj_lend_map
 
G4IonTableionTable
 
G4NistElementBuildernistElementBuilder
 

Static Private Attributes

static G4LENDManagerlend_manager = NULL
 

Detailed Description

Definition at line 63 of file G4LENDManager.hh.

Constructor & Destructor Documentation

◆ G4LENDManager() [1/2]

G4LENDManager::G4LENDManager ( )
private

Definition at line 56 of file G4LENDManager.cc.

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( getenv("G4LENDDATA") == NULL ) {
70  throw G4HadronicException(__FILE__, __LINE__, " Please setenv G4LENDDATA to point to the LEND files." );
71  } else {
72  xmcf = getenv("G4LENDDATA");
73  //xmcf += "/xmcf.n_1.map";
74  xmcf += "/neutrons.map";
75  xmcf_gamma = getenv("G4LENDDATA");
76  xmcf_gamma += "/gammas.map";
77  xmcf_p = getenv("G4LENDDATA");
78  xmcf_p += "/protons.map";
79  xmcf_d = getenv("G4LENDDATA");
80  xmcf_d += "/deuterons.map";
81  xmcf_t = getenv("G4LENDDATA");
82  xmcf_t += "/tritons.map";
83  xmcf_he3 = getenv("G4LENDDATA");
84  xmcf_he3 += "/He3s.map";
85  xmcf_a = getenv("G4LENDDATA");
86  xmcf_a += "/alphas.map";
87  }
88 
89 //Example of xmcf.n_1.map
90 //<map>
91 //<target schema="MonteCarlo" evaluation="ENDF.B-VII.0" projectile="n_1" target="H_1" path="000_n_1/xMC.000_n_1.001_H_1/xMC.000_n_1.001_H_1.xml"/>
92 //</map>
93 //
94 // for neutron "1" for neutron; see G4GIDI::init
95  proj_lend_map.insert ( std::pair < G4ParticleDefinition* , G4GIDI* > ( G4Neutron::Neutron() , new G4GIDI( 1 , xmcf ) ) );
96 // for gamma "0" for gamma; see G4GIDI::init
97  proj_lend_map.insert ( std::pair < G4ParticleDefinition* , G4GIDI* > ( G4Gamma::Gamma() , new G4GIDI( 0 , xmcf_gamma ) ) );
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 < G4ParticleDefinition* , G4GIDI* > ( G4Proton::Proton() , new G4GIDI( 2 , xmcf_p ) ) );
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 < G4ParticleDefinition* , G4GIDI* > ( G4Deuteron::Deuteron() , new G4GIDI( 3 , xmcf_d ) ) );
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 < G4ParticleDefinition* , G4GIDI* > ( G4Triton::Triton() , new G4GIDI( 4 , xmcf_t ) ) );
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 < G4ParticleDefinition* , G4GIDI* > ( G4He3::He3() , new G4GIDI( 5 , xmcf_he3 ) ) );
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 < G4ParticleDefinition* , G4GIDI* > ( G4Alpha::Alpha() , new G4GIDI( 6 , xmcf_a ) ) );
132  } else {
133  aFile.close();
134  }
135 
136 
137 
138 // proj_lend_map.insert ( std::pair < G4ParticleDefinition* , G4GIDI* > ( xxx , new G4GIDI( xxx , xmcf ) ) );
139 
140  v_lend_target.clear();
141 
142  //ionTable = new G4IonTable();
145 
146 }
G4IonTable * ionTable
std::map< G4ParticleDefinition *, G4GIDI *> proj_lend_map
std::vector< lend_target > v_lend_target
G4IonTable * GetIonTable() const
static G4Triton * Triton()
Definition: G4Triton.cc:95
static G4Proton * Proton()
Definition: G4Proton.cc:93
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
static G4Deuteron * Deuteron()
Definition: G4Deuteron.cc:94
G4NistElementBuilder * nistElementBuilder
static G4ParticleTable * GetParticleTable()
static G4Alpha * Alpha()
Definition: G4Alpha.cc:89
static G4He3 * He3()
Definition: G4He3.cc:94
Definition: G4GIDI.hh:43
Here is the call graph for this function:

◆ G4LENDManager() [2/2]

G4LENDManager::G4LENDManager ( const G4LENDManager )
private

◆ ~G4LENDManager()

G4LENDManager::~G4LENDManager ( )
private

Definition at line 150 of file G4LENDManager.cc.

151 {
152 
153 // deleting target
154  for ( std::vector < lend_target >::iterator
155  it = v_lend_target.begin() ; it != v_lend_target.end() ; it++ )
156  {
157  (*it).lend->freeTarget( it->target );
158  }
159 
160 // deleting lend
161  for ( std::map < G4ParticleDefinition* , G4GIDI* >::iterator
162  it = proj_lend_map.begin() ; it != proj_lend_map.end() ; it++ )
163  {
164  delete it->second;
165  }
166 
167  //delete ionTable;
168  delete nistElementBuilder;
169 
170 }
std::map< G4ParticleDefinition *, G4GIDI *> proj_lend_map
std::vector< lend_target > v_lend_target
G4NistElementBuilder * nistElementBuilder

Member Function Documentation

◆ GetInstance()

static G4LENDManager* G4LENDManager::GetInstance ( void  )
inlinestatic

Definition at line 77 of file G4LENDManager.hh.

78  {
79  if ( lend_manager == NULL) lend_manager = new G4LENDManager();
80  return lend_manager;
81  };
static G4LENDManager * lend_manager
Here is the caller graph for this function:

◆ GetLENDTarget()

G4GIDI_target * G4LENDManager::GetLENDTarget ( G4ParticleDefinition proj,
G4String  evaluation,
G4int  iZ,
G4int  iA,
G4int  iM = 0 
)

Definition at line 174 of file G4LENDManager.cc.

175 {
176 
177  G4GIDI_target* anLENDTarget = NULL;
178 
179  if ( iM > 9 ) {
180  throw G4HadronicException(__FILE__, __LINE__, "Requested isomer level of target is too high." );
181  }
182 
183  G4int iTarg = GetNucleusEncoding( iZ , iA , iM );
184 
185  // Searching in current map
186  for ( std::vector < lend_target >::iterator
187  it = v_lend_target.begin() ; it != v_lend_target.end() ; it++ )
188  {
189  if ( it->proj == proj && it->target_code == iTarg && it->evaluation == evaluation )
190  {
191  //find!
192  return it->target;
193  }
194  }
195 
196 
197  if ( proj_lend_map.find ( proj ) == proj_lend_map.end() ) {
198  G4cout << proj->GetParticleName() << " is not supported by this LEND library." << G4endl;
199  return anLENDTarget; // return NULL
200  }
201 
202  G4GIDI* xlend = proj_lend_map.find ( proj ) -> second;
203 
204  if ( xlend->isThisDataAvailable( evaluation, iZ, iA , iM ) )
205  {
206 
207  if ( verboseLevel > 1 ) {
208  G4cout << evaluation << " for " << ionTable->GetIonName( iZ , iA , 0 )
209  << " with Isomer level of " << iM << " is exist in this LEND." << G4endl;
210  }
211 
212  anLENDTarget = xlend->readTarget( evaluation , iZ , iA , iM );
213 
214  lend_target new_target;
215  new_target.lend = xlend;
216  new_target.target = anLENDTarget;
217  new_target.proj = proj;
218  new_target.evaluation = evaluation;
219  new_target.target_code = iTarg;
220 
221  v_lend_target.push_back( new_target );
222 
223 // found EXACT
224  return anLENDTarget;
225 
226  }
227  else
228  {
229 // NO EXACT DATA (Evaluatino & Z,A,M)
230 
231  //Searching available evaluation and natural abundance data and give suggestions.
232  //
233  if ( verboseLevel > 1 )
234  G4cout << evaluation << " for " << ionTable->GetIonName( iZ , iA , 0 )
235  << " with Isomer level of " << iM << " is not exist in this LEND." << G4endl;
236 
237  std::vector< std::string >* available = xlend->getNamesOfAvailableLibraries( iZ, iA , iM );
238  if ( available->size() > 0 ) {
239 // EXACT Z,A,M but Evaluation is different
240  if ( verboseLevel > 1 )
241  {
242  G4cout << " However you can use following evaluation(s) for the target. " << G4endl;
243 
244  std::vector< std::string >::iterator its;
245  for ( its = available->begin() ; its != available->end() ; its++ )
246  G4cout << *its << G4endl;
247 
248  G4cout << G4endl;
249  }
250  } else if ( xlend->isThisDataAvailable( evaluation, iZ, 0 , iM ) ) {
251 //
252 // checking natural abundance data for Z
253 //
254 // EXACT natural abundance data for the evaluation
255  if ( verboseLevel > 1 )
256  G4cout << " However you can use natural abundance data for the target. " << G4endl;
257  }
258  else
259  {
260  std::vector< std::string >* available_nat = xlend->getNamesOfAvailableLibraries( iZ, 0 , iM );
261 //
262  if ( available_nat->size() > 0 ) {
263 // EXACT natural abundance data for Z but differnet evaluation
264  if ( verboseLevel > 1 ) {
265  G4cout << " However you can use following evaluation(s) for natural abundace of the target. " << G4endl;
266 
267  std::vector< std::string >::iterator its;
268  for ( its = available_nat->begin() ; its != available_nat->end() ; its++ )
269  G4cout << *its << G4endl;
270  G4cout << G4endl;
271  }
272  }
273  delete available_nat;
274  }
275  delete available;
276 // return NULL if exact data is not available
277  return anLENDTarget; // return NULL
278  }
279 
280  return anLENDTarget;
281 }
G4IonTable * ionTable
G4String evaluation
const G4String & GetIonName(G4int Z, G4int A, G4int lvl=0) const
Definition: G4IonTable.cc:1038
int G4int
Definition: G4Types.hh:78
std::map< G4ParticleDefinition *, G4GIDI *> proj_lend_map
G4int GetNucleusEncoding(G4int iZ, G4int iA, G4int iM)
std::vector< lend_target > v_lend_target
G4ParticleDefinition * proj
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
std::vector< std::string > * getNamesOfAvailableLibraries(int iZ, int iA, int iM=0)
Definition: G4GIDI.cc:237
bool isThisDataAvailable(std::string &lib_name, int iZ, int iA, int iM=0)
Definition: G4GIDI.cc:169
static const double second
Definition: G4SIunits.hh:156
G4GIDI_target * readTarget(std::string &lib_name, int iZ, int iA, int iM=0, bool bind=true)
Definition: G4GIDI.cc:289
G4int target_code
#define G4endl
Definition: G4ios.hh:61
G4GIDI_target * target
G4GIDI * lend
Definition: G4GIDI.hh:43
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetNistElementBuilder()

G4NistElementBuilder* G4LENDManager::GetNistElementBuilder ( )
inline

Definition at line 87 of file G4LENDManager.hh.

87 { return nistElementBuilder; };
G4NistElementBuilder * nistElementBuilder
Here is the caller graph for this function:

◆ GetNucleusEncoding()

G4int G4LENDManager::GetNucleusEncoding ( G4int  iZ,
G4int  iA,
G4int  iM 
)

Definition at line 309 of file G4LENDManager.cc.

310 {
311  G4int value = ionTable->GetNucleusEncoding( iZ , iA ); // Ground State
312  // G4double E=0.0, G4int J=0);
313  value += iM;
314  return value;
315 }
G4IonTable * ionTable
static G4int GetNucleusEncoding(G4int Z, G4int A, G4double E=0.0, G4int lvl=0)
Definition: G4IonTable.cc:898
int G4int
Definition: G4Types.hh:78
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetVerboseLevel()

G4int G4LENDManager::GetVerboseLevel ( )
inline

Definition at line 89 of file G4LENDManager.hh.

89 { return verboseLevel; };

◆ IsLENDTargetAvailable()

std::vector< G4String > G4LENDManager::IsLENDTargetAvailable ( G4ParticleDefinition proj,
G4int  iZ,
G4int  iA,
G4int  iM = 0 
)

Definition at line 284 of file G4LENDManager.cc.

285 {
286 
287  std::vector< G4String > vEvaluation;
288  if ( proj_lend_map.find ( proj ) == proj_lend_map.end() )
289  {
290  G4cout << proj->GetParticleName() << " is not supported by this LEND." << G4endl;
291  return vEvaluation; // return empty
292  }
293 
294  G4GIDI* xlend = proj_lend_map.find ( proj ) -> second;
295  std::vector< std::string >* available = xlend->getNamesOfAvailableLibraries( iZ, iA , iM );
296 
297  if ( available->size() > 0 ) {
298  std::vector< std::string >::iterator its;
299  for ( its = available->begin() ; its != available->end() ; its++ )
300  vEvaluation.push_back ( *its );
301  }
302  delete available;
303 
304  return vEvaluation;
305 }
std::map< G4ParticleDefinition *, G4GIDI *> proj_lend_map
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
std::vector< std::string > * getNamesOfAvailableLibraries(int iZ, int iA, int iM=0)
Definition: G4GIDI.cc:237
static const double second
Definition: G4SIunits.hh:156
#define G4endl
Definition: G4ios.hh:61
Definition: G4GIDI.hh:43
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

G4LENDManager& G4LENDManager::operator= ( const G4LENDManager )
private

◆ printBanner()

void G4LENDManager::printBanner ( )
private

Definition at line 319 of file G4LENDManager.cc.

320 {
321  G4cout << " <<BEGIN-copyright>> " << G4endl;
322  G4cout << " Copyright (c) 2010, Lawrence Livermore National Security, LLC. " << G4endl;
323  G4cout << " Produced at the Lawrence Livermore National Laboratory " << G4endl;
324  G4cout << " Written by Bret R. Beck, beck6@llnl.gov. " << G4endl;
325  G4cout << " CODE-461393 " << G4endl;
326  G4cout << " All rights reserved. " << G4endl;
327  G4cout << " " << G4endl;
328  G4cout << " This file is part of GIDI. For details, see nuclear.llnl.gov. " << G4endl;
329  G4cout << " Please also read the \"Additional BSD Notice\" at nuclear.llnl.gov. " << G4endl;
330  G4cout << " " << G4endl;
331  G4cout << " Redistribution and use in source and binary forms, with or without modification, " << G4endl;
332  G4cout << " are permitted provided that the following conditions are met: " << G4endl;
333  G4cout << " " << G4endl;
334  G4cout << " 1) Redistributions of source code must retain the above copyright notice, " << G4endl;
335  G4cout << " this list of conditions and the disclaimer below. " << G4endl;
336  G4cout << " 2) Redistributions in binary form must reproduce the above copyright notice, " << G4endl;
337  G4cout << " this list of conditions and the disclaimer (as noted below) in the " << G4endl;
338  G4cout << " documentation and/or other materials provided with the distribution. " << G4endl;
339  G4cout << " 3) Neither the name of the LLNS/LLNL nor the names of its contributors may be " << G4endl;
340  G4cout << " used to endorse or promote products derived from this software without " << G4endl;
341  G4cout << " specific prior written permission. " << G4endl;
342  G4cout << " " << G4endl;
343  G4cout << " THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY " << G4endl;
344  G4cout << " EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES " << G4endl;
345  G4cout << " OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT " << G4endl;
346  G4cout << " SHALL LAWRENCE LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR " << G4endl;
347  G4cout << " CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR " << G4endl;
348  G4cout << " CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS " << G4endl;
349  G4cout << " OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED " << G4endl;
350  G4cout << " AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT " << G4endl;
351  G4cout << " (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, " << G4endl;
352  G4cout << " EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. " << G4endl;
353  G4cout << " <<END-copyright>> " << G4endl;
354 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

◆ RequestChangeOfVerboseLevel()

G4bool G4LENDManager::RequestChangeOfVerboseLevel ( G4int  newValue)

Definition at line 357 of file G4LENDManager.cc.

358 {
359  G4bool result=false;
360  if ( newValue >= verboseLevel)
361  {
362  verboseLevel = newValue;
363  result=true;
364  }
365  else
366  {
367  G4cout << "Since other LEND model or cross section have set the higher verbose level (" << verboseLevel << ") in LENDManager, you cannot change the value now." << G4endl;
368  }
369 
370  return result;
371 }
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
#define G4endl
Definition: G4ios.hh:61
Here is the caller graph for this function:

Member Data Documentation

◆ ionTable

G4IonTable* G4LENDManager::ionTable
private

Definition at line 103 of file G4LENDManager.hh.

◆ lend_manager

G4LENDManager * G4LENDManager::lend_manager = NULL
staticprivate

Definition at line 66 of file G4LENDManager.hh.

◆ nistElementBuilder

G4NistElementBuilder* G4LENDManager::nistElementBuilder
private

Definition at line 105 of file G4LENDManager.hh.

◆ proj_lend_map

std::map< G4ParticleDefinition* , G4GIDI* > G4LENDManager::proj_lend_map
private

Definition at line 99 of file G4LENDManager.hh.

◆ v_lend_target

std::vector< lend_target > G4LENDManager::v_lend_target
private

Definition at line 96 of file G4LENDManager.hh.

◆ verboseLevel

G4int G4LENDManager::verboseLevel
private

Definition at line 94 of file G4LENDManager.hh.


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