e15190.neutron_wall.time_of_flight_calibration.TimeOfFlightCalibrator

class e15190.neutron_wall.time_of_flight_calibration.TimeOfFlightCalibrator(AB, run, init_rdf=True)

Functions

__init__(AB, run[, init_rdf])

collect_all_lazy(bars)

create_base_rdf([multithread])

declare_all_to_root_interpreter()

Declare all relevant functions and variables to the ROOT interpreter.

fit_bar(bar)

get_all_distance_of_flight_stats(bar[, lazy])

get_all_time_of_flight_histograms(bar[, lazy])

get_distance_of_flight_histogram(bar[, lazy])

get_distance_range(bar)

get_first_peak(x, y)

Find the first peak from the left.

get_input_path(run[, directory, filename_fmt])

get_prompt_gamma_fits(bar_tof_histos)

get_speed_of_flight_fit(prompt_gamma_fit_params)

get_stdev_distance_of_flight(bar[, lazy])

get_time_of_flight_histogram(bar[, ...])

Returns the time of flight histogram for a given bar.

save_parameters([path])

Properties

CALIB_FILE_FMT

DATABASE_DIR

DIST_RANGE_N_STEPS

DIST_RANGE_WIDTH

POS_RANGE

SPEED_OF_LIGHT_IN_AIR

__init__(AB, run, init_rdf=True)
declare_all_to_root_interpreter()

Declare all relevant functions and variables to the ROOT interpreter.

Functions that are declared are:
  • GetPositionParam0(bar)

  • GetPositionParam1(bar)

  • GetDistParam0(bar)

  • GetDistParam1(bar)

  • GetDistParam2(bar)

  • GetPosition(time_L, time_R, p0, p1)

  • GetDistance(pos, p0, p1, p2)

This function is called only when ROOT_DECLARED is False. The variable is set to True after this function is called. To call this function again, user have to set ROOT_DECLARED to False manually, though such action would most likely cause an error in the ROOT interpreter due to multiple declarations.

Parameters
  • p0 (np.array) – Array of intercepts. The indices have to match the bar numbers. Pad with zeros if necessary.

  • p1 (np.array) – Array of slopes. The indices have to match the bar numbers. Pad with zeros if necessary.

get_time_of_flight_histogram(bar: int, dist_cut: Optional[Tuple[str, str]] = None, lazy: bool = True)

Returns the time of flight histogram for a given bar.

Parameters
  • bar (int) – Bar number.

  • dist_cut (2-tuple of strings, default None) – Optional distance cut. When provided, it is user’s responsibility to ensure there is non-zero count after the cut. Default is None, where no cut is applied.

  • lazy (bool, default True) – If True, return a lazy result pointer to the histogram. If False, return the histogram instantly.

Returns

histogram – The time-of-flight spectrum.

Return type

RResultPtr or TH1D

static get_first_peak(x, y)

Find the first peak from the left.

Useful when locating the prompt gamma peak in a time-of-flight spectrum.