COSMOS v7.655  COSMOSv7655
(AirShowerMC)
cintModels.f
Go to the documentation of this file.
1 ! *******************
2  subroutine cintmodels(from)
3 !
4 ! establish the energy bound for the given interaction model.
5 ! and corresponding init.
6  implicit none
7 #include "Zmanagerp.h"
8 #include "Zmanager.h"
9 #include "Zevhnp.h"
10 #include "Zptcl.h"
11 #include "Zevhnv.h"
12 
13  character*(*) from ! input. cosmos or epics ; from which
14 
15  integer i, j
16  character*100 path
17 
18  cosorepi = from
19  call cgettopdir ! get Cosmos top dir and set it in Zmanager.h
20 
21  do i = 1, maxintmdls
22  modellist(i) = ' '
23  inteerg(i) = 2.d12 ! GeV 10^21 eV
24  modellist2(i) = ' '
25  inteerg2(i) = 2.d12 ! GeV 10^21 eV
26  enddo
27 ! ModelList InteErg
28 ! "xxx" 100.
29 ! "yyy" 1.d12 ====> xxx if E< 100 else yyy
30 !
31 ! "xxx" 1.d12 ====> xxx at entier energy.
32 !
33  intmodel(64:64) = '/'
34  if( xsecmodel == " ") then
35  xsecmodel = intmodel
36  else
37  xsecmodel(64:64) = '/'
38  endif
39 
40  read(intmodel, *, err=100)
41  * (modellist(i), inteerg(i), i=1, maxintmdls)
42  read(xsecmodel, *, err=100)
43  * (modellist2(i), inteerg2(i), i=1, maxintmdls)
44 
45  do i = 1, maxintmdls
46  if(modellist(i) .eq. ' ') then
47  noofmdls = i-1
48  goto 10
49  endif
50  enddo
51  noofmdls = maxintmdls
52  10 continue
53  do i = 1, maxintmdls
54  if(modellist2(i) .eq. ' ') then
55  noofmdls2 = i-1
56  goto 20
57  endif
58  enddo
59  noofmdls2 = maxintmdls
60  20 continue
61 
62  do i = 1, noofmdls-1
63 ! if(InteErg(i) .ge. InteErg(i+1)) then
64  if(inteerg(i) > inteerg(i+1)) then ! v7.633
65 ! energy region invalid
66  call cerrormsg(
67  * 'IntModel is invalid; energy region not ascending', 1)
68  call cerrormsg(intmodel, 0)
69  elseif(inteerg(i) == inteerg(i+1)) then ! v7.633
70 ! a model written between(i) and (i+1)
71 ! will not be used explicitly but initialization
72 ! is tried. It might be used as a rescuee when a
73 ! some model cannot cope with a specific particle.
74  ! issue some message
75  write(0,*) '================================='
76  write(0,*)
77  * i,'-th and ',i+1,'-th energy in IntModel are same'
78  write(0,*) 'The model specified is ',modellist(i+1), '.'
79  write(0,*) 'It will not be used explicitly but might be'
80  write(0,*) 'used when some model needs help for a '
81  write(0,*) 'specific particle. dpmjet3 is a good '
82  write(0,*) 'candidate of such a model'
83  write(0,*) '================================='
84  endif
85 
86  enddo
87  if( noofmdls2 /= noofmdls .or.
88  & any(inteerg(1:noofmdls) /= inteerg2(1:noofmdls)) ) then
89  do i = 1, noofmdls2-1
90  if(inteerg2(i) > inteerg2(i+1)) then
91 ! energy region invalid
92  call cerrormsg(
93  * 'XsecModel is invalid; energy region not ascending', 1)
94  call cerrormsg(xsecmodel, 0)
95  elseif(inteerg2(i) == inteerg2(i+1)) then
96  write(0,*) '================================='
97  write(0,*)
98  * i,'-th and ',i+1,'-th energy in IntModel are same'
99  write(0,*) 'The model specified is ',modellist2(i+1), '.'
100  write(0,*) 'It will not be used explicitly but might be'
101  write(0,*) 'used when some model needs help for a '
102  write(0,*) 'specific particle. dpmjet3 is a good '
103  write(0,*) 'candidate of such a model'
104  write(0,*) '================================='
105  endif
106  enddo
107  endif
108 ! exam models
109  do i = 1, noofmdls
110  do j = 1, nmdls
111  if( modellist(i) .eq. regmdls(j) ) goto 25
112  enddo
113  call cerrormsg( modellist(i), 1)
114  call cerrormsg('above model is not yet registered', 0)
115  25 continue
116  enddo
117 ! exam models
118  do i = 1, noofmdls2
119  do j = 1, nmdls
120  if( modellist2(i) .eq. regmdls(j) ) goto 28
121  enddo
122  call cerrormsg( modellist2(i), 1)
123  call cerrormsg('above model is not yet registered', 0)
124  28 continue
125  enddo
126 
127 !
128  if( index(intmodel, 'fritiof1.6') .gt. 0 .or.
129  * index(intmodel, 'nucrin') .gt. 0 .or.
130  * index(intmodel, 'dpmjet3') .gt. 0 .or.
131  * index(intmodel, 'incdpm3') .gt. 0 .or.
132  * index(intmodel, 'jam') .gt. 0 ) then
133 
134 ! for Lund init. dpm may use Lund at low energy or
135 ! for some particles
136  call haddenc
137  call chanwnc
138  endif
139  if( index(intmodel, 'phits') .gt. 0 .or.
140  * index(xsecmodel, 'phits') .gt. 0 ) then
141  call cprephits
142  endif
143  if( index(intmodel, 'qgsjet2') .gt. 0 .or.
144  * index(xsecmodel, 'qgsjet2') .gt. 0 ) then
145  call ciniqgs
146  endif
147  if( index(intmodel, 'epos') .gt. 0 .or.
148  * index(xsecmodel, 'epos') .gt. 0 ) then
149  call ceposiniall
150  endif
151  if( index(intmodel, 'sibyll') > 0 .or.
152  * index(xsecmodel, 'sibyll') > 0 ) then
153  call csibyllinit
154  endif
155  if( index(intmodel, 'incdpm3') .gt. 0 ) then
156  call ciniincdpm3
157  endif
158 
159  if( index(intmodel, 'gheisha' ) .gt. 0) then
160 ! Gheisha; init. Gheisha cannot use hadrin/nucrin in Cosmos
161  call gpart
162  call gheini
163  endif
164  if( index(intmodel, 'jam' ) .gt. 0) then
165  ! nothing to do ?
166  endif
167  if( index(intmodel, 'dpmjet3') .gt. 0 .or.
168  * index(xsecmodel, 'dpmjet3') .gt. 0 .or.
169  * index(intmodel, 'incdpm3') .gt. 0 ) then
170  if(from .eq. 'cosmos') then
171  ! init for dpmjet. for Cosmos
172  ! If DpmFile is ' ',
173  ! $COSMOSTOP/Data/atmos.inp is the control card for dpmjet3.
174  If( dpmfile .eq. ' ' ) then
175  call cformfullpath('atmos.inp', path)
176  call cinidpmjet(path)
177  else
178  call cinidpmjet(dpmfile)
179  endif
180  elseif(from .eq. 'check') then
181 ! it is assumed that the Glauber file is
182 ! specified by prefix/...GLB
183 
184  elseif(from == 'epics' .or. from == 'gencol') then
185 ! dpmjet.inp is assumed in the same directory
186 ! as config file.
187  call cformfullpath('dpmjet.inp', path)
188  call cinidpmjet(path)
189  else
190  call cerrormsg(from, 1)
191  call cerrormsg('above "from" in cintModels invalid',0)
192  endif
193  endif
194  return
195 
196  100 continue
197  call cerrormsg(
198  * 'IntModel syntax error; prob.missing " mark'//
199  * ' for string; IntModel is', 1)
200  call cerrormsg(intmodel, 0)
201  end
202 
203 !
204 ! next is for dpmjet file management.
205 ! dpmfiles for Epcis is assumed to be in the
206 ! same directory as config file resides so
207 ! extract the directory where the config file is.
208  subroutine cfixprefix(dsn)
209  implicit none
210 #include "Zmanager.h"
211  character*(*) dsn ! input. config file name or path
212 ! output. PrefixConf= './' or '/.../.../' where
213 ! config file exist.
214 ! PrefixLeng is it's length.
215 !
216 !
217  integer i, j, klena, k
218 
219  if( index(dsn, '/') .eq. 0 ) then
220  prefixconf = './'
221  prefixleng = 2
222  else
223 ! find last '/'
224  i = klena(dsn)
225  do j = i, 1, -1
226  k = index(dsn(j:j), '/')
227  if( k .gt. 0 ) then
228  prefixconf = dsn(1:j)
229  prefixleng = j
230  goto 33
231  endif
232  enddo
233  endif
234  33 continue
235  end
236 ! *********** get Cosmos Top director
237 ! and set it in TopDir in Zmanager.h
238  subroutine cgettopdir
239  implicit none
240 #include "Zmanager.h"
241 
242 
243  character*1 NULL
244  integer kgetenv
245 
246  null = char(0)
247  topdir = ' '
248  topdirleng = kgetenv("COSMOSTOP"//null, topdir)
249  end
250 
251  subroutine csetcosorepi(from)
252  implicit none
253 #include "Zmanager.h"
254  character*(*) from ! input. cosmos or epics
255  cosorepi = from
256  end
257 
258  subroutine cformfullpath(file, path)
259  implicit none
260 #include "Zmanager.h"
261  character*(*) file ! input. file name
262  character*(*) path ! output. $COSMOSTOP/Data/DPM/file
263  integer klena
264 
265  path = ' '
266 
267  if(cosorepi .eq. 'cosmos') then
268  path = topdir(1:topdirleng)//'/Data/DPM/'
269  * //file(1:klena(file))
270  elseif(cosorepi == 'epics' .or. cosorepi == 'check'
271  * .or. cosorepi == 'gencol') then
272  path = prefixconf(1:prefixleng)//file(1:klena(file))
273  else
274  call cerrormsg(
275  * "cintModels('cosmos') or cintModels('epics')"//
276  * " must have been called ", 0)
277  endif
278 
279  end
280  subroutine cputgencolcms(cms)
281 ! this is introduced for EPOS
282 ! to save the single precision boost in EPOS
283 ! call afinal is avoided to convert cms to lab
284 ! conversion of which result becomes not accurate
285 ! if we convet it to cms again. (Gencol needs to do so)
286 !
287  implicit none
288 #include "Zptcl.h"
289  type(ptcl):: cms ! input. Gencol must
290  ! inform the cms (/n)
291 
292  common /forgencol/ cmssave
293  type(ptcl):: cmsSave
294  cmssave = cms
295  end
296  subroutine cqgencolcms(cms)
297 ! ask gencol cms
298 !
299  implicit none
300 #include "Zptcl.h"
301  type(ptcl):: cms ! outut.
302  common /forgencol/ cmssave
303  type(ptcl):: cmsSave
304  cms = cmssave
305  end
subroutine cerrormsg(msg, needrtn)
Definition: cerrorMsg.f:4
subroutine csetcosorepi(from)
Definition: cintModels.f:252
subroutine cintmodels(from)
Definition: cintModels.f:3
subroutine cformfullpath(file, path)
Definition: cintModels.f:259
subroutine cqgencolcms(cms)
Definition: cintModels.f:297
subroutine cgettopdir
Definition: cintModels.f:239
subroutine cputgencolcms(cms)
Definition: cintModels.f:281
subroutine cfixprefix(dsn)
Definition: cintModels.f:209
Definition: Zptcl.h:75