Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4FullGlaubAADataSet.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: G4FullGlaubAADataSet.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 "G4FullGlaubAADataSet.hh"
57 
58 #include "G4DPMJET2_5Interface.hh"
59 
60 #include <iomanip>
62 //
63 // G4FullGlaubAADataSet
64 //
65 // Constructor simply resets all variables to zero.
66 //
68 {
69  baseArrayPtrn = &bsiten[0][0];
70  baseArrayPtrm = &bsitem[0][0];
73 
74  for (G4int i=0; i<maxig; i++) {
75  for (G4int j=0; j<maxArray; j++) {
76  bsiten[i][j] = 0.0;
77  bsitem[i][j] = 0.0;
78  }
79  }
80 
81  wu10 = std::sqrt(10.0); // WU10=SQRT(10.)
82 
84 }
86 //
87 // G4FullGlaubAADataSet
88 //
89 // Constructor resets all variables to zero and creates data.
90 //
92 {
93  baseArrayPtrn = &bsiten[0][0];
94  baseArrayPtrm = &bsitem[0][0];
97 
98  for (G4int i=0; i<maxig; i++) {
99  for (G4int j=0; j<maxArray; j++) {
100  bsiten[i][j] = 0.0;
101  bsitem[i][j] = 0.0;
102  }
103  }
104 
105  wu10 = std::sqrt(10.0); // WU10=SQRT(10.)
106 
107  glauberDataSetType = 0;
108 
109  CreateGlauberData (AP1, AT1);
110 }
112 //
113 // ~G4FullGlaubAADataSet
114 //
115 // If you thought the contructor was boring, the destructor is even worse!.
116 // It doesn't do anything.
117 //
119 {}
121 //
123 {
124 #ifdef G4VERBOSE
125  if (GetVerboseLevel()>0) {
126  G4cout <<"AT G4FullGlaubAADataSet::CreateGlauberData: BEFORE SHMAKI CALL"
127  <<G4endl;
128  }
129 #endif
130  AP = AP1;
131  AT = AT1;
132 
133  nucc_.ijproj = 1; // IJPROJ=1
134  collis_.ijprox = 1; // IJPROX=1
135  nuccc_.jjproj = 1; // JJPROJ=1
136  G4int jjprox = 1; // JJPROX=1
137  G4int ishc = 0; // ISHC=0
138 
139  G4int ZP1 = stabZ[AP];
140  G4int ZT1 = stabZ[AT];
141 
142  for (G4int ig = 0; ig < maxig; ig++)
143  {
144  G4double ppn = std::pow(wu10,ig+2); // PPN = WU10**(IG+1)
145  shmaki_ (&AP, &ZP1, &AT, &ZT1, &rptshm_.rproj, &rptshm_.rtarg, &ppn);
146  for (G4int i=0; i<maxArray; i++)
147  {
148  bsiten[ig][i] = dshm_.bsite[i][1];
149  }
150  ishc++; // ISHC = ISHC + 1
151  if (ishc == 1) { // IF(ISHC.EQ.1)THEN
152  rproj = rptshm_.rproj; // RPROJJ(MATNUM) = RPROJ
153  rtarg = rptshm_.rtarg; // RTARGG(MATNUM) = RTARG
154  bmax = dshm_.bmax; // BMAXX(MATNUM) = BMAX
155  bstep = dshm_.bstep; // BSTEPP(MATNUM) = BSTEP
156  }
157  }
158  nucc_.ijproj = 13; // IJPROJ=13
159  collis_.ijprox = 13; // IJPROX=13
160  nuccc_.jjproj = 13; // JJPROJ=13
161  jjprox = 13; // JJPROX=13
162 
163  for (G4int ig = 0; ig < maxig; ig++)
164  {
165  G4double ppn = std::pow(wu10,ig+2); // PPN = WU10**(IG+1)
166  shmaki_ (&AP, &ZP1, &AT, &ZT1, &rptshm_.rproj, &rptshm_.rtarg, &ppn);
167  for (G4int i=0; i<maxArray; i++)
168  {
169  bsitem[ig][i] = dshm_.bsite[i][1];
170  }
171  }
172 #ifdef G4VERBOSE
173  if (GetVerboseLevel()>0) {
174  G4cout <<"AT G4FullGlaubAADataSet::CreateGlauberData: AFTER SHMAKI CALL"
175  <<G4endl;
176  }
177 #endif
178 
179  return true;
180 }
182 //
184 {
185  if (ppn < 1.0E-10) {
186  return baseArrayPtrn;
187  }
188  else {
189  G4int ig = G4int(2.0*std::log10(ppn)) - 2;
190  if (ig < 0) ig = 0;
191 
192  for (G4int j=0; j<maxArray; j++) {
193  dtumat_.bsiten[0][ig][j] = bsiten[ig][j];
194  }
195  dtumat_.ntaxx[0] = AT;
196  dtumat_.nztaxx[0] = ZT;
197  dtumat_.nprxx[0] = AP;
198  dtumat_.nzprxx[0] = ZP;
199  dtumat_.rprojj[0] = rproj;
200  dtumat_.rtagg[0] = rtarg;
201  dtumat_.bstepp[0] = bstep;
202  dtumat_.bmaxx[0] = bmax;
203  arrayPtrn = baseArrayPtrn + maxArray*ig; //NOTE IS THIS A VALID OPERATION??
204  }
205  return arrayPtrn;
206 }
208 //
210 {
211  if (ppn < 1.0E-10) {
212  return baseArrayPtrm;
213  }
214  else {
215  G4int ig = G4int(2.0*std::log10(ppn)) - 2;
216  if (ig < 0) ig = 0;
217 
218  for (G4int j=0; j<maxArray; j++) {
219  dtumat_.bsitem[0][ig][j] = bsitem[ig][j];
220  }
221  dtumat_.ntaxx[0] = AT;
222  dtumat_.nztaxx[0] = ZT;
223  dtumat_.nprxx[0] = AP;
224  dtumat_.nzprxx[0] = ZP;
225  dtumat_.rprojj[0] = rproj;
226  dtumat_.rtagg[0] = rtarg;
227  dtumat_.bstepp[0] = bstep;
228  dtumat_.bmaxx[0] = bmax;
229  arrayPtrm = baseArrayPtrm + maxArray*ig; //NOTE IS THIS A VALID OPERATION??
230  }
231  return arrayPtrm;
232 }
234 //
235 // WriteDataToFile
236 //
237 // This appends the Glauber data from the arrays to the output file stream.
238 // The format is intended to match the standard GLAUBER data file format.
239 //
240 std::ofstream & G4FullGlaubAADataSet::WriteDataToFile (std::ofstream &File) const
241 {
242  File.unsetf(std::ios::fixed);
243  File.setf(std::ios::scientific|std::ios::right|std::ios::adjustfield);
244 
245  for (G4int i=0; i<maxig; i++) {
246  for (G4int j=0; j<maxArray; j+=5) {
247  for (G4int k=j; k<j+5; k++) {
248  File <<std::setw(16) <<bsiten[i][k];
249  }
250  File <<G4endl;
251  }
252  }
253 
254  for (G4int i=0; i<maxig; i++) {
255  for (G4int j=0; j<maxArray; j+=5) {
256  for (G4int k=j; k<j+5; k++) {
257  File <<std::setw(16) <<bsitem[i][k];
258  }
259  File <<G4endl;
260  }
261  }
262 
263  return File;
264 }
266 //
267 // DumpData
268 //
269 // This reads the Glauber data into the arrays from the input file stream.
270 // The format is intended to match the standard GLAUBER data file format.
271 //
272 std::ifstream & G4FullGlaubAADataSet::ReadDataFromFile (std::ifstream &File)
273 {
274  for (G4int i=0; i<maxig; i++) {
275  for (G4int j=0; j<maxArray; j+=5) {
276  File >>bsiten[i][j]
277  >>bsiten[i][j+1]
278  >>bsiten[i][j+2]
279  >>bsiten[i][j+3]
280  >>bsiten[i][j+4];
281  }
282  }
283 
284  for (G4int i=0; i<maxig; i++) {
285  for (G4int j=0; j<maxArray; j+=5) {
286  File >>bsitem[i][j]
287  >>bsitem[i][j+1]
288  >>bsitem[i][j+2]
289  >>bsitem[i][j+3]
290  >>bsitem[i][j+4];
291  }
292  }
293 
294  return File;
295 }
297 //
298 #endif