source: trunk/MagicSoft/Simulation/Corsika/Mmcs/mupair.f@ 378

Last change on this file since 378 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: 7.0 KB
Line 
1 SUBROUTINE MUPAIR
2C
3C*********************************************************************
4C DESIGN : D. HECK IK3 FZK KARLSRUHE
5C DATE : JUL 15, 1988
6C*********************************************************************
7C IN ANALOGY WITH THE SUBROUTINE PAIR.
8C FOR A PHOTON ENERGY LESS THAN 434 MEV, THE APPROXIMATION IS
9C MADE THAT THE ENERGY OF ONE POSITIVE OR NEGATIVE MUON IS
10C UNIFORMLY DISTRIBUTED IN THE INTERVAL (RMMU, EIG/2) =
11C (MUON REST MASS, PHOTON ENERGY/2).
12C FOR PHOTON ENERGY ABOVE 434 MEV THE
13C COULOMB CORRECTED BETHE-HEITLER CROSS SECTION IS USED.
14C (BUTCHER AND MESSEL, OP. CIT., P. 17-19, 22).
15C ========== THIS MAY BE INCORRECT ==========
16C*********************************************************************
17 DOUBLE PRECISION PEIG,PESE1,PESE2
18 DOUBLE PRECISION ENERN
19 COMMON/BREMPR/DL1(6),DL2(6),DL3(6),DL4(6),DL5(6),DL6(6),DELCM, ALP
20 *HI(2),BPAR(2),DELPOS(2),PWR2I(50)
21 DOUBLE PRECISION PRRMMU
22 COMMON/MUON/PRRMMU,RMMU,RMMUT2
23*KEEP,PARPAR.
24 COMMON /PARPAR/ CURPAR,SECPAR,PRMPAR,OUTPAR,C,
25 * E00,E00PN,PTOT0,PTOT0N,THICKH,ITYPE,LEVL
26 DOUBLE PRECISION CURPAR(14),SECPAR(14),PRMPAR(14),OUTPAR(14),
27 * C(50),E00,E00PN,PTOT0,PTOT0N,THICKH
28 INTEGER ITYPE,LEVL
29*KEEP,POLAR.
30 COMMON /POLAR/ POLART,POLARF
31 DOUBLE PRECISION POLART,POLARF
32*KEEP,RANDPA.
33 COMMON /RANDPA/ FAC,U1,U2,RD,NSEQ,ISEED,KNOR
34 DOUBLE PRECISION FAC,U1,U2
35 REAL RD(3000)
36 INTEGER ISEED(103,10),NSEQ
37 LOGICAL KNOR
38*KEEP,RUNPAR.
39 COMMON /RUNPAR/ FIXHEI,THICK0,HILOECM,HILOELB,
40 * STEPFC,NRRUN,NSHOW,PATAPE,MONIIN,
41 * MONIOU,MDEBUG,NUCNUC,
42 * CETAPE,
43 * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
44 * N1STTR,MDBASE,
45 * DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
46 * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
47 * ,GHEISH,GHESIG
48 COMMON /RUNPAC/ DSN,HOST,USER
49 DOUBLE PRECISION FIXHEI,THICK0,HILOECM,HILOELB
50 REAL STEPFC
51 INTEGER NRRUN,NSHOW,PATAPE,MONIIN,MONIOU,MDEBUG,NUCNUC,
52 * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
53 * N1STTR,MDBASE
54 INTEGER CETAPE
55 CHARACTER*79 DSN
56 CHARACTER*20 HOST,USER
57
58 LOGICAL DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
59 * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
60 * ,GHEISH,GHESIG
61*KEEP,STACKE.
62 COMMON/STACKE/ E,TIME,X,Y,Z,U,V,W,DNEAR,IQ,IGEN,IR,IOBS,LPCTE,NP
63 DOUBLE PRECISION E(60),TIME(60)
64 REAL X(60),Y(60),Z(60),U(60),V(60),W(60),DNEAR(60)
65 INTEGER IQ(60),IGEN(60),IR(60),IOBS(60),LPCTE(60),NP
66*KEND.
67 COMMON/THRESH/RMT2,RMSQ,ESCD2,AP,API,AE,UP,UE,TE,THMOLL
68 COMMON/UPHIOT/THETA,SINTHE,COSTHE,SINPHI, COSPHI,PI,TWOPI,PI5D2
69 DOUBLE PRECISION PZERO,PRM,PRMT2,RMI,VC
70 COMMON/USEFUL/PZERO,PRM,PRMT2,RMI,VC,RM,MEDIUM,MEDOLD,IBLOBE,ICALL
71 COMMON/ACLOCK/NCLOCK,JCLOCK
72C_____IF (NCLOCK.GT.JCLOCK) THEN
73C______WRITE(MDEBUG,* )' MUPAIR:NP=',NP,' IR=',IR(NP),' IOBS=',IOBS(NP)
74C______CALL AUSGB2
75C_____END IF
76 IF(DEBUG)WRITE(MDEBUG,*)'MUPAIR: E=',E(NP)
77 IGEN(NP) = IGEN(NP) + 1
78C*** PRECISE ENERGY OF INCIDENT GAMMA
79 PEIG=E(NP)
80C *** SUBTRACT EM SUBSHOWER FROM NKG CALCULATION
81 IF ( FNKG ) THEN
82 SECPAR(3) = W(NP)
83 IF (U(NP)**2+V(NP)**2.GT.3.E-38) THEN
84 ANGLEX = -ATAN2(V(NP),U(NP))
85 ELSE
86 ANGLEX = 0.
87 END IF
88 SECPAR(4) = ANGLEX
89 SECPAR(5) = -Z(NP)
90 ENERN = -PEIG*1.D-3
91 CALL NKG(ENERN)
92 ENDIF
93C*** ENERGY OF INCIDENT GAMMA
94 EIG=PEIG
95 IF (EIG.LE.434.) THEN
96C *** BELOW 434.MEV, WE ASSUME UNIFORM ENERGY
97C *** DISTRIBUTION OF THE MUON #2 IN THE INTERVAL (RMMU, EIG/2).
98C *** SEE ALSO SLAC-265, P.49 FOR FURTHER DISCUSSION.
99 CALL RMMAR(RNNO29,1,2)
100 ESE2=(EIG*0.5-RMMU)*RNNO29+RMMU
101 ELSE
102C *** ABOVE 434.MEV, MUST SAMPLE
103C *** COULOMB CORRECTED(LVX=2,LVL=4,6) CROSS SECTIONS.
104C *** SEE RELATED COMMENTS IN BREMS.
105 LVX=2
106 LVL0=3
107181 CONTINUE
108C *** RETRY IF REJECTED BECAUSE DEL OUT OF RANGE, OR BY SCREENING
109C *** WE'LL NEED AT LEAST ONE RANDOM NUMBER
110 CALL RMMAR(RD,2,2)
111 RNNO30=RD(1)
112C *** NOW DECIDE WHICH OF THE TWO SUBDISTRIBUTIONS TO USE.
113 RNNO31=RD(2)
114 IF (RNNO31.GE.BPAR(LVX)) THEN
115C *** USE THE SUBDISTRIBUTION THAT IS PROPORTIONAL TO
116C *** 12*(BR-0.5)**2. IT USES A(DELTA) FOR SCREENING FUNCTION
117 LVL=LVL0+1
118 CALL RMMAR(RD,2,2)
119 RNNO32=RD(1)
120 RNNO33=RD(2)
121C *** FROM SYMMETRY, ONLY NEED TO SAMPLE BR IN INTERVAL (0,.5)
122 BR=0.5*(1.0-MAX(RNNO32,RNNO33,RNNO30))
123 ELSE
124C *** USE THE SUBDISTRIBUTION THAT IS PROPORTIONAL TO 1,I.E.
125C *** UNIFORM.IT USES C(DELTA) FOR A SCREENING REJECT FUNCTION
126 LVL=LVL0+3
127 BR=RNNO30*0.5
128 END IF
129C *** THE SCREENING FUNCTIONS ARE FUNCTIONS OF DELTA=DELCM*DEL,
130C *** WHERE DELCM= 136.0*EXP(ZG)*RM (SAME AS FOR BREMS)
131C *** AND WHERE DEL=1./(EG0*BR*(1.0-BR))
132C *** WITH EG0 = INCIDENT PHOTON ENERGY AND BR=ENERGY FRACTION.
133 IF((BR.EQ.0.0))GO TO181
134C *** TO AVOID DIVISION BY ZERO
135 DEL=1.0/(EIG*BR*(1.0-BR))
136 IF((DEL.GE.(RM/RMMU)*DELPOS(LVX)))GO TO181
137C *** NEXT TRY
138C *** THE PRECEDING CONDITION ENSURES THAT A(DELTA) AND C(DELTA)
139C *** WILL BE POSITIVE. IF IT IS NOT SATISFIED,LOOP BACK AND TRY
140C *** ANOTHER SAMPLE.
141 DELTA=(RMMU*RMI)*DELCM*DEL
142 IF (DELTA.LT.1.0) THEN
143 REJF=DL1(LVL)+DELTA*(DL2(LVL) +DELTA*DL3(LVL))
144 ELSE
145 REJF=DL4(LVL)+DL5(LVL) *LOG(DELTA+DL6(LVL))
146 END IF
147C *** RANDOM NUMBER FOR SCREENING REJECTION
148 CALL RMMAR(RNSCRN,1,2)
149C *** RETRY UNTIL ACCEPTED
150 IF((RNSCRN.LE.REJF))GO TO182
151 GO TO 181
152182 CONTINUE
153C *** BR=PRODUCT ENERGY FRACTION
154C *** ENERGY OF SECONDARY 'MUON' #2
155 ESE2=BR*EIG
156C *** END OF EIG.GT.434 ELSE
157 END IF
158C*** ENERGY GOING TO LOWER SECONDARY HAS NOW BEEN DETERMINED
159C*** PRECISE ENERGY OF SECONDARY 'MUON' 2
160 PESE2=ESE2
161C*** PRECISE ENERGY OF SECONDARY 'MUON' 1
162 PESE1=PEIG-PESE2
163 E(NP)=PESE1
164 E(NP+1)=PESE2
165C*** THIS AVERAGE ANGLE OF EMISSION FOR BOTH PAIR PRODUCTION AND
166C*** BREMSSTRAHLUNG IS MUCH SMALLER THAN THE AVERAGE ANGLE OF
167C*** MULTIPLE SCATTERING FOR DELTA T TRANSPORT=0.01 R.L.
168C*** THE INITIAL AND FINAL MOMENTA ARE COPLANAR
169C*** SET UP A NEW 'MUON'
170 THETA=RMMU/EIG
171 CALL UPHI(1,1)
172C*** SET UP A NEW 'MUON'
173 NP=NP+1
174 SINTHE=-SINTHE
175 CALL UPHI(3,2)
176C*** NOW RANDOMLY DECIDED WHICH IS POSITIVE MUON, AND SET
177C*** CHARGES ACCORDINGLY
178 CALL RMMAR(RNNO34,1,2)
179 IF (RNNO34.LE.0.5) THEN
180C *** POSITIVE MUON ON TOP
181 IQ(NP)=5
182 IQ(NP-1)=6
183 ELSE
184C *** NEGATIVE MUON ON TOP
185 IQ(NP)=6
186 IQ(NP-1)=5
187 END IF
188 CALL RMMAR(RD,2,2)
189 RNPOLT=RD(1)
190 RNPOLF=RD(2)
191 POLART=2.*RNPOLT-1.
192 POLARF=TWOPI*RNPOLF
193 RETURN
194 END
Note: See TracBrowser for help on using the repository browser.