Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4ComponentSAIDTotalXS.cc
이 파일의 문서화 페이지로 가기
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 // $Id: G4ComponentSAIDTotalXS.cc 83409 2014-08-21 15:16:07Z gcosmo $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class file
31 //
32 //
33 // File name: G4ComponentSAIDTotalXS
34 //
35 // Authors: G.Folger, V.Ivanchenko, D.Wright
36 //
37 // Modifications:
38 //
39 
41 #include "G4PhysicsVector.hh"
42 #include "G4LPhysicsFreeVector.hh"
43 
45  "","pp","np","pip","pim",
46  "pin","pie",
47  "gp_pi0p","gp_pi+n","gn_pi-p","gn_pi0n","gp_etap","gp_etapp"
48 };
49 
51  : G4VComponentCrossSection("xsSAID")
52 {
53  for(G4int i=0; i<numberOfSaidXS; ++i) {
54  elastdata[i] = 0;
55  inelastdata[i] = 0;
56  }
57 }
58 
60 {
61  for(G4int i=0; i<numberOfSaidXS; ++i) {
62  if(elastdata[i]) {
63  delete elastdata[i];
64  elastdata[i] = 0;
65  }
66  if(inelastdata[i]) {
67  delete inelastdata[i];
68  inelastdata[i] = 0;
69  }
70  }
71 }
72 
73 G4double
77 {
78  PrintWarning(part,0,Z,G4lrint(N),
79  "G4ComponentSAIDTotalXS::GetTotalElementCrossSection",
80  "Method is not implemented");
81  return 0.0;
82 }
83 
84 G4double
87  G4double kinEnergy, G4int Z, G4int N)
88 {
89  return GetInelasticIsotopeCrossSection(part,kinEnergy,Z,N)
90  + GetElasticIsotopeCrossSection(part,kinEnergy,Z,N);
91 }
92 
93 G4double
97 {
98  PrintWarning(part,0,Z,G4lrint(N),
99  "G4ComponentSAIDTotalXS::GetTotalElementCrossSection",
100  "Method is not implemented");
101  return 0.0;
102 }
103 
104 G4double
106  const G4ParticleDefinition* part,
107  G4double kinEnergy, G4int Z, G4int N)
108 {
109  G4double cross = 0.0;
110  G4SAIDCrossSectionType tp = GetType(part,0,Z,N);
111  if(saidUnknown != tp) {
112  G4int idx = G4int(tp);
113  if(!inelastdata[idx]) { Initialise(tp); }
114  if(inelastdata[idx]) {
115  cross = (inelastdata[idx])->Value(kinEnergy);
116  }
117  }
118  return cross;
119 }
120 
121 G4double
123  const G4ParticleDefinition* part,
125 {
126  PrintWarning(part,0,Z,G4lrint(N),
127  "G4ComponentSAIDTotalXS::GetTotalElementCrossSection",
128  "Method is not implemented");
129  return 0.0;
130 }
131 
132 G4double
134  const G4ParticleDefinition* part,
135  G4double kinEnergy, G4int Z, G4int N)
136 {
137  G4double cross = 0.0;
138  G4SAIDCrossSectionType tp = GetType(part,0,Z,N);
139  if(saidUnknown != tp) {
140  G4int idx = G4int(tp);
141  if(!elastdata[idx]) { Initialise(tp); }
142  if(elastdata[idx]) {
143  cross = (elastdata[idx])->Value(kinEnergy);
144  }
145  }
146  return cross;
147 }
148 
149 G4double
151  const G4ParticleDefinition* prim,
152  const G4ParticleDefinition* sec,
153  G4double kinEnergy, G4int Z, G4int N)
154 {
155  G4double cross = 0.0;
156  G4SAIDCrossSectionType tp = GetType(prim,sec,Z,N);
157  if(saidUnknown != tp) {
158  G4int idx = G4int(tp);
159  if(!inelastdata[idx]) { Initialise(tp); }
160  if(inelastdata[idx]) {
161  cross = (inelastdata[idx])->Value(kinEnergy);
162  }
163  }
164  return cross;
165 }
166 
167 void
169 {
170 }
171 
174  const G4ParticleDefinition* sec,
175  G4int Z, G4int N)
176 {
178  if(1 == N && prim) {
179  G4int code = prim->GetPDGEncoding();
180 
181  // only gamma + N x-sections available
182  if(0 == Z && sec && 22 == code) {
183  G4int code1 = sec->GetPDGEncoding();
184  if(-211 == code1) { type = saidGN_PINP; }
185  else if(111 == code1) { type = saidGN_PI0N; }
186 
187  // x-sections off proton
188  } else if(1 == Z) {
189  if(sec) {
190  G4int code1 = sec->GetPDGEncoding();
191  if(-211 == code) {
192  if(111 == code1) { type = saidPINP_PI0N; }
193  else if(221 == code1) { type = saidPINP_ETAN; }
194 
195  } else if(22 == code) {
196  if(111 == code1) { type = saidGP_PI0P; }
197  else if(211 == code1) { type = saidGP_PIPN; }
198  else if(221 == code1) { type = saidGP_ETAP; }
199  else if(331 == code1) { type = saidGP_ETAPP; }
200  }
201  } else {
202  if(2212 == code) { type = saidPP; }
203  else if(2112 == code) { type = saidNP; }
204  else if(211 == code) { type = saidPIPP; }
205  else if(-211 == code) { type = saidPINP; }
206  }
207  }
208  }
209  //G4cout << "G4ComponentSAIDTotalXS::Type= " << type << G4endl;
210  return type;
211 }
212 
214 {
215  G4int idx = G4int(tp);
216  // check environment variable
217  // Build the complete string identifying the file with the data set
218  char* path = getenv("G4SAIDXSDATA");
219  if (!path){
220  G4Exception("G4ComponentSAIDTotalXS::Initialise(..)","had013",
222  "Environment variable G4SAIDXSDATA is not defined");
223  return;
224  }
225  if(idx <= 4) {
226  elastdata[idx] = new G4LPhysicsFreeVector();
227  inelastdata[idx] = new G4LPhysicsFreeVector();
228  ReadData(idx,elastdata[idx],path,"_el.dat");
229  ReadData(idx,inelastdata[idx],path,"_in.dat");
230  } else {
231  inelastdata[idx] = new G4LPhysicsFreeVector();
232  ReadData(idx,inelastdata[idx],path,".dat");
233  }
234 }
235 
237  G4PhysicsVector* v,
238  const G4String& ss1,
239  const G4String& ss2)
240 {
241  std::ostringstream ost;
242  ost << ss1 << "/" << fnames[index] << ss2;
243  std::ifstream filein(ost.str().c_str());
244  if (!(filein)) {
246  ed << "Data file <" << ost.str().c_str()
247  << "> is not opened!";
248  G4Exception("G4ComponentSAIDTotalXS::ReadData(..)","had014",
249  FatalException, ed, "Check G4SAIDXSDATA");
250  } else {
251  if(GetVerboseLevel() > 1) {
252  G4cout << "File " << ost.str()
253  << " is opened by G4ComponentSAIDTotalXS" << G4endl;
254  }
255  // retrieve data from DB
256  v->Retrieve(filein, true);
258  v->SetSpline(true);
259  }
260 }
261 
262 void
264  const G4ParticleDefinition* sec,
265  G4int Z, G4int N,
266  const G4String& ss1,
267  const G4String& ss2)
268 {
269  G4cout << ss1 << ": " << ss2 << G4endl;
270  G4cout << "For Z= " << Z << " N= " << N << " of ";
271  if(prim) { G4cout << prim->GetParticleName() << " "; }
272  if(sec) { G4cout << " x-section to " << sec->GetParticleName(); }
273  G4cout << G4endl;
274 }
G4PhysicsVector * inelastdata[numberOfSaidXS]
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:45
virtual void ScaleVector(G4double factorE, G4double factorV)
#define G4endl
Definition: G4ios.hh:61
const G4String & GetParticleName() const
virtual void Description() const
void PrintWarning(const G4ParticleDefinition *prim, const G4ParticleDefinition *sec, G4int, G4int, const G4String &, const G4String &)
virtual G4double GetTotalElementCrossSection(const G4ParticleDefinition *, G4double kinEnergy, G4int, G4double)
static const G4String fnames[numberOfSaidXS]
G4PhysicsVector * elastdata[numberOfSaidXS]
Float_t Z
double G4double
Definition: G4Types.hh:76
TString part[npart]
Definition: Style.C:32
G4SAIDCrossSectionType
**D E S C R I P T I O N
static constexpr double MeV
void SetSpline(G4bool)
virtual G4double GetElasticIsotopeCrossSection(const G4ParticleDefinition *, G4double kinEnergy, G4int, G4int)
void ReadData(G4int index, G4PhysicsVector *, const G4String &, const G4String &)
virtual G4double GetInelasticIsotopeCrossSection(const G4ParticleDefinition *, G4double kinEnergy, G4int, G4int)
virtual G4bool Retrieve(std::ifstream &fIn, G4bool ascii=false)
Definition: inftrees.h:24
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.hh:65
virtual G4double GetTotalIsotopeCrossSection(const G4ParticleDefinition *, G4double kinEnergy, G4int, G4int)
int G4lrint(double ad)
Definition: templates.hh:151
int G4int
Definition: G4Types.hh:78
G4double GetChargeExchangeCrossSection(const G4ParticleDefinition *prim, const G4ParticleDefinition *sec, G4double kinEnergy, G4int, G4int)
G4GLOB_DLL std::ostream G4cout
G4SAIDCrossSectionType GetType(const G4ParticleDefinition *prim, const G4ParticleDefinition *sec, G4int Z, G4int N)
void Initialise(G4SAIDCrossSectionType tp)
virtual G4double GetInelasticElementCrossSection(const G4ParticleDefinition *, G4double kinEnergy, G4int, G4double)
static constexpr double millibarn
Definition: SystemOfUnits.h:86
virtual G4double GetElasticElementCrossSection(const G4ParticleDefinition *, G4double kinEnergy, G4int, G4double)