C   22/03/97 703221634  MEMBER NAME  JEOSUM1  (JADEMUS)     FVS
C   22/03/97 703221633  MEMBER NAME  #MUPR    (JADEMUS)     FVS
//F22MCCP3 JOB 10622622,CLASS=L,TIME=(01,00),MSGLEVEL=(1,1)
//*MAIN LINES=(9),RELPRI=HIG,ORG=EXT
// EXEC FCLG,REGION.GO=896K
      IMPLICIT INTEGER*2 (H)
      DATA IVERSN/20/
C-------------------------------------
#include "cdata.for"
#include "ciouni.for"
#include "cmucalib.for"
#include "cmuffl.for"
C
      INTEGER*4 UN,UN1,SECT
      COMMON/CWORK/IDUMMY
      COMMON /TRAX/ PHIT(40),THETAT(40),NHRPHI(40)
C
C----------------------------------------------------------------------
      COMMON /CDEV/ ITRAK,ND,NDHIT(20),NDCHAM(20),XDEV(20),SDEV(20)
C
C  CDEV IS THE 'DEVIATIONS COMMON'.
C
C  I  ITRAK        IS THE CURRENT TRACK NO. IN CALLING PROGRAM;
C  O  ND           IS THE NO. OF HITS FOR WHICH DEVIATIONS ARE OUTPUT
C                  FOR THIS TRACK. THIS IS DEPENDENT ON MUFFLD   ;
C  O  NDHIT(1->ND) ARE THE HIT NOS OF THESE HITS ;
C  O  NDCHAM( "  ) ARE THE CHAMBER NOS OF THESE HITS ;
C  O  XDEV  ( "  ) ARE THE ABSOLUTE DEVIATIONS OF THESE HITS FROM THE
C                  EXTRAPOLATED JET CHAMBER TRACK ;
C  O  SDEV  ( "  ) ARE THE STANDARD DEVIATIONS OF THESE HITS FROM THE
C                  EXTRAPOLATED JET CHAMBER TRACK .
C
C---------------------------------------------------------------------
C
C  ASSIGN A UNIT NO. TO EACH OF THE 634 CHAMBERS . THE SCHEME IS
C  AS FOLLOWS :
C              UNICH=1N -X SIDE WALL CHAMBERS , EXCLUDING INNER LAYER ,
C                        LAYER N ;
C              UNICH=2N +X SIDE WALL CHAMBERS , EXCLUDING INNER LAYER ;
C              UNICH=3MN      PLINTH CHAMBERS , EXCLUDING INNER LAYER ;
C                             N=LAYER NO. , M= 1 FOR -X ,  2 FOR +X ;
C              UNICH=4MN  -X    ROOF CHAMBERS , EXCLUDING INNER LAYER ;
C              UNICH=5MN  +X    ROOF CHAMBERS , EXCLUDING INNER LAYER ;
C                               M=QUADRANT NO. , N=LAYER NO.
C                               ROOF L2 HAS  QUADRANT NOS. 1 & 2 ;
C                               ROOF L3,4,5 HAVE  QUAD NOS. 3,4,5,6 .
C              UNICH=6     ALL INNER LAYER CHAMBERS ;
C              UNICH=7N  -Z -X END WALL CHAMBERS ; N INDICATES LAYER NO.
C              UNICH=8N  -Z +X END WALL CHAMBERS ;
C              UNICH=9N  +Z -X END WALL CHAMBERS ;
C              UNICH=10N +Z +X END WALL CHAMBERS ;
C
C   CONVENTIONS FOR UNICH  :
C   (1)  UNICH/10  =  UNIT NO. IN RANGE 1 --> 10  ;
C   (2)  MOD(UNICH,10) =  LAYER NO. WITHIN QUADRANT ;
C   (3)  MOD(UNICH,100) - LAYER NO. = QUADRANT NO.  (ROOF CHAMBERS ONLY)
C                                                 (HALF NO. FOR PLINTH
      INTEGER*4 UNICH(634)/21*6,18*12,18*13,18*14,18*15,
     *21*6,18*22,18*23,18*24,18*25,
     *16*6,  7*312,7*322,  7*313,7*323,  7*314,7*324,  7*315,7*325,
     *16*6, 12*412,12*522, 12*433,12*543,12*453,12*563,
     *12*434,12*544,12*454,12*564,   12*435,12*545,12*455,12*565,
     * 12*72,12*82 , 12*73,12*83 , 12*74,12*84 , 12*75,12*85,
     * 12*92,12*102, 12*93,12*103, 12*94,12*104, 12*95,12*105/
C
      COMMON /  / IMEMOR(80000)
C                 INITIALISE CALIBRATION EDITS UNIT.
      DATA SECS /2./
      CALL HBOOK1(2 ,'NO. OF HITS IN THE R-PHI PATR FIT$',60,0.,60.,0.)
      CALL HBOOK1(10,'CHI**2 PROBABILITY ALL MUONS $',
     *100,0.,1.,0.)
      CALL HBOOK1(15,'CHI**2 PROBABILITY ALL MUONS, 2% BINS $',
     *50,0.,1.,0.)
      CALL HBOOK1(20,'CHI**2 PROBABILITY BARREL MUONS ONLY $',
     *100,0.,1.,0.)
      CALL HBOOK1(25,'CHI**2 PROBABILITY BARREL MUONS ONLY , 2 % BINS$',
     *50,0.,1.,0.)
      CALL HBOOK1(30,'CHI**2 PROBABILITY ENDWALL MUONS ONLY $',
     *100,0.,1.,0.)
      CALL HBOOK1(31,'CHI**2 PROB. -X -Z ENDWALL MUONS ONLY$',
     *100,0.,1.,0.)
      CALL HBOOK1(32,'CHI**2 PROB. +X -Z ENDWALL MUONS ONLY$',
     *100,0.,1.,0.)
      CALL HBOOK1(33,'CHI**2 PROB. -X +Z ENDWALL MUONS ONLY$',
     *100,0.,1.,0.)
      CALL HBOOK1(34,'CHI**2 PROB. +X +Z ENDWALL MUONS ONLY$',
     *100,0.,1.,0.)
      CALL HBOOK1(35,'CHI**2 PROBABILITY ENDWALL MUONS ONLY, 4 % BINS$',
     *25,0.,1.,0.)
      CALL HBOOK1(36,'CHI**2 PROB. -X -Z ENDWALL MUONS ONLY, 4 % BINS$',
     *25,0.,1.,0.)
      CALL HBOOK1(37,'CHI**2 PROB. +X -Z ENDWALL MUONS ONLY, 4 % BINS$',
     *25,0.,1.,0.)
      CALL HBOOK1(38,'CHI**2 PROB. -X +Z ENDWALL MUONS ONLY, 4 % BINS$',
     *25,0.,1.,0.)
      CALL HBOOK1(39,'CHI**2 PROB. +X +Z ENDWALL MUONS ONLY, 4 % BINS$',
     *25,0.,1.,0.)
      CALL HBOOK2(100,'PHI  VS  CHI**2 PROBABILITY BARREL MUONS ONLY $',
     *50,0.,1.,72,0.,360.,0.)
      CALL HBSLIX(100,8)
CCC   CALL HBOOK1(140,'THETA DIST FOR ALL MUONS WITH  90 < PHI < 100$',
CCC  *100,0.,200.,0.)
CCC   CALL HBOOK1(141,'THETA DIST MUONS  PROB < 4 % , 90 < PHI < 100$',
CCC  *100,0.,200.,0.)
CCC   CALL HBOOK1(142,'THETA DIST FOR ALL MUONS WITH 100 < PHI < 120$',
CCC  *100,0.,200.,0.)
CCC   CALL HBOOK1(143,'THETA DIST MUONS  PROB < 4 % ,100 < PHI < 120$',
CCC  *100,0.,200.,0.)
CCC   CALL HBOOK1(144,'THETA DIST FOR ALL MUONS WITH 120 < PHI < 145$',
CCC  *100,0.,200.,0.)
CCC   CALL HBOOK1(145,'THETA DIST MUONS  PROB < 4 % ,120 < PHI < 145$',
CCC  *100,0.,200.,0.)
CCC   CALL HBOOK1(150,'HITMAP FOR MUONS  90 < PHI < 100$',
CCC  *200,250.,450.,0.)
CCC   CALL HBOOK1(155,'HITMAP FOR MUONS  90 < PHI < 100 , PROB < 4%$',
CCC  *200,250.,450.,0.)
CCC   CALL HBOOK1(160,'HITMAP FOR MUONS 100 < PHI < 120$',
CCC  *200,250.,450.,0.)
CCC   CALL HBOOK1(165,'HITMAP FOR MUONS 100 < PHI < 120 , PROB < 4%$',
CCC  *200,250.,450.,0.)
CCC   CALL HBOOK1(170,'HITMAP FOR MUONS 120 < PHI < 145$',
CCC  *200,250.,450.,0.)
CCC   CALL HBOOK1(175,'HITMAP FOR MUONS 120 < PHI < 145 , PROB < 4%$',
CCC  *200,250.,450.,0.)
C
      CALL H1EVLI(0)
      CALL HBLACK(0)
      CALL HMINIM(0,0.)
CCC   CALL HSQUEZ(3HYES)
C---
C---     INITIALIZE BOS.
C---
      CALL BINT(25000,25000,25000,1)
C
      CALL MUINI
C  INITIALISE EVENT COUNTER.
C
      NEV=0
      IEV=0
C
C---
C---     MAIN EVENT LOOP
C---
C---CALL SUBROUTINE MUTIM(SECS,*) TO FORCE EXIT
C---    FIRST , SUPPLY LOGICAL UNIT NO. OF INPUT DATA SET.
      NUNIN=2
    1 CONTINUE
      CALL MUTIM(SECS,&30)
      CALL BSLT
      CALL BDLG
C---
       CALL BREAD(NUNIN,&10,&20)
C PICK UP HEADER POINTER.
      IPHEAD=IDATA(IBLN('HEAD'))
C PICK UP RUN NUMBER ,RECORD NUMBER ETC
      ISECS = HDATA(2*IPHEAD+3)
      IMINS = HDATA(2*IPHEAD+4)
      IHOURS= HDATA(2*IPHEAD+5)
      IDAY  = HDATA(2*IPHEAD+6)
      IMONTH= HDATA(2*IPHEAD+7)
      IYEAR = HDATA(2*IPHEAD+8)
      KRUN  = HDATA(2*IPHEAD+10)
      KREC  = HDATA(2*IPHEAD+11)
      BGAUSS= HDATA(2*IPHEAD+30)
C
C  ONLY TAKE EVENTS WITH C.M. ENERGY .GT. 26 GEV  .
C FIND BEAM ENERGY - IN GEV!!!!!!
      EBGEV=EBEAM(KRUN)/1000.
CCCC  IF(EBGEV.LT.13.)GO TO 1
CMACRO HEADWRIT
C
      CALL KALIBR
C  TO SELECT DATA FROM PERIOD UNDER INVESTIGATION ONLY.
CCCCC IF(NVERSN.NE.IVERSN)GO TO 1
      NEV=NEV+1
      IEV=NEV
C
C  GENERALISATION :
CCCC  IEDIT=20+NVERSN
C
C FOR 1980 DATA :
CCC   IEDIT=28
CCC   IF(IEDIT.LT.28)GO TO 999
CCC   IF(HCTW(115).EQ.-2767)CALL MUCONE(IEDIT,3,1)
C                                    (LUN,IPRINT,IFLAG)
      IF(IEV.GT.1)GO TO 2
      CALL MUCONP
C  FOR LATER CHECK OF MODIFIED CALIBRATION AGAINST PRIVATE FILES :
CCC   IOUT=50+IVERSN
CCC   CALL MUCONW(1,0,IOUT,HERR)
C           (IFLAG,LUNBOS,LUNJAD,HERR)
C
   2  CONTINUE
C
C
C-----------------------------------------------------------------------
C
C MUCONE EDITS MUON CALIBRATION DATA.
C READS EDITS FROM LOGICAL UNIT LUNMUE.
C PRINTING SUPRESSED IF IPRINT.LT.2.
C FULL PRINTING IF IPRINT.GE.10.
C THE MODIFIED HMUCAL VALUES & THEIR ADDRESSES ARE SAVED IN /MUED/
C IF IFLAG=0 .IF A COMPLETE NEW SET OF CALIBRATION IS WANTED,
C PUT IFLAG=1 .
C
C-----------------------------------------------------------------------
      IPPATR=IDATA(IBLN('PATR'))
      CALL FTRAX(IPPATR)
C
C FORCE MUON RE-ANALYSIS.
C
      CALL BMLT(2,'MUR1MUR2')
      CALL BDLM
C
C---  CALL MU CHAMBER TRACKING.
      IMUARG=1
      CALL MUANA(IMUARG)
C--- PRINT MUEV BANK.
CC    CALL MUDUMP(0,0)
C--- PRINT RESULTS OF SIGNAL-COORDINATE CONVERSION.
CC    CALL MURES1(1,1,1,0,0,0)
C--- PRINT RESULTS OF PHILOSOPHY 2 ANALYSIS.
CC    CALL MURES2(1,1,1,1,1)
C
C  NOW ANALYSE RESULTS.
C
C
C  FIND MUR2/0.
      IBANK=0
      CALL CLOC(IND20,'MUR2',IBANK)
      IF(IND20.LE.0)GO TO 11
      NUMTRK=IDATA(IND20+1)
      NMUW  =IDATA(IND20+2)
      NTPH=IDATA(IND20+3)
C
C  FIND MUR2/1.
      IBANK=1
      CALL CLOC(IND21,'MUR2',IBANK)
      IF(IND21.LE.0)GO TO 11
C
C   LOOP ROUND TRACKS.
C
      J=IND21
      J2=J+J
      DO 99 I=1,NUMTRK
C
C  ONLY CONSIDER MUONS WITH QUALITY >= 1 AND < 100:
            IQUAL=IDATA(J+6)
            IF(IQUAL.LE.0.OR.IQUAL.GE.100)GO TO 9
                CHIP=ADATA(J+11)
C
C
                CALL HFILL(10,CHIP)
                CALL HFILL(15,CHIP)
                ITRAK=I
                PHI=PHIT(I)
                THETA=THETAT(I)
                NHXY =NHRPHI(I)
                CALL DEVPIK
C
C  SPECIAL PRINTING FOR TROUBLE AREAS :
CCC             IFLAG=0
CCC             IF(PHI.GT. 90..AND.PHI.LT.145..AND.CHIP.LT.0.1)IFLAG=1
CCC             IF(PHI.GT.180..AND.PHI.LT.225..AND.CHIP.LT.0.1)IFLAG=1
CCC             IF(IFLAG.EQ.0)GO TO 7
C--- PRINT MUEV BANK.
CCC                 CALL MUDUMP(0,0)
C--- PRINT RESULTS OF SIGNAL-COORDINATE CONVERSION.
CCC                 CALL MURES1(1,1,1,0,0,0)
C--- PRINT RESULTS OF PHILOSOPHY 2 ANALYSIS.
CCC                 CALL MURES2(1,1,1,0,0)
C
C++
CCC                 WRITE(6,156)I,PHI,THETA,ND,CHIP
CC156               FORMAT('0 **** ITRAK/ PHI/ THETA/ ND/ CHIP :',
CCC  *              I3,2F7.2,I3,F10.5)
C++
CCC                 IF(ND.LE.0)GO TO 7
C++
CCC                    DO 170 JPIK=1,ND
CCC      WRITE(6,166)NDHIT(JPIK),NDCHAM(JPIK),XDEV(JPIK),SDEV(JPIK)
CC166    FORMAT('0  HIT NO./  CHAMBER NO./ XDEV/ SDEV : ', 2I5,2F10.2)
CC170                  CONTINUE
C++
    7              NEW=0
                   IF(PHI.GT.80..AND.PHI.LT.100.)GO TO 9
                   IF(ND.LE.0)GO TO 9
                   CALL HFILL(2,NHRPHI(I))
                   IF(NHRPHI(I).LT.20)GO TO 9
                      DO 90 JASS=1,ND
                         UN1=UNICH(NDCHAM(JASS))
                         UN = UN1
C
C  REMOVE DIGITS FROM RIGHT OF UN IF NECESSARY :
                         IF(UN .GT.10)UN=UN /10
                         IF(UN .GT.10)UN=UN /10
                         IF(UN.GT.6)NEW=NEW+1
                         IF(NEW.NE.1)GO TO 90
                            IHIST=35+UN-6
                            CALL HFILL(IHIST,CHIP)
                            IHIST2=30+UN-6
                            CALL HFILL(IHIST2,CHIP)
   90                 CONTINUE
C
C  SEPARATE TRACKS WITH >= 1 END WALL HIT IN THE CHI**2 CALCULATION :
                   IF(NEW.GT.0)GO TO 8
                       CALL HFILL(20,CHIP)
                       CALL HFILL(25,CHIP)
                       CALL HFILL(100,CHIP,PHI)
CCC                    IF(PHI.LT.90.  .OR.  PHI.GT.145.  )GO TO 9
CCC                        IF(PHI.LT.100.)MAPALL=150
CCC                        IF(PHI.GT.100..AND.PHI.LT.120.)MAPALL=160
CCC                        IF(PHI.GT.120.)MAPALL=170
CCC                        MAPLOW=MAPALL+5
CCC                        ITHALL=140
CCC                        IF(MAPALL.EQ.150)ITHALL=142
CCC                        IF(MAPALL.EQ.170)ITHALL=144
CCC                        ITHLOW=ITHALL+1
CCC                        CALL HFILL(ITHALL,THETA)
CCC                        IF(CHIP.LT.0.04)CALL HFILL(ITHLOW,THETA)
CCC                        DO 95 JASS=1,ND
CCC                            ICH=NDCHAM(JASS)
CCC                                            CALL HFILL(MAPALL,ICH)
CCC                            IF(CHIP.LT.0.04)CALL HFILL(MAPLOW,ICH)
CCC95                      CONTINUE
                       GO TO 9
C
    8               CALL HFILL(30,CHIP)
                    CALL HFILL(35,CHIP)
    9 CONTINUE
      J=J+NMUW
   99 CONTINUE
C
C  GO TO NEXT EVENT.
      GO TO 1
C
C PROBLEMS , PROBLEMS , .......
   11 CONTINUE
      WRITE(6,116)IBANK
  116 FORMAT('0 BANK MUR2 / ',I1,' NOT FOUND')
      GO TO 1
C***  IF(NEV.GT.99)GO TO 20
      GO TO 1
C---
C
C---     READ ERROR ON INPUT DATA SET
C---
   10 CONTINUE
      WRITE(6,110)NEV
  110 FORMAT('0READ ERROR',I5,2X,
     *'EVENTS WERE READ BEFORE ERROR OCCURED.')
       GOTO 140
C---
C---     END OF DATA.
C---
   20 CONTINUE
      WRITE(6,120)NEV
  120 FORMAT('0END OF DATA.',I5,2X,'EVENTS HAVE BEEN PROCESSED.')
C
      GOTO 140
   30 CONTINUE
      WRITE(6,130)SECS,NEV
  130 FORMAT('0TIMEOUT AT ',F4.1,' SECS.',
     *I5,2X,'EVENTS HAVE BEEN PROCESSED.')
C
  140 CONTINUE
C
CC    CALL HINDEX
CC    CALL HPHS(0)
      CALL HPRINT(0)
C
      GO TO 200
C
C  EMERGENCY STOP :
  999 WRITE(6,9996)IEDIT
 9996 FORMAT('0  ******* EMERGENCY STOP , IEDIT = ',I4)
C
C PRINT BOS STATISTICS.
  200 CALL BSTA
C
      STOP
      END
C
C-----------------------------------------------------------------------
C BLOCK DATA.
C-----------------------------------------------------------------------
C
      BLOCK DATA
C
#include "cmuffl.for"
C
      DATA XYSTEP/20./
C XYSTEP IS STEP LENGTH OF INITIAL EXTRAPOLATION UP TO COIL OR END-PLUG
C   WITH MORE OR LESS FIXED LENGTH IN X-Y PLANE (MM).
C   (STPINI IS THE ACTUAL INITIAL STEP LENGTH).
C
      DATA RCOILI/968./,RCOILO/1045./
C RCOILI/O ARE INNER/OUTER RADII OF COIL (MM).
C
      DATA PGMID/'MUFF'/
C PGMID IS PROGRAM IDENTIFIER.
C
      DATA WMU/.10566/,WMUSQ/.011164/
C WMU,WMUSQ ARE MUON MASS (GEV) AND MASS-SQARED (GEV**2).
C
      DATA NSPECI/21/
C NSPECI IS THE NUMBER OF SPECIAL VARIBLES ACTUALLY USED (SEE CMUFWORK).
C
      DATA XPBAR,XPROT,XPION,XKAON/100.,40.,25.,20./
C THESE ARE NOMINAL CROSS-SECTIONS OF PARTICLES ON HYDROGEN AT 1 GEV
C   USED FOR SCALING INTERACTION LENGTH.
C (NOT USED, ACTUALLY - SEE MUFFLS).
C
C THE FOLLOWING ARE R--  = RADIUS (MM),
C                   Z--  = Z COORDINATE,
C                   T--  = THICKNESS (MM),
C                   GM-- = THICKNESS (GM CM**-2),
C                   AB-- = THICKNESS (ABSORPTION LENGTHS, USING DATA
C                            BOOKLET, I.E. FOR PROTONS. SCALE FOR OTHER
C                            PARTICLES.)
C                   RD-- = THICKNESS (RADIATION LENGTHS),
C                   DE-- = ENERGY LOSS FOR MIN. IONISING PARTICLE (GEV).
C
C BEAM PIPE AND BEAM PIPE COUNTERS (4 MM ALUMINIUM).
C   (ALUMINIUM HAS A DENSITY = 2.7 GM CM**-3,
C          ABSORPTION LENGTH = 37.2 CM,
C           RADIATION LENGTH = 8.9 CM,
C               (-DE/DX) MIN = 4.37 MEV CM**-1).
      DATA TBP,GMBP,ABBP,RDBP,DEBP/4.,1.08,.011,.045,1.7E-3/
C
C JET CHAMBER INNER PIPE (SEE JADE NOTE 17).
      DATA TJETI,GMJETI,ABJETI,RDJETI,DEJETI/0.,1.89,.019,.079,3.02E-3/
C
C JET CHAMBER SUPPORT 1 (SEE JADE NOTE 17).
C   (SUPPORTS ASSUMED TO HAVE AN ABSORPTION LENGTH = 100 GM CM**-2,
C                  (-DE/DX)MIN = 1.6 MEV GM**-1 CM**2).
      DATA TJET1,GMJET1,ABJET1,RDJET1,DEJET1/0.,.208,.002,.006,.33E-3/
C
C JET CHAMBER SUPPORTS 2 AND 3 (SEE JADE NOTE 17).
      DATA TJET2,GMJET2,ABJET2,RDJET2,DEJET2/0.,.33,.003,.01,.53E-3/
C
C JET CHAMBER SUPPORT 4 (SEE JADE NOTE 17).
      DATA TJET4,GMJET4,ABJET4,RDJET4,DEJET4/0.,.258,.003,.008,.41E-3/
C
C JET CHAMBER OUTER WALL (SEE JADE NOTE 17).
      DATA TJETO,GMJETO,ABJETO,RDJETO,DEJETO/12.,3.42,.032,.135,5.24E-3/
C
C COIL. ASSUMED TO BE...
C   3 MM EPOXY (MYLAR?),
C  20 MM WATER (THIS IS 2 20 MM DIAM. PIPES AVERAGED OUT),
C  57 MM ALUMINIUM.
      DATA TCOIL,GMCOIL,ABCOIL,RDCOIL,DECOIL/80.,17.8,.185,.7,30.E-3/
C
C JET CHAMBER END WALLS (JADE NOTE 17 SAYS 'SIMILAR TO COIL', I.E.
C    AS ABOVE, BUT I QUERIE THIS).
      DATA ZJETE/1250./
      DATA TJETE,GMJETE,ABJETE,RDJETE,DEJETE/80.,17.8,.185,.7,30.E-3/
C
C END-PLUG LEAD-GLASS.
C TOKYO LEAD-GLASS HAS DENSITY = 4.08 GM CM**-3,  ) ( BASED ON TOKYO
C            ABSORPTION LENGTH = 318.4 MM,        ) ( DATA INTERPRETED
C             RADIATION LENGTH = 22.39 MM,        ) ( BY J. ALLISON.
C                  (-DE/DX)MIN = 5.708 MEV/CM.    ) (
      DATA ZEPLG/1510./
      DATA TEPLG,GMEPLG,ABEPLG,RDEPLG,DEEPLG/226.,92.21,.71,10.09,.129/
C
C (BARREL) LEAD-GLASS.
C RLG IS INNER RADIUS OF BARREL LG.
C ZLG IS Z COORDINATE OF END OF BARREL.
      DATA RLG,ZLG/1100.,1602.25/
      DATA TLG,GMLG,ABLG,RDLG,DELG/300.,122.4,.942,13.4,.171/
C
C MAGNET END-PLUG.
      DATA ZEP/1755./
      DATA TEP,GMEP,ABEP,RDEP,DEEP/340.,267.,1.99,19.32,.394/
C TEP,ETC., ARE (AVERAGE) FOR END-PLUG (MM).  (I ASSUME IT HAS
C   UNIFORM THICKNESS, AVERAGED TO SOMETHING LESS THAN REAL THICKNESS
C   TO TAKE INTO ACCOUNT LEAD-GLASS LIGHT-GUIDE HOLES.  FURTHER I
C   ASSUME DENSITY, ETC. OF IRON.)
C
C GMG(3),ABG(3),RDG(3),DEG(3) ARE 'GENERAL' QUANTITIES PER MILLIMETRE
C   FOR 1)CHAMBERS, 2)CONCRETE, 3)IRON.
      DATA GMG/0.05,0.536,0.787/
      DATA ABG/0.0005,0.00438,0.0058/
      DATA RDG/0.001,0.0368,0.0568/
      DATA DEG/0.07E-3,0.91E-3,1.16E-3/
C
C SPECIFY NOMINAL CHAMBER RESOLUTION (IN STANDARD DEVIATIONS)....
C REST   IS RESOLUTION IN TRANSVERSE (DRIFT) DIRECTION.
C REST1 IS FOR BARREL FACES , REST2 IS FOR ENDWALLS.
C RESTMX IS RESOLUTION IN TRANSVERSE DIRECTION FOR THE CASE WHEN THE
C          TRANSVERSE (DRIFT) COORDINATE IS BAD. THIS IS SET TO
C          DRIFT DISTANCE = 150 MM, RATHER THAN (CHAMBER WIDTH),
C          SINCE BOTH AMBIGUITIES ARE TRIED.
C          FOR ASSOCIATION OF HITS , IT IS ADDED LINEARLY TO THE SQUARE
C          ROOT OF THE SUM OF THE SQUARES OF THE VARIANCES DUE TO
C          MULT SCAT & PATREC FIT ERRORS.
C          HOWEVER , FOR CALCULATION OF CHI**2 , IT SHOULD BE  ADDED
C          QUADRATICALLY WITH THE OTHERS -- BUT , FOR PRESENT, BAD
C          HITS ARE NOT USED FOR CHI**2 CALCULATION.
C RESL   IS RESOLUTION IN LONGITUDINAL (WIRE) DIRECTION.
C RESLMX IS SIMILAR TO RESTMX, I.E. FOR CASE WHEN LONGITUDINAL COORD.
C          IS BAD.  SET TO CHAMBER LENGTH.
      DATA REST1,REST2,RESTMX,RESL,RESLMX/ 5.,10.,150.,150.,5000./
C
C FACTOR IS THE NUMBER OF STANDARD DEVIATIONS USED FOR HIT CUT.
      DATA FACTOR/3./
C
C OVLCUT IS THE DIFFERENCE IN DRIFT DEVIATIONS WHICH IS TOLERATED(MM)
C FOR HITS TO BE CONSIDERED AS OVERLAP HITS.
      DATA OVLCUT/15./
C
      END
      BLOCK DATA
C==MACRO CIOUNI=========================================
      COMMON/CIOUNI/IUNIT,JUNIT,NCALI,KUNITA(10),LUNITA(10)
C==ENDMACRO CIOUNI========================================
      DATA NCALI/2/
      DATA KUNITA/10,11,8*0/
      DATA LUNITA/21,22,8*0/
      END
//LKED.SYSLIB DD
//            DD
//            DD DISP=SHR,UNIT=FAST,DSN=F11LHO.JADEGL
//            DD DISP=SHR,UNIT=FAST,DSN=F22NAR.TOFLIB.L
//            DD DISP=SHR,UNIT=FAST,DSN=F22ALL.JADEMUL
//            DD DISP=SHR,UNIT=FAST,DSN=F1EBLO.BOSLIB.L
//            DD DISP=SHR,UNIT=FAST,DSN=R01UTL.HBOOK321.L (NEW HBOOK)
//            DD DSN=R01UTL.CERNLIB,DISP=SHR,UNIT=FAST  (CERN LIB)
//LKED.MYLIB  DD DSN=F22MCC.MUCALIB.L,DISP=SHR,UNIT=FAST
  INCLUDE MYLIB(FTRAX,MUANAFD,MUFFL2MD,MUFFLD,DEVPIK,MUCONE1)
//LKED.SYSIN DD *
//*NCLUDE SYSLIB(SUCOOR,TANTHM,NUFFLY)
//*NCLUDE MYLIB(FTRAX,MUANAFD,MUFFL2MD,MUFFLD,DEVPIK,MUFFLS,MUCONE1)
//*NCLUDE MYLIB(NUCOORSH,TANTHM,NUFFLY)
//*NCLUDE MYLIB(NUCOOR,TANTHM)
//*KED.SYSIN DD *
//*O.FT02F001 DD DSN=F22HAS.COSMIC.MANY,DISP=SHR,UNIT=TAPE
//*O.FT02F001 DD DSN=F22NAR.MSSJAD.MC1.R408450,DISP=SHR
//*O.FT02F001 DD DSN=F22NAR.DSK.MY064190,DISP=SHR
//*O.FT02F001 DD DSN=F22NAR.MSSJAD.MY191269,DISP=SHR
//GO.FT02F001 DD DSN=F22NAR.MSSJAD.MY191269,DISP=SHR
//*O.FT02F001 DD DSN=F22NAR.ZZ.DSK.M271290A.B821123,DISP=SHR,UNIT=TAPE
//*           DD DSN=F22NAR.DSK.MY291335,DISP=SHR
//*O.FT02F001 DD DSN=F22NAR.MSSJAD.MY336407,DISP=SHR
//*O.FT02F001 DD DSN=F22NAR.MSSJAD.MY408450,DISP=SHR
//*O.FT02F001 DD DSN=F22NAR.MSSJAD.MY451509,DISP=SHR
//*O.FT02F001 DD DSN=F22MCC.MSS.MUPAIRS,DISP=SHR,UNIT=FAST
//*---CALIBRATION DATA INPUT----------------------------------
//GO.FT21F001 DD UNIT=FAST,DISP=SHR,DSN=F11LHO.AUPDAT0
//GO.FT22F001 DD UNIT=FAST,DISP=SHR,DSN=F11LHO.AUPDAT1
//*O.FT21F001 DD UNIT=FAST,DISP=SHR,DSN=F11LHO.AUPDAT0
//*O.FT22F001 DD UNIT=FAST,DISP=SHR,DSN=F11LHO.ZZ.AUPDAT1.B821209
//*O.FT28F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.FIXED.DS1980
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.NISURVEY
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.SHED0816
//*O.FT33F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.OLDXT.CARDS.FIXED13
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.NFSURVEY
//*O.FT34F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.OLDXT.CARDS.FIXED14
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.NGSURVEY
//*O.FT35F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.OLDXT.CARDS.FIXED15
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.NHSURVEY
//*O.FT36F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.OLDXT.CARDS.FIXED16
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.NISURVEY
//*O.FT37F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.OLDXT.CARDS.FIXED17
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.NJSURVEY
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.SHEDIT17
//*O.FT38F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.OLDXT.CARDS.FIXED18
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.NKSURVEY
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.SHEDIT18
//*O.FT39F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.OLDXT.CARDS.FIXED19
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.NLSURVEY
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.SHEDIT19
//*O.FT40F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.OLDXT.CARDS.FIXED20
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.NMSURVEY
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.SHEDIT20
//*O.FT41F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.OLDXT.CARDS.FIXED21
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.NNSURVEY
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.SHEDIT21
//*O.FT42F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.MEANVDTP.CARDS.FIXED22
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.NOSURVEY
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.SHEDIT22
//*O.FT43F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.MEANVDTP.CARDS.RIXED23
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.NUSURVEY
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.SHEDIT23
//*O.FT32F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.MEANVDTP.CARDS.FIXED22
//*O.FT33F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.MEANVDTP.CARDS.FIXED23
//*           DD UNIT=FAST,DISP=SHR,DSN=F22MCC.CARDS.NUSURVEY
//*O.FT48F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.OLDXT.CARDS.FIXED08
//*O.FT49F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.OLDXT.CARDS.FIXED09
//*O.FT50F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.OLDXT.CARDS.FIXED10
//*O.FT51F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.OLDXT.CARDS.FIXED11
//*O.FT52F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.OLDXT.CARDS.FIXED12
//*O.FT53F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.OLDXT.CARDS.FIXED13
//*O.FT54F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.OLDXT.CARDS.FIXED14
//*O.FT55F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.OLDXT.CARDS.FIXED15
//*O.FT56F001 DD UNIT=FAST,DISP=SHR,DSN=F22MCC.OLDXT.CARDS.FIXED16
//GO.SYSIN DD *
C   22/03/97 703221633  MEMBER NAME  #MUTEST  (JADEMUS)     FVS
//F22HAS13 JOB 10622622,CLASS=E,MSGLEVEL=(0,0),TIME=(0,10),MSGCLASS=T
//*MAIN ORG=EXT,RELPRI=HIGH
//*EXEC NEWFAST
// EXEC FLG,PARM.LKED='MAP,LIST',REGION=800K
//LKED.SYSLIB DD
//            DD
//            DD DISP=SHR,UNIT=FAST,DSN=F11LHO.JADEGL
//            DD DISP=SHR,UNIT=FAST,DSN=F11GOD.PATRECLD
//            DD DISP=SHR,UNIT=FAST,DSN=JADELG.LOAD
//            DD DISP=SHR,UNIT=FAST,DSN=F22ALL.JADEMUL
//            DD DISP=SHR,UNIT=FAST,DSN=F1EBLO.BOSLIB.L
//            DD DSN=R01UTL.HBOOK3.L,DISP=SHR,UNIT=FAST (NEW HBOOK)
//            DD DSN=R02BUT.CERNLIB,DISP=SHR,UNIT=FAST  (CERN LIB)
 INCLUDE SYSLIB(JDMAIN0,MUSER)
//*
//*
//*___EXPT_DATA_________________________________________________________
//*
//GO.FT02F001 DD DSN=F22HAS.MUSTBE,DISP=SHR,UNIT=FAST
//*O.FT02F001 DD DSN=F22MIN.RESULT.TPMH412,DISP=SHR,UNIT=FAST
//*
//*
//*___REDUCED DATA______________________________________________________
//*
//*
//*--FT03F001-DATA OUTPUT FILE----------------------------------------
//GO.FT03F001 DD DUMMY  (ANALYSIS OUTPUT)
//*O.FT03F001 DD DSN=F22ALL.ARCHIE,DISP=OLD,UNIT=FAST
//*
//*
//*--FT38F001-CALIBRATION DATA INPUT----------------------------------
//*UNIT=FAST                   (MU CALIB. DATA - JUL 1979)
//GO.FT38F001 DD DSN=F22ALL.NUCALIB.DATA0013,DISP=SHR,UNIT=FAST
//*
//*
//*--FT39F001-CALIBRATION UPDATES-------------------------------------
//GO.FT39F001 DD DSN=F22HAS.@UPDAT43,DISP=SHR,UNIT=FAST
//*O.FT39F001 DD DSN=NULLFILE
//*O.FT39F001 DD DSN=F22HAS.DATA0014,DISP=SHR,
//*UNIT=FAST
//*
//*
//*--FT37F001-UPDATED-CALIBRATION DATASET.----------------------------
//*O.FT37F001 DD DUMMY
//GO.FT41F001 DD DSN=F22ALL.MUCALIB.DATA0013,DISP=(NEW,CATLG,DELETE),
// VOL=SER=STOR05,DCB=R01DCB.VBS,SPACE=(TRK,2),
// UNIT=FAST                      (CALIBRATION DATA FROM JAN 1980)
//*O.FT37F001 DD DSN=F22HAS.RECAL.DATA007,DISP=(NEW,CATLG),
//*VOL=SER=FASTOV,DCB=R01DCB.VBS,SPACE=(TRK,2),
//*UNIT=FAST                      (OLD MUCALIB DS.)
//*
//*
//*LARRY'S CALIBRATION DATA SETS...
//*
//GO.FT42F001 DD DSN=F22ALL.MUCALIB.NBOS0013,DISP=(NEW,CATLG,DELETE),
// VOL=SER=STOR05,DCB=R01DCB.VBS,SPACE=(TRK,2),
// UNIT=FAST                      (CALIBRATION DATA FROM JAN 1980)
//GO.FT10F001 DD UNIT=FAST,DISP=SHR,DSN=F11LHO.ASTART0
//GO.FT11F001 DD UNIT=FAST,DISP=SHR,DSN=F11LHO.ASTART1
//GO.FT21F001 DD UNIT=FAST,DISP=SHR,DSN=F11LHO.AUPDAT0
//GO.FT22F001 DD UNIT=FAST,DISP=SHR,DSN=F11LHO.AUPDAT1
//*
//*
//*--TITLES---------------------------------------------------------
//GO.FT35F001 DD *
OLD MUCALIB NONSENSE  UPDATED JH 29.11.80
INNER LAYERS ARE INCLUDED BUT POSITIONAL PARAMETERS ARE DESIGN VALUES.
THESE MAY BE 1 CM OUT OF POSITION- THEY AWAIT OFFLINE ANALYSIS.
//*S DS HAS OFFLINE TPS AND LSFS, PLUS THE EXTRA ROOF CHAMBERS
//*IMISED OFFLINE MEASUREMENTS. DATA11,12,13 ROOF MISTAKES CORRECTED
//*WALL EXTRA CHAMBERS TAKEN OUT AS APPROPRIATE.
//*
//*--SYSIN------------------------------------------------------------
//* FIRST CARD ON SYSIN IS IN FORMAT(14I5)...
//* IEV1,IEV2,NPR,IPRINT,IPRINS,IANAL,ISTATS,IJOIN
//* EVENTS IEV1 TO IEV2 ARE PROCESSED. (IF IEV2=0, ALL EVENTS FROM IEV1
//*   ARE PROCESSED.  IF IEV1=0, ALL EVENTS ARE PROCESSED.)
//* THE EVENT COUNTER STARTS FROM IRUN,IREC IF IRUN,IREC.NE.0.
//* NPR IS NUMBER OF EVENTS PRINTED, =0 FOR 10 EVENTS, =-1 FOR NONE.
//* IPRINT=2 NORMALLY TO GET MESSAGES, BUT NOT FULL CALIB. DATA PRINT.
//* IPRINS=0 SUPPRESSES SPECIAL RAW DATA PRINTING.
//* IREC SELECTS RECORD NUMBER IN ASSOCIATION WITH IRUN.
//* IHISTS=0 SUPPRESSES HISTOGRAMS.
//* LUNT = LOG. UNIT NUMBER OF TITLES, =0 IF NONE.
//* IRUN SELECTS SINGLE RUN (=0 FOR ANY RUN).
//* ITLFT IS NUMBER OF SECONDS REQUIRED AT END. (=2 IF ITLFT=0)
//* IOUT.NE.0 PRINTS OUTPUT BANKS EVEN IF NPR DOES NOT SELECT.
//* LUNC =(38)= LOG. UNIT OF OWN CALIBRATION DATA FILE, =0 IF NONE.
//* LUNE =(39)= LOG. UNIT OF CALIBRATION DATA UPDATES, =0 IF NONE.
//* LUNO =(37,41)= LOG. UNIT OF CALIB. DATA OUTPUT FILE, =0 IF NONE.
//*   40<LUNO<45      ==>  MUCONW WRITES BOTH A BOS DATA SET AND A
//*                         SINGLE LOGICAL RECORD OF LENGTH 4185 WORDS
//*                         ON LOGICAL UNIT NUMBERS LUNO AND LUNO+1
//*                         RESPECTIVELY ;
//*V1-IEV2--NPR-RINT-RINS-IREC-ISTS-LUNT-IRUN-TLFT-IOUT-LUNC-LUNE-LUNO
    0    1   -1    0    0             35         1        38   39   41
