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