subroutine hec_ntuple_pass1 c c pass 1 over data set to fill standard ntuples c implicit none c include'hec_par.inc' ! shared parameters include'hec_datacard.inc' ! datacard values include'hec_evth.inc' ! event header common include'hec_geo.inc' ! geometry correpondence etc. include'hec_max.inc' ! preferred maximum signal include'hec_search.inc' ! search common include'hec_trig.inc' ! trigger common c c local variable declaration c real tmp_max(i_adc_dim) integer ic,ic_maxsig,ind_n(i_adc_dim) logical hec_nextevt external hec_nextevt logical again c print *, ' ' print *, ' *** starting pass 1 for standard ntuple filling' c c initialise data io for pass c call hec_io_pass_ini c c loop over events c i_event = 1 again = .true. do while (i_event.le.n_evtmax .and. again) c c check on end of epio file and/or errors c again = hec_nextevt() if( again )then if (mod(i_event, 1000) .eq. 0 .or. i_event .eq. 1) then print *, ' *** starting event number ', i_event endif c c process event c call hec_evt c c filter out events with bad timing (look at timing of cell with maximum c signal) c do ic = 1, i_adc_used tmp_max(ic) = adc_max_ic(ic,1) enddo call sortzv(tmp_max,ind_n,i_adc_used,1,1,0) ic_maxsig = ind_n(1) if ( tfilter_ntp .eq. 0. .or. abs(adc_max_ic(ic_maxsig,2)) + .lt. tfilter_ntp) then c c filter out events with software/hardware random triggers if c requested by user c if ( ( random_ntp.eq.0 ) .or. + ((random_ntp.eq.1).and.(.not.trig_random)) .or. + ((random_ntp.eq.2).and.(.not.trig_random_hard)) + )then c c ntuple analysis for a given event. c call hec_ntuple_evt1 c c call user event ntuple fill c if (nt_user_switch .ge. 1) call user_ntuple_block_evt1 endif endif c c handle end of event data io c call hec_io_pass_evt c i_event = i_event + 1 c endif c enddo ! enddo over events c i_event = i_event - 1 print *, ' *** events processed ', i_event c c standard ntuple analysis at end of event loop c call hec_ntuple_ana1 c c handle data io at pass end c call hec_io_pass_ter c print *, ' *** pass 1 done for standard ntuple filling' c end