Geant4  10.01.p01
G4ParticleHPIsoData.cc
Go to the documentation of this file.
1 // ********************************************************************
2 // * License and Disclaimer *
3 // * *
4 // * The Geant4 software is copyright of the Copyright Holders of *
5 // * the Geant4 Collaboration. It is provided under the terms and *
6 // * conditions of the Geant4 Software License, included in the file *
7 // * LICENSE and available at http://cern.ch/geant4/license . These *
8 // * include a list of copyright holders. *
9 // * *
10 // * Neither the authors of this software system, nor their employing *
11 // * institutes,nor the agencies providing financial support for this *
12 // * work make any representation or warranty, express or implied, *
13 // * regarding this software system or assume any liability for its *
14 // * use. Please see the license in the file LICENSE and URL above *
15 // * for the full disclaimer and the limitation of liability. *
16 // * *
17 // * This code implementation is the result of the scientific and *
18 // * technical work of the GEANT4 collaboration. *
19 // * By using, copying, modifying or distributing the software (or *
20 // * any work based on the software) you agree to acknowledge its *
21 // * use in resulting scientific publications, and indicate your *
22 // * acceptance of all terms of the Geant4 Software license. *
23 // ********************************************************************
24 //
25 // particle_hp -- source file
26 // J.P. Wellisch, Nov-1996
27 // A prototype of the low energy neutron transport model.
28 //
29 //080901 Avoiding troubles which caused by G4PhysicsVecotor of length 0 by T. Koi
30 //
31 // P. Arce, June-2014 Conversion neutron_hp to particle_hp
32 //
33 #include "G4ParticleHPIsoData.hh"
34 #include "G4ParticleHPManager.hh"
35 #include "G4ParticleHPDataUsed.hh"
36 #include "G4Neutron.hh"
37 
38  //G4bool G4ParticleHPIsoData::Init(G4int A, G4int Z, G4double abun, G4String dirName, G4String aFSType)
40  {
41  theChannelData = 0;
42  G4double abundance = abun/100.;
43  G4String filename;
44  G4bool result = true;
45  //G4ParticleHPDataUsed aFile = theNames.GetName(A, Z, dirName, aFSType, result);
46  G4ParticleHPDataUsed aFile = theNames.GetName(A, Z, M, dirName, aFSType, result);
47  filename = aFile.GetName();
48 // if(filename=="") return false;
49  //std::ifstream theChannel(filename);
50  std::istringstream theChannel(filename,std::ios::in);
51  G4ParticleHPManager::GetInstance()->GetDataStream(filename,theChannel);
52 
53 #ifdef G4PHPDEBUG
54  if(getenv("G4ParticleHPDebug")) G4cout << "G4ParticleHPIsoData::Init = "<< filename <<" "<< A << " " << Z <<G4endl;
55 #endif
56 
57  if(Z==1 && (aFile.GetZ()!=Z || std::abs(aFile.GetA()-A)>0.0001) )
58  {
59  if(getenv("G4ParticleHPDebug")) G4cout << "Skipped = "<< filename <<" "<<A<<" "<<Z<<G4endl;
60  //080901 TKDB No more necessary below protection, cross sections set to 0 in G4ParticleHPNames
61  //And below two lines causes trouble with G4PhysicsVector
62  //theChannel.close();
63  //return false;
64  }
65  if(!theChannel) {/*theChannel.close()*/; return false;}
66  // accommodating deficiencie of some compilers
67  if(theChannel.eof()) {/*theChannel.close()*/; return false;}
68  if(!theChannel) {/*theChannel.close()*/; return false;}
69  G4int dummy;
70  theChannel >> dummy >> dummy;
72  G4int nData;
73  theChannel >> nData;
74  theChannelData->Init(theChannel, nData, CLHEP::eV, abundance*CLHEP::barn);
75 // G4cout << "Channel Data Statistics: "<<theChannelData->GetVectorLength()<<G4endl;
76 // G4cout << "Channel data"<<G4endl;
77 // G4int hpw;
78 // G4cin >> hpw;
79 // theChannelData->Dump();
80 // theChannel.close();
81  return result;
82  }
83 
84  //void G4ParticleHPIsoData::Init(G4int A, G4int Z, G4double abun) //fill PhysicsVector for this Isotope
85 void G4ParticleHPIsoData::Init(G4int A, G4int Z, G4int M,G4double abun, G4ParticleDefinition* projectile, const char* dataDirVariable ) //fill PhysicsVector for this Isotope
86  {
87  G4String dirName;
88 
89  G4String baseName = getenv(dataDirVariable);
90  if( projectile == G4Neutron::Neutron() ){
91  dirName = baseName+"/Fission";
92  //if(Z>89)
93  if(Z>87) //TK Modifed for ENDF VII.0
94  {
95  //Init(A, Z, abun, dirName, "/CrossSection/");
96  Init(A, Z, M, abun, dirName, "/CrossSection");
97  }
98  else
99  {
101  }
103  theChannelData = 0; // fast fix for double delete; revisit later. @@@@@@@
104 
105  dirName = baseName+"/Capture";
106  //Init(A, Z, abun, dirName, "/CrossSection/");
107  Init(A, Z, M, abun, dirName, "/CrossSection");
109  theChannelData = 0;
110 
111  dirName = baseName+"/Elastic";
112  //Init(A, Z, abun, dirName, "/CrossSection/");
113  Init(A, Z, M, abun, dirName, "/CrossSection");
115  theChannelData = 0;
116  }
117 
118  dirName = baseName+"/Inelastic";
119  //Init(A, Z, abun, dirName, "/CrossSection/");
120  Init(A, Z, M, abun, dirName, "/CrossSection");
122  theChannelData = 0;
123 
124 // if(theInelasticData!=0) G4cout << "Inelastic Data Statistics: "<<theInelasticData->GetVectorLength()<<G4endl;
125 // if(theElasticData!=0) G4cout << "Elastic Data Statistics: "<<theElasticData->GetVectorLength()<<G4endl;
126 // if(theCaptureData!=0) G4cout << "Capture Data Statistics: "<<theCaptureData->GetVectorLength()<<G4endl;
127 // if(theFissionData!=0) G4cout << "Fission Data Statistics: "<<theFissionData->GetVectorLength()<<G4endl;
128 // G4cout << "Inelastic data"<<G4endl;
129 // if(theInelasticData!=0) theInelasticData->Dump();
130 // G4cout << "Elastic data"<<G4endl;
131 // if(theElasticData!=0) theElasticData->Dump();
132 // G4cout << "Capture data"<<G4endl;
133 // if(theCaptureData!=0) theCaptureData->Dump();
134 // G4cout << "Fission data"<<G4endl;
135 // if(theFissionData!=0) theFissionData->Dump();
136 
137  }
138 
140  {
141  G4bool dbool;
142  return (theNames.GetName(A, Z, base, rest, dbool)).GetName();
143  }
144 
static G4ParticleHPManager * GetInstance()
G4ParticleHPVector * theInelasticData
void GetDataStream(G4String, std::istringstream &iss)
G4ParticleHPVector * theChannelData
int G4int
Definition: G4Types.hh:78
G4ParticleHPNames theNames
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
static const G4double A[nN]
static const double eV
Definition: G4SIunits.hh:194
G4String GetName(G4int A, G4int Z, G4String base, G4String rest)
G4ParticleHPVector * theElasticData
#define G4endl
Definition: G4ios.hh:61
G4ParticleHPDataUsed GetName(G4int A, G4int Z, G4String base, G4String rest, G4bool &active)
G4bool Init(G4int A, G4int Z, G4double abun, G4String dirName, G4String aFSType)
static const double barn
Definition: G4SIunits.hh:95
double G4double
Definition: G4Types.hh:76
G4ParticleHPVector * theCaptureData
G4ParticleHPVector * theFissionData