Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions
G4LENDManager Class Reference

#include <G4LENDManager.hh>

Public Member Functions

G4GIDI_target * GetLENDTarget (G4ParticleDefinition *, G4String, G4int iZ, G4int iA, G4int iM=0)
 
std::vector< G4String > IsLENDTargetAvailable (G4ParticleDefinition *, G4int iZ, G4int iA, G4int iM=0)
 
G4int GetNucleusEncoding (G4int iZ, G4int iA, G4int iM)
 
G4NistElementBuilder * GetNistElementBuilder ()
 
G4int GetVerboseLevel ()
 
G4bool RequestChangeOfVerboseLevel (G4int)
 

Static Public Member Functions

static G4LENDManager * GetInstance ()
 

Detailed Description

Definition at line 63 of file G4LENDManager.hh.

Member Function Documentation

static G4LENDManager* G4LENDManager::GetInstance ( void  )
inlinestatic

Definition at line 77 of file G4LENDManager.hh.

Referenced by G4LENDCrossSection::G4LENDCrossSection(), and G4LENDModel::G4LENDModel().

78  {
79  if ( lend_manager == NULL) lend_manager = new G4LENDManager();
80  return lend_manager;
81  };
G4GIDI_target * G4LENDManager::GetLENDTarget ( G4ParticleDefinition *  proj,
G4String  evaluation,
G4int  iZ,
G4int  iA,
G4int  iM = 0 
)

Definition at line 105 of file G4LENDManager.cc.

References lend_target::evaluation, G4cout, G4endl, G4IonTable::GetIonName(), G4GIDI::getNamesOfAvailableLibraries(), GetNucleusEncoding(), G4ParticleDefinition::GetParticleName(), G4GIDI::isThisDataAvailable(), lend_target::lend, lend_target::proj, G4GIDI::readTarget(), python.hepunit::second, lend_target::target, and lend_target::target_code.

106 {
107 
108  G4GIDI_target* anLENDTarget = NULL;
109 
110  if ( iM > 9 ) {
111  throw G4HadronicException(__FILE__, __LINE__, "Requested isomer level of target is too high." );
112  }
113 
114  G4int iTarg = GetNucleusEncoding( iZ , iA , iM );
115 
116  // Searching in current map
117  for ( std::vector < lend_target >::iterator
118  it = v_lend_target.begin() ; it != v_lend_target.end() ; it++ )
119  {
120  if ( it->proj == proj && it->target_code == iTarg && it->evaluation == evaluation )
121  {
122  //find!
123  return it->target;
124  }
125  }
126 
127 
128  if ( proj_lend_map.find ( proj ) == proj_lend_map.end() ) {
129  G4cout << proj->GetParticleName() << " is not supported by this LEND library." << G4endl;
130  return anLENDTarget; // return NULL
131  }
132 
133  G4GIDI* xlend = proj_lend_map.find ( proj ) -> second;
134 
135  if ( xlend->isThisDataAvailable( evaluation, iZ, iA , iM ) )
136  {
137 
138  if ( verboseLevel > 1 ) {
139  G4cout << evaluation << " for " << ionTable->GetIonName( iZ , iA , 0 )
140  << " with Isomer level of " << iM << " is exist in this LEND." << G4endl;
141  }
142 
143  anLENDTarget = xlend->readTarget( evaluation , iZ , iA , iM );
144 
145  lend_target new_target;
146  new_target.lend = xlend;
147  new_target.target = anLENDTarget;
148  new_target.proj = proj;
149  new_target.evaluation = evaluation;
150  new_target.target_code = iTarg;
151 
152  v_lend_target.push_back( new_target );
153 
154 // found EXACT
155  return anLENDTarget;
156 
157  }
158  else
159  {
160 // NO EXACT DATA (Evaluatino & Z,A,M)
161 
162  //Searching available evaluation and natural abundance data and give suggestions.
163  //
164  if ( verboseLevel > 1 )
165  G4cout << evaluation << " for " << ionTable->GetIonName( iZ , iA , 0 )
166  << " with Isomer level of " << iM << " is not exist in this LEND." << G4endl;
167 
168  std::vector< std::string >* available = xlend->getNamesOfAvailableLibraries( iZ, iA , iM );
169  if ( available->size() > 0 ) {
170 // EXACT Z,A,M but Evaluation is different
171  if ( verboseLevel > 1 )
172  {
173  G4cout << " However you can use following evaluation(s) for the target. " << G4endl;
174 
175  std::vector< std::string >::iterator its;
176  for ( its = available->begin() ; its != available->end() ; its++ )
177  G4cout << *its << G4endl;
178 
179  G4cout << G4endl;
180  }
181  } else if ( xlend->isThisDataAvailable( evaluation, iZ, 0 , iM ) ) {
182 //
183 // checking natural abundance data for Z
184 //
185 // EXACT natural abundance data for the evaluation
186  if ( verboseLevel > 1 )
187  G4cout << " However you can use natural abundance data for the target. " << G4endl;
188  }
189  else
190  {
191  std::vector< std::string >* available_nat = xlend->getNamesOfAvailableLibraries( iZ, 0 , iM );
192 //
193  if ( available_nat->size() > 0 ) {
194 // EXACT natural abundance data for Z but differnet evaluation
195  if ( verboseLevel > 1 ) {
196  G4cout << " However you can use following evaluation(s) for natural abundace of the target. " << G4endl;
197 
198  std::vector< std::string >::iterator its;
199  for ( its = available_nat->begin() ; its != available_nat->end() ; its++ )
200  G4cout << *its << G4endl;
201  G4cout << G4endl;
202  }
203  }
204  delete available_nat;
205  }
206  delete available;
207 // return NULL if exact data is not available
208  return anLENDTarget; // return NULL
209  }
210 
211  return anLENDTarget;
212 }
G4String evaluation
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
const G4String & GetIonName(G4int Z, G4int A, G4int lvl=0) const
Definition: G4IonTable.cc:992
G4int GetNucleusEncoding(G4int iZ, G4int iA, G4int iM)
G4ParticleDefinition * proj
G4GLOB_DLL std::ostream G4cout
std::vector< std::string > * getNamesOfAvailableLibraries(int iZ, int iA, int iM=0)
Definition: G4GIDI.cc:240
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
G4int target_code
#define G4endl
Definition: G4ios.hh:61
G4GIDI_target * target
G4GIDI * lend
Definition: G4GIDI.hh:73
G4NistElementBuilder* G4LENDManager::GetNistElementBuilder ( )
inline

Definition at line 87 of file G4LENDManager.hh.

Referenced by G4LENDModel::create_used_target_map(), and G4LENDCrossSection::create_used_target_map().

87 { return nistElementBuilder; };
G4int G4LENDManager::GetNucleusEncoding ( G4int  iZ,
G4int  iA,
G4int  iM 
)

Definition at line 240 of file G4LENDManager.cc.

References G4IonTable::GetNucleusEncoding().

Referenced by G4LENDModel::ApplyYourself(), G4LENDCapture::ApplyYourself(), G4LENDElastic::ApplyYourself(), G4LENDInelastic::ApplyYourself(), G4LENDFission::ApplyYourself(), G4LENDModel::create_used_target_map(), G4LENDCrossSection::create_used_target_map(), G4LENDCrossSection::GetIsoCrossSection(), and GetLENDTarget().

241 {
242  G4int value = ionTable->GetNucleusEncoding( iZ , iA ); // Ground State
243  // G4double E=0.0, G4int J=0);
244  value += iM;
245  return value;
246 }
static G4int GetNucleusEncoding(G4int Z, G4int A, G4double E=0.0, G4int lvl=0)
Definition: G4IonTable.cc:854
int G4int
Definition: G4Types.hh:78
const XML_Char int const XML_Char * value
G4int G4LENDManager::GetVerboseLevel ( )
inline

Definition at line 89 of file G4LENDManager.hh.

89 { return verboseLevel; };
std::vector< G4String > G4LENDManager::IsLENDTargetAvailable ( G4ParticleDefinition *  proj,
G4int  iZ,
G4int  iA,
G4int  iM = 0 
)

Definition at line 215 of file G4LENDManager.cc.

References G4cout, G4endl, G4GIDI::getNamesOfAvailableLibraries(), G4ParticleDefinition::GetParticleName(), and python.hepunit::second.

216 {
217 
218  std::vector< G4String > vEvaluation;
219  if ( proj_lend_map.find ( proj ) == proj_lend_map.end() )
220  {
221  G4cout << proj->GetParticleName() << " is not supported by this LEND." << G4endl;
222  return vEvaluation; // return empty
223  }
224 
225  G4GIDI* xlend = proj_lend_map.find ( proj ) -> second;
226  std::vector< std::string >* available = xlend->getNamesOfAvailableLibraries( iZ, iA , iM );
227 
228  if ( available->size() > 0 ) {
229  std::vector< std::string >::iterator its;
230  for ( its = available->begin() ; its != available->end() ; its++ )
231  vEvaluation.push_back ( *its );
232  }
233  delete available;
234 
235  return vEvaluation;
236 }
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
std::vector< std::string > * getNamesOfAvailableLibraries(int iZ, int iA, int iM=0)
Definition: G4GIDI.cc:240
#define G4endl
Definition: G4ios.hh:61
Definition: G4GIDI.hh:73
G4bool G4LENDManager::RequestChangeOfVerboseLevel ( G4int  newValue)

Definition at line 288 of file G4LENDManager.cc.

References G4cout, and G4endl.

Referenced by G4LENDModel::create_used_target_map(), and G4LENDCrossSection::create_used_target_map().

289 {
290  G4bool result=false;
291  if ( newValue >= verboseLevel)
292  {
293  verboseLevel = newValue;
294  result=true;
295  }
296  else
297  {
298  G4cout << "Since other LEND model or cross section have set the higher verbose level (" << verboseLevel << ") in LENDManager, you cannot change the value now." << G4endl;
299  }
300 
301  return result;
302 }
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
#define G4endl
Definition: G4ios.hh:61

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