****************************************************************** * examp1.f * cradle file for first neural network training example * Richard Hawkings (OPAL) Alain Bellerive (SNO) ****************************************************************** * example 1 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','examp1.hb',' ',1024,ISTAT) CALL HRIN(5000,9999,ISTAT) CALL HBNAME(5000,' ',0,'$CLEAR') CALL HBNAME(5000,'Vertex',FLAVTR,'$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) NSUB=-1 * now make selection * require non zero EDECR and significant high multiplicity vertex IF (EDECR.GT.0.AND.DECL/EDECL.GT.MINSIG.AND.NSEC.GE.MINMUL) THEN * vertex is OK, fill 4 inputs and output * note transformations of network inputs LSEL=.TRUE. OIN(1)=TANH(0.05*DECL/EDECL) OIN(2)=TANH(DECL) OIN(3)=TANH(0.05*DECR/EDECR) OIN(4)=REAL(NSEC)/10. * output: signal is b events (flav=5) all else is background IF (FLAVTR.EQ.5) THEN OUT(1)=1.0 ELSE OUT(1)=0. ENDIF ENDIF END ************************************************************* SUBROUTINE UNPATS implicit none PRINT *,'UNPATS called! Why?' 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