Geant4  10.00.p01
G4VGlauberDataSet.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 // * *
21 // * Parts of this code which have been developed by QinetiQ Ltd *
22 // * under contract to the European Space Agency (ESA) are the *
23 // * intellectual property of ESA. Rights to use, copy, modify and *
24 // * redistribute this software for general public use are granted *
25 // * in compliance with any licensing, distribution and development *
26 // * policy adopted by the Geant4 Collaboration. This code has been *
27 // * written by QinetiQ Ltd for the European Space Agency, under ESA *
28 // * contract 19770/06/NL/JD (Technology Research Programme). *
29 // * *
30 // * By using, copying, modifying or distributing the software (or *
31 // * any work based on the software) you agree to acknowledge its *
32 // * use in resulting scientific publications, and indicate your *
33 // * acceptance of all terms of the Geant4 Software license. *
34 // ********************************************************************
35 //
38 //
39 // $Id: G4VGlauberDataSet.cc 77519 2013-11-25 10:54:57Z gcosmo $
40 //
41 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42 //
43 // MODULE: G4VGlauberDataSet.cc
44 //
45 // Version: 0.B
46 // Date: 02/04/08
47 // Author: P R Truscott
48 // Organisation: QinetiQ Ltd, UK
49 // Customer: ESA/ESTEC, NOORDWIJK
50 // Contract: 19770/06/NL/JD
51 //
52 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54 //
55 #ifdef G4_USE_DPMJET
56 
57 
58 #include "G4VGlauberDataSet.hh"
59 
60 #include "G4DPMJET2_5Interface.hh"
61 #include "G4PhysicalConstants.hh"
62 #include "G4SystemOfUnits.hh"
63 
64 #include <iomanip>
65 #include <iostream>
66 
68 //
69 // G4G4VGlauberDataSet
70 //
71 // Constructor simply resets all variables to zero.
72 //
74 {
75  rproj = 0.0;
76  rtarg = 0.0;
77  bstep = 0.0;
78  bmax = 0.0;
79  AP = 0;
80  ZP = 0;
81  AT = 0;
82  ZT = 0;
83 
84  maxArray = 200;
85  maxig = 24;
86 
87  glauberDataSetType = -1;
88 
89  verboseLevel = 0;
90 }
92 //
93 // ~G4G4VGlauberDataSet
94 //
95 // If you thought the contructor was boring, the destructor is even worse!.
96 // It doesn't do anything.
97 //
99 {}
101 //
103 {
104  return AP;
105 }
107 //
109 {
110  return ZP;
111 }
113 //
115 {
116  return AT;
117 }
119 //
121 {
122  return ZT;
123 }
125 //
127 {
128  if (i<0 || i>=maxArray) {
129  G4cerr <<"WARNING G4G4VGlauberDataSet::SetArrayPointer" <<G4endl;
130  G4cerr <<"ATTEMPT TO SET POINTER TO VALUE OUTSIDE [0,"
131  <<maxArray-1
132  <<"]"
133  <<G4endl;
134  }
135  else {
136  arrayPtrn = baseArrayPtrn + i;
137  arrayPtrm = baseArrayPtrm + i;
138  }
139 }
141 //
143 {
144  if (ppn < 1.0E-10) return baseArrayPtrn;
145  else return arrayPtrn;
146 }
148 //
150 {
151  if (ppn < 1.0E-10) return baseArrayPtrm;
152  else return arrayPtrm;
153 }
155 //
157 {
158  return glauberDataSetType;
159 }
161 //
162 std::ofstream & G4VGlauberDataSet::WriteDataToFile (std::ofstream &File) const
163 {
164 //
165 //
166 // Dummy member function;
167 //
168  return File;
169 }
170 std::ifstream & G4VGlauberDataSet::ReadDataFromFile (std::ifstream &File)
171 {
172 //
173 //
174 // Dummy member function;
175 //
176  return File;
177 }
179 //
180 // operator <<
181 //
182 // Output file-stream operator. This is intended to match the standard
183 // GLAUBER data file format.
184 //
185 std::ofstream & operator << (std::ofstream &File, const G4VGlauberDataSet &q)
186 {
187  File.unsetf(std::ios::scientific);
188  File.setf(std::ios::fixed|std::ios::right|std::ios::adjustfield);
189  File.precision(0);
190  File <<std::setw(1) <<q.glauberDataSetType
191  <<"NUCLEUS "
192  <<std::setw(10) <<q.AT
193  <<std::setw(10) <<q.ZT
194  <<std::setw(10) <<q.AP
195  <<std::setw(10) <<q.ZP
196  <<G4endl;
197 
198  File.unsetf(std::ios::fixed);
199  File.setf(std::ios::fixed|std::ios::right|std::ios::adjustfield);
200  File.precision(5);
201 
202  File <<std::setw(10) <<q.bmax
203  <<std::setw(10) <<q.bstep
204  <<std::setw(10) <<q.rproj
205  <<std::setw(10) <<q.rtarg
206  <<G4endl;
207 
208  File.precision(8);
209 
210  return q.WriteDataToFile (File);
211 }
213 //
214 // operator >>
215 //
216 // Input file-stream operator. This is assumed to the format matches the
217 // standard GLAUBER data file format.
218 //
219 std::ifstream & operator >> (std::ifstream &File, G4VGlauberDataSet &q)
220 {
221  G4String dummy;
222  File >>dummy
223  >>q.AT
224  >>q.ZT
225  >>q.AP
226  >>q.ZP;
227 
228  File >>q.bmax
229  >>q.bstep
230  >>q.rproj
231  >>q.rtarg;
232 
233  return q.ReadDataFromFile (File);
234 }
235 #endif
G4int GetZT() const
G4int GetAT() const
virtual ~G4VGlauberDataSet()
Definition of the G4VGlauberDataSet class.
G4int GetGlauberDataSetType() const
void SetArrayPointer(const G4int i)
int G4int
Definition: G4Types.hh:78
virtual std::ofstream & WriteDataToFile(std::ofstream &File) const
std::istream & operator>>(std::istream &is, HepAxisAngle &aa)
Definition: AxisAngle.cc:95
G4double * GetArrayPointerM(const G4double ppn=0.0)
G4double * GetArrayPointerN(const G4double ppn=0.0)
std::ostream & operator<<(std::ostream &ostr, const G4String &astr)
Definition: pyG4String.cc:40
virtual std::ifstream & ReadDataFromFile(std::ifstream &File)
G4int GetAP() const
Definition of the G4DPMJET2_5Interface class.
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4int GetZP() const
G4GLOB_DLL std::ostream G4cerr