****************************************************************** * examp2.cra * cradle file for first neural network training example * Richard Hawkings (OPAL) Alain Bellerive (SNO) ****************************************************************** * example 2 user code for NETTRA * SUBROUTINE UNINIT * define your ntuple, any FFREAD cards implicit none include 'myntup.inc' include 'mycut.inc' INTEGER ISTAT * * open and define the ntuple CALL HROPEN(10,'INPUT','examp2.hb',' ',1024,ISTAT) CALL HRIN(5000,9999,ISTAT) CALL HBNAME(5000,' ',0,'$CLEAR') CALL HBNAME(5000,'Vertex',FLAVTR,'$SET') CALL HBNAME(5000,'Tracks',NTRK,'$SET') * define the FFREAD cards: * here UNCUT to set min decay length significance and multiplicity MINSIG=3.0 MINMUL=3 END * ************************************************************** SUBROUTINE UNSETR * called after all FFREAD cards have been read in implicit none include 'mycut.inc' * WRITE(*,1000) MINSIG,MINMUL * 1000 FORMAT('UNSETR called'/ + 'Minimum decay length significance:',f6.3/ + 'Minimum vertex multuplicity :',i6) END * ************************************************************** SUBROUTINE UNPATN(IEVT,NSUB,LSEL,LFIN) * user routine to fetch pattern into JNCOMM array OIN, answer in OUT * input : IEVT=requested event * output: NSUB=number of `sub events', or -1 for simple events * LSEL=true if this event is 'selected' by user * LFIN=true if this event is beyond the end of the sequence * OIN() array in JNCOMM must be filled with net inputs * OUT() array in JNCOMM must be filled with desired output(s) implicit none INTEGER IEVT,NSUB LOGICAL LSEL,LFIN include 'jncomm.inc' include 'myntup.inc' include 'mycut.inc' INTEGER ISTAT * LSEL=.FALSE. CALL HGNT(5000,IEVT,ISTAT) LFIN=(ISTAT.NE.0) * now make selection * require significant high multiplicity vertex from b event IF (DECL/EDECL.GT.MINSIG.AND.NSEC.GE.MINMUL.AND.FLAVTR.EQ.5) THEN * vertex is OK, define number of sub events (tracks in this case) NSUB=NTRK LSEL=.TRUE. ENDIF END * ************************************************************** SUBROUTINE UNPATS(IT,LSEL) * set up network input and required output for one track in current event implicit none INTEGER IT LOGICAL LSEL include 'myntup.inc' include 'jncomm.inc' * LSEL=.TRUE. * set up the inputs * kinematic quantities OIN(1)=TRP(IT)/45.6 OIN(2)=TRPT(IT)/TRP(IT) * primary vertex quantities OIN(3)=tanh(0.1*TRD0SP(IT)) OIN(4)=tanh(0.1*TRZ0SP(IT)) * secondary vertex quantities OIN(5)=tanh(0.1*TRD0SS(IT)) OIN(6)=tanh(0.1*TRZ0SS(IT)) * required output: fragmentation tracks are background, b-decay are signal OUT(1)=0. IF (TRisAb(IT)) OUT(1)=1. END * ************************************************************** SUBROUTINE UNFIN * user termination routine implicit none * CALL HDELET(5000) CALL HREND('INPUT') CLOSE(10) WRITE(*,1000) 1000 FORMAT('UNFIN: Input ntuple closed') END