program tstiom C C read in multiple events to the common block C #include "stdlun.inc" integer lok,ifl,i,ntries,istr integer lstr(4) character*11 filin(4),filrd logical lrdit(4) data lrdit/.true.,.true.,.true.,.true./ data filin/'stdtsthx.io','stdtstjx.io','stdtstix.io', 1 'stdtstpx.io'/ save lrdit C initialize HEP logical units lnhwrt=0 lnhdcy=0 lnhout=22 lnhrdm(1)=23 lnhrdm(2)=24 lnhrdm(3)=25 lnhrdm(4)=26 C...open output file open(unit=lnhout,file='stdtstiom.lpt',status='new') call mcfio_init() ! initialize MCFio once only C...open input files do 110 i = 1,4 filrd=filin(i) lnhrd=lnhrdm(i) call stdxropen(filrd,ntries,istr,lok) if(lok.ne.0) then lrdit(i)=.false. write(lnhout,1001) filrd else lstr(i) = istr write(lnhout,1002) filrd,istr endif 110 continue C...book histograms call tstbkiom C...now read events do while (lrdit(1).or.lrdit(2).or.lrdit(3).or.lrdit(4)) call stdzero do i=1,4 if(lrdit(i))then 200 call stdxrdm(ifl,lstr(i),lok) if(lok.ne.0)then call stdxend(lstr(i)) lrdit(i)=.false. else C... keep looping if this is not a HEPEVT record if(ifl.ne.1) go to 200 C... fill histograms call tstfliom endif endif enddo enddo C...print histograms call houtpu(lnhout) call histdo 1001 format(' could not open file ',a12) 1002 format(' file ',a12,' is input stream ',i2) end subroutine tstfliom C... fill histograms #include "stdhep.inc" integer i call hfill(11,float(nevhep),0.,1.) call hfill(12,float(nhep),0.,1.) do 100 i=1,nhep call hfill(13,float(idhep(i)),0.,1.) call hfill(14,float(isthep(i)),0.,1.) call hfill(15,float(jmohep(1,i)),0.,1.) call hfill(16,float(jmohep(2,i)),0.,1.) call hfill(17,float(jdahep(1,i)),0.,1.) call hfill(18,float(jdahep(2,i)),0.,1.) call hfill(19,float(jmulti(i)),0.,1.) call hfill(21,sngl(phep(1,i)),0.,1.) call hfill(22,sngl(phep(2,i)),0.,1.) call hfill(23,sngl(phep(3,i)),0.,1.) call hfill(24,sngl(phep(4,i)),0.,1.) call hfill(25,sngl(phep(5,i)),0.,1.) call hfill(26,sngl(vhep(1,i)),0.,1.) call hfill(27,sngl(vhep(2,i)),0.,1.) call hfill(28,sngl(vhep(3,i)),0.,1.) call hfill(29,sngl(vhep(4,i)),0.,1.) 100 continue return end subroutine tstbkiom C--- book histograms C implicit none C--- The HBOOK common real hmemor common/pawc/hmemor(50000) C--- Setup the HBOOK memory limit. call hlimit(50000) C--- Book histograms. call hbook1(11,'nevhep',100,0.0,100.0,0.) call hbook1(12,'nhep',100,0.,1000.,0.) call hbook1(13,'idhep',100,0.,100.,0.) call hbook1(14,'isthep',100,0.,200.,0.) call hbook1(15,'jmohep(1,)',100,0.,1000.,0.) call hbook1(16,'jmohep(2,)',100,0.,1000.,0.) call hbook1(17,'jdahep(1,)',100,0.,1000.,0.) call hbook1(18,'jdahep(2,)',100,0.,1000.,0.) call hbook1(19,'jmulti',20,0.,10.,0.) call hbook1(21,'phep(1,)',100,-100.,100.,0.) call hbook1(22,'phep(2,)',100,-100.,100.,0.) call hbook1(23,'phep(3,)',100,-1000.,1000.,0.) call hbook1(24,'phep(4,)',100,-1000.,1000.,0.) call hbook1(25,'phep(5,)',50,-250.,250.,0.) call hbook1(26,'vhep(1,)',10,-1.,1.,0.) call hbook1(27,'vhep(2,)',10,-1.,1.,0.) call hbook1(28,'vhep(3,)',10,-1.,1.,0.) call hbook1(29,'vhep(4,)',10,0.,1.,0.) return end