COSMOS v7.655  COSMOSv7655
(AirShowerMC)
cMCSconstForMedia.f
Go to the documentation of this file.
1  subroutine cmcsconstformedia(md, pm, aMCS)
2 ! for this media, sampling table is read and
3 ! stored in aMCS.
4 ! It is assumed that pm = -1 comes first for a given md
5 ! and next call is for pm=1. So the file opened for
6 ! pm=-1 is kept open for pm=1. After it is read for
7 ! pm=1, the file will be closed.
8  use modmcscontrol
9  use modxsecmedia
10  use modmcs
11  implicit none
12 #include "Zmanager.h"
13 #include "Zmanagerp.h"
14  ! CosOrEpi is used from above
15  type(xsmedia),intent(in):: md ! media
16  integer,intent(in):: pm ! >0 for e+, < 0 for e-
17  type(mcsconst),intent(out):: aMCS
18 
19  integer::icon, ie
20 
21  if( cosorepi == "epics") then
22 ! filename is declared in modTPXS
23  if(mcsdir == " " ) then
24  mcsdir ="$EPICSTOP/Data/MCS/"
25  endif
26 ! filename="$EPICSTOP/Data/MCS/"//trim(md%name)
27  else
28  if(mcsdir == " " ) then
29  mcsdir ="$COSMOSTOP/Data/MCS/"
30  endif
31 ! filename="$COSMOSTOP/Data/MCS/"//trim(md%name)
32  endif
33  filename=trim(mcsdir)//trim(mcsparam)//"/"//trim(md%name)
34 
35  if( pm == -1 ) then
36  call copenf(tempdev, filename, icon)
37  if( icon /= 0 ) then
38  write(0,*) trim(filename), ' cannot be opened for MCS'
39  if( cosorepi == "epics") then
40  write(0,*) 'If the path: '
41  write(0,*) trim(mcsdir)//trim(mcsparam)
42  write(0,*)
43  * ' is correct, ',trim(md%name),' may be missing'
44  write(0,*) ' If so, you have to do next:'
45  write(0,*)
46  * '1: goto $EPICSTOP/Util/Elemag/MixedMCS'
47  write(0,*)
48  * '2: Edit paramdata file there: fix the 1st line'
49  write(0,*)
50  * ' Normally only 1st term may be given; (0.05~1.9)'
51  write(0,*) '3: then do'
52  write(0,'(a,a,a,a)') ' ./ForManyMedia.sh ',
53  * ' $EPICSTOP/Data/MCS/',trim(mcsparam),
54  * " "//trim(md%name)
55  endif
56  stop
57  endif
58  read(tempdev, *) ! skip 1 line which is C1forHardScat
59  call creadmcstab(tempdev, amcs)
60  read(tempdev, *)
61  elseif(pm == 1 ) then
62  call creadmcstab(tempdev, amcs)
63  close(tempdev)
64  else
65  write(0,*)' pm =',pm, ' invalid for cMCSconstForMedia'
66  stop
67  endif
68 
69  amcs%loglambdah(:) =log( amcs%lambdah(:) )
70 
71  ie = amcs%minNon0mucEindex ! for ie, 0 is stored
72  amcs%loglambdas1(ie:) =log( amcs%lambdas1(ie:) )
73  amcs%loglambdas2(ie:) =log( amcs%lambdas2(ie:) )
74  amcs%logmuc(ie:) =log( amcs%muc(ie:) )
75 
76  end subroutine cmcsconstformedia
subroutine cmcsconstformedia(md, pm, aMCS)
subroutine copenf(io, fnin, icon)
Definition: copenf.f:8