C Program: CMC_PREDICT C Authors: David Christian C Erik Gottschalk C Date: 27. April 1992 C C ------------------------------------------------------------------------- SUBROUTINE CMC_PREDICT SAVE C ------------------------------------------------------------------------- C C Description: C ============ C This subroutine projects MCARLO tracks into the Cherenkov counter, C uses the track ID to calculate how much light is made on which C mirrors, and calculates ADC values for cells with light. C C Arguments: C ========== C IOT - Initialization, Operation, Termination C DATFIL - Drift chamber data file for Initialization phase C C Revisions: C ========== C Date Who Description C -------- ----- --------------------------------------------------- C C 21JUL97 mwang Accomodated StdHEP 3.02 numbering scheme, which will C now be designated as naming scheme 3 (replacing any C previous definition of this scheme). Note that we C can't designate this as naming scheme 4 since only C the middle 2 bits of the most significant 4 bits of C an integer*2 word are used to pack the variable C MC_ITYP(3,I)--0:0000, 1:0010, 2:0100, 3:0110. Named C this program CMC_PREDICT_V1_1. C C External Specifications: C ======================== INCLUDE 'CMC_COMMONS.FOR' INCLUDE 'MC_CONFIG.FOR' INCLUDE 'MC_EVTPAR2.FOR' INCLUDE 'MC_IO.FOR' INCLUDE 'MC_RAW.FOR' INCLUDE 'COM_INTAPE.FOR' C C LOCAL Specifications: C ===================== C-->2/16/94 DCC ... modified to use separate pe constants for each mirror c ==> no more rows. DIMENSION NROW(96),cmc_pet(96) C-->NROW(MIRROR#) = "ROW" WHICH MIRROR BELONGS TO DATA NROW/1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4, x 1,2,3,4,1,2,3,4,5,6,7,5,6,7,7,7,7,7,5,6,7,5,6,7, x 1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4, x 1,2,3,4,5,6,7,5,6,7,7,7,7,7,5,6,7,5,6,7/ C C ------------------------------------------------------------------------- C C-->INITIALIZE THESE THINGS EVERY CALL DO 107 IT=1,50 ! Loop over 50 possible tracks. ICMC_ITS(IT)=0 ! ITS will hold track id in Cerenkov lingo. DO 107 J=1,6 ! Loop over 6 hypothesees. Icmc_NMRS(IT,J)=0 DO 107 K=1,4 ! Loop over 4 possible mirrors. Icmc_MRS(IT,K,J)=0 107 cmc_PEEXP(IT,K,J)=0. DO 108 M=1,96 ! Loop over 96 mirrors. Icmc_NHIT(M)=0 Icmc_NCER(M)=0 cmc_PEMEAS(M)=0. cmc_ADC(m)=0. cmc_TDC(M)=0. cmc_pet(m)=0. c-->Don't make light on a cell with cmc_GAINC0 set to 0. if(cmc_GAINC0(m).le.0.)then cmc_adc(m)=450. cmc_tdc(m)=450. cmc_pemeas(m)=450. endif 108 continue C--> PROJECT TRACKS INTO THE CERENKOV COUNTER/ PREDICT LIGHT c count the # of hits on each mirror, using known track ids. IF(MC_ACT(2).LE.0)RETURN !NO ACTIVE TRACKS LEFT DO 11 I=1,MC_ACT(2) IF(MC_IACT(I,2).LE.0)GOTO 11 Icmc_NMRS(I,1)=0 cmc_TOTL(I,1)=0. ICMC_ITS(I)=-1 C-->PROJECT CHARGED TRACKS IF(MC_ITYP(1,I).EQ.0)GOTO 11 GOTO(8,11,9)MC_ITYP(3,I) GOTO 11 C-->LOAD ICMC_ITS(I) WITH TRACK TYPE IN CERENKOV LINGO: C 1 = ELECTRON C 2 = MUON C 3 = PION C 4 = KAON C 5 = PROTON C 6 = DEUTERON 8 IF(MC_ITYP(2,I).EQ.1)ICMC_ITS(I)=3 !naming scheme 1 IF(MC_ITYP(2,I).EQ.2)ICMC_ITS(I)=4 IF(MC_ITYP(2,I).EQ.4)ICMC_ITS(I)=5 IF(MC_ITYP(2,I).EQ.8)ICMC_ITS(I)=6 IF(MC_ITYP(2,I).EQ.16)ICMC_ITS(I)=1 IF(MC_ITYP(2,I).EQ.32)ICMC_ITS(I)=2 IF(ICMC_ITS(I).LE.0)GOTO 11 GOTO 10 9 IF(MC_ITYP(2,I).EQ.211)ICMC_ITS(I)=3 !naming scheme 4 IF(MC_ITYP(2,I).EQ.321)ICMC_ITS(I)=4 IF(MC_ITYP(2,I).EQ.2212)ICMC_ITS(I)=5 cc IF(MC_ITYP(2,I).EQ.8)ICMC_ITS(I)=6 !no deuterons in scheme 4 IF(MC_ITYP(2,I).EQ.11)ICMC_ITS(I)=1 IF(MC_ITYP(2,I).EQ.13)ICMC_ITS(I)=2 IF(ICMC_ITS(I).LE.0)GOTO 11 C-->PROJECT ALL ACTIVE CHARGED TRACKS 10 PTOT=MC_P4(5,I,2) call cmc_PROJTC(i,ptot,xm,ym,mh,ip) C-->ADD ANY LIGHT EXPECTED TO LISTS JJ=Icmc_NMRS(I,ICMC_ITS(I)) IF(JJ.EQ.0) GO TO 11 DO 12 K=1,JJ MM=Icmc_MRS(I,K,ICMC_ITS(I)) IF(MM.GT.96) GO TO 12 Icmc_NHIT(MM)=Icmc_NHIT(MM)+1 !# OF TRACKS MAKING LIGHT ON MIRROR C-->ADD TO THE LIGHT EXPECTED ON THIS MIRROR cmc_pet(mm)=cmc_pet(mm)+cmc_peexp(i,k,ICMC_ITS(i)) IF(Icmc_NHIT(MM).GT.9)GOTO 12 Icmc_HIT(MM,Icmc_NHIT(MM))=I !TRACK # MAKING LIGHT ON MIRROR 12 CONTINUE 11 CONTINUE c-->Now load the adc values do 301 m=1,96 c-->don't add light to mirrors with gain=0 if(cmc_GAINC0(m).le.0.)goto 300 c-->now look at mirrors with light predicted... if(cmc_pet(m).le.0.)goto 300 C-->smear the # of photoelectrons using a Poisson distribution cmc_fpet=cmc_pet(m) IF(MC_MEM(MC_OFF(MC_SEG)+2).EQ.1)cmc_fpet=cmc_fish(cmc_pet(m)) c-->check that we still expect a non-zero number of pe's if(cmc_fpet.le.0.)goto 300 mm=14+2*m cmc_adc(m)= cdcc 1 cmc_c0aped(mm)+cmc_GAINC0(m)*cmc_fpet/cmc_pebeq1(nrow(m)) 1 cmc_c0aped(mm)+cmc_GAINC0(m)*cmc_fpet/cmc_pebeq1(m) 300 continue 301 continue RETURN END