source: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPIsoData.cc @ 1007

Last change on this file since 1007 was 962, checked in by garnier, 15 years ago

update processes

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