EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
radgen_init.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file radgen_init.f
1 
2  subroutine radgen_init(bUseLUT,bGenLUT)
3 
4  implicit none
5 
6  include "mc_set.inc"
7  include "density.inc"
8  include "cmpcom.inc"
9  include "tailcom.inc"
10  include "radgen.inc"
11  include "radgenkeys.inc"
12 
13  logical buselut,bgenlut
14  CHARACTER*256 tname
15  integer aaa
16 
17 ! ... force block data modules to be read
18  external radata
19 
20 * kill_elas_res =0, all rad corrections
21 * kill_elas_res =1, ???
22 * kill_elas_res =2, no rad corrections
23  kill_elas_res=0
24  aaa=0
25 
26 * initialise the rad. correction part !
27 * = 2 : fint cernlib extrapolation routine
28 * = 1 : 2dim spline
29 * = 0 : make lookuptable
30 * = -1 : do not lookup table , calculate all events
31  if( buselut ) then
32  if( bgenlut ) then
33  ixytest = 0
34  else
35  ixytest = 2
36  endif
37  else
38  ixytest = -1
39  endif
40 
41 *----------------------------
42 * ire is target 1,2,3
43 * now also 14 (nitrogen) and 84 (krypton)
44 * add neutron target
45  if( mcset_tara .eq. 1 .and. mcset_tarz .eq. 0 ) then
46  ire = 0
47  elseif( mcset_tara .eq. 1 .and. mcset_tarz .eq. 1 ) then
48  ire = 1
49  elseif( mcset_tara .eq. 2 .and. mcset_tarz .eq. 1 ) then
50  ire = 2
51  elseif( mcset_tara .eq. 3 .and. mcset_tarz .eq. 2 ) then
52  ire = 3
53  elseif( mcset_tara .eq. 4 .and. mcset_tarz .eq. 2 ) then
54  ire = 4
55  elseif( mcset_tara .eq. 14 .and. mcset_tarz .eq. 7 ) then
56  ire = 14
57  elseif( mcset_tara .eq. 20 .and. mcset_tarz .eq. 10 ) then
58  ire = 20
59  elseif( mcset_tara .eq. 84 .and. mcset_tarz .eq. 36 ) then
60  ire = 84
61  else
62  write(*,*)( 'RADGEN_INIT: invalid target selection' )
63  endif
64 
65 ! We handle the following target and beam polarizations
66 
67  if (mcset_pbeam(1:1).ne.'L') then
68  write(*,*)('RADGEN_INIT: '//
69  + 'Only longitudinal polarized Beam (PBeam) makes sense')
70  endif
71  if ((mcset_ptarget(1:1).ne.'L').and.
72  + (mcset_ptarget(1:1).ne.'T').and.
73  + (mcset_ptarget(1:2).ne.'DT')) then
74  write(*,*)('RADGEN_INIT: '//
75  + 'Check your value for the Target polarization(PTarget)')
76  endif
77 
78 *----------------------------
79 * plrun : beam polarisation [-1.,+1.]
80 * pnrun : nucleon polarisation [-1.,0,+1.]
81 
82 C if this code would be used with pepsi than you can calculate rad-corrections
83 C for all this target and beam polarisation settings.
84 
85  IF (((mcset_pbvalue*mcset_ptvalue).lt.0).and.
86  & (mcset_ptarget(1:1).eq.'L')) THEN
87 * larger cross section state (anti parallel )
88  plrun = -1.
89  pnrun = 1.
90  tname='radgen/xytab0ant.ee.ppp.dat'
91  ELSEIF (((mcset_pbvalue*mcset_ptvalue).gt.0).and.
92  & (mcset_ptarget(1:1).eq.'L')) THEN
93 * smaller cross section state ( parallel )
94  plrun = -1.
95  pnrun = -1.
96  tname='radgen/xytab0par.ee.ppp.dat'
97  ELSEIF (((mcset_pbvalue*mcset_ptvalue).eq.0).and.
98  & (mcset_ptarget(1:2).eq.'DT')) THEN
99 * cross section state for tensor polarised deuterium
100  plrun = 0.
101  pnrun = mcset_ptvalue * 2.
102  if (mcset_ptvalue.lt.0.) then
103  tname='radgen/xytab0tenant.dat'
104  elseif (mcset_ptvalue.gt.0.) then
105  tname='radgen/xytab0tenpar.dat'
106  endif
107  ELSEIF (((mcset_pbvalue*mcset_ptvalue).lt.0.).and.
108  + (mcset_ptarget(1:1).eq.'T')) THEN
109 * larger cross section state (anti parallel ) transverse proton
110  plrun = -1.
111  pnrun = 1.
112  tname='radgen/xyten0ant.ee.ppp.dat'
113  ELSEIF (((mcset_pbvalue*mcset_ptvalue).gt.0.).and.
114  + (mcset_ptarget(1:1).eq.'T')) THEN
115 * smaller cross section state ( parallel ) transverse proton
116  plrun = -1.
117  pnrun = -1.
118  tname='radgen/xyten0par.ee.ppp.dat'
119  ELSE
120  plrun = 0.
121  pnrun = 0.
122  if(ire.lt.10) then
123  tname='radgen/xytab0unp.ee.ppp.dat'
124  else
125  tname='radgen/xytab00unp.ee.ppp.dat'
126  endif
127  ENDIF
128 
129  if (ire.lt.10) then
130  write(tname(13:13),'(i1)')ire
131  if ((ebeam.gt.0).and.(ebeam.lt.10)) then
132  write(tname(18:18),'(i1)')aaa
133  write(tname(19:19),'(i1)')int(ebeam)
134  endif
135  if (ebeam.ge.10) then
136  write(tname(18:19),'(i2)')int(ebeam)
137  endif
138  if ((pbeam.ge.10).and.(pbeam.lt.100)) then
139  write(tname(21:21),'(i1)')aaa
140  write(tname(22:23),'(i2)')int(pbeam)
141  endif
142  if (pbeam.ge.100) then
143  write(tname(21:23),'(i3)')int(pbeam)
144  endif
145  else
146  write(tname(13:14),'(i2)')ire
147  if ((ebeam.gt.0).and.(ebeam.lt.10)) then
148  write(tname(19:19),'(i1)')aaa
149  write(tname(20:20),'(i1)')int(ebeam)
150  endif
151  if (ebeam.ge.10) then
152  write(tname(19:20),'(i2)')int(ebeam)
153  endif
154  if ((pbeam.ge.10).and.(pbeam.lt.100)) then
155  write(tname(22:22),'(i1)')aaa
156  write(tname(23:24),'(i2)')int(pbeam)
157  endif
158  if (pbeam.ge.100) then
159  write(tname(22:24),'(i3)')int(pbeam)
160  endif
161  endif
162 
163 
164 *----------------------------
165 * grid of important regions in theta (7*ntk)
166  ntk = 35
167 *----------------------------
168 * photonic energy grid
169  nrr = 100
170 *----------------------------
171 * min. energy in the calo (resolution parameter)
172 * as the Hermes calorimeter can only see single photons from a minimum
173 * energy of 0.5 GeV should the parameter not be changed from 0.1
174 * to 0.5 GeV (E.C.A)
175  demin=0.10
176 
177 *----------------------------
178  ap=2.*amp
179  amp2=amp**2
180  ap2=2.*amp**2
181  if(kill_elas_res.eq.1)amc2=4d0
182 
183  if(ire.eq.0) then
184  amt=.939565d0
185  rtara=1d0
186  rtarz=0d0
187  fermom=0d0
188  elseif(ire.eq.1)then
189  amt=.938272d0
190  rtara=1d0
191  rtarz=1d0
192  fermom=0d0
193  elseif(ire.eq.2)then
194  amt=1.87561d0
195  rtara=2d0
196  rtarz=1d0
197  fermom=.07d0
198  elseif(ire.eq.3)then
199  amt=2.80923d0
200  rtara=3d0
201  rtarz=2d0
202  fermom=.164d0
203  elseif(ire.eq.4)then
204  amt=3.72742d0
205  rtara=4d0
206  rtarz=2d0
207  fermom=.164d0
208  elseif(ire.eq.14)then
209  amt=13.0438d0
210  rtara=14d0
211  rtarz=7d0
212  fermom=.221d0
213  call fordop
214  elseif(ire.eq.20)then
215  amt=18.6228d0
216  rtara=20d0
217  rtarz=10d0
218  fermom=.225d0
219  call fordop
220  elseif(ire.eq.84)then
221  amt=78.1631d0
222  rtara=84d0
223  rtarz=36d0
224  fermom=.260d0
225  call fordop
226  endif
227 
228 *-----------------------------
229  if (mcset_xmin.ge. 0.002) then
230  ntx=ntdis
231  write(*,*)
232  & ('Radiative corrections for DIS kinematics (xmin=0.002)')
233  elseif (mcset_xmin.ge. 1.e-09) then
234  ntx=ntpho
235  write(*,*)
236  & ('Radiative corrections for photoproduction (xmin=1.e-09)')
237  write(*,*)
238  & ('Elastic and quesielastric contributions set to ZERO !')
239  if(ixytest.gt.0 .and. mcset_xmin.lt.1.e-07) then
240  write(*,*)
241  & ('Xmin in lookup table = 1.e-07 --> extrapolation to 1.e-09')
242  endif
243  if(ixytest.eq.0 .and. mcset_xmin.lt.1.e-07) then
244  write(*,*)
245  & ('Xmin in lookup table = 1.e-07 --> change minimum x')
246  stop
247  endif
248  else
249  write(*,*)
250  & ('Minimum x value below minimum value of 10**-9 ! ')
251  stop
252  endif
253 
254 * initialize lookup table
255  if(ixytest.ge.0) then
256 
257 * number of x bins depending on x range desired
258 * finer grid at lower x values
259 * number of y bins = number of x bins (equidistant in y)
260 * (needed to avoid double loop - speed optimisation)
261  write(*,*) ('*********************************************')
262  write(*,*)
263  & ('Make sure that you did create the correct lookup table')
264  write(6,*) 'number of x bins in RC table = ',ntx
265  write(6,*) 'size of x bins in RC table depending on x'
266  nty=ntx
267  write(6,*) 'number of y bins in RC table = ',nty
268  write(6,*) 'size of y bins in RC table = ',
269  & (radgen_ymax-radgen_ymin)/(nty-1)
270  write(*,*) ('*********************************************')
271 
272  if(ixytest.eq.0) then
273  write(*,*)('RADGEN_INIT: Creating lookup table '//tname)
274  elseif (ixytest.eq.2) then
275  write(*,*)
276  + ('RADGEN_INIT: Loading lookup table '//tname)
277  endif
278  call xytabl(tname,mcset_enebeam,plrun,pnrun,ixytest,ire)
279  endif
280  END