Using TGeo to retrieve the mean material budget between two points (M.Ivanov)
[u/mrichter/AliRoot.git] / TFluka / Fdblprc.h
1 #ifndef FDBLPRC_H
2 #define FDBLPRC_H 1
3
4 #include "Rtypes.h"
5 #include "cfortran.h"
6 extern "C" {
7 //*$ create dblprc.add
8 //*copy dblprc
9 //*                                                                     *
10 //*=== dblprc ==========================================================*
11 //*                                                                     *
12 //*---------------------------------------------------------------------*
13 //*                                                                     *
14 //*      dblprc: included in any routine, machine, mathematical and     *
15 //*              physical constants plus global declarations            *
16 //*                                                                     *
17 //*  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  *
18 //*  !!!! o n   m a c h i n e s   w h e r e   t h e   d o u b l e !!!!  *
19 //*  !!!! p r e c i s i o n   i s   n o t   r e q u i r e d  r e -!!!!  *
20 //*  !!!! m o v e   t h e   d o u b l e   p r e c i s i o n       !!!!  *
21 //*  !!!! s t a t e m e n t,  s e t   k a l g n m = 1   a n d     !!!!  *
22 //*  !!!! c h a n g e   a l l   n u m e r i c a l   c o n s -     !!!!  *
23 //*  !!!! t a n t s   t o   s i n g l e   p r e c i s i o n       !!!!  *
24 //*  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  *
25 //*                                                                     *
26 //*         kalgnm = real address alignment, 2 for double precision,    *
27 //*                  1 for single precision                             *
28 //*         kalch8 = character*8 address alignment wrt the precision    *
29 //*                  defined by kalgnm (mostly 1 in all situations)     *
30 //*         i2algn = integer*2 address alignment wrt the normal integer *
31 //*                  precision (mostly 2, 4 for 64 bit integers)        *
32 //*         anglgb = this parameter should be set equal to the machine  *
33 //*                  "zero" with respect to unit                        *
34 //*         anglsq = this parameter should be set equal to the square   *
35 //*                  of anglgb                                          *
36 //*         axcssv = this parameter should be set equal to the number   *
37 //*                  for which unity is negligible for the machine      *
38 //*                  accuracy                                           *
39 //*         andrfl = "underflow" of the machine for floating point      *
40 //*                  operation                                          *
41 //*         avrflw = "overflow"  of the machine for floating point      *
42 //*                  operation                                          *
43 //*         ainfnt = code "infinite"                                    *
44 //*         azrzrz = code "zero"                                        *
45 //*         einfnt = natural logarithm of the code "infinite"           *
46 //*         ezrzrz = natural logarithm of the code "zero"               *
47 //*         excssv = natural logarithm of the code number for which     *
48 //*                  unit is negligible                                 *
49 //*         englgb = natural logarithm of the code "zero" with respect  *
50 //*                  to unit                                            *
51 //*         onemns = 1- of the machine, it is 1 - 2 x anglgb            *
52 //*         onepls = 1+ of the machine, it is 1 + 2 x anglgb            *
53 //*         csnnrm = maximum tolerable error on cosine normalization,   *
54 //*                  u**2+v**2+w**2: assuming a typical anglgb relative *
55 //*                  error on each component we would get 2xanglgb: use *
56 //*                  4xanglgb to avoid too many normalizations          *
57 //*         dmxtrn = "infinite" distance for transport (cm)             *
58 //*         rhflmn = minimal density for fluka (g/cm^3)                 *
59 //*                                                                     *
60 //*   "global" declarations:                                            *
61 //*         lfluka = set to true for a real (full) fluka run            *
62 //*         lgbias = set to true for a fully biased run                 *
63 //*         lgbana = set to true for a fully analogue run               *
64 //*         lflgeo = set to true when using the standard fluka geometry *
65 //*         loflts = set to true for special off-line testing of speci- *
66 //*                  fic routines                                       *
67 //*         lusrin = set to true if the user dependent initialization   *
68 //*                  routine usrini has been called at least once       *
69 //*         lnmgeo = set to true for a name-base geometry input         *
70 //*         lnminp = set to true for a name-base fluka input            *
71 //*         Lfrfmt = set to true for a free-format based Fluka input    *
72 //*         lfdrtr = set to true for going in/out feeder/flukam at each *
73 //*                  event                                              *
74 //*                                                                     *
75 //*---------------------------------------------------------------------*
76 //*                                                                     *
77 const Int_t kalgnm = 2;
78 const Int_t kalch8 = 1;
79 const Int_t i2algn = 2;
80 const Double_t anglgb = 5.0e-16;
81 const Double_t anglsq = 2.5e-31;
82 const Double_t axcssv = 0.2e+16;
83 const Double_t andrfl = 1.0e-38;
84 const Double_t avrflw = 1.0e+38;
85 const Double_t ainfnt = 1.0e+30;
86 const Double_t azrzrz = 1.0e-30;
87 const Double_t einfnt = +69.07755278982137e+00;
88 const Double_t ezrzrz = -69.07755278982137e+00;
89 const Double_t excssv = +35.23192357547063e+00;
90 const Double_t englgb = -35.23192357547063e+00;
91 const Double_t onemns = 0.999999999999999e+00;
92 const Double_t onepls = 1.000000000000001e+00;
93 const Double_t csnnrm = 2.0e-15;
94 const Double_t dmxtrn = 1.0e+08;
95 const Double_t rhflmn = 1.0e-06;
96 //*
97 //*======================================================================*
98 //*======================================================================*
99 //*=========                                                   ==========*
100 //*=========    m a t h e m a t i c a l   c o n s t a n t s    ==========*
101 //*=========                                                   ==========*
102 //*======================================================================*
103 //*======================================================================*
104 //*                                                                      *
105 //*   numerical constants (single precision):                            *
106 //*                                                                      *
107 //*         zersng = 0                                                   *
108 //*                                                                      *
109 //*   numerical constants (double precision):                            *
110 //*                                                                      *
111 //*         zerzer = 0                                                   *
112 //*         oneone = 1                                                   *
113 //*         twotwo = 2                                                   *
114 //*         thrthr = 3                                                   *
115 //*         foufou = 4                                                   *
116 //*         fivfiv = 5                                                   *
117 //*         sixsix = 6                                                   *
118 //*         sevsev = 7                                                   *
119 //*         eigeig = 8                                                   *
120 //*         aninen = 9                                                   *
121 //*         tenten = 10                                                  *
122 //*         eleven = 11                                                  *
123 //*         twelve = 12                                                  *
124 //*         fiften = 15                                                  *
125 //*         sixten = 16                                                  *
126 //*         hlfhlf = 1/2                                                 *
127 //*         onethi = 1/3                                                 *
128 //*         onefou = 1/4                                                 *
129 //*         onefiv = 1/5                                                 *
130 //*         onesix = 1/6                                                 *
131 //*         onesev = 1/7                                                 *
132 //*         oneeig = 1/8                                                 *
133 //*         twothi = 2/3                                                 *
134 //*         thrfou = 3/4                                                 *
135 //*         thrtwo = 3/2                                                 *
136 //*         pipipi = circumference / diameter                            *
137 //*         twopip = 2 x pipipi                                          *
138 //*         pip5o2 = 5/2 x pipipi                                        *
139 //*         pipisq = pipipi x pipipi                                     *
140 //*         pihalf = 1/2 x pipipi                                        *
141 //*         erfa00 = erf (oo) = 1/2 x square root of pi                  *
142 //*         sqtwpi = square root of 2xpi                                 *
143 //*         eulero = eulero's constant                                   *
144 //*         eulexp = exp ( eulero )                                      *
145 //*         e1m2eu = exp ( 1 - 2 eulero )                                *
146 //*         eneper = "e", base of natural logarithm                      *
147 //*         sqrent = square root of "e"                                  *
148 //*         sqrtwo = square root of  2                                   *
149 //*         sqrthr = square root of  3                                   *
150 //*         sqrfiv = square root of  5                                   *
151 //*         sqrsix = square root of  6                                   *
152 //*         sqrsev = square root of  7                                   *
153 //*         sqrt12 = square root of 12                                   *
154 //*         s2fwhm = 2 x square root of 2 x logarithm of 2               *
155 //*                                                                      *
156 //*----------------------------------------------------------------------*
157 //*
158 const Float_t  zersng = 0.e+00;
159 const Double_t zerzer = 0.e+00;
160 const Double_t oneone = 1.e+00;
161 const Double_t twotwo = 2.e+00;
162 const Double_t thrthr = 3.e+00;
163 const Double_t foufou = 4.e+00;
164 const Double_t fivfiv = 5.e+00;
165 const Double_t sixsix = 6.e+00;
166 const Double_t sevsev = 7.e+00;
167 const Double_t eigeig = 8.e+00;
168 const Double_t aninen = 9.e+00;
169 const Double_t tenten = 10.e+00;
170 const Double_t eleven = 11.e+00;
171 const Double_t twelve = 12.e+00;
172 const Double_t fiften = 15.e+00;
173 const Double_t sixten = 16.e+00;
174 const Double_t hlfhlf = 0.5e+00;
175 const Double_t onethi = oneone/thrthr;
176 const Double_t onefou = oneone/foufou;
177 const Double_t onefiv = oneone/fivfiv;
178 const Double_t onesix = oneone/sixsix;
179 const Double_t onesev = oneone/sevsev;
180 const Double_t oneeig = oneone/eigeig;
181 const Double_t twothi = twotwo/thrthr;
182 const Double_t thrfou = thrthr/foufou;
183 const Double_t thrtwo = thrthr/twotwo;
184 const Double_t pipipi = 3.141592653589793238462643383279e+00;
185 const Double_t twopip = 6.283185307179586476925286766559e+00;
186 const Double_t pip5o2 = 7.853981633974483096156608458199e+00;
187 const Double_t pipisq = 9.869604401089358618834490999876e+00;
188 const Double_t pihalf = 1.570796326794896619231321691640e+00;
189 const Double_t erfa00 = 0.886226925452758013649083741671e+00;
190 const Double_t sqrtpi = 1.772453850905516027298167483341e+00;
191 const Double_t sqtwpi = 2.506628274631000502415765284811e+00;
192 const Double_t eulero = 0.577215664901532860606512e+00;
193 const Double_t eulexp = 1.781072417990197985236504e+00;
194 const Double_t eullog = -0.5495393129816448223376619e+00;
195 const Double_t e1m2eu = 0.8569023337737540831433017e+00;
196 const Double_t eneper = 2.718281828459045235360287471353e+00;
197 const Double_t sqrent = 1.648721270700128146848650787814e+00;
198 const Double_t sqrtwo = 1.414213562373095048801688724210e+00;
199 const Double_t sqrthr = 1.732050807568877293527446341506e+00;
200 const Double_t sqrfiv = 2.236067977499789696409173668731e+00;
201 const Double_t sqrsix = 2.449489742783178098197284074706e+00;
202 const Double_t sqrsev = 2.645751311064590590501615753639e+00;
203 const Double_t sqrt12 = 3.464101615137754587054892683012e+00;
204 const Double_t s2fwhm = 2.354820045030949e+00;
205 //*
206 //*======================================================================*
207 //*======================================================================*
208 //*=========                                                   ==========*
209 //*=========       p h y s i c a l   c o n s t a n t s         ==========*
210 //*=========                                                   ==========*
211 //*======================================================================*
212 //*======================================================================*
213 //*                                                                      *
214 //*   primary constants:                                                 *
215 //*                                                                      *
216 //*         clight = speed of light in cm s-1                            *
217 //*         avogad = avogadro number                                     *
218 //*         boltzm = k boltzmann constant (j k-1)                        *
219 //*         amelgr = electron mass (g)                                   *
220 //*         plckbr = reduced planck constant (erg s)                     *
221 //*         elccgs = elementary charge (cgs unit)                        *
222 //*         elcmks = elementary charge (mks unit)                        *
223 //*         amugrm = atomic mass unit (g)                                *
224 //*         ammumu = muon    mass (amu)                                  *
225 //*         amprmu = proton  mass (amu)                                  *
226 //*         amnemu = neutron mass (amu)                                  *
227 //*                                                                      *
228 //*   derived constants:                                                 *
229 //*                                                                      *
230 //*         alpfsc = fine structure constant  = e^2/(hbar c) (cgs units) *
231 //*         amelct = electron mass (gev) = 10^-16amelgr clight^2 / elcmks*
232 //*         amugev = atomic mass unit (gev) = 10^-16amugrm clight^2      *
233 //*                                           / elcmks                   *
234 //*         ammuon = muon    mass (gev) = ammumu * amugev                *
235 //*         amprtn = proton  mass (gev) = amprmu * amugev                *
236 //*         amntrn = neutron mass (gev) = amnemu * amugev                *
237 //*         amdeut = deuteron mass (gev)                                 *
238 //*         amalph = alpha    mass (gev) (derived from the excess mass   *
239 //*                  and an (approximate) atomic binding not a really    *
240 //*                  measured constant)                                  *
241 //*         cougfm = e^2 (gev fm) = elccgs^2 / elcmks * 10^-7 * 10^-9    *
242 //*                * 10^13 (10^..=erg cm->joule cm->gev cm->gev fm       *
243 //*                it is equal to 0.00144 gev fm                         *
244 //*         fscto2 = (fine structure constant)^2                         *
245 //*         fscto3 = (fine structure constant)^3                         *
246 //*         fscto4 = (fine structure constant)^4                         *
247 //*         plabrc = reduced planck constant times the light velocity    *
248 //*                  expressed in gev fm                                 *
249 //*         rclsel = classical electron radius (cm) = e^2 / (m_e c^2)    *
250 //*         bltzmn = k boltzmann constant in gev k-1                     *
251 //*         a0bohr = bohr radius, hbar^2 / ( m_e e^2) (fm) = plabrc**2   *
252 //*                / amelct / cougfm, or equivalently,                   *
253 //*                plabrc / alpfsc / amelct                              *
254 //*         gfohb3 = fermi constant, g_f/(hbar c)^3, in gev^-2           *
255 //*         gfermi = fermi constant in gev fm^3                          *
256 //*         sin2tw = sin^2 theta_weinberg                                *
257 //*         prmgnm = proton  magnetic moment (magneton)                  *
258 //*         anmgnm = neutron magnetic moment (magneton)                  *
259 //*         s0thms = sigma_0 Thomson, 8/3 pi r_e^2 (mb)                  *
260 //*                                                                      *
261 //*   astronomical constants:                                            *
262 //*                                                                      *
263 //*         rearth = earth equatorial radius (cm)                        *
264 //*         auastu = astronomical unit       (cm)                        *
265 //*                                                                      *
266 //*   conversion constants:                                              *
267 //*                                                                      *
268 //*         gevmev = from gev to mev                                     *
269 //*         emvgev = from mev to gev                                     *
270 //*         gev2ev = from gev to  ev                                     *
271 //*         ev2gev = from ev  to gev                                     *
272 //*         algvmv = from gev to mev, log                                *
273 //*         raddeg = from radians to degrees                             *
274 //*         degrad = from degrees to radians                             *
275 //*         gevomg = from (photon) energy [gev] in 2pi x frequency [s^-1]*
276 //*         cmq2mb = from square centimetres to millibarns               *
277 //*                                                                      *
278 //*   useful constants:                                                  *
279 //*                                                                      *
280 //*         fertho = constant to be used in the fermi-thomas approxima-  *
281 //*                  ted expression for atomic binding energies          *
282 //*         expebn = exponent to be used in the fermi-thomas approxima-  *
283 //*                  ted expression for atomic binding energies          *
284 //*                    b_atomic (z) = fertho x z^expebn (gev)            *
285 //*         bexc12 = fermi-thomas approximated expression for 12-c ato-  *
286 //*                  mic binding energies (gev)                          *
287 //*         amunmu = difference between the atomic and nuclear mass units*
288 //*         amuc12 = "nuclear" mass unit = 1/12 m_nucl (12-c),           *
289 //*                  m_nucl (12-c) = m_atom (12-c) - 6 m_e + b_atom(12-c)*
290 //*                                                                      *
291 //*----------------------------------------------------------------------*
292 //*
293 const Double_t clight = 2.99792458e+10;
294 const Double_t avogad = 6.0221367e+23;
295 const Double_t boltzm = 1.380658e-23;
296 const Double_t amelgr = 9.1093897e-28;
297 const Double_t plckbr = 1.05457266e-27;
298 const Double_t elccgs = 4.8032068e-10;
299 const Double_t elcmks = 1.60217733e-19;
300 const Double_t amugrm = 1.6605402e-24;
301 const Double_t ammumu = 0.113428913e+00;
302 const Double_t amprmu = 1.007276470e+00;
303 const Double_t amnemu = 1.008664904e+00;
304 //* const Double_t alpfsc = 1.e+00 / 137.035989561e+00
305 //* const Double_t fscto2 = alpfsc * alpfsc
306 //* const Double_t fscto3 = fscto2 * alpfsc
307 //* const Double_t fscto4 = fscto3 * alpfsc
308 //*    it is important to set the electron mass exactly with the same
309 //*    rounding as in the mass tables, so use the explicit expression
310 //* const Double_t amelct = 1.e-16 * amelgr * clight * clight / elcmks
311 //*    it is important to set the amu mass exactly with the same
312 //*    rounding as in the mass tables, so use the explicit expression
313 //* const Double_t amugev = 1.e-16 * amugrm * clight * clight / elcmks
314 //*    it is important to set the muon,proton,neutron masses exactly with
315 //*    the same rounding as in the mass tables, so use the explicit
316 //*    expression
317 //* const Double_t ammuon = ammumu * amugev
318 //* const Double_t amprtn = amprmu * amugev
319 //* const Double_t amntrn = amnemu * amugev
320 //* const Double_t rclsel = elccgs * elccgs / clight / clight / amelgr
321 //* const Double_t bltzmn = boltzm / elcmks * 1.e-09
322 const Double_t alpfsc = 7.2973530791728595e-3;
323 const Double_t fscto2 = 5.3251361962113614e-5;
324 const Double_t fscto3 = 3.8859399018437826e-7;
325 const Double_t fscto4 = 2.8357075508200407e-9;
326 const Double_t plabrc = 0.197327053e+00;
327 const Double_t amelct = 0.51099906e-3;
328 const Double_t amugev = 0.93149432e+00;
329 const Double_t ammuon = 0.105658389e+00;
330 const Double_t amprtn = 0.93827231e+00;
331 const Double_t amntrn = 0.93956563e+00;
332 const Double_t amdeut = 1.87561339e+00;
333 const Double_t amalph = 3.72738025692891e+00;
334 const Double_t cougfm = elccgs*elccgs/elcmks*(1.e-7)*(1.e+13)*(1.e-9);
335 const Double_t rclsel = 2.8179409183694872e-13;
336 const Double_t bltzmn = 8.617385e-14;
337 const Double_t a0bohr = plabrc/alpfsc/amelct;
338 const Double_t gfohb3 = 1.16639e-5;
339 const Double_t gfermi = gfohb3*plabrc*plabrc*plabrc;
340 const Double_t sin2tw = 0.2319e+00;
341 const Double_t prmgnm = 2.792847386e+00;
342 const Double_t anmgnm = -1.91304275e+00;
343 const Double_t rearth = 6.378140e+8;
344 const Double_t auastu = 1.4959787066e+13;
345 const Double_t gevmev = 1.0e+3;
346 const Double_t ev2gev = 1.0e-9;
347 const Double_t gev2ev = 1.0e+9;
348 const Double_t emvgev = 1.0e-3;
349 const Double_t cmq2mb = 1.0e+27;
350 const Double_t algvmv = 6.90775527898214e+00;
351 const Double_t raddeg = (180.e+00)/pipipi;
352 const Double_t degrad = pipipi/(180.e+00);
353 const Double_t gevomg = clight*(1.e+13)/plabrc;
354 const Double_t s0thms = eigeig / thrthr * pipipi * rclsel * rclsel * cmq2mb;
355 //*  old Fermi-Thomas parametrization of atomic binding energies:
356 //*     const Double_t fertho = 15.73       e-9
357 //*     const Double_t expebn = 7.e+00 / 3.e+00
358 //*     const Double_t bexc12 = fertho * 65.41634134195703e+00
359 //*  new Fermi-Thomas parametrization of atomic binding energies:
360 const Double_t fertho = 14.33e-9;
361 const Double_t expebn = 2.39e+00;
362 const Double_t bexc12 = fertho*72.40715579499394e+00;
363 const Double_t amunmu = hlfhlf*amelct-bexc12/12.e+00;
364 const Double_t amuc12 = amugev-amunmu;
365 //*  Old MeV units:
366 const Double_t amemev = gevmev * amelct;
367 //*
368
369 typedef struct {
370    Int_t    lfluka;
371    Int_t    lgbias;
372    Int_t    lgbana;
373    Int_t    lflgeo;
374    Int_t    loflts;
375    Int_t    lusrin;
376    Int_t    lnmgeo;
377    Int_t    lnminp;
378    Int_t    lfrfmt;
379    Int_t    lfdrtr;
380    Int_t    kflgeo;
381    Int_t    kfldnr;
382 } globalCommon;
383 #define GLOBAL COMMON_BLOCK(GLOBAL,global)
384 COMMON_BLOCK_DEF(globalCommon,GLOBAL);
385 }
386
387 #endif