source: trunk/MagicSoft/Simulation/Corsika/Mmcs/pigen.f@ 6724

Last change on this file since 6724 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: 5.3 KB
Line 
1 SUBROUTINE PIGEN
2C
3C*********************************************************************
4C DESIGN : D. HECK IK3 FZK KARLSRUHE
5C DATE : JUL 31, 1989
6C*********************************************************************
7C THIS SUBROUTINE STEERS THE PHOTONUCLEAR REACTION:
8C FOR PRODUCTION OF 1 PION, PIGEN1 IS CALLED.
9C FOR PRODUCTION OF 2 PIONS, PIGEN2 IS CALLED.
10C FOR PRODUCTION OF MORE PARTICLES, SDPM IS CALLED.
11C*********************************************************************
12 DOUBLE PRECISION PEIG,REGPAR,REGGEN,REGLVL
13 DOUBLE PRECISION ENERN
14 DIMENSION REGPAR(12)
15*KEEP,BUFFS.
16 COMMON /BUFFS/ RUNH,RUNE,EVTH,EVTE,DATAB,LH
17 INTEGER MAXBUF,MAXLEN
18 PARAMETER (MAXBUF=39*7)
19 PARAMETER (MAXLEN=12)
20 REAL RUNH(MAXBUF),EVTH(MAXBUF),EVTE(MAXBUF),
21 * RUNE(MAXBUF),DATAB(MAXBUF)
22 INTEGER LH
23 CHARACTER*4 CRUNH,CRUNE,CEVTH,CEVTE
24 EQUIVALENCE (RUNH(1),CRUNH), (RUNE(1),CRUNE)
25 EQUIVALENCE (EVTH(1),CEVTH), (EVTE(1),CEVTE)
26*KEEP,GENER.
27 COMMON /GENER/ GEN,ALEVEL
28 DOUBLE PRECISION GEN,ALEVEL
29*KEEP,PAM.
30 COMMON /PAM/ PAMA,SIGNUM
31 DOUBLE PRECISION PAMA(6000),SIGNUM(6000)
32*KEEP,PARPAR.
33 COMMON /PARPAR/ CURPAR,SECPAR,PRMPAR,OUTPAR,C,
34 * E00,E00PN,PTOT0,PTOT0N,THICKH,ITYPE,LEVL
35 DOUBLE PRECISION CURPAR(14),SECPAR(14),PRMPAR(14),OUTPAR(14),
36 * C(50),E00,E00PN,PTOT0,PTOT0N,THICKH
37 INTEGER ITYPE,LEVL
38*KEEP,RANDPA.
39 COMMON /RANDPA/ FAC,U1,U2,RD,NSEQ,ISEED,KNOR
40 DOUBLE PRECISION FAC,U1,U2
41 REAL RD(3000)
42 INTEGER ISEED(103,10),NSEQ
43 LOGICAL KNOR
44*KEEP,RUNPAR.
45 COMMON /RUNPAR/ FIXHEI,THICK0,HILOECM,HILOELB,
46 * STEPFC,NRRUN,NSHOW,PATAPE,MONIIN,
47 * MONIOU,MDEBUG,NUCNUC,
48 * CETAPE,
49 * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
50 * N1STTR,MDBASE,
51 * DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
52 * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
53 * ,GHEISH,GHESIG
54 COMMON /RUNPAC/ DSN,HOST,USER
55 DOUBLE PRECISION FIXHEI,THICK0,HILOECM,HILOELB
56 REAL STEPFC
57 INTEGER NRRUN,NSHOW,PATAPE,MONIIN,MONIOU,MDEBUG,NUCNUC,
58 * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
59 * N1STTR,MDBASE
60 INTEGER CETAPE
61 CHARACTER*79 DSN
62 CHARACTER*20 HOST,USER
63
64 LOGICAL DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
65 * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
66 * ,GHEISH,GHESIG
67*KEEP,STACKE.
68 COMMON/STACKE/ E,TIME,X,Y,Z,U,V,W,DNEAR,IQ,IGEN,IR,IOBS,LPCTE,NP
69 DOUBLE PRECISION E(60),TIME(60)
70 REAL X(60),Y(60),Z(60),U(60),V(60),W(60),DNEAR(60)
71 INTEGER IQ(60),IGEN(60),IR(60),IOBS(60),LPCTE(60),NP
72*KEND.
73 COMMON/ACLOCK/NCLOCK,JCLOCK
74C_____IF (NCLOCK.GT.JCLOCK) THEN
75C______WRITE(MDEBUG,* )' PIGEN: NP=',NP,' IR=',IR(NP),' IOBS=',IOBS(NP)
76C______CALL AUSGB2
77C_____END IF
78 IF(DEBUG)WRITE(MDEBUG,*)'PIGEN : E=',E(NP)
79C*** INCREASE AGE, WE HAVE HADRONIC INTERACTION
80 IGEN(NP)=IGEN(NP)+1
81 SECPAR(9)=IGEN(NP)
82 SECPAR(10)=-Z(NP)
83 PEIG=E(NP)
84 IF (U(NP)**2+V(NP)**2.GT.3.E-38) THEN
85 ANGLEX = -ATAN2(V(NP),U(NP))
86 ELSE
87 ANGLEX = 0.
88 END IF
89C *** SUBTRACT EM SUBSHOWER FROM NKG CALCULATION
90 IF ( FNKG ) THEN
91 SECPAR(3) = W(NP)
92 SECPAR(4) = ANGLEX
93 SECPAR(5) = -Z(NP)
94 ENERN = -PEIG*1.D-3
95 CALL NKG(ENERN)
96 ENDIF
97 CALL RMMAR(RNNO90,1,2)
98 IF (RNNO90.GT.(PEIG-400.D0)/1000.D0) THEN
99C *** FOR ENERGIES BETWEEN 400 MEV AND 1400 MEV (=1000+400) DECIDE
100C *** BY CHANCE WHETHER ONE OR TWO PIONS ARE GENERATED
101C *** PIGEN1 TREATES THE PRODUCTION OF 1 PION
102 CALL PIGEN1
103 ELSE IF(RNNO90.GT.(PEIG-2000.D0)/1000.D0) THEN
104C *** FOR ENERGIES BETWEEN 2000MEV AND 3000MEV (=1000+2000) DECIDE
105C *** BY CHANCE WHETHER 2 (PIGEN2) OR MORE PIONS (DPM) ARE GENERATED
106C *** PIGEN2 TREATES THE PRODUCTION OF 2 PIONS
107 CALL PIGEN2
108 ELSE
109C *** AT HIGHER ENERGIES MORE THAN 2 PIONS ARE GENERATED BY
110C *** THE DUAL PARTON MODEL, BY VENUS, BY SIBYLL, BY QGS, OR BY DPMJET
111 DO 191 K=1,MAXLEN
112C *** SAVE CURPAR PARTICLE INTO REGISTER REGPAR
113 REGPAR(K)=CURPAR(K)
114191 CONTINUE
115192 CONTINUE
116 REGGEN = GEN
117 REGLVL = ALEVEL
118C *** FILL CURRENT EGS4-PARTICLE INTO CURPAR
119 ITYPE=1
120 CURPAR(1)=1.D0
121 CURPAR(2)=PEIG*1.D-3
122 CURPAR(3)=W(NP)
123 CURPAR(4)=ANGLEX
124 CURPAR(5)=-Z(NP)
125 CURPAR(6)=TIME(NP)
126 CURPAR(7)=X(NP)
127 CURPAR(8)=-Y(NP)
128 CURPAR(9)=0.D0
129 CURPAR(10)=1.D0
130 CURPAR(12)=SQRT(PAMA(14)*(PAMA(14)+PEIG*2.D-3))
131 CURPAR(11)=(PEIG*1.D-3+PAMA(14))/CURPAR(12)
132 GEN = IGEN(NP)
133 ALEVEL = -Z(NP)
134C *** ELIMINATE GAMMA FROM EGS-STACK
135 NP=NP-1
136C *** HDPM, VENUS, SIBYLL, QGS, DPMJET GIVE ALL PARTICLES TO SECPAR
137 CALL TSTINI
138 CALL SDPM
139 CALL TSTEND
140 DO 201 K=1,MAXLEN
141C *** RESTORE CURPAR PARTICLE FROM REGPAR
142 CURPAR(K)=REGPAR(K)
143201 CONTINUE
144202 CONTINUE
145 GEN = REGGEN
146 ALEVEL = REGLVL
147C *** END OF MANY PION GENERATION
148 END IF
149 RETURN
150 END
Note: See TracBrowser for help on using the repository browser.