gaps_online.tof.analysis#

Functions

calc_rms(data)

root mean square calculation

create_occupancy_dict([reader, events, ...])

Create a dictionary of paddle id vs nhits

distance(h0, h1)

The spatial distance between 2 TofHits

find_paddle(hit, paddles)

Get a paddle id for a trigger hit where the trigger hit is (dsi, j, ch)

Classes

TofAnalysis([skip_mangled, skip_timeout, ...])

A container (yeah I know, don't like it either) to keep a bunch of plots together.

TofCuts()

A simple container to hold a collection of TOF relevant cut values

gaps_online.tof.analysis.find_paddle(hit, paddles)#

Get a paddle id for a trigger hit where the trigger hit is (dsi, j, ch)

gaps_online.tof.analysis.distance(h0, h1) float#

The spatial distance between 2 TofHits

gaps_online.tof.analysis.create_occupancy_dict(reader=None, events=[], normalize=True, use_trigger_hits=False, mark_0_as_bad=False, cbe_side=True, cor_side=True)#

Create a dictionary of paddle id vs nhits

This can either accept a reader or a list of events. Use reader when memory is sparse and events when time is of the essence

# Arguments:
  • reader - either TofPacket or TelemetryPacketReader. The reader should be primed in a way

    that it only spits out MergedEvents, TofEventSummary or TofEvents

  • use_trigger_hits - instead of plotting TofHits, just use the triggered hits for the occupancy

  • cbe_side - add the CBE sides to the occupancy dictionary. It might make sense to exclude

    them for normalization reasons

  • cor_side - add the COR sides to the occupancy dictionary. It might make sense to exclude

    them for normalization reasons

gaps_online.tof.analysis.calc_rms(data) float#

root mean square calculation

class gaps_online.tof.analysis.TofCuts#

A simple container to hold a collection of TOF relevant cut values

__init__()#
clear_stats()#

Zero out the event/hit counter variables

property void#
is_compatible(other)#

Void cuts will autmaticaly be compatible

property acc_frac_hit_cbe#
property acc_frac_hit_cor#
property acc_frac_hit_umb#
property acc_frac_fh_is_umb#
pretty_print_efficiency()#
class gaps_online.tof.analysis.TofAnalysis(skip_mangled=True, skip_timeout=True, beta_analysis=True, nbins=90, cuts: ~gaps_online.tof.analysis.TofCuts = <TofCuts:   0 <= NHit(UMB) <= 161   0 <= NHit(CBE) <= 161   0 <= NHit(COR) <= 161>, use_offsets=False, active=False)#

A container (yeah I know, don't like it either) to keep a bunch of plots together.

This does have some use as a pre-compiled analysis for gander, and as a quick look kind of thing.

The gist here it is independent of the data source, as long as some kind of TofEvent can be plugged in.

define_bins(nbins=70)#

Set the bins for the different histograms for the variables. Only the number of bins can be set

pretty_print_statistics()#

A textual representation for some important numbers, e.g. seen events, cut efficiencies, etc.

property rate#
property rate_nocut#
property run_time#

Get run time from last - first event in seconds

reinit(nbins=90)#

Re-run the initialization routine. This will clear all plots, and reset the binning. This needs to be run in case the binning has been changed

__init__(skip_mangled=True, skip_timeout=True, beta_analysis=True, nbins=90, cuts: ~gaps_online.tof.analysis.TofCuts = <TofCuts:   0 <= NHit(UMB) <= 161   0 <= NHit(CBE) <= 161   0 <= NHit(COR) <= 161>, use_offsets=False, active=False)#

Start a new TofAnalysis. This will add create histograms for 'interesting' variables and count mangled and timed out events. While not complete, this can provide a conciese, first look for a run. Events can be added to this analysis through the .add_event(ev) method. When all events are added, a call to .finish() is needed to make sure all events in the caches are added to the histograms. Caching is used to massively improve performance, since adding individual numbers to dashi.histograms is painfully slow.

# Arguments:

skip_mangledIgnore events which have the "AnyDataMangling"

flag set

skip_timeoutIgnore events which have the "EventTimedOut"

flag set

beta_analysisLook for first hit on outer tof/inner tof and

use these for a beta calculation. If pid_outer and pid_inner are given, use these paddles instead.

nbinsThe number of bins for the histograms getting

created

cutsGive a cut instance to reject events & hits.

Default: None (no cuts)

activeif True, this analysis will actually "do something"

and acquire events

property n_mangled_frac#
property n_timed_out_frac#
fill_histograms()#

Fill the histograms with the cached values

finish()#

Ensure the remainder in the caches is histogrammed

add_event(ev)#

Fills the associated histograms

# Arguments:
  • ev : Any kind of TofEvent or TofEventSummary