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 | #include "G4NeutronHPIsoData.hh" |
---|
31 | #include "G4NeutronHPDataUsed.hh" |
---|
32 | |
---|
33 | G4bool G4NeutronHPIsoData::Init(G4int A, G4int Z, G4double abun, G4String dirName, G4String aFSType) |
---|
34 | { |
---|
35 | theChannelData = 0; |
---|
36 | G4double abundance = abun/100.; |
---|
37 | G4String filename; |
---|
38 | G4bool result = true; |
---|
39 | G4NeutronHPDataUsed aFile = theNames.GetName(A, Z, dirName, aFSType, result); |
---|
40 | filename = aFile.GetName(); |
---|
41 | // if(filename=="") return false; |
---|
42 | std::ifstream theChannel(filename); |
---|
43 | |
---|
44 | if(Z==1 && (aFile.GetZ()!=Z || std::abs(aFile.GetA()-A)>0.0001) ) |
---|
45 | { |
---|
46 | if(getenv("NeutronHPNamesLogging")) G4cout << "Skipped = "<< filename <<" "<<A<<" "<<Z<<G4endl; |
---|
47 | theChannel.close(); |
---|
48 | return false; |
---|
49 | } |
---|
50 | if(!theChannel) {theChannel.close(); return false;} |
---|
51 | // accommodating deficiencie of some compilers |
---|
52 | if(theChannel.eof()) {theChannel.close(); return false;} |
---|
53 | if(!theChannel) {theChannel.close(); return false;} |
---|
54 | G4int dummy; |
---|
55 | theChannel >> dummy >> dummy; |
---|
56 | theChannelData = new G4NeutronHPVector; |
---|
57 | G4int nData; |
---|
58 | theChannel >> nData; |
---|
59 | theChannelData->Init(theChannel, nData, eV, abundance*barn); |
---|
60 | // G4cout << "Channel Data Statistics: "<<theChannelData->GetVectorLength()<<G4endl; |
---|
61 | // G4cout << "Channel data"<<G4endl; |
---|
62 | // G4int hpw; |
---|
63 | // G4cin >> hpw; |
---|
64 | // theChannelData->Dump(); |
---|
65 | theChannel.close(); |
---|
66 | return result; |
---|
67 | } |
---|
68 | |
---|
69 | void G4NeutronHPIsoData::Init(G4int A, G4int Z, G4double abun) //fill PhysicsVector for this Isotope |
---|
70 | { |
---|
71 | G4String dirName; |
---|
72 | if(!getenv("G4NEUTRONHPDATA")) |
---|
73 | throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files."); |
---|
74 | G4String baseName = getenv("G4NEUTRONHPDATA"); |
---|
75 | dirName = baseName+"/Fission"; |
---|
76 | if(Z>89) |
---|
77 | { |
---|
78 | Init(A, Z, abun, dirName, "/CrossSection/"); |
---|
79 | } |
---|
80 | else |
---|
81 | { |
---|
82 | theChannelData = new G4NeutronHPVector; |
---|
83 | } |
---|
84 | theFissionData = theChannelData; |
---|
85 | theChannelData = 0; // fast fix for double delete; revisit later. @@@@@@@ |
---|
86 | dirName = baseName+"/Capture"; |
---|
87 | Init(A, Z, abun, dirName, "/CrossSection/"); |
---|
88 | theCaptureData = theChannelData; |
---|
89 | theChannelData = 0; |
---|
90 | dirName = baseName+"/Elastic"; |
---|
91 | Init(A, Z, abun, dirName, "/CrossSection/"); |
---|
92 | theElasticData = theChannelData; |
---|
93 | theChannelData = 0; |
---|
94 | dirName = baseName+"/Inelastic"; |
---|
95 | Init(A, Z, abun, dirName, "/CrossSection/"); |
---|
96 | theInelasticData = theChannelData; |
---|
97 | theChannelData = 0; |
---|
98 | |
---|
99 | // if(theInelasticData!=0) G4cout << "Inelastic Data Statistics: "<<theInelasticData->GetVectorLength()<<G4endl; |
---|
100 | // if(theElasticData!=0) G4cout << "Elastic Data Statistics: "<<theElasticData->GetVectorLength()<<G4endl; |
---|
101 | // if(theCaptureData!=0) G4cout << "Capture Data Statistics: "<<theCaptureData->GetVectorLength()<<G4endl; |
---|
102 | // if(theFissionData!=0) G4cout << "Fission Data Statistics: "<<theFissionData->GetVectorLength()<<G4endl; |
---|
103 | // G4cout << "Inelastic data"<<G4endl; |
---|
104 | // if(theInelasticData!=0) theInelasticData->Dump(); |
---|
105 | // G4cout << "Elastic data"<<G4endl; |
---|
106 | // if(theElasticData!=0) theElasticData->Dump(); |
---|
107 | // G4cout << "Capture data"<<G4endl; |
---|
108 | // if(theCaptureData!=0) theCaptureData->Dump(); |
---|
109 | // G4cout << "Fission data"<<G4endl; |
---|
110 | // if(theFissionData!=0) theFissionData->Dump(); |
---|
111 | |
---|
112 | } |
---|
113 | |
---|
114 | G4String G4NeutronHPIsoData::GetName(G4int A, G4int Z, G4String base, G4String rest) |
---|
115 | { |
---|
116 | G4bool dbool; |
---|
117 | return (theNames.GetName(A, Z, base, rest, dbool)).GetName(); |
---|
118 | } |
---|
119 | |
---|