5 * Revision 1.1.1.1 1996/03/06 15:37:34 mclareni
6 * Add geane321 source directories
9 #include "geant321/pilot.h"
10 *CMZ : 3.21/02 29/03/94 15.41.49 by S.Giani
12 SUBROUTINE ERTRAK (X1, P1, X2, P2, IPA, CHOPT)
14 ************************************************************************
16 * Perform the tracking of the track from point X1 to *
18 * (Before calling this routine the user should also provide *
19 * the input informations in /EROPTS/ and /ERTRIO/ *
20 * using subroutine EUFIL(L/P/V) *
21 * X1 - Starting coordinates (Cartesian) *
22 * P1 - Starting 3-momentum (Cartesian) *
23 * X2 - Final coordinates (Cartesian) *
24 * P2 - Final 3-momentum (Cartesian) *
25 * IPA - Particle code (a la GEANT) of the track *
28 * 'B' 'Backward tracking' - i.e. energy loss *
29 * added to the current energy *
30 * 'E' 'Exact' calculation of errors assuming *
31 * helix (i.e. pathlength not *
32 * assumed as infinitesimal) *
33 * 'L' Tracking upto prescribed Lengths reached *
34 * 'M' 'Mixed' prediction (not yet coded) *
35 * 'O' Tracking 'Only' without calculating errors *
36 * 'P' Tracking upto prescribed Planes reached *
37 * 'V' Tracking upto prescribed Volumes reached *
38 * 'X' Tracking upto prescribed Point approached *
40 * Interface with GEANT : *
41 * Track parameters are in /CGKINE/ and /GCTRAK/ *
43 * ==>Called by : USER *
44 * Authors M.Maire, E.Nagy ********* *
46 ************************************************************************
48 #include "geant321/gcbank.inc"
49 #include "geant321/gcnum.inc"
50 #include "geant321/gckine.inc"
51 #include "geant321/gctmed.inc"
52 #include "geant321/gctrak.inc"
53 #include "geant321/gcunit.inc"
54 #include "geant321/ertrio.inc"
55 #include "geant321/erwork.inc"
56 #include "geant321/trcom3.inc"
58 DIMENSION P1(3), P2(3), X1(3), X2(3), DUM(15), IOPT(30)
59 EQUIVALENCE (IOPT(1),IOPTB), (IOPT(2),IOPTE), (IOPT(3),IOPTL),
60 , (IOPT(4),IOPTM), (IOPT(5),IOPTO), (IOPT(6),IOPTP),
61 , (IOPT(7),IOPTV), (IOPT(8),IOPTX)
65 * *** Decode character option
68 CALL UOPTC (CHOPT, 'BELMOPVX', IOPT)
83 * *** Check consistency of the Ch-options
85 IF ((LELENG .AND. LEVOLU) .OR. (LELENG .AND. LEPLAN) .OR.
86 + (LEVOLU .AND. LEPLAN)) THEN
100 CALL VZERO (IEPRED , MXPRED)
101 CALL VZERO (ERXOUT , 3*MXPRED)
102 CALL VZERO (ERPOUT , 3*MXPRED)
103 CALL VZERO (ERROUT ,15*MXPRED)
109 PMOM2 = P1(1)**2 + P1(2)**2 + P1(3)**2
110 IF(PMOM2.LE.1.E-20) THEN
116 ERPIN(2) = ASIN (P1(3)*ERPIN(1))
117 IF (ABS (P1(1)) .LT. 1.E-30) P1(1) = 1.E-30
118 ERPIN(3) = ATAN2 (P1(2), P1(1))
120 * *** Initialize GCKINE common
122 IF((IPA.LE.0).OR.(IPA.GT.NPART)) THEN
123 WRITE (LOUT, 777) IPA
130 JPA = LQ(JPART-IPART)
132 NAPART(I) = IQ(JPA+I)
145 * *** Error matrix into SC System
148 IF (IFIELD.EQ.3) THEN
150 ELSEIF (IFIELD.NE.0) THEN
154 CALL TRSCSD (ERPIN(1), DUM(1), ERPIN(1), DUM(1), HI(1),
155 + CHARGE, IERR, SPU, ERPLI(1,1), ERPLI(1,2))
157 CALL TRSDSC (ERPIN(1), ERRIN(1), DUM(1), ERRIN(1), HI(1),
158 + CHARGE, IERR, SPU, ERPLI(1,1), ERPLI(1,2))
167 * *** Error matrix into direction of tracking
169 IF (BACKTR .LT. 0.) CALL ERBCER (ERRIN(1))
171 * *** Error matrix into double precision
180 PVERT(I) = P1(I)*BACKTR
183 * *** Initialize GCTRAK common
185 PVERT(4) = SQRT (PMOM2 + AMASS**2)
189 VECT(I+3) = PVERT(I)/VECT(7)
192 GEKIN = GETOT - AMASS
193 IF(GEKIN.LT.0.) GEKIN = 0.
196 * *** Additional EMC initialization
198 IF (.NOT.LEONLY) CALL ERPINI
200 * *** Ready for tracking
204 * *** Copy the final point and momentum into the output buffer
208 P2(I) = VECT(7)*BACKTR*VECT(I+3)
211 777 FORMAT(/,4X,'Error in ERTRAK : particle type ', I4,
212 * ' unknown in GEANT' )
213 778 FORMAT(/,4X,'Error in ERTRAK : Nul Momentum. Tracking stops now')
214 779 FORMAT(/,4X,'Error in ERTRAK : Inconsistent character options',
215 + '. Tracking stops now')
216 780 FORMAT(/,4X,'Error in ERTRAK : No prediction. Tracking stops now')