Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4LENDManager.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// Class Description
27// Manager of LEND (Low Energy Nuclear Data) target (nucleus)
28// LEND is Geant4 interface for GIDI (General Interaction Data Interface)
29// which gives a discription of nuclear and atomic reactions, such as
30// Binary collision cross sections
31// Particle number multiplicity distributions of reaction products
32// Energy and angular distributions of reaction products
33// Derived calculational constants
34// GIDI is developped at Lawrence Livermore National Laboratory
35// Class Description - End
36
37// 071025 First implementation done by T. Koi (SLAC/SCCS)
38// 101118 Name modifications for release T. Koi (SLAC/PPA)
39
40#include "G4LENDManager.hh"
42
43#include "G4Neutron.hh"
44
45G4LENDManager* G4LENDManager::lend_manager = NULL;
46
48:verboseLevel( 0 )
49{
50
51 printBanner();
52
53 if(!getenv("G4LENDDATA"))
54 throw G4HadronicException(__FILE__, __LINE__, " Please setenv G4LENDDATA to point to the LEND files." );
55
56 G4String xmcf = getenv("G4LENDDATA");
57 xmcf = xmcf+"/xmcf.n_1.map";
58
59// for neutron
60
61 G4GIDI* axLEND = new G4GIDI( 1 , xmcf );
62
63 if ( proj_lend_map.find ( G4Neutron::Neutron() ) == proj_lend_map.end() )
64 {
65 proj_lend_map.insert ( std::pair < G4ParticleDefinition* , G4GIDI* > ( G4Neutron::Neutron() , axLEND ) );
66 }
67
68 v_lend_target.clear();
69
70 ionTable = new G4IonTable();
71 nistElementBuilder = new G4NistElementBuilder( 0 );
72
73}
74
75
76
78{
79
80// deleting target
81 for ( std::vector < lend_target >::iterator
82 it = v_lend_target.begin() ; it != v_lend_target.end() ; it++ )
83 {
84 (*it).lend->freeTarget( it->target );
85 }
86
87// deleting lend
88 for ( std::map < G4ParticleDefinition* , G4GIDI* >::iterator
89 it = proj_lend_map.begin() ; it != proj_lend_map.end() ; it++ )
90 {
91 delete it->second;
92 }
93
94 delete ionTable;
95 delete nistElementBuilder;
96
97}
98
99
100
102{
103
104 G4GIDI_target* anLENDTarget = NULL;
105
106 G4int iTarg = ionTable->GetNucleusEncoding( iZ , iA );
107 // G4double E=0.0, G4int J=0);
108
109 for ( std::vector < lend_target >::iterator
110 it = v_lend_target.begin() ; it != v_lend_target.end() ; it++ )
111 {
112// find the target
113 if ( it->proj == proj && it->target_code == iTarg && it->evaluation == evaluation )
114 {
115 return it->target;
116 }
117 }
118
119 if ( proj_lend_map.find ( proj ) == proj_lend_map.end() )
120 {
121 G4cout << proj->GetParticleName() << " is not supported by this LEND." << G4endl;
122 return anLENDTarget; // return NULL
123 }
124
125 G4GIDI* xlend = proj_lend_map.find ( proj ) -> second;
126
127 if ( xlend->isThisDataAvailable( evaluation, iZ, iA , iM ) )
128 {
129
130 if ( verboseLevel > 1 )
131 G4cout << evaluation << " for " << ionTable->GetIonName( iZ , iA , 0 ) << " is exist in this LEND." << G4endl;
132
133 anLENDTarget = xlend->readTarget( evaluation , iZ , iA , iM );
134
135 lend_target new_target;
136 new_target.lend = xlend;
137 new_target.target = anLENDTarget;
138 new_target.proj = proj;
139 new_target.evaluation = evaluation;
140 new_target.target_code = iTarg;
141
142 v_lend_target.push_back( new_target );
143
144// found EXACT
145 return anLENDTarget;
146
147 }
148 else
149 {
150// NO EXACT DATA (Evaluatino & Z,A,M)
151 // This is for ground state
152 if ( verboseLevel > 1 )
153 G4cout << evaluation << " for " << ionTable->GetIonName( iZ , iA , 0 ) << " is not exist in this LEND." << G4endl;
154
155 std::vector< std::string >* available = xlend->getNamesOfAvailableLibraries( iZ, iA , iM );
156 if ( available->size() > 0 )
157 {
158// EXACT Z,A,M but Evaluation is different
159 if ( verboseLevel > 1 )
160 {
161 G4cout << " However you can use following evaluation(s) for the target. " << G4endl;
162
163 std::vector< std::string >::iterator its;
164 for ( its = available->begin() ; its != available->end() ; its++ )
165 G4cout << *its << G4endl;
166
167 G4cout << G4endl;
168 }
169 }
170//
171// checking natural abundance data for Z
172//
173 else if ( xlend->isThisDataAvailable( evaluation, iZ, 0 , iM ) )
174 {
175// EXACT natural abundance data for the evaluation
176 if ( verboseLevel > 1 )
177 G4cout << " However you can use natural abundance data for the target. " << G4endl;
178 }
179 else
180 {
181 std::vector< std::string >* available_nat = xlend->getNamesOfAvailableLibraries( iZ, 0 , iM );
182//
183 if ( available_nat->size() > 0 )
184 {
185// EXACT natural abundance data for Z but differnet evaluation
186 if ( verboseLevel > 1 )
187 {
188 G4cout << " However you can use following evaluation(s) for natural abundace of the target. " << G4endl;
189
190 std::vector< std::string >::iterator its;
191 for ( its = available_nat->begin() ; its != available_nat->end() ; its++ )
192 G4cout << *its << G4endl;
193 G4cout << G4endl;
194 }
195 }
196 }
197
198// return NULL if exact data is not available
199 return anLENDTarget; // return NULL
200 }
201
202 return anLENDTarget;
203}
204
205
206
207std::vector< G4String > G4LENDManager::IsLENDTargetAvailable ( G4ParticleDefinition* proj , G4int iZ , G4int iA , G4int iM )
208{
209
210 std::vector< G4String > answer;
211 if ( proj_lend_map.find ( proj ) == proj_lend_map.end() )
212 {
213 G4cout << proj->GetParticleName() << " is not supported by this LEND." << G4endl;
214 return answer; // return NULL
215 }
216
217 G4GIDI* xlend = proj_lend_map.find ( proj ) -> second;
218 std::vector< std::string >* available = xlend->getNamesOfAvailableLibraries( iZ, iA , iM );
219
220 if ( available->size() > 0 )
221 {
222 std::vector< std::string >::iterator its;
223 for ( its = available->begin() ; its != available->end() ; its++ )
224 answer.push_back ( *its );
225 }
226
227 return answer;
228}
229
230
231
232void G4LENDManager::printBanner()
233{
234 G4cout << " <<BEGIN-copyright>> " << G4endl;
235 G4cout << " Copyright (c) 2010, Lawrence Livermore National Security, LLC. " << G4endl;
236 G4cout << " Produced at the Lawrence Livermore National Laboratory " << G4endl;
237 G4cout << " Written by Bret R. Beck, [email protected]. " << G4endl;
238 G4cout << " CODE-461393 " << G4endl;
239 G4cout << " All rights reserved. " << G4endl;
240 G4cout << " " << G4endl;
241 G4cout << " This file is part of GIDI. For details, see nuclear.llnl.gov. " << G4endl;
242 G4cout << " Please also read the \"Additional BSD Notice\" at nuclear.llnl.gov. " << G4endl;
243 G4cout << " " << G4endl;
244 G4cout << " Redistribution and use in source and binary forms, with or without modification, " << G4endl;
245 G4cout << " are permitted provided that the following conditions are met: " << G4endl;
246 G4cout << " " << G4endl;
247 G4cout << " 1) Redistributions of source code must retain the above copyright notice, " << G4endl;
248 G4cout << " this list of conditions and the disclaimer below. " << G4endl;
249 G4cout << " 2) Redistributions in binary form must reproduce the above copyright notice, " << G4endl;
250 G4cout << " this list of conditions and the disclaimer (as noted below) in the " << G4endl;
251 G4cout << " documentation and/or other materials provided with the distribution. " << G4endl;
252 G4cout << " 3) Neither the name of the LLNS/LLNL nor the names of its contributors may be " << G4endl;
253 G4cout << " used to endorse or promote products derived from this software without " << G4endl;
254 G4cout << " specific prior written permission. " << G4endl;
255 G4cout << " " << G4endl;
256 G4cout << " THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY " << G4endl;
257 G4cout << " EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES " << G4endl;
258 G4cout << " OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT " << G4endl;
259 G4cout << " SHALL LAWRENCE LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR " << G4endl;
260 G4cout << " CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR " << G4endl;
261 G4cout << " CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS " << G4endl;
262 G4cout << " OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED " << G4endl;
263 G4cout << " AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT " << G4endl;
264 G4cout << " (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, " << G4endl;
265 G4cout << " EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. " << G4endl;
266 G4cout << " <<END-copyright>> " << G4endl;
267}
268
269
271{
272 G4bool result=false;
273 if ( newValue >= verboseLevel)
274 {
275 verboseLevel = newValue;
276 result=true;
277 }
278 else
279 {
280 G4cout << "Since other LEND model or cross section have set the higher verbose level (" << verboseLevel << ") in LENDManager, you cannot change the value now." << G4endl;
281 }
282
283 return result;
284}
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
Definition: G4GIDI.hh:73
bool isThisDataAvailable(std::string &lib_name, int iZ, int iA, int iM=0)
Definition: G4GIDI.cc:184
G4GIDI_target * readTarget(std::string &lib_name, int iZ, int iA, int iM=0, bool bind=true)
Definition: G4GIDI.cc:293
std::vector< std::string > * getNamesOfAvailableLibraries(int iZ, int iA, int iM=0)
Definition: G4GIDI.cc:240
static G4int GetNucleusEncoding(G4int Z, G4int A, G4double E=0.0, G4int J=0)
Definition: G4IonTable.cc:446
const G4String & GetIonName(G4int Z, G4int A, G4double E) const
Definition: G4IonTable.cc:558
std::vector< G4String > IsLENDTargetAvailable(G4ParticleDefinition *, G4int iZ, G4int iA, G4int iM=0)
G4bool RequestChangeOfVerboseLevel(G4int)
G4GIDI_target * GetLENDTarget(G4ParticleDefinition *, G4String, G4int iZ, G4int iA, G4int iM=0)
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
const G4String & GetParticleName() const
G4int target_code
G4ParticleDefinition * proj
G4GIDI_target * target
G4GIDI * lend
G4String evaluation