Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40 //
41 // MODULE: G4VGlauberDataSet.cc
42 //
43 // Version: 0.B
44 // Date: 02/04/08
45 // Author: P R Truscott
46 // Organisation: QinetiQ Ltd, UK
47 // Customer: ESA/ESTEC, NOORDWIJK
48 // Contract: 19770/06/NL/JD
49 //
50 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52 //
53 #ifdef G4_USE_DPMJET
54 
55 
56 #include "G4VGlauberDataSet.hh"
57 
58 #include "G4DPMJET2_5Interface.hh"
59 
60 #include <iomanip>
61 #include <iostream>
62 
64 //
65 // G4G4VGlauberDataSet
66 //
67 // Constructor simply resets all variables to zero.
68 //
70 {
71  rproj = 0.0;
72  rtarg = 0.0;
73  bstep = 0.0;
74  bmax = 0.0;
75  AP = 0;
76  ZP = 0;
77  AT = 0;
78  ZT = 0;
79 
80  maxArray = 200;
81  maxig = 24;
82 
83  glauberDataSetType = -1;
84 
85  verboseLevel = 0;
86 }
88 //
89 // ~G4G4VGlauberDataSet
90 //
91 // If you thought the contructor was boring, the destructor is even worse!.
92 // It doesn't do anything.
93 //
95 {}
97 //
99 {
100  return AP;
101 }
103 //
105 {
106  return ZP;
107 }
109 //
111 {
112  return AT;
113 }
115 //
117 {
118  return ZT;
119 }
121 //
123 {
124  if (i<0 || i>=maxArray) {
125  G4cerr <<"WARNING G4G4VGlauberDataSet::SetArrayPointer" <<G4endl;
126  G4cerr <<"ATTEMPT TO SET POINTER TO VALUE OUTSIDE [0,"
127  <<maxArray-1
128  <<"]"
129  <<G4endl;
130  }
131  else {
132  arrayPtrn = baseArrayPtrn + i;
133  arrayPtrm = baseArrayPtrm + i;
134  }
135 }
137 //
139 {
140  if (ppn < 1.0E-10) return baseArrayPtrn;
141  else return arrayPtrn;
142 }
144 //
146 {
147  if (ppn < 1.0E-10) return baseArrayPtrm;
148  else return arrayPtrm;
149 }
151 //
153 {
154  return glauberDataSetType;
155 }
157 //
158 std::ofstream & G4VGlauberDataSet::WriteDataToFile (std::ofstream &File) const
159 {
160 //
161 //
162 // Dummy member function;
163 //
164  return File;
165 }
166 std::ifstream & G4VGlauberDataSet::ReadDataFromFile (std::ifstream &File)
167 {
168 //
169 //
170 // Dummy member function;
171 //
172  return File;
173 }
175 //
176 // operator <<
177 //
178 // Output file-stream operator. This is intended to match the standard
179 // GLAUBER data file format.
180 //
181 std::ofstream & operator << (std::ofstream &File, const G4VGlauberDataSet &q)
182 {
183  File.unsetf(std::ios::scientific);
184  File.setf(std::ios::fixed|std::ios::right|std::ios::adjustfield);
185  File.precision(0);
186  File <<std::setw(1) <<q.glauberDataSetType
187  <<"NUCLEUS "
188  <<std::setw(10) <<q.AT
189  <<std::setw(10) <<q.ZT
190  <<std::setw(10) <<q.AP
191  <<std::setw(10) <<q.ZP
192  <<G4endl;
193 
194  File.unsetf(std::ios::fixed);
195  File.setf(std::ios::fixed|std::ios::right|std::ios::adjustfield);
196  File.precision(5);
197 
198  File <<std::setw(10) <<q.bmax
199  <<std::setw(10) <<q.bstep
200  <<std::setw(10) <<q.rproj
201  <<std::setw(10) <<q.rtarg
202  <<G4endl;
203 
204  File.precision(8);
205 
206  return q.WriteDataToFile (File);
207 }
209 //
210 // operator >>
211 //
212 // Input file-stream operator. This is assumed to the format matches the
213 // standard GLAUBER data file format.
214 //
215 std::ifstream & operator >> (std::ifstream &File, G4VGlauberDataSet &q)
216 {
217  G4String dummy;
218  File >>dummy
219  >>q.AT
220  >>q.ZT
221  >>q.AP
222  >>q.ZP;
223 
224  File >>q.bmax
225  >>q.bstep
226  >>q.rproj
227  >>q.rtarg;
228 
229  return q.ReadDataFromFile (File);
230 }
231 #endif