subroutine hec_online_mwpc ************************************************************************* *** *** Get MWPC clusters and fill the beam profile histograms *** ************************************************************************* implicit none include 'hec_dwpc.inc' include 'hec_beam_sys_config.inc' include 'hec_evth.inc' C=== Local variables logical first save first C=== character*80 htit C=== integer i, iword, icha, ixy, idh, id, icent, nwires, n1, n2 real coor, ch_width logical mwpc_signal_hit_switch logical mwpc_signal_xhit_switch(5) logical mwpc_signal_yhit_switch(5) C=== data first/.true./ data idh/5200/ C=== Book histograms if (i_event .le. 1) then mwpc_signal_hit_count = 0 do i=1, 5 mwpc_signal_xhit_count(i) = 0 mwpc_signal_yhit_count(i) = 0 enddo ! do i=1, 5 first=.false. call hec_beam_ini htit='Beam profile, x plane 2 (wire no.)$' call hbook1(idh+2,htit,128,0.0,128.,0.) htit='Beam profile, y plane 2 (wire no.)$' call hbook1(idh+7,htit,128,0.0,128.,0.) htit='Beam profile, x plane 3 (wire no.)$' call hbook1(idh+3,htit,128,0.0,128.,0.) htit='Beam profile, y plane 3 (wire no.)$' call hbook1(idh+8,htit,128,0.0,128.,0.) htit='Beam profile, x plane 4 (wire no.)$' call hbook1(idh+4,htit,128,0.0,128.,0.) htit='Beam profile, y plane 4 (wire no.)$' call hbook1(idh+9,htit,128,0.0,128.,0.) htit='Beam profile, x plane 5 (wire no.)$' call hbook1(idh+5,htit,64,0.0,64.,0.) htit='Beam profile, y plane 5 (wire no.)$' call hbook1(idh+10,htit,64,0.0,64.,0.) C=== id=idh+10 htit='Beam profile, x plane 2 (cm)$' call hbook1(id+2,htit,128,-6.4,6.4,0.) htit='Beam profile, y plane 2 (cm)$' call hbook1(id+7,htit,128,-6.4,6.4,0.) htit='Beam profile, x plane 3 (cm)$' call hbook1(id+3,htit,128,-6.4,6.4,0.) htit='Beam profile, y plane 3 (cm)$' call hbook1(id+8,htit,128,-6.4,6.4,0.) htit='Beam profile, x plane 4 (cm)$' call hbook1(id+4,htit,128,-6.4,6.4,0.) htit='Beam profile, y plane 4 (cm)$' call hbook1(id+9,htit,128,-6.4,6.4,0.) htit='Beam profile, x plane 5 (cm)$' call hbook1(id+5,htit,64,-6.4,6.4,0.) htit='Beam profile, y plane 5 (cm)$' call hbook1(id+10,htit,64,-6.4,6.4,0.) endif if (n_dwpc.le.0) return C=== Fill histograms mwpc_signal_hit_switch = .false. do icha = 1, 5 mwpc_signal_xhit_switch(icha) = .false. mwpc_signal_yhit_switch(icha) = .false. enddo do iword=1,n_dwpc if (dwpc_words(iword).ne.0) then c c If any wire has signal, then switch = true c mwpc_signal_hit_switch = .true. call hec_beam_xymwpc(dwpc_words(iword),icha,ixy,coor,ch_width) id=idh+10+icha if (ixy.eq.1) then mwpc_signal_xhit_switch(icha) = .true. else id=id+5 mwpc_signal_yhit_switch(icha) = .true. endif call hf1(id,coor,1.0) c if (step(icha) .gt. 0.) then icent=(coor+hsize(icha))/step(icha) nwires=nint(2.*ch_width/step(icha)) endif c n1=icent-(nwires-1)/2 n2=n1+nwires-1 id=id-10 do i=n1,n2 call hf1(id,float(i),1.) enddo endif ! dwpc_words(iword).ne.0 enddo c c count how many times each chamber was hit c channels are numbered 2->5, the 1st array position is for c overall hits (ie. if any wire is hit in the event) c do icha = 1, 5 if (mwpc_signal_hit_switch) then mwpc_signal_hit_count = mwpc_signal_hit_count + 1 if (mwpc_signal_xhit_switch(icha)) then mwpc_signal_xhit_count(icha) = mwpc_signal_xhit_count(icha) + + 1 endif if (mwpc_signal_yhit_switch(icha)) then mwpc_signal_yhit_count(icha) = mwpc_signal_yhit_count(icha) + + 1 endif endif enddo C return end