read_data

A basic introduction on how to read data using LegendDataManagement

First you have to load the required packages

using LegendDataManagement
using LegendHDF5IO
using TypedTables

Now you define which data set you want to read. For more information on the datasets, check out the documentation in teststand-metadata

category = DataCategory(:cal)
period = DataPeriod(3)
run = DataRun(1)
channel = ChannelId(1) # channel 1 => PPC01 in LBNL-70-141

Create LegendData object

asic = LegendData(:ppc01)

Read the "raw" tier (waveforms)

filekeys = search_disk(FileKey, asic.tier[DataTier(:raw), category , period, run])
data_raw = Table(read_ldata(asic, DataTier(:raw), filekeys, channel))
waveforms = data_raw.waveform

Read the "dsp" tier

data_dsp = Table(read_ldata(asic, DataTier(:jldsp), filekeys, channel))

this data contains many variables, like the different energy estimates such as

data_dsp.e_trap

Read the "hit" tier

data_hit = Table(read_ldata(asic, DataTier(:jlhit), filekeys, channel))

this data contains the hit information, such as the calibrated energyes and quality cuts flags

Read the "pars"

Saved parameters, can be access with the following synthax:

pars = asic.par[category].rpars

here are some example to lad specific parameters:

pars_pole_zero = pars.pz[period, run, channel]
pars_energy = pars.ecal[period, run, channel].e_trap
gamma_peaks = [pars_energy.fit[peak].fwhm for peak in [:Co60a, :Co60b]]
qc_flag =  pars.qc[period, run, channel].wvf_keep.all