source: branches/start/MagicSoft/Simulation/Corsika/Mmcs/pigen1.f@ 19921

Last change on this file since 19921 was 286, checked in by harald, 25 years ago
This is the start point for further developments of the Magic Monte Carlo Simulation written by Jose Carlos Gonzales. Now it is under control of one CVS repository for the whole collaboration. Everyone should use this CVS repository for further developments.
File size: 8.0 KB
Line 
1 SUBROUTINE PIGEN1
2C
3C*********************************************************************
4C DESIGN : D. HECK IK3 FZK KARLSRUHE
5C DATE : JUL 31, 1989
6C*********************************************************************
7C THIS SUBROUTINE DESCRIBES THE PHOTONUCLEAR REACTION
8C GAMMA + NUCLEON -----> PION + NUCLEON
9C*********************************************************************
10 DOUBLE PRECISION BETA,DUMMY,ENUCL,ESQ,E3CM,GAMMA
11 DOUBLE PRECISION PEIG,PEOP,PT,PTRANS,P3CM,W0,W0I,W0S,W0SI
12*KEEP,ELABCT.
13 COMMON /ELABCT/ ELCUT
14 DOUBLE PRECISION ELCUT(4)
15*KEEP,PAM.
16 COMMON /PAM/ PAMA,SIGNUM
17 DOUBLE PRECISION PAMA(6000),SIGNUM(6000)
18*KEEP,PARPAR.
19 COMMON /PARPAR/ CURPAR,SECPAR,PRMPAR,OUTPAR,C,
20 * E00,E00PN,PTOT0,PTOT0N,THICKH,ITYPE,LEVL
21 DOUBLE PRECISION CURPAR(14),SECPAR(14),PRMPAR(14),OUTPAR(14),
22 * C(50),E00,E00PN,PTOT0,PTOT0N,THICKH
23 INTEGER ITYPE,LEVL
24*KEND.
25 DOUBLE PRECISION PI0MSQ
26 COMMON/PION/PI0MSQ,PITHR,PICMAS,PI0MAS,AMASK0,AMASKC,AMASPR,AMASNT
27 *
28*KEEP,RANDPA.
29 COMMON /RANDPA/ FAC,U1,U2,RD,NSEQ,ISEED,KNOR
30 DOUBLE PRECISION FAC,U1,U2
31 REAL RD(3000)
32 INTEGER ISEED(103,10),NSEQ
33 LOGICAL KNOR
34*KEEP,RUNPAR.
35 COMMON /RUNPAR/ FIXHEI,THICK0,HILOECM,HILOELB,
36 * STEPFC,NRRUN,NSHOW,PATAPE,MONIIN,
37 * MONIOU,MDEBUG,NUCNUC,
38 * CETAPE,
39 * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
40 * N1STTR,MDBASE,
41 * DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
42 * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
43 * ,GHEISH,GHESIG
44 COMMON /RUNPAC/ DSN,HOST,USER
45 DOUBLE PRECISION FIXHEI,THICK0,HILOECM,HILOELB
46 REAL STEPFC
47 INTEGER NRRUN,NSHOW,PATAPE,MONIIN,MONIOU,MDEBUG,NUCNUC,
48 * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
49 * N1STTR,MDBASE
50 INTEGER CETAPE
51 CHARACTER*79 DSN
52 CHARACTER*20 HOST,USER
53
54 LOGICAL DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
55 * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
56 * ,GHEISH,GHESIG
57*KEEP,STACKE.
58 COMMON/STACKE/ E,TIME,X,Y,Z,U,V,W,DNEAR,IQ,IGEN,IR,IOBS,LPCTE,NP
59 DOUBLE PRECISION E(60),TIME(60)
60 REAL X(60),Y(60),Z(60),U(60),V(60),W(60),DNEAR(60)
61 INTEGER IQ(60),IGEN(60),IR(60),IOBS(60),LPCTE(60),NP
62*KEND.
63 COMMON/UPHIOT/THETA,SINTHE,COSTHE,SINPHI, COSPHI,PI,TWOPI,PI5D2
64 COMMON/ACLOCK/NCLOCK,JCLOCK
65C_____IF (NCLOCK.GT.JCLOCK) THEN
66C______WRITE(MDEBUG,* )' PIGEN1:NP=',NP,' IR=',IR(NP),' IOBS=',IOBS(NP)
67C______CALL AUSGB2
68C_____END IF
69 IF(DEBUG)WRITE(MDEBUG,*)'PIGEN1: E=',E(NP)
70 PEIG=E(NP)
71C*** NUMBERS AT THE VARIABLES MEAN :
72C*** 1 INCOMING GAMMA RAY
73C*** 2 HIT NUCLEON
74C*** 3 PRODUCED PION
75C*** 4 RECOILING NUCLEON
76C*** LOOK WHICH TYPE OF REACTION
77 CALL RMMAR(RD,2,2)
78 RNNO91=RD(1)
79 RNNO92=RD(2)
80C*** 0.49923 IS THE FRACTION OF PROTONS IN AIR
81 IF (RNNO91.LE.0.49923) THEN
82C *** HIT NUCLEON IS PROTON
83 AMASS2=AMASPR
84C *** 33% CHANCE FOR CHARGE EXCHANGE
85 IF (RNNO92.LE.0.333333) THEN
86C *** PI(+) + NEUTRON PRODUCED
87 IQ(NP)=8
88 IQ(NP+1)=13
89 ELSE
90C *** PI(0) + PROTON PRODUCED
91 IQ(NP)=7
92 IQ(NP+1)=14
93 END IF
94 ELSE
95C *** HIT NUCLEON IS NEUTRON
96 AMASS2=AMASNT
97C *** 33% CHANCE FOR CHARGE EXCHANGE
98 IF (RNNO92.LE.0.333333) THEN
99C *** PI(-) + PROTON PRODUCED
100 IQ(NP)=9
101 IQ(NP+1)=14
102 ELSE
103C *** PI(0) + NEUTRON PRODUCED
104 IQ(NP)=7
105 IQ(NP+1)=13
106 END IF
107 END IF
108 AMAS2I=1./AMASS2
109C*** NOTE: THE ENERGIES IN EGS ARE IN MEV, IN CORSIKA IN GEV
110 AMASS3=PAMA(IQ(NP))*1.D3
111 AMASS4=PAMA(IQ(NP+1))*1.D3
112C*** TOTAL LABORATORY ENERGY AND ITS INVERSE
113 W0 =PEIG+AMASS2
114 W0I=1.D0/W0
115C*** TOTAL.C.M. ENERGY AND INVERSE OF TOTAL C.M.ENERGY
116 W0S = SQRT(AMASS2*(AMASS2+2.D0*PEIG))
117 W0SI=1.D0/W0S
118C*** THRESHOLD ENERGY
119 ETH=0.5*((AMASS3+AMASS4)**2-AMASS2**2)*AMAS2I
120C*** BETA,GAMMA, ESQ, BRATIO, G3 ARE AUXILIARY QUANTITIES
121 BETA=PEIG*W0I
122 GAMMA=W0*W0SI
123 ED =0.5*((AMASS3-AMASS4)**2-AMASS2**2)*AMAS2I
124 ESQ = SQRT((PEIG-ETH)*(PEIG-ED))
125 BRATIO = PEIG/ESQ
126 G3 = W0I*BRATIO*(PEIG-ETH+AMASS3*AMAS2I*(AMASS3+AMASS4))
127C*** C.M. ENERGY OF PION
128 E3CM=G3*AMASS2*GAMMA/BRATIO
129C*** C.M. PION MOMENTUM
130 P3CM=AMASS2*W0SI*ESQ
131 B3CM2=P3CM**2/(P3CM**2+AMASS3**2)
132 B3CM=SQRT(B3CM2)
133C*** DETERMINE THETA IN C.M. SYSTEM BY CHANCE.
134 IF (PEIG.LE.900.D0) THEN
135C *** PHOTON ENERGY IS BELOW 900 MEV
136210 CONTINUE
137 CALL RMMAR(RD,2,2)
138 RNNO93=RD(1)
139 RNNO94=RD(2)
140 IF (IQ(NP).EQ.7) THEN
141C *** NEUTRAL PION EMITTED, TAKE PURE
142C *** DIPOLE RADIATION: W(COSTH) = 1-3/5*COSTH**2
143 COSTE3 = 2.*RNNO93-1.
144 IF((RNNO94 .GT. 1.-0.6*COSTE3**2))GOTO 210
145 ELSE
146C *** CHARGED PION EMITTED, TAKE MODIFIED DIPOLE RADIATION
147C *** WITH ASYMMETRY TERM 1/(1-BETACM*COSTE3)**2
148 COSTE3 = 1./B3CM-1./(RNNO93*2.*B3CM2/(1.-B3CM2)+B3CM/(1.+B3CM))
149 IF((RNNO94*2.5 .GT. 1.+COSTE3*(-1.8+COSTE3*(.65+COSTE3*(.34 -.18
150 * *COSTE3 )))))GOTO 210
151 END IF
152 ELSE IF(PEIG.LE.1300.D0) THEN
153C *** PHOTON ENERGY BETWEEN 900 AND 1300 MEV
154220 CONTINUE
155 CALL RMMAR(RD,2,2)
156 RNNO93=RD(1)
157 RNNO94=RD(2)
158 IF (IQ(NP).EQ.7) THEN
159C *** NEUTRAL PION EMITTED, TAKE PURE QUADRUPOLE
160C *** RADIATION: W(COSTH) = 1+6*COSTH**2-5*COSTH**4
161 COSTE3 = 2.*RNNO93-1.
162 IF((2.8*RNNO94 .GT. 1.+6.*COSTE3**2-5.*COSTE3**4))GOTO 220
163 ELSE
164C *** CHARGED PION EMITTED, TAKE MODIFIED QUADRUPOLE
165C *** RADIATION WITH ASYMMETRY TERM: 1/(1-BETACM*COSTE3)**2
166 COSTE3 = 1./B3CM-1./(RNNO93*2.*B3CM2/(1.-B3CM2)+B3CM/(1.+B3CM))
167 IF((13.2*RNNO94 .GT. 1.+COSTE3*(-2.18+COSTE3*(7.20+COSTE3*(-2.55
168 * +COSTE3*(-15.39+COSTE3*(6.36+COSTE3*(13.80-COSTE3*8.235))))))))
169 * GOTO 220
170 END IF
171 ELSE
172C *** ABOVE 1300 MEV THE ANGULAR DISTRIBUTION IS DETERMINED
173C *** BY THE TRANSVERSE MOMENTUM OF THE PION
174 PT=1.D3*PTRANS(DUMMY)
175 COSTE3=SQRT(MAX(0.D0,P3CM**2-PT**2))/P3CM
176 END IF
177C*** PRECISE ENERGY OUTGOING PION = PEOP
178 PEOP =GAMMA*(E3CM+BETA*P3CM*COSTE3)
179C*** ENERGY OF OUTGOING PION IN STACK POSITION NP
180 E(NP)=PEOP
181C*** MOMENTUM OF OUTGOING PION = AMOM3
182C*** COSTHE AND SINTHE ARE ANGLES IN LAB SYSTEM FOR PARTICLE 3 (PION)
183C*** SEE SLAC-265, P. 52
184 AMOM3=SQRT(MAX(0.D0,PEOP**2-AMASS3**2))
185 IF (AMOM3.GT.0.) THEN
186 COSTHE=(AMASS4**2-AMASS2**2-AMASS3**2+2.*PEOP*W0-2.*PEIG*AMASS2)
187 * /(2.*PEIG* AMOM3)
188 ELSE
189 COSTHE=1.
190 END IF
191 SINTHE= SQRT(MAX(0.0,1.-COSTHE**2))
192 CALL UPHI(2,1)
193C*** TOTAL ENERGY OF RECOILING NUCLEON = ENUCL
194 ENUCL=W0-PEOP
195 IF ((ENUCL-AMASS4).GT.ELCUT(1)*1000.D0) THEN
196C *** RECOIL ENERGY IS TOO LARGE, MUST TREAT THE NUCLEON
197 NP=NP+1
198 E(NP)=ENUCL
199C *** MOMENTUM OF RECOIL NUCLEON
200 AMOM4=SQRT(ENUCL**2-AMASS4**2)
201C *** COSTHE AND SINTHE ARE ANGLES IN LAB SYSTEM FOR RECOIL NUCLEON
202C *** SEE SLAC-265, P. 52
203 COSTHE=(AMASS3**2-AMASS2**2-AMASS4**2+2.*ENUCL*W0-2.*PEIG*AMASS2)
204 * / (2. * PEIG*AMOM4)
205 SINTHE=-SQRT(MAX(0.0,1.-COSTHE**2))
206 CALL UPHI(3,2)
207 IF (W(NP).GT.C(29)) THEN
208C *** ANGLE WITH RESPECT TO X AXIS
209 IF (U(NP)**2+V(NP)**2.GT.3.E-38) THEN
210 ANGLEX = -ATAN2(V(NP),U(NP))
211 ELSE
212 ANGLEX = 0.
213 END IF
214C *** ADD NUCLEON TO CORSIKA STACK
215 SECPAR(1)=IQ(NP)
216 SECPAR(2)=E(NP)/AMASS4
217 SECPAR(3)=W(NP)
218 SECPAR(4)=ANGLEX
219 SECPAR(5)=-Z(NP)
220 SECPAR(6)=TIME(NP)
221 SECPAR(7)=X(NP)
222 SECPAR(8)=-Y(NP)
223 SECPAR(11)=1.D0
224 SECPAR(12)=0.D0
225 CALL TSTOUT
226 END IF
227C *** ELIMINATE NUCLEON FROM EGS-STACK
228 NP=NP-1
229 END IF
230C*** END OF RECOIL NUCLEON TREATEMENT CASE
231 RETURN
232 END
Note: See TracBrowser for help on using the repository browser.