Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ParamType1GlaubAADataSet.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: G4ParamType1GlaubAADataSet.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 
57 
58 using namespace std;
59 #include "G4DPMJET2_5Interface.hh"
60 
61 #include <iomanip>
63 //
64 // G4ParamType1GlaubAADataSet
65 //
66 // Constructor simply resets all variables to zero.
67 //
69 {
70  glauberDataSetType = 1;
71 }
73 //
74 // G4ParamType1GlaubAADataSet
75 //
76 // Constructor instructing to generate Glauber data based on AP1 and AT1.
77 //
79  const G4int AT1)
80 {
81  glauberDataSetType = 1;
82 
83  CreateGlauberData (AP1,AT1);
84 }
86 //
87 // G4ParamType1GlaubAADataSet
88 //
89 // Constructor instructing to generate Glauber data based full glauber set.
90 //
92  (G4FullGlaubAADataSet *fullGlauberDataSet)
93 {
94  glauberDataSetType = 1;
95 
96  CreateGlauberData (fullGlauberDataSet);
97  AP = fullGlauberDataSet->AP;
98  AT = fullGlauberDataSet->AT;
99  rproj = fullGlauberDataSet->rproj;
100  rtarg = fullGlauberDataSet->rtarg;
101  bstep = fullGlauberDataSet->bstep;
102  bmax = fullGlauberDataSet->bmax;
103 
104 }
106 //
107 // ~G4ParamType1GlaubAADataSet
108 //
109 // If you thought the contructor was boring, the destructor is even worse!.
110 // It doesn't do anything.
111 //
113 {}
115 //
117  (const G4int AP1, const G4int AT1)
118 {
119 //
120 //
121 // Create an full Glauber data set.
122 //
123  G4FullGlaubAADataSet *fullGlauberDataSet = new G4FullGlaubAADataSet();
124  if (fullGlauberDataSet->CreateGlauberData(AP1,AT1)) {
125  CreateGlauberData(fullGlauberDataSet);
126  AP = AP1;
127  AT = AT1;
128  rproj = fullGlauberDataSet->rproj;
129  rtarg = fullGlauberDataSet->rtarg;
130  bstep = fullGlauberDataSet->bstep;
131  bmax = fullGlauberDataSet->bmax;
132 
133  return true;
134  }
135  else {
136  return false;
137  }
138 
139  delete fullGlauberDataSet;
140 }
142 //
144  (G4FullGlaubAADataSet *fullGlauberDataSet)
145 {
146  G4double *ptrArrayN = fullGlauberDataSet->GetArrayPointerN ();
147  G4double *ptrArrayM = fullGlauberDataSet->GetArrayPointerM ();
148 //
149 //
150 // Loop over the momenta. Create hit parameters using GetFitParameters member
151 // function, send a pointer to the relevant part of bsiten and bsitem array in
152 // fullGlauberData object. The parameters are automatically inserted into the
153 // calling parameters array by the calling routine.
154 //
155  for (G4int i=0; i<maxig; i++) {
156  GetFitParameters (ptrArrayN, &paramn[i][0]);
157  ptrArrayN += maxArray;
158  mun1[i] = paramn[i][5] / paramn[i][1];
159  mun2[i] = paramn[i][5] / paramn[i][3] - mun1[i];
160  G4double c1 = std::log(paramn[i][0]);
161  G4double c2 = std::log(paramn[i][2]);
162  cn[i] = std::exp((c2*paramn[i][1] - c1*paramn[i][3]) /
163  (paramn[i][3]-paramn[i][1]));
164 
165  GetFitParameters (ptrArrayM, &paramm[i][0]);
166  ptrArrayM += maxArray;
167  mum1[i] = paramm[i][5] / paramm[i][1];
168  mum2[i] = paramm[i][5] / paramm[i][3] - mun1[i];
169  c1 = std::log(paramm[i][0]);
170  c2 = std::log(paramm[i][2]);
171  cm[i] = std::exp((c2*paramm[i][1] - c1*paramm[i][3]) /
172  (paramm[i][3]-paramm[i][1]));
173  }
174 
175  return true;
176 }
178 //
179 /*G4double *G4ParamType1GlaubAADataSet::GetArrayPointerN (const G4double ppn)
180 {
181  G4int ig = 0;
182  if (ppn < 1.0E-10) {
183  return 0;
184  }
185  else {
186  ig = G4int(2.0*std::log10(ppn)) - 2;
187  }
188  if (ig > 23) ig = 23;
189 
190  for (G4int j=0; j<maxArray; j++) {
191  bsiten[j] = GetInverseValueN(j,ig);
192  dtumat_.bsiten[0][ig][j] = bsiten[j];
193  }
194  dtumat_.ntaxx[0] = AT;
195  dtumat_.nztaxx[0] = ZT;
196  dtumat_.nprxx[0] = AP;
197  dtumat_.nzprxx[0] = ZP;
198  dtumat_.rprojj[0] = rproj;
199  dtumat_.rtagg[0] = rtarg;
200  dtumat_.bstepp[0] = bstep;
201  dtumat_.bmaxx[0] = bmax;
202 
203  arrayPtrn = baseArrayPtrn;
204 
205  return arrayPtrn;
206 }
208 //
209 G4double *G4ParamType1GlaubAADataSet::GetArrayPointerM (const G4double ppn)
210 {
211  G4int ig = 0;
212  if (ppn < 1.0E-10) {
213  return 0;
214  }
215  else {
216  ig = G4int(2.0*std::log10(ppn)) - 2;
217  }
218  if (ig > 23) ig = 23;
219 
220  for (G4int j=0; j<maxArray; j++) {
221  bsitem[j] = GetInverseValueM(j,ig);
222  dtumat_.bsitem[0][ig][j] = bsitem[j];
223  }
224  dtumat_.ntaxx[0] = AT;
225  dtumat_.nztaxx[0] = ZT;
226  dtumat_.nprxx[0] = AP;
227  dtumat_.nzprxx[0] = ZP;
228  dtumat_.rprojj[0] = rproj;
229  dtumat_.rtagg[0] = rtarg;
230  dtumat_.bstepp[0] = bstep;
231  dtumat_.bmaxx[0] = bmax;
232 
233  arrayPtrm = baseArrayPtrm;
234 
235  return arrayPtrm;
236 }*/
238 //
239 // WriteDataToFile
240 //
241 // This appends the Glauber data from the arrays to the output file stream.
242 // The format is intended to match the standard GLAUBER data file format.
243 //
244 std::ofstream & G4ParamType1GlaubAADataSet::WriteDataToFile (std::ofstream &File) const
245 {
246  File.unsetf(std::ios::fixed);
247  File.setf(std::ios::scientific|std::ios::right|std::ios::adjustfield);
248 
249  File <<" c1"
250  <<" m1"
251  <<" c2"
252  <<" m2"
253  <<" Itrans"
254  <<" gamma"
255  <<" d0"
256  <<" d1"
257  <<" d2"
258  <<" d3"
259  <<G4endl;
260 
261  for (G4int i=0; i<maxig; i++) {
262  File <<std::setw(16) <<paramn[i][0]
263  <<std::setw(16) <<paramn[i][1]
264  <<std::setw(16) <<paramn[i][2]
265  <<std::setw(16) <<paramn[i][3]
266  <<std::setw(16) <<paramn[i][4]
267  <<std::setw(16) <<paramn[i][5]
268  <<std::setw(16) <<paramn[i][6]
269  <<std::setw(16) <<paramn[i][7]
270  <<std::setw(16) <<paramn[i][8]
271  <<std::setw(16) <<paramn[i][9]
272  <<G4endl;
273  }
274 
275  for (G4int i=0; i<maxig; i++) {
276  File <<std::setw(16) <<paramm[i][0]
277  <<std::setw(16) <<paramm[i][1]
278  <<std::setw(16) <<paramm[i][2]
279  <<std::setw(16) <<paramm[i][3]
280  <<std::setw(16) <<paramm[i][4]
281  <<std::setw(16) <<paramm[i][5]
282  <<std::setw(16) <<paramm[i][6]
283  <<std::setw(16) <<paramm[i][7]
284  <<std::setw(16) <<paramm[i][8]
285  <<std::setw(16) <<paramm[i][9]
286  <<G4endl;
287  }
288 
289  return File;
290 }
292 //
293 // DumpData
294 //
295 // This reads the Glauber data into the arrays from the input file stream.
296 // The format is intended to match the standard GLAUBER data file format.
297 //
298 std::ifstream & G4ParamType1GlaubAADataSet::ReadDataFromFile (std::ifstream &File)
299 {
300  G4String dummy[10];
301  File >>dummy[0]
302  >>dummy[1]
303  >>dummy[2]
304  >>dummy[3]
305  >>dummy[4]
306  >>dummy[5]
307  >>dummy[6]
308  >>dummy[7]
309  >>dummy[8]
310  >>dummy[9];
311 
312  for (G4int i=0; i<maxig; i++) {
313  File >>paramn[i][0]
314  >>paramn[i][1]
315  >>paramn[i][2]
316  >>paramn[i][3]
317  >>paramn[i][4]
318  >>paramn[i][5]
319  >>paramn[i][6]
320  >>paramn[i][7]
321  >>paramn[i][8]
322  >>paramn[i][9];
323  }
324 
325  for (G4int i=0; i<maxig; i++) {
326  File >>paramm[i][0]
327  >>paramm[i][1]
328  >>paramm[i][2]
329  >>paramm[i][3]
330  >>paramm[i][4]
331  >>paramm[i][5]
332  >>paramm[i][6]
333  >>paramm[i][7]
334  >>paramm[i][8]
335  >>paramm[i][9];
336  }
337 
338  return File;
339 }
341 //
342 #endif