C   23/08/85 702101935  MEMBER NAME  MCTAGF   (S)           FORTRAN
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
      REAL FUNCTION MCTAGF(X,MARKMC)
C
C WEIGHTING FUNCTION FOR INTEGRATION OF TAGGING MC ENERGY DEPOSTION
C      THE FUNCTION DESCRIBES THE LATERAL SPREAD OF THE SHOWER ENERGY.
C      DIFFERENT VALUES ARE USED FOR DIFFERENT VALUES OF MARKMC,
C      BASED ON COMPARISON OF RESULTING THETA/PHI DISTRIBUTIONS
C      WITH LUMI EVENTS IN DATA.
C
C        AUTHOR: A.J.FINCH 8/3/84
C
C   LAST CHANGE: A.J.FINCH 9/2/87
C
C                         - SLOPE FOR MARK 2 TAGGER CHANGED FROM
C                        0.025 TO 0.039, TO OPTIMISE THETA DISTRIBUTION
C                        BY COMPARISION WITH LUMI EVENTS.
C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
C DATA SECTION
C
      DATA XMAX/190.0/
      DIMENSION SLOPE(10)
      DATA SLOPE  /0.025,2*0.039,7*0.0675/
      DATA SLOPE2/0.0325/
      DATA PERCEN/0.45/
      LOGICAL FIRST/.TRUE./
C
C INIIALISATION ON FIRST EVENT
C
      IF( FIRST ) CUTOFF = -(LOG(PERCEN)/SLOPE(4))
      FIRST = .FALSE.
C
C FOR MOST CASES USE SIMPLE SINGLE EXPONENTIAL, ...
C
      IF(MARKMC.GE.4.AND.X.GE.CUTOFF)GOTO 4
         MCTAGF=EXP(-1.0*X*SLOPE(MARKMC))
         RETURN
C
C HOWEVER FOR MARKMC = 4 (I.E.MARK III TAGGER) , AT LARGE X ...
C
 4    CONTINUE
         MCTAGF=PERCEN*EXP(-1.0*SLOPE2*(X-CUTOFF))
         IF(X.GT.XMAX)MCTAGF = 0.0
         RETURN
      END
