subroutine hec_his_evt_hfill_ch(ic) c c fill histograms for a particular channel (ic) c implicit none c include'hec_par.inc' ! shared parameters include'hec_adc.inc' ! adc values common include'hec_cal.inc' ! calibration common include'hec_hvstat.inc' ! hv status and correction include'hec_datacard.inc' ! datacard values include'hec_evth.inc' ! event header common include'hec_fadc.inc' ! trigger flash adc common include'hec_geo.inc' ! geometry correspondance tables include'hec_his_sys.inc' ! histo ids, etc. include'hec_max.inc' ! max adc and time include'hec_ped.inc' ! pedestal values include'hec_runh.inc' ! run header common include'hec_tdc.inc' ! tdc values common include'hec_trig.inc' ! trigger values c c local variables c integer ic real sig integer i_t, i_z, id, nid, nid3, ibin c real maxns c c make useful variable (max-ped) c sig = adc_max_ic(ic,1) if (ic .eq. 1) nid = 0 c c fill histograms type 2 -- geometric energy distribution c if (histo_switch(2) .eq. 1) then c c accumulate moments to later fill histo containing average maximum for c each channel c maxmom(ic,1) = maxmom(ic,1) + 1.d0 maxmom(ic,2) = maxmom(ic,2) + dble(adc_max_ic(ic,1)) maxmom(ic,3) = maxmom(ic,3) + dble(adc_max_ic(ic,1)**2) c c sum adc(max)-ped for each tower depth c i_z = ictoph(ic,3) if (i_z .gt. 0) then sig_sum(i_z) = sig_sum(i_z) + sig endif c endif c c fill histograms type 3 -- no tdc, no calib c if (histo_switch(3) .eq. 1) then c c adc(max)-ped histograms for each channel c id = id_adc_ic + ic call hff1(id, nid, sig, 1.) c c time(max) histograms for each channel for 1997 and later c if (irunpd .ge. 4) then id = id_tim_ic + ic call hfill(id, adc_max_ic(ic, 2),0., 1.) endif c c accumulate moments for time profile c do i_t = 1, i_tim_used adcmom(ic,i_t,1) = adcmom(ic,i_t,1) + 1.d0 adcmom(ic,i_t,2) = adcmom(ic,i_t,2) + + dble(real(i_adc_ic_t(ic, i_t))) adcmom(ic,i_t,3) = adcmom(ic,i_t,3) + + dble(real(i_adc_ic_t(ic, i_t)))**2 enddo endif c c fill histogram type 4 -- tdc corrected histos c if (histo_switch(4) .eq. 1) then c c time(max) histograms with TDC correction (1997 and later) c if (irunpd .ge. 4) then c c tdc corrected time max only makes sense for cubic fit c if (m_pref .eq. 1) then if (i_event .eq. 1) nid3 = 0 id = id_tim_icns + ic maxns = adc_max_ic(ic,2) call hff1(id, nid3, maxns + tdc_ns, 1.) endif c c accumulate moments to later fill time profile histograms c do i_t = 1,i_tim_used ibin = int((i_t-1)*25. + (tdc_ns)) if (ibin .ge. 1 .and. ibin .le. ntdc_bin) then tdcmom(ic,ibin,1) = tdcmom(ic,ibin,1) + 1.d0 tdcmom(ic,ibin,2) = tdcmom(ic,ibin,2) + + dble(i_adc_ic_t(ic,i_t)) tdcmom(ic,ibin,3) = tdcmom(ic,ibin,3) + + dble(i_adc_ic_t(ic,i_t))**2 endif enddo endif endif c c fill histograms type 5 -- calibrated energy c if (histo_switch(5) .eq. 1) then c c fill histograms of energy in nA for each channel, c id = id_cal_ic + ic call hfill(id, hec_cal_ic(ic), 0., 1.) c c tabulate sums for energy histograms with maximums above certain c sigma cut from peds, plus the same after HV correction, when c HV infos available and good calibration c if(ic_has_calib(ic))then i_z = ictoph(ic,3) if (i_z .gt. 0) then if ((adc_max_ic(ic,1) - adc_rms_evt(ic)) .gt. 0)then sum_sigma(1) = sum_sigma(1) + + depthw_na(i_z)*hec_cal_ic(ic) if(ic_hv_known(ic))then sum_sigma_hv(1) = sum_sigma_hv(1) + + depthw_na(i_z)*hec_cal_ic(ic)*ic_hv_cor(ic) endif endif if ((adc_max_ic(ic,1) - 2.*adc_rms_evt(ic)) .gt. 0)then sum_sigma(2) = sum_sigma(2) + + depthw_na(i_z)*hec_cal_ic(ic) if(ic_hv_known(ic))then sum_sigma_hv(2) = sum_sigma_hv(2) + + depthw_na(i_z)*hec_cal_ic(ic)*ic_hv_cor(ic) endif endif if ((adc_max_ic(ic,1) - 3.*adc_rms_evt(ic)) .gt. 0)then sum_sigma(3) = sum_sigma(3) + + depthw_na(i_z)*hec_cal_ic(ic) if(ic_hv_known(ic))then sum_sigma_hv(3) = sum_sigma_hv(3) + + depthw_na(i_z)*hec_cal_ic(ic)*ic_hv_cor(ic) endif endif endif endif endif c end