Skip to content

Update Hit Finding Algorithm #8

@kmtsui

Description

@kmtsui

Below are the description of pulsing finding for the IWCD mPMTs. We will need to implement it in the waveform fitting function to get digitized Q and T.


The general description of the hit finding algorithm was shown in the presentation on the meeting on 15 February 2024. Here is this description:

  • Self-trigger is verified and triggering conditions are as follows:
    • Amplitude exceeding the threshold
    • Integral of 7 samples (preceding and following) exceeds 2x threshold
    • Local maximum
    • Sufficient period from the previous pulse
    • FIFOs are not almost full – to prevent overflow
  • Waveform windows includes eight samples before maximum
  • Window length is configurable
  • Positive polarity
  • Time is estimated using Constant Fraction Discriminator (CFD) for subsequent windows
  • Charge is estimated as the sum of eight samples around the maximum.

The extraction of related VHDL code is attached.

constant SAMPLE_NUMBER_BEFORE_MAXIMUM     : natural := 8;-- first sample number before
constant SAMPLE_NUMBER_AFTER_MAXIMUM      : natural := 7;--namber of samples after maximum kept in pipeline registers
constant INTEGRAL_PRECEDING_SAMPLE_NUMBER : natural := 2;
constant INTEGRAL_FOLLOWING_SAMPLE_NUMBER : natural := 4;
---------------------------------------------------------------
---- selected VHDL code describing the hit detection ----------


  adder_tree_v := (others => (others => (others => '0')));
  for channel in 0 to 19 loop
    -- integral computation using adder tree on moving window
    for i in SAMPLE_NUMBER_AFTER_MAXIMUM-1-INTEGRAL_PRECEDING_SAMPLE_NUMBER to SAMPLE_NUMBER_AFTER_MAXIMUM-1+INTEGRAL_FOLLOWING_SAMPLE_NUMBER loop 
      adder_tree_v(channel)(i+3-SAMPLE_NUMBER_AFTER_MAXIMUM) := adc_delay_r(i)(channel)(11) & adc_delay_r(i)(channel)(11) & adc_delay_r(i)(channel)(11) & adc_delay_r(i)(channel);
    end loop;
    -- first adder level
    for i in 0 to 3 loop
      adder_tree_v(channel)(i+8) := adder_tree_v(channel)(2*i) + adder_tree_v(channel)(2*i+1);
    end loop;
    adder_tree_v(channel)(12) := adder_tree_v(channel)(8) + adder_tree_v(channel)(9);
    adder_tree_v(channel)(13) := adder_tree_v(channel)(10) + adder_tree_v(channel)(11);
    adder_tree_v(channel)(14) := adder_tree_v(channel)(12) + adder_tree_v(channel)(13);
    sum_v(channel) := adder_tree_v(channel)(14) & "00";
  
    trigger_auto_v(channel) := '0';  
    if signed(adc_delay_r(SAMPLE_NUMBER_AFTER_MAXIMUM-1)(channel)) >= signed(adc_delay_r(SAMPLE_NUMBER_AFTER_MAXIMUM-2)(channel)) 
    and signed(adc_delay_r(SAMPLE_NUMBER_AFTER_MAXIMUM-1)(channel)) > signed(adc_delay_r(SAMPLE_NUMBER_AFTER_MAXIMUM)(channel))
    and signed(adc_delay_r(SAMPLE_NUMBER_AFTER_MAXIMUM-1)(channel)) > signed(adc_delay_r(SAMPLE_NUMBER_AFTER_MAXIMUM-3)(channel)) 
    and signed(adc_delay_r(SAMPLE_NUMBER_AFTER_MAXIMUM-1)(channel)) > signed(adc_delay_r(SAMPLE_NUMBER_AFTER_MAXIMUM+1)(channel)) 
    then
      maximum_condition_v(channel) := '1'; 
    end if;
    if signed(adc_delay_r(SAMPLE_NUMBER_AFTER_MAXIMUM-1)(channel)) > signed(integral_threshold_v(11 downto 3)) then
      amplitude_condition_v(channel) := '1'; 
    end if;
    if signed(sum_v(channel)) > signed(integral_threshold_v) then
      integral_condition_v(channel) := '1'; 
    end if;
    if estimator_r(channel).cycles_from_hit = 0 or estimator_r(channel).cycles_from_hit > config_r.hit_insensitivity_period then
      separation_condition_v(channel) := '1';
    end if;
  end loop;
  trigger_auto_v :=  maximum_condition_v and integral_condition_v and amplitude_condition_v and separation_condition_v and config_r.self_trigger_enable;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions