Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4NeutronHPIsoData.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 // neutron_hp -- source file
27 // J.P. Wellisch, Nov-1996
28 // A prototype of the low energy neutron transport model.
29 //
30 //080901 Avoiding troubles which caused by G4PhysicsVecotor of length 0 by T. Koi
31 //
32 #include "G4NeutronHPIsoData.hh"
33 #include "G4NeutronHPManager.hh"
34 #include "G4SystemOfUnits.hh"
35 #include "G4NeutronHPDataUsed.hh"
36 
37  //G4bool G4NeutronHPIsoData::Init(G4int A, G4int Z, G4double abun, G4String dirName, G4String aFSType)
39  {
40  theChannelData = 0;
41  G4double abundance = abun/100.;
42  G4String filename;
43  G4bool result = true;
44  //G4NeutronHPDataUsed aFile = theNames.GetName(A, Z, dirName, aFSType, result);
45  G4NeutronHPDataUsed aFile = theNames.GetName(A, Z, M, dirName, aFSType, result);
46  filename = aFile.GetName();
47 // if(filename=="") return false;
48  //std::ifstream theChannel(filename);
49  std::istringstream theChannel(filename,std::ios::in);
50  G4NeutronHPManager::GetInstance()->GetDataStream(filename,theChannel);
51 
52  if(Z==1 && (aFile.GetZ()!=Z || std::abs(aFile.GetA()-A)>0.0001) )
53  {
54  if(getenv("NeutronHPNamesLogging")) G4cout << "Skipped = "<< filename <<" "<<A<<" "<<Z<<G4endl;
55  //080901 TKDB No more necessary below protection, cross sections set to 0 in G4NeutronHPNames
56  //And below two lines causes trouble with G4PhysicsVector
57  //theChannel.close();
58  //return false;
59  }
60  if(!theChannel) {/*theChannel.close()*/; return false;}
61  // accommodating deficiencie of some compilers
62  if(theChannel.eof()) {/*theChannel.close()*/; return false;}
63  if(!theChannel) {/*theChannel.close()*/; return false;}
64  G4int dummy;
65  theChannel >> dummy >> dummy;
66  theChannelData = new G4NeutronHPVector;
67  G4int nData;
68  theChannel >> nData;
69  theChannelData->Init(theChannel, nData, eV, abundance*barn);
70 // G4cout << "Channel Data Statistics: "<<theChannelData->GetVectorLength()<<G4endl;
71 // G4cout << "Channel data"<<G4endl;
72 // G4int hpw;
73 // G4cin >> hpw;
74 // theChannelData->Dump();
75  //theChannel.close();
76  return result;
77  }
78 
79  //void G4NeutronHPIsoData::Init(G4int A, G4int Z, G4double abun) //fill PhysicsVector for this Isotope
80  void G4NeutronHPIsoData::Init(G4int A, G4int Z, G4int M, G4double abun) //fill PhysicsVector for this Isotope
81  {
82  G4String dirName;
83  if(!getenv("G4NEUTRONHPDATA"))
84  throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
85  G4String baseName = getenv("G4NEUTRONHPDATA");
86  dirName = baseName+"/Fission";
87  //if(Z>89)
88  if(Z>87) //TK Modifed for ENDF VII.0
89  {
90  //Init(A, Z, abun, dirName, "/CrossSection/");
91  Init(A, Z, M, abun, dirName, "/CrossSection");
92  }
93  else
94  {
95  theChannelData = new G4NeutronHPVector;
96  }
97  theFissionData = theChannelData;
98  theChannelData = 0; // fast fix for double delete; revisit later. @@@@@@@
99  dirName = baseName+"/Capture";
100  //Init(A, Z, abun, dirName, "/CrossSection/");
101  Init(A, Z, M, abun, dirName, "/CrossSection");
102  theCaptureData = theChannelData;
103  theChannelData = 0;
104  dirName = baseName+"/Elastic";
105  //Init(A, Z, abun, dirName, "/CrossSection/");
106  Init(A, Z, M, abun, dirName, "/CrossSection");
107  theElasticData = theChannelData;
108  theChannelData = 0;
109  dirName = baseName+"/Inelastic";
110  //Init(A, Z, abun, dirName, "/CrossSection/");
111  Init(A, Z, M, abun, dirName, "/CrossSection");
112  theInelasticData = theChannelData;
113  theChannelData = 0;
114 
115 // if(theInelasticData!=0) G4cout << "Inelastic Data Statistics: "<<theInelasticData->GetVectorLength()<<G4endl;
116 // if(theElasticData!=0) G4cout << "Elastic Data Statistics: "<<theElasticData->GetVectorLength()<<G4endl;
117 // if(theCaptureData!=0) G4cout << "Capture Data Statistics: "<<theCaptureData->GetVectorLength()<<G4endl;
118 // if(theFissionData!=0) G4cout << "Fission Data Statistics: "<<theFissionData->GetVectorLength()<<G4endl;
119 // G4cout << "Inelastic data"<<G4endl;
120 // if(theInelasticData!=0) theInelasticData->Dump();
121 // G4cout << "Elastic data"<<G4endl;
122 // if(theElasticData!=0) theElasticData->Dump();
123 // G4cout << "Capture data"<<G4endl;
124 // if(theCaptureData!=0) theCaptureData->Dump();
125 // G4cout << "Fission data"<<G4endl;
126 // if(theFissionData!=0) theFissionData->Dump();
127 
128  }
129 
131  {
132  G4bool dbool;
133  return (theNames.GetName(A, Z, base, rest, dbool)).GetName();
134  }
135 
G4String GetName(G4int A, G4int Z, G4String base, G4String rest)
static G4NeutronHPManager * GetInstance()
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
void GetDataStream(G4String, std::istringstream &iss)
G4bool Init(G4int A, G4int Z, G4double abun, G4String dirName, G4String aFSType)
G4NeutronHPDataUsed GetName(G4int A, G4int Z, G4String base, G4String rest, G4bool &active)
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
const XML_Char int const XML_Char int const XML_Char * base
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76